diff --git a/.gitignore b/.gitignore index 7092a568ba2a2..f3784ee198240 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,8 @@ atlassian* /package.json /.php_cs /.php_cs.cache +/.php-cs-fixer.php +/.php-cs-fixer.cache /grunt-config.json /pub/media/*.* !/pub/media/.htaccess diff --git a/.php_cs.dist b/.php-cs-fixer.dist.php similarity index 88% rename from .php_cs.dist rename to .php-cs-fixer.dist.php index 4c1c9091d54ca..30fcfc86de059 100644 --- a/.php_cs.dist +++ b/.php-cs-fixer.dist.php @@ -21,8 +21,8 @@ ->exclude('setup/vendor') ->exclude('var'); -return PhpCsFixer\Config::create() - ->setFinder($finder) +$config = new PhpCsFixer\Config(); +$config->setFinder($finder) ->setRules([ '@PSR2' => true, 'array_syntax' => ['syntax' => 'short'], @@ -30,11 +30,11 @@ 'include' => true, 'new_with_braces' => true, 'no_empty_statement' => true, - 'no_extra_consecutive_blank_lines' => true, + 'no_extra_blank_lines' => true, 'no_leading_import_slash' => true, 'no_leading_namespace_whitespace' => true, 'no_multiline_whitespace_around_double_arrow' => true, - 'no_multiline_whitespace_before_semicolons' => true, + 'multiline_whitespace_before_semicolons' => true, 'no_singleline_whitespace_before_semicolons' => true, 'no_trailing_comma_in_singleline_array' => true, 'no_unused_imports' => true, @@ -44,3 +44,4 @@ 'standardize_not_equals' => true, 'ternary_operator_spaces' => true, ]); +return $config; diff --git a/app/code/Magento/Backend/Test/Mftf/ActionGroup/WebSetup/GoToWebSetupPageActionGroup.xml b/app/code/Magento/Backend/Test/Mftf/ActionGroup/WebSetup/GoToWebSetupPageActionGroup.xml new file mode 100644 index 0000000000000..2d0e39c72aff3 --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/ActionGroup/WebSetup/GoToWebSetupPageActionGroup.xml @@ -0,0 +1,20 @@ + + + + + + + Go to the Web Setup Page + + + + + + + + diff --git a/app/code/Magento/Backend/Test/Mftf/ActionGroup/WebSetup/WebSetupShowLandingSectionActionGroup.xml b/app/code/Magento/Backend/Test/Mftf/ActionGroup/WebSetup/WebSetupShowLandingSectionActionGroup.xml new file mode 100644 index 0000000000000..905ec666c79a2 --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/ActionGroup/WebSetup/WebSetupShowLandingSectionActionGroup.xml @@ -0,0 +1,18 @@ + + + + + + + Action for showing landing section and closing license section on Web Setup Page + + + + + + diff --git a/app/code/Magento/Backend/Test/Mftf/ActionGroup/WebSetup/WebSetupShowLicenseSectionActionGroup.xml b/app/code/Magento/Backend/Test/Mftf/ActionGroup/WebSetup/WebSetupShowLicenseSectionActionGroup.xml new file mode 100644 index 0000000000000..e12c421c9078c --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/ActionGroup/WebSetup/WebSetupShowLicenseSectionActionGroup.xml @@ -0,0 +1,18 @@ + + + + + + + Action for showing license section on Web Setup Page + + + + + + diff --git a/app/code/Magento/Backend/Test/Mftf/Page/WebSetup/WebSetupPage.xml b/app/code/Magento/Backend/Test/Mftf/Page/WebSetup/WebSetupPage.xml new file mode 100644 index 0000000000000..1524f3a552115 --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/Page/WebSetup/WebSetupPage.xml @@ -0,0 +1,14 @@ + + + + + +
+
+ + diff --git a/app/code/Magento/Backend/Test/Mftf/Section/WebSetup/WebSetupPageLandingSection.xml b/app/code/Magento/Backend/Test/Mftf/Section/WebSetup/WebSetupPageLandingSection.xml new file mode 100644 index 0000000000000..efeb5a8bf8034 --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/Section/WebSetup/WebSetupPageLandingSection.xml @@ -0,0 +1,17 @@ + + + + +
+ + + + + +
+
diff --git a/app/code/Magento/Backend/Test/Mftf/Section/WebSetup/WebSetupPageLicenseSection.xml b/app/code/Magento/Backend/Test/Mftf/Section/WebSetup/WebSetupPageLicenseSection.xml new file mode 100644 index 0000000000000..b810e28dc5802 --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/Section/WebSetup/WebSetupPageLicenseSection.xml @@ -0,0 +1,15 @@ + + + + +
+ + + +
+
diff --git a/app/code/Magento/Backend/Test/Mftf/Test/WebSetup/WebSetupPageTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/WebSetup/WebSetupPageTest.xml new file mode 100644 index 0000000000000..4d338a5553065 --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/Test/WebSetup/WebSetupPageTest.xml @@ -0,0 +1,31 @@ + + + + + + + + + + <description value="Setup Magento via Web Interface should show only landing section with logo, version, and welcome and licence section"/> + <severity value="MAJOR"/> + </annotations> + <actionGroup ref="GoToWebSetupPageActionGroup" stepKey="goToWebSetupPage"/> + <seeElement selector="{{WebSetupPageLandingSection.section}}" stepKey="assertLandingSectionVisibleInSetupPage"/> + <dontSeeElement selector="{{WebSetupPageLicenseSection.section}}" stepKey="assertLicenseSectionInvisibleInSetupPage"/> + <seeElement selector="{{WebSetupPageLandingSection.logo}}" stepKey="assertSetupPageLogoVisibleInSetupPage"/> + <seeElement selector="{{WebSetupPageLandingSection.version}}" stepKey="assertVersionVisibleInSetupPage"/> + <seeElement selector="{{WebSetupPageLandingSection.welcome}}" stepKey="assertWelcomeVisibleInSetupPage"/> + <actionGroup ref="WebSetupShowLicenseSectionActionGroup" stepKey="showLicense"/> + <seeElement selector="{{WebSetupPageLicenseSection.section}}" stepKey="assertLicenseSectionVisibleInSetupPage"/> + <dontSeeElement selector="{{WebSetupPageLandingSection.section}}" stepKey="assertLandingSectionInvisibleInSetupPage"/> + <actionGroup ref="WebSetupShowLandingSectionActionGroup" stepKey="goBackToLanding"/> + <seeElement selector="{{WebSetupPageLandingSection.section}}" stepKey="assertLandingSectionVisibleAfterGoingBackFromLicenseSection"/> + <dontSeeElement selector="{{WebSetupPageLicenseSection.section}}" stepKey="assertLicenseSectionInvisibleAfterGoingBackFromLicenseSection"/> + </test> +</tests> diff --git a/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Group/SaveTest.php b/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Group/SaveTest.php index 7fd6806013efd..3af52a0fadf09 100644 --- a/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Group/SaveTest.php +++ b/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Group/SaveTest.php @@ -34,55 +34,55 @@ class SaveTest extends TestCase { /** @var Save */ - protected $controller; + private $controller; /** @var Context|MockObject */ - protected $contextMock; + private $contextMock; /** @var Registry|MockObject */ - protected $registryMock; + private $registryMock; /** @var GroupRepositoryInterface|MockObject */ - protected $groupRepositoryMock; + private $groupRepositoryMock; /** @var GroupInterfaceFactory|MockObject */ - protected $groupInterfaceFactoryMock; + private $groupInterfaceFactoryMock; /** @var ForwardFactory|MockObject */ - protected $forwardFactoryMock; + private $forwardFactoryMock; /** @var PageFactory|MockObject */ - protected $pageFactoryMock; + private $pageFactoryMock; /** @var DataObjectProcessor|MockObject */ - protected $dataObjectProcessorMock; + private $dataObjectProcessorMock; /** @var RequestInterface|MockObject */ - protected $request; + private $requestMock; /** @var RedirectFactory|MockObject */ - protected $resultRedirectFactory; + private $resultRedirectFactoryMock; /** @var Redirect|MockObject */ - protected $resultRedirect; + private $resultRedirectMock; /** @var ManagerInterface|MockObject */ - protected $messageManager; + private $messageManagerMock; /** @var Forward|MockObject */ - protected $resultForward; + private $resultForwardMock; /** @var GroupInterface|MockObject */ - protected $group; + private $groupMock; /** @var Session|MockObject */ - protected $session; + private $sessionMock; - /** @var GroupExtensionInterfaceFactory $groupExtensionInterfaceFactory|MockObject */ - private $groupExtensionInterfaceFactory; + /** @var GroupExtensionInterfaceFactory|MockObject $groupExtensionFactoryMock */ + private $groupExtensionFactoryMock; - /** @var GroupExtension/MockObject */ - private $groupExtension; + /** @var GroupExtension|MockObject */ + private $groupExtensionMock; protected function setUp(): void { @@ -106,46 +106,47 @@ protected function setUp(): void $this->dataObjectProcessorMock = $this->getMockBuilder(DataObjectProcessor::class) ->disableOriginalConstructor() ->getMock(); - $this->request = $this->getMockBuilder(RequestInterface::class) + $this->requestMock = $this->getMockBuilder(RequestInterface::class) ->getMockForAbstractClass(); - $this->resultRedirectFactory = $this->getMockBuilder(RedirectFactory::class) + $this->resultRedirectFactoryMock = $this->getMockBuilder(RedirectFactory::class) ->disableOriginalConstructor() ->getMock(); - $this->resultRedirect = $this->getMockBuilder(Redirect::class) + $this->resultRedirectMock = $this->getMockBuilder(Redirect::class) ->disableOriginalConstructor() ->getMock(); - $this->messageManager = $this->getMockBuilder(ManagerInterface::class) + $this->messageManagerMock = $this->getMockBuilder(ManagerInterface::class) ->getMockForAbstractClass(); - $this->resultForward = $this->getMockBuilder(Forward::class) + $this->resultForwardMock = $this->getMockBuilder(Forward::class) ->disableOriginalConstructor() ->getMock(); - $this->group = $this->getMockBuilder(GroupInterface::class) + $this->groupMock = $this->getMockBuilder(GroupInterface::class) ->setMethods(['setExtensionAttributes']) ->getMockForAbstractClass(); - $this->session = $this->getMockBuilder(Session::class) + $this->sessionMock = $this->getMockBuilder(Session::class) ->disableOriginalConstructor() ->setMethods(['setCustomerGroupData']) ->getMock(); - $this->groupExtensionInterfaceFactory = $this->getMockBuilder(GroupExtensionInterfaceFactory::class) + $this->groupExtensionFactoryMock = $this->getMockBuilder(GroupExtensionInterfaceFactory::class) ->setMethods(['create']) ->disableOriginalConstructor() ->getMockForAbstractClass(); - $this->groupExtension = $this->getMockBuilder(GroupExtension::class) + $this->groupExtensionMock = $this->getMockBuilder(GroupExtension::class) + ->addMethods(['setExcludeWebsiteIds']) ->disableOriginalConstructor() ->getMock(); $this->contextMock->expects(self::once()) ->method('getMessageManager') - ->willReturn($this->messageManager); + ->willReturn($this->messageManagerMock); $this->contextMock->expects(self::once()) ->method('getRequest') - ->willReturn($this->request); + ->willReturn($this->requestMock); $this->contextMock->expects(self::once()) ->method('getResultRedirectFactory') - ->willReturn($this->resultRedirectFactory); + ->willReturn($this->resultRedirectFactoryMock); $this->contextMock->expects(self::once()) ->method('getSession') - ->willReturn($this->session); + ->willReturn($this->sessionMock); $this->controller = new Save( $this->contextMock, @@ -155,7 +156,7 @@ protected function setUp(): void $this->forwardFactoryMock, $this->pageFactoryMock, $this->dataObjectProcessorMock, - $this->groupExtensionInterfaceFactory + $this->groupExtensionFactoryMock ); } @@ -165,7 +166,7 @@ public function testExecuteWithTaxClassAndException(): void $groupId = 0; $code = 'NOT LOGGED IN'; - $this->request->method('getParam') + $this->requestMock->method('getParam') ->willReturnMap( [ ['tax_class', null, $taxClass], @@ -174,73 +175,73 @@ public function testExecuteWithTaxClassAndException(): void ['customer_group_excluded_websites', null, ''] ] ); - $this->groupExtensionInterfaceFactory->expects(self::once()) + $this->groupExtensionFactoryMock->expects(self::once()) ->method('create') - ->willReturn($this->groupExtension); - $this->groupExtension->expects(self::once()) + ->willReturn($this->groupExtensionMock); + $this->groupExtensionMock->expects(self::once()) ->method('setExcludeWebsiteIds') ->with([]) ->willReturnSelf(); - $this->group->expects(self::once()) + $this->groupMock->expects(self::once()) ->method('setExtensionAttributes') - ->with($this->groupExtension) + ->with($this->groupExtensionMock) ->willReturnSelf(); - $this->resultRedirectFactory->expects($this->once()) + $this->resultRedirectFactoryMock->expects($this->once()) ->method('create') - ->willReturn($this->resultRedirect); + ->willReturn($this->resultRedirectMock); $this->groupRepositoryMock->expects($this->once()) ->method('getById') ->with($groupId) - ->willReturn($this->group); - $this->group->expects(self::once()) + ->willReturn($this->groupMock); + $this->groupMock->expects(self::once()) ->method('getCode') ->willReturn($code); - $this->group->expects(self::once()) + $this->groupMock->expects(self::once()) ->method('setCode') ->with($code); - $this->group->expects(self::once()) + $this->groupMock->expects(self::once()) ->method('setTaxClassId') ->with($taxClass); $this->groupRepositoryMock->expects(self::once()) ->method('save') - ->with($this->group); - $this->messageManager->expects(self::once()) + ->with($this->groupMock); + $this->messageManagerMock->expects(self::once()) ->method('addSuccessMessage') ->with(__('You saved the customer group.')); $exception = new \Exception('Exception'); - $this->resultRedirect->expects(self::at(0)) + $this->resultRedirectMock->expects(self::at(0)) ->method('setPath') ->with('customer/group') ->willThrowException($exception); - $this->messageManager->expects(self::once()) + $this->messageManagerMock->expects(self::once()) ->method('addErrorMessage') ->with('Exception'); $this->dataObjectProcessorMock->expects(self::once()) ->method('buildOutputDataArray') - ->with($this->group, GroupInterface::class) + ->with($this->groupMock, GroupInterface::class) ->willReturn(['code' => $code]); - $this->session->expects(self::once()) + $this->sessionMock->expects(self::once()) ->method('setCustomerGroupData') ->with(['customer_group_code' => $code]); - $this->resultRedirect->expects(self::at(1)) + $this->resultRedirectMock->expects(self::at(1)) ->method('setPath') ->with('customer/group/edit', ['id' => $groupId]); - self::assertSame($this->resultRedirect, $this->controller->execute()); + self::assertSame($this->resultRedirectMock, $this->controller->execute()); } public function testExecuteWithoutTaxClass(): void { - $this->request->expects(self::once()) + $this->requestMock->expects(self::once()) ->method('getParam') ->with('tax_class') ->willReturn(null); $this->forwardFactoryMock->expects(self::once()) ->method('create') - ->willReturn($this->resultForward); - $this->resultForward->expects(self::once()) + ->willReturn($this->resultForwardMock); + $this->resultForwardMock->expects(self::once()) ->method('forward') ->with('new') ->willReturnSelf(); - self::assertSame($this->resultForward, $this->controller->execute()); + self::assertSame($this->resultForwardMock, $this->controller->execute()); } } diff --git a/app/code/Magento/Customer/Test/Unit/Model/Plugin/SaveCustomerGroupExcludedWebsiteTest.php b/app/code/Magento/Customer/Test/Unit/Model/Plugin/SaveCustomerGroupExcludedWebsiteTest.php index b6c7cedbb4285..5c1743be83f4d 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Plugin/SaveCustomerGroupExcludedWebsiteTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Plugin/SaveCustomerGroupExcludedWebsiteTest.php @@ -10,14 +10,14 @@ use Magento\Catalog\Model\Indexer\Product\Price\Processor; use Magento\Customer\Api\Data\GroupExtensionInterface; use Magento\Customer\Api\Data\GroupInterface; -use Magento\Customer\Api\GroupRepositoryInterface; use Magento\Customer\Api\GroupExcludedWebsiteRepositoryInterface; +use Magento\Customer\Api\GroupRepositoryInterface; use Magento\Customer\Model\Data\GroupExcludedWebsite; use Magento\Customer\Model\Data\GroupExcludedWebsiteFactory; use Magento\Customer\Model\Plugin\SaveCustomerGroupExcludedWebsite; -use Magento\Customer\Model\ResourceModel\GroupExcludedWebsite as GroupExcludedWebsiteResourceModel; +use Magento\Framework\Exception\CouldNotSaveException; +use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Indexer\IndexerInterface; -use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Magento\Store\Model\System\Store; use Magento\Store\Model\Website; use PHPUnit\Framework\MockObject\MockObject; @@ -28,134 +28,125 @@ class SaveCustomerGroupExcludedWebsiteTest extends TestCase /** * @var GroupInterface|MockObject */ - private $groupInterface; + private $groupMock; /** * @var GroupExtensionInterface|MockObject */ - private $groupExtensionInterface; + private $groupExtensionMock; /** * @var GroupRepositoryInterface|MockObject */ - private $groupRepositoryInterface; + private $groupRepositoryMock; /** * @var GroupExcludedWebsiteFactory|MockObject */ - private $groupExcludedWebsiteFactory; + private $groupExcludedWebsiteFactoryMock; /** * @var GroupExcludedWebsite|MockObject */ - private $groupExcludedWebsite; + private $groupExcludedWebsiteMock; /** * @var GroupExcludedWebsiteRepositoryInterface|MockObject */ - private $groupExcludedWebsiteRepository; - - /** - * @var GroupExcludedWebsiteResourceModel|MockObject - */ - private $groupExcludedWebsiteResourceModel; + private $groupExcludedWebsiteRepositoryMock; /** * @var Store|MockObject */ - private $store; + private $storeMock; /** * @var Processor|MockObject */ - private $priceIndexProcessor; + private $priceIndexProcessorMock; /** * @var IndexerInterface */ - private $priceIndexer; + private $priceIndexerMock; /** - * @var SaveCustomerGroupExcludedWebsite + * @var SaveCustomerGroupExcludedWebsite */ private $plugin; protected function setUp(): void { - $objectManagerHelper = new ObjectManager($this); - - $this->groupExcludedWebsiteFactory = $this->getMockBuilder(GroupExcludedWebsiteFactory::class) + $this->groupExcludedWebsiteFactoryMock = $this->getMockBuilder(GroupExcludedWebsiteFactory::class) ->setMethods(['create']) ->disableOriginalConstructor() ->getMock(); - $this->groupExcludedWebsiteRepository = $this->getMockForAbstractClass( + $this->groupExcludedWebsiteRepositoryMock = $this->getMockForAbstractClass( GroupExcludedWebsiteRepositoryInterface::class ); - $this->groupExcludedWebsiteResourceModel = $this->createMock(GroupExcludedWebsiteResourceModel::class); - $this->groupExcludedWebsite = $this->getMockBuilder(GroupExcludedWebsite::class) + $this->groupExcludedWebsiteMock = $this->getMockBuilder(GroupExcludedWebsite::class) ->disableOriginalConstructor() ->getMock(); - $this->groupRepositoryInterface = $this->getMockBuilder(GroupRepositoryInterface::class) + $this->groupRepositoryMock = $this->getMockBuilder(GroupRepositoryInterface::class) ->disableOriginalConstructor() ->getMockForAbstractClass(); - $this->groupInterface = $this->getMockBuilder(GroupInterface::class) + $this->groupMock = $this->getMockBuilder(GroupInterface::class) ->disableOriginalConstructor() ->getMockForAbstractClass(); - $this->groupExtensionInterface = $this->getMockBuilder(GroupExtensionInterface::class) + $this->groupExtensionMock = $this->getMockBuilder(GroupExtensionInterface::class) + ->addMethods(['getExcludeWebsiteIds']) ->disableOriginalConstructor() ->getMockForAbstractClass(); - $this->groupInterface->method('getExtensionAttributes') - ->willReturn($this->groupExtensionInterface); - $this->groupInterface->method('getId')->willReturn(1); - $this->store = $this->createPartialMock( + $this->groupMock->method('getExtensionAttributes') + ->willReturn($this->groupExtensionMock); + $this->groupMock->method('getId')->willReturn(1); + + $this->storeMock = $this->createPartialMock( Store::class, ['getWebsiteCollection', 'getGroupCollection', 'getStoreCollection'] ); - $this->priceIndexProcessor = $this->getMockBuilder(Processor::class) + $this->priceIndexProcessorMock = $this->getMockBuilder(Processor::class) ->disableOriginalConstructor() ->getMock(); - $this->priceIndexer = $this->getMockBuilder(IndexerInterface::class) + $this->priceIndexerMock = $this->getMockBuilder(IndexerInterface::class) ->getMockForAbstractClass(); - $this->plugin = $objectManagerHelper->getObject( - SaveCustomerGroupExcludedWebsite::class, - [ - 'groupExcludedWebsiteFactory' => $this->groupExcludedWebsiteFactory, - 'groupExcludedWebsiteRepository' => $this->groupExcludedWebsiteRepository, - 'systemStore' => $this->store, - 'priceIndexProcessor' => $this->priceIndexProcessor - ] + $this->plugin = new SaveCustomerGroupExcludedWebsite( + $this->groupExcludedWebsiteFactoryMock, + $this->groupExcludedWebsiteRepositoryMock, + $this->storeMock, + $this->priceIndexProcessorMock ); } public function testAfterSaveWithoutExtensionAttributes(): void { - $this->groupExtensionInterface->method('getExcludeWebsiteIds')->willReturn(null); - $this->groupInterface->expects(self::never())->method('getId'); + $this->groupExtensionMock->method('getExcludeWebsiteIds')->willReturn(null); + $this->groupMock->expects(self::never())->method('getId'); - $this->plugin->afterSave($this->groupRepositoryInterface, $this->groupInterface, $this->groupInterface); + $this->plugin->afterSave($this->groupRepositoryMock, $this->groupMock, $this->groupMock); } /** * @dataProvider dataProviderNoExcludedWebsitesChanged * @param array $excludedWebsites * @param array $websitesToExclude - * @throws \Magento\Framework\Exception\CouldNotSaveException - * @throws \Magento\Framework\Exception\LocalizedException + * @throws CouldNotSaveException + * @throws LocalizedException */ public function testAfterSaveWithNoExcludedWebsitesChanged(array $excludedWebsites, array $websitesToExclude): void { $this->getAllWebsites(); - $this->groupExtensionInterface->method('getExcludeWebsiteIds')->willReturn($websitesToExclude); - $this->groupExcludedWebsiteRepository->method('getCustomerGroupExcludedWebsites') + $this->groupExtensionMock->method('getExcludeWebsiteIds')->willReturn($websitesToExclude); + $this->groupExcludedWebsiteRepositoryMock->method('getCustomerGroupExcludedWebsites') ->with(1)->willReturn($excludedWebsites); - $this->groupExcludedWebsiteRepository->expects(self::never())->method('delete'); - $this->groupExcludedWebsiteFactory->expects(self::never())->method('create'); + $this->groupExcludedWebsiteRepositoryMock->expects(self::never())->method('delete'); + $this->groupExcludedWebsiteFactoryMock->expects(self::never())->method('create'); - $this->plugin->afterSave($this->groupRepositoryInterface, $this->groupInterface, $this->groupInterface); + $this->plugin->afterSave($this->groupRepositoryMock, $this->groupMock, $this->groupMock); } /** @@ -163,8 +154,8 @@ public function testAfterSaveWithNoExcludedWebsitesChanged(array $excludedWebsit * @param array $excludedWebsites * @param array $websitesToExclude * @param int $times - * @throws \Magento\Framework\Exception\CouldNotSaveException - * @throws \Magento\Framework\Exception\LocalizedException + * @throws CouldNotSaveException + * @throws LocalizedException */ public function testAfterSaveWithExcludedWebsitesChanged( array $excludedWebsites, @@ -173,28 +164,28 @@ public function testAfterSaveWithExcludedWebsitesChanged( ): void { $this->getAllWebsites(); - $this->groupExtensionInterface->method('getExcludeWebsiteIds')->willReturn($websitesToExclude); - $this->groupExcludedWebsiteRepository->method('getCustomerGroupExcludedWebsites') + $this->groupExtensionMock->method('getExcludeWebsiteIds')->willReturn($websitesToExclude); + $this->groupExcludedWebsiteRepositoryMock->method('getCustomerGroupExcludedWebsites') ->with(1)->willReturn($excludedWebsites); - $this->groupExcludedWebsiteRepository->expects(self::once())->method('delete'); - $this->groupExcludedWebsiteFactory->expects(self::exactly($times)) - ->method('create')->willReturn($this->groupExcludedWebsite); - $this->groupExcludedWebsite->expects(self::exactly($times)) + $this->groupExcludedWebsiteRepositoryMock->expects(self::once())->method('delete'); + $this->groupExcludedWebsiteFactoryMock->expects(self::exactly($times)) + ->method('create')->willReturn($this->groupExcludedWebsiteMock); + $this->groupExcludedWebsiteMock->expects(self::exactly($times)) ->method('setGroupId') ->with(1) ->willReturnSelf(); - $this->groupExcludedWebsite->expects(self::exactly($times)) + $this->groupExcludedWebsiteMock->expects(self::exactly($times)) ->method('setExcludedWebsiteId')->willReturnSelf(); - $this->groupExcludedWebsiteRepository->expects(self::exactly($times)) + $this->groupExcludedWebsiteRepositoryMock->expects(self::exactly($times)) ->method('save') - ->willReturn($this->groupExcludedWebsiteResourceModel); + ->willReturn($this->groupExcludedWebsiteMock); - $this->priceIndexProcessor->expects(self::once())->method('getIndexer') - ->willReturn($this->priceIndexer); - $this->priceIndexer->expects(self::once())->method('invalidate') + $this->priceIndexProcessorMock->expects(self::once())->method('getIndexer') + ->willReturn($this->priceIndexerMock); + $this->priceIndexerMock->expects(self::once())->method('invalidate') ->willReturnSelf(); - $this->plugin->afterSave($this->groupRepositoryInterface, $this->groupInterface, $this->groupInterface); + $this->plugin->afterSave($this->groupRepositoryMock, $this->groupMock, $this->groupMock); } private function getAllWebsites(): void @@ -207,7 +198,7 @@ private function getAllWebsites(): void ->setMethods(['getWebsiteId']) ->disableOriginalConstructor() ->getMock(); - $this->store->expects(self::once())->method('getWebsiteCollection') + $this->storeMock->expects(self::once())->method('getWebsiteCollection') ->willReturn([$websiteMock1, $websiteMock2]); $websiteMock1->method('getWebsiteId')->willReturn(1); $websiteMock2->method('getWebsiteId')->willReturn(2); @@ -222,7 +213,8 @@ public function dataProviderNoExcludedWebsitesChanged(): array { return [ [ - [], [] + [], + [] ], [ ['1', '2'], diff --git a/app/code/Magento/Customer/Test/Unit/Observer/CatalogRule/AddCustomerGroupExcludedWebsiteTest.php b/app/code/Magento/Customer/Test/Unit/Observer/CatalogRule/AddCustomerGroupExcludedWebsiteTest.php index 2d430975d1f13..77b7359d2d186 100644 --- a/app/code/Magento/Customer/Test/Unit/Observer/CatalogRule/AddCustomerGroupExcludedWebsiteTest.php +++ b/app/code/Magento/Customer/Test/Unit/Observer/CatalogRule/AddCustomerGroupExcludedWebsiteTest.php @@ -19,59 +19,58 @@ class AddCustomerGroupExcludedWebsiteTest extends TestCase { /** @var GroupExcludedWebsiteRepositoryInterface|MockObject */ - private $groupExcludedWebsiteRepository; + private $groupExcludedWebsiteRepositoryMock; /** @var Collection */ - private $ruleCollection; + private $ruleCollectionMock; /** @var Rule */ - private $rule; + private $ruleMock; /** @var RuleExtension */ - private $ruleExtension; + private $ruleExtensionMock; /** @var Observer */ - private $observer; + private $observerMock; /** @var AddCustomerGroupExcludedWebsite */ - protected $addCustomerGroupExcludedWebsiteObserver; + private $observer; protected function setUp(): void { - $this->groupExcludedWebsiteRepository = $this->getMockBuilder(GroupExcludedWebsiteRepositoryInterface::class) + $this->groupExcludedWebsiteRepositoryMock = $this->getMockBuilder(GroupExcludedWebsiteRepositoryInterface::class) ->getMockForAbstractClass(); - $this->observer = $this->getMockBuilder(Observer::class) + $this->observerMock = $this->getMockBuilder(Observer::class) ->disableOriginalConstructor() ->getMock(); - $this->ruleCollection = $this->getMockBuilder(Collection::class) + $this->ruleCollectionMock = $this->getMockBuilder(Collection::class) ->disableOriginalConstructor() ->getMock(); - $this->rule = $this->getMockBuilder(Rule::class) + $this->ruleMock = $this->getMockBuilder(Rule::class) ->disableOriginalConstructor() ->getMock(); - $this->ruleExtension = $this->getMockBuilder(RuleExtension::class) + $this->ruleExtensionMock = $this->getMockBuilder(RuleExtension::class) + ->addMethods(['setExcludeWebsiteIds']) ->disableOriginalConstructor() ->getMock(); - $this->observer->expects(self::atLeastOnce()) + $this->observerMock->expects(self::atLeastOnce()) ->method('getData') - ->willReturn($this->ruleCollection); + ->willReturn($this->ruleCollectionMock); - $this->addCustomerGroupExcludedWebsiteObserver = new AddCustomerGroupExcludedWebsite( - $this->groupExcludedWebsiteRepository - ); + $this->observer = new AddCustomerGroupExcludedWebsite($this->groupExcludedWebsiteRepositoryMock); } public function testExecuteWithoutCatalogRules(): void { - $this->ruleCollection->expects(self::once()) + $this->ruleCollectionMock->expects(self::once()) ->method('getItems') ->willReturn([]); - $this->groupExcludedWebsiteRepository->expects(self::never()) + $this->groupExcludedWebsiteRepositoryMock->expects(self::never()) ->method('getAllExcludedWebsites') ->willReturn([]); - $this->addCustomerGroupExcludedWebsiteObserver->execute($this->observer); + $this->observer->execute($this->observerMock); } public function testExecuteWithCustomerGroupExcludedWebsites(): void @@ -80,33 +79,33 @@ public function testExecuteWithCustomerGroupExcludedWebsites(): void 1 => [2], 3 => [1] ]; - $this->ruleCollection->expects(self::once()) + $this->ruleCollectionMock->expects(self::once()) ->method('getItems') - ->willReturn([$this->rule]); + ->willReturn([$this->ruleMock]); - $this->groupExcludedWebsiteRepository->expects(self::once()) + $this->groupExcludedWebsiteRepositoryMock->expects(self::once()) ->method('getAllExcludedWebsites') ->willReturn($excludedWebsites); - $this->rule->expects(self::once()) + $this->ruleMock->expects(self::once()) ->method('getIsActive') ->willReturn(true); - $this->rule->expects(self::once()) + $this->ruleMock->expects(self::once()) ->method('getCustomerGroupIds') ->willReturn([1, 2, 3, 4]); - $this->rule->expects(self::once()) + $this->ruleMock->expects(self::once()) ->method('getExtensionAttributes') - ->willReturn($this->ruleExtension); - $this->ruleExtension->expects(self::once()) + ->willReturn($this->ruleExtensionMock); + $this->ruleExtensionMock->expects(self::once()) ->method('setExcludeWebsiteIds') ->with($excludedWebsites) ->willReturnSelf(); - $this->rule->expects(self::once()) + $this->ruleMock->expects(self::once()) ->method('setExtensionAttributes') - ->with($this->ruleExtension) + ->with($this->ruleExtensionMock) ->willReturnSelf(); - $this->addCustomerGroupExcludedWebsiteObserver->execute($this->observer); + $this->observer->execute($this->observerMock); } } diff --git a/app/code/Magento/Customer/view/frontend/web/js/customer-data.js b/app/code/Magento/Customer/view/frontend/web/js/customer-data.js index 566125dd90921..3e8a2a1853ad4 100644 --- a/app/code/Magento/Customer/view/frontend/web/js/customer-data.js +++ b/app/code/Magento/Customer/view/frontend/web/js/customer-data.js @@ -120,7 +120,7 @@ define([ storage.remove(sectionName); sectionDataIds = $.cookieStorage.get('section_data_ids') || {}; _.each(sectionDataIds, function (data, name) { - if (name != sectionName) { //eslint-disable-line eqeqeq + if (name !== sectionName) { newSectionDataIds[name] = data; } }); @@ -266,7 +266,7 @@ define([ if (typeof sectionData === 'undefined' || typeof sectionData === 'object' && - cookieSectionTimestamp != sectionData['data_id'] //eslint-disable-line + cookieSectionTimestamp !== sectionData['data_id'] ) { expiredSectionNames.push(sectionName); } diff --git a/app/code/Magento/Customer/view/frontend/web/js/section-config.js b/app/code/Magento/Customer/view/frontend/web/js/section-config.js index 107a177d0832f..5d3bbd279a201 100644 --- a/app/code/Magento/Customer/view/frontend/web/js/section-config.js +++ b/app/code/Magento/Customer/view/frontend/web/js/section-config.js @@ -32,7 +32,7 @@ define(['underscore'], function (_) { /** * Returns a list of sections which should be invalidated for given URL. * @param {String} url - URL which was requested. - * @return {Array} - List of sections to invalidate. + * @return {Object} - List of sections to invalidate. */ getAffectedSections: function (url) { var route = canonize(url), @@ -55,8 +55,8 @@ define(['underscore'], function (_) { /** * Filters the list of given sections to the ones defined as client side. - * @param {Array} allSections - List of sections to check. - * @return {Array} - List of filtered sections. + * @param {Object} allSections - List of sections to check. + * @return {Object} - List of filtered sections. */ filterClientSideSections: function (allSections) { return _.difference(allSections, clientSideSections); diff --git a/app/code/Magento/Developer/Model/Logger/Handler/Debug.php b/app/code/Magento/Developer/Model/Logger/Handler/Debug.php index fc659c773c0af..4085744acf423 100644 --- a/app/code/Magento/Developer/Model/Logger/Handler/Debug.php +++ b/app/code/Magento/Developer/Model/Logger/Handler/Debug.php @@ -3,18 +3,23 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Developer\Model\Logger\Handler; +use Exception; use Magento\Config\Setup\ConfigOptionsList; -use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\App\DeploymentConfig; use Magento\Framework\App\State; +use Magento\Framework\Exception\FileSystemException; +use Magento\Framework\Exception\RuntimeException; use Magento\Framework\Filesystem\DriverInterface; -use Magento\Framework\App\DeploymentConfig; +use Magento\Framework\Logger\Handler\Debug as DebugHandler; /** * Enable/disable debug logging based on the store config setting */ -class Debug extends \Magento\Framework\Logger\Handler\Debug +class Debug extends DebugHandler { /** * @var State @@ -30,14 +35,14 @@ class Debug extends \Magento\Framework\Logger\Handler\Debug * @param DriverInterface $filesystem * @param State $state * @param DeploymentConfig $deploymentConfig - * @param string $filePath - * @throws \Exception + * @param string|null $filePath + * @throws Exception */ public function __construct( DriverInterface $filesystem, State $state, DeploymentConfig $deploymentConfig, - $filePath = null + ?string $filePath = null ) { parent::__construct($filesystem, $filePath); @@ -48,30 +53,34 @@ public function __construct( /** * @inheritdoc */ - public function isHandling(array $record) + public function isHandling(array $record): bool { if ($this->deploymentConfig->isAvailable()) { - return - parent::isHandling($record) - && $this->isLoggingEnabled(); + return parent::isHandling($record) && $this->isLoggingEnabled(); } return parent::isHandling($record); } /** - * Check that logging functionality is enabled. + * Check that logging functionality is enabled * * @return bool + * @throws FileSystemException + * @throws RuntimeException */ private function isLoggingEnabled(): bool { - $configValue = $this->deploymentConfig->get(ConfigOptionsList::CONFIG_PATH_DEBUG_LOGGING); + $configValue = $this->deploymentConfig->get( + ConfigOptionsList::CONFIG_PATH_DEBUG_LOGGING + ); + if ($configValue === null) { $isEnabled = $this->state->getMode() !== State::MODE_PRODUCTION; } else { - $isEnabled = (bool)$configValue; + $isEnabled = (bool) $configValue; } + return $isEnabled; } } diff --git a/app/code/Magento/Newsletter/Test/Unit/Model/Template/FilterTest.php b/app/code/Magento/Newsletter/Test/Unit/Model/Template/FilterTest.php index a455852c94f42..f41988d0664a0 100644 --- a/app/code/Magento/Newsletter/Test/Unit/Model/Template/FilterTest.php +++ b/app/code/Magento/Newsletter/Test/Unit/Model/Template/FilterTest.php @@ -7,9 +7,13 @@ namespace Magento\Newsletter\Test\Unit\Model\Template; +use Magento\Email\Model\Template\Css\Processor; use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\App\State; +use Magento\Framework\Css\PreProcessor\Adapter\CssInliner; use Magento\Framework\Escaper; +use Magento\Framework\Filesystem; +use Magento\Framework\Filter\VariableResolverInterface; use Magento\Framework\Stdlib\StringUtils; use Magento\Framework\UrlInterface; use Magento\Framework\View\Asset\Repository; @@ -22,8 +26,8 @@ use Magento\Variable\Model\Source\Variables; use Magento\Variable\Model\VariableFactory; use Magento\Widget\Model\ResourceModel\Widget as WidgetResourceModel; +use Magento\Widget\Model\Widget; use Magento\Widget\Model\Widget as WidgetModel; -use Pelago\Emogrifier; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; @@ -73,10 +77,13 @@ protected function setUp(): void $coreVariableFactory = $this->createPartialMock(VariableFactory::class, ['create']); $layoutFactory = $this->createPartialMock(LayoutFactory::class, ['create']); $this->appStateMock = $this->createMock(State::class); - $emogrifier = $this->createMock(Emogrifier::class); $configVariables = $this->createMock(Variables::class); $widgetResource = $this->createMock(WidgetResourceModel::class); $widget = $this->createMock(WidgetModel::class); + $variableResolver = $this->createMock(VariableResolverInterface::class); + $cssProcessor = $this->createMock(Processor::class); + $pubDirectory = $this->createMock(Filesystem::class); + $cssInliner = $this->createMock(CssInliner::class); $this->filter = new Filter( $string, @@ -90,8 +97,11 @@ protected function setUp(): void $layoutFactory, $this->appStateMock, $urlModel, - $emogrifier, $configVariables, + $variableResolver, + $cssProcessor, + $pubDirectory, + $cssInliner, $widgetResource, $widget ); diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js index 7dcf0994ef56b..2d7ec9151d9b4 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js @@ -5,9 +5,10 @@ /* eslint-disable no-undef */ define([ 'jquery', + 'underscore', 'Magento_Ui/js/grid/columns/column', 'Magento_Ui/js/lib/key-codes' -], function ($, Column, keyCodes) { +], function ($, _, Column, keyCodes) { 'use strict'; return Column.extend({ diff --git a/app/code/Magento/Ui/view/base/web/js/lib/view/utils/async.js b/app/code/Magento/Ui/view/base/web/js/lib/view/utils/async.js index 5f8916ac5ddb7..3c97b002c59e0 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/view/utils/async.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/view/utils/async.js @@ -76,7 +76,7 @@ define([ * Internal method used to normalize argumnets passed * to 'async' module methods. * - * @param {(String|Objetc)} selector + * @param {(String|Object)} selector * @param {(HTMLElement|Object|String)} [ctx] * @returns {Object} */ diff --git a/app/code/Magento/WeeeGraphQl/Test/Unit/Model/Resolver/FixedProductTaxResolverTest.php b/app/code/Magento/WeeeGraphQl/Test/Unit/Model/Resolver/FixedProductTaxResolverTest.php index 15edec0dd6145..54258a0df9b86 100644 --- a/app/code/Magento/WeeeGraphQl/Test/Unit/Model/Resolver/FixedProductTaxResolverTest.php +++ b/app/code/Magento/WeeeGraphQl/Test/Unit/Model/Resolver/FixedProductTaxResolverTest.php @@ -28,17 +28,17 @@ class FixedProductTaxResolverTest extends TestCase /** * @var MockObject|ContextInterface */ - private $context; + private $contextMock; /** * @var MockObject|WeeeHelper */ - private $weeeHelper; + private $weeeHelperMock; /** * @var TaxHelper|MockObject */ - private $taxHelper; + private $taxHelperMock; /** * @var FixedProductTax @@ -84,28 +84,58 @@ class FixedProductTaxResolverTest extends TestCase ] ]; + /** + * @var ContextExtensionInterface|MockObject + */ + private $contextExtensionAttributesMock; + + /** + * @var StoreInterface|MockObject + */ + private $storeMock; + + /** + * @var CartItemInterface|MockObject + */ + private $cartItemMock; + + /** + * @var Field|MockObject + */ + private $fieldMock; + + /** + * @var ResolveInfo|MockObject + */ + private $resolveInfoMock; + /** * @inheritdoc */ protected function setUp(): void { - $this->context = $this->getMockBuilder(ContextInterface::class) + $this->contextMock = $this->getMockBuilder(ContextInterface::class) ->setMethods(['getExtensionAttributes']) ->getMockForAbstractClass(); - $this->weeeHelper = $this->getMockBuilder(WeeeHelper::class) + $this->weeeHelperMock = $this->getMockBuilder(WeeeHelper::class) ->disableOriginalConstructor() ->onlyMethods(['isEnabled', 'getApplied']) ->getMock(); - $this->taxHelper = $this->getMockBuilder(TaxHelper::class) + $this->taxHelperMock = $this->getMockBuilder(TaxHelper::class) ->disableOriginalConstructor() ->onlyMethods(['getPriceDisplayType']) ->getMock(); - $this->resolver = new FixedProductTax( - $this->weeeHelper, - $this->taxHelper, - ); + $this->contextExtensionAttributesMock = $this->getMockBuilder(ContextExtensionInterface::class) + ->addMethods(['getStore']) + ->getMock(); + $this->storeMock = $this->createMock(StoreInterface::class); + $this->cartItemMock = $this->createMock(CartItemInterface::class); + $this->fieldMock = $this->createMock(Field::class); + $this->resolveInfoMock = $this->createMock(ResolveInfo::class); + + $this->resolver = new FixedProductTax($this->weeeHelperMock, $this->taxHelperMock); } /** @@ -116,11 +146,7 @@ public function testShouldThrowException(): void $this->expectException(LocalizedException::class); $this->expectExceptionMessageMatches('/value should be specified/'); - $this->resolver->resolve( - $this->getFieldStub(), - null, - $this->getResolveInfoStub() - ); + $this->resolver->resolve($this->fieldMock, null, $this->resolveInfoMock); } /** @@ -128,28 +154,25 @@ public function testShouldThrowException(): void */ public function testShouldReturnEmptyResult(): void { - $store = $this->createMock(StoreInterface::class); - $cartItem = $this->createMock(CartItemInterface::class); - $contextExtensionAttributes = $this->createMock(ContextExtensionInterface::class); - $contextExtensionAttributes->method('getStore') - ->willreturn($store); - $this->context->method('getExtensionAttributes') - ->willReturn($contextExtensionAttributes); + $this->contextExtensionAttributesMock->method('getStore') + ->willreturn($this->storeMock); + $this->contextMock->method('getExtensionAttributes') + ->willReturn($this->contextExtensionAttributesMock); - $this->weeeHelper->method('isEnabled') - ->with($store) + $this->weeeHelperMock->method('isEnabled') + ->with($this->storeMock) ->willReturn(false); - $this->weeeHelper->expects($this->never()) + $this->weeeHelperMock->expects($this->never()) ->method('getApplied'); $this->assertEquals( [], $this->resolver->resolve( - $this->getFieldStub(), - $this->context, - $this->getResolveInfoStub(), - ['model' => $cartItem] + $this->fieldMock, + $this->contextMock, + $this->resolveInfoMock, + ['model' => $this->cartItemMock] ) ); } @@ -161,34 +184,31 @@ public function testShouldReturnEmptyResult(): void */ public function testShouldReturnResult(int $displayType, array $expected): void { - $store = $this->createMock(StoreInterface::class); - $cartItem = $this->createMock(CartItemInterface::class); - $contextExtensionAttributes = $this->createMock(ContextExtensionInterface::class); - $contextExtensionAttributes->method('getStore') - ->willreturn($store); - $this->context->method('getExtensionAttributes') - ->willReturn($contextExtensionAttributes); + $this->contextExtensionAttributesMock->method('getStore') + ->willreturn($this->storeMock); + $this->contextMock->method('getExtensionAttributes') + ->willReturn($this->contextExtensionAttributesMock); - $this->weeeHelper->method('isEnabled') - ->with($store) + $this->weeeHelperMock->method('isEnabled') + ->with($this->storeMock) ->willReturn(true); - $this->weeeHelper->expects($this->once()) + $this->weeeHelperMock->expects($this->once()) ->method('getApplied') ->willReturn($this->fpts); - $this->taxHelper->expects($this->once()) + $this->taxHelperMock->expects($this->once()) ->method('getPriceDisplayType') ->willReturn($displayType); $this->assertEquals( $expected, $this->resolver->resolve( - $this->getFieldStub(), - $this->context, - $this->getResolveInfoStub(), + $this->fieldMock, + $this->contextMock, + $this->resolveInfoMock, [ - 'model' => $cartItem, + 'model' => $this->cartItemMock, 'price' => [ 'currency' => 'USD' ] @@ -257,28 +277,4 @@ public function shouldReturnResultDataProvider(): array ] ]; } - - /** - * @return MockObject|Field - */ - private function getFieldStub(): Field - { - /** @var MockObject|Field $fieldMock */ - $fieldMock = $this->getMockBuilder(Field::class) - ->disableOriginalConstructor() - ->getMock(); - return $fieldMock; - } - - /** - * @return MockObject|ResolveInfo - */ - private function getResolveInfoStub(): ResolveInfo - { - /** @var MockObject|ResolveInfo $resolveInfoMock */ - $resolveInfoMock = $this->getMockBuilder(ResolveInfo::class) - ->disableOriginalConstructor() - ->getMock(); - return $resolveInfoMock; - } } diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateItemOptionsTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateItemOptionsTest.php index 623ba8f266fa1..4e117320756ec 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateItemOptionsTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateItemOptionsTest.php @@ -18,12 +18,13 @@ use Magento\Framework\Controller\ResultFactory; use Magento\Framework\Data\Form\FormKey\Validator; use Magento\Framework\DataObject; +use Magento\Framework\Event\Manager as EventManager; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Logger\Monolog; -use Magento\Framework\Message\Manager; +use Magento\Framework\Message\Manager as MessageManager; +use Magento\Framework\ObjectManagerInterface; use Magento\Framework\Url; -use Magento\Wishlist\Controller\Index\Remove; use Magento\Wishlist\Controller\Index\UpdateItemOptions; use Magento\Wishlist\Controller\WishlistProvider; use Magento\Wishlist\Helper\Data; @@ -41,62 +42,62 @@ class UpdateItemOptionsTest extends TestCase /** * @var ProductRepository|MockObject */ - protected $productRepository; + private $productRepositoryMock; /** * @var WishlistProvider|MockObject */ - protected $wishlistProvider; + private $wishlistProviderMock; /** * @var Context|MockObject */ - protected $context; + private $contextMock; /** * @var Http|MockObject */ - protected $request; + private $requestMock; /** * @var ObjectManager|MockObject */ - protected $om; + private $objectManagerMock; /** - * @var Manager|MockObject + * @var MessageManager|MockObject */ - protected $messageManager; + private $messageManagerMock; /** * @var Url|MockObject */ - protected $url; + private $urlMock; /** * @var Session|MockObject */ - protected $customerSession; + private $customerSessionMock; /** - * @var \Magento\Framework\Event\Manager|MockObject + * @var EventManager|MockObject */ - protected $eventManager; + private $eventManagerMock; /** * @var ResultFactory|MockObject */ - protected $resultFactoryMock; + private $resultFactoryMock; /** * @var Redirect|MockObject */ - protected $resultRedirectMock; + private $resultRedirectMock; /** * @var Validator|MockObject */ - protected $formKeyValidator; + private $formKeyValidator; /** * SetUp method @@ -105,30 +106,24 @@ class UpdateItemOptionsTest extends TestCase */ protected function setUp(): void { - $this->productRepository = $this->createMock(ProductRepository::class); - $this->context = $this->createMock(Context::class); - $this->request = $this->createMock(Http::class); - $this->wishlistProvider = $this->createMock(WishlistProvider::class); - $this->om = $this->createMock(ObjectManager::class); - $this->messageManager = $this->createMock(Manager::class); - $this->url = $this->createMock(Url::class); - $this->customerSession = $this->createMock(Session::class); - $this->eventManager = $this->createMock(\Magento\Framework\Event\Manager::class); - $this->resultFactoryMock = $this->getMockBuilder(ResultFactory::class) - ->disableOriginalConstructor() - ->getMock(); - $this->resultRedirectMock = $this->getMockBuilder(Redirect::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->resultFactoryMock->expects($this->any()) + $this->productRepositoryMock = $this->createMock(ProductRepository::class); + $this->contextMock = $this->createMock(Context::class); + $this->requestMock = $this->createMock(Http::class); + $this->wishlistProviderMock = $this->createMock(WishlistProvider::class); + $this->objectManagerMock = $this->createMock(ObjectManagerInterface::class); + $this->messageManagerMock = $this->createMock(MessageManager::class); + $this->urlMock = $this->createMock(Url::class); + $this->customerSessionMock = $this->createMock(Session::class); + $this->eventManagerMock = $this->createMock(EventManager::class); + $this->resultFactoryMock = $this->createMock(ResultFactory::class); + $this->resultRedirectMock = $this->createMock(Redirect::class); + $this->formKeyValidator = $this->createMock(Validator::class); + + $this->resultFactoryMock ->method('create') ->with(ResultFactory::TYPE_REDIRECT, []) ->willReturn($this->resultRedirectMock); - $this->formKeyValidator = $this->getMockBuilder(Validator::class) - ->disableOriginalConstructor() - ->getMock(); } /** @@ -139,14 +134,14 @@ protected function setUp(): void protected function tearDown(): void { unset( - $this->productRepository, - $this->context, - $this->request, - $this->wishlistProvider, - $this->om, - $this->messageManager, - $this->url, - $this->eventManager + $this->productRepositoryMock, + $this->contextMock, + $this->requestMock, + $this->wishlistProviderMock, + $this->objectManagerMock, + $this->messageManagerMock, + $this->urlMock, + $this->eventManagerMock ); } @@ -155,35 +150,29 @@ protected function tearDown(): void * * @return void */ - public function prepareContext() + private function prepareContext(): void { $actionFlag = $this->createMock(ActionFlag::class); - $this->context - ->expects($this->any()) + $this->contextMock ->method('getObjectManager') - ->willReturn($this->om); - $this->context - ->expects($this->any()) + ->willReturn($this->objectManagerMock); + $this->contextMock ->method('getRequest') - ->willReturn($this->request); - $this->context - ->expects($this->any()) + ->willReturn($this->requestMock); + $this->contextMock ->method('getEventManager') - ->willReturn($this->eventManager); - $this->context - ->expects($this->any()) + ->willReturn($this->eventManagerMock); + $this->contextMock ->method('getUrl') - ->willReturn($this->url); - $this->context - ->expects($this->any()) + ->willReturn($this->urlMock); + $this->contextMock ->method('getActionFlag') ->willReturn($actionFlag); - $this->context - ->expects($this->any()) + $this->contextMock ->method('getMessageManager') - ->willReturn($this->messageManager); - $this->context->expects($this->any()) + ->willReturn($this->messageManagerMock); + $this->contextMock ->method('getResultFactory') ->willReturn($this->resultFactoryMock); } @@ -191,47 +180,35 @@ public function prepareContext() /** * Get controller * + * @param bool $formKeyValid * @return UpdateItemOptions */ - protected function getController() + private function getController(bool $formKeyValid = true): UpdateItemOptions { $this->prepareContext(); $this->formKeyValidator->expects($this->once()) ->method('validate') - ->with($this->request) - ->willReturn(true); + ->with($this->requestMock) + ->willReturn($formKeyValid); return new UpdateItemOptions( - $this->context, - $this->customerSession, - $this->wishlistProvider, - $this->productRepository, + $this->contextMock, + $this->customerSessionMock, + $this->wishlistProviderMock, + $this->productRepositoryMock, $this->formKeyValidator ); } - public function testExecuteWithInvalidFormKey() + public function testExecuteWithInvalidFormKey(): void { - $this->prepareContext(); - - $this->formKeyValidator->expects($this->once()) - ->method('validate') - ->with($this->request) - ->willReturn(false); - $this->resultRedirectMock->expects($this->once()) ->method('setPath') ->with('*/*/') ->willReturnSelf(); - $controller = new Remove( - $this->context, - $this->wishlistProvider, - $this->formKeyValidator - ); - - $this->assertSame($this->resultRedirectMock, $controller->execute()); + $this->assertSame($this->resultRedirectMock, $this->getController(false)->execute()); } /** @@ -239,9 +216,9 @@ public function testExecuteWithInvalidFormKey() * * @return void */ - public function testExecuteWithoutProductId() + public function testExecuteWithoutProductId(): void { - $this->request + $this->requestMock ->expects($this->once()) ->method('getParam') ->with('product') @@ -259,21 +236,21 @@ public function testExecuteWithoutProductId() * * @return void */ - public function testExecuteWithoutProduct() + public function testExecuteWithoutProduct(): void { - $this->request + $this->requestMock ->expects($this->once()) ->method('getParam') ->with('product') ->willReturn(2); - $this->productRepository + $this->productRepositoryMock ->expects($this->once()) ->method('getById') ->with(2) ->willThrowException(new NoSuchEntityException()); - $this->messageManager + $this->messageManagerMock ->expects($this->once()) ->method('addErrorMessage') ->with('We can\'t specify a product.') @@ -291,7 +268,7 @@ public function testExecuteWithoutProduct() * * @return void */ - public function testExecuteWithoutWishList() + public function testExecuteWithoutWishList(): void { $product = $this->createMock(Product::class); $item = $this->createMock(Item::class); @@ -301,24 +278,24 @@ public function testExecuteWithoutWishList() ->method('isVisibleInCatalog') ->willReturn(true); - $this->request + $this->requestMock ->expects($this->at(0)) ->method('getParam') ->with('product', null) ->willReturn(2); - $this->request + $this->requestMock ->expects($this->at(1)) ->method('getParam') ->with('id', null) ->willReturn(3); - $this->productRepository + $this->productRepositoryMock ->expects($this->once()) ->method('getById') ->with(2) ->willReturn($product); - $this->messageManager + $this->messageManagerMock ->expects($this->never()) ->method('addErrorMessage') ->with('We can\'t specify a product.') @@ -335,13 +312,13 @@ public function testExecuteWithoutWishList() ->with('getWishlistId') ->willReturn(12); - $this->wishlistProvider + $this->wishlistProviderMock ->expects($this->once()) ->method('getWishlist') ->with(12) ->willReturn(null); - $this->om + $this->objectManagerMock ->expects($this->once()) ->method('create') ->with(Item::class) @@ -360,7 +337,7 @@ public function testExecuteWithoutWishList() * @return void * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - public function testExecuteAddSuccessException() + public function testExecuteAddSuccessException(): void { $wishlist = $this->createMock(Wishlist::class); $product = $this->createMock(Product::class); @@ -400,18 +377,18 @@ public function testExecuteAddSuccessException() ->method('getName') ->willReturn('Test name'); - $this->request + $this->requestMock ->expects($this->at(0)) ->method('getParam') ->with('product', null) ->willReturn(2); - $this->request + $this->requestMock ->expects($this->at(1)) ->method('getParam') ->with('id', null) ->willReturn(3); - $this->productRepository + $this->productRepositoryMock ->expects($this->once()) ->method('getById') ->with(2) @@ -428,41 +405,41 @@ public function testExecuteAddSuccessException() ->with('getWishlistId') ->willReturn(12); - $this->wishlistProvider + $this->wishlistProviderMock ->expects($this->once()) ->method('getWishlist') ->with(12) ->willReturn($wishlist); - $this->om + $this->objectManagerMock ->expects($this->once()) ->method('create') ->with(Item::class) ->willReturn($item); - $this->request + $this->requestMock ->expects($this->once()) ->method('getParams') ->willReturn([]); - $this->om + $this->objectManagerMock ->expects($this->exactly(2)) ->method('get') ->with(Data::class) ->willReturn($helper); - $this->eventManager + $this->eventManagerMock ->expects($this->once()) ->method('dispatch') ->with('wishlist_update_item', ['wishlist' => $wishlist, 'product' => $product, 'item' => $item]) ->willReturn(true); - $this->messageManager + $this->messageManagerMock ->expects($this->once()) ->method('addSuccessMessage') ->with('Test name has been updated in your Wish List.', null) ->willThrowException(new LocalizedException(__('error-message'))); - $this->messageManager + $this->messageManagerMock ->expects($this->once()) ->method('addErrorMessage') ->with('error-message', null) @@ -481,7 +458,7 @@ public function testExecuteAddSuccessException() * @return void * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - public function testExecuteAddSuccessCriticalException() + public function testExecuteAddSuccessCriticalException(): void { $wishlist = $this->createMock(Wishlist::class); $product = $this->createMock(Product::class); @@ -493,8 +470,7 @@ public function testExecuteAddSuccessCriticalException() $logger ->expects($this->once()) ->method('critical') - ->with($exception) - ->willReturn(true); + ->with($exception); $helper ->expects($this->exactly(2)) @@ -529,18 +505,18 @@ public function testExecuteAddSuccessCriticalException() ->method('getName') ->willReturn('Test name'); - $this->request + $this->requestMock ->expects($this->at(0)) ->method('getParam') ->with('product', null) ->willReturn(2); - $this->request + $this->requestMock ->expects($this->at(1)) ->method('getParam') ->with('id', null) ->willReturn(3); - $this->productRepository + $this->productRepositoryMock ->expects($this->once()) ->method('getById') ->with(2) @@ -557,51 +533,51 @@ public function testExecuteAddSuccessCriticalException() ->with('getWishlistId') ->willReturn(12); - $this->wishlistProvider + $this->wishlistProviderMock ->expects($this->once()) ->method('getWishlist') ->with(12) ->willReturn($wishlist); - $this->om + $this->objectManagerMock ->expects($this->once()) ->method('create') ->with(Item::class) ->willReturn($item); - $this->request + $this->requestMock ->expects($this->once()) ->method('getParams') ->willReturn([]); - $this->om + $this->objectManagerMock ->expects($this->at(1)) ->method('get') ->with(Data::class) ->willReturn($helper); - $this->om + $this->objectManagerMock ->expects($this->at(2)) ->method('get') ->with(Data::class) ->willReturn($helper); - $this->om + $this->objectManagerMock ->expects($this->at(3)) ->method('get') ->with(LoggerInterface::class) ->willReturn($logger); - $this->eventManager + $this->eventManagerMock ->expects($this->once()) ->method('dispatch') ->with('wishlist_update_item', ['wishlist' => $wishlist, 'product' => $product, 'item' => $item]) ->willReturn(true); - $this->messageManager + $this->messageManagerMock ->expects($this->once()) ->method('addSuccessMessage') ->with('Test name has been updated in your Wish List.', null) ->willThrowException($exception); - $this->messageManager + $this->messageManagerMock ->expects($this->once()) ->method('addErrorMessage') ->with('We can\'t update your Wish List right now.', null) diff --git a/composer.json b/composer.json index 35429831d19b2..c36f93c7f75f6 100644 --- a/composer.json +++ b/composer.json @@ -63,7 +63,7 @@ "magento/composer": "1.7.0", "magento/magento-composer-installer": ">=0.1.11", "magento/zendframework1": "~1.14.2", - "monolog/monolog": "^1.17", + "monolog/monolog": "^2.3", "pelago/emogrifier": "^5.0.0", "php-amqplib/php-amqplib": "~3.0.0", "phpseclib/mcrypt_compat": "1.0.8", @@ -81,7 +81,7 @@ "require-dev": { "allure-framework/allure-phpunit": "~1.4", "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", - "friendsofphp/php-cs-fixer": "~2.18.1", + "friendsofphp/php-cs-fixer": "~3.0.0", "lusitanian/oauth": "~0.8.10", "magento/magento-coding-standard": "*", "magento/magento2-functional-testing-framework": "^3.0", diff --git a/composer.lock b/composer.lock index 3ec41c2164283..bf3fd98bbd49e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ebdb58747a71078cfbcba5524b46599b", + "content-hash": "fb578a81f7a819082165f73582c28dc2", "packages": [ { "name": "aws/aws-sdk-php", @@ -1797,16 +1797,16 @@ }, { "name": "laminas/laminas-escaper", - "version": "2.7.0", + "version": "2.8.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-escaper.git", - "reference": "5e04bc5ae5990b17159d79d331055e2c645e5cc5" + "reference": "2d6dce99668b413610e9544183fa10392437f542" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-escaper/zipball/5e04bc5ae5990b17159d79d331055e2c645e5cc5", - "reference": "5e04bc5ae5990b17159d79d331055e2c645e5cc5", + "url": "https://api.github.com/repos/laminas/laminas-escaper/zipball/2d6dce99668b413610e9544183fa10392437f542", + "reference": "2d6dce99668b413610e9544183fa10392437f542", "shasum": "" }, "require": { @@ -1817,7 +1817,7 @@ "zendframework/zend-escaper": "^2.6.1" }, "require-dev": { - "laminas/laminas-coding-standard": "~1.0.0", + "laminas/laminas-coding-standard": "~2.3.0", "phpunit/phpunit": "^9.3", "psalm/plugin-phpunit": "^0.12.2", "vimeo/psalm": "^3.16" @@ -1856,7 +1856,7 @@ "type": "community_bridge" } ], - "time": "2020-11-17T21:26:43+00:00" + "time": "2021-06-26T14:26:08+00:00" }, { "name": "laminas/laminas-eventmanager", @@ -3733,21 +3733,21 @@ }, { "name": "monolog/monolog", - "version": "1.26.1", + "version": "2.3.2", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "c6b00f05152ae2c9b04a448f99c7590beb6042f5" + "reference": "71312564759a7db5b789296369c1a264efc43aad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/c6b00f05152ae2c9b04a448f99c7590beb6042f5", - "reference": "c6b00f05152ae2c9b04a448f99c7590beb6042f5", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/71312564759a7db5b789296369c1a264efc43aad", + "reference": "71312564759a7db5b789296369c1a264efc43aad", "shasum": "" }, "require": { - "php": ">=5.3.0", - "psr/log": "~1.0" + "php": ">=7.2", + "psr/log": "^1.0.1" }, "provide": { "psr/log-implementation": "1.0.0" @@ -3755,29 +3755,39 @@ "require-dev": { "aws/aws-sdk-php": "^2.4.9 || ^3.0", "doctrine/couchdb": "~1.0@dev", - "graylog2/gelf-php": "~1.0", + "elasticsearch/elasticsearch": "^7", + "graylog2/gelf-php": "^1.4.2", + "mongodb/mongodb": "^1.8", "php-amqplib/php-amqplib": "~2.4", "php-console/php-console": "^3.1.3", - "phpstan/phpstan": "^0.12.59", - "phpunit/phpunit": "~4.5", - "ruflin/elastica": ">=0.90 <3.0", - "sentry/sentry": "^0.13", + "phpspec/prophecy": "^1.6.1", + "phpstan/phpstan": "^0.12.91", + "phpunit/phpunit": "^8.5", + "predis/predis": "^1.1", + "rollbar/rollbar": "^1.3", + "ruflin/elastica": ">=0.90 <7.0.1", "swiftmailer/swiftmailer": "^5.3|^6.0" }, "suggest": { "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client", "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", - "ext-mongo": "Allow sending log messages to a MongoDB server", + "ext-mbstring": "Allow to work properly with unicode symbols", + "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)", "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", - "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)", "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", "php-console/php-console": "Allow sending log messages to Google Chrome", "rollbar/rollbar": "Allow sending log messages to Rollbar", - "ruflin/elastica": "Allow sending log messages to an Elastic Search server", - "sentry/sentry": "Allow sending log messages to a Sentry server" + "ruflin/elastica": "Allow sending log messages to an Elastic Search server" }, "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.x-dev" + } + }, "autoload": { "psr-4": { "Monolog\\": "src/Monolog" @@ -3791,11 +3801,11 @@ { "name": "Jordi Boggiano", "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" + "homepage": "https://seld.be" } ], "description": "Sends your logs to files, sockets, inboxes, databases and various web services", - "homepage": "http://github.com/Seldaek/monolog", + "homepage": "https://github.com/Seldaek/monolog", "keywords": [ "log", "logging", @@ -3803,7 +3813,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/1.26.1" + "source": "https://github.com/Seldaek/monolog/tree/2.3.2" }, "funding": [ { @@ -3815,7 +3825,7 @@ "type": "tidelift" } ], - "time": "2021-05-28T08:32:12+00:00" + "time": "2021-07-23T07:42:52+00:00" }, { "name": "mtdowling/jmespath.php", @@ -8781,57 +8791,54 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v2.18.7", + "version": "v3.0.2", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "b3281bbe07e8d45759e9e3e8032b4c5fa3463b21" + "reference": "990b979379502feb7f393d6c9aa36cc9b9765f24" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/b3281bbe07e8d45759e9e3e8032b4c5fa3463b21", - "reference": "b3281bbe07e8d45759e9e3e8032b4c5fa3463b21", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/990b979379502feb7f393d6c9aa36cc9b9765f24", + "reference": "990b979379502feb7f393d6c9aa36cc9b9765f24", "shasum": "" }, "require": { - "composer/semver": "^1.4 || ^2.0 || ^3.0", - "composer/xdebug-handler": "^1.2 || ^2.0", - "doctrine/annotations": "^1.2", + "composer/semver": "^3.2", + "composer/xdebug-handler": "^2.0", + "doctrine/annotations": "^1.12", "ext-json": "*", "ext-tokenizer": "*", - "php": "^5.6 || ^7.0 || ^8.0", - "php-cs-fixer/diff": "^1.3", - "symfony/console": "^3.4.43 || ^4.1.6 || ^5.0", - "symfony/event-dispatcher": "^3.0 || ^4.0 || ^5.0", - "symfony/filesystem": "^3.0 || ^4.0 || ^5.0", - "symfony/finder": "^3.0 || ^4.0 || ^5.0", - "symfony/options-resolver": "^3.0 || ^4.0 || ^5.0", - "symfony/polyfill-php70": "^1.0", - "symfony/polyfill-php72": "^1.4", - "symfony/process": "^3.0 || ^4.0 || ^5.0", - "symfony/stopwatch": "^3.0 || ^4.0 || ^5.0" - }, - "require-dev": { - "justinrainbow/json-schema": "^5.0", + "php": "^7.1.3 || ^8.0", + "php-cs-fixer/diff": "^2.0", + "symfony/console": "^4.4.20 || ^5.1.3", + "symfony/event-dispatcher": "^4.4.20 || ^5.0", + "symfony/filesystem": "^4.4.20 || ^5.0", + "symfony/finder": "^4.4.20 || ^5.0", + "symfony/options-resolver": "^4.4.20 || ^5.0", + "symfony/polyfill-php72": "^1.22", + "symfony/process": "^4.4.20 || ^5.0", + "symfony/stopwatch": "^4.4.20 || ^5.0" + }, + "require-dev": { + "justinrainbow/json-schema": "^5.2", "keradus/cli-executor": "^1.4", - "mikey179/vfsstream": "^1.6", - "php-coveralls/php-coveralls": "^2.4.2", - "php-cs-fixer/accessible-object": "^1.0", + "mikey179/vfsstream": "^1.6.8", + "php-coveralls/php-coveralls": "^2.4.3", + "php-cs-fixer/accessible-object": "^1.1", "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.2", "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.2.1", + "phpspec/prophecy": "^1.10.3", "phpspec/prophecy-phpunit": "^1.1 || ^2.0", - "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.13 || ^9.5", + "phpunit/phpunit": "^7.5.20 || ^8.5.14 || ^9.5", "phpunitgoodpractices/polyfill": "^1.5", "phpunitgoodpractices/traits": "^1.9.1", - "sanmai/phpunit-legacy-adapter": "^6.4 || ^8.2.1", - "symfony/phpunit-bridge": "^5.2.1", - "symfony/yaml": "^3.0 || ^4.0 || ^5.0" + "symfony/phpunit-bridge": "^5.2.4", + "symfony/yaml": "^4.4.20 || ^5.0" }, "suggest": { "ext-dom": "For handling output formats in XML", "ext-mbstring": "For handling non-UTF8 characters.", - "php-cs-fixer/phpunit-constraint-isidenticalstring": "For IsIdenticalString constraint.", - "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "For XmlMatchesXsd constraint.", "symfony/polyfill-mbstring": "When enabling `ext-mbstring` is not possible." }, "bin": [ @@ -8841,20 +8848,7 @@ "autoload": { "psr-4": { "PhpCsFixer\\": "src/" - }, - "classmap": [ - "tests/Test/AbstractFixerTestCase.php", - "tests/Test/AbstractIntegrationCaseFactory.php", - "tests/Test/AbstractIntegrationTestCase.php", - "tests/Test/Assert/AssertTokensTrait.php", - "tests/Test/IntegrationCase.php", - "tests/Test/IntegrationCaseFactory.php", - "tests/Test/IntegrationCaseFactoryInterface.php", - "tests/Test/InternalIntegrationCaseFactory.php", - "tests/Test/IsIdenticalConstraint.php", - "tests/Test/TokensWithObservedTransformers.php", - "tests/TestCase.php" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -8873,7 +8867,7 @@ "description": "A tool to automatically fix PHP code style", "support": { "issues": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues", - "source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v2.18.7" + "source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v3.0.2" }, "funding": [ { @@ -8881,7 +8875,7 @@ "type": "github" } ], - "time": "2021-05-03T21:36:45+00:00" + "time": "2021-08-04T19:28:19+00:00" }, { "name": "hoa/consistency", @@ -9777,27 +9771,27 @@ }, { "name": "magento/magento2-functional-testing-framework", - "version": "3.5.1", + "version": "3.6.0", "source": { "type": "git", "url": "https://github.com/magento/magento2-functional-testing-framework.git", - "reference": "5a6bdf511182151a6c357b788eb0c3f2fd89954a" + "reference": "d0350979b7c02ca5329d61d1cce2760d14170e90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/magento/magento2-functional-testing-framework/zipball/5a6bdf511182151a6c357b788eb0c3f2fd89954a", - "reference": "5a6bdf511182151a6c357b788eb0c3f2fd89954a", + "url": "https://api.github.com/repos/magento/magento2-functional-testing-framework/zipball/d0350979b7c02ca5329d61d1cce2760d14170e90", + "reference": "d0350979b7c02ca5329d61d1cce2760d14170e90", "shasum": "" }, "require": { - "allure-framework/allure-codeception": "~1.4.0||~1.5.0", + "allure-framework/allure-codeception": "^1.4", "aws/aws-sdk-php": "^3.132", - "codeception/codeception": "~4.1.4", + "codeception/codeception": "^4.1", "codeception/module-asserts": "^1.1", "codeception/module-sequence": "^1.0", "codeception/module-webdriver": "^1.0", "composer/composer": "^1.9||^2.0", - "csharpru/vault-php": "^4.1.0", + "csharpru/vault-php": "^4.2.1", "csharpru/vault-php-guzzle6-transport": "^2.0", "ext-curl": "*", "ext-dom": "*", @@ -9805,11 +9799,11 @@ "ext-json": "*", "ext-openssl": "*", "hoa/console": "~3.0", - "monolog/monolog": "^1.17", + "monolog/monolog": "^2.3", "mustache/mustache": "~2.5", - "nikic/php-parser": "~4.4.0", + "nikic/php-parser": "^4.4", "php": "^7.3", - "php-webdriver/webdriver": "^1.8.0", + "php-webdriver/webdriver": "^1.9.0", "spomky-labs/otphp": "^10.0", "symfony/console": "^4.4", "symfony/finder": "^5.0", @@ -9819,22 +9813,15 @@ "vlucas/phpdotenv": "^2.4", "weew/helpers-array": "^1.3" }, - "replace": { - "facebook/webdriver": "^1.7.1" - }, "require-dev": { "brainmaestro/composer-git-hooks": "^2.3.1", "codacy/coverage": "^1.4", "codeception/aspect-mock": "^3.0", - "doctrine/cache": "<1.7.0", - "goaop/framework": "~2.3.4", - "php-coveralls/php-coveralls": "^1.0", + "php-coveralls/php-coveralls": "^1.0||^2.2", "phpmd/phpmd": "^2.8.0", "phpunit/phpunit": "^9.0", - "rregeer/phpunit-coverage-check": "^0.1.4", "sebastian/phpcpd": "~6.0.0", - "squizlabs/php_codesniffer": "~3.5.4", - "symfony/stopwatch": "~3.4.6" + "squizlabs/php_codesniffer": "~3.5.4" }, "bin": [ "bin/mftf" @@ -9867,9 +9854,9 @@ ], "support": { "issues": "https://github.com/magento/magento2-functional-testing-framework/issues", - "source": "https://github.com/magento/magento2-functional-testing-framework/tree/3.5.1" + "source": "https://github.com/magento/magento2-functional-testing-framework/tree/3.6.0" }, - "time": "2021-05-05T15:01:30+00:00" + "time": "2021-07-23T16:10:15+00:00" }, { "name": "mustache/mustache", @@ -10215,16 +10202,16 @@ }, { "name": "php-cs-fixer/diff", - "version": "v1.3.1", + "version": "v2.0.2", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/diff.git", - "reference": "dbd31aeb251639ac0b9e7e29405c1441907f5759" + "reference": "29dc0d507e838c4580d018bd8b5cb412474f7ec3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/dbd31aeb251639ac0b9e7e29405c1441907f5759", - "reference": "dbd31aeb251639ac0b9e7e29405c1441907f5759", + "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/29dc0d507e838c4580d018bd8b5cb412474f7ec3", + "reference": "29dc0d507e838c4580d018bd8b5cb412474f7ec3", "shasum": "" }, "require": { @@ -10252,52 +10239,51 @@ { "name": "Kore Nordmann", "email": "mail@kore-nordmann.de" - }, - { - "name": "SpacePossum" } ], - "description": "sebastian/diff v2 backport support for PHP5.6", + "description": "sebastian/diff v3 backport support for PHP 5.6+", "homepage": "https://github.com/PHP-CS-Fixer", "keywords": [ "diff" ], "support": { "issues": "https://github.com/PHP-CS-Fixer/diff/issues", - "source": "https://github.com/PHP-CS-Fixer/diff/tree/v1.3.1" + "source": "https://github.com/PHP-CS-Fixer/diff/tree/v2.0.2" }, - "time": "2020-10-14T08:39:05+00:00" + "time": "2020-10-14T08:32:19+00:00" }, { "name": "php-webdriver/webdriver", - "version": "1.8.2", + "version": "1.11.1", "source": { "type": "git", "url": "https://github.com/php-webdriver/php-webdriver.git", - "reference": "3308a70be084d6d7fd1ee5787b4c2e6eb4b70aab" + "reference": "da16e39968f8dd5cfb7d07eef91dc2b731c69880" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-webdriver/php-webdriver/zipball/3308a70be084d6d7fd1ee5787b4c2e6eb4b70aab", - "reference": "3308a70be084d6d7fd1ee5787b4c2e6eb4b70aab", + "url": "https://api.github.com/repos/php-webdriver/php-webdriver/zipball/da16e39968f8dd5cfb7d07eef91dc2b731c69880", + "reference": "da16e39968f8dd5cfb7d07eef91dc2b731c69880", "shasum": "" }, "require": { "ext-curl": "*", "ext-json": "*", "ext-zip": "*", - "php": "^5.6 || ~7.0", + "php": "^5.6 || ~7.0 || ^8.0", "symfony/polyfill-mbstring": "^1.12", "symfony/process": "^2.8 || ^3.1 || ^4.0 || ^5.0" }, + "replace": { + "facebook/webdriver": "*" + }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.0", - "jakub-onderka/php-parallel-lint": "^1.0", - "php-coveralls/php-coveralls": "^2.0", - "php-mock/php-mock-phpunit": "^1.1", - "phpunit/phpunit": "^5.7", - "sebastian/environment": "^1.3.4 || ^2.0 || ^3.0", - "sminnee/phpunit-mock-objects": "^3.4", + "ondram/ci-detector": "^2.1 || ^3.5 || ^4.0", + "php-coveralls/php-coveralls": "^2.4", + "php-mock/php-mock-phpunit": "^1.1 || ^2.0", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpunit/phpunit": "^5.7 || ^7 || ^8 || ^9", "squizlabs/php_codesniffer": "^3.5", "symfony/var-dumper": "^3.3 || ^4.0 || ^5.0" }, @@ -10305,11 +10291,6 @@ "ext-SimpleXML": "For Firefox profile creation" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.8.x-dev" - } - }, "autoload": { "psr-4": { "Facebook\\WebDriver\\": "lib/" @@ -10333,9 +10314,9 @@ ], "support": { "issues": "https://github.com/php-webdriver/php-webdriver/issues", - "source": "https://github.com/php-webdriver/php-webdriver/tree/1.8.2" + "source": "https://github.com/php-webdriver/php-webdriver/tree/1.11.1" }, - "time": "2020-03-04T14:40:12+00:00" + "time": "2021-05-21T15:12:49+00:00" }, { "name": "phpcompatibility/php-compatibility", @@ -12534,74 +12515,6 @@ ], "time": "2021-05-26T17:43:10+00:00" }, - { - "name": "symfony/polyfill-php70", - "version": "v1.20.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "5f03a781d984aae42cebd18e7912fa80f02ee644" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/5f03a781d984aae42cebd18e7912fa80f02ee644", - "reference": "5f03a781d984aae42cebd18e7912fa80f02ee644", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "metapackage", - "extra": { - "branch-alias": { - "dev-main": "1.20-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php70/tree/v1.20.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-10-23T14:02:19+00:00" - }, { "name": "symfony/stopwatch", "version": "v5.3.0", diff --git a/dev/tests/integration/framework/Magento/TestFramework/ErrorLog/Logger.php b/dev/tests/integration/framework/Magento/TestFramework/ErrorLog/Logger.php index 88f08a1ee4103..dc7ad37426150 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/ErrorLog/Logger.php +++ b/dev/tests/integration/framework/Magento/TestFramework/ErrorLog/Logger.php @@ -3,11 +3,14 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\TestFramework\ErrorLog; +use Magento\Framework\Logger\Monolog; use Monolog\Handler\HandlerInterface; -class Logger extends \Magento\Framework\Logger\Monolog +class Logger extends Monolog { /** * @var array @@ -16,27 +19,33 @@ class Logger extends \Magento\Framework\Logger\Monolog /** * Minimum error level to log message - * Possible values: -1 ignore all errors, and level constants form http://tools.ietf.org/html/rfc5424 standard + * Possible values: -1 ignore all errors, + * and level constants form http://tools.ietf.org/html/rfc5424 standard * * @var int */ protected $minimumErrorLevel; /** - * @param string $name The logging channel - * @param HandlerInterface[] $handlers Optional stack of handlers, the first one in the array is called first, etc - * @param callable[] $processors Optional array of processors + * @param string $name The logging channel + * @param HandlerInterface[] $handlers Optional stack of handlers, the first one in the array is called first, etc + * @param callable[] $processors Optional array of processors */ - public function __construct($name, array $handlers = [], array $processors = []) - { - $this->minimumErrorLevel = defined('TESTS_ERROR_LOG_LISTENER_LEVEL') ? TESTS_ERROR_LOG_LISTENER_LEVEL : -1; + public function __construct( + string $name, + array $handlers = [], + array $processors = [] + ) { + $this->minimumErrorLevel = defined('TESTS_ERROR_LOG_LISTENER_LEVEL') + ? TESTS_ERROR_LOG_LISTENER_LEVEL + : -1; parent::__construct($name, $handlers, $processors); } /** * @return void */ - public function clearMessages() + public function clearMessages(): void { $this->messages = []; } @@ -44,21 +53,24 @@ public function clearMessages() /** * @return array */ - public function getMessages() + public function getMessages(): array { return $this->messages; } /** - * @{inheritDoc} + * @inheritdoc * - * @param integer $level The logging level - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed + * @param int $level The logging level + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed */ - public function addRecord($level, $message, array $context = []) - { + public function addRecord( + int $level, + string $message, + array $context = [] + ): bool { if ($level <= $this->minimumErrorLevel) { $this->messages[] = [ 'level' => $this->getLevelName($level), diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/AbstractProductExportImportTestCase.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/AbstractProductExportImportTestCase.php index c2f571097f8e9..ddcae97e5d6d5 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/AbstractProductExportImportTestCase.php +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/AbstractProductExportImportTestCase.php @@ -124,10 +124,31 @@ public function testImportExport(array $fixtures, array $skus, array $skippedAtt $csvFile = $this->executeExportTest($skus, $skippedAttributes); $this->executeImportReplaceTest($skus, $skippedAttributes, false, $csvFile); - $this->executeImportReplaceTest($skus, $skippedAttributes, true, $csvFile); $this->executeImportDeleteTest($skus, $csvFile); } + /** + * Run import/export test with pagination. + * + * @magentoAppArea adminhtml + * @magentoDbIsolation disabled + * @magentoAppIsolation enabled + * + * @param array $fixtures + * @param string[] $skus + * @param string[] $skippedAttributes + * @dataProvider exportImportDataProvider + * @throws \Magento\Framework\Exception\NoSuchEntityException + */ + public function testImportExportWithPagination(array $fixtures, array $skus, array $skippedAttributes = []) + { + $this->fixtures = $fixtures; + $this->executeFixtures($fixtures); + $this->modifyData($skus); + $skippedAttributes = array_merge(self::$skippedAttributes, $skippedAttributes); + $this->executeImportReplaceTest($skus, $skippedAttributes, true); + } + /** * Provide data for import/export. * diff --git a/dev/tests/integration/testsuite/Magento/DownloadableImportExport/Model/DownloadableTest.php b/dev/tests/integration/testsuite/Magento/DownloadableImportExport/Model/DownloadableTest.php index 861be98c13e72..4f9fbfe61e032 100644 --- a/dev/tests/integration/testsuite/Magento/DownloadableImportExport/Model/DownloadableTest.php +++ b/dev/tests/integration/testsuite/Magento/DownloadableImportExport/Model/DownloadableTest.php @@ -49,6 +49,25 @@ public function testImportExport(array $fixtures, array $skus, array $skippedAtt parent::testImportExport($fixtures, $skus, $skippedAttributes); } + /** + * Run import/export test with pagination. + * + * @magentoAppArea adminhtml + * @magentoDbIsolation disabled + * @magentoAppIsolation enabled + * + * @param array $fixtures + * @param string[] $skus + * @param string[] $skippedAttributes + * @dataProvider exportImportDataProvider + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function testImportExportWithPagination(array $fixtures, array $skus, array $skippedAttributes = []) + { + $skippedAttributes = array_merge(self::$skippedAttributes, ['downloadable_links']); + parent::testImportExportWithPagination($fixtures, $skus, $skippedAttributes); + } + /** * @inheritdoc */ diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/customer-data.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/customer-data.test.js index 952ade30969d5..e516c3f19d64a 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/customer-data.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/customer-data.test.js @@ -3,17 +3,17 @@ * See COPYING.txt for license details. */ -/* global _ */ /* eslint max-nested-callbacks: 0 */ /* jscs:disable jsDoc*/ define([ + 'underscore', 'squire', 'jquery', 'Magento_Customer/js/section-config', 'Magento_Customer/js/customer-data', 'jquery/jquery-storageapi' -], function (Squire, $, sectionConfig, customerData) { +], function (_, Squire, $, sectionConfig, customerData) { 'use strict'; var injector = new Squire(), @@ -98,9 +98,6 @@ define([ } describe('Magento_Customer/js/customer-data', function () { - - var _; - beforeAll(function () { clearLocalStorage(); }); @@ -401,7 +398,6 @@ define([ } }; }; - expect(parameters).toEqual(jasmine.objectContaining({ sections: 'section' })); @@ -410,7 +406,6 @@ define([ }); result = obj.reload(['section'], true); - expect(result).toEqual(jasmine.objectContaining({ responseJSON: { section: {} @@ -422,7 +417,6 @@ define([ var result; spyOn(sectionConfig, 'filterClientSideSections').and.returnValue(['cart,customer,messages']); - $.getJSON = jasmine.createSpy().and.callFake(function (url, parameters) { var deferred = $.Deferred(); @@ -448,7 +442,6 @@ define([ }); result = obj.reload(['cart', 'customer', 'messages'], true); - expect(result).toEqual(jasmine.objectContaining({ responseJSON: { cart: {}, @@ -457,7 +450,7 @@ define([ } })); }); - // + it('Check it returns all sections when passed wildcard string', function () { var result; @@ -486,7 +479,6 @@ define([ }); result = obj.reload('*', true); - expect($.getJSON).toHaveBeenCalled(); expect(result).toEqual(jasmine.objectContaining({ responseJSON: { diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/ko/bind/datepicker.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/ko/bind/datepicker.test.js index de38e929b7ce2..2b05f089b6e47 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/ko/bind/datepicker.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/ko/bind/datepicker.test.js @@ -2,6 +2,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +/* eslint-disable max-nested-callbacks */ define([ 'ko', @@ -19,7 +20,6 @@ define([ config; beforeEach(function () { - jasmine.clock().install(); element = $('<input />'); observable = ko.observable(); @@ -40,7 +40,6 @@ define([ }); afterEach(function () { - jasmine.clock().uninstall(); element.remove(); }); @@ -57,26 +56,27 @@ define([ expect(todayDate).toEqual(result); }); - it('update picked date\'s value after update observable value', function () { + it('update picked date\'s value after update observable value', function (done) { var date = '06/21/2019', inputFormat = 'M/d/yy', expectedDate; expectedDate = moment(date, utils.convertToMomentFormat(inputFormat)).toDate(); observable(date); - - jasmine.clock().tick(100); - - expect(expectedDate.valueOf()).toEqual(element.datepicker('getDate').valueOf()); + setTimeout(function () { + expect(expectedDate.valueOf()).toEqual(element.datepicker('getDate').valueOf()); + done(); + }, 100); }); - it('clear picked date\'s value after clear observable value', function () { + it('clear picked date\'s value after clear observable value', function (done) { element.datepicker('setTimezoneDate').trigger('blur').trigger('change'); observable(''); - jasmine.clock().tick(100); - - expect(null).toEqual(element.datepicker('getDate')); + setTimeout(function () { + expect(null).toEqual(element.datepicker('getDate')); + done(); + }, 100); }); }); }); diff --git a/dev/tests/static/framework/Magento/CodeMessDetector/Rule/Design/AllPurposeAction.php b/dev/tests/static/framework/Magento/CodeMessDetector/Rule/Design/AllPurposeAction.php index 00a6e49d4e31d..7192eeccf731b 100644 --- a/dev/tests/static/framework/Magento/CodeMessDetector/Rule/Design/AllPurposeAction.php +++ b/dev/tests/static/framework/Magento/CodeMessDetector/Rule/Design/AllPurposeAction.php @@ -32,6 +32,9 @@ public function apply(AbstractNode $node) return; } try { + if (!class_exists($node->getFullQualifiedName(), true)) { + return; + } $impl = class_implements($node->getFullQualifiedName(), true); } catch (\Throwable $exception) { //Couldn't load a class. diff --git a/dev/tests/static/framework/Magento/CodeMessDetector/Rule/Design/CookieAndSessionMisuse.php b/dev/tests/static/framework/Magento/CodeMessDetector/Rule/Design/CookieAndSessionMisuse.php index d03253bd166dc..2d0525391fbf2 100644 --- a/dev/tests/static/framework/Magento/CodeMessDetector/Rule/Design/CookieAndSessionMisuse.php +++ b/dev/tests/static/framework/Magento/CodeMessDetector/Rule/Design/CookieAndSessionMisuse.php @@ -110,7 +110,11 @@ private function isControllerPlugin(\ReflectionClass $class): bool foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) { if (preg_match('/^(after|around|before).+/i', $method->getName())) { try { - $argument = $this->getParameterClass($method->getParameters()[0]); + $parameters = $method->getParameters(); + if (count($parameters) === 0) { + continue; + } + $argument = $this->getParameterClass($parameters[0]); } catch (\Throwable $exception) { //Non-existing class (autogenerated perhaps) or doesn't have an argument. continue; @@ -139,7 +143,11 @@ private function isBlockPlugin(\ReflectionClass $class): bool foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) { if (preg_match('/^(after|around|before).+/i', $method->getName())) { try { - $argument = $this->getParameterClass($method->getParameters()[0]); + $parameters = $method->getParameters(); + if (count($parameters) === 0) { + continue; + } + $argument = $this->getParameterClass($parameters[0]); } catch (\Throwable $exception) { //Non-existing class (autogenerated perhaps) or doesn't have an argument. continue; diff --git a/dev/tests/unit/phpunit.xml.dist b/dev/tests/unit/phpunit.xml.dist index c89de486be0e4..333753048ed6d 100644 --- a/dev/tests/unit/phpunit.xml.dist +++ b/dev/tests/unit/phpunit.xml.dist @@ -28,6 +28,7 @@ </testsuite> </testsuites> <php> + <ini name="memory_limit" value="-1"/> <ini name="date.timezone" value="America/Los_Angeles"/> <ini name="xdebug.max_nesting_level" value="200"/> </php> diff --git a/lib/internal/Magento/Framework/Escaper.php b/lib/internal/Magento/Framework/Escaper.php index dae830dd889dc..dae5d99960f0f 100644 --- a/lib/internal/Magento/Framework/Escaper.php +++ b/lib/internal/Magento/Framework/Escaper.php @@ -291,7 +291,7 @@ public function escapeUrl($string) */ public function encodeUrlParam($string) { - return $this->getEscaper()->escapeUrl($string); + return $this->getEscaper()->escapeUrl((string)$string); } /** @@ -330,7 +330,7 @@ function ($matches) { */ public function escapeCss($string) { - return $this->getEscaper()->escapeCss($string); + return $this->getEscaper()->escapeCss((string)$string); } /** diff --git a/lib/internal/Magento/Framework/Logger/Handler/Base.php b/lib/internal/Magento/Framework/Logger/Handler/Base.php index 07dfd3f0963ab..d93825bcd0248 100644 --- a/lib/internal/Magento/Framework/Logger/Handler/Base.php +++ b/lib/internal/Magento/Framework/Logger/Handler/Base.php @@ -3,9 +3,11 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Framework\Logger\Handler; +use InvalidArgumentException; use Magento\Framework\Filesystem\DriverInterface; use Monolog\Formatter\LineFormatter; use Monolog\Handler\StreamHandler; @@ -33,19 +35,20 @@ class Base extends StreamHandler /** * @param DriverInterface $filesystem - * @param string $filePath - * @param string $fileName - * @throws \Exception + * @param string|null $filePath + * @param string|null $fileName */ public function __construct( DriverInterface $filesystem, - $filePath = null, - $fileName = null + ?string $filePath = null, + ?string $fileName = null ) { $this->filesystem = $filesystem; + if (!empty($fileName)) { $this->fileName = $this->sanitizeFileName($fileName); } + parent::__construct( $filePath ? $filePath . $this->fileName : BP . DIRECTORY_SEPARATOR . $this->fileName, $this->loggerType @@ -59,14 +62,9 @@ public function __construct( * * @param string $fileName * @return string - * @throws \InvalidArgumentException */ - private function sanitizeFileName($fileName) + private function sanitizeFileName(string $fileName): string { - if (!is_string($fileName)) { - throw new \InvalidArgumentException('Filename expected to be a string'); - } - $parts = explode('/', $fileName); $parts = array_filter($parts, function ($value) { return !in_array($value, ['', '.', '..']); @@ -78,9 +76,10 @@ private function sanitizeFileName($fileName) /** * @inheritDoc */ - protected function write(array $record) + protected function write(array $record): void { $logDir = $this->filesystem->getParentDirectory($this->url); + if (!$this->filesystem->isDirectory($logDir)) { $this->filesystem->createDirectory($logDir); } diff --git a/lib/internal/Magento/Framework/Logger/Handler/System.php b/lib/internal/Magento/Framework/Logger/Handler/System.php index c519e320a254d..ff57ae872c713 100644 --- a/lib/internal/Magento/Framework/Logger/Handler/System.php +++ b/lib/internal/Magento/Framework/Logger/Handler/System.php @@ -3,10 +3,13 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Framework\Logger\Handler; +use Exception; use Magento\Framework\Filesystem\DriverInterface; +use Magento\Framework\Logger\Handler\Exception as ExceptionHandler; use Monolog\Logger; /** @@ -25,38 +28,38 @@ class System extends Base protected $loggerType = Logger::INFO; /** - * @var Exception + * @var ExceptionHandler */ protected $exceptionHandler; /** * @param DriverInterface $filesystem - * @param Exception $exceptionHandler - * @param string $filePath + * @param ExceptionHandler $exceptionHandler + * @param string|null $filePath + * @throws Exception */ public function __construct( DriverInterface $filesystem, - Exception $exceptionHandler, - $filePath = null + ExceptionHandler $exceptionHandler, + ?string $filePath = null ) { $this->exceptionHandler = $exceptionHandler; parent::__construct($filesystem, $filePath); } /** - * Writes formatted record through the handler. + * Writes formatted record through the handler * * @param array $record The record metadata * @return void */ - public function write(array $record) + public function write(array $record): void { if (isset($record['context']['exception'])) { $this->exceptionHandler->handle($record); return; } - $record['formatted'] = $this->getFormatter()->format($record); parent::write($record); diff --git a/lib/internal/Magento/Framework/Logger/Monolog.php b/lib/internal/Magento/Framework/Logger/Monolog.php index 05ef4cf262d77..105acffc5355f 100644 --- a/lib/internal/Magento/Framework/Logger/Monolog.php +++ b/lib/internal/Magento/Framework/Logger/Monolog.php @@ -3,48 +3,32 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Framework\Logger; +use DateTimeZone; use Monolog\Logger; +/** + * Monolog Logger + */ class Monolog extends Logger { /** * @inheritdoc */ - public function __construct($name, array $handlers = [], array $processors = []) - { + public function __construct( + string $name, + array $handlers = [], + array $processors = [], + ?DateTimeZone $timezone = null + ) { /** * TODO: This should be eliminated with MAGETWO-53989 */ $handlers = array_values($handlers); - parent::__construct($name, $handlers, $processors); - } - - /** - * Adds a log record. - * - * @param integer $level The logging level - * @param string $message The log message - * @param array $context The log context - * @return bool Whether the record has been processed - */ - public function addRecord($level, $message, array $context = []) - { - /** - * To preserve compatibility with Exception messages. - * And support PSR-3 context standard. - * - * @link http://www.php-fig.org/psr/psr-3/#context PSR-3 context standard - */ - if ($message instanceof \Exception && !isset($context['exception'])) { - $context['exception'] = $message; - } - - $message = $message instanceof \Exception ? $message->getMessage() : $message; - - return parent::addRecord($level, $message, $context); + parent::__construct($name, $handlers, $processors, $timezone); } } diff --git a/lib/internal/Magento/Framework/Logger/Test/Unit/Handler/BaseTest.php b/lib/internal/Magento/Framework/Logger/Test/Unit/Handler/BaseTest.php index 47169fd2bc0be..f6f9b537c4fd2 100644 --- a/lib/internal/Magento/Framework/Logger/Test/Unit/Handler/BaseTest.php +++ b/lib/internal/Magento/Framework/Logger/Test/Unit/Handler/BaseTest.php @@ -61,11 +61,4 @@ public function testSanitizeParentLevelFolder() $this->sanitizeMethod->invokeArgs($this->model, ['../../../var/hack/custom.log']) ); } - - public function testSanitizeFileException() - { - $this->expectException('InvalidArgumentException'); - $this->expectExceptionMessage('Filename expected to be a string'); - $this->sanitizeMethod->invokeArgs($this->model, [['filename' => 'notValid']]); - } } diff --git a/lib/internal/Magento/Framework/Logger/Test/Unit/Handler/SystemTest.php b/lib/internal/Magento/Framework/Logger/Test/Unit/Handler/SystemTest.php index e9b0bb1cfd359..39dec8935c73d 100644 --- a/lib/internal/Magento/Framework/Logger/Test/Unit/Handler/SystemTest.php +++ b/lib/internal/Magento/Framework/Logger/Test/Unit/Handler/SystemTest.php @@ -7,8 +7,10 @@ namespace Magento\Framework\Logger\Test\Unit\Handler; +use DateTime; +use Exception; use Magento\Framework\Filesystem\DriverInterface; -use Magento\Framework\Logger\Handler\Exception; +use Magento\Framework\Logger\Handler\Exception as ExceptionHandler; use Magento\Framework\Logger\Handler\System; use Monolog\Logger; use PHPUnit\Framework\MockObject\MockObject as Mock; @@ -27,20 +29,22 @@ class SystemTest extends TestCase private $filesystemMock; /** - * @var Exception|Mock + * @var ExceptionHandler|Mock */ private $exceptionHandlerMock; /** * @inheritdoc + * + * @throws Exception */ protected function setUp(): void { $this->filesystemMock = $this->getMockBuilder(DriverInterface::class) ->getMockForAbstractClass(); - $this->exceptionHandlerMock = $this->getMockBuilder(Exception::class) - ->disableOriginalConstructor() - ->getMock(); + $this->exceptionHandlerMock = $this->getMockBuilder( + ExceptionHandler::class + )->disableOriginalConstructor()->getMock(); $this->model = new System( $this->filesystemMock, @@ -62,7 +66,7 @@ public function testWrite() public function testWriteException() { $record = $this->getRecord(); - $record['context']['exception'] = new \Exception('Some exception'); + $record['context']['exception'] = new Exception('Some exception'); $this->exceptionHandlerMock->expects($this->once()) ->method('handle') @@ -79,15 +83,21 @@ public function testWriteException() * @param array $context * @return array */ - private function getRecord($level = Logger::WARNING, $message = 'test', $context = []) - { + private function getRecord( + int $level = Logger::WARNING, + string $message = 'test', + array $context = [] + ): array { return [ 'message' => $message, 'context' => $context, 'level' => $level, 'level_name' => Logger::getLevelName($level), 'channel' => 'test', - 'datetime' => \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true))), + 'datetime' => DateTime::createFromFormat( + 'U.u', + sprintf('%.6F', microtime(true)) + ), 'extra' => [], ]; } diff --git a/lib/internal/Magento/Framework/Logger/Test/Unit/MonologTest.php b/lib/internal/Magento/Framework/Logger/Test/Unit/MonologTest.php index 9173b47a4b6f3..d11b552e9dbe1 100644 --- a/lib/internal/Magento/Framework/Logger/Test/Unit/MonologTest.php +++ b/lib/internal/Magento/Framework/Logger/Test/Unit/MonologTest.php @@ -7,8 +7,10 @@ namespace Magento\Framework\Logger\Test\Unit; +use Exception; use Magento\Framework\Logger\Monolog; use Monolog\Handler\TestHandler; +use Monolog\Logger; use PHPUnit\Framework\TestCase; class MonologTest extends TestCase @@ -20,23 +22,9 @@ public function testAddRecord() $logger->pushHandler($handler); - $logger->addError('test'); + $logger->addRecord(Logger::ERROR, 'test'); list($record) = $handler->getRecords(); $this->assertSame('test', $record['message']); } - - public function testAddRecordAsException() - { - $logger = new Monolog(__METHOD__); - $handler = new TestHandler(); - - $logger->pushHandler($handler); - - $logger->addError(new \Exception('Some exception')); - list($record) = $handler->getRecords(); - - $this->assertInstanceOf(\Exception::class, $record['context']['exception']); - $this->assertSame('Some exception', $record['message']); - } } diff --git a/lib/internal/Magento/Framework/Test/Unit/EscaperTest.php b/lib/internal/Magento/Framework/Test/Unit/EscaperTest.php index 67dac40863ad4..91cc99d09c6a3 100644 --- a/lib/internal/Magento/Framework/Test/Unit/EscaperTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/EscaperTest.php @@ -364,6 +364,76 @@ public function testEscapeUrl(string $data, string $expected): void $this->assertEquals($expected, $this->escaper->escapeUrl($expected)); } + /** + * @covers \Magento\Framework\Escaper::escapeCss + * + * @param string $data + * @param string $expected + * @return void + * + * @dataProvider escapeCssDataProvider + */ + public function testEscapeCss($data, string $expected): void + { + $this->assertEquals($expected, $this->escaper->escapeCss($data)); + } + + /** + * @return array + */ + public function escapeCssDataProvider(): array + { + return [ + [ + 'data' => 1, + 'expected' => '1', + ], + [ + 'data' => '*%string{foo}%::', + 'expected' => '\2A \25 string\7B foo\7D \25 \3A \3A ', + ] + ]; + } + + /** + * @covers \Magento\Framework\Escaper::encodeUrlParam + * + * @param string $data + * @param string $expected + * @return void + * + * @dataProvider encodeUrlParamDataProvider + */ + public function testEncodeUrlParam($data, string $expected): void + { + $this->assertEquals($expected, $this->escaper->encodeUrlParam($data)); + } + + /** + * @return array + */ + public function encodeUrlParamDataProvider(): array + { + return [ + [ + 'data' => "a3==", + 'expected' => "a3%3D%3D", + ], + [ + 'data' => "example string", + 'expected' => "example%20string", + ], + [ + 'data' => 1, + 'expected' => "1", + ], + [ + 'data' => null, + 'expected' => "", + ] + ]; + } + /** * @return array */ diff --git a/lib/internal/Magento/Framework/Url/RouteParamsResolver.php b/lib/internal/Magento/Framework/Url/RouteParamsResolver.php index eac9005e68548..3d5b559e97843 100644 --- a/lib/internal/Magento/Framework/Url/RouteParamsResolver.php +++ b/lib/internal/Magento/Framework/Url/RouteParamsResolver.php @@ -112,7 +112,7 @@ public function setRouteParams(array $data, $unsetOldParams = true) } else { $this->setRouteParam( $this->getEscaper()->encodeUrlParam($key), - $this->getEscaper()->encodeUrlParam($value) + $this->getEscaper()->encodeUrlParam((string)$value) ); } } diff --git a/lib/internal/Magento/Framework/composer.json b/lib/internal/Magento/Framework/composer.json index e81c83ab28378..49b04b058f565 100644 --- a/lib/internal/Magento/Framework/composer.json +++ b/lib/internal/Magento/Framework/composer.json @@ -35,7 +35,7 @@ "laminas/laminas-uri": "^2.5.1", "laminas/laminas-validator": "^2.6.0", "magento/zendframework1": "~1.14.2", - "monolog/monolog": "^1.17", + "monolog/monolog": "^2.3", "ramsey/uuid": "~4.1.0", "symfony/console": "~4.4.0", "symfony/process": "~4.4.0", diff --git a/lib/web/legacy-build.min.js b/lib/web/legacy-build.min.js index 455d1e591ddae..cff6ea5ce84b4 100644 --- a/lib/web/legacy-build.min.js +++ b/lib/web/legacy-build.min.js @@ -1,4 +1,4 @@ -var Prototype={Version:"1.7.3",Browser:(function(){var d=navigator.userAgent;var b=Object.prototype.toString.call(window.opera)=="[object Opera]";return{IE:!!window.attachEvent&&!b,Opera:b,WebKit:d.indexOf("AppleWebKit/")>-1,Gecko:d.indexOf("Gecko")>-1&&d.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile/.test(d)}})(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){var b=window.Element||window.HTMLElement;return !!(b&&b.prototype)})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=="undefined"){return true}var e=document.createElement("div"),d=document.createElement("form"),b=false;if(e.__proto__&&(e.__proto__!==d.__proto__)){b=true}e=d=null;return b})()},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script\\s*>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(b){return b}};if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false}var Class=(function(){var f=(function(){for(var g in {toString:1}){if(g==="toString"){return false}}return true})();function b(){}function d(){var n=null,l=$A(arguments);if(Object.isFunction(l[0])){n=l.shift()}function g(){this.initialize.apply(this,arguments)}Object.extend(g,Class.Methods);g.superclass=n;g.subclasses=[];if(n){b.prototype=n.prototype;g.prototype=new b;n.subclasses.push(g)}for(var h=0,o=l.length;h<o;h++){g.addMethods(l[h])}if(!g.prototype.initialize){g.prototype.initialize=Prototype.emptyFunction}g.prototype.constructor=g;return g}function e(q){var l=this.superclass&&this.superclass.prototype,h=Object.keys(q);if(f){if(q.toString!=Object.prototype.toString){h.push("toString")}if(q.valueOf!=Object.prototype.valueOf){h.push("valueOf")}}for(var g=0,n=h.length;g<n;g++){var p=h[g],o=q[p];if(l&&Object.isFunction(o)&&o.argumentNames()[0]=="$super"){var r=o;o=(function(s){return function(){return l[s].apply(this,arguments)}})(p).wrap(r);o.valueOf=(function(s){return function(){return s.valueOf.call(s)}})(r);o.toString=(function(s){return function(){return s.toString.call(s)}})(r)}this.prototype[p]=o}return this}return{create:d,Methods:{addMethods:e}}})();(function(){var F=Object.prototype.toString,q=Object.prototype.hasOwnProperty,G="Null",I="Undefined",R="Boolean",D="Number",C="String",P="Object",o="[object Function]",f="[object Boolean]",p="[object Number]",h="[object String]",d="[object Array]",O="[object Date]",g=window.JSON&&typeof JSON.stringify==="function"&&JSON.stringify(0)==="0"&&typeof JSON.stringify(Prototype.K)==="undefined";var w=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];var b=(function(){for(var S in {toString:1}){if(S==="toString"){return false}}return true})();function K(T){switch(T){case null:return G;case (void 0):return I}var S=typeof T;switch(S){case"boolean":return R;case"number":return D;case"string":return C}return P}function n(S,U){for(var T in U){S[T]=U[T]}return S}function r(S){try{if(u(S)){return"undefined"}if(S===null){return"null"}return S.inspect?S.inspect():String(S)}catch(T){if(T instanceof RangeError){return"..."}throw T}}function H(S){return s("",{"":S},[])}function s(ab,Y,Z){var aa=Y[ab];if(K(aa)===P&&typeof aa.toJSON==="function"){aa=aa.toJSON(ab)}var U=F.call(aa);switch(U){case p:case f:case h:aa=aa.valueOf()}switch(aa){case null:return"null";case true:return"true";case false:return"false"}var X=typeof aa;switch(X){case"string":return aa.inspect(true);case"number":return isFinite(aa)?String(aa):"null";case"object":for(var T=0,S=Z.length;T<S;T++){if(Z[T]===aa){throw new TypeError("Cyclic reference to '"+aa+"' in object")}}Z.push(aa);var W=[];if(U===d){for(var T=0,S=aa.length;T<S;T++){var V=s(T,aa,Z);W.push(typeof V==="undefined"?"null":V)}W="["+W.join(",")+"]"}else{var ac=Object.keys(aa);for(var T=0,S=ac.length;T<S;T++){var ab=ac[T],V=s(ab,aa,Z);if(typeof V!=="undefined"){W.push(ab.inspect(true)+":"+V)}}W="{"+W.join(",")+"}"}Z.pop();return W}}function Q(S){return JSON.stringify(S)}function J(S){return $H(S).toQueryString()}function v(S){return S&&S.toHTML?S.toHTML():String.interpret(S)}function E(S){if(K(S)!==P){throw new TypeError()}var U=[];for(var V in S){if(q.call(S,V)){U.push(V)}}if(b){for(var T=0;V=w[T];T++){if(q.call(S,V)){U.push(V)}}}return U}function N(S){var T=[];for(var U in S){T.push(S[U])}return T}function z(S){return n({},S)}function L(S){return !!(S&&S.nodeType==1)}function B(S){return F.call(S)===d}var e=(typeof Array.isArray=="function")&&Array.isArray([])&&!Array.isArray({});if(e){B=Array.isArray}function y(S){return S instanceof Hash}function t(S){return F.call(S)===o}function l(S){return F.call(S)===h}function M(S){return F.call(S)===p}function A(S){return F.call(S)===O}function u(S){return typeof S==="undefined"}n(Object,{extend:n,inspect:r,toJSON:g?Q:H,toQueryString:J,toHTML:v,keys:Object.keys||E,values:N,clone:z,isElement:L,isArray:B,isHash:y,isFunction:t,isString:l,isNumber:M,isDate:A,isUndefined:u})})();Object.extend(Function.prototype,(function(){var r=Array.prototype.slice;function f(v,s){var u=v.length,t=s.length;while(t--){v[u+t]=s[t]}return v}function p(t,s){t=r.call(t,0);return f(t,s)}function l(){var s=this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g,"").replace(/\s+/g,"").split(",");return s.length==1&&!s[0]?[]:s}function n(u){if(arguments.length<2&&Object.isUndefined(arguments[0])){return this}if(!Object.isFunction(this)){throw new TypeError("The object is not callable.")}var w=function(){};var s=this,t=r.call(arguments,1);var v=function(){var y=p(t,arguments);var z=this instanceof v?this:u;return s.apply(z,y)};w.prototype=this.prototype;v.prototype=new w();return v}function h(u){var s=this,t=r.call(arguments,1);return function(w){var v=f([w||window.event],t);return s.apply(u,v)}}function q(){if(!arguments.length){return this}var s=this,t=r.call(arguments,0);return function(){var u=p(t,arguments);return s.apply(this,u)}}function g(u){var s=this,t=r.call(arguments,1);u=u*1000;return window.setTimeout(function(){return s.apply(s,t)},u)}function b(){var s=f([0.01],arguments);return this.delay.apply(this,s)}function e(t){var s=this;return function(){var u=f([s.bind(this)],arguments);return t.apply(this,u)}}function d(){if(this._methodized){return this._methodized}var s=this;return this._methodized=function(){var t=f([this],arguments);return s.apply(null,t)}}var o={argumentNames:l,bindAsEventListener:h,curry:q,delay:g,defer:b,wrap:e,methodize:d};if(!Function.prototype.bind){o.bind=n}return o})());(function(e){function d(){return this.getUTCFullYear()+"-"+(this.getUTCMonth()+1).toPaddedString(2)+"-"+this.getUTCDate().toPaddedString(2)+"T"+this.getUTCHours().toPaddedString(2)+":"+this.getUTCMinutes().toPaddedString(2)+":"+this.getUTCSeconds().toPaddedString(2)+"Z"}function b(){return this.toISOString()}if(!e.toISOString){e.toISOString=d}if(!e.toJSON){e.toJSON=b}})(Date.prototype);RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(b){return String(b).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};var PeriodicalExecuter=Class.create({initialize:function(d,b){this.callback=d;this.frequency=b;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},execute:function(){this.callback(this)},stop:function(){if(!this.timer){return}clearInterval(this.timer);this.timer=null},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute();this.currentlyExecuting=false}catch(b){this.currentlyExecuting=false;throw b}}}});Object.extend(String,{interpret:function(b){return b==null?"":String(b)},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});Object.extend(String.prototype,(function(){var NATIVE_JSON_PARSE_SUPPORT=window.JSON&&typeof JSON.parse==="function"&&JSON.parse('{"test": true}').test;function prepareReplacement(replacement){if(Object.isFunction(replacement)){return replacement}var template=new Template(replacement);return function(match){return template.evaluate(match)}}function isNonEmptyRegExp(regexp){return regexp.source&®exp.source!=="(?:)"}function gsub(pattern,replacement){var result="",source=this,match;replacement=prepareReplacement(replacement);if(Object.isString(pattern)){pattern=RegExp.escape(pattern)}if(!(pattern.length||isNonEmptyRegExp(pattern))){replacement=replacement("");return replacement+source.split("").join(replacement)+replacement}while(source.length>0){match=source.match(pattern);if(match&&match[0].length>0){result+=source.slice(0,match.index);result+=String.interpret(replacement(match));source=source.slice(match.index+match[0].length)}else{result+=source,source=""}}return result}function sub(pattern,replacement,count){replacement=prepareReplacement(replacement);count=Object.isUndefined(count)?1:count;return this.gsub(pattern,function(match){if(--count<0){return match[0]}return replacement(match)})}function scan(pattern,iterator){this.gsub(pattern,iterator);return String(this)}function truncate(length,truncation){length=length||30;truncation=Object.isUndefined(truncation)?"...":truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:String(this)}function strip(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}function stripTags(){return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?(\/)?>|<\/\w+>/gi,"")}function stripScripts(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")}function extractScripts(){var matchAll=new RegExp(Prototype.ScriptFragment,"img"),matchOne=new RegExp(Prototype.ScriptFragment,"im");return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||["",""])[1]})}function evalScripts(){return this.extractScripts().map(function(script){return eval(script)})}function escapeHTML(){return this.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function unescapeHTML(){return this.stripTags().replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}function toQueryParams(separator){var match=this.strip().match(/([^?#]*)(#.*)?$/);if(!match){return{}}return match[1].split(separator||"&").inject({},function(hash,pair){if((pair=pair.split("="))[0]){var key=decodeURIComponent(pair.shift()),value=pair.length>1?pair.join("="):pair[0];if(value!=undefined){value=value.gsub("+"," ");value=decodeURIComponent(value)}if(key in hash){if(!Object.isArray(hash[key])){hash[key]=[hash[key]]}hash[key].push(value)}else{hash[key]=value}}return hash})}function toArray(){return this.split("")}function succ(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)}function times(count){return count<1?"":new Array(count+1).join(this)}function camelize(){return this.replace(/-+(.)?/g,function(match,chr){return chr?chr.toUpperCase():""})}function capitalize(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()}function underscore(){return this.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/-/g,"_").toLowerCase()}function dasherize(){return this.replace(/_/g,"-")}function inspect(useDoubleQuotes){var escapedString=this.replace(/[\x00-\x1f\\]/g,function(character){if(character in String.specialChar){return String.specialChar[character]}return"\\u00"+character.charCodeAt().toPaddedString(2,16)});if(useDoubleQuotes){return'"'+escapedString.replace(/"/g,'\\"')+'"'}return"'"+escapedString.replace(/'/g,"\\'")+"'"}function unfilterJSON(filter){return this.replace(filter||Prototype.JSONFilter,"$1")}function isJSON(){var str=this;if(str.blank()){return false}str=str.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@");str=str.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]");str=str.replace(/(?:^|:|,)(?:\s*\[)+/g,"");return(/^[\],:{}\s]*$/).test(str)}function evalJSON(sanitize){var json=this.unfilterJSON(),cx=/[\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff\u0000]/g;if(cx.test(json)){json=json.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}try{if(!sanitize||json.isJSON()){return eval("("+json+")")}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())}function parseJSON(){var json=this.unfilterJSON();return JSON.parse(json)}function include(pattern){return this.indexOf(pattern)>-1}function startsWith(pattern,position){position=Object.isNumber(position)?position:0;return this.lastIndexOf(pattern,position)===position}function endsWith(pattern,position){pattern=String(pattern);position=Object.isNumber(position)?position:this.length;if(position<0){position=0}if(position>this.length){position=this.length}var d=position-pattern.length;return d>=0&&this.indexOf(pattern,d)===d}function empty(){return this==""}function blank(){return/^\s*$/.test(this)}function interpolate(object,pattern){return new Template(this,pattern).evaluate(object)}return{gsub:gsub,sub:sub,scan:scan,truncate:truncate,strip:String.prototype.trim||strip,stripTags:stripTags,stripScripts:stripScripts,extractScripts:extractScripts,evalScripts:evalScripts,escapeHTML:escapeHTML,unescapeHTML:unescapeHTML,toQueryParams:toQueryParams,parseQuery:toQueryParams,toArray:toArray,succ:succ,times:times,camelize:camelize,capitalize:capitalize,underscore:underscore,dasherize:dasherize,inspect:inspect,unfilterJSON:unfilterJSON,isJSON:isJSON,evalJSON:NATIVE_JSON_PARSE_SUPPORT?parseJSON:evalJSON,include:include,startsWith:String.prototype.startsWith||startsWith,endsWith:String.prototype.endsWith||endsWith,empty:empty,blank:blank,interpolate:interpolate}})());var Template=Class.create({initialize:function(b,d){this.template=b.toString();this.pattern=d||Template.Pattern},evaluate:function(b){if(b&&Object.isFunction(b.toTemplateReplacements)){b=b.toTemplateReplacements()}return this.template.gsub(this.pattern,function(f){if(b==null){return(f[1]+"")}var h=f[1]||"";if(h=="\\"){return f[2]}var d=b,l=f[3],g=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;f=g.exec(l);if(f==null){return h}while(f!=null){var e=f[1].startsWith("[")?f[2].replace(/\\\\]/g,"]"):f[1];d=d[e];if(null==d||""==f[3]){break}l=l.substring("["==f[3]?f[1].length:f[0].length);f=g.exec(l)}return h+String.interpret(d)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable=(function(){function e(E,D){try{this._each(E,D)}catch(F){if(F!=$break){throw F}}return this}function y(G,F,E){var D=-G,H=[],I=this.toArray();if(G<1){return I}while((D+=G)<I.length){H.push(I.slice(D,D+G))}return H.collect(F,E)}function d(F,E){F=F||Prototype.K;var D=true;this.each(function(H,G){D=D&&!!F.call(E,H,G,this);if(!D){throw $break}},this);return D}function o(F,E){F=F||Prototype.K;var D=false;this.each(function(H,G){if(D=!!F.call(E,H,G,this)){throw $break}},this);return D}function p(F,E){F=F||Prototype.K;var D=[];this.each(function(H,G){D.push(F.call(E,H,G,this))},this);return D}function A(F,E){var D;this.each(function(H,G){if(F.call(E,H,G,this)){D=H;throw $break}},this);return D}function n(F,E){var D=[];this.each(function(H,G){if(F.call(E,H,G,this)){D.push(H)}},this);return D}function l(G,F,E){F=F||Prototype.K;var D=[];if(Object.isString(G)){G=new RegExp(RegExp.escape(G))}this.each(function(I,H){if(G.match(I)){D.push(F.call(E,I,H,this))}},this);return D}function b(D){if(Object.isFunction(this.indexOf)&&this.indexOf(D)!=-1){return true}var E=false;this.each(function(F){if(F==D){E=true;throw $break}});return E}function w(E,D){D=Object.isUndefined(D)?null:D;return this.eachSlice(E,function(F){while(F.length<E){F.push(D)}return F})}function r(D,F,E){this.each(function(H,G){D=F.call(E,D,H,G,this)},this);return D}function C(E){var D=$A(arguments).slice(1);return this.map(function(F){return F[E].apply(F,D)})}function v(F,E){F=F||Prototype.K;var D;this.each(function(H,G){H=F.call(E,H,G,this);if(D==null||H>=D){D=H}},this);return D}function t(F,E){F=F||Prototype.K;var D;this.each(function(H,G){H=F.call(E,H,G,this);if(D==null||H<D){D=H}},this);return D}function g(G,E){G=G||Prototype.K;var F=[],D=[];this.each(function(I,H){(G.call(E,I,H,this)?F:D).push(I)},this);return[F,D]}function h(E){var D=[];this.each(function(F){D.push(F[E])});return D}function f(F,E){var D=[];this.each(function(H,G){if(!F.call(E,H,G,this)){D.push(H)}},this);return D}function s(E,D){return this.map(function(G,F){return{value:G,criteria:E.call(D,G,F,this)}},this).sort(function(I,H){var G=I.criteria,F=H.criteria;return G<F?-1:G>F?1:0}).pluck("value")}function u(){return this.map()}function z(){var E=Prototype.K,D=$A(arguments);if(Object.isFunction(D.last())){E=D.pop()}var F=[this].concat(D).map($A);return this.map(function(H,G){return E(F.pluck(G))})}function q(){return this.toArray().length}function B(){return"#<Enumerable:"+this.toArray().inspect()+">"}return{each:e,eachSlice:y,all:d,every:d,any:o,some:o,collect:p,map:p,detect:A,findAll:n,select:n,filter:n,grep:l,include:b,member:b,inGroupsOf:w,inject:r,invoke:C,max:v,min:t,partition:g,pluck:h,reject:f,sortBy:s,toArray:u,entries:u,zip:z,size:q,inspect:B,find:A}})();function $A(e){if(!e){return[]}if("toArray" in Object(e)){return e.toArray()}var d=e.length||0,b=new Array(d);while(d--){b[d]=e[d]}return b}function $w(b){if(!Object.isString(b)){return[]}b=b.strip();return b?b.split(/\s+/):[]}Array.from=$A;(function(){var C=Array.prototype,u=C.slice,w=C.forEach;function d(I,H){for(var G=0,J=this.length>>>0;G<J;G++){if(G in this){I.call(H,this[G],G,this)}}}if(!w){w=d}function t(){this.length=0;return this}function f(){return this[0]}function l(){return this[this.length-1]}function q(){return this.select(function(G){return G!=null})}function F(){return this.inject([],function(H,G){if(Object.isArray(G)){return H.concat(G.flatten())}H.push(G);return H})}function p(){var G=u.call(arguments,0);return this.select(function(H){return !G.include(H)})}function h(G){return(G===false?this.toArray():this)._reverse()}function s(G){return this.inject([],function(J,I,H){if(0==H||(G?J.last()!=I:!J.include(I))){J.push(I)}return J})}function y(G){return this.uniq().findAll(function(H){return G.indexOf(H)!==-1})}function A(){return u.call(this,0)}function r(){return this.length}function D(){return"["+this.map(Object.inspect).join(", ")+"]"}function b(J,H){if(this==null){throw new TypeError()}var K=Object(this),I=K.length>>>0;if(I===0){return -1}H=Number(H);if(isNaN(H)){H=0}else{if(H!==0&&isFinite(H)){H=(H>0?1:-1)*Math.floor(Math.abs(H))}}if(H>I){return -1}var G=H>=0?H:Math.max(I-Math.abs(H),0);for(;G<I;G++){if(G in K&&K[G]===J){return G}}return -1}function v(J,H){if(this==null){throw new TypeError()}var K=Object(this),I=K.length>>>0;if(I===0){return -1}if(!Object.isUndefined(H)){H=Number(H);if(isNaN(H)){H=0}else{if(H!==0&&isFinite(H)){H=(H>0?1:-1)*Math.floor(Math.abs(H))}}}else{H=I}var G=H>=0?Math.min(H,I-1):I-Math.abs(H);for(;G>=0;G--){if(G in K&&K[G]===J){return G}}return -1}function e(N){var L=[],M=u.call(arguments,0),O,H=0;M.unshift(this);for(var K=0,G=M.length;K<G;K++){O=M[K];if(Object.isArray(O)&&!("callee" in O)){for(var J=0,I=O.length;J<I;J++){if(J in O){L[H]=O[J]}H++}}else{L[H++]=O}}L.length=H;return L}function z(G){return function(){if(arguments.length===0){return G.call(this,Prototype.K)}else{if(arguments[0]===undefined){var H=u.call(arguments,1);H.unshift(Prototype.K);return G.apply(this,H)}else{return G.apply(this,arguments)}}}}function B(K){if(this==null){throw new TypeError()}K=K||Prototype.K;var G=Object(this);var J=[],I=arguments[1],M=0;for(var H=0,L=G.length>>>0;H<L;H++){if(H in G){J[M]=K.call(I,G[H],H,G)}M++}J.length=M;return J}if(C.map){B=z(Array.prototype.map)}function n(K){if(this==null||!Object.isFunction(K)){throw new TypeError()}var G=Object(this);var J=[],I=arguments[1],M;for(var H=0,L=G.length>>>0;H<L;H++){if(H in G){M=G[H];if(K.call(I,M,H,G)){J.push(M)}}}return J}if(C.filter){n=Array.prototype.filter}function o(J){if(this==null){throw new TypeError()}J=J||Prototype.K;var I=arguments[1];var G=Object(this);for(var H=0,K=G.length>>>0;H<K;H++){if(H in G&&J.call(I,G[H],H,G)){return true}}return false}if(C.some){o=z(Array.prototype.some)}function E(J){if(this==null){throw new TypeError()}J=J||Prototype.K;var I=arguments[1];var G=Object(this);for(var H=0,K=G.length>>>0;H<K;H++){if(H in G&&!J.call(I,G[H],H,G)){return false}}return true}if(C.every){E=z(Array.prototype.every)}Object.extend(C,Enumerable);if(C.entries===Enumerable.entries){delete C.entries}if(!C._reverse){C._reverse=C.reverse}Object.extend(C,{_each:w,map:B,collect:B,select:n,filter:n,findAll:n,some:o,any:o,every:E,all:E,clear:t,first:f,last:l,compact:q,flatten:F,without:p,reverse:h,uniq:s,intersect:y,clone:A,toArray:A,size:r,inspect:D});var g=(function(){return[].concat(arguments)[0][0]!==1})(1,2);if(g){C.concat=e}if(!C.indexOf){C.indexOf=b}if(!C.lastIndexOf){C.lastIndexOf=v}})();function $H(b){return new Hash(b)}var Hash=Class.create(Enumerable,(function(){function g(v){this._object=Object.isHash(v)?v.toObject():Object.clone(v)}function h(z,y){var w=0;for(var v in this._object){var A=this._object[v],B=[v,A];B.key=v;B.value=A;z.call(y,B,w);w++}}function p(v,w){return this._object[v]=w}function e(v){if(this._object[v]!==Object.prototype[v]){return this._object[v]}}function s(v){var w=this._object[v];delete this._object[v];return w}function u(){return Object.clone(this._object)}function t(){return this.pluck("key")}function r(){return this.pluck("value")}function l(w){var v=this.detect(function(y){return y.value===w});return v&&v.key}function o(v){return this.clone().update(v)}function f(v){return new Hash(v).inject(this,function(w,y){w.set(y.key,y.value);return w})}function d(v,w){if(Object.isUndefined(w)){return v}w=String.interpret(w);w=w.gsub(/(\r)?\n/,"\r\n");w=encodeURIComponent(w);w=w.gsub(/%20/,"+");return v+"="+w}function b(){return this.inject([],function(A,D){var z=encodeURIComponent(D.key),w=D.value;if(w&&typeof w=="object"){if(Object.isArray(w)){var C=[];for(var y=0,v=w.length,B;y<v;y++){B=w[y];C.push(d(z,B))}return A.concat(C)}}else{A.push(d(z,w))}return A}).join("&")}function q(){return"#<Hash:{"+this.map(function(v){return v.map(Object.inspect).join(": ")}).join(", ")+"}>"}function n(){return new Hash(this)}return{initialize:g,_each:h,set:p,get:e,unset:s,toObject:u,toTemplateReplacements:u,keys:t,values:r,index:l,merge:o,update:f,toQueryString:b,inspect:q,toJSON:u,clone:n}})());Hash.from=$H;Object.extend(Number.prototype,(function(){function f(){return this.toPaddedString(2,16)}function d(){return this+1}function n(p,o){$R(0,this,true).each(p,o);return this}function l(q,p){var o=this.toString(p||10);return"0".times(q-o.length)+o}function b(){return Math.abs(this)}function e(){return Math.round(this)}function g(){return Math.ceil(this)}function h(){return Math.floor(this)}return{toColorPart:f,succ:d,times:n,toPaddedString:l,abs:b,round:e,ceil:g,floor:h}})());function $R(e,b,d){return new ObjectRange(e,b,d)}var ObjectRange=Class.create(Enumerable,(function(){function d(h,f,g){this.start=h;this.end=f;this.exclusive=g}function e(h,g){var l=this.start,f;for(f=0;this.include(l);f++){h.call(g,l,f);l=l.succ()}}function b(f){if(f<this.start){return false}if(this.exclusive){return f<this.end}return f<=this.end}return{initialize:d,_each:e,include:b}})());var Abstract={};var Try={these:function(){var f;for(var d=0,g=arguments.length;d<g;d++){var b=arguments[d];try{f=b();break}catch(h){}}return f}};var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")})||false},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(d,b){this.responders._each(d,b)},register:function(b){if(!this.include(b)){this.responders.push(b)}},unregister:function(b){this.responders=this.responders.without(b)},dispatch:function(f,d,e,b){this.each(function(g){if(Object.isFunction(g[f])){try{g[f].apply(g,[d,e,b])}catch(h){}}})}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=Class.create({initialize:function(b){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:"",evalJSON:true,evalJS:true};Object.extend(this.options,b||{});this.options.method=this.options.method.toLowerCase();if(Object.isHash(this.options.parameters)){this.options.parameters=this.options.parameters.toObject()}}});Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,d,b){$super(b);this.transport=Ajax.getTransport();this.request(d)},request:function(d){this.url=d;this.method=this.options.method;var g=Object.isString(this.options.parameters)?this.options.parameters:Object.toQueryString(this.options.parameters);if(!["get","post"].include(this.method)){g+=(g?"&":"")+"_method="+this.method;this.method="post"}if(g&&this.method==="get"){this.url+=(this.url.include("?")?"&":"?")+g}this.parameters=g.toQueryParams();try{var b=new Ajax.Response(this);if(this.options.onCreate){this.options.onCreate(b)}Ajax.Responders.dispatch("onCreate",this,b);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous){this.respondToReadyState.bind(this).defer(1)}this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=="post"?(this.options.postBody||g):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(f){this.dispatchException(f)}},onStateChange:function(){var b=this.transport.readyState;if(b>1&&!((b==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)}},setRequestHeaders:function(){var g={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){g["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:"");if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005){g.Connection="close"}}if(typeof this.options.requestHeaders=="object"){var e=this.options.requestHeaders;if(Object.isFunction(e.push)){for(var d=0,f=e.length;d<f;d+=2){g[e[d]]=e[d+1]}}else{$H(e).each(function(h){g[h.key]=h.value})}}for(var b in g){if(g[b]!=null){this.transport.setRequestHeader(b,g[b])}}},success:function(){var b=this.getStatus();return !b||(b>=200&&b<300)||b==304},getStatus:function(){try{if(this.transport.status===1223){return 204}return this.transport.status||0}catch(b){return 0}},respondToReadyState:function(b){var f=Ajax.Request.Events[b],d=new Ajax.Response(this);if(f=="Complete"){try{this._complete=true;(this.options["on"+d.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(d,d.headerJSON)}catch(g){this.dispatchException(g)}var h=d.getHeader("Content-type");if(this.options.evalJS=="force"||(this.options.evalJS&&this.isSameOrigin()&&h&&h.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))){this.evalResponse()}}try{(this.options["on"+f]||Prototype.emptyFunction)(d,d.headerJSON);Ajax.Responders.dispatch("on"+f,this,d,d.headerJSON)}catch(g){this.dispatchException(g)}if(f=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction}},isSameOrigin:function(){var b=this.url.match(/^\s*https?:\/\/[^\/]*/);return !b||(b[0]=="#{protocol}//#{domain}#{port}".interpolate({protocol:location.protocol,domain:document.domain,port:location.port?":"+location.port:""}))},getHeader:function(b){try{return this.transport.getResponseHeader(b)||null}catch(d){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(e){this.dispatchException(e)}},dispatchException:function(b){(this.options.onException||Prototype.emptyFunction)(this,b);Ajax.Responders.dispatch("onException",this,b)}});Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Response=Class.create({initialize:function(e){this.request=e;var f=this.transport=e.transport,b=this.readyState=f.readyState;if((b>2&&!Prototype.Browser.IE)||b==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(f.responseText);this.headerJSON=this._getHeaderJSON()}if(b==4){var d=f.responseXML;this.responseXML=Object.isUndefined(d)?null:d;this.responseJSON=this._getResponseJSON()}},status:0,statusText:"",getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||""}catch(b){return""}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()}catch(b){return null}},getResponseHeader:function(b){return this.transport.getResponseHeader(b)},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()},_getHeaderJSON:function(){var b=this.getHeader("X-JSON");if(!b){return null}try{b=decodeURIComponent(escape(b))}catch(d){}try{return b.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin())}catch(d){this.request.dispatchException(d)}},_getResponseJSON:function(){var b=this.request.options;if(!b.evalJSON||(b.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json"))||this.responseText.blank()){return null}try{return this.responseText.evalJSON(b.sanitizeJSON||!this.request.isSameOrigin())}catch(d){this.request.dispatchException(d)}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,b,e,d){this.container={success:(b.success||b),failure:(b.failure||(b.success?null:b))};d=Object.clone(d);var f=d.onComplete;d.onComplete=(function(g,h){this.updateContent(g.responseText);if(Object.isFunction(f)){f(g,h)}}).bind(this);$super(e,d)},updateContent:function(f){var e=this.container[this.success()?"success":"failure"],b=this.options;if(!b.evalScripts){f=f.stripScripts()}if(e=$(e)){if(b.insertion){if(Object.isString(b.insertion)){var d={};d[b.insertion]=f;e.insert(d)}else{b.insertion(e,f)}}else{e.update(f)}}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,b,e,d){$super(d);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=b;this.url=e;this.start()},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent()},stop:function(){this.updater.options.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments)},updateComplete:function(b){if(this.options.decay){this.decay=(b.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=b.responseText}this.timer=this.onTimerEvent.bind(this).delay(this.decay*this.frequency)},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)}});(function(be){var aK;var a7=Array.prototype.slice;var aB=document.createElement("div");function a5(bv){if(arguments.length>1){for(var F=0,bx=[],bw=arguments.length;F<bw;F++){bx.push(a5(arguments[F]))}return bx}if(Object.isString(bv)){bv=document.getElementById(bv)}return aL.extend(bv)}be.$=a5;if(!be.Node){be.Node={}}if(!be.Node.ELEMENT_NODE){Object.extend(be.Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12})}var w={};function aW(bv,F){if(bv==="select"){return false}if("type" in F){return false}return true}var f=(function(){try{var F=document.createElement('<input name="x">');return F.tagName.toLowerCase()==="input"&&F.name==="x"}catch(bv){return false}})();var aO=be.Element;function aL(bv,F){F=F||{};bv=bv.toLowerCase();if(f&&F.name){bv="<"+bv+' name="'+F.name+'">';delete F.name;return aL.writeAttribute(document.createElement(bv),F)}if(!w[bv]){w[bv]=aL.extend(document.createElement(bv))}var bw=aW(bv,F)?w[bv].cloneNode(false):document.createElement(bv);return aL.writeAttribute(bw,F)}be.Element=aL;Object.extend(be.Element,aO||{});if(aO){be.Element.prototype=aO.prototype}aL.Methods={ByTag:{},Simulated:{}};var a9={};var N={id:"id",className:"class"};function bg(bv){bv=a5(bv);var F="<"+bv.tagName.toLowerCase();var bw,by;for(var bx in N){bw=N[bx];by=(bv[bx]||"").toString();if(by){F+=" "+bw+"="+by.inspect(true)}}return F+">"}a9.inspect=bg;function B(F){return a5(F).getStyle("display")!=="none"}function aD(bv,F){bv=a5(bv);if(typeof F!=="boolean"){F=!aL.visible(bv)}aL[F?"show":"hide"](bv);return bv}function aN(F){F=a5(F);F.style.display="none";return F}function o(F){F=a5(F);F.style.display="";return F}Object.extend(a9,{visible:B,toggle:aD,hide:aN,show:o});function aj(F){F=a5(F);F.parentNode.removeChild(F);return F}var aZ=(function(){var F=document.createElement("select"),bv=true;F.innerHTML='<option value="test">test</option>';if(F.options&&F.options[0]){bv=F.options[0].nodeName.toUpperCase()!=="OPTION"}F=null;return bv})();var O=(function(){try{var F=document.createElement("table");if(F&&F.tBodies){F.innerHTML="<tbody><tr><td>test</td></tr></tbody>";var bw=typeof F.tBodies[0]=="undefined";F=null;return bw}}catch(bv){return true}})();var a8=(function(){try{var F=document.createElement("div");F.innerHTML="<link />";var bw=(F.childNodes.length===0);F=null;return bw}catch(bv){return true}})();var D=aZ||O||a8;var ax=(function(){var F=document.createElement("script"),bw=false;try{F.appendChild(document.createTextNode(""));bw=!F.firstChild||F.firstChild&&F.firstChild.nodeType!==3}catch(bv){bw=true}F=null;return bw})();function U(bx,bz){bx=a5(bx);var bA=bx.getElementsByTagName("*"),bw=bA.length;while(bw--){af(bA[bw])}if(bz&&bz.toElement){bz=bz.toElement()}if(Object.isElement(bz)){return bx.update().insert(bz)}bz=Object.toHTML(bz);var bv=bx.tagName.toUpperCase();if(bv==="SCRIPT"&&ax){bx.text=bz;return bx}if(D){if(bv in R.tags){while(bx.firstChild){bx.removeChild(bx.firstChild)}var F=z(bv,bz.stripScripts());for(var bw=0,by;by=F[bw];bw++){bx.appendChild(by)}}else{if(a8&&Object.isString(bz)&&bz.indexOf("<link")>-1){while(bx.firstChild){bx.removeChild(bx.firstChild)}var F=z(bv,bz.stripScripts(),true);for(var bw=0,by;by=F[bw];bw++){bx.appendChild(by)}}else{bx.innerHTML=bz.stripScripts()}}}else{bx.innerHTML=bz.stripScripts()}bz.evalScripts.bind(bz).defer();return bx}function an(bv,bw){bv=a5(bv);if(bw&&bw.toElement){bw=bw.toElement()}else{if(!Object.isElement(bw)){bw=Object.toHTML(bw);var F=bv.ownerDocument.createRange();F.selectNode(bv);bw.evalScripts.bind(bw).defer();bw=F.createContextualFragment(bw.stripScripts())}}bv.parentNode.replaceChild(bw,bv);return bv}var R={before:function(F,bv){F.parentNode.insertBefore(bv,F)},top:function(F,bv){F.insertBefore(bv,F.firstChild)},bottom:function(F,bv){F.appendChild(bv)},after:function(F,bv){F.parentNode.insertBefore(bv,F.nextSibling)},tags:{TABLE:["<table>","</table>",1],TBODY:["<table><tbody>","</tbody></table>",2],TR:["<table><tbody><tr>","</tr></tbody></table>",3],TD:["<table><tbody><tr><td>","</td></tr></tbody></table>",4],SELECT:["<select>","</select>",1]}};var aP=R.tags;Object.extend(aP,{THEAD:aP.TBODY,TFOOT:aP.TBODY,TH:aP.TD});function av(bw,bz){bw=a5(bw);if(bz&&bz.toElement){bz=bz.toElement()}if(Object.isElement(bz)){bw.parentNode.replaceChild(bz,bw);return bw}bz=Object.toHTML(bz);var by=bw.parentNode,bv=by.tagName.toUpperCase();if(bv in R.tags){var bA=aL.next(bw);var F=z(bv,bz.stripScripts());by.removeChild(bw);var bx;if(bA){bx=function(bB){by.insertBefore(bB,bA)}}else{bx=function(bB){by.appendChild(bB)}}F.each(bx)}else{bw.outerHTML=bz.stripScripts()}bz.evalScripts.bind(bz).defer();return bw}if("outerHTML" in document.documentElement){an=av}function bd(F){if(Object.isUndefined(F)||F===null){return false}if(Object.isString(F)||Object.isNumber(F)){return true}if(Object.isElement(F)){return true}if(F.toElement||F.toHTML){return true}return false}function bt(bx,bz,F){F=F.toLowerCase();var bB=R[F];if(bz&&bz.toElement){bz=bz.toElement()}if(Object.isElement(bz)){bB(bx,bz);return bx}bz=Object.toHTML(bz);var bw=((F==="before"||F==="after")?bx.parentNode:bx).tagName.toUpperCase();var bA=z(bw,bz.stripScripts());if(F==="top"||F==="after"){bA.reverse()}for(var bv=0,by;by=bA[bv];bv++){bB(bx,by)}bz.evalScripts.bind(bz).defer()}function W(bv,bw){bv=a5(bv);if(bd(bw)){bw={bottom:bw}}for(var F in bw){bt(bv,bw[F],F)}return bv}function A(bv,bw,F){bv=a5(bv);if(Object.isElement(bw)){a5(bw).writeAttribute(F||{})}else{if(Object.isString(bw)){bw=new aL(bw,F)}else{bw=new aL("div",bw)}}if(bv.parentNode){bv.parentNode.replaceChild(bw,bv)}bw.appendChild(bv);return bw}function C(bv){bv=a5(bv);var bw=bv.firstChild;while(bw){var F=bw.nextSibling;if(bw.nodeType===Node.TEXT_NODE&&!/\S/.test(bw.nodeValue)){bv.removeChild(bw)}bw=F}return bv}function ba(F){return a5(F).innerHTML.blank()}function z(by,bx,bz){var bw=R.tags[by],bA=aB;var F=!!bw;if(!F&&bz){F=true;bw=["","",0]}if(F){bA.innerHTML=" "+bw[0]+bx+bw[1];bA.removeChild(bA.firstChild);for(var bv=bw[2];bv--;){bA=bA.firstChild}}else{bA.innerHTML=bx}return $A(bA.childNodes)}function L(bw,F){if(!(bw=a5(bw))){return}var by=bw.cloneNode(F);if(!a4){by._prototypeUID=aK;if(F){var bx=aL.select(by,"*"),bv=bx.length;while(bv--){bx[bv]._prototypeUID=aK}}}return aL.extend(by)}function af(bv){var F=S(bv);if(F){aL.stopObserving(bv);if(!a4){bv._prototypeUID=aK}delete aL.Storage[F]}}function br(bv){var F=bv.length;while(F--){af(bv[F])}}function az(bx){var bw=bx.length,bv,F;while(bw--){bv=bx[bw];F=S(bv);delete aL.Storage[F];delete Event.cache[F]}}if(a4){br=az}function r(bv){if(!(bv=a5(bv))){return}af(bv);var bw=bv.getElementsByTagName("*"),F=bw.length;while(F--){af(bw[F])}return null}Object.extend(a9,{remove:aj,update:U,replace:an,insert:W,wrap:A,cleanWhitespace:C,empty:ba,clone:L,purge:r});function at(F,bw,bx){F=a5(F);bx=bx||-1;var bv=[];while(F=F[bw]){if(F.nodeType===Node.ELEMENT_NODE){bv.push(aL.extend(F))}if(bv.length===bx){break}}return bv}function aR(F){return at(F,"parentNode")}function bs(F){return aL.select(F,"*")}function ad(F){F=a5(F).firstChild;while(F&&F.nodeType!==Node.ELEMENT_NODE){F=F.nextSibling}return a5(F)}function bo(bv){var F=[],bw=a5(bv).firstChild;while(bw){if(bw.nodeType===Node.ELEMENT_NODE){F.push(aL.extend(bw))}bw=bw.nextSibling}return F}function u(F){return at(F,"previousSibling")}function bn(F){return at(F,"nextSibling")}function a1(F){F=a5(F);var bw=u(F),bv=bn(F);return bw.reverse().concat(bv)}function aX(bv,F){bv=a5(bv);if(Object.isString(F)){return Prototype.Selector.match(bv,F)}return F.match(bv)}function a2(bv,bw,bx,F){bv=a5(bv),bx=bx||0,F=F||0;if(Object.isNumber(bx)){F=bx,bx=null}while(bv=bv[bw]){if(bv.nodeType!==1){continue}if(bx&&!Prototype.Selector.match(bv,bx)){continue}if(--F>=0){continue}return aL.extend(bv)}}function ag(bv,bw,F){bv=a5(bv);if(arguments.length===1){return a5(bv.parentNode)}return a2(bv,"parentNode",bw,F)}function E(bv,bx,F){if(arguments.length===1){return ad(bv)}bv=a5(bv),bx=bx||0,F=F||0;if(Object.isNumber(bx)){F=bx,bx="*"}var bw=Prototype.Selector.select(bx,bv)[F];return aL.extend(bw)}function n(bv,bw,F){return a2(bv,"previousSibling",bw,F)}function aH(bv,bw,F){return a2(bv,"nextSibling",bw,F)}function bh(F){F=a5(F);var bv=a7.call(arguments,1).join(", ");return Prototype.Selector.select(bv,F)}function aJ(bw){bw=a5(bw);var by=a7.call(arguments,1).join(", ");var bz=aL.siblings(bw),bv=[];for(var F=0,bx;bx=bz[F];F++){if(Prototype.Selector.match(bx,by)){bv.push(bx)}}return bv}function K(bv,F){bv=a5(bv),F=a5(F);if(!bv||!F){return false}while(bv=bv.parentNode){if(bv===F){return true}}return false}function I(bv,F){bv=a5(bv),F=a5(F);if(!bv||!F){return false}if(!F.contains){return K(bv,F)}return F.contains(bv)&&F!==bv}function P(bv,F){bv=a5(bv),F=a5(F);if(!bv||!F){return false}return(bv.compareDocumentPosition(F)&8)===8}var aS;if(aB.compareDocumentPosition){aS=P}else{if(aB.contains){aS=I}else{aS=K}}Object.extend(a9,{recursivelyCollect:at,ancestors:aR,descendants:bs,firstDescendant:ad,immediateDescendants:bo,previousSiblings:u,nextSiblings:bn,siblings:a1,match:aX,up:ag,down:E,previous:n,next:aH,select:bh,adjacent:aJ,descendantOf:aS,getElementsBySelector:bh,childElements:bo});var Z=1;function a0(F){F=a5(F);var bv=aL.readAttribute(F,"id");if(bv){return bv}do{bv="anonymous_element_"+Z++}while(a5(bv));aL.writeAttribute(F,"id",bv);return bv}function bf(bv,F){return a5(bv).getAttribute(F)}function Q(bv,F){bv=a5(bv);var bw=aM.read;if(bw.values[F]){return bw.values[F](bv,F)}if(bw.names[F]){F=bw.names[F]}if(F.include(":")){if(!bv.attributes||!bv.attributes[F]){return null}return bv.attributes[F].value}return bv.getAttribute(F)}function g(bv,F){if(F==="title"){return bv.title}return bv.getAttribute(F)}var aa=(function(){aB.setAttribute("onclick",[]);var F=aB.getAttribute("onclick");var bv=Object.isArray(F);aB.removeAttribute("onclick");return bv})();if(aa){bf=Q}else{if(Prototype.Browser.Opera){bf=g}}function a6(bx,bw,bz){bx=a5(bx);var bv={},by=aM.write;if(typeof bw==="object"){bv=bw}else{bv[bw]=Object.isUndefined(bz)?true:bz}for(var F in bv){bw=by.names[F]||F;bz=bv[F];if(by.values[F]){bz=by.values[F](bx,bz);if(Object.isUndefined(bz)){continue}}if(bz===false||bz===null){bx.removeAttribute(bw)}else{if(bz===true){bx.setAttribute(bw,bw)}else{bx.setAttribute(bw,bz)}}}return bx}var b=(function(){if(!f){return false}var bv=document.createElement('<input type="checkbox">');bv.checked=true;var F=bv.getAttributeNode("checked");return !F||!F.specified})();function ae(F,bw){bw=aM.has[bw]||bw;var bv=a5(F).getAttributeNode(bw);return !!(bv&&bv.specified)}function bm(F,bv){if(bv==="checked"){return F.checked}return ae(F,bv)}be.Element.Methods.Simulated.hasAttribute=b?bm:ae;function p(F){return new aL.ClassNames(F)}var ab={};function h(bv){if(ab[bv]){return ab[bv]}var F=new RegExp("(^|\\s+)"+bv+"(\\s+|$)");ab[bv]=F;return F}function ar(F,bv){if(!(F=a5(F))){return}var bw=F.className;if(bw.length===0){return false}if(bw===bv){return true}return h(bv).test(bw)}function t(F,bv){if(!(F=a5(F))){return}if(!ar(F,bv)){F.className+=(F.className?" ":"")+bv}return F}function aA(F,bv){if(!(F=a5(F))){return}F.className=F.className.replace(h(bv)," ").strip();return F}function ak(bv,bw,F){if(!(bv=a5(bv))){return}if(Object.isUndefined(F)){F=!ar(bv,bw)}var bx=aL[F?"addClassName":"removeClassName"];return bx(bv,bw)}var aM={};var aV="className",ay="for";aB.setAttribute(aV,"x");if(aB.className!=="x"){aB.setAttribute("class","x");if(aB.className==="x"){aV="class"}}var aQ=document.createElement("label");aQ.setAttribute(ay,"x");if(aQ.htmlFor!=="x"){aQ.setAttribute("htmlFor","x");if(aQ.htmlFor==="x"){ay="htmlFor"}}aQ=null;function ai(F,bv){return F.getAttribute(bv)}function l(F,bv){return F.getAttribute(bv,2)}function H(F,bw){var bv=F.getAttributeNode(bw);return bv?bv.value:""}function bp(F,bv){return a5(F).hasAttribute(bv)?bv:null}aB.onclick=Prototype.emptyFunction;var V=aB.getAttribute("onclick");var aC;if(String(V).indexOf("{")>-1){aC=function(F,bv){var bw=F.getAttribute(bv);if(!bw){return null}bw=bw.toString();bw=bw.split("{")[1];bw=bw.split("}")[0];return bw.strip()}}else{if(V===""){aC=function(F,bv){var bw=F.getAttribute(bv);if(!bw){return null}return bw.strip()}}}aM.read={names:{"class":aV,className:aV,"for":ay,htmlFor:ay},values:{style:function(F){return F.style.cssText.toLowerCase()},title:function(F){return F.title}}};aM.write={names:{className:"class",htmlFor:"for",cellpadding:"cellPadding",cellspacing:"cellSpacing"},values:{checked:function(F,bv){bv=!!bv;F.checked=bv;return bv?"checked":null},style:function(F,bv){F.style.cssText=bv?bv:""}}};aM.has={names:{}};Object.extend(aM.write.names,aM.read.names);var bc=$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc frameBorder");for(var al=0,am;am=bc[al];al++){aM.write.names[am.toLowerCase()]=am;aM.has.names[am.toLowerCase()]=am}Object.extend(aM.read.values,{href:l,src:l,type:ai,action:H,disabled:bp,checked:bp,readonly:bp,multiple:bp,onload:aC,onunload:aC,onclick:aC,ondblclick:aC,onmousedown:aC,onmouseup:aC,onmouseover:aC,onmousemove:aC,onmouseout:aC,onfocus:aC,onblur:aC,onkeypress:aC,onkeydown:aC,onkeyup:aC,onsubmit:aC,onreset:aC,onselect:aC,onchange:aC});Object.extend(a9,{identify:a0,readAttribute:bf,writeAttribute:a6,classNames:p,hasClassName:ar,addClassName:t,removeClassName:aA,toggleClassName:ak});function ac(F){if(F==="float"||F==="styleFloat"){return"cssFloat"}return F.camelize()}function bu(F){if(F==="float"||F==="cssFloat"){return"styleFloat"}return F.camelize()}function J(bw,bx){bw=a5(bw);var bA=bw.style,bv;if(Object.isString(bx)){bA.cssText+=";"+bx;if(bx.include("opacity")){var F=bx.match(/opacity:\s*(\d?\.?\d*)/)[1];aL.setOpacity(bw,F)}return bw}for(var bz in bx){if(bz==="opacity"){aL.setOpacity(bw,bx[bz])}else{var by=bx[bz];if(bz==="float"||bz==="cssFloat"){bz=Object.isUndefined(bA.styleFloat)?"cssFloat":"styleFloat"}bA[bz]=by}}return bw}function aU(bv,bw){bv=a5(bv);bw=ac(bw);var bx=bv.style[bw];if(!bx||bx==="auto"){var F=document.defaultView.getComputedStyle(bv,null);bx=F?F[bw]:null}if(bw==="opacity"){return bx?parseFloat(bx):1}return bx==="auto"?null:bx}function y(F,bv){switch(bv){case"height":case"width":if(!aL.visible(F)){return null}var bw=parseInt(aU(F,bv),10);if(bw!==F["offset"+bv.capitalize()]){return bw+"px"}return aL.measure(F,bv);default:return aU(F,bv)}}function ap(F,bv){F=a5(F);bv=bu(bv);var bw=F.style[bv];if(!bw&&F.currentStyle){bw=F.currentStyle[bv]}if(bv==="opacity"){if(!T){return bk(F)}else{return bw?parseFloat(bw):1}}if(bw==="auto"){if((bv==="width"||bv==="height")&&aL.visible(F)){return aL.measure(F,bv)+"px"}return null}return bw}function aG(F){return(F||"").replace(/alpha\([^\)]*\)/gi,"")}function ah(F){if(!F.currentStyle||!F.currentStyle.hasLayout){F.style.zoom=1}return F}var T=(function(){aB.style.cssText="opacity:.55";return/^0.55/.test(aB.style.opacity)})();function G(F,bv){F=a5(F);if(bv==1||bv===""){bv=""}else{if(bv<0.00001){bv=0}}F.style.opacity=bv;return F}function bl(F,bx){if(T){return G(F,bx)}F=ah(a5(F));var bw=aL.getStyle(F,"filter"),bv=F.style;if(bx==1||bx===""){bw=aG(bw);if(bw){bv.filter=bw}else{bv.removeAttribute("filter")}return F}if(bx<0.00001){bx=0}bv.filter=aG(bw)+" alpha(opacity="+(bx*100)+")";return F}function bj(F){return aL.getStyle(F,"opacity")}function bk(bv){if(T){return bj(bv)}var bw=aL.getStyle(bv,"filter");if(bw.length===0){return 1}var F=(bw||"").match(/alpha\(opacity=(.*)\)/i);if(F&&F[1]){return parseFloat(F[1])/100}return 1}Object.extend(a9,{setStyle:J,getStyle:aU,setOpacity:G,getOpacity:bj});if("styleFloat" in aB.style){a9.getStyle=ap;a9.setOpacity=bl;a9.getOpacity=bk}var q=0;be.Element.Storage={UID:1};function S(F){if(F===window){return 0}if(typeof F._prototypeUID==="undefined"){F._prototypeUID=aL.Storage.UID++}return F._prototypeUID}function e(F){if(F===window){return 0}if(F==document){return 1}return F.uniqueID}var a4=("uniqueID" in aB);if(a4){S=e}function d(bv){if(!(bv=a5(bv))){return}var F=S(bv);if(!aL.Storage[F]){aL.Storage[F]=$H()}return aL.Storage[F]}function bb(bv,F,bw){if(!(bv=a5(bv))){return}var bx=d(bv);if(arguments.length===2){bx.update(F)}else{bx.set(F,bw)}return bv}function aT(bw,bv,F){if(!(bw=a5(bw))){return}var by=d(bw),bx=by.get(bv);if(Object.isUndefined(bx)){by.set(bv,F);bx=F}return bx}Object.extend(a9,{getStorage:d,store:bb,retrieve:aT});var au={},a3=aL.Methods.ByTag,aI=Prototype.BrowserFeatures;if(!aI.ElementExtensions&&("__proto__" in aB)){be.HTMLElement={};be.HTMLElement.prototype=aB.__proto__;aI.ElementExtensions=true}function bi(F){if(typeof window.Element==="undefined"){return false}if(!f){return false}var bw=window.Element.prototype;if(bw){var by="_"+(Math.random()+"").slice(2),bv=document.createElement(F);bw[by]="x";var bx=(bv[by]!=="x");delete bw[by];bv=null;return bx}return false}var aw=bi("object");function aq(bv,F){for(var bx in F){var bw=F[bx];if(Object.isFunction(bw)&&!(bx in bv)){bv[bx]=bw.methodize()}}}var bq={};function aE(bv){var F=S(bv);return(F in bq)}function aF(bw){if(!bw||aE(bw)){return bw}if(bw.nodeType!==Node.ELEMENT_NODE||bw==window){return bw}var F=Object.clone(au),bv=bw.tagName.toUpperCase();if(a3[bv]){Object.extend(F,a3[bv])}aq(bw,F);bq[S(bw)]=true;return bw}function aY(bv){if(!bv||aE(bv)){return bv}var F=bv.tagName;if(F&&(/^(?:object|applet|embed)$/i.test(F))){aq(bv,aL.Methods);aq(bv,aL.Methods.Simulated);aq(bv,aL.Methods.ByTag[F.toUpperCase()])}return bv}if(aI.SpecificElementExtensions){aF=aw?aY:Prototype.K}function Y(bv,F){bv=bv.toUpperCase();if(!a3[bv]){a3[bv]={}}Object.extend(a3[bv],F)}function v(bv,bw,F){if(Object.isUndefined(F)){F=false}for(var by in bw){var bx=bw[by];if(!Object.isFunction(bx)){continue}if(!F||!(by in bv)){bv[by]=bx.methodize()}}}function ao(bx){var F;var bw={OPTGROUP:"OptGroup",TEXTAREA:"TextArea",P:"Paragraph",FIELDSET:"FieldSet",UL:"UList",OL:"OList",DL:"DList",DIR:"Directory",H1:"Heading",H2:"Heading",H3:"Heading",H4:"Heading",H5:"Heading",H6:"Heading",Q:"Quote",INS:"Mod",DEL:"Mod",A:"Anchor",IMG:"Image",CAPTION:"TableCaption",COL:"TableCol",COLGROUP:"TableCol",THEAD:"TableSection",TFOOT:"TableSection",TBODY:"TableSection",TR:"TableRow",TH:"TableCell",TD:"TableCell",FRAMESET:"FrameSet",IFRAME:"IFrame"};if(bw[bx]){F="HTML"+bw[bx]+"Element"}if(window[F]){return window[F]}F="HTML"+bx+"Element";if(window[F]){return window[F]}F="HTML"+bx.capitalize()+"Element";if(window[F]){return window[F]}var bv=document.createElement(bx),by=bv.__proto__||bv.constructor.prototype;bv=null;return by}function X(bx){if(arguments.length===0){M()}if(arguments.length===2){var bz=bx;bx=arguments[1]}if(!bz){Object.extend(aL.Methods,bx||{})}else{if(Object.isArray(bz)){for(var by=0,bw;bw=bz[by];by++){Y(bw,bx)}}else{Y(bz,bx)}}var bv=window.HTMLElement?HTMLElement.prototype:aL.prototype;if(aI.ElementExtensions){v(bv,aL.Methods);v(bv,aL.Methods.Simulated,true)}if(aI.SpecificElementExtensions){for(var bw in aL.Methods.ByTag){var F=ao(bw);if(Object.isUndefined(F)){continue}v(F.prototype,a3[bw])}}Object.extend(aL,aL.Methods);Object.extend(aL,aL.Methods.Simulated);delete aL.ByTag;delete aL.Simulated;aL.extend.refresh();w={}}Object.extend(be.Element,{extend:aF,addMethods:X});if(aF===Prototype.K){be.Element.extend.refresh=Prototype.emptyFunction}else{be.Element.extend.refresh=function(){if(Prototype.BrowserFeatures.ElementExtensions){return}Object.extend(au,aL.Methods);Object.extend(au,aL.Methods.Simulated);bq={}}}function M(){Object.extend(Form,Form.Methods);Object.extend(Form.Element,Form.Element.Methods);Object.extend(aL.Methods.ByTag,{FORM:Object.clone(Form.Methods),INPUT:Object.clone(Form.Element.Methods),SELECT:Object.clone(Form.Element.Methods),TEXTAREA:Object.clone(Form.Element.Methods),BUTTON:Object.clone(Form.Element.Methods)})}aL.addMethods(a9);function s(){aB=null;w=null}if(window.attachEvent){window.attachEvent("onunload",s)}})(this);(function(){function q(N){var M=N.match(/^(\d+)%?$/i);if(!M){return null}return(Number(M[1])/100)}function F(N,O){N=$(N);var P=N.style[O];if(!P||P==="auto"){var M=document.defaultView.getComputedStyle(N,null);P=M?M[O]:null}if(O==="opacity"){return P?parseFloat(P):1}return P==="auto"?null:P}function I(M,N){var O=M.style[N];if(!O&&M.currentStyle){O=M.currentStyle[N]}return O}function y(O,N){var Q=O.offsetWidth;var S=B(O,"borderLeftWidth",N)||0;var M=B(O,"borderRightWidth",N)||0;var P=B(O,"paddingLeft",N)||0;var R=B(O,"paddingRight",N)||0;return Q-S-M-P-R}if(!Object.isUndefined(document.documentElement.currentStyle)&&!Prototype.Browser.Opera){F=I}function B(W,X,N){var Q=null;if(Object.isElement(W)){Q=W;W=F(Q,X)}if(W===null||Object.isUndefined(W)){return null}if((/^(?:-)?\d+(\.\d+)?(px)?$/i).test(W)){return window.parseFloat(W)}var R=W.include("%"),O=(N===document.viewport);if(/\d/.test(W)&&Q&&Q.runtimeStyle&&!(R&&O)){var M=Q.style.left,V=Q.runtimeStyle.left;Q.runtimeStyle.left=Q.currentStyle.left;Q.style.left=W||0;W=Q.style.pixelLeft;Q.style.left=M;Q.runtimeStyle.left=V;return W}if(Q&&R){N=N||Q.parentNode;var P=q(W),S=null;var U=X.include("left")||X.include("right")||X.include("width");var T=X.include("top")||X.include("bottom")||X.include("height");if(N===document.viewport){if(U){S=document.viewport.getWidth()}else{if(T){S=document.viewport.getHeight()}}}else{if(U){S=$(N).measure("width")}else{if(T){S=$(N).measure("height")}}}return(S===null)?0:S*P}return 0}function p(M){if(Object.isString(M)&&M.endsWith("px")){return M}return M+"px"}function s(M){while(M&&M.parentNode){var N=M.getStyle("display");if(N==="none"){return false}M=$(M.parentNode)}return true}var l=Prototype.K;if("currentStyle" in document.documentElement){l=function(M){if(!M.currentStyle.hasLayout){M.style.zoom=1}return M}}function o(M){if(M.include("border")){M=M+"-width"}return M.camelize()}Element.Layout=Class.create(Hash,{initialize:function($super,N,M){$super();this.element=$(N);Element.Layout.PROPERTIES.each(function(O){this._set(O,null)},this);if(M){this._preComputing=true;this._begin();Element.Layout.PROPERTIES.each(this._compute,this);this._end();this._preComputing=false}},_set:function(N,M){return Hash.prototype.set.call(this,N,M)},set:function(N,M){throw"Properties of Element.Layout are read-only."},get:function($super,N){var M=$super(N);return M===null?this._compute(N):M},_begin:function(){if(this._isPrepared()){return}var Q=this.element;if(s(Q)){this._setPrepared(true);return}var S={position:Q.style.position||"",width:Q.style.width||"",visibility:Q.style.visibility||"",display:Q.style.display||""};Q.store("prototype_original_styles",S);var T=F(Q,"position"),M=Q.offsetWidth;if(M===0||M===null){Q.style.display="block";M=Q.offsetWidth}var N=(T==="fixed")?document.viewport:Q.parentNode;var U={visibility:"hidden",display:"block"};if(T!=="fixed"){U.position="absolute"}Q.setStyle(U);var O=Q.offsetWidth,P;if(M&&(O===M)){P=y(Q,N)}else{if(T==="absolute"||T==="fixed"){P=y(Q,N)}else{var V=Q.parentNode,R=$(V).getLayout();P=R.get("width")-this.get("margin-left")-this.get("border-left")-this.get("padding-left")-this.get("padding-right")-this.get("border-right")-this.get("margin-right")}}Q.setStyle({width:P+"px"});this._setPrepared(true)},_end:function(){var N=this.element;var M=N.retrieve("prototype_original_styles");N.store("prototype_original_styles",null);N.setStyle(M);this._setPrepared(false)},_compute:function(N){var M=Element.Layout.COMPUTATIONS;if(!(N in M)){throw"Property not found."}return this._set(N,M[N].call(this,this.element))},_isPrepared:function(){return this.element.retrieve("prototype_element_layout_prepared",false)},_setPrepared:function(M){return this.element.store("prototype_element_layout_prepared",M)},toObject:function(){var M=$A(arguments);var N=(M.length===0)?Element.Layout.PROPERTIES:M.join(" ").split(" ");var O={};N.each(function(P){if(!Element.Layout.PROPERTIES.include(P)){return}var Q=this.get(P);if(Q!=null){O[P]=Q}},this);return O},toHash:function(){var M=this.toObject.apply(this,arguments);return new Hash(M)},toCSS:function(){var M=$A(arguments);var O=(M.length===0)?Element.Layout.PROPERTIES:M.join(" ").split(" ");var N={};O.each(function(P){if(!Element.Layout.PROPERTIES.include(P)){return}if(Element.Layout.COMPOSITE_PROPERTIES.include(P)){return}var Q=this.get(P);if(Q!=null){N[o(P)]=Q+"px"}},this);return N},inspect:function(){return"#<Element.Layout>"}});Object.extend(Element.Layout,{PROPERTIES:$w("height width top left right bottom border-left border-right border-top border-bottom padding-left padding-right padding-top padding-bottom margin-top margin-bottom margin-left margin-right padding-box-width padding-box-height border-box-width border-box-height margin-box-width margin-box-height"),COMPOSITE_PROPERTIES:$w("padding-box-width padding-box-height margin-box-width margin-box-height border-box-width border-box-height"),COMPUTATIONS:{height:function(O){if(!this._preComputing){this._begin()}var M=this.get("border-box-height");if(M<=0){if(!this._preComputing){this._end()}return 0}var P=this.get("border-top"),N=this.get("border-bottom");var R=this.get("padding-top"),Q=this.get("padding-bottom");if(!this._preComputing){this._end()}return M-P-N-R-Q},width:function(O){if(!this._preComputing){this._begin()}var N=this.get("border-box-width");if(N<=0){if(!this._preComputing){this._end()}return 0}var R=this.get("border-left"),M=this.get("border-right");var P=this.get("padding-left"),Q=this.get("padding-right");if(!this._preComputing){this._end()}return N-R-M-P-Q},"padding-box-height":function(N){var M=this.get("height"),P=this.get("padding-top"),O=this.get("padding-bottom");return M+P+O},"padding-box-width":function(M){var N=this.get("width"),O=this.get("padding-left"),P=this.get("padding-right");return N+O+P},"border-box-height":function(N){if(!this._preComputing){this._begin()}var M=N.offsetHeight;if(!this._preComputing){this._end()}return M},"border-box-width":function(M){if(!this._preComputing){this._begin()}var N=M.offsetWidth;if(!this._preComputing){this._end()}return N},"margin-box-height":function(N){var M=this.get("border-box-height"),O=this.get("margin-top"),P=this.get("margin-bottom");if(M<=0){return 0}return M+O+P},"margin-box-width":function(O){var N=this.get("border-box-width"),P=this.get("margin-left"),M=this.get("margin-right");if(N<=0){return 0}return N+P+M},top:function(M){var N=M.positionedOffset();return N.top},bottom:function(M){var P=M.positionedOffset(),N=M.getOffsetParent(),O=N.measure("height");var Q=this.get("border-box-height");return O-Q-P.top},left:function(M){var N=M.positionedOffset();return N.left},right:function(O){var Q=O.positionedOffset(),P=O.getOffsetParent(),M=P.measure("width");var N=this.get("border-box-width");return M-N-Q.left},"padding-top":function(M){return B(M,"paddingTop")},"padding-bottom":function(M){return B(M,"paddingBottom")},"padding-left":function(M){return B(M,"paddingLeft")},"padding-right":function(M){return B(M,"paddingRight")},"border-top":function(M){return B(M,"borderTopWidth")},"border-bottom":function(M){return B(M,"borderBottomWidth")},"border-left":function(M){return B(M,"borderLeftWidth")},"border-right":function(M){return B(M,"borderRightWidth")},"margin-top":function(M){return B(M,"marginTop")},"margin-bottom":function(M){return B(M,"marginBottom")},"margin-left":function(M){return B(M,"marginLeft")},"margin-right":function(M){return B(M,"marginRight")}}});if("getBoundingClientRect" in document.documentElement){Object.extend(Element.Layout.COMPUTATIONS,{right:function(N){var O=l(N.getOffsetParent());var P=N.getBoundingClientRect(),M=O.getBoundingClientRect();return(M.right-P.right).round()},bottom:function(N){var O=l(N.getOffsetParent());var P=N.getBoundingClientRect(),M=O.getBoundingClientRect();return(M.bottom-P.bottom).round()}})}Element.Offset=Class.create({initialize:function(N,M){this.left=N.round();this.top=M.round();this[0]=this.left;this[1]=this.top},relativeTo:function(M){return new Element.Offset(this.left-M.left,this.top-M.top)},inspect:function(){return"#<Element.Offset left: #{left} top: #{top}>".interpolate(this)},toString:function(){return"[#{left}, #{top}]".interpolate(this)},toArray:function(){return[this.left,this.top]}});function G(N,M){return new Element.Layout(N,M)}function f(M,N){return $(M).getLayout().get(N)}function w(M){return Element.getDimensions(M).height}function e(M){return Element.getDimensions(M).width}function z(N){N=$(N);var R=Element.getStyle(N,"display");if(R&&R!=="none"){return{width:N.offsetWidth,height:N.offsetHeight}}var O=N.style;var M={visibility:O.visibility,position:O.position,display:O.display};var Q={visibility:"hidden",display:"block"};if(M.position!=="fixed"){Q.position="absolute"}Element.setStyle(N,Q);var P={width:N.offsetWidth,height:N.offsetHeight};Element.setStyle(N,M);return P}function v(M){M=$(M);function O(P){return t(P)?$(document.body):$(P)}if(n(M)||h(M)||u(M)||t(M)){return $(document.body)}var N=(Element.getStyle(M,"display")==="inline");if(!N&&M.offsetParent){return O(M.offsetParent)}while((M=M.parentNode)&&M!==document.body){if(Element.getStyle(M,"position")!=="static"){return O(M)}}return $(document.body)}function J(N){N=$(N);var M=0,O=0;if(N.parentNode){do{M+=N.offsetTop||0;O+=N.offsetLeft||0;N=N.offsetParent}while(N)}return new Element.Offset(O,M)}function D(N){N=$(N);var O=N.getLayout();var M=0,Q=0;do{M+=N.offsetTop||0;Q+=N.offsetLeft||0;N=N.offsetParent;if(N){if(u(N)){break}var P=Element.getStyle(N,"position");if(P!=="static"){break}}}while(N);Q-=O.get("margin-left");M-=O.get("margin-top");return new Element.Offset(Q,M)}function d(N){var M=0,O=0;do{if(N===document.body){var P=document.documentElement||document.body.parentNode||document.body;M+=!Object.isUndefined(window.pageYOffset)?window.pageYOffset:P.scrollTop||0;O+=!Object.isUndefined(window.pageXOffset)?window.pageXOffset:P.scrollLeft||0;break}else{M+=N.scrollTop||0;O+=N.scrollLeft||0;N=N.parentNode}}while(N);return new Element.Offset(O,M)}function H(Q){var M=0,P=0,O=document.body;Q=$(Q);var N=Q;do{M+=N.offsetTop||0;P+=N.offsetLeft||0;if(N.offsetParent==O&&Element.getStyle(N,"position")=="absolute"){break}}while(N=N.offsetParent);N=Q;do{if(N!=O){M-=N.scrollTop||0;P-=N.scrollLeft||0}}while(N=N.parentNode);return new Element.Offset(P,M)}function E(M){M=$(M);if(Element.getStyle(M,"position")==="absolute"){return M}var Q=v(M);var P=M.viewportOffset(),N=Q.viewportOffset();var R=P.relativeTo(N);var O=M.getLayout();M.store("prototype_absolutize_original_styles",{position:M.getStyle("position"),left:M.getStyle("left"),top:M.getStyle("top"),width:M.getStyle("width"),height:M.getStyle("height")});M.setStyle({position:"absolute",top:R.top+"px",left:R.left+"px",width:O.get("width")+"px",height:O.get("height")+"px"});return M}function r(N){N=$(N);if(Element.getStyle(N,"position")==="relative"){return N}var M=N.retrieve("prototype_absolutize_original_styles");if(M){N.setStyle(M)}return N}function b(M){M=$(M);var N=Element.cumulativeOffset(M);window.scrollTo(N.left,N.top);return M}function C(N){N=$(N);var M=Element.getStyle(N,"position"),O={};if(M==="static"||!M){O.position="relative";if(Prototype.Browser.Opera){O.top=0;O.left=0}Element.setStyle(N,O);Element.store(N,"prototype_made_positioned",true)}return N}function A(M){M=$(M);var O=Element.getStorage(M),N=O.get("prototype_made_positioned");if(N){O.unset("prototype_made_positioned");Element.setStyle(M,{position:"",top:"",bottom:"",left:"",right:""})}return M}function g(N){N=$(N);var P=Element.getStorage(N),M=P.get("prototype_made_clipping");if(Object.isUndefined(M)){var O=Element.getStyle(N,"overflow");P.set("prototype_made_clipping",O);if(O!=="hidden"){N.style.overflow="hidden"}}return N}function K(M){M=$(M);var O=Element.getStorage(M),N=O.get("prototype_made_clipping");if(!Object.isUndefined(N)){O.unset("prototype_made_clipping");M.style.overflow=N||""}return M}function L(P,M,X){X=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},X||{});var O=document.documentElement;M=$(M);P=$(P);var N,V,R,W={};if(X.setLeft||X.setTop){N=Element.viewportOffset(M);V=[0,0];if(Element.getStyle(P,"position")==="absolute"){var U=Element.getOffsetParent(P);if(U!==document.body){V=Element.viewportOffset(U)}}}function S(){var Y=0,Z=0;if(Object.isNumber(window.pageXOffset)){Y=window.pageXOffset;Z=window.pageYOffset}else{if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){Y=document.body.scrollLeft;Z=document.body.scrollTop}else{if(O&&(O.scrollLeft||O.scrollTop)){Y=O.scrollLeft;Z=O.scrollTop}}}return{x:Y,y:Z}}var Q=S();if(X.setWidth||X.setHeight){R=Element.getLayout(M)}if(X.setLeft){W.left=(N[0]+Q.x-V[0]+X.offsetLeft)+"px"}if(X.setTop){W.top=(N[1]+Q.y-V[1]+X.offsetTop)+"px"}var T=P.getLayout();if(X.setWidth){W.width=R.get("width")+"px"}if(X.setHeight){W.height=R.get("height")+"px"}return Element.setStyle(P,W)}if(Prototype.Browser.IE){v=v.wrap(function(O,N){N=$(N);if(n(N)||h(N)||u(N)||t(N)){return $(document.body)}var M=N.getStyle("position");if(M!=="static"){return O(N)}N.setStyle({position:"relative"});var P=O(N);N.setStyle({position:M});return P});D=D.wrap(function(P,N){N=$(N);if(!N.parentNode){return new Element.Offset(0,0)}var M=N.getStyle("position");if(M!=="static"){return P(N)}var O=N.getOffsetParent();if(O&&O.getStyle("position")==="fixed"){l(O)}N.setStyle({position:"relative"});var Q=P(N);N.setStyle({position:M});return Q})}else{if(Prototype.Browser.Webkit){J=function(N){N=$(N);var M=0,O=0;do{M+=N.offsetTop||0;O+=N.offsetLeft||0;if(N.offsetParent==document.body){if(Element.getStyle(N,"position")=="absolute"){break}}N=N.offsetParent}while(N);return new Element.Offset(O,M)}}}Element.addMethods({getLayout:G,measure:f,getWidth:e,getHeight:w,getDimensions:z,getOffsetParent:v,cumulativeOffset:J,positionedOffset:D,cumulativeScrollOffset:d,viewportOffset:H,absolutize:E,relativize:r,scrollTo:b,makePositioned:C,undoPositioned:A,makeClipping:g,undoClipping:K,clonePosition:L});function u(M){return M.nodeName.toUpperCase()==="BODY"}function t(M){return M.nodeName.toUpperCase()==="HTML"}function n(M){return M.nodeType===Node.DOCUMENT_NODE}function h(M){return M!==document.body&&!Element.descendantOf(M,document.body)}if("getBoundingClientRect" in document.documentElement){Element.addMethods({viewportOffset:function(M){M=$(M);if(h(M)){return new Element.Offset(0,0)}var N=M.getBoundingClientRect(),O=document.documentElement;return new Element.Offset(N.left-O.clientLeft,N.top-O.clientTop)}})}})();(function(){var e=Prototype.Browser.Opera&&(window.parseFloat(window.opera.version())<9.5);var h=null;function d(){if(h){return h}h=e?document.body:document.documentElement;return h}function f(){return{width:this.getWidth(),height:this.getHeight()}}function b(){return d().clientWidth}function l(){return d().clientHeight}function g(){var n=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft;var o=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop;return new Element.Offset(n,o)}document.viewport={getDimensions:f,getWidth:b,getHeight:l,getScrollOffsets:g}})();window.$$=function(){var b=$A(arguments).join(", ");return Prototype.Selector.select(b,document)};Prototype.Selector=(function(){function b(){throw new Error('Method "Prototype.Selector.select" must be defined.')}function e(){throw new Error('Method "Prototype.Selector.match" must be defined.')}function f(q,r,n){n=n||0;var l=Prototype.Selector.match,p=q.length,h=0,o;for(o=0;o<p;o++){if(l(q[o],r)&&n==h++){return Element.extend(q[o])}}}function g(n){for(var h=0,l=n.length;h<l;h++){Element.extend(n[h])}return n}var d=Prototype.K;return{select:b,match:e,find:f,extendElements:(Element.extend===d)?d:g,extendElement:Element.extend}})();Prototype._original_property=window.Sizzle;(function(){function b(d){Prototype._actual_sizzle=d()}b.amd=true;if(typeof define!=="undefined"&&define.amd){Prototype._original_define=define;Prototype._actual_sizzle=null;window.define=b}})(); +var Prototype={Version:"1.7.3",Browser:(function(){var b=navigator.userAgent;var a=Object.prototype.toString.call(window.opera)=="[object Opera]";return{IE:!!window.attachEvent&&!a,Opera:a,WebKit:b.indexOf("AppleWebKit/")>-1,Gecko:b.indexOf("Gecko")>-1&&b.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile/.test(b)}})(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){var a=window.Element||window.HTMLElement;return !!(a&&a.prototype)})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=="undefined"){return true}var c=document.createElement("div"),b=document.createElement("form"),a=false;if(c.__proto__&&(c.__proto__!==b.__proto__)){a=true}c=b=null;return a})()},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script\\s*>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(a){return a}};if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false}var Class=(function(){var d=(function(){for(var e in {toString:1}){if(e==="toString"){return false}}return true})();function a(){}function b(){var h=null,g=$A(arguments);if(Object.isFunction(g[0])){h=g.shift()}function e(){this.initialize.apply(this,arguments)}Object.extend(e,Class.Methods);e.superclass=h;e.subclasses=[];if(h){a.prototype=h.prototype;e.prototype=new a;h.subclasses.push(e)}for(var f=0,k=g.length;f<k;f++){e.addMethods(g[f])}if(!e.prototype.initialize){e.prototype.initialize=Prototype.emptyFunction}e.prototype.constructor=e;return e}function c(m){var g=this.superclass&&this.superclass.prototype,f=Object.keys(m);if(d){if(m.toString!=Object.prototype.toString){f.push("toString")}if(m.valueOf!=Object.prototype.valueOf){f.push("valueOf")}}for(var e=0,h=f.length;e<h;e++){var l=f[e],k=m[l];if(g&&Object.isFunction(k)&&k.argumentNames()[0]=="$super"){var n=k;k=(function(i){return function(){return g[i].apply(this,arguments)}})(l).wrap(n);k.valueOf=(function(i){return function(){return i.valueOf.call(i)}})(n);k.toString=(function(i){return function(){return i.toString.call(i)}})(n)}this.prototype[l]=k}return this}return{create:b,Methods:{addMethods:c}}})();(function(){var z=Object.prototype.toString,l=Object.prototype.hasOwnProperty,A="Null",C="Undefined",L="Boolean",x="Number",w="String",J="Object",i="[object Function]",d="[object Boolean]",k="[object Number]",f="[object String]",b="[object Array]",I="[object Date]",e=window.JSON&&typeof JSON.stringify==="function"&&JSON.stringify(0)==="0"&&typeof JSON.stringify(Prototype.K)==="undefined";var r=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];var a=(function(){for(var M in {toString:1}){if(M==="toString"){return false}}return true})();function E(N){switch(N){case null:return A;case (void 0):return C}var M=typeof N;switch(M){case"boolean":return L;case"number":return x;case"string":return w}return J}function h(M,O){for(var N in O){M[N]=O[N]}return M}function m(M){try{if(p(M)){return"undefined"}if(M===null){return"null"}return M.inspect?M.inspect():String(M)}catch(N){if(N instanceof RangeError){return"..."}throw N}}function B(M){return n("",{"":M},[])}function n(V,S,T){var U=S[V];if(E(U)===J&&typeof U.toJSON==="function"){U=U.toJSON(V)}var O=z.call(U);switch(O){case k:case d:case f:U=U.valueOf()}switch(U){case null:return"null";case true:return"true";case false:return"false"}var R=typeof U;switch(R){case"string":return U.inspect(true);case"number":return isFinite(U)?String(U):"null";case"object":for(var N=0,M=T.length;N<M;N++){if(T[N]===U){throw new TypeError("Cyclic reference to '"+U+"' in object")}}T.push(U);var Q=[];if(O===b){for(var N=0,M=U.length;N<M;N++){var P=n(N,U,T);Q.push(typeof P==="undefined"?"null":P)}Q="["+Q.join(",")+"]"}else{var W=Object.keys(U);for(var N=0,M=W.length;N<M;N++){var V=W[N],P=n(V,U,T);if(typeof P!=="undefined"){Q.push(V.inspect(true)+":"+P)}}Q="{"+Q.join(",")+"}"}T.pop();return Q}}function K(M){return JSON.stringify(M)}function D(M){return $H(M).toQueryString()}function q(M){return M&&M.toHTML?M.toHTML():String.interpret(M)}function y(M){if(E(M)!==J){throw new TypeError()}var O=[];for(var P in M){if(l.call(M,P)){O.push(P)}}if(a){for(var N=0;P=r[N];N++){if(l.call(M,P)){O.push(P)}}}return O}function H(M){var N=[];for(var O in M){N.push(M[O])}return N}function t(M){return h({},M)}function F(M){return !!(M&&M.nodeType==1)}function v(M){return z.call(M)===b}var c=(typeof Array.isArray=="function")&&Array.isArray([])&&!Array.isArray({});if(c){v=Array.isArray}function s(M){return M instanceof Hash}function o(M){return z.call(M)===i}function g(M){return z.call(M)===f}function G(M){return z.call(M)===k}function u(M){return z.call(M)===I}function p(M){return typeof M==="undefined"}h(Object,{extend:h,inspect:m,toJSON:e?K:B,toQueryString:D,toHTML:q,keys:Object.keys||y,values:H,clone:t,isElement:F,isArray:v,isHash:s,isFunction:o,isString:g,isNumber:G,isDate:u,isUndefined:p})})();Object.extend(Function.prototype,(function(){var m=Array.prototype.slice;function d(q,n){var p=q.length,o=n.length;while(o--){q[p+o]=n[o]}return q}function k(o,n){o=m.call(o,0);return d(o,n)}function g(){var n=this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g,"").replace(/\s+/g,"").split(",");return n.length==1&&!n[0]?[]:n}function h(p){if(arguments.length<2&&Object.isUndefined(arguments[0])){return this}if(!Object.isFunction(this)){throw new TypeError("The object is not callable.")}var r=function(){};var n=this,o=m.call(arguments,1);var q=function(){var s=k(o,arguments);var t=this instanceof q?this:p;return n.apply(t,s)};r.prototype=this.prototype;q.prototype=new r();return q}function f(p){var n=this,o=m.call(arguments,1);return function(r){var q=d([r||window.event],o);return n.apply(p,q)}}function l(){if(!arguments.length){return this}var n=this,o=m.call(arguments,0);return function(){var p=k(o,arguments);return n.apply(this,p)}}function e(p){var n=this,o=m.call(arguments,1);p=p*1000;return window.setTimeout(function(){return n.apply(n,o)},p)}function a(){var n=d([0.01],arguments);return this.delay.apply(this,n)}function c(o){var n=this;return function(){var p=d([n.bind(this)],arguments);return o.apply(this,p)}}function b(){if(this._methodized){return this._methodized}var n=this;return this._methodized=function(){var o=d([this],arguments);return n.apply(null,o)}}var i={argumentNames:g,bindAsEventListener:f,curry:l,delay:e,defer:a,wrap:c,methodize:b};if(!Function.prototype.bind){i.bind=h}return i})());(function(c){function b(){return this.getUTCFullYear()+"-"+(this.getUTCMonth()+1).toPaddedString(2)+"-"+this.getUTCDate().toPaddedString(2)+"T"+this.getUTCHours().toPaddedString(2)+":"+this.getUTCMinutes().toPaddedString(2)+":"+this.getUTCSeconds().toPaddedString(2)+"Z"}function a(){return this.toISOString()}if(!c.toISOString){c.toISOString=b}if(!c.toJSON){c.toJSON=a}})(Date.prototype);RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(a){return String(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};var PeriodicalExecuter=Class.create({initialize:function(b,a){this.callback=b;this.frequency=a;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},execute:function(){this.callback(this)},stop:function(){if(!this.timer){return}clearInterval(this.timer);this.timer=null},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute();this.currentlyExecuting=false}catch(a){this.currentlyExecuting=false;throw a}}}});Object.extend(String,{interpret:function(a){return a==null?"":String(a)},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});Object.extend(String.prototype,(function(){var NATIVE_JSON_PARSE_SUPPORT=window.JSON&&typeof JSON.parse==="function"&&JSON.parse('{"test": true}').test;function prepareReplacement(replacement){if(Object.isFunction(replacement)){return replacement}var template=new Template(replacement);return function(match){return template.evaluate(match)}}function isNonEmptyRegExp(regexp){return regexp.source&®exp.source!=="(?:)"}function gsub(pattern,replacement){var result="",source=this,match;replacement=prepareReplacement(replacement);if(Object.isString(pattern)){pattern=RegExp.escape(pattern)}if(!(pattern.length||isNonEmptyRegExp(pattern))){replacement=replacement("");return replacement+source.split("").join(replacement)+replacement}while(source.length>0){match=source.match(pattern);if(match&&match[0].length>0){result+=source.slice(0,match.index);result+=String.interpret(replacement(match));source=source.slice(match.index+match[0].length)}else{result+=source,source=""}}return result}function sub(pattern,replacement,count){replacement=prepareReplacement(replacement);count=Object.isUndefined(count)?1:count;return this.gsub(pattern,function(match){if(--count<0){return match[0]}return replacement(match)})}function scan(pattern,iterator){this.gsub(pattern,iterator);return String(this)}function truncate(length,truncation){length=length||30;truncation=Object.isUndefined(truncation)?"...":truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:String(this)}function strip(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}function stripTags(){return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?(\/)?>|<\/\w+>/gi,"")}function stripScripts(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")}function extractScripts(){var matchAll=new RegExp(Prototype.ScriptFragment,"img"),matchOne=new RegExp(Prototype.ScriptFragment,"im");return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||["",""])[1]})}function evalScripts(){return this.extractScripts().map(function(script){return eval(script)})}function escapeHTML(){return this.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function unescapeHTML(){return this.stripTags().replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}function toQueryParams(separator){var match=this.strip().match(/([^?#]*)(#.*)?$/);if(!match){return{}}return match[1].split(separator||"&").inject({},function(hash,pair){if((pair=pair.split("="))[0]){var key=decodeURIComponent(pair.shift()),value=pair.length>1?pair.join("="):pair[0];if(value!=undefined){value=value.gsub("+"," ");value=decodeURIComponent(value)}if(key in hash){if(!Object.isArray(hash[key])){hash[key]=[hash[key]]}hash[key].push(value)}else{hash[key]=value}}return hash})}function toArray(){return this.split("")}function succ(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)}function times(count){return count<1?"":new Array(count+1).join(this)}function camelize(){return this.replace(/-+(.)?/g,function(match,chr){return chr?chr.toUpperCase():""})}function capitalize(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()}function underscore(){return this.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/-/g,"_").toLowerCase()}function dasherize(){return this.replace(/_/g,"-")}function inspect(useDoubleQuotes){var escapedString=this.replace(/[\x00-\x1f\\]/g,function(character){if(character in String.specialChar){return String.specialChar[character]}return"\\u00"+character.charCodeAt().toPaddedString(2,16)});if(useDoubleQuotes){return'"'+escapedString.replace(/"/g,'\\"')+'"'}return"'"+escapedString.replace(/'/g,"\\'")+"'"}function unfilterJSON(filter){return this.replace(filter||Prototype.JSONFilter,"$1")}function isJSON(){var str=this;if(str.blank()){return false}str=str.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@");str=str.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]");str=str.replace(/(?:^|:|,)(?:\s*\[)+/g,"");return(/^[\],:{}\s]*$/).test(str)}function evalJSON(sanitize){var json=this.unfilterJSON(),cx=/[\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff\u0000]/g;if(cx.test(json)){json=json.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}try{if(!sanitize||json.isJSON()){return eval("("+json+")")}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())}function parseJSON(){var json=this.unfilterJSON();return JSON.parse(json)}function include(pattern){return this.indexOf(pattern)>-1}function startsWith(pattern,position){position=Object.isNumber(position)?position:0;return this.lastIndexOf(pattern,position)===position}function endsWith(pattern,position){pattern=String(pattern);position=Object.isNumber(position)?position:this.length;if(position<0){position=0}if(position>this.length){position=this.length}var d=position-pattern.length;return d>=0&&this.indexOf(pattern,d)===d}function empty(){return this==""}function blank(){return/^\s*$/.test(this)}function interpolate(object,pattern){return new Template(this,pattern).evaluate(object)}return{gsub:gsub,sub:sub,scan:scan,truncate:truncate,strip:String.prototype.trim||strip,stripTags:stripTags,stripScripts:stripScripts,extractScripts:extractScripts,evalScripts:evalScripts,escapeHTML:escapeHTML,unescapeHTML:unescapeHTML,toQueryParams:toQueryParams,parseQuery:toQueryParams,toArray:toArray,succ:succ,times:times,camelize:camelize,capitalize:capitalize,underscore:underscore,dasherize:dasherize,inspect:inspect,unfilterJSON:unfilterJSON,isJSON:isJSON,evalJSON:NATIVE_JSON_PARSE_SUPPORT?parseJSON:evalJSON,include:include,startsWith:String.prototype.startsWith||startsWith,endsWith:String.prototype.endsWith||endsWith,empty:empty,blank:blank,interpolate:interpolate}})());var Template=Class.create({initialize:function(a,b){this.template=a.toString();this.pattern=b||Template.Pattern},evaluate:function(a){if(a&&Object.isFunction(a.toTemplateReplacements)){a=a.toTemplateReplacements()}return this.template.gsub(this.pattern,function(d){if(a==null){return(d[1]+"")}var f=d[1]||"";if(f=="\\"){return d[2]}var b=a,g=d[3],e=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;d=e.exec(g);if(d==null){return f}while(d!=null){var c=d[1].startsWith("[")?d[2].replace(/\\\\]/g,"]"):d[1];b=b[c];if(null==b||""==d[3]){break}g=g.substring("["==d[3]?d[1].length:d[0].length);d=e.exec(g)}return f+String.interpret(b)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable=(function(){function c(y,x){try{this._each(y,x)}catch(z){if(z!=$break){throw z}}return this}function s(A,z,y){var x=-A,B=[],C=this.toArray();if(A<1){return C}while((x+=A)<C.length){B.push(C.slice(x,x+A))}return B.collect(z,y)}function b(z,y){z=z||Prototype.K;var x=true;this.each(function(B,A){x=x&&!!z.call(y,B,A,this);if(!x){throw $break}},this);return x}function i(z,y){z=z||Prototype.K;var x=false;this.each(function(B,A){if(x=!!z.call(y,B,A,this)){throw $break}},this);return x}function k(z,y){z=z||Prototype.K;var x=[];this.each(function(B,A){x.push(z.call(y,B,A,this))},this);return x}function u(z,y){var x;this.each(function(B,A){if(z.call(y,B,A,this)){x=B;throw $break}},this);return x}function h(z,y){var x=[];this.each(function(B,A){if(z.call(y,B,A,this)){x.push(B)}},this);return x}function g(A,z,y){z=z||Prototype.K;var x=[];if(Object.isString(A)){A=new RegExp(RegExp.escape(A))}this.each(function(C,B){if(A.match(C)){x.push(z.call(y,C,B,this))}},this);return x}function a(x){if(Object.isFunction(this.indexOf)&&this.indexOf(x)!=-1){return true}var y=false;this.each(function(z){if(z==x){y=true;throw $break}});return y}function r(y,x){x=Object.isUndefined(x)?null:x;return this.eachSlice(y,function(z){while(z.length<y){z.push(x)}return z})}function m(x,z,y){this.each(function(B,A){x=z.call(y,x,B,A,this)},this);return x}function w(y){var x=$A(arguments).slice(1);return this.map(function(z){return z[y].apply(z,x)})}function q(z,y){z=z||Prototype.K;var x;this.each(function(B,A){B=z.call(y,B,A,this);if(x==null||B>=x){x=B}},this);return x}function o(z,y){z=z||Prototype.K;var x;this.each(function(B,A){B=z.call(y,B,A,this);if(x==null||B<x){x=B}},this);return x}function e(A,y){A=A||Prototype.K;var z=[],x=[];this.each(function(C,B){(A.call(y,C,B,this)?z:x).push(C)},this);return[z,x]}function f(y){var x=[];this.each(function(z){x.push(z[y])});return x}function d(z,y){var x=[];this.each(function(B,A){if(!z.call(y,B,A,this)){x.push(B)}},this);return x}function n(y,x){return this.map(function(A,z){return{value:A,criteria:y.call(x,A,z,this)}},this).sort(function(C,B){var A=C.criteria,z=B.criteria;return A<z?-1:A>z?1:0}).pluck("value")}function p(){return this.map()}function t(){var y=Prototype.K,x=$A(arguments);if(Object.isFunction(x.last())){y=x.pop()}var z=[this].concat(x).map($A);return this.map(function(B,A){return y(z.pluck(A))})}function l(){return this.toArray().length}function v(){return"#<Enumerable:"+this.toArray().inspect()+">"}return{each:c,eachSlice:s,all:b,every:b,any:i,some:i,collect:k,map:k,detect:u,findAll:h,select:h,filter:h,grep:g,include:a,member:a,inGroupsOf:r,inject:m,invoke:w,max:q,min:o,partition:e,pluck:f,reject:d,sortBy:n,toArray:p,entries:p,zip:t,size:l,inspect:v,find:u}})();function $A(c){if(!c){return[]}if("toArray" in Object(c)){return c.toArray()}var b=c.length||0,a=new Array(b);while(b--){a[b]=c[b]}return a}function $w(a){if(!Object.isString(a)){return[]}a=a.strip();return a?a.split(/\s+/):[]}Array.from=$A;(function(){var w=Array.prototype,p=w.slice,r=w.forEach;function b(C,B){for(var A=0,D=this.length>>>0;A<D;A++){if(A in this){C.call(B,this[A],A,this)}}}if(!r){r=b}function o(){this.length=0;return this}function d(){return this[0]}function g(){return this[this.length-1]}function l(){return this.select(function(A){return A!=null})}function z(){return this.inject([],function(B,A){if(Object.isArray(A)){return B.concat(A.flatten())}B.push(A);return B})}function k(){var A=p.call(arguments,0);return this.select(function(B){return !A.include(B)})}function f(A){return(A===false?this.toArray():this)._reverse()}function n(A){return this.inject([],function(D,C,B){if(0==B||(A?D.last()!=C:!D.include(C))){D.push(C)}return D})}function s(A){return this.uniq().findAll(function(B){return A.indexOf(B)!==-1})}function u(){return p.call(this,0)}function m(){return this.length}function x(){return"["+this.map(Object.inspect).join(", ")+"]"}function a(D,B){if(this==null){throw new TypeError()}var E=Object(this),C=E.length>>>0;if(C===0){return -1}B=Number(B);if(isNaN(B)){B=0}else{if(B!==0&&isFinite(B)){B=(B>0?1:-1)*Math.floor(Math.abs(B))}}if(B>C){return -1}var A=B>=0?B:Math.max(C-Math.abs(B),0);for(;A<C;A++){if(A in E&&E[A]===D){return A}}return -1}function q(D,B){if(this==null){throw new TypeError()}var E=Object(this),C=E.length>>>0;if(C===0){return -1}if(!Object.isUndefined(B)){B=Number(B);if(isNaN(B)){B=0}else{if(B!==0&&isFinite(B)){B=(B>0?1:-1)*Math.floor(Math.abs(B))}}}else{B=C}var A=B>=0?Math.min(B,C-1):C-Math.abs(B);for(;A>=0;A--){if(A in E&&E[A]===D){return A}}return -1}function c(H){var F=[],G=p.call(arguments,0),I,B=0;G.unshift(this);for(var E=0,A=G.length;E<A;E++){I=G[E];if(Object.isArray(I)&&!("callee" in I)){for(var D=0,C=I.length;D<C;D++){if(D in I){F[B]=I[D]}B++}}else{F[B++]=I}}F.length=B;return F}function t(A){return function(){if(arguments.length===0){return A.call(this,Prototype.K)}else{if(arguments[0]===undefined){var B=p.call(arguments,1);B.unshift(Prototype.K);return A.apply(this,B)}else{return A.apply(this,arguments)}}}}function v(E){if(this==null){throw new TypeError()}E=E||Prototype.K;var A=Object(this);var D=[],C=arguments[1],G=0;for(var B=0,F=A.length>>>0;B<F;B++){if(B in A){D[G]=E.call(C,A[B],B,A)}G++}D.length=G;return D}if(w.map){v=t(Array.prototype.map)}function h(E){if(this==null||!Object.isFunction(E)){throw new TypeError()}var A=Object(this);var D=[],C=arguments[1],G;for(var B=0,F=A.length>>>0;B<F;B++){if(B in A){G=A[B];if(E.call(C,G,B,A)){D.push(G)}}}return D}if(w.filter){h=Array.prototype.filter}function i(D){if(this==null){throw new TypeError()}D=D||Prototype.K;var C=arguments[1];var A=Object(this);for(var B=0,E=A.length>>>0;B<E;B++){if(B in A&&D.call(C,A[B],B,A)){return true}}return false}if(w.some){i=t(Array.prototype.some)}function y(D){if(this==null){throw new TypeError()}D=D||Prototype.K;var C=arguments[1];var A=Object(this);for(var B=0,E=A.length>>>0;B<E;B++){if(B in A&&!D.call(C,A[B],B,A)){return false}}return true}if(w.every){y=t(Array.prototype.every)}Object.extend(w,Enumerable);if(w.entries===Enumerable.entries){delete w.entries}if(!w._reverse){w._reverse=w.reverse}Object.extend(w,{_each:r,map:v,collect:v,select:h,filter:h,findAll:h,some:i,any:i,every:y,all:y,clear:o,first:d,last:g,compact:l,flatten:z,without:k,reverse:f,uniq:n,intersect:s,clone:u,toArray:u,size:m,inspect:x});var e=(function(){return[].concat(arguments)[0][0]!==1})(1,2);if(e){w.concat=c}if(!w.indexOf){w.indexOf=a}if(!w.lastIndexOf){w.lastIndexOf=q}})();function $H(a){return new Hash(a)}var Hash=Class.create(Enumerable,(function(){function e(q){this._object=Object.isHash(q)?q.toObject():Object.clone(q)}function f(t,s){var r=0;for(var q in this._object){var u=this._object[q],v=[q,u];v.key=q;v.value=u;t.call(s,v,r);r++}}function k(q,r){return this._object[q]=r}function c(q){if(this._object[q]!==Object.prototype[q]){return this._object[q]}}function n(q){var r=this._object[q];delete this._object[q];return r}function p(){return Object.clone(this._object)}function o(){return this.pluck("key")}function m(){return this.pluck("value")}function g(r){var q=this.detect(function(s){return s.value===r});return q&&q.key}function i(q){return this.clone().update(q)}function d(q){return new Hash(q).inject(this,function(r,s){r.set(s.key,s.value);return r})}function b(q,r){if(Object.isUndefined(r)){return q}r=String.interpret(r);r=r.gsub(/(\r)?\n/,"\r\n");r=encodeURIComponent(r);r=r.gsub(/%20/,"+");return q+"="+r}function a(){return this.inject([],function(u,x){var t=encodeURIComponent(x.key),r=x.value;if(r&&typeof r=="object"){if(Object.isArray(r)){var w=[];for(var s=0,q=r.length,v;s<q;s++){v=r[s];w.push(b(t,v))}return u.concat(w)}}else{u.push(b(t,r))}return u}).join("&")}function l(){return"#<Hash:{"+this.map(function(q){return q.map(Object.inspect).join(": ")}).join(", ")+"}>"}function h(){return new Hash(this)}return{initialize:e,_each:f,set:k,get:c,unset:n,toObject:p,toTemplateReplacements:p,keys:o,values:m,index:g,merge:i,update:d,toQueryString:a,inspect:l,toJSON:p,clone:h}})());Hash.from=$H;Object.extend(Number.prototype,(function(){function d(){return this.toPaddedString(2,16)}function b(){return this+1}function h(k,i){$R(0,this,true).each(k,i);return this}function g(l,k){var i=this.toString(k||10);return"0".times(l-i.length)+i}function a(){return Math.abs(this)}function c(){return Math.round(this)}function e(){return Math.ceil(this)}function f(){return Math.floor(this)}return{toColorPart:d,succ:b,times:h,toPaddedString:g,abs:a,round:c,ceil:e,floor:f}})());function $R(c,a,b){return new ObjectRange(c,a,b)}var ObjectRange=Class.create(Enumerable,(function(){function b(f,d,e){this.start=f;this.end=d;this.exclusive=e}function c(f,e){var g=this.start,d;for(d=0;this.include(g);d++){f.call(e,g,d);g=g.succ()}}function a(d){if(d<this.start){return false}if(this.exclusive){return d<this.end}return d<=this.end}return{initialize:b,_each:c,include:a}})());var Abstract={};var Try={these:function(){var c;for(var b=0,d=arguments.length;b<d;b++){var a=arguments[b];try{c=a();break}catch(f){}}return c}};var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")})||false},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(b,a){this.responders._each(b,a)},register:function(a){if(!this.include(a)){this.responders.push(a)}},unregister:function(a){this.responders=this.responders.without(a)},dispatch:function(d,b,c,a){this.each(function(f){if(Object.isFunction(f[d])){try{f[d].apply(f,[b,c,a])}catch(g){}}})}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=Class.create({initialize:function(a){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:"",evalJSON:true,evalJS:true};Object.extend(this.options,a||{});this.options.method=this.options.method.toLowerCase();if(Object.isHash(this.options.parameters)){this.options.parameters=this.options.parameters.toObject()}}});Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,b,a){$super(a);this.transport=Ajax.getTransport();this.request(b)},request:function(b){this.url=b;this.method=this.options.method;var d=Object.isString(this.options.parameters)?this.options.parameters:Object.toQueryString(this.options.parameters);if(!["get","post"].include(this.method)){d+=(d?"&":"")+"_method="+this.method;this.method="post"}if(d&&this.method==="get"){this.url+=(this.url.include("?")?"&":"?")+d}this.parameters=d.toQueryParams();try{var a=new Ajax.Response(this);if(this.options.onCreate){this.options.onCreate(a)}Ajax.Responders.dispatch("onCreate",this,a);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous){this.respondToReadyState.bind(this).defer(1)}this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=="post"?(this.options.postBody||d):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(c){this.dispatchException(c)}},onStateChange:function(){var a=this.transport.readyState;if(a>1&&!((a==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)}},setRequestHeaders:function(){var e={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){e["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:"");if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005){e.Connection="close"}}if(typeof this.options.requestHeaders=="object"){var c=this.options.requestHeaders;if(Object.isFunction(c.push)){for(var b=0,d=c.length;b<d;b+=2){e[c[b]]=c[b+1]}}else{$H(c).each(function(f){e[f.key]=f.value})}}for(var a in e){if(e[a]!=null){this.transport.setRequestHeader(a,e[a])}}},success:function(){var a=this.getStatus();return !a||(a>=200&&a<300)||a==304},getStatus:function(){try{if(this.transport.status===1223){return 204}return this.transport.status||0}catch(a){return 0}},respondToReadyState:function(a){var c=Ajax.Request.Events[a],b=new Ajax.Response(this);if(c=="Complete"){try{this._complete=true;(this.options["on"+b.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(b,b.headerJSON)}catch(d){this.dispatchException(d)}var f=b.getHeader("Content-type");if(this.options.evalJS=="force"||(this.options.evalJS&&this.isSameOrigin()&&f&&f.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))){this.evalResponse()}}try{(this.options["on"+c]||Prototype.emptyFunction)(b,b.headerJSON);Ajax.Responders.dispatch("on"+c,this,b,b.headerJSON)}catch(d){this.dispatchException(d)}if(c=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction}},isSameOrigin:function(){var a=this.url.match(/^\s*https?:\/\/[^\/]*/);return !a||(a[0]=="#{protocol}//#{domain}#{port}".interpolate({protocol:location.protocol,domain:document.domain,port:location.port?":"+location.port:""}))},getHeader:function(a){try{return this.transport.getResponseHeader(a)||null}catch(b){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(e){this.dispatchException(e)}},dispatchException:function(a){(this.options.onException||Prototype.emptyFunction)(this,a);Ajax.Responders.dispatch("onException",this,a)}});Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Response=Class.create({initialize:function(c){this.request=c;var d=this.transport=c.transport,a=this.readyState=d.readyState;if((a>2&&!Prototype.Browser.IE)||a==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(d.responseText);this.headerJSON=this._getHeaderJSON()}if(a==4){var b=d.responseXML;this.responseXML=Object.isUndefined(b)?null:b;this.responseJSON=this._getResponseJSON()}},status:0,statusText:"",getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||""}catch(a){return""}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()}catch(a){return null}},getResponseHeader:function(a){return this.transport.getResponseHeader(a)},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()},_getHeaderJSON:function(){var a=this.getHeader("X-JSON");if(!a){return null}try{a=decodeURIComponent(escape(a))}catch(b){}try{return a.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin())}catch(b){this.request.dispatchException(b)}},_getResponseJSON:function(){var a=this.request.options;if(!a.evalJSON||(a.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json"))||this.responseText.blank()){return null}try{return this.responseText.evalJSON(a.sanitizeJSON||!this.request.isSameOrigin())}catch(b){this.request.dispatchException(b)}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,a,c,b){this.container={success:(a.success||a),failure:(a.failure||(a.success?null:a))};b=Object.clone(b);var d=b.onComplete;b.onComplete=(function(e,f){this.updateContent(e.responseText);if(Object.isFunction(d)){d(e,f)}}).bind(this);$super(c,b)},updateContent:function(d){var c=this.container[this.success()?"success":"failure"],a=this.options;if(!a.evalScripts){d=d.stripScripts()}if(c=$(c)){if(a.insertion){if(Object.isString(a.insertion)){var b={};b[a.insertion]=d;c.insert(b)}else{a.insertion(c,d)}}else{c.update(d)}}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,a,c,b){$super(b);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=a;this.url=c;this.start()},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent()},stop:function(){this.updater.options.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments)},updateComplete:function(a){if(this.options.decay){this.decay=(a.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=a.responseText}this.timer=this.onTimerEvent.bind(this).delay(this.decay*this.frequency)},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)}});(function(a9){var aF;var a2=Array.prototype.slice;var aw=document.createElement("div");function a0(bq){if(arguments.length>1){for(var F=0,bs=[],br=arguments.length;F<br;F++){bs.push(a0(arguments[F]))}return bs}if(Object.isString(bq)){bq=document.getElementById(bq)}return aG.extend(bq)}a9.$=a0;if(!a9.Node){a9.Node={}}if(!a9.Node.ELEMENT_NODE){Object.extend(a9.Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12})}var s={};function aR(F,i){if(F==="select"){return false}if("type" in i){return false}return true}var d=(function(){try{var i=document.createElement('<input name="x">');return i.tagName.toLowerCase()==="input"&&i.name==="x"}catch(F){return false}})();var aJ=a9.Element;function aG(F,i){i=i||{};F=F.toLowerCase();if(d&&i.name){F="<"+F+' name="'+i.name+'">';delete i.name;return aG.writeAttribute(document.createElement(F),i)}if(!s[F]){s[F]=aG.extend(document.createElement(F))}var bq=aR(F,i)?s[F].cloneNode(false):document.createElement(F);return aG.writeAttribute(bq,i)}a9.Element=aG;Object.extend(a9.Element,aJ||{});if(aJ){a9.Element.prototype=aJ.prototype}aG.Methods={ByTag:{},Simulated:{}};var a4={};var I={id:"id",className:"class"};function bb(F){F=a0(F);var i="<"+F.tagName.toLowerCase();var bq,bs;for(var br in I){bq=I[br];bs=(F[br]||"").toString();if(bs){i+=" "+bq+"="+bs.inspect(true)}}return i+">"}a4.inspect=bb;function w(i){return a0(i).getStyle("display")!=="none"}function ay(F,i){F=a0(F);if(typeof i!=="boolean"){i=!aG.visible(F)}aG[i?"show":"hide"](F);return F}function aI(i){i=a0(i);i.style.display="none";return i}function k(i){i=a0(i);i.style.display="";return i}Object.extend(a4,{visible:w,toggle:ay,hide:aI,show:k});function ae(i){i=a0(i);i.parentNode.removeChild(i);return i}var aU=(function(){var i=document.createElement("select"),F=true;i.innerHTML='<option value="test">test</option>';if(i.options&&i.options[0]){F=i.options[0].nodeName.toUpperCase()!=="OPTION"}i=null;return F})();var J=(function(){try{var i=document.createElement("table");if(i&&i.tBodies){i.innerHTML="<tbody><tr><td>test</td></tr></tbody>";var bq=typeof i.tBodies[0]=="undefined";i=null;return bq}}catch(F){return true}})();var a3=(function(){try{var i=document.createElement("div");i.innerHTML="<link />";var bq=(i.childNodes.length===0);i=null;return bq}catch(F){return true}})();var y=aU||J||a3;var ar=(function(){var i=document.createElement("script"),bq=false;try{i.appendChild(document.createTextNode(""));bq=!i.firstChild||i.firstChild&&i.firstChild.nodeType!==3}catch(F){bq=true}i=null;return bq})();function P(bs,bu){bs=a0(bs);var bv=bs.getElementsByTagName("*"),br=bv.length;while(br--){aa(bv[br])}if(bu&&bu.toElement){bu=bu.toElement()}if(Object.isElement(bu)){return bs.update().insert(bu)}bu=Object.toHTML(bu);var bq=bs.tagName.toUpperCase();if(bq==="SCRIPT"&&ar){bs.text=bu;return bs}if(y){if(bq in M.tags){while(bs.firstChild){bs.removeChild(bs.firstChild)}var F=u(bq,bu.stripScripts());for(var br=0,bt;bt=F[br];br++){bs.appendChild(bt)}}else{if(a3&&Object.isString(bu)&&bu.indexOf("<link")>-1){while(bs.firstChild){bs.removeChild(bs.firstChild)}var F=u(bq,bu.stripScripts(),true);for(var br=0,bt;bt=F[br];br++){bs.appendChild(bt)}}else{bs.innerHTML=bu.stripScripts()}}}else{bs.innerHTML=bu.stripScripts()}bu.evalScripts.bind(bu).defer();return bs}function ai(F,bq){F=a0(F);if(bq&&bq.toElement){bq=bq.toElement()}else{if(!Object.isElement(bq)){bq=Object.toHTML(bq);var i=F.ownerDocument.createRange();i.selectNode(F);bq.evalScripts.bind(bq).defer();bq=i.createContextualFragment(bq.stripScripts())}}F.parentNode.replaceChild(bq,F);return F}var M={before:function(i,F){i.parentNode.insertBefore(F,i)},top:function(i,F){i.insertBefore(F,i.firstChild)},bottom:function(i,F){i.appendChild(F)},after:function(i,F){i.parentNode.insertBefore(F,i.nextSibling)},tags:{TABLE:["<table>","</table>",1],TBODY:["<table><tbody>","</tbody></table>",2],TR:["<table><tbody><tr>","</tr></tbody></table>",3],TD:["<table><tbody><tr><td>","</td></tr></tbody></table>",4],SELECT:["<select>","</select>",1]}};var aK=M.tags;Object.extend(aK,{THEAD:aK.TBODY,TFOOT:aK.TBODY,TH:aK.TD});function ap(bq,bt){bq=a0(bq);if(bt&&bt.toElement){bt=bt.toElement()}if(Object.isElement(bt)){bq.parentNode.replaceChild(bt,bq);return bq}bt=Object.toHTML(bt);var bs=bq.parentNode,F=bs.tagName.toUpperCase();if(F in M.tags){var bu=aG.next(bq);var i=u(F,bt.stripScripts());bs.removeChild(bq);var br;if(bu){br=function(bv){bs.insertBefore(bv,bu)}}else{br=function(bv){bs.appendChild(bv)}}i.each(br)}else{bq.outerHTML=bt.stripScripts()}bt.evalScripts.bind(bt).defer();return bq}if("outerHTML" in document.documentElement){ai=ap}function a8(i){if(Object.isUndefined(i)||i===null){return false}if(Object.isString(i)||Object.isNumber(i)){return true}if(Object.isElement(i)){return true}if(i.toElement||i.toHTML){return true}return false}function bo(bs,bu,F){F=F.toLowerCase();var bw=M[F];if(bu&&bu.toElement){bu=bu.toElement()}if(Object.isElement(bu)){bw(bs,bu);return bs}bu=Object.toHTML(bu);var br=((F==="before"||F==="after")?bs.parentNode:bs).tagName.toUpperCase();var bv=u(br,bu.stripScripts());if(F==="top"||F==="after"){bv.reverse()}for(var bq=0,bt;bt=bv[bq];bq++){bw(bs,bt)}bu.evalScripts.bind(bu).defer()}function R(F,bq){F=a0(F);if(a8(bq)){bq={bottom:bq}}for(var i in bq){bo(F,bq[i],i)}return F}function v(F,bq,i){F=a0(F);if(Object.isElement(bq)){a0(bq).writeAttribute(i||{})}else{if(Object.isString(bq)){bq=new aG(bq,i)}else{bq=new aG("div",bq)}}if(F.parentNode){F.parentNode.replaceChild(bq,F)}bq.appendChild(F);return bq}function x(F){F=a0(F);var bq=F.firstChild;while(bq){var i=bq.nextSibling;if(bq.nodeType===Node.TEXT_NODE&&!/\S/.test(bq.nodeValue)){F.removeChild(bq)}bq=i}return F}function a5(i){return a0(i).innerHTML.blank()}function u(bt,bs,bu){var br=M.tags[bt],bv=aw;var F=!!br;if(!F&&bu){F=true;br=["","",0]}if(F){bv.innerHTML=" "+br[0]+bs+br[1];bv.removeChild(bv.firstChild);for(var bq=br[2];bq--;){bv=bv.firstChild}}else{bv.innerHTML=bs}return $A(bv.childNodes)}function G(br,F){if(!(br=a0(br))){return}var bt=br.cloneNode(F);if(!aZ){bt._prototypeUID=aF;if(F){var bs=aG.select(bt,"*"),bq=bs.length;while(bq--){bs[bq]._prototypeUID=aF}}}return aG.extend(bt)}function aa(F){var i=N(F);if(i){aG.stopObserving(F);if(!aZ){F._prototypeUID=aF}delete aG.Storage[i]}}function bm(bq){var F=bq.length;while(F--){aa(bq[F])}}function au(bs){var br=bs.length,bq,F;while(br--){bq=bs[br];F=N(bq);delete aG.Storage[F];delete Event.cache[F]}}if(aZ){bm=au}function n(bq){if(!(bq=a0(bq))){return}aa(bq);var br=bq.getElementsByTagName("*"),F=br.length;while(F--){aa(br[F])}return null}Object.extend(a4,{remove:ae,update:P,replace:ai,insert:R,wrap:v,cleanWhitespace:x,empty:a5,clone:G,purge:n});function an(i,bq,br){i=a0(i);br=br||-1;var F=[];while(i=i[bq]){if(i.nodeType===Node.ELEMENT_NODE){F.push(aG.extend(i))}if(F.length===br){break}}return F}function aM(i){return an(i,"parentNode")}function bn(i){return aG.select(i,"*")}function Y(i){i=a0(i).firstChild;while(i&&i.nodeType!==Node.ELEMENT_NODE){i=i.nextSibling}return a0(i)}function bj(F){var i=[],bq=a0(F).firstChild;while(bq){if(bq.nodeType===Node.ELEMENT_NODE){i.push(aG.extend(bq))}bq=bq.nextSibling}return i}function q(i){return an(i,"previousSibling")}function bi(i){return an(i,"nextSibling")}function aW(i){i=a0(i);var bq=q(i),F=bi(i);return bq.reverse().concat(F)}function aS(F,i){F=a0(F);if(Object.isString(i)){return Prototype.Selector.match(F,i)}return i.match(F)}function aX(F,bq,br,i){F=a0(F),br=br||0,i=i||0;if(Object.isNumber(br)){i=br,br=null}while(F=F[bq]){if(F.nodeType!==1){continue}if(br&&!Prototype.Selector.match(F,br)){continue}if(--i>=0){continue}return aG.extend(F)}}function ab(F,bq,i){F=a0(F);if(arguments.length===1){return a0(F.parentNode)}return aX(F,"parentNode",bq,i)}function z(F,br,i){if(arguments.length===1){return Y(F)}F=a0(F),br=br||0,i=i||0;if(Object.isNumber(br)){i=br,br="*"}var bq=Prototype.Selector.select(br,F)[i];return aG.extend(bq)}function h(F,bq,i){return aX(F,"previousSibling",bq,i)}function aC(F,bq,i){return aX(F,"nextSibling",bq,i)}function bc(i){i=a0(i);var F=a2.call(arguments,1).join(", ");return Prototype.Selector.select(F,i)}function aE(br){br=a0(br);var bt=a2.call(arguments,1).join(", ");var bu=aG.siblings(br),bq=[];for(var F=0,bs;bs=bu[F];F++){if(Prototype.Selector.match(bs,bt)){bq.push(bs)}}return bq}function E(F,i){F=a0(F),i=a0(i);if(!F||!i){return false}while(F=F.parentNode){if(F===i){return true}}return false}function C(F,i){F=a0(F),i=a0(i);if(!F||!i){return false}if(!i.contains){return E(F,i)}return i.contains(F)&&i!==F}function K(F,i){F=a0(F),i=a0(i);if(!F||!i){return false}return(F.compareDocumentPosition(i)&8)===8}var aN;if(aw.compareDocumentPosition){aN=K}else{if(aw.contains){aN=C}else{aN=E}}Object.extend(a4,{recursivelyCollect:an,ancestors:aM,descendants:bn,firstDescendant:Y,immediateDescendants:bj,previousSiblings:q,nextSiblings:bi,siblings:aW,match:aS,up:ab,down:z,previous:h,next:aC,select:bc,adjacent:aE,descendantOf:aN,getElementsBySelector:bc,childElements:bj});var U=1;function aV(i){i=a0(i);var F=aG.readAttribute(i,"id");if(F){return F}do{F="anonymous_element_"+U++}while(a0(F));aG.writeAttribute(i,"id",F);return F}function ba(F,i){return a0(F).getAttribute(i)}function L(F,i){F=a0(F);var bq=aH.read;if(bq.values[i]){return bq.values[i](F,i)}if(bq.names[i]){i=bq.names[i]}if(i.include(":")){if(!F.attributes||!F.attributes[i]){return null}return F.attributes[i].value}return F.getAttribute(i)}function e(F,i){if(i==="title"){return F.title}return F.getAttribute(i)}var V=(function(){aw.setAttribute("onclick",[]);var i=aw.getAttribute("onclick");var F=Object.isArray(i);aw.removeAttribute("onclick");return F})();if(V){ba=L}else{if(Prototype.Browser.Opera){ba=e}}function a1(br,bq,bt){br=a0(br);var F={},bs=aH.write;if(typeof bq==="object"){F=bq}else{F[bq]=Object.isUndefined(bt)?true:bt}for(var i in F){bq=bs.names[i]||i;bt=F[i];if(bs.values[i]){bt=bs.values[i](br,bt);if(Object.isUndefined(bt)){continue}}if(bt===false||bt===null){br.removeAttribute(bq)}else{if(bt===true){br.setAttribute(bq,bq)}else{br.setAttribute(bq,bt)}}}return br}var a=(function(){if(!d){return false}var F=document.createElement('<input type="checkbox">');F.checked=true;var i=F.getAttributeNode("checked");return !i||!i.specified})();function Z(i,bq){bq=aH.has[bq]||bq;var F=a0(i).getAttributeNode(bq);return !!(F&&F.specified)}function bh(i,F){if(F==="checked"){return i.checked}return Z(i,F)}a9.Element.Methods.Simulated.hasAttribute=a?bh:Z;function l(i){return new aG.ClassNames(i)}var W={};function f(F){if(W[F]){return W[F]}var i=new RegExp("(^|\\s+)"+F+"(\\s+|$)");W[F]=i;return i}function am(i,F){if(!(i=a0(i))){return}var bq=i.className;if(bq.length===0){return false}if(bq===F){return true}return f(F).test(bq)}function p(i,F){if(!(i=a0(i))){return}if(!am(i,F)){i.className+=(i.className?" ":"")+F}return i}function av(i,F){if(!(i=a0(i))){return}i.className=i.className.replace(f(F)," ").strip();return i}function af(F,bq,i){if(!(F=a0(F))){return}if(Object.isUndefined(i)){i=!am(F,bq)}var br=aG[i?"addClassName":"removeClassName"];return br(F,bq)}var aH={};var aQ="className",at="for";aw.setAttribute(aQ,"x");if(aw.className!=="x"){aw.setAttribute("class","x");if(aw.className==="x"){aQ="class"}}var aL=document.createElement("label");aL.setAttribute(at,"x");if(aL.htmlFor!=="x"){aL.setAttribute("htmlFor","x");if(aL.htmlFor==="x"){at="htmlFor"}}aL=null;function ad(i,F){return i.getAttribute(F)}function g(i,F){return i.getAttribute(F,2)}function B(i,bq){var F=i.getAttributeNode(bq);return F?F.value:""}function bk(i,F){return a0(i).hasAttribute(F)?F:null}aw.onclick=Prototype.emptyFunction;var Q=aw.getAttribute("onclick");var ax;if(String(Q).indexOf("{")>-1){ax=function(i,F){var bq=i.getAttribute(F);if(!bq){return null}bq=bq.toString();bq=bq.split("{")[1];bq=bq.split("}")[0];return bq.strip()}}else{if(Q===""){ax=function(i,F){var bq=i.getAttribute(F);if(!bq){return null}return bq.strip()}}}aH.read={names:{"class":aQ,className:aQ,"for":at,htmlFor:at},values:{style:function(i){return i.style.cssText.toLowerCase()},title:function(i){return i.title}}};aH.write={names:{className:"class",htmlFor:"for",cellpadding:"cellPadding",cellspacing:"cellSpacing"},values:{checked:function(i,F){F=!!F;i.checked=F;return F?"checked":null},style:function(i,F){i.style.cssText=F?F:""}}};aH.has={names:{}};Object.extend(aH.write.names,aH.read.names);var a7=$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc frameBorder");for(var ag=0,ah;ah=a7[ag];ag++){aH.write.names[ah.toLowerCase()]=ah;aH.has.names[ah.toLowerCase()]=ah}Object.extend(aH.read.values,{href:g,src:g,type:ad,action:B,disabled:bk,checked:bk,readonly:bk,multiple:bk,onload:ax,onunload:ax,onclick:ax,ondblclick:ax,onmousedown:ax,onmouseup:ax,onmouseover:ax,onmousemove:ax,onmouseout:ax,onfocus:ax,onblur:ax,onkeypress:ax,onkeydown:ax,onkeyup:ax,onsubmit:ax,onreset:ax,onselect:ax,onchange:ax});Object.extend(a4,{identify:aV,readAttribute:ba,writeAttribute:a1,classNames:l,hasClassName:am,addClassName:p,removeClassName:av,toggleClassName:af});function X(i){if(i==="float"||i==="styleFloat"){return"cssFloat"}return i.camelize()}function bp(i){if(i==="float"||i==="cssFloat"){return"styleFloat"}return i.camelize()}function D(bq,br){bq=a0(bq);var bu=bq.style,F;if(Object.isString(br)){bu.cssText+=";"+br;if(br.include("opacity")){var i=br.match(/opacity:\s*(\d?\.?\d*)/)[1];aG.setOpacity(bq,i)}return bq}for(var bt in br){if(bt==="opacity"){aG.setOpacity(bq,br[bt])}else{var bs=br[bt];if(bt==="float"||bt==="cssFloat"){bt=Object.isUndefined(bu.styleFloat)?"cssFloat":"styleFloat"}bu[bt]=bs}}return bq}function aP(F,bq){F=a0(F);bq=X(bq);var br=F.style[bq];if(!br||br==="auto"){var i=document.defaultView.getComputedStyle(F,null);br=i?i[bq]:null}if(bq==="opacity"){return br?parseFloat(br):1}return br==="auto"?null:br}function t(i,F){switch(F){case"height":case"width":if(!aG.visible(i)){return null}var bq=parseInt(aP(i,F),10);if(bq!==i["offset"+F.capitalize()]){return bq+"px"}return aG.measure(i,F);default:return aP(i,F)}}function ak(i,F){i=a0(i);F=bp(F);var bq=i.style[F];if(!bq&&i.currentStyle){bq=i.currentStyle[F]}if(F==="opacity"){if(!O){return bf(i)}else{return bq?parseFloat(bq):1}}if(bq==="auto"){if((F==="width"||F==="height")&&aG.visible(i)){return aG.measure(i,F)+"px"}return null}return bq}function aB(i){return(i||"").replace(/alpha\([^\)]*\)/gi,"")}function ac(i){if(!i.currentStyle||!i.currentStyle.hasLayout){i.style.zoom=1}return i}var O=(function(){aw.style.cssText="opacity:.55";return/^0.55/.test(aw.style.opacity)})();function A(i,F){i=a0(i);if(F==1||F===""){F=""}else{if(F<0.00001){F=0}}i.style.opacity=F;return i}function bg(i,br){if(O){return A(i,br)}i=ac(a0(i));var bq=aG.getStyle(i,"filter"),F=i.style;if(br==1||br===""){bq=aB(bq);if(bq){F.filter=bq}else{F.removeAttribute("filter")}return i}if(br<0.00001){br=0}F.filter=aB(bq)+" alpha(opacity="+(br*100)+")";return i}function be(i){return aG.getStyle(i,"opacity")}function bf(F){if(O){return be(F)}var bq=aG.getStyle(F,"filter");if(bq.length===0){return 1}var i=(bq||"").match(/alpha\(opacity=(.*)\)/i);if(i&&i[1]){return parseFloat(i[1])/100}return 1}Object.extend(a4,{setStyle:D,getStyle:aP,setOpacity:A,getOpacity:be});if("styleFloat" in aw.style){a4.getStyle=ak;a4.setOpacity=bg;a4.getOpacity=bf}var m=0;a9.Element.Storage={UID:1};function N(i){if(i===window){return 0}if(typeof i._prototypeUID==="undefined"){i._prototypeUID=aG.Storage.UID++}return i._prototypeUID}function c(i){if(i===window){return 0}if(i==document){return 1}return i.uniqueID}var aZ=("uniqueID" in aw);if(aZ){N=c}function b(F){if(!(F=a0(F))){return}var i=N(F);if(!aG.Storage[i]){aG.Storage[i]=$H()}return aG.Storage[i]}function a6(F,i,bq){if(!(F=a0(F))){return}var br=b(F);if(arguments.length===2){br.update(i)}else{br.set(i,bq)}return F}function aO(bq,F,i){if(!(bq=a0(bq))){return}var bs=b(bq),br=bs.get(F);if(Object.isUndefined(br)){bs.set(F,i);br=i}return br}Object.extend(a4,{getStorage:b,store:a6,retrieve:aO});var ao={},aY=aG.Methods.ByTag,aD=Prototype.BrowserFeatures;if(!aD.ElementExtensions&&("__proto__" in aw)){a9.HTMLElement={};a9.HTMLElement.prototype=aw.__proto__;aD.ElementExtensions=true}function bd(i){if(typeof window.Element==="undefined"){return false}if(!d){return false}var bq=window.Element.prototype;if(bq){var bs="_"+(Math.random()+"").slice(2),F=document.createElement(i);bq[bs]="x";var br=(F[bs]!=="x");delete bq[bs];F=null;return br}return false}var aq=bd("object");function al(F,i){for(var br in i){var bq=i[br];if(Object.isFunction(bq)&&!(br in F)){F[br]=bq.methodize()}}}var bl={};function az(F){var i=N(F);return(i in bl)}function aA(bq){if(!bq||az(bq)){return bq}if(bq.nodeType!==Node.ELEMENT_NODE||bq==window){return bq}var i=Object.clone(ao),F=bq.tagName.toUpperCase();if(aY[F]){Object.extend(i,aY[F])}al(bq,i);bl[N(bq)]=true;return bq}function aT(F){if(!F||az(F)){return F}var i=F.tagName;if(i&&(/^(?:object|applet|embed)$/i.test(i))){al(F,aG.Methods);al(F,aG.Methods.Simulated);al(F,aG.Methods.ByTag[i.toUpperCase()])}return F}if(aD.SpecificElementExtensions){aA=aq?aT:Prototype.K}function T(F,i){F=F.toUpperCase();if(!aY[F]){aY[F]={}}Object.extend(aY[F],i)}function r(F,bq,i){if(Object.isUndefined(i)){i=false}for(var bs in bq){var br=bq[bs];if(!Object.isFunction(br)){continue}if(!i||!(bs in F)){F[bs]=br.methodize()}}}function aj(br){var i;var bq={OPTGROUP:"OptGroup",TEXTAREA:"TextArea",P:"Paragraph",FIELDSET:"FieldSet",UL:"UList",OL:"OList",DL:"DList",DIR:"Directory",H1:"Heading",H2:"Heading",H3:"Heading",H4:"Heading",H5:"Heading",H6:"Heading",Q:"Quote",INS:"Mod",DEL:"Mod",A:"Anchor",IMG:"Image",CAPTION:"TableCaption",COL:"TableCol",COLGROUP:"TableCol",THEAD:"TableSection",TFOOT:"TableSection",TBODY:"TableSection",TR:"TableRow",TH:"TableCell",TD:"TableCell",FRAMESET:"FrameSet",IFRAME:"IFrame"};if(bq[br]){i="HTML"+bq[br]+"Element"}if(window[i]){return window[i]}i="HTML"+br+"Element";if(window[i]){return window[i]}i="HTML"+br.capitalize()+"Element";if(window[i]){return window[i]}var F=document.createElement(br),bs=F.__proto__||F.constructor.prototype;F=null;return bs}function S(bs){if(arguments.length===0){H()}if(arguments.length===2){var bu=bs;bs=arguments[1]}if(!bu){Object.extend(aG.Methods,bs||{})}else{if(Object.isArray(bu)){for(var bt=0,br;br=bu[bt];bt++){T(br,bs)}}else{T(bu,bs)}}var bq=window.HTMLElement?HTMLElement.prototype:aG.prototype;if(aD.ElementExtensions){r(bq,aG.Methods);r(bq,aG.Methods.Simulated,true)}if(aD.SpecificElementExtensions){for(var br in aG.Methods.ByTag){var F=aj(br);if(Object.isUndefined(F)){continue}r(F.prototype,aY[br])}}Object.extend(aG,aG.Methods);Object.extend(aG,aG.Methods.Simulated);delete aG.ByTag;delete aG.Simulated;aG.extend.refresh();s={}}Object.extend(a9.Element,{extend:aA,addMethods:S});if(aA===Prototype.K){a9.Element.extend.refresh=Prototype.emptyFunction}else{a9.Element.extend.refresh=function(){if(Prototype.BrowserFeatures.ElementExtensions){return}Object.extend(ao,aG.Methods);Object.extend(ao,aG.Methods.Simulated);bl={}}}function H(){Object.extend(Form,Form.Methods);Object.extend(Form.Element,Form.Element.Methods);Object.extend(aG.Methods.ByTag,{FORM:Object.clone(Form.Methods),INPUT:Object.clone(Form.Element.Methods),SELECT:Object.clone(Form.Element.Methods),TEXTAREA:Object.clone(Form.Element.Methods),BUTTON:Object.clone(Form.Element.Methods)})}aG.addMethods(a4);function o(){aw=null;s=null}if(window.attachEvent){window.attachEvent("onunload",o)}})(this);(function(){function l(H){var G=H.match(/^(\d+)%?$/i);if(!G){return null}return(Number(G[1])/100)}function z(H,I){H=$(H);var J=H.style[I];if(!J||J==="auto"){var G=document.defaultView.getComputedStyle(H,null);J=G?G[I]:null}if(I==="opacity"){return J?parseFloat(J):1}return J==="auto"?null:J}function C(G,H){var I=G.style[H];if(!I&&G.currentStyle){I=G.currentStyle[H]}return I}function s(I,H){var K=I.offsetWidth;var M=v(I,"borderLeftWidth",H)||0;var G=v(I,"borderRightWidth",H)||0;var J=v(I,"paddingLeft",H)||0;var L=v(I,"paddingRight",H)||0;return K-M-G-J-L}if(!Object.isUndefined(document.documentElement.currentStyle)&&!Prototype.Browser.Opera){z=C}function v(Q,R,H){var K=null;if(Object.isElement(Q)){K=Q;Q=z(K,R)}if(Q===null||Object.isUndefined(Q)){return null}if((/^(?:-)?\d+(\.\d+)?(px)?$/i).test(Q)){return window.parseFloat(Q)}var L=Q.include("%"),I=(H===document.viewport);if(/\d/.test(Q)&&K&&K.runtimeStyle&&!(L&&I)){var G=K.style.left,P=K.runtimeStyle.left;K.runtimeStyle.left=K.currentStyle.left;K.style.left=Q||0;Q=K.style.pixelLeft;K.style.left=G;K.runtimeStyle.left=P;return Q}if(K&&L){H=H||K.parentNode;var J=l(Q),M=null;var O=R.include("left")||R.include("right")||R.include("width");var N=R.include("top")||R.include("bottom")||R.include("height");if(H===document.viewport){if(O){M=document.viewport.getWidth()}else{if(N){M=document.viewport.getHeight()}}}else{if(O){M=$(H).measure("width")}else{if(N){M=$(H).measure("height")}}}return(M===null)?0:M*J}return 0}function k(G){if(Object.isString(G)&&G.endsWith("px")){return G}return G+"px"}function n(G){while(G&&G.parentNode){var H=G.getStyle("display");if(H==="none"){return false}G=$(G.parentNode)}return true}var g=Prototype.K;if("currentStyle" in document.documentElement){g=function(G){if(!G.currentStyle.hasLayout){G.style.zoom=1}return G}}function i(G){if(G.include("border")){G=G+"-width"}return G.camelize()}Element.Layout=Class.create(Hash,{initialize:function($super,H,G){$super();this.element=$(H);Element.Layout.PROPERTIES.each(function(I){this._set(I,null)},this);if(G){this._preComputing=true;this._begin();Element.Layout.PROPERTIES.each(this._compute,this);this._end();this._preComputing=false}},_set:function(H,G){return Hash.prototype.set.call(this,H,G)},set:function(H,G){throw"Properties of Element.Layout are read-only."},get:function($super,H){var G=$super(H);return G===null?this._compute(H):G},_begin:function(){if(this._isPrepared()){return}var K=this.element;if(n(K)){this._setPrepared(true);return}var M={position:K.style.position||"",width:K.style.width||"",visibility:K.style.visibility||"",display:K.style.display||""};K.store("prototype_original_styles",M);var N=z(K,"position"),G=K.offsetWidth;if(G===0||G===null){K.style.display="block";G=K.offsetWidth}var H=(N==="fixed")?document.viewport:K.parentNode;var O={visibility:"hidden",display:"block"};if(N!=="fixed"){O.position="absolute"}K.setStyle(O);var I=K.offsetWidth,J;if(G&&(I===G)){J=s(K,H)}else{if(N==="absolute"||N==="fixed"){J=s(K,H)}else{var P=K.parentNode,L=$(P).getLayout();J=L.get("width")-this.get("margin-left")-this.get("border-left")-this.get("padding-left")-this.get("padding-right")-this.get("border-right")-this.get("margin-right")}}K.setStyle({width:J+"px"});this._setPrepared(true)},_end:function(){var H=this.element;var G=H.retrieve("prototype_original_styles");H.store("prototype_original_styles",null);H.setStyle(G);this._setPrepared(false)},_compute:function(H){var G=Element.Layout.COMPUTATIONS;if(!(H in G)){throw"Property not found."}return this._set(H,G[H].call(this,this.element))},_isPrepared:function(){return this.element.retrieve("prototype_element_layout_prepared",false)},_setPrepared:function(G){return this.element.store("prototype_element_layout_prepared",G)},toObject:function(){var G=$A(arguments);var H=(G.length===0)?Element.Layout.PROPERTIES:G.join(" ").split(" ");var I={};H.each(function(J){if(!Element.Layout.PROPERTIES.include(J)){return}var K=this.get(J);if(K!=null){I[J]=K}},this);return I},toHash:function(){var G=this.toObject.apply(this,arguments);return new Hash(G)},toCSS:function(){var G=$A(arguments);var I=(G.length===0)?Element.Layout.PROPERTIES:G.join(" ").split(" ");var H={};I.each(function(J){if(!Element.Layout.PROPERTIES.include(J)){return}if(Element.Layout.COMPOSITE_PROPERTIES.include(J)){return}var K=this.get(J);if(K!=null){H[i(J)]=K+"px"}},this);return H},inspect:function(){return"#<Element.Layout>"}});Object.extend(Element.Layout,{PROPERTIES:$w("height width top left right bottom border-left border-right border-top border-bottom padding-left padding-right padding-top padding-bottom margin-top margin-bottom margin-left margin-right padding-box-width padding-box-height border-box-width border-box-height margin-box-width margin-box-height"),COMPOSITE_PROPERTIES:$w("padding-box-width padding-box-height margin-box-width margin-box-height border-box-width border-box-height"),COMPUTATIONS:{height:function(I){if(!this._preComputing){this._begin()}var G=this.get("border-box-height");if(G<=0){if(!this._preComputing){this._end()}return 0}var J=this.get("border-top"),H=this.get("border-bottom");var L=this.get("padding-top"),K=this.get("padding-bottom");if(!this._preComputing){this._end()}return G-J-H-L-K},width:function(I){if(!this._preComputing){this._begin()}var H=this.get("border-box-width");if(H<=0){if(!this._preComputing){this._end()}return 0}var L=this.get("border-left"),G=this.get("border-right");var J=this.get("padding-left"),K=this.get("padding-right");if(!this._preComputing){this._end()}return H-L-G-J-K},"padding-box-height":function(H){var G=this.get("height"),J=this.get("padding-top"),I=this.get("padding-bottom");return G+J+I},"padding-box-width":function(G){var H=this.get("width"),I=this.get("padding-left"),J=this.get("padding-right");return H+I+J},"border-box-height":function(H){if(!this._preComputing){this._begin()}var G=H.offsetHeight;if(!this._preComputing){this._end()}return G},"border-box-width":function(G){if(!this._preComputing){this._begin()}var H=G.offsetWidth;if(!this._preComputing){this._end()}return H},"margin-box-height":function(H){var G=this.get("border-box-height"),I=this.get("margin-top"),J=this.get("margin-bottom");if(G<=0){return 0}return G+I+J},"margin-box-width":function(I){var H=this.get("border-box-width"),J=this.get("margin-left"),G=this.get("margin-right");if(H<=0){return 0}return H+J+G},top:function(G){var H=G.positionedOffset();return H.top},bottom:function(G){var J=G.positionedOffset(),H=G.getOffsetParent(),I=H.measure("height");var K=this.get("border-box-height");return I-K-J.top},left:function(G){var H=G.positionedOffset();return H.left},right:function(I){var K=I.positionedOffset(),J=I.getOffsetParent(),G=J.measure("width");var H=this.get("border-box-width");return G-H-K.left},"padding-top":function(G){return v(G,"paddingTop")},"padding-bottom":function(G){return v(G,"paddingBottom")},"padding-left":function(G){return v(G,"paddingLeft")},"padding-right":function(G){return v(G,"paddingRight")},"border-top":function(G){return v(G,"borderTopWidth")},"border-bottom":function(G){return v(G,"borderBottomWidth")},"border-left":function(G){return v(G,"borderLeftWidth")},"border-right":function(G){return v(G,"borderRightWidth")},"margin-top":function(G){return v(G,"marginTop")},"margin-bottom":function(G){return v(G,"marginBottom")},"margin-left":function(G){return v(G,"marginLeft")},"margin-right":function(G){return v(G,"marginRight")}}});if("getBoundingClientRect" in document.documentElement){Object.extend(Element.Layout.COMPUTATIONS,{right:function(H){var I=g(H.getOffsetParent());var J=H.getBoundingClientRect(),G=I.getBoundingClientRect();return(G.right-J.right).round()},bottom:function(H){var I=g(H.getOffsetParent());var J=H.getBoundingClientRect(),G=I.getBoundingClientRect();return(G.bottom-J.bottom).round()}})}Element.Offset=Class.create({initialize:function(H,G){this.left=H.round();this.top=G.round();this[0]=this.left;this[1]=this.top},relativeTo:function(G){return new Element.Offset(this.left-G.left,this.top-G.top)},inspect:function(){return"#<Element.Offset left: #{left} top: #{top}>".interpolate(this)},toString:function(){return"[#{left}, #{top}]".interpolate(this)},toArray:function(){return[this.left,this.top]}});function A(H,G){return new Element.Layout(H,G)}function d(G,H){return $(G).getLayout().get(H)}function r(G){return Element.getDimensions(G).height}function c(G){return Element.getDimensions(G).width}function t(H){H=$(H);var L=Element.getStyle(H,"display");if(L&&L!=="none"){return{width:H.offsetWidth,height:H.offsetHeight}}var I=H.style;var G={visibility:I.visibility,position:I.position,display:I.display};var K={visibility:"hidden",display:"block"};if(G.position!=="fixed"){K.position="absolute"}Element.setStyle(H,K);var J={width:H.offsetWidth,height:H.offsetHeight};Element.setStyle(H,G);return J}function q(G){G=$(G);function I(J){return o(J)?$(document.body):$(J)}if(h(G)||f(G)||p(G)||o(G)){return $(document.body)}var H=(Element.getStyle(G,"display")==="inline");if(!H&&G.offsetParent){return I(G.offsetParent)}while((G=G.parentNode)&&G!==document.body){if(Element.getStyle(G,"position")!=="static"){return I(G)}}return $(document.body)}function D(H){H=$(H);var G=0,I=0;if(H.parentNode){do{G+=H.offsetTop||0;I+=H.offsetLeft||0;H=H.offsetParent}while(H)}return new Element.Offset(I,G)}function x(H){H=$(H);var I=H.getLayout();var G=0,K=0;do{G+=H.offsetTop||0;K+=H.offsetLeft||0;H=H.offsetParent;if(H){if(p(H)){break}var J=Element.getStyle(H,"position");if(J!=="static"){break}}}while(H);K-=I.get("margin-left");G-=I.get("margin-top");return new Element.Offset(K,G)}function b(H){var G=0,I=0;do{if(H===document.body){var J=document.documentElement||document.body.parentNode||document.body;G+=!Object.isUndefined(window.pageYOffset)?window.pageYOffset:J.scrollTop||0;I+=!Object.isUndefined(window.pageXOffset)?window.pageXOffset:J.scrollLeft||0;break}else{G+=H.scrollTop||0;I+=H.scrollLeft||0;H=H.parentNode}}while(H);return new Element.Offset(I,G)}function B(K){var G=0,J=0,I=document.body;K=$(K);var H=K;do{G+=H.offsetTop||0;J+=H.offsetLeft||0;if(H.offsetParent==I&&Element.getStyle(H,"position")=="absolute"){break}}while(H=H.offsetParent);H=K;do{if(H!=I){G-=H.scrollTop||0;J-=H.scrollLeft||0}}while(H=H.parentNode);return new Element.Offset(J,G)}function y(G){G=$(G);if(Element.getStyle(G,"position")==="absolute"){return G}var K=q(G);var J=G.viewportOffset(),H=K.viewportOffset();var L=J.relativeTo(H);var I=G.getLayout();G.store("prototype_absolutize_original_styles",{position:G.getStyle("position"),left:G.getStyle("left"),top:G.getStyle("top"),width:G.getStyle("width"),height:G.getStyle("height")});G.setStyle({position:"absolute",top:L.top+"px",left:L.left+"px",width:I.get("width")+"px",height:I.get("height")+"px"});return G}function m(H){H=$(H);if(Element.getStyle(H,"position")==="relative"){return H}var G=H.retrieve("prototype_absolutize_original_styles");if(G){H.setStyle(G)}return H}function a(G){G=$(G);var H=Element.cumulativeOffset(G);window.scrollTo(H.left,H.top);return G}function w(H){H=$(H);var G=Element.getStyle(H,"position"),I={};if(G==="static"||!G){I.position="relative";if(Prototype.Browser.Opera){I.top=0;I.left=0}Element.setStyle(H,I);Element.store(H,"prototype_made_positioned",true)}return H}function u(G){G=$(G);var I=Element.getStorage(G),H=I.get("prototype_made_positioned");if(H){I.unset("prototype_made_positioned");Element.setStyle(G,{position:"",top:"",bottom:"",left:"",right:""})}return G}function e(H){H=$(H);var J=Element.getStorage(H),G=J.get("prototype_made_clipping");if(Object.isUndefined(G)){var I=Element.getStyle(H,"overflow");J.set("prototype_made_clipping",I);if(I!=="hidden"){H.style.overflow="hidden"}}return H}function E(G){G=$(G);var I=Element.getStorage(G),H=I.get("prototype_made_clipping");if(!Object.isUndefined(H)){I.unset("prototype_made_clipping");G.style.overflow=H||""}return G}function F(J,G,R){R=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},R||{});var I=document.documentElement;G=$(G);J=$(J);var H,P,L,Q={};if(R.setLeft||R.setTop){H=Element.viewportOffset(G);P=[0,0];if(Element.getStyle(J,"position")==="absolute"){var O=Element.getOffsetParent(J);if(O!==document.body){P=Element.viewportOffset(O)}}}function M(){var S=0,T=0;if(Object.isNumber(window.pageXOffset)){S=window.pageXOffset;T=window.pageYOffset}else{if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){S=document.body.scrollLeft;T=document.body.scrollTop}else{if(I&&(I.scrollLeft||I.scrollTop)){S=I.scrollLeft;T=I.scrollTop}}}return{x:S,y:T}}var K=M();if(R.setWidth||R.setHeight){L=Element.getLayout(G)}if(R.setLeft){Q.left=(H[0]+K.x-P[0]+R.offsetLeft)+"px"}if(R.setTop){Q.top=(H[1]+K.y-P[1]+R.offsetTop)+"px"}var N=J.getLayout();if(R.setWidth){Q.width=L.get("width")+"px"}if(R.setHeight){Q.height=L.get("height")+"px"}return Element.setStyle(J,Q)}if(Prototype.Browser.IE){q=q.wrap(function(I,H){H=$(H);if(h(H)||f(H)||p(H)||o(H)){return $(document.body)}var G=H.getStyle("position");if(G!=="static"){return I(H)}H.setStyle({position:"relative"});var J=I(H);H.setStyle({position:G});return J});x=x.wrap(function(J,H){H=$(H);if(!H.parentNode){return new Element.Offset(0,0)}var G=H.getStyle("position");if(G!=="static"){return J(H)}var I=H.getOffsetParent();if(I&&I.getStyle("position")==="fixed"){g(I)}H.setStyle({position:"relative"});var K=J(H);H.setStyle({position:G});return K})}else{if(Prototype.Browser.Webkit){D=function(H){H=$(H);var G=0,I=0;do{G+=H.offsetTop||0;I+=H.offsetLeft||0;if(H.offsetParent==document.body){if(Element.getStyle(H,"position")=="absolute"){break}}H=H.offsetParent}while(H);return new Element.Offset(I,G)}}}Element.addMethods({getLayout:A,measure:d,getWidth:c,getHeight:r,getDimensions:t,getOffsetParent:q,cumulativeOffset:D,positionedOffset:x,cumulativeScrollOffset:b,viewportOffset:B,absolutize:y,relativize:m,scrollTo:a,makePositioned:w,undoPositioned:u,makeClipping:e,undoClipping:E,clonePosition:F});function p(G){return G.nodeName.toUpperCase()==="BODY"}function o(G){return G.nodeName.toUpperCase()==="HTML"}function h(G){return G.nodeType===Node.DOCUMENT_NODE}function f(G){return G!==document.body&&!Element.descendantOf(G,document.body)}if("getBoundingClientRect" in document.documentElement){Element.addMethods({viewportOffset:function(G){G=$(G);if(f(G)){return new Element.Offset(0,0)}var H=G.getBoundingClientRect(),I=document.documentElement;return new Element.Offset(H.left-I.clientLeft,H.top-I.clientTop)}})}})();(function(){var c=Prototype.Browser.Opera&&(window.parseFloat(window.opera.version())<9.5);var f=null;function b(){if(f){return f}f=c?document.body:document.documentElement;return f}function d(){return{width:this.getWidth(),height:this.getHeight()}}function a(){return b().clientWidth}function g(){return b().clientHeight}function e(){var h=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft;var i=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop;return new Element.Offset(h,i)}document.viewport={getDimensions:d,getWidth:a,getHeight:g,getScrollOffsets:e}})();window.$$=function(){var a=$A(arguments).join(", ");return Prototype.Selector.select(a,document)};Prototype.Selector=(function(){function a(){throw new Error('Method "Prototype.Selector.select" must be defined.')}function c(){throw new Error('Method "Prototype.Selector.match" must be defined.')}function d(m,n,h){h=h||0;var g=Prototype.Selector.match,l=m.length,f=0,k;for(k=0;k<l;k++){if(g(m[k],n)&&h==f++){return Element.extend(m[k])}}}function e(h){for(var f=0,g=h.length;f<g;f++){Element.extend(h[f])}return h}var b=Prototype.K;return{select:a,match:c,find:d,extendElements:(Element.extend===b)?b:e,extendElement:Element.extend}})();Prototype._original_property=window.Sizzle;(function(){function a(b){Prototype._actual_sizzle=b()}a.amd=true;if(typeof define!=="undefined"&&define.amd){Prototype._original_define=define;Prototype._actual_sizzle=null;window.define=a}})(); /*! * Sizzle CSS Selector Engine v1.10.18 * http://sizzlejs.com/ @@ -9,4 +9,4 @@ var Prototype={Version:"1.7.3",Browser:(function(){var d=navigator.userAgent;var * * Date: 2014-02-05 */ -(function(aB){var J,aE,z,S,V,ah,aD,aI,T,ai,ak,N,A,au,ao,aC,p,Q,aw="sizzle"+-(new Date()),U=aB.document,aF=0,ap=0,g=L(),av=L(),R=L(),P=function(aJ,e){if(aJ===e){ai=true}return 0},aA=typeof undefined,ab=1<<31,Z=({}).hasOwnProperty,ay=[],az=ay.pop,X=ay.push,d=ay.push,y=ay.slice,o=ay.indexOf||function(aK){var aJ=0,e=this.length;for(;aJ<e;aJ++){if(this[aJ]===aK){return aJ}}return -1},f="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",B="[\\x20\\t\\r\\n\\f]",b="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",W=b.replace("w","w#"),ar="\\["+B+"*("+b+")"+B+"*(?:([*^$|!~]?=)"+B+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+W+")|)|)"+B+"*\\]",v=":("+b+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+ar.replace(3,8)+")*)|.*)\\)|)",D=new RegExp("^"+B+"+|((?:^|[^\\\\])(?:\\\\.)*)"+B+"+$","g"),G=new RegExp("^"+B+"*,"+B+"*"),M=new RegExp("^"+B+"*([>+~]|"+B+")"+B+"*"),F=new RegExp("="+B+"*([^\\]'\"]*?)"+B+"*\\]","g"),ad=new RegExp(v),af=new RegExp("^"+W+"$"),an={ID:new RegExp("^#("+b+")"),CLASS:new RegExp("^\\.("+b+")"),TAG:new RegExp("^("+b.replace("w","w*")+")"),ATTR:new RegExp("^"+ar),PSEUDO:new RegExp("^"+v),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+B+"*(even|odd|(([+-]|)(\\d*)n|)"+B+"*(?:([+-]|)"+B+"*(\\d+)|))"+B+"*\\)|)","i"),bool:new RegExp("^(?:"+f+")$","i"),needsContext:new RegExp("^"+B+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+B+"*((?:-\\d)?\\d*)"+B+"*\\)|)(?=[^-]|$)","i")},n=/^(?:input|select|textarea|button)$/i,w=/^h\d$/i,aa=/^[^{]+\{\s*\[native \w/,ac=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,am=/[+~]/,Y=/'|\\/g,E=new RegExp("\\\\([\\da-f]{1,6}"+B+"?|("+B+")|.)","ig"),aq=function(e,aL,aJ){var aK="0x"+aL-65536;return aK!==aK||aJ?aL:aK<0?String.fromCharCode(aK+65536):String.fromCharCode(aK>>10|55296,aK&1023|56320)};try{d.apply((ay=y.call(U.childNodes)),U.childNodes);ay[U.childNodes.length].nodeType}catch(O){d={apply:ay.length?function(aJ,e){X.apply(aJ,y.call(e))}:function(aL,aK){var e=aL.length,aJ=0;while((aL[e++]=aK[aJ++])){}aL.length=e-1}}}function H(aQ,aJ,aU,aW){var aV,aN,aO,aS,aT,aM,aL,e,aK,aR;if((aJ?aJ.ownerDocument||aJ:U)!==N){ak(aJ)}aJ=aJ||N;aU=aU||[];if(!aQ||typeof aQ!=="string"){return aU}if((aS=aJ.nodeType)!==1&&aS!==9){return[]}if(au&&!aW){if((aV=ac.exec(aQ))){if((aO=aV[1])){if(aS===9){aN=aJ.getElementById(aO);if(aN&&aN.parentNode){if(aN.id===aO){aU.push(aN);return aU}}else{return aU}}else{if(aJ.ownerDocument&&(aN=aJ.ownerDocument.getElementById(aO))&&Q(aJ,aN)&&aN.id===aO){aU.push(aN);return aU}}}else{if(aV[2]){d.apply(aU,aJ.getElementsByTagName(aQ));return aU}else{if((aO=aV[3])&&aE.getElementsByClassName&&aJ.getElementsByClassName){d.apply(aU,aJ.getElementsByClassName(aO));return aU}}}}if(aE.qsa&&(!ao||!ao.test(aQ))){e=aL=aw;aK=aJ;aR=aS===9&&aQ;if(aS===1&&aJ.nodeName.toLowerCase()!=="object"){aM=s(aQ);if((aL=aJ.getAttribute("id"))){e=aL.replace(Y,"\\$&")}else{aJ.setAttribute("id",e)}e="[id='"+e+"'] ";aT=aM.length;while(aT--){aM[aT]=e+t(aM[aT])}aK=am.test(aQ)&&ae(aJ.parentNode)||aJ;aR=aM.join(",")}if(aR){try{d.apply(aU,aK.querySelectorAll(aR));return aU}catch(aP){}finally{if(!aL){aJ.removeAttribute("id")}}}}}return aD(aQ.replace(D,"$1"),aJ,aU,aW)}function L(){var aJ=[];function e(aK,aL){if(aJ.push(aK+" ")>z.cacheLength){delete e[aJ.shift()]}return(e[aK+" "]=aL)}return e}function u(e){e[aw]=true;return e}function q(aJ){var aL=N.createElement("div");try{return !!aJ(aL)}catch(aK){return false}finally{if(aL.parentNode){aL.parentNode.removeChild(aL)}aL=null}}function aG(aJ,aL){var e=aJ.split("|"),aK=aJ.length;while(aK--){z.attrHandle[e[aK]]=aL}}function h(aJ,e){var aL=e&&aJ,aK=aL&&aJ.nodeType===1&&e.nodeType===1&&(~e.sourceIndex||ab)-(~aJ.sourceIndex||ab);if(aK){return aK}if(aL){while((aL=aL.nextSibling)){if(aL===e){return -1}}}return aJ?1:-1}function I(e){return function(aK){var aJ=aK.nodeName.toLowerCase();return aJ==="input"&&aK.type===e}}function l(e){return function(aK){var aJ=aK.nodeName.toLowerCase();return(aJ==="input"||aJ==="button")&&aK.type===e}}function at(e){return u(function(aJ){aJ=+aJ;return u(function(aK,aO){var aM,aL=e([],aK.length,aJ),aN=aL.length;while(aN--){if(aK[(aM=aL[aN])]){aK[aM]=!(aO[aM]=aK[aM])}}})})}function ae(e){return e&&typeof e.getElementsByTagName!==aA&&e}aE=H.support={};V=H.isXML=function(e){var aJ=e&&(e.ownerDocument||e).documentElement;return aJ?aJ.nodeName!=="HTML":false};ak=H.setDocument=function(aK){var e,aL=aK?aK.ownerDocument||aK:U,aJ=aL.defaultView;if(aL===N||aL.nodeType!==9||!aL.documentElement){return N}N=aL;A=aL.documentElement;au=!V(aL);if(aJ&&aJ!==aJ.top){if(aJ.addEventListener){aJ.addEventListener("unload",function(){ak()},false)}else{if(aJ.attachEvent){aJ.attachEvent("onunload",function(){ak()})}}}aE.attributes=q(function(aM){aM.className="i";return !aM.getAttribute("className")});aE.getElementsByTagName=q(function(aM){aM.appendChild(aL.createComment(""));return !aM.getElementsByTagName("*").length});aE.getElementsByClassName=aa.test(aL.getElementsByClassName)&&q(function(aM){aM.innerHTML="<div class='a'></div><div class='a i'></div>";aM.firstChild.className="i";return aM.getElementsByClassName("i").length===2});aE.getById=q(function(aM){A.appendChild(aM).id=aw;return !aL.getElementsByName||!aL.getElementsByName(aw).length});if(aE.getById){z.find.ID=function(aO,aN){if(typeof aN.getElementById!==aA&&au){var aM=aN.getElementById(aO);return aM&&aM.parentNode?[aM]:[]}};z.filter.ID=function(aN){var aM=aN.replace(E,aq);return function(aO){return aO.getAttribute("id")===aM}}}else{delete z.find.ID;z.filter.ID=function(aN){var aM=aN.replace(E,aq);return function(aP){var aO=typeof aP.getAttributeNode!==aA&&aP.getAttributeNode("id");return aO&&aO.value===aM}}}z.find.TAG=aE.getElementsByTagName?function(aM,aN){if(typeof aN.getElementsByTagName!==aA){return aN.getElementsByTagName(aM)}}:function(aM,aQ){var aR,aP=[],aO=0,aN=aQ.getElementsByTagName(aM);if(aM==="*"){while((aR=aN[aO++])){if(aR.nodeType===1){aP.push(aR)}}return aP}return aN};z.find.CLASS=aE.getElementsByClassName&&function(aN,aM){if(typeof aM.getElementsByClassName!==aA&&au){return aM.getElementsByClassName(aN)}};aC=[];ao=[];if((aE.qsa=aa.test(aL.querySelectorAll))){q(function(aM){aM.innerHTML="<select t=''><option selected=''></option></select>";if(aM.querySelectorAll("[t^='']").length){ao.push("[*^$]="+B+"*(?:''|\"\")")}if(!aM.querySelectorAll("[selected]").length){ao.push("\\["+B+"*(?:value|"+f+")")}if(!aM.querySelectorAll(":checked").length){ao.push(":checked")}});q(function(aN){var aM=aL.createElement("input");aM.setAttribute("type","hidden");aN.appendChild(aM).setAttribute("name","D");if(aN.querySelectorAll("[name=d]").length){ao.push("name"+B+"*[*^$|!~]?=")}if(!aN.querySelectorAll(":enabled").length){ao.push(":enabled",":disabled")}aN.querySelectorAll("*,:x");ao.push(",.*:")})}if((aE.matchesSelector=aa.test((p=A.webkitMatchesSelector||A.mozMatchesSelector||A.oMatchesSelector||A.msMatchesSelector)))){q(function(aM){aE.disconnectedMatch=p.call(aM,"div");p.call(aM,"[s!='']:x");aC.push("!=",v)})}ao=ao.length&&new RegExp(ao.join("|"));aC=aC.length&&new RegExp(aC.join("|"));e=aa.test(A.compareDocumentPosition);Q=e||aa.test(A.contains)?function(aN,aM){var aP=aN.nodeType===9?aN.documentElement:aN,aO=aM&&aM.parentNode;return aN===aO||!!(aO&&aO.nodeType===1&&(aP.contains?aP.contains(aO):aN.compareDocumentPosition&&aN.compareDocumentPosition(aO)&16))}:function(aN,aM){if(aM){while((aM=aM.parentNode)){if(aM===aN){return true}}}return false};P=e?function(aN,aM){if(aN===aM){ai=true;return 0}var aO=!aN.compareDocumentPosition-!aM.compareDocumentPosition;if(aO){return aO}aO=(aN.ownerDocument||aN)===(aM.ownerDocument||aM)?aN.compareDocumentPosition(aM):1;if(aO&1||(!aE.sortDetached&&aM.compareDocumentPosition(aN)===aO)){if(aN===aL||aN.ownerDocument===U&&Q(U,aN)){return -1}if(aM===aL||aM.ownerDocument===U&&Q(U,aM)){return 1}return T?(o.call(T,aN)-o.call(T,aM)):0}return aO&4?-1:1}:function(aN,aM){if(aN===aM){ai=true;return 0}var aT,aQ=0,aS=aN.parentNode,aP=aM.parentNode,aO=[aN],aR=[aM];if(!aS||!aP){return aN===aL?-1:aM===aL?1:aS?-1:aP?1:T?(o.call(T,aN)-o.call(T,aM)):0}else{if(aS===aP){return h(aN,aM)}}aT=aN;while((aT=aT.parentNode)){aO.unshift(aT)}aT=aM;while((aT=aT.parentNode)){aR.unshift(aT)}while(aO[aQ]===aR[aQ]){aQ++}return aQ?h(aO[aQ],aR[aQ]):aO[aQ]===U?-1:aR[aQ]===U?1:0};return aL};H.matches=function(aJ,e){return H(aJ,null,null,e)};H.matchesSelector=function(aK,aM){if((aK.ownerDocument||aK)!==N){ak(aK)}aM=aM.replace(F,"='$1']");if(aE.matchesSelector&&au&&(!aC||!aC.test(aM))&&(!ao||!ao.test(aM))){try{var aJ=p.call(aK,aM);if(aJ||aE.disconnectedMatch||aK.document&&aK.document.nodeType!==11){return aJ}}catch(aL){}}return H(aM,N,null,[aK]).length>0};H.contains=function(e,aJ){if((e.ownerDocument||e)!==N){ak(e)}return Q(e,aJ)};H.attr=function(aK,e){if((aK.ownerDocument||aK)!==N){ak(aK)}var aJ=z.attrHandle[e.toLowerCase()],aL=aJ&&Z.call(z.attrHandle,e.toLowerCase())?aJ(aK,e,!au):undefined;return aL!==undefined?aL:aE.attributes||!au?aK.getAttribute(e):(aL=aK.getAttributeNode(e))&&aL.specified?aL.value:null};H.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)};H.uniqueSort=function(aK){var aL,aM=[],e=0,aJ=0;ai=!aE.detectDuplicates;T=!aE.sortStable&&aK.slice(0);aK.sort(P);if(ai){while((aL=aK[aJ++])){if(aL===aK[aJ]){e=aM.push(aJ)}}while(e--){aK.splice(aM[e],1)}}T=null;return aK};S=H.getText=function(aM){var aL,aJ="",aK=0,e=aM.nodeType;if(!e){while((aL=aM[aK++])){aJ+=S(aL)}}else{if(e===1||e===9||e===11){if(typeof aM.textContent==="string"){return aM.textContent}else{for(aM=aM.firstChild;aM;aM=aM.nextSibling){aJ+=S(aM)}}}else{if(e===3||e===4){return aM.nodeValue}}}return aJ};z=H.selectors={cacheLength:50,createPseudo:u,match:an,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:true}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:true},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){e[1]=e[1].replace(E,aq);e[3]=(e[4]||e[5]||"").replace(E,aq);if(e[2]==="~="){e[3]=" "+e[3]+" "}return e.slice(0,4)},CHILD:function(e){e[1]=e[1].toLowerCase();if(e[1].slice(0,3)==="nth"){if(!e[3]){H.error(e[0])}e[4]=+(e[4]?e[5]+(e[6]||1):2*(e[3]==="even"||e[3]==="odd"));e[5]=+((e[7]+e[8])||e[3]==="odd")}else{if(e[3]){H.error(e[0])}}return e},PSEUDO:function(aJ){var e,aK=!aJ[5]&&aJ[2];if(an.CHILD.test(aJ[0])){return null}if(aJ[3]&&aJ[4]!==undefined){aJ[2]=aJ[4]}else{if(aK&&ad.test(aK)&&(e=s(aK,true))&&(e=aK.indexOf(")",aK.length-e)-aK.length)){aJ[0]=aJ[0].slice(0,e);aJ[2]=aK.slice(0,e)}}return aJ.slice(0,3)}},filter:{TAG:function(aJ){var e=aJ.replace(E,aq).toLowerCase();return aJ==="*"?function(){return true}:function(aK){return aK.nodeName&&aK.nodeName.toLowerCase()===e}},CLASS:function(e){var aJ=g[e+" "];return aJ||(aJ=new RegExp("(^|"+B+")"+e+"("+B+"|$)"))&&g(e,function(aK){return aJ.test(typeof aK.className==="string"&&aK.className||typeof aK.getAttribute!==aA&&aK.getAttribute("class")||"")})},ATTR:function(aK,aJ,e){return function(aM){var aL=H.attr(aM,aK);if(aL==null){return aJ==="!="}if(!aJ){return true}aL+="";return aJ==="="?aL===e:aJ==="!="?aL!==e:aJ==="^="?e&&aL.indexOf(e)===0:aJ==="*="?e&&aL.indexOf(e)>-1:aJ==="$="?e&&aL.slice(-e.length)===e:aJ==="~="?(" "+aL+" ").indexOf(e)>-1:aJ==="|="?aL===e||aL.slice(0,e.length+1)===e+"-":false}},CHILD:function(aJ,aM,aL,aN,aK){var aP=aJ.slice(0,3)!=="nth",e=aJ.slice(-4)!=="last",aO=aM==="of-type";return aN===1&&aK===0?function(aQ){return !!aQ.parentNode}:function(aW,aU,aZ){var aQ,a2,aX,a1,aY,aT,aV=aP!==e?"nextSibling":"previousSibling",a0=aW.parentNode,aS=aO&&aW.nodeName.toLowerCase(),aR=!aZ&&!aO;if(a0){if(aP){while(aV){aX=aW;while((aX=aX[aV])){if(aO?aX.nodeName.toLowerCase()===aS:aX.nodeType===1){return false}}aT=aV=aJ==="only"&&!aT&&"nextSibling"}return true}aT=[e?a0.firstChild:a0.lastChild];if(e&&aR){a2=a0[aw]||(a0[aw]={});aQ=a2[aJ]||[];aY=aQ[0]===aF&&aQ[1];a1=aQ[0]===aF&&aQ[2];aX=aY&&a0.childNodes[aY];while((aX=++aY&&aX&&aX[aV]||(a1=aY=0)||aT.pop())){if(aX.nodeType===1&&++a1&&aX===aW){a2[aJ]=[aF,aY,a1];break}}}else{if(aR&&(aQ=(aW[aw]||(aW[aw]={}))[aJ])&&aQ[0]===aF){a1=aQ[1]}else{while((aX=++aY&&aX&&aX[aV]||(a1=aY=0)||aT.pop())){if((aO?aX.nodeName.toLowerCase()===aS:aX.nodeType===1)&&++a1){if(aR){(aX[aw]||(aX[aw]={}))[aJ]=[aF,a1]}if(aX===aW){break}}}}}a1-=aK;return a1===aN||(a1%aN===0&&a1/aN>=0)}}},PSEUDO:function(aL,aK){var e,aJ=z.pseudos[aL]||z.setFilters[aL.toLowerCase()]||H.error("unsupported pseudo: "+aL);if(aJ[aw]){return aJ(aK)}if(aJ.length>1){e=[aL,aL,"",aK];return z.setFilters.hasOwnProperty(aL.toLowerCase())?u(function(aO,aQ){var aN,aM=aJ(aO,aK),aP=aM.length;while(aP--){aN=o.call(aO,aM[aP]);aO[aN]=!(aQ[aN]=aM[aP])}}):function(aM){return aJ(aM,0,e)}}return aJ}},pseudos:{not:u(function(e){var aJ=[],aK=[],aL=ah(e.replace(D,"$1"));return aL[aw]?u(function(aN,aS,aQ,aO){var aR,aM=aL(aN,null,aO,[]),aP=aN.length;while(aP--){if((aR=aM[aP])){aN[aP]=!(aS[aP]=aR)}}}):function(aO,aN,aM){aJ[0]=aO;aL(aJ,null,aM,aK);return !aK.pop()}}),has:u(function(e){return function(aJ){return H(e,aJ).length>0}}),contains:u(function(e){return function(aJ){return(aJ.textContent||aJ.innerText||S(aJ)).indexOf(e)>-1}}),lang:u(function(e){if(!af.test(e||"")){H.error("unsupported lang: "+e)}e=e.replace(E,aq).toLowerCase();return function(aK){var aJ;do{if((aJ=au?aK.lang:aK.getAttribute("xml:lang")||aK.getAttribute("lang"))){aJ=aJ.toLowerCase();return aJ===e||aJ.indexOf(e+"-")===0}}while((aK=aK.parentNode)&&aK.nodeType===1);return false}}),target:function(e){var aJ=aB.location&&aB.location.hash;return aJ&&aJ.slice(1)===e.id},root:function(e){return e===A},focus:function(e){return e===N.activeElement&&(!N.hasFocus||N.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===false},disabled:function(e){return e.disabled===true},checked:function(e){var aJ=e.nodeName.toLowerCase();return(aJ==="input"&&!!e.checked)||(aJ==="option"&&!!e.selected)},selected:function(e){if(e.parentNode){e.parentNode.selectedIndex}return e.selected===true},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling){if(e.nodeType<6){return false}}return true},parent:function(e){return !z.pseudos.empty(e)},header:function(e){return w.test(e.nodeName)},input:function(e){return n.test(e.nodeName)},button:function(aJ){var e=aJ.nodeName.toLowerCase();return e==="input"&&aJ.type==="button"||e==="button"},text:function(aJ){var e;return aJ.nodeName.toLowerCase()==="input"&&aJ.type==="text"&&((e=aJ.getAttribute("type"))==null||e.toLowerCase()==="text")},first:at(function(){return[0]}),last:at(function(e,aJ){return[aJ-1]}),eq:at(function(e,aK,aJ){return[aJ<0?aJ+aK:aJ]}),even:at(function(e,aK){var aJ=0;for(;aJ<aK;aJ+=2){e.push(aJ)}return e}),odd:at(function(e,aK){var aJ=1;for(;aJ<aK;aJ+=2){e.push(aJ)}return e}),lt:at(function(e,aL,aK){var aJ=aK<0?aK+aL:aK;for(;--aJ>=0;){e.push(aJ)}return e}),gt:at(function(e,aL,aK){var aJ=aK<0?aK+aL:aK;for(;++aJ<aL;){e.push(aJ)}return e})}};z.pseudos.nth=z.pseudos.eq;for(J in {radio:true,checkbox:true,file:true,password:true,image:true}){z.pseudos[J]=I(J)}for(J in {submit:true,reset:true}){z.pseudos[J]=l(J)}function ag(){}ag.prototype=z.filters=z.pseudos;z.setFilters=new ag();function s(aM,aR){var aJ,aN,aP,aQ,aO,aK,e,aL=av[aM+" "];if(aL){return aR?0:aL.slice(0)}aO=aM;aK=[];e=z.preFilter;while(aO){if(!aJ||(aN=G.exec(aO))){if(aN){aO=aO.slice(aN[0].length)||aO}aK.push((aP=[]))}aJ=false;if((aN=M.exec(aO))){aJ=aN.shift();aP.push({value:aJ,type:aN[0].replace(D," ")});aO=aO.slice(aJ.length)}for(aQ in z.filter){if((aN=an[aQ].exec(aO))&&(!e[aQ]||(aN=e[aQ](aN)))){aJ=aN.shift();aP.push({value:aJ,type:aQ,matches:aN});aO=aO.slice(aJ.length)}}if(!aJ){break}}return aR?aO.length:aO?H.error(aM):av(aM,aK).slice(0)}function t(aL){var aK=0,aJ=aL.length,e="";for(;aK<aJ;aK++){e+=aL[aK].value}return e}function C(aM,aK,aL){var e=aK.dir,aN=aL&&e==="parentNode",aJ=ap++;return aK.first?function(aQ,aP,aO){while((aQ=aQ[e])){if(aQ.nodeType===1||aN){return aM(aQ,aP,aO)}}}:function(aS,aQ,aP){var aT,aR,aO=[aF,aJ];if(aP){while((aS=aS[e])){if(aS.nodeType===1||aN){if(aM(aS,aQ,aP)){return true}}}}else{while((aS=aS[e])){if(aS.nodeType===1||aN){aR=aS[aw]||(aS[aw]={});if((aT=aR[e])&&aT[0]===aF&&aT[1]===aJ){return(aO[2]=aT[2])}else{aR[e]=aO;if((aO[2]=aM(aS,aQ,aP))){return true}}}}}}}function aH(e){return e.length>1?function(aM,aL,aJ){var aK=e.length;while(aK--){if(!e[aK](aM,aL,aJ)){return false}}return true}:e[0]}function K(aJ,aM,aL){var aK=0,e=aM.length;for(;aK<e;aK++){H(aJ,aM[aK],aL)}return aL}function al(e,aJ,aK,aL,aO){var aM,aR=[],aN=0,aP=e.length,aQ=aJ!=null;for(;aN<aP;aN++){if((aM=e[aN])){if(!aK||aK(aM,aL,aO)){aR.push(aM);if(aQ){aJ.push(aN)}}}}return aR}function r(aK,aJ,aM,aL,aN,e){if(aL&&!aL[aw]){aL=r(aL)}if(aN&&!aN[aw]){aN=r(aN,e)}return u(function(aY,aV,aQ,aX){var a0,aW,aS,aR=[],aZ=[],aP=aV.length,aO=aY||K(aJ||"*",aQ.nodeType?[aQ]:aQ,[]),aT=aK&&(aY||!aJ)?al(aO,aR,aK,aQ,aX):aO,aU=aM?aN||(aY?aK:aP||aL)?[]:aV:aT;if(aM){aM(aT,aU,aQ,aX)}if(aL){a0=al(aU,aZ);aL(a0,[],aQ,aX);aW=a0.length;while(aW--){if((aS=a0[aW])){aU[aZ[aW]]=!(aT[aZ[aW]]=aS)}}}if(aY){if(aN||aK){if(aN){a0=[];aW=aU.length;while(aW--){if((aS=aU[aW])){a0.push((aT[aW]=aS))}}aN(null,(aU=[]),a0,aX)}aW=aU.length;while(aW--){if((aS=aU[aW])&&(a0=aN?o.call(aY,aS):aR[aW])>-1){aY[a0]=!(aV[a0]=aS)}}}}else{aU=al(aU===aV?aU.splice(aP,aU.length):aU);if(aN){aN(null,aV,aU,aX)}else{d.apply(aV,aU)}}})}function ax(aO){var aJ,aM,aK,aN=aO.length,aR=z.relative[aO[0].type],aS=aR||z.relative[" "],aL=aR?1:0,aP=C(function(aT){return aT===aJ},aS,true),aQ=C(function(aT){return o.call(aJ,aT)>-1},aS,true),e=[function(aV,aU,aT){return(!aR&&(aT||aU!==aI))||((aJ=aU).nodeType?aP(aV,aU,aT):aQ(aV,aU,aT))}];for(;aL<aN;aL++){if((aM=z.relative[aO[aL].type])){e=[C(aH(e),aM)]}else{aM=z.filter[aO[aL].type].apply(null,aO[aL].matches);if(aM[aw]){aK=++aL;for(;aK<aN;aK++){if(z.relative[aO[aK].type]){break}}return r(aL>1&&aH(e),aL>1&&t(aO.slice(0,aL-1).concat({value:aO[aL-2].type===" "?"*":""})).replace(D,"$1"),aM,aL<aK&&ax(aO.slice(aL,aK)),aK<aN&&ax((aO=aO.slice(aK))),aK<aN&&t(aO))}e.push(aM)}}return aH(e)}function aj(aL,aK){var e=aK.length>0,aM=aL.length>0,aJ=function(aW,aQ,aV,aU,aZ){var aR,aS,aX,a1=0,aT="0",aN=aW&&[],a2=[],a0=aI,aP=aW||aM&&z.find.TAG("*",aZ),aO=(aF+=a0==null?1:Math.random()||0.1),aY=aP.length;if(aZ){aI=aQ!==N&&aQ}for(;aT!==aY&&(aR=aP[aT])!=null;aT++){if(aM&&aR){aS=0;while((aX=aL[aS++])){if(aX(aR,aQ,aV)){aU.push(aR);break}}if(aZ){aF=aO}}if(e){if((aR=!aX&&aR)){a1--}if(aW){aN.push(aR)}}}a1+=aT;if(e&&aT!==a1){aS=0;while((aX=aK[aS++])){aX(aN,a2,aQ,aV)}if(aW){if(a1>0){while(aT--){if(!(aN[aT]||a2[aT])){a2[aT]=az.call(aU)}}}a2=al(a2)}d.apply(aU,a2);if(aZ&&!aW&&a2.length>0&&(a1+aK.length)>1){H.uniqueSort(aU)}}if(aZ){aF=aO;aI=a0}return aN};return e?u(aJ):aJ}ah=H.compile=function(e,aK){var aL,aJ=[],aN=[],aM=R[e+" "];if(!aM){if(!aK){aK=s(e)}aL=aK.length;while(aL--){aM=ax(aK[aL]);if(aM[aw]){aJ.push(aM)}else{aN.push(aM)}}aM=R(e,aj(aN,aJ));aM.selector=e}return aM};aD=H.select=function(aK,e,aL,aO){var aM,aR,aJ,aS,aP,aQ=typeof aK==="function"&&aK,aN=!aO&&s((aK=aQ.selector||aK));aL=aL||[];if(aN.length===1){aR=aN[0]=aN[0].slice(0);if(aR.length>2&&(aJ=aR[0]).type==="ID"&&aE.getById&&e.nodeType===9&&au&&z.relative[aR[1].type]){e=(z.find.ID(aJ.matches[0].replace(E,aq),e)||[])[0];if(!e){return aL}else{if(aQ){e=e.parentNode}}aK=aK.slice(aR.shift().value.length)}aM=an.needsContext.test(aK)?0:aR.length;while(aM--){aJ=aR[aM];if(z.relative[(aS=aJ.type)]){break}if((aP=z.find[aS])){if((aO=aP(aJ.matches[0].replace(E,aq),am.test(aR[0].type)&&ae(e.parentNode)||e))){aR.splice(aM,1);aK=aO.length&&t(aR);if(!aK){d.apply(aL,aO);return aL}break}}}}(aQ||ah(aK,aN))(aO,e,!au,aL,am.test(aK)&&ae(e.parentNode)||e);return aL};aE.sortStable=aw.split("").sort(P).join("")===aw;aE.detectDuplicates=!!ai;ak();aE.sortDetached=q(function(e){return e.compareDocumentPosition(N.createElement("div"))&1});if(!q(function(e){e.innerHTML="<a href='#'></a>";return e.firstChild.getAttribute("href")==="#"})){aG("type|href|height|width",function(aJ,e,aK){if(!aK){return aJ.getAttribute(e,e.toLowerCase()==="type"?1:2)}})}if(!aE.attributes||!q(function(e){e.innerHTML="<input/>";e.firstChild.setAttribute("value","");return e.firstChild.getAttribute("value")===""})){aG("value",function(aJ,e,aK){if(!aK&&aJ.nodeName.toLowerCase()==="input"){return aJ.defaultValue}})}if(!q(function(e){return e.getAttribute("disabled")==null})){aG(f,function(aJ,e,aL){var aK;if(!aL){return aJ[e]===true?e.toLowerCase():(aK=aJ.getAttributeNode(e))&&aK.specified?aK.value:null}})}if(typeof define==="function"&&define.amd){define(function(){return H})}else{if(typeof module!=="undefined"&&module.exports){module.exports=H}else{aB.Sizzle=H}}})(window);(function(){if(typeof Sizzle!=="undefined"){return}if(typeof define!=="undefined"&&define.amd){window.Sizzle=Prototype._actual_sizzle;window.define=Prototype._original_define;delete Prototype._actual_sizzle;delete Prototype._original_define}else{if(typeof module!=="undefined"&&module.exports){window.Sizzle=module.exports;module.exports={}}}})();(function(e){var f=Prototype.Selector.extendElements;function b(g,h){return f(e(g,h||document))}function d(h,g){return e.matches(g,[h]).length==1}Prototype.Selector.engine=e;Prototype.Selector.select=b;Prototype.Selector.match=d})(Sizzle);window.Sizzle=Prototype._original_property;delete Prototype._original_property;var Form={reset:function(b){b=$(b);b.reset();return b},serializeElements:function(n,f){if(typeof f!="object"){f={hash:!!f}}else{if(Object.isUndefined(f.hash)){f.hash=true}}var g,l,b=false,h=f.submit,d,e;if(f.hash){e={};d=function(o,p,q){if(p in o){if(!Object.isArray(o[p])){o[p]=[o[p]]}o[p]=o[p].concat(q)}else{o[p]=q}return o}}else{e="";d=function(o,q,p){if(!Object.isArray(p)){p=[p]}if(!p.length){return o}var r=encodeURIComponent(q).gsub(/%20/,"+");return o+(o?"&":"")+p.map(function(s){s=s.gsub(/(\r)?\n/,"\r\n");s=encodeURIComponent(s);s=s.gsub(/%20/,"+");return r+"="+s}).join("&")}}return n.inject(e,function(o,p){if(!p.disabled&&p.name){g=p.name;l=$(p).getValue();if(l!=null&&p.type!="file"&&(p.type!="submit"||(!b&&h!==false&&(!h||g==h)&&(b=true)))){o=d(o,g,l)}}return o})}};Form.Methods={serialize:function(d,b){return Form.serializeElements(Form.getElements(d),b)},getElements:function(g){var h=$(g).getElementsByTagName("*");var f,e=[],d=Form.Element.Serializers;for(var b=0;f=h[b];b++){if(d[f.tagName.toLowerCase()]){e.push(Element.extend(f))}}return e},getInputs:function(l,e,f){l=$(l);var b=l.getElementsByTagName("input");if(!e&&!f){return $A(b).map(Element.extend)}for(var g=0,n=[],h=b.length;g<h;g++){var d=b[g];if((e&&d.type!=e)||(f&&d.name!=f)){continue}n.push(Element.extend(d))}return n},disable:function(b){b=$(b);Form.getElements(b).invoke("disable");return b},enable:function(b){b=$(b);Form.getElements(b).invoke("enable");return b},findFirstElement:function(d){var e=$(d).getElements().findAll(function(f){return"hidden"!=f.type&&!f.disabled});var b=e.findAll(function(f){return f.hasAttribute("tabIndex")&&f.tabIndex>=0}).sortBy(function(f){return f.tabIndex}).first();return b?b:e.find(function(f){return/^(?:input|select|textarea)$/i.test(f.tagName)})},focusFirstElement:function(d){d=$(d);var b=d.findFirstElement();if(b){b.activate()}return d},request:function(d,b){d=$(d),b=Object.clone(b||{});var f=b.parameters,e=d.readAttribute("action")||"";if(e.blank()){e=window.location.href}b.parameters=d.serialize(true);if(f){if(Object.isString(f)){f=f.toQueryParams()}Object.extend(b.parameters,f)}if(d.hasAttribute("method")&&!b.method){b.method=d.method}return new Ajax.Request(e,b)}};Form.Element={focus:function(b){$(b).focus();return b},select:function(b){$(b).select();return b}};Form.Element.Methods={serialize:function(b){b=$(b);if(!b.disabled&&b.name){var d=b.getValue();if(d!=undefined){var e={};e[b.name]=d;return Object.toQueryString(e)}}return""},getValue:function(b){b=$(b);var d=b.tagName.toLowerCase();return Form.Element.Serializers[d](b)},setValue:function(b,d){b=$(b);var e=b.tagName.toLowerCase();Form.Element.Serializers[e](b,d);return b},clear:function(b){$(b).value="";return b},present:function(b){return $(b).value!=""},activate:function(b){b=$(b);try{b.focus();if(b.select&&(b.tagName.toLowerCase()!="input"||!(/^(?:button|reset|submit)$/i.test(b.type)))){b.select()}}catch(d){}return b},disable:function(b){b=$(b);b.disabled=true;return b},enable:function(b){b=$(b);b.disabled=false;return b}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers=(function(){function d(n,o){switch(n.type.toLowerCase()){case"checkbox":case"radio":return h(n,o);default:return g(n,o)}}function h(n,o){if(Object.isUndefined(o)){return n.checked?n.value:null}else{n.checked=!!o}}function g(n,o){if(Object.isUndefined(o)){return n.value}else{n.value=o}}function b(p,s){if(Object.isUndefined(s)){return(p.type==="select-one"?e:f)(p)}var o,q,t=!Object.isArray(s);for(var n=0,r=p.length;n<r;n++){o=p.options[n];q=this.optionValue(o);if(t){if(q==s){o.selected=true;return}}else{o.selected=s.include(q)}}}function e(o){var n=o.selectedIndex;return n>=0?l(o.options[n]):null}function f(q){var n,r=q.length;if(!r){return null}for(var p=0,n=[];p<r;p++){var o=q.options[p];if(o.selected){n.push(l(o))}}return n}function l(n){return Element.hasAttribute(n,"value")?n.value:n.text}return{input:d,inputSelector:h,textarea:g,select:b,selectOne:e,selectMany:f,optionValue:l,button:g}})();Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,b,d,e){$super(e,d);this.element=$(b);this.lastValue=this.getValue()},execute:function(){var b=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(b)?this.lastValue!=b:String(this.lastValue)!=String(b)){this.callback(this.element,b);this.lastValue=b}}});Form.Element.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.serialize(this.element)}});Abstract.EventObserver=Class.create({initialize:function(b,d){this.element=$(b);this.callback=d;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=="form"){this.registerFormCallbacks()}else{this.registerCallback(this.element)}},onElementEvent:function(){var b=this.getValue();if(this.lastValue!=b){this.callback(this.element,b);this.lastValue=b}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this)},registerCallback:function(b){if(b.type){switch(b.type.toLowerCase()){case"checkbox":case"radio":Event.observe(b,"click",this.onElementEvent.bind(this));break;default:Event.observe(b,"change",this.onElementEvent.bind(this));break}}}});Form.Element.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element)}});(function(K){var B=document.createElement("div");var f=document.documentElement;var q="onmouseenter" in f&&"onmouseleave" in f;var S={KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45};var H=function(ae){return false};if(window.attachEvent){if(window.addEventListener){H=function(ae){return !(ae instanceof window.Event)}}else{H=function(ae){return true}}}var V;function T(af,ae){return af.which?(af.which===ae+1):(af.button===ae)}var ad={0:1,1:4,2:2};function Z(af,ae){return af.button===ad[ae]}function W(af,ae){switch(ae){case 0:return af.which==1&&!af.metaKey;case 1:return af.which==2||(af.which==1&&af.metaKey);case 2:return af.which==3;default:return false}}if(window.attachEvent){if(!window.addEventListener){V=Z}else{V=function(af,ae){return H(af)?Z(af,ae):T(af,ae)}}}else{if(Prototype.Browser.WebKit){V=W}else{V=T}}function I(ae){return V(ae,0)}function o(ae){return V(ae,1)}function g(ae){return V(ae,2)}function u(ae){return Element.extend(R(ae))}function R(ag){ag=S.extend(ag);var af=ag.target,ae=ag.type,ah=ag.currentTarget;if(ah&&ah.tagName){if(ae==="load"||ae==="error"||(ae==="click"&&ah.tagName.toLowerCase()==="input"&&ah.type==="radio")){af=ah}}return af.nodeType==Node.TEXT_NODE?af.parentNode:af}function p(ag,ah){var af=R(ag),ae=Prototype.Selector;if(!ah){return Element.extend(af)}while(af){if(Object.isElement(af)&&ae.match(af,ah)){return Element.extend(af)}af=af.parentNode}}function A(ae){return{x:ab(ae),y:aa(ae)}}function ab(ag){var af=document.documentElement,ae=document.body||{scrollLeft:0};return ag.pageX||(ag.clientX+(af.scrollLeft||ae.scrollLeft)-(af.clientLeft||0))}function aa(ag){var af=document.documentElement,ae=document.body||{scrollTop:0};return ag.pageY||(ag.clientY+(af.scrollTop||ae.scrollTop)-(af.clientTop||0))}function y(ae){S.extend(ae);ae.preventDefault();ae.stopPropagation();ae.stopped=true}S.Methods={isLeftClick:I,isMiddleClick:o,isRightClick:g,element:u,findElement:p,pointer:A,pointerX:ab,pointerY:aa,stop:y};var O=Object.keys(S.Methods).inject({},function(ae,af){ae[af]=S.Methods[af].methodize();return ae});if(window.attachEvent){function ac(af){var ae;switch(af.type){case"mouseover":case"mouseenter":ae=af.fromElement;break;case"mouseout":case"mouseleave":ae=af.toElement;break;default:return null}return Element.extend(ae)}var X={stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}};S.extend=function(af,ae){if(!af){return false}if(!H(af)){return af}if(af._extendedByPrototype){return af}af._extendedByPrototype=Prototype.emptyFunction;var ag=S.pointer(af);Object.extend(af,{target:af.srcElement||ae,relatedTarget:ac(af),pageX:ag.x,pageY:ag.y});Object.extend(af,O);Object.extend(af,X);return af}}else{S.extend=Prototype.K}if(window.addEventListener){S.prototype=window.Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(S.prototype,O)}var C={mouseenter:"mouseover",mouseleave:"mouseout"};function h(ae){return C[ae]||ae}if(q){h=Prototype.K}function Y(ae){if(ae===window){return 0}if(typeof ae._prototypeUID==="undefined"){ae._prototypeUID=Element.Storage.UID++}return ae._prototypeUID}function P(ae){if(ae===window){return 0}if(ae==document){return 1}return ae.uniqueID}if("uniqueID" in B){Y=P}function E(ae){return ae.include(":")}S._isCustomEvent=E;function G(ag,af){var ae=K.Event.cache;if(Object.isUndefined(af)){af=Y(ag)}if(!ae[af]){ae[af]={element:ag}}return ae[af]}function L(af,ae){if(Object.isUndefined(ae)){ae=Y(af)}delete K.Event.cache[ae]}function n(ag,aj,am){var ae=G(ag);if(!ae[aj]){ae[aj]=[]}var ai=ae[aj];var ah=ai.length;while(ah--){if(ai[ah].handler===am){return null}}var ak=Y(ag);var af=K.Event._createResponder(ak,aj,am);var al={responder:af,handler:am};ai.push(al);return al}function z(aj,ag,ak){var af=G(aj);var ae=af[ag]||[];var ai=ae.length,al;while(ai--){if(ae[ai].handler===ak){al=ae[ai];break}}if(al){var ah=ae.indexOf(al);ae.splice(ah,1)}if(ae.length===0){delete af[ag];if(Object.keys(af).length===1&&("element" in af)){L(aj)}}return al}function e(ag,af,ah){ag=$(ag);var ai=n(ag,af,ah);if(ai===null){return ag}var ae=ai.responder;if(E(af)){v(ag,af,ae)}else{s(ag,af,ae)}return ag}function s(ah,ag,af){var ae=h(ag);if(ah.addEventListener){ah.addEventListener(ae,af,false)}else{ah.attachEvent("on"+ae,af)}}function v(ag,af,ae){if(ag.addEventListener){ag.addEventListener("dataavailable",ae,false)}else{ag.attachEvent("ondataavailable",ae);ag.attachEvent("onlosecapture",ae)}}function Q(af,ae,ag){af=$(af);var ai=!Object.isUndefined(ag),aj=!Object.isUndefined(ae);if(!aj&&!ai){F(af);return af}if(!ai){N(af,ae);return af}var ah=z(af,ae,ag);if(!ah){return af}b(af,ae,ah.responder);return af}function J(ah,ag,af){var ae=h(ag);if(ah.removeEventListener){ah.removeEventListener(ae,af,false)}else{ah.detachEvent("on"+ae,af)}}function d(ag,af,ae){if(ag.removeEventListener){ag.removeEventListener("dataavailable",ae,false)}else{ag.detachEvent("ondataavailable",ae);ag.detachEvent("onlosecapture",ae)}}function F(aj){var ai=Y(aj),ag=K.Event.cache[ai];if(!ag){return}L(aj,ai);var ae,ah;for(var af in ag){if(af==="element"){continue}ae=ag[af];ah=ae.length;while(ah--){b(aj,af,ae[ah].responder)}}}function N(aj,ag){var af=G(aj);var ae=af[ag];if(ae){delete af[ag]}ae=ae||[];var ai=ae.length;while(ai--){b(aj,ag,ae[ai].responder)}for(var ah in af){if(ah==="element"){continue}return}L(aj)}function b(af,ae,ag){if(E(ae)){d(af,ae,ag)}else{J(af,ae,ag)}}function l(ae){if(ae!==document){return ae}if(document.createEvent&&!ae.dispatchEvent){return document.documentElement}return ae}function D(ah,ag,af,ae){ah=l($(ah));if(Object.isUndefined(ae)){ae=true}af=af||{};var ai=U(ah,ag,af,ae);return S.extend(ai)}function r(ah,ag,af,ae){var ai=document.createEvent("HTMLEvents");ai.initEvent("dataavailable",ae,true);ai.eventName=ag;ai.memo=af;ah.dispatchEvent(ai);return ai}function t(ah,ag,af,ae){var ai=document.createEventObject();ai.eventType=ae?"ondataavailable":"onlosecapture";ai.eventName=ag;ai.memo=af;ah.fireEvent(ai.eventType,ai);return ai}var U=document.createEvent?r:t;S.Handler=Class.create({initialize:function(ag,af,ae,ah){this.element=$(ag);this.eventName=af;this.selector=ae;this.callback=ah;this.handler=this.handleEvent.bind(this)},start:function(){S.observe(this.element,this.eventName,this.handler);return this},stop:function(){S.stopObserving(this.element,this.eventName,this.handler);return this},handleEvent:function(af){var ae=S.findElement(af,this.selector);if(ae){this.callback.call(this.element,af,ae)}}});function M(ag,af,ae,ah){ag=$(ag);if(Object.isFunction(ae)&&Object.isUndefined(ah)){ah=ae,ae=null}return new S.Handler(ag,af,ae,ah).start()}Object.extend(S,S.Methods);Object.extend(S,{fire:D,observe:e,stopObserving:Q,on:M});Element.addMethods({fire:D,observe:e,stopObserving:Q,on:M});Object.extend(document,{fire:D.methodize(),observe:e.methodize(),stopObserving:Q.methodize(),on:M.methodize(),loaded:false});if(K.Event){Object.extend(window.Event,S)}else{K.Event=S}K.Event.cache={};function w(){K.Event.cache=null}if(window.attachEvent){window.attachEvent("onunload",w)}B=null;f=null})(this);(function(e){var l=document.documentElement;var d="onmouseenter" in l&&"onmouseleave" in l;function h(n){return !d&&(n==="mouseenter"||n==="mouseleave")}function f(o,n,p){if(Event._isCustomEvent(n)){return g(o,n,p)}if(h(n)){return b(o,n,p)}return function(r){if(!Event.cache){return}var q=Event.cache[o].element;Event.extend(r,q);p.call(q,r)}}function g(o,n,p){return function(s){var q=Event.cache[o];var r=q&&q.element;if(Object.isUndefined(s.eventName)){return false}if(s.eventName!==n){return false}Event.extend(s,r);p.call(r,s)}}function b(o,n,p){return function(s){var q=Event.cache[o].element;Event.extend(s,q);var r=s.relatedTarget;while(r&&r!==q){try{r=r.parentNode}catch(t){r=q}}if(r===q){return}p.call(q,s)}}e.Event._createResponder=f;l=null})(this);(function(b){var g;function d(){if(document.loaded){return}if(g){window.clearTimeout(g)}document.loaded=true;document.fire("dom:loaded")}function f(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",f);d()}}function e(){try{document.documentElement.doScroll("left")}catch(h){g=e.defer();return}d()}if(document.readyState==="complete"){d();return}if(document.addEventListener){document.addEventListener("DOMContentLoaded",d,false)}else{document.attachEvent("onreadystatechange",f);if(window==top){g=e.defer()}}Event.observe(window,"load",d)})(this);Element.addMethods();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.addMethods({childOf:Element.Methods.descendantOf});var Insertion={Before:function(b,d){return Element.insert(b,{before:d})},Top:function(b,d){return Element.insert(b,{top:d})},Bottom:function(b,d){return Element.insert(b,{bottom:d})},After:function(b,d){return Element.insert(b,{after:d})}};var $continue=new Error('"throw $continue" is deprecated, use "return" instead');var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},within:function(d,b,e){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(d,b,e)}this.xcomp=b;this.ycomp=e;this.offset=Element.cumulativeOffset(d);return(e>=this.offset[1]&&e<this.offset[1]+d.offsetHeight&&b>=this.offset[0]&&b<this.offset[0]+d.offsetWidth)},withinIncludingScrolloffsets:function(d,b,f){var e=Element.cumulativeScrollOffset(d);this.xcomp=b+e[0]-this.deltaX;this.ycomp=f+e[1]-this.deltaY;this.offset=Element.cumulativeOffset(d);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+d.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+d.offsetWidth)},overlap:function(d,b){if(!d){return 0}if(d=="vertical"){return((this.offset[1]+b.offsetHeight)-this.ycomp)/b.offsetHeight}if(d=="horizontal"){return((this.offset[0]+b.offsetWidth)-this.xcomp)/b.offsetWidth}},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(b){Position.prepare();return Element.absolutize(b)},relativize:function(b){Position.prepare();return Element.relativize(b)},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(d,e,b){b=b||{};return Element.clonePosition(e,d,b)}};if(!document.getElementsByClassName){document.getElementsByClassName=function(d){function b(e){return e.blank()?null:"[contains(concat(' ', @class, ' '), ' "+e+" ')]"}d.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(e,g){g=g.toString().strip();var f=/\s/.test(g)?$w(g).map(b).join(""):b(g);return f?document._getElementsByXPath(".//*"+f,e):[]}:function(g,h){h=h.toString().strip();var l=[],n=(/\s/.test(h)?$w(h):null);if(!n&&!h){return l}var e=$(g).getElementsByTagName("*");h=" "+h+" ";for(var f=0,p,o;p=e[f];f++){if(p.className&&(o=" "+p.className+" ")&&(o.include(h)||(n&&n.all(function(q){return !q.toString().blank()&&o.include(" "+q+" ")})))){l.push(Element.extend(p))}}return l};return function(f,e){return $(e||document.body).getElementsByClassName(f)}}(Element.Methods)}Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(b){this.element=$(b)},_each:function(d,b){this.element.className.split(/\s+/).select(function(e){return e.length>0})._each(d,b)},set:function(b){this.element.className=b},add:function(b){if(this.include(b)){return}this.set($A(this).concat(b).join(" "))},remove:function(b){if(!this.include(b)){return}this.set($A(this).without(b).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);(function(){window.Selector=Class.create({initialize:function(b){this.expression=b.strip()},findElements:function(b){return Prototype.Selector.select(this.expression,b)},match:function(b){return Prototype.Selector.match(b,this.expression)},toString:function(){return this.expression},inspect:function(){return"#<Selector: "+this.expression+">"}});Object.extend(Selector,{matchElements:function(h,l){var b=Prototype.Selector.match,f=[];for(var e=0,g=h.length;e<g;e++){var d=h[e];if(b(d,l)){f.push(Element.extend(d))}}return f},findElement:function(h,l,d){d=d||0;var b=0,f;for(var e=0,g=h.length;e<g;e++){f=h[e];if(Prototype.Selector.match(f,l)&&d===b++){return Element.extend(f)}}},findChildElements:function(d,e){var b=e.toArray().join(", ");return Prototype.Selector.select(b,d||document)}})})();var Window=Class.create();Window.keepMultiModalWindow=false;Window.hasEffectLib=(typeof Effect!="undefined");Window.resizeEffectDuration=0.4;Window.prototype={initialize:function(){var e;var d=0;if(arguments.length>0){if(typeof arguments[0]=="string"){e=arguments[0];d=1}else{e=arguments[0]?arguments[0].id:null}}if(!e){e="window_"+new Date().getTime()}if($(e)){alert("Window "+e+" is already registered in the DOM! Make sure you use setDestroyOnClose() or destroyOnClose: true in the constructor")}this.options=Object.extend({className:"dialog",windowClassName:null,blurClassName:null,minWidth:100,minHeight:20,resizable:true,closable:true,minimizable:true,maximizable:true,draggable:true,userData:null,showEffect:(Window.hasEffectLib?Effect.Appear:Element.show),hideEffect:(Window.hasEffectLib?Effect.Fade:Element.hide),showEffectOptions:{},hideEffectOptions:{},effectOptions:null,parent:document.body,title:" ",url:null,onload:Prototype.emptyFunction,width:200,height:300,opacity:1,recenterAuto:true,wiredDrag:false,closeOnEsc:true,closeCallback:null,destroyOnClose:false,gridX:1,gridY:1},arguments[d]||{});if(this.options.blurClassName){this.options.focusClassName=this.options.className}if(typeof this.options.top=="undefined"&&typeof this.options.bottom=="undefined"){this.options.top=this._round(Math.random()*500,this.options.gridY)}if(typeof this.options.left=="undefined"&&typeof this.options.right=="undefined"){this.options.left=this._round(Math.random()*500,this.options.gridX)}if(this.options.effectOptions){Object.extend(this.options.hideEffectOptions,this.options.effectOptions);Object.extend(this.options.showEffectOptions,this.options.effectOptions);if(this.options.showEffect==Element.Appear){this.options.showEffectOptions.to=this.options.opacity}}if(Window.hasEffectLib){if(this.options.showEffect==Effect.Appear){this.options.showEffectOptions.to=this.options.opacity}if(this.options.hideEffect==Effect.Fade){this.options.hideEffectOptions.from=this.options.opacity}}if(this.options.hideEffect==Element.hide){this.options.hideEffect=function(){Element.hide(this.element);if(this.options.destroyOnClose){this.destroy()}}.bind(this)}if(this.options.parent!=document.body){this.options.parent=$(this.options.parent)}this.element=this._createWindow(e);this.element.win=this;this.eventMouseDown=this._initDrag.bindAsEventListener(this);this.eventMouseUp=this._endDrag.bindAsEventListener(this);this.eventMouseMove=this._updateDrag.bindAsEventListener(this);this.eventOnLoad=this._getWindowBorderSize.bindAsEventListener(this);this.eventMouseDownContent=this.toFront.bindAsEventListener(this);this.eventResize=this._recenter.bindAsEventListener(this);this.eventKeyUp=this._keyUp.bindAsEventListener(this);this.topbar=$(this.element.id+"_top");this.bottombar=$(this.element.id+"_bottom");this.content=$(this.element.id+"_content");Event.observe(this.topbar,"mousedown",this.eventMouseDown);Event.observe(this.bottombar,"mousedown",this.eventMouseDown);Event.observe(this.content,"mousedown",this.eventMouseDownContent);Event.observe(window,"load",this.eventOnLoad);Event.observe(window,"resize",this.eventResize);Event.observe(window,"scroll",this.eventResize);Event.observe(document,"keyup",this.eventKeyUp);Event.observe(this.options.parent,"scroll",this.eventResize);if(this.options.draggable){var b=this;[this.topbar,this.topbar.up().previous(),this.topbar.up().next()].each(function(f){f.observe("mousedown",b.eventMouseDown);f.addClassName("top_draggable")});[this.bottombar.up(),this.bottombar.up().previous(),this.bottombar.up().next()].each(function(f){f.observe("mousedown",b.eventMouseDown);f.addClassName("bottom_draggable")})}if(this.options.resizable){this.sizer=$(this.element.id+"_sizer");Event.observe(this.sizer,"mousedown",this.eventMouseDown)}this.useLeft=null;this.useTop=null;if(typeof this.options.left!="undefined"){this.element.setStyle({left:parseFloat(this.options.left)+"px"});this.useLeft=true}else{this.element.setStyle({right:parseFloat(this.options.right)+"px"});this.useLeft=false}if(typeof this.options.top!="undefined"){this.element.setStyle({top:parseFloat(this.options.top)+"px"});this.useTop=true}else{this.element.setStyle({bottom:parseFloat(this.options.bottom)+"px"});this.useTop=false}this.storedLocation=null;this.setOpacity(this.options.opacity);if(this.options.zIndex){this.setZIndex(this.options.zIndex)}else{this.setZIndex(this.getMaxZIndex())}if(this.options.destroyOnClose){this.setDestroyOnClose(true)}this._getWindowBorderSize();this.width=this.options.width;this.height=this.options.height;this.visible=false;this.constraint=false;this.constraintPad={top:0,left:0,bottom:0,right:0};if(this.width&&this.height){this.setSize(this.options.width,this.options.height)}this.setTitle(this.options.title);Windows.register(this)},getMaxZIndex:function(){var b=0,d;var g=document.body.childNodes;for(d=0;d<g.length;d++){var e=g[d];var f=e.nodeType==1?parseInt(e.style.zIndex,10)||0:0;if(f<10000){b=Math.max(b,f)}}return b+10},destroy:function(){this._notify("onDestroy");Event.stopObserving(this.topbar,"mousedown",this.eventMouseDown);Event.stopObserving(this.bottombar,"mousedown",this.eventMouseDown);Event.stopObserving(this.content,"mousedown",this.eventMouseDownContent);Event.stopObserving(window,"load",this.eventOnLoad);Event.stopObserving(window,"resize",this.eventResize);Event.stopObserving(window,"scroll",this.eventResize);Event.stopObserving(this.content,"load",this.options.onload);Event.stopObserving(document,"keyup",this.eventKeyUp);if(this._oldParent){var e=this.getContent();var b=null;for(var d=0;d<e.childNodes.length;d++){b=e.childNodes[d];if(b.nodeType==1){break}b=null}if(b){this._oldParent.appendChild(b)}this._oldParent=null}if(this.sizer){Event.stopObserving(this.sizer,"mousedown",this.eventMouseDown)}if(this.options.url){this.content.src=null}if(this.iefix){Element.remove(this.iefix)}Element.remove(this.element);Windows.unregister(this)},setCloseCallback:function(b){this.options.closeCallback=b},getContent:function(){return this.content},setContent:function(n,l,e){var b=$(n);if(null==b){throw"Unable to find element '"+n+"' in DOM"}this._oldParent=b.parentNode;var h=null;var g=null;if(l){h=Element.getDimensions(b)}if(e){g=Position.cumulativeOffset(b)}var f=this.getContent();this.setHTMLContent("");f=this.getContent();f.appendChild(b);b.show();if(l){this.setSize(h.width,h.height)}if(e){this.setLocation(g[1]-this.heightN,g[0]-this.widthW)}},setHTMLContent:function(b){if(this.options.url){this.content.src=null;this.options.url=null;var d='<div id="'+this.getId()+'_content" class="'+this.options.className+'_content"> </div>';$(this.getId()+"_table_content").innerHTML=d;this.content=$(this.element.id+"_content")}this.getContent().innerHTML=b},setAjaxContent:function(d,b,f,e){this.showFunction=f?"showCenter":"show";this.showModal=e||false;b=b||{};this.setHTMLContent("");this.onComplete=b.onComplete;if(!this._onCompleteHandler){this._onCompleteHandler=this._setAjaxContent.bind(this)}b.onComplete=this._onCompleteHandler;new Ajax.Request(d,b);b.onComplete=this.onComplete},_setAjaxContent:function(b){Element.update(this.getContent(),b.responseText);if(this.onComplete){this.onComplete(b)}this.onComplete=null;this[this.showFunction](this.showModal)},setURL:function(b){if(this.options.url){this.content.src=null}this.options.url=b;var d="<iframe frameborder='0' name='"+this.getId()+"_content' id='"+this.getId()+"_content' src='"+b+"' width='"+this.width+"' height='"+this.height+"'> </iframe>";$(this.getId()+"_table_content").innerHTML=d;this.content=$(this.element.id+"_content")},getURL:function(){return this.options.url?this.options.url:null},refresh:function(){if(this.options.url){$(this.element.getAttribute("id")+"_content").src=this.options.url}},setCookie:function(d,e,t,g,b){d=d||this.element.id;this.cookie=[d,e,t,g,b];var r=WindowUtilities.getCookie(d);if(r){var s=r.split(",");var p=s[0].split(":");var o=s[1].split(":");var q=parseFloat(s[2]),l=parseFloat(s[3]);var n=s[4];var f=s[5];this.setSize(q,l);if(n=="true"){this.doMinimize=true}else{if(f=="true"){this.doMaximize=true}}this.useLeft=p[0]=="l";this.useTop=o[0]=="t";this.element.setStyle(this.useLeft?{left:p[1]}:{right:p[1]});this.element.setStyle(this.useTop?{top:o[1]}:{bottom:o[1]})}},getId:function(){return this.element.id},setDestroyOnClose:function(){this.options.destroyOnClose=true},setConstraint:function(b,d){this.constraint=b;this.constraintPad=Object.extend(this.constraintPad,d||{});if(this.useTop&&this.useLeft){this.setLocation(parseFloat(this.element.style.top),parseFloat(this.element.style.left))}},_initDrag:function(d){if(Event.element(d)==this.sizer&&this.isMinimized()){return}if(Event.element(d)!=this.sizer&&this.isMaximized()){return}if(Prototype.Browser.IE&&this.heightN==0){this._getWindowBorderSize()}this.pointer=[this._round(Event.pointerX(d),this.options.gridX),this._round(Event.pointerY(d),this.options.gridY)];if(this.options.wiredDrag){this.currentDrag=this._createWiredElement()}else{this.currentDrag=this.element}if(Event.element(d)==this.sizer){this.doResize=true;this.widthOrg=this.width;this.heightOrg=this.height;this.bottomOrg=parseFloat(this.element.getStyle("bottom"));this.rightOrg=parseFloat(this.element.getStyle("right"));this._notify("onStartResize")}else{this.doResize=false;var b=$(this.getId()+"_close");if(b&&Position.within(b,this.pointer[0],this.pointer[1])){this.currentDrag=null;return}this.toFront();if(!this.options.draggable){return}this._notify("onStartMove")}Event.observe(document,"mouseup",this.eventMouseUp,false);Event.observe(document,"mousemove",this.eventMouseMove,false);WindowUtilities.disableScreen("__invisible__","__invisible__",this.overlayOpacity);document.body.ondrag=function(){return false};document.body.onselectstart=function(){return false};this.currentDrag.show();Event.stop(d)},_round:function(d,b){return b==1?d:d=Math.floor(d/b)*b},_updateDrag:function(d){var b=[this._round(Event.pointerX(d),this.options.gridX),this._round(Event.pointerY(d),this.options.gridY)];var q=b[0]-this.pointer[0];var p=b[1]-this.pointer[1];if(this.doResize){var o=this.widthOrg+q;var f=this.heightOrg+p;q=this.width-this.widthOrg;p=this.height-this.heightOrg;if(this.useLeft){o=this._updateWidthConstraint(o)}else{this.currentDrag.setStyle({right:(this.rightOrg-q)+"px"})}if(this.useTop){f=this._updateHeightConstraint(f)}else{this.currentDrag.setStyle({bottom:(this.bottomOrg-p)+"px"})}this.setSize(o,f);this._notify("onResize")}else{this.pointer=b;if(this.useLeft){var e=parseFloat(this.currentDrag.getStyle("left"))+q;var n=this._updateLeftConstraint(e);this.pointer[0]+=n-e;this.currentDrag.setStyle({left:n+"px"})}else{this.currentDrag.setStyle({right:parseFloat(this.currentDrag.getStyle("right"))-q+"px"})}if(this.useTop){var l=parseFloat(this.currentDrag.getStyle("top"))+p;var g=this._updateTopConstraint(l);this.pointer[1]+=g-l;this.currentDrag.setStyle({top:g+"px"})}else{this.currentDrag.setStyle({bottom:parseFloat(this.currentDrag.getStyle("bottom"))-p+"px"})}this._notify("onMove")}if(this.iefix){this._fixIEOverlapping()}this._removeStoreLocation();Event.stop(d)},_endDrag:function(b){WindowUtilities.enableScreen("__invisible__");if(this.doResize){this._notify("onEndResize")}else{this._notify("onEndMove")}Event.stopObserving(document,"mouseup",this.eventMouseUp,false);Event.stopObserving(document,"mousemove",this.eventMouseMove,false);Event.stop(b);this._hideWiredElement();this._saveCookie();document.body.ondrag=null;document.body.onselectstart=null},_updateLeftConstraint:function(d){if(this.constraint&&this.useLeft&&this.useTop){var b=this.options.parent==document.body?WindowUtilities.getPageSize().windowWidth:this.options.parent.getDimensions().width;if(d<this.constraintPad.left){d=this.constraintPad.left}if(d+this.width+this.widthE+this.widthW>b-this.constraintPad.right){d=b-this.constraintPad.right-this.width-this.widthE-this.widthW}}return d},_updateTopConstraint:function(e){if(this.constraint&&this.useLeft&&this.useTop){var b=this.options.parent==document.body?WindowUtilities.getPageSize().windowHeight:this.options.parent.getDimensions().height;var d=this.height+this.heightN+this.heightS;if(e<this.constraintPad.top){e=this.constraintPad.top}if(e+d>b-this.constraintPad.bottom){e=b-this.constraintPad.bottom-d}}return e},_updateWidthConstraint:function(b){if(this.constraint&&this.useLeft&&this.useTop){var d=this.options.parent==document.body?WindowUtilities.getPageSize().windowWidth:this.options.parent.getDimensions().width;var e=parseFloat(this.element.getStyle("left"));if(e+b+this.widthE+this.widthW>d-this.constraintPad.right){b=d-this.constraintPad.right-e-this.widthE-this.widthW}}return b},_updateHeightConstraint:function(d){if(this.constraint&&this.useLeft&&this.useTop){var b=this.options.parent==document.body?WindowUtilities.getPageSize().windowHeight:this.options.parent.getDimensions().height;var e=parseFloat(this.element.getStyle("top"));if(e+d+this.heightN+this.heightS>b-this.constraintPad.bottom){d=b-this.constraintPad.bottom-e-this.heightN-this.heightS}}return d},_createWindow:function(b){var h=this.options.className;var f=document.createElement("div");f.setAttribute("id",b);f.className="dialog";if(this.options.windowClassName){f.className+=" "+this.options.windowClassName}var g;if(this.options.url){g='<iframe frameborder="0" name="'+b+'_content" id="'+b+'_content" src="'+this.options.url+'"> </iframe>'}else{g='<div id="'+b+'_content" class="'+h+'_content"> </div>'}var l=this.options.closable?"<div class='"+h+"_close' id='"+b+"_close' onclick='Windows.close(\""+b+"\", event)'> </div>":"";var n=this.options.minimizable?"<div class='"+h+"_minimize' id='"+b+"_minimize' onclick='Windows.minimize(\""+b+"\", event)'> </div>":"";var o=this.options.maximizable?"<div class='"+h+"_maximize' id='"+b+"_maximize' onclick='Windows.maximize(\""+b+"\", event)'> </div>":"";var e=this.options.resizable?"class='"+h+"_sizer' id='"+b+"_sizer'":"class='"+h+"_se'";var d="../themes/default/blank.gif";f.innerHTML=l+n+o+" <a href='#' id='"+b+"_focus_anchor'><!-- --></a> <table id='"+b+"_row1' class=\"top table_window\"> <tr> <td class='"+h+"_nw'></td> <td class='"+h+"_n'><div id='"+b+"_top' class='"+h+"_title title_window'>"+this.options.title+"</div></td> <td class='"+h+"_ne'></td> </tr> </table> <table id='"+b+"_row2' class=\"mid table_window\"> <tr> <td class='"+h+"_w'></td> <td id='"+b+"_table_content' class='"+h+"_content' valign='top'>"+g+"</td> <td class='"+h+"_e'></td> </tr> </table> <table id='"+b+"_row3' class=\"bot table_window\"> <tr> <td class='"+h+"_sw'></td> <td class='"+h+"_s'><div id='"+b+"_bottom' class='status_bar'><span style='float:left; width:1px; height:1px'></span></div></td> <td "+e+"></td> </tr> </table> ";Element.hide(f);this.options.parent.insertBefore(f,this.options.parent.firstChild);Event.observe($(b+"_content"),"load",this.options.onload);return f},changeClassName:function(b){var d=this.options.className;var e=this.getId();$A(["_close","_minimize","_maximize","_sizer","_content"]).each(function(f){this._toggleClassName($(e+f),d+f,b+f)}.bind(this));this._toggleClassName($(e+"_top"),d+"_title",b+"_title");$$("#"+e+" td").each(function(f){f.className=f.className.sub(d,b)});this.options.className=b},_toggleClassName:function(e,d,b){if(e){e.removeClassName(d);e.addClassName(b)}},setLocation:function(f,d){f=this._updateTopConstraint(f);d=this._updateLeftConstraint(d);var b=this.currentDrag||this.element;b.setStyle({top:f+"px"});b.setStyle({left:d+"px"});this.useLeft=true;this.useTop=true},getLocation:function(){var b={};if(this.useTop){b=Object.extend(b,{top:this.element.getStyle("top")})}else{b=Object.extend(b,{bottom:this.element.getStyle("bottom")})}if(this.useLeft){b=Object.extend(b,{left:this.element.getStyle("left")})}else{b=Object.extend(b,{right:this.element.getStyle("right")})}return b},getSize:function(){return{width:this.width,height:this.height}},setSize:function(f,d,b){f=parseFloat(f);d=parseFloat(d);if(!this.minimized&&f<this.options.minWidth){f=this.options.minWidth}if(!this.minimized&&d<this.options.minHeight){d=this.options.minHeight}if(this.options.maxHeight&&d>this.options.maxHeight){d=this.options.maxHeight}if(this.options.maxWidth&&f>this.options.maxWidth){f=this.options.maxWidth}if(this.useTop&&this.useLeft&&Window.hasEffectLib&&Effect.ResizeWindow&&b){new Effect.ResizeWindow(this,null,null,f,d,{duration:Window.resizeEffectDuration})}else{this.width=f;this.height=d;var h=this.currentDrag?this.currentDrag:this.element;h.setStyle({width:f+this.widthW+this.widthE+"px"});h.setStyle({height:d+this.heightN+this.heightS+"px"});if(!this.currentDrag||this.currentDrag==this.element){var g=$(this.element.id+"_content");g.setStyle({height:d+"px"});g.setStyle({width:f+"px"})}}},updateHeight:function(){this.setSize(this.width,this.content.scrollHeight,true)},updateWidth:function(){this.setSize(this.content.scrollWidth,this.height,true)},toFront:function(){if(this.element.style.zIndex<Windows.maxZIndex){this.setZIndex(Windows.maxZIndex+1)}if(this.iefix){this._fixIEOverlapping()}},getBounds:function(d){if(!this.width||!this.height||!this.visible){this.computeBounds()}var b=this.width;var e=this.height;if(!d){b+=this.widthW+this.widthE;e+=this.heightN+this.heightS}var f=Object.extend(this.getLocation(),{width:b+"px",height:e+"px"});return f},computeBounds:function(){if(!this.width||!this.height){var b=WindowUtilities._computeSize(this.content.innerHTML,this.content.id,this.width,this.height,0,this.options.className);if(this.height){this.width=b+5}else{this.height=b+5}}this.setSize(this.width,this.height);if(this.centered){this._center(this.centerTop,this.centerLeft)}},show:function(d){this.visible=true;if(d){if(typeof this.overlayOpacity=="undefined"){var b=this;setTimeout(function(){b.show(d)},10);return}Windows.addModalWindow(this);this.modal=true;this.setZIndex(Windows.maxZIndex+1);Windows.unsetOverflow(this)}else{if(!this.element.style.zIndex){this.setZIndex(Windows.maxZIndex+1)}}if(this.oldStyle){this.getContent().setStyle({overflow:this.oldStyle})}this.computeBounds();this._notify("onBeforeShow");if(this.options.showEffect!=Element.show&&this.options.showEffectOptions){this.options.showEffect(this.element,this.options.showEffectOptions)}else{this.options.showEffect(this.element)}this._checkIEOverlapping();WindowUtilities.focusedWindow=this;this._notify("onShow");$(this.element.id+"_focus_anchor").focus()},showCenter:function(b,e,d){this.centered=true;this.centerTop=e;this.centerLeft=d;this.show(b)},isVisible:function(){return this.visible},_center:function(e,d){var f=WindowUtilities.getWindowScroll(this.options.parent);var b=WindowUtilities.getPageSize(this.options.parent);if(typeof e=="undefined"){e=(b.windowHeight-(this.height+this.heightN+this.heightS))/2}e+=f.top;if(typeof d=="undefined"){d=(b.windowWidth-(this.width+this.widthW+this.widthE))/2}d+=f.left;this.setLocation(e,d);this.toFront()},_recenter:function(d){if(this.centered){var b=WindowUtilities.getPageSize(this.options.parent);var e=WindowUtilities.getWindowScroll(this.options.parent);if(this.pageSize&&this.pageSize.windowWidth==b.windowWidth&&this.pageSize.windowHeight==b.windowHeight&&this.windowScroll.left==e.left&&this.windowScroll.top==e.top){return}this.pageSize=b;this.windowScroll=e;if($("overlay_modal")){$("overlay_modal").setStyle({height:(b.pageHeight+"px")})}if(this.options.recenterAuto){this._center(this.centerTop,this.centerLeft)}}},hide:function(){this.visible=false;if(this.modal){Windows.removeModalWindow(this);Windows.resetOverflow()}this.oldStyle=this.getContent().getStyle("overflow")||"auto";this.getContent().setStyle({overflow:"hidden"});this.options.hideEffect(this.element,this.options.hideEffectOptions);if(this.iefix){this.iefix.hide()}if(!this.doNotNotifyHide){this._notify("onHide")}},close:function(){if(this.visible){if(this.options.closeCallback&&!this.options.closeCallback(this)){return}if(this.options.destroyOnClose){var b=this.destroy.bind(this);if(this.options.hideEffectOptions.afterFinish){var d=this.options.hideEffectOptions.afterFinish;this.options.hideEffectOptions.afterFinish=function(){d();b()}}else{this.options.hideEffectOptions.afterFinish=function(){b()}}}Windows.updateFocusedWindow();this.doNotNotifyHide=true;this.hide();this.doNotNotifyHide=false;this._notify("onClose")}},minimize:function(){if(this.resizing){return}var b=$(this.getId()+"_row2");if(!this.minimized){this.minimized=true;var f=b.getDimensions().height;this.r2Height=f;var e=this.element.getHeight()-f;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,null,null,null,this.height-f,{duration:Window.resizeEffectDuration})}else{this.height-=f;this.element.setStyle({height:e+"px"});b.hide()}if(!this.useTop){var d=parseFloat(this.element.getStyle("bottom"));this.element.setStyle({bottom:(d+f)+"px"})}}else{this.minimized=false;var f=this.r2Height;this.r2Height=null;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,null,null,null,this.height+f,{duration:Window.resizeEffectDuration})}else{var e=this.element.getHeight()+f;this.height+=f;this.element.setStyle({height:e+"px"});b.show()}if(!this.useTop){var d=parseFloat(this.element.getStyle("bottom"));this.element.setStyle({bottom:(d-f)+"px"})}this.toFront()}this._notify("onMinimize");this._saveCookie()},maximize:function(){if(this.isMinimized()||this.resizing){return}if(Prototype.Browser.IE&&this.heightN==0){this._getWindowBorderSize()}if(this.storedLocation!=null){this._restoreLocation();if(this.iefix){this.iefix.hide()}}else{this._storeLocation();Windows.unsetOverflow(this);var l=WindowUtilities.getWindowScroll(this.options.parent);var d=WindowUtilities.getPageSize(this.options.parent);var h=l.left;var g=l.top;if(this.options.parent!=document.body){l={top:0,left:0,bottom:0,right:0};var f=this.options.parent.getDimensions();d.windowWidth=f.width;d.windowHeight=f.height;g=0;h=0}if(this.constraint){d.windowWidth-=Math.max(0,this.constraintPad.left)+Math.max(0,this.constraintPad.right);d.windowHeight-=Math.max(0,this.constraintPad.top)+Math.max(0,this.constraintPad.bottom);h+=Math.max(0,this.constraintPad.left);g+=Math.max(0,this.constraintPad.top)}var e=d.windowWidth-this.widthW-this.widthE;var b=d.windowHeight-this.heightN-this.heightS;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,g,h,e,b,{duration:Window.resizeEffectDuration})}else{this.setSize(e,b);this.element.setStyle(this.useLeft?{left:h}:{right:h});this.element.setStyle(this.useTop?{top:g}:{bottom:g})}this.toFront();if(this.iefix){this._fixIEOverlapping()}}this._notify("onMaximize");this._saveCookie()},isMinimized:function(){return this.minimized},isMaximized:function(){return(this.storedLocation!=null)},setOpacity:function(b){if(Element.setOpacity){Element.setOpacity(this.element,b)}},setZIndex:function(b){this.element.setStyle({zIndex:b});Windows.updateZindex(b,this)},setTitle:function(b){if(!b||b==""){b=" "}Element.update(this.element.id+"_top",b)},getTitle:function(){return $(this.element.id+"_top").innerHTML},setStatusBar:function(d){var b=$(this.getId()+"_bottom");if(typeof(d)=="object"){if(this.bottombar.firstChild){this.bottombar.replaceChild(d,this.bottombar.firstChild)}else{this.bottombar.appendChild(d)}}else{this.bottombar.innerHTML=d}},_checkIEOverlapping:function(){if(!this.iefix&&(navigator.appVersion.indexOf("MSIE")>0)&&(navigator.userAgent.indexOf("Opera")<0)&&(this.element.getStyle("position")=="absolute")){new Insertion.After(this.element.id,'<iframe id="'+this.element.id+'_iefix" style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" src="javascript:false;" frameborder="0" scrolling="no"></iframe>');this.iefix=$(this.element.id+"_iefix")}if(this.iefix){setTimeout(this._fixIEOverlapping.bind(this),50)}},_fixIEOverlapping:function(){Position.clone(this.element,this.iefix);this.iefix.style.zIndex=this.element.style.zIndex-1;this.iefix.show()},_keyUp:function(b){if(27==b.keyCode&&this.options.closeOnEsc){this.close()}},_getWindowBorderSize:function(d){var e=this._createHiddenDiv(this.options.className+"_n");this.heightN=Element.getDimensions(e).height;e.parentNode.removeChild(e);var e=this._createHiddenDiv(this.options.className+"_s");this.heightS=Element.getDimensions(e).height;e.parentNode.removeChild(e);var e=this._createHiddenDiv(this.options.className+"_e");this.widthE=Element.getDimensions(e).width;e.parentNode.removeChild(e);var e=this._createHiddenDiv(this.options.className+"_w");this.widthW=Element.getDimensions(e).width;e.parentNode.removeChild(e);var e=document.createElement("div");e.className="overlay_"+this.options.className;document.body.appendChild(e);var b=this;setTimeout(function(){b.overlayOpacity=($(e).getStyle("opacity"));e.parentNode.removeChild(e)},10);if(Prototype.Browser.IE){this.heightS=$(this.getId()+"_row3").getDimensions().height;this.heightN=$(this.getId()+"_row1").getDimensions().height}if(Prototype.Browser.WebKit&&Prototype.Browser.WebKitVersion<420){this.setSize(this.width,this.height)}if(this.doMaximize){this.maximize()}if(this.doMinimize){this.minimize()}},_createHiddenDiv:function(d){var b=document.body;var e=document.createElement("div");e.setAttribute("id",this.element.id+"_tmp");e.className=d;e.style.display="none";e.innerHTML="";b.insertBefore(e,b.firstChild);return e},_storeLocation:function(){if(this.storedLocation==null){this.storedLocation={useTop:this.useTop,useLeft:this.useLeft,top:this.element.getStyle("top"),bottom:this.element.getStyle("bottom"),left:this.element.getStyle("left"),right:this.element.getStyle("right"),width:this.width,height:this.height}}},_restoreLocation:function(){if(this.storedLocation!=null){this.useLeft=this.storedLocation.useLeft;this.useTop=this.storedLocation.useTop;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,this.storedLocation.top,this.storedLocation.left,this.storedLocation.width,this.storedLocation.height,{duration:Window.resizeEffectDuration})}else{this.element.setStyle(this.useLeft?{left:this.storedLocation.left}:{right:this.storedLocation.right});this.element.setStyle(this.useTop?{top:this.storedLocation.top}:{bottom:this.storedLocation.bottom});this.setSize(this.storedLocation.width,this.storedLocation.height)}Windows.resetOverflow();this._removeStoreLocation()}},_removeStoreLocation:function(){this.storedLocation=null},_saveCookie:function(){if(this.cookie){var b="";if(this.useLeft){b+="l:"+(this.storedLocation?this.storedLocation.left:this.element.getStyle("left"))}else{b+="r:"+(this.storedLocation?this.storedLocation.right:this.element.getStyle("right"))}if(this.useTop){b+=",t:"+(this.storedLocation?this.storedLocation.top:this.element.getStyle("top"))}else{b+=",b:"+(this.storedLocation?this.storedLocation.bottom:this.element.getStyle("bottom"))}b+=","+(this.storedLocation?this.storedLocation.width:this.width);b+=","+(this.storedLocation?this.storedLocation.height:this.height);b+=","+this.isMinimized();b+=","+this.isMaximized();WindowUtilities.setCookie(b,this.cookie)}},_createWiredElement:function(){if(!this.wiredElement){if(Prototype.Browser.IE){this._getWindowBorderSize()}var d=document.createElement("div");d.className="wired_frame "+this.options.className+"_wired_frame";d.style.position="absolute";this.options.parent.insertBefore(d,this.options.parent.firstChild);this.wiredElement=$(d)}if(this.useLeft){this.wiredElement.setStyle({left:this.element.getStyle("left")})}else{this.wiredElement.setStyle({right:this.element.getStyle("right")})}if(this.useTop){this.wiredElement.setStyle({top:this.element.getStyle("top")})}else{this.wiredElement.setStyle({bottom:this.element.getStyle("bottom")})}var b=this.element.getDimensions();this.wiredElement.setStyle({width:b.width+"px",height:b.height+"px"});this.wiredElement.setStyle({zIndex:Windows.maxZIndex+30});return this.wiredElement},_hideWiredElement:function(){if(!this.wiredElement||!this.currentDrag){return}if(this.currentDrag==this.element){this.currentDrag=null}else{if(this.useLeft){this.element.setStyle({left:this.currentDrag.getStyle("left")})}else{this.element.setStyle({right:this.currentDrag.getStyle("right")})}if(this.useTop){this.element.setStyle({top:this.currentDrag.getStyle("top")})}else{this.element.setStyle({bottom:this.currentDrag.getStyle("bottom")})}this.currentDrag.hide();this.currentDrag=null;if(this.doResize){this.setSize(this.width,this.height)}}},_notify:function(b){if(this.options[b]){this.options[b](this)}else{Windows.notify(b,this)}}};var Windows={windows:[],modalWindows:[],observers:[],focusedWindow:null,maxZIndex:0,overlayShowEffectOptions:{duration:0.5},overlayHideEffectOptions:{duration:0.5},addObserver:function(b){this.removeObserver(b);this.observers.push(b)},removeObserver:function(b){this.observers=this.observers.reject(function(d){return d==b})},notify:function(b,d){this.observers.each(function(e){if(e[b]){e[b](b,d)}})},getWindow:function(b){return this.windows.detect(function(e){return e.getId()==b})},getFocusedWindow:function(){return this.focusedWindow},updateFocusedWindow:function(){this.focusedWindow=this.windows.length>=2?this.windows[this.windows.length-2]:null},register:function(b){this.windows.push(b)},addModalWindow:function(b){if(this.modalWindows.length==0){WindowUtilities.disableScreen(b.options.className,"overlay_modal",b.overlayOpacity,b.getId(),b.options.parent)}else{if(Window.keepMultiModalWindow){$("overlay_modal").style.zIndex=Windows.maxZIndex+1;Windows.maxZIndex+=1;WindowUtilities._hideSelect(this.modalWindows.last().getId())}else{this.modalWindows.last().element.hide()}WindowUtilities._showSelect(b.getId())}this.modalWindows.push(b)},removeModalWindow:function(b){this.modalWindows.pop();if(this.modalWindows.length==0){WindowUtilities.enableScreen()}else{if(Window.keepMultiModalWindow){this.modalWindows.last().toFront();WindowUtilities._showSelect(this.modalWindows.last().getId())}else{this.modalWindows.last().element.show()}}},register:function(b){this.windows.push(b)},unregister:function(b){this.windows=this.windows.reject(function(e){return e==b})},closeAll:function(){this.windows.each(function(b){Windows.close(b.getId())})},closeAllModalWindows:function(){WindowUtilities.enableScreen();this.modalWindows.each(function(b){if(b){b.close()}})},minimize:function(e,b){var d=this.getWindow(e);if(d&&d.visible){d.minimize()}Event.stop(b)},maximize:function(e,b){var d=this.getWindow(e);if(d&&d.visible){d.maximize()}Event.stop(b)},close:function(e,b){var d=this.getWindow(e);if(d){d.close()}if(b){Event.stop(b)}},blur:function(d){var b=this.getWindow(d);if(!b){return}if(b.options.blurClassName){b.changeClassName(b.options.blurClassName)}if(this.focusedWindow==b){this.focusedWindow=null}b._notify("onBlur")},focus:function(d){var b=this.getWindow(d);if(!b){return}if(this.focusedWindow){this.blur(this.focusedWindow.getId())}if(b.options.focusClassName){b.changeClassName(b.options.focusClassName)}this.focusedWindow=b;b._notify("onFocus")},unsetOverflow:function(b){this.windows.each(function(e){e.oldOverflow=e.getContent().getStyle("overflow")||"auto";e.getContent().setStyle({overflow:"hidden"})});if(b&&b.oldOverflow){b.getContent().setStyle({overflow:b.oldOverflow})}},resetOverflow:function(){this.windows.each(function(b){if(b.oldOverflow){b.getContent().setStyle({overflow:b.oldOverflow})}})},updateZindex:function(b,d){if(b>this.maxZIndex){this.maxZIndex=b;if(this.focusedWindow){this.blur(this.focusedWindow.getId())}}this.focusedWindow=d;if(this.focusedWindow){this.focus(this.focusedWindow.getId())}}};var Dialog={dialogId:null,onCompleteFunc:null,callFunc:null,parameters:null,confirm:function(f,e){if(f&&typeof f!="string"){Dialog._runAjaxRequest(f,e,Dialog.confirm);return}f=f||"";e=e||{};var h=e.okLabel?e.okLabel:"Ok";var b=e.cancelLabel?e.cancelLabel:"Cancel";e=Object.extend(e,e.windowParameters||{});e.windowParameters=e.windowParameters||{};e.className=e.className||"alert";var d="class ='"+(e.buttonClass?e.buttonClass+" ":"")+" ok_button'";var g="class ='"+(e.buttonClass?e.buttonClass+" ":"")+" cancel_button'";var f=" <div class='"+e.className+"_message'>"+f+"</div> <div class='"+e.className+"_buttons'> <button type='button' title='"+h+"' onclick='Dialog.okCallback()' "+d+"><span><span><span>"+h+"</span></span></span></button> <button type='button' title='"+b+"' onclick='Dialog.cancelCallback()' "+g+"><span><span><span>"+b+"</span></span></span></button> </div> ";return this._openDialog(f,e)},alert:function(e,d){if(e&&typeof e!="string"){Dialog._runAjaxRequest(e,d,Dialog.alert);return}e=e||"";d=d||{};var f=d.okLabel?d.okLabel:"Ok";d=Object.extend(d,d.windowParameters||{});d.windowParameters=d.windowParameters||{};d.className=d.className||"alert";var b="class ='"+(d.buttonClass?d.buttonClass+" ":"")+" ok_button'";var e=" <div class='"+d.className+"_message'>"+e+"</div> <div class='"+d.className+"_buttons'> <button type='button' title='"+f+"' onclick='Dialog.okCallback()' "+b+"><span><span><span>"+f+"</span></span></span></button> </div>";return this._openDialog(e,d)},info:function(d,b){if(d&&typeof d!="string"){Dialog._runAjaxRequest(d,b,Dialog.info);return}d=d||"";b=b||{};b=Object.extend(b,b.windowParameters||{});b.windowParameters=b.windowParameters||{};b.className=b.className||"alert";var d="<div id='modal_dialog_message' class='"+b.className+"_message'>"+d+"</div>";if(b.showProgress){d+="<div id='modal_dialog_progress' class='"+b.className+"_progress'> </div>"}b.ok=null;b.cancel=null;return this._openDialog(d,b)},setInfoMessage:function(b){$("modal_dialog_message").update(b)},closeInfo:function(){Windows.close(this.dialogId)},_openDialog:function(g,f){var e=f.className;if(!f.height&&!f.width){f.width=WindowUtilities.getPageSize(f.options.parent||document.body).pageWidth/2}if(f.id){this.dialogId=f.id}else{var d=new Date();this.dialogId="modal_dialog_"+d.getTime();f.id=this.dialogId}if(!f.height||!f.width){var b=WindowUtilities._computeSize(g,this.dialogId,f.width,f.height,5,e);if(f.height){f.width=b+5}else{f.height=b+5}}f.effectOptions=f.effectOptions;f.resizable=f.resizable||false;f.minimizable=f.minimizable||false;f.maximizable=f.maximizable||false;f.draggable=f.draggable||false;f.closable=f.closable||false;var h=new Window(f);h.getContent().innerHTML=g;h.showCenter(true,f.top,f.left);h.setDestroyOnClose();h.cancelCallback=f.onCancel||f.cancel;h.okCallback=f.onOk||f.ok;return h},_getAjaxContent:function(b){Dialog.callFunc(b.responseText,Dialog.parameters)},_runAjaxRequest:function(e,d,b){if(e.options==null){e.options={}}Dialog.onCompleteFunc=e.options.onComplete;Dialog.parameters=d;Dialog.callFunc=b;e.options.onComplete=Dialog._getAjaxContent;new Ajax.Request(e.url,e.options)},okCallback:function(){var b=Windows.focusedWindow;if(!b.okCallback||b.okCallback(b)){$$("#"+b.getId()+" input").each(function(d){d.onclick=null});b.close()}},cancelCallback:function(){var b=Windows.focusedWindow;$$("#"+b.getId()+" input").each(function(d){d.onclick=null});b.close();if(b.cancelCallback){b.cancelCallback(b)}}};if(Prototype.Browser.WebKit){var array=navigator.userAgent.match(new RegExp(/AppleWebKit\/([\d\.\+]*)/));Prototype.Browser.WebKitVersion=parseFloat(array[1])}var WindowUtilities={getWindowScroll:function(parent){var T,L,W,H;parent=parent||document.body;if(parent!=document.body){T=parent.scrollTop;L=parent.scrollLeft;W=parent.scrollWidth;H=parent.scrollHeight}else{var w=window;with(w.document){if(w.document.documentElement&&documentElement.scrollTop){T=documentElement.scrollTop;L=documentElement.scrollLeft}else{if(w.document.body){T=body.scrollTop;L=body.scrollLeft}}if(w.innerWidth){W=w.innerWidth;H=w.innerHeight}else{if(w.document.documentElement&&documentElement.clientWidth){W=documentElement.clientWidth;H=documentElement.clientHeight}else{W=body.offsetWidth;H=body.offsetHeight}}}}return{top:T,left:L,width:W,height:H}},getPageSize:function(f){f=f||document.body;var e,l;var g,d;if(f!=document.body){e=f.getWidth();l=f.getHeight();d=f.scrollWidth;g=f.scrollHeight}else{var h,b;if(window.innerHeight&&window.scrollMaxY){h=document.body.scrollWidth;b=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){h=document.body.scrollWidth;b=document.body.scrollHeight}else{h=document.body.offsetWidth;b=document.body.offsetHeight}}if(self.innerHeight){e=document.documentElement.clientWidth;l=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){e=document.documentElement.clientWidth;l=document.documentElement.clientHeight}else{if(document.body){e=document.body.clientWidth;l=document.body.clientHeight}}}if(b<l){g=l}else{g=b}if(h<e){d=e}else{d=h}}return{pageWidth:d,pageHeight:g,windowWidth:e,windowHeight:l}},disableScreen:function(e,b,f,g,d){WindowUtilities.initLightbox(b,e,function(){this._disableScreen(e,b,f,g)}.bind(this),d||document.body)},_disableScreen:function(e,d,g,h){var f=$(d);var b=WindowUtilities.getPageSize(f.parentNode);if(h&&Prototype.Browser.IE){WindowUtilities._hideSelect();WindowUtilities._showSelect(h)}f.style.height=(b.pageHeight+"px");f.style.display="none";if(d=="overlay_modal"&&Window.hasEffectLib&&Windows.overlayShowEffectOptions){f.overlayOpacity=g;new Effect.Appear(f,Object.extend({from:0,to:g},Windows.overlayShowEffectOptions))}else{f.style.display="block"}},enableScreen:function(d){d=d||"overlay_modal";var b=$(d);if(b){if(d=="overlay_modal"&&Window.hasEffectLib&&Windows.overlayHideEffectOptions){new Effect.Fade(b,Object.extend({from:b.overlayOpacity,to:0},Windows.overlayHideEffectOptions))}else{b.style.display="none";b.parentNode.removeChild(b)}if(d!="__invisible__"){WindowUtilities._showSelect()}}},_hideSelect:function(b){if(Prototype.Browser.IE){b=b==null?"":"#"+b+" ";$$(b+"select").each(function(d){if(!WindowUtilities.isDefined(d.oldVisibility)){d.oldVisibility=d.style.visibility?d.style.visibility:"visible";d.style.visibility="hidden"}})}},_showSelect:function(b){if(Prototype.Browser.IE){b=b==null?"":"#"+b+" ";$$(b+"select").each(function(d){if(WindowUtilities.isDefined(d.oldVisibility)){try{d.style.visibility=d.oldVisibility}catch(f){d.style.visibility="visible"}d.oldVisibility=null}else{if(d.style.visibility){d.style.visibility="visible"}}})}},isDefined:function(b){return typeof(b)!="undefined"&&b!=null},initLightbox:function(g,e,b,d){if($(g)){Element.setStyle(g,{zIndex:Windows.maxZIndex+1});Windows.maxZIndex++;b()}else{var f=document.createElement("div");f.setAttribute("id",g);f.className="overlay_"+e;f.style.display="none";f.style.position="absolute";f.style.top="0";f.style.left="0";f.style.zIndex=Windows.maxZIndex+1;Windows.maxZIndex++;f.style.width="100%";d.insertBefore(f,d.firstChild);if(Prototype.Browser.WebKit&&g=="overlay_modal"){setTimeout(function(){b()},10)}else{b()}}},setCookie:function(d,b){document.cookie=b[0]+"="+escape(d)+((b[1])?"; expires="+b[1].toUTCString():"")+((b[2])?"; path="+b[2]:"")+((b[3])?"; domain="+b[3]:"")+((b[4])?"; secure":"")},getCookie:function(e){var d=document.cookie;var g=e+"=";var f=d.indexOf("; "+g);if(f==-1){f=d.indexOf(g);if(f!=0){return null}}else{f+=2}var b=document.cookie.indexOf(";",f);if(b==-1){b=d.length}return unescape(d.substring(f+g.length,b))},_computeSize:function(g,b,d,l,f,h){var o=document.body;var e=document.createElement("div");e.setAttribute("id",b);e.className=h+"_content";if(l){e.style.height=l+"px"}else{e.style.width=d+"px"}e.style.position="absolute";e.style.top="0";e.style.left="0";e.style.display="none";e.innerHTML=g;o.insertBefore(e,o.firstChild);var n;if(l){n=$(e).getDimensions().width+f}else{n=$(e).getDimensions().height+f}o.removeChild(e);return n}};var Builder={NODEMAP:{AREA:"map",CAPTION:"table",COL:"table",COLGROUP:"table",LEGEND:"fieldset",OPTGROUP:"select",OPTION:"select",PARAM:"object",TBODY:"table",TD:"table",TFOOT:"table",TH:"table",THEAD:"table",TR:"table"},node:function(b){b=b.toUpperCase();var l=this.NODEMAP[b]||"div";var d=document.createElement(l);try{d.innerHTML="<"+b+"></"+b+">"}catch(h){}var g=d.firstChild||null;if(g&&(g.tagName.toUpperCase()!=b)){g=g.getElementsByTagName(b)[0]}if(!g){g=document.createElement(b)}if(!g){return}if(arguments[1]){if(this._isStringOrNumber(arguments[1])||(arguments[1] instanceof Array)||arguments[1].tagName){this._children(g,arguments[1])}else{var f=this._attributes(arguments[1]);if(f.length){try{d.innerHTML="<"+b+" "+f+"></"+b+">"}catch(h){}g=d.firstChild||null;if(!g){g=document.createElement(b);for(attr in arguments[1]){g[attr=="class"?"className":attr]=arguments[1][attr]}}if(g.tagName.toUpperCase()!=b){g=d.getElementsByTagName(b)[0]}}}}if(arguments[2]){this._children(g,arguments[2])}return $(g)},_text:function(b){return document.createTextNode(b)},ATTR_MAP:{className:"class",htmlFor:"for"},_attributes:function(b){var d=[];for(attribute in b){d.push((attribute in this.ATTR_MAP?this.ATTR_MAP[attribute]:attribute)+'="'+b[attribute].toString().escapeHTML().gsub(/"/,""")+'"')}return d.join(" ")},_children:function(d,b){if(b.tagName){d.appendChild(b);return}if(typeof b=="object"){b.flatten().each(function(f){if(typeof f=="object"){d.appendChild(f)}else{if(Builder._isStringOrNumber(f)){d.appendChild(Builder._text(f))}}})}else{if(Builder._isStringOrNumber(b)){d.appendChild(Builder._text(b))}}},_isStringOrNumber:function(b){return(typeof b=="string"||typeof b=="number")},build:function(d){var b=this.node("div");$(b).update(d.strip());return b.down()},dump:function(d){if(typeof d!="object"&&typeof d!="function"){d=window}var b=("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/);b.each(function(e){d[e]=function(){return Builder.node.apply(Builder,[e].concat($A(arguments)))}})}};String.prototype.parseColor=function(){var b="#";if(this.slice(0,4)=="rgb("){var e=this.slice(4,this.length-1).split(",");var d=0;do{b+=parseInt(e[d]).toColorPart()}while(++d<3)}else{if(this.slice(0,1)=="#"){if(this.length==4){for(var d=1;d<4;d++){b+=(this.charAt(d)+this.charAt(d)).toLowerCase()}}if(this.length==7){b=this.toLowerCase()}}}return(b.length==7?b:(arguments[0]||this))};Element.collectTextNodes=function(b){return $A($(b).childNodes).collect(function(d){return(d.nodeType==3?d.nodeValue:(d.hasChildNodes()?Element.collectTextNodes(d):""))}).flatten().join("")};Element.collectTextNodesIgnoreClass=function(b,d){return $A($(b).childNodes).collect(function(e){return(e.nodeType==3?e.nodeValue:((e.hasChildNodes()&&!Element.hasClassName(e,d))?Element.collectTextNodesIgnoreClass(e,d):""))}).flatten().join("")};Element.setContentZoom=function(b,d){b=$(b);b.setStyle({fontSize:(d/100)+"em"});if(Prototype.Browser.WebKit){window.scrollBy(0,0)}return b};Element.getInlineOpacity=function(b){return $(b).style.opacity||""};Element.forceRerendering=function(b){try{b=$(b);var f=document.createTextNode(" ");b.appendChild(f);b.removeChild(f)}catch(d){}};var Effect={_elementDoesNotExistError:{name:"ElementDoesNotExistError",message:"The specified DOM element does not exist, but is required for this effect to operate"},Transitions:{linear:Prototype.K,sinoidal:function(b){return(-Math.cos(b*Math.PI)/2)+0.5},reverse:function(b){return 1-b},flicker:function(b){var b=((-Math.cos(b*Math.PI)/4)+0.75)+Math.random()/4;return b>1?1:b},wobble:function(b){return(-Math.cos(b*Math.PI*(9*b))/2)+0.5},pulse:function(d,b){return(-Math.cos((d*((b||5)-0.5)*2)*Math.PI)/2)+0.5},spring:function(b){return 1-(Math.cos(b*4.5*Math.PI)*Math.exp(-b*6))},none:function(b){return 0},full:function(b){return 1}},DefaultOptions:{duration:1,fps:100,sync:false,from:0,to:1,delay:0,queue:"parallel"},tagifyText:function(b){var d="position:relative";if(Prototype.Browser.IE){d+=";zoom:1"}b=$(b);$A(b.childNodes).each(function(e){if(e.nodeType==3){e.nodeValue.toArray().each(function(f){b.insertBefore(new Element("span",{style:d}).update(f==" "?String.fromCharCode(160):f),e)});Element.remove(e)}})},multiple:function(d,e){var g;if(((typeof d=="object")||Object.isFunction(d))&&(d.length)){g=d}else{g=$(d).childNodes}var b=Object.extend({speed:0.1,delay:0},arguments[2]||{});var f=b.delay;$A(g).each(function(l,h){new e(l,Object.extend(b,{delay:h*b.speed+f}))})},PAIRS:{slide:["SlideDown","SlideUp"],blind:["BlindDown","BlindUp"],appear:["Appear","Fade"]},toggle:function(d,e,b){d=$(d);e=(e||"appear").toLowerCase();return Effect[Effect.PAIRS[e][d.visible()?1:0]](d,Object.extend({queue:{position:"end",scope:(d.id||"global"),limit:1}},b||{}))}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];this.interval=null},_each:function(b){this.effects._each(b)},add:function(d){var e=new Date().getTime();var b=Object.isString(d.options.queue)?d.options.queue:d.options.queue.position;switch(b){case"front":this.effects.findAll(function(f){return f.state=="idle"}).each(function(f){f.startOn+=d.finishOn;f.finishOn+=d.finishOn});break;case"with-last":e=this.effects.pluck("startOn").max()||e;break;case"end":e=this.effects.pluck("finishOn").max()||e;break}d.startOn+=e;d.finishOn+=e;if(!d.options.queue.limit||(this.effects.length<d.options.queue.limit)){this.effects.push(d)}if(!this.interval){this.interval=setInterval(this.loop.bind(this),15)}},remove:function(b){this.effects=this.effects.reject(function(d){return d==b});if(this.effects.length==0){clearInterval(this.interval);this.interval=null}},loop:function(){var e=new Date().getTime();for(var d=0,b=this.effects.length;d<b;d++){this.effects[d]&&this.effects[d].loop(e)}}});Effect.Queues={instances:$H(),get:function(b){if(!Object.isString(b)){return b}return this.instances.get(b)||this.instances.set(b,new Effect.ScopedQueue())}};Effect.Queue=Effect.Queues.get("global");Effect.Base=Class.create({position:null,start:function(b){if(b&&b.transition===false){b.transition=Effect.Transitions.linear}this.options=Object.extend(Object.extend({},Effect.DefaultOptions),b||{});this.currentFrame=0;this.state="idle";this.startOn=this.options.delay*1000;this.finishOn=this.startOn+(this.options.duration*1000);this.fromToDelta=this.options.to-this.options.from;this.totalTime=this.finishOn-this.startOn;this.totalFrames=this.options.fps*this.options.duration;this.render=(function(){function d(f,e){if(f.options[e+"Internal"]){f.options[e+"Internal"](f)}if(f.options[e]){f.options[e](f)}}return function(e){if(this.state==="idle"){this.state="running";d(this,"beforeSetup");if(this.setup){this.setup()}d(this,"afterSetup")}if(this.state==="running"){e=(this.options.transition(e)*this.fromToDelta)+this.options.from;this.position=e;d(this,"beforeUpdate");if(this.update){this.update(e)}d(this,"afterUpdate")}}})();this.event("beforeStart");if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).add(this)}},loop:function(e){if(e>=this.startOn){if(e>=this.finishOn){this.render(1);this.cancel();this.event("beforeFinish");if(this.finish){this.finish()}this.event("afterFinish");return}var d=(e-this.startOn)/this.totalTime,b=(d*this.totalFrames).round();if(b>this.currentFrame){this.render(d);this.currentFrame=b}}},cancel:function(){if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).remove(this)}this.state="finished"},event:function(b){if(this.options[b+"Internal"]){this.options[b+"Internal"](this)}if(this.options[b]){this.options[b](this)}},inspect:function(){var b=$H();for(property in this){if(!Object.isFunction(this[property])){b.set(property,this[property])}}return"#<Effect:"+b.inspect()+",options:"+$H(this.options).inspect()+">"}});Effect.Parallel=Class.create(Effect.Base,{initialize:function(b){this.effects=b||[];this.start(arguments[1])},update:function(b){this.effects.invoke("render",b)},finish:function(b){this.effects.each(function(d){d.render(1);d.cancel();d.event("beforeFinish");if(d.finish){d.finish(b)}d.event("afterFinish")})}});Effect.Tween=Class.create(Effect.Base,{initialize:function(e,h,g){e=Object.isString(e)?$(e):e;var d=$A(arguments),f=d.last(),b=d.length==5?d[3]:null;this.method=Object.isFunction(f)?f.bind(e):Object.isFunction(e[f])?e[f].bind(e):function(l){e[f]=l};this.start(Object.extend({from:h,to:g},b||{}))},update:function(b){this.method(b)}});Effect.Event=Class.create(Effect.Base,{initialize:function(){this.start(Object.extend({duration:0},arguments[0]||{}))},update:Prototype.emptyFunction});Effect.Opacity=Class.create(Effect.Base,{initialize:function(d){this.element=$(d);if(!this.element){throw (Effect._elementDoesNotExistError)}if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}var b=Object.extend({from:this.element.getOpacity()||0,to:1},arguments[1]||{});this.start(b)},update:function(b){this.element.setOpacity(b)}});Effect.Move=Class.create(Effect.Base,{initialize:function(d){this.element=$(d);if(!this.element){throw (Effect._elementDoesNotExistError)}var b=Object.extend({x:0,y:0,mode:"relative"},arguments[1]||{});this.start(b)},setup:function(){this.element.makePositioned();this.originalLeft=parseFloat(this.element.getStyle("left")||"0");this.originalTop=parseFloat(this.element.getStyle("top")||"0");if(this.options.mode=="absolute"){this.options.x=this.options.x-this.originalLeft;this.options.y=this.options.y-this.originalTop}},update:function(b){this.element.setStyle({left:(this.options.x*b+this.originalLeft).round()+"px",top:(this.options.y*b+this.originalTop).round()+"px"})}});Effect.MoveBy=function(d,b,e){return new Effect.Move(d,Object.extend({x:e,y:b},arguments[3]||{}))};Effect.Scale=Class.create(Effect.Base,{initialize:function(d,e){this.element=$(d);if(!this.element){throw (Effect._elementDoesNotExistError)}var b=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:e},arguments[2]||{});this.start(b)},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle("position");this.originalStyle={};["top","left","width","height","fontSize"].each(function(d){this.originalStyle[d]=this.element.style[d]}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var b=this.element.getStyle("font-size")||"100%";["em","px","%","pt"].each(function(d){if(b.indexOf(d)>0){this.fontSize=parseFloat(b);this.fontSizeType=d}}.bind(this));this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=="box"){this.dims=[this.element.offsetHeight,this.element.offsetWidth]}if(/^content/.test(this.options.scaleMode)){this.dims=[this.element.scrollHeight,this.element.scrollWidth]}if(!this.dims){this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth]}},update:function(b){var d=(this.options.scaleFrom/100)+(this.factor*b);if(this.options.scaleContent&&this.fontSize){this.element.setStyle({fontSize:this.fontSize*d+this.fontSizeType})}this.setDimensions(this.dims[0]*d,this.dims[1]*d)},finish:function(b){if(this.restoreAfterFinish){this.element.setStyle(this.originalStyle)}},setDimensions:function(b,g){var h={};if(this.options.scaleX){h.width=g.round()+"px"}if(this.options.scaleY){h.height=b.round()+"px"}if(this.options.scaleFromCenter){var f=(b-this.dims[0])/2;var e=(g-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY){h.top=this.originalTop-f+"px"}if(this.options.scaleX){h.left=this.originalLeft-e+"px"}}else{if(this.options.scaleY){h.top=-f+"px"}if(this.options.scaleX){h.left=-e+"px"}}}this.element.setStyle(h)}});Effect.Highlight=Class.create(Effect.Base,{initialize:function(d){this.element=$(d);if(!this.element){throw (Effect._elementDoesNotExistError)}var b=Object.extend({startcolor:"#ffff99"},arguments[1]||{});this.start(b)},setup:function(){if(this.element.getStyle("display")=="none"){this.cancel();return}this.oldStyle={};if(!this.options.keepBackgroundImage){this.oldStyle.backgroundImage=this.element.getStyle("background-image");this.element.setStyle({backgroundImage:"none"})}if(!this.options.endcolor){this.options.endcolor=this.element.getStyle("background-color").parseColor("#ffffff")}if(!this.options.restorecolor){this.options.restorecolor=this.element.getStyle("background-color")}this._base=$R(0,2).map(function(b){return parseInt(this.options.startcolor.slice(b*2+1,b*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(b){return parseInt(this.options.endcolor.slice(b*2+1,b*2+3),16)-this._base[b]}.bind(this))},update:function(b){this.element.setStyle({backgroundColor:$R(0,2).inject("#",function(d,e,f){return d+((this._base[f]+(this._delta[f]*b)).round().toColorPart())}.bind(this))})},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}))}});Effect.ScrollTo=function(e){var d=arguments[1]||{},b=document.viewport.getScrollOffsets(),f=$(e).cumulativeOffset();if(d.offset){f[1]+=d.offset}return new Effect.Tween(null,b.top,f[1],d,function(g){scrollTo(b.left,g.round())})};Effect.Fade=function(e){e=$(e);var b=e.getInlineOpacity();var d=Object.extend({from:e.getOpacity()||1,to:0,afterFinishInternal:function(f){if(f.options.to!=0){return}f.element.hide().setStyle({opacity:b})}},arguments[1]||{});return new Effect.Opacity(e,d)};Effect.Appear=function(d){d=$(d);var b=Object.extend({from:(d.getStyle("display")=="none"?0:d.getOpacity()||0),to:1,afterFinishInternal:function(e){e.element.forceRerendering()},beforeSetup:function(e){e.element.setOpacity(e.options.from).show()}},arguments[1]||{});return new Effect.Opacity(d,b)};Effect.Puff=function(d){d=$(d);var b={opacity:d.getInlineOpacity(),position:d.getStyle("position"),top:d.style.top,left:d.style.left,width:d.style.width,height:d.style.height};return new Effect.Parallel([new Effect.Scale(d,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(d,{sync:true,to:0})],Object.extend({duration:1,beforeSetupInternal:function(e){Position.absolutize(e.effects[0].element)},afterFinishInternal:function(e){e.effects[0].element.hide().setStyle(b)}},arguments[1]||{}))};Effect.BlindUp=function(b){b=$(b);b.makeClipping();return new Effect.Scale(b,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(d){d.element.hide().undoClipping()}},arguments[1]||{}))};Effect.BlindDown=function(d){d=$(d);var b=d.getDimensions();return new Effect.Scale(d,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:b.height,originalWidth:b.width},restoreAfterFinish:true,afterSetup:function(e){e.element.makeClipping().setStyle({height:"0px"}).show()},afterFinishInternal:function(e){e.element.undoClipping()}},arguments[1]||{}))};Effect.SwitchOff=function(d){d=$(d);var b=d.getInlineOpacity();return new Effect.Appear(d,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(e){new Effect.Scale(e.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(f){f.element.makePositioned().makeClipping()},afterFinishInternal:function(f){f.element.hide().undoClipping().undoPositioned().setStyle({opacity:b})}})}},arguments[1]||{}))};Effect.DropOut=function(d){d=$(d);var b={top:d.getStyle("top"),left:d.getStyle("left"),opacity:d.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(d,{x:0,y:100,sync:true}),new Effect.Opacity(d,{sync:true,to:0})],Object.extend({duration:0.5,beforeSetup:function(e){e.effects[0].element.makePositioned()},afterFinishInternal:function(e){e.effects[0].element.hide().undoPositioned().setStyle(b)}},arguments[1]||{}))};Effect.Shake=function(f){f=$(f);var d=Object.extend({distance:20,duration:0.5},arguments[1]||{});var g=parseFloat(d.distance);var e=parseFloat(d.duration)/10;var b={top:f.getStyle("top"),left:f.getStyle("left")};return new Effect.Move(f,{x:g,y:0,duration:e,afterFinishInternal:function(h){new Effect.Move(h.element,{x:-g*2,y:0,duration:e*2,afterFinishInternal:function(l){new Effect.Move(l.element,{x:g*2,y:0,duration:e*2,afterFinishInternal:function(n){new Effect.Move(n.element,{x:-g*2,y:0,duration:e*2,afterFinishInternal:function(o){new Effect.Move(o.element,{x:g*2,y:0,duration:e*2,afterFinishInternal:function(p){new Effect.Move(p.element,{x:-g,y:0,duration:e,afterFinishInternal:function(q){q.element.undoPositioned().setStyle(b)}})}})}})}})}})}})};Effect.SlideDown=function(e){e=$(e).cleanWhitespace();var b=e.down().getStyle("bottom");var d=e.getDimensions();return new Effect.Scale(e,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:d.height,originalWidth:d.width},restoreAfterFinish:true,afterSetup:function(f){f.element.makePositioned();f.element.down().makePositioned();if(window.opera){f.element.setStyle({top:""})}f.element.makeClipping().setStyle({height:"0px"}).show()},afterUpdateInternal:function(f){f.element.down().setStyle({bottom:(f.dims[0]-f.element.clientHeight)+"px"})},afterFinishInternal:function(f){f.element.undoClipping().undoPositioned();f.element.down().undoPositioned().setStyle({bottom:b})}},arguments[1]||{}))};Effect.SlideUp=function(e){e=$(e).cleanWhitespace();var b=e.down().getStyle("bottom");var d=e.getDimensions();return new Effect.Scale(e,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,scaleMode:{originalHeight:d.height,originalWidth:d.width},restoreAfterFinish:true,afterSetup:function(f){f.element.makePositioned();f.element.down().makePositioned();if(window.opera){f.element.setStyle({top:""})}f.element.makeClipping().show()},afterUpdateInternal:function(f){f.element.down().setStyle({bottom:(f.dims[0]-f.element.clientHeight)+"px"})},afterFinishInternal:function(f){f.element.hide().undoClipping().undoPositioned();f.element.down().undoPositioned().setStyle({bottom:b})}},arguments[1]||{}))};Effect.Squish=function(b){return new Effect.Scale(b,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(d){d.element.makeClipping()},afterFinishInternal:function(d){d.element.hide().undoClipping()}})};Effect.Grow=function(e){e=$(e);var d=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var b={top:e.style.top,left:e.style.left,height:e.style.height,width:e.style.width,opacity:e.getInlineOpacity()};var l=e.getDimensions();var n,h;var g,f;switch(d.direction){case"top-left":n=h=g=f=0;break;case"top-right":n=l.width;h=f=0;g=-l.width;break;case"bottom-left":n=g=0;h=l.height;f=-l.height;break;case"bottom-right":n=l.width;h=l.height;g=-l.width;f=-l.height;break;case"center":n=l.width/2;h=l.height/2;g=-l.width/2;f=-l.height/2;break}return new Effect.Move(e,{x:n,y:h,duration:0.01,beforeSetup:function(o){o.element.hide().makeClipping().makePositioned()},afterFinishInternal:function(o){new Effect.Parallel([new Effect.Opacity(o.element,{sync:true,to:1,from:0,transition:d.opacityTransition}),new Effect.Move(o.element,{x:g,y:f,sync:true,transition:d.moveTransition}),new Effect.Scale(o.element,100,{scaleMode:{originalHeight:l.height,originalWidth:l.width},sync:true,scaleFrom:window.opera?1:0,transition:d.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(p){p.effects[0].element.setStyle({height:"0px"}).show()},afterFinishInternal:function(p){p.effects[0].element.undoClipping().undoPositioned().setStyle(b)}},d))}})};Effect.Shrink=function(e){e=$(e);var d=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var b={top:e.style.top,left:e.style.left,height:e.style.height,width:e.style.width,opacity:e.getInlineOpacity()};var h=e.getDimensions();var g,f;switch(d.direction){case"top-left":g=f=0;break;case"top-right":g=h.width;f=0;break;case"bottom-left":g=0;f=h.height;break;case"bottom-right":g=h.width;f=h.height;break;case"center":g=h.width/2;f=h.height/2;break}return new Effect.Parallel([new Effect.Opacity(e,{sync:true,to:0,from:1,transition:d.opacityTransition}),new Effect.Scale(e,window.opera?1:0,{sync:true,transition:d.scaleTransition,restoreAfterFinish:true}),new Effect.Move(e,{x:g,y:f,sync:true,transition:d.moveTransition})],Object.extend({beforeStartInternal:function(l){l.effects[0].element.makePositioned().makeClipping()},afterFinishInternal:function(l){l.effects[0].element.hide().undoClipping().undoPositioned().setStyle(b)}},d))};Effect.Pulsate=function(e){e=$(e);var d=arguments[1]||{},b=e.getInlineOpacity(),g=d.transition||Effect.Transitions.linear,f=function(h){return 1-g((-Math.cos((h*(d.pulses||5)*2)*Math.PI)/2)+0.5)};return new Effect.Opacity(e,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(h){h.element.setStyle({opacity:b})}},d),{transition:f}))};Effect.Fold=function(d){d=$(d);var b={top:d.style.top,left:d.style.left,width:d.style.width,height:d.style.height};d.makeClipping();return new Effect.Scale(d,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(e){new Effect.Scale(d,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(f){f.element.hide().undoClipping().setStyle(b)}})}},arguments[1]||{}))};Effect.Morph=Class.create(Effect.Base,{initialize:function(e){this.element=$(e);if(!this.element){throw (Effect._elementDoesNotExistError)}var b=Object.extend({style:{}},arguments[1]||{});if(!Object.isString(b.style)){this.style=$H(b.style)}else{if(b.style.include(":")){this.style=b.style.parseStyle()}else{this.element.addClassName(b.style);this.style=$H(this.element.getStyles());this.element.removeClassName(b.style);var d=this.element.getStyles();this.style=this.style.reject(function(f){return f.value==d[f.key]});b.afterFinishInternal=function(f){f.element.addClassName(f.options.style);f.transforms.each(function(g){f.element.style[g.style]=""})}}}this.start(b)},setup:function(){function b(d){if(!d||["rgba(0, 0, 0, 0)","transparent"].include(d)){d="#ffffff"}d=d.parseColor();return $R(0,2).map(function(e){return parseInt(d.slice(e*2+1,e*2+3),16)})}this.transforms=this.style.map(function(l){var h=l[0],g=l[1],f=null;if(g.parseColor("#zzzzzz")!="#zzzzzz"){g=g.parseColor();f="color"}else{if(h=="opacity"){g=parseFloat(g);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}}else{if(Element.CSS_LENGTH.test(g)){var e=g.match(/^([\+\-]?[0-9\.]+)(.*)$/);g=parseFloat(e[1]);f=(e.length==3)?e[2]:null}}}var d=this.element.getStyle(h);return{style:h.camelize(),originalValue:f=="color"?b(d):parseFloat(d||0),targetValue:f=="color"?b(g):g,unit:f}}.bind(this)).reject(function(d){return((d.originalValue==d.targetValue)||(d.unit!="color"&&(isNaN(d.originalValue)||isNaN(d.targetValue))))})},update:function(b){var f={},d,e=this.transforms.length;while(e--){f[(d=this.transforms[e]).style]=d.unit=="color"?"#"+(Math.round(d.originalValue[0]+(d.targetValue[0]-d.originalValue[0])*b)).toColorPart()+(Math.round(d.originalValue[1]+(d.targetValue[1]-d.originalValue[1])*b)).toColorPart()+(Math.round(d.originalValue[2]+(d.targetValue[2]-d.originalValue[2])*b)).toColorPart():(d.originalValue+(d.targetValue-d.originalValue)*b).toFixed(3)+(d.unit===null?"":d.unit)}this.element.setStyle(f,true)}});Effect.Transform=Class.create({initialize:function(b){this.tracks=[];this.options=arguments[1]||{};this.addTracks(b)},addTracks:function(b){b.each(function(d){d=$H(d);var e=d.values().first();this.tracks.push($H({ids:d.keys().first(),effect:Effect.Morph,options:{style:e}}))}.bind(this));return this},play:function(){return new Effect.Parallel(this.tracks.map(function(b){var f=b.get("ids"),e=b.get("effect"),d=b.get("options");var g=[$(f)||$$(f)].flatten();return g.map(function(h){return new e(h,Object.extend({sync:true},d))})}).flatten(),this.options)}});Element.CSS_PROPERTIES=$w("backgroundColor backgroundPosition borderBottomColor borderBottomStyle borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth borderRightColor borderRightStyle borderRightWidth borderSpacing borderTopColor borderTopStyle borderTopWidth bottom clip color fontSize fontWeight height left letterSpacing lineHeight marginBottom marginLeft marginRight marginTop markerOffset maxHeight maxWidth minHeight minWidth opacity outlineColor outlineOffset outlineWidth paddingBottom paddingLeft paddingRight paddingTop right textIndent top width wordSpacing zIndex");Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;String.__parseStyleElement=document.createElement("div");String.prototype.parseStyle=function(){var d,b=$H();if(Prototype.Browser.WebKit){d=new Element("div",{style:this}).style}else{String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>';d=String.__parseStyleElement.childNodes[0].style}Element.CSS_PROPERTIES.each(function(e){if(d[e]){b.set(e,d[e])}});if(Prototype.Browser.IE&&this.include("opacity")){b.set("opacity",this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1])}return b};if(document.defaultView&&document.defaultView.getComputedStyle){Element.getStyles=function(d){var b=document.defaultView.getComputedStyle($(d),null);return Element.CSS_PROPERTIES.inject({},function(e,f){e[f]=b[f];return e})}}else{Element.getStyles=function(d){d=$(d);var b=d.currentStyle,e;e=Element.CSS_PROPERTIES.inject({},function(f,g){f[g]=b[g];return f});if(!e.opacity){e.opacity=d.getOpacity()}return e}}Effect.Methods={morph:function(b,d){b=$(b);new Effect.Morph(b,Object.extend({style:d},arguments[2]||{}));return b},visualEffect:function(e,g,d){e=$(e);var f=g.dasherize().camelize(),b=f.charAt(0).toUpperCase()+f.substring(1);new Effect[b](e,d);return e},highlight:function(d,b){d=$(d);new Effect.Highlight(d,b);return d}};$w("fade appear grow shrink fold blindUp blindDown slideUp slideDown pulsate shake puff squish switchOff dropOut").each(function(b){Effect.Methods[b]=function(e,d){e=$(e);Effect[b.charAt(0).toUpperCase()+b.substring(1)](e,d);return e}});$w("getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles").each(function(b){Effect.Methods[b]=Element[b]});Element.addMethods(Effect.Methods);function validateCreditCard(e){var d="0123456789";var b="";for(i=0;i<e.length;i++){x=e.charAt(i);if(d.indexOf(x,0)!=-1){b+=x}}j=b.length/2;k=Math.floor(j);m=Math.ceil(j)-k;c=0;for(i=0;i<k;i++){a=b.charAt(i*2+m)*2;c+=a>9?Math.floor(a/10+a%10):a}for(i=0;i<k+m;i++){c+=b.charAt(i*2+1-m)*1}return(c%10==0)}var Validator=Class.create();Validator.prototype={initialize:function(e,d,f,b){if(typeof f=="function"){this.options=$H(b);this._test=f}else{this.options=$H(f);this._test=function(){return true}}this.error=d||"Validation failed.";this.className=e},test:function(b,d){return(this._test(b,d)&&this.options.all(function(e){return Validator.methods[e.key]?Validator.methods[e.key](b,d,e.value):true}))}};Validator.methods={pattern:function(b,e,d){return Validation.get("IsEmpty").test(b)||d.test(b)},minLength:function(b,e,d){return b.length>=d},maxLength:function(b,e,d){return b.length<=d},min:function(b,e,d){return b>=parseFloat(d)},max:function(b,e,d){return b<=parseFloat(d)},notOneOf:function(b,e,d){return $A(d).all(function(f){return b!=f})},oneOf:function(b,e,d){return $A(d).any(function(f){return b==f})},is:function(b,e,d){return b==d},isNot:function(b,e,d){return b!=d},equalToField:function(b,e,d){return b==$F(d)},notEqualToField:function(b,e,d){return b!=$F(d)},include:function(b,e,d){return $A(d).all(function(f){return Validation.get(f).test(b,e)})}};var Validation=Class.create();Validation.defaultOptions={onSubmit:true,stopOnFirst:false,immediate:false,focusOnError:true,useTitles:false,addClassNameToContainer:false,containerClassName:".input-box",onFormValidate:function(b,d){},onElementValidate:function(b,d){}};Validation.prototype={initialize:function(d,b){this.form=$(d);if(!this.form){return}this.options=Object.extend({onSubmit:Validation.defaultOptions.onSubmit,stopOnFirst:Validation.defaultOptions.stopOnFirst,immediate:Validation.defaultOptions.immediate,focusOnError:Validation.defaultOptions.focusOnError,useTitles:Validation.defaultOptions.useTitles,onFormValidate:Validation.defaultOptions.onFormValidate,onElementValidate:Validation.defaultOptions.onElementValidate},b||{});if(this.options.onSubmit){Event.observe(this.form,"submit",this.onSubmit.bind(this),false)}if(this.options.immediate){Form.getElements(this.form).each(function(e){if(e.tagName.toLowerCase()=="select"){Event.observe(e,"blur",this.onChange.bindAsEventListener(this))}if(e.type.toLowerCase()=="radio"||e.type.toLowerCase()=="checkbox"){Event.observe(e,"click",this.onChange.bindAsEventListener(this))}else{Event.observe(e,"change",this.onChange.bindAsEventListener(this))}},this)}},onChange:function(b){Validation.isOnChange=true;Validation.validate(Event.element(b),{useTitle:this.options.useTitles,onElementValidate:this.options.onElementValidate});Validation.isOnChange=false},onSubmit:function(b){if(!this.validate()){Event.stop(b)}},validate:function(){var b=false;var d=this.options.useTitles;var g=this.options.onElementValidate;try{if(this.options.stopOnFirst){b=Form.getElements(this.form).all(function(e){if(e.hasClassName("local-validation")&&!this.isElementInForm(e,this.form)){return true}return Validation.validate(e,{useTitle:d,onElementValidate:g})},this)}else{b=Form.getElements(this.form).collect(function(e){if(e.hasClassName("local-validation")&&!this.isElementInForm(e,this.form)){return true}if(e.hasClassName("validation-disabled")){return true}return Validation.validate(e,{useTitle:d,onElementValidate:g})},this).all()}}catch(f){}if(!b&&this.options.focusOnError){try{Form.getElements(this.form).findAll(function(e){return $(e).hasClassName("validation-failed")}).first().focus()}catch(f){}}this.options.onFormValidate(b,this.form);return b},reset:function(){Form.getElements(this.form).each(Validation.reset)},isElementInForm:function(e,d){var b=e.up("form");if(b==d){return true}return false}};Object.extend(Validation,{validate:function(e,b){b=Object.extend({useTitle:false,onElementValidate:function(f,g){}},b||{});e=$(e);var d=$w(e.className);return result=d.all(function(f){var g=Validation.test(f,e,b.useTitle);b.onElementValidate(g,e);return g})},insertAdvice:function(f,d){var b=$(f).up(".field-row");if(b){Element.insert(b,{after:d})}else{if(f.up("td.value")){f.up("td.value").insert({bottom:d})}else{if(f.advaiceContainer&&$(f.advaiceContainer)){$(f.advaiceContainer).update(d)}else{switch(f.type.toLowerCase()){case"checkbox":case"radio":var e=f.parentNode;if(e){Element.insert(e,{bottom:d})}else{Element.insert(f,{after:d})}break;default:Element.insert(f,{after:d})}}}}},showAdvice:function(e,d,b){if(!e.advices){e.advices=new Hash()}else{e.advices.each(function(f){if(!d||f.value.id!=d.id){this.hideAdvice(e,f.value)}}.bind(this))}e.advices.set(b,d);if(typeof Effect=="undefined"){d.style.display="block"}else{if(!d._adviceAbsolutize){new Effect.Appear(d,{duration:1})}else{Position.absolutize(d);d.show();d.setStyle({top:d._adviceTop,left:d._adviceLeft,width:d._adviceWidth,"z-index":1000});d.addClassName("advice-absolute")}}},hideAdvice:function(d,b){if(b!=null){new Effect.Fade(b,{duration:1,afterFinishInternal:function(){b.hide()}})}},updateCallback:function(elm,status){if(typeof elm.callbackFunction!="undefined"){eval(elm.callbackFunction+"('"+elm.id+"','"+status+"')")}},ajaxError:function(g,f){var e="validate-ajax";var d=Validation.getAdvice(e,g);if(d==null){d=this.createAdvice(e,g,false,f)}this.showAdvice(g,d,"validate-ajax");this.updateCallback(g,"failed");g.addClassName("validation-failed");g.addClassName("validate-ajax");if(Validation.defaultOptions.addClassNameToContainer&&Validation.defaultOptions.containerClassName!=""){var b=g.up(Validation.defaultOptions.containerClassName);if(b&&this.allowContainerClassName(g)){b.removeClassName("validation-passed");b.addClassName("validation-error")}}},allowContainerClassName:function(b){if(b.type=="radio"||b.type=="checkbox"){return b.hasClassName("change-container-classname")}return true},test:function(g,o,l){var d=Validation.get(g);var n="__advice"+g.camelize();try{if(Validation.isVisible(o)&&!d.test($F(o),o)){var f=Validation.getAdvice(g,o);if(f==null){f=this.createAdvice(g,o,l)}this.showAdvice(o,f,g);this.updateCallback(o,"failed");o[n]=1;if(!o.advaiceContainer){o.removeClassName("validation-passed");o.addClassName("validation-failed")}if(Validation.defaultOptions.addClassNameToContainer&&Validation.defaultOptions.containerClassName!=""){var b=o.up(Validation.defaultOptions.containerClassName);if(b&&this.allowContainerClassName(o)){b.removeClassName("validation-passed");b.addClassName("validation-error")}}return false}else{var f=Validation.getAdvice(g,o);this.hideAdvice(o,f);this.updateCallback(o,"passed");o[n]="";o.removeClassName("validation-failed");o.addClassName("validation-passed");if(Validation.defaultOptions.addClassNameToContainer&&Validation.defaultOptions.containerClassName!=""){var b=o.up(Validation.defaultOptions.containerClassName);if(b&&!b.down(".validation-failed")&&this.allowContainerClassName(o)){if(!Validation.get("IsEmpty").test(o.value)||!this.isVisible(o)){b.addClassName("validation-passed")}else{b.removeClassName("validation-passed")}b.removeClassName("validation-error")}}return true}}catch(h){throw (h)}},isVisible:function(b){while(b.tagName!="BODY"){if(!$(b).visible()){return false}b=b.parentNode}return true},getAdvice:function(b,d){return $("advice-"+b+"-"+Validation.getElmID(d))||$("advice-"+Validation.getElmID(d))},createAdvice:function(e,n,l,d){var b=Validation.get(e);var h=l?((n&&n.title)?n.title:b.error):b.error;if(d){h=d}if(jQuery.mage.__){h=jQuery.mage.__(h)}advice='<div class="validation-advice" id="advice-'+e+"-"+Validation.getElmID(n)+'" style="display:none">'+h+"</div>";Validation.insertAdvice(n,advice);advice=Validation.getAdvice(e,n);if($(n).hasClassName("absolute-advice")){var g=$(n).getDimensions();var f=Position.cumulativeOffset(n);advice._adviceTop=(f[1]+g.height)+"px";advice._adviceLeft=(f[0])+"px";advice._adviceWidth=(g.width)+"px";advice._adviceAbsolutize=true}return advice},getElmID:function(b){return b.id?b.id:b.name},reset:function(d){d=$(d);var b=$w(d.className);b.each(function(g){var h="__advice"+g.camelize();if(d[h]){var f=Validation.getAdvice(g,d);if(f){f.hide()}d[h]=""}d.removeClassName("validation-failed");d.removeClassName("validation-passed");if(Validation.defaultOptions.addClassNameToContainer&&Validation.defaultOptions.containerClassName!=""){var e=d.up(Validation.defaultOptions.containerClassName);if(e){e.removeClassName("validation-passed");e.removeClassName("validation-error")}}})},add:function(f,e,g,d){var b={};b[f]=new Validator(f,e,g,d);Object.extend(Validation.methods,b)},addAllThese:function(b){var d={};$A(b).each(function(e){d[e[0]]=new Validator(e[0],e[1],e[2],(e.length>3?e[3]:{}))});Object.extend(Validation.methods,d)},get:function(b){return Validation.methods[b]?Validation.methods[b]:Validation.methods._LikeNoIDIEverSaw_},methods:{_LikeNoIDIEverSaw_:new Validator("_LikeNoIDIEverSaw_","",{})}});Validation.add("IsEmpty","",function(b){return(b==""||(b==null)||(b.length==0)||/^\s+$/.test(b))});Validation.addAllThese([["validate-no-html-tags","HTML tags are not allowed",function(b){return !/<(\/)?\w+/.test(b)}],["validate-select","Please select an option.",function(b){return((b!="none")&&(b!=null)&&(b.length!=0))}],["required-entry","This is a required field.",function(b){return !Validation.get("IsEmpty").test(b)}],["validate-number","Please enter a valid number in this field.",function(b){return Validation.get("IsEmpty").test(b)||(!isNaN(parseNumber(b))&&/^\s*-?\d*(\.\d*)?\s*$/.test(b))}],["validate-number-range","The value is not within the specified range.",function(e,g){if(Validation.get("IsEmpty").test(e)){return true}var f=parseNumber(e);if(isNaN(f)){return false}var d=/^number-range-(-?[\d.,]+)?-(-?[\d.,]+)?$/,b=true;$w(g.className).each(function(l){var h=d.exec(l);if(h){b=b&&(h[1]==null||h[1]==""||f>=parseNumber(h[1]))&&(h[2]==null||h[2]==""||f<=parseNumber(h[2]))}});return b}],["validate-digits","Please use numbers only in this field. Please avoid spaces or other characters such as dots or commas.",function(b){return Validation.get("IsEmpty").test(b)||!/[^\d]/.test(b)}],["validate-digits-range","The value is not within the specified range.",function(e,g){if(Validation.get("IsEmpty").test(e)){return true}var f=parseNumber(e);if(isNaN(f)){return false}var d=/^digits-range-(-?\d+)?-(-?\d+)?$/,b=true;$w(g.className).each(function(l){var h=d.exec(l);if(h){b=b&&(h[1]==null||h[1]==""||f>=parseNumber(h[1]))&&(h[2]==null||h[2]==""||f<=parseNumber(h[2]))}});return b}],["validate-range","The value is not within the specified range.",function(f,l){var g,h;if(Validation.get("IsEmpty").test(f)){return true}else{if(Validation.get("validate-digits").test(f)){g=h=parseNumber(f)}else{var e=/^(-?\d+)?-(-?\d+)?$/.exec(f);if(e){g=parseNumber(e[1]);h=parseNumber(e[2]);if(g>h){return false}}else{return false}}}var d=/^range-(-?\d+)?-(-?\d+)?$/,b=true;$w(l.className).each(function(n){var q=d.exec(n);if(q){var p=parseNumber(q[1]);var o=parseNumber(q[2]);b=b&&(isNaN(p)||g>=p)&&(isNaN(o)||h<=o)}});return b}],["validate-alpha","Please use letters only (a-z or A-Z) in this field.",function(b){return Validation.get("IsEmpty").test(b)||/^[a-zA-Z]+$/.test(b)}],["validate-code","Please use only lowercase letters (a-z), numbers (0-9) or underscore (_) in this field, and the first character should be a letter.",function(b){return Validation.get("IsEmpty").test(b)||/^[a-z]+[a-z0-9_]+$/.test(b)}],["validate-alphanum","Please use only letters (a-z or A-Z) or numbers (0-9) in this field. No spaces or other characters are allowed.",function(b){return Validation.get("IsEmpty").test(b)||/^[a-zA-Z0-9]+$/.test(b)}],["validate-alphanum-with-spaces","Please use only letters (a-z or A-Z), numbers (0-9) or spaces only in this field.",function(b){return Validation.get("IsEmpty").test(b)||/^[a-zA-Z0-9 ]+$/.test(b)}],["validate-street",'Please use only letters (a-z or A-Z), numbers (0-9), spaces and "#" in this field.',function(b){return Validation.get("IsEmpty").test(b)||/^[ \w]{3,}([A-Za-z]\.)?([ \w]*\#\d+)?(\r\n| )[ \w]{3,}/.test(b)}],["validate-phoneStrict","Please enter a valid phone number (Ex: 123-456-7890).",function(b){return Validation.get("IsEmpty").test(b)||/^(\()?\d{3}(\))?(-|\s)?\d{3}(-|\s)\d{4}$/.test(b)}],["validate-phoneLax","Please enter a valid phone number (Ex: 123-456-7890).",function(b){return Validation.get("IsEmpty").test(b)||/^((\d[-. ]?)?((\(\d{3}\))|\d{3}))?[-. ]?\d{3}[-. ]?\d{4}$/.test(b)}],["validate-fax","Please enter a valid fax number (Ex: 123-456-7890).",function(b){return Validation.get("IsEmpty").test(b)||/^(\()?\d{3}(\))?(-|\s)?\d{3}(-|\s)\d{4}$/.test(b)}],["validate-date","Please enter a valid date.",function(b){var d=new Date(b);return Validation.get("IsEmpty").test(b)||!isNaN(d)}],["validate-date-range","Make sure the To Date is later than or the same as the From Date.",function(e,h){var d=/\bdate-range-(\w+)-(\w+)\b/.exec(h.className);if(!d||d[2]=="to"||Validation.get("IsEmpty").test(e)){return true}var f=new Date().getFullYear()+"";var b=function(l){l=l.split(/[.\/]/);if(l[2]&&l[2].length<4){l[2]=f.substr(0,l[2].length)+l[2]}return new Date(l.join("/")).getTime()};var g=Element.select(h.form,".validate-date-range.date-range-"+d[1]+"-to");return !g.length||Validation.get("IsEmpty").test(g[0].value)||b(e)<=b(g[0].value)}],["validate-email","Please enter a valid email address (Ex: johndoe@domain.com).",function(b){return Validation.get("IsEmpty").test(b)||/^([a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*@([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*\.(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]){2,})$/i.test(b)}],["validate-emailSender","Please use only visible characters and spaces.",function(b){return Validation.get("IsEmpty").test(b)||/^[\S ]+$/.test(b)}],["validate-password","Please enter 6 or more characters. Leading and trailing spaces will be ignored.",function(b){var d=b.strip();return !(d.length>0&&d.length<6)}],["validate-admin-password","Please enter 7 or more characters, using both numeric and alphabetic.",function(b){var d=b.strip();if(0==d.length){return true}if(!(/[a-z]/i.test(b))||!(/[0-9]/.test(b))){return false}return !(d.length<7)}],["validate-cpassword","Please make sure your passwords match.",function(b){var d=$("confirmation")?$("confirmation"):$$(".validate-cpassword")[0];var g=false;if($("password")){g=$("password")}var h=$$(".validate-password");for(var e=0;e<h.size();e++){var f=h[e];if(f.up("form").id==d.up("form").id){g=f}}if($$(".validate-admin-password").size()){g=$$(".validate-admin-password")[0]}return(g.value==d.value)}],["validate-both-passwords","Please make sure your passwords match.",function(e,d){var b=$(d.form[d.name=="password"?"confirmation":"password"]),f=d.value==b.value;if(f&&b.hasClassName("validation-failed")){Validation.test(this.className,b)}return b.value==""||f}],["validate-url","Please enter a valid URL. Protocol is required (http://, https:// or ftp://)",function(b){b=(b||"").replace(/^\s+/,"").replace(/\s+$/,"");return Validation.get("IsEmpty").test(b)||/^(http|https|ftp):\/\/(([A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))(\.[A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))*)(:(\d+))?(\/[A-Z0-9~](([A-Z0-9_~-]|\.)*[A-Z0-9~]|))*\/?(.*)?$/i.test(b)}],["validate-clean-url",'Please enter a valid URL (Ex: "http://www.example.com" or "www.example.com").',function(b){return Validation.get("IsEmpty").test(b)||/^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+.(com|org|net|dk|at|us|tv|info|uk|co.uk|biz|se)$)(:(\d+))?\/?/i.test(b)||/^(www)((\.[A-Z0-9][A-Z0-9_-]*)+.(com|org|net|dk|at|us|tv|info|uk|co.uk|biz|se)$)(:(\d+))?\/?/i.test(b)}],["validate-identifier",'Please enter a valid URL Key (Ex: "example-page", "example-page.html" or "anotherlevel/example-page").',function(b){return Validation.get("IsEmpty").test(b)||/^[a-z0-9][a-z0-9_\/-]+(\.[a-z0-9_-]+)?$/.test(b)}],["validate-xml-identifier","Please enter a valid XML-identifier (Ex: something_1, block5, id-4).",function(b){return Validation.get("IsEmpty").test(b)||/^[A-Z][A-Z0-9_\/-]*$/i.test(b)}],["validate-ssn","Please enter a valid social security number (Ex: 123-45-6789).",function(b){return Validation.get("IsEmpty").test(b)||/^\d{3}-?\d{2}-?\d{4}$/.test(b)}],["validate-zip-us","Please enter a valid zip code (Ex: 90602 or 90602-1234).",function(b){return Validation.get("IsEmpty").test(b)||/(^\d{5}$)|(^\d{5}-\d{4}$)/.test(b)}],["validate-zip-international","Please enter a valid zip code.",function(b){return true}],["validate-date-au",'Please use this date format: dd/mm/yyyy (Ex: "17/03/2006" for the 17th of March, 2006).',function(b){if(Validation.get("IsEmpty").test(b)){return true}var e=/^(\d{2})\/(\d{2})\/(\d{4})$/;if(!e.test(b)){return false}var f=new Date(b.replace(e,"$2/$1/$3"));return(parseInt(RegExp.$2,10)==(1+f.getMonth()))&&(parseInt(RegExp.$1,10)==f.getDate())&&(parseInt(RegExp.$3,10)==f.getFullYear())}],["validate-currency-dollar","Please enter a valid $ amount (Ex: $100.00).",function(b){return Validation.get("IsEmpty").test(b)||/^\$?\-?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}\d*(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/.test(b)}],["validate-one-required","Please select one of the options above.",function(b,f){var e=f.parentNode;var d=e.getElementsByTagName("INPUT");return $A(d).any(function(g){return $F(g)})}],["validate-one-required-by-name","Please select one of the options.",function(d,g){var b=$$('input[name="'+g.name.replace(/([\\"])/g,"\\$1")+'"]');var e=1;for(var f=0;f<b.length;f++){if((b[f].type=="checkbox"||b[f].type=="radio")&&b[f].checked==true){e=0}if(Validation.isOnChange&&(b[f].type=="checkbox"||b[f].type=="radio")){Validation.reset(b[f])}}if(e==0){return true}else{return false}}],["validate-not-negative-number","Please enter a number 0 or greater in this field.",function(b){if(Validation.get("IsEmpty").test(b)){return true}b=parseNumber(b);return !isNaN(b)&&b>=0}],["validate-zero-or-greater","Please enter a number 0 or greater in this field.",function(b){return Validation.get("validate-not-negative-number").test(b)}],["validate-greater-than-zero","Please enter a number greater than 0 in this field.",function(b){if(Validation.get("IsEmpty").test(b)){return true}b=parseNumber(b);return !isNaN(b)&&b>0}],["validate-state","Please select State/Province.",function(b){return(b!=0||b=="")}],["validate-new-password","Please enter 6 or more characters. Leading and trailing spaces will be ignored.",function(b){if(!Validation.get("validate-password").test(b)){return false}if(Validation.get("IsEmpty").test(b)&&b!=""){return false}return true}],["validate-cc-number","Please enter a valid credit card number.",function(b,e){var d=$(e.id.substr(0,e.id.indexOf("_cc_number"))+"_cc_type");if(d&&typeof Validation.creditCartTypes.get(d.value)!="undefined"&&Validation.creditCartTypes.get(d.value)[2]==false){if(!Validation.get("IsEmpty").test(b)&&Validation.get("validate-digits").test(b)){return true}else{return false}}return validateCreditCard(b)}],["validate-cc-type","Credit card number does not match credit card type.",function(d,g){g.value=removeDelimiters(g.value);d=removeDelimiters(d);var f=$(g.id.substr(0,g.id.indexOf("_cc_number"))+"_cc_type");if(!f){return true}var e=f.value;if(typeof Validation.creditCartTypes.get(e)=="undefined"){return false}if(Validation.creditCartTypes.get(e)[0]==false){return true}var b="";Validation.creditCartTypes.each(function(h){if(h.value[0]&&d.match(h.value[0])){b=h.key;throw $break}});if(b!=e){return false}if(f.hasClassName("validation-failed")&&Validation.isOnChange){Validation.validate(f)}return true}],["validate-cc-type-select","Card type does not match credit card number.",function(d,e){var b=$(e.id.substr(0,e.id.indexOf("_cc_type"))+"_cc_number");if(Validation.isOnChange&&Validation.get("IsEmpty").test(b.value)){return true}if(Validation.get("validate-cc-type").test(b.value,b)){Validation.validate(b)}return Validation.get("validate-cc-type").test(b.value,b)}],["validate-cc-exp","Incorrect credit card expiration date.",function(b,l){var h=b;var g=$(l.id.substr(0,l.id.indexOf("_expiration"))+"_expiration_yr").value;var f=new Date();var e=f.getMonth()+1;var d=f.getFullYear();if(h<e&&g==d){return false}return true}],["validate-cc-cvn","Please enter a valid credit card verification number.",function(b,g){var f=$(g.id.substr(0,g.id.indexOf("_cc_cid"))+"_cc_type");if(!f){return true}var d=f.value;if(typeof Validation.creditCartTypes.get(d)=="undefined"){return false}var e=Validation.creditCartTypes.get(d)[1];if(b.match(e)){return true}return false}],["validate-ajax","",function(b,d){return true}],["validate-data","Please use only letters (a-z or A-Z), numbers (0-9) or underscore (_) in this field, and the first character should be a letter.",function(b){if(b!=""&&b){return/^[A-Za-z]+[A-Za-z0-9_]+$/.test(b)}return true}],["validate-css-length","Please input a valid CSS-length (Ex: 100px, 77pt, 20em, .5ex or 50%).",function(b){if(b!=""&&b){return/^[0-9\.]+(px|pt|em|ex|%)?$/.test(b)&&(!(/\..*\./.test(b)))&&!(/\.$/.test(b))}return true}],["validate-length","Text length does not meet the specified text range.",function(d,g){var e=new RegExp(/^maximum-length-[0-9]+$/);var f=new RegExp(/^minimum-length-[0-9]+$/);var b=true;$w(g.className).each(function(l,h){if(l.match(e)&&b){var n=l.split("-")[2];b=(d.length<=n)}if(l.match(f)&&b&&!Validation.get("IsEmpty").test(d)){var n=l.split("-")[2];b=(d.length>=n)}});return b}],["validate-percents","Please enter a number lower than 100.",{max:100}],["required-file","Please select a file.",function(d,e){var b=!Validation.get("IsEmpty").test(d);if(b===false){ovId=e.id+"_value";if($(ovId)){b=!Validation.get("IsEmpty").test($(ovId).value)}}return b}],["validate-cc-ukss","Please enter issue number or start date for switch/solo card type.",function(o,g){var b;if(g.id.match(/(.)+_cc_issue$/)){b=g.id.indexOf("_cc_issue")}else{if(g.id.match(/(.)+_start_month$/)){b=g.id.indexOf("_start_month")}else{b=g.id.indexOf("_start_year")}}var f=g.id.substr(0,b);var d=$(f+"_cc_type");if(!d){return true}var n=d.value;if(["SS","SM","SO"].indexOf(n)==-1){return true}$(f+"_cc_issue").advaiceContainer=$(f+"_start_month").advaiceContainer=$(f+"_start_year").advaiceContainer=$(f+"_cc_type_ss_div").down(".adv-container");var h=$(f+"_cc_issue").value;var l=$(f+"_start_month").value;var p=$(f+"_start_year").value;var e=(l&&p)?true:false;if(!e&&!h){return false}return true}]]);function removeDelimiters(b){b=b.replace(/\s/g,"");b=b.replace(/\-/g,"");return b}function parseNumber(b){if(typeof b!="string"){return parseFloat(b)}var e=b.indexOf(".");var d=b.indexOf(",");if(e!=-1&&d!=-1){if(d>e){b=b.replace(".","").replace(",",".")}else{b=b.replace(",","")}}else{if(d!=-1){b=b.replace(",",".")}}return parseFloat(b)}Validation.creditCartTypes=$H({SO:[new RegExp("^(6334[5-9]([0-9]{11}|[0-9]{13,14}))|(6767([0-9]{12}|[0-9]{14,15}))$"),new RegExp("^([0-9]{3}|[0-9]{4})?$"),true],SM:[new RegExp("(^(5[0678])[0-9]{11,18}$)|(^(6[^05])[0-9]{11,18}$)|(^(601)[^1][0-9]{9,16}$)|(^(6011)[0-9]{9,11}$)|(^(6011)[0-9]{13,16}$)|(^(65)[0-9]{11,13}$)|(^(65)[0-9]{15,18}$)|(^(49030)[2-9]([0-9]{10}$|[0-9]{12,13}$))|(^(49033)[5-9]([0-9]{10}$|[0-9]{12,13}$))|(^(49110)[1-2]([0-9]{10}$|[0-9]{12,13}$))|(^(49117)[4-9]([0-9]{10}$|[0-9]{12,13}$))|(^(49118)[0-2]([0-9]{10}$|[0-9]{12,13}$))|(^(4936)([0-9]{12}$|[0-9]{14,15}$))"),new RegExp("^([0-9]{3}|[0-9]{4})?$"),true],VI:[new RegExp("^4[0-9]{12}([0-9]{3})?$"),new RegExp("^[0-9]{3}$"),true],MC:[new RegExp("^5[1-5][0-9]{14}$"),new RegExp("^[0-9]{3}$"),true],AE:[new RegExp("^3[47][0-9]{13}$"),new RegExp("^[0-9]{4}$"),true],DI:[new RegExp("^6(011|4[4-9][0-9]|5[0-9]{2})[0-9]{12}$"),new RegExp("^[0-9]{3}$"),true],JCB:[new RegExp("^(3[0-9]{15}|(2131|1800)[0-9]{11})$"),new RegExp("^[0-9]{3,4}$"),true],OT:[false,new RegExp("^([0-9]{3}|[0-9]{4})?$"),false]});function popWin(d,e,b){var e=window.open(d,e,b);e.focus()}function setLocation(b){window.location.href=b}function setPLocation(d,b){if(b){window.opener.focus()}window.opener.location.href=d}function setLanguageCode(e,f){var b=window.location.href;var h="",g;if(g=b.match(/\#(.*)$/)){b=b.replace(/\#(.*)$/,"");h=g[0]}if(b.match(/[?]/)){var d=/([?&]store=)[a-z0-9_]*/;if(b.match(d)){b=b.replace(d,"$1"+e)}else{b+="&store="+e}var d=/([?&]from_store=)[a-z0-9_]*/;if(b.match(d)){b=b.replace(d,"")}}else{b+="?store="+e}if(typeof f!="undefined"){b+="&from_store="+f}b+=h;setLocation(b)}function decorateGeneric(h,e){var l=["odd","even","first","last"];var d={};var g=h.length;if(g){if(typeof e=="undefined"){e=l}if(!e.length){return}for(var b in l){d[l[b]]=false}for(var b in e){d[e[b]]=true}if(d.first){Element.addClassName(h[0],"first")}if(d.last){Element.addClassName(h[g-1],"last")}for(var f=0;f<g;f++){if((f+1)%2==0){if(d.even){Element.addClassName(h[f],"even")}}else{if(d.odd){Element.addClassName(h[f],"odd")}}}}}function decorateTable(h,e){var h=$(h);if(h){var b={tbody:false,"tbody tr":["odd","even","first","last"],"thead tr":["first","last"],"tfoot tr":["first","last"],"tr td":["last"]};if(typeof e!="undefined"){for(var d in e){b[d]=e[d]}}if(b.tbody){decorateGeneric(h.select("tbody"),b.tbody)}if(b["tbody tr"]){decorateGeneric(h.select("tbody tr"),b["tbody tr"])}if(b["thead tr"]){decorateGeneric(h.select("thead tr"),b["thead tr"])}if(b["tfoot tr"]){decorateGeneric(h.select("tfoot tr"),b["tfoot tr"])}if(b["tr td"]){var g=h.select("tr");if(g.length){for(var f=0;f<g.length;f++){decorateGeneric(g[f].getElementsByTagName("TD"),b["tr td"])}}}}}function decorateList(e,d){if($(e)){if(typeof d=="undefined"){var b=$(e).select("li")}else{var b=$(e).childElements()}decorateGeneric(b,["odd","even","last"])}}function decorateDataList(b){b=$(b);if(b){decorateGeneric(b.select("dt"),["odd","even","last"]);decorateGeneric(b.select("dd"),["odd","even","last"])}}function parseSidUrl(f,e){var d=f.indexOf("/?SID=");var b="";e=e!=undefined?e:"";if(d>-1){b="?"+f.substring(d+2);f=f.substring(0,d+1)}return f+e+b}function formatCurrency(n,q,g){var l=isNaN(q.precision=Math.abs(q.precision))?2:q.precision;var v=isNaN(q.requiredPrecision=Math.abs(q.requiredPrecision))?2:q.requiredPrecision;l=v;var t=isNaN(q.integerRequired=Math.abs(q.integerRequired))?1:q.integerRequired;var p=q.decimalSymbol==undefined?",":q.decimalSymbol;var e=q.groupSymbol==undefined?".":q.groupSymbol;var d=q.groupLength==undefined?3:q.groupLength;var u="";if(g==undefined||g==true){u=n<0?"-":g?"+":""}else{if(g==false){u=""}}var h=parseInt(n=Math.abs(+n||0).toFixed(l))+"";var f=h.length<t?t-h.length:0;while(f){h="0"+h;f--}j=(j=h.length)>d?j%d:0;re=new RegExp("(\\d{"+d+"})(?=\\d)","g");var b=(j?h.substr(0,j)+e:"")+h.substr(j).replace(re,"$1"+e)+(l?p+Math.abs(n-h).toFixed(l).replace(/-/,0).slice(2):"");var o="";if(q.pattern.indexOf("{sign}")==-1){o=u+q.pattern}else{o=q.pattern.replace("{sign}",u)}return o.replace("%s",b).replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function expandDetails(d,b){if(Element.hasClassName(d,"show-details")){$$(b).each(function(e){e.hide()});Element.removeClassName(d,"show-details")}else{$$(b).each(function(e){e.show()});Element.addClassName(d,"show-details")}}var isIE=navigator.appVersion.match(/MSIE/)=="MSIE";if(!window.Varien){var Varien=new Object()}Varien.showLoading=function(){var b=$("loading-process");b&&b.show()};Varien.hideLoading=function(){var b=$("loading-process");b&&b.hide()};Varien.GlobalHandlers={onCreate:function(){Varien.showLoading()},onComplete:function(){if(Ajax.activeRequestCount==0){Varien.hideLoading()}}};Ajax.Responders.register(Varien.GlobalHandlers);Varien.searchForm=Class.create();Varien.searchForm.prototype={initialize:function(d,e,b){this.form=$(d);this.field=$(e);this.emptyText=b;Event.observe(this.form,"submit",this.submit.bind(this));Event.observe(this.field,"focus",this.focus.bind(this));Event.observe(this.field,"blur",this.blur.bind(this));this.blur()},submit:function(b){if(this.field.value==this.emptyText||this.field.value==""){Event.stop(b);return false}return true},focus:function(b){if(this.field.value==this.emptyText){this.field.value=""}},blur:function(b){if(this.field.value==""){this.field.value=this.emptyText}}};Varien.DateElement=Class.create();Varien.DateElement.prototype={initialize:function(b,d,f,e){if(b=="id"){this.day=$(d+"day");this.month=$(d+"month");this.year=$(d+"year");this.full=$(d+"full");this.advice=$(d+"date-advice")}else{if(b=="container"){this.day=d.day;this.month=d.month;this.year=d.year;this.full=d.full;this.advice=d.advice}else{return}}this.required=f;this.format=e;this.day.addClassName("validate-custom");this.day.validate=this.validate.bind(this);this.month.addClassName("validate-custom");this.month.validate=this.validate.bind(this);this.year.addClassName("validate-custom");this.year.validate=this.validate.bind(this);this.setDateRange(false,false);this.year.setAttribute("autocomplete","off");this.advice.hide()},validate:function(){var l=false,o=parseInt(this.day.value,10)||0,f=parseInt(this.month.value,10)||0,h=parseInt(this.year.value,10)||0;if(this.day.value.strip().empty()&&this.month.value.strip().empty()&&this.year.value.strip().empty()){if(this.required){l="Please enter a date."}else{this.full.value=""}}else{if(!o||!f||!h){l="Please enter a valid full date."}else{var d=new Date,n=0,e=null;d.setYear(h);d.setMonth(f-1);d.setDate(32);n=32-d.getDate();if(!n||n>31){n=31}if(o<1||o>n){e="day";l="Please enter a valid day (1-%1)."}else{if(f<1||f>12){e="month";l="Please enter a valid month (1-12)."}else{if(o%10==o){this.day.value="0"+o}if(f%10==f){this.month.value="0"+f}this.full.value=this.format.replace(/%[mb]/i,this.month.value).replace(/%[de]/i,this.day.value).replace(/%y/i,this.year.value);var b=this.month.value+"/"+this.day.value+"/"+this.year.value;var g=new Date(b);if(isNaN(g)){l="Please enter a valid date."}else{this.setFullDate(g)}}}var p=false;if(!l&&!this.validateData()){e=this.validateDataErrorType;p=this.validateDataErrorText;l=p}}}if(l!==false){if(jQuery.mage.__){l=jQuery.mage.__(l)}if(!p){this.advice.innerHTML=l.replace("%1",n)}else{this.advice.innerHTML=this.errorTextModifier(l)}this.advice.show();return false}this.day.removeClassName("validation-failed");this.month.removeClassName("validation-failed");this.year.removeClassName("validation-failed");this.advice.hide();return true},validateData:function(){var d=this.fullDate.getFullYear();var b=new Date;this.curyear=b.getFullYear();return d>=1900&&d<=this.curyear},validateDataErrorType:"year",validateDataErrorText:"Please enter a valid year (1900-%1).",errorTextModifier:function(b){return b.replace("%1",this.curyear)},setDateRange:function(b,d){this.minDate=b;this.maxDate=d},setFullDate:function(b){this.fullDate=b}};Varien.DOB=Class.create();Varien.DOB.prototype={initialize:function(b,g,f){var e=$$(b)[0];var d={};d.day=Element.select(e,".dob-day input")[0];d.month=Element.select(e,".dob-month input")[0];d.year=Element.select(e,".dob-year input")[0];d.full=Element.select(e,".dob-full input")[0];d.advice=Element.select(e,".validation-advice")[0];new Varien.DateElement("container",d,g,f)}};Varien.dateRangeDate=Class.create();Varien.dateRangeDate.prototype=Object.extend(new Varien.DateElement(),{validateData:function(){var b=true;if(this.minDate||this.maxValue){if(this.minDate){this.minDate=new Date(this.minDate);this.minDate.setHours(0);if(isNaN(this.minDate)){this.minDate=new Date("1/1/1900")}b=b&&this.fullDate>=this.minDate}if(this.maxDate){this.maxDate=new Date(this.maxDate);this.minDate.setHours(0);if(isNaN(this.maxDate)){this.maxDate=new Date()}b=b&&this.fullDate<=this.maxDate}if(this.maxDate&&this.minDate){this.validateDataErrorText="Please enter a valid date between %s and %s"}else{if(this.maxDate){this.validateDataErrorText="Please enter a valid date less than or equal to %s"}else{if(this.minDate){this.validateDataErrorText="Please enter a valid date equal to or greater than %s"}else{this.validateDataErrorText=""}}}}return b},validateDataErrorText:"Date should be between %s and %s",errorTextModifier:function(b){if(this.minDate){b=b.sub("%s",this.dateFormat(this.minDate))}if(this.maxDate){b=b.sub("%s",this.dateFormat(this.maxDate))}return b},dateFormat:function(b){return b.getMonth()+1+"/"+b.getDate()+"/"+b.getFullYear()}});Varien.FileElement=Class.create();Varien.FileElement.prototype={initialize:function(b){this.fileElement=$(b);this.hiddenElement=$(b+"_value");this.fileElement.observe("change",this.selectFile.bind(this))},selectFile:function(b){this.hiddenElement.value=this.fileElement.getValue()}};Validation.addAllThese([["validate-custom"," ",function(b,d){return d.validate()}]]);Element.addMethods({getInnerText:function(b){b=$(b);if(b.innerText&&!Prototype.Browser.Opera){return b.innerText}return b.innerHTML.stripScripts().unescapeHTML().replace(/[\n\r\s]+/g," ").strip()}});function fireEvent(d,e){var b=document.createEvent("HTMLEvents");b.initEvent(e,true,true);return d.dispatchEvent(b)}function modulo(b,f){var e=f/10000;var d=b%f;if(Math.abs(d-f)<e||Math.abs(d)<e){d=0}return d}if(typeof Range!="undefined"&&!Range.prototype.createContextualFragment){Range.prototype.createContextualFragment=function(b){var e=document.createDocumentFragment(),d=document.createElement("div");e.appendChild(d);d.outerHTML=b;return e}}var byteConvert=function(b){if(isNaN(b)){return""}var d=["bytes","KB","MB","GB","TB","PB","EB","ZB","YB"];var f=Math.floor(Math.log(b)/Math.log(2));if(f<1){f=0}var e=Math.floor(f/10);b/=Math.pow(2,10*e);if(b.toString().length>b.toFixed(2).toString().length){b=b.toFixed(2)}return b+" "+d[e]};var SessionError=Class.create();SessionError.prototype={initialize:function(b){this.errorText=b},toString:function(){return"Session Error:"+this.errorText}};Ajax.Request.addMethods({initialize:function($super,d,b){$super(b);this.transport=Ajax.getTransport();if(!d.match(new RegExp("[?&]isAjax=true",""))){d=d.match(new RegExp("\\?","g"))?d+"&isAjax=true":d+"?isAjax=true"}if(Object.isString(this.options.parameters)&&this.options.parameters.indexOf("form_key=")==-1){this.options.parameters+="&"+Object.toQueryString({form_key:FORM_KEY})}else{if(!this.options.parameters){this.options.parameters={form_key:FORM_KEY}}if(!this.options.parameters.form_key){this.options.parameters.form_key=FORM_KEY}}this.request(d)},respondToReadyState:function(b){var g=Ajax.Request.Events[b],d=new Ajax.Response(this);if(g=="Complete"){try{this._complete=true;if(d.responseText.isJSON()){var f=d.responseText.evalJSON();if(f.ajaxExpired&&f.ajaxRedirect){window.location.replace(f.ajaxRedirect);throw new SessionError("session expired")}}(this.options["on"+d.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(d,d.headerJSON)}catch(h){this.dispatchException(h);if(h instanceof SessionError){return}}var l=d.getHeader("Content-type");if(this.options.evalJS=="force"||this.options.evalJS&&this.isSameOrigin()&&l&&l.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)){this.evalResponse()}}try{(this.options["on"+g]||Prototype.emptyFunction)(d,d.headerJSON);Ajax.Responders.dispatch("on"+g,this,d,d.headerJSON)}catch(h){this.dispatchException(h)}if(g=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction}}});Ajax.Updater.respondToReadyState=Ajax.Request.respondToReadyState;var varienLoader=new Class.create();varienLoader.prototype={initialize:function(b){this.callback=false;this.cache=$H();this.caching=b||false;this.url=false},getCache:function(b){if(this.cache.get(b)){return this.cache.get(b)}return false},load:function(b,d,f){this.url=b;this.callback=f;if(this.caching){var e=this.getCache(b);if(e){this.processResult(e);return}}if(typeof d.updaterId!="undefined"){new varienUpdater(d.updaterId,b,{evalScripts:true,onComplete:this.processResult.bind(this),onFailure:this._processFailure.bind(this)})}else{new Ajax.Request(b,{method:"post",parameters:d||{},onComplete:this.processResult.bind(this),onFailure:this._processFailure.bind(this)})}},_processFailure:function(b){location.href=BASE_URL},processResult:function(b){if(this.caching){this.cache.set(this.url,b)}if(this.callback){this.callback(b.responseText)}}};if(!window.varienLoaderHandler){var varienLoaderHandler=new Object()}varienLoaderHandler.handler={onCreate:function(b){if(b.options.loaderArea===false){return}jQuery("body").trigger("processStart")},onException:function(b){jQuery("body").trigger("processStop")},onComplete:function(b){jQuery("body").trigger("processStop")}};function setLoaderPosition(){var e=$("loading_mask_loader");if(e&&Prototype.Browser.IE){var d=e.getDimensions();var f=document.viewport.getDimensions();var b=document.viewport.getScrollOffsets();e.style.left=Math.floor(f.width/2+b.left-d.width/2)+"px";e.style.top=Math.floor(f.height/2+b.top-d.height/2)+"px";e.style.position="absolute"}}function toggleSelectsUnderBlock(f,b){if(Prototype.Browser.IE){var e=document.getElementsByTagName("select");for(var d=0;d<e.length;d++){if(b){if(e[d].needShowOnSuccess){e[d].needShowOnSuccess=false;e[d].style.visibility=""}}else{if(Element.visible(e[d])){e[d].style.visibility="hidden";e[d].needShowOnSuccess=true}}}}}Ajax.Responders.register(varienLoaderHandler.handler);var varienUpdater=Class.create(Ajax.Updater,{updateContent:function($super,b){if(b.isJSON()){var d=b.evalJSON();if(d.ajaxExpired&&d.ajaxRedirect){window.location.replace(d.ajaxRedirect)}}else{$super(b)}}});function setLocation(b){window.location.href=b}function setElementDisable(d,b){if($(d)){$(d).disabled=b}}function toggleParentVis(b){b=$(b).parentNode;if(b.style.display=="none"){b.style.display=""}else{b.style.display="none"}}function toggleFieldsetVis(d){id=d;d=$(d);if(d.style.display=="none"){d.style.display=""}else{d.style.display="none"}d=d.parentNode.childElements();for(var b=0;b<d.length;b++){if(d[b].id!=undefined&&d[b].id==id&&d[b-1].classNames()=="entry-edit-head"){if(d[b-1].style.display=="none"){d[b-1].style.display=""}else{d[b-1].style.display="none"}}}}function toggleVis(b){b=$(b);if(b.style.display=="none"){b.style.display=""}else{b.style.display="none"}}function imagePreview(b){if($(b)){var d=window.open("","preview","width=400,height=400,resizable=1,scrollbars=1");d.document.open();d.document.write('<body style="padding:0;margin:0"><img src="'+$(b).src+'" id="image_preview"/></body>');d.document.close();Event.observe(d,"load",function(){var e=d.document.getElementById("image_preview");d.resizeTo(e.width+40,e.height+80)})}}function checkByProductPriceType(b){if(b.id=="price_type"){this.productPriceType=b.value;return false}if(b.id=="price"&&this.productPriceType==0){return false}return true}function toggleSeveralValueElements(f,e,b,d){if(e&&f){if(Object.prototype.toString.call(e)!="[object Array]"){e=[e]}e.each(function(g){toggleValueElements(f,g,b,d)})}}function toggleValueElements(l,d,f,h){if(d&&l){var n=[l];if(typeof f!="undefined"){if(Object.prototype.toString.call(f)!="[object Array]"){f=[f]}for(var g=0;g<f.length;g++){n.push(f[g])}}var e=Element.select(d,["select","input","textarea","button","img"]).filter(function(o){return o.readAttribute("type")!="hidden"});var b=h!=undefined?h:l.checked;e.each(function(p){if(checkByProductPriceType(p)){var o=n.length;while(o--&&p!=n[o]){}if(o!=-1){return}p.disabled=b;if(b){p.addClassName("disabled")}else{p.removeClassName("disabled")}if(p.nodeName.toLowerCase()=="img"){b?p.hide():p.show()}}})}}function submitAndReloadArea(e,d){if($(e)){var b=$(e).select("input","select","textarea");var f=Form.serializeElements(b,true);d+=d.match(new RegExp("\\?"))?"&isAjax=true":"?isAjax=true";new Ajax.Request(d,{parameters:$H(f),loaderArea:e,onSuccess:function(l){try{if(l.responseText.isJSON()){var g=l.responseText.evalJSON();if(g.error){alert(g.message)}if(g.ajaxExpired&&g.ajaxRedirect){setLocation(g.ajaxRedirect)}}else{$(e).update(l.responseText)}}catch(h){$(e).update(l.responseText)}}})}}function syncOnchangeValue(d,e){var b={baseElem:d,distElem:e};Event.observe(d,"change",function(){if($(this.baseElem)&&$(this.distElem)){$(this.distElem).value=$(this.baseElem).value}}.bind(b))}function updateElementAtCursor(e,f,g){if(g==undefined){g=window.self}if(document.selection){e.focus();sel=g.document.selection.createRange();sel.text=f}else{if(e.selectionStart||e.selectionStart=="0"){var d=e.selectionStart;var b=e.selectionEnd;e.value=e.value.substring(0,d)+f+e.value.substring(b,e.value.length)}else{e.value+=f}}}function firebugEnabled(){if(window.console&&window.console.firebug){return true}return false}function disableElement(b){b.disabled=true;b.addClassName("disabled")}function enableElement(b){b.disabled=false;b.removeClassName("disabled")}function disableElements(b){$$("."+b).each(disableElement)}function enableElements(b){$$("."+b).each(enableElement)}var Cookie={all:function(){var d=document.cookie.split(";");var b={};d.each(function(f,e){var g=f.strip().split("=");b[unescape(g[0])]=unescape(g[1])});return b},read:function(d){var b=this.all();if(b[d]){return b[d]}return null},write:function(l,g,h,f){var b="";if(h){var e=new Date();e.setTime(e.getTime()+h*1000);b="; expires="+e.toUTCString()}var d="/"+BASE_URL.split("/").slice(3).join("/");f="; samesite="+(f?f:"lax");document.cookie=escape(l)+"="+escape(g)+b+"; path="+d+f},clear:function(b){this.write(b,"",-1)}};var Fieldset={cookiePrefix:"fh-",applyCollapse:function(b){if($(b+"-state")){collapsed=$(b+"-state").value==1?0:1}else{collapsed=$(b+"-head").collapsed}if(collapsed==1||collapsed===undefined){$(b+"-head").removeClassName("open");if($(b+"-head").up(".section-config")){$(b+"-head").up(".section-config").removeClassName("active")}$(b).hide()}else{$(b+"-head").addClassName("open");if($(b+"-head").up(".section-config")){$(b+"-head").up(".section-config").addClassName("active")}$(b).show()}},toggleCollapse:function(b,d){if($(b+"-state")){collapsed=$(b+"-state").value==1?0:1}else{collapsed=$(b+"-head").collapsed}if(collapsed==1||collapsed===undefined){if($(b+"-state")){$(b+"-state").value=1}$(b+"-head").collapsed=0}else{if($(b+"-state")){$(b+"-state").value=0}$(b+"-head").collapsed=1}this.applyCollapse(b);if(typeof d!="undefined"){this.saveState(d,{container:b,value:$(b+"-state").value})}},addToPrefix:function(b){this.cookiePrefix+=b+"-"},saveState:function(b,d){new Ajax.Request(b,{method:"post",parameters:Object.toQueryString(d),loaderArea:false})}};var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var b="";var p,n,h,o,l,g,f;var d=0;e=Base64._utf8_encode(e);if(typeof window.btoa==="function"){return window.btoa(e)}while(d<e.length){p=e.charCodeAt(d++);n=e.charCodeAt(d++);h=e.charCodeAt(d++);o=p>>2;l=(p&3)<<4|n>>4;g=(n&15)<<2|h>>6;f=h&63;if(isNaN(n)){g=f=64}else{if(isNaN(h)){f=64}}b=b+this._keyStr.charAt(o)+this._keyStr.charAt(l)+this._keyStr.charAt(g)+this._keyStr.charAt(f)}return b},decode:function(e){var b="";var p,n,h;var o,l,g,f;var d=0;if(typeof window.atob==="function"){return Base64._utf8_decode(window.atob(e))}e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(d<e.length){o=this._keyStr.indexOf(e.charAt(d++));l=this._keyStr.indexOf(e.charAt(d++));g=this._keyStr.indexOf(e.charAt(d++));f=this._keyStr.indexOf(e.charAt(d++));p=o<<2|l>>4;n=(l&15)<<4|g>>2;h=(g&3)<<6|f;b+=String.fromCharCode(p);if(g!=64){b+=String.fromCharCode(n)}if(f!=64){b+=String.fromCharCode(h)}}return Base64._utf8_decode(b)},mageEncode:function(b){return this.encode(b).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,",")},mageDecode:function(b){b=b.replace(/\-/g,"+").replace(/_/g,"/").replace(/,/g,"=");return this.decode(b)},idEncode:function(b){return this.encode(b).replace(/\+/g,":").replace(/\//g,"_").replace(/=/g,"-")},idDecode:function(b){b=b.replace(/\-/g,"=").replace(/_/g,"/").replace(/\:/g,"+");return this.decode(b)},_utf8_encode:function(d){d=d.replace(/\r\n/g,"\n");var b="";for(var f=0;f<d.length;f++){var e=d.charCodeAt(f);if(e<128){b+=String.fromCharCode(e)}else{if(e>127&&e<2048){b+=String.fromCharCode(e>>6|192);b+=String.fromCharCode(e&63|128)}else{b+=String.fromCharCode(e>>12|224);b+=String.fromCharCode(e>>6&63|128);b+=String.fromCharCode(e&63|128)}}}return b},_utf8_decode:function(b){var d="";var e=0;var f=c1=c2=0;while(e<b.length){f=b.charCodeAt(e);if(f<128){d+=String.fromCharCode(f);e++}else{if(f>191&&f<224){c2=b.charCodeAt(e+1);d+=String.fromCharCode((f&31)<<6|c2&63);e+=2}else{c2=b.charCodeAt(e+1);c3=b.charCodeAt(e+2);d+=String.fromCharCode((f&15)<<12|(c2&63)<<6|c3&63);e+=3}}}return d}};function sortNumeric(d,b){return d-b}(function(){var globals=["Prototype","Abstract","Try","Class","PeriodicalExecuter","Template","$break","Enumerable","$A","$w","$H","Hash","$R","ObjectRange","Ajax","$","Form","Field","$F","Toggle","Insertion","$continue","Position","Windows","Dialog","array","WindowUtilities","Builder","Effect","validateCreditCard","Validator","Validation","removeDelimiters","parseNumber","popWin","setLocation","setPLocation","setLanguageCode","decorateGeneric","decorateTable","decorateList","decorateDataList","parseSidUrl","formatCurrency","expandDetails","isIE","Varien","fireEvent","modulo","byteConvert","SessionError","varienLoader","varienLoaderHandler","setLoaderPosition","toggleSelectsUnderBlock","varienUpdater","setElementDisable","toggleParentVis","toggleFieldsetVis","toggleVis","imagePreview","checkByProductPriceType","toggleSeveralValueElements","toggleValueElements","submitAndReloadArea","syncOnchangeValue","updateElementAtCursor","firebugEnabled","disableElement","enableElement","disableElements","enableElements","Cookie","Fieldset","Base64","sortNumeric","Element","$$","Sizzle","Selector","Window"];globals.forEach(function(prop){window[prop]=eval(prop)})})(); \ No newline at end of file +(function(aw){var E,az,u,N,Q,ac,ay,aD,O,ad,af,I,v,ao,aj,ax,l,L,aq="sizzle"+-(new Date()),P=aw.document,aA=0,ak=0,d=G(),ap=G(),M=G(),K=function(i,e){if(i===e){ad=true}return 0},av=typeof undefined,W=1<<31,U=({}).hasOwnProperty,at=[],au=at.pop,S=at.push,b=at.push,t=at.slice,k=at.indexOf||function(aF){var aE=0,e=this.length;for(;aE<e;aE++){if(this[aE]===aF){return aE}}return -1},c="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",w="[\\x20\\t\\r\\n\\f]",a="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",R=a.replace("w","w#"),am="\\["+w+"*("+a+")"+w+"*(?:([*^$|!~]?=)"+w+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+R+")|)|)"+w+"*\\]",r=":("+a+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+am.replace(3,8)+")*)|.*)\\)|)",y=new RegExp("^"+w+"+|((?:^|[^\\\\])(?:\\\\.)*)"+w+"+$","g"),B=new RegExp("^"+w+"*,"+w+"*"),H=new RegExp("^"+w+"*([>+~]|"+w+")"+w+"*"),A=new RegExp("="+w+"*([^\\]'\"]*?)"+w+"*\\]","g"),Y=new RegExp(r),aa=new RegExp("^"+R+"$"),ai={ID:new RegExp("^#("+a+")"),CLASS:new RegExp("^\\.("+a+")"),TAG:new RegExp("^("+a.replace("w","w*")+")"),ATTR:new RegExp("^"+am),PSEUDO:new RegExp("^"+r),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+w+"*(even|odd|(([+-]|)(\\d*)n|)"+w+"*(?:([+-]|)"+w+"*(\\d+)|))"+w+"*\\)|)","i"),bool:new RegExp("^(?:"+c+")$","i"),needsContext:new RegExp("^"+w+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+w+"*((?:-\\d)?\\d*)"+w+"*\\)|)(?=[^-]|$)","i")},h=/^(?:input|select|textarea|button)$/i,s=/^h\d$/i,V=/^[^{]+\{\s*\[native \w/,X=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ah=/[+~]/,T=/'|\\/g,z=new RegExp("\\\\([\\da-f]{1,6}"+w+"?|("+w+")|.)","ig"),al=function(e,aF,i){var aE="0x"+aF-65536;return aE!==aE||i?aF:aE<0?String.fromCharCode(aE+65536):String.fromCharCode(aE>>10|55296,aE&1023|56320)};try{b.apply((at=t.call(P.childNodes)),P.childNodes);at[P.childNodes.length].nodeType}catch(J){b={apply:at.length?function(i,e){S.apply(i,t.call(e))}:function(aG,aF){var e=aG.length,aE=0;while((aG[e++]=aF[aE++])){}aG.length=e-1}}}function C(aL,aE,aP,aR){var aQ,aI,aJ,aN,aO,aH,aG,e,aF,aM;if((aE?aE.ownerDocument||aE:P)!==I){af(aE)}aE=aE||I;aP=aP||[];if(!aL||typeof aL!=="string"){return aP}if((aN=aE.nodeType)!==1&&aN!==9){return[]}if(ao&&!aR){if((aQ=X.exec(aL))){if((aJ=aQ[1])){if(aN===9){aI=aE.getElementById(aJ);if(aI&&aI.parentNode){if(aI.id===aJ){aP.push(aI);return aP}}else{return aP}}else{if(aE.ownerDocument&&(aI=aE.ownerDocument.getElementById(aJ))&&L(aE,aI)&&aI.id===aJ){aP.push(aI);return aP}}}else{if(aQ[2]){b.apply(aP,aE.getElementsByTagName(aL));return aP}else{if((aJ=aQ[3])&&az.getElementsByClassName&&aE.getElementsByClassName){b.apply(aP,aE.getElementsByClassName(aJ));return aP}}}}if(az.qsa&&(!aj||!aj.test(aL))){e=aG=aq;aF=aE;aM=aN===9&&aL;if(aN===1&&aE.nodeName.toLowerCase()!=="object"){aH=o(aL);if((aG=aE.getAttribute("id"))){e=aG.replace(T,"\\$&")}else{aE.setAttribute("id",e)}e="[id='"+e+"'] ";aO=aH.length;while(aO--){aH[aO]=e+p(aH[aO])}aF=ah.test(aL)&&Z(aE.parentNode)||aE;aM=aH.join(",")}if(aM){try{b.apply(aP,aF.querySelectorAll(aM));return aP}catch(aK){}finally{if(!aG){aE.removeAttribute("id")}}}}}return ay(aL.replace(y,"$1"),aE,aP,aR)}function G(){var i=[];function e(aE,aF){if(i.push(aE+" ")>u.cacheLength){delete e[i.shift()]}return(e[aE+" "]=aF)}return e}function q(e){e[aq]=true;return e}function m(i){var aF=I.createElement("div");try{return !!i(aF)}catch(aE){return false}finally{if(aF.parentNode){aF.parentNode.removeChild(aF)}aF=null}}function aB(aE,aG){var e=aE.split("|"),aF=aE.length;while(aF--){u.attrHandle[e[aF]]=aG}}function f(i,e){var aF=e&&i,aE=aF&&i.nodeType===1&&e.nodeType===1&&(~e.sourceIndex||W)-(~i.sourceIndex||W);if(aE){return aE}if(aF){while((aF=aF.nextSibling)){if(aF===e){return -1}}}return i?1:-1}function D(e){return function(aE){var i=aE.nodeName.toLowerCase();return i==="input"&&aE.type===e}}function g(e){return function(aE){var i=aE.nodeName.toLowerCase();return(i==="input"||i==="button")&&aE.type===e}}function an(e){return q(function(i){i=+i;return q(function(aE,aI){var aG,aF=e([],aE.length,i),aH=aF.length;while(aH--){if(aE[(aG=aF[aH])]){aE[aG]=!(aI[aG]=aE[aG])}}})})}function Z(e){return e&&typeof e.getElementsByTagName!==av&&e}az=C.support={};Q=C.isXML=function(e){var i=e&&(e.ownerDocument||e).documentElement;return i?i.nodeName!=="HTML":false};af=C.setDocument=function(aE){var e,aF=aE?aE.ownerDocument||aE:P,i=aF.defaultView;if(aF===I||aF.nodeType!==9||!aF.documentElement){return I}I=aF;v=aF.documentElement;ao=!Q(aF);if(i&&i!==i.top){if(i.addEventListener){i.addEventListener("unload",function(){af()},false)}else{if(i.attachEvent){i.attachEvent("onunload",function(){af()})}}}az.attributes=m(function(aG){aG.className="i";return !aG.getAttribute("className")});az.getElementsByTagName=m(function(aG){aG.appendChild(aF.createComment(""));return !aG.getElementsByTagName("*").length});az.getElementsByClassName=V.test(aF.getElementsByClassName)&&m(function(aG){aG.innerHTML="<div class='a'></div><div class='a i'></div>";aG.firstChild.className="i";return aG.getElementsByClassName("i").length===2});az.getById=m(function(aG){v.appendChild(aG).id=aq;return !aF.getElementsByName||!aF.getElementsByName(aq).length});if(az.getById){u.find.ID=function(aI,aH){if(typeof aH.getElementById!==av&&ao){var aG=aH.getElementById(aI);return aG&&aG.parentNode?[aG]:[]}};u.filter.ID=function(aH){var aG=aH.replace(z,al);return function(aI){return aI.getAttribute("id")===aG}}}else{delete u.find.ID;u.filter.ID=function(aH){var aG=aH.replace(z,al);return function(aJ){var aI=typeof aJ.getAttributeNode!==av&&aJ.getAttributeNode("id");return aI&&aI.value===aG}}}u.find.TAG=az.getElementsByTagName?function(aG,aH){if(typeof aH.getElementsByTagName!==av){return aH.getElementsByTagName(aG)}}:function(aG,aK){var aL,aJ=[],aI=0,aH=aK.getElementsByTagName(aG);if(aG==="*"){while((aL=aH[aI++])){if(aL.nodeType===1){aJ.push(aL)}}return aJ}return aH};u.find.CLASS=az.getElementsByClassName&&function(aH,aG){if(typeof aG.getElementsByClassName!==av&&ao){return aG.getElementsByClassName(aH)}};ax=[];aj=[];if((az.qsa=V.test(aF.querySelectorAll))){m(function(aG){aG.innerHTML="<select t=''><option selected=''></option></select>";if(aG.querySelectorAll("[t^='']").length){aj.push("[*^$]="+w+"*(?:''|\"\")")}if(!aG.querySelectorAll("[selected]").length){aj.push("\\["+w+"*(?:value|"+c+")")}if(!aG.querySelectorAll(":checked").length){aj.push(":checked")}});m(function(aH){var aG=aF.createElement("input");aG.setAttribute("type","hidden");aH.appendChild(aG).setAttribute("name","D");if(aH.querySelectorAll("[name=d]").length){aj.push("name"+w+"*[*^$|!~]?=")}if(!aH.querySelectorAll(":enabled").length){aj.push(":enabled",":disabled")}aH.querySelectorAll("*,:x");aj.push(",.*:")})}if((az.matchesSelector=V.test((l=v.webkitMatchesSelector||v.mozMatchesSelector||v.oMatchesSelector||v.msMatchesSelector)))){m(function(aG){az.disconnectedMatch=l.call(aG,"div");l.call(aG,"[s!='']:x");ax.push("!=",r)})}aj=aj.length&&new RegExp(aj.join("|"));ax=ax.length&&new RegExp(ax.join("|"));e=V.test(v.compareDocumentPosition);L=e||V.test(v.contains)?function(aH,aG){var aJ=aH.nodeType===9?aH.documentElement:aH,aI=aG&&aG.parentNode;return aH===aI||!!(aI&&aI.nodeType===1&&(aJ.contains?aJ.contains(aI):aH.compareDocumentPosition&&aH.compareDocumentPosition(aI)&16))}:function(aH,aG){if(aG){while((aG=aG.parentNode)){if(aG===aH){return true}}}return false};K=e?function(aH,aG){if(aH===aG){ad=true;return 0}var aI=!aH.compareDocumentPosition-!aG.compareDocumentPosition;if(aI){return aI}aI=(aH.ownerDocument||aH)===(aG.ownerDocument||aG)?aH.compareDocumentPosition(aG):1;if(aI&1||(!az.sortDetached&&aG.compareDocumentPosition(aH)===aI)){if(aH===aF||aH.ownerDocument===P&&L(P,aH)){return -1}if(aG===aF||aG.ownerDocument===P&&L(P,aG)){return 1}return O?(k.call(O,aH)-k.call(O,aG)):0}return aI&4?-1:1}:function(aH,aG){if(aH===aG){ad=true;return 0}var aN,aK=0,aM=aH.parentNode,aJ=aG.parentNode,aI=[aH],aL=[aG];if(!aM||!aJ){return aH===aF?-1:aG===aF?1:aM?-1:aJ?1:O?(k.call(O,aH)-k.call(O,aG)):0}else{if(aM===aJ){return f(aH,aG)}}aN=aH;while((aN=aN.parentNode)){aI.unshift(aN)}aN=aG;while((aN=aN.parentNode)){aL.unshift(aN)}while(aI[aK]===aL[aK]){aK++}return aK?f(aI[aK],aL[aK]):aI[aK]===P?-1:aL[aK]===P?1:0};return aF};C.matches=function(i,e){return C(i,null,null,e)};C.matchesSelector=function(aE,aG){if((aE.ownerDocument||aE)!==I){af(aE)}aG=aG.replace(A,"='$1']");if(az.matchesSelector&&ao&&(!ax||!ax.test(aG))&&(!aj||!aj.test(aG))){try{var i=l.call(aE,aG);if(i||az.disconnectedMatch||aE.document&&aE.document.nodeType!==11){return i}}catch(aF){}}return C(aG,I,null,[aE]).length>0};C.contains=function(e,i){if((e.ownerDocument||e)!==I){af(e)}return L(e,i)};C.attr=function(aE,e){if((aE.ownerDocument||aE)!==I){af(aE)}var i=u.attrHandle[e.toLowerCase()],aF=i&&U.call(u.attrHandle,e.toLowerCase())?i(aE,e,!ao):undefined;return aF!==undefined?aF:az.attributes||!ao?aE.getAttribute(e):(aF=aE.getAttributeNode(e))&&aF.specified?aF.value:null};C.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)};C.uniqueSort=function(aF){var aG,aH=[],e=0,aE=0;ad=!az.detectDuplicates;O=!az.sortStable&&aF.slice(0);aF.sort(K);if(ad){while((aG=aF[aE++])){if(aG===aF[aE]){e=aH.push(aE)}}while(e--){aF.splice(aH[e],1)}}O=null;return aF};N=C.getText=function(aH){var aG,aE="",aF=0,e=aH.nodeType;if(!e){while((aG=aH[aF++])){aE+=N(aG)}}else{if(e===1||e===9||e===11){if(typeof aH.textContent==="string"){return aH.textContent}else{for(aH=aH.firstChild;aH;aH=aH.nextSibling){aE+=N(aH)}}}else{if(e===3||e===4){return aH.nodeValue}}}return aE};u=C.selectors={cacheLength:50,createPseudo:q,match:ai,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:true}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:true},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){e[1]=e[1].replace(z,al);e[3]=(e[4]||e[5]||"").replace(z,al);if(e[2]==="~="){e[3]=" "+e[3]+" "}return e.slice(0,4)},CHILD:function(e){e[1]=e[1].toLowerCase();if(e[1].slice(0,3)==="nth"){if(!e[3]){C.error(e[0])}e[4]=+(e[4]?e[5]+(e[6]||1):2*(e[3]==="even"||e[3]==="odd"));e[5]=+((e[7]+e[8])||e[3]==="odd")}else{if(e[3]){C.error(e[0])}}return e},PSEUDO:function(i){var e,aE=!i[5]&&i[2];if(ai.CHILD.test(i[0])){return null}if(i[3]&&i[4]!==undefined){i[2]=i[4]}else{if(aE&&Y.test(aE)&&(e=o(aE,true))&&(e=aE.indexOf(")",aE.length-e)-aE.length)){i[0]=i[0].slice(0,e);i[2]=aE.slice(0,e)}}return i.slice(0,3)}},filter:{TAG:function(i){var e=i.replace(z,al).toLowerCase();return i==="*"?function(){return true}:function(aE){return aE.nodeName&&aE.nodeName.toLowerCase()===e}},CLASS:function(e){var i=d[e+" "];return i||(i=new RegExp("(^|"+w+")"+e+"("+w+"|$)"))&&d(e,function(aE){return i.test(typeof aE.className==="string"&&aE.className||typeof aE.getAttribute!==av&&aE.getAttribute("class")||"")})},ATTR:function(aE,i,e){return function(aG){var aF=C.attr(aG,aE);if(aF==null){return i==="!="}if(!i){return true}aF+="";return i==="="?aF===e:i==="!="?aF!==e:i==="^="?e&&aF.indexOf(e)===0:i==="*="?e&&aF.indexOf(e)>-1:i==="$="?e&&aF.slice(-e.length)===e:i==="~="?(" "+aF+" ").indexOf(e)>-1:i==="|="?aF===e||aF.slice(0,e.length+1)===e+"-":false}},CHILD:function(i,aG,aF,aH,aE){var aJ=i.slice(0,3)!=="nth",e=i.slice(-4)!=="last",aI=aG==="of-type";return aH===1&&aE===0?function(aK){return !!aK.parentNode}:function(aQ,aO,aT){var aK,aW,aR,aV,aS,aN,aP=aJ!==e?"nextSibling":"previousSibling",aU=aQ.parentNode,aM=aI&&aQ.nodeName.toLowerCase(),aL=!aT&&!aI;if(aU){if(aJ){while(aP){aR=aQ;while((aR=aR[aP])){if(aI?aR.nodeName.toLowerCase()===aM:aR.nodeType===1){return false}}aN=aP=i==="only"&&!aN&&"nextSibling"}return true}aN=[e?aU.firstChild:aU.lastChild];if(e&&aL){aW=aU[aq]||(aU[aq]={});aK=aW[i]||[];aS=aK[0]===aA&&aK[1];aV=aK[0]===aA&&aK[2];aR=aS&&aU.childNodes[aS];while((aR=++aS&&aR&&aR[aP]||(aV=aS=0)||aN.pop())){if(aR.nodeType===1&&++aV&&aR===aQ){aW[i]=[aA,aS,aV];break}}}else{if(aL&&(aK=(aQ[aq]||(aQ[aq]={}))[i])&&aK[0]===aA){aV=aK[1]}else{while((aR=++aS&&aR&&aR[aP]||(aV=aS=0)||aN.pop())){if((aI?aR.nodeName.toLowerCase()===aM:aR.nodeType===1)&&++aV){if(aL){(aR[aq]||(aR[aq]={}))[i]=[aA,aV]}if(aR===aQ){break}}}}}aV-=aE;return aV===aH||(aV%aH===0&&aV/aH>=0)}}},PSEUDO:function(aF,aE){var e,i=u.pseudos[aF]||u.setFilters[aF.toLowerCase()]||C.error("unsupported pseudo: "+aF);if(i[aq]){return i(aE)}if(i.length>1){e=[aF,aF,"",aE];return u.setFilters.hasOwnProperty(aF.toLowerCase())?q(function(aI,aK){var aH,aG=i(aI,aE),aJ=aG.length;while(aJ--){aH=k.call(aI,aG[aJ]);aI[aH]=!(aK[aH]=aG[aJ])}}):function(aG){return i(aG,0,e)}}return i}},pseudos:{not:q(function(e){var i=[],aE=[],aF=ac(e.replace(y,"$1"));return aF[aq]?q(function(aH,aM,aK,aI){var aL,aG=aF(aH,null,aI,[]),aJ=aH.length;while(aJ--){if((aL=aG[aJ])){aH[aJ]=!(aM[aJ]=aL)}}}):function(aI,aH,aG){i[0]=aI;aF(i,null,aG,aE);return !aE.pop()}}),has:q(function(e){return function(i){return C(e,i).length>0}}),contains:q(function(e){return function(i){return(i.textContent||i.innerText||N(i)).indexOf(e)>-1}}),lang:q(function(e){if(!aa.test(e||"")){C.error("unsupported lang: "+e)}e=e.replace(z,al).toLowerCase();return function(aE){var i;do{if((i=ao?aE.lang:aE.getAttribute("xml:lang")||aE.getAttribute("lang"))){i=i.toLowerCase();return i===e||i.indexOf(e+"-")===0}}while((aE=aE.parentNode)&&aE.nodeType===1);return false}}),target:function(e){var i=aw.location&&aw.location.hash;return i&&i.slice(1)===e.id},root:function(e){return e===v},focus:function(e){return e===I.activeElement&&(!I.hasFocus||I.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===false},disabled:function(e){return e.disabled===true},checked:function(e){var i=e.nodeName.toLowerCase();return(i==="input"&&!!e.checked)||(i==="option"&&!!e.selected)},selected:function(e){if(e.parentNode){e.parentNode.selectedIndex}return e.selected===true},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling){if(e.nodeType<6){return false}}return true},parent:function(e){return !u.pseudos.empty(e)},header:function(e){return s.test(e.nodeName)},input:function(e){return h.test(e.nodeName)},button:function(i){var e=i.nodeName.toLowerCase();return e==="input"&&i.type==="button"||e==="button"},text:function(i){var e;return i.nodeName.toLowerCase()==="input"&&i.type==="text"&&((e=i.getAttribute("type"))==null||e.toLowerCase()==="text")},first:an(function(){return[0]}),last:an(function(e,i){return[i-1]}),eq:an(function(e,aE,i){return[i<0?i+aE:i]}),even:an(function(e,aF){var aE=0;for(;aE<aF;aE+=2){e.push(aE)}return e}),odd:an(function(e,aF){var aE=1;for(;aE<aF;aE+=2){e.push(aE)}return e}),lt:an(function(e,aG,aF){var aE=aF<0?aF+aG:aF;for(;--aE>=0;){e.push(aE)}return e}),gt:an(function(e,aG,aF){var aE=aF<0?aF+aG:aF;for(;++aE<aG;){e.push(aE)}return e})}};u.pseudos.nth=u.pseudos.eq;for(E in {radio:true,checkbox:true,file:true,password:true,image:true}){u.pseudos[E]=D(E)}for(E in {submit:true,reset:true}){u.pseudos[E]=g(E)}function ab(){}ab.prototype=u.filters=u.pseudos;u.setFilters=new ab();function o(aG,aL){var i,aH,aJ,aK,aI,aE,e,aF=ap[aG+" "];if(aF){return aL?0:aF.slice(0)}aI=aG;aE=[];e=u.preFilter;while(aI){if(!i||(aH=B.exec(aI))){if(aH){aI=aI.slice(aH[0].length)||aI}aE.push((aJ=[]))}i=false;if((aH=H.exec(aI))){i=aH.shift();aJ.push({value:i,type:aH[0].replace(y," ")});aI=aI.slice(i.length)}for(aK in u.filter){if((aH=ai[aK].exec(aI))&&(!e[aK]||(aH=e[aK](aH)))){i=aH.shift();aJ.push({value:i,type:aK,matches:aH});aI=aI.slice(i.length)}}if(!i){break}}return aL?aI.length:aI?C.error(aG):ap(aG,aE).slice(0)}function p(aG){var aF=0,aE=aG.length,e="";for(;aF<aE;aF++){e+=aG[aF].value}return e}function x(aG,aE,aF){var e=aE.dir,aH=aF&&e==="parentNode",i=ak++;return aE.first?function(aK,aJ,aI){while((aK=aK[e])){if(aK.nodeType===1||aH){return aG(aK,aJ,aI)}}}:function(aM,aK,aJ){var aN,aL,aI=[aA,i];if(aJ){while((aM=aM[e])){if(aM.nodeType===1||aH){if(aG(aM,aK,aJ)){return true}}}}else{while((aM=aM[e])){if(aM.nodeType===1||aH){aL=aM[aq]||(aM[aq]={});if((aN=aL[e])&&aN[0]===aA&&aN[1]===i){return(aI[2]=aN[2])}else{aL[e]=aI;if((aI[2]=aG(aM,aK,aJ))){return true}}}}}}}function aC(e){return e.length>1?function(aH,aG,aE){var aF=e.length;while(aF--){if(!e[aF](aH,aG,aE)){return false}}return true}:e[0]}function F(aE,aH,aG){var aF=0,e=aH.length;for(;aF<e;aF++){C(aE,aH[aF],aG)}return aG}function ag(e,aE,aF,aG,aJ){var aH,aM=[],aI=0,aK=e.length,aL=aE!=null;for(;aI<aK;aI++){if((aH=e[aI])){if(!aF||aF(aH,aG,aJ)){aM.push(aH);if(aL){aE.push(aI)}}}}return aM}function n(aE,i,aG,aF,aH,e){if(aF&&!aF[aq]){aF=n(aF)}if(aH&&!aH[aq]){aH=n(aH,e)}return q(function(aS,aP,aK,aR){var aU,aQ,aM,aL=[],aT=[],aJ=aP.length,aI=aS||F(i||"*",aK.nodeType?[aK]:aK,[]),aN=aE&&(aS||!i)?ag(aI,aL,aE,aK,aR):aI,aO=aG?aH||(aS?aE:aJ||aF)?[]:aP:aN;if(aG){aG(aN,aO,aK,aR)}if(aF){aU=ag(aO,aT);aF(aU,[],aK,aR);aQ=aU.length;while(aQ--){if((aM=aU[aQ])){aO[aT[aQ]]=!(aN[aT[aQ]]=aM)}}}if(aS){if(aH||aE){if(aH){aU=[];aQ=aO.length;while(aQ--){if((aM=aO[aQ])){aU.push((aN[aQ]=aM))}}aH(null,(aO=[]),aU,aR)}aQ=aO.length;while(aQ--){if((aM=aO[aQ])&&(aU=aH?k.call(aS,aM):aL[aQ])>-1){aS[aU]=!(aP[aU]=aM)}}}}else{aO=ag(aO===aP?aO.splice(aJ,aO.length):aO);if(aH){aH(null,aP,aO,aR)}else{b.apply(aP,aO)}}})}function ar(aJ){var aE,aH,aF,aI=aJ.length,aM=u.relative[aJ[0].type],aN=aM||u.relative[" "],aG=aM?1:0,aK=x(function(i){return i===aE},aN,true),aL=x(function(i){return k.call(aE,i)>-1},aN,true),e=[function(aP,aO,i){return(!aM&&(i||aO!==aD))||((aE=aO).nodeType?aK(aP,aO,i):aL(aP,aO,i))}];for(;aG<aI;aG++){if((aH=u.relative[aJ[aG].type])){e=[x(aC(e),aH)]}else{aH=u.filter[aJ[aG].type].apply(null,aJ[aG].matches);if(aH[aq]){aF=++aG;for(;aF<aI;aF++){if(u.relative[aJ[aF].type]){break}}return n(aG>1&&aC(e),aG>1&&p(aJ.slice(0,aG-1).concat({value:aJ[aG-2].type===" "?"*":""})).replace(y,"$1"),aH,aG<aF&&ar(aJ.slice(aG,aF)),aF<aI&&ar((aJ=aJ.slice(aF))),aF<aI&&p(aJ))}e.push(aH)}}return aC(e)}function ae(aF,aE){var e=aE.length>0,aG=aF.length>0,i=function(aQ,aK,aP,aO,aT){var aL,aM,aR,aV=0,aN="0",aH=aQ&&[],aW=[],aU=aD,aJ=aQ||aG&&u.find.TAG("*",aT),aI=(aA+=aU==null?1:Math.random()||0.1),aS=aJ.length;if(aT){aD=aK!==I&&aK}for(;aN!==aS&&(aL=aJ[aN])!=null;aN++){if(aG&&aL){aM=0;while((aR=aF[aM++])){if(aR(aL,aK,aP)){aO.push(aL);break}}if(aT){aA=aI}}if(e){if((aL=!aR&&aL)){aV--}if(aQ){aH.push(aL)}}}aV+=aN;if(e&&aN!==aV){aM=0;while((aR=aE[aM++])){aR(aH,aW,aK,aP)}if(aQ){if(aV>0){while(aN--){if(!(aH[aN]||aW[aN])){aW[aN]=au.call(aO)}}}aW=ag(aW)}b.apply(aO,aW);if(aT&&!aQ&&aW.length>0&&(aV+aE.length)>1){C.uniqueSort(aO)}}if(aT){aA=aI;aD=aU}return aH};return e?q(i):i}ac=C.compile=function(e,aF){var aG,aE=[],aI=[],aH=M[e+" "];if(!aH){if(!aF){aF=o(e)}aG=aF.length;while(aG--){aH=ar(aF[aG]);if(aH[aq]){aE.push(aH)}else{aI.push(aH)}}aH=M(e,ae(aI,aE));aH.selector=e}return aH};ay=C.select=function(aF,e,aG,aJ){var aH,aM,aE,aN,aK,aL=typeof aF==="function"&&aF,aI=!aJ&&o((aF=aL.selector||aF));aG=aG||[];if(aI.length===1){aM=aI[0]=aI[0].slice(0);if(aM.length>2&&(aE=aM[0]).type==="ID"&&az.getById&&e.nodeType===9&&ao&&u.relative[aM[1].type]){e=(u.find.ID(aE.matches[0].replace(z,al),e)||[])[0];if(!e){return aG}else{if(aL){e=e.parentNode}}aF=aF.slice(aM.shift().value.length)}aH=ai.needsContext.test(aF)?0:aM.length;while(aH--){aE=aM[aH];if(u.relative[(aN=aE.type)]){break}if((aK=u.find[aN])){if((aJ=aK(aE.matches[0].replace(z,al),ah.test(aM[0].type)&&Z(e.parentNode)||e))){aM.splice(aH,1);aF=aJ.length&&p(aM);if(!aF){b.apply(aG,aJ);return aG}break}}}}(aL||ac(aF,aI))(aJ,e,!ao,aG,ah.test(aF)&&Z(e.parentNode)||e);return aG};az.sortStable=aq.split("").sort(K).join("")===aq;az.detectDuplicates=!!ad;af();az.sortDetached=m(function(e){return e.compareDocumentPosition(I.createElement("div"))&1});if(!m(function(e){e.innerHTML="<a href='#'></a>";return e.firstChild.getAttribute("href")==="#"})){aB("type|href|height|width",function(i,e,aE){if(!aE){return i.getAttribute(e,e.toLowerCase()==="type"?1:2)}})}if(!az.attributes||!m(function(e){e.innerHTML="<input/>";e.firstChild.setAttribute("value","");return e.firstChild.getAttribute("value")===""})){aB("value",function(i,e,aE){if(!aE&&i.nodeName.toLowerCase()==="input"){return i.defaultValue}})}if(!m(function(e){return e.getAttribute("disabled")==null})){aB(c,function(i,e,aF){var aE;if(!aF){return i[e]===true?e.toLowerCase():(aE=i.getAttributeNode(e))&&aE.specified?aE.value:null}})}if(typeof define==="function"&&define.amd){define(function(){return C})}else{if(typeof module!=="undefined"&&module.exports){module.exports=C}else{aw.Sizzle=C}}})(window);(function(){if(typeof Sizzle!=="undefined"){return}if(typeof define!=="undefined"&&define.amd){window.Sizzle=Prototype._actual_sizzle;window.define=Prototype._original_define;delete Prototype._actual_sizzle;delete Prototype._original_define}else{if(typeof module!=="undefined"&&module.exports){window.Sizzle=module.exports;module.exports={}}}})();(function(c){var d=Prototype.Selector.extendElements;function a(e,f){return d(c(e,f||document))}function b(f,e){return c.matches(e,[f]).length==1}Prototype.Selector.engine=c;Prototype.Selector.select=a;Prototype.Selector.match=b})(Sizzle);window.Sizzle=Prototype._original_property;delete Prototype._original_property;var Form={reset:function(a){a=$(a);a.reset();return a},serializeElements:function(h,d){if(typeof d!="object"){d={hash:!!d}}else{if(Object.isUndefined(d.hash)){d.hash=true}}var e,g,a=false,f=d.submit,b,c;if(d.hash){c={};b=function(i,k,l){if(k in i){if(!Object.isArray(i[k])){i[k]=[i[k]]}i[k]=i[k].concat(l)}else{i[k]=l}return i}}else{c="";b=function(i,l,k){if(!Object.isArray(k)){k=[k]}if(!k.length){return i}var m=encodeURIComponent(l).gsub(/%20/,"+");return i+(i?"&":"")+k.map(function(n){n=n.gsub(/(\r)?\n/,"\r\n");n=encodeURIComponent(n);n=n.gsub(/%20/,"+");return m+"="+n}).join("&")}}return h.inject(c,function(i,k){if(!k.disabled&&k.name){e=k.name;g=$(k).getValue();if(g!=null&&k.type!="file"&&(k.type!="submit"||(!a&&f!==false&&(!f||e==f)&&(a=true)))){i=b(i,e,g)}}return i})}};Form.Methods={serialize:function(b,a){return Form.serializeElements(Form.getElements(b),a)},getElements:function(e){var f=$(e).getElementsByTagName("*");var d,c=[],b=Form.Element.Serializers;for(var a=0;d=f[a];a++){if(b[d.tagName.toLowerCase()]){c.push(Element.extend(d))}}return c},getInputs:function(g,c,d){g=$(g);var a=g.getElementsByTagName("input");if(!c&&!d){return $A(a).map(Element.extend)}for(var e=0,h=[],f=a.length;e<f;e++){var b=a[e];if((c&&b.type!=c)||(d&&b.name!=d)){continue}h.push(Element.extend(b))}return h},disable:function(a){a=$(a);Form.getElements(a).invoke("disable");return a},enable:function(a){a=$(a);Form.getElements(a).invoke("enable");return a},findFirstElement:function(b){var c=$(b).getElements().findAll(function(d){return"hidden"!=d.type&&!d.disabled});var a=c.findAll(function(d){return d.hasAttribute("tabIndex")&&d.tabIndex>=0}).sortBy(function(d){return d.tabIndex}).first();return a?a:c.find(function(d){return/^(?:input|select|textarea)$/i.test(d.tagName)})},focusFirstElement:function(b){b=$(b);var a=b.findFirstElement();if(a){a.activate()}return b},request:function(b,a){b=$(b),a=Object.clone(a||{});var d=a.parameters,c=b.readAttribute("action")||"";if(c.blank()){c=window.location.href}a.parameters=b.serialize(true);if(d){if(Object.isString(d)){d=d.toQueryParams()}Object.extend(a.parameters,d)}if(b.hasAttribute("method")&&!a.method){a.method=b.method}return new Ajax.Request(c,a)}};Form.Element={focus:function(a){$(a).focus();return a},select:function(a){$(a).select();return a}};Form.Element.Methods={serialize:function(a){a=$(a);if(!a.disabled&&a.name){var b=a.getValue();if(b!=undefined){var c={};c[a.name]=b;return Object.toQueryString(c)}}return""},getValue:function(a){a=$(a);var b=a.tagName.toLowerCase();return Form.Element.Serializers[b](a)},setValue:function(a,b){a=$(a);var c=a.tagName.toLowerCase();Form.Element.Serializers[c](a,b);return a},clear:function(a){$(a).value="";return a},present:function(a){return $(a).value!=""},activate:function(a){a=$(a);try{a.focus();if(a.select&&(a.tagName.toLowerCase()!="input"||!(/^(?:button|reset|submit)$/i.test(a.type)))){a.select()}}catch(b){}return a},disable:function(a){a=$(a);a.disabled=true;return a},enable:function(a){a=$(a);a.disabled=false;return a}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers=(function(){function b(h,i){switch(h.type.toLowerCase()){case"checkbox":case"radio":return f(h,i);default:return e(h,i)}}function f(h,i){if(Object.isUndefined(i)){return h.checked?h.value:null}else{h.checked=!!i}}function e(h,i){if(Object.isUndefined(i)){return h.value}else{h.value=i}}function a(l,o){if(Object.isUndefined(o)){return(l.type==="select-one"?c:d)(l)}var k,m,p=!Object.isArray(o);for(var h=0,n=l.length;h<n;h++){k=l.options[h];m=this.optionValue(k);if(p){if(m==o){k.selected=true;return}}else{k.selected=o.include(m)}}}function c(i){var h=i.selectedIndex;return h>=0?g(i.options[h]):null}function d(m){var h,n=m.length;if(!n){return null}for(var l=0,h=[];l<n;l++){var k=m.options[l];if(k.selected){h.push(g(k))}}return h}function g(h){return Element.hasAttribute(h,"value")?h.value:h.text}return{input:b,inputSelector:f,textarea:e,select:a,selectOne:c,selectMany:d,optionValue:g,button:e}})();Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,a,b,c){$super(c,b);this.element=$(a);this.lastValue=this.getValue()},execute:function(){var a=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(a)?this.lastValue!=a:String(this.lastValue)!=String(a)){this.callback(this.element,a);this.lastValue=a}}});Form.Element.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.serialize(this.element)}});Abstract.EventObserver=Class.create({initialize:function(a,b){this.element=$(a);this.callback=b;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=="form"){this.registerFormCallbacks()}else{this.registerCallback(this.element)}},onElementEvent:function(){var a=this.getValue();if(this.lastValue!=a){this.callback(this.element,a);this.lastValue=a}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this)},registerCallback:function(a){if(a.type){switch(a.type.toLowerCase()){case"checkbox":case"radio":Event.observe(a,"click",this.onElementEvent.bind(this));break;default:Event.observe(a,"change",this.onElementEvent.bind(this));break}}}});Form.Element.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element)}});(function(E){var v=document.createElement("div");var d=document.documentElement;var l="onmouseenter" in d&&"onmouseleave" in d;var M={KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45};var B=function(Y){return false};if(window.attachEvent){if(window.addEventListener){B=function(Y){return !(Y instanceof window.Event)}}else{B=function(Y){return true}}}var P;function N(Z,Y){return Z.which?(Z.which===Y+1):(Z.button===Y)}var X={0:1,1:4,2:2};function T(Z,Y){return Z.button===X[Y]}function Q(Z,Y){switch(Y){case 0:return Z.which==1&&!Z.metaKey;case 1:return Z.which==2||(Z.which==1&&Z.metaKey);case 2:return Z.which==3;default:return false}}if(window.attachEvent){if(!window.addEventListener){P=T}else{P=function(Z,Y){return B(Z)?T(Z,Y):N(Z,Y)}}}else{if(Prototype.Browser.WebKit){P=Q}else{P=N}}function C(Y){return P(Y,0)}function i(Y){return P(Y,1)}function e(Y){return P(Y,2)}function p(Y){return Element.extend(L(Y))}function L(aa){aa=M.extend(aa);var Z=aa.target,Y=aa.type,ab=aa.currentTarget;if(ab&&ab.tagName){if(Y==="load"||Y==="error"||(Y==="click"&&ab.tagName.toLowerCase()==="input"&&ab.type==="radio")){Z=ab}}return Z.nodeType==Node.TEXT_NODE?Z.parentNode:Z}function k(aa,ab){var Z=L(aa),Y=Prototype.Selector;if(!ab){return Element.extend(Z)}while(Z){if(Object.isElement(Z)&&Y.match(Z,ab)){return Element.extend(Z)}Z=Z.parentNode}}function u(Y){return{x:V(Y),y:U(Y)}}function V(aa){var Z=document.documentElement,Y=document.body||{scrollLeft:0};return aa.pageX||(aa.clientX+(Z.scrollLeft||Y.scrollLeft)-(Z.clientLeft||0))}function U(aa){var Z=document.documentElement,Y=document.body||{scrollTop:0};return aa.pageY||(aa.clientY+(Z.scrollTop||Y.scrollTop)-(Z.clientTop||0))}function s(Y){M.extend(Y);Y.preventDefault();Y.stopPropagation();Y.stopped=true}M.Methods={isLeftClick:C,isMiddleClick:i,isRightClick:e,element:p,findElement:k,pointer:u,pointerX:V,pointerY:U,stop:s};var I=Object.keys(M.Methods).inject({},function(Y,Z){Y[Z]=M.Methods[Z].methodize();return Y});if(window.attachEvent){function W(Z){var Y;switch(Z.type){case"mouseover":case"mouseenter":Y=Z.fromElement;break;case"mouseout":case"mouseleave":Y=Z.toElement;break;default:return null}return Element.extend(Y)}var R={stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}};M.extend=function(Z,Y){if(!Z){return false}if(!B(Z)){return Z}if(Z._extendedByPrototype){return Z}Z._extendedByPrototype=Prototype.emptyFunction;var aa=M.pointer(Z);Object.extend(Z,{target:Z.srcElement||Y,relatedTarget:W(Z),pageX:aa.x,pageY:aa.y});Object.extend(Z,I);Object.extend(Z,R);return Z}}else{M.extend=Prototype.K}if(window.addEventListener){M.prototype=window.Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(M.prototype,I)}var w={mouseenter:"mouseover",mouseleave:"mouseout"};function f(Y){return w[Y]||Y}if(l){f=Prototype.K}function S(Y){if(Y===window){return 0}if(typeof Y._prototypeUID==="undefined"){Y._prototypeUID=Element.Storage.UID++}return Y._prototypeUID}function J(Y){if(Y===window){return 0}if(Y==document){return 1}return Y.uniqueID}if("uniqueID" in v){S=J}function y(Y){return Y.include(":")}M._isCustomEvent=y;function A(aa,Z){var Y=E.Event.cache;if(Object.isUndefined(Z)){Z=S(aa)}if(!Y[Z]){Y[Z]={element:aa}}return Y[Z]}function F(Z,Y){if(Object.isUndefined(Y)){Y=S(Z)}delete E.Event.cache[Y]}function h(aa,ad,ag){var Y=A(aa);if(!Y[ad]){Y[ad]=[]}var ac=Y[ad];var ab=ac.length;while(ab--){if(ac[ab].handler===ag){return null}}var ae=S(aa);var Z=E.Event._createResponder(ae,ad,ag);var af={responder:Z,handler:ag};ac.push(af);return af}function t(ad,aa,ae){var Z=A(ad);var Y=Z[aa]||[];var ac=Y.length,af;while(ac--){if(Y[ac].handler===ae){af=Y[ac];break}}if(af){var ab=Y.indexOf(af);Y.splice(ab,1)}if(Y.length===0){delete Z[aa];if(Object.keys(Z).length===1&&("element" in Z)){F(ad)}}return af}function c(aa,Z,ab){aa=$(aa);var ac=h(aa,Z,ab);if(ac===null){return aa}var Y=ac.responder;if(y(Z)){q(aa,Z,Y)}else{n(aa,Z,Y)}return aa}function n(ab,aa,Z){var Y=f(aa);if(ab.addEventListener){ab.addEventListener(Y,Z,false)}else{ab.attachEvent("on"+Y,Z)}}function q(aa,Z,Y){if(aa.addEventListener){aa.addEventListener("dataavailable",Y,false)}else{aa.attachEvent("ondataavailable",Y);aa.attachEvent("onlosecapture",Y)}}function K(Z,Y,aa){Z=$(Z);var ac=!Object.isUndefined(aa),ad=!Object.isUndefined(Y);if(!ad&&!ac){z(Z);return Z}if(!ac){H(Z,Y);return Z}var ab=t(Z,Y,aa);if(!ab){return Z}a(Z,Y,ab.responder);return Z}function D(ab,aa,Z){var Y=f(aa);if(ab.removeEventListener){ab.removeEventListener(Y,Z,false)}else{ab.detachEvent("on"+Y,Z)}}function b(aa,Z,Y){if(aa.removeEventListener){aa.removeEventListener("dataavailable",Y,false)}else{aa.detachEvent("ondataavailable",Y);aa.detachEvent("onlosecapture",Y)}}function z(ad){var ac=S(ad),aa=E.Event.cache[ac];if(!aa){return}F(ad,ac);var Y,ab;for(var Z in aa){if(Z==="element"){continue}Y=aa[Z];ab=Y.length;while(ab--){a(ad,Z,Y[ab].responder)}}}function H(ad,aa){var Z=A(ad);var Y=Z[aa];if(Y){delete Z[aa]}Y=Y||[];var ac=Y.length;while(ac--){a(ad,aa,Y[ac].responder)}for(var ab in Z){if(ab==="element"){continue}return}F(ad)}function a(Z,Y,aa){if(y(Y)){b(Z,Y,aa)}else{D(Z,Y,aa)}}function g(Y){if(Y!==document){return Y}if(document.createEvent&&!Y.dispatchEvent){return document.documentElement}return Y}function x(ab,aa,Z,Y){ab=g($(ab));if(Object.isUndefined(Y)){Y=true}Z=Z||{};var ac=O(ab,aa,Z,Y);return M.extend(ac)}function m(ab,aa,Z,Y){var ac=document.createEvent("HTMLEvents");ac.initEvent("dataavailable",Y,true);ac.eventName=aa;ac.memo=Z;ab.dispatchEvent(ac);return ac}function o(ab,aa,Z,Y){var ac=document.createEventObject();ac.eventType=Y?"ondataavailable":"onlosecapture";ac.eventName=aa;ac.memo=Z;ab.fireEvent(ac.eventType,ac);return ac}var O=document.createEvent?m:o;M.Handler=Class.create({initialize:function(aa,Z,Y,ab){this.element=$(aa);this.eventName=Z;this.selector=Y;this.callback=ab;this.handler=this.handleEvent.bind(this)},start:function(){M.observe(this.element,this.eventName,this.handler);return this},stop:function(){M.stopObserving(this.element,this.eventName,this.handler);return this},handleEvent:function(Z){var Y=M.findElement(Z,this.selector);if(Y){this.callback.call(this.element,Z,Y)}}});function G(aa,Z,Y,ab){aa=$(aa);if(Object.isFunction(Y)&&Object.isUndefined(ab)){ab=Y,Y=null}return new M.Handler(aa,Z,Y,ab).start()}Object.extend(M,M.Methods);Object.extend(M,{fire:x,observe:c,stopObserving:K,on:G});Element.addMethods({fire:x,observe:c,stopObserving:K,on:G});Object.extend(document,{fire:x.methodize(),observe:c.methodize(),stopObserving:K.methodize(),on:G.methodize(),loaded:false});if(E.Event){Object.extend(window.Event,M)}else{E.Event=M}E.Event.cache={};function r(){E.Event.cache=null}if(window.attachEvent){window.attachEvent("onunload",r)}v=null;d=null})(this);(function(c){var g=document.documentElement;var b="onmouseenter" in g&&"onmouseleave" in g;function f(h){return !b&&(h==="mouseenter"||h==="mouseleave")}function d(i,h,k){if(Event._isCustomEvent(h)){return e(i,h,k)}if(f(h)){return a(i,h,k)}return function(m){if(!Event.cache){return}var l=Event.cache[i].element;Event.extend(m,l);k.call(l,m)}}function e(i,h,k){return function(n){var l=Event.cache[i];var m=l&&l.element;if(Object.isUndefined(n.eventName)){return false}if(n.eventName!==h){return false}Event.extend(n,m);k.call(m,n)}}function a(i,h,k){return function(n){var l=Event.cache[i].element;Event.extend(n,l);var m=n.relatedTarget;while(m&&m!==l){try{m=m.parentNode}catch(o){m=l}}if(m===l){return}k.call(l,n)}}c.Event._createResponder=d;g=null})(this);(function(a){var e;function b(){if(document.loaded){return}if(e){window.clearTimeout(e)}document.loaded=true;document.fire("dom:loaded")}function d(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",d);b()}}function c(){try{document.documentElement.doScroll("left")}catch(f){e=c.defer();return}b()}if(document.readyState==="complete"){b();return}if(document.addEventListener){document.addEventListener("DOMContentLoaded",b,false)}else{document.attachEvent("onreadystatechange",d);if(window==top){e=c.defer()}}Event.observe(window,"load",b)})(this);Element.addMethods();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.addMethods({childOf:Element.Methods.descendantOf});var Insertion={Before:function(a,b){return Element.insert(a,{before:b})},Top:function(a,b){return Element.insert(a,{top:b})},Bottom:function(a,b){return Element.insert(a,{bottom:b})},After:function(a,b){return Element.insert(a,{after:b})}};var $continue=new Error('"throw $continue" is deprecated, use "return" instead');var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},within:function(b,a,c){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(b,a,c)}this.xcomp=a;this.ycomp=c;this.offset=Element.cumulativeOffset(b);return(c>=this.offset[1]&&c<this.offset[1]+b.offsetHeight&&a>=this.offset[0]&&a<this.offset[0]+b.offsetWidth)},withinIncludingScrolloffsets:function(b,a,d){var c=Element.cumulativeScrollOffset(b);this.xcomp=a+c[0]-this.deltaX;this.ycomp=d+c[1]-this.deltaY;this.offset=Element.cumulativeOffset(b);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+b.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+b.offsetWidth)},overlap:function(b,a){if(!b){return 0}if(b=="vertical"){return((this.offset[1]+a.offsetHeight)-this.ycomp)/a.offsetHeight}if(b=="horizontal"){return((this.offset[0]+a.offsetWidth)-this.xcomp)/a.offsetWidth}},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(a){Position.prepare();return Element.absolutize(a)},relativize:function(a){Position.prepare();return Element.relativize(a)},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(b,c,a){a=a||{};return Element.clonePosition(c,b,a)}};if(!document.getElementsByClassName){document.getElementsByClassName=function(b){function a(c){return c.blank()?null:"[contains(concat(' ', @class, ' '), ' "+c+" ')]"}b.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(c,e){e=e.toString().strip();var d=/\s/.test(e)?$w(e).map(a).join(""):a(e);return d?document._getElementsByXPath(".//*"+d,c):[]}:function(e,f){f=f.toString().strip();var g=[],h=(/\s/.test(f)?$w(f):null);if(!h&&!f){return g}var c=$(e).getElementsByTagName("*");f=" "+f+" ";for(var d=0,l,k;l=c[d];d++){if(l.className&&(k=" "+l.className+" ")&&(k.include(f)||(h&&h.all(function(i){return !i.toString().blank()&&k.include(" "+i+" ")})))){g.push(Element.extend(l))}}return g};return function(d,c){return $(c||document.body).getElementsByClassName(d)}}(Element.Methods)}Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(a){this.element=$(a)},_each:function(b,a){this.element.className.split(/\s+/).select(function(c){return c.length>0})._each(b,a)},set:function(a){this.element.className=a},add:function(a){if(this.include(a)){return}this.set($A(this).concat(a).join(" "))},remove:function(a){if(!this.include(a)){return}this.set($A(this).without(a).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);(function(){window.Selector=Class.create({initialize:function(a){this.expression=a.strip()},findElements:function(a){return Prototype.Selector.select(this.expression,a)},match:function(a){return Prototype.Selector.match(a,this.expression)},toString:function(){return this.expression},inspect:function(){return"#<Selector: "+this.expression+">"}});Object.extend(Selector,{matchElements:function(f,g){var a=Prototype.Selector.match,d=[];for(var c=0,e=f.length;c<e;c++){var b=f[c];if(a(b,g)){d.push(Element.extend(b))}}return d},findElement:function(f,g,b){b=b||0;var a=0,d;for(var c=0,e=f.length;c<e;c++){d=f[c];if(Prototype.Selector.match(d,g)&&b===a++){return Element.extend(d)}}},findChildElements:function(b,c){var a=c.toArray().join(", ");return Prototype.Selector.select(a,b||document)}})})();var Window=Class.create();Window.keepMultiModalWindow=false;Window.hasEffectLib=(typeof Effect!="undefined");Window.resizeEffectDuration=0.4;Window.prototype={initialize:function(){var c;var b=0;if(arguments.length>0){if(typeof arguments[0]=="string"){c=arguments[0];b=1}else{c=arguments[0]?arguments[0].id:null}}if(!c){c="window_"+new Date().getTime()}if($(c)){alert("Window "+c+" is already registered in the DOM! Make sure you use setDestroyOnClose() or destroyOnClose: true in the constructor")}this.options=Object.extend({className:"dialog",blurClassName:null,minWidth:100,minHeight:20,resizable:true,closable:true,minimizable:true,maximizable:true,draggable:true,userData:null,showEffect:(Window.hasEffectLib?Effect.Appear:Element.show),hideEffect:(Window.hasEffectLib?Effect.Fade:Element.hide),showEffectOptions:{},hideEffectOptions:{},effectOptions:null,parent:document.body,title:" ",url:null,onload:Prototype.emptyFunction,width:200,height:300,opacity:1,recenterAuto:true,wiredDrag:false,closeCallback:null,destroyOnClose:false,gridX:1,gridY:1},arguments[b]||{});if(this.options.blurClassName){this.options.focusClassName=this.options.className}if(typeof this.options.top=="undefined"&&typeof this.options.bottom=="undefined"){this.options.top=this._round(Math.random()*500,this.options.gridY)}if(typeof this.options.left=="undefined"&&typeof this.options.right=="undefined"){this.options.left=this._round(Math.random()*500,this.options.gridX)}if(this.options.effectOptions){Object.extend(this.options.hideEffectOptions,this.options.effectOptions);Object.extend(this.options.showEffectOptions,this.options.effectOptions);if(this.options.showEffect==Element.Appear){this.options.showEffectOptions.to=this.options.opacity}}if(Window.hasEffectLib){if(this.options.showEffect==Effect.Appear){this.options.showEffectOptions.to=this.options.opacity}if(this.options.hideEffect==Effect.Fade){this.options.hideEffectOptions.from=this.options.opacity}}if(this.options.hideEffect==Element.hide){this.options.hideEffect=function(){Element.hide(this.element);if(this.options.destroyOnClose){this.destroy()}}.bind(this)}if(this.options.parent!=document.body){this.options.parent=$(this.options.parent)}this.element=this._createWindow(c);this.element.win=this;this.eventMouseDown=this._initDrag.bindAsEventListener(this);this.eventMouseUp=this._endDrag.bindAsEventListener(this);this.eventMouseMove=this._updateDrag.bindAsEventListener(this);this.eventOnLoad=this._getWindowBorderSize.bindAsEventListener(this);this.eventMouseDownContent=this.toFront.bindAsEventListener(this);this.eventResize=this._recenter.bindAsEventListener(this);this.topbar=$(this.element.id+"_top");this.bottombar=$(this.element.id+"_bottom");this.content=$(this.element.id+"_content");Event.observe(this.topbar,"mousedown",this.eventMouseDown);Event.observe(this.bottombar,"mousedown",this.eventMouseDown);Event.observe(this.content,"mousedown",this.eventMouseDownContent);Event.observe(window,"load",this.eventOnLoad);Event.observe(window,"resize",this.eventResize);Event.observe(window,"scroll",this.eventResize);Event.observe(this.options.parent,"scroll",this.eventResize);if(this.options.draggable){var a=this;[this.topbar,this.topbar.up().previous(),this.topbar.up().next()].each(function(d){d.observe("mousedown",a.eventMouseDown);d.addClassName("top_draggable")});[this.bottombar.up(),this.bottombar.up().previous(),this.bottombar.up().next()].each(function(d){d.observe("mousedown",a.eventMouseDown);d.addClassName("bottom_draggable")})}if(this.options.resizable){this.sizer=$(this.element.id+"_sizer");Event.observe(this.sizer,"mousedown",this.eventMouseDown)}this.useLeft=null;this.useTop=null;if(typeof this.options.left!="undefined"){this.element.setStyle({left:parseFloat(this.options.left)+"px"});this.useLeft=true}else{this.element.setStyle({right:parseFloat(this.options.right)+"px"});this.useLeft=false}if(typeof this.options.top!="undefined"){this.element.setStyle({top:parseFloat(this.options.top)+"px"});this.useTop=true}else{this.element.setStyle({bottom:parseFloat(this.options.bottom)+"px"});this.useTop=false}this.storedLocation=null;this.setOpacity(this.options.opacity);if(this.options.zIndex){this.setZIndex(this.options.zIndex)}if(this.options.destroyOnClose){this.setDestroyOnClose(true)}this._getWindowBorderSize();this.width=this.options.width;this.height=this.options.height;this.visible=false;this.constraint=false;this.constraintPad={top:0,left:0,bottom:0,right:0};if(this.width&&this.height){this.setSize(this.options.width,this.options.height)}this.setTitle(this.options.title);Windows.register(this)},destroy:function(){this._notify("onDestroy");Event.stopObserving(this.topbar,"mousedown",this.eventMouseDown);Event.stopObserving(this.bottombar,"mousedown",this.eventMouseDown);Event.stopObserving(this.content,"mousedown",this.eventMouseDownContent);Event.stopObserving(window,"load",this.eventOnLoad);Event.stopObserving(window,"resize",this.eventResize);Event.stopObserving(window,"scroll",this.eventResize);Event.stopObserving(this.options.parent,"scroll",this.eventResize);Event.stopObserving(this.content,"load",this.options.onload);if(this._oldParent){var c=this.getContent();var a=null;for(var b=0;b<c.childNodes.length;b++){a=c.childNodes[b];if(a.nodeType==1){break}a=null}if(a){this._oldParent.appendChild(a)}this._oldParent=null}if(this.sizer){Event.stopObserving(this.sizer,"mousedown",this.eventMouseDown)}if(this.options.url){this.content.src=null}if(this.wiredElement){this.wiredElement.remove()}if(this.iefix){Element.remove(this.iefix)}Element.remove(this.element);Windows.unregister(this)},setCloseCallback:function(a){this.options.closeCallback=a},getContent:function(){return this.content},setContent:function(h,g,b){var a=$(h);if(null==a){throw"Unable to find element '"+h+"' in DOM"}this._oldParent=a.parentNode;var f=null;var e=null;if(g){f=Element.getDimensions(a)}if(b){e=Position.cumulativeOffset(a)}var c=this.getContent();this.setHTMLContent("");c=this.getContent();c.appendChild(a);a.show();if(g){this.setSize(f.width,f.height)}if(b){this.setLocation(e[1]-this.heightN,e[0]-this.widthW)}},setHTMLContent:function(a){if(this.options.url){this.content.src=null;this.options.url=null;var b='<div id="'+this.getId()+'_content" class="'+this.options.className+'_content"> </div>';$(this.getId()+"_table_content").innerHTML=b;this.content=$(this.element.id+"_content")}this.getContent().update(a);return this},setAjaxContent:function(b,a,d,c){this.showFunction=d?"showCenter":"show";this.showModal=c||false;a=a||{};this.setHTMLContent("");this.onComplete=a.onComplete;if(!this._onCompleteHandler){this._onCompleteHandler=this._setAjaxContent.bind(this)}a.onComplete=this._onCompleteHandler;new Ajax.Request(b,a);a.onComplete=this.onComplete},_setAjaxContent:function(a){Element.update(this.getContent(),a.responseText);if(this.onComplete){this.onComplete(a)}this.onComplete=null;this[this.showFunction](this.showModal)},setURL:function(a){if(this.options.url){this.content.src=null}this.options.url=a;var b="<iframe frameborder='0' name='"+this.getId()+"_content' id='"+this.getId()+"_content' src='"+a+"' width='"+this.width+"' height='"+this.height+"'> </iframe>";$(this.getId()+"_table_content").innerHTML=b;this.content=$(this.element.id+"_content")},getURL:function(){return this.options.url?this.options.url:null},refresh:function(){if(this.options.url){$(this.element.getAttribute("id")+"_content").src=this.options.url}},setCookie:function(b,c,o,e,a){b=b||this.element.id;this.cookie=[b,c,o,e,a];var m=WindowUtilities.getCookie(b);if(m){var n=m.split(",");var k=n[0].split(":");var i=n[1].split(":");var l=parseFloat(n[2]),f=parseFloat(n[3]);var g=n[4];var d=n[5];this.setSize(l,f);if(g=="true"){this.doMinimize=true}else{if(d=="true"){this.doMaximize=true}}this.useLeft=k[0]=="l";this.useTop=i[0]=="t";this.element.setStyle(this.useLeft?{left:k[1]}:{right:k[1]});this.element.setStyle(this.useTop?{top:i[1]}:{bottom:i[1]})}},getId:function(){return this.element.id},setDestroyOnClose:function(){this.options.destroyOnClose=true},setConstraint:function(a,b){this.constraint=a;this.constraintPad=Object.extend(this.constraintPad,b||{});if(this.useTop&&this.useLeft){this.setLocation(parseFloat(this.element.style.top),parseFloat(this.element.style.left))}},_initDrag:function(b){if(Event.element(b)==this.sizer&&this.isMinimized()){return}if(Event.element(b)!=this.sizer&&this.isMaximized()){return}if(Prototype.Browser.IE&&this.heightN==0){this._getWindowBorderSize()}this.pointer=[this._round(Event.pointerX(b),this.options.gridX),this._round(Event.pointerY(b),this.options.gridY)];if(this.options.wiredDrag){this.currentDrag=this._createWiredElement()}else{this.currentDrag=this.element}if(Event.element(b)==this.sizer){this.doResize=true;this.widthOrg=this.width;this.heightOrg=this.height;this.bottomOrg=parseFloat(this.element.getStyle("bottom"));this.rightOrg=parseFloat(this.element.getStyle("right"));this._notify("onStartResize")}else{this.doResize=false;var a=$(this.getId()+"_close");if(a&&Position.within(a,this.pointer[0],this.pointer[1])){this.currentDrag=null;return}this.toFront();if(!this.options.draggable){return}this._notify("onStartMove")}Event.observe(document,"mouseup",this.eventMouseUp,false);Event.observe(document,"mousemove",this.eventMouseMove,false);WindowUtilities.disableScreen("__invisible__","__invisible__",this.overlayOpacity);document.body.ondrag=function(){return false};document.body.onselectstart=function(){return false};this.currentDrag.show();Event.stop(b)},_round:function(b,a){return a==1?b:b=Math.floor(b/a)*a},_updateDrag:function(b){var a=[this._round(Event.pointerX(b),this.options.gridX),this._round(Event.pointerY(b),this.options.gridY)];var l=a[0]-this.pointer[0];var k=a[1]-this.pointer[1];if(this.doResize){var i=this.widthOrg+l;var d=this.heightOrg+k;l=this.width-this.widthOrg;k=this.height-this.heightOrg;if(this.useLeft){i=this._updateWidthConstraint(i)}else{this.currentDrag.setStyle({right:(this.rightOrg-l)+"px"})}if(this.useTop){d=this._updateHeightConstraint(d)}else{this.currentDrag.setStyle({bottom:(this.bottomOrg-k)+"px"})}this.setSize(i,d);this._notify("onResize")}else{this.pointer=a;if(this.useLeft){var c=parseFloat(this.currentDrag.getStyle("left"))+l;var g=this._updateLeftConstraint(c);this.pointer[0]+=g-c;this.currentDrag.setStyle({left:g+"px"})}else{this.currentDrag.setStyle({right:parseFloat(this.currentDrag.getStyle("right"))-l+"px"})}if(this.useTop){var f=parseFloat(this.currentDrag.getStyle("top"))+k;var e=this._updateTopConstraint(f);this.pointer[1]+=e-f;this.currentDrag.setStyle({top:e+"px"})}else{this.currentDrag.setStyle({bottom:parseFloat(this.currentDrag.getStyle("bottom"))-k+"px"})}this._notify("onMove")}if(this.iefix){this._fixIEOverlapping()}this._removeStoreLocation();Event.stop(b)},_endDrag:function(a){WindowUtilities.enableScreen("__invisible__");if(this.doResize){this._notify("onEndResize")}else{this._notify("onEndMove")}Event.stopObserving(document,"mouseup",this.eventMouseUp,false);Event.stopObserving(document,"mousemove",this.eventMouseMove,false);Event.stop(a);this._hideWiredElement();this._saveCookie();document.body.ondrag=null;document.body.onselectstart=null},_updateLeftConstraint:function(b){if(this.constraint&&this.useLeft&&this.useTop){var a=this.options.parent==document.body?WindowUtilities.getPageSize().windowWidth:this.options.parent.getDimensions().width;if(b<this.constraintPad.left){b=this.constraintPad.left}if(b+this.width+this.widthE+this.widthW>a-this.constraintPad.right){b=a-this.constraintPad.right-this.width-this.widthE-this.widthW}}return b},_updateTopConstraint:function(c){if(this.constraint&&this.useLeft&&this.useTop){var a=this.options.parent==document.body?WindowUtilities.getPageSize().windowHeight:this.options.parent.getDimensions().height;var b=this.height+this.heightN+this.heightS;if(c<this.constraintPad.top){c=this.constraintPad.top}if(c+b>a-this.constraintPad.bottom){c=a-this.constraintPad.bottom-b}}return c},_updateWidthConstraint:function(a){if(this.constraint&&this.useLeft&&this.useTop){var b=this.options.parent==document.body?WindowUtilities.getPageSize().windowWidth:this.options.parent.getDimensions().width;var c=parseFloat(this.element.getStyle("left"));if(c+a+this.widthE+this.widthW>b-this.constraintPad.right){a=b-this.constraintPad.right-c-this.widthE-this.widthW}}return a},_updateHeightConstraint:function(b){if(this.constraint&&this.useLeft&&this.useTop){var a=this.options.parent==document.body?WindowUtilities.getPageSize().windowHeight:this.options.parent.getDimensions().height;var c=parseFloat(this.element.getStyle("top"));if(c+b+this.heightN+this.heightS>a-this.constraintPad.bottom){b=a-this.constraintPad.bottom-c-this.heightN-this.heightS}}return b},_createWindow:function(a){var f=this.options.className;var d=document.createElement("div");d.setAttribute("id",a);d.className="dialog";var e;if(this.options.url){e='<iframe frameborder="0" name="'+a+'_content" id="'+a+'_content" src="'+this.options.url+'"> </iframe>'}else{e='<div id="'+a+'_content" class="'+f+'_content"> </div>'}var g=this.options.closable?"<div class='"+f+"_close' id='"+a+"_close' onclick='Windows.close(\""+a+"\", event)'> </div>":"";var h=this.options.minimizable?"<div class='"+f+"_minimize' id='"+a+"_minimize' onclick='Windows.minimize(\""+a+"\", event)'> </div>":"";var i=this.options.maximizable?"<div class='"+f+"_maximize' id='"+a+"_maximize' onclick='Windows.maximize(\""+a+"\", event)'> </div>":"";var c=this.options.resizable?"class='"+f+"_sizer' id='"+a+"_sizer'":"class='"+f+"_se'";var b="../themes/default/blank.gif";d.innerHTML=g+h+i+" <table id='"+a+"_row1' class=\"top table_window\"> <tr> <td class='"+f+"_nw'></td> <td class='"+f+"_n'><div id='"+a+"_top' class='"+f+"_title title_window'>"+this.options.title+"</div></td> <td class='"+f+"_ne'></td> </tr> </table> <table id='"+a+"_row2' class=\"mid table_window\"> <tr> <td class='"+f+"_w'></td> <td id='"+a+"_table_content' class='"+f+"_content' valign='top'>"+e+"</td> <td class='"+f+"_e'></td> </tr> </table> <table id='"+a+"_row3' class=\"bot table_window\"> <tr> <td class='"+f+"_sw'></td> <td class='"+f+"_s'><div id='"+a+"_bottom' class='status_bar'><span style='float:left; width:1px; height:1px'></span></div></td> <td "+c+"></td> </tr> </table> ";Element.hide(d);this.options.parent.insertBefore(d,this.options.parent.firstChild);Event.observe($(a+"_content"),"load",this.options.onload);return d},changeClassName:function(a){var b=this.options.className;var c=this.getId();$A(["_close","_minimize","_maximize","_content"]).each(function(d){this._toggleClassName($(c+d),b+d,a+d)}.bind(this));this._toggleClassName($(c+"_top"),b+"_title",a+"_title");$$("#"+c+" td").each(function(d){d.className=d.className.sub(b,a)});this.options.className=a;this._getWindowBorderSize();this.setSize(this.width,this.height)},_toggleClassName:function(c,b,a){if(c){c.removeClassName(b);c.addClassName(a)}},setLocation:function(c,b){c=this._updateTopConstraint(c);b=this._updateLeftConstraint(b);var a=this.currentDrag||this.element;a.setStyle({top:c+"px"});a.setStyle({left:b+"px"});this.useLeft=true;this.useTop=true},getLocation:function(){var a={};if(this.useTop){a=Object.extend(a,{top:this.element.getStyle("top")})}else{a=Object.extend(a,{bottom:this.element.getStyle("bottom")})}if(this.useLeft){a=Object.extend(a,{left:this.element.getStyle("left")})}else{a=Object.extend(a,{right:this.element.getStyle("right")})}return a},getSize:function(){return{width:this.width,height:this.height}},setSize:function(c,b,a){c=parseFloat(c);b=parseFloat(b);if(!this.minimized&&c<this.options.minWidth){c=this.options.minWidth}if(!this.minimized&&b<this.options.minHeight){b=this.options.minHeight}if(this.options.maxHeight&&b>this.options.maxHeight){b=this.options.maxHeight}if(this.options.maxWidth&&c>this.options.maxWidth){c=this.options.maxWidth}if(this.useTop&&this.useLeft&&Window.hasEffectLib&&Effect.ResizeWindow&&a){new Effect.ResizeWindow(this,null,null,c,b,{duration:Window.resizeEffectDuration})}else{this.width=c;this.height=b;var f=this.currentDrag?this.currentDrag:this.element;f.setStyle({width:c+this.widthW+this.widthE+"px"});f.setStyle({height:b+this.heightN+this.heightS+"px"});if(!this.currentDrag||this.currentDrag==this.element){var d=$(this.element.id+"_content");d.setStyle({height:b+"px"});d.setStyle({width:c+"px"})}}},updateHeight:function(){this.setSize(this.width,this.content.scrollHeight,true)},updateWidth:function(){this.setSize(this.content.scrollWidth,this.height,true)},toFront:function(){if(this.element.style.zIndex<Windows.maxZIndex){this.setZIndex(Windows.maxZIndex+1)}if(this.iefix){this._fixIEOverlapping()}},getBounds:function(b){if(!this.width||!this.height||!this.visible){this.computeBounds()}var a=this.width;var c=this.height;if(!b){a+=this.widthW+this.widthE;c+=this.heightN+this.heightS}var d=Object.extend(this.getLocation(),{width:a+"px",height:c+"px"});return d},computeBounds:function(){if(!this.width||!this.height){var a=WindowUtilities._computeSize(this.content.innerHTML,this.content.id,this.width,this.height,0,this.options.className);if(this.height){this.width=a+5}else{this.height=a+5}}this.setSize(this.width,this.height);if(this.centered){this._center(this.centerTop,this.centerLeft)}},show:function(b){this.visible=true;if(b){if(typeof this.overlayOpacity=="undefined"){var a=this;setTimeout(function(){a.show(b)},10);return}Windows.addModalWindow(this);this.modal=true;this.setZIndex(Windows.maxZIndex+1);Windows.unsetOverflow(this)}else{if(!this.element.style.zIndex){this.setZIndex(Windows.maxZIndex+1)}}if(this.oldStyle){this.getContent().setStyle({overflow:this.oldStyle})}this.computeBounds();this._notify("onBeforeShow");if(this.options.showEffect!=Element.show&&this.options.showEffectOptions){this.options.showEffect(this.element,this.options.showEffectOptions)}else{this.options.showEffect(this.element)}this._checkIEOverlapping();WindowUtilities.focusedWindow=this;this._notify("onShow")},showCenter:function(a,c,b){this.centered=true;this.centerTop=c;this.centerLeft=b;this.show(a)},isVisible:function(){return this.visible},_center:function(c,b){var d=WindowUtilities.getWindowScroll(this.options.parent);var a=WindowUtilities.getPageSize(this.options.parent);if(typeof c=="undefined"){c=(a.windowHeight-(this.height+this.heightN+this.heightS))/2}c+=d.top;if(typeof b=="undefined"){b=(a.windowWidth-(this.width+this.widthW+this.widthE))/2}b+=d.left;this.setLocation(c,b);this.toFront()},_recenter:function(b){if(this.centered){var a=WindowUtilities.getPageSize(this.options.parent);var c=WindowUtilities.getWindowScroll(this.options.parent);if(this.pageSize&&this.pageSize.windowWidth==a.windowWidth&&this.pageSize.windowHeight==a.windowHeight&&this.windowScroll.left==c.left&&this.windowScroll.top==c.top){return}this.pageSize=a;this.windowScroll=c;if($("overlay_modal")){$("overlay_modal").setStyle({height:(a.pageHeight+"px")})}if(this.options.recenterAuto){this._center(this.centerTop,this.centerLeft)}}},hide:function(){this.visible=false;if(this.modal){Windows.removeModalWindow(this);Windows.resetOverflow()}this.oldStyle=this.getContent().getStyle("overflow")||"auto";this.getContent().setStyle({overflow:"hidden"});this.options.hideEffect(this.element,this.options.hideEffectOptions);if(this.iefix){this.iefix.hide()}if(!this.doNotNotifyHide){this._notify("onHide")}},close:function(){if(this.visible){if(this.options.closeCallback&&!this.options.closeCallback(this)){return}if(this.options.destroyOnClose){var a=this.destroy.bind(this);if(this.options.hideEffectOptions.afterFinish){var b=this.options.hideEffectOptions.afterFinish;this.options.hideEffectOptions.afterFinish=function(){b();a()}}else{this.options.hideEffectOptions.afterFinish=function(){a()}}}Windows.updateFocusedWindow();this.doNotNotifyHide=true;this.hide();this.doNotNotifyHide=false;this._notify("onClose")}},minimize:function(){if(this.isMaximized()||this.resizing){return}if(this.minimized){this.restore();return}var a=$(this.getId()+"_row2");this.minimized=true;var d=a.getDimensions().height;this.r2Height=d;var c=this.element.getHeight()-d;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,null,null,null,this.height-d,{duration:Window.resizeEffectDuration})}else{this.height-=d;this.element.setStyle({height:c+"px"});a.hide()}if(!this.useTop){var b=parseFloat(this.element.getStyle("bottom"));this.element.setStyle({bottom:(b+d)+"px"})}this._notify("onMinimize");this._saveCookie()},restore:function(){if(!this.minimized||this.resizing){return}var a=$(this.getId()+"_row2");this.minimized=false;var d=this.r2Height;this.r2Height=null;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,null,null,null,this.height+d,{duration:Window.resizeEffectDuration})}else{var c=this.element.getHeight()+d;this.height+=d;this.element.setStyle({height:c+"px"});a.show()}if(!this.useTop){var b=parseFloat(this.element.getStyle("bottom"));this.element.setStyle({bottom:(b-d)+"px"})}this.toFront();this._saveCookie()},maximize:function(){if(this.isMinimized()||this.resizing){return}if(Prototype.Browser.IE&&this.heightN==0){this._getWindowBorderSize()}if(this.storedLocation!=null){this._restoreLocation();if(this.iefix){this.iefix.hide()}}else{this._storeLocation();Windows.unsetOverflow(this);var g=WindowUtilities.getWindowScroll(this.options.parent);var b=WindowUtilities.getPageSize(this.options.parent);var f=g.left;var e=g.top;if(this.options.parent!=document.body){g={top:0,left:0,bottom:0,right:0};var d=this.options.parent.getDimensions();b.windowWidth=d.width;b.windowHeight=d.height;e=0;f=0}if(this.constraint){b.windowWidth-=Math.max(0,this.constraintPad.left)+Math.max(0,this.constraintPad.right);b.windowHeight-=Math.max(0,this.constraintPad.top)+Math.max(0,this.constraintPad.bottom);f+=Math.max(0,this.constraintPad.left);e+=Math.max(0,this.constraintPad.top)}var c=b.windowWidth-this.widthW-this.widthE;var a=b.windowHeight-this.heightN-this.heightS;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,e,f,c,a,{duration:Window.resizeEffectDuration})}else{this.setSize(c,a);this.element.setStyle(this.useLeft?{left:f+"px"}:{right:f+"px"});this.element.setStyle(this.useTop?{top:e+"px"}:{bottom:e+"px"})}this.toFront();if(this.iefix){this._fixIEOverlapping()}}this._notify("onMaximize");this._saveCookie()},isMinimized:function(){return this.minimized},isMaximized:function(){return(this.storedLocation!=null)},setOpacity:function(a){if(Element.setOpacity){Element.setOpacity(this.element,a)}},setZIndex:function(a){this.element.setStyle({zIndex:a});Windows.updateZindex(a,this)},setTitle:function(a){if(!a||a==""){a=" "}Element.update(this.element.id+"_top",a)},getTitle:function(){return $(this.element.id+"_top").innerHTML},setStatusBar:function(b){var a=$(this.getId()+"_bottom");if(typeof(b)=="object"){if(this.bottombar.firstChild){this.bottombar.replaceChild(b,this.bottombar.firstChild)}else{this.bottombar.appendChild(b)}}else{this.bottombar.innerHTML=b}},_checkIEOverlapping:function(){if(!this.iefix&&(navigator.appVersion.indexOf("MSIE")>0)&&(navigator.userAgent.indexOf("Opera")<0)&&(this.element.getStyle("position")=="absolute")){new Insertion.After(this.element.id,'<iframe id="'+this.element.id+'_iefix" style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" src="javascript:false;" frameborder="0" scrolling="no"></iframe>');this.iefix=$(this.element.id+"_iefix")}if(this.iefix){setTimeout(this._fixIEOverlapping.bind(this),50)}},_fixIEOverlapping:function(){Position.clone(this.element,this.iefix);this.iefix.style.zIndex=this.element.style.zIndex-1;this.iefix.show()},_getWindowBorderSize:function(b){var c=this._createHiddenDiv(this.options.className+"_n");this.heightN=Element.getDimensions(c).height;c.parentNode.removeChild(c);var c=this._createHiddenDiv(this.options.className+"_s");this.heightS=Element.getDimensions(c).height;c.parentNode.removeChild(c);var c=this._createHiddenDiv(this.options.className+"_e");this.widthE=Element.getDimensions(c).width;c.parentNode.removeChild(c);var c=this._createHiddenDiv(this.options.className+"_w");this.widthW=Element.getDimensions(c).width;c.parentNode.removeChild(c);var c=document.createElement("div");c.className="overlay_"+this.options.className;document.body.appendChild(c);var a=this;setTimeout(function(){a.overlayOpacity=($(c).getStyle("opacity"));c.parentNode.removeChild(c)},10);if(Prototype.Browser.IE){this.heightS=$(this.getId()+"_row3").getDimensions().height;this.heightN=$(this.getId()+"_row1").getDimensions().height}if(Prototype.Browser.WebKit&&Prototype.Browser.WebKitVersion<420){this.setSize(this.width,this.height)}if(this.doMaximize){this.maximize()}if(this.doMinimize){this.minimize()}},_createHiddenDiv:function(b){var a=document.body;var c=document.createElement("div");c.setAttribute("id",this.element.id+"_tmp");c.className=b;c.style.display="none";c.innerHTML="";a.insertBefore(c,a.firstChild);return c},_storeLocation:function(){if(this.storedLocation==null){this.storedLocation={useTop:this.useTop,useLeft:this.useLeft,top:this.element.getStyle("top"),bottom:this.element.getStyle("bottom"),left:this.element.getStyle("left"),right:this.element.getStyle("right"),width:this.width,height:this.height}}},_restoreLocation:function(){if(this.storedLocation!=null){this.useLeft=this.storedLocation.useLeft;this.useTop=this.storedLocation.useTop;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,this.storedLocation.top,this.storedLocation.left,this.storedLocation.width,this.storedLocation.height,{duration:Window.resizeEffectDuration})}else{this.element.setStyle(this.useLeft?{left:this.storedLocation.left}:{right:this.storedLocation.right});this.element.setStyle(this.useTop?{top:this.storedLocation.top}:{bottom:this.storedLocation.bottom});this.setSize(this.storedLocation.width,this.storedLocation.height)}Windows.resetOverflow();this._removeStoreLocation()}},_removeStoreLocation:function(){this.storedLocation=null},_saveCookie:function(){if(this.cookie){var a="";if(this.useLeft){a+="l:"+(this.storedLocation?this.storedLocation.left:this.element.getStyle("left"))}else{a+="r:"+(this.storedLocation?this.storedLocation.right:this.element.getStyle("right"))}if(this.useTop){a+=",t:"+(this.storedLocation?this.storedLocation.top:this.element.getStyle("top"))}else{a+=",b:"+(this.storedLocation?this.storedLocation.bottom:this.element.getStyle("bottom"))}a+=","+(this.storedLocation?this.storedLocation.width:this.width);a+=","+(this.storedLocation?this.storedLocation.height:this.height);a+=","+this.isMinimized();a+=","+this.isMaximized();WindowUtilities.setCookie(a,this.cookie)}},_createWiredElement:function(){if(!this.wiredElement){if(Prototype.Browser.IE){this._getWindowBorderSize()}var b=document.createElement("div");b.className="wired_frame "+this.options.className+"_wired_frame";b.style.position="absolute";this.options.parent.insertBefore(b,this.options.parent.firstChild);this.wiredElement=$(b)}if(this.useLeft){this.wiredElement.setStyle({left:this.element.getStyle("left")})}else{this.wiredElement.setStyle({right:this.element.getStyle("right")})}if(this.useTop){this.wiredElement.setStyle({top:this.element.getStyle("top")})}else{this.wiredElement.setStyle({bottom:this.element.getStyle("bottom")})}var a=this.element.getDimensions();this.wiredElement.setStyle({width:a.width+"px",height:a.height+"px"});this.wiredElement.setStyle({zIndex:Windows.maxZIndex+30});return this.wiredElement},_hideWiredElement:function(){if(!this.wiredElement||!this.currentDrag){return}if(this.currentDrag==this.element){this.currentDrag=null}else{if(this.useLeft){this.element.setStyle({left:this.currentDrag.getStyle("left")})}else{this.element.setStyle({right:this.currentDrag.getStyle("right")})}if(this.useTop){this.element.setStyle({top:this.currentDrag.getStyle("top")})}else{this.element.setStyle({bottom:this.currentDrag.getStyle("bottom")})}this.currentDrag.hide();this.currentDrag=null;if(this.doResize){this.setSize(this.width,this.height)}}},_notify:function(a){if(this.options[a]){this.options[a](this)}else{Windows.notify(a,this)}}};var Windows={windows:[],modalWindows:[],observers:[],focusedWindow:null,maxZIndex:0,overlayShowEffectOptions:{duration:0.5},overlayHideEffectOptions:{duration:0.5},addObserver:function(a){this.removeObserver(a);this.observers.push(a)},removeObserver:function(a){this.observers=this.observers.reject(function(b){return b==a})},notify:function(a,b){this.observers.each(function(c){if(c[a]){c[a](a,b)}})},getWindow:function(a){return this.windows.detect(function(b){return b.getId()==a})},getFocusedWindow:function(){return this.focusedWindow},updateFocusedWindow:function(){this.focusedWindow=this.windows.length>=2?this.windows[this.windows.length-2]:null},addModalWindow:function(a){if(this.modalWindows.length==0){WindowUtilities.disableScreen(a.options.className,"overlay_modal",a.overlayOpacity,a.getId(),a.options.parent)}else{if(Window.keepMultiModalWindow){$("overlay_modal").style.zIndex=Windows.maxZIndex+1;Windows.maxZIndex+=1;WindowUtilities._hideSelect(this.modalWindows.last().getId())}else{this.modalWindows.last().element.hide()}WindowUtilities._showSelect(a.getId())}this.modalWindows.push(a)},removeModalWindow:function(a){this.modalWindows.pop();if(this.modalWindows.length==0){WindowUtilities.enableScreen()}else{if(Window.keepMultiModalWindow){this.modalWindows.last().toFront();WindowUtilities._showSelect(this.modalWindows.last().getId())}else{this.modalWindows.last().element.show()}}},register:function(a){this.windows.push(a)},unregister:function(a){this.windows=this.windows.reject(function(b){return b==a})},closeAll:function(){this.windows.each(function(a){Windows.close(a.getId())})},closeAllModalWindows:function(){WindowUtilities.enableScreen();this.modalWindows.each(function(a){if(a){a.close()}})},minimize:function(c,a){var b=this.getWindow(c);if(b&&b.visible){b.minimize()}Event.stop(a)},maximize:function(c,a){var b=this.getWindow(c);if(b&&b.visible){b.maximize()}Event.stop(a)},close:function(c,a){var b=this.getWindow(c);if(b){b.close()}if(a){Event.stop(a)}},blur:function(b){var a=this.getWindow(b);if(!a){return}if(a.options.blurClassName){a.changeClassName(a.options.blurClassName)}if(this.focusedWindow==a){this.focusedWindow=null}a._notify("onBlur")},focus:function(b){var a=this.getWindow(b);if(!a){return}if(this.focusedWindow){this.blur(this.focusedWindow.getId())}if(a.options.focusClassName){a.changeClassName(a.options.focusClassName)}this.focusedWindow=a;a._notify("onFocus")},unsetOverflow:function(a){this.windows.each(function(b){b.oldOverflow=b.getContent().getStyle("overflow")||"auto";b.getContent().setStyle({overflow:"hidden"})});if(a&&a.oldOverflow){a.getContent().setStyle({overflow:a.oldOverflow})}},resetOverflow:function(){this.windows.each(function(a){if(a.oldOverflow){a.getContent().setStyle({overflow:a.oldOverflow})}})},updateZindex:function(a,b){if(a>this.maxZIndex){this.maxZIndex=a;if(this.focusedWindow){this.blur(this.focusedWindow.getId())}}this.focusedWindow=b;if(this.focusedWindow){this.focus(this.focusedWindow.getId())}}};var Dialog={dialogId:null,onCompleteFunc:null,callFunc:null,parameters:null,confirm:function(d,c){if(d&&typeof d!="string"){Dialog._runAjaxRequest(d,c,Dialog.confirm);return}d=d||"";c=c||{};var f=c.okLabel?c.okLabel:"Ok";var a=c.cancelLabel?c.cancelLabel:"Cancel";c=Object.extend(c,c.windowParameters||{});c.windowParameters=c.windowParameters||{};c.className=c.className||"alert";var b="class ='"+(c.buttonClass?c.buttonClass+" ":"")+" ok_button'";var e="class ='"+(c.buttonClass?c.buttonClass+" ":"")+" cancel_button'";var d=" <div class='"+c.className+"_message'>"+d+"</div> <div class='"+c.className+"_buttons'> <input type='button' value='"+f+"' onclick='Dialog.okCallback()' "+b+"/> <input type='button' value='"+a+"' onclick='Dialog.cancelCallback()' "+e+"/> </div> ";return this._openDialog(d,c)},alert:function(c,b){if(c&&typeof c!="string"){Dialog._runAjaxRequest(c,b,Dialog.alert);return}c=c||"";b=b||{};var d=b.okLabel?b.okLabel:"Ok";b=Object.extend(b,b.windowParameters||{});b.windowParameters=b.windowParameters||{};b.className=b.className||"alert";var a="class ='"+(b.buttonClass?b.buttonClass+" ":"")+" ok_button'";var c=" <div class='"+b.className+"_message'>"+c+"</div> <div class='"+b.className+"_buttons'> <input type='button' value='"+d+"' onclick='Dialog.okCallback()' "+a+"/> </div>";return this._openDialog(c,b)},info:function(b,a){if(b&&typeof b!="string"){Dialog._runAjaxRequest(b,a,Dialog.info);return}b=b||"";a=a||{};a=Object.extend(a,a.windowParameters||{});a.windowParameters=a.windowParameters||{};a.className=a.className||"alert";var b="<div id='modal_dialog_message' class='"+a.className+"_message'>"+b+"</div>";if(a.showProgress){b+="<div id='modal_dialog_progress' class='"+a.className+"_progress'> </div>"}a.ok=null;a.cancel=null;return this._openDialog(b,a)},setInfoMessage:function(a){$("modal_dialog_message").update(a)},closeInfo:function(){Windows.close(this.dialogId)},_openDialog:function(e,d){var c=d.className;if(!d.height&&!d.width){d.width=WindowUtilities.getPageSize((d.options&&d.options.parent)||document.body).pageWidth/2}if(d.id){this.dialogId=d.id}else{var b=new Date();this.dialogId="modal_dialog_"+b.getTime();d.id=this.dialogId}if(!d.height||!d.width){var a=WindowUtilities._computeSize(e,this.dialogId,d.width,d.height,5,c);if(d.height){d.width=a+5}else{d.height=a+5}}d.effectOptions=d.effectOptions;d.resizable=d.resizable||false;d.minimizable=d.minimizable||false;d.maximizable=d.maximizable||false;d.draggable=d.draggable||false;d.closable=d.closable||false;var f=new Window(d);if(!d.url){f.setHTMLContent(e)}f.showCenter(true,d.top,d.left);f.setDestroyOnClose();f.cancelCallback=d.onCancel||d.cancel;f.okCallback=d.onOk||d.ok;return f},_getAjaxContent:function(a){Dialog.callFunc(a.responseText,Dialog.parameters)},_runAjaxRequest:function(c,b,a){if(c.options==null){c.options={}}Dialog.onCompleteFunc=c.options.onComplete;Dialog.parameters=b;Dialog.callFunc=a;c.options.onComplete=Dialog._getAjaxContent;new Ajax.Request(c.url,c.options)},okCallback:function(){var a=Windows.focusedWindow;if(!a.okCallback||a.okCallback(a)){$$("#"+a.getId()+" input").each(function(b){b.onclick=null});a.close()}},cancelCallback:function(){var a=Windows.focusedWindow;$$("#"+a.getId()+" input").each(function(b){b.onclick=null});a.close();if(a.cancelCallback){a.cancelCallback(a)}}};if(Prototype.Browser.WebKit){var array=navigator.userAgent.match(new RegExp(/AppleWebKit\/([\d\.\+]*)/));Prototype.Browser.WebKitVersion=parseFloat(array[1])}var WindowUtilities={getWindowScroll:function(parent){var T,L,W,H;parent=parent||document.body;if(parent!=document.body){T=parent.scrollTop;L=parent.scrollLeft;W=parent.scrollWidth;H=parent.scrollHeight}else{var w=window;with(w.document){if(w.document.documentElement&&documentElement.scrollTop){T=documentElement.scrollTop;L=documentElement.scrollLeft}else{if(w.document.body){T=body.scrollTop;L=body.scrollLeft}}if(w.innerWidth){W=w.innerWidth;H=w.innerHeight}else{if(w.document.documentElement&&documentElement.clientWidth){W=documentElement.clientWidth;H=documentElement.clientHeight}else{W=body.offsetWidth;H=body.offsetHeight}}}}return{top:T,left:L,width:W,height:H}},getPageSize:function(d){d=d||document.body;var c,g;var e,b;if(d!=document.body){c=d.getWidth();g=d.getHeight();b=d.scrollWidth;e=d.scrollHeight}else{var f,a;if(window.innerHeight&&window.scrollMaxY){f=document.body.scrollWidth;a=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){f=document.body.scrollWidth;a=document.body.scrollHeight}else{f=document.body.offsetWidth;a=document.body.offsetHeight}}if(self.innerHeight){c=self.innerWidth;g=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){c=document.documentElement.clientWidth;g=document.documentElement.clientHeight}else{if(document.body){c=document.body.clientWidth;g=document.body.clientHeight}}}if(a<g){e=g}else{e=a}if(f<c){b=c}else{b=f}}return{pageWidth:b,pageHeight:e,windowWidth:c,windowHeight:g}},disableScreen:function(c,a,d,e,b){WindowUtilities.initLightbox(a,c,function(){this._disableScreen(c,a,d,e)}.bind(this),b||document.body)},_disableScreen:function(c,b,e,f){var d=$(b);var a=WindowUtilities.getPageSize(d.parentNode);if(f&&Prototype.Browser.IE){WindowUtilities._hideSelect();WindowUtilities._showSelect(f)}d.style.height=(a.pageHeight+"px");d.style.display="none";if(b=="overlay_modal"&&Window.hasEffectLib&&Windows.overlayShowEffectOptions){d.overlayOpacity=e;new Effect.Appear(d,Object.extend({from:0,to:e},Windows.overlayShowEffectOptions))}else{d.style.display="block"}},enableScreen:function(b){b=b||"overlay_modal";var a=$(b);if(a){if(b=="overlay_modal"&&Window.hasEffectLib&&Windows.overlayHideEffectOptions){new Effect.Fade(a,Object.extend({from:a.overlayOpacity,to:0},Windows.overlayHideEffectOptions))}else{a.style.display="none";a.parentNode.removeChild(a)}if(b!="__invisible__"){WindowUtilities._showSelect()}}},_hideSelect:function(a){if(Prototype.Browser.IE){a=a==null?"":"#"+a+" ";$$(a+"select").each(function(b){if(!WindowUtilities.isDefined(b.oldVisibility)){b.oldVisibility=b.style.visibility?b.style.visibility:"visible";b.style.visibility="hidden"}})}},_showSelect:function(a){if(Prototype.Browser.IE){a=a==null?"":"#"+a+" ";$$(a+"select").each(function(b){if(WindowUtilities.isDefined(b.oldVisibility)){try{b.style.visibility=b.oldVisibility}catch(c){b.style.visibility="visible"}b.oldVisibility=null}else{if(b.style.visibility){b.style.visibility="visible"}}})}},isDefined:function(a){return typeof(a)!="undefined"&&a!=null},initLightbox:function(e,c,a,b){if($(e)){Element.setStyle(e,{zIndex:Windows.maxZIndex+1});Windows.maxZIndex++;a()}else{var d=document.createElement("div");d.setAttribute("id",e);d.className="overlay_"+c;d.style.display="none";d.style.position="absolute";d.style.top="0";d.style.left="0";d.style.zIndex=Windows.maxZIndex+1;Windows.maxZIndex++;d.style.width="100%";b.insertBefore(d,b.firstChild);if(Prototype.Browser.WebKit&&e=="overlay_modal"){setTimeout(function(){a()},10)}else{a()}}},setCookie:function(b,a){document.cookie=a[0]+"="+escape(b)+((a[1])?"; expires="+a[1].toGMTString():"")+((a[2])?"; path="+a[2]:"")+((a[3])?"; domain="+a[3]:"")+((a[4])?"; secure":"")},getCookie:function(c){var b=document.cookie;var e=c+"=";var d=b.indexOf("; "+e);if(d==-1){d=b.indexOf(e);if(d!=0){return null}}else{d+=2}var a=document.cookie.indexOf(";",d);if(a==-1){a=b.length}return unescape(b.substring(d+e.length,a))},_computeSize:function(e,a,b,g,d,f){var i=document.body;var c=document.createElement("div");c.setAttribute("id",a);c.className=f+"_content";if(g){c.style.height=g+"px"}else{c.style.width=b+"px"}c.style.position="absolute";c.style.top="0";c.style.left="0";c.style.display="none";c.innerHTML=e.stripScripts();i.insertBefore(c,i.firstChild);var h;if(g){h=$(c).getDimensions().width+d}else{h=$(c).getDimensions().height+d}i.removeChild(c);return h}};var Builder={NODEMAP:{AREA:"map",CAPTION:"table",COL:"table",COLGROUP:"table",LEGEND:"fieldset",OPTGROUP:"select",OPTION:"select",PARAM:"object",TBODY:"table",TD:"table",TFOOT:"table",TH:"table",THEAD:"table",TR:"table"},node:function(a){a=a.toUpperCase();var g=this.NODEMAP[a]||"div";var b=document.createElement(g);try{b.innerHTML="<"+a+"></"+a+">"}catch(f){}var d=b.firstChild||null;if(d&&(d.tagName.toUpperCase()!=a)){d=d.getElementsByTagName(a)[0]}if(!d){d=document.createElement(a)}if(!d){return}if(arguments[1]){if(this._isStringOrNumber(arguments[1])||(arguments[1] instanceof Array)||arguments[1].tagName){this._children(d,arguments[1])}else{var c=this._attributes(arguments[1]);if(c.length){try{b.innerHTML="<"+a+" "+c+"></"+a+">"}catch(f){}d=b.firstChild||null;if(!d){d=document.createElement(a);for(attr in arguments[1]){d[attr=="class"?"className":attr]=arguments[1][attr]}}if(d.tagName.toUpperCase()!=a){d=b.getElementsByTagName(a)[0]}}}}if(arguments[2]){this._children(d,arguments[2])}return $(d)},_text:function(a){return document.createTextNode(a)},ATTR_MAP:{className:"class",htmlFor:"for"},_attributes:function(a){var b=[];for(attribute in a){b.push((attribute in this.ATTR_MAP?this.ATTR_MAP[attribute]:attribute)+'="'+a[attribute].toString().escapeHTML().gsub(/"/,""")+'"')}return b.join(" ")},_children:function(b,a){if(a.tagName){b.appendChild(a);return}if(typeof a=="object"){a.flatten().each(function(c){if(typeof c=="object"){b.appendChild(c)}else{if(Builder._isStringOrNumber(c)){b.appendChild(Builder._text(c))}}})}else{if(Builder._isStringOrNumber(a)){b.appendChild(Builder._text(a))}}},_isStringOrNumber:function(a){return(typeof a=="string"||typeof a=="number")},build:function(b){var a=this.node("div");$(a).update(b.strip());return a.down()},dump:function(b){if(typeof b!="object"&&typeof b!="function"){b=window}var a=("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/);a.each(function(c){b[c]=function(){return Builder.node.apply(Builder,[c].concat($A(arguments)))}})}};String.prototype.parseColor=function(){var a="#";if(this.slice(0,4)=="rgb("){var c=this.slice(4,this.length-1).split(",");var b=0;do{a+=parseInt(c[b]).toColorPart()}while(++b<3)}else{if(this.slice(0,1)=="#"){if(this.length==4){for(var b=1;b<4;b++){a+=(this.charAt(b)+this.charAt(b)).toLowerCase()}}if(this.length==7){a=this.toLowerCase()}}}return(a.length==7?a:(arguments[0]||this))};Element.collectTextNodes=function(a){return $A($(a).childNodes).collect(function(b){return(b.nodeType==3?b.nodeValue:(b.hasChildNodes()?Element.collectTextNodes(b):""))}).flatten().join("")};Element.collectTextNodesIgnoreClass=function(a,b){return $A($(a).childNodes).collect(function(c){return(c.nodeType==3?c.nodeValue:((c.hasChildNodes()&&!Element.hasClassName(c,b))?Element.collectTextNodesIgnoreClass(c,b):""))}).flatten().join("")};Element.setContentZoom=function(a,b){a=$(a);a.setStyle({fontSize:(b/100)+"em"});if(Prototype.Browser.WebKit){window.scrollBy(0,0)}return a};Element.getInlineOpacity=function(a){return $(a).style.opacity||""};Element.forceRerendering=function(a){try{a=$(a);var c=document.createTextNode(" ");a.appendChild(c);a.removeChild(c)}catch(b){}};var Effect={_elementDoesNotExistError:{name:"ElementDoesNotExistError",message:"The specified DOM element does not exist, but is required for this effect to operate"},Transitions:{linear:Prototype.K,sinoidal:function(a){return(-Math.cos(a*Math.PI)/2)+0.5},reverse:function(a){return 1-a},flicker:function(a){var a=((-Math.cos(a*Math.PI)/4)+0.75)+Math.random()/4;return a>1?1:a},wobble:function(a){return(-Math.cos(a*Math.PI*(9*a))/2)+0.5},pulse:function(b,a){return(-Math.cos((b*((a||5)-0.5)*2)*Math.PI)/2)+0.5},spring:function(a){return 1-(Math.cos(a*4.5*Math.PI)*Math.exp(-a*6))},none:function(a){return 0},full:function(a){return 1}},DefaultOptions:{duration:1,fps:100,sync:false,from:0,to:1,delay:0,queue:"parallel"},tagifyText:function(a){var b="position:relative";if(Prototype.Browser.IE){b+=";zoom:1"}a=$(a);$A(a.childNodes).each(function(c){if(c.nodeType==3){c.nodeValue.toArray().each(function(d){a.insertBefore(new Element("span",{style:b}).update(d==" "?String.fromCharCode(160):d),c)});Element.remove(c)}})},multiple:function(b,c){var e;if(((typeof b=="object")||Object.isFunction(b))&&(b.length)){e=b}else{e=$(b).childNodes}var a=Object.extend({speed:0.1,delay:0},arguments[2]||{});var d=a.delay;$A(e).each(function(g,f){new c(g,Object.extend(a,{delay:f*a.speed+d}))})},PAIRS:{slide:["SlideDown","SlideUp"],blind:["BlindDown","BlindUp"],appear:["Appear","Fade"]},toggle:function(b,c,a){b=$(b);c=(c||"appear").toLowerCase();return Effect[Effect.PAIRS[c][b.visible()?1:0]](b,Object.extend({queue:{position:"end",scope:(b.id||"global"),limit:1}},a||{}))}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];this.interval=null},_each:function(a){this.effects._each(a)},add:function(b){var c=new Date().getTime();var a=Object.isString(b.options.queue)?b.options.queue:b.options.queue.position;switch(a){case"front":this.effects.findAll(function(d){return d.state=="idle"}).each(function(d){d.startOn+=b.finishOn;d.finishOn+=b.finishOn});break;case"with-last":c=this.effects.pluck("startOn").max()||c;break;case"end":c=this.effects.pluck("finishOn").max()||c;break}b.startOn+=c;b.finishOn+=c;if(!b.options.queue.limit||(this.effects.length<b.options.queue.limit)){this.effects.push(b)}if(!this.interval){this.interval=setInterval(this.loop.bind(this),15)}},remove:function(a){this.effects=this.effects.reject(function(b){return b==a});if(this.effects.length==0){clearInterval(this.interval);this.interval=null}},loop:function(){var c=new Date().getTime();for(var b=0,a=this.effects.length;b<a;b++){this.effects[b]&&this.effects[b].loop(c)}}});Effect.Queues={instances:$H(),get:function(a){if(!Object.isString(a)){return a}return this.instances.get(a)||this.instances.set(a,new Effect.ScopedQueue())}};Effect.Queue=Effect.Queues.get("global");Effect.Base=Class.create({position:null,start:function(a){if(a&&a.transition===false){a.transition=Effect.Transitions.linear}this.options=Object.extend(Object.extend({},Effect.DefaultOptions),a||{});this.currentFrame=0;this.state="idle";this.startOn=this.options.delay*1000;this.finishOn=this.startOn+(this.options.duration*1000);this.fromToDelta=this.options.to-this.options.from;this.totalTime=this.finishOn-this.startOn;this.totalFrames=this.options.fps*this.options.duration;this.render=(function(){function b(d,c){if(d.options[c+"Internal"]){d.options[c+"Internal"](d)}if(d.options[c]){d.options[c](d)}}return function(c){if(this.state==="idle"){this.state="running";b(this,"beforeSetup");if(this.setup){this.setup()}b(this,"afterSetup")}if(this.state==="running"){c=(this.options.transition(c)*this.fromToDelta)+this.options.from;this.position=c;b(this,"beforeUpdate");if(this.update){this.update(c)}b(this,"afterUpdate")}}})();this.event("beforeStart");if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).add(this)}},loop:function(c){if(c>=this.startOn){if(c>=this.finishOn){this.render(1);this.cancel();this.event("beforeFinish");if(this.finish){this.finish()}this.event("afterFinish");return}var b=(c-this.startOn)/this.totalTime,a=(b*this.totalFrames).round();if(a>this.currentFrame){this.render(b);this.currentFrame=a}}},cancel:function(){if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).remove(this)}this.state="finished"},event:function(a){if(this.options[a+"Internal"]){this.options[a+"Internal"](this)}if(this.options[a]){this.options[a](this)}},inspect:function(){var a=$H();for(property in this){if(!Object.isFunction(this[property])){a.set(property,this[property])}}return"#<Effect:"+a.inspect()+",options:"+$H(this.options).inspect()+">"}});Effect.Parallel=Class.create(Effect.Base,{initialize:function(a){this.effects=a||[];this.start(arguments[1])},update:function(a){this.effects.invoke("render",a)},finish:function(a){this.effects.each(function(b){b.render(1);b.cancel();b.event("beforeFinish");if(b.finish){b.finish(a)}b.event("afterFinish")})}});Effect.Tween=Class.create(Effect.Base,{initialize:function(c,f,e){c=Object.isString(c)?$(c):c;var b=$A(arguments),d=b.last(),a=b.length==5?b[3]:null;this.method=Object.isFunction(d)?d.bind(c):Object.isFunction(c[d])?c[d].bind(c):function(g){c[d]=g};this.start(Object.extend({from:f,to:e},a||{}))},update:function(a){this.method(a)}});Effect.Event=Class.create(Effect.Base,{initialize:function(){this.start(Object.extend({duration:0},arguments[0]||{}))},update:Prototype.emptyFunction});Effect.Opacity=Class.create(Effect.Base,{initialize:function(b){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}var a=Object.extend({from:this.element.getOpacity()||0,to:1},arguments[1]||{});this.start(a)},update:function(a){this.element.setOpacity(a)}});Effect.Move=Class.create(Effect.Base,{initialize:function(b){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({x:0,y:0,mode:"relative"},arguments[1]||{});this.start(a)},setup:function(){this.element.makePositioned();this.originalLeft=parseFloat(this.element.getStyle("left")||"0");this.originalTop=parseFloat(this.element.getStyle("top")||"0");if(this.options.mode=="absolute"){this.options.x=this.options.x-this.originalLeft;this.options.y=this.options.y-this.originalTop}},update:function(a){this.element.setStyle({left:(this.options.x*a+this.originalLeft).round()+"px",top:(this.options.y*a+this.originalTop).round()+"px"})}});Effect.MoveBy=function(b,a,c){return new Effect.Move(b,Object.extend({x:c,y:a},arguments[3]||{}))};Effect.Scale=Class.create(Effect.Base,{initialize:function(b,c){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:c},arguments[2]||{});this.start(a)},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle("position");this.originalStyle={};["top","left","width","height","fontSize"].each(function(b){this.originalStyle[b]=this.element.style[b]}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var a=this.element.getStyle("font-size")||"100%";["em","px","%","pt"].each(function(b){if(a.indexOf(b)>0){this.fontSize=parseFloat(a);this.fontSizeType=b}}.bind(this));this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=="box"){this.dims=[this.element.offsetHeight,this.element.offsetWidth]}if(/^content/.test(this.options.scaleMode)){this.dims=[this.element.scrollHeight,this.element.scrollWidth]}if(!this.dims){this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth]}},update:function(a){var b=(this.options.scaleFrom/100)+(this.factor*a);if(this.options.scaleContent&&this.fontSize){this.element.setStyle({fontSize:this.fontSize*b+this.fontSizeType})}this.setDimensions(this.dims[0]*b,this.dims[1]*b)},finish:function(a){if(this.restoreAfterFinish){this.element.setStyle(this.originalStyle)}},setDimensions:function(a,e){var f={};if(this.options.scaleX){f.width=e.round()+"px"}if(this.options.scaleY){f.height=a.round()+"px"}if(this.options.scaleFromCenter){var c=(a-this.dims[0])/2;var b=(e-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY){f.top=this.originalTop-c+"px"}if(this.options.scaleX){f.left=this.originalLeft-b+"px"}}else{if(this.options.scaleY){f.top=-c+"px"}if(this.options.scaleX){f.left=-b+"px"}}}this.element.setStyle(f)}});Effect.Highlight=Class.create(Effect.Base,{initialize:function(b){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({startcolor:"#ffff99"},arguments[1]||{});this.start(a)},setup:function(){if(this.element.getStyle("display")=="none"){this.cancel();return}this.oldStyle={};if(!this.options.keepBackgroundImage){this.oldStyle.backgroundImage=this.element.getStyle("background-image");this.element.setStyle({backgroundImage:"none"})}if(!this.options.endcolor){this.options.endcolor=this.element.getStyle("background-color").parseColor("#ffffff")}if(!this.options.restorecolor){this.options.restorecolor=this.element.getStyle("background-color")}this._base=$R(0,2).map(function(a){return parseInt(this.options.startcolor.slice(a*2+1,a*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(a){return parseInt(this.options.endcolor.slice(a*2+1,a*2+3),16)-this._base[a]}.bind(this))},update:function(a){this.element.setStyle({backgroundColor:$R(0,2).inject("#",function(b,c,d){return b+((this._base[d]+(this._delta[d]*a)).round().toColorPart())}.bind(this))})},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}))}});Effect.ScrollTo=function(c){var b=arguments[1]||{},a=document.viewport.getScrollOffsets(),d=$(c).cumulativeOffset();if(b.offset){d[1]+=b.offset}return new Effect.Tween(null,a.top,d[1],b,function(e){scrollTo(a.left,e.round())})};Effect.Fade=function(c){c=$(c);var a=c.getInlineOpacity();var b=Object.extend({from:c.getOpacity()||1,to:0,afterFinishInternal:function(d){if(d.options.to!=0){return}d.element.hide().setStyle({opacity:a})}},arguments[1]||{});return new Effect.Opacity(c,b)};Effect.Appear=function(b){b=$(b);var a=Object.extend({from:(b.getStyle("display")=="none"?0:b.getOpacity()||0),to:1,afterFinishInternal:function(c){c.element.forceRerendering()},beforeSetup:function(c){c.element.setOpacity(c.options.from).show()}},arguments[1]||{});return new Effect.Opacity(b,a)};Effect.Puff=function(b){b=$(b);var a={opacity:b.getInlineOpacity(),position:b.getStyle("position"),top:b.style.top,left:b.style.left,width:b.style.width,height:b.style.height};return new Effect.Parallel([new Effect.Scale(b,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(b,{sync:true,to:0})],Object.extend({duration:1,beforeSetupInternal:function(c){Position.absolutize(c.effects[0].element)},afterFinishInternal:function(c){c.effects[0].element.hide().setStyle(a)}},arguments[1]||{}))};Effect.BlindUp=function(a){a=$(a);a.makeClipping();return new Effect.Scale(a,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(b){b.element.hide().undoClipping()}},arguments[1]||{}))};Effect.BlindDown=function(b){b=$(b);var a=b.getDimensions();return new Effect.Scale(b,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:a.height,originalWidth:a.width},restoreAfterFinish:true,afterSetup:function(c){c.element.makeClipping().setStyle({height:"0px"}).show()},afterFinishInternal:function(c){c.element.undoClipping()}},arguments[1]||{}))};Effect.SwitchOff=function(b){b=$(b);var a=b.getInlineOpacity();return new Effect.Appear(b,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(c){new Effect.Scale(c.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(d){d.element.makePositioned().makeClipping()},afterFinishInternal:function(d){d.element.hide().undoClipping().undoPositioned().setStyle({opacity:a})}})}},arguments[1]||{}))};Effect.DropOut=function(b){b=$(b);var a={top:b.getStyle("top"),left:b.getStyle("left"),opacity:b.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(b,{x:0,y:100,sync:true}),new Effect.Opacity(b,{sync:true,to:0})],Object.extend({duration:0.5,beforeSetup:function(c){c.effects[0].element.makePositioned()},afterFinishInternal:function(c){c.effects[0].element.hide().undoPositioned().setStyle(a)}},arguments[1]||{}))};Effect.Shake=function(d){d=$(d);var b=Object.extend({distance:20,duration:0.5},arguments[1]||{});var e=parseFloat(b.distance);var c=parseFloat(b.duration)/10;var a={top:d.getStyle("top"),left:d.getStyle("left")};return new Effect.Move(d,{x:e,y:0,duration:c,afterFinishInternal:function(f){new Effect.Move(f.element,{x:-e*2,y:0,duration:c*2,afterFinishInternal:function(g){new Effect.Move(g.element,{x:e*2,y:0,duration:c*2,afterFinishInternal:function(h){new Effect.Move(h.element,{x:-e*2,y:0,duration:c*2,afterFinishInternal:function(i){new Effect.Move(i.element,{x:e*2,y:0,duration:c*2,afterFinishInternal:function(k){new Effect.Move(k.element,{x:-e,y:0,duration:c,afterFinishInternal:function(l){l.element.undoPositioned().setStyle(a)}})}})}})}})}})}})};Effect.SlideDown=function(c){c=$(c).cleanWhitespace();var a=c.down().getStyle("bottom");var b=c.getDimensions();return new Effect.Scale(c,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:b.height,originalWidth:b.width},restoreAfterFinish:true,afterSetup:function(d){d.element.makePositioned();d.element.down().makePositioned();if(window.opera){d.element.setStyle({top:""})}d.element.makeClipping().setStyle({height:"0px"}).show()},afterUpdateInternal:function(d){d.element.down().setStyle({bottom:(d.dims[0]-d.element.clientHeight)+"px"})},afterFinishInternal:function(d){d.element.undoClipping().undoPositioned();d.element.down().undoPositioned().setStyle({bottom:a})}},arguments[1]||{}))};Effect.SlideUp=function(c){c=$(c).cleanWhitespace();var a=c.down().getStyle("bottom");var b=c.getDimensions();return new Effect.Scale(c,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,scaleMode:{originalHeight:b.height,originalWidth:b.width},restoreAfterFinish:true,afterSetup:function(d){d.element.makePositioned();d.element.down().makePositioned();if(window.opera){d.element.setStyle({top:""})}d.element.makeClipping().show()},afterUpdateInternal:function(d){d.element.down().setStyle({bottom:(d.dims[0]-d.element.clientHeight)+"px"})},afterFinishInternal:function(d){d.element.hide().undoClipping().undoPositioned();d.element.down().undoPositioned().setStyle({bottom:a})}},arguments[1]||{}))};Effect.Squish=function(a){return new Effect.Scale(a,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(b){b.element.makeClipping()},afterFinishInternal:function(b){b.element.hide().undoClipping()}})};Effect.Grow=function(c){c=$(c);var b=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var a={top:c.style.top,left:c.style.left,height:c.style.height,width:c.style.width,opacity:c.getInlineOpacity()};var g=c.getDimensions();var h,f;var e,d;switch(b.direction){case"top-left":h=f=e=d=0;break;case"top-right":h=g.width;f=d=0;e=-g.width;break;case"bottom-left":h=e=0;f=g.height;d=-g.height;break;case"bottom-right":h=g.width;f=g.height;e=-g.width;d=-g.height;break;case"center":h=g.width/2;f=g.height/2;e=-g.width/2;d=-g.height/2;break}return new Effect.Move(c,{x:h,y:f,duration:0.01,beforeSetup:function(i){i.element.hide().makeClipping().makePositioned()},afterFinishInternal:function(i){new Effect.Parallel([new Effect.Opacity(i.element,{sync:true,to:1,from:0,transition:b.opacityTransition}),new Effect.Move(i.element,{x:e,y:d,sync:true,transition:b.moveTransition}),new Effect.Scale(i.element,100,{scaleMode:{originalHeight:g.height,originalWidth:g.width},sync:true,scaleFrom:window.opera?1:0,transition:b.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(k){k.effects[0].element.setStyle({height:"0px"}).show()},afterFinishInternal:function(k){k.effects[0].element.undoClipping().undoPositioned().setStyle(a)}},b))}})};Effect.Shrink=function(c){c=$(c);var b=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var a={top:c.style.top,left:c.style.left,height:c.style.height,width:c.style.width,opacity:c.getInlineOpacity()};var f=c.getDimensions();var e,d;switch(b.direction){case"top-left":e=d=0;break;case"top-right":e=f.width;d=0;break;case"bottom-left":e=0;d=f.height;break;case"bottom-right":e=f.width;d=f.height;break;case"center":e=f.width/2;d=f.height/2;break}return new Effect.Parallel([new Effect.Opacity(c,{sync:true,to:0,from:1,transition:b.opacityTransition}),new Effect.Scale(c,window.opera?1:0,{sync:true,transition:b.scaleTransition,restoreAfterFinish:true}),new Effect.Move(c,{x:e,y:d,sync:true,transition:b.moveTransition})],Object.extend({beforeStartInternal:function(g){g.effects[0].element.makePositioned().makeClipping()},afterFinishInternal:function(g){g.effects[0].element.hide().undoClipping().undoPositioned().setStyle(a)}},b))};Effect.Pulsate=function(c){c=$(c);var b=arguments[1]||{},a=c.getInlineOpacity(),e=b.transition||Effect.Transitions.linear,d=function(f){return 1-e((-Math.cos((f*(b.pulses||5)*2)*Math.PI)/2)+0.5)};return new Effect.Opacity(c,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(f){f.element.setStyle({opacity:a})}},b),{transition:d}))};Effect.Fold=function(b){b=$(b);var a={top:b.style.top,left:b.style.left,width:b.style.width,height:b.style.height};b.makeClipping();return new Effect.Scale(b,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(c){new Effect.Scale(b,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(d){d.element.hide().undoClipping().setStyle(a)}})}},arguments[1]||{}))};Effect.Morph=Class.create(Effect.Base,{initialize:function(c){this.element=$(c);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({style:{}},arguments[1]||{});if(!Object.isString(a.style)){this.style=$H(a.style)}else{if(a.style.include(":")){this.style=a.style.parseStyle()}else{this.element.addClassName(a.style);this.style=$H(this.element.getStyles());this.element.removeClassName(a.style);var b=this.element.getStyles();this.style=this.style.reject(function(d){return d.value==b[d.key]});a.afterFinishInternal=function(d){d.element.addClassName(d.options.style);d.transforms.each(function(e){d.element.style[e.style]=""})}}}this.start(a)},setup:function(){function a(b){if(!b||["rgba(0, 0, 0, 0)","transparent"].include(b)){b="#ffffff"}b=b.parseColor();return $R(0,2).map(function(c){return parseInt(b.slice(c*2+1,c*2+3),16)})}this.transforms=this.style.map(function(g){var f=g[0],e=g[1],d=null;if(e.parseColor("#zzzzzz")!="#zzzzzz"){e=e.parseColor();d="color"}else{if(f=="opacity"){e=parseFloat(e);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}}else{if(Element.CSS_LENGTH.test(e)){var c=e.match(/^([\+\-]?[0-9\.]+)(.*)$/);e=parseFloat(c[1]);d=(c.length==3)?c[2]:null}}}var b=this.element.getStyle(f);return{style:f.camelize(),originalValue:d=="color"?a(b):parseFloat(b||0),targetValue:d=="color"?a(e):e,unit:d}}.bind(this)).reject(function(b){return((b.originalValue==b.targetValue)||(b.unit!="color"&&(isNaN(b.originalValue)||isNaN(b.targetValue))))})},update:function(a){var d={},b,c=this.transforms.length;while(c--){d[(b=this.transforms[c]).style]=b.unit=="color"?"#"+(Math.round(b.originalValue[0]+(b.targetValue[0]-b.originalValue[0])*a)).toColorPart()+(Math.round(b.originalValue[1]+(b.targetValue[1]-b.originalValue[1])*a)).toColorPart()+(Math.round(b.originalValue[2]+(b.targetValue[2]-b.originalValue[2])*a)).toColorPart():(b.originalValue+(b.targetValue-b.originalValue)*a).toFixed(3)+(b.unit===null?"":b.unit)}this.element.setStyle(d,true)}});Effect.Transform=Class.create({initialize:function(a){this.tracks=[];this.options=arguments[1]||{};this.addTracks(a)},addTracks:function(a){a.each(function(b){b=$H(b);var c=b.values().first();this.tracks.push($H({ids:b.keys().first(),effect:Effect.Morph,options:{style:c}}))}.bind(this));return this},play:function(){return new Effect.Parallel(this.tracks.map(function(a){var d=a.get("ids"),c=a.get("effect"),b=a.get("options");var e=[$(d)||$$(d)].flatten();return e.map(function(f){return new c(f,Object.extend({sync:true},b))})}).flatten(),this.options)}});Element.CSS_PROPERTIES=$w("backgroundColor backgroundPosition borderBottomColor borderBottomStyle borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth borderRightColor borderRightStyle borderRightWidth borderSpacing borderTopColor borderTopStyle borderTopWidth bottom clip color fontSize fontWeight height left letterSpacing lineHeight marginBottom marginLeft marginRight marginTop markerOffset maxHeight maxWidth minHeight minWidth opacity outlineColor outlineOffset outlineWidth paddingBottom paddingLeft paddingRight paddingTop right textIndent top width wordSpacing zIndex");Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;String.__parseStyleElement=document.createElement("div");String.prototype.parseStyle=function(){var b,a=$H();if(Prototype.Browser.WebKit){b=new Element("div",{style:this}).style}else{String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>';b=String.__parseStyleElement.childNodes[0].style}Element.CSS_PROPERTIES.each(function(c){if(b[c]){a.set(c,b[c])}});if(Prototype.Browser.IE&&this.include("opacity")){a.set("opacity",this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1])}return a};if(document.defaultView&&document.defaultView.getComputedStyle){Element.getStyles=function(b){var a=document.defaultView.getComputedStyle($(b),null);return Element.CSS_PROPERTIES.inject({},function(c,d){c[d]=a[d];return c})}}else{Element.getStyles=function(b){b=$(b);var a=b.currentStyle,c;c=Element.CSS_PROPERTIES.inject({},function(d,e){d[e]=a[e];return d});if(!c.opacity){c.opacity=b.getOpacity()}return c}}Effect.Methods={morph:function(a,b){a=$(a);new Effect.Morph(a,Object.extend({style:b},arguments[2]||{}));return a},visualEffect:function(c,e,b){c=$(c);var d=e.dasherize().camelize(),a=d.charAt(0).toUpperCase()+d.substring(1);new Effect[a](c,b);return c},highlight:function(b,a){b=$(b);new Effect.Highlight(b,a);return b}};$w("fade appear grow shrink fold blindUp blindDown slideUp slideDown pulsate shake puff squish switchOff dropOut").each(function(a){Effect.Methods[a]=function(c,b){c=$(c);Effect[a.charAt(0).toUpperCase()+a.substring(1)](c,b);return c}});$w("getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles").each(function(a){Effect.Methods[a]=Element[a]});Element.addMethods(Effect.Methods);function validateCreditCard(p){var o="0123456789",n="",f,e,d,b,g,l,h;for(f=0;f<p.length;f++){h=p.charAt(f);if(o.indexOf(h,0)!==-1){n+=h}}e=n.length/2;d=Math.floor(e);b=Math.ceil(e)-d;g=0;for(f=0;f<d;f++){l=n.charAt(f*2+b)*2;g+=l>9?Math.floor(l/10+l%10):l}for(f=0;f<d+b;f++){g+=n.charAt(f*2+1-b)*1}return g%10===0}var Validator=Class.create();Validator.prototype={initialize:function(c,b,d,a){if(typeof d=="function"){this.options=$H(a);this._test=d}else{this.options=$H(d);this._test=function(){return true}}this.error=b||"Validation failed.";this.className=c},test:function(a,b){return(this._test(a,b)&&this.options.all(function(c){return Validator.methods[c.key]?Validator.methods[c.key](a,b,c.value):true}))}};Validator.methods={pattern:function(a,c,b){return Validation.get("IsEmpty").test(a)||b.test(a)},minLength:function(a,c,b){return a.length>=b},maxLength:function(a,c,b){return a.length<=b},min:function(a,c,b){return a>=parseFloat(b)},max:function(a,c,b){return a<=parseFloat(b)},notOneOf:function(a,c,b){return $A(b).all(function(d){return a!=d})},oneOf:function(a,c,b){return $A(b).any(function(d){return a==d})},is:function(a,c,b){return a==b},isNot:function(a,c,b){return a!=b},equalToField:function(a,c,b){return a==$F(b)},notEqualToField:function(a,c,b){return a!=$F(b)},include:function(a,c,b){return $A(b).all(function(d){return Validation.get(d).test(a,c)})}};var Validation=Class.create();Validation.defaultOptions={onSubmit:true,stopOnFirst:false,immediate:false,focusOnError:true,useTitles:false,addClassNameToContainer:false,containerClassName:".input-box",onFormValidate:function(a,b){},onElementValidate:function(a,b){}};Validation.prototype={initialize:function(b,a){this.form=$(b);if(!this.form){return}this.options=Object.extend({onSubmit:Validation.defaultOptions.onSubmit,stopOnFirst:Validation.defaultOptions.stopOnFirst,immediate:Validation.defaultOptions.immediate,focusOnError:Validation.defaultOptions.focusOnError,useTitles:Validation.defaultOptions.useTitles,onFormValidate:Validation.defaultOptions.onFormValidate,onElementValidate:Validation.defaultOptions.onElementValidate},a||{});if(this.options.onSubmit){Event.observe(this.form,"submit",this.onSubmit.bind(this),false)}if(this.options.immediate){Form.getElements(this.form).each(function(c){if(c.tagName.toLowerCase()=="select"){Event.observe(c,"blur",this.onChange.bindAsEventListener(this))}if(c.type.toLowerCase()=="radio"||c.type.toLowerCase()=="checkbox"){Event.observe(c,"click",this.onChange.bindAsEventListener(this))}else{Event.observe(c,"change",this.onChange.bindAsEventListener(this))}},this)}},onChange:function(a){Validation.isOnChange=true;Validation.validate(Event.element(a),{useTitle:this.options.useTitles,onElementValidate:this.options.onElementValidate});Validation.isOnChange=false},onSubmit:function(a){if(!this.validate()){Event.stop(a)}},validate:function(){var a=false;var b=this.options.useTitles;var d=this.options.onElementValidate;try{if(this.options.stopOnFirst){a=Form.getElements(this.form).all(function(e){if(e.hasClassName("local-validation")&&!this.isElementInForm(e,this.form)){return true}return Validation.validate(e,{useTitle:b,onElementValidate:d})},this)}else{a=Form.getElements(this.form).collect(function(e){if(e.hasClassName("local-validation")&&!this.isElementInForm(e,this.form)){return true}if(e.hasClassName("validation-disabled")){return true}return Validation.validate(e,{useTitle:b,onElementValidate:d})},this).all()}}catch(c){}if(!a&&this.options.focusOnError){try{Form.getElements(this.form).findAll(function(e){return $(e).hasClassName("validation-failed")}).first().focus()}catch(c){}}this.options.onFormValidate(a,this.form);return a},reset:function(){Form.getElements(this.form).each(Validation.reset)},isElementInForm:function(c,b){var a=c.up("form");if(a==b){return true}return false}};Object.extend(Validation,{validate:function(c,a){a=Object.extend({useTitle:false,onElementValidate:function(d,e){}},a||{});c=$(c);var b=$w(c.className);return result=b.all(function(d){var e=Validation.test(d,c,a.useTitle);a.onElementValidate(e,c);return e})},insertAdvice:function(d,b){var a=$(d).up(".field-row");if(a){Element.insert(a,{after:b})}else{if(d.up("td.value")){d.up("td.value").insert({bottom:b})}else{if(d.advaiceContainer&&$(d.advaiceContainer)){$(d.advaiceContainer).update(b)}else{switch(d.type.toLowerCase()){case"checkbox":case"radio":var c=d.parentNode;if(c){Element.insert(c,{bottom:b})}else{Element.insert(d,{after:b})}break;default:Element.insert(d,{after:b})}}}}},showAdvice:function(c,b,a){if(!c.advices){c.advices=new Hash()}else{c.advices.each(function(d){if(!b||d.value.id!=b.id){this.hideAdvice(c,d.value)}}.bind(this))}c.advices.set(a,b);if(typeof Effect=="undefined"){b.style.display="block"}else{if(!b._adviceAbsolutize){new Effect.Appear(b,{duration:1})}else{Position.absolutize(b);b.show();b.setStyle({top:b._adviceTop,left:b._adviceLeft,width:b._adviceWidth,"z-index":1000});b.addClassName("advice-absolute")}}},hideAdvice:function(b,a){if(a!=null){new Effect.Fade(a,{duration:1,afterFinishInternal:function(){a.hide()}})}},updateCallback:function(elm,status){if(typeof elm.callbackFunction!="undefined"){eval(elm.callbackFunction+"('"+elm.id+"','"+status+"')")}},ajaxError:function(e,d){var c="validate-ajax";var b=Validation.getAdvice(c,e);if(b==null){b=this.createAdvice(c,e,false,d)}this.showAdvice(e,b,"validate-ajax");this.updateCallback(e,"failed");e.addClassName("validation-failed");e.addClassName("validate-ajax");if(Validation.defaultOptions.addClassNameToContainer&&Validation.defaultOptions.containerClassName!=""){var a=e.up(Validation.defaultOptions.containerClassName);if(a&&this.allowContainerClassName(e)){a.removeClassName("validation-passed");a.addClassName("validation-error")}}},allowContainerClassName:function(a){if(a.type=="radio"||a.type=="checkbox"){return a.hasClassName("change-container-classname")}return true},test:function(d,i,g){var b=Validation.get(d);var h="__advice"+d.camelize();try{if(Validation.isVisible(i)&&!b.test($F(i),i)){var c=Validation.getAdvice(d,i);if(c==null){c=this.createAdvice(d,i,g)}this.showAdvice(i,c,d);this.updateCallback(i,"failed");i[h]=1;if(!i.advaiceContainer){i.removeClassName("validation-passed");i.addClassName("validation-failed")}if(Validation.defaultOptions.addClassNameToContainer&&Validation.defaultOptions.containerClassName!=""){var a=i.up(Validation.defaultOptions.containerClassName);if(a&&this.allowContainerClassName(i)){a.removeClassName("validation-passed");a.addClassName("validation-error")}}return false}else{var c=Validation.getAdvice(d,i);this.hideAdvice(i,c);this.updateCallback(i,"passed");i[h]="";i.removeClassName("validation-failed");i.addClassName("validation-passed");if(Validation.defaultOptions.addClassNameToContainer&&Validation.defaultOptions.containerClassName!=""){var a=i.up(Validation.defaultOptions.containerClassName);if(a&&!a.down(".validation-failed")&&this.allowContainerClassName(i)){if(!Validation.get("IsEmpty").test(i.value)||!this.isVisible(i)){a.addClassName("validation-passed")}else{a.removeClassName("validation-passed")}a.removeClassName("validation-error")}}return true}}catch(f){throw (f)}},isVisible:function(a){while(a.tagName!="BODY"){if(!$(a).visible()){return false}a=a.parentNode}return true},getAdvice:function(a,b){return $("advice-"+a+"-"+Validation.getElmID(b))||$("advice-"+Validation.getElmID(b))},createAdvice:function(c,h,g,b){var a=Validation.get(c);var f=g?((h&&h.title)?h.title:a.error):a.error;if(b){f=b}if(jQuery.mage.__){f=jQuery.mage.__(f)}advice='<div class="validation-advice" id="advice-'+c+"-"+Validation.getElmID(h)+'" style="display:none">'+f+"</div>";Validation.insertAdvice(h,advice);advice=Validation.getAdvice(c,h);if($(h).hasClassName("absolute-advice")){var e=$(h).getDimensions();var d=Position.cumulativeOffset(h);advice._adviceTop=(d[1]+e.height)+"px";advice._adviceLeft=(d[0])+"px";advice._adviceWidth=(e.width)+"px";advice._adviceAbsolutize=true}return advice},getElmID:function(a){return a.id?a.id:a.name},reset:function(b){b=$(b);var a=$w(b.className);a.each(function(e){var f="__advice"+e.camelize();if(b[f]){var d=Validation.getAdvice(e,b);if(d){d.hide()}b[f]=""}b.removeClassName("validation-failed");b.removeClassName("validation-passed");if(Validation.defaultOptions.addClassNameToContainer&&Validation.defaultOptions.containerClassName!=""){var c=b.up(Validation.defaultOptions.containerClassName);if(c){c.removeClassName("validation-passed");c.removeClassName("validation-error")}}})},add:function(d,c,e,b){var a={};a[d]=new Validator(d,c,e,b);Object.extend(Validation.methods,a)},addAllThese:function(a){var b={};$A(a).each(function(c){b[c[0]]=new Validator(c[0],c[1],c[2],(c.length>3?c[3]:{}))});Object.extend(Validation.methods,b)},get:function(a){return Validation.methods[a]?Validation.methods[a]:Validation.methods._LikeNoIDIEverSaw_},methods:{_LikeNoIDIEverSaw_:new Validator("_LikeNoIDIEverSaw_","",{})}});Validation.add("IsEmpty","",function(a){return(a==""||(a==null)||(a.length==0)||/^\s+$/.test(a))});Validation.addAllThese([["validate-no-html-tags","HTML tags are not allowed",function(a){return !/<(\/)?\w+/.test(a)}],["validate-select","Please select an option.",function(a){return((a!="none")&&(a!=null)&&(a.length!=0))}],["required-entry","This is a required field.",function(a){return !Validation.get("IsEmpty").test(a)}],["validate-number","Please enter a valid number in this field.",function(a){return Validation.get("IsEmpty").test(a)||(!isNaN(parseNumber(a))&&/^\s*-?\d*(\.\d*)?\s*$/.test(a))}],["validate-number-range","The value is not within the specified range.",function(c,e){if(Validation.get("IsEmpty").test(c)){return true}var d=parseNumber(c);if(isNaN(d)){return false}var b=/^number-range-(-?[\d.,]+)?-(-?[\d.,]+)?$/,a=true;$w(e.className).each(function(g){var f=b.exec(g);if(f){a=a&&(f[1]==null||f[1]==""||d>=parseNumber(f[1]))&&(f[2]==null||f[2]==""||d<=parseNumber(f[2]))}});return a}],["validate-digits","Please use numbers only in this field. Please avoid spaces or other characters such as dots or commas.",function(a){return Validation.get("IsEmpty").test(a)||!/[^\d]/.test(a)}],["validate-digits-range","The value is not within the specified range.",function(c,e){if(Validation.get("IsEmpty").test(c)){return true}var d=parseNumber(c);if(isNaN(d)){return false}var b=/^digits-range-(-?\d+)?-(-?\d+)?$/,a=true;$w(e.className).each(function(g){var f=b.exec(g);if(f){a=a&&(f[1]==null||f[1]==""||d>=parseNumber(f[1]))&&(f[2]==null||f[2]==""||d<=parseNumber(f[2]))}});return a}],["validate-range","The value is not within the specified range.",function(d,g){var e,f;if(Validation.get("IsEmpty").test(d)){return true}else{if(Validation.get("validate-digits").test(d)){e=f=parseNumber(d)}else{var c=/^(-?\d+)?-(-?\d+)?$/.exec(d);if(c){e=parseNumber(c[1]);f=parseNumber(c[2]);if(e>f){return false}}else{return false}}}var b=/^range-(-?\d+)?-(-?\d+)?$/,a=true;$w(g.className).each(function(h){var l=b.exec(h);if(l){var k=parseNumber(l[1]);var i=parseNumber(l[2]);a=a&&(isNaN(k)||e>=k)&&(isNaN(i)||f<=i)}});return a}],["validate-alpha","Please use letters only (a-z or A-Z) in this field.",function(a){return Validation.get("IsEmpty").test(a)||/^[a-zA-Z]+$/.test(a)}],["validate-code","Please use only lowercase letters (a-z), numbers (0-9) or underscore (_) in this field, and the first character should be a letter.",function(a){return Validation.get("IsEmpty").test(a)||/^[a-z]+[a-z0-9_]+$/.test(a)}],["validate-alphanum","Please use only letters (a-z or A-Z) or numbers (0-9) in this field. No spaces or other characters are allowed.",function(a){return Validation.get("IsEmpty").test(a)||/^[a-zA-Z0-9]+$/.test(a)}],["validate-alphanum-with-spaces","Please use only letters (a-z or A-Z), numbers (0-9) or spaces only in this field.",function(a){return Validation.get("IsEmpty").test(a)||/^[a-zA-Z0-9 ]+$/.test(a)}],["validate-street",'Please use only letters (a-z or A-Z), numbers (0-9), spaces and "#" in this field.',function(a){return Validation.get("IsEmpty").test(a)||/^[ \w]{3,}([A-Za-z]\.)?([ \w]*\#\d+)?(\r\n| )[ \w]{3,}/.test(a)}],["validate-phoneStrict","Please enter a valid phone number (Ex: 123-456-7890).",function(a){return Validation.get("IsEmpty").test(a)||/^(\()?\d{3}(\))?(-|\s)?\d{3}(-|\s)\d{4}$/.test(a)}],["validate-phoneLax","Please enter a valid phone number (Ex: 123-456-7890).",function(a){return Validation.get("IsEmpty").test(a)||/^((\d[-. ]?)?((\(\d{3}\))|\d{3}))?[-. ]?\d{3}[-. ]?\d{4}$/.test(a)}],["validate-fax","Please enter a valid fax number (Ex: 123-456-7890).",function(a){return Validation.get("IsEmpty").test(a)||/^(\()?\d{3}(\))?(-|\s)?\d{3}(-|\s)\d{4}$/.test(a)}],["validate-date","Please enter a valid date.",function(a){var b=new Date(a);return Validation.get("IsEmpty").test(a)||!isNaN(b)}],["validate-date-range","Make sure the To Date is later than or the same as the From Date.",function(c,f){var b=/\bdate-range-(\w+)-(\w+)\b/.exec(f.className);if(!b||b[2]=="to"||Validation.get("IsEmpty").test(c)){return true}var d=new Date().getFullYear()+"";var a=function(g){g=g.split(/[.\/]/);if(g[2]&&g[2].length<4){g[2]=d.substr(0,g[2].length)+g[2]}return new Date(g.join("/")).getTime()};var e=Element.select(f.form,".validate-date-range.date-range-"+b[1]+"-to");return !e.length||Validation.get("IsEmpty").test(e[0].value)||a(c)<=a(e[0].value)}],["validate-email","Please enter a valid email address (Ex: johndoe@domain.com).",function(a){return Validation.get("IsEmpty").test(a)||/^([a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*@([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*\.(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]){2,})$/i.test(a)}],["validate-emailSender","Please use only visible characters and spaces.",function(a){return Validation.get("IsEmpty").test(a)||/^[\S ]+$/.test(a)}],["validate-password","Please enter 6 or more characters. Leading and trailing spaces will be ignored.",function(a){var b=a.strip();return !(b.length>0&&b.length<6)}],["validate-admin-password","Please enter 7 or more characters, using both numeric and alphabetic.",function(a){var b=a.strip();if(0==b.length){return true}if(!(/[a-z]/i.test(a))||!(/[0-9]/.test(a))){return false}return !(b.length<7)}],["validate-cpassword","Please make sure your passwords match.",function(a){var b=$("confirmation")?$("confirmation"):$$(".validate-cpassword")[0];var e=false;if($("password")){e=$("password")}var f=$$(".validate-password");for(var c=0;c<f.size();c++){var d=f[c];if(d.up("form").id==b.up("form").id){e=d}}if($$(".validate-admin-password").size()){e=$$(".validate-admin-password")[0]}return(e.value==b.value)}],["validate-both-passwords","Please make sure your passwords match.",function(c,b){var a=$(b.form[b.name=="password"?"confirmation":"password"]),d=b.value==a.value;if(d&&a.hasClassName("validation-failed")){Validation.test(this.className,a)}return a.value==""||d}],["validate-url","Please enter a valid URL. Protocol is required (http://, https:// or ftp://)",function(a){a=(a||"").replace(/^\s+/,"").replace(/\s+$/,"");return Validation.get("IsEmpty").test(a)||/^(http|https|ftp):\/\/(([A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))(\.[A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))*)(:(\d+))?(\/[A-Z0-9~](([A-Z0-9_~-]|\.)*[A-Z0-9~]|))*\/?(.*)?$/i.test(a)}],["validate-clean-url",'Please enter a valid URL (Ex: "http://www.example.com" or "www.example.com").',function(a){return Validation.get("IsEmpty").test(a)||/^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+.(com|org|net|dk|at|us|tv|info|uk|co.uk|biz|se)$)(:(\d+))?\/?/i.test(a)||/^(www)((\.[A-Z0-9][A-Z0-9_-]*)+.(com|org|net|dk|at|us|tv|info|uk|co.uk|biz|se)$)(:(\d+))?\/?/i.test(a)}],["validate-identifier",'Please enter a valid URL Key (Ex: "example-page", "example-page.html" or "anotherlevel/example-page").',function(a){return Validation.get("IsEmpty").test(a)||/^[a-z0-9][a-z0-9_\/-]+(\.[a-z0-9_-]+)?$/.test(a)}],["validate-xml-identifier","Please enter a valid XML-identifier (Ex: something_1, block5, id-4).",function(a){return Validation.get("IsEmpty").test(a)||/^[A-Z][A-Z0-9_\/-]*$/i.test(a)}],["validate-ssn","Please enter a valid social security number (Ex: 123-45-6789).",function(a){return Validation.get("IsEmpty").test(a)||/^\d{3}-?\d{2}-?\d{4}$/.test(a)}],["validate-zip-us","Please enter a valid zip code (Ex: 90602 or 90602-1234).",function(a){return Validation.get("IsEmpty").test(a)||/(^\d{5}$)|(^\d{5}-\d{4}$)/.test(a)}],["validate-zip-international","Please enter a valid zip code.",function(a){return true}],["validate-date-au",'Please use this date format: dd/mm/yyyy (Ex: "17/03/2006" for the 17th of March, 2006).',function(a){if(Validation.get("IsEmpty").test(a)){return true}var b=/^(\d{2})\/(\d{2})\/(\d{4})$/;if(!b.test(a)){return false}var c=new Date(a.replace(b,"$2/$1/$3"));return(parseInt(RegExp.$2,10)==(1+c.getMonth()))&&(parseInt(RegExp.$1,10)==c.getDate())&&(parseInt(RegExp.$3,10)==c.getFullYear())}],["validate-currency-dollar","Please enter a valid $ amount (Ex: $100.00).",function(a){return Validation.get("IsEmpty").test(a)||/^\$?\-?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}\d*(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/.test(a)}],["validate-one-required","Please select one of the options above.",function(a,d){var c=d.parentNode;var b=c.getElementsByTagName("INPUT");return $A(b).any(function(e){return $F(e)})}],["validate-one-required-by-name","Please select one of the options.",function(b,e){var a=$$('input[name="'+e.name.replace(/([\\"])/g,"\\$1")+'"]');var c=1;for(var d=0;d<a.length;d++){if((a[d].type=="checkbox"||a[d].type=="radio")&&a[d].checked==true){c=0}if(Validation.isOnChange&&(a[d].type=="checkbox"||a[d].type=="radio")){Validation.reset(a[d])}}if(c==0){return true}else{return false}}],["validate-not-negative-number","Please enter a number 0 or greater in this field.",function(a){if(Validation.get("IsEmpty").test(a)){return true}a=parseNumber(a);return !isNaN(a)&&a>=0}],["validate-zero-or-greater","Please enter a number 0 or greater in this field.",function(a){return Validation.get("validate-not-negative-number").test(a)}],["validate-greater-than-zero","Please enter a number greater than 0 in this field.",function(a){if(Validation.get("IsEmpty").test(a)){return true}a=parseNumber(a);return !isNaN(a)&&a>0}],["validate-state","Please select State/Province.",function(a){return(a!=0||a=="")}],["validate-new-password","Please enter 6 or more characters. Leading and trailing spaces will be ignored.",function(a){if(!Validation.get("validate-password").test(a)){return false}if(Validation.get("IsEmpty").test(a)&&a!=""){return false}return true}],["validate-cc-number","Please enter a valid credit card number.",function(a,c){var b=$(c.id.substr(0,c.id.indexOf("_cc_number"))+"_cc_type");if(b&&typeof Validation.creditCartTypes.get(b.value)!="undefined"&&Validation.creditCartTypes.get(b.value)[2]==false){if(!Validation.get("IsEmpty").test(a)&&Validation.get("validate-digits").test(a)){return true}else{return false}}return validateCreditCard(a)}],["validate-cc-type","Credit card number does not match credit card type.",function(b,e){e.value=removeDelimiters(e.value);b=removeDelimiters(b);var d=$(e.id.substr(0,e.id.indexOf("_cc_number"))+"_cc_type");if(!d){return true}var c=d.value;if(typeof Validation.creditCartTypes.get(c)=="undefined"){return false}if(Validation.creditCartTypes.get(c)[0]==false){return true}var a="";Validation.creditCartTypes.each(function(f){if(f.value[0]&&b.match(f.value[0])){a=f.key;throw $break}});if(a!=c){return false}if(d.hasClassName("validation-failed")&&Validation.isOnChange){Validation.validate(d)}return true}],["validate-cc-type-select","Card type does not match credit card number.",function(b,c){var a=$(c.id.substr(0,c.id.indexOf("_cc_type"))+"_cc_number");if(Validation.isOnChange&&Validation.get("IsEmpty").test(a.value)){return true}if(Validation.get("validate-cc-type").test(a.value,a)){Validation.validate(a)}return Validation.get("validate-cc-type").test(a.value,a)}],["validate-cc-exp","Incorrect credit card expiration date.",function(a,g){var f=a;var e=$(g.id.substr(0,g.id.indexOf("_expiration"))+"_expiration_yr").value;var d=new Date();var c=d.getMonth()+1;var b=d.getFullYear();if(f<c&&e==b){return false}return true}],["validate-cc-cvn","Please enter a valid credit card verification number.",function(a,e){var d=$(e.id.substr(0,e.id.indexOf("_cc_cid"))+"_cc_type");if(!d){return true}var b=d.value;if(typeof Validation.creditCartTypes.get(b)=="undefined"){return false}var c=Validation.creditCartTypes.get(b)[1];if(a.match(c)){return true}return false}],["validate-ajax","",function(a,b){return true}],["validate-data","Please use only letters (a-z or A-Z), numbers (0-9) or underscore (_) in this field, and the first character should be a letter.",function(a){if(a!=""&&a){return/^[A-Za-z]+[A-Za-z0-9_]+$/.test(a)}return true}],["validate-css-length","Please input a valid CSS-length (Ex: 100px, 77pt, 20em, .5ex or 50%).",function(a){if(a!=""&&a){return/^[0-9\.]+(px|pt|em|ex|%)?$/.test(a)&&(!(/\..*\./.test(a)))&&!(/\.$/.test(a))}return true}],["validate-length","Text length does not meet the specified text range.",function(b,e){var c=new RegExp(/^maximum-length-[0-9]+$/);var d=new RegExp(/^minimum-length-[0-9]+$/);var a=true;$w(e.className).each(function(g,f){if(g.match(c)&&a){var h=g.split("-")[2];a=(b.length<=h)}if(g.match(d)&&a&&!Validation.get("IsEmpty").test(b)){var h=g.split("-")[2];a=(b.length>=h)}});return a}],["validate-percents","Please enter a number lower than 100.",{max:100}],["required-file","Please select a file.",function(b,c){var a=!Validation.get("IsEmpty").test(b);if(a===false){ovId=c.id+"_value";if($(ovId)){a=!Validation.get("IsEmpty").test($(ovId).value)}}return a}],["validate-cc-ukss","Please enter issue number or start date for switch/solo card type.",function(i,e){var a;if(e.id.match(/(.)+_cc_issue$/)){a=e.id.indexOf("_cc_issue")}else{if(e.id.match(/(.)+_start_month$/)){a=e.id.indexOf("_start_month")}else{a=e.id.indexOf("_start_year")}}var d=e.id.substr(0,a);var b=$(d+"_cc_type");if(!b){return true}var h=b.value;if(["SS","SM","SO"].indexOf(h)==-1){return true}$(d+"_cc_issue").advaiceContainer=$(d+"_start_month").advaiceContainer=$(d+"_start_year").advaiceContainer=$(d+"_cc_type_ss_div").down(".adv-container");var f=$(d+"_cc_issue").value;var g=$(d+"_start_month").value;var k=$(d+"_start_year").value;var c=(g&&k)?true:false;if(!c&&!f){return false}return true}]]);function removeDelimiters(a){a=a.replace(/\s/g,"");a=a.replace(/\-/g,"");return a}function parseNumber(a){if(typeof a!="string"){return parseFloat(a)}var c=a.indexOf(".");var b=a.indexOf(",");if(c!=-1&&b!=-1){if(b>c){a=a.replace(".","").replace(",",".")}else{a=a.replace(",","")}}else{if(b!=-1){a=a.replace(",",".")}}return parseFloat(a)}Validation.creditCartTypes=$H({SO:[new RegExp("^(6334[5-9]([0-9]{11}|[0-9]{13,14}))|(6767([0-9]{12}|[0-9]{14,15}))$"),new RegExp("^([0-9]{3}|[0-9]{4})?$"),true],SM:[new RegExp("(^(5[0678])[0-9]{11,18}$)|(^(6[^05])[0-9]{11,18}$)|(^(601)[^1][0-9]{9,16}$)|(^(6011)[0-9]{9,11}$)|(^(6011)[0-9]{13,16}$)|(^(65)[0-9]{11,13}$)|(^(65)[0-9]{15,18}$)|(^(49030)[2-9]([0-9]{10}$|[0-9]{12,13}$))|(^(49033)[5-9]([0-9]{10}$|[0-9]{12,13}$))|(^(49110)[1-2]([0-9]{10}$|[0-9]{12,13}$))|(^(49117)[4-9]([0-9]{10}$|[0-9]{12,13}$))|(^(49118)[0-2]([0-9]{10}$|[0-9]{12,13}$))|(^(4936)([0-9]{12}$|[0-9]{14,15}$))"),new RegExp("^([0-9]{3}|[0-9]{4})?$"),true],VI:[new RegExp("^4[0-9]{12}([0-9]{3})?$"),new RegExp("^[0-9]{3}$"),true],MC:[new RegExp("^5[1-5][0-9]{14}$"),new RegExp("^[0-9]{3}$"),true],AE:[new RegExp("^3[47][0-9]{13}$"),new RegExp("^[0-9]{4}$"),true],DI:[new RegExp("^6(011|4[4-9][0-9]|5[0-9]{2})[0-9]{12}$"),new RegExp("^[0-9]{3}$"),true],JCB:[new RegExp("^(3[0-9]{15}|(2131|1800)[0-9]{11})$"),new RegExp("^[0-9]{3,4}$"),true],OT:[false,new RegExp("^([0-9]{3}|[0-9]{4})?$"),false]});function popWin(b,c,a){var c=window.open(b,c,a);c.focus()}function setLocation(a){window.location.href=a}function setPLocation(b,a){if(a){window.opener.focus()}window.opener.location.href=b}function setLanguageCode(c,d){var a=window.location.href;var f="",e;if(e=a.match(/\#(.*)$/)){a=a.replace(/\#(.*)$/,"");f=e[0]}if(a.match(/[?]/)){var b=/([?&]store=)[a-z0-9_]*/;if(a.match(b)){a=a.replace(b,"$1"+c)}else{a+="&store="+c}var b=/([?&]from_store=)[a-z0-9_]*/;if(a.match(b)){a=a.replace(b,"")}}else{a+="?store="+c}if(typeof d!="undefined"){a+="&from_store="+d}a+=f;setLocation(a)}function decorateGeneric(f,c){var g=["odd","even","first","last"];var b={};var e=f.length;if(e){if(typeof c=="undefined"){c=g}if(!c.length){return}for(var a in g){b[g[a]]=false}for(var a in c){b[c[a]]=true}if(b.first){Element.addClassName(f[0],"first")}if(b.last){Element.addClassName(f[e-1],"last")}for(var d=0;d<e;d++){if((d+1)%2==0){if(b.even){Element.addClassName(f[d],"even")}}else{if(b.odd){Element.addClassName(f[d],"odd")}}}}}function decorateTable(f,c){var f=$(f);if(f){var a={tbody:false,"tbody tr":["odd","even","first","last"],"thead tr":["first","last"],"tfoot tr":["first","last"],"tr td":["last"]};if(typeof c!="undefined"){for(var b in c){a[b]=c[b]}}if(a.tbody){decorateGeneric(f.select("tbody"),a.tbody)}if(a["tbody tr"]){decorateGeneric(f.select("tbody tr"),a["tbody tr"])}if(a["thead tr"]){decorateGeneric(f.select("thead tr"),a["thead tr"])}if(a["tfoot tr"]){decorateGeneric(f.select("tfoot tr"),a["tfoot tr"])}if(a["tr td"]){var e=f.select("tr");if(e.length){for(var d=0;d<e.length;d++){decorateGeneric(e[d].getElementsByTagName("TD"),a["tr td"])}}}}}function decorateList(c,b){if($(c)){if(typeof b=="undefined"){var a=$(c).select("li")}else{var a=$(c).childElements()}decorateGeneric(a,["odd","even","last"])}}function decorateDataList(a){a=$(a);if(a){decorateGeneric(a.select("dt"),["odd","even","last"]);decorateGeneric(a.select("dd"),["odd","even","last"])}}function parseSidUrl(d,c){var b=d.indexOf("/?SID=");var a="";c=c!=undefined?c:"";if(b>-1){a="?"+d.substring(b+2);d=d.substring(0,b+1)}return d+c+a}function formatCurrency(h,m,e){var g=isNaN(m.precision=Math.abs(m.precision))?2:m.precision;var p=isNaN(m.requiredPrecision=Math.abs(m.requiredPrecision))?2:m.requiredPrecision;g=p;var n=isNaN(m.integerRequired=Math.abs(m.integerRequired))?1:m.integerRequired;var l=m.decimalSymbol==undefined?",":m.decimalSymbol;var c=m.groupSymbol==undefined?".":m.groupSymbol;var b=m.groupLength==undefined?3:m.groupLength;var o="";if(e==undefined||e==true){o=h<0?"-":e?"+":""}else{if(e==false){o=""}}var f=parseInt(h=Math.abs(+h||0).toFixed(g))+"";var d=f.length<n?n-f.length:0;while(d){f="0"+f;d--}j=(j=f.length)>b?j%b:0;re=new RegExp("(\\d{"+b+"})(?=\\d)","g");var a=(j?f.substr(0,j)+c:"")+f.substr(j).replace(re,"$1"+c)+(g?l+Math.abs(h-f).toFixed(g).replace(/-/,0).slice(2):"");var k="";if(m.pattern.indexOf("{sign}")==-1){k=o+m.pattern}else{k=m.pattern.replace("{sign}",o)}return k.replace("%s",a).replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function expandDetails(b,a){if(Element.hasClassName(b,"show-details")){$$(a).each(function(c){c.hide()});Element.removeClassName(b,"show-details")}else{$$(a).each(function(c){c.show()});Element.addClassName(b,"show-details")}}var isIE=navigator.appVersion.match(/MSIE/)=="MSIE";if(!window.Varien){var Varien=new Object()}Varien.showLoading=function(){var a=$("loading-process");a&&a.show()};Varien.hideLoading=function(){var a=$("loading-process");a&&a.hide()};Varien.GlobalHandlers={onCreate:function(){Varien.showLoading()},onComplete:function(){if(Ajax.activeRequestCount==0){Varien.hideLoading()}}};Ajax.Responders.register(Varien.GlobalHandlers);Varien.searchForm=Class.create();Varien.searchForm.prototype={initialize:function(b,c,a){this.form=$(b);this.field=$(c);this.emptyText=a;Event.observe(this.form,"submit",this.submit.bind(this));Event.observe(this.field,"focus",this.focus.bind(this));Event.observe(this.field,"blur",this.blur.bind(this));this.blur()},submit:function(a){if(this.field.value==this.emptyText||this.field.value==""){Event.stop(a);return false}return true},focus:function(a){if(this.field.value==this.emptyText){this.field.value=""}},blur:function(a){if(this.field.value==""){this.field.value=this.emptyText}}};Varien.DateElement=Class.create();Varien.DateElement.prototype={initialize:function(a,b,d,c){if(a=="id"){this.day=$(b+"day");this.month=$(b+"month");this.year=$(b+"year");this.full=$(b+"full");this.advice=$(b+"date-advice")}else{if(a=="container"){this.day=b.day;this.month=b.month;this.year=b.year;this.full=b.full;this.advice=b.advice}else{return}}this.required=d;this.format=c;this.day.addClassName("validate-custom");this.day.validate=this.validate.bind(this);this.month.addClassName("validate-custom");this.month.validate=this.validate.bind(this);this.year.addClassName("validate-custom");this.year.validate=this.validate.bind(this);this.setDateRange(false,false);this.year.setAttribute("autocomplete","off");this.advice.hide()},validate:function(){var g=false,i=parseInt(this.day.value,10)||0,d=parseInt(this.month.value,10)||0,f=parseInt(this.year.value,10)||0;if(this.day.value.strip().empty()&&this.month.value.strip().empty()&&this.year.value.strip().empty()){if(this.required){g="Please enter a date."}else{this.full.value=""}}else{if(!i||!d||!f){g="Please enter a valid full date."}else{var b=new Date,h=0,c=null;b.setYear(f);b.setMonth(d-1);b.setDate(32);h=32-b.getDate();if(!h||h>31){h=31}if(i<1||i>h){c="day";g="Please enter a valid day (1-%1)."}else{if(d<1||d>12){c="month";g="Please enter a valid month (1-12)."}else{if(i%10==i){this.day.value="0"+i}if(d%10==d){this.month.value="0"+d}this.full.value=this.format.replace(/%[mb]/i,this.month.value).replace(/%[de]/i,this.day.value).replace(/%y/i,this.year.value);var a=this.month.value+"/"+this.day.value+"/"+this.year.value;var e=new Date(a);if(isNaN(e)){g="Please enter a valid date."}else{this.setFullDate(e)}}}var k=false;if(!g&&!this.validateData()){c=this.validateDataErrorType;k=this.validateDataErrorText;g=k}}}if(g!==false){if(jQuery.mage.__){g=jQuery.mage.__(g)}if(!k){this.advice.innerHTML=g.replace("%1",h)}else{this.advice.innerHTML=this.errorTextModifier(g)}this.advice.show();return false}this.day.removeClassName("validation-failed");this.month.removeClassName("validation-failed");this.year.removeClassName("validation-failed");this.advice.hide();return true},validateData:function(){var b=this.fullDate.getFullYear();var a=new Date;this.curyear=a.getFullYear();return b>=1900&&b<=this.curyear},validateDataErrorType:"year",validateDataErrorText:"Please enter a valid year (1900-%1).",errorTextModifier:function(a){return a.replace("%1",this.curyear)},setDateRange:function(a,b){this.minDate=a;this.maxDate=b},setFullDate:function(a){this.fullDate=a}};Varien.DOB=Class.create();Varien.DOB.prototype={initialize:function(a,e,d){var c=$$(a)[0];var b={};b.day=Element.select(c,".dob-day input")[0];b.month=Element.select(c,".dob-month input")[0];b.year=Element.select(c,".dob-year input")[0];b.full=Element.select(c,".dob-full input")[0];b.advice=Element.select(c,".validation-advice")[0];new Varien.DateElement("container",b,e,d)}};Varien.dateRangeDate=Class.create();Varien.dateRangeDate.prototype=Object.extend(new Varien.DateElement(),{validateData:function(){var a=true;if(this.minDate||this.maxValue){if(this.minDate){this.minDate=new Date(this.minDate);this.minDate.setHours(0);if(isNaN(this.minDate)){this.minDate=new Date("1/1/1900")}a=a&&this.fullDate>=this.minDate}if(this.maxDate){this.maxDate=new Date(this.maxDate);this.minDate.setHours(0);if(isNaN(this.maxDate)){this.maxDate=new Date()}a=a&&this.fullDate<=this.maxDate}if(this.maxDate&&this.minDate){this.validateDataErrorText="Please enter a valid date between %s and %s"}else{if(this.maxDate){this.validateDataErrorText="Please enter a valid date less than or equal to %s"}else{if(this.minDate){this.validateDataErrorText="Please enter a valid date equal to or greater than %s"}else{this.validateDataErrorText=""}}}}return a},validateDataErrorText:"Date should be between %s and %s",errorTextModifier:function(a){if(this.minDate){a=a.sub("%s",this.dateFormat(this.minDate))}if(this.maxDate){a=a.sub("%s",this.dateFormat(this.maxDate))}return a},dateFormat:function(a){return a.getMonth()+1+"/"+a.getDate()+"/"+a.getFullYear()}});Varien.FileElement=Class.create();Varien.FileElement.prototype={initialize:function(a){this.fileElement=$(a);this.hiddenElement=$(a+"_value");this.fileElement.observe("change",this.selectFile.bind(this))},selectFile:function(a){this.hiddenElement.value=this.fileElement.getValue()}};Validation.addAllThese([["validate-custom"," ",function(a,b){return b.validate()}]]);Element.addMethods({getInnerText:function(a){a=$(a);if(a.innerText&&!Prototype.Browser.Opera){return a.innerText}return a.innerHTML.stripScripts().unescapeHTML().replace(/[\n\r\s]+/g," ").strip()}});function fireEvent(b,c){var a=document.createEvent("HTMLEvents");a.initEvent(c,true,true);return b.dispatchEvent(a)}function modulo(a,d){var c=d/10000;var b=a%d;if(Math.abs(b-d)<c||Math.abs(b)<c){b=0}return b}if(typeof Range!="undefined"&&!Range.prototype.createContextualFragment){Range.prototype.createContextualFragment=function(a){var c=document.createDocumentFragment(),b=document.createElement("div");c.appendChild(b);b.outerHTML=a;return c}}var byteConvert=function(a){if(isNaN(a)){return""}var b=["bytes","KB","MB","GB","TB","PB","EB","ZB","YB"];var d=Math.floor(Math.log(a)/Math.log(2));if(d<1){d=0}var c=Math.floor(d/10);a/=Math.pow(2,10*c);if(a.toString().length>a.toFixed(2).toString().length){a=a.toFixed(2)}return a+" "+b[c]};var SessionError=Class.create();SessionError.prototype={initialize:function(a){this.errorText=a},toString:function(){return"Session Error:"+this.errorText}};Ajax.Request.addMethods({initialize:function($super,b,a){$super(a);this.transport=Ajax.getTransport();if(!b.match(new RegExp("[?&]isAjax=true",""))){b=b.match(new RegExp("\\?","g"))?b+"&isAjax=true":b+"?isAjax=true"}if(Object.isString(this.options.parameters)&&this.options.parameters.indexOf("form_key=")==-1){this.options.parameters+="&"+Object.toQueryString({form_key:FORM_KEY})}else{if(!this.options.parameters){this.options.parameters={form_key:FORM_KEY}}if(!this.options.parameters.form_key){this.options.parameters.form_key=FORM_KEY}}this.request(b)},respondToReadyState:function(a){var d=Ajax.Request.Events[a],b=new Ajax.Response(this);if(d=="Complete"){try{this._complete=true;if(b.responseText.isJSON()){var c=b.responseText.evalJSON();if(c.ajaxExpired&&c.ajaxRedirect){window.location.replace(c.ajaxRedirect);throw new SessionError("session expired")}}(this.options["on"+b.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(b,b.headerJSON)}catch(f){this.dispatchException(f);if(f instanceof SessionError){return}}var g=b.getHeader("Content-type");if(this.options.evalJS=="force"||this.options.evalJS&&this.isSameOrigin()&&g&&g.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)){this.evalResponse()}}try{(this.options["on"+d]||Prototype.emptyFunction)(b,b.headerJSON);Ajax.Responders.dispatch("on"+d,this,b,b.headerJSON)}catch(f){this.dispatchException(f)}if(d=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction}}});Ajax.Updater.respondToReadyState=Ajax.Request.respondToReadyState;var varienLoader=new Class.create();varienLoader.prototype={initialize:function(a){this.callback=false;this.cache=$H();this.caching=a||false;this.url=false},getCache:function(a){if(this.cache.get(a)){return this.cache.get(a)}return false},load:function(a,b,d){this.url=a;this.callback=d;if(this.caching){var c=this.getCache(a);if(c){this.processResult(c);return}}if(typeof b.updaterId!="undefined"){new varienUpdater(b.updaterId,a,{evalScripts:true,onComplete:this.processResult.bind(this),onFailure:this._processFailure.bind(this)})}else{new Ajax.Request(a,{method:"post",parameters:b||{},onComplete:this.processResult.bind(this),onFailure:this._processFailure.bind(this)})}},_processFailure:function(a){location.href=BASE_URL},processResult:function(a){if(this.caching){this.cache.set(this.url,a)}if(this.callback){this.callback(a.responseText)}}};if(!window.varienLoaderHandler){var varienLoaderHandler=new Object()}varienLoaderHandler.handler={onCreate:function(a){if(a.options.loaderArea===false){return}jQuery("body").trigger("processStart")},onException:function(a){jQuery("body").trigger("processStop")},onComplete:function(a){jQuery("body").trigger("processStop")}};function setLoaderPosition(){var c=$("loading_mask_loader");if(c&&Prototype.Browser.IE){var b=c.getDimensions();var d=document.viewport.getDimensions();var a=document.viewport.getScrollOffsets();c.style.left=Math.floor(d.width/2+a.left-b.width/2)+"px";c.style.top=Math.floor(d.height/2+a.top-b.height/2)+"px";c.style.position="absolute"}}function toggleSelectsUnderBlock(d,a){if(Prototype.Browser.IE){var c=document.getElementsByTagName("select");for(var b=0;b<c.length;b++){if(a){if(c[b].needShowOnSuccess){c[b].needShowOnSuccess=false;c[b].style.visibility=""}}else{if(Element.visible(c[b])){c[b].style.visibility="hidden";c[b].needShowOnSuccess=true}}}}}Ajax.Responders.register(varienLoaderHandler.handler);var varienUpdater=Class.create(Ajax.Updater,{updateContent:function($super,a){if(a.isJSON()){var b=a.evalJSON();if(b.ajaxExpired&&b.ajaxRedirect){window.location.replace(b.ajaxRedirect)}}else{$super(a)}}});function setLocation(a){window.location.href=a}function setElementDisable(b,a){if($(b)){$(b).disabled=a}}function toggleParentVis(a){a=$(a).parentNode;if(a.style.display=="none"){a.style.display=""}else{a.style.display="none"}}function toggleFieldsetVis(b){id=b;b=$(b);if(b.style.display=="none"){b.style.display=""}else{b.style.display="none"}b=b.parentNode.childElements();for(var a=0;a<b.length;a++){if(b[a].id!=undefined&&b[a].id==id&&b[a-1].classNames()=="entry-edit-head"){if(b[a-1].style.display=="none"){b[a-1].style.display=""}else{b[a-1].style.display="none"}}}}function toggleVis(a){a=$(a);if(a.style.display=="none"){a.style.display=""}else{a.style.display="none"}}function imagePreview(a){if($(a)){var b=window.open("","preview","width=400,height=400,resizable=1,scrollbars=1");b.document.open();b.document.write('<body style="padding:0;margin:0"><img src="'+$(a).src+'" id="image_preview"/></body>');b.document.close();Event.observe(b,"load",function(){var c=b.document.getElementById("image_preview");b.resizeTo(c.width+40,c.height+80)})}}function checkByProductPriceType(a){if(a.id=="price_type"){this.productPriceType=a.value;return false}if(a.id=="price"&&this.productPriceType==0){return false}return true}function toggleSeveralValueElements(d,c,a,b){if(c&&d){if(Object.prototype.toString.call(c)!="[object Array]"){c=[c]}c.each(function(e){toggleValueElements(d,e,a,b)})}}function toggleValueElements(g,b,d,f){if(b&&g){var h=[g];if(typeof d!="undefined"){if(Object.prototype.toString.call(d)!="[object Array]"){d=[d]}for(var e=0;e<d.length;e++){h.push(d[e])}}var c=Element.select(b,["select","input","textarea","button","img"]).filter(function(i){return i.readAttribute("type")!="hidden"});var a=f!=undefined?f:g.checked;c.each(function(l){if(checkByProductPriceType(l)){var k=h.length;while(k--&&l!=h[k]){}if(k!=-1){return}l.disabled=a;if(a){l.addClassName("disabled")}else{l.removeClassName("disabled")}if(l.nodeName.toLowerCase()=="img"){a?l.hide():l.show()}}})}}function submitAndReloadArea(c,b){if($(c)){var a=$(c).select("input","select","textarea");var d=Form.serializeElements(a,true);b+=b.match(new RegExp("\\?"))?"&isAjax=true":"?isAjax=true";new Ajax.Request(b,{parameters:$H(d),loaderArea:c,onSuccess:function(h){try{if(h.responseText.isJSON()){var f=h.responseText.evalJSON();if(f.error){alert(f.message)}if(f.ajaxExpired&&f.ajaxRedirect){setLocation(f.ajaxRedirect)}}else{$(c).update(h.responseText)}}catch(g){$(c).update(h.responseText)}}})}}function syncOnchangeValue(b,c){var a={baseElem:b,distElem:c};Event.observe(b,"change",function(){if($(this.baseElem)&&$(this.distElem)){$(this.distElem).value=$(this.baseElem).value}}.bind(a))}function updateElementAtCursor(c,d,e){if(e==undefined){e=window.self}if(document.selection){c.focus();sel=e.document.selection.createRange();sel.text=d}else{if(c.selectionStart||c.selectionStart=="0"){var b=c.selectionStart;var a=c.selectionEnd;c.value=c.value.substring(0,b)+d+c.value.substring(a,c.value.length)}else{c.value+=d}}}function firebugEnabled(){if(window.console&&window.console.firebug){return true}return false}function disableElement(a){a.disabled=true;a.addClassName("disabled")}function enableElement(a){a.disabled=false;a.removeClassName("disabled")}function disableElements(a){$$("."+a).each(disableElement)}function enableElements(a){$$("."+a).each(enableElement)}var Cookie={all:function(){var b=document.cookie.split(";");var a={};b.each(function(d,c){var e=d.strip().split("=");a[unescape(e[0])]=unescape(e[1])});return a},read:function(b){var a=this.all();if(a[b]){return a[b]}return null},write:function(g,e,f,d){var a="";if(f){var c=new Date();c.setTime(c.getTime()+f*1000);a="; expires="+c.toUTCString()}var b="/"+BASE_URL.split("/").slice(3).join("/");d="; samesite="+(d?d:"lax");document.cookie=escape(g)+"="+escape(e)+a+"; path="+b+d},clear:function(a){this.write(a,"",-1)}};var Fieldset={cookiePrefix:"fh-",applyCollapse:function(a){if($(a+"-state")){collapsed=$(a+"-state").value==1?0:1}else{collapsed=$(a+"-head").collapsed}if(collapsed==1||collapsed===undefined){$(a+"-head").removeClassName("open");if($(a+"-head").up(".section-config")){$(a+"-head").up(".section-config").removeClassName("active")}$(a).hide()}else{$(a+"-head").addClassName("open");if($(a+"-head").up(".section-config")){$(a+"-head").up(".section-config").addClassName("active")}$(a).show()}},toggleCollapse:function(a,b){if($(a+"-state")){collapsed=$(a+"-state").value==1?0:1}else{collapsed=$(a+"-head").collapsed}if(collapsed==1||collapsed===undefined){if($(a+"-state")){$(a+"-state").value=1}$(a+"-head").collapsed=0}else{if($(a+"-state")){$(a+"-state").value=0}$(a+"-head").collapsed=1}this.applyCollapse(a);if(typeof b!="undefined"){this.saveState(b,{container:a,value:$(a+"-state").value})}},addToPrefix:function(a){this.cookiePrefix+=a+"-"},saveState:function(a,b){new Ajax.Request(a,{method:"post",parameters:Object.toQueryString(b),loaderArea:false})}};var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(c){var a="";var l,h,f,k,g,e,d;var b=0;c=Base64._utf8_encode(c);if(typeof window.btoa==="function"){return window.btoa(c)}while(b<c.length){l=c.charCodeAt(b++);h=c.charCodeAt(b++);f=c.charCodeAt(b++);k=l>>2;g=(l&3)<<4|h>>4;e=(h&15)<<2|f>>6;d=f&63;if(isNaN(h)){e=d=64}else{if(isNaN(f)){d=64}}a=a+this._keyStr.charAt(k)+this._keyStr.charAt(g)+this._keyStr.charAt(e)+this._keyStr.charAt(d)}return a},decode:function(c){var a="";var l,h,f;var k,g,e,d;var b=0;if(typeof window.atob==="function"){return Base64._utf8_decode(window.atob(c))}c=c.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(b<c.length){k=this._keyStr.indexOf(c.charAt(b++));g=this._keyStr.indexOf(c.charAt(b++));e=this._keyStr.indexOf(c.charAt(b++));d=this._keyStr.indexOf(c.charAt(b++));l=k<<2|g>>4;h=(g&15)<<4|e>>2;f=(e&3)<<6|d;a+=String.fromCharCode(l);if(e!=64){a+=String.fromCharCode(h)}if(d!=64){a+=String.fromCharCode(f)}}return Base64._utf8_decode(a)},mageEncode:function(a){return this.encode(a).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,",")},mageDecode:function(a){a=a.replace(/\-/g,"+").replace(/_/g,"/").replace(/,/g,"=");return this.decode(a)},idEncode:function(a){return this.encode(a).replace(/\+/g,":").replace(/\//g,"_").replace(/=/g,"-")},idDecode:function(a){a=a.replace(/\-/g,"=").replace(/_/g,"/").replace(/\:/g,"+");return this.decode(a)},_utf8_encode:function(b){b=b.replace(/\r\n/g,"\n");var a="";for(var e=0;e<b.length;e++){var d=b.charCodeAt(e);if(d<128){a+=String.fromCharCode(d)}else{if(d>127&&d<2048){a+=String.fromCharCode(d>>6|192);a+=String.fromCharCode(d&63|128)}else{a+=String.fromCharCode(d>>12|224);a+=String.fromCharCode(d>>6&63|128);a+=String.fromCharCode(d&63|128)}}}return a},_utf8_decode:function(a){var b="";var d=0;var e=c1=c2=0;while(d<a.length){e=a.charCodeAt(d);if(e<128){b+=String.fromCharCode(e);d++}else{if(e>191&&e<224){c2=a.charCodeAt(d+1);b+=String.fromCharCode((e&31)<<6|c2&63);d+=2}else{c2=a.charCodeAt(d+1);c3=a.charCodeAt(d+2);b+=String.fromCharCode((e&15)<<12|(c2&63)<<6|c3&63);d+=3}}}return b}};function sortNumeric(b,a){return b-a}(function(){var globals=["Prototype","Abstract","Try","Class","PeriodicalExecuter","Template","$break","Enumerable","$A","$w","$H","Hash","$R","ObjectRange","Ajax","$","Form","Field","$F","Toggle","Insertion","$continue","Position","Windows","Dialog","array","WindowUtilities","Builder","Effect","validateCreditCard","Validator","Validation","removeDelimiters","parseNumber","popWin","setLocation","setPLocation","setLanguageCode","decorateGeneric","decorateTable","decorateList","decorateDataList","parseSidUrl","formatCurrency","expandDetails","isIE","Varien","fireEvent","modulo","byteConvert","SessionError","varienLoader","varienLoaderHandler","setLoaderPosition","toggleSelectsUnderBlock","varienUpdater","setElementDisable","toggleParentVis","toggleFieldsetVis","toggleVis","imagePreview","checkByProductPriceType","toggleSeveralValueElements","toggleValueElements","submitAndReloadArea","syncOnchangeValue","updateElementAtCursor","firebugEnabled","disableElement","enableElement","disableElements","enableElements","Cookie","Fieldset","Base64","sortNumeric","Element","$$","Sizzle","Selector","Window"];globals.forEach(function(prop){window[prop]=eval(prop)})})(); \ No newline at end of file diff --git a/lib/web/less/less.min.js b/lib/web/less/less.min.js index 7a2e68480fb55..cc9d4a622452d 100644 --- a/lib/web/less/less.min.js +++ b/lib/web/less/less.min.js @@ -1,17 +1,10 @@ -/*! - * Less - Leaner CSS v2.3.1 +/** + * Less - Leaner CSS v3.13.1 * http://lesscss.org * - * Copyright (c) 2009-2015, Alexis Sellier <self@cloudhead.net> - * Licensed under the Apache v2 License. + * Copyright (c) 2009-2020, Alexis Sellier <self@cloudhead.net> + * Licensed under the Apache-2.0 License. * + * @license Apache-2.0 */ - - /** * @license Apache v2 - */ - -!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;"undefined"!=typeof window?b=window:"undefined"!=typeof global?b=global:"undefined"!=typeof self&&(b=self),b.less=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;d.length>g;g++)e(d[g]);return e}({1:[function(a,b){var c=a("./utils").addDataAttr,d=a("./browser");b.exports=function(a,b){c(b,d.currentScript(a)),void 0===b.isFileProtocol&&(b.isFileProtocol=/^(file|(chrome|safari)(-extension)?|resource|qrc|app):/.test(a.location.protocol)),b.async=b.async||!1,b.fileAsync=b.fileAsync||!1,b.poll=b.poll||(b.isFileProtocol?1e3:1500),b.env=b.env||("127.0.0.1"==a.location.hostname||"0.0.0.0"==a.location.hostname||"localhost"==a.location.hostname||a.location.port&&a.location.port.length>0||b.isFileProtocol?"development":"production");var e=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(a.location.hash);e&&(b.dumpLineNumbers=e[1]),void 0===b.useFileCache&&(b.useFileCache=!0),void 0===b.onReady&&(b.onReady=!0)}},{"./browser":3,"./utils":9}],2:[function(a,b){a("promise/polyfill.js");var c=window.less||{};a("./add-default-options")(window,c);var d=b.exports=a("./index")(window,c);c.onReady&&(/!watch/.test(window.location.hash)&&d.watch(),d.pageLoadFinished=d.registerStylesheets().then(function(){return d.refresh("development"===d.env)}))},{"./add-default-options":1,"./index":7,"promise/polyfill.js":void 0}],3:[function(a,b){var c=a("./utils");b.exports={createCSS:function(a,b,d){var e=d.href||"",f="less:"+(d.title||c.extractId(e)),g=a.getElementById(f),h=!1,i=a.createElement("style");i.setAttribute("type","text/css"),d.media&&i.setAttribute("media",d.media),i.id=f,i.styleSheet||(i.appendChild(a.createTextNode(b)),h=null!==g&&g.childNodes.length>0&&i.childNodes.length>0&&g.firstChild.nodeValue===i.firstChild.nodeValue);var j=a.getElementsByTagName("head")[0];if(null===g||h===!1){var k=d&&d.nextSibling||null;k?k.parentNode.insertBefore(i,k):j.appendChild(i)}if(g&&h===!1&&g.parentNode.removeChild(g),i.styleSheet)try{i.styleSheet.cssText=b}catch(l){throw new Error("Couldn't reassign styleSheet.cssText.")}},currentScript:function(a){var b=a.document;return b.currentScript||function(){var a=b.getElementsByTagName("script");return a[a.length-1]}()}}},{"./utils":9}],4:[function(a,b){b.exports=function(a,b,c){var d=null;if("development"!==b.env)try{d="undefined"==typeof a.localStorage?null:a.localStorage}catch(e){}return{setCSS:function(a,b,e){if(d){c.info("saving "+a+" to cache.");try{d.setItem(a,e),d.setItem(a+":timestamp",b)}catch(f){c.error('failed to save "'+a+'" to local storage for caching.')}}},getCSS:function(a,b){var c=d&&d.getItem(a),e=d&&d.getItem(a+":timestamp");return e&&b.lastModified&&new Date(b.lastModified).valueOf()===new Date(e).valueOf()?c:void 0}}}},{}],5:[function(a,b){var c=a("./utils"),d=a("./browser");b.exports=function(a,b,e){function f(b,f){var g,h,i="less-error-message:"+c.extractId(f||""),j='<li><label>{line}</label><pre class="{class}">{content}</pre></li>',k=a.document.createElement("div"),l=[],m=b.filename||f,n=m.match(/([^\/]+(\?.*)?)$/)[1];k.id=i,k.className="less-error-message",h="<h3>"+(b.type||"Syntax")+"Error: "+(b.message||"There is an error in your .less file")+'</h3><p>in <a href="'+m+'">'+n+"</a> ";var o=function(a,b,c){void 0!==a.extract[b]&&l.push(j.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};b.extract&&(o(b,0,""),o(b,1,"line"),o(b,2,""),h+="on line "+b.line+", column "+(b.column+1)+":</p><ul>"+l.join("")+"</ul>"),b.stack&&(b.extract||e.logLevel>=4)&&(h+="<br/>Stack Trace</br />"+b.stack.split("\n").slice(1).join("<br/>")),k.innerHTML=h,d.createCSS(a.document,[".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),k.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),"development"===e.env&&(g=setInterval(function(){var b=a.document,c=b.body;c&&(b.getElementById(i)?c.replaceChild(k,b.getElementById(i)):c.insertBefore(k,c.firstChild),clearInterval(g))},10))}function g(a,b){e.errorReporting&&"html"!==e.errorReporting?"console"===e.errorReporting?k(a,b):"function"==typeof e.errorReporting&&e.errorReporting("add",a,b):f(a,b)}function h(b){var d=a.document.getElementById("less-error-message:"+c.extractId(b));d&&d.parentNode.removeChild(d)}function i(){}function j(a){e.errorReporting&&"html"!==e.errorReporting?"console"===e.errorReporting?i(a):"function"==typeof e.errorReporting&&e.errorReporting("remove",a):h(a)}function k(a,c){var d="{line} {content}",f=a.filename||c,g=[],h=(a.type||"Syntax")+"Error: "+(a.message||"There is an error in your .less file")+" in "+f+" ",i=function(a,b,c){void 0!==a.extract[b]&&g.push(d.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};a.extract&&(i(a,0,""),i(a,1,"line"),i(a,2,""),h+="on line "+a.line+", column "+(a.column+1)+":\n"+g.join("\n")),a.stack&&(a.extract||e.logLevel>=4)&&(h+="\nStack Trace\n"+a.stack),b.logger.error(h)}return{add:g,remove:j}}},{"./browser":3,"./utils":9}],6:[function(a,b){b.exports=function(b,c){function d(){if(window.XMLHttpRequest&&!("file:"===window.location.protocol&&"ActiveXObject"in window))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(a){return c.error("browser doesn't support AJAX."),null}}var e=a("../less/environment/abstract-file-manager.js"),f={},g=function(){};return g.prototype=new e,g.prototype.alwaysMakePathsAbsolute=function(){return!0},g.prototype.join=function(a,b){return a?this.extractUrlParts(b,a).path:b},g.prototype.doXHR=function(a,e,f,g){function h(b,c,d){b.status>=200&&300>b.status?c(b.responseText,b.getResponseHeader("Last-Modified")):"function"==typeof d&&d(b.status,a)}var i=d(),j=b.isFileProtocol?b.fileAsync:b.async;"function"==typeof i.overrideMimeType&&i.overrideMimeType("text/css"),c.debug("XHR: Getting '"+a+"'"),i.open("GET",a,j),i.setRequestHeader("Accept",e||"text/x-less, text/css; q=0.9, */*; q=0.5"),i.send(null),b.isFileProtocol&&!b.fileAsync?0===i.status||i.status>=200&&300>i.status?f(i.responseText):g(i.status,a):j?i.onreadystatechange=function(){4==i.readyState&&h(i,f,g)}:h(i,f,g)},g.prototype.supports=function(){return!0},g.prototype.clearFileCache=function(){f={}},g.prototype.loadFile=function(a,b,c,d,e){b&&!this.isPathAbsolute(a)&&(a=b+a),c=c||{};var g=this.extractUrlParts(a,window.location.href),h=g.url;if(c.useFileCache&&f[h])try{var i=f[h];e(null,{contents:i,filename:h,webInfo:{lastModified:new Date}})}catch(j){e({filename:h,message:"Error loading file "+h+" error was "+j.message})}else this.doXHR(h,c.mime,function(a,b){f[h]=a,e(null,{contents:a,filename:h,webInfo:{lastModified:b}})},function(a,b){e({type:"File",message:"'"+b+"' wasn't found ("+a+")",href:h})})},g}},{"../less/environment/abstract-file-manager.js":14}],7:[function(a,b){var c=a("./utils").addDataAttr,d=a("./browser");b.exports=function(e,f){function g(a){return f.postProcessor&&"function"==typeof f.postProcessor&&(a=f.postProcessor.call(a,a)||a),a}function h(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function i(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){var d=c.concat(Array.prototype.slice.call(arguments,0));return a.apply(b,d)}}function j(a){for(var b,c=n.getElementsByTagName("style"),d=0;c.length>d;d++)if(b=c[d],b.type.match(u)){var e=h(f);e.modifyVars=a;var g=b.innerHTML||"";e.filename=n.location.href.replace(/#.*$/,""),o.render(g,e,i(function(a,b,c){b?s.add(b,"inline"):(a.type="text/css",a.styleSheet?a.styleSheet.cssText=c.css:a.innerHTML=c.css)},null,b))}}function k(a,b,d,e,i){function j(c){var f=c.contents,h=c.filename,i=c.webInfo,j={currentDirectory:r.getPath(h),filename:h,rootFilename:h,relativeUrls:k.relativeUrls};if(j.entryPath=j.currentDirectory,j.rootpath=k.rootpath||j.currentDirectory,i&&(i.remaining=e,!k.modifyVars)){var l=t.getCSS(h,i);if(!d&&l)return i.local=!0,void b(null,l,f,a,i,h)}s.remove(h),k.rootFileInfo=j,o.render(f,k,function(c,d){c?(c.href=h,b(c)):(d.css=g(d.css),k.modifyVars||t.setCSS(a.href,i.lastModified,d.css),b(null,d.css,f,a,i,h))})}var k=h(f);c(k,a),k.mime=a.type,i&&(k.modifyVars=i),r.loadFile(a.href,null,k,p,function(a,c){return a?void b(a):void j(c)})}function l(a,b,c){for(var d=0;o.sheets.length>d;d++)k(o.sheets[d],a,b,o.sheets.length-(d+1),c)}function m(){"development"===o.env&&(o.watchTimer=setInterval(function(){o.watchMode&&(r.clearFileCache(),l(function(a,b,c,f){a?s.add(a,a.href||f.href):b&&d.createCSS(e.document,b,f)}))},f.poll))}var n=e.document,o=a("../less")();b.exports=o,o.options=f;var p=o.environment,q=a("./file-manager")(f,o.logger),r=new q;p.addFileManager(r),o.FileManager=q,a("./log-listener")(o,f);var s=a("./error-reporting")(e,o,f),t=o.cache=f.cache||a("./cache")(e,f,o.logger);f.functions&&o.functions.functionRegistry.addMultiple(f.functions);var u=/^text\/(x-)?less$/;return o.watch=function(){return o.watchMode||(o.env="development",m()),this.watchMode=!0,!0},o.unwatch=function(){return clearInterval(o.watchTimer),this.watchMode=!1,!1},o.registerStylesheets=function(){return new Promise(function(a){var b=n.getElementsByTagName("link");o.sheets=[];for(var c=0;b.length>c;c++)("stylesheet/less"===b[c].rel||b[c].rel.match(/stylesheet/)&&b[c].type.match(u))&&o.sheets.push(b[c]);a()})},o.modifyVars=function(a){return o.refresh(!0,a,!1)},o.refresh=function(a,b,c){return(a||c)&&c!==!1&&r.clearFileCache(),new Promise(function(c,f){var g,h,i;g=h=new Date,l(function(a,b,j,k,l){return a?(s.add(a,a.href||k.href),void f(a)):(o.logger.info(l.local?"loading "+k.href+" from cache.":"rendered "+k.href+" successfully."),d.createCSS(e.document,b,k),o.logger.info("css for "+k.href+" generated in "+(new Date-h)+"ms"),0===l.remaining&&(i=new Date-g,o.logger.info("less has finished. css generated in "+i+"ms"),c({startTime:g,endTime:h,totalMilliseconds:i,sheets:o.sheets.length})),void(h=new Date))},a,b),j(b)})},o.refreshStyles=j,o}},{"../less":29,"./browser":3,"./cache":4,"./error-reporting":5,"./file-manager":6,"./log-listener":8,"./utils":9}],8:[function(a,b){b.exports=function(a,b){var c=4,d=3,e=2,f=1;b.logLevel="undefined"!=typeof b.logLevel?b.logLevel:"development"===b.env?d:f,b.loggers||(b.loggers=[{debug:function(a){b.logLevel>=c&&console.log(a)},info:function(a){b.logLevel>=d&&console.log(a)},warn:function(a){b.logLevel>=e&&console.warn(a)},error:function(a){b.logLevel>=f&&console.error(a)}}]);for(var g=0;b.loggers.length>g;g++)a.logger.addListener(b.loggers[g])}},{}],9:[function(a,b){b.exports={extractId:function(a){return a.replace(/^[a-z-]+:\/+?[^\/]+/,"").replace(/[\?\&]livereload=\w+/,"").replace(/^\//,"").replace(/\.[a-zA-Z]+$/,"").replace(/[^\.\w-]+/g,"-").replace(/\./g,":")},addDataAttr:function(a,b){for(var c in b.dataset)if(b.dataset.hasOwnProperty(c))if("env"===c||"dumpLineNumbers"===c||"rootpath"===c||"errorReporting"===c)a[c]=b.dataset[c];else try{a[c]=JSON.parse(b.dataset[c])}catch(d){}}}},{}],10:[function(a,b){var c={};b.exports=c;var d=function(a,b,c){if(a)for(var d=0;c.length>d;d++)a.hasOwnProperty(c[d])&&(b[c[d]]=a[c[d]])},e=["paths","relativeUrls","rootpath","strictImports","insecure","dumpLineNumbers","compress","syncImport","chunkInput","mime","useFileCache","processImports","reference","pluginManager"];c.Parse=function(a){d(a,this,e),"string"==typeof this.paths&&(this.paths=[this.paths])};var f=["paths","compress","ieCompat","strictMath","strictUnits","sourceMap","importMultiple","urlArgs","javascriptEnabled","pluginManager","importantScope"];c.Eval=function(a,b){d(a,this,f),this.frames=b||[],this.importantScope=this.importantScope||[]},c.Eval.prototype.inParenthesis=function(){this.parensStack||(this.parensStack=[]),this.parensStack.push(!0)},c.Eval.prototype.outOfParenthesis=function(){this.parensStack.pop()},c.Eval.prototype.isMathOn=function(){return this.strictMath?this.parensStack&&this.parensStack.length:!0},c.Eval.prototype.isPathRelative=function(a){return!/^(?:[a-z-]+:|\/)/i.test(a)},c.Eval.prototype.normalizePath=function(a){var b,c=a.split("/").reverse();for(a=[];0!==c.length;)switch(b=c.pop()){case".":break;case"..":0===a.length||".."===a[a.length-1]?a.push(b):a.pop();break;default:a.push(b)}return a.join("/")}},{}],11:[function(a,b){b.exports={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgrey:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}},{}],12:[function(a,b){b.exports={colors:a("./colors"),unitConversions:a("./unit-conversions")}},{"./colors":11,"./unit-conversions":13}],13:[function(a,b){b.exports={length:{m:1,cm:.01,mm:.001,"in":.0254,px:.0254/96,pt:.0254/72,pc:.0254/72*12},duration:{s:1,ms:.001},angle:{rad:1/(2*Math.PI),deg:1/360,grad:.0025,turn:1}}},{}],14:[function(a,b){var c=function(){};c.prototype.getPath=function(a){var b=a.lastIndexOf("?");return b>0&&(a=a.slice(0,b)),b=a.lastIndexOf("/"),0>b&&(b=a.lastIndexOf("\\")),0>b?"":a.slice(0,b+1)},c.prototype.tryAppendLessExtension=function(a){return/(\.[a-z]*$)|([\?;].*)$/.test(a)?a:a+".less"},c.prototype.supportsSync=function(){return!1},c.prototype.alwaysMakePathsAbsolute=function(){return!1},c.prototype.isPathAbsolute=function(a){return/^(?:[a-z-]+:|\/|\\)/i.test(a)},c.prototype.join=function(a,b){return a?a+b:b},c.prototype.pathDiff=function(a,b){var c,d,e,f,g=this.extractUrlParts(a),h=this.extractUrlParts(b),i="";if(g.hostPart!==h.hostPart)return"";for(d=Math.max(h.directories.length,g.directories.length),c=0;d>c&&h.directories[c]===g.directories[c];c++);for(f=h.directories.slice(c),e=g.directories.slice(c),c=0;f.length-1>c;c++)i+="../";for(c=0;e.length-1>c;c++)i+=e[c]+"/";return i},c.prototype.extractUrlParts=function(a,b){var c,d,e=/^((?:[a-z-]+:)?\/+?(?:[^\/\?#]*\/)|([\/\\]))?((?:[^\/\\\?#]*[\/\\])*)([^\/\\\?#]*)([#\?].*)?$/i,f=a.match(e),g={},h=[];if(!f)throw new Error("Could not parse sheet href - '"+a+"'");if(b&&(!f[1]||f[2])){if(d=b.match(e),!d)throw new Error("Could not parse page url - '"+b+"'");f[1]=f[1]||d[1]||"",f[2]||(f[3]=d[3]+f[3])}if(f[3]){for(h=f[3].replace(/\\/g,"/").split("/"),c=0;h.length>c;c++)"."===h[c]&&(h.splice(c,1),c-=1);for(c=0;h.length>c;c++)".."===h[c]&&c>0&&(h.splice(c-1,2),c-=2)}return g.hostPart=f[1],g.directories=h,g.path=(f[1]||"")+h.join("/"),g.fileUrl=g.path+(f[4]||""),g.url=g.fileUrl+(f[5]||""),g},b.exports=c},{}],15:[function(a,b){var c=a("../logger"),d=function(a,b){this.fileManagers=b||[],a=a||{};for(var c=["encodeBase64","mimeLookup","charsetLookup","getSourceMapGenerator"],d=[],e=d.concat(c),f=0;e.length>f;f++){var g=e[f],h=a[g];h?this[g]=h.bind(a):d.length>f&&this.warn("missing required function in environment - "+g)}};d.prototype.getFileManager=function(a,b,d,e,f){a||c.warn("getFileManager called with no filename.. Please report this issue. continuing."),null==b&&c.warn("getFileManager called with null directory.. Please report this issue. continuing.");var g=this.fileManagers;d.pluginManager&&(g=[].concat(g).concat(d.pluginManager.getFileManagers()));for(var h=g.length-1;h>=0;h--){var i=g[h];if(i[f?"supportsSync":"supports"](a,b,d,e))return i}return null},d.prototype.addFileManager=function(a){this.fileManagers.push(a)},d.prototype.clearFileManagers=function(){this.fileManagers=[]},b.exports=d},{"../logger":31}],16:[function(a){function b(a,b,d){var e,f,g,h,i=b.alpha,j=d.alpha,k=[];g=j+i*(1-j);for(var l=0;3>l;l++)e=b.rgb[l]/255,f=d.rgb[l]/255,h=a(e,f),g&&(h=(j*f+i*(e-j*(e+f-h)))/g),k[l]=255*h;return new c(k,g)}var c=a("../tree/color"),d=a("./function-registry"),e={multiply:function(a,b){return a*b},screen:function(a,b){return a+b-a*b},overlay:function(a,b){return a*=2,1>=a?e.multiply(a,b):e.screen(a-1,b)},softlight:function(a,b){var c=1,d=a;return b>.5&&(d=1,c=a>.25?Math.sqrt(a):((16*a-12)*a+4)*a),a-(1-2*b)*d*(c-a)},hardlight:function(a,b){return e.overlay(b,a)},difference:function(a,b){return Math.abs(a-b)},exclusion:function(a,b){return a+b-2*a*b},average:function(a,b){return(a+b)/2},negation:function(a,b){return 1-Math.abs(a+b-1)}};for(var f in e)e.hasOwnProperty(f)&&(b[f]=b.bind(null,e[f]));d.addMultiple(b)},{"../tree/color":47,"./function-registry":21}],17:[function(a){function b(a){return Math.min(1,Math.max(0,a))}function c(a){return f.hsla(a.h,a.s,a.l,a.a)}function d(a){if(a instanceof g)return parseFloat(a.unit.is("%")?a.value/100:a.value);if("number"==typeof a)return a;throw{type:"Argument",message:"color functions take numbers as parameters"}}function e(a,b){return a instanceof g&&a.unit.is("%")?parseFloat(a.value*b/100):d(a)}var f,g=a("../tree/dimension"),h=a("../tree/color"),i=a("../tree/quoted"),j=a("../tree/anonymous"),k=a("./function-registry");f={rgb:function(a,b,c){return f.rgba(a,b,c,1)},rgba:function(a,b,c,f){var g=[a,b,c].map(function(a){return e(a,255)});return f=d(f),new h(g,f)},hsl:function(a,b,c){return f.hsla(a,b,c,1)},hsla:function(a,c,e,g){function h(a){return a=0>a?a+1:a>1?a-1:a,1>6*a?j+(i-j)*a*6:1>2*a?i:2>3*a?j+(i-j)*(2/3-a)*6:j}a=d(a)%360/360,c=b(d(c)),e=b(d(e)),g=b(d(g));var i=.5>=e?e*(c+1):e+c-e*c,j=2*e-i;return f.rgba(255*h(a+1/3),255*h(a),255*h(a-1/3),g)},hsv:function(a,b,c){return f.hsva(a,b,c,1)},hsva:function(a,b,c,e){a=d(a)%360/360*360,b=d(b),c=d(c),e=d(e);var g,h;g=Math.floor(a/60%6),h=a/60-g;var i=[c,c*(1-b),c*(1-h*b),c*(1-(1-h)*b)],j=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return f.rgba(255*i[j[g][0]],255*i[j[g][1]],255*i[j[g][2]],e)},hue:function(a){return new g(a.toHSL().h)},saturation:function(a){return new g(100*a.toHSL().s,"%")},lightness:function(a){return new g(100*a.toHSL().l,"%")},hsvhue:function(a){return new g(a.toHSV().h)},hsvsaturation:function(a){return new g(100*a.toHSV().s,"%")},hsvvalue:function(a){return new g(100*a.toHSV().v,"%")},red:function(a){return new g(a.rgb[0])},green:function(a){return new g(a.rgb[1])},blue:function(a){return new g(a.rgb[2])},alpha:function(a){return new g(a.toHSL().a)},luma:function(a){return new g(a.luma()*a.alpha*100,"%")},luminance:function(a){var b=.2126*a.rgb[0]/255+.7152*a.rgb[1]/255+.0722*a.rgb[2]/255;return new g(b*a.alpha*100,"%")},saturate:function(a,d){if(!a.rgb)return null;var e=a.toHSL();return e.s+=d.value/100,e.s=b(e.s),c(e)},desaturate:function(a,d){var e=a.toHSL();return e.s-=d.value/100,e.s=b(e.s),c(e)},lighten:function(a,d){var e=a.toHSL();return e.l+=d.value/100,e.l=b(e.l),c(e)},darken:function(a,d){var e=a.toHSL();return e.l-=d.value/100,e.l=b(e.l),c(e)},fadein:function(a,d){var e=a.toHSL();return e.a+=d.value/100,e.a=b(e.a),c(e)},fadeout:function(a,d){var e=a.toHSL();return e.a-=d.value/100,e.a=b(e.a),c(e)},fade:function(a,d){var e=a.toHSL();return e.a=d.value/100,e.a=b(e.a),c(e)},spin:function(a,b){var d=a.toHSL(),e=(d.h+b.value)%360;return d.h=0>e?360+e:e,c(d)},mix:function(a,b,c){c||(c=new g(50));var d=c.value/100,e=2*d-1,f=a.toHSL().a-b.toHSL().a,i=((e*f==-1?e:(e+f)/(1+e*f))+1)/2,j=1-i,k=[a.rgb[0]*i+b.rgb[0]*j,a.rgb[1]*i+b.rgb[1]*j,a.rgb[2]*i+b.rgb[2]*j],l=a.alpha*d+b.alpha*(1-d);return new h(k,l)},greyscale:function(a){return f.desaturate(a,new g(100))},contrast:function(a,b,c,e){if(!a.rgb)return null;if("undefined"==typeof c&&(c=f.rgba(255,255,255,1)),"undefined"==typeof b&&(b=f.rgba(0,0,0,1)),b.luma()>c.luma()){var g=c;c=b,b=g}return e="undefined"==typeof e?.43:d(e),a.luma()<e?c:b},argb:function(a){return new j(a.toARGB())},color:function(a){if(a instanceof i&&/^#([a-f0-9]{6}|[a-f0-9]{3})$/i.test(a.value))return new h(a.value.slice(1));if(a instanceof h||(a=h.fromKeyword(a.value)))return a.value=void 0,a;throw{type:"Argument",message:"argument must be a color keyword or 3/6 digit hex e.g. #FFF"}},tint:function(a,b){return f.mix(f.rgb(255,255,255),a,b)},shade:function(a,b){return f.mix(f.rgb(0,0,0),a,b)}},k.addMultiple(f)},{"../tree/anonymous":43,"../tree/color":47,"../tree/dimension":53,"../tree/quoted":70,"./function-registry":21}],18:[function(a,b){b.exports=function(b){var c=a("../tree/quoted"),d=a("../tree/url"),e=a("./function-registry"),f=function(a,b){return new d(b,a.index,a.currentFileInfo).eval(a.context)},g=a("../logger");e.add("data-uri",function(a,e){e||(e=a,a=null);var h=a&&a.value,i=e.value,j=this.currentFileInfo,k=j.relativeUrls?j.currentDirectory:j.entryPath,l=i.indexOf("#"),m="";-1!==l&&(m=i.slice(l),i=i.slice(0,l));var n=b.getFileManager(i,k,this.context,b,!0);if(!n)return f(this,e);var o=!1;if(a)o=/;base64$/.test(h);else{if(h=b.mimeLookup(i),"image/svg+xml"===h)o=!1;else{var p=b.charsetLookup(h);o=["US-ASCII","UTF-8"].indexOf(p)<0}o&&(h+=";base64")}var q=n.loadFileSync(i,k,this.context,b);if(!q.contents)return g.warn("Skipped data-uri embedding of "+i+" because file not found"),f(this,e||a);var r=q.contents;if(o&&!b.encodeBase64)return f(this,e);r=o?b.encodeBase64(r):encodeURIComponent(r);var s="data:"+h+","+r+m,t=32768;return s.length>=t&&this.context.ieCompat!==!1?(g.warn("Skipped data-uri embedding of "+i+" because its size ("+s.length+" characters) exceeds IE8-safe "+t+" characters!"),f(this,e||a)):new d(new c('"'+s+'"',s,!1,this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../logger":31,"../tree/quoted":70,"../tree/url":77,"./function-registry":21}],19:[function(a,b){var c=a("../tree/keyword"),d=a("./function-registry"),e={eval:function(){var a=this.value_,b=this.error_;if(b)throw b;return null!=a?a?c.True:c.False:void 0},value:function(a){this.value_=a},error:function(a){this.error_=a},reset:function(){this.value_=this.error_=null}};d.add("default",e.eval.bind(e)),b.exports=e},{"../tree/keyword":62,"./function-registry":21}],20:[function(a,b){var c=a("./function-registry"),d=function(a,b,d,e){this.name=a.toLowerCase(),this.func=c.get(this.name),this.index=d,this.context=b,this.currentFileInfo=e};d.prototype.isValid=function(){return Boolean(this.func)},d.prototype.call=function(a){return this.func.apply(this,a)},b.exports=d},{"./function-registry":21}],21:[function(a,b){b.exports={_data:{},add:function(a,b){this._data.hasOwnProperty(a),this._data[a]=b},addMultiple:function(a){Object.keys(a).forEach(function(b){this.add(b,a[b])}.bind(this))},get:function(a){return this._data[a]}}},{}],22:[function(a,b){b.exports=function(b){var c={functionRegistry:a("./function-registry"),functionCaller:a("./function-caller")};return a("./default"),a("./color"),a("./color-blending"),a("./data-uri")(b),a("./math"),a("./number"),a("./string"),a("./svg")(b),a("./types"),c}},{"./color":17,"./color-blending":16,"./data-uri":18,"./default":19,"./function-caller":20,"./function-registry":21,"./math":23,"./number":24,"./string":25,"./svg":26,"./types":27}],23:[function(a){function b(a,b,d){if(!(d instanceof c))throw{type:"Argument",message:"argument must be a number"};return null==b?b=d.unit:d=d.unify(),new c(a(parseFloat(d.value)),b)}var c=a("../tree/dimension"),d=a("./function-registry"),e={ceil:null,floor:null,sqrt:null,abs:null,tan:"",sin:"",cos:"",atan:"rad",asin:"rad",acos:"rad"};for(var f in e)e.hasOwnProperty(f)&&(e[f]=b.bind(null,Math[f],e[f]));e.round=function(a,c){var d="undefined"==typeof c?0:c.value;return b(function(a){return a.toFixed(d)},null,a)},d.addMultiple(e)},{"../tree/dimension":53,"./function-registry":21}],24:[function(a){var b=a("../tree/dimension"),c=a("../tree/anonymous"),d=a("./function-registry"),e=function(a,d){switch(d=Array.prototype.slice.call(d),d.length){case 0:throw{type:"Argument",message:"one or more arguments required"}}var e,f,g,h,i,j,k,l,m=[],n={};for(e=0;d.length>e;e++)if(g=d[e],g instanceof b)if(h=""===g.unit.toString()&&void 0!==l?new b(g.value,l).unify():g.unify(),j=""===h.unit.toString()&&void 0!==k?k:h.unit.toString(),k=""!==j&&void 0===k||""!==j&&""===m[0].unify().unit.toString()?j:k,l=""!==j&&void 0===l?g.unit.toString():l,f=void 0!==n[""]&&""!==j&&j===k?n[""]:n[j],void 0!==f)i=""===m[f].unit.toString()&&void 0!==l?new b(m[f].value,l).unify():m[f].unify(),(a&&i.value>h.value||!a&&h.value>i.value)&&(m[f]=g);else{if(void 0!==k&&j!==k)throw{type:"Argument",message:"incompatible types"};n[j]=m.length,m.push(g)}else Array.isArray(d[e].value)&&Array.prototype.push.apply(d,Array.prototype.slice.call(d[e].value));return 1==m.length?m[0]:(d=m.map(function(a){return a.toCSS(this.context)}).join(this.context.compress?",":", "),new c((a?"min":"max")+"("+d+")"))};d.addMultiple({min:function(){return e(!0,arguments)},max:function(){return e(!1,arguments)},convert:function(a,b){return a.convertTo(b.value)},pi:function(){return new b(Math.PI)},mod:function(a,c){return new b(a.value%c.value,a.unit)},pow:function(a,c){if("number"==typeof a&&"number"==typeof c)a=new b(a),c=new b(c);else if(!(a instanceof b&&c instanceof b))throw{type:"Argument",message:"arguments must be numbers"};return new b(Math.pow(a.value,c.value),a.unit)},percentage:function(a){return new b(100*a.value,"%")}})},{"../tree/anonymous":43,"../tree/dimension":53,"./function-registry":21}],25:[function(a){var b=a("../tree/quoted"),c=a("../tree/anonymous"),d=a("../tree/javascript"),e=a("./function-registry");e.addMultiple({e:function(a){return new c(a instanceof d?a.evaluated:a.value)},escape:function(a){return new c(encodeURI(a.value).replace(/=/g,"%3D").replace(/:/g,"%3A").replace(/#/g,"%23").replace(/;/g,"%3B").replace(/\(/g,"%28").replace(/\)/g,"%29"))},replace:function(a,c,d,e){var f=a.value;return f=f.replace(new RegExp(c.value,e?e.value:""),d.value),new b(a.quote||"",f,a.escaped)},"%":function(a){for(var c=Array.prototype.slice.call(arguments,1),d=a.value,e=0;c.length>e;e++)d=d.replace(/%[sda]/i,function(a){var b=a.match(/s/i)?c[e].value:c[e].toCSS();return a.match(/[A-Z]$/)?encodeURIComponent(b):b});return d=d.replace(/%%/g,"%"),new b(a.quote||"",d,a.escaped)}})},{"../tree/anonymous":43,"../tree/javascript":60,"../tree/quoted":70,"./function-registry":21}],26:[function(a,b){b.exports=function(){var b=a("../tree/dimension"),c=a("../tree/color"),d=a("../tree/expression"),e=a("../tree/quoted"),f=a("../tree/url"),g=a("./function-registry");g.add("svg-gradient",function(a){function g(){throw{type:"Argument",message:"svg-gradient expects direction, start_color [start_position], [color position,]..., end_color [end_position]"}}arguments.length<3&&g();var h,i,j,k,l,m,n,o=Array.prototype.slice.call(arguments,1),p="linear",q='x="0" y="0" width="1" height="1"',r={compress:!1},s=a.toCSS(r);switch(s){case"to bottom":h='x1="0%" y1="0%" x2="0%" y2="100%"';break;case"to right":h='x1="0%" y1="0%" x2="100%" y2="0%"';break;case"to bottom right":h='x1="0%" y1="0%" x2="100%" y2="100%"';break;case"to top right":h='x1="0%" y1="100%" x2="100%" y2="0%"';break;case"ellipse":case"ellipse at center":p="radial",h='cx="50%" cy="50%" r="75%"',q='x="-50" y="-50" width="101" height="101"';break;default:throw{type:"Argument",message:"svg-gradient direction must be 'to bottom', 'to right', 'to bottom right', 'to top right' or 'ellipse at center'"}}for(i='<?xml version="1.0" ?><svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="100%" height="100%" viewBox="0 0 1 1" preserveAspectRatio="none"><'+p+'Gradient id="gradient" gradientUnits="userSpaceOnUse" '+h+">",j=0;o.length>j;j+=1)o[j]instanceof d?(k=o[j].value[0],l=o[j].value[1]):(k=o[j],l=void 0),k instanceof c&&((0===j||j+1===o.length)&&void 0===l||l instanceof b)||g(),m=l?l.toCSS(r):0===j?"0%":"100%",n=k.alpha,i+='<stop offset="'+m+'" stop-color="'+k.toRGB()+'"'+(1>n?' stop-opacity="'+n+'"':"")+"/>";return i+="</"+p+"Gradient><rect "+q+' fill="url(#gradient)" /></svg>',i=encodeURIComponent(i),i="data:image/svg+xml,"+i,new f(new e("'"+i+"'",i,!1,this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../tree/color":47,"../tree/dimension":53,"../tree/expression":56,"../tree/quoted":70,"../tree/url":77,"./function-registry":21}],27:[function(a){var b=a("../tree/keyword"),c=a("../tree/detached-ruleset"),d=a("../tree/dimension"),e=a("../tree/color"),f=a("../tree/quoted"),g=a("../tree/anonymous"),h=a("../tree/url"),i=a("../tree/operation"),j=a("./function-registry"),k=function(a,c){return a instanceof c?b.True:b.False},l=function(a,c){if(void 0===c)throw{type:"Argument",message:"missing the required second argument to isunit."}; -if(c="string"==typeof c.value?c.value:c,"string"!=typeof c)throw{type:"Argument",message:"Second argument to isunit should be a unit or a string."};return a instanceof d&&a.unit.is(c)?b.True:b.False};j.addMultiple({isruleset:function(a){return k(a,c)},iscolor:function(a){return k(a,e)},isnumber:function(a){return k(a,d)},isstring:function(a){return k(a,f)},iskeyword:function(a){return k(a,b)},isurl:function(a){return k(a,h)},ispixel:function(a){return l(a,"px")},ispercentage:function(a){return l(a,"%")},isem:function(a){return l(a,"em")},isunit:l,unit:function(a,c){if(!(a instanceof d))throw{type:"Argument",message:"the first argument to unit must be a number"+(a instanceof i?". Have you forgotten parenthesis?":"")};return c=c?c instanceof b?c.value:c.toCSS():"",new d(a.value,c)},"get-unit":function(a){return new g(a.unit)},extract:function(a,b){return b=b.value-1,Array.isArray(a.value)?a.value[b]:Array(a)[b]},length:function(a){var b=Array.isArray(a.value)?a.value.length:1;return new d(b)}})},{"../tree/anonymous":43,"../tree/color":47,"../tree/detached-ruleset":52,"../tree/dimension":53,"../tree/keyword":62,"../tree/operation":68,"../tree/quoted":70,"../tree/url":77,"./function-registry":21}],28:[function(a,b){var c=a("./contexts"),d=a("./parser/parser");b.exports=function(a){var b=function(a,b){this.rootFilename=b.filename,this.paths=a.paths||[],this.contents={},this.contentsIgnoredChars={},this.mime=a.mime,this.error=null,this.context=a,this.queue=[],this.files={}};return b.prototype.push=function(b,e,f,g,h){var i=this;this.queue.push(b);var j=function(a,c,d){i.queue.splice(i.queue.indexOf(b),1);var e=d===i.rootFilename;g.optional&&a?h(null,{rules:[]},!1,null):(i.files[d]=c,a&&!i.error&&(i.error=a),h(a,c,e,d))},k={relativeUrls:this.context.relativeUrls,entryPath:f.entryPath,rootpath:f.rootpath,rootFilename:f.rootFilename},l=a.getFileManager(b,f.currentDirectory,this.context,a);if(!l)return void j({message:"Could not find a file-manager for "+b});e&&(b=l.tryAppendLessExtension(b));var m=function(a){var b=a.filename,e=a.contents.replace(/^\uFEFF/,"");k.currentDirectory=l.getPath(b),k.relativeUrls&&(k.rootpath=l.join(i.context.rootpath||"",l.pathDiff(k.currentDirectory,k.entryPath)),!l.isPathAbsolute(k.rootpath)&&l.alwaysMakePathsAbsolute()&&(k.rootpath=l.join(k.entryPath,k.rootpath))),k.filename=b;var h=new c.Parse(i.context);h.processImports=!1,i.contents[b]=e,(f.reference||g.reference)&&(k.reference=!0),g.inline?j(null,e,b):new d(h,i,k).parse(e,function(a,c){j(a,c,b)})},n=l.loadFile(b,f.currentDirectory,this.context,a,function(a,b){a?j(a):m(b)});n&&n.then(m,j)},b}},{"./contexts":10,"./parser/parser":36}],29:[function(a,b){b.exports=function(b,c){var d,e,f,g,h,i={version:[2,3,1],data:a("./data"),tree:a("./tree"),Environment:h=a("./environment/environment"),AbstractFileManager:a("./environment/abstract-file-manager"),environment:b=new h(b,c),visitors:a("./visitors"),Parser:a("./parser/parser"),functions:a("./functions")(b),contexts:a("./contexts"),SourceMapOutput:d=a("./source-map-output")(b),SourceMapBuilder:e=a("./source-map-builder")(d,b),ParseTree:f=a("./parse-tree")(e),ImportManager:g=a("./import-manager")(b),render:a("./render")(b,f,g),parse:a("./parse")(b,f,g),LessError:a("./less-error"),transformTree:a("./transform-tree"),utils:a("./utils"),PluginManager:a("./plugin-manager"),logger:a("./logger")};return i}},{"./contexts":10,"./data":12,"./environment/abstract-file-manager":14,"./environment/environment":15,"./functions":22,"./import-manager":28,"./less-error":30,"./logger":31,"./parse":33,"./parse-tree":32,"./parser/parser":36,"./plugin-manager":37,"./render":38,"./source-map-builder":39,"./source-map-output":40,"./transform-tree":41,"./tree":59,"./utils":80,"./visitors":84}],30:[function(a,b){var c=a("./utils"),d=b.exports=function(a,b,d){Error.call(this);var e=a.filename||d;if(b&&e){var f=b.contents[e],g=c.getLocation(a.index,f),h=g.line,i=g.column,j=a.call&&c.getLocation(a.call,f).line,k=f.split("\n");this.type=a.type||"Syntax",this.filename=e,this.index=a.index,this.line="number"==typeof h?h+1:null,this.callLine=j+1,this.callExtract=k[j],this.column=i,this.extract=[k[h-1],k[h],k[h+1]]}this.message=a.message,this.stack=a.stack};if("undefined"==typeof Object.create){var e=function(){};e.prototype=Error.prototype,d.prototype=new e}else d.prototype=Object.create(Error.prototype);d.prototype.constructor=d},{"./utils":80}],31:[function(a,b){b.exports={error:function(a){this._fireEvent("error",a)},warn:function(a){this._fireEvent("warn",a)},info:function(a){this._fireEvent("info",a)},debug:function(a){this._fireEvent("debug",a)},addListener:function(a){this._listeners.push(a)},removeListener:function(a){for(var b=0;this._listeners.length>b;b++)if(this._listeners[b]===a)return void this._listeners.splice(b,1)},_fireEvent:function(a,b){for(var c=0;this._listeners.length>c;c++){var d=this._listeners[c][a];d&&d(b)}},_listeners:[]}},{}],32:[function(a,b){var c=a("./less-error"),d=a("./transform-tree"),e=a("./logger");b.exports=function(a){var b=function(a,b){this.root=a,this.imports=b};return b.prototype.toCSS=function(b){var f,g,h={};try{f=d(this.root,b)}catch(i){throw new c(i,this.imports)}try{var j=Boolean(b.compress);j&&e.warn("The compress option has been deprecated. We recommend you use a dedicated css minifier, for instance see less-plugin-clean-css.");var k={compress:j,dumpLineNumbers:b.dumpLineNumbers,strictUnits:Boolean(b.strictUnits),numPrecision:8};b.sourceMap?(g=new a(b.sourceMap),h.css=g.toCSS(f,k,this.imports)):h.css=f.toCSS(k)}catch(i){throw new c(i,this.imports)}if(b.pluginManager)for(var l=b.pluginManager.getPostProcessors(),m=0;l.length>m;m++)h.css=l[m].process(h.css,{sourceMap:g,options:b,imports:this.imports});b.sourceMap&&(h.map=g.getExternalSourceMap()),h.imports=[];for(var n in this.imports.files)this.imports.files.hasOwnProperty(n)&&n!==this.imports.rootFilename&&h.imports.push(n);return h},b}},{"./less-error":30,"./logger":31,"./transform-tree":41}],33:[function(a,b){var c="undefined"==typeof Promise?a("promise"):Promise,d=a("./contexts"),e=a("./parser/parser"),f=a("./plugin-manager");b.exports=function(a,b,g){var h=function(a,b,i){if(b=b||{},"function"==typeof b&&(i=b,b={}),!i){var j=this;return new c(function(c,d){h.call(j,a,b,function(a,b){a?d(a):c(b)})})}var k,l,m=new f(this);if(m.addPlugins(b.plugins),b.pluginManager=m,k=new d.Parse(b),b.rootFileInfo)l=b.rootFileInfo;else{var n=b.filename||"input",o=n.replace(/[^\/\\]*$/,"");l={filename:n,relativeUrls:k.relativeUrls,rootpath:k.rootpath||"",currentDirectory:o,entryPath:o,rootFilename:n},l.rootpath&&"/"!==l.rootpath.slice(-1)&&(l.rootpath+="/")}var p=new g(k,l);new e(k,p,l).parse(a,function(a,c){return a?i(a):void i(null,c,p,b)},b)};return h}},{"./contexts":10,"./parser/parser":36,"./plugin-manager":37,promise:void 0}],34:[function(a,b){b.exports=function(a,b){function c(b){var c=h-q;512>c&&!b||!c||(p.push(a.slice(q,h+1)),q=h+1)}var d,e,f,g,h,i,j,k,l,m=a.length,n=0,o=0,p=[],q=0;for(h=0;m>h;h++)if(j=a.charCodeAt(h),!(j>=97&&122>=j||34>j))switch(j){case 40:o++,e=h;continue;case 41:if(--o<0)return b("missing opening `(`",h);continue;case 59:o||c();continue;case 123:n++,d=h;continue;case 125:if(--n<0)return b("missing opening `{`",h);n||o||c();continue;case 92:if(m-1>h){h++;continue}return b("unescaped `\\`",h);case 34:case 39:case 96:for(l=0,i=h,h+=1;m>h;h++)if(k=a.charCodeAt(h),!(k>96)){if(k==j){l=1;break}if(92==k){if(h==m-1)return b("unescaped `\\`",h);h++}}if(l)continue;return b("unmatched `"+String.fromCharCode(j)+"`",i);case 47:if(o||h==m-1)continue;if(k=a.charCodeAt(h+1),47==k)for(h+=2;m>h&&(k=a.charCodeAt(h),!(13>=k)||10!=k&&13!=k);h++);else if(42==k){for(f=i=h,h+=2;m-1>h&&(k=a.charCodeAt(h),125==k&&(g=h),42!=k||47!=a.charCodeAt(h+1));h++);if(h==m-1)return b("missing closing `*/`",i);h++}continue;case 42:if(m-1>h&&47==a.charCodeAt(h+1))return b("unmatched `/*`",h);continue}return 0!==n?f>d&&g>f?b("missing closing `}` or `*/`",d):b("missing closing `}`",d):0!==o?b("missing closing `)`",e):(c(!0),p)}},{}],35:[function(a,b){var c=a("./chunker");b.exports=function(){function a(){k.i>i&&(h=h.slice(k.i-i),i=k.i)}var b,d,e,f,g,h,i,j=[],k={};k.save=function(){i=k.i,j.push({current:h,i:k.i,j:d})},k.restore=function(a){(k.i>e||k.i===e&&a&&!f)&&(e=k.i,f=a);var b=j.pop();h=b.current,i=k.i=b.i,d=b.j},k.forget=function(){j.pop()},k.isWhitespace=function(a){var c=k.i+(a||0),d=b.charCodeAt(c);return d===l||d===o||d===m||d===n},k.$=function(c){var d,e,f=typeof c;return"string"===f?b.charAt(k.i)!==c?null:(t(1),c):(a(),(d=c.exec(h))?(e=d[0].length,t(e),"string"==typeof d?d:1===d.length?d[0]:d):null)},k.$re=function(a){k.i>i&&(h=h.slice(k.i-i),i=k.i);var b=a.exec(h);return b?(t(b[0].length),"string"==typeof b?b:1===b.length?b[0]:b):null},k.$char=function(a){return b.charAt(k.i)!==a?null:(t(1),a)};var l=32,m=9,n=10,o=13,p=43,q=44,r=47,s=57;k.autoCommentAbsorb=!0,k.commentStore=[],k.finished=!1;var t=function(a){for(var c,e,f,j=k.i,p=d,q=k.i-i,s=k.i+h.length-q,u=k.i+=a,v=b;s>k.i;k.i++){if(c=v.charCodeAt(k.i),k.autoCommentAbsorb&&c===r){if(e=v.charAt(k.i+1),"/"===e){f={index:k.i,isLineComment:!0};var w=v.indexOf("\n",k.i+1);0>w&&(w=s),k.i=w,f.text=v.substr(f.i,k.i-f.i),k.commentStore.push(f);continue}if("*"===e){var x=v.substr(k.i),y=x.match(/^\/\*(?:[^*]|\*+[^\/*])*\*+\//);if(y){f={index:k.i,text:y[0],isLineComment:!1},k.i+=f.text.length-1,k.commentStore.push(f);continue}}break}if(c!==l&&c!==n&&c!==m&&c!==o)break}if(h=h.slice(a+k.i-u+q),i=k.i,!h.length){if(g.length-1>d)return h=g[++d],t(0),!0;k.finished=!0}return j!==k.i||p!==d};return k.peek=function(a){return"string"==typeof a?b.charAt(k.i)===a:a.test(h)},k.peekChar=function(a){return b.charAt(k.i)===a},k.currentChar=function(){return b.charAt(k.i)},k.getInput=function(){return b},k.peekNotNumeric=function(){var a=b.charCodeAt(k.i);return a>s||p>a||a===r||a===q},k.start=function(a,f,j){b=a,k.i=d=i=e=0,g=f?c(a,j):[a],h=g[0],t(0)},k.end=function(){var a,c=k.i>=b.length;return e>k.i&&(a=f,k.i=e),{isFinished:c,furthest:k.i,furthestPossibleErrorMessage:a,furthestReachedEnd:k.i>=b.length-1,furthestChar:b[k.i]}},k}},{"./chunker":34}],36:[function(a,b){var c=a("../less-error"),d=a("../tree"),e=a("../visitors"),f=a("./parser-input"),g=a("../utils"),h=function i(a,b,h){function j(a,b){var c="[object Function]"===Object.prototype.toString.call(a)?a.call(n):o.$(a);return c?c:void l(b||("string"==typeof a?"expected '"+a+"' got '"+o.currentChar()+"'":"unexpected token"))}function k(a,b){return o.$char(a)?a:void l(b||"expected '"+a+"' got '"+o.currentChar()+"'")}function l(a,d){throw new c({index:o.i,filename:h.filename,type:d||"Syntax",message:a},b)}function m(a){var b=h.filename;return{lineNumber:g.getLocation(a,o.getInput()).line+1,fileName:b}}var n,o=f();return{parse:function(f,g,j){var k,l,m,n=null,p="";l=j&&j.globalVars?i.serializeVars(j.globalVars)+"\n":"",m=j&&j.modifyVars?"\n"+i.serializeVars(j.modifyVars):"",(l||j&&j.banner)&&(p=(j&&j.banner?j.banner:"")+l,b.contentsIgnoredChars[h.filename]=p.length),f=f.replace(/\r\n/g,"\n"),f=p+f.replace(/^\uFEFF/,"")+m,b.contents[h.filename]=f;try{o.start(f,a.chunkInput,function(a,d){throw c({index:d,type:"Parse",message:a,filename:h.filename},b)}),k=new d.Ruleset(null,this.parsers.primary()),k.root=!0,k.firstRoot=!0}catch(q){return g(new c(q,b,h.filename))}var r=o.end();if(!r.isFinished){var s=r.furthestPossibleErrorMessage;s||(s="Unrecognised input","}"===r.furthestChar?s+=". Possibly missing opening '{'":")"===r.furthestChar?s+=". Possibly missing opening '('":r.furthestReachedEnd&&(s+=". Possibly missing something")),n=new c({type:"Parse",message:s,index:r.furthest,filename:h.filename},b)}var t=function(a){return a=n||a||b.error,a?(a instanceof c||(a=new c(a,b,h.filename)),g(a)):g(null,k)};return a.processImports===!1?t():void new e.ImportVisitor(b,t).run(k)},parsers:n={primary:function(){for(var a,b=this.mixin,c=[];;){for(;;){if(a=this.comment(),!a)break;c.push(a)}if(o.finished)break;if(o.peek("}"))break;if(a=this.extendRule())c=c.concat(a);else if(a=b.definition()||this.rule()||this.ruleset()||b.call()||this.rulesetCall()||this.directive())c.push(a);else if(!o.$re(/^[\s\n]+/)&&!o.$re(/^;+/))break}return c},comment:function(){if(o.commentStore.length){var a=o.commentStore.shift();return new d.Comment(a.text,a.isLineComment,a.index,h)}},entities:{quoted:function(){var a,b=o.i;return a=o.$re(/^(~)?("((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)')/),a?new d.Quoted(a[2],a[3]||a[4],Boolean(a[1]),b,h):void 0},keyword:function(){var a=o.$re(/^%|^[_A-Za-z-][_A-Za-z0-9-]*/);return a?d.Color.fromKeyword(a)||new d.Keyword(a):void 0},call:function(){var a,b,c,e,f=o.i;if(!o.peek(/^url\(/i))return o.save(),(a=o.$re(/^([\w-]+|%|progid:[\w\.]+)\(/))?(a=a[1],b=a.toLowerCase(),"alpha"===b&&(e=n.alpha())?e:(c=this.arguments(),o.$char(")")?(o.forget(),new d.Call(a,c,f,h)):void o.restore("Could not parse call arguments or missing ')'"))):void o.forget()},arguments:function(){for(var a,b=[];;){if(a=this.assignment()||n.expression(),!a)break;if(b.push(a),!o.$char(","))break}return b},literal:function(){return this.dimension()||this.color()||this.quoted()||this.unicodeDescriptor()},assignment:function(){var a,b;return a=o.$re(/^\w+(?=\s?=)/i),a&&o.$char("=")?(b=n.entity(),b?new d.Assignment(a,b):void 0):void 0},url:function(){var a,b=o.i;return o.autoCommentAbsorb=!1,"u"===o.currentChar()&&o.$re(/^url\(/)?(a=this.quoted()||this.variable()||o.$re(/^(?:(?:\\[\(\)'"])|[^\(\)'"])+/)||"",o.autoCommentAbsorb=!0,k(")"),new d.URL(null!=a.value||a instanceof d.Variable?a:new d.Anonymous(a),b,h)):void(o.autoCommentAbsorb=!0)},variable:function(){var a,b=o.i;return"@"===o.currentChar()&&(a=o.$re(/^@@?[\w-]+/))?new d.Variable(a,b,h):void 0},variableCurly:function(){var a,b=o.i;return"@"===o.currentChar()&&(a=o.$re(/^@\{([\w-]+)\}/))?new d.Variable("@"+a[1],b,h):void 0},color:function(){var a;if("#"===o.currentChar()&&(a=o.$re(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/))){var b=a.input.match(/^#([\w]+).*/);return b=b[1],b.match(/^[A-Fa-f0-9]+$/)||l("Invalid HEX color code"),new d.Color(a[1])}},dimension:function(){if(!o.peekNotNumeric()){var a=o.$re(/^([+-]?\d*\.?\d+)(%|[a-z]+)?/i);return a?new d.Dimension(a[1],a[2]):void 0}},unicodeDescriptor:function(){var a;return a=o.$re(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/),a?new d.UnicodeDescriptor(a[0]):void 0},javascript:function(){var a,b=o.i;return a=o.$re(/^(~)?`([^`]*)`/),a?new d.JavaScript(a[2],Boolean(a[1]),b,h):void 0}},variable:function(){var a;return"@"===o.currentChar()&&(a=o.$re(/^(@[\w-]+)\s*:/))?a[1]:void 0},rulesetCall:function(){var a;return"@"===o.currentChar()&&(a=o.$re(/^(@[\w-]+)\s*\(\s*\)\s*;/))?new d.RulesetCall(a[1]):void 0},extend:function(a){var b,c,e,f,g,h=o.i;if(o.$re(a?/^&:extend\(/:/^:extend\(/)){do{for(e=null,b=null;!(e=o.$re(/^(all)(?=\s*(\)|,))/))&&(c=this.element());)b?b.push(c):b=[c];e=e&&e[1],b||l("Missing target selector for :extend()."),g=new d.Extend(new d.Selector(b),e,h),f?f.push(g):f=[g]}while(o.$char(","));return j(/^\)/),a&&j(/^;/),f}},extendRule:function(){return this.extend(!0)},mixin:{call:function(){var a,b,c,e,f,g,i=o.currentChar(),j=!1,l=o.i;if("."===i||"#"===i){for(o.save();;){if(a=o.i,e=o.$re(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/),!e)break;c=new d.Element(f,e,a,h),b?b.push(c):b=[c],f=o.$char(">")}return b&&(o.$char("(")&&(g=this.args(!0).args,k(")")),n.important()&&(j=!0),n.end())?(o.forget(),new d.mixin.Call(b,g,l,h,j)):void o.restore()}},args:function(a){var b,c,e,f,g,h,i=n.entities,j={args:null,variadic:!1},k=[],m=[],p=[];for(o.save();;){if(a)h=n.detachedRuleset()||n.expression();else{if(o.commentStore.length=0,"."===o.currentChar()&&o.$re(/^\.{3}/)){j.variadic=!0,o.$char(";")&&!b&&(b=!0),(b?m:p).push({variadic:!0});break}h=i.variable()||i.literal()||i.keyword()}if(!h)break;f=null,h.throwAwayComments&&h.throwAwayComments(),g=h;var q=null;if(a?h.value&&1==h.value.length&&(q=h.value[0]):q=h,q&&q instanceof d.Variable)if(o.$char(":")){if(k.length>0&&(b&&l("Cannot mix ; and , as delimiter types"),c=!0),g=a&&n.detachedRuleset()||n.expression(),!g){if(!a)return o.restore(),j.args=[],j;l("could not understand value for named argument")}f=e=q.name}else{if(!a&&o.$re(/^\.{3}/)){j.variadic=!0,o.$char(";")&&!b&&(b=!0),(b?m:p).push({name:h.name,variadic:!0});break}a||(e=f=q.name,g=null)}g&&k.push(g),p.push({name:f,value:g}),o.$char(",")||(o.$char(";")||b)&&(c&&l("Cannot mix ; and , as delimiter types"),b=!0,k.length>1&&(g=new d.Value(k)),m.push({name:e,value:g}),e=null,k=[],c=!1)}return o.forget(),j.args=b?m:p,j},definition:function(){var a,b,c,e,f=[],g=!1;if(!("."!==o.currentChar()&&"#"!==o.currentChar()||o.peek(/^[^{]*\}/)))if(o.save(),b=o.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){a=b[1];var h=this.args(!1);if(f=h.args,g=h.variadic,!o.$char(")"))return void o.restore("Missing closing ')'");if(o.commentStore.length=0,o.$re(/^when/)&&(e=j(n.conditions,"expected condition")),c=n.block())return o.forget(),new d.mixin.Definition(a,f,c,e,g);o.restore()}else o.forget()}},entity:function(){var a=this.entities;return this.comment()||a.literal()||a.variable()||a.url()||a.call()||a.keyword()||a.javascript()},end:function(){return o.$char(";")||o.peek("}")},alpha:function(){var a;if(o.$re(/^opacity=/i))return a=o.$re(/^\d+/),a||(a=j(this.entities.variable,"Could not parse alpha")),k(")"),new d.Alpha(a)},element:function(){var a,b,c,e=o.i;return b=this.combinator(),a=o.$re(/^(?:\d+\.\d+|\d+)%/)||o.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||o.$char("*")||o.$char("&")||this.attribute()||o.$re(/^\([^&()@]+\)/)||o.$re(/^[\.#:](?=@)/)||this.entities.variableCurly(),a||(o.save(),o.$char("(")?(c=this.selector())&&o.$char(")")?(a=new d.Paren(c),o.forget()):o.restore("Missing closing ')'"):o.forget()),a?new d.Element(b,a,e,h):void 0},combinator:function(){var a=o.currentChar();if("/"===a){o.save();var b=o.$re(/^\/[a-z]+\//i);if(b)return o.forget(),new d.Combinator(b);o.restore()}if(">"===a||"+"===a||"~"===a||"|"===a||"^"===a){for(o.i++,"^"===a&&"^"===o.currentChar()&&(a="^^",o.i++);o.isWhitespace();)o.i++;return new d.Combinator(a)}return new d.Combinator(o.isWhitespace(-1)?" ":null)},lessSelector:function(){return this.selector(!0)},selector:function(a){for(var b,c,e,f,g,i,k,m=o.i;(a&&(c=this.extend())||a&&(i=o.$re(/^when/))||(f=this.element()))&&(i?k=j(this.conditions,"expected condition"):k?l("CSS guard can only be used at the end of selector"):c?g=g?g.concat(c):c:(g&&l("Extend can only be used at the end of selector"),e=o.currentChar(),b?b.push(f):b=[f],f=null),"{"!==e&&"}"!==e&&";"!==e&&","!==e&&")"!==e););return b?new d.Selector(b,g,k,m,h):void(g&&l("Extend must be used to extend a selector, it cannot be used on its own"))},attribute:function(){if(o.$char("[")){var a,b,c,e=this.entities;return(a=e.variableCurly())||(a=j(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),c=o.$re(/^[|~*$^]?=/),c&&(b=e.quoted()||o.$re(/^[0-9]+%/)||o.$re(/^[\w-]+/)||e.variableCurly()),k("]"),new d.Attribute(a,c,b)}},block:function(){var a;return o.$char("{")&&(a=this.primary())&&o.$char("}")?a:void 0},blockRuleset:function(){var a=this.block();return a&&(a=new d.Ruleset(null,a)),a},detachedRuleset:function(){var a=this.blockRuleset();return a?new d.DetachedRuleset(a):void 0},ruleset:function(){var b,c,e,f;for(o.save(),a.dumpLineNumbers&&(f=m(o.i));;){if(c=this.lessSelector(),!c)break;if(b?b.push(c):b=[c],o.commentStore.length=0,c.condition&&b.length>1&&l("Guards are only currently allowed on a single selector."),!o.$char(","))break;c.condition&&l("Guards are only currently allowed on a single selector."),o.commentStore.length=0}if(b&&(e=this.block())){o.forget();var g=new d.Ruleset(b,e,a.strictImports);return a.dumpLineNumbers&&(g.debugInfo=f),g}o.restore()},rule:function(b){var c,e,f,g,i,j=o.i,k=o.currentChar();if("."!==k&&"#"!==k&&"&"!==k)if(o.save(),c=this.variable()||this.ruleProperty()){if(i="string"==typeof c,i&&(e=this.detachedRuleset()),o.commentStore.length=0,!e){g=!i&&c.pop().value;var l=!b&&(a.compress||i);if(l&&(e=this.value()),!e&&(e=this.anonymousValue()))return o.forget(),new d.Rule(c,e,!1,g,j,h);l||e||(e=this.value()),f=this.important()}if(e&&this.end())return o.forget(),new d.Rule(c,e,f,g,j,h);if(o.restore(),e&&!b)return this.rule(!0)}else o.forget()},anonymousValue:function(){var a=o.$re(/^([^@+\/'"*`(;{}-]*);/);return a?new d.Anonymous(a[1]):void 0},"import":function(){var a,b,c=o.i,e=o.$re(/^@import?\s+/);if(e){var f=(e?this.importOptions():null)||{};if(a=this.entities.quoted()||this.entities.url())return b=this.mediaFeatures(),o.$(";")||(o.i=c,l("missing semi-colon or unrecognised media features on import")),b=b&&new d.Value(b),new d.Import(a,b,f,c,h);o.i=c,l("malformed import statement")}},importOptions:function(){var a,b,c,d={};if(!o.$char("("))return null;do if(a=this.importOption()){switch(b=a,c=!0,b){case"css":b="less",c=!1;break;case"once":b="multiple",c=!1}if(d[b]=c,!o.$char(","))break}while(a);return k(")"),d},importOption:function(){var a=o.$re(/^(less|css|multiple|once|inline|reference|optional)/);return a?a[1]:void 0},mediaFeature:function(){var a,b,c=this.entities,e=[];o.save();do if(a=c.keyword()||c.variable())e.push(a);else if(o.$char("(")){if(b=this.property(),a=this.value(),!o.$char(")"))return o.restore("Missing closing ')'"),null;if(b&&a)e.push(new d.Paren(new d.Rule(b,a,null,null,o.i,h,!0)));else{if(!a)return o.restore("badly formed media feature definition"),null;e.push(new d.Paren(a))}}while(a);return o.forget(),e.length>0?new d.Expression(e):void 0},mediaFeatures:function(){var a,b=this.entities,c=[];do if(a=this.mediaFeature()){if(c.push(a),!o.$char(","))break}else if(a=b.variable(),a&&(c.push(a),!o.$char(",")))break;while(a);return c.length>0?c:null},media:function(){var b,c,e,f;return a.dumpLineNumbers&&(f=m(o.i)),o.$re(/^@media/)&&(b=this.mediaFeatures(),c=this.block())?(e=new d.Media(c,b,o.i,h),a.dumpLineNumbers&&(e.debugInfo=f),e):void 0},directive:function(){var b,c,e,f,g,i,j,k=o.i,n=!0;if("@"===o.currentChar()){if(c=this["import"]()||this.media())return c;if(o.save(),b=o.$re(/^@[a-z-]+/)){switch(f=b,"-"==b.charAt(1)&&b.indexOf("-",2)>0&&(f="@"+b.slice(b.indexOf("-",2)+1)),f){case"@counter-style":g=!0,n=!0;break;case"@charset":g=!0,n=!1;break;case"@namespace":i=!0,n=!1;break;case"@keyframes":g=!0;break;case"@host":case"@page":case"@document":case"@supports":j=!0}return o.commentStore.length=0,g?(c=this.entity(),c||l("expected "+b+" identifier")):i?(c=this.expression(),c||l("expected "+b+" expression")):j&&(c=(o.$re(/^[^{;]+/)||"").trim(),c&&(c=new d.Anonymous(c))),n&&(e=this.blockRuleset()),e||!n&&c&&o.$char(";")?(o.forget(),new d.Directive(b,c,e,k,h,a.dumpLineNumbers?m(k):null)):void o.restore("directive options not recognised")}}},value:function(){var a,b=[];do if(a=this.expression(),a&&(b.push(a),!o.$char(",")))break;while(a);return b.length>0?new d.Value(b):void 0},important:function(){return"!"===o.currentChar()?o.$re(/^! *important/):void 0},sub:function(){var a,b;return o.save(),o.$char("(")?(a=this.addition(),a&&o.$char(")")?(o.forget(),b=new d.Expression([a]),b.parens=!0,b):void o.restore("Expected ')'")):void o.restore()},multiplication:function(){var a,b,c,e,f;if(a=this.operand()){for(f=o.isWhitespace(-1);;){if(o.peek(/^\/[*\/]/))break;if(o.save(),c=o.$char("/")||o.$char("*"),!c){o.forget();break}if(b=this.operand(),!b){o.restore();break}o.forget(),a.parensInOp=!0,b.parensInOp=!0,e=new d.Operation(c,[e||a,b],f),f=o.isWhitespace(-1)}return e||a}},addition:function(){var a,b,c,e,f;if(a=this.multiplication()){for(f=o.isWhitespace(-1);;){if(c=o.$re(/^[-+]\s+/)||!f&&(o.$char("+")||o.$char("-")),!c)break;if(b=this.multiplication(),!b)break;a.parensInOp=!0,b.parensInOp=!0,e=new d.Operation(c,[e||a,b],f),f=o.isWhitespace(-1)}return e||a}},conditions:function(){var a,b,c,e=o.i;if(a=this.condition()){for(;;){if(!o.peek(/^,\s*(not\s*)?\(/)||!o.$char(","))break;if(b=this.condition(),!b)break;c=new d.Condition("or",c||a,b,e)}return c||a}},condition:function(){var a,b,c,e,f=this.entities,g=o.i,h=!1;return o.$re(/^not/)&&(h=!0),k("("),a=this.addition()||f.keyword()||f.quoted(),a?(e=o.$re(/^(?:>=|<=|=<|[<=>])/),e?(b=this.addition()||f.keyword()||f.quoted(),b?c=new d.Condition(e,a,b,g,h):l("expected expression")):c=new d.Condition("=",a,new d.Keyword("true"),g,h),k(")"),o.$re(/^and/)?new d.Condition("and",c,this.condition()):c):void 0},operand:function(){var a,b=this.entities;o.peek(/^-[@\(]/)&&(a=o.$char("-"));var c=this.sub()||b.dimension()||b.color()||b.variable()||b.call();return a&&(c.parensInOp=!0,c=new d.Negative(c)),c},expression:function(){var a,b,c=[];do a=this.comment(),a?c.push(a):(a=this.addition()||this.entity(),a&&(c.push(a),o.peek(/^\/[\/*]/)||(b=o.$char("/"),b&&c.push(new d.Anonymous(b)))));while(a);return c.length>0?new d.Expression(c):void 0},property:function(){var a=o.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);return a?a[1]:void 0},ruleProperty:function(){function a(a){var b=o.i,c=o.$re(a);return c?(f.push(b),e.push(c[1])):void 0}var b,c,e=[],f=[];for(o.save(),a(/^(\*?)/);;)if(!a(/^((?:[\w-]+)|(?:@\{[\w-]+\}))/))break;if(e.length>1&&a(/^((?:\+_|\+)?)\s*:/)){for(o.forget(),""===e[0]&&(e.shift(),f.shift()),c=0;e.length>c;c++)b=e[c],e[c]="@"!==b.charAt(0)?new d.Keyword(b):new d.Variable("@"+b.slice(2,-1),f[c],h);return e}o.restore()}}}};h.serializeVars=function(a){var b="";for(var c in a)if(Object.hasOwnProperty.call(a,c)){var d=a[c];b+=("@"===c[0]?"":"@")+c+": "+d+(";"===String(d).slice(-1)?"":";")}return b},b.exports=h},{"../less-error":30,"../tree":59,"../utils":80,"../visitors":84,"./parser-input":35}],37:[function(a,b){var c=function(a){this.less=a,this.visitors=[],this.postProcessors=[],this.installedPlugins=[],this.fileManagers=[]};c.prototype.addPlugins=function(a){if(a)for(var b=0;a.length>b;b++)this.addPlugin(a[b])},c.prototype.addPlugin=function(a){this.installedPlugins.push(a),a.install(this.less,this)},c.prototype.addVisitor=function(a){this.visitors.push(a)},c.prototype.addPostProcessor=function(a,b){var c;for(c=0;this.postProcessors.length>c&&!(this.postProcessors[c].priority>=b);c++);this.postProcessors.splice(c,0,{postProcessor:a,priority:b})},c.prototype.addFileManager=function(a){this.fileManagers.push(a)},c.prototype.getPostProcessors=function(){for(var a=[],b=0;this.postProcessors.length>b;b++)a.push(this.postProcessors[b].postProcessor);return a},c.prototype.getVisitors=function(){return this.visitors},c.prototype.getFileManagers=function(){return this.fileManagers},b.exports=c},{}],38:[function(a,b){var c="undefined"==typeof Promise?a("promise"):Promise;b.exports=function(a,b){var d=function(a,e,f){if("function"==typeof e&&(f=e,e={}),!f){var g=this;return new c(function(b,c){d.call(g,a,e,function(a,d){a?c(a):b(d)})})}this.parse(a,e,function(a,c,d,e){if(a)return f(a);var g;try{var h=new b(c,d);g=h.toCSS(e)}catch(a){return f(a)}f(null,g)})};return d}},{promise:void 0}],39:[function(a,b){b.exports=function(a,b){var c=function(a){this.options=a};return c.prototype.toCSS=function(b,c,d){var e=new a({contentsIgnoredCharsMap:d.contentsIgnoredChars,rootNode:b,contentsMap:d.contents,sourceMapFilename:this.options.sourceMapFilename,sourceMapURL:this.options.sourceMapURL,outputFilename:this.options.sourceMapOutputFilename,sourceMapBasepath:this.options.sourceMapBasepath,sourceMapRootpath:this.options.sourceMapRootpath,outputSourceFiles:this.options.outputSourceFiles,sourceMapGenerator:this.options.sourceMapGenerator,sourceMapFileInline:this.options.sourceMapFileInline}),f=e.toCSS(c);return this.sourceMap=e.sourceMap,this.sourceMapURL=e.sourceMapURL,this.options.sourceMapInputFilename&&(this.sourceMapInputFilename=e.normalizeFilename(this.options.sourceMapInputFilename)),f+this.getCSSAppendage()},c.prototype.getCSSAppendage=function(){var a=this.sourceMapURL;return this.options.sourceMapFileInline&&(a="data:application/json;base64,"+b.encodeBase64(this.sourceMap)),a?"/*# sourceMappingURL="+a+" */":""},c.prototype.getExternalSourceMap=function(){return this.sourceMap},c.prototype.setExternalSourceMap=function(a){this.sourceMap=a},c.prototype.isInline=function(){return this.options.sourceMapFileInline},c.prototype.getSourceMapURL=function(){return this.sourceMapURL},c.prototype.getOutputFilename=function(){return this.options.sourceMapOutputFilename},c.prototype.getInputFilename=function(){return this.sourceMapInputFilename},c}},{}],40:[function(a,b){b.exports=function(a){var b=function(b){this._css=[],this._rootNode=b.rootNode,this._contentsMap=b.contentsMap,this._contentsIgnoredCharsMap=b.contentsIgnoredCharsMap,b.sourceMapFilename&&(this._sourceMapFilename=b.sourceMapFilename.replace(/\\/g,"/")),this._outputFilename=b.outputFilename,this.sourceMapURL=b.sourceMapURL,b.sourceMapBasepath&&(this._sourceMapBasepath=b.sourceMapBasepath.replace(/\\/g,"/")),b.sourceMapRootpath?(this._sourceMapRootpath=b.sourceMapRootpath.replace(/\\/g,"/"),"/"!==this._sourceMapRootpath.charAt(this._sourceMapRootpath.length-1)&&(this._sourceMapRootpath+="/")):this._sourceMapRootpath="",this._outputSourceFiles=b.outputSourceFiles,this._sourceMapGeneratorConstructor=a.getSourceMapGenerator(),this._lineNumber=0,this._column=0};return b.prototype.normalizeFilename=function(a){return a=a.replace(/\\/g,"/"),this._sourceMapBasepath&&0===a.indexOf(this._sourceMapBasepath)&&(a=a.substring(this._sourceMapBasepath.length),("\\"===a.charAt(0)||"/"===a.charAt(0))&&(a=a.substring(1))),(this._sourceMapRootpath||"")+a},b.prototype.add=function(a,b,c,d){if(a){var e,f,g,h,i;if(b){var j=this._contentsMap[b.filename];this._contentsIgnoredCharsMap[b.filename]&&(c-=this._contentsIgnoredCharsMap[b.filename],0>c&&(c=0),j=j.slice(this._contentsIgnoredCharsMap[b.filename])),j=j.substring(0,c),f=j.split("\n"),h=f[f.length-1]}if(e=a.split("\n"),g=e[e.length-1],b)if(d)for(i=0;e.length>i;i++)this._sourceMapGenerator.addMapping({generated:{line:this._lineNumber+i+1,column:0===i?this._column:0},original:{line:f.length+i,column:0===i?h.length:0},source:this.normalizeFilename(b.filename)});else this._sourceMapGenerator.addMapping({generated:{line:this._lineNumber+1,column:this._column},original:{line:f.length,column:h.length},source:this.normalizeFilename(b.filename)});1===e.length?this._column+=g.length:(this._lineNumber+=e.length-1,this._column=g.length),this._css.push(a)}},b.prototype.isEmpty=function(){return 0===this._css.length},b.prototype.toCSS=function(a){if(this._sourceMapGenerator=new this._sourceMapGeneratorConstructor({file:this._outputFilename,sourceRoot:null}),this._outputSourceFiles)for(var b in this._contentsMap)if(this._contentsMap.hasOwnProperty(b)){var c=this._contentsMap[b];this._contentsIgnoredCharsMap[b]&&(c=c.slice(this._contentsIgnoredCharsMap[b])),this._sourceMapGenerator.setSourceContent(this.normalizeFilename(b),c)}if(this._rootNode.genCSS(a,this),this._css.length>0){var d,e=JSON.stringify(this._sourceMapGenerator.toJSON());this.sourceMapURL?d=this.sourceMapURL:this._sourceMapFilename&&(d=this._sourceMapFilename),this.sourceMapURL=d,this.sourceMap=e}return this._css.join("")},b}},{}],41:[function(a,b){var c=a("./contexts"),d=a("./visitors"),e=a("./tree");b.exports=function(a,b){b=b||{};var f,g=b.variables,h=new c.Eval(b);"object"!=typeof g||Array.isArray(g)||(g=Object.keys(g).map(function(a){var b=g[a];return b instanceof e.Value||(b instanceof e.Expression||(b=new e.Expression([b])),b=new e.Value([b])),new e.Rule("@"+a,b,!1,null,0)}),h.frames=[new e.Ruleset(null,g)]);var i,j=[],k=[new d.JoinSelectorVisitor,new d.ExtendVisitor,new d.ToCSSVisitor({compress:Boolean(b.compress)})];if(b.pluginManager){var l=b.pluginManager.getVisitors();for(i=0;l.length>i;i++){var m=l[i];m.isPreEvalVisitor?j.push(m):m.isPreVisitor?k.splice(0,0,m):k.push(m)}}for(i=0;j.length>i;i++)j[i].run(a);for(f=a.eval(h),i=0;k.length>i;i++)k[i].run(f);return f}},{"./contexts":10,"./tree":59,"./visitors":84}],42:[function(a,b){var c=a("./node"),d=function(a){this.value=a};d.prototype=new c,d.prototype.type="Alpha",d.prototype.accept=function(a){this.value=a.visit(this.value) -},d.prototype.eval=function(a){return this.value.eval?new d(this.value.eval(a)):this},d.prototype.genCSS=function(a,b){b.add("alpha(opacity="),this.value.genCSS?this.value.genCSS(a,b):b.add(this.value),b.add(")")},b.exports=d},{"./node":67}],43:[function(a,b){var c=a("./node"),d=function(a,b,c,d,e){this.value=a,this.index=b,this.mapLines=d,this.currentFileInfo=c,this.rulesetLike="undefined"==typeof e?!1:e};d.prototype=new c,d.prototype.type="Anonymous",d.prototype.eval=function(){return new d(this.value,this.index,this.currentFileInfo,this.mapLines,this.rulesetLike)},d.prototype.compare=function(a){return a.toCSS&&this.toCSS()===a.toCSS()?0:void 0},d.prototype.isRulesetLike=function(){return this.rulesetLike},d.prototype.genCSS=function(a,b){b.add(this.value,this.currentFileInfo,this.index,this.mapLines)},b.exports=d},{"./node":67}],44:[function(a,b){var c=a("./node"),d=function(a,b){this.key=a,this.value=b};d.prototype=new c,d.prototype.type="Assignment",d.prototype.accept=function(a){this.value=a.visit(this.value)},d.prototype.eval=function(a){return this.value.eval?new d(this.key,this.value.eval(a)):this},d.prototype.genCSS=function(a,b){b.add(this.key+"="),this.value.genCSS?this.value.genCSS(a,b):b.add(this.value)},b.exports=d},{"./node":67}],45:[function(a,b){var c=a("./node"),d=function(a,b,c){this.key=a,this.op=b,this.value=c};d.prototype=new c,d.prototype.type="Attribute",d.prototype.eval=function(a){return new d(this.key.eval?this.key.eval(a):this.key,this.op,this.value&&this.value.eval?this.value.eval(a):this.value)},d.prototype.genCSS=function(a,b){b.add(this.toCSS(a))},d.prototype.toCSS=function(a){var b=this.key.toCSS?this.key.toCSS(a):this.key;return this.op&&(b+=this.op,b+=this.value.toCSS?this.value.toCSS(a):this.value),"["+b+"]"},b.exports=d},{"./node":67}],46:[function(a,b){var c=a("./node"),d=a("../functions/function-caller"),e=function(a,b,c,d){this.name=a,this.args=b,this.index=c,this.currentFileInfo=d};e.prototype=new c,e.prototype.type="Call",e.prototype.accept=function(a){this.args&&(this.args=a.visitArray(this.args))},e.prototype.eval=function(a){var b,c=this.args.map(function(b){return b.eval(a)}),f=new d(this.name,a,this.index,this.currentFileInfo);if(f.isValid())try{if(b=f.call(c),null!=b)return b}catch(g){throw{type:g.type||"Runtime",message:"error evaluating function `"+this.name+"`"+(g.message?": "+g.message:""),index:this.index,filename:this.currentFileInfo.filename}}return new e(this.name,c,this.index,this.currentFileInfo)},e.prototype.genCSS=function(a,b){b.add(this.name+"(",this.currentFileInfo,this.index);for(var c=0;this.args.length>c;c++)this.args[c].genCSS(a,b),this.args.length>c+1&&b.add(", ");b.add(")")},b.exports=e},{"../functions/function-caller":20,"./node":67}],47:[function(a,b){function c(a,b){return Math.min(Math.max(a,0),b)}function d(a){return"#"+a.map(function(a){return a=c(Math.round(a),255),(16>a?"0":"")+a.toString(16)}).join("")}var e=a("./node"),f=a("../data/colors"),g=function(a,b){this.rgb=Array.isArray(a)?a:6==a.length?a.match(/.{2}/g).map(function(a){return parseInt(a,16)}):a.split("").map(function(a){return parseInt(a+a,16)}),this.alpha="number"==typeof b?b:1};g.prototype=new e,g.prototype.type="Color",g.prototype.luma=function(){var a=this.rgb[0]/255,b=this.rgb[1]/255,c=this.rgb[2]/255;return a=.03928>=a?a/12.92:Math.pow((a+.055)/1.055,2.4),b=.03928>=b?b/12.92:Math.pow((b+.055)/1.055,2.4),c=.03928>=c?c/12.92:Math.pow((c+.055)/1.055,2.4),.2126*a+.7152*b+.0722*c},g.prototype.genCSS=function(a,b){b.add(this.toCSS(a))},g.prototype.toCSS=function(a,b){var d,e,f=a&&a.compress&&!b;if(this.value)return this.value;if(e=this.fround(a,this.alpha),1>e)return"rgba("+this.rgb.map(function(a){return c(Math.round(a),255)}).concat(c(e,1)).join(","+(f?"":" "))+")";if(d=this.toRGB(),f){var g=d.split("");g[1]===g[2]&&g[3]===g[4]&&g[5]===g[6]&&(d="#"+g[1]+g[3]+g[5])}return d},g.prototype.operate=function(a,b,c){for(var d=[],e=this.alpha*(1-c.alpha)+c.alpha,f=0;3>f;f++)d[f]=this._operate(a,b,this.rgb[f],c.rgb[f]);return new g(d,e)},g.prototype.toRGB=function(){return d(this.rgb)},g.prototype.toHSL=function(){var a,b,c=this.rgb[0]/255,d=this.rgb[1]/255,e=this.rgb[2]/255,f=this.alpha,g=Math.max(c,d,e),h=Math.min(c,d,e),i=(g+h)/2,j=g-h;if(g===h)a=b=0;else{switch(b=i>.5?j/(2-g-h):j/(g+h),g){case c:a=(d-e)/j+(e>d?6:0);break;case d:a=(e-c)/j+2;break;case e:a=(c-d)/j+4}a/=6}return{h:360*a,s:b,l:i,a:f}},g.prototype.toHSV=function(){var a,b,c=this.rgb[0]/255,d=this.rgb[1]/255,e=this.rgb[2]/255,f=this.alpha,g=Math.max(c,d,e),h=Math.min(c,d,e),i=g,j=g-h;if(b=0===g?0:j/g,g===h)a=0;else{switch(g){case c:a=(d-e)/j+(e>d?6:0);break;case d:a=(e-c)/j+2;break;case e:a=(c-d)/j+4}a/=6}return{h:360*a,s:b,v:i,a:f}},g.prototype.toARGB=function(){return d([255*this.alpha].concat(this.rgb))},g.prototype.compare=function(a){return a.rgb&&a.rgb[0]===this.rgb[0]&&a.rgb[1]===this.rgb[1]&&a.rgb[2]===this.rgb[2]&&a.alpha===this.alpha?0:void 0},g.fromKeyword=function(a){var b,c=a.toLowerCase();return f.hasOwnProperty(c)?b=new g(f[c].slice(1)):"transparent"===c&&(b=new g([0,0,0],0)),b?(b.value=a,b):void 0},b.exports=g},{"../data/colors":11,"./node":67}],48:[function(a,b){var c=a("./node"),d=function(a){" "===a?(this.value=" ",this.emptyOrWhitespace=!0):(this.value=a?a.trim():"",this.emptyOrWhitespace=""===this.value)};d.prototype=new c,d.prototype.type="Combinator";var e={"":!0," ":!0,"|":!0};d.prototype.genCSS=function(a,b){var c=a.compress||e[this.value]?"":" ";b.add(c+this.value+c)},b.exports=d},{"./node":67}],49:[function(a,b){var c=a("./node"),d=a("./debug-info"),e=function(a,b,c,d){this.value=a,this.isLineComment=b,this.currentFileInfo=d};e.prototype=new c,e.prototype.type="Comment",e.prototype.genCSS=function(a,b){this.debugInfo&&b.add(d(a,this),this.currentFileInfo,this.index),b.add(this.value)},e.prototype.isSilent=function(a){var b=this.currentFileInfo&&this.currentFileInfo.reference&&!this.isReferenced,c=a.compress&&"!"!==this.value[2];return this.isLineComment||b||c},e.prototype.markReferenced=function(){this.isReferenced=!0},e.prototype.isRulesetLike=function(a){return Boolean(a)},b.exports=e},{"./debug-info":51,"./node":67}],50:[function(a,b){var c=a("./node"),d=function(a,b,c,d,e){this.op=a.trim(),this.lvalue=b,this.rvalue=c,this.index=d,this.negate=e};d.prototype=new c,d.prototype.type="Condition",d.prototype.accept=function(a){this.lvalue=a.visit(this.lvalue),this.rvalue=a.visit(this.rvalue)},d.prototype.eval=function(a){var b=function(a,b,d){switch(a){case"and":return b&&d;case"or":return b||d;default:switch(c.compare(b,d)){case-1:return"<"===a||"=<"===a||"<="===a;case 0:return"="===a||">="===a||"=<"===a||"<="===a;case 1:return">"===a||">="===a;default:return!1}}}(this.op,this.lvalue.eval(a),this.rvalue.eval(a));return this.negate?!b:b},b.exports=d},{"./node":67}],51:[function(a,b){var c=function(a,b,d){var e="";if(a.dumpLineNumbers&&!a.compress)switch(a.dumpLineNumbers){case"comments":e=c.asComment(b);break;case"mediaquery":e=c.asMediaQuery(b);break;case"all":e=c.asComment(b)+(d||"")+c.asMediaQuery(b)}return e};c.asComment=function(a){return"/* line "+a.debugInfo.lineNumber+", "+a.debugInfo.fileName+" */\n"},c.asMediaQuery=function(a){var b=a.debugInfo.fileName;return/^[a-z]+:\/\//i.test(b)||(b="file://"+b),"@media -sass-debug-info{filename{font-family:"+b.replace(/([.:\/\\])/g,function(a){return"\\"==a&&(a="/"),"\\"+a})+"}line{font-family:\\00003"+a.debugInfo.lineNumber+"}}\n"},b.exports=c},{}],52:[function(a,b){var c=a("./node"),d=a("../contexts"),e=function(a,b){this.ruleset=a,this.frames=b};e.prototype=new c,e.prototype.type="DetachedRuleset",e.prototype.evalFirst=!0,e.prototype.accept=function(a){this.ruleset=a.visit(this.ruleset)},e.prototype.eval=function(a){var b=this.frames||a.frames.slice(0);return new e(this.ruleset,b)},e.prototype.callEval=function(a){return this.ruleset.eval(this.frames?new d.Eval(a,this.frames.concat(a.frames)):a)},b.exports=e},{"../contexts":10,"./node":67}],53:[function(a,b){var c=a("./node"),d=a("../data/unit-conversions"),e=a("./unit"),f=a("./color"),g=function(a,b){this.value=parseFloat(a),this.unit=b&&b instanceof e?b:new e(b?[b]:void 0)};g.prototype=new c,g.prototype.type="Dimension",g.prototype.accept=function(a){this.unit=a.visit(this.unit)},g.prototype.eval=function(){return this},g.prototype.toColor=function(){return new f([this.value,this.value,this.value])},g.prototype.genCSS=function(a,b){if(a&&a.strictUnits&&!this.unit.isSingular())throw new Error("Multiple units in dimension. Correct the units or use the unit function. Bad unit: "+this.unit.toString());var c=this.fround(a,this.value),d=String(c);if(0!==c&&1e-6>c&&c>-1e-6&&(d=c.toFixed(20).replace(/0+$/,"")),a&&a.compress){if(0===c&&this.unit.isLength())return void b.add(d);c>0&&1>c&&(d=d.substr(1))}b.add(d),this.unit.genCSS(a,b)},g.prototype.operate=function(a,b,c){var d=this._operate(a,b,this.value,c.value),e=this.unit.clone();if("+"===b||"-"===b)if(0===e.numerator.length&&0===e.denominator.length)e.numerator=c.unit.numerator.slice(0),e.denominator=c.unit.denominator.slice(0);else if(0===c.unit.numerator.length&&0===e.denominator.length);else{if(c=c.convertTo(this.unit.usedUnits()),a.strictUnits&&c.unit.toString()!==e.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+e.toString()+"' and '"+c.unit.toString()+"'.");d=this._operate(a,b,this.value,c.value)}else"*"===b?(e.numerator=e.numerator.concat(c.unit.numerator).sort(),e.denominator=e.denominator.concat(c.unit.denominator).sort(),e.cancel()):"/"===b&&(e.numerator=e.numerator.concat(c.unit.denominator).sort(),e.denominator=e.denominator.concat(c.unit.numerator).sort(),e.cancel());return new g(d,e)},g.prototype.compare=function(a){var b,d;if(!(a instanceof g))return void 0;if(this.unit.isEmpty()||a.unit.isEmpty())b=this,d=a;else if(b=this.unify(),d=a.unify(),0!==b.unit.compare(d.unit))return void 0;return c.numericCompare(b.value,d.value)},g.prototype.unify=function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},g.prototype.convertTo=function(a){var b,c,e,f,h,i=this.value,j=this.unit.clone(),k={};if("string"==typeof a){for(b in d)d[b].hasOwnProperty(a)&&(k={},k[b]=a);a=k}h=function(a,b){return e.hasOwnProperty(a)?(b?i/=e[a]/e[f]:i*=e[a]/e[f],f):a};for(c in a)a.hasOwnProperty(c)&&(f=a[c],e=d[c],j.map(h));return j.cancel(),new g(i,j)},b.exports=g},{"../data/unit-conversions":13,"./color":47,"./node":67,"./unit":76}],54:[function(a,b){var c=a("./node"),d=a("./ruleset"),e=function(a,b,c,d,e,f,g){this.name=a,this.value=b,c&&(this.rules=c,this.rules.allowImports=!0),this.index=d,this.currentFileInfo=e,this.debugInfo=f,this.isReferenced=g};e.prototype=new c,e.prototype.type="Directive",e.prototype.accept=function(a){var b=this.value,c=this.rules;c&&(this.rules=a.visit(c)),b&&(this.value=a.visit(b))},e.prototype.isRulesetLike=function(){return this.rules||!this.isCharset()},e.prototype.isCharset=function(){return"@charset"===this.name},e.prototype.genCSS=function(a,b){var c=this.value,d=this.rules;b.add(this.name,this.currentFileInfo,this.index),c&&(b.add(" "),c.genCSS(a,b)),d?("Ruleset"===d.type&&(d=[d]),this.outputRuleset(a,b,d)):b.add(";")},e.prototype.eval=function(a){var b=this.value,c=this.rules;return b&&(b=b.eval(a)),c&&(c=c.eval(a),c.root=!0),new e(this.name,b,c,this.index,this.currentFileInfo,this.debugInfo,this.isReferenced)},e.prototype.variable=function(a){return this.rules?d.prototype.variable.call(this.rules,a):void 0},e.prototype.find=function(){return this.rules?d.prototype.find.apply(this.rules,arguments):void 0},e.prototype.rulesets=function(){return this.rules?d.prototype.rulesets.apply(this.rules):void 0},e.prototype.markReferenced=function(){var a,b;if(this.isReferenced=!0,this.rules)for(b=this.rules.rules,a=0;b.length>a;a++)b[a].markReferenced&&b[a].markReferenced()},e.prototype.getIsReferenced=function(){return!this.currentFileInfo||!this.currentFileInfo.reference||this.isReferenced},e.prototype.outputRuleset=function(a,b,c){var d,e=c.length;if(a.tabLevel=(0|a.tabLevel)+1,a.compress){for(b.add("{"),d=0;e>d;d++)c[d].genCSS(a,b);return b.add("}"),void a.tabLevel--}var f="\n"+Array(a.tabLevel).join(" "),g=f+" ";if(e){for(b.add(" {"+g),c[0].genCSS(a,b),d=1;e>d;d++)b.add(g),c[d].genCSS(a,b);b.add(f+"}")}else b.add(" {"+f+"}");a.tabLevel--},b.exports=e},{"./node":67,"./ruleset":73}],55:[function(a,b){var c=a("./node"),d=a("./paren"),e=a("./combinator"),f=function(a,b,c,d){this.combinator=a instanceof e?a:new e(a),this.value="string"==typeof b?b.trim():b?b:"",this.index=c,this.currentFileInfo=d};f.prototype=new c,f.prototype.type="Element",f.prototype.accept=function(a){var b=this.value;this.combinator=a.visit(this.combinator),"object"==typeof b&&(this.value=a.visit(b))},f.prototype.eval=function(a){return new f(this.combinator,this.value.eval?this.value.eval(a):this.value,this.index,this.currentFileInfo)},f.prototype.genCSS=function(a,b){b.add(this.toCSS(a),this.currentFileInfo,this.index)},f.prototype.toCSS=function(a){a=a||{};var b=this.value,c=a.firstSelector;return b instanceof d&&(a.firstSelector=!0),b=b.toCSS?b.toCSS(a):b,a.firstSelector=c,""===b&&"&"===this.combinator.value.charAt(0)?"":this.combinator.toCSS(a)+b},b.exports=f},{"./combinator":48,"./node":67,"./paren":69}],56:[function(a,b){var c=a("./node"),d=a("./paren"),e=a("./comment"),f=function(a){if(this.value=a,!a)throw new Error("Expression requires an array parameter")};f.prototype=new c,f.prototype.type="Expression",f.prototype.accept=function(a){this.value=a.visitArray(this.value)},f.prototype.eval=function(a){var b,c=this.parens&&!this.parensInOp,e=!1;return c&&a.inParenthesis(),this.value.length>1?b=new f(this.value.map(function(b){return b.eval(a)})):1===this.value.length?(this.value[0].parens&&!this.value[0].parensInOp&&(e=!0),b=this.value[0].eval(a)):b=this,c&&a.outOfParenthesis(),this.parens&&this.parensInOp&&!a.isMathOn()&&!e&&(b=new d(b)),b},f.prototype.genCSS=function(a,b){for(var c=0;this.value.length>c;c++)this.value[c].genCSS(a,b),this.value.length>c+1&&b.add(" ")},f.prototype.throwAwayComments=function(){this.value=this.value.filter(function(a){return!(a instanceof e)})},b.exports=f},{"./comment":49,"./node":67,"./paren":69}],57:[function(a,b){var c=a("./node"),d=function e(a,b,c){switch(this.selector=a,this.option=b,this.index=c,this.object_id=e.next_id++,this.parent_ids=[this.object_id],b){case"all":this.allowBefore=!0,this.allowAfter=!0;break;default:this.allowBefore=!1,this.allowAfter=!1}};d.next_id=0,d.prototype=new c,d.prototype.type="Extend",d.prototype.accept=function(a){this.selector=a.visit(this.selector)},d.prototype.eval=function(a){return new d(this.selector.eval(a),this.option,this.index)},d.prototype.clone=function(){return new d(this.selector,this.option,this.index)},d.prototype.findSelfSelectors=function(a){var b,c,d=[];for(b=0;a.length>b;b++)c=a[b].elements,b>0&&c.length&&""===c[0].combinator.value&&(c[0].combinator.value=" "),d=d.concat(a[b].elements);this.selfSelectors=[{elements:d}]},b.exports=d},{"./node":67}],58:[function(a,b){var c=a("./node"),d=a("./media"),e=a("./url"),f=a("./quoted"),g=a("./ruleset"),h=a("./anonymous"),i=function(a,b,c,d,e){if(this.options=c,this.index=d,this.path=a,this.features=b,this.currentFileInfo=e,void 0!==this.options.less||this.options.inline)this.css=!this.options.less||this.options.inline;else{var f=this.getPath();f&&/[#\.\&\?\/]css([\?;].*)?$/.test(f)&&(this.css=!0)}};i.prototype=new c,i.prototype.type="Import",i.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.path=a.visit(this.path),!this.options.inline&&this.root&&(this.root=a.visit(this.root))},i.prototype.genCSS=function(a,b){this.css&&(b.add("@import ",this.currentFileInfo,this.index),this.path.genCSS(a,b),this.features&&(b.add(" "),this.features.genCSS(a,b)),b.add(";"))},i.prototype.getPath=function(){return this.path instanceof f?this.path.value:this.path instanceof e?this.path.value.value:null},i.prototype.isVariableImport=function(){var a=this.path;return a instanceof e&&(a=a.value),a instanceof f?a.containsVariables():!0},i.prototype.evalForImport=function(a){var b=this.path;return b instanceof e&&(b=b.value),new i(b.eval(a),this.features,this.options,this.index,this.currentFileInfo)},i.prototype.evalPath=function(a){var b=this.path.eval(a),c=this.currentFileInfo&&this.currentFileInfo.rootpath;if(!(b instanceof e)){if(c){var d=b.value;d&&a.isPathRelative(d)&&(b.value=c+d)}b.value=a.normalizePath(b.value)}return b},i.prototype.eval=function(a){var b,c=this.features&&this.features.eval(a);if(this.skip&&("function"==typeof this.skip&&(this.skip=this.skip()),this.skip))return[];if(this.options.inline){var e=new h(this.root,0,{filename:this.importedFilename},!0,!0);return this.features?new d([e],this.features.value):[e]}if(this.css){var f=new i(this.evalPath(a),c,this.options,this.index);if(!f.css&&this.error)throw this.error;return f}return b=new g(null,this.root.rules.slice(0)),b.evalImports(a),this.features?new d(b.rules,this.features.value):b.rules},b.exports=i},{"./anonymous":43,"./media":63,"./node":67,"./quoted":70,"./ruleset":73,"./url":77}],59:[function(a,b){var c={};c.Node=a("./node"),c.Alpha=a("./alpha"),c.Color=a("./color"),c.Directive=a("./directive"),c.DetachedRuleset=a("./detached-ruleset"),c.Operation=a("./operation"),c.Dimension=a("./dimension"),c.Unit=a("./unit"),c.Keyword=a("./keyword"),c.Variable=a("./variable"),c.Ruleset=a("./ruleset"),c.Element=a("./element"),c.Attribute=a("./attribute"),c.Combinator=a("./combinator"),c.Selector=a("./selector"),c.Quoted=a("./quoted"),c.Expression=a("./expression"),c.Rule=a("./rule"),c.Call=a("./call"),c.URL=a("./url"),c.Import=a("./import"),c.mixin={Call:a("./mixin-call"),Definition:a("./mixin-definition")},c.Comment=a("./comment"),c.Anonymous=a("./anonymous"),c.Value=a("./value"),c.JavaScript=a("./javascript"),c.Assignment=a("./assignment"),c.Condition=a("./condition"),c.Paren=a("./paren"),c.Media=a("./media"),c.UnicodeDescriptor=a("./unicode-descriptor"),c.Negative=a("./negative"),c.Extend=a("./extend"),c.RulesetCall=a("./ruleset-call"),b.exports=c},{"./alpha":42,"./anonymous":43,"./assignment":44,"./attribute":45,"./call":46,"./color":47,"./combinator":48,"./comment":49,"./condition":50,"./detached-ruleset":52,"./dimension":53,"./directive":54,"./element":55,"./expression":56,"./extend":57,"./import":58,"./javascript":60,"./keyword":62,"./media":63,"./mixin-call":64,"./mixin-definition":65,"./negative":66,"./node":67,"./operation":68,"./paren":69,"./quoted":70,"./rule":71,"./ruleset":73,"./ruleset-call":72,"./selector":74,"./unicode-descriptor":75,"./unit":76,"./url":77,"./value":78,"./variable":79}],60:[function(a,b){var c=a("./js-eval-node"),d=a("./dimension"),e=a("./quoted"),f=a("./anonymous"),g=function(a,b,c,d){this.escaped=b,this.expression=a,this.index=c,this.currentFileInfo=d};g.prototype=new c,g.prototype.type="JavaScript",g.prototype.eval=function(a){var b=this.evaluateJavaScript(this.expression,a);return"number"==typeof b?new d(b):"string"==typeof b?new e('"'+b+'"',b,this.escaped,this.index):new f(Array.isArray(b)?b.join(", "):b)},b.exports=g},{"./anonymous":43,"./dimension":53,"./js-eval-node":61,"./quoted":70}],61:[function(a,b){var c=a("./node"),d=a("./variable"),e=function(){};e.prototype=new c,e.prototype.evaluateJavaScript=function(a,b){var c,e=this,f={};if(void 0!==b.javascriptEnabled&&!b.javascriptEnabled)throw{message:"You are using JavaScript, which has been disabled.",filename:this.currentFileInfo.filename,index:this.index};a=a.replace(/@\{([\w-]+)\}/g,function(a,c){return e.jsify(new d("@"+c,e.index,e.currentFileInfo).eval(b))});try{a=new Function("return ("+a+")")}catch(g){throw{message:"JavaScript evaluation error: "+g.message+" from `"+a+"`",filename:this.currentFileInfo.filename,index:this.index}}var h=b.frames[0].variables();for(var i in h)h.hasOwnProperty(i)&&(f[i.slice(1)]={value:h[i].value,toJS:function(){return this.value.eval(b).toCSS()}});try{c=a.call(f)}catch(g){throw{message:"JavaScript evaluation error: '"+g.name+": "+g.message.replace(/["]/g,"'")+"'",filename:this.currentFileInfo.filename,index:this.index}}return c},e.prototype.jsify=function(a){return Array.isArray(a.value)&&a.value.length>1?"["+a.value.map(function(a){return a.toCSS()}).join(", ")+"]":a.toCSS()},b.exports=e},{"./node":67,"./variable":79}],62:[function(a,b){var c=a("./node"),d=function(a){this.value=a};d.prototype=new c,d.prototype.type="Keyword",d.prototype.genCSS=function(a,b){if("%"===this.value)throw{type:"Syntax",message:"Invalid % without number"};b.add(this.value)},d.True=new d("true"),d.False=new d("false"),b.exports=d},{"./node":67}],63:[function(a,b){var c=a("./ruleset"),d=a("./value"),e=a("./element"),f=a("./selector"),g=a("./anonymous"),h=a("./expression"),i=a("./directive"),j=function(a,b,e,f){this.index=e,this.currentFileInfo=f;var g=this.emptySelectors();this.features=new d(b),this.rules=[new c(g,a)],this.rules[0].allowImports=!0};j.prototype=new i,j.prototype.type="Media",j.prototype.isRulesetLike=!0,j.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.rules&&(this.rules=a.visitArray(this.rules))},j.prototype.genCSS=function(a,b){b.add("@media ",this.currentFileInfo,this.index),this.features.genCSS(a,b),this.outputRuleset(a,b,this.rules)},j.prototype.eval=function(a){a.mediaBlocks||(a.mediaBlocks=[],a.mediaPath=[]);var b=new j(null,[],this.index,this.currentFileInfo);this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,b.debugInfo=this.debugInfo);var c=!1;a.strictMath||(c=!0,a.strictMath=!0);try{b.features=this.features.eval(a)}finally{c&&(a.strictMath=!1)}return a.mediaPath.push(b),a.mediaBlocks.push(b),a.frames.unshift(this.rules[0]),b.rules=[this.rules[0].eval(a)],a.frames.shift(),a.mediaPath.pop(),0===a.mediaPath.length?b.evalTop(a):b.evalNested(a)},j.prototype.variable=function(a){return c.prototype.variable.call(this.rules[0],a)},j.prototype.find=function(){return c.prototype.find.apply(this.rules[0],arguments)},j.prototype.rulesets=function(){return c.prototype.rulesets.apply(this.rules[0])},j.prototype.emptySelectors=function(){var a=new e("","&",this.index,this.currentFileInfo),b=[new f([a],null,null,this.index,this.currentFileInfo)];return b[0].mediaEmpty=!0,b},j.prototype.markReferenced=function(){var a,b=this.rules[0].rules;for(this.rules[0].markReferenced(),this.isReferenced=!0,a=0;b.length>a;a++)b[a].markReferenced&&b[a].markReferenced()},j.prototype.evalTop=function(a){var b=this;if(a.mediaBlocks.length>1){var d=this.emptySelectors();b=new c(d,a.mediaBlocks),b.multiMedia=!0}return delete a.mediaBlocks,delete a.mediaPath,b},j.prototype.evalNested=function(a){var b,e,f=a.mediaPath.concat([this]);for(b=0;f.length>b;b++)e=f[b].features instanceof d?f[b].features.value:f[b].features,f[b]=Array.isArray(e)?e:[e];return this.features=new d(this.permute(f).map(function(a){for(a=a.map(function(a){return a.toCSS?a:new g(a)}),b=a.length-1;b>0;b--)a.splice(b,0,new g("and"));return new h(a)})),new c([],[])},j.prototype.permute=function(a){if(0===a.length)return[];if(1===a.length)return a[0];for(var b=[],c=this.permute(a.slice(1)),d=0;c.length>d;d++)for(var e=0;a[0].length>e;e++)b.push([a[0][e]].concat(c[d]));return b},j.prototype.bubbleSelectors=function(a){a&&(this.rules=[new c(a.slice(0),[this.rules[0]])])},b.exports=j},{"./anonymous":43,"./directive":54,"./element":55,"./expression":56,"./ruleset":73,"./selector":74,"./value":78}],64:[function(a,b){var c=a("./node"),d=a("./selector"),e=a("./mixin-definition"),f=a("../functions/default"),g=function(a,b,c,e,f){this.selector=new d(a),this.arguments=b&&b.length?b:null,this.index=c,this.currentFileInfo=e,this.important=f};g.prototype=new c,g.prototype.type="MixinCall",g.prototype.accept=function(a){this.selector&&(this.selector=a.visit(this.selector)),this.arguments&&(this.arguments=a.visitArray(this.arguments))},g.prototype.eval=function(a){function b(b,c){var d,e;for(k=0;2>k;k++){for(w[k]=!0,f.value(k),d=0;c.length>d&&w[k];d++)e=c[d],e.matchCondition&&(w[k]=w[k]&&e.matchCondition(null,a));b.matchCondition&&(w[k]=w[k]&&b.matchCondition(h,a))}return w[0]||w[1]?w[0]!=w[1]?w[1]?z:A:y:x}var c,d,g,h,i,j,k,l,m,n,o,p,q,r,s,t=[],u=!1,v=[],w=[],x=-1,y=0,z=1,A=2;for(h=this.arguments&&this.arguments.map(function(b){return{name:b.name,value:b.value.eval(a)}}),s=function(b){return b.matchArgs(null,a)},i=0;a.frames.length>i;i++)if((c=a.frames[i].find(this.selector,null,s)).length>0){for(m=!0,j=0;c.length>j;j++){for(d=c[j].rule,g=c[j].path,l=!1,k=0;a.frames.length>k;k++)if(!(d instanceof e)&&d===(a.frames[k].originalRuleset||a.frames[k])){l=!0;break}l||d.matchArgs(h,a)&&(o={mixin:d,group:b(d,g)},o.group!==x&&v.push(o),u=!0)}for(f.reset(),q=[0,0,0],j=0;v.length>j;j++)q[v[j].group]++;if(q[y]>0)p=A;else if(p=z,q[z]+q[A]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(h)+"`",index:this.index,filename:this.currentFileInfo.filename};for(j=0;v.length>j;j++)if(o=v[j].group,o===y||o===p)try{d=v[j].mixin,d instanceof e||(r=d.originalRuleset||d,d=new e("",[],d.rules,null,!1),d.originalRuleset=r),Array.prototype.push.apply(t,d.evalCall(a,h,this.important).rules)}catch(B){throw{message:B.message,index:this.index,filename:this.currentFileInfo.filename,stack:B.stack}}if(u){if(!this.currentFileInfo||!this.currentFileInfo.reference)for(i=0;t.length>i;i++)n=t[i],n.markReferenced&&n.markReferenced();return t}}throw m?{type:"Runtime",message:"No matching definition was found for `"+this.format(h)+"`",index:this.index,filename:this.currentFileInfo.filename}:{type:"Name",message:this.selector.toCSS().trim()+" is undefined",index:this.index,filename:this.currentFileInfo.filename}},g.prototype.format=function(a){return this.selector.toCSS().trim()+"("+(a?a.map(function(a){var b="";return a.name&&(b+=a.name+":"),b+=a.value.toCSS?a.value.toCSS():"???"}).join(", "):"")+")"},b.exports=g},{"../functions/default":19,"./mixin-definition":65,"./node":67,"./selector":74}],65:[function(a,b){var c=a("./selector"),d=a("./element"),e=a("./ruleset"),f=a("./rule"),g=a("./expression"),h=a("../contexts"),i=function(a,b,e,f,g,h){this.name=a,this.selectors=[new c([new d(null,a,this.index,this.currentFileInfo)])],this.params=b,this.condition=f,this.variadic=g,this.arity=b.length,this.rules=e,this._lookups={},this.required=b.reduce(function(a,b){return!b.name||b.name&&!b.value?a+1:a},0),this.frames=h};i.prototype=new e,i.prototype.type="MixinDefinition",i.prototype.evalFirst=!0,i.prototype.accept=function(a){this.params&&this.params.length&&(this.params=a.visitArray(this.params)),this.rules=a.visitArray(this.rules),this.condition&&(this.condition=a.visit(this.condition))},i.prototype.evalParams=function(a,b,c,d){var i,j,k,l,m,n,o,p,q=new e(null,null),r=this.params.slice(0),s=0;if(b=new h.Eval(b,[q].concat(b.frames)),c)for(c=c.slice(0),s=c.length,k=0;s>k;k++)if(j=c[k],n=j&&j.name){for(o=!1,l=0;r.length>l;l++)if(!d[l]&&n===r[l].name){d[l]=j.value.eval(a),q.prependRule(new f(n,j.value.eval(a))),o=!0;break}if(o){c.splice(k,1),k--;continue}throw{type:"Runtime",message:"Named argument for "+this.name+" "+c[k].name+" not found"}}for(p=0,k=0;r.length>k;k++)if(!d[k]){if(j=c&&c[p],n=r[k].name)if(r[k].variadic){for(i=[],l=p;s>l;l++)i.push(c[l].value.eval(a));q.prependRule(new f(n,new g(i).eval(a)))}else{if(m=j&&j.value)m=m.eval(a);else{if(!r[k].value)throw{type:"Runtime",message:"wrong number of arguments for "+this.name+" ("+s+" for "+this.arity+")"};m=r[k].value.eval(b),q.resetCache()}q.prependRule(new f(n,m)),d[k]=m}if(r[k].variadic&&c)for(l=p;s>l;l++)d[l]=c[l].value.eval(a);p++}return q},i.prototype.eval=function(a){return new i(this.name,this.params,this.rules,this.condition,this.variadic,this.frames||a.frames.slice(0))},i.prototype.evalCall=function(a,b,c){var d,i,j=[],k=this.frames?this.frames.concat(a.frames):a.frames,l=this.evalParams(a,new h.Eval(a,k),b,j);return l.prependRule(new f("@arguments",new g(j).eval(a))),d=this.rules.slice(0),i=new e(null,d),i.originalRuleset=this,i=i.eval(new h.Eval(a,[this,l].concat(k))),c&&(i=this.makeImportant.apply(i)),i},i.prototype.matchCondition=function(a,b){return this.condition&&!this.condition.eval(new h.Eval(b,[this.evalParams(b,new h.Eval(b,this.frames?this.frames.concat(b.frames):b.frames),a,[])].concat(this.frames).concat(b.frames)))?!1:!0},i.prototype.matchArgs=function(a,b){var c,d=a&&a.length||0;if(this.variadic){if(this.required-1>d)return!1}else{if(this.required>d)return!1;if(d>this.params.length)return!1}c=Math.min(d,this.arity);for(var e=0;c>e;e++)if(!this.params[e].name&&!this.params[e].variadic&&a[e].value.eval(b).toCSS()!=this.params[e].value.eval(b).toCSS())return!1;return!0},b.exports=i},{"../contexts":10,"./element":55,"./expression":56,"./rule":71,"./ruleset":73,"./selector":74}],66:[function(a,b){var c=a("./node"),d=a("./operation"),e=a("./dimension"),f=function(a){this.value=a};f.prototype=new c,f.prototype.type="Negative",f.prototype.genCSS=function(a,b){b.add("-"),this.value.genCSS(a,b)},f.prototype.eval=function(a){return a.isMathOn()?new d("*",[new e(-1),this.value]).eval(a):new f(this.value.eval(a))},b.exports=f},{"./dimension":53,"./node":67,"./operation":68}],67:[function(a,b){var c=function(){};c.prototype.toCSS=function(a){var b=[];return this.genCSS(a,{add:function(a){b.push(a)},isEmpty:function(){return 0===b.length}}),b.join("")},c.prototype.genCSS=function(a,b){b.add(this.value)},c.prototype.accept=function(a){this.value=a.visit(this.value)},c.prototype.eval=function(){return this},c.prototype._operate=function(a,b,c,d){switch(b){case"+":return c+d;case"-":return c-d;case"*":return c*d;case"/":return c/d}},c.prototype.fround=function(a,b){var c=a&&a.numPrecision;return null==c?b:Number((b+2e-16).toFixed(c))},c.compare=function(a,b){if(a.compare&&"Quoted"!==b.type&&"Anonymous"!==b.type)return a.compare(b);if(b.compare)return-b.compare(a);if(a.type!==b.type)return void 0;if(a=a.value,b=b.value,!Array.isArray(a))return a===b?0:void 0;if(a.length!==b.length)return void 0;for(var d=0;a.length>d;d++)if(0!==c.compare(a[d],b[d]))return void 0;return 0},c.numericCompare=function(a,b){return b>a?-1:a===b?0:a>b?1:void 0},b.exports=c},{}],68:[function(a,b){var c=a("./node"),d=a("./color"),e=a("./dimension"),f=function(a,b,c){this.op=a.trim(),this.operands=b,this.isSpaced=c};f.prototype=new c,f.prototype.type="Operation",f.prototype.accept=function(a){this.operands=a.visit(this.operands)},f.prototype.eval=function(a){var b=this.operands[0].eval(a),c=this.operands[1].eval(a);if(a.isMathOn()){if(b instanceof e&&c instanceof d&&(b=b.toColor()),c instanceof e&&b instanceof d&&(c=c.toColor()),!b.operate)throw{type:"Operation",message:"Operation on an invalid type"};return b.operate(a,this.op,c)}return new f(this.op,[b,c],this.isSpaced)},f.prototype.genCSS=function(a,b){this.operands[0].genCSS(a,b),this.isSpaced&&b.add(" "),b.add(this.op),this.isSpaced&&b.add(" "),this.operands[1].genCSS(a,b)},b.exports=f},{"./color":47,"./dimension":53,"./node":67}],69:[function(a,b){var c=a("./node"),d=function(a){this.value=a};d.prototype=new c,d.prototype.type="Paren",d.prototype.genCSS=function(a,b){b.add("("),this.value.genCSS(a,b),b.add(")")},d.prototype.eval=function(a){return new d(this.value.eval(a))},b.exports=d},{"./node":67}],70:[function(a,b){var c=a("./node"),d=a("./js-eval-node"),e=a("./variable"),f=function(a,b,c,d,e){this.escaped=null==c?!0:c,this.value=b||"",this.quote=a.charAt(0),this.index=d,this.currentFileInfo=e};f.prototype=new d,f.prototype.type="Quoted",f.prototype.genCSS=function(a,b){this.escaped||b.add(this.quote,this.currentFileInfo,this.index),b.add(this.value),this.escaped||b.add(this.quote)},f.prototype.containsVariables=function(){return this.value.match(/(`([^`]+)`)|@\{([\w-]+)\}/)},f.prototype.eval=function(a){function b(a,b,c){var d=a;do a=d,d=a.replace(b,c);while(a!==d);return d}var c=this,d=this.value,g=function(b,d){return String(c.evaluateJavaScript(d,a))},h=function(b,d){var g=new e("@"+d,c.index,c.currentFileInfo).eval(a,!0); -return g instanceof f?g.value:g.toCSS()};return d=b(d,/`([^`]+)`/g,g),d=b(d,/@\{([\w-]+)\}/g,h),new f(this.quote+d+this.quote,d,this.escaped,this.index,this.currentFileInfo)},f.prototype.compare=function(a){return"Quoted"!==a.type||this.escaped||a.escaped?a.toCSS&&this.toCSS()===a.toCSS()?0:void 0:c.numericCompare(this.value,a.value)},b.exports=f},{"./js-eval-node":61,"./node":67,"./variable":79}],71:[function(a,b){function c(a,b){var c,d="",e=b.length,f={add:function(a){d+=a}};for(c=0;e>c;c++)b[c].eval(a).genCSS(a,f);return d}var d=a("./node"),e=a("./value"),f=a("./keyword"),g=function(a,b,c,f,g,h,i,j){this.name=a,this.value=b instanceof d?b:new e([b]),this.important=c?" "+c.trim():"",this.merge=f,this.index=g,this.currentFileInfo=h,this.inline=i||!1,this.variable=void 0!==j?j:a.charAt&&"@"===a.charAt(0)};g.prototype=new d,g.prototype.type="Rule",g.prototype.genCSS=function(a,b){b.add(this.name+(a.compress?":":": "),this.currentFileInfo,this.index);try{this.value.genCSS(a,b)}catch(c){throw c.index=this.index,c.filename=this.currentFileInfo.filename,c}b.add(this.important+(this.inline||a.lastRule&&a.compress?"":";"),this.currentFileInfo,this.index)},g.prototype.eval=function(a){var b,d=!1,e=this.name,h=this.variable;"string"!=typeof e&&(e=1===e.length&&e[0]instanceof f?e[0].value:c(a,e),h=!1),"font"!==e||a.strictMath||(d=!0,a.strictMath=!0);try{if(a.importantScope.push({}),b=this.value.eval(a),!this.variable&&"DetachedRuleset"===b.type)throw{message:"Rulesets cannot be evaluated on a property.",index:this.index,filename:this.currentFileInfo.filename};var i=this.important,j=a.importantScope.pop();return!i&&j.important&&(i=j.important),new g(e,b,i,this.merge,this.index,this.currentFileInfo,this.inline,h)}catch(k){throw"number"!=typeof k.index&&(k.index=this.index,k.filename=this.currentFileInfo.filename),k}finally{d&&(a.strictMath=!1)}},g.prototype.makeImportant=function(){return new g(this.name,this.value,"!important",this.merge,this.index,this.currentFileInfo,this.inline)},b.exports=g},{"./keyword":62,"./node":67,"./value":78}],72:[function(a,b){var c=a("./node"),d=a("./variable"),e=function(a){this.variable=a};e.prototype=new c,e.prototype.type="RulesetCall",e.prototype.eval=function(a){var b=new d(this.variable).eval(a);return b.callEval(a)},b.exports=e},{"./node":67,"./variable":79}],73:[function(a,b){var c=a("./node"),d=a("./rule"),e=a("./selector"),f=a("./element"),g=a("./paren"),h=a("../contexts"),i=a("../functions/default"),j=a("./debug-info"),k=function(a,b,c){this.selectors=a,this.rules=b,this._lookups={},this.strictImports=c};k.prototype=new c,k.prototype.type="Ruleset",k.prototype.isRuleset=!0,k.prototype.isRulesetLike=!0,k.prototype.accept=function(a){this.paths?a.visitArray(this.paths,!0):this.selectors&&(this.selectors=a.visitArray(this.selectors)),this.rules&&this.rules.length&&(this.rules=a.visitArray(this.rules))},k.prototype.eval=function(a){var b,c,e,f,g=this.selectors,h=!1;if(g&&(c=g.length)){for(b=[],i.error({type:"Syntax",message:"it is currently only allowed in parametric mixin guards,"}),f=0;c>f;f++)e=g[f].eval(a),b.push(e),e.evaldCondition&&(h=!0);i.reset()}else h=!0;var j,l,m=this.rules?this.rules.slice(0):null,n=new k(b,m,this.strictImports);n.originalRuleset=this,n.root=this.root,n.firstRoot=this.firstRoot,n.allowImports=this.allowImports,this.debugInfo&&(n.debugInfo=this.debugInfo),h||(m.length=0);var o=a.frames;o.unshift(n);var p=a.selectors;p||(a.selectors=p=[]),p.unshift(this.selectors),(n.root||n.allowImports||!n.strictImports)&&n.evalImports(a);var q=n.rules,r=q?q.length:0;for(f=0;r>f;f++)q[f].evalFirst&&(q[f]=q[f].eval(a));var s=a.mediaBlocks&&a.mediaBlocks.length||0;for(f=0;r>f;f++)"MixinCall"===q[f].type?(m=q[f].eval(a).filter(function(a){return a instanceof d&&a.variable?!n.variable(a.name):!0}),q.splice.apply(q,[f,1].concat(m)),r+=m.length-1,f+=m.length-1,n.resetCache()):"RulesetCall"===q[f].type&&(m=q[f].eval(a).rules.filter(function(a){return a instanceof d&&a.variable?!1:!0}),q.splice.apply(q,[f,1].concat(m)),r+=m.length-1,f+=m.length-1,n.resetCache());for(f=0;q.length>f;f++)j=q[f],j.evalFirst||(q[f]=j=j.eval?j.eval(a):j);for(f=0;q.length>f;f++)if(j=q[f],j instanceof k&&j.selectors&&1===j.selectors.length&&j.selectors[0].isJustParentSelector()){q.splice(f--,1);for(var t=0;j.rules.length>t;t++)l=j.rules[t],l instanceof d&&l.variable||q.splice(++f,0,l)}if(o.shift(),p.shift(),a.mediaBlocks)for(f=s;a.mediaBlocks.length>f;f++)a.mediaBlocks[f].bubbleSelectors(b);return n},k.prototype.evalImports=function(a){var b,c,d=this.rules;if(d)for(b=0;d.length>b;b++)"Import"===d[b].type&&(c=d[b].eval(a),c&&c.length?(d.splice.apply(d,[b,1].concat(c)),b+=c.length-1):d.splice(b,1,c),this.resetCache())},k.prototype.makeImportant=function(){return this.rules=this.rules.map(function(a){return a.makeImportant?a.makeImportant():a}),this},k.prototype.matchArgs=function(a){return!a||0===a.length},k.prototype.matchCondition=function(a,b){var c=this.selectors[this.selectors.length-1];return c.evaldCondition?c.condition&&!c.condition.eval(new h.Eval(b,b.frames))?!1:!0:!1},k.prototype.resetCache=function(){this._rulesets=null,this._variables=null,this._lookups={}},k.prototype.variables=function(){return this._variables||(this._variables=this.rules?this.rules.reduce(function(a,b){if(b instanceof d&&b.variable===!0&&(a[b.name]=b),"Import"===b.type&&b.root&&b.root.variables){var c=b.root.variables();for(var e in c)c.hasOwnProperty(e)&&(a[e]=c[e])}return a},{}):{}),this._variables},k.prototype.variable=function(a){return this.variables()[a]},k.prototype.rulesets=function(){if(!this.rules)return null;var a,b,c=[],d=this.rules,e=d.length;for(a=0;e>a;a++)b=d[a],b.isRuleset&&c.push(b);return c},k.prototype.prependRule=function(a){var b=this.rules;b?b.unshift(a):this.rules=[a]},k.prototype.find=function(a,b,c){b=b||this;var d,f,g=[],h=a.toCSS();return h in this._lookups?this._lookups[h]:(this.rulesets().forEach(function(h){if(h!==b)for(var i=0;h.selectors.length>i;i++)if(d=a.match(h.selectors[i])){if(a.elements.length>d){if(!c||c(h)){f=h.find(new e(a.elements.slice(d)),b,c);for(var j=0;f.length>j;++j)f[j].path.push(h);Array.prototype.push.apply(g,f)}}else g.push({rule:h,path:[]});break}}),this._lookups[h]=g,g)},k.prototype.genCSS=function(a,b){function c(a,b){return"boolean"==typeof a.isRulesetLike?a.isRulesetLike:"function"==typeof a.isRulesetLike?a.isRulesetLike(b):!1}var d,e,f,g,h,i,k=[],l=[],m=[];a.tabLevel=a.tabLevel||0,this.root||a.tabLevel++;var n,o=a.compress?"":Array(a.tabLevel+1).join(" "),p=a.compress?"":Array(a.tabLevel).join(" ");for(d=0;this.rules.length>d;d++)h=this.rules[d],c(h,this.root)?m.push(h):h.isCharset&&h.isCharset()?k.push(h):l.push(h);if(l=k.concat(l),!this.root){g=j(a,this,p),g&&(b.add(g),b.add(p));var q,r=this.paths,s=r.length;for(n=a.compress?",":",\n"+p,d=0;s>d;d++)if(i=r[d],q=i.length)for(d>0&&b.add(n),a.firstSelector=!0,i[0].genCSS(a,b),a.firstSelector=!1,e=1;q>e;e++)i[e].genCSS(a,b);b.add((a.compress?"{":" {\n")+o)}for(d=0;l.length>d;d++)h=l[d],d+1!==l.length||this.root&&0!==m.length&&!this.firstRoot||(a.lastRule=!0),h.genCSS?h.genCSS(a,b):h.value&&b.add(h.value.toString()),a.lastRule?a.lastRule=!1:b.add(a.compress?"":"\n"+o);if(this.root||(b.add(a.compress?"}":"\n"+p+"}"),a.tabLevel--),n=(a.compress?"":"\n")+(this.root?o:p),f=m.length)for(l.length&&n&&b.add(n),m[0].genCSS(a,b),d=1;f>d;d++)n&&b.add(n),m[d].genCSS(a,b);b.isEmpty()||a.compress||!this.firstRoot||b.add("\n")},k.prototype.markReferenced=function(){var a;if(this.selectors)for(a=0;this.selectors.length>a;a++)this.selectors[a].markReferenced();if(this.rules)for(a=0;this.rules.length>a;a++)this.rules[a].markReferenced&&this.rules[a].markReferenced()},k.prototype.getIsReferenced=function(){var a,b,c,d;if(this.paths)for(a=0;this.paths.length>a;a++)for(c=this.paths[a],b=0;c.length>b;b++)if(c[b].getIsReferenced&&c[b].getIsReferenced())return!0;if(this.selectors)for(a=0;this.selectors.length>a;a++)if(d=this.selectors[a],d.getIsReferenced&&d.getIsReferenced())return!0;return!1},k.prototype.joinSelectors=function(a,b,c){for(var d=0;c.length>d;d++)this.joinSelector(a,b,c[d])},k.prototype.joinSelector=function(a,b,c){function d(a,b){var c,d;if(0===a.length)c=new g(a[0]);else{var h=[];for(d=0;a.length>d;d++)h.push(new f(null,a[d],b.index,b.currentFileInfo));c=new g(new e(h))}return c}function h(a,b){var c,d;return c=new f(null,a,b.index,b.currentFileInfo),d=new e([c])}function i(a,b,c){function e(a){var b;return"Paren"!==a.value.type?null:(b=a.value.value,"Selector"!==b.type?null:b)}var g,m,n,o,p,q,r,s,t=!1;for(o=[],p=[[]],g=0;c.elements.length>g;g++)if(s=c.elements[g],"&"!==s.value){var u=e(s);if(null!=u){l(o,p);var v,w=[],x=[];for(v=i(w,b,u),t=t||v,n=0;w.length>n;n++){var y=h(d(w[n],s),s);k(p,[y],s,c,x)}p=x,o=[]}else o.push(s)}else{for(t=!0,q=[],l(o,p),m=0;p.length>m;m++)if(r=p[m],0===b.length)r.length>0&&r[0].elements.push(new f(s.combinator,"",s.index,s.currentFileInfo)),q.push(r);else for(n=0;b.length>n;n++){var z=j(r,b[n],s,c);q.push(z)}p=q,o=[]}for(l(o,p),g=0;p.length>g;g++)p[g].length>0&&a.push(p[g]);return t}function j(a,b,c,d){var e,g,h;if(e=[],a.length>0?(e=a.slice(0),g=e.pop(),h=d.createDerived(g.elements.slice(0))):h=d.createDerived([]),b.length>0){var i=c.combinator,j=b[0].elements[0];i.emptyOrWhitespace&&!j.combinator.emptyOrWhitespace&&(i=j.combinator),h.elements.push(new f(i,j.value,c.index,c.currentFileInfo)),h.elements=h.elements.concat(b[0].elements.slice(1))}return 0!==h.elements.length&&e.push(h),b.length>1&&(e=e.concat(b.slice(1))),e}function k(a,b,c,d,e){var f;for(f=0;a.length>f;f++){var g=j(a[f],b,c,d);e.push(g)}return e}function l(a,b){var c,d;if(0!==a.length){if(0===b.length)return void b.push([new e(a)]);for(c=0;b.length>c;c++)d=b[c],d.length>0?d[d.length-1]=d[d.length-1].createDerived(d[d.length-1].elements.concat(a)):d.push(new e(a))}}var m,n,o;if(n=[],o=i(n,b,c),!o)if(b.length>0)for(n=[],m=0;b.length>m;m++)n.push(b[m].concat(c));else n=[[c]];for(m=0;n.length>m;m++)a.push(n[m])},b.exports=k},{"../contexts":10,"../functions/default":19,"./debug-info":51,"./element":55,"./node":67,"./paren":69,"./rule":71,"./selector":74}],74:[function(a,b){var c=a("./node"),d=function(a,b,c,d,e,f){this.elements=a,this.extendList=b,this.condition=c,this.currentFileInfo=e||{},this.isReferenced=f,c||(this.evaldCondition=!0)};d.prototype=new c,d.prototype.type="Selector",d.prototype.accept=function(a){this.elements&&(this.elements=a.visitArray(this.elements)),this.extendList&&(this.extendList=a.visitArray(this.extendList)),this.condition&&(this.condition=a.visit(this.condition))},d.prototype.createDerived=function(a,b,c){c=null!=c?c:this.evaldCondition;var e=new d(a,b||this.extendList,null,this.index,this.currentFileInfo,this.isReferenced);return e.evaldCondition=c,e.mediaEmpty=this.mediaEmpty,e},d.prototype.match=function(a){var b,c,d=this.elements,e=d.length;if(a.CacheElements(),b=a._elements.length,0===b||b>e)return 0;for(c=0;b>c;c++)if(d[c].value!==a._elements[c])return 0;return b},d.prototype.CacheElements=function(){if(!this._elements){var a=this.elements.map(function(a){return a.combinator.value+(a.value.value||a.value)}).join("").match(/[,&#\*\.\w-]([\w-]|(\\.))*/g);a?"&"===a[0]&&a.shift():a=[],this._elements=a}},d.prototype.isJustParentSelector=function(){return!this.mediaEmpty&&1===this.elements.length&&"&"===this.elements[0].value&&(" "===this.elements[0].combinator.value||""===this.elements[0].combinator.value)},d.prototype.eval=function(a){var b=this.condition&&this.condition.eval(a),c=this.elements,d=this.extendList;return c=c&&c.map(function(b){return b.eval(a)}),d=d&&d.map(function(b){return b.eval(a)}),this.createDerived(c,d,b)},d.prototype.genCSS=function(a,b){var c,d;if(a&&a.firstSelector||""!==this.elements[0].combinator.value||b.add(" ",this.currentFileInfo,this.index),!this._css)for(c=0;this.elements.length>c;c++)d=this.elements[c],d.genCSS(a,b)},d.prototype.markReferenced=function(){this.isReferenced=!0},d.prototype.getIsReferenced=function(){return!this.currentFileInfo.reference||this.isReferenced},d.prototype.getIsOutput=function(){return this.evaldCondition},b.exports=d},{"./node":67}],75:[function(a,b){var c=a("./node"),d=function(a){this.value=a};d.prototype=new c,d.prototype.type="UnicodeDescriptor",b.exports=d},{"./node":67}],76:[function(a,b){var c=a("./node"),d=a("../data/unit-conversions"),e=function(a,b,c){this.numerator=a?a.slice(0).sort():[],this.denominator=b?b.slice(0).sort():[],c?this.backupUnit=c:a&&a.length&&(this.backupUnit=a[0])};e.prototype=new c,e.prototype.type="Unit",e.prototype.clone=function(){return new e(this.numerator.slice(0),this.denominator.slice(0),this.backupUnit)},e.prototype.genCSS=function(a,b){var c=a&&a.strictUnits;1===this.numerator.length?b.add(this.numerator[0]):!c&&this.backupUnit&&b.add(this.backupUnit)},e.prototype.toString=function(){var a,b=this.numerator.join("*");for(a=0;this.denominator.length>a;a++)b+="/"+this.denominator[a];return b},e.prototype.compare=function(a){return this.is(a.toString())?0:void 0},e.prototype.is=function(a){return this.toString().toUpperCase()===a.toUpperCase()},e.prototype.isLength=function(){return Boolean(this.toCSS().match(/px|em|%|in|cm|mm|pc|pt|ex/))},e.prototype.isEmpty=function(){return 0===this.numerator.length&&0===this.denominator.length},e.prototype.isSingular=function(){return 1>=this.numerator.length&&0===this.denominator.length},e.prototype.map=function(a){var b;for(b=0;this.numerator.length>b;b++)this.numerator[b]=a(this.numerator[b],!1);for(b=0;this.denominator.length>b;b++)this.denominator[b]=a(this.denominator[b],!0)},e.prototype.usedUnits=function(){var a,b,c={};b=function(b){return a.hasOwnProperty(b)&&!c[e]&&(c[e]=b),b};for(var e in d)d.hasOwnProperty(e)&&(a=d[e],this.map(b));return c},e.prototype.cancel=function(){var a,b,c={};for(b=0;this.numerator.length>b;b++)a=this.numerator[b],c[a]=(c[a]||0)+1;for(b=0;this.denominator.length>b;b++)a=this.denominator[b],c[a]=(c[a]||0)-1;this.numerator=[],this.denominator=[];for(a in c)if(c.hasOwnProperty(a)){var d=c[a];if(d>0)for(b=0;d>b;b++)this.numerator.push(a);else if(0>d)for(b=0;-d>b;b++)this.denominator.push(a)}this.numerator.sort(),this.denominator.sort()},b.exports=e},{"../data/unit-conversions":13,"./node":67}],77:[function(a,b){var c=a("./node"),d=function(a,b,c,d){this.value=a,this.currentFileInfo=c,this.index=b,this.isEvald=d};d.prototype=new c,d.prototype.type="Url",d.prototype.accept=function(a){this.value=a.visit(this.value)},d.prototype.genCSS=function(a,b){b.add("url("),this.value.genCSS(a,b),b.add(")")},d.prototype.eval=function(a){var b,c=this.value.eval(a);if(!this.isEvald&&(b=this.currentFileInfo&&this.currentFileInfo.rootpath,b&&"string"==typeof c.value&&a.isPathRelative(c.value)&&(c.quote||(b=b.replace(/[\(\)'"\s]/g,function(a){return"\\"+a})),c.value=b+c.value),c.value=a.normalizePath(c.value),a.urlArgs&&!c.value.match(/^\s*data:/))){var e=-1===c.value.indexOf("?")?"?":"&",f=e+a.urlArgs;-1!==c.value.indexOf("#")?c.value=c.value.replace("#",f+"#"):c.value+=f}return new d(c,this.index,this.currentFileInfo,!0)},b.exports=d},{"./node":67}],78:[function(a,b){var c=a("./node"),d=function(a){if(this.value=a,!a)throw new Error("Value requires an array argument")};d.prototype=new c,d.prototype.type="Value",d.prototype.accept=function(a){this.value&&(this.value=a.visitArray(this.value))},d.prototype.eval=function(a){return 1===this.value.length?this.value[0].eval(a):new d(this.value.map(function(b){return b.eval(a)}))},d.prototype.genCSS=function(a,b){var c;for(c=0;this.value.length>c;c++)this.value[c].genCSS(a,b),this.value.length>c+1&&b.add(a&&a.compress?",":", ")},b.exports=d},{"./node":67}],79:[function(a,b){var c=a("./node"),d=function(a,b,c){this.name=a,this.index=b,this.currentFileInfo=c||{}};d.prototype=new c,d.prototype.type="Variable",d.prototype.eval=function(a){var b,c=this.name;if(0===c.indexOf("@@")&&(c="@"+new d(c.slice(1),this.index,this.currentFileInfo).eval(a).value),this.evaluating)throw{type:"Name",message:"Recursive variable definition for "+c,filename:this.currentFileInfo.filename,index:this.index};if(this.evaluating=!0,b=this.find(a.frames,function(b){var d=b.variable(c);if(d){if(d.important){var e=a.importantScope[a.importantScope.length-1];e.important=d.important}return d.value.eval(a)}}))return this.evaluating=!1,b;throw{type:"Name",message:"variable "+c+" is undefined",filename:this.currentFileInfo.filename,index:this.index}},d.prototype.find=function(a,b){for(var c,d=0;a.length>d;d++)if(c=b.call(a,a[d]))return c;return null},b.exports=d},{"./node":67}],80:[function(a,b){b.exports={getLocation:function(a,b){for(var c=a+1,d=null,e=-1;--c>=0&&"\n"!==b.charAt(c);)e++;return"number"==typeof a&&(d=(b.slice(0,a).match(/\n/g)||"").length),{line:d,column:e}}}},{}],81:[function(a,b){var c=a("../tree"),d=a("./visitor"),e=a("../logger"),f=function(){this._visitor=new d(this),this.contexts=[],this.allExtendsStack=[[]]};f.prototype={run:function(a){return a=this._visitor.visit(a),a.allExtends=this.allExtendsStack[0],a},visitRule:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitRuleset:function(a){if(!a.root){var b,d,e,f,g=[],h=a.rules,i=h?h.length:0;for(b=0;i>b;b++)a.rules[b]instanceof c.Extend&&(g.push(h[b]),a.extendOnEveryPath=!0);var j=a.paths;for(b=0;j.length>b;b++){var k=j[b],l=k[k.length-1],m=l.extendList;for(f=m?m.slice(0).concat(g):g,f&&(f=f.map(function(a){return a.clone()})),d=0;f.length>d;d++)this.foundExtends=!0,e=f[d],e.findSelfSelectors(k),e.ruleset=a,0===d&&(e.firstExtendOnThisSelectorPath=!0),this.allExtendsStack[this.allExtendsStack.length-1].push(e)}this.contexts.push(a.selectors)}},visitRulesetOut:function(a){a.root||(this.contexts.length=this.contexts.length-1)},visitMedia:function(a){a.allExtends=[],this.allExtendsStack.push(a.allExtends)},visitMediaOut:function(){this.allExtendsStack.length=this.allExtendsStack.length-1},visitDirective:function(a){a.allExtends=[],this.allExtendsStack.push(a.allExtends)},visitDirectiveOut:function(){this.allExtendsStack.length=this.allExtendsStack.length-1}};var g=function(){this._visitor=new d(this)};g.prototype={run:function(a){var b=new f;if(this.extendIndicies={},b.run(a),!b.foundExtends)return a;a.allExtends=a.allExtends.concat(this.doExtendChaining(a.allExtends,a.allExtends)),this.allExtendsStack=[a.allExtends];var c=this._visitor.visit(a);return this.checkExtendsForNonMatched(a.allExtends),c},checkExtendsForNonMatched:function(a){var b=this.extendIndicies;a.filter(function(a){return!a.hasFoundMatches&&1==a.parent_ids.length}).forEach(function(a){var c="_unknown_";try{c=a.selector.toCSS({})}catch(d){}b[a.index+" "+c]||(b[a.index+" "+c]=!0,e.warn("extend '"+c+"' has no matches"))})},doExtendChaining:function(a,b,d){var e,f,g,h,i,j,k,l,m=[],n=this;for(d=d||0,e=0;a.length>e;e++)for(f=0;b.length>f;f++)j=a[e],k=b[f],j.parent_ids.indexOf(k.object_id)>=0||(i=[k.selfSelectors[0]],g=n.findMatch(j,i),g.length&&(j.hasFoundMatches=!0,j.selfSelectors.forEach(function(a){h=n.extendSelector(g,i,a),l=new c.Extend(k.selector,k.option,0),l.selfSelectors=h,h[h.length-1].extendList=[l],m.push(l),l.ruleset=k.ruleset,l.parent_ids=l.parent_ids.concat(k.parent_ids,j.parent_ids),k.firstExtendOnThisSelectorPath&&(l.firstExtendOnThisSelectorPath=!0,k.ruleset.paths.push(h))})));if(m.length){if(this.extendChainCount++,d>100){var o="{unable to calculate}",p="{unable to calculate}";try{o=m[0].selfSelectors[0].toCSS(),p=m[0].selector.toCSS()}catch(q){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+o+":extend("+p+")"}}return m.concat(n.doExtendChaining(m,b,d+1))}return m},visitRule:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitSelector:function(a,b){b.visitDeeper=!1},visitRuleset:function(a){if(!a.root){var b,c,d,e,f=this.allExtendsStack[this.allExtendsStack.length-1],g=[],h=this;for(d=0;f.length>d;d++)for(c=0;a.paths.length>c;c++)if(e=a.paths[c],!a.extendOnEveryPath){var i=e[e.length-1].extendList;i&&i.length||(b=this.findMatch(f[d],e),b.length&&(f[d].hasFoundMatches=!0,f[d].selfSelectors.forEach(function(a){g.push(h.extendSelector(b,e,a))})))}a.paths=a.paths.concat(g)}},findMatch:function(a,b){var c,d,e,f,g,h,i,j=this,k=a.selector.elements,l=[],m=[];for(c=0;b.length>c;c++)for(d=b[c],e=0;d.elements.length>e;e++)for(f=d.elements[e],(a.allowBefore||0===c&&0===e)&&l.push({pathIndex:c,index:e,matched:0,initialCombinator:f.combinator}),h=0;l.length>h;h++)i=l[h],g=f.combinator.value,""===g&&0===e&&(g=" "),!j.isElementValuesEqual(k[i.matched].value,f.value)||i.matched>0&&k[i.matched].combinator.value!==g?i=null:i.matched++,i&&(i.finished=i.matched===k.length,i.finished&&!a.allowAfter&&(d.elements.length>e+1||b.length>c+1)&&(i=null)),i?i.finished&&(i.length=k.length,i.endPathIndex=c,i.endPathElementIndex=e+1,l.length=0,m.push(i)):(l.splice(h,1),h--);return m},isElementValuesEqual:function(a,b){if("string"==typeof a||"string"==typeof b)return a===b;if(a instanceof c.Attribute)return a.op!==b.op||a.key!==b.key?!1:a.value&&b.value?(a=a.value.value||a.value,b=b.value.value||b.value,a===b):a.value||b.value?!1:!0;if(a=a.value,b=b.value,a instanceof c.Selector){if(!(b instanceof c.Selector)||a.elements.length!==b.elements.length)return!1;for(var d=0;a.elements.length>d;d++){if(a.elements[d].combinator.value!==b.elements[d].combinator.value&&(0!==d||(a.elements[d].combinator.value||" ")!==(b.elements[d].combinator.value||" ")))return!1;if(!this.isElementValuesEqual(a.elements[d].value,b.elements[d].value))return!1}return!0}return!1},extendSelector:function(a,b,d){var e,f,g,h,i,j=0,k=0,l=[];for(e=0;a.length>e;e++)h=a[e],f=b[h.pathIndex],g=new c.Element(h.initialCombinator,d.elements[0].value,d.elements[0].index,d.elements[0].currentFileInfo),h.pathIndex>j&&k>0&&(l[l.length-1].elements=l[l.length-1].elements.concat(b[j].elements.slice(k)),k=0,j++),i=f.elements.slice(k,h.index).concat([g]).concat(d.elements.slice(1)),j===h.pathIndex&&e>0?l[l.length-1].elements=l[l.length-1].elements.concat(i):(l=l.concat(b.slice(j,h.pathIndex)),l.push(new c.Selector(i))),j=h.endPathIndex,k=h.endPathElementIndex,k>=b[j].elements.length&&(k=0,j++);return b.length>j&&k>0&&(l[l.length-1].elements=l[l.length-1].elements.concat(b[j].elements.slice(k)),j++),l=l.concat(b.slice(j,b.length))},visitRulesetOut:function(){},visitMedia:function(a){var b=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);b=b.concat(this.doExtendChaining(b,a.allExtends)),this.allExtendsStack.push(b)},visitMediaOut:function(){var a=this.allExtendsStack.length-1;this.checkExtendsForNonMatched(this.allExtendsStack[a]),this.allExtendsStack.length=a},visitDirective:function(a){var b=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);b=b.concat(this.doExtendChaining(b,a.allExtends)),this.allExtendsStack.push(b)},visitDirectiveOut:function(){var a=this.allExtendsStack.length-1;this.checkExtendsForNonMatched(this.allExtendsStack[a]),this.allExtendsStack.length=a}},b.exports=g},{"../logger":31,"../tree":59,"./visitor":87}],82:[function(a,b){function c(a){this.imports=[],this.variableImports=[],this._onSequencerEmpty=a,this._currentDepth=0}c.prototype.addImport=function(a){var b=this,c={callback:a,args:null,isReady:!1};return this.imports.push(c),function(){c.args=Array.prototype.slice.call(arguments,0),c.isReady=!0,b.tryRun()}},c.prototype.addVariableImport=function(a){this.variableImports.push(a)},c.prototype.tryRun=function(){this._currentDepth++;try{for(;;){for(;this.imports.length>0;){var a=this.imports[0];if(!a.isReady)return;this.imports=this.imports.slice(1),a.callback.apply(null,a.args)}if(0===this.variableImports.length)break;var b=this.variableImports[0];this.variableImports=this.variableImports.slice(1),b()}}finally{this._currentDepth--}0===this._currentDepth&&this._onSequencerEmpty&&this._onSequencerEmpty()},b.exports=c},{}],83:[function(a,b){var c=a("../contexts"),d=a("./visitor"),e=a("./import-sequencer"),f=function(a,b){this._visitor=new d(this),this._importer=a,this._finish=b,this.context=new c.Eval,this.importCount=0,this.onceFileDetectionMap={},this.recursionDetector={},this._sequencer=new e(this._onSequencerEmpty.bind(this))};f.prototype={isReplacing:!1,run:function(a){try{this._visitor.visit(a)}catch(b){this.error=b}this.isFinished=!0,this._sequencer.tryRun()},_onSequencerEmpty:function(){this.isFinished&&this._finish(this.error)},visitImport:function(a,b){var d=a.options.inline;if(!a.css||d){var e=new c.Eval(this.context,this.context.frames.slice(0)),f=e.frames[0];this.importCount++,a.isVariableImport()?this._sequencer.addVariableImport(this.processImportNode.bind(this,a,e,f)):this.processImportNode(a,e,f)}b.visitDeeper=!1},processImportNode:function(a,b,c){var d,e=a.options.inline;try{d=a.evalForImport(b)}catch(f){f.filename||(f.index=a.index,f.filename=a.currentFileInfo.filename),a.css=!0,a.error=f}if(!d||d.css&&!e)this.importCount--,this.isFinished&&this._sequencer.tryRun();else{d.options.multiple&&(b.importMultiple=!0);for(var g=void 0===d.css,h=0;c.rules.length>h;h++)if(c.rules[h]===a){c.rules[h]=d;break}var i=this.onImported.bind(this,d,b),j=this._sequencer.addImport(i);this._importer.push(d.getPath(),g,d.currentFileInfo,d.options,j)}},onImported:function(a,b,c,d,e,f){c&&(c.filename||(c.index=a.index,c.filename=a.currentFileInfo.filename),this.error=c);var g=this,h=a.options.inline,i=e||f in g.recursionDetector;if(b.importMultiple||(a.skip=i?!0:function(){return f in g.onceFileDetectionMap?!0:(g.onceFileDetectionMap[f]=!0,!1)}),d&&(a.root=d,a.importedFilename=f,!h&&(b.importMultiple||!i))){g.recursionDetector[f]=!0;var j=this.context;this.context=b;try{this._visitor.visit(d)}catch(c){this.error=c}this.context=j}g.importCount--,g.isFinished&&g._sequencer.tryRun()},visitRule:function(a,b){b.visitDeeper=!1},visitDirective:function(a){this.context.frames.unshift(a)},visitDirectiveOut:function(){this.context.frames.shift()},visitMixinDefinition:function(a){this.context.frames.unshift(a)},visitMixinDefinitionOut:function(){this.context.frames.shift()},visitRuleset:function(a){this.context.frames.unshift(a)},visitRulesetOut:function(){this.context.frames.shift()},visitMedia:function(a){this.context.frames.unshift(a.rules[0])},visitMediaOut:function(){this.context.frames.shift()}},b.exports=f},{"../contexts":10,"./import-sequencer":82,"./visitor":87}],84:[function(a,b){var c={Visitor:a("./visitor"),ImportVisitor:a("./import-visitor"),ExtendVisitor:a("./extend-visitor"),JoinSelectorVisitor:a("./join-selector-visitor"),ToCSSVisitor:a("./to-css-visitor")};b.exports=c},{"./extend-visitor":81,"./import-visitor":83,"./join-selector-visitor":85,"./to-css-visitor":86,"./visitor":87}],85:[function(a,b){var c=a("./visitor"),d=function(){this.contexts=[[]],this._visitor=new c(this)};d.prototype={run:function(a){return this._visitor.visit(a)},visitRule:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitRuleset:function(a){var b,c=this.contexts[this.contexts.length-1],d=[];this.contexts.push(d),a.root||(b=a.selectors,b&&(b=b.filter(function(a){return a.getIsOutput()}),a.selectors=b.length?b:b=null,b&&a.joinSelectors(d,c,b)),b||(a.rules=null),a.paths=d)},visitRulesetOut:function(){this.contexts.length=this.contexts.length-1},visitMedia:function(a){var b=this.contexts[this.contexts.length-1];a.rules[0].root=0===b.length||b[0].multiMedia}},b.exports=d},{"./visitor":87}],86:[function(a,b){var c=a("../tree"),d=a("./visitor"),e=function(a){this._visitor=new d(this),this._context=a};e.prototype={isReplacing:!0,run:function(a){return this._visitor.visit(a)},visitRule:function(a){return a.variable?void 0:a},visitMixinDefinition:function(a){a.frames=[]},visitExtend:function(){},visitComment:function(a){return a.isSilent(this._context)?void 0:a},visitMedia:function(a,b){return a.accept(this._visitor),b.visitDeeper=!1,a.rules.length?a:void 0},visitDirective:function(a,b){if("@charset"===a.name){if(!a.getIsReferenced())return;if(this.charset){if(a.debugInfo){var d=new c.Comment("/* "+a.toCSS(this._context).replace(/\n/g,"")+" */\n");return d.debugInfo=a.debugInfo,this._visitor.visit(d)}return}this.charset=!0}if(a.rules&&a.rules.rules){if(this._mergeRules(a.rules.rules),a.accept(this._visitor),b.visitDeeper=!1,a.getIsReferenced())return a;if(!a.rules.rules)return;for(var e=0;a.rules.rules.length>e;e++){var f=a.rules.rules[e];if(f.getIsReferenced&&f.getIsReferenced())return a.markReferenced(),a}}else if(a.getIsReferenced())return a},checkPropertiesInRoot:function(a){for(var b,d=0;a.length>d;d++)if(b=a[d],b instanceof c.Rule&&!b.variable)throw{message:"properties must be inside selector blocks, they cannot be in the root.",index:b.index,filename:b.currentFileInfo?b.currentFileInfo.filename:null}},visitRuleset:function(a,b){var d,e=[];if(a.firstRoot&&this.checkPropertiesInRoot(a.rules),a.root)a.accept(this._visitor),b.visitDeeper=!1,(a.firstRoot||a.rules&&a.rules.length>0)&&e.splice(0,0,a);else{a.paths&&(a.paths=a.paths.filter(function(a){var b;for(" "===a[0].elements[0].combinator.value&&(a[0].elements[0].combinator=new c.Combinator("")),b=0;a.length>b;b++)if(a[b].getIsReferenced()&&a[b].getIsOutput())return!0;return!1}));for(var f=a.rules,g=f?f.length:0,h=0;g>h;)d=f[h],d&&d.rules?(e.push(this._visitor.visit(d)),f.splice(h,1),g--):h++;g>0?a.accept(this._visitor):a.rules=null,b.visitDeeper=!1,f=a.rules,f&&(this._mergeRules(f),f=a.rules),f&&(this._removeDuplicateRules(f),f=a.rules),f&&f.length>0&&a.paths.length>0&&e.splice(0,0,a)}return 1===e.length?e[0]:e},_removeDuplicateRules:function(a){if(a){var b,d,e,f={};for(e=a.length-1;e>=0;e--)if(d=a[e],d instanceof c.Rule)if(f[d.name]){b=f[d.name],b instanceof c.Rule&&(b=f[d.name]=[f[d.name].toCSS(this._context)]);var g=d.toCSS(this._context);-1!==b.indexOf(g)?a.splice(e,1):b.push(g)}else f[d.name]=d}},_mergeRules:function(a){if(a){for(var b,d,e,f={},g=0;a.length>g;g++)d=a[g],d instanceof c.Rule&&d.merge&&(e=[d.name,d.important?"!":""].join(","),f[e]?a.splice(g--,1):f[e]=[],f[e].push(d));Object.keys(f).map(function(a){function e(a){return new c.Expression(a.map(function(a){return a.value}))}function g(a){return new c.Value(a.map(function(a){return a}))}if(b=f[a],b.length>1){d=b[0];var h=[],i=[];b.map(function(a){"+"===a.merge&&(i.length>0&&h.push(e(i)),i=[]),i.push(a)}),h.push(e(i)),d.value=g(h)}})}}},b.exports=e},{"../tree":59,"./visitor":87}],87:[function(a,b){function c(a){return a}function d(a,b){var c,e;for(c in a)if(a.hasOwnProperty(c))switch(e=a[c],typeof e){case"function":e.prototype&&e.prototype.type&&(e.prototype.typeIndex=b++);break;case"object":b=d(e,b)}return b}var e=a("../tree"),f={visitDeeper:!0},g=!1,h=function(a){this._implementation=a,this._visitFnCache=[],g||(d(e,1),g=!0)};h.prototype={visit:function(a){if(!a)return a;var b=a.typeIndex;if(!b)return a;var d,e=this._visitFnCache,g=this._implementation,h=b<<1,i=1|h,j=e[h],k=e[i],l=f;if(l.visitDeeper=!0,j||(d="visit"+a.type,j=g[d]||c,k=g[d+"Out"]||c,e[h]=j,e[i]=k),j!==c){var m=j.call(g,a,l);g.isReplacing&&(a=m)}return l.visitDeeper&&a&&a.accept&&a.accept(this),k!=c&&k.call(g,a),a},visitArray:function(a,b){if(!a)return a;var c,d=a.length;if(b||!this._implementation.isReplacing){for(c=0;d>c;c++)this.visit(a[c]);return a}var e=[];for(c=0;d>c;c++){var f=this.visit(a[c]);void 0!==f&&(f.splice?f.length&&this.flatten(f,e):e.push(f))}return e},flatten:function(a,b){b||(b=[]);var c,d,e,f,g,h;for(d=0,c=a.length;c>d;d++)if(e=a[d],void 0!==e)if(e.splice)for(g=0,f=e.length;f>g;g++)h=e[g],void 0!==h&&(h.splice?h.length&&this.flatten(h,b):b.push(h));else b.push(e);return b}},b.exports=h},{"../tree":59}],88:[function(a,b){function c(){}var d=b.exports={};d.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.MutationObserver,c="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};var d=[];if(b){var e=document.createElement("div"),f=new MutationObserver(function(){var a=d.slice(); -d.length=0,a.forEach(function(a){a()})});return f.observe(e,{attributes:!0}),function(a){d.length||e.setAttribute("yes","no"),d.push(a)}}return c?(window.addEventListener("message",function(a){var b=a.source;if((b===window||null===b)&&"process-tick"===a.data&&(a.stopPropagation(),d.length>0)){var c=d.shift();c()}},!0),function(a){d.push(a),window.postMessage("process-tick","*")}):function(a){setTimeout(a,0)}}(),d.title="browser",d.browser=!0,d.env={},d.argv=[],d.on=c,d.addListener=c,d.once=c,d.off=c,d.removeListener=c,d.removeAllListeners=c,d.emit=c,d.binding=function(){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(){throw new Error("process.chdir is not supported")}},{}],89:[function(a,b){"use strict";function c(a){function b(a){return null===i?void k.push(a):void f(function(){var b=i?a.onFulfilled:a.onRejected;if(null===b)return void(i?a.resolve:a.reject)(j);var c;try{c=b(j)}catch(d){return void a.reject(d)}a.resolve(c)})}function c(a){try{if(a===l)throw new TypeError("A promise cannot be resolved with itself.");if(a&&("object"==typeof a||"function"==typeof a)){var b=a.then;if("function"==typeof b)return void e(b.bind(a),c,g)}i=!0,j=a,h()}catch(d){g(d)}}function g(a){i=!1,j=a,h()}function h(){for(var a=0,c=k.length;c>a;a++)b(k[a]);k=null}if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof a)throw new TypeError("not a function");var i=null,j=null,k=[],l=this;this.then=function(a,c){return new l.constructor(function(e,f){b(new d(a,c,e,f))})},e(a,c,g)}function d(a,b,c,d){this.onFulfilled="function"==typeof a?a:null,this.onRejected="function"==typeof b?b:null,this.resolve=c,this.reject=d}function e(a,b,c){var d=!1;try{a(function(a){d||(d=!0,b(a))},function(a){d||(d=!0,c(a))})}catch(e){if(d)return;d=!0,c(e)}}var f=a("asap");b.exports=c},{asap:91}],90:[function(a,b){"use strict";function c(a){this.then=function(b){return"function"!=typeof b?this:new d(function(c,d){e(function(){try{c(b(a))}catch(e){d(e)}})})}}var d=a("./core.js"),e=a("asap");b.exports=d,c.prototype=d.prototype;var f=new c(!0),g=new c(!1),h=new c(null),i=new c(void 0),j=new c(0),k=new c("");d.resolve=function(a){if(a instanceof d)return a;if(null===a)return h;if(void 0===a)return i;if(a===!0)return f;if(a===!1)return g;if(0===a)return j;if(""===a)return k;if("object"==typeof a||"function"==typeof a)try{var b=a.then;if("function"==typeof b)return new d(b.bind(a))}catch(e){return new d(function(a,b){b(e)})}return new c(a)},d.all=function(a){var b=Array.prototype.slice.call(a);return new d(function(a,c){function d(f,g){try{if(g&&("object"==typeof g||"function"==typeof g)){var h=g.then;if("function"==typeof h)return void h.call(g,function(a){d(f,a)},c)}b[f]=g,0===--e&&a(b)}catch(i){c(i)}}if(0===b.length)return a([]);for(var e=b.length,f=0;b.length>f;f++)d(f,b[f])})},d.reject=function(a){return new d(function(b,c){c(a)})},d.race=function(a){return new d(function(b,c){a.forEach(function(a){d.resolve(a).then(b,c)})})},d.prototype["catch"]=function(a){return this.then(null,a)}},{"./core.js":89,asap:91}],91:[function(a,b){(function(a){function c(){for(;e.next;){e=e.next;var a=e.task;e.task=void 0;var b=e.domain;b&&(e.domain=void 0,b.enter());try{a()}catch(d){if(i)throw b&&b.exit(),setTimeout(c,0),b&&b.enter(),d;setTimeout(function(){throw d},0)}b&&b.exit()}g=!1}function d(b){f=f.next={task:b,domain:i&&a.domain,next:null},g||(g=!0,h())}var e={task:void 0,next:null},f=e,g=!1,h=void 0,i=!1;if("undefined"!=typeof a&&a.nextTick)i=!0,h=function(){a.nextTick(c)};else if("function"==typeof setImmediate)h="undefined"!=typeof window?setImmediate.bind(window,c):function(){setImmediate(c)};else if("undefined"!=typeof MessageChannel){var j=new MessageChannel;j.port1.onmessage=c,h=function(){j.port2.postMessage(0)}}else h=function(){setTimeout(c,0)};b.exports=d}).call(this,a("_process"))},{_process:88}],92:[function(){"function"!=typeof Promise.prototype.done&&(Promise.prototype.done=function(){var a=arguments.length?this.then.apply(this,arguments):this;a.then(null,function(a){setTimeout(function(){throw a},0)})})},{}],"promise/polyfill.js":[function(a){a("asap");"undefined"==typeof Promise&&(Promise=a("./lib/core.js"),a("./lib/es6-extensions.js")),a("./polyfill-done.js")},{"./lib/core.js":89,"./lib/es6-extensions.js":90,"./polyfill-done.js":92,asap:91}]},{},[2])(2)}); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).less=t()}(this,(function(){"use strict";function e(e){return e.replace(/^[a-z-]+:\/+?[^\/]+/,"").replace(/[\?\&]livereload=\w+/,"").replace(/^\//,"").replace(/\.[a-zA-Z]+$/,"").replace(/[^\.\w-]+/g,"-").replace(/\./g,":")}function t(e,t){for(var i in t.dataset)if(t.dataset.hasOwnProperty(i))if("env"===i||"dumpLineNumbers"===i||"rootpath"===i||"errorReporting"===i)e[i]=t.dataset[i];else try{e[i]=JSON.parse(t.dataset[i])}catch(e){}}var i=function(t,i,n){var r=n.href||"",s="less:"+(n.title||e(r)),o=t.getElementById(s),a=!1,l=t.createElement("style");l.setAttribute("type","text/css"),n.media&&l.setAttribute("media",n.media),l.id=s,l.styleSheet||(l.appendChild(t.createTextNode(i)),a=null!==o&&o.childNodes.length>0&&l.childNodes.length>0&&o.firstChild.nodeValue===l.firstChild.nodeValue);var u=t.getElementsByTagName("head")[0];if(null===o||!1===a){var h=n&&n.nextSibling||null;h?h.parentNode.insertBefore(l,h):u.appendChild(l)}if(o&&!1===a&&o.parentNode.removeChild(o),l.styleSheet)try{l.styleSheet.cssText=i}catch(e){throw new Error("Couldn't reassign styleSheet.cssText.")}},n=function(e){var t,i=e.document;return i.currentScript||(t=i.getElementsByTagName("script"))[t.length-1]},r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};function s(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}function o(){for(var e=0,t=0,i=arguments.length;t<i;t++)e+=arguments[t].length;var n=Array(e),r=0;for(t=0;t<i;t++)for(var s=arguments[t],o=0,a=s.length;o<a;o++,r++)n[r]=s[o];return n}var a={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgrey:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},l={length:{m:1,cm:.01,mm:.001,in:.0254,px:.0254/96,pt:.0254/72,pc:.0254/72*12},duration:{s:1,ms:.001},angle:{rad:1/(2*Math.PI),deg:1/360,grad:1/400,turn:1}},u={colors:a,unitConversions:l},h=function(){function e(){this.parent=null,this.visibilityBlocks=void 0,this.nodeVisible=void 0,this.rootNode=null,this.parsed=null;var e=this;Object.defineProperty(this,"currentFileInfo",{get:function(){return e.fileInfo()}}),Object.defineProperty(this,"index",{get:function(){return e.getIndex()}})}return e.prototype.setParent=function(t,i){function n(t){t&&t instanceof e&&(t.parent=i)}Array.isArray(t)?t.forEach(n):n(t)},e.prototype.getIndex=function(){return this._index||this.parent&&this.parent.getIndex()||0},e.prototype.fileInfo=function(){return this._fileInfo||this.parent&&this.parent.fileInfo()||{}},e.prototype.isRulesetLike=function(){return!1},e.prototype.toCSS=function(e){var t=[];return this.genCSS(e,{add:function(e,i,n){t.push(e)},isEmpty:function(){return 0===t.length}}),t.join("")},e.prototype.genCSS=function(e,t){t.add(this.value)},e.prototype.accept=function(e){this.value=e.visit(this.value)},e.prototype.eval=function(){return this},e.prototype._operate=function(e,t,i,n){switch(t){case"+":return i+n;case"-":return i-n;case"*":return i*n;case"/":return i/n}},e.prototype.fround=function(e,t){var i=e&&e.numPrecision;return i?Number((t+2e-16).toFixed(i)):t},e.prototype.blocksVisibility=function(){return null==this.visibilityBlocks&&(this.visibilityBlocks=0),0!==this.visibilityBlocks},e.prototype.addVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks+1},e.prototype.removeVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks-1},e.prototype.ensureVisibility=function(){this.nodeVisible=!0},e.prototype.ensureInvisibility=function(){this.nodeVisible=!1},e.prototype.isVisible=function(){return this.nodeVisible},e.prototype.visibilityInfo=function(){return{visibilityBlocks:this.visibilityBlocks,nodeVisible:this.nodeVisible}},e.prototype.copyVisibilityInfo=function(e){e&&(this.visibilityBlocks=e.visibilityBlocks,this.nodeVisible=e.nodeVisible)},e}();h.compare=function(e,t){if(e.compare&&"Quoted"!==t.type&&"Anonymous"!==t.type)return e.compare(t);if(t.compare)return-t.compare(e);if(e.type===t.type){if(e=e.value,t=t.value,!Array.isArray(e))return e===t?0:void 0;if(e.length===t.length){for(var i=0;i<e.length;i++)if(0!==h.compare(e[i],t[i]))return;return 0}}},h.numericCompare=function(e,t){return e<t?-1:e===t?0:e>t?1:void 0};var c=function(e,t,i){var n=this;Array.isArray(e)?this.rgb=e:e.length>=6?(this.rgb=[],e.match(/.{2}/g).map((function(e,t){t<3?n.rgb.push(parseInt(e,16)):n.alpha=parseInt(e,16)/255}))):(this.rgb=[],e.split("").map((function(e,t){t<3?n.rgb.push(parseInt(e+e,16)):n.alpha=parseInt(e+e,16)/255}))),this.alpha=this.alpha||("number"==typeof t?t:1),void 0!==i&&(this.value=i)};function f(e,t){return Math.min(Math.max(e,0),t)}function p(e){return"#"+e.map((function(e){return((e=f(Math.round(e),255))<16?"0":"")+e.toString(16)})).join("")}(c.prototype=new h).luma=function(){var e=this.rgb[0]/255,t=this.rgb[1]/255,i=this.rgb[2]/255;return.2126*(e=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.7152*(t=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.0722*(i=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4))},c.prototype.genCSS=function(e,t){t.add(this.toCSS(e))},c.prototype.toCSS=function(e,t){var i,n,r,s=e&&e.compress&&!t,o=[];if(n=this.fround(e,this.alpha),this.value)if(0===this.value.indexOf("rgb"))n<1&&(r="rgba");else{if(0!==this.value.indexOf("hsl"))return this.value;r=n<1?"hsla":"hsl"}else n<1&&(r="rgba");switch(r){case"rgba":o=this.rgb.map((function(e){return f(Math.round(e),255)})).concat(f(n,1));break;case"hsla":o.push(f(n,1));case"hsl":i=this.toHSL(),o=[this.fround(e,i.h),this.fround(e,100*i.s)+"%",this.fround(e,100*i.l)+"%"].concat(o)}if(r)return r+"("+o.join(","+(s?"":" "))+")";if(i=this.toRGB(),s){var a=i.split("");a[1]===a[2]&&a[3]===a[4]&&a[5]===a[6]&&(i="#"+a[1]+a[3]+a[5])}return i},c.prototype.operate=function(e,t,i){for(var n=new Array(3),r=this.alpha*(1-i.alpha)+i.alpha,s=0;s<3;s++)n[s]=this._operate(e,t,this.rgb[s],i.rgb[s]);return new c(n,r)},c.prototype.toRGB=function(){return p(this.rgb)},c.prototype.toHSL=function(){var e,t,i=this.rgb[0]/255,n=this.rgb[1]/255,r=this.rgb[2]/255,s=this.alpha,o=Math.max(i,n,r),a=Math.min(i,n,r),l=(o+a)/2,u=o-a;if(o===a)e=t=0;else{switch(t=l>.5?u/(2-o-a):u/(o+a),o){case i:e=(n-r)/u+(n<r?6:0);break;case n:e=(r-i)/u+2;break;case r:e=(i-n)/u+4}e/=6}return{h:360*e,s:t,l:l,a:s}},c.prototype.toHSV=function(){var e,t,i=this.rgb[0]/255,n=this.rgb[1]/255,r=this.rgb[2]/255,s=this.alpha,o=Math.max(i,n,r),a=Math.min(i,n,r),l=o,u=o-a;if(t=0===o?0:u/o,o===a)e=0;else{switch(o){case i:e=(n-r)/u+(n<r?6:0);break;case n:e=(r-i)/u+2;break;case r:e=(i-n)/u+4}e/=6}return{h:360*e,s:t,v:l,a:s}},c.prototype.toARGB=function(){return p([255*this.alpha].concat(this.rgb))},c.prototype.compare=function(e){return e.rgb&&e.rgb[0]===this.rgb[0]&&e.rgb[1]===this.rgb[1]&&e.rgb[2]===this.rgb[2]&&e.alpha===this.alpha?0:void 0},c.prototype.type="Color",c.fromKeyword=function(e){var t,i=e.toLowerCase();if(a.hasOwnProperty(i)?t=new c(a[i].slice(1)):"transparent"===i&&(t=new c([0,0,0],0)),t)return t.value=e,t};var d=function(e){this.value=e};(d.prototype=new h).genCSS=function(e,t){t.add("("),this.value.genCSS(e,t),t.add(")")},d.prototype.eval=function(e){return new d(this.value.eval(e))},d.prototype.type="Paren";var v={"":!0," ":!0,"|":!0},m=function(e){" "===e?(this.value=" ",this.emptyOrWhitespace=!0):(this.value=e?e.trim():"",this.emptyOrWhitespace=""===this.value)};(m.prototype=new h).genCSS=function(e,t){var i=e.compress||v[this.value]?"":" ";t.add(i+this.value+i)},m.prototype.type="Combinator";var g=function(e,t,i,n,r,s){this.combinator=e instanceof m?e:new m(e),this.value="string"==typeof t?t.trim():t||"",this.isVariable=i,this._index=n,this._fileInfo=r,this.copyVisibilityInfo(s),this.setParent(this.combinator,this)};(g.prototype=new h).accept=function(e){var t=this.value;this.combinator=e.visit(this.combinator),"object"==typeof t&&(this.value=e.visit(t))},g.prototype.eval=function(e){return new g(this.combinator,this.value.eval?this.value.eval(e):this.value,this.isVariable,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.clone=function(){return new g(this.combinator,this.value,this.isVariable,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.genCSS=function(e,t){t.add(this.toCSS(e),this.fileInfo(),this.getIndex())},g.prototype.toCSS=function(e){void 0===e&&(e={});var t=this.value,i=e.firstSelector;return t instanceof d&&(e.firstSelector=!0),t=t.toCSS?t.toCSS(e):t,e.firstSelector=i,""===t&&"&"===this.combinator.value.charAt(0)?"":this.combinator.toCSS(e)+t},g.prototype.type="Element";var y={ALWAYS:0,PARENS_DIVISION:1,PARENS:2,STRICT_LEGACY:3},b=0,w=1,x=2;function S(e){return Object.prototype.toString.call(e).slice(8,-1)}function I(e){return"Array"===S(e)}function C(e,t){return void 0===t&&(t={}),I(e)?e.map((function(e){return C(e,t)})):"Object"!==S(i=e)||i.constructor!==Object||Object.getPrototypeOf(i)!==Object.prototype?e:function(){for(var e=0,t=0,i=arguments.length;t<i;t++)e+=arguments[t].length;var n=Array(e),r=0;for(t=0;t<i;t++)for(var s=arguments[t],o=0,a=s.length;o<a;o++,r++)n[r]=s[o];return n}(Object.getOwnPropertyNames(e),Object.getOwnPropertySymbols(e)).reduce((function(i,n){return I(t.props)&&!t.props.includes(n)||function(e,t,i,n,r){var s={}.propertyIsEnumerable.call(n,t)?"enumerable":"nonenumerable";"enumerable"===s&&(e[t]=i),r&&"nonenumerable"===s&&Object.defineProperty(e,t,{value:i,enumerable:!1,writable:!0,configurable:!0})}(i,n,C(e[n],t),e,t.nonenumerable),i}),{});var i}function k(e,t){for(var i=e+1,n=null,r=-1;--i>=0&&"\n"!==t.charAt(i);)r++;return"number"==typeof e&&(n=(t.slice(0,e).match(/\n/g)||"").length),{line:n,column:r}}function _(e){var t,i=e.length,n=new Array(i);for(t=0;t<i;t++)n[t]=e[t];return n}function A(e){var t={};for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t}function M(e,t){var i=t||{};if(!t._defaults){i={};var n=C(e);i._defaults=n;var r=t?C(t):{};Object.assign(i,n,r)}return i}function P(e,t){if(t&&t._defaults)return t;var i=M(e,t);if(i.strictMath&&(i.math=y.STRICT_LEGACY),i.relativeUrls&&(i.rewriteUrls=x),"string"==typeof i.math)switch(i.math.toLowerCase()){case"always":i.math=y.ALWAYS;break;case"parens-division":i.math=y.PARENS_DIVISION;break;case"strict":case"parens":i.math=y.PARENS;break;case"strict-legacy":i.math=y.STRICT_LEGACY}if("string"==typeof i.rewriteUrls)switch(i.rewriteUrls.toLowerCase()){case"off":i.rewriteUrls=b;break;case"local":i.rewriteUrls=w;break;case"all":i.rewriteUrls=x}return i}function E(e,t){void 0===t&&(t=[]);for(var i=0,n=e.length;i<n;i++){var r=e[i];Array.isArray(r)?E(r,t):void 0!==r&&t.push(r)}return t}var R=Object.freeze({__proto__:null,getLocation:k,copyArray:_,clone:A,defaults:M,copyOptions:P,merge:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e},flattenArray:E}),V=/(<anonymous>|Function):(\d+):(\d+)/,F=function(e,t,i){Error.call(this);var n=e.filename||i;if(this.message=e.message,this.stack=e.stack,t&&n){var r=t.contents[n],s=k(e.index,r),o=s.line,a=s.column,l=e.call&&k(e.call,r).line,u=r?r.split("\n"):"";if(this.type=e.type||"Syntax",this.filename=n,this.index=e.index,this.line="number"==typeof o?o+1:null,this.column=a,!this.line&&this.stack){var h=this.stack.match(V),c=new Function("a","throw new Error()"),f=0;try{c()}catch(e){var p=e.stack.match(V);f=1-parseInt(p[2])}h&&(h[2]&&(this.line=parseInt(h[2])+f),h[3]&&(this.column=parseInt(h[3])))}this.callLine=l+1,this.callExtract=u[l],this.extract=[u[this.line-2],u[this.line-1],u[this.line]]}};if(void 0===Object.create){var $=function(){};$.prototype=Error.prototype,F.prototype=new $}else F.prototype=Object.create(Error.prototype);F.prototype.constructor=F,F.prototype.toString=function(e){void 0===e&&(e={});var t="",i=this.extract||[],n=[],r=function(e){return e};if(e.stylize){var s=typeof e.stylize;if("function"!==s)throw Error("options.stylize should be a function, got a "+s+"!");r=e.stylize}if(null!==this.line){if("string"==typeof i[0]&&n.push(r(this.line-1+" "+i[0],"grey")),"string"==typeof i[1]){var o=this.line+" ";i[1]&&(o+=i[1].slice(0,this.column)+r(r(r(i[1].substr(this.column,1),"bold")+i[1].slice(this.column+1),"red"),"inverse")),n.push(o)}"string"==typeof i[2]&&n.push(r(this.line+1+" "+i[2],"grey")),n=n.join("\n")+r("","reset")+"\n"}return t+=r(this.type+"Error: "+this.message,"red"),this.filename&&(t+=r(" in ","red")+this.filename),this.line&&(t+=r(" on line "+this.line+", column "+(this.column+1)+":","grey")),t+="\n"+n,this.callLine&&(t+=r("from ","red")+(this.filename||"")+"/n",t+=r(this.callLine,"grey")+" "+this.callExtract+"/n"),t};var O=function(e,t,i,n,r,s){this.extendList=t,this.condition=i,this.evaldCondition=!i,this._index=n,this._fileInfo=r,this.elements=this.getElements(e),this.mixinElements_=void 0,this.copyVisibilityInfo(s),this.setParent(this.elements,this)};(O.prototype=new h).accept=function(e){this.elements&&(this.elements=e.visitArray(this.elements)),this.extendList&&(this.extendList=e.visitArray(this.extendList)),this.condition&&(this.condition=e.visit(this.condition))},O.prototype.createDerived=function(e,t,i){e=this.getElements(e);var n=new O(e,t||this.extendList,null,this.getIndex(),this.fileInfo(),this.visibilityInfo());return n.evaldCondition=null!=i?i:this.evaldCondition,n.mediaEmpty=this.mediaEmpty,n},O.prototype.getElements=function(e){return e?("string"==typeof e&&this.parse.parseNode(e,["selector"],this._index,this._fileInfo,(function(t,i){if(t)throw new F({index:t.index,message:t.message},this.parse.imports,this._fileInfo.filename);e=i[0].elements})),e):[new g("","&",!1,this._index,this._fileInfo)]},O.prototype.createEmptySelectors=function(){var e=new g("","&",!1,this._index,this._fileInfo),t=[new O([e],null,null,this._index,this._fileInfo)];return t[0].mediaEmpty=!0,t},O.prototype.match=function(e){var t,i,n=this.elements,r=n.length;if(0===(t=(e=e.mixinElements()).length)||r<t)return 0;for(i=0;i<t;i++)if(n[i].value!==e[i])return 0;return t},O.prototype.mixinElements=function(){if(this.mixinElements_)return this.mixinElements_;var e=this.elements.map((function(e){return e.combinator.value+(e.value.value||e.value)})).join("").match(/[,&#\*\.\w-]([\w-]|(\\.))*/g);return e?"&"===e[0]&&e.shift():e=[],this.mixinElements_=e},O.prototype.isJustParentSelector=function(){return!this.mediaEmpty&&1===this.elements.length&&"&"===this.elements[0].value&&(" "===this.elements[0].combinator.value||""===this.elements[0].combinator.value)},O.prototype.eval=function(e){var t=this.condition&&this.condition.eval(e),i=this.elements,n=this.extendList;return i=i&&i.map((function(t){return t.eval(e)})),n=n&&n.map((function(t){return t.eval(e)})),this.createDerived(i,n,t)},O.prototype.genCSS=function(e,t){var i;for(e&&e.firstSelector||""!==this.elements[0].combinator.value||t.add(" ",this.fileInfo(),this.getIndex()),i=0;i<this.elements.length;i++)this.elements[i].genCSS(e,t)},O.prototype.getIsOutput=function(){return this.evaldCondition},O.prototype.type="Selector";var L=function(e){if(!e)throw new Error("Value requires an array argument");Array.isArray(e)?this.value=e:this.value=[e]};(L.prototype=new h).accept=function(e){this.value&&(this.value=e.visitArray(this.value))},L.prototype.eval=function(e){return 1===this.value.length?this.value[0].eval(e):new L(this.value.map((function(t){return t.eval(e)})))},L.prototype.genCSS=function(e,t){var i;for(i=0;i<this.value.length;i++)this.value[i].genCSS(e,t),i+1<this.value.length&&t.add(e&&e.compress?",":", ")},L.prototype.type="Value";var N=function(e){this.value=e};(N.prototype=new h).genCSS=function(e,t){if("%"===this.value)throw{type:"Syntax",message:"Invalid % without number"};t.add(this.value)},N.prototype.type="Keyword",N.True=new N("true"),N.False=new N("false");var D=function(e,t,i,n,r,s){this.value=e,this._index=t,this._fileInfo=i,this.mapLines=n,this.rulesetLike=void 0!==r&&r,this.allowRoot=!0,this.copyVisibilityInfo(s)};(D.prototype=new h).eval=function(){return new D(this.value,this._index,this._fileInfo,this.mapLines,this.rulesetLike,this.visibilityInfo())},D.prototype.compare=function(e){return e.toCSS&&this.toCSS()===e.toCSS()?0:void 0},D.prototype.isRulesetLike=function(){return this.rulesetLike},D.prototype.genCSS=function(e,t){this.nodeVisible=Boolean(this.value),this.nodeVisible&&t.add(this.value,this._fileInfo,this._index,this.mapLines)},D.prototype.type="Anonymous";var B=y,U=function(e,t,i,n,r,s,o,a){this.name=e,this.value=t instanceof h?t:new L([t?new D(t):null]),this.important=i?" "+i.trim():"",this.merge=n,this._index=r,this._fileInfo=s,this.inline=o||!1,this.variable=void 0!==a?a:e.charAt&&"@"===e.charAt(0),this.allowRoot=!0,this.setParent(this.value,this)};(U.prototype=new h).genCSS=function(e,t){t.add(this.name+(e.compress?":":": "),this.fileInfo(),this.getIndex());try{this.value.genCSS(e,t)}catch(e){throw e.index=this._index,e.filename=this._fileInfo.filename,e}t.add(this.important+(this.inline||e.lastRule&&e.compress?"":";"),this._fileInfo,this._index)},U.prototype.eval=function(e){var t,i,n=!1,r=this.name,s=this.variable;"string"!=typeof r&&(r=1===r.length&&r[0]instanceof N?r[0].value:function(e,t){var i,n="",r=t.length,s={add:function(e){n+=e}};for(i=0;i<r;i++)t[i].eval(e).genCSS(e,s);return n}(e,r),s=!1),"font"===r&&e.math===B.ALWAYS&&(n=!0,t=e.math,e.math=B.PARENS_DIVISION);try{if(e.importantScope.push({}),i=this.value.eval(e),!this.variable&&"DetachedRuleset"===i.type)throw{message:"Rulesets cannot be evaluated on a property.",index:this.getIndex(),filename:this.fileInfo().filename};var o=this.important,a=e.importantScope.pop();return!o&&a.important&&(o=a.important),new U(r,i,o,this.merge,this.getIndex(),this.fileInfo(),this.inline,s)}catch(e){throw"number"!=typeof e.index&&(e.index=this.getIndex(),e.filename=this.fileInfo().filename),e}finally{n&&(e.math=t)}},U.prototype.makeImportant=function(){return new U(this.name,this.value,"!important",this.merge,this.getIndex(),this.fileInfo(),this.inline)},U.prototype.type="Declaration";var j=function(e,t,i){var n="";if(e.dumpLineNumbers&&!e.compress)switch(e.dumpLineNumbers){case"comments":n=j.asComment(t);break;case"mediaquery":n=j.asMediaQuery(t);break;case"all":n=j.asComment(t)+(i||"")+j.asMediaQuery(t)}return n};j.asComment=function(e){return e.debugInfo?"/* line "+e.debugInfo.lineNumber+", "+e.debugInfo.fileName+" */\n":""},j.asMediaQuery=function(e){if(!e.debugInfo)return"";var t=e.debugInfo.fileName;return/^[a-z]+:\/\//i.test(t)||(t="file://"+t),"@media -sass-debug-info{filename{font-family:"+t.replace(/([.:\/\\])/g,(function(e){return"\\"==e&&(e="/"),"\\"+e}))+"}line{font-family:\\00003"+e.debugInfo.lineNumber+"}}\n"};var q=function(e,t,i,n){this.value=e,this.isLineComment=t,this._index=i,this._fileInfo=n,this.allowRoot=!0};(q.prototype=new h).genCSS=function(e,t){this.debugInfo&&t.add(j(e,this),this.fileInfo(),this.getIndex()),t.add(this.value)},q.prototype.isSilent=function(e){var t=e.compress&&"!"!==this.value[2];return this.isLineComment||t},q.prototype.type="Comment";var T={},z=function(e,t,i){if(e)for(var n=0;n<i.length;n++)e.hasOwnProperty(i[n])&&(t[i[n]]=e[i[n]])},G=["paths","rewriteUrls","rootpath","strictImports","insecure","dumpLineNumbers","compress","syncImport","chunkInput","mime","useFileCache","processImports","pluginManager"];T.Parse=function(e){z(e,this,G),"string"==typeof this.paths&&(this.paths=[this.paths])};var W=["paths","compress","math","strictUnits","sourceMap","importMultiple","urlArgs","javascriptEnabled","pluginManager","importantScope","rewriteUrls"];function J(e){return!/^(?:[a-z-]+:|\/|#)/i.test(e)}function H(e){return"."===e.charAt(0)}T.Eval=function(){function e(e,t){z(e,this,W),"string"==typeof this.paths&&(this.paths=[this.paths]),this.frames=t||[],this.importantScope=this.importantScope||[],this.inCalc=!1,this.mathOn=!0}return e.prototype.enterCalc=function(){this.calcStack||(this.calcStack=[]),this.calcStack.push(!0),this.inCalc=!0},e.prototype.exitCalc=function(){this.calcStack.pop(),this.calcStack.length||(this.inCalc=!1)},e.prototype.inParenthesis=function(){this.parensStack||(this.parensStack=[]),this.parensStack.push(!0)},e.prototype.outOfParenthesis=function(){this.parensStack.pop()},e.prototype.isMathOn=function(e){return!!this.mathOn&&(!!("/"!==e||this.math===y.ALWAYS||this.parensStack&&this.parensStack.length)&&(!(this.math>y.PARENS_DIVISION)||this.parensStack&&this.parensStack.length))},e.prototype.pathRequiresRewrite=function(e){return(this.rewriteUrls===w?H:J)(e)},e.prototype.rewritePath=function(e,t){var i;return t=t||"",i=this.normalizePath(t+e),H(e)&&J(t)&&!1===H(i)&&(i="./"+i),i},e.prototype.normalizePath=function(e){var t,i=e.split("/").reverse();for(e=[];0!==i.length;)switch(t=i.pop()){case".":break;case"..":0===e.length||".."===e[e.length-1]?e.push(t):e.pop();break;default:e.push(t)}return e.join("/")},e}();var Q=function e(t){return{_data:{},add:function(e,t){e=e.toLowerCase(),this._data.hasOwnProperty(e),this._data[e]=t},addMultiple:function(e){var t=this;Object.keys(e).forEach((function(i){t.add(i,e[i])}))},get:function(e){return this._data[e]||t&&t.get(e)},getLocalFunctions:function(){return this._data},inherit:function(){return e(this)},create:function(t){return e(t)}}}(null),K={eval:function(){var e=this.value_,t=this.error_;if(t)throw t;if(null!=e)return e?N.True:N.False},value:function(e){this.value_=e},error:function(e){this.error_=e},reset:function(){this.value_=this.error_=null}},Z=function(e,t,i,n){this.selectors=e,this.rules=t,this._lookups={},this._variables=null,this._properties=null,this.strictImports=i,this.copyVisibilityInfo(n),this.allowRoot=!0,this.setParent(this.selectors,this),this.setParent(this.rules,this)};(Z.prototype=new h).isRulesetLike=function(){return!0},Z.prototype.accept=function(e){this.paths?this.paths=e.visitArray(this.paths,!0):this.selectors&&(this.selectors=e.visitArray(this.selectors)),this.rules&&this.rules.length&&(this.rules=e.visitArray(this.rules))},Z.prototype.eval=function(e){var t,i,n,r,s,o=!1;if(this.selectors&&(i=this.selectors.length)){for(t=new Array(i),K.error({type:"Syntax",message:"it is currently only allowed in parametric mixin guards,"}),r=0;r<i;r++){n=this.selectors[r].eval(e);for(var a=0;a<n.elements.length;a++)if(n.elements[a].isVariable){s=!0;break}t[r]=n,n.evaldCondition&&(o=!0)}if(s){var l=new Array(i);for(r=0;r<i;r++)n=t[r],l[r]=n.toCSS(e);this.parse.parseNode(l.join(","),["selectors"],t[0].getIndex(),t[0].fileInfo(),(function(e,i){i&&(t=E(i))}))}K.reset()}else o=!0;var u,c,f=this.rules?_(this.rules):null,p=new Z(t,f,this.strictImports,this.visibilityInfo());p.originalRuleset=this,p.root=this.root,p.firstRoot=this.firstRoot,p.allowImports=this.allowImports,this.debugInfo&&(p.debugInfo=this.debugInfo),o||(f.length=0),p.functionRegistry=function(e){for(var t,i=0,n=e.length;i!==n;++i)if(t=e[i].functionRegistry)return t;return Q}(e.frames).inherit();var d=e.frames;d.unshift(p);var v=e.selectors;v||(e.selectors=v=[]),v.unshift(this.selectors),(p.root||p.allowImports||!p.strictImports)&&p.evalImports(e);var m=p.rules;for(r=0;u=m[r];r++)u.evalFirst&&(m[r]=u.eval(e));var g=e.mediaBlocks&&e.mediaBlocks.length||0;for(r=0;u=m[r];r++)"MixinCall"===u.type?(f=u.eval(e).filter((function(e){return!(e instanceof U&&e.variable)||!p.variable(e.name)})),m.splice.apply(m,[r,1].concat(f)),r+=f.length-1,p.resetCache()):"VariableCall"===u.type&&(f=u.eval(e).rules.filter((function(e){return!(e instanceof U&&e.variable)})),m.splice.apply(m,[r,1].concat(f)),r+=f.length-1,p.resetCache());for(r=0;u=m[r];r++)u.evalFirst||(m[r]=u=u.eval?u.eval(e):u);for(r=0;u=m[r];r++)if(u instanceof Z&&u.selectors&&1===u.selectors.length&&u.selectors[0]&&u.selectors[0].isJustParentSelector()){m.splice(r--,1);for(a=0;c=u.rules[a];a++)c instanceof h&&(c.copyVisibilityInfo(u.visibilityInfo()),c instanceof U&&c.variable||m.splice(++r,0,c))}if(d.shift(),v.shift(),e.mediaBlocks)for(r=g;r<e.mediaBlocks.length;r++)e.mediaBlocks[r].bubbleSelectors(t);return p},Z.prototype.evalImports=function(e){var t,i,n=this.rules;if(n)for(t=0;t<n.length;t++)"Import"===n[t].type&&((i=n[t].eval(e))&&(i.length||0===i.length)?(n.splice.apply(n,[t,1].concat(i)),t+=i.length-1):n.splice(t,1,i),this.resetCache())},Z.prototype.makeImportant=function(){return new Z(this.selectors,this.rules.map((function(e){return e.makeImportant?e.makeImportant():e})),this.strictImports,this.visibilityInfo())},Z.prototype.matchArgs=function(e){return!e||0===e.length},Z.prototype.matchCondition=function(e,t){var i=this.selectors[this.selectors.length-1];return!!i.evaldCondition&&!(i.condition&&!i.condition.eval(new T.Eval(t,t.frames)))},Z.prototype.resetCache=function(){this._rulesets=null,this._variables=null,this._properties=null,this._lookups={}},Z.prototype.variables=function(){return this._variables||(this._variables=this.rules?this.rules.reduce((function(e,t){if(t instanceof U&&!0===t.variable&&(e[t.name]=t),"Import"===t.type&&t.root&&t.root.variables){var i=t.root.variables();for(var n in i)i.hasOwnProperty(n)&&(e[n]=t.root.variable(n))}return e}),{}):{}),this._variables},Z.prototype.properties=function(){return this._properties||(this._properties=this.rules?this.rules.reduce((function(e,t){if(t instanceof U&&!0!==t.variable){var i=1===t.name.length&&t.name[0]instanceof N?t.name[0].value:t.name;e["$"+i]?e["$"+i].push(t):e["$"+i]=[t]}return e}),{}):{}),this._properties},Z.prototype.variable=function(e){var t=this.variables()[e];if(t)return this.parseValue(t)},Z.prototype.property=function(e){var t=this.properties()[e];if(t)return this.parseValue(t)},Z.prototype.lastDeclaration=function(){for(var e=this.rules.length;e>0;e--){var t=this.rules[e-1];if(t instanceof U)return this.parseValue(t)}},Z.prototype.parseValue=function(e){var t=this;function i(e){return e.value instanceof D&&!e.parsed?("string"==typeof e.value.value?this.parse.parseNode(e.value.value,["value","important"],e.value.getIndex(),e.fileInfo(),(function(t,i){t&&(e.parsed=!0),i&&(e.value=i[0],e.important=i[1]||"",e.parsed=!0)})):e.parsed=!0,e):e}if(Array.isArray(e)){var n=[];return e.forEach((function(e){n.push(i.call(t,e))})),n}return i.call(t,e)},Z.prototype.rulesets=function(){if(!this.rules)return[];var e,t,i=[],n=this.rules;for(e=0;t=n[e];e++)t.isRuleset&&i.push(t);return i},Z.prototype.prependRule=function(e){var t=this.rules;t?t.unshift(e):this.rules=[e],this.setParent(e,this)},Z.prototype.find=function(e,t,i){void 0===t&&(t=this);var n,r,s=[],o=e.toCSS();return o in this._lookups?this._lookups[o]:(this.rulesets().forEach((function(o){if(o!==t)for(var a=0;a<o.selectors.length;a++)if(n=e.match(o.selectors[a])){if(e.elements.length>n){if(!i||i(o)){r=o.find(new O(e.elements.slice(n)),t,i);for(var l=0;l<r.length;++l)r[l].path.push(o);Array.prototype.push.apply(s,r)}}else s.push({rule:o,path:[]});break}})),this._lookups[o]=s,s)},Z.prototype.genCSS=function(e,t){var i,n,r,s,o,a=[];e.tabLevel=e.tabLevel||0,this.root||e.tabLevel++;var l,u=e.compress?"":Array(e.tabLevel+1).join(" "),h=e.compress?"":Array(e.tabLevel).join(" "),c=0,f=0;for(i=0;s=this.rules[i];i++)s instanceof q?(f===i&&f++,a.push(s)):s.isCharset&&s.isCharset()?(a.splice(c,0,s),c++,f++):"Import"===s.type?(a.splice(f,0,s),f++):a.push(s);if(a=[].concat(a),!this.root){(r=j(e,this,h))&&(t.add(r),t.add(h));var p=this.paths,d=p.length,v=void 0;for(l=e.compress?",":",\n"+h,i=0;i<d;i++)if(v=(o=p[i]).length)for(i>0&&t.add(l),e.firstSelector=!0,o[0].genCSS(e,t),e.firstSelector=!1,n=1;n<v;n++)o[n].genCSS(e,t);t.add((e.compress?"{":" {\n")+u)}for(i=0;s=a[i];i++){i+1===a.length&&(e.lastRule=!0);var m=e.lastRule;s.isRulesetLike(s)&&(e.lastRule=!1),s.genCSS?s.genCSS(e,t):s.value&&t.add(s.value.toString()),e.lastRule=m,!e.lastRule&&s.isVisible()?t.add(e.compress?"":"\n"+u):e.lastRule=!1}this.root||(t.add(e.compress?"}":"\n"+h+"}"),e.tabLevel--),t.isEmpty()||e.compress||!this.firstRoot||t.add("\n")},Z.prototype.joinSelectors=function(e,t,i){for(var n=0;n<i.length;n++)this.joinSelector(e,t,i[n])},Z.prototype.joinSelector=function(e,t,i){function n(e,t){var i,n;if(0===e.length)i=new d(e[0]);else{var r=new Array(e.length);for(n=0;n<e.length;n++)r[n]=new g(null,e[n],t.isVariable,t._index,t._fileInfo);i=new d(new O(r))}return i}function r(e,t){var i;return i=new g(null,e,t.isVariable,t._index,t._fileInfo),new O([i])}function s(e,t,i,n){var r,s,o;if(r=[],e.length>0?(s=(r=_(e)).pop(),o=n.createDerived(_(s.elements))):o=n.createDerived([]),t.length>0){var a=i.combinator,l=t[0].elements[0];a.emptyOrWhitespace&&!l.combinator.emptyOrWhitespace&&(a=l.combinator),o.elements.push(new g(a,l.value,i.isVariable,i._index,i._fileInfo)),o.elements=o.elements.concat(t[0].elements.slice(1))}if(0!==o.elements.length&&r.push(o),t.length>1){var u=t.slice(1);u=u.map((function(e){return e.createDerived(e.elements,[])})),r=r.concat(u)}return r}function o(e,t,i,n,r){var o;for(o=0;o<e.length;o++){var a=s(e[o],t,i,n);r.push(a)}return r}function a(e,t){var i,n;if(0!==e.length)if(0!==t.length)for(i=0;n=t[i];i++)n.length>0?n[n.length-1]=n[n.length-1].createDerived(n[n.length-1].elements.concat(e)):n.push(new O(e));else t.push([new O(e)])}function l(e,t){var i=t.createDerived(t.elements,t.extendList,t.evaldCondition);return i.copyVisibilityInfo(e),i}var u,h;if(!function e(t,i,l){var u,h,c,f,p,v,m,y,b,w,x,S,I=!1;for(f=[],p=[[]],u=0;y=l.elements[u];u++)if("&"!==y.value){var C=(S=void 0,(x=y).value instanceof d&&(S=x.value.value)instanceof O?S:null);if(null!=C){a(f,p);var k,_=[],A=[];for(k=e(_,i,C),I=I||k,c=0;c<_.length;c++){o(p,[r(n(_[c],y),y)],y,l,A)}p=A,f=[]}else f.push(y)}else{for(I=!0,v=[],a(f,p),h=0;h<p.length;h++)if(m=p[h],0===i.length)m.length>0&&m[0].elements.push(new g(y.combinator,"",y.isVariable,y._index,y._fileInfo)),v.push(m);else for(c=0;c<i.length;c++){var M=s(m,i[c],y,l);v.push(M)}p=v,f=[]}for(a(f,p),u=0;u<p.length;u++)(b=p[u].length)>0&&(t.push(p[u]),w=p[u][b-1],p[u][b-1]=w.createDerived(w.elements,l.extendList));return I}(h=[],t,i))if(t.length>0)for(h=[],u=0;u<t.length;u++){var c=t[u].map(l.bind(this,i.visibilityInfo()));c.push(i),h.push(c)}else h=[[i]];for(u=0;u<h.length;u++)e.push(h[u])},Z.prototype.type="Ruleset",Z.prototype.isRuleset=!0;var Y=function(e,t,i,n,r,s,o,a){var l;if(this.name=e,this.value=t instanceof h?t:t?new D(t):t,i){for(Array.isArray(i)?this.rules=i:(this.rules=[i],this.rules[0].selectors=new O([],null,null,n,r).createEmptySelectors()),l=0;l<this.rules.length;l++)this.rules[l].allowImports=!0;this.setParent(this.rules,this)}this._index=n,this._fileInfo=r,this.debugInfo=s,this.isRooted=o||!1,this.copyVisibilityInfo(a),this.allowRoot=!0};(Y.prototype=new h).accept=function(e){var t=this.value,i=this.rules;i&&(this.rules=e.visitArray(i)),t&&(this.value=e.visit(t))},Y.prototype.isRulesetLike=function(){return this.rules||!this.isCharset()},Y.prototype.isCharset=function(){return"@charset"===this.name},Y.prototype.genCSS=function(e,t){var i=this.value,n=this.rules;t.add(this.name,this.fileInfo(),this.getIndex()),i&&(t.add(" "),i.genCSS(e,t)),n?this.outputRuleset(e,t,n):t.add(";")},Y.prototype.eval=function(e){var t,i,n=this.value,r=this.rules;return t=e.mediaPath,i=e.mediaBlocks,e.mediaPath=[],e.mediaBlocks=[],n&&(n=n.eval(e)),r&&((r=[r[0].eval(e)])[0].root=!0),e.mediaPath=t,e.mediaBlocks=i,new Y(this.name,n,r,this.getIndex(),this.fileInfo(),this.debugInfo,this.isRooted,this.visibilityInfo())},Y.prototype.variable=function(e){if(this.rules)return Z.prototype.variable.call(this.rules[0],e)},Y.prototype.find=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(this.rules)return Z.prototype.find.apply(this.rules[0],e)},Y.prototype.rulesets=function(){if(this.rules)return Z.prototype.rulesets.apply(this.rules[0])},Y.prototype.outputRuleset=function(e,t,i){var n,r=i.length;if(e.tabLevel=1+(0|e.tabLevel),e.compress){for(t.add("{"),n=0;n<r;n++)i[n].genCSS(e,t);return t.add("}"),void e.tabLevel--}var s="\n"+Array(e.tabLevel).join(" "),o=s+" ";if(r){for(t.add(" {"+o),i[0].genCSS(e,t),n=1;n<r;n++)t.add(o),i[n].genCSS(e,t);t.add(s+"}")}else t.add(" {"+s+"}");e.tabLevel--},Y.prototype.type="AtRule";var X=function(e,t){this.ruleset=e,this.frames=t,this.setParent(this.ruleset,this)};(X.prototype=new h).accept=function(e){this.ruleset=e.visit(this.ruleset)},X.prototype.eval=function(e){var t=this.frames||_(e.frames);return new X(this.ruleset,t)},X.prototype.callEval=function(e){return this.ruleset.eval(this.frames?new T.Eval(e,this.frames.concat(e.frames)):e)},X.prototype.type="DetachedRuleset",X.prototype.evalFirst=!0;var ee=function(e,t,i){this.numerator=e?_(e).sort():[],this.denominator=t?_(t).sort():[],i?this.backupUnit=i:e&&e.length&&(this.backupUnit=e[0])};(ee.prototype=new h).clone=function(){return new ee(_(this.numerator),_(this.denominator),this.backupUnit)},ee.prototype.genCSS=function(e,t){var i=e&&e.strictUnits;1===this.numerator.length?t.add(this.numerator[0]):!i&&this.backupUnit?t.add(this.backupUnit):!i&&this.denominator.length&&t.add(this.denominator[0])},ee.prototype.toString=function(){var e,t=this.numerator.join("*");for(e=0;e<this.denominator.length;e++)t+="/"+this.denominator[e];return t},ee.prototype.compare=function(e){return this.is(e.toString())?0:void 0},ee.prototype.is=function(e){return this.toString().toUpperCase()===e.toUpperCase()},ee.prototype.isLength=function(){return RegExp("^(px|em|ex|ch|rem|in|cm|mm|pc|pt|ex|vw|vh|vmin|vmax)$","gi").test(this.toCSS())},ee.prototype.isEmpty=function(){return 0===this.numerator.length&&0===this.denominator.length},ee.prototype.isSingular=function(){return this.numerator.length<=1&&0===this.denominator.length},ee.prototype.map=function(e){var t;for(t=0;t<this.numerator.length;t++)this.numerator[t]=e(this.numerator[t],!1);for(t=0;t<this.denominator.length;t++)this.denominator[t]=e(this.denominator[t],!0)},ee.prototype.usedUnits=function(){var e,t,i,n={};for(i in t=function(t){return e.hasOwnProperty(t)&&!n[i]&&(n[i]=t),t},l)l.hasOwnProperty(i)&&(e=l[i],this.map(t));return n},ee.prototype.cancel=function(){var e,t,i={};for(t=0;t<this.numerator.length;t++)i[e=this.numerator[t]]=(i[e]||0)+1;for(t=0;t<this.denominator.length;t++)i[e=this.denominator[t]]=(i[e]||0)-1;for(e in this.numerator=[],this.denominator=[],i)if(i.hasOwnProperty(e)){var n=i[e];if(n>0)for(t=0;t<n;t++)this.numerator.push(e);else if(n<0)for(t=0;t<-n;t++)this.denominator.push(e)}this.numerator.sort(),this.denominator.sort()},ee.prototype.type="Unit";var te=function(e,t){if(this.value=parseFloat(e),isNaN(this.value))throw new Error("Dimension is not a number.");this.unit=t&&t instanceof ee?t:new ee(t?[t]:void 0),this.setParent(this.unit,this)};(te.prototype=new h).accept=function(e){this.unit=e.visit(this.unit)},te.prototype.eval=function(e){return this},te.prototype.toColor=function(){return new c([this.value,this.value,this.value])},te.prototype.genCSS=function(e,t){if(e&&e.strictUnits&&!this.unit.isSingular())throw new Error("Multiple units in dimension. Correct the units or use the unit function. Bad unit: "+this.unit.toString());var i=this.fround(e,this.value),n=String(i);if(0!==i&&i<1e-6&&i>-1e-6&&(n=i.toFixed(20).replace(/0+$/,"")),e&&e.compress){if(0===i&&this.unit.isLength())return void t.add(n);i>0&&i<1&&(n=n.substr(1))}t.add(n),this.unit.genCSS(e,t)},te.prototype.operate=function(e,t,i){var n=this._operate(e,t,this.value,i.value),r=this.unit.clone();if("+"===t||"-"===t)if(0===r.numerator.length&&0===r.denominator.length)r=i.unit.clone(),this.unit.backupUnit&&(r.backupUnit=this.unit.backupUnit);else if(0===i.unit.numerator.length&&0===r.denominator.length);else{if(i=i.convertTo(this.unit.usedUnits()),e.strictUnits&&i.unit.toString()!==r.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+r.toString()+"' and '"+i.unit.toString()+"'.");n=this._operate(e,t,this.value,i.value)}else"*"===t?(r.numerator=r.numerator.concat(i.unit.numerator).sort(),r.denominator=r.denominator.concat(i.unit.denominator).sort(),r.cancel()):"/"===t&&(r.numerator=r.numerator.concat(i.unit.denominator).sort(),r.denominator=r.denominator.concat(i.unit.numerator).sort(),r.cancel());return new te(n,r)},te.prototype.compare=function(e){var t,i;if(e instanceof te){if(this.unit.isEmpty()||e.unit.isEmpty())t=this,i=e;else if(t=this.unify(),i=e.unify(),0!==t.unit.compare(i.unit))return;return h.numericCompare(t.value,i.value)}},te.prototype.unify=function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},te.prototype.convertTo=function(e){var t,i,n,r,s,o=this.value,a=this.unit.clone(),u={};if("string"==typeof e){for(t in l)l[t].hasOwnProperty(e)&&((u={})[t]=e);e=u}for(i in s=function(e,t){return n.hasOwnProperty(e)?(t?o/=n[e]/n[r]:o*=n[e]/n[r],r):e},e)e.hasOwnProperty(i)&&(r=e[i],n=l[i],a.map(s));return a.cancel(),new te(o,a)},te.prototype.type="Dimension";var ie=y,ne=function(e,t,i){this.op=e.trim(),this.operands=t,this.isSpaced=i};(ne.prototype=new h).accept=function(e){this.operands=e.visitArray(this.operands)},ne.prototype.eval=function(e){var t,i=this.operands[0].eval(e),n=this.operands[1].eval(e);if(e.isMathOn(this.op)){if(t="./"===this.op?"/":this.op,i instanceof te&&n instanceof c&&(i=i.toColor()),n instanceof te&&i instanceof c&&(n=n.toColor()),!i.operate){if(i instanceof ne&&"/"===i.op&&e.math===ie.PARENS_DIVISION)return new ne(this.op,[i,n],this.isSpaced);throw{type:"Operation",message:"Operation on an invalid type"}}return i.operate(e,t,n)}return new ne(this.op,[i,n],this.isSpaced)},ne.prototype.genCSS=function(e,t){this.operands[0].genCSS(e,t),this.isSpaced&&t.add(" "),t.add(this.op),this.isSpaced&&t.add(" "),this.operands[1].genCSS(e,t)},ne.prototype.type="Operation";var re=y,se=function(e,t){if(this.value=e,this.noSpacing=t,!e)throw new Error("Expression requires an array parameter")};(se.prototype=new h).accept=function(e){this.value=e.visitArray(this.value)},se.prototype.eval=function(e){var t,i=e.isMathOn(),n=this.parens&&(e.math!==re.STRICT_LEGACY||!this.parensInOp),r=!1;return n&&e.inParenthesis(),this.value.length>1?t=new se(this.value.map((function(t){return t.eval?t.eval(e):t})),this.noSpacing):1===this.value.length?(!this.value[0].parens||this.value[0].parensInOp||e.inCalc||(r=!0),t=this.value[0].eval(e)):t=this,n&&e.outOfParenthesis(),!this.parens||!this.parensInOp||i||r||t instanceof te||(t=new d(t)),t},se.prototype.genCSS=function(e,t){for(var i=0;i<this.value.length;i++)this.value[i].genCSS(e,t),!this.noSpacing&&i+1<this.value.length&&t.add(" ")},se.prototype.throwAwayComments=function(){this.value=this.value.filter((function(e){return!(e instanceof q)}))},se.prototype.type="Expression";var oe=function(){function e(e,t,i,n){this.name=e.toLowerCase(),this.index=i,this.context=t,this.currentFileInfo=n,this.func=t.frames[0].functionRegistry.get(this.name)}return e.prototype.isValid=function(){return Boolean(this.func)},e.prototype.call=function(e){var t=this,i=this.func.evalArgs;return!1!==i&&(e=e.map((function(e){return e.eval(t.context)}))),Array.isArray(e)&&(e=e.filter((function(e){return"Comment"!==e.type})).map((function(e){if("Expression"===e.type){var t=e.value.filter((function(e){return"Comment"!==e.type}));return 1===t.length?t[0]:new se(t)}return e}))),!1===i?this.func.apply(this,o([this.context],e)):this.func.apply(this,e)},e}(),ae=function(e,t,i,n){this.name=e,this.args=t,this.calc="calc"===e,this._index=i,this._fileInfo=n};(ae.prototype=new h).accept=function(e){this.args&&(this.args=e.visitArray(this.args))},ae.prototype.eval=function(e){var t=this,i=e.mathOn;e.mathOn=!this.calc,(this.calc||e.inCalc)&&e.enterCalc();var n,r=function(){(t.calc||e.inCalc)&&e.exitCalc(),e.mathOn=i},s=new oe(this.name,e,this.getIndex(),this.fileInfo());if(s.isValid()){try{n=s.call(this.args),r()}catch(e){if(e.hasOwnProperty("line")&&e.hasOwnProperty("column"))throw e;throw{type:e.type||"Runtime",message:"error evaluating function `"+this.name+"`"+(e.message?": "+e.message:""),index:this.getIndex(),filename:this.fileInfo().filename,line:e.lineNumber,column:e.columnNumber}}if(null!=n)return n instanceof h||(n=new D(n&&!0!==n?n.toString():null)),n._index=this._index,n._fileInfo=this._fileInfo,n}var o=this.args.map((function(t){return t.eval(e)}));return r(),new ae(this.name,o,this.getIndex(),this.fileInfo())},ae.prototype.genCSS=function(e,t){t.add(this.name+"(",this.fileInfo(),this.getIndex());for(var i=0;i<this.args.length;i++)this.args[i].genCSS(e,t),i+1<this.args.length&&t.add(", ");t.add(")")},ae.prototype.type="Call";var le=function(e,t,i){this.name=e,this._index=t,this._fileInfo=i};(le.prototype=new h).eval=function(e){var t,i=this.name;if(0===i.indexOf("@@")&&(i="@"+new le(i.slice(1),this.getIndex(),this.fileInfo()).eval(e).value),this.evaluating)throw{type:"Name",message:"Recursive variable definition for "+i,filename:this.fileInfo().filename,index:this.getIndex()};if(this.evaluating=!0,t=this.find(e.frames,(function(t){var n=t.variable(i);if(n){if(n.important)e.importantScope[e.importantScope.length-1].important=n.important;return e.inCalc?new ae("_SELF",[n.value]).eval(e):n.value.eval(e)}})))return this.evaluating=!1,t;throw{type:"Name",message:"variable "+i+" is undefined",filename:this.fileInfo().filename,index:this.getIndex()}},le.prototype.find=function(e,t){for(var i=0,n=void 0;i<e.length;i++)if(n=t.call(e,e[i]))return n;return null},le.prototype.type="Variable";var ue=function(e,t,i){this.name=e,this._index=t,this._fileInfo=i};(ue.prototype=new h).eval=function(e){var t,i=this.name,n=e.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules;if(this.evaluating)throw{type:"Name",message:"Recursive property reference for "+i,filename:this.fileInfo().filename,index:this.getIndex()};if(this.evaluating=!0,t=this.find(e.frames,(function(t){var r,s=t.property(i);if(s){for(var o=0;o<s.length;o++)r=s[o],s[o]=new U(r.name,r.value,r.important,r.merge,r.index,r.currentFileInfo,r.inline,r.variable);if(n(s),(r=s[s.length-1]).important)e.importantScope[e.importantScope.length-1].important=r.important;return r=r.value.eval(e)}})))return this.evaluating=!1,t;throw{type:"Name",message:"Property '"+i+"' is undefined",filename:this.currentFileInfo.filename,index:this.index}},ue.prototype.find=function(e,t){for(var i=0,n=void 0;i<e.length;i++)if(n=t.call(e,e[i]))return n;return null},ue.prototype.type="Property";var he=function(e,t,i){this.key=e,this.op=t,this.value=i};(he.prototype=new h).eval=function(e){return new he(this.key.eval?this.key.eval(e):this.key,this.op,this.value&&this.value.eval?this.value.eval(e):this.value)},he.prototype.genCSS=function(e,t){t.add(this.toCSS(e))},he.prototype.toCSS=function(e){var t=this.key.toCSS?this.key.toCSS(e):this.key;return this.op&&(t+=this.op,t+=this.value.toCSS?this.value.toCSS(e):this.value),"["+t+"]"},he.prototype.type="Attribute";var ce=function(e,t,i,n,r){this.escaped=null==i||i,this.value=t||"",this.quote=e.charAt(0),this._index=n,this._fileInfo=r,this.variableRegex=/@\{([\w-]+)\}/g,this.propRegex=/\$\{([\w-]+)\}/g,this.allowRoot=i};(ce.prototype=new h).genCSS=function(e,t){this.escaped||t.add(this.quote,this.fileInfo(),this.getIndex()),t.add(this.value),this.escaped||t.add(this.quote)},ce.prototype.containsVariables=function(){return this.value.match(this.variableRegex)},ce.prototype.eval=function(e){var t=this,i=this.value;function n(e,t,i){var n=e;do{e=n.toString(),n=e.replace(t,i)}while(e!==n);return n}return i=n(i,this.variableRegex,(function(i,n){var r=new le("@"+n,t.getIndex(),t.fileInfo()).eval(e,!0);return r instanceof ce?r.value:r.toCSS()})),i=n(i,this.propRegex,(function(i,n){var r=new ue("$"+n,t.getIndex(),t.fileInfo()).eval(e,!0);return r instanceof ce?r.value:r.toCSS()})),new ce(this.quote+i+this.quote,i,this.escaped,this.getIndex(),this.fileInfo())},ce.prototype.compare=function(e){return"Quoted"!==e.type||this.escaped||e.escaped?e.toCSS&&this.toCSS()===e.toCSS()?0:void 0:h.numericCompare(this.value,e.value)},ce.prototype.type="Quoted";var fe=function(e,t,i,n){this.value=e,this._index=t,this._fileInfo=i,this.isEvald=n};(fe.prototype=new h).accept=function(e){this.value=e.visit(this.value)},fe.prototype.genCSS=function(e,t){t.add("url("),this.value.genCSS(e,t),t.add(")")},fe.prototype.eval=function(e){var t,i=this.value.eval(e);if(!this.isEvald&&("string"==typeof(t=this.fileInfo()&&this.fileInfo().rootpath)&&"string"==typeof i.value&&e.pathRequiresRewrite(i.value)?(i.quote||(t=t.replace(/[\(\)'"\s]/g,(function(e){return"\\"+e}))),i.value=e.rewritePath(i.value,t)):i.value=e.normalizePath(i.value),e.urlArgs&&!i.value.match(/^\s*data:/))){var n=(-1===i.value.indexOf("?")?"?":"&")+e.urlArgs;-1!==i.value.indexOf("#")?i.value=i.value.replace("#",n+"#"):i.value+=n}return new fe(i,this.getIndex(),this.fileInfo(),!0)},fe.prototype.type="Url";var pe=function(e,t,i,n,r){this._index=i,this._fileInfo=n;var s=new O([],null,null,this._index,this._fileInfo).createEmptySelectors();this.features=new L(t),this.rules=[new Z(s,e)],this.rules[0].allowImports=!0,this.copyVisibilityInfo(r),this.allowRoot=!0,this.setParent(s,this),this.setParent(this.features,this),this.setParent(this.rules,this)};(pe.prototype=new Y).isRulesetLike=function(){return!0},pe.prototype.accept=function(e){this.features&&(this.features=e.visit(this.features)),this.rules&&(this.rules=e.visitArray(this.rules))},pe.prototype.genCSS=function(e,t){t.add("@media ",this._fileInfo,this._index),this.features.genCSS(e,t),this.outputRuleset(e,t,this.rules)},pe.prototype.eval=function(e){e.mediaBlocks||(e.mediaBlocks=[],e.mediaPath=[]);var t=new pe(null,[],this._index,this._fileInfo,this.visibilityInfo());return this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,t.debugInfo=this.debugInfo),t.features=this.features.eval(e),e.mediaPath.push(t),e.mediaBlocks.push(t),this.rules[0].functionRegistry=e.frames[0].functionRegistry.inherit(),e.frames.unshift(this.rules[0]),t.rules=[this.rules[0].eval(e)],e.frames.shift(),e.mediaPath.pop(),0===e.mediaPath.length?t.evalTop(e):t.evalNested(e)},pe.prototype.evalTop=function(e){var t=this;if(e.mediaBlocks.length>1){var i=new O([],null,null,this.getIndex(),this.fileInfo()).createEmptySelectors();(t=new Z(i,e.mediaBlocks)).multiMedia=!0,t.copyVisibilityInfo(this.visibilityInfo()),this.setParent(t,this)}return delete e.mediaBlocks,delete e.mediaPath,t},pe.prototype.evalNested=function(e){var t,i,n=e.mediaPath.concat([this]);for(t=0;t<n.length;t++)i=n[t].features instanceof L?n[t].features.value:n[t].features,n[t]=Array.isArray(i)?i:[i];return this.features=new L(this.permute(n).map((function(e){for(e=e.map((function(e){return e.toCSS?e:new D(e)})),t=e.length-1;t>0;t--)e.splice(t,0,new D("and"));return new se(e)}))),this.setParent(this.features,this),new Z([],[])},pe.prototype.permute=function(e){if(0===e.length)return[];if(1===e.length)return e[0];for(var t=[],i=this.permute(e.slice(1)),n=0;n<i.length;n++)for(var r=0;r<e[0].length;r++)t.push([e[0][r]].concat(i[n]));return t},pe.prototype.bubbleSelectors=function(e){e&&(this.rules=[new Z(_(e),[this.rules[0]])],this.setParent(this.rules,this))},pe.prototype.type="Media";var de=function(e,t,i,n,r,s){if(this.options=i,this._index=n,this._fileInfo=r,this.path=e,this.features=t,this.allowRoot=!0,void 0!==this.options.less||this.options.inline)this.css=!this.options.less||this.options.inline;else{var o=this.getPath();o&&/[#\.\&\?]css([\?;].*)?$/.test(o)&&(this.css=!0)}this.copyVisibilityInfo(s),this.setParent(this.features,this),this.setParent(this.path,this)};(de.prototype=new h).accept=function(e){this.features&&(this.features=e.visit(this.features)),this.path=e.visit(this.path),this.options.isPlugin||this.options.inline||!this.root||(this.root=e.visit(this.root))},de.prototype.genCSS=function(e,t){this.css&&void 0===this.path._fileInfo.reference&&(t.add("@import ",this._fileInfo,this._index),this.path.genCSS(e,t),this.features&&(t.add(" "),this.features.genCSS(e,t)),t.add(";"))},de.prototype.getPath=function(){return this.path instanceof fe?this.path.value.value:this.path.value},de.prototype.isVariableImport=function(){var e=this.path;return e instanceof fe&&(e=e.value),!(e instanceof ce)||e.containsVariables()},de.prototype.evalForImport=function(e){var t=this.path;return t instanceof fe&&(t=t.value),new de(t.eval(e),this.features,this.options,this._index,this._fileInfo,this.visibilityInfo())},de.prototype.evalPath=function(e){var t=this.path.eval(e),i=this._fileInfo;if(!(t instanceof fe)){var n=t.value;i&&n&&e.pathRequiresRewrite(n)?t.value=e.rewritePath(n,i.rootpath):t.value=e.normalizePath(t.value)}return t},de.prototype.eval=function(e){var t=this.doEval(e);return(this.options.reference||this.blocksVisibility())&&(t.length||0===t.length?t.forEach((function(e){e.addVisibilityBlock()})):t.addVisibilityBlock()),t},de.prototype.doEval=function(e){var t,i,n=this.features&&this.features.eval(e);if(this.options.isPlugin){if(this.root&&this.root.eval)try{this.root.eval(e)}catch(e){throw e.message="Plugin error during evaluation",new F(e,this.root.imports,this.root.filename)}return(i=e.frames[0]&&e.frames[0].functionRegistry)&&this.root&&this.root.functions&&i.addMultiple(this.root.functions),[]}if(this.skip&&("function"==typeof this.skip&&(this.skip=this.skip()),this.skip))return[];if(this.options.inline){var r=new D(this.root,0,{filename:this.importedFilename,reference:this.path._fileInfo&&this.path._fileInfo.reference},!0,!0);return this.features?new pe([r],this.features.value):[r]}if(this.css){var s=new de(this.evalPath(e),n,this.options,this._index);if(!s.css&&this.error)throw this.error;return s}return this.root?((t=new Z(null,_(this.root.rules))).evalImports(e),this.features?new pe(t.rules,this.features.value):t.rules):[]},de.prototype.type="Import";var ve=function(){};(ve.prototype=new h).evaluateJavaScript=function(e,t){var i,n=this,r={};if(!t.javascriptEnabled)throw{message:"Inline JavaScript is not enabled. Is it set in your options?",filename:this.fileInfo().filename,index:this.getIndex()};e=e.replace(/@\{([\w-]+)\}/g,(function(e,i){return n.jsify(new le("@"+i,n.getIndex(),n.fileInfo()).eval(t))}));try{e=new Function("return ("+e+")")}catch(t){throw{message:"JavaScript evaluation error: "+t.message+" from `"+e+"`",filename:this.fileInfo().filename,index:this.getIndex()}}var s=t.frames[0].variables();for(var o in s)s.hasOwnProperty(o)&&(r[o.slice(1)]={value:s[o].value,toJS:function(){return this.value.eval(t).toCSS()}});try{i=e.call(r)}catch(e){throw{message:"JavaScript evaluation error: '"+e.name+": "+e.message.replace(/["]/g,"'")+"'",filename:this.fileInfo().filename,index:this.getIndex()}}return i},ve.prototype.jsify=function(e){return Array.isArray(e.value)&&e.value.length>1?"["+e.value.map((function(e){return e.toCSS()})).join(", ")+"]":e.toCSS()};var me=function(e,t,i,n){this.escaped=t,this.expression=e,this._index=i,this._fileInfo=n};(me.prototype=new ve).eval=function(e){var t=this.evaluateJavaScript(this.expression,e),i=typeof t;return"number"!==i||isNaN(t)?"string"===i?new ce('"'+t+'"',t,this.escaped,this._index):Array.isArray(t)?new D(t.join(", ")):new D(t):new te(t)},me.prototype.type="JavaScript";var ge=function(e,t){this.key=e,this.value=t};(ge.prototype=new h).accept=function(e){this.value=e.visit(this.value)},ge.prototype.eval=function(e){return this.value.eval?new ge(this.key,this.value.eval(e)):this},ge.prototype.genCSS=function(e,t){t.add(this.key+"="),this.value.genCSS?this.value.genCSS(e,t):t.add(this.value)},ge.prototype.type="Assignment";var ye=function(e,t,i,n,r){this.op=e.trim(),this.lvalue=t,this.rvalue=i,this._index=n,this.negate=r};(ye.prototype=new h).accept=function(e){this.lvalue=e.visit(this.lvalue),this.rvalue=e.visit(this.rvalue)},ye.prototype.eval=function(e){var t=function(e,t,i){switch(e){case"and":return t&&i;case"or":return t||i;default:switch(h.compare(t,i)){case-1:return"<"===e||"=<"===e||"<="===e;case 0:return"="===e||">="===e||"=<"===e||"<="===e;case 1:return">"===e||">="===e;default:return!1}}}(this.op,this.lvalue.eval(e),this.rvalue.eval(e));return this.negate?!t:t},ye.prototype.type="Condition";var be=function(e){this.value=e};(be.prototype=new h).type="UnicodeDescriptor";var we=function(e){this.value=e};(we.prototype=new h).genCSS=function(e,t){t.add("-"),this.value.genCSS(e,t)},we.prototype.eval=function(e){return e.isMathOn()?new ne("*",[new te(-1),this.value]).eval(e):new we(this.value.eval(e))},we.prototype.type="Negative";var xe=function(e,t,i,n,r){switch(this.selector=e,this.option=t,this.object_id=xe.next_id++,this.parent_ids=[this.object_id],this._index=i,this._fileInfo=n,this.copyVisibilityInfo(r),this.allowRoot=!0,t){case"all":this.allowBefore=!0,this.allowAfter=!0;break;default:this.allowBefore=!1,this.allowAfter=!1}this.setParent(this.selector,this)};xe.prototype=new h,xe.prototype.accept=function(e){this.selector=e.visit(this.selector)},xe.prototype.eval=function(e){return new xe(this.selector.eval(e),this.option,this.getIndex(),this.fileInfo(),this.visibilityInfo())},xe.prototype.clone=function(e){return new xe(this.selector,this.option,this.getIndex(),this.fileInfo(),this.visibilityInfo())},xe.prototype.findSelfSelectors=function(e){var t,i,n=[];for(t=0;t<e.length;t++)i=e[t].elements,t>0&&i.length&&""===i[0].combinator.value&&(i[0].combinator.value=" "),n=n.concat(e[t].elements);this.selfSelectors=[new O(n)],this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo())},xe.next_id=0,xe.prototype.type="Extend";var Se=function(e,t,i){this.variable=e,this._index=t,this._fileInfo=i,this.allowRoot=!0};(Se.prototype=new h).eval=function(e){var t,i=new le(this.variable,this.getIndex(),this.fileInfo()).eval(e),n=new F({message:"Could not evaluate variable call "+this.variable});if(!i.ruleset){if(i.rules)t=i;else if(Array.isArray(i))t=new Z("",i);else{if(!Array.isArray(i.value))throw n;t=new Z("",i.value)}i=new X(t)}if(i.ruleset)return i.callEval(e);throw n},Se.prototype.type="VariableCall";var Ie=function(e,t,i,n){this.value=e,this.lookups=t,this._index=i,this._fileInfo=n};(Ie.prototype=new h).eval=function(e){var t,i,n=this.value.eval(e);for(t=0;t<this.lookups.length;t++){if(i=this.lookups[t],Array.isArray(n)&&(n=new Z([new O],n)),""===i)n=n.lastDeclaration();else if("@"===i.charAt(0)){if("@"===i.charAt(1)&&(i="@"+new le(i.substr(1)).eval(e).value),n.variables&&(n=n.variable(i)),!n)throw{type:"Name",message:"variable "+i+" not found",filename:this.fileInfo().filename,index:this.getIndex()}}else{if(i="$@"===i.substring(0,2)?"$"+new le(i.substr(1)).eval(e).value:"$"===i.charAt(0)?i:"$"+i,n.properties&&(n=n.property(i)),!n)throw{type:"Name",message:'property "'+i.substr(1)+'" not found',filename:this.fileInfo().filename,index:this.getIndex()};n=n[n.length-1]}n.value&&(n=n.eval(e).value),n.ruleset&&(n=n.ruleset.eval(e))}return n},Ie.prototype.type="NamespaceValue";var Ce=function(e,t,i,n,r,s,o){this.name=e||"anonymous mixin",this.selectors=[new O([new g(null,e,!1,this._index,this._fileInfo)])],this.params=t,this.condition=n,this.variadic=r,this.arity=t.length,this.rules=i,this._lookups={};var a=[];this.required=t.reduce((function(e,t){return!t.name||t.name&&!t.value?e+1:(a.push(t.name),e)}),0),this.optionalParameters=a,this.frames=s,this.copyVisibilityInfo(o),this.allowRoot=!0};(Ce.prototype=new Z).accept=function(e){this.params&&this.params.length&&(this.params=e.visitArray(this.params)),this.rules=e.visitArray(this.rules),this.condition&&(this.condition=e.visit(this.condition))},Ce.prototype.evalParams=function(e,t,i,n){var r,s,o,a,l,u,h,c,f=new Z(null,null),p=_(this.params),d=0;if(t.frames&&t.frames[0]&&t.frames[0].functionRegistry&&(f.functionRegistry=t.frames[0].functionRegistry.inherit()),t=new T.Eval(t,[f].concat(t.frames)),i)for(d=(i=_(i)).length,o=0;o<d;o++)if(u=(s=i[o])&&s.name){for(h=!1,a=0;a<p.length;a++)if(!n[a]&&u===p[a].name){n[a]=s.value.eval(e),f.prependRule(new U(u,s.value.eval(e))),h=!0;break}if(h){i.splice(o,1),o--;continue}throw{type:"Runtime",message:"Named argument for "+this.name+" "+i[o].name+" not found"}}for(c=0,o=0;o<p.length;o++)if(!n[o]){if(s=i&&i[c],u=p[o].name)if(p[o].variadic){for(r=[],a=c;a<d;a++)r.push(i[a].value.eval(e));f.prependRule(new U(u,new se(r).eval(e)))}else{if(l=s&&s.value)l=Array.isArray(l)?new X(new Z("",l)):l.eval(e);else{if(!p[o].value)throw{type:"Runtime",message:"wrong number of arguments for "+this.name+" ("+d+" for "+this.arity+")"};l=p[o].value.eval(t),f.resetCache()}f.prependRule(new U(u,l)),n[o]=l}if(p[o].variadic&&i)for(a=c;a<d;a++)n[a]=i[a].value.eval(e);c++}return f},Ce.prototype.makeImportant=function(){var e=this.rules?this.rules.map((function(e){return e.makeImportant?e.makeImportant(!0):e})):this.rules;return new Ce(this.name,this.params,e,this.condition,this.variadic,this.frames)},Ce.prototype.eval=function(e){return new Ce(this.name,this.params,this.rules,this.condition,this.variadic,this.frames||_(e.frames))},Ce.prototype.evalCall=function(e,t,i){var n,r,s=[],o=this.frames?this.frames.concat(e.frames):e.frames,a=this.evalParams(e,new T.Eval(e,o),t,s);return a.prependRule(new U("@arguments",new se(s).eval(e))),n=_(this.rules),(r=new Z(null,n)).originalRuleset=this,r=r.eval(new T.Eval(e,[this,a].concat(o))),i&&(r=r.makeImportant()),r},Ce.prototype.matchCondition=function(e,t){return!(this.condition&&!this.condition.eval(new T.Eval(t,[this.evalParams(t,new T.Eval(t,this.frames?this.frames.concat(t.frames):t.frames),e,[])].concat(this.frames||[]).concat(t.frames))))},Ce.prototype.matchArgs=function(e,t){var i,n=e&&e.length||0,r=this.optionalParameters,s=e?e.reduce((function(e,t){return r.indexOf(t.name)<0?e+1:e}),0):0;if(this.variadic){if(s<this.required-1)return!1}else{if(s<this.required)return!1;if(n>this.params.length)return!1}i=Math.min(s,this.arity);for(var o=0;o<i;o++)if(!this.params[o].name&&!this.params[o].variadic&&e[o].value.eval(t).toCSS()!=this.params[o].value.eval(t).toCSS())return!1;return!0},Ce.prototype.type="MixinDefinition",Ce.prototype.evalFirst=!0;var ke=function(e,t,i,n,r){this.selector=new O(e),this.arguments=t||[],this._index=i,this._fileInfo=n,this.important=r,this.allowRoot=!0,this.setParent(this.selector,this)};(ke.prototype=new h).accept=function(e){this.selector&&(this.selector=e.visit(this.selector)),this.arguments.length&&(this.arguments=e.visitArray(this.arguments))},ke.prototype.eval=function(e){var t,i,n,r,s,o,a,l,u,h,c,f,p,d,v,m=[],g=[],y=!1,b=[],w=[];function x(t,i){var n,r,s;for(n=0;n<2;n++){for(w[n]=!0,K.value(n),r=0;r<i.length&&w[n];r++)(s=i[r]).matchCondition&&(w[n]=w[n]&&s.matchCondition(null,e));t.matchCondition&&(w[n]=w[n]&&t.matchCondition(m,e))}return w[0]||w[1]?w[0]!=w[1]?w[1]?1:2:0:-1}for(this.selector=this.selector.eval(e),o=0;o<this.arguments.length;o++)if(s=(r=this.arguments[o]).value.eval(e),r.expand&&Array.isArray(s.value))for(s=s.value,a=0;a<s.length;a++)m.push({value:s[a]});else m.push({name:r.name,value:s});for(v=function(t){return t.matchArgs(null,e)},o=0;o<e.frames.length;o++)if((t=e.frames[o].find(this.selector,null,v)).length>0){for(h=!0,a=0;a<t.length;a++){for(i=t[a].rule,n=t[a].path,u=!1,l=0;l<e.frames.length;l++)if(!(i instanceof Ce)&&i===(e.frames[l].originalRuleset||e.frames[l])){u=!0;break}u||i.matchArgs(m,e)&&(-1!==(c={mixin:i,group:x(i,n)}).group&&b.push(c),y=!0)}for(K.reset(),p=[0,0,0],a=0;a<b.length;a++)p[b[a].group]++;if(p[0]>0)f=2;else if(f=1,p[1]+p[2]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(m)+"`",index:this.getIndex(),filename:this.fileInfo().filename};for(a=0;a<b.length;a++)if(0===(c=b[a].group)||c===f)try{(i=b[a].mixin)instanceof Ce||(d=i.originalRuleset||i,(i=new Ce("",[],i.rules,null,!1,null,d.visibilityInfo())).originalRuleset=d);var S=i.evalCall(e,m,this.important).rules;this._setVisibilityToReplacement(S),Array.prototype.push.apply(g,S)}catch(e){throw{message:e.message,index:this.getIndex(),filename:this.fileInfo().filename,stack:e.stack}}if(y)return g}throw h?{type:"Runtime",message:"No matching definition was found for `"+this.format(m)+"`",index:this.getIndex(),filename:this.fileInfo().filename}:{type:"Name",message:this.selector.toCSS().trim()+" is undefined",index:this.getIndex(),filename:this.fileInfo().filename}},ke.prototype._setVisibilityToReplacement=function(e){var t;if(this.blocksVisibility())for(t=0;t<e.length;t++)e[t].addVisibilityBlock()},ke.prototype.format=function(e){return this.selector.toCSS().trim()+"("+(e?e.map((function(e){var t="";return e.name&&(t+=e.name+":"),e.value.toCSS?t+=e.value.toCSS():t+="???",t})).join(", "):"")+")"},ke.prototype.type="MixinCall";var _e={Node:h,Color:c,AtRule:Y,DetachedRuleset:X,Operation:ne,Dimension:te,Unit:ee,Keyword:N,Variable:le,Property:ue,Ruleset:Z,Element:g,Attribute:he,Combinator:m,Selector:O,Quoted:ce,Expression:se,Declaration:U,Call:ae,URL:fe,Import:de,Comment:q,Anonymous:D,Value:L,JavaScript:me,Assignment:ge,Condition:ye,Paren:d,Media:pe,UnicodeDescriptor:be,Negative:we,Extend:xe,VariableCall:Se,NamespaceValue:Ie,mixin:{Call:ke,Definition:Ce}},Ae={error:function(e){this._fireEvent("error",e)},warn:function(e){this._fireEvent("warn",e)},info:function(e){this._fireEvent("info",e)},debug:function(e){this._fireEvent("debug",e)},addListener:function(e){this._listeners.push(e)},removeListener:function(e){for(var t=0;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)},_fireEvent:function(e,t){for(var i=0;i<this._listeners.length;i++){var n=this._listeners[i][e];n&&n(t)}},_listeners:[]},Me=function(){function e(e,t){this.fileManagers=t||[],e=e||{};for(var i=[],n=i.concat(["encodeBase64","mimeLookup","charsetLookup","getSourceMapGenerator"]),r=0;r<n.length;r++){var s=n[r],o=e[s];o?this[s]=o.bind(e):r<i.length&&this.warn("missing required function in environment - "+s)}}return e.prototype.getFileManager=function(e,t,i,n,r){e||Ae.warn("getFileManager called with no filename.. Please report this issue. continuing."),null==t&&Ae.warn("getFileManager called with null directory.. Please report this issue. continuing.");var s=this.fileManagers;i.pluginManager&&(s=[].concat(s).concat(i.pluginManager.getFileManagers()));for(var o=s.length-1;o>=0;o--){var a=s[o];if(a[r?"supportsSync":"supports"](e,t,i,n))return a}return null},e.prototype.addFileManager=function(e){this.fileManagers.push(e)},e.prototype.clearFileManagers=function(){this.fileManagers=[]},e}(),Pe=function(){function e(){}return e.prototype.getPath=function(e){var t=e.lastIndexOf("?");return t>0&&(e=e.slice(0,t)),(t=e.lastIndexOf("/"))<0&&(t=e.lastIndexOf("\\")),t<0?"":e.slice(0,t+1)},e.prototype.tryAppendExtension=function(e,t){return/(\.[a-z]*$)|([\?;].*)$/.test(e)?e:e+t},e.prototype.tryAppendLessExtension=function(e){return this.tryAppendExtension(e,".less")},e.prototype.supportsSync=function(){return!1},e.prototype.alwaysMakePathsAbsolute=function(){return!1},e.prototype.isPathAbsolute=function(e){return/^(?:[a-z-]+:|\/|\\|#)/i.test(e)},e.prototype.join=function(e,t){return e?e+t:t},e.prototype.pathDiff=function(e,t){var i,n,r,s,o=this.extractUrlParts(e),a=this.extractUrlParts(t),l="";if(o.hostPart!==a.hostPart)return"";for(n=Math.max(a.directories.length,o.directories.length),i=0;i<n&&a.directories[i]===o.directories[i];i++);for(s=a.directories.slice(i),r=o.directories.slice(i),i=0;i<s.length-1;i++)l+="../";for(i=0;i<r.length-1;i++)l+=r[i]+"/";return l},e.prototype.extractUrlParts=function(e,t){var i,n,r=/^((?:[a-z-]+:)?\/{2}(?:[^\/\?#]*\/)|([\/\\]))?((?:[^\/\\\?#]*[\/\\])*)([^\/\\\?#]*)([#\?].*)?$/i,s=e.match(r),o={},a=[],l=[];if(!s)throw new Error("Could not parse sheet href - '"+e+"'");if(t&&(!s[1]||s[2])){if(!(n=t.match(r)))throw new Error("Could not parse page url - '"+t+"'");s[1]=s[1]||n[1]||"",s[2]||(s[3]=n[3]+s[3])}if(s[3])for(a=s[3].replace(/\\/g,"/").split("/"),i=0;i<a.length;i++)".."===a[i]?l.pop():"."!==a[i]&&l.push(a[i]);return o.hostPart=s[1],o.directories=l,o.rawPath=(s[1]||"")+a.join("/"),o.path=(s[1]||"")+l.join("/"),o.filename=s[4],o.fileUrl=o.path+(s[4]||""),o.url=o.fileUrl+(s[5]||""),o},e}(),Ee=function(){function e(){this.require=function(){return null}}return e.prototype.evalPlugin=function(e,t,i,n,r){var s,o,a,l,u,h;l=t.pluginManager,r&&(u="string"==typeof r?r:r.filename);var c=(new this.less.FileManager).extractUrlParts(u).filename;if(u&&(o=l.get(u))){if(h=this.trySetOptions(o,u,c,n))return h;try{o.use&&o.use.call(this.context,o)}catch(e){return e.message=e.message||"Error during @plugin call",new F(e,i,u)}return o}a={exports:{},pluginManager:l,fileInfo:r},s=Q.create();try{new Function("module","require","registerPlugin","functions","tree","less","fileInfo",e)(a,this.require(u),(function(e){o=e}),s,this.less.tree,this.less,r)}catch(e){return new F(e,i,u)}if(o||(o=a.exports),(o=this.validatePlugin(o,u,c))instanceof F)return o;if(!o)return new F({message:"Not a valid plugin"},i,u);if(o.imports=i,o.filename=u,(!o.minVersion||this.compareVersion("3.0.0",o.minVersion)<0)&&(h=this.trySetOptions(o,u,c,n)))return h;if(l.addPlugin(o,r.filename,s),o.functions=s.getLocalFunctions(),h=this.trySetOptions(o,u,c,n))return h;try{o.use&&o.use.call(this.context,o)}catch(e){return e.message=e.message||"Error during @plugin call",new F(e,i,u)}return o},e.prototype.trySetOptions=function(e,t,i,n){if(n&&!e.setOptions)return new F({message:"Options have been provided but the plugin "+i+" does not support any options."});try{e.setOptions&&e.setOptions(n)}catch(e){return new F(e)}},e.prototype.validatePlugin=function(e,t,i){return e?("function"==typeof e&&(e=new e),e.minVersion&&this.compareVersion(e.minVersion,this.less.version)<0?new F({message:"Plugin "+i+" requires version "+this.versionToString(e.minVersion)}):e):null},e.prototype.compareVersion=function(e,t){"string"==typeof e&&(e=e.match(/^(\d+)\.?(\d+)?\.?(\d+)?/)).shift();for(var i=0;i<e.length;i++)if(e[i]!==t[i])return parseInt(e[i])>parseInt(t[i])?-1:1;return 0},e.prototype.versionToString=function(e){for(var t="",i=0;i<e.length;i++)t+=(t?".":"")+e[i];return t},e.prototype.printUsage=function(e){for(var t=0;t<e.length;t++){var i=e[t];i.printUsage&&i.printUsage()}},e}(),Re={visitDeeper:!0},Ve=!1;function Fe(e){return e}var $e=function(){function e(e){this._implementation=e,this._visitInCache={},this._visitOutCache={},Ve||(!function e(t,i){var n,r;for(n in t)switch(typeof(r=t[n])){case"function":r.prototype&&r.prototype.type&&(r.prototype.typeIndex=i++);break;case"object":i=e(r,i)}return i}(_e,1),Ve=!0)}return e.prototype.visit=function(e){if(!e)return e;var t=e.typeIndex;if(!t)return e.value&&e.value.typeIndex&&this.visit(e.value),e;var i,n=this._implementation,r=this._visitInCache[t],s=this._visitOutCache[t],o=Re;if(o.visitDeeper=!0,r||(r=n[i="visit"+e.type]||Fe,s=n[i+"Out"]||Fe,this._visitInCache[t]=r,this._visitOutCache[t]=s),r!==Fe){var a=r.call(n,e,o);e&&n.isReplacing&&(e=a)}if(o.visitDeeper&&e)if(e.length)for(var l=0,u=e.length;l<u;l++)e[l].accept&&e[l].accept(this);else e.accept&&e.accept(this);return s!=Fe&&s.call(n,e),e},e.prototype.visitArray=function(e,t){if(!e)return e;var i,n=e.length;if(t||!this._implementation.isReplacing){for(i=0;i<n;i++)this.visit(e[i]);return e}var r=[];for(i=0;i<n;i++){var s=this.visit(e[i]);void 0!==s&&(s.splice?s.length&&this.flatten(s,r):r.push(s))}return r},e.prototype.flatten=function(e,t){var i,n,r,s,o,a;for(t||(t=[]),n=0,i=e.length;n<i;n++)if(void 0!==(r=e[n]))if(r.splice)for(o=0,s=r.length;o<s;o++)void 0!==(a=r[o])&&(a.splice?a.length&&this.flatten(a,t):t.push(a));else t.push(r);return t},e}(),Oe=function(){function e(e){this.imports=[],this.variableImports=[],this._onSequencerEmpty=e,this._currentDepth=0}return e.prototype.addImport=function(e){var t=this,i={callback:e,args:null,isReady:!1};return this.imports.push(i),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];i.args=Array.prototype.slice.call(e,0),i.isReady=!0,t.tryRun()}},e.prototype.addVariableImport=function(e){this.variableImports.push(e)},e.prototype.tryRun=function(){this._currentDepth++;try{for(;;){for(;this.imports.length>0;){var e=this.imports[0];if(!e.isReady)return;this.imports=this.imports.slice(1),e.callback.apply(null,e.args)}if(0===this.variableImports.length)break;var t=this.variableImports[0];this.variableImports=this.variableImports.slice(1),t()}}finally{this._currentDepth--}0===this._currentDepth&&this._onSequencerEmpty&&this._onSequencerEmpty()},e}(),Le=function(e,t){this._visitor=new $e(this),this._importer=e,this._finish=t,this.context=new T.Eval,this.importCount=0,this.onceFileDetectionMap={},this.recursionDetector={},this._sequencer=new Oe(this._onSequencerEmpty.bind(this))};Le.prototype={isReplacing:!1,run:function(e){try{this._visitor.visit(e)}catch(e){this.error=e}this.isFinished=!0,this._sequencer.tryRun()},_onSequencerEmpty:function(){this.isFinished&&this._finish(this.error)},visitImport:function(e,t){var i=e.options.inline;if(!e.css||i){var n=new T.Eval(this.context,_(this.context.frames)),r=n.frames[0];this.importCount++,e.isVariableImport()?this._sequencer.addVariableImport(this.processImportNode.bind(this,e,n,r)):this.processImportNode(e,n,r)}t.visitDeeper=!1},processImportNode:function(e,t,i){var n,r=e.options.inline;try{n=e.evalForImport(t)}catch(t){t.filename||(t.index=e.getIndex(),t.filename=e.fileInfo().filename),e.css=!0,e.error=t}if(!n||n.css&&!r)this.importCount--,this.isFinished&&this._sequencer.tryRun();else{n.options.multiple&&(t.importMultiple=!0);for(var s=void 0===n.css,o=0;o<i.rules.length;o++)if(i.rules[o]===e){i.rules[o]=n;break}var a=this.onImported.bind(this,n,t),l=this._sequencer.addImport(a);this._importer.push(n.getPath(),s,n.fileInfo(),n.options,l)}},onImported:function(e,t,i,n,r,s){i&&(i.filename||(i.index=e.getIndex(),i.filename=e.fileInfo().filename),this.error=i);var o=this,a=e.options.inline,l=e.options.isPlugin,u=e.options.optional,h=r||s in o.recursionDetector;if(t.importMultiple||(e.skip=!!h||function(){return s in o.onceFileDetectionMap||(o.onceFileDetectionMap[s]=!0,!1)}),!s&&u&&(e.skip=!0),n&&(e.root=n,e.importedFilename=s,!a&&!l&&(t.importMultiple||!h))){o.recursionDetector[s]=!0;var c=this.context;this.context=t;try{this._visitor.visit(n)}catch(i){this.error=i}this.context=c}o.importCount--,o.isFinished&&o._sequencer.tryRun()},visitDeclaration:function(e,t){"DetachedRuleset"===e.value.type?this.context.frames.unshift(e):t.visitDeeper=!1},visitDeclarationOut:function(e){"DetachedRuleset"===e.value.type&&this.context.frames.shift()},visitAtRule:function(e,t){this.context.frames.unshift(e)},visitAtRuleOut:function(e){this.context.frames.shift()},visitMixinDefinition:function(e,t){this.context.frames.unshift(e)},visitMixinDefinitionOut:function(e){this.context.frames.shift()},visitRuleset:function(e,t){this.context.frames.unshift(e)},visitRulesetOut:function(e){this.context.frames.shift()},visitMedia:function(e,t){this.context.frames.unshift(e.rules[0])},visitMediaOut:function(e){this.context.frames.shift()}};var Ne=function(){function e(e){this.visible=e}return e.prototype.run=function(e){this.visit(e)},e.prototype.visitArray=function(e){if(!e)return e;var t,i=e.length;for(t=0;t<i;t++)this.visit(e[t]);return e},e.prototype.visit=function(e){return e?e.constructor===Array?this.visitArray(e):(!e.blocksVisibility||e.blocksVisibility()||(this.visible?e.ensureVisibility():e.ensureInvisibility(),e.accept(this)),e):e},e}(),De=function(){function e(){this._visitor=new $e(this),this.contexts=[],this.allExtendsStack=[[]]}return e.prototype.run=function(e){return(e=this._visitor.visit(e)).allExtends=this.allExtendsStack[0],e},e.prototype.visitDeclaration=function(e,t){t.visitDeeper=!1},e.prototype.visitMixinDefinition=function(e,t){t.visitDeeper=!1},e.prototype.visitRuleset=function(e,t){if(!e.root){var i,n,r,s,o=[],a=e.rules,l=a?a.length:0;for(i=0;i<l;i++)e.rules[i]instanceof _e.Extend&&(o.push(a[i]),e.extendOnEveryPath=!0);var u=e.paths;for(i=0;i<u.length;i++){var h=u[i],c=h[h.length-1].extendList;for((s=c?_(c).concat(o):o)&&(s=s.map((function(e){return e.clone()}))),n=0;n<s.length;n++)this.foundExtends=!0,(r=s[n]).findSelfSelectors(h),r.ruleset=e,0===n&&(r.firstExtendOnThisSelectorPath=!0),this.allExtendsStack[this.allExtendsStack.length-1].push(r)}this.contexts.push(e.selectors)}},e.prototype.visitRulesetOut=function(e){e.root||(this.contexts.length=this.contexts.length-1)},e.prototype.visitMedia=function(e,t){e.allExtends=[],this.allExtendsStack.push(e.allExtends)},e.prototype.visitMediaOut=function(e){this.allExtendsStack.length=this.allExtendsStack.length-1},e.prototype.visitAtRule=function(e,t){e.allExtends=[],this.allExtendsStack.push(e.allExtends)},e.prototype.visitAtRuleOut=function(e){this.allExtendsStack.length=this.allExtendsStack.length-1},e}(),Be=function(){function e(){this._visitor=new $e(this)}return e.prototype.run=function(e){var t=new De;if(this.extendIndices={},t.run(e),!t.foundExtends)return e;e.allExtends=e.allExtends.concat(this.doExtendChaining(e.allExtends,e.allExtends)),this.allExtendsStack=[e.allExtends];var i=this._visitor.visit(e);return this.checkExtendsForNonMatched(e.allExtends),i},e.prototype.checkExtendsForNonMatched=function(e){var t=this.extendIndices;e.filter((function(e){return!e.hasFoundMatches&&1==e.parent_ids.length})).forEach((function(e){var i="_unknown_";try{i=e.selector.toCSS({})}catch(e){}t[e.index+" "+i]||(t[e.index+" "+i]=!0,Ae.warn("extend '"+i+"' has no matches"))}))},e.prototype.doExtendChaining=function(e,t,i){var n,r,s,o,a,l,u,h,c=[],f=this;for(i=i||0,n=0;n<e.length;n++)for(r=0;r<t.length;r++)l=e[n],u=t[r],l.parent_ids.indexOf(u.object_id)>=0||(a=[u.selfSelectors[0]],(s=f.findMatch(l,a)).length&&(l.hasFoundMatches=!0,l.selfSelectors.forEach((function(e){var t=u.visibilityInfo();o=f.extendSelector(s,a,e,l.isVisible()),(h=new _e.Extend(u.selector,u.option,0,u.fileInfo(),t)).selfSelectors=o,o[o.length-1].extendList=[h],c.push(h),h.ruleset=u.ruleset,h.parent_ids=h.parent_ids.concat(u.parent_ids,l.parent_ids),u.firstExtendOnThisSelectorPath&&(h.firstExtendOnThisSelectorPath=!0,u.ruleset.paths.push(o))}))));if(c.length){if(this.extendChainCount++,i>100){var p="{unable to calculate}",d="{unable to calculate}";try{p=c[0].selfSelectors[0].toCSS(),d=c[0].selector.toCSS()}catch(e){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+p+":extend("+d+")"}}return c.concat(f.doExtendChaining(c,t,i+1))}return c},e.prototype.visitDeclaration=function(e,t){t.visitDeeper=!1},e.prototype.visitMixinDefinition=function(e,t){t.visitDeeper=!1},e.prototype.visitSelector=function(e,t){t.visitDeeper=!1},e.prototype.visitRuleset=function(e,t){if(!e.root){var i,n,r,s,o=this.allExtendsStack[this.allExtendsStack.length-1],a=[],l=this;for(r=0;r<o.length;r++)for(n=0;n<e.paths.length;n++)if(s=e.paths[n],!e.extendOnEveryPath){var u=s[s.length-1].extendList;u&&u.length||(i=this.findMatch(o[r],s)).length&&(o[r].hasFoundMatches=!0,o[r].selfSelectors.forEach((function(e){var t;t=l.extendSelector(i,s,e,o[r].isVisible()),a.push(t)})))}e.paths=e.paths.concat(a)}},e.prototype.findMatch=function(e,t){var i,n,r,s,o,a,l,u=e.selector.elements,h=[],c=[];for(i=0;i<t.length;i++)for(n=t[i],r=0;r<n.elements.length;r++)for(s=n.elements[r],(e.allowBefore||0===i&&0===r)&&h.push({pathIndex:i,index:r,matched:0,initialCombinator:s.combinator}),a=0;a<h.length;a++)l=h[a],""===(o=s.combinator.value)&&0===r&&(o=" "),!this.isElementValuesEqual(u[l.matched].value,s.value)||l.matched>0&&u[l.matched].combinator.value!==o?l=null:l.matched++,l&&(l.finished=l.matched===u.length,l.finished&&!e.allowAfter&&(r+1<n.elements.length||i+1<t.length)&&(l=null)),l?l.finished&&(l.length=u.length,l.endPathIndex=i,l.endPathElementIndex=r+1,h.length=0,c.push(l)):(h.splice(a,1),a--);return c},e.prototype.isElementValuesEqual=function(e,t){if("string"==typeof e||"string"==typeof t)return e===t;if(e instanceof _e.Attribute)return e.op===t.op&&e.key===t.key&&(e.value&&t.value?(e=e.value.value||e.value)===(t=t.value.value||t.value):!e.value&&!t.value);if(e=e.value,t=t.value,e instanceof _e.Selector){if(!(t instanceof _e.Selector)||e.elements.length!==t.elements.length)return!1;for(var i=0;i<e.elements.length;i++){if(e.elements[i].combinator.value!==t.elements[i].combinator.value&&(0!==i||(e.elements[i].combinator.value||" ")!==(t.elements[i].combinator.value||" ")))return!1;if(!this.isElementValuesEqual(e.elements[i].value,t.elements[i].value))return!1}return!0}return!1},e.prototype.extendSelector=function(e,t,i,n){var r,s,o,a,l,u=0,h=0,c=[];for(r=0;r<e.length;r++)s=t[(a=e[r]).pathIndex],o=new _e.Element(a.initialCombinator,i.elements[0].value,i.elements[0].isVariable,i.elements[0].getIndex(),i.elements[0].fileInfo()),a.pathIndex>u&&h>0&&(c[c.length-1].elements=c[c.length-1].elements.concat(t[u].elements.slice(h)),h=0,u++),l=s.elements.slice(h,a.index).concat([o]).concat(i.elements.slice(1)),u===a.pathIndex&&r>0?c[c.length-1].elements=c[c.length-1].elements.concat(l):(c=c.concat(t.slice(u,a.pathIndex))).push(new _e.Selector(l)),u=a.endPathIndex,(h=a.endPathElementIndex)>=t[u].elements.length&&(h=0,u++);return u<t.length&&h>0&&(c[c.length-1].elements=c[c.length-1].elements.concat(t[u].elements.slice(h)),u++),c=(c=c.concat(t.slice(u,t.length))).map((function(e){var t=e.createDerived(e.elements);return n?t.ensureVisibility():t.ensureInvisibility(),t}))},e.prototype.visitMedia=function(e,t){var i=e.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);i=i.concat(this.doExtendChaining(i,e.allExtends)),this.allExtendsStack.push(i)},e.prototype.visitMediaOut=function(e){var t=this.allExtendsStack.length-1;this.allExtendsStack.length=t},e.prototype.visitAtRule=function(e,t){var i=e.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);i=i.concat(this.doExtendChaining(i,e.allExtends)),this.allExtendsStack.push(i)},e.prototype.visitAtRuleOut=function(e){var t=this.allExtendsStack.length-1;this.allExtendsStack.length=t},e}(),Ue=function(){function e(){this.contexts=[[]],this._visitor=new $e(this)}return e.prototype.run=function(e){return this._visitor.visit(e)},e.prototype.visitDeclaration=function(e,t){t.visitDeeper=!1},e.prototype.visitMixinDefinition=function(e,t){t.visitDeeper=!1},e.prototype.visitRuleset=function(e,t){var i,n=this.contexts[this.contexts.length-1],r=[];this.contexts.push(r),e.root||((i=e.selectors)&&(i=i.filter((function(e){return e.getIsOutput()})),e.selectors=i.length?i:i=null,i&&e.joinSelectors(r,n,i)),i||(e.rules=null),e.paths=r)},e.prototype.visitRulesetOut=function(e){this.contexts.length=this.contexts.length-1},e.prototype.visitMedia=function(e,t){var i=this.contexts[this.contexts.length-1];e.rules[0].root=0===i.length||i[0].multiMedia},e.prototype.visitAtRule=function(e,t){var i=this.contexts[this.contexts.length-1];e.rules&&e.rules.length&&(e.rules[0].root=e.isRooted||0===i.length||null)},e}(),je=function(){function e(e){this._visitor=new $e(this),this._context=e}return e.prototype.containsSilentNonBlockedChild=function(e){var t;if(!e)return!1;for(var i=0;i<e.length;i++)if((t=e[i]).isSilent&&t.isSilent(this._context)&&!t.blocksVisibility())return!0;return!1},e.prototype.keepOnlyVisibleChilds=function(e){e&&e.rules&&(e.rules=e.rules.filter((function(e){return e.isVisible()})))},e.prototype.isEmpty=function(e){return!e||!e.rules||0===e.rules.length},e.prototype.hasVisibleSelector=function(e){return!(!e||!e.paths)&&e.paths.length>0},e.prototype.resolveVisibility=function(e,t){if(!e.blocksVisibility()){if(this.isEmpty(e)&&!this.containsSilentNonBlockedChild(t))return;return e}var i=e.rules[0];if(this.keepOnlyVisibleChilds(i),!this.isEmpty(i))return e.ensureVisibility(),e.removeVisibilityBlock(),e},e.prototype.isVisibleRuleset=function(e){return!!e.firstRoot||!this.isEmpty(e)&&!(!e.root&&!this.hasVisibleSelector(e))},e}(),qe=function(e){this._visitor=new $e(this),this._context=e,this.utils=new je(e)};qe.prototype={isReplacing:!0,run:function(e){return this._visitor.visit(e)},visitDeclaration:function(e,t){if(!e.blocksVisibility()&&!e.variable)return e},visitMixinDefinition:function(e,t){e.frames=[]},visitExtend:function(e,t){},visitComment:function(e,t){if(!e.blocksVisibility()&&!e.isSilent(this._context))return e},visitMedia:function(e,t){var i=e.rules[0].rules;return e.accept(this._visitor),t.visitDeeper=!1,this.utils.resolveVisibility(e,i)},visitImport:function(e,t){if(!e.blocksVisibility())return e},visitAtRule:function(e,t){return e.rules&&e.rules.length?this.visitAtRuleWithBody(e,t):this.visitAtRuleWithoutBody(e,t)},visitAnonymous:function(e,t){if(!e.blocksVisibility())return e.accept(this._visitor),e},visitAtRuleWithBody:function(e,t){var i=function(e){var t=e.rules;return function(e){var t=e.rules;return 1===t.length&&(!t[0].paths||0===t[0].paths.length)}(e)?t[0].rules:t}(e);return e.accept(this._visitor),t.visitDeeper=!1,this.utils.isEmpty(e)||this._mergeRules(e.rules[0].rules),this.utils.resolveVisibility(e,i)},visitAtRuleWithoutBody:function(e,t){if(!e.blocksVisibility()){if("@charset"===e.name){if(this.charset){if(e.debugInfo){var i=new _e.Comment("/* "+e.toCSS(this._context).replace(/\n/g,"")+" */\n");return i.debugInfo=e.debugInfo,this._visitor.visit(i)}return}this.charset=!0}return e}},checkValidNodes:function(e,t){if(e)for(var i=0;i<e.length;i++){var n=e[i];if(t&&n instanceof _e.Declaration&&!n.variable)throw{message:"Properties must be inside selector blocks. They cannot be in the root",index:n.getIndex(),filename:n.fileInfo()&&n.fileInfo().filename};if(n instanceof _e.Call)throw{message:"Function '"+n.name+"' is undefined",index:n.getIndex(),filename:n.fileInfo()&&n.fileInfo().filename};if(n.type&&!n.allowRoot)throw{message:n.type+" node returned by a function is not valid here",index:n.getIndex(),filename:n.fileInfo()&&n.fileInfo().filename}}},visitRuleset:function(e,t){var i,n=[];if(this.checkValidNodes(e.rules,e.firstRoot),e.root)e.accept(this._visitor),t.visitDeeper=!1;else{this._compileRulesetPaths(e);for(var r=e.rules,s=r?r.length:0,o=0;o<s;)(i=r[o])&&i.rules?(n.push(this._visitor.visit(i)),r.splice(o,1),s--):o++;s>0?e.accept(this._visitor):e.rules=null,t.visitDeeper=!1}return e.rules&&(this._mergeRules(e.rules),this._removeDuplicateRules(e.rules)),this.utils.isVisibleRuleset(e)&&(e.ensureVisibility(),n.splice(0,0,e)),1===n.length?n[0]:n},_compileRulesetPaths:function(e){e.paths&&(e.paths=e.paths.filter((function(e){var t;for(" "===e[0].elements[0].combinator.value&&(e[0].elements[0].combinator=new _e.Combinator("")),t=0;t<e.length;t++)if(e[t].isVisible()&&e[t].getIsOutput())return!0;return!1})))},_removeDuplicateRules:function(e){if(e){var t,i,n,r={};for(n=e.length-1;n>=0;n--)if((i=e[n])instanceof _e.Declaration)if(r[i.name]){(t=r[i.name])instanceof _e.Declaration&&(t=r[i.name]=[r[i.name].toCSS(this._context)]);var s=i.toCSS(this._context);-1!==t.indexOf(s)?e.splice(n,1):t.push(s)}else r[i.name]=i}},_mergeRules:function(e){if(e){for(var t={},i=[],n=0;n<e.length;n++){var r=e[n];if(r.merge){var s=r.name;t[s]?e.splice(n--,1):i.push(t[s]=[]),t[s].push(r)}}i.forEach((function(e){if(e.length>0){var t=e[0],i=[],n=[new _e.Expression(i)];e.forEach((function(e){"+"===e.merge&&i.length>0&&n.push(new _e.Expression(i=[])),i.push(e.value),t.important=t.important||e.important})),t.value=new _e.Value(n)}}))}}};var Te={Visitor:$e,ImportVisitor:Le,MarkVisibleSelectorsVisitor:Ne,ExtendVisitor:Be,JoinSelectorVisitor:Ue,ToCSSVisitor:qe},ze=function(){var e,t,i,n,r,s,o,a=[],l={};function u(i){for(var n,a,h,c=l.i,f=t,p=l.i-o,d=l.i+s.length-p,v=l.i+=i,m=e;l.i<d;l.i++){if(n=m.charCodeAt(l.i),l.autoCommentAbsorb&&47===n){if("/"===(a=m.charAt(l.i+1))){h={index:l.i,isLineComment:!0};var g=m.indexOf("\n",l.i+2);g<0&&(g=d),l.i=g,h.text=m.substr(h.index,l.i-h.index),l.commentStore.push(h);continue}if("*"===a){var y=m.indexOf("*/",l.i+2);if(y>=0){h={index:l.i,text:m.substr(l.i,y+2-l.i),isLineComment:!1},l.i+=h.text.length-1,l.commentStore.push(h);continue}}break}if(32!==n&&10!==n&&9!==n&&13!==n)break}if(s=s.slice(i+l.i-v+p),o=l.i,!s.length){if(t<r.length-1)return s=r[++t],u(0),!0;l.finished=!0}return c!==l.i||f!==t}return l.save=function(){o=l.i,a.push({current:s,i:l.i,j:t})},l.restore=function(e){(l.i>i||l.i===i&&e&&!n)&&(i=l.i,n=e);var r=a.pop();s=r.current,o=l.i=r.i,t=r.j},l.forget=function(){a.pop()},l.isWhitespace=function(t){var i=l.i+(t||0),n=e.charCodeAt(i);return 32===n||13===n||9===n||10===n},l.$re=function(e){l.i>o&&(s=s.slice(l.i-o),o=l.i);var t=e.exec(s);return t?(u(t[0].length),"string"==typeof t?t:1===t.length?t[0]:t):null},l.$char=function(t){return e.charAt(l.i)!==t?null:(u(1),t)},l.$str=function(t){for(var i=t.length,n=0;n<i;n++)if(e.charAt(l.i+n)!==t.charAt(n))return null;return u(i),t},l.$quoted=function(t){var i=t||l.i,n=e.charAt(i);if("'"===n||'"'===n){for(var r=e.length,s=i,o=1;o+s<r;o++){switch(e.charAt(o+s)){case"\\":o++;continue;case"\r":case"\n":break;case n:var a=e.substr(s,o+1);return t||0===t?[n,a]:(u(o+1),a)}}return null}},l.$parseUntil=function(t){var i,n="",r=null,s=!1,o=0,a=[],h=[],c=e.length,f=l.i,p=l.i,d=l.i,v=!0;i="string"==typeof t?function(e){return e===t}:function(e){return t.test(e)};do{var m=e.charAt(d);if(0===o&&i(m))(r=e.substr(p,d-p))?h.push(r):h.push(" "),r=h,u(d-f),v=!1;else{if(s){"*"===m&&"/"===e.charAt(d+1)&&(d++,o--,s=!1),d++;continue}switch(m){case"\\":d++,m=e.charAt(d),h.push(e.substr(p,d-p+1)),p=d+1;break;case"/":"*"===e.charAt(d+1)&&(d++,s=!0,o++);break;case"'":case'"':(n=l.$quoted(d))?(h.push(e.substr(p,d-p),n),p=(d+=n[1].length-1)+1):(u(d-f),r=m,v=!1);break;case"{":a.push("}"),o++;break;case"(":a.push(")"),o++;break;case"[":a.push("]"),o++;break;case"}":case")":case"]":var g=a.pop();m===g?o--:(u(d-f),r=g,v=!1)}++d>c&&(v=!1)}}while(v);return r||null},l.autoCommentAbsorb=!0,l.commentStore=[],l.finished=!1,l.peek=function(t){if("string"==typeof t){for(var i=0;i<t.length;i++)if(e.charAt(l.i+i)!==t.charAt(i))return!1;return!0}return t.test(s)},l.peekChar=function(t){return e.charAt(l.i)===t},l.currentChar=function(){return e.charAt(l.i)},l.prevChar=function(){return e.charAt(l.i-1)},l.getInput=function(){return e},l.peekNotNumeric=function(){var t=e.charCodeAt(l.i);return t>57||t<43||47===t||44===t},l.start=function(n,a,h){e=n,l.i=t=o=i=0,r=a?function(e,t){var i,n,r,s,o,a,l,u,h,c=e.length,f=0,p=0,d=[],v=0;function m(t){var i=o-v;i<512&&!t||!i||(d.push(e.slice(v,o+1)),v=o+1)}for(o=0;o<c;o++)if(!((l=e.charCodeAt(o))>=97&&l<=122||l<34))switch(l){case 40:p++,n=o;continue;case 41:if(--p<0)return t("missing opening `(`",o);continue;case 59:p||m();continue;case 123:f++,i=o;continue;case 125:if(--f<0)return t("missing opening `{`",o);f||p||m();continue;case 92:if(o<c-1){o++;continue}return t("unescaped `\\`",o);case 34:case 39:case 96:for(h=0,a=o,o+=1;o<c;o++)if(!((u=e.charCodeAt(o))>96)){if(u==l){h=1;break}if(92==u){if(o==c-1)return t("unescaped `\\`",o);o++}}if(h)continue;return t("unmatched `"+String.fromCharCode(l)+"`",a);case 47:if(p||o==c-1)continue;if(47==(u=e.charCodeAt(o+1)))for(o+=2;o<c&&(!((u=e.charCodeAt(o))<=13)||10!=u&&13!=u);o++);else if(42==u){for(r=a=o,o+=2;o<c-1&&(125==(u=e.charCodeAt(o))&&(s=o),42!=u||47!=e.charCodeAt(o+1));o++);if(o==c-1)return t("missing closing `*/`",a);o++}continue;case 42:if(o<c-1&&47==e.charCodeAt(o+1))return t("unmatched `/*`",o);continue}return 0!==f?t(r>i&&s>r?"missing closing `}` or `*/`":"missing closing `}`",i):0!==p?t("missing closing `)`",n):(m(!0),d)}(n,h):[n],s=r[0],u(0)},l.end=function(){var t,r=l.i>=e.length;return l.i<i&&(t=n,l.i=i),{isFinished:r,furthest:l.i,furthestPossibleErrorMessage:t,furthestReachedEnd:l.i>=e.length-1,furthestChar:e[l.i]}},l},Ge=function e(t,i,n){var r,s=ze();function o(e,t){throw new F({index:s.i,filename:n.filename,type:t||"Syntax",message:e},i)}function a(e,t){var i=e instanceof Function?e.call(r):s.$re(e);if(i)return i;o(t||("string"==typeof e?"expected '"+e+"' got '"+s.currentChar()+"'":"unexpected token"))}function l(e,t){if(s.$char(e))return e;o(t||"expected '"+e+"' got '"+s.currentChar()+"'")}function u(e){var t=n.filename;return{lineNumber:k(e,s.getInput()).line+1,fileName:t}}return{parserInput:s,imports:i,fileInfo:n,parseNode:function(e,t,n,o,a){var l,u=[],h=s;try{h.start(e,!1,(function(e,t){a({message:e,index:t+n})}));for(var c=0,f=void 0,p=void 0;f=t[c];c++)if(p=h.i,l=r[f]()){try{l._index=p+n,l._fileInfo=o}catch(e){}u.push(l)}else u.push(null);h.end().isFinished?a(null,u):a(!0,null)}catch(e){throw new F({index:e.index+n,message:e.message},i,o.filename)}},parse:function(r,o,a){var l,u,h,c,f=null,p="";if(u=a&&a.globalVars?e.serializeVars(a.globalVars)+"\n":"",h=a&&a.modifyVars?"\n"+e.serializeVars(a.modifyVars):"",t.pluginManager)for(var d=t.pluginManager.getPreProcessors(),v=0;v<d.length;v++)r=d[v].process(r,{context:t,imports:i,fileInfo:n});(u||a&&a.banner)&&(p=(a&&a.banner?a.banner:"")+u,(c=i.contentsIgnoredChars)[n.filename]=c[n.filename]||0,c[n.filename]+=p.length),r=p+(r=r.replace(/\r\n?/g,"\n")).replace(/^\uFEFF/,"")+h,i.contents[n.filename]=r;try{s.start(r,t.chunkInput,(function(e,t){throw new F({index:t,type:"Parse",message:e,filename:n.filename},i)})),_e.Node.prototype.parse=this,l=new _e.Ruleset(null,this.parsers.primary()),_e.Node.prototype.rootNode=l,l.root=!0,l.firstRoot=!0,l.functionRegistry=Q.inherit()}catch(e){return o(new F(e,i,n.filename))}var m=s.end();if(!m.isFinished){var g=m.furthestPossibleErrorMessage;g||(g="Unrecognised input","}"===m.furthestChar?g+=". Possibly missing opening '{'":")"===m.furthestChar?g+=". Possibly missing opening '('":m.furthestReachedEnd&&(g+=". Possibly missing something")),f=new F({type:"Parse",message:g,index:m.furthest,filename:n.filename},i)}var y=function(e){return(e=f||e||i.error)?(e instanceof F||(e=new F(e,i,n.filename)),o(e)):o(null,l)};if(!1===t.processImports)return y();new Te.ImportVisitor(i,y).run(l)},parsers:r={primary:function(){for(var e,t=this.mixin,i=[];;){for(;e=this.comment();)i.push(e);if(s.finished)break;if(s.peek("}"))break;if(e=this.extendRule())i=i.concat(e);else if(e=t.definition()||this.declaration()||t.call(!1,!1)||this.ruleset()||this.variableCall()||this.entities.call()||this.atrule())i.push(e);else{for(var n=!1;s.$char(";");)n=!0;if(!n)break}}return i},comment:function(){if(s.commentStore.length){var e=s.commentStore.shift();return new _e.Comment(e.text,e.isLineComment,e.index,n)}},entities:{mixinLookup:function(){return r.mixin.call(!0,!0)},quoted:function(e){var t,i=s.i,r=!1;if(s.save(),s.$char("~"))r=!0;else if(e)return void s.restore();if(t=s.$quoted())return s.forget(),new _e.Quoted(t.charAt(0),t.substr(1,t.length-2),r,i,n);s.restore()},keyword:function(){var e=s.$char("%")||s.$re(/^\[?(?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+\]?/);if(e)return _e.Color.fromKeyword(e)||new _e.Keyword(e)},call:function(){var e,t,i,r=s.i;if(!s.peek(/^url\(/i))if(s.save(),e=s.$re(/^([\w-]+|%|progid:[\w\.]+)\(/)){if(e=e[1],(i=this.customFuncCall(e))&&(t=i.parse())&&i.stop)return s.forget(),t;if(t=this.arguments(t),s.$char(")"))return s.forget(),new _e.Call(e,t,r,n);s.restore("Could not parse call arguments or missing ')'")}else s.forget()},customFuncCall:function(e){return{alpha:t(r.ieAlpha,!0),boolean:t(i),if:t(i)}[e.toLowerCase()];function t(e,t){return{parse:e,stop:t}}function i(){return[a(r.condition,"expected condition")]}},arguments:function(e){var t,i,n=e||[],o=[];for(s.save();;){if(e)e=!1;else{if(!(i=r.detachedRuleset()||this.assignment()||r.expression()))break;i.value&&1==i.value.length&&(i=i.value[0]),n.push(i)}s.$char(",")||(s.$char(";")||t)&&(t=!0,i=n.length<1?n[0]:new _e.Value(n),o.push(i),n=[])}return s.forget(),t?o:n},literal:function(){return this.dimension()||this.color()||this.quoted()||this.unicodeDescriptor()},assignment:function(){var e,t;if(s.save(),e=s.$re(/^\w+(?=\s?=)/i))if(s.$char("=")){if(t=r.entity())return s.forget(),new _e.Assignment(e,t);s.restore()}else s.restore();else s.restore()},url:function(){var e,t=s.i;if(s.autoCommentAbsorb=!1,s.$str("url("))return e=this.quoted()||this.variable()||this.property()||s.$re(/^(?:(?:\\[\(\)'"])|[^\(\)'"])+/)||"",s.autoCommentAbsorb=!0,l(")"),new _e.URL(null!=e.value||e instanceof _e.Variable||e instanceof _e.Property?e:new _e.Anonymous(e,t),t,n);s.autoCommentAbsorb=!0},variable:function(){var e,t,i=s.i;if(s.save(),"@"===s.currentChar()&&(t=s.$re(/^@@?[\w-]+/))){if("("===(e=s.currentChar())||"["===e&&!s.prevChar().match(/^\s/)){var o=r.variableCall(t);if(o)return s.forget(),o}return s.forget(),new _e.Variable(t,i,n)}s.restore()},variableCurly:function(){var e,t=s.i;if("@"===s.currentChar()&&(e=s.$re(/^@\{([\w-]+)\}/)))return new _e.Variable("@"+e[1],t,n)},property:function(){var e,t=s.i;if("$"===s.currentChar()&&(e=s.$re(/^\$[\w-]+/)))return new _e.Property(e,t,n)},propertyCurly:function(){var e,t=s.i;if("$"===s.currentChar()&&(e=s.$re(/^\$\{([\w-]+)\}/)))return new _e.Property("$"+e[1],t,n)},color:function(){var e;if(s.save(),"#"===s.currentChar()&&(e=s.$re(/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3,4})([\w.#\[])?/))&&!e[2])return s.forget(),new _e.Color(e[1],void 0,e[0]);s.restore()},colorKeyword:function(){s.save();var e=s.autoCommentAbsorb;s.autoCommentAbsorb=!1;var t=s.$re(/^[_A-Za-z-][_A-Za-z0-9-]+/);if(s.autoCommentAbsorb=e,t){s.restore();var i=_e.Color.fromKeyword(t);return i?(s.$str(t),i):void 0}s.forget()},dimension:function(){if(!s.peekNotNumeric()){var e=s.$re(/^([+-]?\d*\.?\d+)(%|[a-z_]+)?/i);return e?new _e.Dimension(e[1],e[2]):void 0}},unicodeDescriptor:function(){var e;if(e=s.$re(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/))return new _e.UnicodeDescriptor(e[0])},javascript:function(){var e,t=s.i;s.save();var i=s.$char("~");if(s.$char("`")){if(e=s.$re(/^[^`]*`/))return s.forget(),new _e.JavaScript(e.substr(0,e.length-1),Boolean(i),t,n);s.restore("invalid javascript definition")}else s.restore()}},variable:function(){var e;if("@"===s.currentChar()&&(e=s.$re(/^(@[\w-]+)\s*:/)))return e[1]},variableCall:function(e){var t,i=s.i,o=!!e,a=e;if(s.save(),a||"@"===s.currentChar()&&(a=s.$re(/^(@[\w-]+)(\(\s*\))?/))){if(!(t=this.mixin.ruleLookups())&&(o&&"()"!==s.$str("()")||"()"!==a[2]))return void s.restore("Missing '[...]' lookup in variable call");o||(a=a[1]);var l=new _e.VariableCall(a,i,n);return!o&&r.end()?(s.forget(),l):(s.forget(),new _e.NamespaceValue(l,t,i,n))}s.restore()},extend:function(e){var t,i,r,l,u,h=s.i;if(s.$str(e?"&:extend(":":extend(")){do{for(r=null,t=null;!(r=s.$re(/^(all)(?=\s*(\)|,))/))&&(i=this.element());)t?t.push(i):t=[i];r=r&&r[1],t||o("Missing target selector for :extend()."),u=new _e.Extend(new _e.Selector(t),r,h,n),l?l.push(u):l=[u]}while(s.$char(","));return a(/^\)/),e&&a(/^;/),l}},extendRule:function(){return this.extend(!0)},mixin:{call:function(e,t){var i,o,a,u,h=s.currentChar(),c=!1,f=s.i;if("."===h||"#"===h){if(s.save(),o=this.elements()){if(s.$char("(")&&(a=this.args(!0).args,l(")"),u=!0),!1!==t&&(i=this.ruleLookups()),!0===t&&!i)return void s.restore();if(e&&!i&&!u)return void s.restore();if(!e&&r.important()&&(c=!0),e||r.end()){s.forget();var p=new _e.mixin.Call(o,a,f,n,!i&&c);return i?new _e.NamespaceValue(p,i):p}}s.restore()}},elements:function(){for(var e,t,i,r,o,a=/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/;o=s.i,t=s.$re(a);)r=new _e.Element(i,t,!1,o,n),e?e.push(r):e=[r],i=s.$char(">");return e},args:function(e){var t,i,n,a,l,u,h,c=r.entities,f={args:null,variadic:!1},p=[],d=[],v=[],m=!0;for(s.save();;){if(e)u=r.detachedRuleset()||r.expression();else{if(s.commentStore.length=0,s.$str("...")){f.variadic=!0,s.$char(";")&&!t&&(t=!0),(t?d:v).push({variadic:!0});break}u=c.variable()||c.property()||c.literal()||c.keyword()||this.call(!0)}if(!u||!m)break;a=null,u.throwAwayComments&&u.throwAwayComments(),l=u;var g=null;if(e?u.value&&1==u.value.length&&(g=u.value[0]):g=u,g&&(g instanceof _e.Variable||g instanceof _e.Property))if(s.$char(":")){if(p.length>0&&(t&&o("Cannot mix ; and , as delimiter types"),i=!0),!(l=r.detachedRuleset()||r.expression())){if(!e)return s.restore(),f.args=[],f;o("could not understand value for named argument")}a=n=g.name}else if(s.$str("...")){if(!e){f.variadic=!0,s.$char(";")&&!t&&(t=!0),(t?d:v).push({name:u.name,variadic:!0});break}h=!0}else e||(n=a=g.name,l=null);l&&p.push(l),v.push({name:a,value:l,expand:h}),s.$char(",")?m=!0:((m=";"===s.$char(";"))||t)&&(i&&o("Cannot mix ; and , as delimiter types"),t=!0,p.length>1&&(l=new _e.Value(p)),d.push({name:n,value:l,expand:h}),n=null,p=[],i=!1)}return s.forget(),f.args=t?d:v,f},definition:function(){var e,t,i,n,o=[],l=!1;if(!("."!==s.currentChar()&&"#"!==s.currentChar()||s.peek(/^[^{]*\}/)))if(s.save(),t=s.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){e=t[1];var u=this.args(!1);if(o=u.args,l=u.variadic,!s.$char(")"))return void s.restore("Missing closing ')'");if(s.commentStore.length=0,s.$str("when")&&(n=a(r.conditions,"expected condition")),i=r.block())return s.forget(),new _e.mixin.Definition(e,o,i,n,l);s.restore()}else s.restore()},ruleLookups:function(){var e,t=[];if("["===s.currentChar()){for(;;){if(s.save(),!(e=this.lookupValue())&&""!==e){s.restore();break}t.push(e),s.forget()}return t.length>0?t:void 0}},lookupValue:function(){if(s.save(),s.$char("[")){var e=s.$re(/^(?:[@$]{0,2})[_a-zA-Z0-9-]*/);if(s.$char("]"))return e||""===e?(s.forget(),e):void s.restore();s.restore()}else s.restore()}},entity:function(){var e=this.entities;return this.comment()||e.literal()||e.variable()||e.url()||e.property()||e.call()||e.keyword()||this.mixin.call(!0)||e.javascript()},end:function(){return s.$char(";")||s.peek("}")},ieAlpha:function(){var e;if(s.$re(/^opacity=/i))return(e=s.$re(/^\d+/))||(e="@{"+(e=a(r.entities.variable,"Could not parse alpha")).name.slice(1)+"}"),l(")"),new _e.Quoted("","alpha(opacity="+e+")")},element:function(){var e,t,i,r=s.i;if(t=this.combinator(),(e=s.$re(/^(?:\d+\.\d+|\d+)%/)||s.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||s.$char("*")||s.$char("&")||this.attribute()||s.$re(/^\([^&()@]+\)/)||s.$re(/^[\.#:](?=@)/)||this.entities.variableCurly())||(s.save(),s.$char("(")?(i=this.selector(!1))&&s.$char(")")?(e=new _e.Paren(i),s.forget()):s.restore("Missing closing ')'"):s.forget()),e)return new _e.Element(t,e,e instanceof _e.Variable,r,n)},combinator:function(){var e=s.currentChar();if("/"===e){s.save();var t=s.$re(/^\/[a-z]+\//i);if(t)return s.forget(),new _e.Combinator(t);s.restore()}if(">"===e||"+"===e||"~"===e||"|"===e||"^"===e){for(s.i++,"^"===e&&"^"===s.currentChar()&&(e="^^",s.i++);s.isWhitespace();)s.i++;return new _e.Combinator(e)}return s.isWhitespace(-1)?new _e.Combinator(" "):new _e.Combinator(null)},selector:function(e){var t,i,r,l,u,h,c,f=s.i;for(e=!1!==e;(e&&(i=this.extend())||e&&(h=s.$str("when"))||(l=this.element()))&&(h?c=a(this.conditions,"expected condition"):c?o("CSS guard can only be used at the end of selector"):i?u=u?u.concat(i):i:(u&&o("Extend can only be used at the end of selector"),r=s.currentChar(),t?t.push(l):t=[l],l=null),"{"!==r&&"}"!==r&&";"!==r&&","!==r&&")"!==r););if(t)return new _e.Selector(t,u,c,f,n);u&&o("Extend must be used to extend a selector, it cannot be used on its own")},selectors:function(){for(var e,t;(e=this.selector())&&(t?t.push(e):t=[e],s.commentStore.length=0,e.condition&&t.length>1&&o("Guards are only currently allowed on a single selector."),s.$char(","));)e.condition&&o("Guards are only currently allowed on a single selector."),s.commentStore.length=0;return t},attribute:function(){if(s.$char("[")){var e,t,i,n=this.entities;return(e=n.variableCurly())||(e=a(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),(i=s.$re(/^[|~*$^]?=/))&&(t=n.quoted()||s.$re(/^[0-9]+%/)||s.$re(/^[\w-]+/)||n.variableCurly()),l("]"),new _e.Attribute(e,i,t)}},block:function(){var e;if(s.$char("{")&&(e=this.primary())&&s.$char("}"))return e},blockRuleset:function(){var e=this.block();return e&&(e=new _e.Ruleset(null,e)),e},detachedRuleset:function(){var e,t,i;if(s.save(),!s.$re(/^[.#]\(/)||(t=(e=this.mixin.args(!1)).args,i=e.variadic,s.$char(")"))){var n=this.blockRuleset();if(n)return s.forget(),t?new _e.mixin.Definition(null,t,n,null,i):new _e.DetachedRuleset(n);s.restore()}else s.restore()},ruleset:function(){var e,i,n;if(s.save(),t.dumpLineNumbers&&(n=u(s.i)),(e=this.selectors())&&(i=this.block())){s.forget();var r=new _e.Ruleset(e,i,t.strictImports);return t.dumpLineNumbers&&(r.debugInfo=n),r}s.restore()},declaration:function(){var e,t,i,r,o,a,l=s.i,u=s.currentChar();if("."!==u&&"#"!==u&&"&"!==u&&":"!==u)if(s.save(),e=this.variable()||this.ruleProperty()){if((a="string"==typeof e)&&(t=this.detachedRuleset())&&(i=!0),s.commentStore.length=0,!t){if(o=!a&&e.length>1&&e.pop().value,t=e[0].value&&"--"===e[0].value.slice(0,2)?this.permissiveValue():this.anonymousValue())return s.forget(),new _e.Declaration(e,t,!1,o,l,n);t||(t=this.value()),t?r=this.important():a&&(t=this.permissiveValue())}if(t&&(this.end()||i))return s.forget(),new _e.Declaration(e,t,r,o,l,n);s.restore()}else s.restore()},anonymousValue:function(){var e=s.i,t=s.$re(/^([^.#@\$+\/'"*`(;{}-]*);/);if(t)return new _e.Anonymous(t[1],e)},permissiveValue:function(e){var t,i,r,a,l=e||";",u=s.i,h=[];function c(){var e=s.currentChar();return"string"==typeof l?e===l:l.test(e)}if(!c()){a=[];do{((i=this.comment())||(i=this.entity()))&&a.push(i)}while(i);if(r=c(),a.length>0){if(a=new _e.Expression(a),r)return a;h.push(a)," "===s.prevChar()&&h.push(new _e.Anonymous(" ",u))}if(s.save(),a=s.$parseUntil(l)){if("string"==typeof a&&o("Expected '"+a+"'","Parse"),1===a.length&&" "===a[0])return s.forget(),new _e.Anonymous("",u);var f=void 0;for(t=0;t<a.length;t++)if(f=a[t],Array.isArray(f))h.push(new _e.Quoted(f[0],f[1],!0,u,n));else{t===a.length-1&&(f=f.trim());var p=new _e.Quoted("'",f,!0,u,n);p.variableRegex=/@([\w-]+)/g,p.propRegex=/\$([\w-]+)/g,h.push(p)}return s.forget(),new _e.Expression(h,!0)}s.restore()}},import:function(){var e,t,i=s.i,r=s.$re(/^@import?\s+/);if(r){var a=(r?this.importOptions():null)||{};if(e=this.entities.quoted()||this.entities.url())return t=this.mediaFeatures(),s.$char(";")||(s.i=i,o("missing semi-colon or unrecognised media features on import")),t=t&&new _e.Value(t),new _e.Import(e,t,a,i,n);s.i=i,o("malformed import statement")}},importOptions:function(){var e,t,i,n={};if(!s.$char("("))return null;do{if(e=this.importOption()){switch(i=!0,t=e){case"css":t="less",i=!1;break;case"once":t="multiple",i=!1}if(n[t]=i,!s.$char(","))break}}while(e);return l(")"),n},importOption:function(){var e=s.$re(/^(less|css|multiple|once|inline|reference|optional)/);if(e)return e[1]},mediaFeature:function(){var e,t,i=this.entities,r=[];s.save();do{(e=i.keyword()||i.variable()||i.mixinLookup())?r.push(e):s.$char("(")&&(t=this.property(),e=this.value(),s.$char(")")?t&&e?r.push(new _e.Paren(new _e.Declaration(t,e,null,null,s.i,n,!0))):e?r.push(new _e.Paren(e)):o("badly formed media feature definition"):o("Missing closing ')'","Parse"))}while(e);if(s.forget(),r.length>0)return new _e.Expression(r)},mediaFeatures:function(){var e,t=this.entities,i=[];do{if(e=this.mediaFeature()){if(i.push(e),!s.$char(","))break}else if((e=t.variable()||t.mixinLookup())&&(i.push(e),!s.$char(",")))break}while(e);return i.length>0?i:null},media:function(){var e,i,r,a,l=s.i;if(t.dumpLineNumbers&&(a=u(l)),s.save(),s.$str("@media"))return e=this.mediaFeatures(),(i=this.block())||o("media definitions require block statements after any features"),s.forget(),r=new _e.Media(i,e,l,n),t.dumpLineNumbers&&(r.debugInfo=a),r;s.restore()},plugin:function(){var e,t,i,r=s.i;if(s.$re(/^@plugin?\s+/)){if(i=(t=this.pluginArgs())?{pluginArgs:t,isPlugin:!0}:{isPlugin:!0},e=this.entities.quoted()||this.entities.url())return s.$char(";")||(s.i=r,o("missing semi-colon on @plugin")),new _e.Import(e,null,i,r,n);s.i=r,o("malformed @plugin statement")}},pluginArgs:function(){if(s.save(),!s.$char("("))return s.restore(),null;var e=s.$re(/^\s*([^\);]+)\)\s*/);return e[1]?(s.forget(),e[1].trim()):(s.restore(),null)},atrule:function(){var e,i,r,a,l,h,c,f=s.i,p=!0,d=!0;if("@"===s.currentChar()){if(i=this.import()||this.plugin()||this.media())return i;if(s.save(),e=s.$re(/^@[a-z-]+/)){switch(a=e,"-"==e.charAt(1)&&e.indexOf("-",2)>0&&(a="@"+e.slice(e.indexOf("-",2)+1)),a){case"@charset":l=!0,p=!1;break;case"@namespace":h=!0,p=!1;break;case"@keyframes":case"@counter-style":l=!0;break;case"@document":case"@supports":c=!0,d=!1;break;default:c=!0}if(s.commentStore.length=0,l?(i=this.entity())||o("expected "+e+" identifier"):h?(i=this.expression())||o("expected "+e+" expression"):c&&(i=this.permissiveValue(/^[{;]/),p="{"===s.currentChar(),i?i.value||(i=null):p||";"===s.currentChar()||o(e+" rule is missing block or ending semi-colon")),p&&(r=this.blockRuleset()),r||!p&&i&&s.$char(";"))return s.forget(),new _e.AtRule(e,i,r,f,n,t.dumpLineNumbers?u(f):null,d);s.restore("at-rule options not recognised")}}},value:function(){var e,t=[],i=s.i;do{if((e=this.expression())&&(t.push(e),!s.$char(",")))break}while(e);if(t.length>0)return new _e.Value(t,i)},important:function(){if("!"===s.currentChar())return s.$re(/^! *important/)},sub:function(){var e,t;if(s.save(),s.$char("("))return(e=this.addition())&&s.$char(")")?(s.forget(),(t=new _e.Expression([e])).parens=!0,t):void s.restore("Expected ')'");s.restore()},multiplication:function(){var e,t,i,n,r;if(e=this.operand()){for(r=s.isWhitespace(-1);!s.peek(/^\/[*\/]/);){if(s.save(),!(i=s.$char("/")||s.$char("*")||s.$str("./"))){s.forget();break}if(!(t=this.operand())){s.restore();break}s.forget(),e.parensInOp=!0,t.parensInOp=!0,n=new _e.Operation(i,[n||e,t],r),r=s.isWhitespace(-1)}return n||e}},addition:function(){var e,t,i,n,r;if(e=this.multiplication()){for(r=s.isWhitespace(-1);(i=s.$re(/^[-+]\s+/)||!r&&(s.$char("+")||s.$char("-")))&&(t=this.multiplication());)e.parensInOp=!0,t.parensInOp=!0,n=new _e.Operation(i,[n||e,t],r),r=s.isWhitespace(-1);return n||e}},conditions:function(){var e,t,i,n=s.i;if(e=this.condition(!0)){for(;s.peek(/^,\s*(not\s*)?\(/)&&s.$char(",")&&(t=this.condition(!0));)i=new _e.Condition("or",i||e,t,n);return i||e}},condition:function(e){var t,i,n;if(t=this.conditionAnd(e)){if(i=s.$str("or")){if(!(n=this.condition(e)))return;t=new _e.Condition(i,t,n)}return t}},conditionAnd:function(e){var t,i,n,r,o=this;if(t=(r=o.negatedCondition(e)||o.parenthesisCondition(e))||e?r:o.atomicCondition(e)){if(i=s.$str("and")){if(!(n=this.conditionAnd(e)))return;t=new _e.Condition(i,t,n)}return t}},negatedCondition:function(e){if(s.$str("not")){var t=this.parenthesisCondition(e);return t&&(t.negate=!t.negate),t}},parenthesisCondition:function(e){var t;if(s.save(),s.$str("(")){if(t=function(t){var i;if(s.save(),i=t.condition(e)){if(s.$char(")"))return s.forget(),i;s.restore()}else s.restore()}(this))return s.forget(),t;if(t=this.atomicCondition(e)){if(s.$char(")"))return s.forget(),t;s.restore("expected ')' got '"+s.currentChar()+"'")}else s.restore()}else s.restore()},atomicCondition:function(e){var t,i,n,r,a=this.entities,l=s.i;function u(){return this.addition()||a.keyword()||a.quoted()||a.mixinLookup()}if(t=(u=u.bind(this))())return s.$char(">")?r=s.$char("=")?">=":">":s.$char("<")?r=s.$char("=")?"<=":"<":s.$char("=")&&(r=s.$char(">")?"=>":s.$char("<")?"=<":"="),r?(i=u())?n=new _e.Condition(r,t,i,l,!1):o("expected expression"):n=new _e.Condition("=",t,new _e.Keyword("true"),l,!1),n},operand:function(){var e,t=this.entities;s.peek(/^-[@\$\(]/)&&(e=s.$char("-"));var i=this.sub()||t.dimension()||t.color()||t.variable()||t.property()||t.call()||t.quoted(!0)||t.colorKeyword()||t.mixinLookup();return e&&(i.parensInOp=!0,i=new _e.Negative(i)),i},expression:function(){var e,t,i=[],n=s.i;do{(e=this.comment())?i.push(e):((e=this.addition()||this.entity())instanceof _e.Comment&&(e=null),e&&(i.push(e),s.peek(/^\/[\/*]/)||(t=s.$char("/"))&&i.push(new _e.Anonymous(t,n))))}while(e);if(i.length>0)return new _e.Expression(i)},property:function(){var e=s.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);if(e)return e[1]},ruleProperty:function(){var e,t,i=[],r=[];s.save();var o=s.$re(/^([_a-zA-Z0-9-]+)\s*:/);if(o)return i=[new _e.Keyword(o[1])],s.forget(),i;function a(e){var t=s.i,n=s.$re(e);if(n)return r.push(t),i.push(n[1])}for(a(/^(\*?)/);a(/^((?:[\w-]+)|(?:[@\$]\{[\w-]+\}))/););if(i.length>1&&a(/^((?:\+_|\+)?)\s*:/)){for(s.forget(),""===i[0]&&(i.shift(),r.shift()),t=0;t<i.length;t++)e=i[t],i[t]="@"!==e.charAt(0)&&"$"!==e.charAt(0)?new _e.Keyword(e):"@"===e.charAt(0)?new _e.Variable("@"+e.slice(2,-1),r[t],n):new _e.Property("$"+e.slice(2,-1),r[t],n);return i}s.restore()}}}};function We(e,t,i,n){return t.eval(e)?i.eval(e):n?n.eval(e):new D}Ge.serializeVars=function(e){var t="";for(var i in e)if(Object.hasOwnProperty.call(e,i)){var n=e[i];t+=("@"===i[0]?"":"@")+i+": "+n+(";"===String(n).slice(-1)?"":";")}return t},We.evalArgs=!1;var Je,He={boolean:function(e){return e?N.True:N.False},if:We};function Qe(e){return Math.min(1,Math.max(0,e))}function Ke(e,t){var i=Je.hsla(t.h,t.s,t.l,t.a);if(i)return e.value&&/^(rgb|hsl)/.test(e.value)?i.value=e.value:i.value="rgb",i}function Ze(e){if(e.toHSL)return e.toHSL();throw new Error("Argument cannot be evaluated to a color")}function Ye(e){if(e.toHSV)return e.toHSV();throw new Error("Argument cannot be evaluated to a color")}function Xe(e){if(e instanceof te)return parseFloat(e.unit.is("%")?e.value/100:e.value);if("number"==typeof e)return e;throw{type:"Argument",message:"color functions take numbers as parameters"}}var et=Je={rgb:function(e,t,i){var n=Je.rgba(e,t,i,1);if(n)return n.value="rgb",n},rgba:function(e,t,i,n){try{if(e instanceof c)return n=t?Xe(t):e.alpha,new c(e.rgb,n,"rgba");var r=[e,t,i].map((function(e){return i=255,(t=e)instanceof te&&t.unit.is("%")?parseFloat(t.value*i/100):Xe(t);var t,i}));return n=Xe(n),new c(r,n,"rgba")}catch(e){}},hsl:function(e,t,i){var n=Je.hsla(e,t,i,1);if(n)return n.value="hsl",n},hsla:function(e,t,i,n){try{if(e instanceof c)return n=t?Xe(t):e.alpha,new c(e.rgb,n,"hsla");var r,s;function o(e){return 6*(e=e<0?e+1:e>1?e-1:e)<1?r+(s-r)*e*6:2*e<1?s:3*e<2?r+(s-r)*(2/3-e)*6:r}e=Xe(e)%360/360,t=Qe(Xe(t)),i=Qe(Xe(i)),n=Qe(Xe(n)),r=2*i-(s=i<=.5?i*(t+1):i+t-i*t);var a=[255*o(e+1/3),255*o(e),255*o(e-1/3)];return n=Xe(n),new c(a,n,"hsla")}catch(e){}},hsv:function(e,t,i){return Je.hsva(e,t,i,1)},hsva:function(e,t,i,n){var r,s;e=Xe(e)%360/360*360,t=Xe(t),i=Xe(i),n=Xe(n);var o=[i,i*(1-t),i*(1-(s=e/60-(r=Math.floor(e/60%6)))*t),i*(1-(1-s)*t)],a=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return Je.rgba(255*o[a[r][0]],255*o[a[r][1]],255*o[a[r][2]],n)},hue:function(e){return new te(Ze(e).h)},saturation:function(e){return new te(100*Ze(e).s,"%")},lightness:function(e){return new te(100*Ze(e).l,"%")},hsvhue:function(e){return new te(Ye(e).h)},hsvsaturation:function(e){return new te(100*Ye(e).s,"%")},hsvvalue:function(e){return new te(100*Ye(e).v,"%")},red:function(e){return new te(e.rgb[0])},green:function(e){return new te(e.rgb[1])},blue:function(e){return new te(e.rgb[2])},alpha:function(e){return new te(Ze(e).a)},luma:function(e){return new te(e.luma()*e.alpha*100,"%")},luminance:function(e){var t=.2126*e.rgb[0]/255+.7152*e.rgb[1]/255+.0722*e.rgb[2]/255;return new te(t*e.alpha*100,"%")},saturate:function(e,t,i){if(!e.rgb)return null;var n=Ze(e);return void 0!==i&&"relative"===i.value?n.s+=n.s*t.value/100:n.s+=t.value/100,n.s=Qe(n.s),Ke(e,n)},desaturate:function(e,t,i){var n=Ze(e);return void 0!==i&&"relative"===i.value?n.s-=n.s*t.value/100:n.s-=t.value/100,n.s=Qe(n.s),Ke(e,n)},lighten:function(e,t,i){var n=Ze(e);return void 0!==i&&"relative"===i.value?n.l+=n.l*t.value/100:n.l+=t.value/100,n.l=Qe(n.l),Ke(e,n)},darken:function(e,t,i){var n=Ze(e);return void 0!==i&&"relative"===i.value?n.l-=n.l*t.value/100:n.l-=t.value/100,n.l=Qe(n.l),Ke(e,n)},fadein:function(e,t,i){var n=Ze(e);return void 0!==i&&"relative"===i.value?n.a+=n.a*t.value/100:n.a+=t.value/100,n.a=Qe(n.a),Ke(e,n)},fadeout:function(e,t,i){var n=Ze(e);return void 0!==i&&"relative"===i.value?n.a-=n.a*t.value/100:n.a-=t.value/100,n.a=Qe(n.a),Ke(e,n)},fade:function(e,t){var i=Ze(e);return i.a=t.value/100,i.a=Qe(i.a),Ke(e,i)},spin:function(e,t){var i=Ze(e),n=(i.h+t.value)%360;return i.h=n<0?360+n:n,Ke(e,i)},mix:function(e,t,i){i||(i=new te(50));var n=i.value/100,r=2*n-1,s=Ze(e).a-Ze(t).a,o=((r*s==-1?r:(r+s)/(1+r*s))+1)/2,a=1-o,l=[e.rgb[0]*o+t.rgb[0]*a,e.rgb[1]*o+t.rgb[1]*a,e.rgb[2]*o+t.rgb[2]*a],u=e.alpha*n+t.alpha*(1-n);return new c(l,u)},greyscale:function(e){return Je.desaturate(e,new te(100))},contrast:function(e,t,i,n){if(!e.rgb)return null;if(void 0===i&&(i=Je.rgba(255,255,255,1)),void 0===t&&(t=Je.rgba(0,0,0,1)),t.luma()>i.luma()){var r=i;i=t,t=r}return n=void 0===n?.43:Xe(n),e.luma()<n?i:t},argb:function(e){return new D(e.toARGB())},color:function(e){if(e instanceof ce&&/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3,4})$/i.test(e.value)){var t=e.value.slice(1);return new c(t,void 0,"#"+t)}if(e instanceof c||(e=c.fromKeyword(e.value)))return e.value=void 0,e;throw{type:"Argument",message:"argument must be a color keyword or 3|4|6|8 digit hex e.g. #FFF"}},tint:function(e,t){return Je.mix(Je.rgb(255,255,255),e,t)},shade:function(e,t){return Je.mix(Je.rgb(0,0,0),e,t)}};function tt(e,t,i){var n,r,s,o,a=t.alpha,l=i.alpha,u=[];s=l+a*(1-l);for(var h=0;h<3;h++)o=e(n=t.rgb[h]/255,r=i.rgb[h]/255),s&&(o=(l*r+a*(n-l*(n+r-o)))/s),u[h]=255*o;return new c(u,s)}var it={multiply:function(e,t){return e*t},screen:function(e,t){return e+t-e*t},overlay:function(e,t){return(e*=2)<=1?it.multiply(e,t):it.screen(e-1,t)},softlight:function(e,t){var i=1,n=e;return t>.5&&(n=1,i=e>.25?Math.sqrt(e):((16*e-12)*e+4)*e),e-(1-2*t)*n*(i-e)},hardlight:function(e,t){return it.overlay(t,e)},difference:function(e,t){return Math.abs(e-t)},exclusion:function(e,t){return e+t-2*e*t},average:function(e,t){return(e+t)/2},negation:function(e,t){return 1-Math.abs(e+t-1)}};for(var nt in it)it.hasOwnProperty(nt)&&(tt[nt]=tt.bind(null,it[nt]));var rt=function(e){return Array.isArray(e.value)?e.value:Array(e)},st={_SELF:function(e){return e},extract:function(e,t){return t=t.value-1,rt(e)[t]},length:function(e){return new te(rt(e).length)},range:function(e,t,i){var n,r,s=1,o=[];t?(r=t,n=e.value,i&&(s=i.value)):(n=1,r=e);for(var a=n;a<=r.value;a+=s)o.push(new te(a,r.unit));return new se(o)},each:function(e,t){var i,n,r=this,s=[],o=function(e){return e instanceof h?e.eval(r.context):e};n=!e.value||e instanceof ce?e.ruleset?o(e.ruleset).rules:e.rules?e.rules.map(o):Array.isArray(e)?e.map(o):[o(e)]:Array.isArray(e.value)?e.value.map(o):[o(e.value)];var a="@value",l="@key",u="@index";t.params?(a=t.params[0]&&t.params[0].name,l=t.params[1]&&t.params[1].name,u=t.params[2]&&t.params[2].name,t=t.rules):t=t.ruleset;for(var c=0;c<n.length;c++){var f=void 0,p=void 0,d=n[c];d instanceof U?(f="string"==typeof d.name?d.name:d.name[0].value,p=d.value):(f=new te(c+1),p=d),d instanceof q||(i=t.rules.slice(0),a&&i.push(new U(a,p,!1,!1,this.index,this.currentFileInfo)),u&&i.push(new U(u,new te(c+1),!1,!1,this.index,this.currentFileInfo)),l&&i.push(new U(l,f,!1,!1,this.index,this.currentFileInfo)),s.push(new Z([new O([new g("","&")])],i,t.strictImports,t.visibilityInfo())))}return new Z([new O([new g("","&")])],s,t.strictImports,t.visibilityInfo()).eval(this.context)}},ot=function(e,t,i){if(!(i instanceof te))throw{type:"Argument",message:"argument must be a number"};return null==t?t=i.unit:i=i.unify(),new te(e(parseFloat(i.value)),t)},at={ceil:null,floor:null,sqrt:null,abs:null,tan:"",sin:"",cos:"",atan:"rad",asin:"rad",acos:"rad"};for(var lt in at)at.hasOwnProperty(lt)&&(at[lt]=ot.bind(null,Math[lt],at[lt]));at.round=function(e,t){var i=void 0===t?0:t.value;return ot((function(e){return e.toFixed(i)}),null,e)};var ut=function(e,t){switch((t=Array.prototype.slice.call(t)).length){case 0:throw{type:"Argument",message:"one or more arguments required"}}var i,n,r,s,o,a,l,u,h=[],c={};for(i=0;i<t.length;i++)if((r=t[i])instanceof te)if(l=""!==(a=""===(s=""===r.unit.toString()&&void 0!==u?new te(r.value,u).unify():r.unify()).unit.toString()&&void 0!==l?l:s.unit.toString())&&void 0===l||""!==a&&""===h[0].unify().unit.toString()?a:l,u=""!==a&&void 0===u?r.unit.toString():u,void 0!==(n=void 0!==c[""]&&""!==a&&a===l?c[""]:c[a]))o=""===h[n].unit.toString()&&void 0!==u?new te(h[n].value,u).unify():h[n].unify(),(e&&s.value<o.value||!e&&s.value>o.value)&&(h[n]=r);else{if(void 0!==l&&a!==l)throw{type:"Argument",message:"incompatible types"};c[a]=h.length,h.push(r)}else Array.isArray(t[i].value)&&Array.prototype.push.apply(t,Array.prototype.slice.call(t[i].value));return 1==h.length?h[0]:(t=h.map((function(e){return e.toCSS(this.context)})).join(this.context.compress?",":", "),new D((e?"min":"max")+"("+t+")"))},ht={min:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ut(!0,e)},max:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ut(!1,e)},convert:function(e,t){return e.convertTo(t.value)},pi:function(){return new te(Math.PI)},mod:function(e,t){return new te(e.value%t.value,e.unit)},pow:function(e,t){if("number"==typeof e&&"number"==typeof t)e=new te(e),t=new te(t);else if(!(e instanceof te&&t instanceof te))throw{type:"Argument",message:"arguments must be numbers"};return new te(Math.pow(e.value,t.value),e.unit)},percentage:function(e){return ot((function(e){return 100*e}),"%",e)}},ct={e:function(e){return new ce('"',e instanceof me?e.evaluated:e.value,!0)},escape:function(e){return new D(encodeURI(e.value).replace(/=/g,"%3D").replace(/:/g,"%3A").replace(/#/g,"%23").replace(/;/g,"%3B").replace(/\(/g,"%28").replace(/\)/g,"%29"))},replace:function(e,t,i,n){var r=e.value;return i="Quoted"===i.type?i.value:i.toCSS(),r=r.replace(new RegExp(t.value,n?n.value:""),i),new ce(e.quote||"",r,e.escaped)},"%":function(e){for(var t=Array.prototype.slice.call(arguments,1),i=e.value,n=function(e){i=i.replace(/%[sda]/i,(function(i){var n="Quoted"===t[e].type&&i.match(/s/i)?t[e].value:t[e].toCSS();return i.match(/[A-Z]$/)?encodeURIComponent(n):n}))},r=0;r<t.length;r++)n(r);return i=i.replace(/%%/g,"%"),new ce(e.quote||"",i,e.escaped)}},ft=function(e,t){return e instanceof t?N.True:N.False},pt=function(e,t){if(void 0===t)throw{type:"Argument",message:"missing the required second argument to isunit."};if("string"!=typeof(t="string"==typeof t.value?t.value:t))throw{type:"Argument",message:"Second argument to isunit should be a unit or a string."};return e instanceof te&&e.unit.is(t)?N.True:N.False},dt={isruleset:function(e){return ft(e,X)},iscolor:function(e){return ft(e,c)},isnumber:function(e){return ft(e,te)},isstring:function(e){return ft(e,ce)},iskeyword:function(e){return ft(e,N)},isurl:function(e){return ft(e,fe)},ispixel:function(e){return pt(e,"px")},ispercentage:function(e){return pt(e,"%")},isem:function(e){return pt(e,"em")},isunit:pt,unit:function(e,t){if(!(e instanceof te))throw{type:"Argument",message:"the first argument to unit must be a number"+(e instanceof ne?". Have you forgotten parenthesis?":"")};return t=t?t instanceof N?t.value:t.toCSS():"",new te(e.value,t)},"get-unit":function(e){return new D(e.unit)}},vt=function(e){var t={functionRegistry:Q,functionCaller:oe};return Q.addMultiple(He),Q.add("default",K.eval.bind(K)),Q.addMultiple(et),Q.addMultiple(tt),Q.addMultiple(function(e){var t=function(e,t){return new fe(t,e.index,e.currentFileInfo).eval(e.context)};return{"data-uri":function(i,n){n||(n=i,i=null);var r=i&&i.value,s=n.value,o=this.currentFileInfo,a=o.rewriteUrls?o.currentDirectory:o.entryPath,l=s.indexOf("#"),u="";-1!==l&&(u=s.slice(l),s=s.slice(0,l));var h=A(this.context);h.rawBuffer=!0;var c=e.getFileManager(s,a,h,e,!0);if(!c)return t(this,n);var f=!1;if(i)f=/;base64$/.test(r);else{if("image/svg+xml"===(r=e.mimeLookup(s)))f=!1;else{var p=e.charsetLookup(r);f=["US-ASCII","UTF-8"].indexOf(p)<0}f&&(r+=";base64")}var d=c.loadFileSync(s,a,h,e);if(!d.contents)return Ae.warn("Skipped data-uri embedding of "+s+" because file not found"),t(this,n||i);var v=d.contents;if(f&&!e.encodeBase64)return t(this,n);var m="data:"+r+","+(v=f?e.encodeBase64(v):encodeURIComponent(v))+u;return new fe(new ce('"'+m+'"',m,!1,this.index,this.currentFileInfo),this.index,this.currentFileInfo)}}}(e)),Q.addMultiple(st),Q.addMultiple(at),Q.addMultiple(ht),Q.addMultiple(ct),Q.addMultiple({"svg-gradient":function(e){var t,i,n,r,s,o,a,l,u="linear",h='x="0" y="0" width="1" height="1"',f={compress:!1},p=e.toCSS(f);function d(){throw{type:"Argument",message:"svg-gradient expects direction, start_color [start_position], [color position,]..., end_color [end_position] or direction, color list"}}switch(2==arguments.length?(arguments[1].value.length<2&&d(),t=arguments[1].value):arguments.length<3?d():t=Array.prototype.slice.call(arguments,1),p){case"to bottom":i='x1="0%" y1="0%" x2="0%" y2="100%"';break;case"to right":i='x1="0%" y1="0%" x2="100%" y2="0%"';break;case"to bottom right":i='x1="0%" y1="0%" x2="100%" y2="100%"';break;case"to top right":i='x1="0%" y1="100%" x2="100%" y2="0%"';break;case"ellipse":case"ellipse at center":u="radial",i='cx="50%" cy="50%" r="75%"',h='x="-50" y="-50" width="101" height="101"';break;default:throw{type:"Argument",message:"svg-gradient direction must be 'to bottom', 'to right', 'to bottom right', 'to top right' or 'ellipse at center'"}}for(n='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1 1"><'+u+'Gradient id="g" '+i+">",r=0;r<t.length;r+=1)t[r]instanceof se?(s=t[r].value[0],o=t[r].value[1]):(s=t[r],o=void 0),s instanceof c&&((0===r||r+1===t.length)&&void 0===o||o instanceof te)||d(),a=o?o.toCSS(f):0===r?"0%":"100%",l=s.alpha,n+='<stop offset="'+a+'" stop-color="'+s.toRGB()+'"'+(l<1?' stop-opacity="'+l+'"':"")+"/>";return n+="</"+u+"Gradient><rect "+h+' fill="url(#g)" /></svg>',n=encodeURIComponent(n),new fe(new ce("'"+(n="data:image/svg+xml,"+n)+"'",n,!1,this.index,this.currentFileInfo),this.index,this.currentFileInfo)}}),Q.addMultiple(dt),t},mt=function(e,t){var i;void 0===t&&(t={});var n=t.variables,r=new T.Eval(t);"object"!=typeof n||Array.isArray(n)||(n=Object.keys(n).map((function(e){var t=n[e];return t instanceof _e.Value||(t instanceof _e.Expression||(t=new _e.Expression([t])),t=new _e.Value([t])),new _e.Declaration("@"+e,t,!1,null,0)})),r.frames=[new _e.Ruleset(null,n)]);var s,o,a=[new Te.JoinSelectorVisitor,new Te.MarkVisibleSelectorsVisitor(!0),new Te.ExtendVisitor,new Te.ToCSSVisitor({compress:Boolean(t.compress)})],l=[];if(t.pluginManager){o=t.pluginManager.visitor();for(var u=0;u<2;u++)for(o.first();s=o.get();)s.isPreEvalVisitor?0!==u&&-1!==l.indexOf(s)||(l.push(s),s.run(e)):0!==u&&-1!==a.indexOf(s)||(s.isPreVisitor?a.unshift(s):a.push(s))}i=e.eval(r);for(u=0;u<a.length;u++)a[u].run(i);if(t.pluginManager)for(o.first();s=o.get();)-1===a.indexOf(s)&&-1===l.indexOf(s)&&s.run(i);return i};var gt,yt=function(){function e(e){this.less=e,this.visitors=[],this.preProcessors=[],this.postProcessors=[],this.installedPlugins=[],this.fileManagers=[],this.iterator=-1,this.pluginCache={},this.Loader=new e.PluginLoader(e)}return e.prototype.addPlugins=function(e){if(e)for(var t=0;t<e.length;t++)this.addPlugin(e[t])},e.prototype.addPlugin=function(e,t,i){this.installedPlugins.push(e),t&&(this.pluginCache[t]=e),e.install&&e.install(this.less,this,i||this.less.functions.functionRegistry)},e.prototype.get=function(e){return this.pluginCache[e]},e.prototype.addVisitor=function(e){this.visitors.push(e)},e.prototype.addPreProcessor=function(e,t){var i;for(i=0;i<this.preProcessors.length&&!(this.preProcessors[i].priority>=t);i++);this.preProcessors.splice(i,0,{preProcessor:e,priority:t})},e.prototype.addPostProcessor=function(e,t){var i;for(i=0;i<this.postProcessors.length&&!(this.postProcessors[i].priority>=t);i++);this.postProcessors.splice(i,0,{postProcessor:e,priority:t})},e.prototype.addFileManager=function(e){this.fileManagers.push(e)},e.prototype.getPreProcessors=function(){for(var e=[],t=0;t<this.preProcessors.length;t++)e.push(this.preProcessors[t].preProcessor);return e},e.prototype.getPostProcessors=function(){for(var e=[],t=0;t<this.postProcessors.length;t++)e.push(this.postProcessors[t].postProcessor);return e},e.prototype.getVisitors=function(){return this.visitors},e.prototype.visitor=function(){var e=this;return{first:function(){return e.iterator=-1,e.visitors[e.iterator]},get:function(){return e.iterator+=1,e.visitors[e.iterator]}}},e.prototype.getFileManagers=function(){return this.fileManagers},e}();function bt(e,t){return!t&>||(gt=new yt(e)),gt}var wt,xt,St=function(e,t){var i,n=function(e){return function(){function t(t){this._css=[],this._rootNode=t.rootNode,this._contentsMap=t.contentsMap,this._contentsIgnoredCharsMap=t.contentsIgnoredCharsMap,t.sourceMapFilename&&(this._sourceMapFilename=t.sourceMapFilename.replace(/\\/g,"/")),this._outputFilename=t.outputFilename,this.sourceMapURL=t.sourceMapURL,t.sourceMapBasepath&&(this._sourceMapBasepath=t.sourceMapBasepath.replace(/\\/g,"/")),t.sourceMapRootpath?(this._sourceMapRootpath=t.sourceMapRootpath.replace(/\\/g,"/"),"/"!==this._sourceMapRootpath.charAt(this._sourceMapRootpath.length-1)&&(this._sourceMapRootpath+="/")):this._sourceMapRootpath="",this._outputSourceFiles=t.outputSourceFiles,this._sourceMapGeneratorConstructor=e.getSourceMapGenerator(),this._lineNumber=0,this._column=0}return t.prototype.removeBasepath=function(e){return this._sourceMapBasepath&&0===e.indexOf(this._sourceMapBasepath)&&("\\"!==(e=e.substring(this._sourceMapBasepath.length)).charAt(0)&&"/"!==e.charAt(0)||(e=e.substring(1))),e},t.prototype.normalizeFilename=function(e){return e=e.replace(/\\/g,"/"),e=this.removeBasepath(e),(this._sourceMapRootpath||"")+e},t.prototype.add=function(e,t,i,n){if(e){var r,s,o,a,l;if(t&&t.filename){var u=this._contentsMap[t.filename];if(this._contentsIgnoredCharsMap[t.filename]&&((i-=this._contentsIgnoredCharsMap[t.filename])<0&&(i=0),u=u.slice(this._contentsIgnoredCharsMap[t.filename])),void 0===u)return void this._css.push(e);a=(s=(u=u.substring(0,i)).split("\n"))[s.length-1]}if(o=(r=e.split("\n"))[r.length-1],t&&t.filename)if(n)for(l=0;l<r.length;l++)this._sourceMapGenerator.addMapping({generated:{line:this._lineNumber+l+1,column:0===l?this._column:0},original:{line:s.length+l,column:0===l?a.length:0},source:this.normalizeFilename(t.filename)});else this._sourceMapGenerator.addMapping({generated:{line:this._lineNumber+1,column:this._column},original:{line:s.length,column:a.length},source:this.normalizeFilename(t.filename)});1===r.length?this._column+=o.length:(this._lineNumber+=r.length-1,this._column=o.length),this._css.push(e)}},t.prototype.isEmpty=function(){return 0===this._css.length},t.prototype.toCSS=function(e){if(this._sourceMapGenerator=new this._sourceMapGeneratorConstructor({file:this._outputFilename,sourceRoot:null}),this._outputSourceFiles)for(var t in this._contentsMap)if(this._contentsMap.hasOwnProperty(t)){var i=this._contentsMap[t];this._contentsIgnoredCharsMap[t]&&(i=i.slice(this._contentsIgnoredCharsMap[t])),this._sourceMapGenerator.setSourceContent(this.normalizeFilename(t),i)}if(this._rootNode.genCSS(e,this),this._css.length>0){var n=void 0,r=JSON.stringify(this._sourceMapGenerator.toJSON());this.sourceMapURL?n=this.sourceMapURL:this._sourceMapFilename&&(n=this._sourceMapFilename),this.sourceMapURL=n,this.sourceMap=r}return this._css.join("")},t}()}(e=new Me(e,t)),r=function(e,t){return function(){function i(e){this.options=e}return i.prototype.toCSS=function(t,i,n){var r=new e({contentsIgnoredCharsMap:n.contentsIgnoredChars,rootNode:t,contentsMap:n.contents,sourceMapFilename:this.options.sourceMapFilename,sourceMapURL:this.options.sourceMapURL,outputFilename:this.options.sourceMapOutputFilename,sourceMapBasepath:this.options.sourceMapBasepath,sourceMapRootpath:this.options.sourceMapRootpath,outputSourceFiles:this.options.outputSourceFiles,sourceMapGenerator:this.options.sourceMapGenerator,sourceMapFileInline:this.options.sourceMapFileInline,disableSourcemapAnnotation:this.options.disableSourcemapAnnotation}),s=r.toCSS(i);return this.sourceMap=r.sourceMap,this.sourceMapURL=r.sourceMapURL,this.options.sourceMapInputFilename&&(this.sourceMapInputFilename=r.normalizeFilename(this.options.sourceMapInputFilename)),void 0!==this.options.sourceMapBasepath&&void 0!==this.sourceMapURL&&(this.sourceMapURL=r.removeBasepath(this.sourceMapURL)),s+this.getCSSAppendage()},i.prototype.getCSSAppendage=function(){var e=this.sourceMapURL;if(this.options.sourceMapFileInline){if(void 0===this.sourceMap)return"";e="data:application/json;base64,"+t.encodeBase64(this.sourceMap)}return this.options.disableSourcemapAnnotation?"":e?"/*# sourceMappingURL="+e+" */":""},i.prototype.getExternalSourceMap=function(){return this.sourceMap},i.prototype.setExternalSourceMap=function(e){this.sourceMap=e},i.prototype.isInline=function(){return this.options.sourceMapFileInline},i.prototype.getSourceMapURL=function(){return this.sourceMapURL},i.prototype.getOutputFilename=function(){return this.options.sourceMapOutputFilename},i.prototype.getInputFilename=function(){return this.sourceMapInputFilename},i}()}(n,e),s=function(e){return function(){function t(e,t){this.root=e,this.imports=t}return t.prototype.toCSS=function(t){var i,n,r={};try{i=mt(this.root,t)}catch(e){throw new F(e,this.imports)}try{var s=Boolean(t.compress);s&&Ae.warn("The compress option has been deprecated. We recommend you use a dedicated css minifier, for instance see less-plugin-clean-css.");var o={compress:s,dumpLineNumbers:t.dumpLineNumbers,strictUnits:Boolean(t.strictUnits),numPrecision:8};t.sourceMap?(n=new e(t.sourceMap),r.css=n.toCSS(i,o,this.imports)):r.css=i.toCSS(o)}catch(e){throw new F(e,this.imports)}if(t.pluginManager)for(var a=t.pluginManager.getPostProcessors(),l=0;l<a.length;l++)r.css=a[l].process(r.css,{sourceMap:n,options:t,imports:this.imports});for(var u in t.sourceMap&&(r.map=n.getExternalSourceMap()),r.imports=[],this.imports.files)this.imports.files.hasOwnProperty(u)&&u!==this.imports.rootFilename&&r.imports.push(u);return r},t}()}(r),a=function(e){return function(){function t(e,t,i){this.less=e,this.rootFilename=i.filename,this.paths=t.paths||[],this.contents={},this.contentsIgnoredChars={},this.mime=t.mime,this.error=null,this.context=t,this.queue=[],this.files={}}return t.prototype.push=function(t,i,n,r,s){var o=this,a=this.context.pluginManager.Loader;this.queue.push(t);var l=function(e,i,n){o.queue.splice(o.queue.indexOf(t),1);var a=n===o.rootFilename;r.optional&&e?(s(null,{rules:[]},!1,null),Ae.info("The file "+n+" was skipped because it was not found and the import was marked optional.")):(o.files[n]||r.inline||(o.files[n]={root:i,options:r}),e&&!o.error&&(o.error=e),s(e,i,a,n))},u={rewriteUrls:this.context.rewriteUrls,entryPath:n.entryPath,rootpath:n.rootpath,rootFilename:n.rootFilename},h=e.getFileManager(t,n.currentDirectory,this.context,e);if(h){var c,f,p=function(e){var t,i=e.filename,s=e.contents.replace(/^\uFEFF/,"");u.currentDirectory=h.getPath(i),u.rewriteUrls&&(u.rootpath=h.join(o.context.rootpath||"",h.pathDiff(u.currentDirectory,u.entryPath)),!h.isPathAbsolute(u.rootpath)&&h.alwaysMakePathsAbsolute()&&(u.rootpath=h.join(u.entryPath,u.rootpath))),u.filename=i;var c=new T.Parse(o.context);c.processImports=!1,o.contents[i]=s,(n.reference||r.reference)&&(u.reference=!0),r.isPlugin?(t=a.evalPlugin(s,c,o,r.pluginArgs,u))instanceof F?l(t,null,i):l(null,t,i):r.inline?l(null,s,i):!o.files[i]||o.files[i].options.multiple||r.multiple?new Ge(c,o,u).parse(s,(function(e,t){l(e,t,i)})):l(null,o.files[i].root,i)},d=A(this.context);i&&(d.ext=r.isPlugin?".js":".less"),r.isPlugin?(d.mime="application/javascript",d.syncImport?c=a.loadPluginSync(t,n.currentDirectory,d,e,h):f=a.loadPlugin(t,n.currentDirectory,d,e,h)):d.syncImport?c=h.loadFileSync(t,n.currentDirectory,d,e):f=h.loadFile(t,n.currentDirectory,d,e,(function(e,t){e?l(e):p(t)})),c?c.filename?p(c):l(c):f&&f.then(p,l)}else l({message:"Could not find a file-manager for "+t})},t}()}(e),l=function(e,t,i){var n=function(e,i,r){if("function"==typeof i?(r=i,i=P(this.options,{})):i=P(this.options,i||{}),!r){var s=this;return new Promise((function(t,r){n.call(s,e,i,(function(e,i){e?r(e):t(i)}))}))}this.parse(e,i,(function(e,i,n,s){if(e)return r(e);var o;try{o=new t(i,n).toCSS(s)}catch(e){return r(e)}r(null,o)}))};return n}(0,s),h=function(e,t,i){var n=function(e,t,r){if("function"==typeof t?(r=t,t=P(this.options,{})):t=P(this.options,t||{}),!r){var s=this;return new Promise((function(i,r){n.call(s,e,t,(function(e,t){e?r(e):i(t)}))}))}var o,a=void 0,l=new bt(this,!t.reUsePluginManager);if(t.pluginManager=l,o=new T.Parse(t),t.rootFileInfo)a=t.rootFileInfo;else{var u=t.filename||"input",h=u.replace(/[^\/\\]*$/,"");(a={filename:u,rewriteUrls:o.rewriteUrls,rootpath:o.rootpath||"",currentDirectory:h,entryPath:h,rootFilename:u}).rootpath&&"/"!==a.rootpath.slice(-1)&&(a.rootpath+="/")}var c=new i(this,o,a);this.importManager=c,t.plugins&&t.plugins.forEach((function(e){var t,i;if(e.fileContent){if(i=e.fileContent.replace(/^\uFEFF/,""),(t=l.Loader.evalPlugin(i,o,c,e.options,e.filename))instanceof F)return r(t)}else l.addPlugin(e)})),new Ge(o,c,a).parse(e,(function(e,i){if(e)return r(e);r(null,i,c,t)}),t)};return n}(0,0,a),c=vt(e),f={version:[3,13,1],data:u,tree:_e,Environment:Me,AbstractFileManager:Pe,AbstractPluginLoader:Ee,environment:e,visitors:Te,Parser:Ge,functions:c,contexts:T,SourceMapOutput:n,SourceMapBuilder:r,ParseTree:s,ImportManager:a,render:l,parse:h,LessError:F,transformTree:mt,utils:R,PluginManager:bt,logger:Ae},p=function(e){return function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return new(e.bind.apply(e,o([void 0],t)))}},d=Object.create(f);for(var v in f.tree)if("function"==typeof(i=f.tree[v]))d[v.toLowerCase()]=p(i);else for(var m in d[v]=Object.create(null),i)d[v][m.toLowerCase()]=p(i[m]);return f.parse=f.parse.bind(d),f.render=f.render.bind(d),d},It={},Ct=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return s(t,e),t.prototype.alwaysMakePathsAbsolute=function(){return!0},t.prototype.join=function(e,t){return e?this.extractUrlParts(t,e).path:t},t.prototype.doXHR=function(e,t,i,n){var r=new XMLHttpRequest,s=!wt.isFileProtocol||wt.fileAsync;function o(t,i,n){t.status>=200&&t.status<300?i(t.responseText,t.getResponseHeader("Last-Modified")):"function"==typeof n&&n(t.status,e)}"function"==typeof r.overrideMimeType&&r.overrideMimeType("text/css"),xt.debug("XHR: Getting '"+e+"'"),r.open("GET",e,s),r.setRequestHeader("Accept",t||"text/x-less, text/css; q=0.9, */*; q=0.5"),r.send(null),wt.isFileProtocol&&!wt.fileAsync?0===r.status||r.status>=200&&r.status<300?i(r.responseText):n(r.status,e):s?r.onreadystatechange=function(){4==r.readyState&&o(r,i,n)}:o(r,i,n)},t.prototype.supports=function(){return!0},t.prototype.clearFileCache=function(){It={}},t.prototype.loadFile=function(e,t,i,n){t&&!this.isPathAbsolute(e)&&(e=t+e),e=i.ext?this.tryAppendExtension(e,i.ext):e,i=i||{};var r=this.extractUrlParts(e,window.location.href).url,s=this;return new Promise((function(e,t){if(i.useFileCache&&It[r])try{var n=It[r];return e({contents:n,filename:r,webInfo:{lastModified:new Date}})}catch(e){return t({filename:r,message:"Error loading file "+r+" error was "+e.message})}s.doXHR(r,i.mime,(function(t,i){It[r]=t,e({contents:t,filename:r,webInfo:{lastModified:i}})}),(function(e,i){t({type:"File",message:"'"+i+"' wasn't found ("+e+")",href:r})}))}))},t}(Pe),kt=function(e,t){return wt=e,xt=t,Ct},_t=function(e){function t(t){var i=e.call(this)||this;return i.less=t,i}return s(t,e),t.prototype.loadPlugin=function(e,t,i,n,r){return new Promise((function(s,o){r.loadFile(e,t,i,n).then(s).catch(o)}))},t}(Ee),At=function(t,n,r){return{add:function(s,o){r.errorReporting&&"html"!==r.errorReporting?"console"===r.errorReporting?function(e,t){var i=e.filename||t,s=[],o=(e.type||"Syntax")+"Error: "+(e.message||"There is an error in your .less file")+" in "+i,a=function(e,t,i){void 0!==e.extract[t]&&s.push("{line} {content}".replace(/\{line\}/,(parseInt(e.line,10)||0)+(t-1)).replace(/\{class\}/,i).replace(/\{content\}/,e.extract[t]))};e.line&&(a(e,0,""),a(e,1,"line"),a(e,2,""),o+=" on line "+e.line+", column "+(e.column+1)+":\n"+s.join("\n")),e.stack&&(e.extract||r.logLevel>=4)&&(o+="\nStack Trace\n"+e.stack),n.logger.error(o)}(s,o):"function"==typeof r.errorReporting&&r.errorReporting("add",s,o):function(n,s){var o,a,l="less-error-message:"+e(s||""),u=t.document.createElement("div"),h=[],c=n.filename||s,f=c.match(/([^\/]+(\?.*)?)$/)[1];u.id=l,u.className="less-error-message",a="<h3>"+(n.type||"Syntax")+"Error: "+(n.message||"There is an error in your .less file")+'</h3><p>in <a href="'+c+'">'+f+"</a> ";var p=function(e,t,i){void 0!==e.extract[t]&&h.push('<li><label>{line}</label><pre class="{class}">{content}</pre></li>'.replace(/\{line\}/,(parseInt(e.line,10)||0)+(t-1)).replace(/\{class\}/,i).replace(/\{content\}/,e.extract[t]))};n.line&&(p(n,0,""),p(n,1,"line"),p(n,2,""),a+="on line "+n.line+", column "+(n.column+1)+":</p><ul>"+h.join("")+"</ul>"),n.stack&&(n.extract||r.logLevel>=4)&&(a+="<br/>Stack Trace</br />"+n.stack.split("\n").slice(1).join("<br/>")),u.innerHTML=a,i(t.document,[".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),u.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),"development"===r.env&&(o=setInterval((function(){var e=t.document,i=e.body;i&&(e.getElementById(l)?i.replaceChild(u,e.getElementById(l)):i.insertBefore(u,i.firstChild),clearInterval(o))}),10))}(s,o)},remove:function(i){r.errorReporting&&"html"!==r.errorReporting?"console"===r.errorReporting||"function"==typeof r.errorReporting&&r.errorReporting("remove",i):function(i){var n=t.document.getElementById("less-error-message:"+e(i));n&&n.parentNode.removeChild(n)}(i)}}},Mt={javascriptEnabled:!1,depends:!1,compress:!1,lint:!1,paths:[],color:!0,strictImports:!1,insecure:!1,rootpath:"",rewriteUrls:!1,math:0,strictUnits:!1,globalVars:null,modifyVars:null,urlArgs:""};if(window.less)for(var Pt in window.less)window.less.hasOwnProperty(Pt)&&(Mt[Pt]=window.less[Pt]);!function(e,i){t(i,n(e)),void 0===i.isFileProtocol&&(i.isFileProtocol=/^(file|(chrome|safari)(-extension)?|resource|qrc|app):/.test(e.location.protocol)),i.async=i.async||!1,i.fileAsync=i.fileAsync||!1,i.poll=i.poll||(i.isFileProtocol?1e3:1500),i.env=i.env||("127.0.0.1"==e.location.hostname||"0.0.0.0"==e.location.hostname||"localhost"==e.location.hostname||e.location.port&&e.location.port.length>0||i.isFileProtocol?"development":"production");var r=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(e.location.hash);r&&(i.dumpLineNumbers=r[1]),void 0===i.useFileCache&&(i.useFileCache=!0),void 0===i.onReady&&(i.onReady=!0),i.relativeUrls&&(i.rewriteUrls="all")}(window,Mt),Mt.plugins=Mt.plugins||[],window.LESS_PLUGINS&&(Mt.plugins=Mt.plugins.concat(window.LESS_PLUGINS));var Et,Rt,Vt,Ft=function(e,n){var r=e.document,s=St();s.options=n;var o=s.environment,a=kt(n,s.logger),l=new a;o.addFileManager(l),s.FileManager=a,s.PluginLoader=_t,function(e,t){t.logLevel=void 0!==t.logLevel?t.logLevel:"development"===t.env?3:1,t.loggers||(t.loggers=[{debug:function(e){t.logLevel>=4&&console.log(e)},info:function(e){t.logLevel>=3&&console.log(e)},warn:function(e){t.logLevel>=2&&console.warn(e)},error:function(e){t.logLevel>=1&&console.error(e)}}]);for(var i=0;i<t.loggers.length;i++)e.logger.addListener(t.loggers[i])}(s,n);var u=At(e,s,n),h=s.cache=n.cache||function(e,t,i){var n=null;if("development"!==t.env)try{n=void 0===e.localStorage?null:e.localStorage}catch(e){}return{setCSS:function(e,t,r,s){if(n){i.info("saving "+e+" to cache.");try{n.setItem(e,s),n.setItem(e+":timestamp",t),r&&n.setItem(e+":vars",JSON.stringify(r))}catch(t){i.error('failed to save "'+e+'" to local storage for caching.')}}},getCSS:function(e,t,i){var r=n&&n.getItem(e),s=n&&n.getItem(e+":timestamp"),o=n&&n.getItem(e+":vars");if(i=i||{},o=o||"{}",s&&t.lastModified&&new Date(t.lastModified).valueOf()===new Date(s).valueOf()&&JSON.stringify(i)===o)return r}}}(e,n,s.logger);!function(){function e(){throw{type:"Runtime",message:"Image size functions are not supported in browser version of less"}}var t={"image-size":function(t){return e(),-1},"image-width":function(t){return e(),-1},"image-height":function(t){return e(),-1}};Q.addMultiple(t)}(s.environment),n.functions&&s.functions.functionRegistry.addMultiple(n.functions);var c=/^text\/(x-)?less$/;function f(e){var t={};for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t}function p(e,t){var i=Array.prototype.slice.call(arguments,2);return function(){var n=i.concat(Array.prototype.slice.call(arguments,0));return e.apply(t,n)}}function d(e){for(var t,i=r.getElementsByTagName("style"),o=0;o<i.length;o++)if((t=i[o]).type.match(c)){var a=f(n);a.modifyVars=e;var l=t.innerHTML||"";a.filename=r.location.href.replace(/#.*$/,""),s.render(l,a,p((function(e,t,i){t?u.add(t,"inline"):(e.type="text/css",e.styleSheet?e.styleSheet.cssText=i.css:e.innerHTML=i.css)}),null,t))}}function v(e,i,r,a,c){var p=f(n);t(p,e),p.mime=e.type,c&&(p.modifyVars=c),l.loadFile(e.href,null,p,o).then((function(t){!function(t){var n=t.contents,o=t.filename,c=t.webInfo,f={currentDirectory:l.getPath(o),filename:o,rootFilename:o,rewriteUrls:p.rewriteUrls};if(f.entryPath=f.currentDirectory,f.rootpath=p.rootpath||f.currentDirectory,c){c.remaining=a;var d=h.getCSS(o,c,p.modifyVars);if(!r&&d)return c.local=!0,void i(null,d,n,e,c,o)}u.remove(o),p.rootFileInfo=f,s.render(n,p,(function(t,r){t?(t.href=o,i(t)):(h.setCSS(e.href,c.lastModified,p.modifyVars,r.css),i(null,r.css,n,e,c,o))}))}(t)})).catch((function(e){console.log(e),i(e)}))}function m(e,t,i){for(var n=0;n<s.sheets.length;n++)v(s.sheets[n],e,t,s.sheets.length-(n+1),i)}return s.watch=function(){return s.watchMode||(s.env="development","development"===s.env&&(s.watchTimer=setInterval((function(){s.watchMode&&(l.clearFileCache(),m((function(t,n,r,s,o){t?u.add(t,t.href||s.href):n&&i(e.document,n,s)})))}),n.poll))),this.watchMode=!0,!0},s.unwatch=function(){return clearInterval(s.watchTimer),this.watchMode=!1,!1},s.registerStylesheetsImmediately=function(){var e=r.getElementsByTagName("link");s.sheets=[];for(var t=0;t<e.length;t++)("stylesheet/less"===e[t].rel||e[t].rel.match(/stylesheet/)&&e[t].type.match(c))&&s.sheets.push(e[t])},s.registerStylesheets=function(){return new Promise((function(e,t){s.registerStylesheetsImmediately(),e()}))},s.modifyVars=function(e){return s.refresh(!0,e,!1)},s.refresh=function(t,n,r){return(t||r)&&!1!==r&&l.clearFileCache(),new Promise((function(r,o){var a,l,h,c;a=l=new Date,0===(c=s.sheets.length)?(l=new Date,h=l-a,s.logger.info("Less has finished and no sheets were loaded."),r({startTime:a,endTime:l,totalMilliseconds:h,sheets:s.sheets.length})):m((function(t,n,f,p,d){if(t)return u.add(t,t.href||p.href),void o(t);d.local?s.logger.info("Loading "+p.href+" from cache."):s.logger.info("Rendered "+p.href+" successfully."),i(e.document,n,p),s.logger.info("CSS for "+p.href+" generated in "+(new Date-l)+"ms"),0===--c&&(h=new Date-a,s.logger.info("Less has finished. CSS generated in "+h+"ms"),r({startTime:a,endTime:l,totalMilliseconds:h,sheets:s.sheets.length})),l=new Date}),t,n),d(n)}))},s.refreshStyles=d,s}(window,Mt);function $t(e){e.filename&&console.warn(e),Mt.async||Rt.removeChild(Vt)}return window.less=Ft,Mt.onReady&&(/!watch/.test(window.location.hash)&&Ft.watch(),Mt.async||(Et="body { display: none !important }",Rt=document.head||document.getElementsByTagName("head")[0],(Vt=document.createElement("style")).type="text/css",Vt.styleSheet?Vt.styleSheet.cssText=Et:Vt.appendChild(document.createTextNode(Et)),Rt.appendChild(Vt)),Ft.registerStylesheetsImmediately(),Ft.pageLoadFinished=Ft.refresh("development"===Ft.env).then($t,$t)),Ft})); diff --git a/lib/web/mage/adminhtml/tools.js b/lib/web/mage/adminhtml/tools.js index 12fe88bb171a4..250bcedcfdba1 100644 --- a/lib/web/mage/adminhtml/tools.js +++ b/lib/web/mage/adminhtml/tools.js @@ -290,10 +290,6 @@ var Cookie = { var Fieldset = { cookiePrefix: 'fh-', applyCollapse: function (containerId) { - //var collapsed = Cookie.read(this.cookiePrefix + containerId); - //if (collapsed !== null) { - // Cookie.clear(this.cookiePrefix + containerId); - //} if ($(containerId + '-state')) { collapsed = $(containerId + '-state').value == 1 ? 0 : 1; } else { diff --git a/lib/web/mage/adminhtml/varienLoader.js b/lib/web/mage/adminhtml/varienLoader.js index f084ecdafd4d3..b2f95109057da 100644 --- a/lib/web/mage/adminhtml/varienLoader.js +++ b/lib/web/mage/adminhtml/varienLoader.js @@ -95,23 +95,6 @@ Ajax.Request.addMethods({ }); Ajax.Updater.respondToReadyState = Ajax.Request.respondToReadyState; -//Ajax.Updater = Object.extend(Ajax.Updater, { -// initialize: function($super, container, url, options) { -// this.container = { -// success: (container.success || container), -// failure: (container.failure || (container.success ? null : container)) -// }; -// -// options = Object.clone(options); -// var onComplete = options.onComplete; -// options.onComplete = (function(response, json) { -// this.updateContent(response.responseText); -// if (Object.isFunction(onComplete)) onComplete(response, json); -// }).bind(this); -// -// $super((url.match(new RegExp('\\?',"g")) ? url + '&isAjax=1' : url + '?isAjax=1'), options); -// } -//}); var varienLoader = new Class.create(); @@ -212,14 +195,6 @@ function setLoaderPosition() { } } -/*function getRealHeight() { - var body = document.body; - if (window.innerHeight && window.scrollMaxY) { - return window.innerHeight + window.scrollMaxY; - } - return Math.max(body.scrollHeight, body.offsetHeight); -}*/ - function toggleSelectsUnderBlock(block, flag) { if (Prototype.Browser.IE) { var selects = document.getElementsByTagName('select'); diff --git a/lib/web/mage/utils/main.js b/lib/web/mage/utils/main.js index 42aa427aa1764..9863fd57ce088 100644 --- a/lib/web/mage/utils/main.js +++ b/lib/web/mage/utils/main.js @@ -6,7 +6,12 @@ define(function (require) { 'use strict'; var utils = {}, - _ = require('underscore'); + _ = require('underscore'), + root = typeof self == 'object' && self.self === self && self || + typeof global == 'object' && global.global === global && global || + Function('return this')() || {}; + + root._ = _; return _.extend( utils, diff --git a/lib/web/prototype/window.js b/lib/web/prototype/window.js index 2b10da401100b..d371be8605e27 100644 --- a/lib/web/prototype/window.js +++ b/lib/web/prototype/window.js @@ -19,7 +19,7 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -// VERSION 1.3 +// VERSION 1.4b var Window = Class.create(); @@ -56,7 +56,6 @@ Window.prototype = { this.options = Object.extend({ className: "dialog", - windowClassName: null, blurClassName: null, minWidth: 100, minHeight: 20, @@ -80,7 +79,6 @@ Window.prototype = { opacity: 1, recenterAuto: true, wiredDrag: false, - closeOnEsc: true, closeCallback: null, destroyOnClose: false, gridX: 1, @@ -123,8 +121,6 @@ Window.prototype = { this.eventOnLoad = this._getWindowBorderSize.bindAsEventListener(this); this.eventMouseDownContent = this.toFront.bindAsEventListener(this); this.eventResize = this._recenter.bindAsEventListener(this); - this.eventKeyUp = this._keyUp.bindAsEventListener(this); - this.topbar = $(this.element.id + "_top"); this.bottombar = $(this.element.id + "_bottom"); this.content = $(this.element.id + "_content"); @@ -135,7 +131,6 @@ Window.prototype = { Event.observe(window, "load", this.eventOnLoad); Event.observe(window, "resize", this.eventResize); Event.observe(window, "scroll", this.eventResize); - Event.observe(document, "keyup", this.eventKeyUp); Event.observe(this.options.parent, "scroll", this.eventResize); if (this.options.draggable) { @@ -179,11 +174,8 @@ Window.prototype = { this.storedLocation = null; this.setOpacity(this.options.opacity); - if (this.options.zIndex) { + if (this.options.zIndex) this.setZIndex(this.options.zIndex) - } else { - this.setZIndex(this.getMaxZIndex()); - } if (this.options.destroyOnClose) this.setDestroyOnClose(true); @@ -201,20 +193,6 @@ Window.prototype = { this.setTitle(this.options.title) Windows.register(this); }, - - getMaxZIndex: function() { - var max = 0, i; - var cn = document.body.childNodes; - for (i = 0; i < cn.length; i++) { - var el = cn[i]; - var zIndex = el.nodeType == 1 ? parseInt(el.style.zIndex, 10) || 0 : 0; - if (zIndex < 10000) { - max = Math.max(max, zIndex); - } - } - return max + 10; - }, - // Destructor destroy: function() { this._notify("onDestroy"); @@ -225,9 +203,9 @@ Window.prototype = { Event.stopObserving(window, "load", this.eventOnLoad); Event.stopObserving(window, "resize", this.eventResize); Event.stopObserving(window, "scroll", this.eventResize); + Event.stopObserving(this.options.parent, "scroll", this.eventResize); Event.stopObserving(this.content, "load", this.options.onload); - Event.stopObserving(document, "keyup", this.eventKeyUp); if (this._oldParent) { var content = this.getContent(); @@ -248,7 +226,8 @@ Window.prototype = { if (this.options.url) this.content.src = null - + if (this.wiredElement) + this.wiredElement.remove(); if(this.iefix) Element.remove(this.iefix); @@ -304,8 +283,8 @@ Window.prototype = { this.content = $(this.element.id + "_content"); } - - this.getContent().innerHTML = html; + this.getContent().update(html); + return this; }, setAjaxContent: function(url, options, showCentered, showModal) { @@ -610,9 +589,6 @@ Window.prototype = { var win = document.createElement("div"); win.setAttribute('id', id); win.className = "dialog"; - if (this.options.windowClassName) { - win.className += ' ' + this.options.windowClassName; - } var content; if (this.options.url) @@ -627,7 +603,6 @@ Window.prototype = { var blank = "../themes/default/blank.gif"; win.innerHTML = closeDiv + minDiv + maxDiv + "\ - <a href='#' id='"+ id +"_focus_anchor'><!-- --></a>\ <table id='"+ id +"_row1' class=\"top table_window\">\ <tr>\ <td class='"+ className +"_nw'></td>\ @@ -660,10 +635,12 @@ Window.prototype = { changeClassName: function(newClassName) { var className = this.options.className; var id = this.getId(); - $A(["_close", "_minimize", "_maximize", "_sizer", "_content"]).each(function(value) { this._toggleClassName($(id + value), className + value, newClassName + value) }.bind(this)); + $A(["_close", "_minimize", "_maximize", "_content"]).each(function(value) { this._toggleClassName($(id + value), className + value, newClassName + value) }.bind(this)); this._toggleClassName($(id + "_top"), className + "_title", newClassName + "_title"); $$("#" + id + " td").each(function(td) {td.className = td.className.sub(className,newClassName); }); this.options.className = newClassName; + this._getWindowBorderSize(); + this.setSize(this.width, this.height) }, _toggleClassName: function(element, oldClassName, newClassName) { @@ -822,7 +799,6 @@ Window.prototype = { this._checkIEOverlapping(); WindowUtilities.focusedWindow = this this._notify("onShow"); - $(this.element.id + '_focus_anchor').focus(); }, // Displays window modal state or not at the center of the page @@ -917,12 +893,15 @@ Window.prototype = { }, minimize: function() { - if (this.resizing) + if (this.isMaximized() || this.resizing) return; + // Backward compatibility + if (this.minimized) { + this.restore(); + return; + } var r2 = $(this.getId() + "_row2"); - - if (!this.minimized) { this.minimized = true; var dh = r2.getDimensions().height; @@ -936,13 +915,21 @@ Window.prototype = { this.element.setStyle({height: h + "px"}); r2.hide(); } - if (! this.useTop) { var bottom = parseFloat(this.element.getStyle('bottom')); this.element.setStyle({bottom: (bottom + dh) + 'px'}); } - } - else { + this._notify("onMinimize"); + + // Store new location/size if need be + this._saveCookie() + }, + + restore: function() { + if (!this.minimized || this.resizing) + return; + + var r2 = $(this.getId() + "_row2"); this.minimized = false; var dh = this.r2Height; @@ -961,11 +948,9 @@ Window.prototype = { this.element.setStyle({bottom: (bottom - dh) + 'px'}); } this.toFront(); - } - this._notify("onMinimize"); // Store new location/size if need be - this._saveCookie() + this._saveCookie(); }, maximize: function() { @@ -1013,8 +998,8 @@ Window.prototype = { } else { this.setSize(width, height); - this.element.setStyle(this.useLeft ? {left: left} : {right: left}); - this.element.setStyle(this.useTop ? {top: top} : {bottom: top}); + this.element.setStyle(this.useLeft ? {left: left + "px"} : {right: left + "px"}); + this.element.setStyle(this.useTop ? {top: top + "px"} : {bottom: top + "px"}); } this.toFront(); @@ -1084,12 +1069,6 @@ Window.prototype = { this.iefix.show(); }, - _keyUp: function(event) { - if (27 == event.keyCode && this.options.closeOnEsc) { - this.close(); - } - }, - _getWindowBorderSize: function(event) { // Hack to get real window border size!! var div = this._createHiddenDiv(this.options.className + "_n") @@ -1291,11 +1270,6 @@ var Windows = { this.focusedWindow = this.windows.length >=2 ? this.windows[this.windows.length-2] : null; }, - // Registers a new window (called by Windows constructor) - register: function(win) { - this.windows.push(win); - }, - // Add a modal window in the stack addModalWindow: function(win) { // Disable screen if first modal window @@ -1449,14 +1423,13 @@ var Dialog = { parameters.className = parameters.className || "alert"; - var okButtonClass = "class ='" + (parameters.buttonClass ? parameters.buttonClass + " " : "") + " ok_button'"; - var cancelButtonClass = "class ='" + (parameters.buttonClass ? parameters.buttonClass + " " : "") + " cancel_button'"; - + var okButtonClass = "class ='" + (parameters.buttonClass ? parameters.buttonClass + " " : "") + " ok_button'" + var cancelButtonClass = "class ='" + (parameters.buttonClass ? parameters.buttonClass + " " : "") + " cancel_button'" var content = "\ <div class='" + parameters.className + "_message'>" + content + "</div>\ <div class='" + parameters.className + "_buttons'>\ - <button type='button' title='" + okLabel + "' onclick='Dialog.okCallback()' " + okButtonClass + "><span><span><span>" + okLabel + "</span></span></span></button>\ - <button type='button' title='" + cancelLabel + "' onclick='Dialog.cancelCallback()' " + cancelButtonClass + "><span><span><span>" + cancelLabel + "</span></span></span></button>\ + <input type='button' value='" + okLabel + "' onclick='Dialog.okCallback()' " + okButtonClass + "/>\ + <input type='button' value='" + cancelLabel + "' onclick='Dialog.cancelCallback()' " + cancelButtonClass + "/>\ </div>\ "; return this._openDialog(content, parameters) @@ -1479,11 +1452,11 @@ var Dialog = { parameters.className = parameters.className || "alert"; - var okButtonClass = "class ='" + (parameters.buttonClass ? parameters.buttonClass + " " : "") + " ok_button'"; + var okButtonClass = "class ='" + (parameters.buttonClass ? parameters.buttonClass + " " : "") + " ok_button'" var content = "\ <div class='" + parameters.className + "_message'>" + content + "</div>\ <div class='" + parameters.className + "_buttons'>\ - <button type='button' title='" + okLabel + "' onclick='Dialog.okCallback()' " + okButtonClass + "><span><span><span>" + okLabel + "</span></span></span></button>\ + <input type='button' value='" + okLabel + "' onclick='Dialog.okCallback()' " + okButtonClass + "/>\ </div>"; return this._openDialog(content, parameters) }, @@ -1525,7 +1498,7 @@ var Dialog = { var className = parameters.className; if (! parameters.height && ! parameters.width) { - parameters.width = WindowUtilities.getPageSize(parameters.options.parent || document.body).pageWidth / 2; + parameters.width = WindowUtilities.getPageSize((parameters.options && parameters.options.parent) || document.body).pageWidth / 2; } if (parameters.id) this.dialogId = parameters.id; @@ -1551,8 +1524,9 @@ var Dialog = { parameters.closable = parameters.closable || false; var win = new Window(parameters); - win.getContent().innerHTML = content; - + if (!parameters.url) { + win.setHTMLContent(content); + } win.showCenter(true, parameters.top, parameters.left); win.setDestroyOnClose(); @@ -1678,7 +1652,7 @@ var WindowUtilities = { if (self.innerHeight) { // all except Explorer - windowWidth = document.documentElement.clientWidth;//self.innerWidth; + windowWidth = self.innerWidth; windowHeight = self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode windowWidth = document.documentElement.clientWidth; @@ -1822,7 +1796,7 @@ var WindowUtilities = { setCookie: function(value, parameters) { document.cookie= parameters[0] + "=" + escape(value) + - ((parameters[1]) ? "; expires=" + parameters[1].toUTCString() : "") + + ((parameters[1]) ? "; expires=" + parameters[1].toGMTString() : "") + ((parameters[2]) ? "; path=" + parameters[2] : "") + ((parameters[3]) ? "; domain=" + parameters[3] : "") + ((parameters[4]) ? "; secure" : ""); @@ -1861,7 +1835,7 @@ var WindowUtilities = { tmpObj.style.left = '0'; tmpObj.style.display = 'none'; - tmpObj.innerHTML = content; + tmpObj.innerHTML = content.stripScripts(); objBody.insertBefore(tmpObj, objBody.firstChild); var size; diff --git a/lib/web/requirejs/require.js b/lib/web/requirejs/require.js index 35c3bf303e525..424e7386e9855 100644 --- a/lib/web/requirejs/require.js +++ b/lib/web/requirejs/require.js @@ -1,7 +1,6 @@ /** vim: et:ts=4:sw=4:sts=4 - * @license RequireJS 2.1.11 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved. - * Available via the MIT or new BSD license. - * see: http://github.com/jrburke/requirejs for details + * @license RequireJS 2.3.6 Copyright jQuery Foundation and other contributors. + * Released under MIT license, https://github.com/requirejs/requirejs/blob/master/LICENSE */ //Not using strict: uneven strict support in browsers, #392, and causes //problems with requirejs.exec()/transpiler plugins that may not be strict. @@ -9,19 +8,17 @@ /*global window, navigator, document, importScripts, setTimeout, opera */ var requirejs, require, define; -(function (global) { +(function (global, setTimeout) { var req, s, head, baseElement, dataMain, src, interactiveScript, currentlyAddingScript, mainScript, subPath, - version = '2.1.11', - commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg, + version = '2.3.6', + commentRegExp = /\/\*[\s\S]*?\*\/|([^:"'=]|^)\/\/.*$/mg, cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g, jsSuffixRegExp = /\.js$/, currDirRegExp = /^\.\//, op = Object.prototype, ostring = op.toString, hasOwn = op.hasOwnProperty, - ap = Array.prototype, - apsp = ap.splice, isBrowser = !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document), isWebWorker = !isBrowser && typeof importScripts !== 'undefined', //PS3 indicates loaded and complete, but need to wait for complete @@ -29,7 +26,7 @@ var requirejs, require, define; // then 'complete'. The UA check is unfortunate, but not sure how //to feature test w/o causing perf issues. readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ? - /^complete$/ : /^(complete|loaded)$/, + /^complete$/ : /^(complete|loaded)$/, defContextName = '_', //Oh the tragedy, detecting opera. See the usage of isOpera for reason. isOpera = typeof opera !== 'undefined' && opera.toString() === '[object Opera]', @@ -38,6 +35,11 @@ var requirejs, require, define; globalDefQueue = [], useInteractive = false; + //Could match something like ')//comment', do not lose the prefix to comment. + function commentReplace(match, singlePrefix) { + return singlePrefix || ''; + } + function isFunction(it) { return ostring.call(it) === '[object Function]'; } @@ -163,7 +165,7 @@ var requirejs, require, define; * @returns {Error} */ function makeError(id, msg, err, requireModules) { - var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id); + var e = new Error(msg + '\nhttps://requirejs.org/docs/errors.html#' + id); e.requireType = id; e.requireModules = requireModules; if (err) { @@ -180,7 +182,7 @@ var requirejs, require, define; if (typeof requirejs !== 'undefined') { if (isFunction(requirejs)) { - //Do not overwrite and existing requirejs instance. + //Do not overwrite an existing requirejs instance. return; } cfg = requirejs; @@ -232,21 +234,20 @@ var requirejs, require, define; * @param {Array} ary the array of path segments. */ function trimDots(ary) { - var i, part, length = ary.length; - for (i = 0; i < length; i++) { + var i, part; + for (i = 0; i < ary.length; i++) { part = ary[i]; if (part === '.') { ary.splice(i, 1); i -= 1; } else if (part === '..') { - if (i === 1 && (ary[2] === '..' || ary[0] === '..')) { - //End of the line. Keep at least one non-dot - //path segment at the front so it can be mapped - //correctly to disk. Otherwise, there is likely - //no path mapping for a path starting with '..'. - //This can still fail, but catches the most reasonable - //uses of .. - break; + // If at the start, or previous value is still .., + // keep them so that when converted to a path it may + // still work when converted to a path, even though + // as an ID it is less than ideal. In larger point + // releases, may be better to just kick out an error. + if (i === 0 || (i === 1 && ary[2] === '..') || ary[i - 1] === '..') { + continue; } else if (i > 0) { ary.splice(i - 1, 2); i -= 2; @@ -267,43 +268,37 @@ var requirejs, require, define; */ function normalize(name, baseName, applyMap) { var pkgMain, mapValue, nameParts, i, j, nameSegment, lastIndex, - foundMap, foundI, foundStarMap, starI, - baseParts = baseName && baseName.split('/'), - normalizedBaseParts = baseParts, + foundMap, foundI, foundStarMap, starI, normalizedBaseParts, + baseParts = (baseName && baseName.split('/')), map = config.map, starMap = map && map['*']; //Adjust any relative paths. - if (name && name.charAt(0) === '.') { - //If have a base name, try to normalize against it, - //otherwise, assume it is a top-level require that will - //be relative to baseUrl in the end. - if (baseName) { + if (name) { + name = name.split('/'); + lastIndex = name.length - 1; + + // If wanting node ID compatibility, strip .js from end + // of IDs. Have to do this here, and not in nameToUrl + // because node allows either .js or non .js to map + // to same file. + if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) { + name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, ''); + } + + // Starts with a '.' so need the baseName + if (name[0].charAt(0) === '.' && baseParts) { //Convert baseName to array, and lop off the last part, //so that . matches that 'directory' and not name of the baseName's //module. For instance, baseName of 'one/two/three', maps to //'one/two/three.js', but we want the directory, 'one/two' for //this normalization. normalizedBaseParts = baseParts.slice(0, baseParts.length - 1); - name = name.split('/'); - lastIndex = name.length - 1; - - // If wanting node ID compatibility, strip .js from end - // of IDs. Have to do this here, and not in nameToUrl - // because node allows either .js or non .js to map - // to same file. - if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) { - name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, ''); - } - name = normalizedBaseParts.concat(name); - trimDots(name); - name = name.join('/'); - } else if (name.indexOf('./') === 0) { - // No baseName, so this is ID is resolved relative - // to baseUrl, pull off the leading dot. - name = name.substring(2); } + + trimDots(name); + name = name.join('/'); } //Apply map config if available. @@ -364,7 +359,7 @@ var requirejs, require, define; if (isBrowser) { each(scripts(), function (scriptNode) { if (scriptNode.getAttribute('data-requiremodule') === name && - scriptNode.getAttribute('data-requirecontext') === context.contextName) { + scriptNode.getAttribute('data-requirecontext') === context.contextName) { scriptNode.parentNode.removeChild(scriptNode); return true; } @@ -379,7 +374,13 @@ var requirejs, require, define; //retry pathConfig.shift(); context.require.undef(id); - context.require([id]); + + //Custom require that does not do map translation, since + //ID is "absolute", already mapped/resolved. + context.makeRequire(null, { + skipMap: true + })([id]); + return true; } } @@ -439,13 +440,24 @@ var requirejs, require, define; //Account for relative paths if there is a base name. if (name) { if (prefix) { - if (pluginModule && pluginModule.normalize) { + if (isNormalized) { + normalizedName = name; + } else if (pluginModule && pluginModule.normalize) { //Plugin is loaded, use its normalize method. normalizedName = pluginModule.normalize(name, function (name) { return normalize(name, parentName, applyMap); }); } else { - normalizedName = normalize(name, parentName, applyMap); + // If nested plugin references, then do not try to + // normalize, as it will not normalize correctly. This + // places a restriction on resourceIds, and the longer + // term solution is not to normalize until plugins are + // loaded and all normalizations to allow for async + // loading of a loader plugin. But for now, fixes the + // common uses. Details in #1131 + normalizedName = name.indexOf('!') === -1 ? + normalize(name, parentName, applyMap) : + name; } } else { //A regular module. @@ -467,8 +479,8 @@ var requirejs, require, define; //normalization, stamp it with a unique ID so two matching relative //ids that may conflict can be separate. suffix = prefix && !pluginModule && !isNormalized ? - '_unnormalized' + (unnormalizedCounter += 1) : - ''; + '_unnormalized' + (unnormalizedCounter += 1) : + ''; return { prefix: prefix, @@ -479,8 +491,8 @@ var requirejs, require, define; originalName: originalName, isDefine: isDefine, id: (prefix ? - prefix + '!' + normalizedName : - normalizedName) + suffix + prefix + '!' + normalizedName : + normalizedName) + suffix }; } @@ -500,7 +512,7 @@ var requirejs, require, define; mod = getOwn(registry, id); if (hasProp(defined, id) && - (!mod || mod.defineEmitComplete)) { + (!mod || mod.defineEmitComplete)) { if (name === 'defined') { fn(defined[id]); } @@ -546,11 +558,13 @@ var requirejs, require, define; function takeGlobalQueue() { //Push all the globalDefQueue items into the context's defQueue if (globalDefQueue.length) { - //Array splice in the values since the context code has a - //local var ref to defQueue, so cannot just reassign the one - //on context. - apsp.apply(defQueue, - [defQueue.length, 0].concat(globalDefQueue)); + each(globalDefQueue, function(queueItem) { + var id = queueItem[0]; + if (typeof id === 'string') { + context.defQueueMap[id] = true; + } + defQueue.push(queueItem); + }); globalDefQueue = []; } } @@ -581,7 +595,7 @@ var requirejs, require, define; id: mod.map.id, uri: mod.map.url, config: function () { - return getOwn(config.config, mod.map.id) || {}; + return getOwn(config.config, mod.map.id) || {}; }, exports: mod.exports || (mod.exports = {}) }); @@ -837,7 +851,10 @@ var requirejs, require, define; factory = this.factory; if (!this.inited) { - this.fetch(); + // Only fetch if not already in the defQueue. + if (!hasProp(context.defQueueMap, id)) { + this.fetch(); + } } else if (this.error) { this.emit('error', this.error); } else if (!this.defining) { @@ -897,7 +914,11 @@ var requirejs, require, define; defined[id] = exports; if (req.onResourceLoad) { - req.onResourceLoad(context, this.map, this.depMaps); + var resLoadMaps = []; + each(this.depMaps, function (depMap) { + resLoadMaps.push(depMap.normalizedMap || depMap); + }); + req.onResourceLoad(context, this.map, resLoadMaps); } } @@ -953,9 +974,11 @@ var requirejs, require, define; //prefix and name should already be normalized, no need //for applying map config again either. normalizedMap = makeModuleMap(map.prefix + '!' + name, - this.map.parentMap); + this.map.parentMap, + true); on(normalizedMap, 'defined', bind(this, function (value) { + this.map.normalizedMap = normalizedMap; this.init([], function () { return value; }, null, { enabled: true, ignore: true @@ -1044,10 +1067,10 @@ var requirejs, require, define; req.exec(text); } catch (e) { return onError(makeError('fromtexteval', - 'fromText eval for ' + id + - ' failed: ' + e, - e, - [id])); + 'fromText eval for ' + id + + ' failed: ' + e, + e, + [id])); } if (hasInteractive) { @@ -1094,9 +1117,9 @@ var requirejs, require, define; //Dependency needs to be converted to a depMap //and wired up to this module. depMap = makeModuleMap(depMap, - (this.map.isDefine ? this.map : this.map.parentMap), - false, - !this.skipMap); + (this.map.isDefine ? this.map : this.map.parentMap), + false, + !this.skipMap); this.depMaps[i] = depMap; handler = getOwn(handlers, depMap.id); @@ -1109,12 +1132,22 @@ var requirejs, require, define; this.depCount += 1; on(depMap, 'defined', bind(this, function (depExports) { + if (this.undefed) { + return; + } this.defineDep(i, depExports); this.check(); })); if (this.errback) { on(depMap, 'error', bind(this, this.errback)); + } else if (this.events.error) { + // No direct errback on this module, but something + // else is listening for errors, so be sure to + // propagate the error correctly. + on(depMap, 'error', bind(this, function(err) { + this.emit('error', err); + })); } } @@ -1218,13 +1251,15 @@ var requirejs, require, define; while (defQueue.length) { args = defQueue.shift(); if (args[0] === null) { - return onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + args[args.length - 1])); + return onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + + args[args.length - 1])); } else { //args are id, deps, factory. Should be normalized by the //define() function. callGetModule(args); } } + context.defQueueMap = {}; } context = { @@ -1234,6 +1269,7 @@ var requirejs, require, define; defined: defined, urlFetched: urlFetched, defQueue: defQueue, + defQueueMap: {}, Module: Module, makeModuleMap: makeModuleMap, nextTick: req.nextTick, @@ -1251,6 +1287,14 @@ var requirejs, require, define; } } + // Convert old style urlArgs string to a function. + if (typeof cfg.urlArgs === 'string') { + var urlArgs = cfg.urlArgs; + cfg.urlArgs = function(id, url) { + return (url.indexOf('?') === -1 ? '?' : '&') + urlArgs; + }; + } + //Save off the paths since they require special processing, //they are additive. var shim = config.shim, @@ -1305,7 +1349,7 @@ var requirejs, require, define; each(cfg.packages, function (pkgObj) { var location, name; - pkgObj = typeof pkgObj === 'string' ? { name: pkgObj } : pkgObj; + pkgObj = typeof pkgObj === 'string' ? {name: pkgObj} : pkgObj; name = pkgObj.name; location = pkgObj.location; @@ -1319,8 +1363,8 @@ var requirejs, require, define; //envs have different conventions: some use a module name, //some use a file name. config.pkgs[name] = pkgObj.name + '/' + (pkgObj.main || 'main') - .replace(currDirRegExp, '') - .replace(jsSuffixRegExp, ''); + .replace(currDirRegExp, '') + .replace(jsSuffixRegExp, ''); }); } @@ -1332,7 +1376,7 @@ var requirejs, require, define; //late to modify them, and ignore unnormalized ones //since they are transient. if (!mod.inited && !mod.map.unnormalized) { - mod.map = makeModuleMap(id); + mod.map = makeModuleMap(id, null, true); } }); @@ -1390,10 +1434,10 @@ var requirejs, require, define; if (!hasProp(defined, id)) { return onError(makeError('notloaded', 'Module name "' + - id + - '" has not been loaded yet for context: ' + - contextName + - (relMap ? '' : '. Use require([])'))); + id + + '" has not been loaded yet for context: ' + + contextName + + (relMap ? '' : '. Use require([])'))); } return defined[id]; } @@ -1445,7 +1489,7 @@ var requirejs, require, define; } return context.nameToUrl(normalize(moduleNamePlusExt, - relMap && relMap.id, true), ext, true); + relMap && relMap.id, true), ext, true); }, defined: function (id) { @@ -1468,6 +1512,7 @@ var requirejs, require, define; var map = makeModuleMap(id, relMap, true), mod = getOwn(registry, id); + mod.undefed = true; removeScript(id); delete defined[id]; @@ -1478,10 +1523,11 @@ var requirejs, require, define; //in array so that the splices do not //mess up the iteration. eachReverse(defQueue, function(args, i) { - if(args[0] === id) { + if (args[0] === id) { defQueue.splice(i, 1); } }); + delete context.defQueueMap[id]; if (mod) { //Hold on to listeners in case the @@ -1543,6 +1589,7 @@ var requirejs, require, define; callGetModule(args); } + context.defQueueMap = {}; //Do this after the cycle of callGetModule in case the result //of those calls/init calls changes the registry. @@ -1554,9 +1601,9 @@ var requirejs, require, define; return; } else { return onError(makeError('nodefine', - 'No define call for ' + moduleName, - null, - [moduleName])); + 'No define call for ' + moduleName, + null, + [moduleName])); } } else { //A script that does not call define(), so just simulate @@ -1624,13 +1671,12 @@ var requirejs, require, define; //Join the path parts together, then figure out if baseUrl is needed. url = syms.join('/'); - url += (ext || (/^data\:|\?/.test(url) || skipExt ? '' : '.js')); + url += (ext || (/^data\:|^blob\:|\?/.test(url) || skipExt ? '' : '.js')); url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url; } - return config.urlArgs ? url + - ((url.indexOf('?') === -1 ? '?' : '&') + - config.urlArgs) : url; + return config.urlArgs && !/^blob\:/.test(url) ? + url + config.urlArgs(moduleName, url) : url; }, //Delegates to req.load. Broken out as a separate function to @@ -1661,7 +1707,7 @@ var requirejs, require, define; //all old browsers will be supported, but this one was easy enough //to support and still makes sense. if (evt.type === 'load' || - (readyRegExp.test((evt.currentTarget || evt.srcElement).readyState))) { + (readyRegExp.test((evt.currentTarget || evt.srcElement).readyState))) { //Reset interactive script so a script node is not held onto for //to long. interactiveScript = null; @@ -1678,7 +1724,21 @@ var requirejs, require, define; onScriptError: function (evt) { var data = getScriptData(evt); if (!hasPathFallback(data.id)) { - return onError(makeError('scripterror', 'Script error for: ' + data.id, evt, [data.id])); + var parents = []; + eachProp(registry, function(value, key) { + if (key.indexOf('_@r') !== 0) { + each(value.depMaps, function(depMap) { + if (depMap.id === data.id) { + parents.push(key); + return true; + } + }); + } + }); + return onError(makeError('scripterror', 'Script error for "' + data.id + + (parents.length ? + '", needed by: ' + parents.join(', ') : + '"'), evt, [data.id])); } } }; @@ -1814,8 +1874,8 @@ var requirejs, require, define; */ req.createNode = function (config, moduleName, url) { var node = config.xhtml ? - document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') : - document.createElement('script'); + document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') : + document.createElement('script'); node.type = config.scriptType || 'text/javascript'; node.charset = 'utf-8'; node.async = true; @@ -1850,15 +1910,15 @@ var requirejs, require, define; //UNFORTUNATELY Opera implements attachEvent but does not follow the script //script execution mode. if (node.attachEvent && - //Check if node.attachEvent is artificially added by custom script or - //natively supported by browser - //read https://github.com/jrburke/requirejs/issues/187 - //if we can NOT find [native code] then it must NOT natively supported. - //in IE8, node.attachEvent does not have toString() - //Note the test for "[native code" with no closing brace, see: - //https://github.com/jrburke/requirejs/issues/273 - !(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) && - !isOpera) { + //Check if node.attachEvent is artificially added by custom script or + //natively supported by browser + //read https://github.com/requirejs/requirejs/issues/187 + //if we can NOT find [native code] then it must NOT natively supported. + //in IE8, node.attachEvent does not have toString() + //Note the test for "[native code" with no closing brace, see: + //https://github.com/requirejs/requirejs/issues/273 + !(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) && + !isOpera) { //Probably IE. IE (at least 6-8) do not fire //script onload right after executing the script, so //we cannot tie the anonymous define call to a name. @@ -1884,6 +1944,12 @@ var requirejs, require, define; } node.src = url; + //Calling onNodeCreated after all properties on the node have been + //set, but before it is placed in the DOM. + if (config.onNodeCreated) { + config.onNodeCreated(node, config, moduleName, url); + } + //For some cache cases in IE 6-8, the script executes before the end //of the appendChild execution, so to tie an anonymous define //call to the module name (which is stored on the node), hold on @@ -1902,19 +1968,24 @@ var requirejs, require, define; //In a web worker, use importScripts. This is not a very //efficient use of importScripts, importScripts will block until //its script is downloaded and evaluated. However, if web workers - //are in play, the expectation that a build has been done so that - //only one script needs to be loaded anyway. This may need to be - //reevaluated if other use cases become common. + //are in play, the expectation is that a build has been done so + //that only one script needs to be loaded anyway. This may need + //to be reevaluated if other use cases become common. + + // Post a task to the event loop to work around a bug in WebKit + // where the worker gets garbage-collected after calling + // importScripts(): https://webkit.org/b/153317 + setTimeout(function() {}, 0); importScripts(url); //Account for anonymous modules context.completeLoad(moduleName); } catch (e) { context.onError(makeError('importscripts', - 'importScripts failed for ' + - moduleName + ' at ' + url, - e, - [moduleName])); + 'importScripts failed for ' + + moduleName + ' at ' + url, + e, + [moduleName])); } } }; @@ -1950,8 +2021,10 @@ var requirejs, require, define; //Preserve dataMain in case it is a path (i.e. contains '?') mainScript = dataMain; - //Set final baseUrl if there is not already an explicit one. - if (!cfg.baseUrl) { + //Set final baseUrl if there is not already an explicit one, + //but only do so if the data-main value is not a loader plugin + //module ID. + if (!cfg.baseUrl && mainScript.indexOf('!') === -1) { //Pull off the directory of data-main for use as the //baseUrl. src = mainScript.split('/'); @@ -1965,7 +2038,7 @@ var requirejs, require, define; //like a module name. mainScript = mainScript.replace(jsSuffixRegExp, ''); - //If mainScript is still a path, fall back to dataMain + //If mainScript is still a path, fall back to dataMain if (req.jsExtRegExp.test(mainScript)) { mainScript = dataMain; } @@ -2012,7 +2085,7 @@ var requirejs, require, define; if (callback.length) { callback .toString() - .replace(commentRegExp, '') + .replace(commentRegExp, commentReplace) .replace(cjsRequireRegExp, function (match, dep) { deps.push(dep); }); @@ -2044,14 +2117,18 @@ var requirejs, require, define; //where the module name is not known until the script onload event //occurs. If no context, use the global queue, and get it processed //in the onscript load callback. - (context ? context.defQueue : globalDefQueue).push([name, deps, callback]); + if (context) { + context.defQueue.push([name, deps, callback]); + context.defQueueMap[name] = true; + } else { + globalDefQueue.push([name, deps, callback]); + } }; define.amd = { jQuery: true }; - /** * Executes the text. Normally just uses eval, but can be modified * to use a better, environment-specific call. Only used for transpiling @@ -2065,4 +2142,4 @@ var requirejs, require, define; //Set up with config info. req(cfg); -}(this)); \ No newline at end of file +}(this, (typeof setTimeout === 'undefined' ? undefined : setTimeout))); diff --git a/lib/web/underscore.js b/lib/web/underscore.js index efaaad38007b7..35fa759e91c87 100644 --- a/lib/web/underscore.js +++ b/lib/web/underscore.js @@ -1,1537 +1,2041 @@ -// Underscore.js 1.8.2 -// http://underscorejs.org -// (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -// Underscore may be freely distributed under the MIT license. - -(function() { - - // Baseline setup - // -------------- - - // Establish the root object, `window` in the browser, or `exports` on the server. - var root = this; - - // Save the previous value of the `_` variable. - var previousUnderscore = root._; - - // Save bytes in the minified (but not gzipped) version: - var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype; - - // Create quick reference variables for speed access to core prototypes. - var - push = ArrayProto.push, - slice = ArrayProto.slice, - toString = ObjProto.toString, - hasOwnProperty = ObjProto.hasOwnProperty; - - // All **ECMAScript 5** native function implementations that we hope to use - // are declared here. - var - nativeIsArray = Array.isArray, - nativeKeys = Object.keys, - nativeBind = FuncProto.bind, - nativeCreate = Object.create; - - // Naked function reference for surrogate-prototype-swapping. - var Ctor = function(){}; - - // Create a safe reference to the Underscore object for use below. - var _ = function(obj) { - if (obj instanceof _) return obj; - if (!(this instanceof _)) return new _(obj); - this._wrapped = obj; - }; - - // Export the Underscore object for **Node.js**, with - // backwards-compatibility for the old `require()` API. If we're in - // the browser, add `_` as a global object. - if (typeof exports !== 'undefined') { - if (typeof module !== 'undefined' && module.exports) { - exports = module.exports = _; - } - exports._ = _; - } else { - root._ = _; - } - - // Current version. - _.VERSION = '1.8.2'; - - // Internal function that returns an efficient (for current engines) version - // of the passed-in callback, to be repeatedly applied in other Underscore - // functions. - var optimizeCb = function(func, context, argCount) { - if (context === void 0) return func; - switch (argCount == null ? 3 : argCount) { - case 1: return function(value) { - return func.call(context, value); - }; - case 2: return function(value, other) { - return func.call(context, value, other); - }; - case 3: return function(value, index, collection) { - return func.call(context, value, index, collection); - }; - case 4: return function(accumulator, value, index, collection) { - return func.call(context, accumulator, value, index, collection); - }; - } - return function() { - return func.apply(context, arguments); - }; - }; - - // A mostly-internal function to generate callbacks that can be applied - // to each element in a collection, returning the desired result — either - // identity, an arbitrary callback, a property matcher, or a property accessor. - var cb = function(value, context, argCount) { - if (value == null) return _.identity; - if (_.isFunction(value)) return optimizeCb(value, context, argCount); - if (_.isObject(value)) return _.matcher(value); - return _.property(value); - }; - _.iteratee = function(value, context) { - return cb(value, context, Infinity); - }; - - // An internal function for creating assigner functions. - var createAssigner = function(keysFunc, undefinedOnly) { - return function(obj) { - var length = arguments.length; - if (length < 2 || obj == null) return obj; - for (var index = 1; index < length; index++) { - var source = arguments[index], - keys = keysFunc(source), - l = keys.length; - for (var i = 0; i < l; i++) { - var key = keys[i]; - if (!undefinedOnly || obj[key] === void 0) obj[key] = source[key]; +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define('underscore', factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (function () { + var current = global._; + var exports = global._ = factory(); + exports.noConflict = function () { global._ = current; return exports; }; + }())); +}(this, (function () { + // Underscore.js 1.13.1 + // https://underscorejs.org + // (c) 2009-2021 Jeremy Ashkenas, Julian Gonggrijp, and DocumentCloud and Investigative Reporters & Editors + // Underscore may be freely distributed under the MIT license. + + // Current version. + var VERSION = '1.13.1'; + + // Establish the root object, `window` (`self`) in the browser, `global` + // on the server, or `this` in some virtual machines. We use `self` + // instead of `window` for `WebWorker` support. + var root = typeof self == 'object' && self.self === self && self || + typeof global == 'object' && global.global === global && global || + Function('return this')() || + {}; + + // Save bytes in the minified (but not gzipped) version: + var ArrayProto = Array.prototype, ObjProto = Object.prototype; + var SymbolProto = typeof Symbol !== 'undefined' ? Symbol.prototype : null; + + // Create quick reference variables for speed access to core prototypes. + var push = ArrayProto.push, + slice = ArrayProto.slice, + toString = ObjProto.toString, + hasOwnProperty = ObjProto.hasOwnProperty; + + // Modern feature detection. + var supportsArrayBuffer = typeof ArrayBuffer !== 'undefined', + supportsDataView = typeof DataView !== 'undefined'; + + // All **ECMAScript 5+** native function implementations that we hope to use + // are declared here. + var nativeIsArray = Array.isArray, + nativeKeys = Object.keys, + nativeCreate = Object.create, + nativeIsView = supportsArrayBuffer && ArrayBuffer.isView; + + // Create references to these builtin functions because we override them. + var _isNaN = isNaN, + _isFinite = isFinite; + + // Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed. + var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString'); + var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString', + 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString']; + + // The largest integer that can be represented exactly. + var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1; + + // Some functions take a variable number of arguments, or a few expected + // arguments at the beginning and then a variable number of values to operate + // on. This helper accumulates all remaining arguments past the function’s + // argument length (or an explicit `startIndex`), into an array that becomes + // the last argument. Similar to ES6’s "rest parameter". + function restArguments(func, startIndex) { + startIndex = startIndex == null ? func.length - 1 : +startIndex; + return function() { + var length = Math.max(arguments.length - startIndex, 0), + rest = Array(length), + index = 0; + for (; index < length; index++) { + rest[index] = arguments[index + startIndex]; + } + switch (startIndex) { + case 0: return func.call(this, rest); + case 1: return func.call(this, arguments[0], rest); + case 2: return func.call(this, arguments[0], arguments[1], rest); + } + var args = Array(startIndex + 1); + for (index = 0; index < startIndex; index++) { + args[index] = arguments[index]; + } + args[startIndex] = rest; + return func.apply(this, args); + }; + } + + // Is a given variable an object? + function isObject(obj) { + var type = typeof obj; + return type === 'function' || type === 'object' && !!obj; + } + + // Is a given value equal to null? + function isNull(obj) { + return obj === null; + } + + // Is a given variable undefined? + function isUndefined(obj) { + return obj === void 0; + } + + // Is a given value a boolean? + function isBoolean(obj) { + return obj === true || obj === false || toString.call(obj) === '[object Boolean]'; + } + + // Is a given value a DOM element? + function isElement(obj) { + return !!(obj && obj.nodeType === 1); + } + + // Internal function for creating a `toString`-based type tester. + function tagTester(name) { + var tag = '[object ' + name + ']'; + return function(obj) { + return toString.call(obj) === tag; + }; + } + + var isString = tagTester('String'); + + var isNumber = tagTester('Number'); + + var isDate = tagTester('Date'); + + var isRegExp = tagTester('RegExp'); + + var isError = tagTester('Error'); + + var isSymbol = tagTester('Symbol'); + + var isArrayBuffer = tagTester('ArrayBuffer'); + + var isFunction = tagTester('Function'); + + // Optimize `isFunction` if appropriate. Work around some `typeof` bugs in old + // v8, IE 11 (#1621), Safari 8 (#1929), and PhantomJS (#2236). + var nodelist = root.document && root.document.childNodes; + if (typeof /./ != 'function' && typeof Int8Array != 'object' && typeof nodelist != 'function') { + isFunction = function(obj) { + return typeof obj == 'function' || false; + }; + } + + var isFunction$1 = isFunction; + + var hasObjectTag = tagTester('Object'); + + // In IE 10 - Edge 13, `DataView` has string tag `'[object Object]'`. + // In IE 11, the most common among them, this problem also applies to + // `Map`, `WeakMap` and `Set`. + var hasStringTagBug = ( + supportsDataView && hasObjectTag(new DataView(new ArrayBuffer(8))) + ), + isIE11 = (typeof Map !== 'undefined' && hasObjectTag(new Map)); + + var isDataView = tagTester('DataView'); + + // In IE 10 - Edge 13, we need a different heuristic + // to determine whether an object is a `DataView`. + function ie10IsDataView(obj) { + return obj != null && isFunction$1(obj.getInt8) && isArrayBuffer(obj.buffer); + } + + var isDataView$1 = (hasStringTagBug ? ie10IsDataView : isDataView); + + // Is a given value an array? + // Delegates to ECMA5's native `Array.isArray`. + var isArray = nativeIsArray || tagTester('Array'); + + // Internal function to check whether `key` is an own property name of `obj`. + function has$1(obj, key) { + return obj != null && hasOwnProperty.call(obj, key); + } + + var isArguments = tagTester('Arguments'); + + // Define a fallback version of the method in browsers (ahem, IE < 9), where + // there isn't any inspectable "Arguments" type. + (function() { + if (!isArguments(arguments)) { + isArguments = function(obj) { + return has$1(obj, 'callee'); + }; + } + }()); + + var isArguments$1 = isArguments; + + // Is a given object a finite number? + function isFinite$1(obj) { + return !isSymbol(obj) && _isFinite(obj) && !isNaN(parseFloat(obj)); + } + + // Is the given value `NaN`? + function isNaN$1(obj) { + return isNumber(obj) && _isNaN(obj); + } + + // Predicate-generating function. Often useful outside of Underscore. + function constant(value) { + return function() { + return value; + }; + } + + // Common internal logic for `isArrayLike` and `isBufferLike`. + function createSizePropertyCheck(getSizeProperty) { + return function(collection) { + var sizeProperty = getSizeProperty(collection); + return typeof sizeProperty == 'number' && sizeProperty >= 0 && sizeProperty <= MAX_ARRAY_INDEX; } - } - return obj; + } + + // Internal helper to generate a function to obtain property `key` from `obj`. + function shallowProperty(key) { + return function(obj) { + return obj == null ? void 0 : obj[key]; + }; + } + + // Internal helper to obtain the `byteLength` property of an object. + var getByteLength = shallowProperty('byteLength'); + + // Internal helper to determine whether we should spend extensive checks against + // `ArrayBuffer` et al. + var isBufferLike = createSizePropertyCheck(getByteLength); + + // Is a given value a typed array? + var typedArrayPattern = /\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/; + function isTypedArray(obj) { + // `ArrayBuffer.isView` is the most future-proof, so use it when available. + // Otherwise, fall back on the above regular expression. + return nativeIsView ? (nativeIsView(obj) && !isDataView$1(obj)) : + isBufferLike(obj) && typedArrayPattern.test(toString.call(obj)); + } + + var isTypedArray$1 = supportsArrayBuffer ? isTypedArray : constant(false); + + // Internal helper to obtain the `length` property of an object. + var getLength = shallowProperty('length'); + + // Internal helper to create a simple lookup structure. + // `collectNonEnumProps` used to depend on `_.contains`, but this led to + // circular imports. `emulatedSet` is a one-off solution that only works for + // arrays of strings. + function emulatedSet(keys) { + var hash = {}; + for (var l = keys.length, i = 0; i < l; ++i) hash[keys[i]] = true; + return { + contains: function(key) { return hash[key]; }, + push: function(key) { + hash[key] = true; + return keys.push(key); + } + }; + } + + // Internal helper. Checks `keys` for the presence of keys in IE < 9 that won't + // be iterated by `for key in ...` and thus missed. Extends `keys` in place if + // needed. + function collectNonEnumProps(obj, keys) { + keys = emulatedSet(keys); + var nonEnumIdx = nonEnumerableProps.length; + var constructor = obj.constructor; + var proto = isFunction$1(constructor) && constructor.prototype || ObjProto; + + // Constructor is a special case. + var prop = 'constructor'; + if (has$1(obj, prop) && !keys.contains(prop)) keys.push(prop); + + while (nonEnumIdx--) { + prop = nonEnumerableProps[nonEnumIdx]; + if (prop in obj && obj[prop] !== proto[prop] && !keys.contains(prop)) { + keys.push(prop); + } + } + } + + // Retrieve the names of an object's own properties. + // Delegates to **ECMAScript 5**'s native `Object.keys`. + function keys(obj) { + if (!isObject(obj)) return []; + if (nativeKeys) return nativeKeys(obj); + var keys = []; + for (var key in obj) if (has$1(obj, key)) keys.push(key); + // Ahem, IE < 9. + if (hasEnumBug) collectNonEnumProps(obj, keys); + return keys; + } + + // Is a given array, string, or object empty? + // An "empty" object has no enumerable own-properties. + function isEmpty(obj) { + if (obj == null) return true; + // Skip the more expensive `toString`-based type checks if `obj` has no + // `.length`. + var length = getLength(obj); + if (typeof length == 'number' && ( + isArray(obj) || isString(obj) || isArguments$1(obj) + )) return length === 0; + return getLength(keys(obj)) === 0; + } + + // Returns whether an object has a given set of `key:value` pairs. + function isMatch(object, attrs) { + var _keys = keys(attrs), length = _keys.length; + if (object == null) return !length; + var obj = Object(object); + for (var i = 0; i < length; i++) { + var key = _keys[i]; + if (attrs[key] !== obj[key] || !(key in obj)) return false; + } + return true; + } + + // If Underscore is called as a function, it returns a wrapped object that can + // be used OO-style. This wrapper holds altered versions of all functions added + // through `_.mixin`. Wrapped objects may be chained. + function _$1(obj) { + if (obj instanceof _$1) return obj; + if (!(this instanceof _$1)) return new _$1(obj); + this._wrapped = obj; + } + + _$1.VERSION = VERSION; + + // Extracts the result from a wrapped and chained object. + _$1.prototype.value = function() { + return this._wrapped; }; - }; - - // An internal function for creating a new object that inherits from another. - var baseCreate = function(prototype) { - if (!_.isObject(prototype)) return {}; - if (nativeCreate) return nativeCreate(prototype); - Ctor.prototype = prototype; - var result = new Ctor; - Ctor.prototype = null; - return result; - }; - - // Helper for collection methods to determine whether a collection - // should be iterated as an array or as an object - // Related: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength - var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1; - var isArrayLike = function(collection) { - var length = collection && collection.length; - return typeof length == 'number' && length >= 0 && length <= MAX_ARRAY_INDEX; - }; - - // Collection Functions - // -------------------- - - // The cornerstone, an `each` implementation, aka `forEach`. - // Handles raw objects in addition to array-likes. Treats all - // sparse array-likes as if they were dense. - _.each = _.forEach = function(obj, iteratee, context) { - iteratee = optimizeCb(iteratee, context); - var i, length; - if (isArrayLike(obj)) { - for (i = 0, length = obj.length; i < length; i++) { - iteratee(obj[i], i, obj); - } - } else { - var keys = _.keys(obj); - for (i = 0, length = keys.length; i < length; i++) { - iteratee(obj[keys[i]], keys[i], obj); - } - } - return obj; - }; - - // Return the results of applying the iteratee to each element. - _.map = _.collect = function(obj, iteratee, context) { - iteratee = cb(iteratee, context); - var keys = !isArrayLike(obj) && _.keys(obj), - length = (keys || obj).length, - results = Array(length); - for (var index = 0; index < length; index++) { - var currentKey = keys ? keys[index] : index; - results[index] = iteratee(obj[currentKey], currentKey, obj); - } - return results; - }; - - // Create a reducing function iterating left or right. - function createReduce(dir) { - // Optimized iterator function as using arguments.length - // in the main function will deoptimize the, see #1991. - function iterator(obj, iteratee, memo, keys, index, length) { - for (; index >= 0 && index < length; index += dir) { - var currentKey = keys ? keys[index] : index; - memo = iteratee(memo, obj[currentKey], currentKey, obj); - } - return memo; - } - - return function(obj, iteratee, memo, context) { - iteratee = optimizeCb(iteratee, context, 4); - var keys = !isArrayLike(obj) && _.keys(obj), - length = (keys || obj).length, - index = dir > 0 ? 0 : length - 1; - // Determine the initial value if none is provided. - if (arguments.length < 3) { - memo = obj[keys ? keys[index] : index]; - index += dir; - } - return iterator(obj, iteratee, memo, keys, index, length); + + // Provide unwrapping proxies for some methods used in engine operations + // such as arithmetic and JSON stringification. + _$1.prototype.valueOf = _$1.prototype.toJSON = _$1.prototype.value; + + _$1.prototype.toString = function() { + return String(this._wrapped); }; - } - - // **Reduce** builds up a single result from a list of values, aka `inject`, - // or `foldl`. - _.reduce = _.foldl = _.inject = createReduce(1); - - // The right-associative version of reduce, also known as `foldr`. - _.reduceRight = _.foldr = createReduce(-1); - - // Return the first value which passes a truth test. Aliased as `detect`. - _.find = _.detect = function(obj, predicate, context) { - var key; - if (isArrayLike(obj)) { - key = _.findIndex(obj, predicate, context); - } else { - key = _.findKey(obj, predicate, context); - } - if (key !== void 0 && key !== -1) return obj[key]; - }; - - // Return all the elements that pass a truth test. - // Aliased as `select`. - _.filter = _.select = function(obj, predicate, context) { - var results = []; - predicate = cb(predicate, context); - _.each(obj, function(value, index, list) { - if (predicate(value, index, list)) results.push(value); - }); - return results; - }; - - // Return all the elements for which a truth test fails. - _.reject = function(obj, predicate, context) { - return _.filter(obj, _.negate(cb(predicate)), context); - }; - - // Determine whether all of the elements match a truth test. - // Aliased as `all`. - _.every = _.all = function(obj, predicate, context) { - predicate = cb(predicate, context); - var keys = !isArrayLike(obj) && _.keys(obj), - length = (keys || obj).length; - for (var index = 0; index < length; index++) { - var currentKey = keys ? keys[index] : index; - if (!predicate(obj[currentKey], currentKey, obj)) return false; - } - return true; - }; - - // Determine if at least one element in the object matches a truth test. - // Aliased as `any`. - _.some = _.any = function(obj, predicate, context) { - predicate = cb(predicate, context); - var keys = !isArrayLike(obj) && _.keys(obj), - length = (keys || obj).length; - for (var index = 0; index < length; index++) { - var currentKey = keys ? keys[index] : index; - if (predicate(obj[currentKey], currentKey, obj)) return true; - } - return false; - }; - - // Determine if the array or object contains a given value (using `===`). - // Aliased as `includes` and `include`. - _.contains = _.includes = _.include = function(obj, target, fromIndex) { - if (!isArrayLike(obj)) obj = _.values(obj); - return _.indexOf(obj, target, typeof fromIndex == 'number' && fromIndex) >= 0; - }; - - // Invoke a method (with arguments) on every item in a collection. - _.invoke = function(obj, method) { - var args = slice.call(arguments, 2); - var isFunc = _.isFunction(method); - return _.map(obj, function(value) { - var func = isFunc ? method : value[method]; - return func == null ? func : func.apply(value, args); - }); - }; - - // Convenience version of a common use case of `map`: fetching a property. - _.pluck = function(obj, key) { - return _.map(obj, _.property(key)); - }; - - // Convenience version of a common use case of `filter`: selecting only objects - // containing specific `key:value` pairs. - _.where = function(obj, attrs) { - return _.filter(obj, _.matcher(attrs)); - }; - - // Convenience version of a common use case of `find`: getting the first object - // containing specific `key:value` pairs. - _.findWhere = function(obj, attrs) { - return _.find(obj, _.matcher(attrs)); - }; - - // Return the maximum element (or element-based computation). - _.max = function(obj, iteratee, context) { - var result = -Infinity, lastComputed = -Infinity, - value, computed; - if (iteratee == null && obj != null) { - obj = isArrayLike(obj) ? obj : _.values(obj); - for (var i = 0, length = obj.length; i < length; i++) { - value = obj[i]; - if (value > result) { - result = value; + + // Internal function to wrap or shallow-copy an ArrayBuffer, + // typed array or DataView to a new view, reusing the buffer. + function toBufferView(bufferSource) { + return new Uint8Array( + bufferSource.buffer || bufferSource, + bufferSource.byteOffset || 0, + getByteLength(bufferSource) + ); + } + + // We use this string twice, so give it a name for minification. + var tagDataView = '[object DataView]'; + + // Internal recursive comparison function for `_.isEqual`. + function eq(a, b, aStack, bStack) { + // Identical objects are equal. `0 === -0`, but they aren't identical. + // See the [Harmony `egal` proposal](https://wiki.ecmascript.org/doku.php?id=harmony:egal). + if (a === b) return a !== 0 || 1 / a === 1 / b; + // `null` or `undefined` only equal to itself (strict comparison). + if (a == null || b == null) return false; + // `NaN`s are equivalent, but non-reflexive. + if (a !== a) return b !== b; + // Exhaust primitive checks + var type = typeof a; + if (type !== 'function' && type !== 'object' && typeof b != 'object') return false; + return deepEq(a, b, aStack, bStack); + } + + // Internal recursive comparison function for `_.isEqual`. + function deepEq(a, b, aStack, bStack) { + // Unwrap any wrapped objects. + if (a instanceof _$1) a = a._wrapped; + if (b instanceof _$1) b = b._wrapped; + // Compare `[[Class]]` names. + var className = toString.call(a); + if (className !== toString.call(b)) return false; + // Work around a bug in IE 10 - Edge 13. + if (hasStringTagBug && className == '[object Object]' && isDataView$1(a)) { + if (!isDataView$1(b)) return false; + className = tagDataView; } - } - } else { - iteratee = cb(iteratee, context); - _.each(obj, function(value, index, list) { - computed = iteratee(value, index, list); - if (computed > lastComputed || computed === -Infinity && result === -Infinity) { - result = value; - lastComputed = computed; + switch (className) { + // These types are compared by value. + case '[object RegExp]': + // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i') + case '[object String]': + // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is + // equivalent to `new String("5")`. + return '' + a === '' + b; + case '[object Number]': + // `NaN`s are equivalent, but non-reflexive. + // Object(NaN) is equivalent to NaN. + if (+a !== +a) return +b !== +b; + // An `egal` comparison is performed for other numeric values. + return +a === 0 ? 1 / +a === 1 / b : +a === +b; + case '[object Date]': + case '[object Boolean]': + // Coerce dates and booleans to numeric primitive values. Dates are compared by their + // millisecond representations. Note that invalid dates with millisecond representations + // of `NaN` are not equivalent. + return +a === +b; + case '[object Symbol]': + return SymbolProto.valueOf.call(a) === SymbolProto.valueOf.call(b); + case '[object ArrayBuffer]': + case tagDataView: + // Coerce to typed array so we can fall through. + return deepEq(toBufferView(a), toBufferView(b), aStack, bStack); } - }); - } - return result; - }; - - // Return the minimum element (or element-based computation). - _.min = function(obj, iteratee, context) { - var result = Infinity, lastComputed = Infinity, - value, computed; - if (iteratee == null && obj != null) { - obj = isArrayLike(obj) ? obj : _.values(obj); - for (var i = 0, length = obj.length; i < length; i++) { - value = obj[i]; - if (value < result) { - result = value; + + var areArrays = className === '[object Array]'; + if (!areArrays && isTypedArray$1(a)) { + var byteLength = getByteLength(a); + if (byteLength !== getByteLength(b)) return false; + if (a.buffer === b.buffer && a.byteOffset === b.byteOffset) return true; + areArrays = true; } - } - } else { - iteratee = cb(iteratee, context); - _.each(obj, function(value, index, list) { - computed = iteratee(value, index, list); - if (computed < lastComputed || computed === Infinity && result === Infinity) { - result = value; - lastComputed = computed; + if (!areArrays) { + if (typeof a != 'object' || typeof b != 'object') return false; + + // Objects with different constructors are not equivalent, but `Object`s or `Array`s + // from different frames are. + var aCtor = a.constructor, bCtor = b.constructor; + if (aCtor !== bCtor && !(isFunction$1(aCtor) && aCtor instanceof aCtor && + isFunction$1(bCtor) && bCtor instanceof bCtor) + && ('constructor' in a && 'constructor' in b)) { + return false; + } } - }); - } - return result; - }; - - // Shuffle a collection, using the modern version of the - // [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher–Yates_shuffle). - _.shuffle = function(obj) { - var set = isArrayLike(obj) ? obj : _.values(obj); - var length = set.length; - var shuffled = Array(length); - for (var index = 0, rand; index < length; index++) { - rand = _.random(0, index); - if (rand !== index) shuffled[index] = shuffled[rand]; - shuffled[rand] = set[index]; - } - return shuffled; - }; - - // Sample **n** random values from a collection. - // If **n** is not specified, returns a single random element. - // The internal `guard` argument allows it to work with `map`. - _.sample = function(obj, n, guard) { - if (n == null || guard) { - if (!isArrayLike(obj)) obj = _.values(obj); - return obj[_.random(obj.length - 1)]; - } - return _.shuffle(obj).slice(0, Math.max(0, n)); - }; - - // Sort the object's values by a criterion produced by an iteratee. - _.sortBy = function(obj, iteratee, context) { - iteratee = cb(iteratee, context); - return _.pluck(_.map(obj, function(value, index, list) { - return { - value: value, - index: index, - criteria: iteratee(value, index, list) - }; - }).sort(function(left, right) { - var a = left.criteria; - var b = right.criteria; - if (a !== b) { - if (a > b || a === void 0) return 1; - if (a < b || b === void 0) return -1; - } - return left.index - right.index; - }), 'value'); - }; - - // An internal function used for aggregate "group by" operations. - var group = function(behavior) { - return function(obj, iteratee, context) { - var result = {}; - iteratee = cb(iteratee, context); - _.each(obj, function(value, index) { - var key = iteratee(value, index, obj); - behavior(result, value, key); - }); - return result; - }; - }; - - // Groups the object's values by a criterion. Pass either a string attribute - // to group by, or a function that returns the criterion. - _.groupBy = group(function(result, value, key) { - if (_.has(result, key)) result[key].push(value); else result[key] = [value]; - }); - - // Indexes the object's values by a criterion, similar to `groupBy`, but for - // when you know that your index values will be unique. - _.indexBy = group(function(result, value, key) { - result[key] = value; - }); - - // Counts instances of an object that group by a certain criterion. Pass - // either a string attribute to count by, or a function that returns the - // criterion. - _.countBy = group(function(result, value, key) { - if (_.has(result, key)) result[key]++; else result[key] = 1; - }); - - // Safely create a real, live array from anything iterable. - _.toArray = function(obj) { - if (!obj) return []; - if (_.isArray(obj)) return slice.call(obj); - if (isArrayLike(obj)) return _.map(obj, _.identity); - return _.values(obj); - }; - - // Return the number of elements in an object. - _.size = function(obj) { - if (obj == null) return 0; - return isArrayLike(obj) ? obj.length : _.keys(obj).length; - }; - - // Split a collection into two arrays: one whose elements all satisfy the given - // predicate, and one whose elements all do not satisfy the predicate. - _.partition = function(obj, predicate, context) { - predicate = cb(predicate, context); - var pass = [], fail = []; - _.each(obj, function(value, key, obj) { - (predicate(value, key, obj) ? pass : fail).push(value); - }); - return [pass, fail]; - }; - - // Array Functions - // --------------- - - // Get the first element of an array. Passing **n** will return the first N - // values in the array. Aliased as `head` and `take`. The **guard** check - // allows it to work with `_.map`. - _.first = _.head = _.take = function(array, n, guard) { - if (array == null) return void 0; - if (n == null || guard) return array[0]; - return _.initial(array, array.length - n); - }; - - // Returns everything but the last entry of the array. Especially useful on - // the arguments object. Passing **n** will return all the values in - // the array, excluding the last N. - _.initial = function(array, n, guard) { - return slice.call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n))); - }; - - // Get the last element of an array. Passing **n** will return the last N - // values in the array. - _.last = function(array, n, guard) { - if (array == null) return void 0; - if (n == null || guard) return array[array.length - 1]; - return _.rest(array, Math.max(0, array.length - n)); - }; - - // Returns everything but the first entry of the array. Aliased as `tail` and `drop`. - // Especially useful on the arguments object. Passing an **n** will return - // the rest N values in the array. - _.rest = _.tail = _.drop = function(array, n, guard) { - return slice.call(array, n == null || guard ? 1 : n); - }; - - // Trim out all falsy values from an array. - _.compact = function(array) { - return _.filter(array, _.identity); - }; - - // Internal implementation of a recursive `flatten` function. - var flatten = function(input, shallow, strict, startIndex) { - var output = [], idx = 0; - for (var i = startIndex || 0, length = input && input.length; i < length; i++) { - var value = input[i]; - if (isArrayLike(value) && (_.isArray(value) || _.isArguments(value))) { - //flatten current level of array or arguments object - if (!shallow) value = flatten(value, shallow, strict); - var j = 0, len = value.length; - output.length += len; - while (j < len) { - output[idx++] = value[j++]; + // Assume equality for cyclic structures. The algorithm for detecting cyclic + // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. + + // Initializing stack of traversed objects. + // It's done here since we only need them for objects and arrays comparison. + aStack = aStack || []; + bStack = bStack || []; + var length = aStack.length; + while (length--) { + // Linear search. Performance is inversely proportional to the number of + // unique nested structures. + if (aStack[length] === a) return bStack[length] === b; } - } else if (!strict) { - output[idx++] = value; - } - } - return output; - }; - - // Flatten out an array, either recursively (by default), or just one level. - _.flatten = function(array, shallow) { - return flatten(array, shallow, false); - }; - - // Return a version of the array that does not contain the specified value(s). - _.without = function(array) { - return _.difference(array, slice.call(arguments, 1)); - }; - - // Produce a duplicate-free version of the array. If the array has already - // been sorted, you have the option of using a faster algorithm. - // Aliased as `unique`. - _.uniq = _.unique = function(array, isSorted, iteratee, context) { - if (array == null) return []; - if (!_.isBoolean(isSorted)) { - context = iteratee; - iteratee = isSorted; - isSorted = false; - } - if (iteratee != null) iteratee = cb(iteratee, context); - var result = []; - var seen = []; - for (var i = 0, length = array.length; i < length; i++) { - var value = array[i], - computed = iteratee ? iteratee(value, i, array) : value; - if (isSorted) { - if (!i || seen !== computed) result.push(value); - seen = computed; - } else if (iteratee) { - if (!_.contains(seen, computed)) { - seen.push(computed); - result.push(value); + + // Add the first object to the stack of traversed objects. + aStack.push(a); + bStack.push(b); + + // Recursively compare objects and arrays. + if (areArrays) { + // Compare array lengths to determine if a deep comparison is necessary. + length = a.length; + if (length !== b.length) return false; + // Deep compare the contents, ignoring non-numeric properties. + while (length--) { + if (!eq(a[length], b[length], aStack, bStack)) return false; + } + } else { + // Deep compare objects. + var _keys = keys(a), key; + length = _keys.length; + // Ensure that both objects contain the same number of properties before comparing deep equality. + if (keys(b).length !== length) return false; + while (length--) { + // Deep compare each member + key = _keys[length]; + if (!(has$1(b, key) && eq(a[key], b[key], aStack, bStack))) return false; + } } - } else if (!_.contains(result, value)) { - result.push(value); - } - } - return result; - }; - - // Produce an array that contains the union: each distinct element from all of - // the passed-in arrays. - _.union = function() { - return _.uniq(flatten(arguments, true, true)); - }; - - // Produce an array that contains every item shared between all the - // passed-in arrays. - _.intersection = function(array) { - if (array == null) return []; - var result = []; - var argsLength = arguments.length; - for (var i = 0, length = array.length; i < length; i++) { - var item = array[i]; - if (_.contains(result, item)) continue; - for (var j = 1; j < argsLength; j++) { - if (!_.contains(arguments[j], item)) break; - } - if (j === argsLength) result.push(item); - } - return result; - }; - - // Take the difference between one array and a number of other arrays. - // Only the elements present in just the first array will remain. - _.difference = function(array) { - var rest = flatten(arguments, true, true, 1); - return _.filter(array, function(value){ - return !_.contains(rest, value); - }); - }; - - // Zip together multiple lists into a single array -- elements that share - // an index go together. - _.zip = function() { - return _.unzip(arguments); - }; - - // Complement of _.zip. Unzip accepts an array of arrays and groups - // each array's elements on shared indices - _.unzip = function(array) { - var length = array && _.max(array, 'length').length || 0; - var result = Array(length); - - for (var index = 0; index < length; index++) { - result[index] = _.pluck(array, index); - } - return result; - }; - - // Converts lists into objects. Pass either a single array of `[key, value]` - // pairs, or two parallel arrays of the same length -- one of keys, and one of - // the corresponding values. - _.object = function(list, values) { - var result = {}; - for (var i = 0, length = list && list.length; i < length; i++) { - if (values) { - result[list[i]] = values[i]; - } else { - result[list[i][0]] = list[i][1]; - } - } - return result; - }; - - // Return the position of the first occurrence of an item in an array, - // or -1 if the item is not included in the array. - // If the array is large and already in sort order, pass `true` - // for **isSorted** to use binary search. - _.indexOf = function(array, item, isSorted) { - var i = 0, length = array && array.length; - if (typeof isSorted == 'number') { - i = isSorted < 0 ? Math.max(0, length + isSorted) : isSorted; - } else if (isSorted && length) { - i = _.sortedIndex(array, item); - return array[i] === item ? i : -1; - } - if (item !== item) { - return _.findIndex(slice.call(array, i), _.isNaN); - } - for (; i < length; i++) if (array[i] === item) return i; - return -1; - }; - - _.lastIndexOf = function(array, item, from) { - var idx = array ? array.length : 0; - if (typeof from == 'number') { - idx = from < 0 ? idx + from + 1 : Math.min(idx, from + 1); - } - if (item !== item) { - return _.findLastIndex(slice.call(array, 0, idx), _.isNaN); - } - while (--idx >= 0) if (array[idx] === item) return idx; - return -1; - }; - - // Generator function to create the findIndex and findLastIndex functions - function createIndexFinder(dir) { - return function(array, predicate, context) { - predicate = cb(predicate, context); - var length = array != null && array.length; - var index = dir > 0 ? 0 : length - 1; - for (; index >= 0 && index < length; index += dir) { - if (predicate(array[index], index, array)) return index; - } - return -1; - }; - } - - // Returns the first index on an array-like that passes a predicate test - _.findIndex = createIndexFinder(1); - - _.findLastIndex = createIndexFinder(-1); - - // Use a comparator function to figure out the smallest index at which - // an object should be inserted so as to maintain order. Uses binary search. - _.sortedIndex = function(array, obj, iteratee, context) { - iteratee = cb(iteratee, context, 1); - var value = iteratee(obj); - var low = 0, high = array.length; - while (low < high) { - var mid = Math.floor((low + high) / 2); - if (iteratee(array[mid]) < value) low = mid + 1; else high = mid; - } - return low; - }; - - // Generate an integer Array containing an arithmetic progression. A port of - // the native Python `range()` function. See - // [the Python documentation](http://docs.python.org/library/functions.html#range). - _.range = function(start, stop, step) { - if (arguments.length <= 1) { - stop = start || 0; - start = 0; - } - step = step || 1; - - var length = Math.max(Math.ceil((stop - start) / step), 0); - var range = Array(length); - - for (var idx = 0; idx < length; idx++, start += step) { - range[idx] = start; - } - - return range; - }; - - // Function (ahem) Functions - // ------------------ - - // Determines whether to execute a function as a constructor - // or a normal function with the provided arguments - var executeBound = function(sourceFunc, boundFunc, context, callingContext, args) { - if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args); - var self = baseCreate(sourceFunc.prototype); - var result = sourceFunc.apply(self, args); - if (_.isObject(result)) return result; - return self; - }; - - // Create a function bound to a given object (assigning `this`, and arguments, - // optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if - // available. - _.bind = function(func, context) { - if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1)); - if (!_.isFunction(func)) throw new TypeError('Bind must be called on a function'); - var args = slice.call(arguments, 2); - var bound = function() { - return executeBound(func, bound, context, this, args.concat(slice.call(arguments))); - }; - return bound; - }; - - // Partially apply a function by creating a version that has had some of its - // arguments pre-filled, without changing its dynamic `this` context. _ acts - // as a placeholder, allowing any combination of arguments to be pre-filled. - _.partial = function(func) { - var boundArgs = slice.call(arguments, 1); - var bound = function() { - var position = 0, length = boundArgs.length; - var args = Array(length); - for (var i = 0; i < length; i++) { - args[i] = boundArgs[i] === _ ? arguments[position++] : boundArgs[i]; - } - while (position < arguments.length) args.push(arguments[position++]); - return executeBound(func, bound, this, this, args); - }; - return bound; - }; - - // Bind a number of an object's methods to that object. Remaining arguments - // are the method names to be bound. Useful for ensuring that all callbacks - // defined on an object belong to it. - _.bindAll = function(obj) { - var i, length = arguments.length, key; - if (length <= 1) throw new Error('bindAll must be passed function names'); - for (i = 1; i < length; i++) { - key = arguments[i]; - obj[key] = _.bind(obj[key], obj); - } - return obj; - }; - - // Memoize an expensive function by storing its results. - _.memoize = function(func, hasher) { - var memoize = function(key) { - var cache = memoize.cache; - var address = '' + (hasher ? hasher.apply(this, arguments) : key); - if (!_.has(cache, address)) cache[address] = func.apply(this, arguments); - return cache[address]; - }; - memoize.cache = {}; - return memoize; - }; - - // Delays a function for the given number of milliseconds, and then calls - // it with the arguments supplied. - _.delay = function(func, wait) { - var args = slice.call(arguments, 2); - return setTimeout(function(){ - return func.apply(null, args); - }, wait); - }; - - // Defers a function, scheduling it to run after the current call stack has - // cleared. - _.defer = _.partial(_.delay, _, 1); - - // Returns a function, that, when invoked, will only be triggered at most once - // during a given window of time. Normally, the throttled function will run - // as much as it can, without ever going more than once per `wait` duration; - // but if you'd like to disable the execution on the leading edge, pass - // `{leading: false}`. To disable execution on the trailing edge, ditto. - _.throttle = function(func, wait, options) { - var context, args, result; - var timeout = null; - var previous = 0; - if (!options) options = {}; - var later = function() { - previous = options.leading === false ? 0 : _.now(); - timeout = null; - result = func.apply(context, args); - if (!timeout) context = args = null; - }; - return function() { - var now = _.now(); - if (!previous && options.leading === false) previous = now; - var remaining = wait - (now - previous); - context = this; - args = arguments; - if (remaining <= 0 || remaining > wait) { - if (timeout) { - clearTimeout(timeout); - timeout = null; + // Remove the first object from the stack of traversed objects. + aStack.pop(); + bStack.pop(); + return true; + } + + // Perform a deep comparison to check if two objects are equal. + function isEqual(a, b) { + return eq(a, b); + } + + // Retrieve all the enumerable property names of an object. + function allKeys(obj) { + if (!isObject(obj)) return []; + var keys = []; + for (var key in obj) keys.push(key); + // Ahem, IE < 9. + if (hasEnumBug) collectNonEnumProps(obj, keys); + return keys; + } + + // Since the regular `Object.prototype.toString` type tests don't work for + // some types in IE 11, we use a fingerprinting heuristic instead, based + // on the methods. It's not great, but it's the best we got. + // The fingerprint method lists are defined below. + function ie11fingerprint(methods) { + var length = getLength(methods); + return function(obj) { + if (obj == null) return false; + // `Map`, `WeakMap` and `Set` have no enumerable keys. + var keys = allKeys(obj); + if (getLength(keys)) return false; + for (var i = 0; i < length; i++) { + if (!isFunction$1(obj[methods[i]])) return false; + } + // If we are testing against `WeakMap`, we need to ensure that + // `obj` doesn't have a `forEach` method in order to distinguish + // it from a regular `Map`. + return methods !== weakMapMethods || !isFunction$1(obj[forEachName]); + }; + } + + // In the interest of compact minification, we write + // each string in the fingerprints only once. + var forEachName = 'forEach', + hasName = 'has', + commonInit = ['clear', 'delete'], + mapTail = ['get', hasName, 'set']; + + // `Map`, `WeakMap` and `Set` each have slightly different + // combinations of the above sublists. + var mapMethods = commonInit.concat(forEachName, mapTail), + weakMapMethods = commonInit.concat(mapTail), + setMethods = ['add'].concat(commonInit, forEachName, hasName); + + var isMap = isIE11 ? ie11fingerprint(mapMethods) : tagTester('Map'); + + var isWeakMap = isIE11 ? ie11fingerprint(weakMapMethods) : tagTester('WeakMap'); + + var isSet = isIE11 ? ie11fingerprint(setMethods) : tagTester('Set'); + + var isWeakSet = tagTester('WeakSet'); + + // Retrieve the values of an object's properties. + function values(obj) { + var _keys = keys(obj); + var length = _keys.length; + var values = Array(length); + for (var i = 0; i < length; i++) { + values[i] = obj[_keys[i]]; } - previous = now; - result = func.apply(context, args); - if (!timeout) context = args = null; - } else if (!timeout && options.trailing !== false) { - timeout = setTimeout(later, remaining); - } - return result; - }; - }; - - // Returns a function, that, as long as it continues to be invoked, will not - // be triggered. The function will be called after it stops being called for - // N milliseconds. If `immediate` is passed, trigger the function on the - // leading edge, instead of the trailing. - _.debounce = function(func, wait, immediate) { - var timeout, args, context, timestamp, result; - - var later = function() { - var last = _.now() - timestamp; - - if (last < wait && last >= 0) { - timeout = setTimeout(later, wait - last); - } else { - timeout = null; - if (!immediate) { - result = func.apply(context, args); - if (!timeout) context = args = null; + return values; + } + + // Convert an object into a list of `[key, value]` pairs. + // The opposite of `_.object` with one argument. + function pairs(obj) { + var _keys = keys(obj); + var length = _keys.length; + var pairs = Array(length); + for (var i = 0; i < length; i++) { + pairs[i] = [_keys[i], obj[_keys[i]]]; } - } - }; + return pairs; + } - return function() { - context = this; - args = arguments; - timestamp = _.now(); - var callNow = immediate && !timeout; - if (!timeout) timeout = setTimeout(later, wait); - if (callNow) { - result = func.apply(context, args); - context = args = null; - } - - return result; - }; - }; - - // Returns the first function passed as an argument to the second, - // allowing you to adjust arguments, run code before and after, and - // conditionally execute the original function. - _.wrap = function(func, wrapper) { - return _.partial(wrapper, func); - }; - - // Returns a negated version of the passed-in predicate. - _.negate = function(predicate) { - return function() { - return !predicate.apply(this, arguments); + // Invert the keys and values of an object. The values must be serializable. + function invert(obj) { + var result = {}; + var _keys = keys(obj); + for (var i = 0, length = _keys.length; i < length; i++) { + result[obj[_keys[i]]] = _keys[i]; + } + return result; + } + + // Return a sorted list of the function names available on the object. + function functions(obj) { + var names = []; + for (var key in obj) { + if (isFunction$1(obj[key])) names.push(key); + } + return names.sort(); + } + + // An internal function for creating assigner functions. + function createAssigner(keysFunc, defaults) { + return function(obj) { + var length = arguments.length; + if (defaults) obj = Object(obj); + if (length < 2 || obj == null) return obj; + for (var index = 1; index < length; index++) { + var source = arguments[index], + keys = keysFunc(source), + l = keys.length; + for (var i = 0; i < l; i++) { + var key = keys[i]; + if (!defaults || obj[key] === void 0) obj[key] = source[key]; + } + } + return obj; + }; + } + + // Extend a given object with all the properties in passed-in object(s). + var extend = createAssigner(allKeys); + + // Assigns a given object with all the own properties in the passed-in + // object(s). + // (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) + var extendOwn = createAssigner(keys); + + // Fill in a given object with default properties. + var defaults = createAssigner(allKeys, true); + + // Create a naked function reference for surrogate-prototype-swapping. + function ctor() { + return function(){}; + } + + // An internal function for creating a new object that inherits from another. + function baseCreate(prototype) { + if (!isObject(prototype)) return {}; + if (nativeCreate) return nativeCreate(prototype); + var Ctor = ctor(); + Ctor.prototype = prototype; + var result = new Ctor; + Ctor.prototype = null; + return result; + } + + // Creates an object that inherits from the given prototype object. + // If additional properties are provided then they will be added to the + // created object. + function create(prototype, props) { + var result = baseCreate(prototype); + if (props) extendOwn(result, props); + return result; + } + + // Create a (shallow-cloned) duplicate of an object. + function clone(obj) { + if (!isObject(obj)) return obj; + return isArray(obj) ? obj.slice() : extend({}, obj); + } + + // Invokes `interceptor` with the `obj` and then returns `obj`. + // The primary purpose of this method is to "tap into" a method chain, in + // order to perform operations on intermediate results within the chain. + function tap(obj, interceptor) { + interceptor(obj); + return obj; + } + + // Normalize a (deep) property `path` to array. + // Like `_.iteratee`, this function can be customized. + function toPath$1(path) { + return isArray(path) ? path : [path]; + } + _$1.toPath = toPath$1; + + // Internal wrapper for `_.toPath` to enable minification. + // Similar to `cb` for `_.iteratee`. + function toPath(path) { + return _$1.toPath(path); + } + + // Internal function to obtain a nested property in `obj` along `path`. + function deepGet(obj, path) { + var length = path.length; + for (var i = 0; i < length; i++) { + if (obj == null) return void 0; + obj = obj[path[i]]; + } + return length ? obj : void 0; + } + + // Get the value of the (deep) property on `path` from `object`. + // If any property in `path` does not exist or if the value is + // `undefined`, return `defaultValue` instead. + // The `path` is normalized through `_.toPath`. + function get(object, path, defaultValue) { + var value = deepGet(object, toPath(path)); + return isUndefined(value) ? defaultValue : value; + } + + // Shortcut function for checking if an object has a given property directly on + // itself (in other words, not on a prototype). Unlike the internal `has` + // function, this public version can also traverse nested properties. + function has(obj, path) { + path = toPath(path); + var length = path.length; + for (var i = 0; i < length; i++) { + var key = path[i]; + if (!has$1(obj, key)) return false; + obj = obj[key]; + } + return !!length; + } + + // Keep the identity function around for default iteratees. + function identity(value) { + return value; + } + + // Returns a predicate for checking whether an object has a given set of + // `key:value` pairs. + function matcher(attrs) { + attrs = extendOwn({}, attrs); + return function(obj) { + return isMatch(obj, attrs); + }; + } + + // Creates a function that, when passed an object, will traverse that object’s + // properties down the given `path`, specified as an array of keys or indices. + function property(path) { + path = toPath(path); + return function(obj) { + return deepGet(obj, path); + }; + } + + // Internal function that returns an efficient (for current engines) version + // of the passed-in callback, to be repeatedly applied in other Underscore + // functions. + function optimizeCb(func, context, argCount) { + if (context === void 0) return func; + switch (argCount == null ? 3 : argCount) { + case 1: return function(value) { + return func.call(context, value); + }; + // The 2-argument case is omitted because we’re not using it. + case 3: return function(value, index, collection) { + return func.call(context, value, index, collection); + }; + case 4: return function(accumulator, value, index, collection) { + return func.call(context, accumulator, value, index, collection); + }; + } + return function() { + return func.apply(context, arguments); + }; + } + + // An internal function to generate callbacks that can be applied to each + // element in a collection, returning the desired result — either `_.identity`, + // an arbitrary callback, a property matcher, or a property accessor. + function baseIteratee(value, context, argCount) { + if (value == null) return identity; + if (isFunction$1(value)) return optimizeCb(value, context, argCount); + if (isObject(value) && !isArray(value)) return matcher(value); + return property(value); + } + + // External wrapper for our callback generator. Users may customize + // `_.iteratee` if they want additional predicate/iteratee shorthand styles. + // This abstraction hides the internal-only `argCount` argument. + function iteratee(value, context) { + return baseIteratee(value, context, Infinity); + } + _$1.iteratee = iteratee; + + // The function we call internally to generate a callback. It invokes + // `_.iteratee` if overridden, otherwise `baseIteratee`. + function cb(value, context, argCount) { + if (_$1.iteratee !== iteratee) return _$1.iteratee(value, context); + return baseIteratee(value, context, argCount); + } + + // Returns the results of applying the `iteratee` to each element of `obj`. + // In contrast to `_.map` it returns an object. + function mapObject(obj, iteratee, context) { + iteratee = cb(iteratee, context); + var _keys = keys(obj), + length = _keys.length, + results = {}; + for (var index = 0; index < length; index++) { + var currentKey = _keys[index]; + results[currentKey] = iteratee(obj[currentKey], currentKey, obj); + } + return results; + } + + // Predicate-generating function. Often useful outside of Underscore. + function noop(){} + + // Generates a function for a given object that returns a given property. + function propertyOf(obj) { + if (obj == null) return noop; + return function(path) { + return get(obj, path); + }; + } + + // Run a function **n** times. + function times(n, iteratee, context) { + var accum = Array(Math.max(0, n)); + iteratee = optimizeCb(iteratee, context, 1); + for (var i = 0; i < n; i++) accum[i] = iteratee(i); + return accum; + } + + // Return a random integer between `min` and `max` (inclusive). + function random(min, max) { + if (max == null) { + max = min; + min = 0; + } + return min + Math.floor(Math.random() * (max - min + 1)); + } + + // A (possibly faster) way to get the current timestamp as an integer. + var now = Date.now || function() { + return new Date().getTime(); }; - }; - - // Returns a function that is the composition of a list of functions, each - // consuming the return value of the function that follows. - _.compose = function() { - var args = arguments; - var start = args.length - 1; - return function() { - var i = start; - var result = args[start].apply(this, arguments); - while (i--) result = args[i].call(this, result); - return result; + + // Internal helper to generate functions for escaping and unescaping strings + // to/from HTML interpolation. + function createEscaper(map) { + var escaper = function(match) { + return map[match]; + }; + // Regexes for identifying a key that needs to be escaped. + var source = '(?:' + keys(map).join('|') + ')'; + var testRegexp = RegExp(source); + var replaceRegexp = RegExp(source, 'g'); + return function(string) { + string = string == null ? '' : '' + string; + return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string; + }; + } + + // Internal list of HTML entities for escaping. + var escapeMap = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + '`': '`' }; - }; - - // Returns a function that will only be executed on and after the Nth call. - _.after = function(times, func) { - return function() { - if (--times < 1) { - return func.apply(this, arguments); - } + + // Function for escaping strings to HTML interpolation. + var _escape = createEscaper(escapeMap); + + // Internal list of HTML entities for unescaping. + var unescapeMap = invert(escapeMap); + + // Function for unescaping strings from HTML interpolation. + var _unescape = createEscaper(unescapeMap); + + // By default, Underscore uses ERB-style template delimiters. Change the + // following template settings to use alternative delimiters. + var templateSettings = _$1.templateSettings = { + evaluate: /<%([\s\S]+?)%>/g, + interpolate: /<%=([\s\S]+?)%>/g, + escape: /<%-([\s\S]+?)%>/g }; - }; - - // Returns a function that will only be executed up to (but not including) the Nth call. - _.before = function(times, func) { - var memo; - return function() { - if (--times > 0) { - memo = func.apply(this, arguments); - } - if (times <= 1) func = null; - return memo; + + // When customizing `_.templateSettings`, if you don't want to define an + // interpolation, evaluation or escaping regex, we need one that is + // guaranteed not to match. + var noMatch = /(.)^/; + + // Certain characters need to be escaped so that they can be put into a + // string literal. + var escapes = { + "'": "'", + '\\': '\\', + '\r': 'r', + '\n': 'n', + '\u2028': 'u2028', + '\u2029': 'u2029' }; - }; - - // Returns a function that will be executed at most one time, no matter how - // often you call it. Useful for lazy initialization. - _.once = _.partial(_.before, 2); - - // Object Functions - // ---------------- - - // Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed. - var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString'); - var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString', - 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString']; - - function collectNonEnumProps(obj, keys) { - var nonEnumIdx = nonEnumerableProps.length; - var constructor = obj.constructor; - var proto = (_.isFunction(constructor) && constructor.prototype) || ObjProto; - - // Constructor is a special case. - var prop = 'constructor'; - if (_.has(obj, prop) && !_.contains(keys, prop)) keys.push(prop); - - while (nonEnumIdx--) { - prop = nonEnumerableProps[nonEnumIdx]; - if (prop in obj && obj[prop] !== proto[prop] && !_.contains(keys, prop)) { - keys.push(prop); - } - } - } - - // Retrieve the names of an object's own properties. - // Delegates to **ECMAScript 5**'s native `Object.keys` - _.keys = function(obj) { - if (!_.isObject(obj)) return []; - if (nativeKeys) return nativeKeys(obj); - var keys = []; - for (var key in obj) if (_.has(obj, key)) keys.push(key); - // Ahem, IE < 9. - if (hasEnumBug) collectNonEnumProps(obj, keys); - return keys; - }; - - // Retrieve all the property names of an object. - _.allKeys = function(obj) { - if (!_.isObject(obj)) return []; - var keys = []; - for (var key in obj) keys.push(key); - // Ahem, IE < 9. - if (hasEnumBug) collectNonEnumProps(obj, keys); - return keys; - }; - - // Retrieve the values of an object's properties. - _.values = function(obj) { - var keys = _.keys(obj); - var length = keys.length; - var values = Array(length); - for (var i = 0; i < length; i++) { - values[i] = obj[keys[i]]; - } - return values; - }; - - // Returns the results of applying the iteratee to each element of the object - // In contrast to _.map it returns an object - _.mapObject = function(obj, iteratee, context) { - iteratee = cb(iteratee, context); - var keys = _.keys(obj), - length = keys.length, - results = {}, - currentKey; - for (var index = 0; index < length; index++) { - currentKey = keys[index]; - results[currentKey] = iteratee(obj[currentKey], currentKey, obj); - } - return results; - }; - - // Convert an object into a list of `[key, value]` pairs. - _.pairs = function(obj) { - var keys = _.keys(obj); - var length = keys.length; - var pairs = Array(length); - for (var i = 0; i < length; i++) { - pairs[i] = [keys[i], obj[keys[i]]]; - } - return pairs; - }; - - // Invert the keys and values of an object. The values must be serializable. - _.invert = function(obj) { - var result = {}; - var keys = _.keys(obj); - for (var i = 0, length = keys.length; i < length; i++) { - result[obj[keys[i]]] = keys[i]; - } - return result; - }; - - // Return a sorted list of the function names available on the object. - // Aliased as `methods` - _.functions = _.methods = function(obj) { - var names = []; - for (var key in obj) { - if (_.isFunction(obj[key])) names.push(key); - } - return names.sort(); - }; - - // Extend a given object with all the properties in passed-in object(s). - _.extend = createAssigner(_.allKeys); - - // Assigns a given object with all the own properties in the passed-in object(s) - // (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) - _.extendOwn = _.assign = createAssigner(_.keys); - - // Returns the first key on an object that passes a predicate test - _.findKey = function(obj, predicate, context) { - predicate = cb(predicate, context); - var keys = _.keys(obj), key; - for (var i = 0, length = keys.length; i < length; i++) { - key = keys[i]; - if (predicate(obj[key], key, obj)) return key; - } - }; - - // Return a copy of the object only containing the whitelisted properties. - _.pick = function(object, oiteratee, context) { - var result = {}, obj = object, iteratee, keys; - if (obj == null) return result; - if (_.isFunction(oiteratee)) { - keys = _.allKeys(obj); - iteratee = optimizeCb(oiteratee, context); - } else { - keys = flatten(arguments, false, false, 1); - iteratee = function(value, key, obj) { return key in obj; }; - obj = Object(obj); - } - for (var i = 0, length = keys.length; i < length; i++) { - var key = keys[i]; - var value = obj[key]; - if (iteratee(value, key, obj)) result[key] = value; - } - return result; - }; - - // Return a copy of the object without the blacklisted properties. - _.omit = function(obj, iteratee, context) { - if (_.isFunction(iteratee)) { - iteratee = _.negate(iteratee); - } else { - var keys = _.map(flatten(arguments, false, false, 1), String); - iteratee = function(value, key) { - return !_.contains(keys, key); - }; - } - return _.pick(obj, iteratee, context); - }; - - // Fill in a given object with default properties. - _.defaults = createAssigner(_.allKeys, true); - - // Create a (shallow-cloned) duplicate of an object. - _.clone = function(obj) { - if (!_.isObject(obj)) return obj; - return _.isArray(obj) ? obj.slice() : _.extend({}, obj); - }; - - // Invokes interceptor with the obj, and then returns obj. - // The primary purpose of this method is to "tap into" a method chain, in - // order to perform operations on intermediate results within the chain. - _.tap = function(obj, interceptor) { - interceptor(obj); - return obj; - }; - - // Returns whether an object has a given set of `key:value` pairs. - _.isMatch = function(object, attrs) { - var keys = _.keys(attrs), length = keys.length; - if (object == null) return !length; - var obj = Object(object); - for (var i = 0; i < length; i++) { - var key = keys[i]; - if (attrs[key] !== obj[key] || !(key in obj)) return false; - } - return true; - }; - - - // Internal recursive comparison function for `isEqual`. - var eq = function(a, b, aStack, bStack) { - // Identical objects are equal. `0 === -0`, but they aren't identical. - // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal). - if (a === b) return a !== 0 || 1 / a === 1 / b; - // A strict comparison is necessary because `null == undefined`. - if (a == null || b == null) return a === b; - // Unwrap any wrapped objects. - if (a instanceof _) a = a._wrapped; - if (b instanceof _) b = b._wrapped; - // Compare `[[Class]]` names. - var className = toString.call(a); - if (className !== toString.call(b)) return false; - switch (className) { - // Strings, numbers, regular expressions, dates, and booleans are compared by value. - case '[object RegExp]': - // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i') - case '[object String]': - // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is - // equivalent to `new String("5")`. - return '' + a === '' + b; - case '[object Number]': - // `NaN`s are equivalent, but non-reflexive. - // Object(NaN) is equivalent to NaN - if (+a !== +a) return +b !== +b; - // An `egal` comparison is performed for other numeric values. - return +a === 0 ? 1 / +a === 1 / b : +a === +b; - case '[object Date]': - case '[object Boolean]': - // Coerce dates and booleans to numeric primitive values. Dates are compared by their - // millisecond representations. Note that invalid dates with millisecond representations - // of `NaN` are not equivalent. - return +a === +b; - } - - var areArrays = className === '[object Array]'; - if (!areArrays) { - if (typeof a != 'object' || typeof b != 'object') return false; - - // Objects with different constructors are not equivalent, but `Object`s or `Array`s - // from different frames are. - var aCtor = a.constructor, bCtor = b.constructor; - if (aCtor !== bCtor && !(_.isFunction(aCtor) && aCtor instanceof aCtor && - _.isFunction(bCtor) && bCtor instanceof bCtor) - && ('constructor' in a && 'constructor' in b)) { + + var escapeRegExp = /\\|'|\r|\n|\u2028|\u2029/g; + + function escapeChar(match) { + return '\\' + escapes[match]; + } + + // In order to prevent third-party code injection through + // `_.templateSettings.variable`, we test it against the following regular + // expression. It is intentionally a bit more liberal than just matching valid + // identifiers, but still prevents possible loopholes through defaults or + // destructuring assignment. + var bareIdentifier = /^\s*(\w|\$)+\s*$/; + + // JavaScript micro-templating, similar to John Resig's implementation. + // Underscore templating handles arbitrary delimiters, preserves whitespace, + // and correctly escapes quotes within interpolated code. + // NB: `oldSettings` only exists for backwards compatibility. + function template(text, settings, oldSettings) { + if (!settings && oldSettings) settings = oldSettings; + settings = defaults({}, settings, _$1.templateSettings); + + // Combine delimiters into one regular expression via alternation. + var matcher = RegExp([ + (settings.escape || noMatch).source, + (settings.interpolate || noMatch).source, + (settings.evaluate || noMatch).source + ].join('|') + '|$', 'g'); + + // Compile the template source, escaping string literals appropriately. + var index = 0; + var source = "__p+='"; + text.replace(matcher, function(match, escape, interpolate, evaluate, offset) { + source += text.slice(index, offset).replace(escapeRegExp, escapeChar); + index = offset + match.length; + + if (escape) { + source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'"; + } else if (interpolate) { + source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'"; + } else if (evaluate) { + source += "';\n" + evaluate + "\n__p+='"; + } + + // Adobe VMs need the match returned to produce the correct offset. + return match; + }); + source += "';\n"; + + var argument = settings.variable; + if (argument) { + // Insure against third-party code injection. (CVE-2021-23358) + if (!bareIdentifier.test(argument)) throw new Error( + 'variable is not a bare identifier: ' + argument + ); + } else { + // If a variable is not specified, place data values in local scope. + source = 'with(obj||{}){\n' + source + '}\n'; + argument = 'obj'; + } + + source = "var __t,__p='',__j=Array.prototype.join," + + "print=function(){__p+=__j.call(arguments,'');};\n" + + source + 'return __p;\n'; + + var render; + try { + render = new Function(argument, '_', source); + } catch (e) { + e.source = source; + throw e; + } + + var template = function(data) { + return render.call(this, data, _$1); + }; + + // Provide the compiled source as a convenience for precompilation. + template.source = 'function(' + argument + '){\n' + source + '}'; + + return template; + } + + // Traverses the children of `obj` along `path`. If a child is a function, it + // is invoked with its parent as context. Returns the value of the final + // child, or `fallback` if any child is undefined. + function result(obj, path, fallback) { + path = toPath(path); + var length = path.length; + if (!length) { + return isFunction$1(fallback) ? fallback.call(obj) : fallback; + } + for (var i = 0; i < length; i++) { + var prop = obj == null ? void 0 : obj[path[i]]; + if (prop === void 0) { + prop = fallback; + i = length; // Ensure we don't continue iterating. + } + obj = isFunction$1(prop) ? prop.call(obj) : prop; + } + return obj; + } + + // Generate a unique integer id (unique within the entire client session). + // Useful for temporary DOM ids. + var idCounter = 0; + function uniqueId(prefix) { + var id = ++idCounter + ''; + return prefix ? prefix + id : id; + } + + // Start chaining a wrapped Underscore object. + function chain(obj) { + var instance = _$1(obj); + instance._chain = true; + return instance; + } + + // Internal function to execute `sourceFunc` bound to `context` with optional + // `args`. Determines whether to execute a function as a constructor or as a + // normal function. + function executeBound(sourceFunc, boundFunc, context, callingContext, args) { + if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args); + var self = baseCreate(sourceFunc.prototype); + var result = sourceFunc.apply(self, args); + if (isObject(result)) return result; + return self; + } + + // Partially apply a function by creating a version that has had some of its + // arguments pre-filled, without changing its dynamic `this` context. `_` acts + // as a placeholder by default, allowing any combination of arguments to be + // pre-filled. Set `_.partial.placeholder` for a custom placeholder argument. + var partial = restArguments(function(func, boundArgs) { + var placeholder = partial.placeholder; + var bound = function() { + var position = 0, length = boundArgs.length; + var args = Array(length); + for (var i = 0; i < length; i++) { + args[i] = boundArgs[i] === placeholder ? arguments[position++] : boundArgs[i]; + } + while (position < arguments.length) args.push(arguments[position++]); + return executeBound(func, bound, this, this, args); + }; + return bound; + }); + + partial.placeholder = _$1; + + // Create a function bound to a given object (assigning `this`, and arguments, + // optionally). + var bind = restArguments(function(func, context, args) { + if (!isFunction$1(func)) throw new TypeError('Bind must be called on a function'); + var bound = restArguments(function(callArgs) { + return executeBound(func, bound, context, this, args.concat(callArgs)); + }); + return bound; + }); + + // Internal helper for collection methods to determine whether a collection + // should be iterated as an array or as an object. + // Related: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength + // Avoids a very nasty iOS 8 JIT bug on ARM-64. #2094 + var isArrayLike = createSizePropertyCheck(getLength); + + // Internal implementation of a recursive `flatten` function. + function flatten$1(input, depth, strict, output) { + output = output || []; + if (!depth && depth !== 0) { + depth = Infinity; + } else if (depth <= 0) { + return output.concat(input); + } + var idx = output.length; + for (var i = 0, length = getLength(input); i < length; i++) { + var value = input[i]; + if (isArrayLike(value) && (isArray(value) || isArguments$1(value))) { + // Flatten current level of array or arguments object. + if (depth > 1) { + flatten$1(value, depth - 1, strict, output); + idx = output.length; + } else { + var j = 0, len = value.length; + while (j < len) output[idx++] = value[j++]; + } + } else if (!strict) { + output[idx++] = value; + } + } + return output; + } + + // Bind a number of an object's methods to that object. Remaining arguments + // are the method names to be bound. Useful for ensuring that all callbacks + // defined on an object belong to it. + var bindAll = restArguments(function(obj, keys) { + keys = flatten$1(keys, false, false); + var index = keys.length; + if (index < 1) throw new Error('bindAll must be passed function names'); + while (index--) { + var key = keys[index]; + obj[key] = bind(obj[key], obj); + } + return obj; + }); + + // Memoize an expensive function by storing its results. + function memoize(func, hasher) { + var memoize = function(key) { + var cache = memoize.cache; + var address = '' + (hasher ? hasher.apply(this, arguments) : key); + if (!has$1(cache, address)) cache[address] = func.apply(this, arguments); + return cache[address]; + }; + memoize.cache = {}; + return memoize; + } + + // Delays a function for the given number of milliseconds, and then calls + // it with the arguments supplied. + var delay = restArguments(function(func, wait, args) { + return setTimeout(function() { + return func.apply(null, args); + }, wait); + }); + + // Defers a function, scheduling it to run after the current call stack has + // cleared. + var defer = partial(delay, _$1, 1); + + // Returns a function, that, when invoked, will only be triggered at most once + // during a given window of time. Normally, the throttled function will run + // as much as it can, without ever going more than once per `wait` duration; + // but if you'd like to disable the execution on the leading edge, pass + // `{leading: false}`. To disable execution on the trailing edge, ditto. + function throttle(func, wait, options) { + var timeout, context, args, result; + var previous = 0; + if (!options) options = {}; + + var later = function() { + previous = options.leading === false ? 0 : now(); + timeout = null; + result = func.apply(context, args); + if (!timeout) context = args = null; + }; + + var throttled = function() { + var _now = now(); + if (!previous && options.leading === false) previous = _now; + var remaining = wait - (_now - previous); + context = this; + args = arguments; + if (remaining <= 0 || remaining > wait) { + if (timeout) { + clearTimeout(timeout); + timeout = null; + } + previous = _now; + result = func.apply(context, args); + if (!timeout) context = args = null; + } else if (!timeout && options.trailing !== false) { + timeout = setTimeout(later, remaining); + } + return result; + }; + + throttled.cancel = function() { + clearTimeout(timeout); + previous = 0; + timeout = context = args = null; + }; + + return throttled; + } + + // When a sequence of calls of the returned function ends, the argument + // function is triggered. The end of a sequence is defined by the `wait` + // parameter. If `immediate` is passed, the argument function will be + // triggered at the beginning of the sequence instead of at the end. + function debounce(func, wait, immediate) { + var timeout, previous, args, result, context; + + var later = function() { + var passed = now() - previous; + if (wait > passed) { + timeout = setTimeout(later, wait - passed); + } else { + timeout = null; + if (!immediate) result = func.apply(context, args); + // This check is needed because `func` can recursively invoke `debounced`. + if (!timeout) args = context = null; + } + }; + + var debounced = restArguments(function(_args) { + context = this; + args = _args; + previous = now(); + if (!timeout) { + timeout = setTimeout(later, wait); + if (immediate) result = func.apply(context, args); + } + return result; + }); + + debounced.cancel = function() { + clearTimeout(timeout); + timeout = args = context = null; + }; + + return debounced; + } + + // Returns the first function passed as an argument to the second, + // allowing you to adjust arguments, run code before and after, and + // conditionally execute the original function. + function wrap(func, wrapper) { + return partial(wrapper, func); + } + + // Returns a negated version of the passed-in predicate. + function negate(predicate) { + return function() { + return !predicate.apply(this, arguments); + }; + } + + // Returns a function that is the composition of a list of functions, each + // consuming the return value of the function that follows. + function compose() { + var args = arguments; + var start = args.length - 1; + return function() { + var i = start; + var result = args[start].apply(this, arguments); + while (i--) result = args[i].call(this, result); + return result; + }; + } + + // Returns a function that will only be executed on and after the Nth call. + function after(times, func) { + return function() { + if (--times < 1) { + return func.apply(this, arguments); + } + }; + } + + // Returns a function that will only be executed up to (but not including) the + // Nth call. + function before(times, func) { + var memo; + return function() { + if (--times > 0) { + memo = func.apply(this, arguments); + } + if (times <= 1) func = null; + return memo; + }; + } + + // Returns a function that will be executed at most one time, no matter how + // often you call it. Useful for lazy initialization. + var once = partial(before, 2); + + // Returns the first key on an object that passes a truth test. + function findKey(obj, predicate, context) { + predicate = cb(predicate, context); + var _keys = keys(obj), key; + for (var i = 0, length = _keys.length; i < length; i++) { + key = _keys[i]; + if (predicate(obj[key], key, obj)) return key; + } + } + + // Internal function to generate `_.findIndex` and `_.findLastIndex`. + function createPredicateIndexFinder(dir) { + return function(array, predicate, context) { + predicate = cb(predicate, context); + var length = getLength(array); + var index = dir > 0 ? 0 : length - 1; + for (; index >= 0 && index < length; index += dir) { + if (predicate(array[index], index, array)) return index; + } + return -1; + }; + } + + // Returns the first index on an array-like that passes a truth test. + var findIndex = createPredicateIndexFinder(1); + + // Returns the last index on an array-like that passes a truth test. + var findLastIndex = createPredicateIndexFinder(-1); + + // Use a comparator function to figure out the smallest index at which + // an object should be inserted so as to maintain order. Uses binary search. + function sortedIndex(array, obj, iteratee, context) { + iteratee = cb(iteratee, context, 1); + var value = iteratee(obj); + var low = 0, high = getLength(array); + while (low < high) { + var mid = Math.floor((low + high) / 2); + if (iteratee(array[mid]) < value) low = mid + 1; else high = mid; + } + return low; + } + + // Internal function to generate the `_.indexOf` and `_.lastIndexOf` functions. + function createIndexFinder(dir, predicateFind, sortedIndex) { + return function(array, item, idx) { + var i = 0, length = getLength(array); + if (typeof idx == 'number') { + if (dir > 0) { + i = idx >= 0 ? idx : Math.max(idx + length, i); + } else { + length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1; + } + } else if (sortedIndex && idx && length) { + idx = sortedIndex(array, item); + return array[idx] === item ? idx : -1; + } + if (item !== item) { + idx = predicateFind(slice.call(array, i, length), isNaN$1); + return idx >= 0 ? idx + i : -1; + } + for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) { + if (array[idx] === item) return idx; + } + return -1; + }; + } + + // Return the position of the first occurrence of an item in an array, + // or -1 if the item is not included in the array. + // If the array is large and already in sort order, pass `true` + // for **isSorted** to use binary search. + var indexOf = createIndexFinder(1, findIndex, sortedIndex); + + // Return the position of the last occurrence of an item in an array, + // or -1 if the item is not included in the array. + var lastIndexOf = createIndexFinder(-1, findLastIndex); + + // Return the first value which passes a truth test. + function find(obj, predicate, context) { + var keyFinder = isArrayLike(obj) ? findIndex : findKey; + var key = keyFinder(obj, predicate, context); + if (key !== void 0 && key !== -1) return obj[key]; + } + + // Convenience version of a common use case of `_.find`: getting the first + // object containing specific `key:value` pairs. + function findWhere(obj, attrs) { + return find(obj, matcher(attrs)); + } + + // The cornerstone for collection functions, an `each` + // implementation, aka `forEach`. + // Handles raw objects in addition to array-likes. Treats all + // sparse array-likes as if they were dense. + function each(obj, iteratee, context) { + iteratee = optimizeCb(iteratee, context); + var i, length; + if (isArrayLike(obj)) { + for (i = 0, length = obj.length; i < length; i++) { + iteratee(obj[i], i, obj); + } + } else { + var _keys = keys(obj); + for (i = 0, length = _keys.length; i < length; i++) { + iteratee(obj[_keys[i]], _keys[i], obj); + } + } + return obj; + } + + // Return the results of applying the iteratee to each element. + function map(obj, iteratee, context) { + iteratee = cb(iteratee, context); + var _keys = !isArrayLike(obj) && keys(obj), + length = (_keys || obj).length, + results = Array(length); + for (var index = 0; index < length; index++) { + var currentKey = _keys ? _keys[index] : index; + results[index] = iteratee(obj[currentKey], currentKey, obj); + } + return results; + } + + // Internal helper to create a reducing function, iterating left or right. + function createReduce(dir) { + // Wrap code that reassigns argument variables in a separate function than + // the one that accesses `arguments.length` to avoid a perf hit. (#1991) + var reducer = function(obj, iteratee, memo, initial) { + var _keys = !isArrayLike(obj) && keys(obj), + length = (_keys || obj).length, + index = dir > 0 ? 0 : length - 1; + if (!initial) { + memo = obj[_keys ? _keys[index] : index]; + index += dir; + } + for (; index >= 0 && index < length; index += dir) { + var currentKey = _keys ? _keys[index] : index; + memo = iteratee(memo, obj[currentKey], currentKey, obj); + } + return memo; + }; + + return function(obj, iteratee, memo, context) { + var initial = arguments.length >= 3; + return reducer(obj, optimizeCb(iteratee, context, 4), memo, initial); + }; + } + + // **Reduce** builds up a single result from a list of values, aka `inject`, + // or `foldl`. + var reduce = createReduce(1); + + // The right-associative version of reduce, also known as `foldr`. + var reduceRight = createReduce(-1); + + // Return all the elements that pass a truth test. + function filter(obj, predicate, context) { + var results = []; + predicate = cb(predicate, context); + each(obj, function(value, index, list) { + if (predicate(value, index, list)) results.push(value); + }); + return results; + } + + // Return all the elements for which a truth test fails. + function reject(obj, predicate, context) { + return filter(obj, negate(cb(predicate)), context); + } + + // Determine whether all of the elements pass a truth test. + function every(obj, predicate, context) { + predicate = cb(predicate, context); + var _keys = !isArrayLike(obj) && keys(obj), + length = (_keys || obj).length; + for (var index = 0; index < length; index++) { + var currentKey = _keys ? _keys[index] : index; + if (!predicate(obj[currentKey], currentKey, obj)) return false; + } + return true; + } + + // Determine if at least one element in the object passes a truth test. + function some(obj, predicate, context) { + predicate = cb(predicate, context); + var _keys = !isArrayLike(obj) && keys(obj), + length = (_keys || obj).length; + for (var index = 0; index < length; index++) { + var currentKey = _keys ? _keys[index] : index; + if (predicate(obj[currentKey], currentKey, obj)) return true; + } return false; - } - } - // Assume equality for cyclic structures. The algorithm for detecting cyclic - // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. - - // Initializing stack of traversed objects. - // It's done here since we only need them for objects and arrays comparison. - aStack = aStack || []; - bStack = bStack || []; - var length = aStack.length; - while (length--) { - // Linear search. Performance is inversely proportional to the number of - // unique nested structures. - if (aStack[length] === a) return bStack[length] === b; - } - - // Add the first object to the stack of traversed objects. - aStack.push(a); - bStack.push(b); - - // Recursively compare objects and arrays. - if (areArrays) { - // Compare array lengths to determine if a deep comparison is necessary. - length = a.length; - if (length !== b.length) return false; - // Deep compare the contents, ignoring non-numeric properties. - while (length--) { - if (!eq(a[length], b[length], aStack, bStack)) return false; - } - } else { - // Deep compare objects. - var keys = _.keys(a), key; - length = keys.length; - // Ensure that both objects contain the same number of properties before comparing deep equality. - if (_.keys(b).length !== length) return false; - while (length--) { - // Deep compare each member - key = keys[length]; - if (!(_.has(b, key) && eq(a[key], b[key], aStack, bStack))) return false; - } - } - // Remove the first object from the stack of traversed objects. - aStack.pop(); - bStack.pop(); - return true; - }; - - // Perform a deep comparison to check if two objects are equal. - _.isEqual = function(a, b) { - return eq(a, b); - }; - - // Is a given array, string, or object empty? - // An "empty" object has no enumerable own-properties. - _.isEmpty = function(obj) { - if (obj == null) return true; - if (isArrayLike(obj) && (_.isArray(obj) || _.isString(obj) || _.isArguments(obj))) return obj.length === 0; - return _.keys(obj).length === 0; - }; - - // Is a given value a DOM element? - _.isElement = function(obj) { - return !!(obj && obj.nodeType === 1); - }; - - // Is a given value an array? - // Delegates to ECMA5's native Array.isArray - _.isArray = nativeIsArray || function(obj) { - return toString.call(obj) === '[object Array]'; - }; - - // Is a given variable an object? - _.isObject = function(obj) { - var type = typeof obj; - return type === 'function' || type === 'object' && !!obj; - }; - - // Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp, isError. - _.each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp', 'Error'], function(name) { - _['is' + name] = function(obj) { - return toString.call(obj) === '[object ' + name + ']'; - }; - }); + } - // Define a fallback version of the method in browsers (ahem, IE < 9), where - // there isn't any inspectable "Arguments" type. - if (!_.isArguments(arguments)) { - _.isArguments = function(obj) { - return _.has(obj, 'callee'); - }; - } + // Determine if the array or object contains a given item (using `===`). + function contains(obj, item, fromIndex, guard) { + if (!isArrayLike(obj)) obj = values(obj); + if (typeof fromIndex != 'number' || guard) fromIndex = 0; + return indexOf(obj, item, fromIndex) >= 0; + } - // Optimize `isFunction` if appropriate. Work around some typeof bugs in old v8, - // IE 11 (#1621), and in Safari 8 (#1929). - if (typeof /./ != 'function' && typeof Int8Array != 'object') { - _.isFunction = function(obj) { - return typeof obj == 'function' || false; - }; - } - - // Is a given object a finite number? - _.isFinite = function(obj) { - return isFinite(obj) && !isNaN(parseFloat(obj)); - }; - - // Is the given value `NaN`? (NaN is the only number which does not equal itself). - _.isNaN = function(obj) { - return _.isNumber(obj) && obj !== +obj; - }; - - // Is a given value a boolean? - _.isBoolean = function(obj) { - return obj === true || obj === false || toString.call(obj) === '[object Boolean]'; - }; - - // Is a given value equal to null? - _.isNull = function(obj) { - return obj === null; - }; - - // Is a given variable undefined? - _.isUndefined = function(obj) { - return obj === void 0; - }; - - // Shortcut function for checking if an object has a given property directly - // on itself (in other words, not on a prototype). - _.has = function(obj, key) { - return obj != null && hasOwnProperty.call(obj, key); - }; - - // Utility Functions - // ----------------- - - // Run Underscore.js in *noConflict* mode, returning the `_` variable to its - // previous owner. Returns a reference to the Underscore object. - _.noConflict = function() { - root._ = previousUnderscore; - return this; - }; - - // Keep the identity function around for default iteratees. - _.identity = function(value) { - return value; - }; - - // Predicate-generating functions. Often useful outside of Underscore. - _.constant = function(value) { - return function() { - return value; - }; - }; + // Invoke a method (with arguments) on every item in a collection. + var invoke = restArguments(function(obj, path, args) { + var contextPath, func; + if (isFunction$1(path)) { + func = path; + } else { + path = toPath(path); + contextPath = path.slice(0, -1); + path = path[path.length - 1]; + } + return map(obj, function(context) { + var method = func; + if (!method) { + if (contextPath && contextPath.length) { + context = deepGet(context, contextPath); + } + if (context == null) return void 0; + method = context[path]; + } + return method == null ? method : method.apply(context, args); + }); + }); - _.noop = function(){}; + // Convenience version of a common use case of `_.map`: fetching a property. + function pluck(obj, key) { + return map(obj, property(key)); + } - _.property = function(key) { - return function(obj) { - return obj == null ? void 0 : obj[key]; - }; - }; + // Convenience version of a common use case of `_.filter`: selecting only + // objects containing specific `key:value` pairs. + function where(obj, attrs) { + return filter(obj, matcher(attrs)); + } - // Generates a function for a given object that returns a given property. - _.propertyOf = function(obj) { - return obj == null ? function(){} : function(key) { - return obj[key]; - }; - }; - - // Returns a predicate for checking whether an object has a given set of - // `key:value` pairs. - _.matcher = _.matches = function(attrs) { - attrs = _.extendOwn({}, attrs); - return function(obj) { - return _.isMatch(obj, attrs); - }; - }; - - // Run a function **n** times. - _.times = function(n, iteratee, context) { - var accum = Array(Math.max(0, n)); - iteratee = optimizeCb(iteratee, context, 1); - for (var i = 0; i < n; i++) accum[i] = iteratee(i); - return accum; - }; - - // Return a random integer between min and max (inclusive). - _.random = function(min, max) { - if (max == null) { - max = min; - min = 0; - } - return min + Math.floor(Math.random() * (max - min + 1)); - }; - - // A (possibly faster) way to get the current timestamp as an integer. - _.now = Date.now || function() { - return new Date().getTime(); - }; - - // List of HTML entities for escaping. - var escapeMap = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''', - '`': '`', - "'": ''', - }; - var unescapeMap = _.invert(escapeMap); - - // Functions for escaping and unescaping strings to/from HTML interpolation. - var createEscaper = function(map) { - var escaper = function(match) { - return map[match]; - }; - // Regexes for identifying a key that needs to be escaped - var source = '(?:' + _.keys(map).join('|') + ')'; - var testRegexp = RegExp(source); - var replaceRegexp = RegExp(source, 'g'); - return function(string) { - string = string == null ? '' : '' + string; - return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string; - }; - }; - _.escape = createEscaper(escapeMap); - _.unescape = createEscaper(unescapeMap); - - // If the value of the named `property` is a function then invoke it with the - // `object` as context; otherwise, return it. - _.result = function(object, property, fallback) { - var value = object == null ? void 0 : object[property]; - if (value === void 0) { - value = fallback; - } - return _.isFunction(value) ? value.call(object) : value; - }; - - // Generate a unique integer id (unique within the entire client session). - // Useful for temporary DOM ids. - var idCounter = 0; - _.uniqueId = function(prefix) { - var id = ++idCounter + ''; - return prefix ? prefix + id : id; - }; - - // By default, Underscore uses ERB-style template delimiters, change the - // following template settings to use alternative delimiters. - _.templateSettings = { - evaluate : /<%([\s\S]+?)%>/g, - interpolate : /<%=([\s\S]+?)%>/g, - escape : /<%-([\s\S]+?)%>/g - }; - - // When customizing `templateSettings`, if you don't want to define an - // interpolation, evaluation or escaping regex, we need one that is - // guaranteed not to match. - var noMatch = /(.)^/; - - // Certain characters need to be escaped so that they can be put into a - // string literal. - var escapes = { - "'": "'", - '\\': '\\', - '\r': 'r', - '\n': 'n', - '\u2028': 'u2028', - '\u2029': 'u2029' - }; - - var escaper = /\\|'|\r|\n|\u2028|\u2029/g; - - var escapeChar = function(match) { - return '\\' + escapes[match]; - }; - - // JavaScript micro-templating, similar to John Resig's implementation. - // Underscore templating handles arbitrary delimiters, preserves whitespace, - // and correctly escapes quotes within interpolated code. - // NB: `oldSettings` only exists for backwards compatibility. - _.template = function(text, settings, oldSettings) { - if (!settings && oldSettings) settings = oldSettings; - settings = _.defaults({}, settings, _.templateSettings); - - // Combine delimiters into one regular expression via alternation. - var matcher = RegExp([ - (settings.escape || noMatch).source, - (settings.interpolate || noMatch).source, - (settings.evaluate || noMatch).source - ].join('|') + '|$', 'g'); - - // Compile the template source, escaping string literals appropriately. - var index = 0; - var source = "__p+='"; - text.replace(matcher, function(match, escape, interpolate, evaluate, offset) { - source += text.slice(index, offset).replace(escaper, escapeChar); - index = offset + match.length; - - if (escape) { - source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'"; - } else if (interpolate) { - source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'"; - } else if (evaluate) { - source += "';\n" + evaluate + "\n__p+='"; - } - - // Adobe VMs need the match returned to produce the correct offest. - return match; + // Return the maximum element (or element-based computation). + function max(obj, iteratee, context) { + var result = -Infinity, lastComputed = -Infinity, + value, computed; + if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) { + obj = isArrayLike(obj) ? obj : values(obj); + for (var i = 0, length = obj.length; i < length; i++) { + value = obj[i]; + if (value != null && value > result) { + result = value; + } + } + } else { + iteratee = cb(iteratee, context); + each(obj, function(v, index, list) { + computed = iteratee(v, index, list); + if (computed > lastComputed || computed === -Infinity && result === -Infinity) { + result = v; + lastComputed = computed; + } + }); + } + return result; + } + + // Return the minimum element (or element-based computation). + function min(obj, iteratee, context) { + var result = Infinity, lastComputed = Infinity, + value, computed; + if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) { + obj = isArrayLike(obj) ? obj : values(obj); + for (var i = 0, length = obj.length; i < length; i++) { + value = obj[i]; + if (value != null && value < result) { + result = value; + } + } + } else { + iteratee = cb(iteratee, context); + each(obj, function(v, index, list) { + computed = iteratee(v, index, list); + if (computed < lastComputed || computed === Infinity && result === Infinity) { + result = v; + lastComputed = computed; + } + }); + } + return result; + } + + // Sample **n** random values from a collection using the modern version of the + // [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher–Yates_shuffle). + // If **n** is not specified, returns a single random element. + // The internal `guard` argument allows it to work with `_.map`. + function sample(obj, n, guard) { + if (n == null || guard) { + if (!isArrayLike(obj)) obj = values(obj); + return obj[random(obj.length - 1)]; + } + var sample = isArrayLike(obj) ? clone(obj) : values(obj); + var length = getLength(sample); + n = Math.max(Math.min(n, length), 0); + var last = length - 1; + for (var index = 0; index < n; index++) { + var rand = random(index, last); + var temp = sample[index]; + sample[index] = sample[rand]; + sample[rand] = temp; + } + return sample.slice(0, n); + } + + // Shuffle a collection. + function shuffle(obj) { + return sample(obj, Infinity); + } + + // Sort the object's values by a criterion produced by an iteratee. + function sortBy(obj, iteratee, context) { + var index = 0; + iteratee = cb(iteratee, context); + return pluck(map(obj, function(value, key, list) { + return { + value: value, + index: index++, + criteria: iteratee(value, key, list) + }; + }).sort(function(left, right) { + var a = left.criteria; + var b = right.criteria; + if (a !== b) { + if (a > b || a === void 0) return 1; + if (a < b || b === void 0) return -1; + } + return left.index - right.index; + }), 'value'); + } + + // An internal function used for aggregate "group by" operations. + function group(behavior, partition) { + return function(obj, iteratee, context) { + var result = partition ? [[], []] : {}; + iteratee = cb(iteratee, context); + each(obj, function(value, index) { + var key = iteratee(value, index, obj); + behavior(result, value, key); + }); + return result; + }; + } + + // Groups the object's values by a criterion. Pass either a string attribute + // to group by, or a function that returns the criterion. + var groupBy = group(function(result, value, key) { + if (has$1(result, key)) result[key].push(value); else result[key] = [value]; }); - source += "';\n"; - // If a variable is not specified, place data values in local scope. - if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n'; + // Indexes the object's values by a criterion, similar to `_.groupBy`, but for + // when you know that your index values will be unique. + var indexBy = group(function(result, value, key) { + result[key] = value; + }); - source = "var __t,__p='',__j=Array.prototype.join," + - "print=function(){__p+=__j.call(arguments,'');};\n" + - source + 'return __p;\n'; + // Counts instances of an object that group by a certain criterion. Pass + // either a string attribute to count by, or a function that returns the + // criterion. + var countBy = group(function(result, value, key) { + if (has$1(result, key)) result[key]++; else result[key] = 1; + }); - try { - var render = new Function(settings.variable || 'obj', '_', source); - } catch (e) { - e.source = source; - throw e; + // Split a collection into two arrays: one whose elements all pass the given + // truth test, and one whose elements all do not pass the truth test. + var partition = group(function(result, value, pass) { + result[pass ? 0 : 1].push(value); + }, true); + + // Safely create a real, live array from anything iterable. + var reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g; + function toArray(obj) { + if (!obj) return []; + if (isArray(obj)) return slice.call(obj); + if (isString(obj)) { + // Keep surrogate pair characters together. + return obj.match(reStrSymbol); + } + if (isArrayLike(obj)) return map(obj, identity); + return values(obj); } - var template = function(data) { - return render.call(this, data, _); - }; + // Return the number of elements in a collection. + function size(obj) { + if (obj == null) return 0; + return isArrayLike(obj) ? obj.length : keys(obj).length; + } - // Provide the compiled source as a convenience for precompilation. - var argument = settings.variable || 'obj'; - template.source = 'function(' + argument + '){\n' + source + '}'; - - return template; - }; - - // Add a "chain" function. Start chaining a wrapped Underscore object. - _.chain = function(obj) { - var instance = _(obj); - instance._chain = true; - return instance; - }; - - // OOP - // --------------- - // If Underscore is called as a function, it returns a wrapped object that - // can be used OO-style. This wrapper holds altered versions of all the - // underscore functions. Wrapped objects may be chained. - - // Helper function to continue chaining intermediate results. - var result = function(instance, obj) { - return instance._chain ? _(obj).chain() : obj; - }; - - // Add your own custom functions to the Underscore object. - _.mixin = function(obj) { - _.each(_.functions(obj), function(name) { - var func = _[name] = obj[name]; - _.prototype[name] = function() { - var args = [this._wrapped]; - push.apply(args, arguments); - return result(this, func.apply(_, args)); - }; + // Internal `_.pick` helper function to determine whether `key` is an enumerable + // property name of `obj`. + function keyInObj(value, key, obj) { + return key in obj; + } + + // Return a copy of the object only containing the allowed properties. + var pick = restArguments(function(obj, keys) { + var result = {}, iteratee = keys[0]; + if (obj == null) return result; + if (isFunction$1(iteratee)) { + if (keys.length > 1) iteratee = optimizeCb(iteratee, keys[1]); + keys = allKeys(obj); + } else { + iteratee = keyInObj; + keys = flatten$1(keys, false, false); + obj = Object(obj); + } + for (var i = 0, length = keys.length; i < length; i++) { + var key = keys[i]; + var value = obj[key]; + if (iteratee(value, key, obj)) result[key] = value; + } + return result; }); - }; - - // Add all of the Underscore functions to the wrapper object. - _.mixin(_); - - // Add all mutator Array functions to the wrapper. - _.each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) { - var method = ArrayProto[name]; - _.prototype[name] = function() { - var obj = this._wrapped; - method.apply(obj, arguments); - if ((name === 'shift' || name === 'splice') && obj.length === 0) delete obj[0]; - return result(this, obj); - }; - }); - // Add all accessor Array functions to the wrapper. - _.each(['concat', 'join', 'slice'], function(name) { - var method = ArrayProto[name]; - _.prototype[name] = function() { - return result(this, method.apply(this._wrapped, arguments)); - }; - }); - - // Extracts the result from a wrapped and chained object. - _.prototype.value = function() { - return this._wrapped; - }; - - // Provide unwrapping proxy for some methods used in engine operations - // such as arithmetic and JSON stringification. - _.prototype.valueOf = _.prototype.toJSON = _.prototype.value; - - _.prototype.toString = function() { - return '' + this._wrapped; - }; - - // AMD registration happens at the end for compatibility with AMD loaders - // that may not enforce next-turn semantics on modules. Even though general - // practice for AMD registration is to be anonymous, underscore registers - // as a named module because, like jQuery, it is a base library that is - // popular enough to be bundled in a third party lib, but not be part of - // an AMD load request. Those cases could generate an error when an - // anonymous define() is called outside of a loader request. - if (typeof define === 'function' && define.amd) { - define('underscore', [], function() { - return _; + // Return a copy of the object without the disallowed properties. + var omit = restArguments(function(obj, keys) { + var iteratee = keys[0], context; + if (isFunction$1(iteratee)) { + iteratee = negate(iteratee); + if (keys.length > 1) context = keys[1]; + } else { + keys = map(flatten$1(keys, false, false), String); + iteratee = function(value, key) { + return !contains(keys, key); + }; + } + return pick(obj, iteratee, context); + }); + + // Returns everything but the last entry of the array. Especially useful on + // the arguments object. Passing **n** will return all the values in + // the array, excluding the last N. + function initial(array, n, guard) { + return slice.call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n))); + } + + // Get the first element of an array. Passing **n** will return the first N + // values in the array. The **guard** check allows it to work with `_.map`. + function first(array, n, guard) { + if (array == null || array.length < 1) return n == null || guard ? void 0 : []; + if (n == null || guard) return array[0]; + return initial(array, array.length - n); + } + + // Returns everything but the first entry of the `array`. Especially useful on + // the `arguments` object. Passing an **n** will return the rest N values in the + // `array`. + function rest(array, n, guard) { + return slice.call(array, n == null || guard ? 1 : n); + } + + // Get the last element of an array. Passing **n** will return the last N + // values in the array. + function last(array, n, guard) { + if (array == null || array.length < 1) return n == null || guard ? void 0 : []; + if (n == null || guard) return array[array.length - 1]; + return rest(array, Math.max(0, array.length - n)); + } + + // Trim out all falsy values from an array. + function compact(array) { + return filter(array, Boolean); + } + + // Flatten out an array, either recursively (by default), or up to `depth`. + // Passing `true` or `false` as `depth` means `1` or `Infinity`, respectively. + function flatten(array, depth) { + return flatten$1(array, depth, false); + } + + // Take the difference between one array and a number of other arrays. + // Only the elements present in just the first array will remain. + var difference = restArguments(function(array, rest) { + rest = flatten$1(rest, true, true); + return filter(array, function(value){ + return !contains(rest, value); + }); + }); + + // Return a version of the array that does not contain the specified value(s). + var without = restArguments(function(array, otherArrays) { + return difference(array, otherArrays); + }); + + // Produce a duplicate-free version of the array. If the array has already + // been sorted, you have the option of using a faster algorithm. + // The faster algorithm will not work with an iteratee if the iteratee + // is not a one-to-one function, so providing an iteratee will disable + // the faster algorithm. + function uniq(array, isSorted, iteratee, context) { + if (!isBoolean(isSorted)) { + context = iteratee; + iteratee = isSorted; + isSorted = false; + } + if (iteratee != null) iteratee = cb(iteratee, context); + var result = []; + var seen = []; + for (var i = 0, length = getLength(array); i < length; i++) { + var value = array[i], + computed = iteratee ? iteratee(value, i, array) : value; + if (isSorted && !iteratee) { + if (!i || seen !== computed) result.push(value); + seen = computed; + } else if (iteratee) { + if (!contains(seen, computed)) { + seen.push(computed); + result.push(value); + } + } else if (!contains(result, value)) { + result.push(value); + } + } + return result; + } + + // Produce an array that contains the union: each distinct element from all of + // the passed-in arrays. + var union = restArguments(function(arrays) { + return uniq(flatten$1(arrays, true, true)); }); - } -}.call(this)); \ No newline at end of file + + // Produce an array that contains every item shared between all the + // passed-in arrays. + function intersection(array) { + var result = []; + var argsLength = arguments.length; + for (var i = 0, length = getLength(array); i < length; i++) { + var item = array[i]; + if (contains(result, item)) continue; + var j; + for (j = 1; j < argsLength; j++) { + if (!contains(arguments[j], item)) break; + } + if (j === argsLength) result.push(item); + } + return result; + } + + // Complement of zip. Unzip accepts an array of arrays and groups + // each array's elements on shared indices. + function unzip(array) { + var length = array && max(array, getLength).length || 0; + var result = Array(length); + + for (var index = 0; index < length; index++) { + result[index] = pluck(array, index); + } + return result; + } + + // Zip together multiple lists into a single array -- elements that share + // an index go together. + var zip = restArguments(unzip); + + // Converts lists into objects. Pass either a single array of `[key, value]` + // pairs, or two parallel arrays of the same length -- one of keys, and one of + // the corresponding values. Passing by pairs is the reverse of `_.pairs`. + function object(list, values) { + var result = {}; + for (var i = 0, length = getLength(list); i < length; i++) { + if (values) { + result[list[i]] = values[i]; + } else { + result[list[i][0]] = list[i][1]; + } + } + return result; + } + + // Generate an integer Array containing an arithmetic progression. A port of + // the native Python `range()` function. See + // [the Python documentation](https://docs.python.org/library/functions.html#range). + function range(start, stop, step) { + if (stop == null) { + stop = start || 0; + start = 0; + } + if (!step) { + step = stop < start ? -1 : 1; + } + + var length = Math.max(Math.ceil((stop - start) / step), 0); + var range = Array(length); + + for (var idx = 0; idx < length; idx++, start += step) { + range[idx] = start; + } + + return range; + } + + // Chunk a single array into multiple arrays, each containing `count` or fewer + // items. + function chunk(array, count) { + if (count == null || count < 1) return []; + var result = []; + var i = 0, length = array.length; + while (i < length) { + result.push(slice.call(array, i, i += count)); + } + return result; + } + + // Helper function to continue chaining intermediate results. + function chainResult(instance, obj) { + return instance._chain ? _$1(obj).chain() : obj; + } + + // Add your own custom functions to the Underscore object. + function mixin(obj) { + each(functions(obj), function(name) { + var func = _$1[name] = obj[name]; + _$1.prototype[name] = function() { + var args = [this._wrapped]; + push.apply(args, arguments); + return chainResult(this, func.apply(_$1, args)); + }; + }); + return _$1; + } + + // Add all mutator `Array` functions to the wrapper. + each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) { + var method = ArrayProto[name]; + _$1.prototype[name] = function() { + var obj = this._wrapped; + if (obj != null) { + method.apply(obj, arguments); + if ((name === 'shift' || name === 'splice') && obj.length === 0) { + delete obj[0]; + } + } + return chainResult(this, obj); + }; + }); + + // Add all accessor `Array` functions to the wrapper. + each(['concat', 'join', 'slice'], function(name) { + var method = ArrayProto[name]; + _$1.prototype[name] = function() { + var obj = this._wrapped; + if (obj != null) obj = method.apply(obj, arguments); + return chainResult(this, obj); + }; + }); + + // Named Exports + + var allExports = { + __proto__: null, + VERSION: VERSION, + restArguments: restArguments, + isObject: isObject, + isNull: isNull, + isUndefined: isUndefined, + isBoolean: isBoolean, + isElement: isElement, + isString: isString, + isNumber: isNumber, + isDate: isDate, + isRegExp: isRegExp, + isError: isError, + isSymbol: isSymbol, + isArrayBuffer: isArrayBuffer, + isDataView: isDataView$1, + isArray: isArray, + isFunction: isFunction$1, + isArguments: isArguments$1, + isFinite: isFinite$1, + isNaN: isNaN$1, + isTypedArray: isTypedArray$1, + isEmpty: isEmpty, + isMatch: isMatch, + isEqual: isEqual, + isMap: isMap, + isWeakMap: isWeakMap, + isSet: isSet, + isWeakSet: isWeakSet, + keys: keys, + allKeys: allKeys, + values: values, + pairs: pairs, + invert: invert, + functions: functions, + methods: functions, + extend: extend, + extendOwn: extendOwn, + assign: extendOwn, + defaults: defaults, + create: create, + clone: clone, + tap: tap, + get: get, + has: has, + mapObject: mapObject, + identity: identity, + constant: constant, + noop: noop, + toPath: toPath$1, + property: property, + propertyOf: propertyOf, + matcher: matcher, + matches: matcher, + times: times, + random: random, + now: now, + escape: _escape, + unescape: _unescape, + templateSettings: templateSettings, + template: template, + result: result, + uniqueId: uniqueId, + chain: chain, + iteratee: iteratee, + partial: partial, + bind: bind, + bindAll: bindAll, + memoize: memoize, + delay: delay, + defer: defer, + throttle: throttle, + debounce: debounce, + wrap: wrap, + negate: negate, + compose: compose, + after: after, + before: before, + once: once, + findKey: findKey, + findIndex: findIndex, + findLastIndex: findLastIndex, + sortedIndex: sortedIndex, + indexOf: indexOf, + lastIndexOf: lastIndexOf, + find: find, + detect: find, + findWhere: findWhere, + each: each, + forEach: each, + map: map, + collect: map, + reduce: reduce, + foldl: reduce, + inject: reduce, + reduceRight: reduceRight, + foldr: reduceRight, + filter: filter, + select: filter, + reject: reject, + every: every, + all: every, + some: some, + any: some, + contains: contains, + includes: contains, + include: contains, + invoke: invoke, + pluck: pluck, + where: where, + max: max, + min: min, + shuffle: shuffle, + sample: sample, + sortBy: sortBy, + groupBy: groupBy, + indexBy: indexBy, + countBy: countBy, + partition: partition, + toArray: toArray, + size: size, + pick: pick, + omit: omit, + first: first, + head: first, + take: first, + initial: initial, + last: last, + rest: rest, + tail: rest, + drop: rest, + compact: compact, + flatten: flatten, + without: without, + uniq: uniq, + unique: uniq, + union: union, + intersection: intersection, + difference: difference, + unzip: unzip, + transpose: unzip, + zip: zip, + object: object, + range: range, + chunk: chunk, + mixin: mixin, + 'default': _$1 + }; + + // Default Export + + // Add all of the Underscore functions to the wrapper object. + var _ = mixin(allExports); + // Legacy Node.js API. + _._ = _; + + return _; + +}))); diff --git a/lib/web/varien/js.js b/lib/web/varien/js.js index 45032829f2fd8..6efbe98ddcc79 100644 --- a/lib/web/varien/js.js +++ b/lib/web/varien/js.js @@ -586,18 +586,6 @@ Element.addMethods({ } }); -/* -if (!("console" in window) || !("firebug" in console)) -{ - var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", - "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; - - window.console = {}; - for (var i = 0; i < names.length; ++i) - window.console[names[i]] = function() {} -} -*/ - /** * Executes event handler on the element. Works with event handlers attached by Prototype, * in a browser-agnostic fashion. diff --git a/package.json.sample b/package.json.sample index 1d07bcff26d8d..b8c18190ff3d5 100644 --- a/package.json.sample +++ b/package.json.sample @@ -7,7 +7,7 @@ "type": "git", "url": "https://github.com/magento/magento2.git" }, - "homepage": "http://magento.com/", + "homepage": "https://magento.com/", "devDependencies": { "glob": "~7.1.1", "grunt": "~1.0.1", @@ -19,7 +19,7 @@ "grunt-contrib-cssmin": "~2.2.1", "grunt-contrib-imagemin": "~2.0.1", "grunt-contrib-jasmine": "~1.2.0", - "grunt-contrib-less": "~1.4.1", + "grunt-contrib-less": "^2.1.0", "grunt-contrib-watch": "~1.0.0", "grunt-eslint": "~20.1.0", "grunt-exec": "~3.0.0", @@ -29,6 +29,7 @@ "grunt-template-jasmine-requirejs": "~0.2.3", "grunt-text-replace": "~0.4.0", "imagemin-svgo": "~5.2.1", + "less": "^3.13.1", "load-grunt-config": "~0.19.2", "morgan": "~1.9.0", "node-minify": "~2.3.1", @@ -37,6 +38,6 @@ "squirejs": "~0.2.1", "strip-json-comments": "~2.0.1", "time-grunt": "~1.4.0", - "underscore": "~1.8.0" + "underscore": "^1.13.1" } } diff --git a/setup/config/module.config.php b/setup/config/module.config.php index f1a23f3518084..98033437be49d 100644 --- a/setup/config/module.config.php +++ b/setup/config/module.config.php @@ -12,10 +12,5 @@ 'template_path_stack' => [ 'setup' => __DIR__ . '/../view', ], - ], - 'controllers' => [ - 'factories' => [ - \Magento\Setup\Controller\Index::class => \Laminas\ServiceManager\AbstractFactory\ReflectionBasedAbstractFactory::class, - ], - ], + ] ]; diff --git a/setup/config/router.config.php b/setup/config/router.config.php deleted file mode 100644 index 0817752498c18..0000000000000 --- a/setup/config/router.config.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -return [ - 'router' => [ - 'routes' => [ - 'literal' => [ - 'type' => 'Literal', - 'options' => [ - 'route' => '/', - 'defaults' => [ - 'controller' => \Magento\Setup\Controller\Index::class, - 'action' => 'index', - ], - ], - ], - ], - ], -]; diff --git a/setup/index.php b/setup/index.php index 0653ed97b07fa..fd338f8f0c6e2 100644 --- a/setup/index.php +++ b/setup/index.php @@ -3,8 +3,11 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -use Magento\Setup\Application; -use Magento\Setup\Model\ObjectManagerProvider; + +use Laminas\Http\PhpEnvironment\Request; +use Magento\Framework\App\Bootstrap; +use Magento\Framework\App\ProductMetadata; +use Magento\Setup\Model\License; if (PHP_SAPI == 'cli') { echo "You cannot run this from the command line." . PHP_EOL . @@ -30,10 +33,20 @@ $handler = new \Magento\Framework\App\ErrorHandler(); set_error_handler([$handler, 'handler']); -$configuration = require __DIR__ . '/config/application.config.php'; -$bootstrap = new Application(); -$application = $bootstrap->bootstrap($configuration); -$application->getServiceManager() - ->get(ObjectManagerProvider::class) - ->setObjectManager(\Magento\Framework\App\Bootstrap::create(BP, $_SERVER)->getObjectManager()); -$application->run(); +// Render Setup Wizard landing page +$objectManager = Bootstrap::create(BP, $_SERVER)->getObjectManager(); + +$licenseClass = $objectManager->create(License::class); +$metaClass = $objectManager->create(ProductMetadata::class); +/** @var License $license */ +$license = $licenseClass->getContents(); +/** @var ProductMetadata $version */ +$version = $metaClass->getVersion(); + +$request = new Request(); +$basePath = $request->getBasePath(); + +ob_start(); +require_once __DIR__ . '/view/magento/setup/index.phtml'; +$html = ob_get_clean(); +echo $html; diff --git a/setup/src/Magento/Setup/Controller/Index.php b/setup/src/Magento/Setup/Controller/Index.php deleted file mode 100644 index 9edca080b2cbd..0000000000000 --- a/setup/src/Magento/Setup/Controller/Index.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -declare(strict_types=1); - -namespace Magento\Setup\Controller; - -use Laminas\Mvc\Controller\AbstractActionController; -use Laminas\View\Model\ViewModel; -use Magento\Framework\App\ProductMetadata; -use Magento\Setup\Model\License; - -/** - * Main controller of the Setup Wizard - */ -class Index extends AbstractActionController -{ - /** - * @var ProductMetadata - */ - private $productMetadata; - - /** - * @var License - */ - private $license; - - /** - * Index constructor. - * - * @param ProductMetadata $productMetadata - * @param License $license - */ - public function __construct( - ProductMetadata $productMetadata, - License $license - ) { - $this->productMetadata = $productMetadata; - $this->license = $license; - } - - /** - * Setup index action. - * - * @return ViewModel - */ - public function indexAction(): ViewModel - { - return new ViewModel([ - 'version' => $this->productMetadata->getVersion(), - 'license' => $this->license->getContents(), - ]); - } -} diff --git a/setup/src/Magento/Setup/Module.php b/setup/src/Magento/Setup/Module.php index ceb17332e80ff..ec87d739e80cc 100644 --- a/setup/src/Magento/Setup/Module.php +++ b/setup/src/Magento/Setup/Module.php @@ -75,7 +75,6 @@ public function getConfig() // phpcs:disable $result = array_merge_recursive( include __DIR__ . '/../../../config/module.config.php', - include __DIR__ . '/../../../config/router.config.php', include __DIR__ . '/../../../config/di.config.php', ); // phpcs:enable diff --git a/setup/src/Magento/Setup/Test/Unit/Controller/IndexTest.php b/setup/src/Magento/Setup/Test/Unit/Controller/IndexTest.php deleted file mode 100644 index 0c7fa041166a2..0000000000000 --- a/setup/src/Magento/Setup/Test/Unit/Controller/IndexTest.php +++ /dev/null @@ -1,67 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -declare(strict_types=1); - -namespace Magento\Setup\Test\Unit\Controller; - -use Laminas\View\Model\ViewModel; -use Magento\Framework\App\ProductMetadata; -use Magento\Setup\Controller\Index; -use PHPUnit\Framework\MockObject\MockObject; -use PHPUnit\Framework\TestCase; - -class IndexTest extends TestCase -{ - /** - * Test Product Version Value - */ - private const TEST_PRODUCT_VERSION = '222.333.444'; - - /** - * Test license string - */ - private const TEST_LICENSE = 'some license string'; - - /** - * @var Index - */ - private $controller; - - protected function setUp(): void - { - /** @var ProductMetadata|MockObject $productMetadataMock */ - $productMetadataMock = $this->getMockBuilder(ProductMetadata::class) - ->onlyMethods(['getVersion']) - ->disableOriginalConstructor() - ->getMock(); - $productMetadataMock->expects($this->once()) - ->method('getVersion') - ->willReturn(self::TEST_PRODUCT_VERSION); - - $licenseModel = $this->createMock(\Magento\Setup\Model\License::class); - $licenseModel->expects($this->once())->method('getContents')->willReturn(self::TEST_LICENSE); - - $this->controller = new Index($productMetadataMock, $licenseModel); - } - - public function testIndexAction(): void - { - $viewModel = $this->controller->indexAction(); - - //check view model - $this->assertInstanceOf(ViewModel::class, $viewModel); - $this->assertFalse($viewModel->terminate()); - $variables = $viewModel->getVariables(); - - //version - $this->assertArrayHasKey('version', $variables); - $this->assertEquals(self::TEST_PRODUCT_VERSION, $variables['version']); - - //license - $this->assertArrayHasKey('license', $viewModel->getVariables()); - $this->assertEquals(self::TEST_LICENSE, $variables['license']); - } -} diff --git a/setup/view/magento/setup/index.phtml b/setup/view/magento/setup/index.phtml index 47b7e1eed46bf..9c8b147b2c214 100644 --- a/setup/view/magento/setup/index.phtml +++ b/setup/view/magento/setup/index.phtml @@ -3,14 +3,48 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -// phpcs:disable Magento2.Templates.ThisInTemplate ?> +<!--[if !IE]><!--> +<html lang="en"> +<!--<![endif]--> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <title>Magento + + + + + + + + +
- -

Version version, ENT_COMPAT) ?>

+ +

Version

Welcome to Magento Admin, your online store headquarters.
@@ -22,7 +56,7 @@

+ +