code_text
stringlengths
604
999k
repo_name
stringlengths
4
100
file_path
stringlengths
4
873
language
stringclasses
23 values
license
stringclasses
15 values
size
int32
1.02k
999k
<?php namespace JMS\SecurityExtraBundle\Tests\Security\Authorization\Expression; use JMS\SecurityExtraBundle\Security\Authorization\Expression\Ast\IsEqualExpression; use JMS\SecurityExtraBundle\Security\Authorization\Expression\Ast\ParameterExpression; use JMS\SecurityExtraBundle\Security\Authorization\Expression\Ast\ConstantExpression; use JMS\SecurityExtraBundle\Security\Authorization\Expression\Ast\GetItemExpression; use JMS\SecurityExtraBundle\Security\Authorization\Expression\Ast\ArrayExpression; use JMS\SecurityExtraBundle\Security\Authorization\Expression\Ast\MethodCallExpression; use JMS\SecurityExtraBundle\Security\Authorization\Expression\Ast\GetPropertyExpression; use JMS\SecurityExtraBundle\Security\Authorization\Expression\Ast\VariableExpression; use JMS\SecurityExtraBundle\Security\Authorization\Expression\Ast\OrExpression; use JMS\SecurityExtraBundle\Security\Authorization\Expression\Ast\AndExpression; use JMS\SecurityExtraBundle\Security\Authorization\Expression\Ast\FunctionExpression; use JMS\SecurityExtraBundle\Security\Authorization\Expression\ExpressionParser; class ExpressionParserTest extends \PHPUnit_Framework_TestCase { private $parser; public function testSingleFunction() { $this->assertEquals(new FunctionExpression('isAnonymous', array()), $this->parser->parse('isAnonymous()')); } public function testSingleFunctionWithOneArgument() { $this->assertEquals(new FunctionExpression('hasRole', array( new ConstantExpression('ROLE_ADMIN'))), $this->parser->parse('hasRole("ROLE_ADMIN")')); } public function testSingleFunctionWithMultipleArguments() { $this->assertEquals(new FunctionExpression('hasAnyRole', array( new ConstantExpression('FOO'), new ConstantExpression('BAR'))), $this->parser->parse('hasAnyRole("FOO", "BAR",)')); } public function testComplexFunctionExpression() { $expected = new OrExpression(new FunctionExpression('hasRole', array( new ConstantExpression('ADMIN'))), new FunctionExpression('hasAnyRole', array(new ConstantExpression('FOO'), new ConstantExpression('BAR')))); $this->assertEquals($expected, $this->parser->parse('hasRole("ADMIN") or hasAnyRole("FOO", "BAR")')); } public function testAnd() { $expected = new AndExpression( new FunctionExpression('isAnonymous', array()), new FunctionExpression('hasRole', array(new ConstantExpression('FOO')))); $this->assertEquals($expected, $this->parser->parse('isAnonymous() && hasRole("FOO")')); $this->assertEquals($expected, $this->parser->parse('isAnonymous() and hasRole("FOO")')); } /** * @expectedException \JMS\Parser\SyntaxErrorException * @expectedExceptionMessage Expected end of input, but got "," of type T_COMMA at position 6 (0-based). */ public function testInvalidExpression() { $this->parser->parse('object, "FOO")'); } /** * @dataProvider getPrecedenceTests */ public function testPrecendence($expected, $expr) { $this->assertEquals($expected, $this->parser->parse($expr)); } public function getPrecedenceTests() { $tests = array(); $expected = new OrExpression( new AndExpression(new VariableExpression('A'), new VariableExpression('B')), new VariableExpression('C') ); $tests[] = array($expected, 'A && B || C'); $tests[] = array($expected, '(A && B) || C'); $expected = new OrExpression( new VariableExpression('C'), new AndExpression(new VariableExpression('A'), new VariableExpression('B')) ); $tests[] = array($expected, 'C || A && B'); $tests[] = array($expected, 'C || (A && B)'); $expected = new AndExpression( new AndExpression(new VariableExpression('A'), new VariableExpression('B')), new VariableExpression('C') ); $tests[] = array($expected, 'A && B && C'); $expected = new AndExpression( new VariableExpression('A'), new OrExpression(new VariableExpression('B'), new VariableExpression('C')) ); $tests[] = array($expected, 'A && (B || C)'); return $tests; } public function testGetProperty() { $expected = new GetPropertyExpression(new VariableExpression('A'), 'foo'); $this->assertEquals($expected, $this->parser->parse('A.foo')); } public function testMethodCall() { $expected = new MethodCallExpression(new VariableExpression('A'), 'foo', array()); $this->assertEquals($expected, $this->parser->parse('A.foo()')); } public function testArray() { $expected = new ArrayExpression(array( 'foo' => new ConstantExpression('bar'), )); $this->assertEquals($expected, $this->parser->parse('{"foo":"bar",}')); $this->assertEquals($expected, $this->parser->parse('{"foo":"bar"}')); $expected = new ArrayExpression(array( new ConstantExpression('foo'), new ConstantExpression('bar'), )); $this->assertEquals($expected, $this->parser->parse('["foo","bar",]')); $this->assertEquals($expected, $this->parser->parse('["foo","bar"]')); } public function testGetItem() { $expected = new GetItemExpression( new GetPropertyExpression(new VariableExpression('A'), 'foo'), new ConstantExpression('foo') ); $this->assertEquals($expected, $this->parser->parse('A.foo["foo"]')); } public function testParameter() { $expected = new ParameterExpression('contact'); $this->assertEquals($expected, $this->parser->parse('#contact')); } public function testIsEqual() { $expected = new IsEqualExpression(new MethodCallExpression( new VariableExpression('user'), 'getUsername', array()), new ConstantExpression('Johannes')); $this->assertEquals($expected, $this->parser->parse('user.getUsername() == "Johannes"')); } protected function setUp() { $this->parser = new ExpressionParser; } }
nattaphat/hgis
vendor/jms/security-extra-bundle/JMS/SecurityExtraBundle/Tests/Security/Authorization/Expression/ExpressionParserTest.php
PHP
mit
6,311
CREATE TABLE country (id NVARCHAR(2) NOT NULL, name NVARCHAR(64) NOT NULL, PRIMARY KEY (id)); INSERT INTO [country] ([id], [name]) VALUES ('AW', 'آروبا'); INSERT INTO [country] ([id], [name]) VALUES ('AZ', 'أذربيجان'); INSERT INTO [country] ([id], [name]) VALUES ('AM', 'أرمينيا'); INSERT INTO [country] ([id], [name]) VALUES ('ER', 'أريتريا'); INSERT INTO [country] ([id], [name]) VALUES ('AU', 'أستراليا'); INSERT INTO [country] ([id], [name]) VALUES ('EE', 'أستونيا'); INSERT INTO [country] ([id], [name]) VALUES ('AF', 'أفغانستان'); INSERT INTO [country] ([id], [name]) VALUES ('AL', 'ألبانيا'); INSERT INTO [country] ([id], [name]) VALUES ('DE', 'ألمانيا'); INSERT INTO [country] ([id], [name]) VALUES ('AQ', 'أنتاركتيكا'); INSERT INTO [country] ([id], [name]) VALUES ('AG', 'أنتيغوا وبربودا'); INSERT INTO [country] ([id], [name]) VALUES ('AD', 'أندورا'); INSERT INTO [country] ([id], [name]) VALUES ('ID', 'أندونيسيا'); INSERT INTO [country] ([id], [name]) VALUES ('AO', 'أنغولا'); INSERT INTO [country] ([id], [name]) VALUES ('AI', 'أنغويلا'); INSERT INTO [country] ([id], [name]) VALUES ('UY', 'أورغواي'); INSERT INTO [country] ([id], [name]) VALUES ('UZ', 'أوزبكستان'); INSERT INTO [country] ([id], [name]) VALUES ('UG', 'أوغندا'); INSERT INTO [country] ([id], [name]) VALUES ('UA', 'أوكرانيا'); INSERT INTO [country] ([id], [name]) VALUES ('IE', 'أيرلندا'); INSERT INTO [country] ([id], [name]) VALUES ('IS', 'أيسلندا'); INSERT INTO [country] ([id], [name]) VALUES ('ET', 'إثيوبيا'); INSERT INTO [country] ([id], [name]) VALUES ('ES', 'إسبانيا'); INSERT INTO [country] ([id], [name]) VALUES ('IL', 'إسرائيل'); INSERT INTO [country] ([id], [name]) VALUES ('IR', 'إيران'); INSERT INTO [country] ([id], [name]) VALUES ('IT', 'إيطاليا'); INSERT INTO [country] ([id], [name]) VALUES ('PS', 'الأراضي الفلسطينية'); INSERT INTO [country] ([id], [name]) VALUES ('AR', 'الأرجنتين'); INSERT INTO [country] ([id], [name]) VALUES ('JO', 'الأردن'); INSERT INTO [country] ([id], [name]) VALUES ('IO', 'الإقليم البريطاني في المحيط الهندي'); INSERT INTO [country] ([id], [name]) VALUES ('EC', 'الإكوادور'); INSERT INTO [country] ([id], [name]) VALUES ('AE', 'الإمارات العربية المتحدة'); INSERT INTO [country] ([id], [name]) VALUES ('BS', 'الباهاما'); INSERT INTO [country] ([id], [name]) VALUES ('BH', 'البحرين'); INSERT INTO [country] ([id], [name]) VALUES ('BR', 'البرازيل'); INSERT INTO [country] ([id], [name]) VALUES ('PT', 'البرتغال'); INSERT INTO [country] ([id], [name]) VALUES ('BA', 'البوسنة والهرسك'); INSERT INTO [country] ([id], [name]) VALUES ('GA', 'الجابون'); INSERT INTO [country] ([id], [name]) VALUES ('ME', 'الجبل الأسود'); INSERT INTO [country] ([id], [name]) VALUES ('DZ', 'الجزائر'); INSERT INTO [country] ([id], [name]) VALUES ('DK', 'الدانمرك'); INSERT INTO [country] ([id], [name]) VALUES ('CV', 'الرأس الأخضر'); INSERT INTO [country] ([id], [name]) VALUES ('SV', 'السلفادور'); INSERT INTO [country] ([id], [name]) VALUES ('SN', 'السنغال'); INSERT INTO [country] ([id], [name]) VALUES ('SD', 'السودان'); INSERT INTO [country] ([id], [name]) VALUES ('SE', 'السويد'); INSERT INTO [country] ([id], [name]) VALUES ('EH', 'الصحراء الغربية'); INSERT INTO [country] ([id], [name]) VALUES ('SO', 'الصومال'); INSERT INTO [country] ([id], [name]) VALUES ('CN', 'الصين'); INSERT INTO [country] ([id], [name]) VALUES ('IQ', 'العراق'); INSERT INTO [country] ([id], [name]) VALUES ('VA', 'الفاتيكان'); INSERT INTO [country] ([id], [name]) VALUES ('PH', 'الفلبين'); INSERT INTO [country] ([id], [name]) VALUES ('CM', 'الكاميرون'); INSERT INTO [country] ([id], [name]) VALUES ('CG', 'الكونغو - برازافيل'); INSERT INTO [country] ([id], [name]) VALUES ('CD', 'الكونغو - كينشاسا'); INSERT INTO [country] ([id], [name]) VALUES ('KW', 'الكويت'); INSERT INTO [country] ([id], [name]) VALUES ('MA', 'المغرب'); INSERT INTO [country] ([id], [name]) VALUES ('TF', 'المقاطعات الجنوبية الفرنسية'); INSERT INTO [country] ([id], [name]) VALUES ('MX', 'المكسيك'); INSERT INTO [country] ([id], [name]) VALUES ('SA', 'المملكة العربية السعودية'); INSERT INTO [country] ([id], [name]) VALUES ('GB', 'المملكة المتحدة'); INSERT INTO [country] ([id], [name]) VALUES ('NO', 'النرويج'); INSERT INTO [country] ([id], [name]) VALUES ('AT', 'النمسا'); INSERT INTO [country] ([id], [name]) VALUES ('NE', 'النيجر'); INSERT INTO [country] ([id], [name]) VALUES ('IN', 'الهند'); INSERT INTO [country] ([id], [name]) VALUES ('US', 'الولايات المتحدة'); INSERT INTO [country] ([id], [name]) VALUES ('JP', 'اليابان'); INSERT INTO [country] ([id], [name]) VALUES ('YE', 'اليمن'); INSERT INTO [country] ([id], [name]) VALUES ('GR', 'اليونان'); INSERT INTO [country] ([id], [name]) VALUES ('PG', 'بابوا غينيا الجديدة'); INSERT INTO [country] ([id], [name]) VALUES ('PY', 'باراغواي'); INSERT INTO [country] ([id], [name]) VALUES ('PK', 'باكستان'); INSERT INTO [country] ([id], [name]) VALUES ('PW', 'بالاو'); INSERT INTO [country] ([id], [name]) VALUES ('BW', 'بتسوانا'); INSERT INTO [country] ([id], [name]) VALUES ('BB', 'بربادوس'); INSERT INTO [country] ([id], [name]) VALUES ('BM', 'برمودا'); INSERT INTO [country] ([id], [name]) VALUES ('BN', 'بروناي'); INSERT INTO [country] ([id], [name]) VALUES ('BE', 'بلجيكا'); INSERT INTO [country] ([id], [name]) VALUES ('BG', 'بلغاريا'); INSERT INTO [country] ([id], [name]) VALUES ('BZ', 'بليز'); INSERT INTO [country] ([id], [name]) VALUES ('BD', 'بنجلاديش'); INSERT INTO [country] ([id], [name]) VALUES ('PA', 'بنما'); INSERT INTO [country] ([id], [name]) VALUES ('BJ', 'بنين'); INSERT INTO [country] ([id], [name]) VALUES ('BT', 'بوتان'); INSERT INTO [country] ([id], [name]) VALUES ('PR', 'بورتوريكو'); INSERT INTO [country] ([id], [name]) VALUES ('BF', 'بوركينا فاسو'); INSERT INTO [country] ([id], [name]) VALUES ('BI', 'بوروندي'); INSERT INTO [country] ([id], [name]) VALUES ('PL', 'بولندا'); INSERT INTO [country] ([id], [name]) VALUES ('BO', 'بوليفيا'); INSERT INTO [country] ([id], [name]) VALUES ('PF', 'بولينيزيا الفرنسية'); INSERT INTO [country] ([id], [name]) VALUES ('PE', 'بيرو'); INSERT INTO [country] ([id], [name]) VALUES ('TZ', 'تانزانيا'); INSERT INTO [country] ([id], [name]) VALUES ('TH', 'تايلاند'); INSERT INTO [country] ([id], [name]) VALUES ('TW', 'تايوان'); INSERT INTO [country] ([id], [name]) VALUES ('TM', 'تركمانستان'); INSERT INTO [country] ([id], [name]) VALUES ('TR', 'تركيا'); INSERT INTO [country] ([id], [name]) VALUES ('TA', 'تريستان دي كونها'); INSERT INTO [country] ([id], [name]) VALUES ('TT', 'ترينيداد وتوباغو'); INSERT INTO [country] ([id], [name]) VALUES ('TD', 'تشاد'); INSERT INTO [country] ([id], [name]) VALUES ('TG', 'توجو'); INSERT INTO [country] ([id], [name]) VALUES ('TV', 'توفالو'); INSERT INTO [country] ([id], [name]) VALUES ('TK', 'توكيلو'); INSERT INTO [country] ([id], [name]) VALUES ('TN', 'تونس'); INSERT INTO [country] ([id], [name]) VALUES ('TO', 'تونغا'); INSERT INTO [country] ([id], [name]) VALUES ('TL', 'تيمور الشرقية'); INSERT INTO [country] ([id], [name]) VALUES ('JM', 'جامايكا'); INSERT INTO [country] ([id], [name]) VALUES ('GI', 'جبل طارق'); INSERT INTO [country] ([id], [name]) VALUES ('AX', 'جزر آلاند'); INSERT INTO [country] ([id], [name]) VALUES ('AN', 'جزر الأنتيل الهولندية'); INSERT INTO [country] ([id], [name]) VALUES ('TC', 'جزر الترك وجايكوس'); INSERT INTO [country] ([id], [name]) VALUES ('KM', 'جزر القمر'); INSERT INTO [country] ([id], [name]) VALUES ('KY', 'جزر الكايمن'); INSERT INTO [country] ([id], [name]) VALUES ('IC', 'جزر الكناري'); INSERT INTO [country] ([id], [name]) VALUES ('MH', 'جزر المارشال'); INSERT INTO [country] ([id], [name]) VALUES ('MV', 'جزر المالديف'); INSERT INTO [country] ([id], [name]) VALUES ('UM', 'جزر الولايات المتحدة النائية'); INSERT INTO [country] ([id], [name]) VALUES ('PN', 'جزر بيتكيرن'); INSERT INTO [country] ([id], [name]) VALUES ('SB', 'جزر سليمان'); INSERT INTO [country] ([id], [name]) VALUES ('FO', 'جزر فارو'); INSERT INTO [country] ([id], [name]) VALUES ('VI', 'جزر فرجين الأمريكية'); INSERT INTO [country] ([id], [name]) VALUES ('VG', 'جزر فرجين البريطانية'); INSERT INTO [country] ([id], [name]) VALUES ('FK', 'جزر فوكلاند'); INSERT INTO [country] ([id], [name]) VALUES ('CK', 'جزر كوك'); INSERT INTO [country] ([id], [name]) VALUES ('CC', 'جزر كوكوس'); INSERT INTO [country] ([id], [name]) VALUES ('MP', 'جزر ماريانا الشمالية'); INSERT INTO [country] ([id], [name]) VALUES ('WF', 'جزر والس وفوتونا'); INSERT INTO [country] ([id], [name]) VALUES ('AC', 'جزيرة أسينشيون'); INSERT INTO [country] ([id], [name]) VALUES ('CX', 'جزيرة الكريسماس'); INSERT INTO [country] ([id], [name]) VALUES ('BV', 'جزيرة بوفيه'); INSERT INTO [country] ([id], [name]) VALUES ('CP', 'جزيرة كليبيرتون'); INSERT INTO [country] ([id], [name]) VALUES ('IM', 'جزيرة مان'); INSERT INTO [country] ([id], [name]) VALUES ('NF', 'جزيرة نورفوك'); INSERT INTO [country] ([id], [name]) VALUES ('HM', 'جزيرة هيرد وجزر ماكدونالد'); INSERT INTO [country] ([id], [name]) VALUES ('CF', 'جمهورية أفريقيا الوسطى'); INSERT INTO [country] ([id], [name]) VALUES ('CZ', 'جمهورية التشيك'); INSERT INTO [country] ([id], [name]) VALUES ('DO', 'جمهورية الدومينيك'); INSERT INTO [country] ([id], [name]) VALUES ('ZA', 'جنوب أفريقيا'); INSERT INTO [country] ([id], [name]) VALUES ('SS', 'جنوب السودان'); INSERT INTO [country] ([id], [name]) VALUES ('GP', 'جوادلوب'); INSERT INTO [country] ([id], [name]) VALUES ('GE', 'جورجيا'); INSERT INTO [country] ([id], [name]) VALUES ('GS', 'جورجيا الجنوبية وجزر ساندويتش الجنوبية'); INSERT INTO [country] ([id], [name]) VALUES ('DJ', 'جيبوتي'); INSERT INTO [country] ([id], [name]) VALUES ('JE', 'جيرسي'); INSERT INTO [country] ([id], [name]) VALUES ('DM', 'دومينيكا'); INSERT INTO [country] ([id], [name]) VALUES ('DG', 'دييغو غارسيا'); INSERT INTO [country] ([id], [name]) VALUES ('RW', 'رواندا'); INSERT INTO [country] ([id], [name]) VALUES ('RU', 'روسيا'); INSERT INTO [country] ([id], [name]) VALUES ('BY', 'روسيا البيضاء'); INSERT INTO [country] ([id], [name]) VALUES ('RO', 'رومانيا'); INSERT INTO [country] ([id], [name]) VALUES ('RE', 'روينيون'); INSERT INTO [country] ([id], [name]) VALUES ('ZM', 'زامبيا'); INSERT INTO [country] ([id], [name]) VALUES ('ZW', 'زيمبابوي'); INSERT INTO [country] ([id], [name]) VALUES ('CI', 'ساحل العاج'); INSERT INTO [country] ([id], [name]) VALUES ('WS', 'ساموا'); INSERT INTO [country] ([id], [name]) VALUES ('AS', 'ساموا الأمريكية'); INSERT INTO [country] ([id], [name]) VALUES ('BL', 'سان بارتليمي'); INSERT INTO [country] ([id], [name]) VALUES ('SM', 'سان مارينو'); INSERT INTO [country] ([id], [name]) VALUES ('PM', 'سانت بيير وميكولون'); INSERT INTO [country] ([id], [name]) VALUES ('VC', 'سانت فنسنت وغرنادين'); INSERT INTO [country] ([id], [name]) VALUES ('KN', 'سانت كيتس ونيفيس'); INSERT INTO [country] ([id], [name]) VALUES ('LC', 'سانت لوسيا'); INSERT INTO [country] ([id], [name]) VALUES ('MF', 'سانت مارتن'); INSERT INTO [country] ([id], [name]) VALUES ('SH', 'سانت هيلنا'); INSERT INTO [country] ([id], [name]) VALUES ('ST', 'ساو تومي وبرينسيبي'); INSERT INTO [country] ([id], [name]) VALUES ('LK', 'سريلانكا'); INSERT INTO [country] ([id], [name]) VALUES ('SJ', 'سفالبارد وجان مايان'); INSERT INTO [country] ([id], [name]) VALUES ('SK', 'سلوفاكيا'); INSERT INTO [country] ([id], [name]) VALUES ('SI', 'سلوفينيا'); INSERT INTO [country] ([id], [name]) VALUES ('SG', 'سنغافورة'); INSERT INTO [country] ([id], [name]) VALUES ('SZ', 'سوازيلاند'); INSERT INTO [country] ([id], [name]) VALUES ('SY', 'سوريا'); INSERT INTO [country] ([id], [name]) VALUES ('SR', 'سورينام'); INSERT INTO [country] ([id], [name]) VALUES ('CH', 'سويسرا'); INSERT INTO [country] ([id], [name]) VALUES ('SL', 'سيراليون'); INSERT INTO [country] ([id], [name]) VALUES ('SC', 'سيشل'); INSERT INTO [country] ([id], [name]) VALUES ('SX', 'سينت مارتن'); INSERT INTO [country] ([id], [name]) VALUES ('EA', 'سيوتا وميليلا'); INSERT INTO [country] ([id], [name]) VALUES ('CL', 'شيلي'); INSERT INTO [country] ([id], [name]) VALUES ('RS', 'صربيا'); INSERT INTO [country] ([id], [name]) VALUES ('TJ', 'طاجكستان'); INSERT INTO [country] ([id], [name]) VALUES ('OM', 'عُمان'); INSERT INTO [country] ([id], [name]) VALUES ('GM', 'غامبيا'); INSERT INTO [country] ([id], [name]) VALUES ('GH', 'غانا'); INSERT INTO [country] ([id], [name]) VALUES ('GD', 'غرينادا'); INSERT INTO [country] ([id], [name]) VALUES ('GL', 'غرينلاند'); INSERT INTO [country] ([id], [name]) VALUES ('GT', 'غواتيمالا'); INSERT INTO [country] ([id], [name]) VALUES ('GU', 'غوام'); INSERT INTO [country] ([id], [name]) VALUES ('GF', 'غويانا الفرنسية'); INSERT INTO [country] ([id], [name]) VALUES ('GY', 'غيانا'); INSERT INTO [country] ([id], [name]) VALUES ('GG', 'غيرنزي'); INSERT INTO [country] ([id], [name]) VALUES ('GN', 'غينيا'); INSERT INTO [country] ([id], [name]) VALUES ('GQ', 'غينيا الإستوائية'); INSERT INTO [country] ([id], [name]) VALUES ('GW', 'غينيا بيساو'); INSERT INTO [country] ([id], [name]) VALUES ('VU', 'فانواتو'); INSERT INTO [country] ([id], [name]) VALUES ('FR', 'فرنسا'); INSERT INTO [country] ([id], [name]) VALUES ('VE', 'فنزويلا'); INSERT INTO [country] ([id], [name]) VALUES ('FI', 'فنلندا'); INSERT INTO [country] ([id], [name]) VALUES ('VN', 'فيتنام'); INSERT INTO [country] ([id], [name]) VALUES ('FJ', 'فيجي'); INSERT INTO [country] ([id], [name]) VALUES ('CY', 'قبرص'); INSERT INTO [country] ([id], [name]) VALUES ('KG', 'قرغيزستان'); INSERT INTO [country] ([id], [name]) VALUES ('QA', 'قطر'); INSERT INTO [country] ([id], [name]) VALUES ('KZ', 'كازاخستان'); INSERT INTO [country] ([id], [name]) VALUES ('NC', 'كاليدونيا الجديدة'); INSERT INTO [country] ([id], [name]) VALUES ('HR', 'كرواتيا'); INSERT INTO [country] ([id], [name]) VALUES ('KH', 'كمبوديا'); INSERT INTO [country] ([id], [name]) VALUES ('CA', 'كندا'); INSERT INTO [country] ([id], [name]) VALUES ('CU', 'كوبا'); INSERT INTO [country] ([id], [name]) VALUES ('CW', 'كوراساو'); INSERT INTO [country] ([id], [name]) VALUES ('KR', 'كوريا الجنوبية'); INSERT INTO [country] ([id], [name]) VALUES ('KP', 'كوريا الشمالية'); INSERT INTO [country] ([id], [name]) VALUES ('CR', 'كوستاريكا'); INSERT INTO [country] ([id], [name]) VALUES ('XK', 'كوسوفو'); INSERT INTO [country] ([id], [name]) VALUES ('CO', 'كولومبيا'); INSERT INTO [country] ([id], [name]) VALUES ('KI', 'كيريباتي'); INSERT INTO [country] ([id], [name]) VALUES ('KE', 'كينيا'); INSERT INTO [country] ([id], [name]) VALUES ('LV', 'لاتفيا'); INSERT INTO [country] ([id], [name]) VALUES ('LA', 'لاوس'); INSERT INTO [country] ([id], [name]) VALUES ('LB', 'لبنان'); INSERT INTO [country] ([id], [name]) VALUES ('LU', 'لوكسمبورغ'); INSERT INTO [country] ([id], [name]) VALUES ('LY', 'ليبيا'); INSERT INTO [country] ([id], [name]) VALUES ('LR', 'ليبيريا'); INSERT INTO [country] ([id], [name]) VALUES ('LT', 'ليتوانيا'); INSERT INTO [country] ([id], [name]) VALUES ('LI', 'ليختنشتاين'); INSERT INTO [country] ([id], [name]) VALUES ('LS', 'ليسوتو'); INSERT INTO [country] ([id], [name]) VALUES ('MQ', 'مارتينيك'); INSERT INTO [country] ([id], [name]) VALUES ('MT', 'مالطا'); INSERT INTO [country] ([id], [name]) VALUES ('ML', 'مالي'); INSERT INTO [country] ([id], [name]) VALUES ('MY', 'ماليزيا'); INSERT INTO [country] ([id], [name]) VALUES ('YT', 'مايوت'); INSERT INTO [country] ([id], [name]) VALUES ('MG', 'مدغشقر'); INSERT INTO [country] ([id], [name]) VALUES ('EG', 'مصر'); INSERT INTO [country] ([id], [name]) VALUES ('MK', 'مقدونيا'); INSERT INTO [country] ([id], [name]) VALUES ('MO', 'مكاو الصينية (منطقة إدارية خاصة)'); INSERT INTO [country] ([id], [name]) VALUES ('MW', 'ملاوي'); INSERT INTO [country] ([id], [name]) VALUES ('ZZ', 'منطقة غير معروفة'); INSERT INTO [country] ([id], [name]) VALUES ('MN', 'منغوليا'); INSERT INTO [country] ([id], [name]) VALUES ('MR', 'موريتانيا'); INSERT INTO [country] ([id], [name]) VALUES ('MU', 'موريشيوس'); INSERT INTO [country] ([id], [name]) VALUES ('MZ', 'موزمبيق'); INSERT INTO [country] ([id], [name]) VALUES ('MD', 'مولدافيا'); INSERT INTO [country] ([id], [name]) VALUES ('MC', 'موناكو'); INSERT INTO [country] ([id], [name]) VALUES ('MS', 'مونتسرات'); INSERT INTO [country] ([id], [name]) VALUES ('MM', 'ميانمار -بورما'); INSERT INTO [country] ([id], [name]) VALUES ('FM', 'ميكرونيزيا'); INSERT INTO [country] ([id], [name]) VALUES ('NA', 'ناميبيا'); INSERT INTO [country] ([id], [name]) VALUES ('NR', 'ناورو'); INSERT INTO [country] ([id], [name]) VALUES ('NP', 'نيبال'); INSERT INTO [country] ([id], [name]) VALUES ('NG', 'نيجيريا'); INSERT INTO [country] ([id], [name]) VALUES ('NI', 'نيكاراغوا'); INSERT INTO [country] ([id], [name]) VALUES ('NZ', 'نيوزيلاندا'); INSERT INTO [country] ([id], [name]) VALUES ('NU', 'نيوي'); INSERT INTO [country] ([id], [name]) VALUES ('HT', 'هايتي'); INSERT INTO [country] ([id], [name]) VALUES ('HN', 'هندوراس'); INSERT INTO [country] ([id], [name]) VALUES ('HU', 'هنغاريا'); INSERT INTO [country] ([id], [name]) VALUES ('NL', 'هولندا'); INSERT INTO [country] ([id], [name]) VALUES ('BQ', 'هولندا الكاريبية'); INSERT INTO [country] ([id], [name]) VALUES ('HK', 'هونغ كونغ الصينية');
bitsmike/country-list
country/cldr/ar_MR/country.sqlserver.sql
SQL
mit
19,246
#!/usr/bin/env python # Copyright (c) 2012 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Argument-less script to select what to run on the buildbots.""" import os import shutil import subprocess import sys if sys.platform in ['win32', 'cygwin']: EXE_SUFFIX = '.exe' else: EXE_SUFFIX = '' BUILDBOT_DIR = os.path.dirname(os.path.abspath(__file__)) TRUNK_DIR = os.path.dirname(BUILDBOT_DIR) ROOT_DIR = os.path.dirname(TRUNK_DIR) ANDROID_DIR = os.path.join(ROOT_DIR, 'android') OUT_DIR = os.path.join(TRUNK_DIR, 'out') def CallSubProcess(*args, **kwargs): """Wrapper around subprocess.call which treats errors as build exceptions.""" retcode = subprocess.call(*args, **kwargs) if retcode != 0: print '@@@STEP_EXCEPTION@@@' sys.exit(1) def PrepareAndroidTree(): """Prepare an Android tree to run 'android' format tests.""" if os.environ['BUILDBOT_CLOBBER'] == '1': print '@@@BUILD_STEP Clobber Android checkout@@@' shutil.rmtree(ANDROID_DIR) # The release of Android we use is static, so there's no need to do anything # if the directory already exists. if os.path.isdir(ANDROID_DIR): return print '@@@BUILD_STEP Initialize Android checkout@@@' os.mkdir(ANDROID_DIR) CallSubProcess(['git', 'config', '--global', 'user.name', 'trybot']) CallSubProcess(['git', 'config', '--global', 'user.email', 'chrome-bot@google.com']) CallSubProcess(['git', 'config', '--global', 'color.ui', 'false']) CallSubProcess( ['repo', 'init', '-u', 'https://android.googlesource.com/platform/manifest', '-b', 'android-4.2.1_r1', '-g', 'all,-notdefault,-device,-darwin,-mips,-x86'], cwd=ANDROID_DIR) print '@@@BUILD_STEP Sync Android@@@' CallSubProcess(['repo', 'sync', '-j4'], cwd=ANDROID_DIR) print '@@@BUILD_STEP Build Android@@@' CallSubProcess( ['/bin/bash', '-c', 'source build/envsetup.sh && lunch full-eng && make -j4'], cwd=ANDROID_DIR) def GypTestFormat(title, format=None, msvs_version=None): """Run the gyp tests for a given format, emitting annotator tags. See annotator docs at: https://sites.google.com/a/chromium.org/dev/developers/testing/chromium-build-infrastructure/buildbot-annotations Args: format: gyp format to test. Returns: 0 for sucesss, 1 for failure. """ if not format: format = title print '@@@BUILD_STEP ' + title + '@@@' sys.stdout.flush() env = os.environ.copy() if msvs_version: env['GYP_MSVS_VERSION'] = msvs_version command = ' '.join( [sys.executable, 'trunk/gyptest.py', '--all', '--passed', '--format', format, '--chdir', 'trunk']) if format == 'android': # gyptest needs the environment setup from envsetup/lunch in order to build # using the 'android' backend, so this is done in a single shell. retcode = subprocess.call( ['/bin/bash', '-c', 'source build/envsetup.sh && lunch full-eng && cd %s && %s' % (ROOT_DIR, command)], cwd=ANDROID_DIR, env=env) else: retcode = subprocess.call(command, cwd=ROOT_DIR, env=env, shell=True) if retcode: # Emit failure tag, and keep going. print '@@@STEP_FAILURE@@@' return 1 return 0 def GypBuild(): # Dump out/ directory. print '@@@BUILD_STEP cleanup@@@' print 'Removing %s...' % OUT_DIR shutil.rmtree(OUT_DIR, ignore_errors=True) print 'Done.' retcode = 0 # The Android gyp bot runs on linux so this must be tested first. if os.environ['BUILDBOT_BUILDERNAME'] == 'gyp-android': PrepareAndroidTree() retcode += GypTestFormat('android') elif sys.platform.startswith('linux'): retcode += GypTestFormat('ninja') retcode += GypTestFormat('make') elif sys.platform == 'darwin': retcode += GypTestFormat('ninja') retcode += GypTestFormat('xcode') retcode += GypTestFormat('make') elif sys.platform == 'win32': retcode += GypTestFormat('ninja') if os.environ['BUILDBOT_BUILDERNAME'] == 'gyp-win64': retcode += GypTestFormat('msvs-2010', format='msvs', msvs_version='2010') retcode += GypTestFormat('msvs-2012', format='msvs', msvs_version='2012') else: raise Exception('Unknown platform') if retcode: # TODO(bradnelson): once the annotator supports a postscript (section for # after the build proper that could be used for cumulative failures), # use that instead of this. This isolates the final return value so # that it isn't misattributed to the last stage. print '@@@BUILD_STEP failures@@@' sys.exit(retcode) if __name__ == '__main__': GypBuild()
garvinling/Flapstack
node_modules/npm/node_modules/node-gyp/gyp/buildbot/buildbot_run.py
Python
mit
4,706
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Threading; namespace System.Reflection.Internal { internal sealed class PinnedObject : CriticalDisposableObject { // can't be read-only since GCHandle is a mutable struct private GCHandle _handle; // non-zero indicates a valid handle private int _isValid; public PinnedObject(object obj) { // Make sure the current thread isn't aborted in between allocating the handle and storing it. #if !NETSTANDARD11 RuntimeHelpers.PrepareConstrainedRegions(); #endif try { } finally { _handle = GCHandle.Alloc(obj, GCHandleType.Pinned); _isValid = 1; } } protected override void Release() { // Make sure the current thread isn't aborted in between zeroing the handle and freeing it. #if !NETSTANDARD11 RuntimeHelpers.PrepareConstrainedRegions(); #endif try { } finally { if (Interlocked.Exchange(ref _isValid, 0) != 0) { _handle.Free(); } } } public unsafe byte* Pointer => (byte*)_handle.AddrOfPinnedObject(); } }
axelheer/corefx
src/System.Reflection.Metadata/src/System/Reflection/Internal/Utilities/PinnedObject.cs
C#
mit
1,598
/* ======================================================================== * bootstrap-switch - v3.2.2 * http://www.bootstrap-switch.org * ======================================================================== * Copyright 2012-2013 Mattia Larentis * * ======================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ======================================================================== */ .clearfix { *zoom: 1; } .clearfix:before, .clearfix:after { display: table; content: ""; line-height: 0; } .clearfix:after { clear: both; } .hide-text { font: 0/0 a; color: transparent; text-shadow: none; background-color: transparent; border: 0; } .input-block-level { display: block; width: 100%; min-height: 30px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .bootstrap-switch { display: inline-block; cursor: pointer; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; border: 1px solid; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); position: relative; text-align: left; overflow: hidden; line-height: 8px; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; -o-user-select: none; user-select: none; vertical-align: middle; min-width: 100px; -webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; -moz-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; } .bootstrap-switch.bootstrap-switch-mini { min-width: 71px; } .bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-on, .bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-off, .bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-label { padding-bottom: 4px; padding-top: 4px; font-size: 10px; line-height: 9px; } .bootstrap-switch.bootstrap-switch-small { min-width: 79px; } .bootstrap-switch.bootstrap-switch-small .bootstrap-switch-handle-on, .bootstrap-switch.bootstrap-switch-small .bootstrap-switch-handle-off, .bootstrap-switch.bootstrap-switch-small .bootstrap-switch-label { padding-bottom: 3px; padding-top: 3px; font-size: 12px; line-height: 18px; } .bootstrap-switch.bootstrap-switch-large { min-width: 120px; } .bootstrap-switch.bootstrap-switch-large .bootstrap-switch-handle-on, .bootstrap-switch.bootstrap-switch-large .bootstrap-switch-handle-off, .bootstrap-switch.bootstrap-switch-large .bootstrap-switch-label { padding-bottom: 9px; padding-top: 9px; font-size: 16px; line-height: normal; } .bootstrap-switch.bootstrap-switch-disabled, .bootstrap-switch.bootstrap-switch-readonly, .bootstrap-switch.bootstrap-switch-indeterminate { opacity: 0.5; filter: alpha(opacity=50); cursor: default !important; } .bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-on, .bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-on, .bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-on, .bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-off, .bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-off, .bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-off, .bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-label, .bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-label, .bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-label { cursor: default !important; } .bootstrap-switch.bootstrap-switch-animate .bootstrap-switch-container { -webkit-transition: margin-left 0.5s; -moz-transition: margin-left 0.5s; -o-transition: margin-left 0.5s; transition: margin-left 0.5s; } .bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-on { -webkit-border-top-left-radius: 0; -moz-border-radius-topleft: 0; border-top-left-radius: 0; -webkit-border-bottom-left-radius: 0; -moz-border-radius-bottomleft: 0; border-bottom-left-radius: 0; -webkit-border-top-right-radius: 4px; -moz-border-radius-topright: 4px; border-top-right-radius: 4px; -webkit-border-bottom-right-radius: 4px; -moz-border-radius-bottomright: 4px; border-bottom-right-radius: 4px; } .bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-off { -webkit-border-top-right-radius: 0; -moz-border-radius-topright: 0; border-top-right-radius: 0; -webkit-border-bottom-right-radius: 0; -moz-border-radius-bottomright: 0; border-bottom-right-radius: 0; -webkit-border-top-left-radius: 4px; -moz-border-radius-topleft: 4px; border-top-left-radius: 4px; -webkit-border-bottom-left-radius: 4px; -moz-border-radius-bottomleft: 4px; border-bottom-left-radius: 4px; } .bootstrap-switch.bootstrap-switch-focused { border-color: rgba(82, 168, 236, 0.8); outline: 0; outline: thin dotted \9; -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82, 168, 236, .6); -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82, 168, 236, .6); box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82, 168, 236, .6); } .bootstrap-switch.bootstrap-switch-on .bootstrap-switch-container, .bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-off .bootstrap-switch-container { margin-left: 0%; } .bootstrap-switch.bootstrap-switch-on .bootstrap-switch-label, .bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-off .bootstrap-switch-label { -webkit-border-top-right-radius: 4px; -moz-border-radius-topright: 4px; border-top-right-radius: 4px; -webkit-border-bottom-right-radius: 4px; -moz-border-radius-bottomright: 4px; border-bottom-right-radius: 4px; } .bootstrap-switch.bootstrap-switch-off .bootstrap-switch-container, .bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-on .bootstrap-switch-container { margin-left: -50%; } .bootstrap-switch.bootstrap-switch-off .bootstrap-switch-label, .bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-on .bootstrap-switch-label { -webkit-border-top-left-radius: 4px; -moz-border-radius-topleft: 4px; border-top-left-radius: 4px; -webkit-border-bottom-left-radius: 4px; -moz-border-radius-bottomleft: 4px; border-bottom-left-radius: 4px; } .bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-container { margin-left: -25%; } .bootstrap-switch .bootstrap-switch-container { display: inline-block; width: 150%; top: 0; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; -webkit-transform: translate3d(0, 0, 0); -moz-transform: translate3d(0, 0, 0); -o-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); } .bootstrap-switch .bootstrap-switch-handle-on, .bootstrap-switch .bootstrap-switch-handle-off, .bootstrap-switch .bootstrap-switch-label { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; cursor: pointer; display: inline-block !important; height: 100%; padding-bottom: 4px; padding-top: 4px; font-size: 14px; line-height: 20px; } .bootstrap-switch .bootstrap-switch-handle-on, .bootstrap-switch .bootstrap-switch-handle-off { text-align: center; z-index: 1; width: 33.333333333%; } .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary { color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #005fcc; background-image: -moz-linear-gradient(top, #0044cc, #0088cc); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0044cc), to(#0088cc)); background-image: -webkit-linear-gradient(top, #0044cc, #0088cc); background-image: -o-linear-gradient(top, #0044cc, #0088cc); background-image: linear-gradient(to bottom, #0044cc, #0088cc); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0044cc', endColorstr='#ff0088cc', GradientType=0); border-color: #0088cc #0088cc #005580; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #0088cc; /* Darken IE7 buttons by default so they stand out more given they won't have borders */ filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); } .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary:hover, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary:hover, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary:focus, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary:focus, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary:active, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary:active, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary.active, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary.active, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary.disabled, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary.disabled, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary[disabled], .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary[disabled] { color: #ffffff; background-color: #0088cc; *background-color: #0077b3; } .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary:active, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary:active, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary.active, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary.active { background-color: #006699 \9; } .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info { color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #41a7c5; background-image: -moz-linear-gradient(top, #2f96b4, #5bc0de); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#2f96b4), to(#5bc0de)); background-image: -webkit-linear-gradient(top, #2f96b4, #5bc0de); background-image: -o-linear-gradient(top, #2f96b4, #5bc0de); background-image: linear-gradient(to bottom, #2f96b4, #5bc0de); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff2f96b4', endColorstr='#ff5bc0de', GradientType=0); border-color: #5bc0de #5bc0de #28a1c5; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #5bc0de; /* Darken IE7 buttons by default so they stand out more given they won't have borders */ filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); } .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info:hover, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info:hover, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info:focus, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info:focus, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info:active, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info:active, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info.active, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info.active, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info.disabled, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info.disabled, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info[disabled], .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info[disabled] { color: #ffffff; background-color: #5bc0de; *background-color: #46b8da; } .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info:active, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info:active, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info.active, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info.active { background-color: #31b0d5 \9; } .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success { color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #58b058; background-image: -moz-linear-gradient(top, #51a351, #62c462); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#51a351), to(#62c462)); background-image: -webkit-linear-gradient(top, #51a351, #62c462); background-image: -o-linear-gradient(top, #51a351, #62c462); background-image: linear-gradient(to bottom, #51a351, #62c462); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff51a351', endColorstr='#ff62c462', GradientType=0); border-color: #62c462 #62c462 #3b9e3b; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #62c462; /* Darken IE7 buttons by default so they stand out more given they won't have borders */ filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); } .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success:hover, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success:hover, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success:focus, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success:focus, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success:active, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success:active, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success.active, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success.active, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success.disabled, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success.disabled, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success[disabled], .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success[disabled] { color: #ffffff; background-color: #62c462; *background-color: #4fbd4f; } .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success:active, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success:active, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success.active, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success.active { background-color: #42b142 \9; } .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning { color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #f9a123; background-image: -moz-linear-gradient(top, #f89406, #fbb450); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f89406), to(#fbb450)); background-image: -webkit-linear-gradient(top, #f89406, #fbb450); background-image: -o-linear-gradient(top, #f89406, #fbb450); background-image: linear-gradient(to bottom, #f89406, #fbb450); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff89406', endColorstr='#fffbb450', GradientType=0); border-color: #fbb450 #fbb450 #f89406; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #fbb450; /* Darken IE7 buttons by default so they stand out more given they won't have borders */ filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); } .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning:hover, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning:hover, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning:focus, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning:focus, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning:active, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning:active, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning.active, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning.active, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning.disabled, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning.disabled, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning[disabled], .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning[disabled] { color: #ffffff; background-color: #fbb450; *background-color: #faa937; } .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning:active, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning:active, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning.active, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning.active { background-color: #fa9f1e \9; } .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger { color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #d14641; background-image: -moz-linear-gradient(top, #bd362f, #ee5f5b); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#bd362f), to(#ee5f5b)); background-image: -webkit-linear-gradient(top, #bd362f, #ee5f5b); background-image: -o-linear-gradient(top, #bd362f, #ee5f5b); background-image: linear-gradient(to bottom, #bd362f, #ee5f5b); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffbd362f', endColorstr='#ffee5f5b', GradientType=0); border-color: #ee5f5b #ee5f5b #e51d18; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #ee5f5b; /* Darken IE7 buttons by default so they stand out more given they won't have borders */ filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); } .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger:hover, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger:hover, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger:focus, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger:focus, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger:active, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger:active, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger.active, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger.active, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger.disabled, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger.disabled, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger[disabled], .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger[disabled] { color: #ffffff; background-color: #ee5f5b; *background-color: #ec4844; } .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger:active, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger:active, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger.active, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger.active { background-color: #e9322d \9; } .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default { color: #333333; text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); background-color: #f0f0f0; background-image: -moz-linear-gradient(top, #e6e6e6, #ffffff); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#e6e6e6), to(#ffffff)); background-image: -webkit-linear-gradient(top, #e6e6e6, #ffffff); background-image: -o-linear-gradient(top, #e6e6e6, #ffffff); background-image: linear-gradient(to bottom, #e6e6e6, #ffffff); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe6e6e6', endColorstr='#ffffffff', GradientType=0); border-color: #ffffff #ffffff #d9d9d9; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #ffffff; /* Darken IE7 buttons by default so they stand out more given they won't have borders */ filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); } .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default:hover, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default:hover, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default:focus, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default:focus, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default:active, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default:active, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default.active, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default.active, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default.disabled, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default.disabled, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default[disabled], .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default[disabled] { color: #333333; background-color: #ffffff; *background-color: #f2f2f2; } .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default:active, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default:active, .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default.active, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default.active { background-color: #e6e6e6 \9; } .bootstrap-switch .bootstrap-switch-label { text-align: center; margin-top: -1px; margin-bottom: -1px; z-index: 100; width: 33.333333333%; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; color: #333333; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #f5f5f5; background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6)); background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6); background-image: -o-linear-gradient(top, #ffffff, #e6e6e6); background-image: linear-gradient(to bottom, #ffffff, #e6e6e6); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0); border-color: #e6e6e6 #e6e6e6 #bfbfbf; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #e6e6e6; /* Darken IE7 buttons by default so they stand out more given they won't have borders */ filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); } .bootstrap-switch .bootstrap-switch-label:hover, .bootstrap-switch .bootstrap-switch-label:focus, .bootstrap-switch .bootstrap-switch-label:active, .bootstrap-switch .bootstrap-switch-label.active, .bootstrap-switch .bootstrap-switch-label.disabled, .bootstrap-switch .bootstrap-switch-label[disabled] { color: #333333; background-color: #e6e6e6; *background-color: #d9d9d9; } .bootstrap-switch .bootstrap-switch-label:active, .bootstrap-switch .bootstrap-switch-label.active { background-color: #cccccc \9; } .bootstrap-switch .bootstrap-switch-handle-on { -webkit-border-top-left-radius: 4px; -moz-border-radius-topleft: 4px; border-top-left-radius: 4px; -webkit-border-bottom-left-radius: 4px; -moz-border-radius-bottomleft: 4px; border-bottom-left-radius: 4px; } .bootstrap-switch .bootstrap-switch-handle-off { -webkit-border-top-right-radius: 4px; -moz-border-radius-topright: 4px; border-top-right-radius: 4px; -webkit-border-bottom-right-radius: 4px; -moz-border-radius-bottomright: 4px; border-bottom-right-radius: 4px; } .bootstrap-switch input[type='radio'], .bootstrap-switch input[type='checkbox'] { position: absolute !important; top: 0; left: 0; opacity: 0; filter: alpha(opacity=0); z-index: -1; } .bootstrap-switch input[type='radio'].form-control, .bootstrap-switch input[type='checkbox'].form-control { height: auto; }
hibrahimsafak/cdnjs
ajax/libs/bootstrap-switch/3.2.2/css/bootstrap2/bootstrap-switch.css
CSS
mit
25,011
!function() { var topojson = { version: "1.4.6", mesh: mesh, feature: featureOrCollection, neighbors: neighbors, presimplify: presimplify }; function merge(topology, arcs) { var fragmentByStart = {}, fragmentByEnd = {}; arcs.forEach(function(i) { var e = ends(i), start = e[0], end = e[1], f, g; if (f = fragmentByEnd[start]) { delete fragmentByEnd[f.end]; f.push(i); f.end = end; if (g = fragmentByStart[end]) { delete fragmentByStart[g.start]; var fg = g === f ? f : f.concat(g); fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg; } else if (g = fragmentByEnd[end]) { delete fragmentByStart[g.start]; delete fragmentByEnd[g.end]; var fg = f.concat(g.map(function(i) { return ~i; }).reverse()); fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.start] = fg; } else { fragmentByStart[f.start] = fragmentByEnd[f.end] = f; } } else if (f = fragmentByStart[end]) { delete fragmentByStart[f.start]; f.unshift(i); f.start = start; if (g = fragmentByEnd[start]) { delete fragmentByEnd[g.end]; var gf = g === f ? f : g.concat(f); fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf; } else if (g = fragmentByStart[start]) { delete fragmentByStart[g.start]; delete fragmentByEnd[g.end]; var gf = g.map(function(i) { return ~i; }).reverse().concat(f); fragmentByStart[gf.start = g.end] = fragmentByEnd[gf.end = f.end] = gf; } else { fragmentByStart[f.start] = fragmentByEnd[f.end] = f; } } else if (f = fragmentByStart[start]) { delete fragmentByStart[f.start]; f.unshift(~i); f.start = end; if (g = fragmentByEnd[end]) { delete fragmentByEnd[g.end]; var gf = g === f ? f : g.concat(f); fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf; } else if (g = fragmentByStart[end]) { delete fragmentByStart[g.start]; delete fragmentByEnd[g.end]; var gf = g.map(function(i) { return ~i; }).reverse().concat(f); fragmentByStart[gf.start = g.end] = fragmentByEnd[gf.end = f.end] = gf; } else { fragmentByStart[f.start] = fragmentByEnd[f.end] = f; } } else if (f = fragmentByEnd[end]) { delete fragmentByEnd[f.end]; f.push(~i); f.end = start; if (g = fragmentByEnd[start]) { delete fragmentByStart[g.start]; var fg = g === f ? f : f.concat(g); fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg; } else if (g = fragmentByStart[start]) { delete fragmentByStart[g.start]; delete fragmentByEnd[g.end]; var fg = f.concat(g.map(function(i) { return ~i; }).reverse()); fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.start] = fg; } else { fragmentByStart[f.start] = fragmentByEnd[f.end] = f; } } else { f = [i]; fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f; } }); function ends(i) { var arc = topology.arcs[i], p0 = arc[0], p1 = [0, 0]; arc.forEach(function(dp) { p1[0] += dp[0], p1[1] += dp[1]; }); return [p0, p1]; } var fragments = []; for (var k in fragmentByEnd) fragments.push(fragmentByEnd[k]); return fragments; } function mesh(topology, o, filter) { var arcs = []; if (arguments.length > 1) { var geomsByArc = [], geom; function arc(i) { if (i < 0) i = ~i; (geomsByArc[i] || (geomsByArc[i] = [])).push(geom); } function line(arcs) { arcs.forEach(arc); } function polygon(arcs) { arcs.forEach(line); } function geometry(o) { if (o.type === "GeometryCollection") o.geometries.forEach(geometry); else if (o.type in geometryType) { geom = o; geometryType[o.type](o.arcs); } } var geometryType = { LineString: line, MultiLineString: polygon, Polygon: polygon, MultiPolygon: function(arcs) { arcs.forEach(polygon); } }; geometry(o); geomsByArc.forEach(arguments.length < 3 ? function(geoms, i) { arcs.push(i); } : function(geoms, i) { if (filter(geoms[0], geoms[geoms.length - 1])) arcs.push(i); }); } else { for (var i = 0, n = topology.arcs.length; i < n; ++i) arcs.push(i); } return object(topology, {type: "MultiLineString", arcs: merge(topology, arcs)}); } function featureOrCollection(topology, o) { return o.type === "GeometryCollection" ? { type: "FeatureCollection", features: o.geometries.map(function(o) { return feature(topology, o); }) } : feature(topology, o); } function feature(topology, o) { var f = { type: "Feature", id: o.id, properties: o.properties || {}, geometry: object(topology, o) }; if (o.id == null) delete f.id; return f; } function object(topology, o) { var absolute = transformAbsolute(topology.transform), arcs = topology.arcs; function arc(i, points) { if (points.length) points.pop(); for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length, p; k < n; ++k) { points.push(p = a[k].slice()); absolute(p, k); } if (i < 0) reverse(points, n); } function point(p) { p = p.slice(); absolute(p, 0); return p; } function line(arcs) { var points = []; for (var i = 0, n = arcs.length; i < n; ++i) arc(arcs[i], points); if (points.length < 2) points.push(points[0].slice()); return points; } function ring(arcs) { var points = line(arcs); while (points.length < 4) points.push(points[0].slice()); return points; } function polygon(arcs) { return arcs.map(ring); } function geometry(o) { var t = o.type; return t === "GeometryCollection" ? {type: t, geometries: o.geometries.map(geometry)} : t in geometryType ? {type: t, coordinates: geometryType[t](o)} : null; } var geometryType = { Point: function(o) { return point(o.coordinates); }, MultiPoint: function(o) { return o.coordinates.map(point); }, LineString: function(o) { return line(o.arcs); }, MultiLineString: function(o) { return o.arcs.map(line); }, Polygon: function(o) { return polygon(o.arcs); }, MultiPolygon: function(o) { return o.arcs.map(polygon); } }; return geometry(o); } function reverse(array, n) { var t, j = array.length, i = j - n; while (i < --j) t = array[i], array[i++] = array[j], array[j] = t; } function bisect(a, x) { var lo = 0, hi = a.length; while (lo < hi) { var mid = lo + hi >>> 1; if (a[mid] < x) lo = mid + 1; else hi = mid; } return lo; } function neighbors(objects) { var indexesByArc = {}, // arc index -> array of object indexes neighbors = objects.map(function() { return []; }); function line(arcs, i) { arcs.forEach(function(a) { if (a < 0) a = ~a; var o = indexesByArc[a]; if (o) o.push(i); else indexesByArc[a] = [i]; }); } function polygon(arcs, i) { arcs.forEach(function(arc) { line(arc, i); }); } function geometry(o, i) { if (o.type === "GeometryCollection") o.geometries.forEach(function(o) { geometry(o, i); }); else if (o.type in geometryType) geometryType[o.type](o.arcs, i); } var geometryType = { LineString: line, MultiLineString: polygon, Polygon: polygon, MultiPolygon: function(arcs, i) { arcs.forEach(function(arc) { polygon(arc, i); }); } }; objects.forEach(geometry); for (var i in indexesByArc) { for (var indexes = indexesByArc[i], m = indexes.length, j = 0; j < m; ++j) { for (var k = j + 1; k < m; ++k) { var ij = indexes[j], ik = indexes[k], n; if ((n = neighbors[ij])[i = bisect(n, ik)] !== ik) n.splice(i, 0, ik); if ((n = neighbors[ik])[i = bisect(n, ij)] !== ij) n.splice(i, 0, ij); } } } return neighbors; } function presimplify(topology, triangleArea) { var absolute = transformAbsolute(topology.transform), relative = transformRelative(topology.transform), heap = minHeap(compareArea), maxArea = 0, triangle; if (!triangleArea) triangleArea = cartesianArea; topology.arcs.forEach(function(arc) { var triangles = []; arc.forEach(absolute); for (var i = 1, n = arc.length - 1; i < n; ++i) { triangle = arc.slice(i - 1, i + 2); triangle[1][2] = triangleArea(triangle); triangles.push(triangle); heap.push(triangle); } // Always keep the arc endpoints! arc[0][2] = arc[n][2] = Infinity; for (var i = 0, n = triangles.length; i < n; ++i) { triangle = triangles[i]; triangle.previous = triangles[i - 1]; triangle.next = triangles[i + 1]; } }); while (triangle = heap.pop()) { var previous = triangle.previous, next = triangle.next; // If the area of the current point is less than that of the previous point // to be eliminated, use the latter's area instead. This ensures that the // current point cannot be eliminated without eliminating previously- // eliminated points. if (triangle[1][2] < maxArea) triangle[1][2] = maxArea; else maxArea = triangle[1][2]; if (previous) { previous.next = next; previous[2] = triangle[2]; update(previous); } if (next) { next.previous = previous; next[0] = triangle[0]; update(next); } } topology.arcs.forEach(function(arc) { arc.forEach(relative); }); function update(triangle) { heap.remove(triangle); triangle[1][2] = triangleArea(triangle); heap.push(triangle); } return topology; }; function cartesianArea(triangle) { return Math.abs( (triangle[0][0] - triangle[2][0]) * (triangle[1][1] - triangle[0][1]) - (triangle[0][0] - triangle[1][0]) * (triangle[2][1] - triangle[0][1]) ); } function compareArea(a, b) { return a[1][2] - b[1][2]; } function minHeap(compare) { var heap = {}, array = []; heap.push = function() { for (var i = 0, n = arguments.length; i < n; ++i) { var object = arguments[i]; up(object.index = array.push(object) - 1); } return array.length; }; heap.pop = function() { var removed = array[0], object = array.pop(); if (array.length) { array[object.index = 0] = object; down(0); } return removed; }; heap.remove = function(removed) { var i = removed.index, object = array.pop(); if (i !== array.length) { array[object.index = i] = object; (compare(object, removed) < 0 ? up : down)(i); } return i; }; function up(i) { var object = array[i]; while (i > 0) { var up = ((i + 1) >> 1) - 1, parent = array[up]; if (compare(object, parent) >= 0) break; array[parent.index = i] = parent; array[object.index = i = up] = object; } } function down(i) { var object = array[i]; while (true) { var right = (i + 1) << 1, left = right - 1, down = i, child = array[down]; if (left < array.length && compare(array[left], child) < 0) child = array[down = left]; if (right < array.length && compare(array[right], child) < 0) child = array[down = right]; if (down === i) break; array[child.index = i] = child; array[object.index = i = down] = object; } } return heap; } function transformAbsolute(transform) { if (!transform) return noop; var x0, y0, kx = transform.scale[0], ky = transform.scale[1], dx = transform.translate[0], dy = transform.translate[1]; return function(point, i) { if (!i) x0 = y0 = 0; point[0] = (x0 += point[0]) * kx + dx; point[1] = (y0 += point[1]) * ky + dy; }; } function transformRelative(transform) { if (!transform) return noop; var x0, y0, kx = transform.scale[0], ky = transform.scale[1], dx = transform.translate[0], dy = transform.translate[1]; return function(point, i) { if (!i) x0 = y0 = 0; var x1 = (point[0] - dx) / kx | 0, y1 = (point[1] - dy) / ky | 0; point[0] = x1 - x0; point[1] = y1 - y0; x0 = x1; y0 = y1; }; } function noop() {} if (typeof define === "function" && define.amd) define(topojson); else if (typeof module === "object" && module.exports) module.exports = topojson; else this.topojson = topojson; }();
NMastracchio/cdnjs
ajax/libs/topojson/1.4.6/topojson.js
JavaScript
mit
13,379
var ghostBookshelf = require('./base'), App, Apps; App = ghostBookshelf.Model.extend({ tableName: 'apps', saving: function (newPage, attr, options) { /*jshint unused:false*/ var self = this; ghostBookshelf.Model.prototype.saving.apply(this, arguments); if (this.hasChanged('slug') || !this.get('slug')) { // Pass the new slug through the generator to strip illegal characters, detect duplicates return ghostBookshelf.Model.generateSlug(App, this.get('slug') || this.get('name'), {transacting: options.transacting}) .then(function (slug) { self.set({slug: slug}); }); } }, permissions: function () { return this.belongsToMany('Permission', 'permissions_apps'); }, settings: function () { return this.belongsToMany('AppSetting', 'app_settings'); } }, { /** * Returns an array of keys permitted in a method's `options` hash, depending on the current method. * @param {String} methodName The name of the method to check valid options for. * @return {Array} Keys allowed in the `options` hash of the model's method. */ permittedOptions: function (methodName) { var options = ghostBookshelf.Model.permittedOptions(), // whitelists for the `options` hash argument on methods, by method name. // these are the only options that can be passed to Bookshelf / Knex. validOptions = { findOne: ['withRelated'] }; if (validOptions[methodName]) { options = options.concat(validOptions[methodName]); } return options; } }); Apps = ghostBookshelf.Collection.extend({ model: App }); module.exports = { App: ghostBookshelf.model('App', App), Apps: ghostBookshelf.collection('Apps', Apps) };
kellynloehr/paul
core/server/models/app.js
JavaScript
mit
1,916
/*! * jQuery JavaScript Library v2.1.0 * http://jquery.com/ * * Includes Sizzle.js * http://sizzlejs.com/ * * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors * Released under the MIT license * http://jquery.org/license * * Date: 2014-01-23T21:10Z */ !function(d,c){"object"==typeof module&&"object"==typeof module.exports?module.exports=d.document?c(d,!0):function(b){if(!b.document){throw new Error("jQuery requires a window with a document")}return c(b)}:c(d)}("undefined"!=typeof window?window:this,function(a,b){function c(a){var b=a.length,c=ab.type(a);return"function"===c||ab.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}function d(a,b,c){if(ab.isFunction(b)){return ab.grep(a,function(a,d){return !!b.call(a,d,a)!==c})}if(b.nodeType){return ab.grep(a,function(a){return a===b!==c})}if("string"==typeof b){if(hb.test(b)){return ab.filter(b,a,c)}b=ab.filter(b,a)}return ab.grep(a,function(a){return U.call(b,a)>=0!==c})}function e(a,b){for(;(a=a[b])&&1!==a.nodeType;){}return a}function f(a){var b=ob[a]={};return ab.each(a.match(nb)||[],function(a,c){b[c]=!0}),b}function g(){$.removeEventListener("DOMContentLoaded",g,!1),a.removeEventListener("load",g,!1),ab.ready()}function h(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=ab.expando+Math.random()}function i(a,b,c){var d;if(void 0===c&&1===a.nodeType){if(d="data-"+b.replace(ub,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:tb.test(c)?ab.parseJSON(c):c}catch(e){}sb.set(a,b,c)}else{c=void 0}}return c}function j(){return !0}function k(){return !1}function l(){try{return $.activeElement}catch(a){}}function m(a,b){return ab.nodeName(a,"table")&&ab.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function n(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function o(a){var b=Kb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function p(a,b){for(var c=0,d=a.length;d>c;c++){rb.set(a[c],"globalEval",!b||rb.get(b[c],"globalEval"))}}function q(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(rb.hasData(a)&&(f=rb.access(a),g=rb.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j){for(c=0,d=j[e].length;d>c;c++){ab.event.add(b,e,j[e][c])}}}sb.hasData(a)&&(h=sb.access(a),i=ab.extend({},h),sb.set(b,i))}}function r(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&ab.nodeName(a,b)?ab.merge([a],c):c}function s(a,b){var c=b.nodeName.toLowerCase();"input"===c&&yb.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}function t(b,c){var d=ab(c.createElement(b)).appendTo(c.body),e=a.getDefaultComputedStyle?a.getDefaultComputedStyle(d[0]).display:ab.css(d[0],"display");return d.detach(),e}function u(a){var b=$,c=Ob[a];return c||(c=t(a,b),"none"!==c&&c||(Nb=(Nb||ab("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=Nb[0].contentDocument,b.write(),b.close(),c=t(a,b),Nb.detach()),Ob[a]=c),c}function v(a,b,c){var d,e,f,g,h=a.style;return c=c||Rb(a),c&&(g=c.getPropertyValue(b)||c[b]),c&&(""!==g||ab.contains(a.ownerDocument,a)||(g=ab.style(a,b)),Qb.test(g)&&Pb.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function w(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}function x(a,b){if(b in a){return b}for(var c=b[0].toUpperCase()+b.slice(1),d=b,e=Xb.length;e--;){if(b=Xb[e]+c,b in a){return b}}return d}function y(a,b,c){var d=Tb.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function z(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2){"margin"===c&&(g+=ab.css(a,c+wb[f],!0,e)),d?("content"===c&&(g-=ab.css(a,"padding"+wb[f],!0,e)),"margin"!==c&&(g-=ab.css(a,"border"+wb[f]+"Width",!0,e))):(g+=ab.css(a,"padding"+wb[f],!0,e),"padding"!==c&&(g+=ab.css(a,"border"+wb[f]+"Width",!0,e)))}return g}function A(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Rb(a),g="border-box"===ab.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=v(a,b,f),(0>e||null==e)&&(e=a.style[b]),Qb.test(e)){return e}d=g&&(Z.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+z(a,b,c||(g?"border":"content"),d,f)+"px"}function B(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++){d=a[g],d.style&&(f[g]=rb.get(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&xb(d)&&(f[g]=rb.access(d,"olddisplay",u(d.nodeName)))):f[g]||(e=xb(d),(c&&"none"!==c||!e)&&rb.set(d,"olddisplay",e?c:ab.css(d,"display"))))}for(g=0;h>g;g++){d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"))}return a}function C(a,b,c,d,e){return new C.prototype.init(a,b,c,d,e)}function D(){return setTimeout(function(){Yb=void 0}),Yb=ab.now()}function E(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b){c=wb[d],e["margin"+c]=e["padding"+c]=a}return b&&(e.opacity=e.width=a),e}function F(a,b,c){for(var d,e=(cc[b]||[]).concat(cc["*"]),f=0,g=e.length;g>f;f++){if(d=e[f].call(c,b,a)){return d}}}function G(a,b,c){var d,e,f,g,h,i,j,k=this,l={},m=a.style,n=a.nodeType&&xb(a),o=rb.get(a,"fxshow");c.queue||(h=ab._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,k.always(function(){k.always(function(){h.unqueued--,ab.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height" in b||"width" in b)&&(c.overflow=[m.overflow,m.overflowX,m.overflowY],j=ab.css(a,"display"),"none"===j&&(j=u(a.nodeName)),"inline"===j&&"none"===ab.css(a,"float")&&(m.display="inline-block")),c.overflow&&(m.overflow="hidden",k.always(function(){m.overflow=c.overflow[0],m.overflowX=c.overflow[1],m.overflowY=c.overflow[2]}));for(d in b){if(e=b[d],$b.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(n?"hide":"show")){if("show"!==e||!o||void 0===o[d]){continue}n=!0}l[d]=o&&o[d]||ab.style(a,d)}}if(!ab.isEmptyObject(l)){o?"hidden" in o&&(n=o.hidden):o=rb.access(a,"fxshow",{}),f&&(o.hidden=!n),n?ab(a).show():k.done(function(){ab(a).hide()}),k.done(function(){var b;rb.remove(a,"fxshow");for(b in l){ab.style(a,b,l[b])}});for(d in l){g=F(n?o[d]:0,d,k),d in o||(o[d]=g.start,n&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}}function H(a,b){var c,d,e,f,g;for(c in a){if(d=ab.camelCase(c),e=b[d],f=a[c],ab.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=ab.cssHooks[d],g&&"expand" in g){f=g.expand(f),delete a[d];for(c in f){c in a||(a[c]=f[c],b[c]=e)}}else{b[d]=e}}}function I(a,b,c){var d,e,f=0,g=bc.length,h=ab.Deferred().always(function(){delete i.elem}),i=function(){if(e){return !1}for(var b=Yb||D(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++){j.tweens[g].run(f)}return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:ab.extend({},b),opts:ab.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:Yb||D(),duration:c.duration,tweens:[],createTween:function(b,c){var d=ab.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e){return this}for(e=!0;d>c;c++){j.tweens[c].run(1)}return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(H(k,j.opts.specialEasing);g>f;f++){if(d=bc[f].call(j,a,k,j.opts)){return d}}return ab.map(k,F,j),ab.isFunction(j.opts.start)&&j.opts.start.call(a,j),ab.fx.timer(ab.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}function J(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(nb)||[];if(ab.isFunction(c)){for(;d=f[e++];){"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}}}function K(a,b,c,d){function e(h){var i;return f[h]=!0,ab.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||g||f[j]?g?!(i=j):void 0:(b.dataTypes.unshift(j),e(j),!1)}),i}var f={},g=a===vc;return e(b.dataTypes[0])||!f["*"]&&e("*")}function L(a,b){var c,d,e=ab.ajaxSettings.flatOptions||{};for(c in b){void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c])}return d&&ab.extend(!0,a,d),a}function M(a,b,c){for(var d,e,f,g,h=a.contents,i=a.dataTypes;"*"===i[0];){i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"))}if(d){for(e in h){if(h[e]&&h[e].test(d)){i.unshift(e);break}}}if(i[0] in c){f=i[0]}else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function N(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1]){for(g in a.converters){j[g.toLowerCase()]=a.converters[g]}}for(f=k.shift();f;){if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift()){if("*"===f){f=i}else{if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g){for(e in j){if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}}}if(g!==!0){if(g&&a["throws"]){b=g(b)}else{try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}}}}}}return{state:"success",data:b}}function O(a,b,c,d){var e;if(ab.isArray(b)){ab.each(b,function(b,e){c||zc.test(a)?d(a,e):O(a+"["+("object"==typeof e?b:"")+"]",e,c,d)})}else{if(c||"object"!==ab.type(b)){d(a,b)}else{for(e in b){O(a+"["+e+"]",b[e],c,d)}}}}function P(a){return ab.isWindow(a)?a:9===a.nodeType&&a.defaultView}var Q=[],R=Q.slice,S=Q.concat,T=Q.push,U=Q.indexOf,V={},W=V.toString,X=V.hasOwnProperty,Y="".trim,Z={},$=a.document,_="2.1.0",ab=function(a,b){return new ab.fn.init(a,b)},bb=/^-ms-/,cb=/-([\da-z])/gi,db=function(a,b){return b.toUpperCase()};ab.fn=ab.prototype={jquery:_,constructor:ab,selector:"",length:0,toArray:function(){return R.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:R.call(this)},pushStack:function(a){var b=ab.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return ab.each(this,a,b)},map:function(a){return this.pushStack(ab.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(R.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:T,sort:Q.sort,splice:Q.splice},ab.extend=ab.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||ab.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++){if(null!=(a=arguments[h])){for(b in a){c=g[b],d=a[b],g!==d&&(j&&d&&(ab.isPlainObject(d)||(e=ab.isArray(d)))?(e?(e=!1,f=c&&ab.isArray(c)?c:[]):f=c&&ab.isPlainObject(c)?c:{},g[b]=ab.extend(j,f,d)):void 0!==d&&(g[b]=d))}}}return g},ab.extend({expando:"jQuery"+(_+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===ab.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return a-parseFloat(a)>=0},isPlainObject:function(a){if("object"!==ab.type(a)||a.nodeType||ab.isWindow(a)){return !1}try{if(a.constructor&&!X.call(a.constructor.prototype,"isPrototypeOf")){return !1}}catch(b){return !1}return !0},isEmptyObject:function(a){var b;for(b in a){return !1}return !0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?V[W.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=ab.trim(a),a&&(1===a.indexOf("use strict")?(b=$.createElement("script"),b.text=a,$.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(bb,"ms-").replace(cb,db)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,d){var e,f=0,g=a.length,h=c(a);if(d){if(h){for(;g>f&&(e=b.apply(a[f],d),e!==!1);f++){}}else{for(f in a){if(e=b.apply(a[f],d),e===!1){break}}}}else{if(h){for(;g>f&&(e=b.call(a[f],f,a[f]),e!==!1);f++){}}else{for(f in a){if(e=b.call(a[f],f,a[f]),e===!1){break}}}}return a},trim:function(a){return null==a?"":Y.call(a)},makeArray:function(a,b){var d=b||[];return null!=a&&(c(Object(a))?ab.merge(d,"string"==typeof a?[a]:a):T.call(d,a)),d},inArray:function(a,b,c){return null==b?-1:U.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++){a[e++]=b[d]}return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++){d=!b(a[f],f),d!==h&&e.push(a[f])}return e},map:function(a,b,d){var e,f=0,g=a.length,h=c(a),i=[];if(h){for(;g>f;f++){e=b(a[f],f,d),null!=e&&i.push(e)}}else{for(f in a){e=b(a[f],f,d),null!=e&&i.push(e)}}return S.apply([],i)},guid:1,proxy:function(a,b){var c,d,e;return"string"==typeof b&&(c=a[b],b=a,a=c),ab.isFunction(a)?(d=R.call(arguments,2),e=function(){return a.apply(b||this,d.concat(R.call(arguments)))},e.guid=a.guid=a.guid||ab.guid++,e):void 0},now:Date.now,support:Z}),ab.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){V["[object "+b+"]"]=b.toLowerCase()});var eb= /*! * Sizzle CSS Selector Engine v1.10.16 * http://sizzlejs.com/ * * Copyright 2013 jQuery Foundation, Inc. and other contributors * Released under the MIT license * http://jquery.org/license * * Date: 2014-01-13 */ function(a){function b(a,b,c,d){var e,f,g,h,i,j,l,o,p,q;if((b?b.ownerDocument||b:O)!==G&&F(b),b=b||G,c=c||[],!a||"string"!=typeof a){return c}if(1!==(h=b.nodeType)&&9!==h){return[]}if(I&&!d){if(e=sb.exec(a)){if(g=e[1]){if(9===h){if(f=b.getElementById(g),!f||!f.parentNode){return c}if(f.id===g){return c.push(f),c}}else{if(b.ownerDocument&&(f=b.ownerDocument.getElementById(g))&&M(b,f)&&f.id===g){return c.push(f),c}}}else{if(e[2]){return _.apply(c,b.getElementsByTagName(a)),c}if((g=e[3])&&x.getElementsByClassName&&b.getElementsByClassName){return _.apply(c,b.getElementsByClassName(g)),c}}}if(x.qsa&&(!J||!J.test(a))){if(o=l=N,p=b,q=9===h&&a,1===h&&"object"!==b.nodeName.toLowerCase()){for(j=m(a),(l=b.getAttribute("id"))?o=l.replace(ub,"\\$&"):b.setAttribute("id",o),o="[id='"+o+"'] ",i=j.length;i--;){j[i]=o+n(j[i])}p=tb.test(a)&&k(b.parentNode)||b,q=j.join(",")}if(q){try{return _.apply(c,p.querySelectorAll(q)),c}catch(r){}finally{l||b.removeAttribute("id")}}}}return v(a.replace(ib,"$1"),b,c,d)}function c(){function a(c,d){return b.push(c+" ")>y.cacheLength&&delete a[b.shift()],a[c+" "]=d}var b=[];return a}function d(a){return a[N]=!0,a}function e(a){var b=G.createElement("div");try{return !!a(b)}catch(c){return !1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function f(a,b){for(var c=a.split("|"),d=a.length;d--;){y.attrHandle[c[d]]=b}}function g(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||W)-(~a.sourceIndex||W);if(d){return d}if(c){for(;c=c.nextSibling;){if(c===b){return -1}}}return a?1:-1}function h(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function i(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function j(a){return d(function(b){return b=+b,d(function(c,d){for(var e,f=a([],c.length,b),g=f.length;g--;){c[e=f[g]]&&(c[e]=!(d[e]=c[e]))}})})}function k(a){return a&&typeof a.getElementsByTagName!==V&&a}function l(){}function m(a,c){var d,e,f,g,h,i,j,k=S[a+" "];if(k){return c?0:k.slice(0)}for(h=a,i=[],j=y.preFilter;h;){(!d||(e=jb.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),d=!1,(e=kb.exec(h))&&(d=e.shift(),f.push({value:d,type:e[0].replace(ib," ")}),h=h.slice(d.length));for(g in y.filter){!(e=ob[g].exec(h))||j[g]&&!(e=j[g](e))||(d=e.shift(),f.push({value:d,type:g,matches:e}),h=h.slice(d.length))}if(!d){break}}return c?h.length:h?b.error(a):S(a,i).slice(0)}function n(a){for(var b=0,c=a.length,d="";c>b;b++){d+=a[b].value}return d}function o(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=Q++;return b.first?function(b,c,f){for(;b=b[d];){if(1===b.nodeType||e){return a(b,c,f)}}}:function(b,c,g){var h,i,j=[P,f];if(g){for(;b=b[d];){if((1===b.nodeType||e)&&a(b,c,g)){return !0}}}else{for(;b=b[d];){if(1===b.nodeType||e){if(i=b[N]||(b[N]={}),(h=i[d])&&h[0]===P&&h[1]===f){return j[2]=h[2]}if(i[d]=j,j[2]=a(b,c,g)){return !0}}}}}}function p(a){return a.length>1?function(b,c,d){for(var e=a.length;e--;){if(!a[e](b,c,d)){return !1}}return !0}:a[0]}function q(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++){(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h))}return g}function r(a,b,c,e,f,g){return e&&!e[N]&&(e=r(e)),f&&!f[N]&&(f=r(f,g)),d(function(d,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=d||u(b||"*",h.nodeType?[h]:h,[]),r=!a||!d&&b?p:q(p,m,a,h,i),s=c?f||(d?a:o||e)?[]:g:r;if(c&&c(r,s,h,i),e){for(j=q(s,n),e(j,[],h,i),k=j.length;k--;){(l=j[k])&&(s[n[k]]=!(r[n[k]]=l))}}if(d){if(f||a){if(f){for(j=[],k=s.length;k--;){(l=s[k])&&j.push(r[k]=l)}f(null,s=[],j,i)}for(k=s.length;k--;){(l=s[k])&&(j=f?bb.call(d,l):m[k])>-1&&(d[j]=!(g[j]=l))}}}else{s=q(s===g?s.splice(o,s.length):s),f?f(null,g,s,i):_.apply(g,s)}})}function s(a){for(var b,c,d,e=a.length,f=y.relative[a[0].type],g=f||y.relative[" "],h=f?1:0,i=o(function(a){return a===b},g,!0),j=o(function(a){return bb.call(b,a)>-1},g,!0),k=[function(a,c,d){return !f&&(d||c!==C)||((b=c).nodeType?i(a,c,d):j(a,c,d))}];e>h;h++){if(c=y.relative[a[h].type]){k=[o(p(k),c)]}else{if(c=y.filter[a[h].type].apply(null,a[h].matches),c[N]){for(d=++h;e>d&&!y.relative[a[d].type];d++){}return r(h>1&&p(k),h>1&&n(a.slice(0,h-1).concat({value:" "===a[h-2].type?"*":""})).replace(ib,"$1"),c,d>h&&s(a.slice(h,d)),e>d&&s(a=a.slice(d)),e>d&&n(a))}k.push(c)}}return p(k)}function t(a,c){var e=c.length>0,f=a.length>0,g=function(d,g,h,i,j){var k,l,m,n=0,o="0",p=d&&[],r=[],s=C,t=d||f&&y.find.TAG("*",j),u=P+=null==s?1:Math.random()||0.1,v=t.length;for(j&&(C=g!==G&&g);o!==v&&null!=(k=t[o]);o++){if(f&&k){for(l=0;m=a[l++];){if(m(k,g,h)){i.push(k);break}}j&&(P=u)}e&&((k=!m&&k)&&n--,d&&p.push(k))}if(n+=o,e&&o!==n){for(l=0;m=c[l++];){m(p,r,g,h)}if(d){if(n>0){for(;o--;){p[o]||r[o]||(r[o]=Z.call(i))}}r=q(r)}_.apply(i,r),j&&!d&&r.length>0&&n+c.length>1&&b.uniqueSort(i)}return j&&(P=u,C=s),p};return e?d(g):g}function u(a,c,d){for(var e=0,f=c.length;f>e;e++){b(a,c[e],d)}return d}function v(a,b,c,d){var e,f,g,h,i,j=m(a);if(!d&&1===j.length){if(f=j[0]=j[0].slice(0),f.length>2&&"ID"===(g=f[0]).type&&x.getById&&9===b.nodeType&&I&&y.relative[f[1].type]){if(b=(y.find.ID(g.matches[0].replace(vb,wb),b)||[])[0],!b){return c}a=a.slice(f.shift().value.length)}for(e=ob.needsContext.test(a)?0:f.length;e--&&(g=f[e],!y.relative[h=g.type]);){if((i=y.find[h])&&(d=i(g.matches[0].replace(vb,wb),tb.test(f[0].type)&&k(b.parentNode)||b))){if(f.splice(e,1),a=d.length&&n(f),!a){return _.apply(c,d),c}break}}}return B(a,j)(d,b,!I,c,tb.test(a)&&k(b.parentNode)||b),c}var w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N="sizzle"+-new Date,O=a.document,P=0,Q=0,R=c(),S=c(),T=c(),U=function(a,b){return a===b&&(E=!0),0},V="undefined",W=1<<31,X={}.hasOwnProperty,Y=[],Z=Y.pop,$=Y.push,_=Y.push,ab=Y.slice,bb=Y.indexOf||function(a){for(var b=0,c=this.length;c>b;b++){if(this[b]===a){return b}}return -1},cb="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",db="[\\x20\\t\\r\\n\\f]",eb="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",fb=eb.replace("w","w#"),gb="\\["+db+"*("+eb+")"+db+"*(?:([*^$|!~]?=)"+db+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+fb+")|)|)"+db+"*\\]",hb=":("+eb+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+gb.replace(3,8)+")*)|.*)\\)|)",ib=new RegExp("^"+db+"+|((?:^|[^\\\\])(?:\\\\.)*)"+db+"+$","g"),jb=new RegExp("^"+db+"*,"+db+"*"),kb=new RegExp("^"+db+"*([>+~]|"+db+")"+db+"*"),lb=new RegExp("="+db+"*([^\\]'\"]*?)"+db+"*\\]","g"),mb=new RegExp(hb),nb=new RegExp("^"+fb+"$"),ob={ID:new RegExp("^#("+eb+")"),CLASS:new RegExp("^\\.("+eb+")"),TAG:new RegExp("^("+eb.replace("w","w*")+")"),ATTR:new RegExp("^"+gb),PSEUDO:new RegExp("^"+hb),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+db+"*(even|odd|(([+-]|)(\\d*)n|)"+db+"*(?:([+-]|)"+db+"*(\\d+)|))"+db+"*\\)|)","i"),bool:new RegExp("^(?:"+cb+")$","i"),needsContext:new RegExp("^"+db+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+db+"*((?:-\\d)?\\d*)"+db+"*\\)|)(?=[^-]|$)","i")},pb=/^(?:input|select|textarea|button)$/i,qb=/^h\d$/i,rb=/^[^{]+\{\s*\[native \w/,sb=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,tb=/[+~]/,ub=/'|\\/g,vb=new RegExp("\\\\([\\da-f]{1,6}"+db+"?|("+db+")|.)","ig"),wb=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{_.apply(Y=ab.call(O.childNodes),O.childNodes),Y[O.childNodes.length].nodeType}catch(xb){_={apply:Y.length?function(a,b){$.apply(a,ab.call(b))}:function(a,b){for(var c=a.length,d=0;a[c++]=b[d++];){}a.length=c-1}}}x=b.support={},A=b.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},F=b.setDocument=function(a){var b,c=a?a.ownerDocument||a:O,d=c.defaultView;return c!==G&&9===c.nodeType&&c.documentElement?(G=c,H=c.documentElement,I=!A(c),d&&d!==d.top&&(d.addEventListener?d.addEventListener("unload",function(){F()},!1):d.attachEvent&&d.attachEvent("onunload",function(){F()})),x.attributes=e(function(a){return a.className="i",!a.getAttribute("className")}),x.getElementsByTagName=e(function(a){return a.appendChild(c.createComment("")),!a.getElementsByTagName("*").length}),x.getElementsByClassName=rb.test(c.getElementsByClassName)&&e(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),x.getById=e(function(a){return H.appendChild(a).id=N,!c.getElementsByName||!c.getElementsByName(N).length}),x.getById?(y.find.ID=function(a,b){if(typeof b.getElementById!==V&&I){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},y.filter.ID=function(a){var b=a.replace(vb,wb);return function(a){return a.getAttribute("id")===b}}):(delete y.find.ID,y.filter.ID=function(a){var b=a.replace(vb,wb);return function(a){var c=typeof a.getAttributeNode!==V&&a.getAttributeNode("id");return c&&c.value===b}}),y.find.TAG=x.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==V?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){for(;c=f[e++];){1===c.nodeType&&d.push(c)}return d}return f},y.find.CLASS=x.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==V&&I?b.getElementsByClassName(a):void 0},K=[],J=[],(x.qsa=rb.test(c.querySelectorAll))&&(e(function(a){a.innerHTML="<select t=''><option selected=''></option></select>",a.querySelectorAll("[t^='']").length&&J.push("[*^$]="+db+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||J.push("\\["+db+"*(?:value|"+cb+")"),a.querySelectorAll(":checked").length||J.push(":checked")}),e(function(a){var b=c.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&J.push("name"+db+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||J.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),J.push(",.*:")})),(x.matchesSelector=rb.test(L=H.webkitMatchesSelector||H.mozMatchesSelector||H.oMatchesSelector||H.msMatchesSelector))&&e(function(a){x.disconnectedMatch=L.call(a,"div"),L.call(a,"[s!='']:x"),K.push("!=",hb)}),J=J.length&&new RegExp(J.join("|")),K=K.length&&new RegExp(K.join("|")),b=rb.test(H.compareDocumentPosition),M=b||rb.test(H.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b){for(;b=b.parentNode;){if(b===a){return !0}}}return !1},U=b?function(a,b){if(a===b){return E=!0,0}var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!x.sortDetached&&b.compareDocumentPosition(a)===d?a===c||a.ownerDocument===O&&M(O,a)?-1:b===c||b.ownerDocument===O&&M(O,b)?1:D?bb.call(D,a)-bb.call(D,b):0:4&d?-1:1)}:function(a,b){if(a===b){return E=!0,0}var d,e=0,f=a.parentNode,h=b.parentNode,i=[a],j=[b];if(!f||!h){return a===c?-1:b===c?1:f?-1:h?1:D?bb.call(D,a)-bb.call(D,b):0}if(f===h){return g(a,b)}for(d=a;d=d.parentNode;){i.unshift(d)}for(d=b;d=d.parentNode;){j.unshift(d)}for(;i[e]===j[e];){e++}return e?g(i[e],j[e]):i[e]===O?-1:j[e]===O?1:0},c):G},b.matches=function(a,c){return b(a,null,null,c)},b.matchesSelector=function(a,c){if((a.ownerDocument||a)!==G&&F(a),c=c.replace(lb,"='$1']"),!(!x.matchesSelector||!I||K&&K.test(c)||J&&J.test(c))){try{var d=L.call(a,c);if(d||x.disconnectedMatch||a.document&&11!==a.document.nodeType){return d}}catch(e){}}return b(c,G,null,[a]).length>0},b.contains=function(a,b){return(a.ownerDocument||a)!==G&&F(a),M(a,b)},b.attr=function(a,b){(a.ownerDocument||a)!==G&&F(a);var c=y.attrHandle[b.toLowerCase()],d=c&&X.call(y.attrHandle,b.toLowerCase())?c(a,b,!I):void 0;return void 0!==d?d:x.attributes||!I?a.getAttribute(b):(d=a.getAttributeNode(b))&&d.specified?d.value:null},b.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},b.uniqueSort=function(a){var b,c=[],d=0,e=0;if(E=!x.detectDuplicates,D=!x.sortStable&&a.slice(0),a.sort(U),E){for(;b=a[e++];){b===a[e]&&(d=c.push(e))}for(;d--;){a.splice(c[d],1)}}return D=null,a},z=b.getText=function(a){var b,c="",d=0,e=a.nodeType;if(e){if(1===e||9===e||11===e){if("string"==typeof a.textContent){return a.textContent}for(a=a.firstChild;a;a=a.nextSibling){c+=z(a)}}else{if(3===e||4===e){return a.nodeValue}}}else{for(;b=a[d++];){c+=z(b)}}return c},y=b.selectors={cacheLength:50,createPseudo:d,match:ob,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(vb,wb),a[3]=(a[4]||a[5]||"").replace(vb,wb),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||b.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&b.error(a[0]),a},PSEUDO:function(a){var b,c=!a[5]&&a[2];return ob.CHILD.test(a[0])?null:(a[3]&&void 0!==a[4]?a[2]=a[4]:c&&mb.test(c)&&(b=m(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(vb,wb).toLowerCase();return"*"===a?function(){return !0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=R[a+" "];return b||(b=new RegExp("(^|"+db+")"+a+"("+db+"|$)"))&&R(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==V&&a.getAttribute("class")||"")})},ATTR:function(a,c,d){return function(e){var f=b.attr(e,a);return null==f?"!="===c:c?(f+="","="===c?f===d:"!="===c?f!==d:"^="===c?d&&0===f.indexOf(d):"*="===c?d&&f.indexOf(d)>-1:"$="===c?d&&f.slice(-d.length)===d:"~="===c?(" "+f+" ").indexOf(d)>-1:"|="===c?f===d||f.slice(0,d.length+1)===d+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return !!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){for(;p;){for(l=b;l=l[p];){if(h?l.nodeName.toLowerCase()===r:1===l.nodeType){return !1}}o=p="only"===a&&!o&&"nextSibling"}return !0}if(o=[g?q.firstChild:q.lastChild],g&&s){for(k=q[N]||(q[N]={}),j=k[a]||[],n=j[0]===P&&j[1],m=j[0]===P&&j[2],l=n&&q.childNodes[n];l=++n&&l&&l[p]||(m=n=0)||o.pop();){if(1===l.nodeType&&++m&&l===b){k[a]=[P,n,m];break}}}else{if(s&&(j=(b[N]||(b[N]={}))[a])&&j[0]===P){m=j[1]}else{for(;(l=++n&&l&&l[p]||(m=n=0)||o.pop())&&((h?l.nodeName.toLowerCase()!==r:1!==l.nodeType)||!++m||(s&&((l[N]||(l[N]={}))[a]=[P,m]),l!==b));){}}}return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,c){var e,f=y.pseudos[a]||y.setFilters[a.toLowerCase()]||b.error("unsupported pseudo: "+a);return f[N]?f(c):f.length>1?(e=[a,a,"",c],y.setFilters.hasOwnProperty(a.toLowerCase())?d(function(a,b){for(var d,e=f(a,c),g=e.length;g--;){d=bb.call(a,e[g]),a[d]=!(b[d]=e[g])}}):function(a){return f(a,0,e)}):f}},pseudos:{not:d(function(a){var b=[],c=[],e=B(a.replace(ib,"$1"));return e[N]?d(function(a,b,c,d){for(var f,g=e(a,null,d,[]),h=a.length;h--;){(f=g[h])&&(a[h]=!(b[h]=f))}}):function(a,d,f){return b[0]=a,e(b,null,f,c),!c.pop()}}),has:d(function(a){return function(c){return b(a,c).length>0}}),contains:d(function(a){return function(b){return(b.textContent||b.innerText||z(b)).indexOf(a)>-1}}),lang:d(function(a){return nb.test(a||"")||b.error("unsupported lang: "+a),a=a.replace(vb,wb).toLowerCase(),function(b){var c;do{if(c=I?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang")){return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-")}}while((b=b.parentNode)&&1===b.nodeType);return !1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===H},focus:function(a){return a===G.activeElement&&(!G.hasFocus||G.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling){if(a.nodeType<6){return !1}}return !0},parent:function(a){return !y.pseudos.empty(a)},header:function(a){return qb.test(a.nodeName)},input:function(a){return pb.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:j(function(){return[0]}),last:j(function(a,b){return[b-1]}),eq:j(function(a,b,c){return[0>c?c+b:c]}),even:j(function(a,b){for(var c=0;b>c;c+=2){a.push(c)}return a}),odd:j(function(a,b){for(var c=1;b>c;c+=2){a.push(c)}return a}),lt:j(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;){a.push(d)}return a}),gt:j(function(a,b,c){for(var d=0>c?c+b:c;++d<b;){a.push(d)}return a})}},y.pseudos.nth=y.pseudos.eq;for(w in {radio:!0,checkbox:!0,file:!0,password:!0,image:!0}){y.pseudos[w]=h(w)}for(w in {submit:!0,reset:!0}){y.pseudos[w]=i(w)}return l.prototype=y.filters=y.pseudos,y.setFilters=new l,B=b.compile=function(a,b){var c,d=[],e=[],f=T[a+" "];if(!f){for(b||(b=m(a)),c=b.length;c--;){f=s(b[c]),f[N]?d.push(f):e.push(f)}f=T(a,t(e,d))}return f},x.sortStable=N.split("").sort(U).join("")===N,x.detectDuplicates=!!E,F(),x.sortDetached=e(function(a){return 1&a.compareDocumentPosition(G.createElement("div"))}),e(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||f("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),x.attributes&&e(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||f("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),e(function(a){return null==a.getAttribute("disabled")})||f(cb,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),b}(a);ab.find=eb,ab.expr=eb.selectors,ab.expr[":"]=ab.expr.pseudos,ab.unique=eb.uniqueSort,ab.text=eb.getText,ab.isXMLDoc=eb.isXML,ab.contains=eb.contains;var fb=ab.expr.match.needsContext,gb=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,hb=/^.[^:#\[\.,]*$/;ab.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?ab.find.matchesSelector(d,a)?[d]:[]:ab.find.matches(a,ab.grep(b,function(a){return 1===a.nodeType}))},ab.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a){return this.pushStack(ab(a).filter(function(){for(b=0;c>b;b++){if(ab.contains(e[b],this)){return !0}}}))}for(b=0;c>b;b++){ab.find(a,e[b],d)}return d=this.pushStack(c>1?ab.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(d(this,a||[],!1))},not:function(a){return this.pushStack(d(this,a||[],!0))},is:function(a){return !!d(this,"string"==typeof a&&fb.test(a)?ab(a):a||[],!1).length}});var ib,jb=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,kb=ab.fn.init=function(a,b){var c,d;if(!a){return this}if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:jb.exec(a),!c||!c[1]&&b){return !b||b.jquery?(b||ib).find(a):this.constructor(b).find(a)}if(c[1]){if(b=b instanceof ab?b[0]:b,ab.merge(this,ab.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:$,!0)),gb.test(c[1])&&ab.isPlainObject(b)){for(c in b){ab.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c])}}return this}return d=$.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=$,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):ab.isFunction(a)?"undefined"!=typeof ib.ready?ib.ready(a):a(ab):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),ab.makeArray(a,this))};kb.prototype=ab.fn,ib=ab($);var lb=/^(?:parents|prev(?:Until|All))/,mb={children:!0,contents:!0,next:!0,prev:!0};ab.extend({dir:function(a,b,c){for(var d=[],e=void 0!==c;(a=a[b])&&9!==a.nodeType;){if(1===a.nodeType){if(e&&ab(a).is(c)){break}d.push(a)}}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling){1===a.nodeType&&a!==b&&c.push(a)}return c}}),ab.fn.extend({has:function(a){var b=ab(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++){if(ab.contains(this,b[a])){return !0}}})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=fb.test(a)||"string"!=typeof a?ab(a,b||this.context):0;e>d;d++){for(c=this[d];c&&c!==b;c=c.parentNode){if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&ab.find.matchesSelector(c,a))){f.push(c);break}}}return this.pushStack(f.length>1?ab.unique(f):f)},index:function(a){return a?"string"==typeof a?U.call(ab(a),this[0]):U.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(ab.unique(ab.merge(this.get(),ab(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}}),ab.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return ab.dir(a,"parentNode")},parentsUntil:function(a,b,c){return ab.dir(a,"parentNode",c)},next:function(a){return e(a,"nextSibling")},prev:function(a){return e(a,"previousSibling")},nextAll:function(a){return ab.dir(a,"nextSibling")},prevAll:function(a){return ab.dir(a,"previousSibling")},nextUntil:function(a,b,c){return ab.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return ab.dir(a,"previousSibling",c)},siblings:function(a){return ab.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return ab.sibling(a.firstChild)},contents:function(a){return a.contentDocument||ab.merge([],a.childNodes)}},function(a,b){ab.fn[a]=function(c,d){var e=ab.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=ab.filter(d,e)),this.length>1&&(mb[a]||ab.unique(e),lb.test(a)&&e.reverse()),this.pushStack(e)}});var nb=/\S+/g,ob={};ab.Callbacks=function(a){a="string"==typeof a?ob[a]||f(a):ab.extend({},a);var b,c,d,e,g,h,i=[],j=!a.once&&[],k=function(f){for(b=a.memory&&f,c=!0,h=e||0,e=0,g=i.length,d=!0;i&&g>h;h++){if(i[h].apply(f[0],f[1])===!1&&a.stopOnFalse){b=!1;break}}d=!1,i&&(j?j.length&&k(j.shift()):b?i=[]:l.disable())},l={add:function(){if(i){var c=i.length;!function f(b){ab.each(b,function(b,c){var d=ab.type(c);"function"===d?a.unique&&l.has(c)||i.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),d?g=i.length:b&&(e=c,k(b))}return this},remove:function(){return i&&ab.each(arguments,function(a,b){for(var c;(c=ab.inArray(b,i,c))>-1;){i.splice(c,1),d&&(g>=c&&g--,h>=c&&h--)}}),this},has:function(a){return a?ab.inArray(a,i)>-1:!(!i||!i.length)},empty:function(){return i=[],g=0,this},disable:function(){return i=j=b=void 0,this},disabled:function(){return !i},lock:function(){return j=void 0,b||l.disable(),this},locked:function(){return !j},fireWith:function(a,b){return !i||c&&!j||(b=b||[],b=[a,b.slice?b.slice():b],d?j.push(b):k(b)),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return !!c}};return l},ab.extend({Deferred:function(a){var b=[["resolve","done",ab.Callbacks("once memory"),"resolved"],["reject","fail",ab.Callbacks("once memory"),"rejected"],["notify","progress",ab.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return ab.Deferred(function(c){ab.each(b,function(b,f){var g=ab.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&ab.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?ab.extend(a,d):d}},e={};return d.pipe=d.then,ab.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b,c,d,e=0,f=R.call(arguments),g=f.length,h=1!==g||a&&ab.isFunction(a.promise)?g:0,i=1===h?a:ab.Deferred(),j=function(a,c,d){return function(e){c[a]=this,d[a]=arguments.length>1?R.call(arguments):e,d===b?i.notifyWith(c,d):--h||i.resolveWith(c,d)}};if(g>1){for(b=new Array(g),c=new Array(g),d=new Array(g);g>e;e++){f[e]&&ab.isFunction(f[e].promise)?f[e].promise().done(j(e,d,f)).fail(i.reject).progress(j(e,c,b)):--h}}return h||i.resolveWith(d,f),i.promise()}});var pb;ab.fn.ready=function(a){return ab.ready.promise().done(a),this},ab.extend({isReady:!1,readyWait:1,holdReady:function(a){a?ab.readyWait++:ab.ready(!0)},ready:function(a){(a===!0?--ab.readyWait:ab.isReady)||(ab.isReady=!0,a!==!0&&--ab.readyWait>0||(pb.resolveWith($,[ab]),ab.fn.trigger&&ab($).trigger("ready").off("ready")))}}),ab.ready.promise=function(b){return pb||(pb=ab.Deferred(),"complete"===$.readyState?setTimeout(ab.ready):($.addEventListener("DOMContentLoaded",g,!1),a.addEventListener("load",g,!1))),pb.promise(b)},ab.ready.promise();var qb=ab.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===ab.type(c)){e=!0;for(h in c){ab.access(a,b,h,c[h],!0,f,g)}}else{if(void 0!==d&&(e=!0,ab.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(ab(a),c)})),b)){for(;i>h;h++){b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)))}}}return e?a:j?b.call(a):i?b(a[0],c):f};ab.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType},h.uid=1,h.accepts=ab.acceptData,h.prototype={key:function(a){if(!h.accepts(a)){return 0}var b={},c=a[this.expando];if(!c){c=h.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,ab.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b){f[b]=c}else{if(ab.isEmptyObject(f)){ab.extend(this.cache[e],b)}else{for(d in b){f[d]=b[d]}}}return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,ab.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b){this.cache[f]={}}else{ab.isArray(b)?d=b.concat(b.map(ab.camelCase)):(e=ab.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(nb)||[])),c=d.length;for(;c--;){delete g[d[c]]}}},hasData:function(a){return !ab.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var rb=new h,sb=new h,tb=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,ub=/([A-Z])/g;ab.extend({hasData:function(a){return sb.hasData(a)||rb.hasData(a)},data:function(a,b,c){return sb.access(a,b,c)},removeData:function(a,b){sb.remove(a,b)},_data:function(a,b,c){return rb.access(a,b,c)},_removeData:function(a,b){rb.remove(a,b)}}),ab.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=sb.get(f),1===f.nodeType&&!rb.get(f,"hasDataAttrs"))){for(c=g.length;c--;){d=g[c].name,0===d.indexOf("data-")&&(d=ab.camelCase(d.slice(5)),i(f,d,e[d]))}rb.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){sb.set(this,a)}):qb(this,function(b){var c,d=ab.camelCase(a);if(f&&void 0===b){if(c=sb.get(f,a),void 0!==c){return c}if(c=sb.get(f,d),void 0!==c){return c}if(c=i(f,d,void 0),void 0!==c){return c}}else{this.each(function(){var c=sb.get(this,d);sb.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&sb.set(this,a,b)})}},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){sb.remove(this,a)})}}),ab.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=rb.get(a,b),c&&(!d||ab.isArray(c)?d=rb.access(a,b,ab.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=ab.queue(a,b),d=c.length,e=c.shift(),f=ab._queueHooks(a,b),g=function(){ab.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return rb.get(a,c)||rb.access(a,c,{empty:ab.Callbacks("once memory").add(function(){rb.remove(a,[b+"queue",c])})})}}),ab.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?ab.queue(this[0],a):void 0===b?this:this.each(function(){var c=ab.queue(this,a,b);ab._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&ab.dequeue(this,a)})},dequeue:function(a){return this.each(function(){ab.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=ab.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};for("string"!=typeof a&&(b=a,a=void 0),a=a||"fx";g--;){c=rb.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h))}return h(),e.promise(b)}});var vb=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,wb=["Top","Right","Bottom","Left"],xb=function(a,b){return a=b||a,"none"===ab.css(a,"display")||!ab.contains(a.ownerDocument,a)},yb=/^(?:checkbox|radio)$/i;!function(){var a=$.createDocumentFragment(),b=a.appendChild($.createElement("div"));b.innerHTML="<input type='radio' checked='checked' name='t'/>",Z.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",Z.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var zb="undefined";Z.focusinBubbles="onfocusin" in a;var Ab=/^key/,Bb=/^(?:mouse|contextmenu)|click/,Cb=/^(?:focusinfocus|focusoutblur)$/,Db=/^([^.]*)(?:\.(.+)|)$/;ab.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=rb.get(a);if(q){for(c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=ab.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return typeof ab!==zb&&ab.event.triggered!==b.type?ab.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(nb)||[""],j=b.length;j--;){h=Db.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=ab.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=ab.event.special[n]||{},k=ab.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&ab.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),ab.event.global[n]=!0)}}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=rb.hasData(a)&&rb.get(a);if(q&&(i=q.events)){for(b=(b||"").match(nb)||[""],j=b.length;j--;){if(h=Db.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){for(l=ab.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;f--;){k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k))}g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||ab.removeEvent(a,n,q.handle),delete i[n])}else{for(n in i){ab.event.remove(a,n+b[j],c,d,!0)}}}ab.isEmptyObject(i)&&(delete q.handle,rb.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,j,k,l,m=[d||$],n=X.call(b,"type")?b.type:b,o=X.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||$,3!==d.nodeType&&8!==d.nodeType&&!Cb.test(n+ab.event.triggered)&&(n.indexOf(".")>=0&&(o=n.split("."),n=o.shift(),o.sort()),j=n.indexOf(":")<0&&"on"+n,b=b[ab.expando]?b:new ab.Event(n,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=o.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:ab.makeArray(c,[b]),l=ab.event.special[n]||{},e||!l.trigger||l.trigger.apply(d,c)!==!1)){if(!e&&!l.noBubble&&!ab.isWindow(d)){for(i=l.delegateType||n,Cb.test(i+n)||(g=g.parentNode);g;g=g.parentNode){m.push(g),h=g}h===(d.ownerDocument||$)&&m.push(h.defaultView||h.parentWindow||a)}for(f=0;(g=m[f++])&&!b.isPropagationStopped();){b.type=f>1?i:l.bindType||n,k=(rb.get(g,"events")||{})[b.type]&&rb.get(g,"handle"),k&&k.apply(g,c),k=j&&g[j],k&&k.apply&&ab.acceptData(g)&&(b.result=k.apply(g,c),b.result===!1&&b.preventDefault())}return b.type=n,e||b.isDefaultPrevented()||l._default&&l._default.apply(m.pop(),c)!==!1||!ab.acceptData(d)||j&&ab.isFunction(d[n])&&!ab.isWindow(d)&&(h=d[j],h&&(d[j]=null),ab.event.triggered=n,d[n](),ab.event.triggered=void 0,h&&(d[j]=h)),b.result}},dispatch:function(a){a=ab.event.fix(a);var b,c,d,e,f,g=[],h=R.call(arguments),i=(rb.get(this,"events")||{})[a.type]||[],j=ab.event.special[a.type]||{};if(h[0]=a,a.delegateTarget=this,!j.preDispatch||j.preDispatch.call(this,a)!==!1){for(g=ab.event.handlers.call(this,a,i),b=0;(e=g[b++])&&!a.isPropagationStopped();){for(a.currentTarget=e.elem,c=0;(f=e.handlers[c++])&&!a.isImmediatePropagationStopped();){(!a.namespace_re||a.namespace_re.test(f.namespace))&&(a.handleObj=f,a.data=f.data,d=((ab.event.special[f.origType]||{}).handle||f.handler).apply(e.elem,h),void 0!==d&&(a.result=d)===!1&&(a.preventDefault(),a.stopPropagation()))}}return j.postDispatch&&j.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type)){for(;i!==this;i=i.parentNode||this){if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++){f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?ab(e,this).index(i)>=0:ab.find(e,this,null,[i]).length),d[e]&&d.push(f)}d.length&&g.push({elem:i,handlers:d})}}}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button;return null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||$,d=c.documentElement,e=c.body,a.pageX=b.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0),a.pageY=b.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},fix:function(a){if(a[ab.expando]){return a}var b,c,d,e=a.type,f=a,g=this.fixHooks[e];for(g||(this.fixHooks[e]=g=Bb.test(e)?this.mouseHooks:Ab.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new ab.Event(f),b=d.length;b--;){c=d[b],a[c]=f[c]}return a.target||(a.target=$),3===a.target.nodeType&&(a.target=a.target.parentNode),g.filter?g.filter(a,f):a},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==l()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===l()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&ab.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(a){return ab.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=ab.extend(new ab.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?ab.event.trigger(e,null,b):ab.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},ab.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)},ab.Event=function(a,b){return this instanceof ab.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.getPreventDefault&&a.getPreventDefault()?j:k):this.type=a,b&&ab.extend(this,b),this.timeStamp=a&&a.timeStamp||ab.now(),void (this[ab.expando]=!0)):new ab.Event(a,b)},ab.Event.prototype={isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=j,a&&a.preventDefault&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=j,a&&a.stopPropagation&&a.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=j,this.stopPropagation()}},ab.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){ab.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!ab.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),Z.focusinBubbles||ab.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){ab.event.simulate(b,a.target,ab.event.fix(a),!0)};ab.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=rb.access(d,b);e||d.addEventListener(a,c,!0),rb.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=rb.access(d,b)-1;e?rb.access(d,b,e):(d.removeEventListener(a,c,!0),rb.remove(d,b))}}}),ab.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(g in a){this.on(g,b,c,a[g],e)}return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1){d=k}else{if(!d){return this}}return 1===e&&(f=d,d=function(a){return ab().off(a),f.apply(this,arguments)},d.guid=f.guid||(f.guid=ab.guid++)),this.each(function(){ab.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj){return d=a.handleObj,ab(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this}if("object"==typeof a){for(e in a){this.off(e,b,a[e])}return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=k),this.each(function(){ab.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){ab.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?ab.event.trigger(a,b,c,!0):void 0}});var Eb=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Fb=/<([\w:]+)/,Gb=/<|&#?\w+;/,Hb=/<(?:script|style|link)/i,Ib=/checked\s*(?:[^=]|=\s*.checked.)/i,Jb=/^$|\/(?:java|ecma)script/i,Kb=/^true\/(.*)/,Lb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,Mb={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};Mb.optgroup=Mb.option,Mb.tbody=Mb.tfoot=Mb.colgroup=Mb.caption=Mb.thead,Mb.th=Mb.td,ab.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=ab.contains(a.ownerDocument,a);if(!(Z.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||ab.isXMLDoc(a))){for(g=r(h),f=r(a),d=0,e=f.length;e>d;d++){s(f[d],g[d])}}if(b){if(c){for(f=f||r(a),g=g||r(h),d=0,e=f.length;e>d;d++){q(f[d],g[d])}}else{q(a,h)}}return g=r(h,"script"),g.length>0&&p(g,!i&&r(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,n=a.length;n>m;m++){if(e=a[m],e||0===e){if("object"===ab.type(e)){ab.merge(l,e.nodeType?[e]:e)}else{if(Gb.test(e)){for(f=f||k.appendChild(b.createElement("div")),g=(Fb.exec(e)||["",""])[1].toLowerCase(),h=Mb[g]||Mb._default,f.innerHTML=h[1]+e.replace(Eb,"<$1></$2>")+h[2],j=h[0];j--;){f=f.lastChild}ab.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else{l.push(b.createTextNode(e))}}}}for(k.textContent="",m=0;e=l[m++];){if((!d||-1===ab.inArray(e,d))&&(i=ab.contains(e.ownerDocument,e),f=r(k.appendChild(e),"script"),i&&p(f),c)){for(j=0;e=f[j++];){Jb.test(e.type||"")&&c.push(e)}}}return k},cleanData:function(a){for(var b,c,d,e,f,g,h=ab.event.special,i=0;void 0!==(c=a[i]);i++){if(ab.acceptData(c)&&(f=c[rb.expando],f&&(b=rb.cache[f]))){if(d=Object.keys(b.events||{}),d.length){for(g=0;void 0!==(e=d[g]);g++){h[e]?ab.event.remove(c,e):ab.removeEvent(c,e,b.handle)}}rb.cache[f]&&delete rb.cache[f]}delete sb.cache[c[sb.expando]]}}}),ab.fn.extend({text:function(a){return qb(this,function(a){return void 0===a?ab.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=m(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=m(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?ab.filter(a,this):this,e=0;null!=(c=d[e]);e++){b||1!==c.nodeType||ab.cleanData(r(c)),c.parentNode&&(b&&ab.contains(c.ownerDocument,c)&&p(r(c,"script")),c.parentNode.removeChild(c))}return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&(ab.cleanData(r(a,!1)),a.textContent="")}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return ab.clone(this,a,b)})},html:function(a){return qb(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType){return b.innerHTML}if("string"==typeof a&&!Hb.test(a)&&!Mb[(Fb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Eb,"<$1></$2>");try{for(;d>c;c++){b=this[c]||{},1===b.nodeType&&(ab.cleanData(r(b,!1)),b.innerHTML=a)}b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,ab.cleanData(r(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=S.apply([],a);var c,d,e,f,g,h,i=0,j=this.length,k=this,l=j-1,m=a[0],p=ab.isFunction(m);if(p||j>1&&"string"==typeof m&&!Z.checkClone&&Ib.test(m)){return this.each(function(c){var d=k.eq(c);p&&(a[0]=m.call(this,c,d.html())),d.domManip(a,b)})}if(j&&(c=ab.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(e=ab.map(r(c,"script"),n),f=e.length;j>i;i++){g=c,i!==l&&(g=ab.clone(g,!0,!0),f&&ab.merge(e,r(g,"script"))),b.call(this[i],g,i)}if(f){for(h=e[e.length-1].ownerDocument,ab.map(e,o),i=0;f>i;i++){g=e[i],Jb.test(g.type||"")&&!rb.access(g,"globalEval")&&ab.contains(h,g)&&(g.src?ab._evalUrl&&ab._evalUrl(g.src):ab.globalEval(g.textContent.replace(Lb,"")))}}}return this}}),ab.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){ab.fn[a]=function(a){for(var c,d=[],e=ab(a),f=e.length-1,g=0;f>=g;g++){c=g===f?this:this.clone(!0),ab(e[g])[b](c),T.apply(d,c.get())}return this.pushStack(d)}});var Nb,Ob={},Pb=/^margin/,Qb=new RegExp("^("+vb+")(?!px)[a-z%]+$","i"),Rb=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)};!function(){function b(){h.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%",f.appendChild(g);var b=a.getComputedStyle(h,null);c="1%"!==b.top,d="4px"===b.width,f.removeChild(g)}var c,d,e="padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box",f=$.documentElement,g=$.createElement("div"),h=$.createElement("div");h.style.backgroundClip="content-box",h.cloneNode(!0).style.backgroundClip="",Z.clearCloneStyle="content-box"===h.style.backgroundClip,g.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",g.appendChild(h),a.getComputedStyle&&ab.extend(Z,{pixelPosition:function(){return b(),c},boxSizingReliable:function(){return null==d&&b(),d},reliableMarginRight:function(){var b,c=h.appendChild($.createElement("div"));return c.style.cssText=h.style.cssText=e,c.style.marginRight=c.style.width="0",h.style.width="1px",f.appendChild(g),b=!parseFloat(a.getComputedStyle(c,null).marginRight),f.removeChild(g),h.innerHTML="",b}})}(),ab.swap=function(a,b,c,d){var e,f,g={};for(f in b){g[f]=a.style[f],a.style[f]=b[f]}e=c.apply(a,d||[]);for(f in b){a.style[f]=g[f]}return e};var Sb=/^(none|table(?!-c[ea]).+)/,Tb=new RegExp("^("+vb+")(.*)$","i"),Ub=new RegExp("^([+-])=("+vb+")","i"),Vb={position:"absolute",visibility:"hidden",display:"block"},Wb={letterSpacing:0,fontWeight:400},Xb=["Webkit","O","Moz","ms"];ab.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=v(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=ab.camelCase(b),i=a.style;return b=ab.cssProps[h]||(ab.cssProps[h]=x(i,h)),g=ab.cssHooks[b]||ab.cssHooks[h],void 0===c?g&&"get" in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=Ub.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(ab.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||ab.cssNumber[h]||(c+="px"),Z.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set" in g&&void 0===(c=g.set(a,c,d))||(i[b]="",i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=ab.camelCase(b);return b=ab.cssProps[h]||(ab.cssProps[h]=x(a.style,h)),g=ab.cssHooks[b]||ab.cssHooks[h],g&&"get" in g&&(e=g.get(a,!0,c)),void 0===e&&(e=v(a,b,d)),"normal"===e&&b in Wb&&(e=Wb[b]),""===c||c?(f=parseFloat(e),c===!0||ab.isNumeric(f)?f||0:e):e}}),ab.each(["height","width"],function(a,b){ab.cssHooks[b]={get:function(a,c,d){return c?0===a.offsetWidth&&Sb.test(ab.css(a,"display"))?ab.swap(a,Vb,function(){return A(a,b,d)}):A(a,b,d):void 0},set:function(a,c,d){var e=d&&Rb(a);return y(a,c,d?z(a,b,d,"border-box"===ab.css(a,"boxSizing",!1,e),e):0)}}}),ab.cssHooks.marginRight=w(Z.reliableMarginRight,function(a,b){return b?ab.swap(a,{display:"inline-block"},v,[a,"marginRight"]):void 0}),ab.each({margin:"",padding:"",border:"Width"},function(a,b){ab.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++){e[a+wb[d]+b]=f[d]||f[d-2]||f[0]}return e}},Pb.test(a)||(ab.cssHooks[a+b].set=y)}),ab.fn.extend({css:function(a,b){return qb(this,function(a,b,c){var d,e,f={},g=0;if(ab.isArray(b)){for(d=Rb(a),e=b.length;e>g;g++){f[b[g]]=ab.css(a,b[g],!1,d)}return f}return void 0!==c?ab.style(a,b,c):ab.css(a,b)},a,b,arguments.length>1)},show:function(){return B(this,!0)},hide:function(){return B(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){xb(this)?ab(this).show():ab(this).hide()})}}),ab.Tween=C,C.prototype={constructor:C,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(ab.cssNumber[c]?"":"px")},cur:function(){var a=C.propHooks[this.prop];return a&&a.get?a.get(this):C.propHooks._default.get(this)},run:function(a){var b,c=C.propHooks[this.prop];return this.pos=b=this.options.duration?ab.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):C.propHooks._default.set(this),this}},C.prototype.init.prototype=C.prototype,C.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=ab.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){ab.fx.step[a.prop]?ab.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[ab.cssProps[a.prop]]||ab.cssHooks[a.prop])?ab.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},C.propHooks.scrollTop=C.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},ab.easing={linear:function(a){return a},swing:function(a){return 0.5-Math.cos(a*Math.PI)/2}},ab.fx=C.prototype.init,ab.fx.step={};var Yb,Zb,$b=/^(?:toggle|show|hide)$/,_b=new RegExp("^(?:([+-])=|)("+vb+")([a-z%]*)$","i"),ac=/queueHooks$/,bc=[G],cc={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=_b.exec(b),f=e&&e[3]||(ab.cssNumber[a]?"":"px"),g=(ab.cssNumber[a]||"px"!==f&&+d)&&_b.exec(ab.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do{h=h||".5",g/=h,ab.style(c.elem,a,g+f)}while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};ab.Animation=ab.extend(I,{tweener:function(a,b){ab.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++){c=a[d],cc[c]=cc[c]||[],cc[c].unshift(b)}},prefilter:function(a,b){b?bc.unshift(a):bc.push(a)}}),ab.speed=function(a,b,c){var d=a&&"object"==typeof a?ab.extend({},a):{complete:c||!c&&b||ab.isFunction(a)&&a,duration:a,easing:c&&b||b&&!ab.isFunction(b)&&b};return d.duration=ab.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in ab.fx.speeds?ab.fx.speeds[d.duration]:ab.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){ab.isFunction(d.old)&&d.old.call(this),d.queue&&ab.dequeue(this,d.queue)},d},ab.fn.extend({fadeTo:function(a,b,c,d){return this.filter(xb).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=ab.isEmptyObject(a),f=ab.speed(b,c,d),g=function(){var b=I(this,ab.extend({},a),f);(e||rb.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=ab.timers,g=rb.get(this);if(e){g[e]&&g[e].stop&&d(g[e])}else{for(e in g){g[e]&&g[e].stop&&ac.test(e)&&d(g[e])}}for(e=f.length;e--;){f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1))}(b||!c)&&ab.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=rb.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=ab.timers,g=d?d.length:0;for(c.finish=!0,ab.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;){f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1))}for(b=0;g>b;b++){d[b]&&d[b].finish&&d[b].finish.call(this)}delete c.finish})}}),ab.each(["toggle","show","hide"],function(a,b){var c=ab.fn[b];ab.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(E(b,!0),a,d,e)}}),ab.each({slideDown:E("show"),slideUp:E("hide"),slideToggle:E("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){ab.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),ab.timers=[],ab.fx.tick=function(){var a,b=0,c=ab.timers;for(Yb=ab.now();b<c.length;b++){a=c[b],a()||c[b]!==a||c.splice(b--,1)}c.length||ab.fx.stop(),Yb=void 0},ab.fx.timer=function(a){ab.timers.push(a),a()?ab.fx.start():ab.timers.pop()},ab.fx.interval=13,ab.fx.start=function(){Zb||(Zb=setInterval(ab.fx.tick,ab.fx.interval))},ab.fx.stop=function(){clearInterval(Zb),Zb=null},ab.fx.speeds={slow:600,fast:200,_default:400},ab.fn.delay=function(a,b){return a=ab.fx?ab.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a=$.createElement("input"),b=$.createElement("select"),c=b.appendChild($.createElement("option"));a.type="checkbox",Z.checkOn=""!==a.value,Z.optSelected=c.selected,b.disabled=!0,Z.optDisabled=!c.disabled,a=$.createElement("input"),a.value="t",a.type="radio",Z.radioValue="t"===a.value}();var dc,ec,fc=ab.expr.attrHandle;ab.fn.extend({attr:function(a,b){return qb(this,ab.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){ab.removeAttr(this,a)})}}),ab.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f){return typeof a.getAttribute===zb?ab.prop(a,b,c):(1===f&&ab.isXMLDoc(a)||(b=b.toLowerCase(),d=ab.attrHooks[b]||(ab.expr.match.bool.test(b)?ec:dc)),void 0===c?d&&"get" in d&&null!==(e=d.get(a,b))?e:(e=ab.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set" in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void ab.removeAttr(a,b))}},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(nb);if(f&&1===a.nodeType){for(;c=f[e++];){d=ab.propFix[c]||c,ab.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)}}},attrHooks:{type:{set:function(a,b){if(!Z.radioValue&&"radio"===b&&ab.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),ec={set:function(a,b,c){return b===!1?ab.removeAttr(a,c):a.setAttribute(c,c),c}},ab.each(ab.expr.match.bool.source.match(/\w+/g),function(a,b){var c=fc[b]||ab.find.attr;fc[b]=function(a,b,d){var e,f;return d||(f=fc[b],fc[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,fc[b]=f),e}});var gc=/^(?:input|select|textarea|button)$/i;ab.fn.extend({prop:function(a,b){return qb(this,ab.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[ab.propFix[a]||a]})}}),ab.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g){return f=1!==g||!ab.isXMLDoc(a),f&&(b=ab.propFix[b]||b,e=ab.propHooks[b]),void 0!==c?e&&"set" in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get" in e&&null!==(d=e.get(a,b))?d:a[b]}},propHooks:{tabIndex:{get:function(a){return a.hasAttribute("tabindex")||gc.test(a.nodeName)||a.href?a.tabIndex:-1}}}}),Z.optSelected||(ab.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),ab.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){ab.propFix[this.toLowerCase()]=this});var hc=/[\t\r\n\f]/g;ab.fn.extend({addClass:function(a){var b,c,d,e,f,g,h="string"==typeof a&&a,i=0,j=this.length;if(ab.isFunction(a)){return this.each(function(b){ab(this).addClass(a.call(this,b,this.className))})}if(h){for(b=(a||"").match(nb)||[];j>i;i++){if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(hc," "):" ")){for(f=0;e=b[f++];){d.indexOf(" "+e+" ")<0&&(d+=e+" ")}g=ab.trim(d),c.className!==g&&(c.className=g)}}}return this},removeClass:function(a){var b,c,d,e,f,g,h=0===arguments.length||"string"==typeof a&&a,i=0,j=this.length;if(ab.isFunction(a)){return this.each(function(b){ab(this).removeClass(a.call(this,b,this.className))})}if(h){for(b=(a||"").match(nb)||[];j>i;i++){if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(hc," "):"")){for(f=0;e=b[f++];){for(;d.indexOf(" "+e+" ")>=0;){d=d.replace(" "+e+" "," ")}}g=a?ab.trim(d):"",c.className!==g&&(c.className=g)}}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(ab.isFunction(a)?function(c){ab(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){for(var b,d=0,e=ab(this),f=a.match(nb)||[];b=f[d++];){e.hasClass(b)?e.removeClass(b):e.addClass(b)}}else{(c===zb||"boolean"===c)&&(this.className&&rb.set(this,"__className__",this.className),this.className=this.className||a===!1?"":rb.get(this,"__className__")||"")}})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++){if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(hc," ").indexOf(b)>=0){return !0}}return !1}});var ic=/\r/g;ab.fn.extend({val:function(a){var b,c,d,e=this[0];if(arguments.length){return d=ab.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,ab(this).val()):a,null==e?e="":"number"==typeof e?e+="":ab.isArray(e)&&(e=ab.map(e,function(a){return null==a?"":a+""})),b=ab.valHooks[this.type]||ab.valHooks[this.nodeName.toLowerCase()],b&&"set" in b&&void 0!==b.set(this,e,"value")||(this.value=e))})}if(e){return b=ab.valHooks[e.type]||ab.valHooks[e.nodeName.toLowerCase()],b&&"get" in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(ic,""):null==c?"":c)}}}),ab.extend({valHooks:{select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++){if(c=d[i],!(!c.selected&&i!==e||(Z.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&ab.nodeName(c.parentNode,"optgroup"))){if(b=ab(c).val(),f){return b}g.push(b)}}return g},set:function(a,b){for(var c,d,e=a.options,f=ab.makeArray(b),g=e.length;g--;){d=e[g],(d.selected=ab.inArray(ab(d).val(),f)>=0)&&(c=!0)}return c||(a.selectedIndex=-1),f}}}}),ab.each(["radio","checkbox"],function(){ab.valHooks[this]={set:function(a,b){return ab.isArray(b)?a.checked=ab.inArray(ab(a).val(),b)>=0:void 0}},Z.checkOn||(ab.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})}),ab.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){ab.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),ab.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var jc=ab.now(),kc=/\?/;ab.parseJSON=function(a){return JSON.parse(a+"")},ab.parseXML=function(a){var b,c;if(!a||"string"!=typeof a){return null}try{c=new DOMParser,b=c.parseFromString(a,"text/xml")}catch(d){b=void 0}return(!b||b.getElementsByTagName("parsererror").length)&&ab.error("Invalid XML: "+a),b};var lc,mc,nc=/#.*$/,oc=/([?&])_=[^&]*/,pc=/^(.*?):[ \t]*([^\r\n]*)$/gm,qc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,rc=/^(?:GET|HEAD)$/,sc=/^\/\//,tc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,uc={},vc={},wc="*/".concat("*");try{mc=location.href}catch(xc){mc=$.createElement("a"),mc.href="",mc=mc.href}lc=tc.exec(mc.toLowerCase())||[],ab.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:mc,type:"GET",isLocal:qc.test(lc[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":wc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":ab.parseJSON,"text xml":ab.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?L(L(a,ab.ajaxSettings),b):L(ab.ajaxSettings,a)},ajaxPrefilter:J(uc),ajaxTransport:J(vc),ajax:function(a,b){function c(a,b,c,g){var i,k,r,s,u,w=b;2!==t&&(t=2,h&&clearTimeout(h),d=void 0,f=g||"",v.readyState=a>0?4:0,i=a>=200&&300>a||304===a,c&&(s=M(l,v,c)),s=N(l,s,v,i),i?(l.ifModified&&(u=v.getResponseHeader("Last-Modified"),u&&(ab.lastModified[e]=u),u=v.getResponseHeader("etag"),u&&(ab.etag[e]=u)),204===a||"HEAD"===l.type?w="nocontent":304===a?w="notmodified":(w=s.state,k=s.data,r=s.error,i=!r)):(r=w,(a||!w)&&(w="error",0>a&&(a=0))),v.status=a,v.statusText=(b||w)+"",i?o.resolveWith(m,[k,w,v]):o.rejectWith(m,[v,w,r]),v.statusCode(q),q=void 0,j&&n.trigger(i?"ajaxSuccess":"ajaxError",[v,l,i?k:r]),p.fireWith(m,[v,w]),j&&(n.trigger("ajaxComplete",[v,l]),--ab.active||ab.event.trigger("ajaxStop")))}"object"==typeof a&&(b=a,a=void 0),b=b||{};var d,e,f,g,h,i,j,k,l=ab.ajaxSetup({},b),m=l.context||l,n=l.context&&(m.nodeType||m.jquery)?ab(m):ab.event,o=ab.Deferred(),p=ab.Callbacks("once memory"),q=l.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!g){for(g={};b=pc.exec(f);){g[b[1].toLowerCase()]=b[2]}}b=g[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(l.mimeType=a),this},statusCode:function(a){var b;if(a){if(2>t){for(b in a){q[b]=[q[b],a[b]]}}else{v.always(a[v.status])}}return this},abort:function(a){var b=a||u;return d&&d.abort(b),c(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,l.url=((a||l.url||mc)+"").replace(nc,"").replace(sc,lc[1]+"//"),l.type=b.method||b.type||l.method||l.type,l.dataTypes=ab.trim(l.dataType||"*").toLowerCase().match(nb)||[""],null==l.crossDomain&&(i=tc.exec(l.url.toLowerCase()),l.crossDomain=!(!i||i[1]===lc[1]&&i[2]===lc[2]&&(i[3]||("http:"===i[1]?"80":"443"))===(lc[3]||("http:"===lc[1]?"80":"443")))),l.data&&l.processData&&"string"!=typeof l.data&&(l.data=ab.param(l.data,l.traditional)),K(uc,l,b,v),2===t){return v}j=l.global,j&&0===ab.active++&&ab.event.trigger("ajaxStart"),l.type=l.type.toUpperCase(),l.hasContent=!rc.test(l.type),e=l.url,l.hasContent||(l.data&&(e=l.url+=(kc.test(e)?"&":"?")+l.data,delete l.data),l.cache===!1&&(l.url=oc.test(e)?e.replace(oc,"$1_="+jc++):e+(kc.test(e)?"&":"?")+"_="+jc++)),l.ifModified&&(ab.lastModified[e]&&v.setRequestHeader("If-Modified-Since",ab.lastModified[e]),ab.etag[e]&&v.setRequestHeader("If-None-Match",ab.etag[e])),(l.data&&l.hasContent&&l.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",l.contentType),v.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+("*"!==l.dataTypes[0]?", "+wc+"; q=0.01":""):l.accepts["*"]);for(k in l.headers){v.setRequestHeader(k,l.headers[k])}if(l.beforeSend&&(l.beforeSend.call(m,v,l)===!1||2===t)){return v.abort()}u="abort";for(k in {success:1,error:1,complete:1}){v[k](l[k])}if(d=K(vc,l,b,v)){v.readyState=1,j&&n.trigger("ajaxSend",[v,l]),l.async&&l.timeout>0&&(h=setTimeout(function(){v.abort("timeout")},l.timeout));try{t=1,d.send(r,c)}catch(w){if(!(2>t)){throw w}c(-1,w)}}else{c(-1,"No Transport")}return v},getJSON:function(a,b,c){return ab.get(a,b,c,"json")},getScript:function(a,b){return ab.get(a,void 0,b,"script")}}),ab.each(["get","post"],function(a,b){ab[b]=function(a,c,d,e){return ab.isFunction(c)&&(e=e||d,d=c,c=void 0),ab.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),ab.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){ab.fn[b]=function(a){return this.on(b,a)}}),ab._evalUrl=function(a){return ab.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},ab.fn.extend({wrapAll:function(a){var b;return ab.isFunction(a)?this.each(function(b){ab(this).wrapAll(a.call(this,b))}):(this[0]&&(b=ab(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){for(var a=this;a.firstElementChild;){a=a.firstElementChild}return a}).append(this)),this)},wrapInner:function(a){return this.each(ab.isFunction(a)?function(b){ab(this).wrapInner(a.call(this,b))}:function(){var b=ab(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=ab.isFunction(a);return this.each(function(c){ab(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){ab.nodeName(this,"body")||ab(this).replaceWith(this.childNodes)}).end()}}),ab.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0},ab.expr.filters.visible=function(a){return !ab.expr.filters.hidden(a)};var yc=/%20/g,zc=/\[\]$/,Ac=/\r?\n/g,Bc=/^(?:submit|button|image|reset|file)$/i,Cc=/^(?:input|select|textarea|keygen)/i;ab.param=function(a,b){var c,d=[],e=function(a,b){b=ab.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=ab.ajaxSettings&&ab.ajaxSettings.traditional),ab.isArray(a)||a.jquery&&!ab.isPlainObject(a)){ab.each(a,function(){e(this.name,this.value)})}else{for(c in a){O(c,a[c],b,e)}}return d.join("&").replace(yc,"+")},ab.fn.extend({serialize:function(){return ab.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=ab.prop(this,"elements");return a?ab.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!ab(this).is(":disabled")&&Cc.test(this.nodeName)&&!Bc.test(a)&&(this.checked||!yb.test(a))}).map(function(a,b){var c=ab(this).val();return null==c?null:ab.isArray(c)?ab.map(c,function(a){return{name:b.name,value:a.replace(Ac,"\r\n")}}):{name:b.name,value:c.replace(Ac,"\r\n")}}).get()}}),ab.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(a){}};var Dc=0,Ec={},Fc={0:200,1223:204},Gc=ab.ajaxSettings.xhr();a.ActiveXObject&&ab(a).on("unload",function(){for(var a in Ec){Ec[a]()}}),Z.cors=!!Gc&&"withCredentials" in Gc,Z.ajax=Gc=!!Gc,ab.ajaxTransport(function(a){var b;return Z.cors||Gc&&!a.crossDomain?{send:function(c,d){var e,f=a.xhr(),g=++Dc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields){for(e in a.xhrFields){f[e]=a.xhrFields[e]}}a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c){f.setRequestHeader(e,c[e])}b=function(a){return function(){b&&(delete Ec[g],b=f.onload=f.onerror=null,"abort"===a?f.abort():"error"===a?d(f.status,f.statusText):d(Fc[f.status]||f.status,f.statusText,"string"==typeof f.responseText?{text:f.responseText}:void 0,f.getAllResponseHeaders()))}},f.onload=b(),f.onerror=b("error"),b=Ec[g]=b("abort"),f.send(a.hasContent&&a.data||null)},abort:function(){b&&b()}}:void 0}),ab.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return ab.globalEval(a),a}}}),ab.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),ab.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(d,e){b=ab("<script>").prop({async:!0,charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&e("error"===a.type?404:200,a.type)}),$.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Hc=[],Ic=/(=)\?(?=&|$)|\?\?/;ab.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Hc.pop()||ab.expando+"_"+jc++;return this[a]=!0,a}}),ab.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Ic.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ic.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=ab.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Ic,"$1"+e):b.jsonp!==!1&&(b.url+=(kc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||ab.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Hc.push(e)),g&&ab.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),ab.parseHTML=function(a,b,c){if(!a||"string"!=typeof a){return null}"boolean"==typeof b&&(c=b,b=!1),b=b||$;var d=gb.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=ab.buildFragment([a],b,e),e&&e.length&&ab(e).remove(),ab.merge([],d.childNodes))};var Jc=ab.fn.load;ab.fn.load=function(a,b,c){if("string"!=typeof a&&Jc){return Jc.apply(this,arguments)}var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=a.slice(h),a=a.slice(0,h)),ab.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&ab.ajax({url:a,type:e,dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?ab("<div>").append(ab.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,f||[a.responseText,b,a])}),this},ab.expr.filters.animated=function(a){return ab.grep(ab.timers,function(b){return a===b.elem}).length};var Kc=a.document.documentElement;ab.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=ab.css(a,"position"),l=ab(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=ab.css(a,"top"),i=ab.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),ab.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using" in b?b.using.call(a,m):l.css(m)}},ab.fn.extend({offset:function(a){if(arguments.length){return void 0===a?this:this.each(function(b){ab.offset.setOffset(this,a,b)})}var b,c,d=this[0],e={top:0,left:0},f=d&&d.ownerDocument;if(f){return b=f.documentElement,ab.contains(b,d)?(typeof d.getBoundingClientRect!==zb&&(e=d.getBoundingClientRect()),c=P(f),{top:e.top+c.pageYOffset-b.clientTop,left:e.left+c.pageXOffset-b.clientLeft}):e}},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===ab.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),ab.nodeName(a[0],"html")||(d=a.offset()),d.top+=ab.css(a[0],"borderTopWidth",!0),d.left+=ab.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-ab.css(c,"marginTop",!0),left:b.left-d.left-ab.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||Kc;a&&!ab.nodeName(a,"html")&&"static"===ab.css(a,"position");){a=a.offsetParent}return a||Kc})}}),ab.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(b,c){var d="pageYOffset"===c;ab.fn[b]=function(e){return qb(this,function(b,e,f){var g=P(b);return void 0===f?g?g[c]:b[e]:void (g?g.scrollTo(d?a.pageXOffset:f,d?f:a.pageYOffset):b[e]=f)},b,e,arguments.length,null)}}),ab.each(["top","left"],function(a,b){ab.cssHooks[b]=w(Z.pixelPosition,function(a,c){return c?(c=v(a,b),Qb.test(c)?ab(a).position()[b]+"px":c):void 0})}),ab.each({Height:"height",Width:"width"},function(a,b){ab.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){ab.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return qb(this,function(b,c,d){var e;return ab.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?ab.css(b,c,g):ab.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),ab.fn.size=function(){return this.length},ab.fn.andSelf=ab.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return ab});var Lc=a.jQuery,Mc=a.$;return ab.noConflict=function(b){return a.$===ab&&(a.$=Mc),b&&a.jQuery===ab&&(a.jQuery=Lc),ab},typeof b===zb&&(a.jQuery=a.$=ab),ab}),function(v){var u,t,s="0.4.2",r="hasOwnProperty",q=/[\.\/]/,p="*",o=function(){},n=function(d,c){return d-c},m={n:{}},l=function(E,D){E=String(E);var C,B=t,A=Array.prototype.slice.call(arguments,2),z=l.listeners(E),y=0,x=[],w={},k=[],i=u;u=E,t=0;for(var c=0,b=z.length;b>c;c++){"zIndex" in z[c]&&(x.push(z[c].zIndex),z[c].zIndex<0&&(w[z[c].zIndex]=z[c]))}for(x.sort(n);x[y]<0;){if(C=w[x[y++]],k.push(C.apply(D,A)),t){return t=B,k}}for(c=0;b>c;c++){if(C=z[c],"zIndex" in C){if(C.zIndex==x[y]){if(k.push(C.apply(D,A)),t){break}do{if(y++,C=w[x[y]],C&&k.push(C.apply(D,A)),t){break}}while(C)}else{w[C.zIndex]=C}}else{if(k.push(C.apply(D,A)),t){break}}}return t=B,u=i,k.length?k:null};l._events=m,l.listeners=function(G){var F,E,D,C,B,A,z,y,x=G.split(q),w=m,j=[w],f=[];for(C=0,B=x.length;B>C;C++){for(y=[],A=0,z=j.length;z>A;A++){for(w=j[A].n,E=[w[x[C]],w[p]],D=2;D--;){F=E[D],F&&(y.push(F),f=f.concat(F.f||[]))}}j=y}return f},l.on=function(h,f){if(h=String(h),"function"!=typeof f){return function(){}}for(var w=h.split(q),k=m,j=0,i=w.length;i>j;j++){k=k.n,k=k.hasOwnProperty(w[j])&&k[w[j]]||(k[w[j]]={n:{}})}for(k.f=k.f||[],j=0,i=k.f.length;i>j;j++){if(k.f[j]==f){return o}}return k.f.push(f),function(b){+b==+b&&(f.zIndex=+b)}},l.f=function(d){var c=[].slice.call(arguments,1);return function(){l.apply(null,[d,null].concat(c).concat([].slice.call(arguments,0)))}},l.stop=function(){t=1},l.nt=function(b){return b?new RegExp("(?:\\.|\\/|^)"+b+"(?:\\.|\\/|$)").test(u):u},l.nts=function(){return u.split(q)},l.off=l.unbind=function(D,C){if(!D){return void (l._events=m={n:{}})}var B,A,z,y,x,w,k,j=D.split(q),f=[m];for(y=0,x=j.length;x>y;y++){for(w=0;w<f.length;w+=z.length-2){if(z=[w,1],B=f[w].n,j[y]!=p){B[j[y]]&&z.push(B[j[y]])}else{for(A in B){B[r](A)&&z.push(B[A])}}f.splice.apply(f,z)}}for(y=0,x=f.length;x>y;y++){for(B=f[y];B.n;){if(C){if(B.f){for(w=0,k=B.f.length;k>w;w++){if(B.f[w]==C){B.f.splice(w,1);break}}!B.f.length&&delete B.f}for(A in B.n){if(B.n[r](A)&&B.n[A].f){var e=B.n[A].f;for(w=0,k=e.length;k>w;w++){if(e[w]==C){e.splice(w,1);break}}!e.length&&delete B.n[A].f}}}else{delete B.f;for(A in B.n){B.n[r](A)&&B.n[A].f&&delete B.n[A].f}}B=B.n}}},l.once=function(e,d){var f=function(){return l.unbind(e,f),d.apply(this,arguments)};return l.on(e,f)},l.version=s,l.toString=function(){return"You are running Eve "+s},"undefined"!=typeof module&&module.exports?module.exports=l:"undefined"!=typeof define?define("eve",[],function(){return l}):v.eve=l}(this),function(d,c){"function"==typeof define&&define.amd?define(["eve"],function(a){return c(d,a)}):c(d,d.eve)}(this,function(f,e){var i=function(F){var E={},D=f.requestAnimationFrame||f.webkitRequestAnimationFrame||f.mozRequestAnimationFrame||f.oRequestAnimationFrame||f.msRequestAnimationFrame||function(b){setTimeout(b,16)},C=Array.isArray||function(b){return b instanceof Array||"[object Array]"==Object.prototype.toString.call(b)},B=0,A="M"+(+new Date).toString(36),z=function(){return A+(B++).toString(36)},y=Date.now||function(){return +new Date},x=function(j){var d=this;if(null==j){return d.s}var k=d.s-j;d.b+=d.dur*k,d.B+=d.dur*k,d.s=j},w=function(d){var c=this;return null==d?c.spd:void (c.spd=d)},v=function(d){var c=this;return null==d?c.dur:(c.s=c.s*d/c.dur,void (c.dur=d))},u=function(){var b=this;delete E[b.id],F("mina.stop."+b.id,b)},t=function(){var b=this;b.pdif||(delete E[b.id],b.pdif=b.get()-b.b)},s=function(){var b=this;b.pdif&&(b.b=b.get()-b.pdif,delete b.pdif,E[b.id]=b)},r=function(){var b=0;for(var o in E){if(E.hasOwnProperty(o)){var n,m=E[o],l=m.get();if(b++,m.s=(l-m.b)/(m.dur/m.spd),m.s>=1&&(delete E[o],m.s=1,b--,function(j){setTimeout(function(){F("mina.finish."+j.id,j)})}(m)),C(m.start)){n=[];for(var d=0,c=m.start.length;c>d;d++){n[d]=+m.start[d]+(m.end[d]-m.start[d])*m.easing(m.s)}}else{n=+m.start+(m.end-m.start)*m.easing(m.s)}m.set(n)}}b&&D(r)},a=function(n,m,l,k,j,d,c){var q={id:z(),start:n,end:m,b:l,s:0,dur:k-l,spd:1,get:j,set:d,easing:c||a.linear,status:x,speed:w,duration:v,stop:u,pause:t,resume:s};E[q.id]=q;var p,o=0;for(p in E){if(E.hasOwnProperty(p)&&(o++,2==o)){break}}return 1==o&&D(r),q};return a.time=y,a.getById=function(b){return E[b]||null},a.linear=function(b){return b},a.easeout=function(b){return Math.pow(b,1.7)},a.easein=function(b){return Math.pow(b,0.48)},a.easeinout=function(k){if(1==k){return 1}if(0==k){return 0}var j=0.48-k/1.04,q=Math.sqrt(0.1734+j*j),p=q-j,o=Math.pow(Math.abs(p),1/3)*(0>p?-1:1),n=-q-j,m=Math.pow(Math.abs(n),1/3)*(0>n?-1:1),l=o+m+0.5;return 3*(1-l)*l*l+l*l*l},a.backin=function(d){if(1==d){return 1}var c=1.70158;return d*d*((c+1)*d-c)},a.backout=function(d){if(0==d){return 0}d-=1;var c=1.70158;return d*d*((c+1)*d+c)+1},a.elastic=function(b){return b==!!b?b:Math.pow(2,-10*b)*Math.sin(2*(b-0.075)*Math.PI/0.3)+1},a.bounce=function(k){var j,m=7.5625,l=2.75;return 1/l>k?j=m*k*k:2/l>k?(k-=1.5/l,j=m*k*k+0.75):2.5/l>k?(k-=2.25/l,j=m*k*k+0.9375):(k-=2.625/l,j=m*k*k+0.984375),j},f.mina=a,a}("undefined"==typeof e?function(){}:e),h=function(){function bg(j,d){if(j){if(j.tagName){return aQ(j)}if(j instanceof aY){return j}if(null==d){return j=aw.doc.querySelector(j),aQ(j)}}return j=null==j?"100%":j,d=null==d?"100%":d,new aS(j,d)}function bf(k,j){if(j){if("string"==typeof k&&(k=bf(k)),"string"==typeof j){return"xlink:"==j.substring(0,6)?k.getAttributeNS(aO,j.substring(6)):"xml:"==j.substring(0,4)?k.getAttributeNS(aH,j.substring(4)):k.getAttribute(j)}for(var m in j){if(j[av](m)){var l=au(j[m]);l?"xlink:"==m.substring(0,6)?k.setAttributeNS(aO,m.substring(6),l):"xml:"==m.substring(0,4)?k.setAttributeNS(aH,m.substring(4),l):k.setAttribute(m,l):k.removeAttribute(m)}}}else{k=aw.doc.createElementNS(aH,k)}return k}function be(j,d){return d=au.prototype.toLowerCase.call(d),"finite"==d?isFinite(j):"array"==d&&(j instanceof Array||Array.isArray&&Array.isArray(j))?!0:"null"==d&&null===j||d==typeof j&&null!==j||"object"==d&&j===Object(j)||ai.call(j).slice(8,-1).toLowerCase()==d}function bd(j){if("function"==typeof j||Object(j)!==j){return j}var d=new j.constructor;for(var k in j){j[av](k)&&(d[k]=bd(j[k]))}return d}function bc(k,j){for(var m=0,l=k.length;l>m;m++){if(k[m]===j){return k.push(k.splice(m,1)[0])}}}function ba(k,j,m){function l(){var p=Array.prototype.slice.call(arguments,0),o=p.join("␀"),n=l.cache=l.cache||{},d=l.count=l.count||[];return n[av](o)?(bc(d,o),m?m(n[o]):n[o]):(d.length>=1000&&delete n[d.shift()],d.push(o),n[o]=k.apply(j,p),m?m(n[o]):n[o])}return l}function a9(k,j,q,p,o,n){if(null==o){var m=k-q,l=j-p;return m||l?(180+180*aq.atan2(-l,-m)/am+360)%360:0}return a9(k,j,o,n)-a9(q,p,o,n)}function a8(d){return d%360*am/180}function a7(d){return 180*d/am%360}function a6(k,j,o,n,m,l){return null==j&&"[object SVGMatrix]"==ai.call(k)?(this.a=k.a,this.b=k.b,this.c=k.c,this.d=k.d,this.e=k.e,void (this.f=k.f)):void (null!=k?(this.a=+k,this.b=+j,this.c=+o,this.d=+n,this.e=+m,this.f=+l):(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0))}function a5(j){var d=[];return j=j.replace(/(?:^|\s)(\w+)\(([^)]+)\)/g,function(k,m,l){return l=l.split(/\s*,\s*|\s+/),"rotate"==m&&1==l.length&&l.push(0,0),"scale"==m&&(2==l.length&&l.push(0,0),1==l.length&&l.push(l[0],0,0)),d.push("skewX"==m?["m",1,0,aq.tan(a8(l[0])),1,0,0]:"skewY"==m?["m",1,aq.tan(a8(l[0])),0,1,0,0]:[m.charAt(0)].concat(l)),k}),d}function a4(F,E){var D=ag(F),C=new a6;if(D){for(var B=0,A=D.length;A>B;B++){var z,y,x,w,v,u=D[B],t=u.length,s=au(u[0]).toLowerCase(),r=u[0]!=s,n=r?C.invert():0;"t"==s&&2==t?C.translate(u[1],0):"t"==s&&3==t?r?(z=n.x(0,0),y=n.y(0,0),x=n.x(u[1],u[2]),w=n.y(u[1],u[2]),C.translate(x-z,w-y)):C.translate(u[1],u[2]):"r"==s?2==t?(v=v||E,C.rotate(u[1],v.x+v.width/2,v.y+v.height/2)):4==t&&(r?(x=n.x(u[2],u[3]),w=n.y(u[2],u[3]),C.rotate(u[1],x,w)):C.rotate(u[1],u[2],u[3])):"s"==s?2==t||3==t?(v=v||E,C.scale(u[1],u[t-1],v.x+v.width/2,v.y+v.height/2)):4==t?r?(x=n.x(u[2],u[3]),w=n.y(u[2],u[3]),C.scale(u[1],u[1],x,w)):C.scale(u[1],u[1],u[2],u[3]):5==t&&(r?(x=n.x(u[3],u[4]),w=n.y(u[3],u[4]),C.scale(u[1],u[2],x,w)):C.scale(u[1],u[2],u[3],u[4])):"m"==s&&7==t&&C.add(u[1],u[2],u[3],u[4],u[5],u[6])}}return C}function a3(j,d){if(null==d){var l=!0;if(d=j.node.getAttribute("linearGradient"==j.type||"radialGradient"==j.type?"gradientTransform":"pattern"==j.type?"patternTransform":"transform"),!d){return new a6}d=a5(d)}else{d=bg._.rgTransform.test(d)?au(d).replace(/\.{3}|\u2026/g,j._.transform||al):a5(d),be(d,"array")&&(d=bg.path?bg.path.toString.call(d):au(d)),j._.transform=d}var k=a4(d,j.getBBox(1));return l?k:void (j.matrix=k)}function a2(j){var d=bg._.someDefs;if(d&&aX(d.ownerDocument.documentElement,d)){return d}var m=j.node.ownerSVGElement&&aQ(j.node.ownerSVGElement)||j.node.parentNode&&aQ(j.node.parentNode)||bg.select("svg")||bg(0,0),l=m.select("defs"),k=null==l?!1:l.node;return k||(k=aT("defs",m.node).node),bg._.someDefs=k,k}function a1(s,r,q){function p(d){return null==d?al:d==+d?d:(bf(k,{width:d}),k.getBBox().width)}function o(d){return null==d?al:d==+d?d:(bf(k,{height:d}),k.getBBox().height)}function n(t,j){null==r?l[t]=j(s.attr(t)):t==r&&(l=j(null==q?s.attr(t):q))}var m=a2(s),l={},k=m.querySelector(".svg---mgr");switch(k||(k=bf("rect"),bf(k,{width:10,height:10,"class":"svg---mgr"}),m.appendChild(k)),s.type){case"rect":n("rx",p),n("ry",o);case"image":n("width",p),n("height",o);case"text":n("x",p),n("y",o);break;case"circle":n("cx",p),n("cy",o),n("r",p);break;case"ellipse":n("cx",p),n("cy",o),n("rx",p),n("ry",o);break;case"line":n("x1",p),n("x2",p),n("y1",o),n("y2",o);break;case"marker":n("refX",p),n("markerWidth",p),n("refY",o),n("markerHeight",o);break;case"radialGradient":n("fx",p),n("fy",o);break;case"tspan":n("dx",p),n("dy",o);break;default:n(r,p)}return l}function aZ(k){be(k,"array")||(k=Array.prototype.slice.call(arguments,0));for(var j=0,n=0,m=this.node;this[j];){delete this[j++]}for(j=0;j<k.length;j++){"set"==k[j].type?k[j].forEach(function(d){m.appendChild(d.node)}):m.appendChild(k[j].node)}var l=m.childNodes;for(j=0;j<l.length;j++){this[n++]=aQ(l[j])}return this}function aY(k){if(k.snap in b){return b[k.snap]}var j,n=this.id=a();try{j=k.ownerSVGElement}catch(m){}if(this.node=k,j&&(this.paper=new aS(j)),this.type=k.tagName,this.anims={},this._={transform:[]},k.snap=n,b[n]=this,"g"==this.type){this.add=aZ;for(var l in aS.prototype){aS.prototype[av](l)&&(this[l]=aS.prototype[l])}}}function aW(k){for(var j,m=0,l=k.length;l>m;m++){if(j=j||k[m]){return j}}}function aV(d){this.node=d}function aT(k,j){var m=bf(k);j.appendChild(m);var l=aQ(m);return l.type=k,l}function aS(k,j){var p,o,n,m=aS.prototype;if(k&&"svg"==k.tagName){if(k.snap in b){return b[k.snap]}p=new aY(k),o=k.getElementsByTagName("desc")[0],n=k.getElementsByTagName("defs")[0],o||(o=bf("desc"),o.appendChild(aw.doc.createTextNode("Created with Snap")),p.node.appendChild(o)),n||(n=bf("defs"),p.node.appendChild(n)),p.defs=n;for(var l in m){m[av](l)&&(p[l]=m[l])}p.paper=p.root=p}else{p=aT("svg",aw.doc.body),bf(p.node,{height:j,version:1.1,width:k,xmlns:aH})}return p}function aQ(d){return d?d instanceof aY||d instanceof aV?d:"svg"==d.tagName?new aS(d):new aY(d):d}function aF(){return this.selectAll("stop")}function aD(j,d){var l=bf("stop"),k={offset:+d+"%"};return j=bg.color(j),k["stop-color"]=j.hex,j.opacity<1&&(k["stop-opacity"]=j.opacity),bf(l,k),this.node.appendChild(l),this}function aC(){if("linearGradient"==this.type){var j=bf(this.node,"x1")||0,d=bf(this.node,"x2")||1,o=bf(this.node,"y1")||0,n=bf(this.node,"y2")||0;return bg._.box(j,o,aq.abs(d-j),aq.abs(n-o))}var m=this.node.cx||0.5,l=this.node.cy||0.5,k=this.node.r||0;return bg._.box(m-k,l-k,2*k,2*k)}function aB(x,w){function v(k,j){for(var m=(j-q)/(k-p),l=p;k>l;l++){s[l].offset=+(+q+m*(l-p)).toFixed(2)}p=k,q=j}var u,t=aW(e("snap.util.grad.parse",null,w));if(!t){return null}t.params.unshift(x),u="l"==t.type.toLowerCase()?aA.apply(0,t.params):az.apply(0,t.params),t.type!=t.type.toLowerCase()&&bf(u.node,{gradientUnits:"userSpaceOnUse"});var s=t.stops,r=s.length,q=0,p=0;r--;for(var o=0;r>o;o++){"offset" in s[o]&&v(o,s[o].offset)}for(s[r].offset=s[r].offset||100,v(r,s[r].offset),o=0;r>=o;o++){var n=s[o];u.addStop(n.color,n.offset)}return u}function aA(k,j,o,n,m){var l=aT("linearGradient",k);return l.stops=aF,l.addStop=aD,l.getBBox=aC,null!=j&&bf(l.node,{x1:j,y1:o,x2:n,y2:m}),l}function az(k,j,p,o,n,m){var l=aT("radialGradient",k);return l.stops=aF,l.addStop=aD,l.getBBox=aC,null!=j&&bf(l.node,{cx:j,cy:p,r:o}),null!=n&&null!=m&&bf(l.node,{fx:n,fy:m}),l}function ay(d){return function(m){if(e.stop(),m instanceof aV&&1==m.node.childNodes.length&&("radialGradient"==m.node.firstChild.tagName||"linearGradient"==m.node.firstChild.tagName||"pattern"==m.node.firstChild.tagName)&&(m=m.node.firstChild,a2(this).appendChild(m),m=aQ(m)),m instanceof aY){if("radialGradient"==m.type||"linearGradient"==m.type||"pattern"==m.type){m.node.id||bf(m.node,{id:m.id});var l=aP(m.node.id)}else{l=m.attr(d)}}else{if(l=bg.color(m),l.error){var k=aB(a2(this),m);k?(k.node.id||bf(k.node,{id:k.id}),l=aP(k.node.id)):l=m}else{l=au(l)}}var j={};j[d]=l,bf(this.node,j),this.node.style[d]=al}}function ax(k){for(var j=[],o=k.childNodes,n=0,m=o.length;m>n;n++){var l=o[n];3==l.nodeType&&j.push(l.nodeValue),"tspan"==l.tagName&&j.push(1==l.childNodes.length&&3==l.firstChild.nodeType?l.firstChild.nodeValue:ax(l))}return j}bg.version="0.2.0",bg.toString=function(){return"Snap v"+this.version},bg._={};var aw={win:f,doc:f.document};bg._.glob=aw;var av="hasOwnProperty",au=String,at=parseFloat,ar=parseInt,aq=Math,ap=aq.max,ao=aq.min,an=aq.abs,am=(aq.pow,aq.PI),al=(aq.round,""),ak=" ",ai=Object.prototype.toString,ah=/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?%?)\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?%?)\s*\))\s*$/i,af=/^url\(#?([^)]+)\)$/,ae=" \n \f\r   ᠎              \u2028\u2029",ac=new RegExp("[,"+ae+"]+"),aa=(new RegExp("["+ae+"]","g"),new RegExp("["+ae+"]*,["+ae+"]*")),aM={hs:1,rg:1},bi=new RegExp("([a-z])["+ae+",]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?["+ae+"]*,?["+ae+"]*)+)","ig"),aE=new RegExp("([rstm])["+ae+",]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?["+ae+"]*,?["+ae+"]*)+)","ig"),bh=new RegExp("(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)["+ae+"]*,?["+ae+"]*","ig"),aN=0,aG="S"+(+new Date).toString(36),a=function(){return aG+(aN++).toString(36)},aO="http://www.w3.org/1999/xlink",aH="http://www.w3.org/2000/svg",b={},aP=bg.url=function(d){return"url('#"+d+"')"};bg._.$=bf,bg._.id=a,bg.format=function(){var j=/\{([^\}]+)\}/g,d=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g,k=function(l,o,n){var m=n;return o.replace(d,function(q,p,t,s,r){p=p||s,m&&(p in m&&(m=m[p]),"function"==typeof m&&r&&(m=m()))}),m=(null==m||m==n?l:m)+""};return function(l,m){return au(l).replace(j,function(o,n){return k(o,n,m)})}}();var aI=function(){function d(){this.parentNode.removeChild(this)}return function(j,m){var l=aw.doc.createElement("img"),k=aw.doc.body;l.style.cssText="position:absolute;left:-9999em;top:-9999em",l.onload=function(){m.call(l),l.onload=l.onerror=null,k.removeChild(l)},l.onerror=d,k.appendChild(l),l.src=j}}();bg._.clone=bd,bg._.cacher=ba,bg.rad=a8,bg.deg=a7,bg.angle=a9,bg.is=be,bg.snapTo=function(k,j,n){if(n=be(n,"finite")?n:10,be(k,"array")){for(var m=k.length;m--;){if(an(k[m]-j)<=n){return k[m]}}}else{k=+k;var l=j%k;if(n>l){return j-l}if(l>k-n){return j-l+k}}return j},function(j){function d(l){return l[0]*l[0]+l[1]*l[1]}function k(l){var m=aq.sqrt(d(l));l[0]&&(l[0]/=m),l[1]&&(l[1]/=m)}j.add=function(z,y,x,w,v,u){var t,s,r,q,p=[[],[],[]],o=[[this.a,this.c,this.e],[this.b,this.d,this.f],[0,0,1]],n=[[z,x,v],[y,w,u],[0,0,1]];for(z&&z instanceof a6&&(n=[[z.a,z.c,z.e],[z.b,z.d,z.f],[0,0,1]]),t=0;3>t;t++){for(s=0;3>s;s++){for(q=0,r=0;3>r;r++){q+=o[t][r]*n[r][s]}p[t][s]=q}}return this.a=p[0][0],this.b=p[1][0],this.c=p[0][1],this.d=p[1][1],this.e=p[0][2],this.f=p[1][2],this},j.invert=function(){var m=this,l=m.a*m.d-m.b*m.c;return new a6(m.d/l,-m.b/l,-m.c/l,m.a/l,(m.c*m.f-m.d*m.e)/l,(m.b*m.e-m.a*m.f)/l)},j.clone=function(){return new a6(this.a,this.b,this.c,this.d,this.e,this.f)},j.translate=function(m,l){return this.add(1,0,0,1,m,l)},j.scale=function(m,l,o,n){return null==l&&(l=m),(o||n)&&this.add(1,0,0,1,o,n),this.add(m,0,0,l,0,0),(o||n)&&this.add(1,0,0,1,-o,-n),this},j.rotate=function(m,l,p){m=a8(m),l=l||0,p=p||0;var o=+aq.cos(m).toFixed(9),n=+aq.sin(m).toFixed(9);return this.add(o,n,-n,o,l,p),this.add(1,0,0,1,-l,-p)},j.x=function(m,l){return m*this.a+l*this.c+this.e},j.y=function(m,l){return m*this.b+l*this.d+this.f},j.get=function(l){return +this[au.fromCharCode(97+l)].toFixed(4)},j.toString=function(){return"matrix("+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)].join()+")"},j.offset=function(){return[this.e.toFixed(4),this.f.toFixed(4)]},j.split=function(){var l={};l.dx=this.e,l.dy=this.f;var o=[[this.a,this.c],[this.b,this.d]];l.scalex=aq.sqrt(d(o[0])),k(o[0]),l.shear=o[0][0]*o[1][0]+o[0][1]*o[1][1],o[1]=[o[1][0]-o[0][0]*l.shear,o[1][1]-o[0][1]*l.shear],l.scaley=aq.sqrt(d(o[1])),k(o[1]),l.shear/=l.scaley;var n=-o[0][1],m=o[1][1];return 0>m?(l.rotate=a7(aq.acos(m)),0>n&&(l.rotate=360-l.rotate)):l.rotate=a7(aq.asin(n)),l.isSimple=!(+l.shear.toFixed(9)||l.scalex.toFixed(9)!=l.scaley.toFixed(9)&&l.rotate),l.isSuperSimple=!+l.shear.toFixed(9)&&l.scalex.toFixed(9)==l.scaley.toFixed(9)&&!l.rotate,l.noRotation=!+l.shear.toFixed(9)&&!l.rotate,l},j.toTransformString=function(m){var l=m||this.split();return l.isSimple?(l.scalex=+l.scalex.toFixed(4),l.scaley=+l.scaley.toFixed(4),l.rotate=+l.rotate.toFixed(4),(l.dx||l.dy?"t"+[+l.dx.toFixed(4),+l.dy.toFixed(4)]:al)+(1!=l.scalex||1!=l.scaley?"s"+[l.scalex,l.scaley,0,0]:al)+(l.rotate?"r"+[+l.rotate.toFixed(4),0,0]:al)):"m"+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)]}}(a6.prototype),bg.Matrix=a6,bg.getRGB=ba(function(k){if(!k||(k=au(k)).indexOf("-")+1){return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:ad}}if("none"==k){return{r:-1,g:-1,b:-1,hex:"none",toString:ad}}if(!(aM[av](k.toLowerCase().substring(0,2))||"#"==k.charAt())&&(k=c(k)),!k){return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:ad}}var d,q,p,o,n,m,l=k.match(ah);return l?(l[2]&&(p=ar(l[2].substring(5),16),q=ar(l[2].substring(3,5),16),d=ar(l[2].substring(1,3),16)),l[3]&&(p=ar((n=l[3].charAt(3))+n,16),q=ar((n=l[3].charAt(2))+n,16),d=ar((n=l[3].charAt(1))+n,16)),l[4]&&(m=l[4].split(aa),d=at(m[0]),"%"==m[0].slice(-1)&&(d*=2.55),q=at(m[1]),"%"==m[1].slice(-1)&&(q*=2.55),p=at(m[2]),"%"==m[2].slice(-1)&&(p*=2.55),"rgba"==l[1].toLowerCase().slice(0,4)&&(o=at(m[3])),m[3]&&"%"==m[3].slice(-1)&&(o/=100)),l[5]?(m=l[5].split(aa),d=at(m[0]),"%"==m[0].slice(-1)&&(d/=100),q=at(m[1]),"%"==m[1].slice(-1)&&(q/=100),p=at(m[2]),"%"==m[2].slice(-1)&&(p/=100),("deg"==m[0].slice(-3)||"°"==m[0].slice(-1))&&(d/=360),"hsba"==l[1].toLowerCase().slice(0,4)&&(o=at(m[3])),m[3]&&"%"==m[3].slice(-1)&&(o/=100),bg.hsb2rgb(d,q,p,o)):l[6]?(m=l[6].split(aa),d=at(m[0]),"%"==m[0].slice(-1)&&(d/=100),q=at(m[1]),"%"==m[1].slice(-1)&&(q/=100),p=at(m[2]),"%"==m[2].slice(-1)&&(p/=100),("deg"==m[0].slice(-3)||"°"==m[0].slice(-1))&&(d/=360),"hsla"==l[1].toLowerCase().slice(0,4)&&(o=at(m[3])),m[3]&&"%"==m[3].slice(-1)&&(o/=100),bg.hsl2rgb(d,q,p,o)):(d=ao(aq.round(d),255),q=ao(aq.round(q),255),p=ao(aq.round(p),255),o=ao(ap(o,0),1),l={r:d,g:q,b:p,toString:ad},l.hex="#"+(16777216|p|q<<8|d<<16).toString(16).slice(1),l.opacity=be(o,"finite")?o:1,l)):{r:-1,g:-1,b:-1,hex:"none",error:1,toString:ad}},bg),bg.hsb=ba(function(j,d,k){return bg.hsb2rgb(j,d,k).hex}),bg.hsl=ba(function(j,d,k){return bg.hsl2rgb(j,d,k).hex}),bg.rgb=ba(function(k,j,n,m){if(be(m,"finite")){var l=aq.round;return"rgba("+[l(k),l(j),l(n),+m.toFixed(2)]+")"}return"#"+(16777216|n|j<<8|k<<16).toString(16).slice(1)});var c=function(j){var d=aw.doc.getElementsByTagName("head")[0],k="rgb(255, 0, 0)";return(c=ba(function(l){if("red"==l.toLowerCase()){return k}d.style.color=k,d.style.color=l;var m=aw.doc.defaultView.getComputedStyle(d,al).getPropertyValue("color");return m==k?null:m}))(j)},aR=function(){return"hsb("+[this.h,this.s,this.b]+")"},aJ=function(){return"hsl("+[this.h,this.s,this.l]+")"},ad=function(){return 1==this.opacity||null==this.opacity?this.hex:"rgba("+[this.r,this.g,this.b,this.opacity]+")"},aU=function(j,d,l){if(null==d&&be(j,"object")&&"r" in j&&"g" in j&&"b" in j&&(l=j.b,d=j.g,j=j.r),null==d&&be(j,string)){var k=bg.getRGB(j);j=k.r,d=k.g,l=k.b}return(j>1||d>1||l>1)&&(j/=255,d/=255,l/=255),[j,d,l]},aK=function(j,d,m,l){j=aq.round(255*j),d=aq.round(255*d),m=aq.round(255*m);var k={r:j,g:d,b:m,opacity:be(l,"finite")?l:1,hex:bg.rgb(j,d,m),toString:ad};return be(l,"finite")&&(k.opacity=l),k};bg.color=function(j){var d;return be(j,"object")&&"h" in j&&"s" in j&&"b" in j?(d=bg.hsb2rgb(j),j.r=d.r,j.g=d.g,j.b=d.b,j.opacity=1,j.hex=d.hex):be(j,"object")&&"h" in j&&"s" in j&&"l" in j?(d=bg.hsl2rgb(j),j.r=d.r,j.g=d.g,j.b=d.b,j.opacity=1,j.hex=d.hex):(be(j,"string")&&(j=bg.getRGB(j)),be(j,"object")&&"r" in j&&"g" in j&&"b" in j&&!("error" in j)?(d=bg.rgb2hsl(j),j.h=d.h,j.s=d.s,j.l=d.l,d=bg.rgb2hsb(j),j.v=d.b):(j={hex:"none"},j.r=j.g=j.b=j.h=j.s=j.v=j.l=-1,j.error=1)),j.toString=ad,j},bg.hsb2rgb=function(s,r,q,p){be(s,"object")&&"h" in s&&"s" in s&&"b" in s&&(q=s.b,r=s.s,s=s.h,p=s.o),s*=360;var o,n,m,l,k;return s=s%360/60,k=q*r,l=k*(1-an(s%2-1)),o=n=m=q-k,s=~~s,o+=[k,l,0,0,l,k][s],n+=[l,k,k,l,0,0][s],m+=[0,0,l,k,k,l][s],aK(o,n,m,p)},bg.hsl2rgb=function(s,r,q,p){be(s,"object")&&"h" in s&&"s" in s&&"l" in s&&(q=s.l,r=s.s,s=s.h),(s>1||r>1||q>1)&&(s/=360,r/=100,q/=100),s*=360;var o,n,m,l,k;return s=s%360/60,k=2*r*(0.5>q?q:1-q),l=k*(1-an(s%2-1)),o=n=m=q-k/2,s=~~s,o+=[k,l,0,0,l,k][s],n+=[l,k,k,l,0,0][s],m+=[0,0,l,k,k,l][s],aK(o,n,m,p)},bg.rgb2hsb=function(k,j,p){p=aU(k,j,p),k=p[0],j=p[1],p=p[2];var o,n,m,l;return m=ap(k,j,p),l=m-ao(k,j,p),o=0==l?null:m==k?(j-p)/l:m==j?(p-k)/l+2:(k-j)/l+4,o=(o+360)%6*60/360,n=0==l?0:l/m,{h:o,s:n,b:m,toString:aR}},bg.rgb2hsl=function(r,q,p){p=aU(r,q,p),r=p[0],q=p[1],p=p[2];var o,n,m,l,k,j;return l=ap(r,q,p),k=ao(r,q,p),j=l-k,o=0==j?null:l==r?(q-p)/j:l==q?(p-r)/j+2:(r-q)/j+4,o=(o+360)%6*60/360,m=(l+k)/2,n=0==j?0:0.5>m?j/(2*m):j/(2-2*m),{h:o,s:n,l:m,toString:aJ}},bg.parsePathString=function(j){if(!j){return null}var d=bg.path(j);if(d.arr){return bg.path.clone(d.arr)}var l={a:7,c:6,o:2,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,u:3,z:0},k=[];return be(j,"array")&&be(j[0],"array")&&(k=bg.path.clone(j)),k.length||au(j).replace(bi,function(n,m,q){var p=[],o=m.toLowerCase();if(q.replace(bh,function(s,r){r&&p.push(+r)}),"m"==o&&p.length>2&&(k.push([m].concat(p.splice(0,2))),o="l",m="m"==m?"l":"L"),"o"==o&&1==p.length&&k.push([m,p[0]]),"r"==o){k.push([m].concat(p))}else{for(;p.length>=l[o]&&(k.push([m].concat(p.splice(0,l[o]))),l[o]);){}}}),k.toString=bg.path.toString,d.arr=bg.path.clone(k),k};var ag=bg.parseTransformString=function(j){if(!j){return null}var d=[];return be(j,"array")&&be(j[0],"array")&&(d=bg.path.clone(j)),d.length||au(j).replace(aE,function(k,n,m){var l=[];n.toLowerCase();m.replace(bh,function(p,o){o&&l.push(+o)}),d.push([n].concat(l))}),d.toString=bg.path.toString,d};bg._.svgTransform2string=a5,bg._.rgTransform=new RegExp("^[a-z]["+ae+"]*-?\\.?\\d","i"),bg._.transform2matrix=a4,bg._unit2px=a1;var aX=aw.doc.contains||aw.doc.compareDocumentPosition?function(k,j){var m=9==k.nodeType?k.documentElement:k,l=j&&j.parentNode;return k==l||!(!l||1!=l.nodeType||!(m.contains?m.contains(l):k.compareDocumentPosition&&16&k.compareDocumentPosition(l)))}:function(j,d){if(d){for(;d;){if(d=d.parentNode,d==j){return !0}}}return !1};bg._.getSomeDefs=a2,bg.select=function(d){return aQ(aw.doc.querySelector(d))},bg.selectAll=function(j){for(var d=aw.doc.querySelectorAll(j),l=(bg.set||Array)(),k=0;k<d.length;k++){l.push(aQ(d[k]))}return l},function(m){function r(F){function E(k,j){var l=bf(k.node,j);l=l&&l.match(A),l=l&&l[2],l&&"#"==l.charAt()&&(l=l.substring(1),l&&(y[l]=(y[l]||[]).concat(function(H){var G={};G[j]=aP(H),bf(k.node,G)})))}function D(k){var j=bf(k.node,"xlink:href");j&&"#"==j.charAt()&&(j=j.substring(1),j&&(y[j]=(y[j]||[]).concat(function(l){k.attr("xlink:href","#"+l)})))}for(var C,B=F.selectAll("*"),A=/^\s*url\(("|'|)(.*)\1\)\s*$/,z=[],y={},x=0,w=B.length;w>x;x++){C=B[x],E(C,"fill"),E(C,"stroke"),E(C,"filter"),E(C,"mask"),E(C,"clip-path"),D(C);var v=bf(C.node,"id");v&&(bf(C.node,{id:C.id}),z.push({old:v,id:C.id}))}for(x=0,w=z.length;w>x;x++){var u=y[z[x].old];if(u){for(var t=0,s=u.length;s>t;t++){u[t](z[x].id)}}}}function q(k,j,l){return function(t){var s=t.slice(k,j);return 1==s.length&&(s=s[0]),l?l(s):s}}function p(j){return function(){var k=j?"<"+this.type:"",u=this.node.attributes,t=this.node.childNodes;if(j){for(var s=0,l=u.length;l>s;s++){k+=" "+u[s].name+'="'+u[s].value.replace(/"/g,'\\"')+'"'}}if(t.length){for(j&&(k+=">"),s=0,l=t.length;l>s;s++){3==t[s].nodeType?k+=t[s].nodeValue:1==t[s].nodeType&&(k+=aQ(t[s]).toString())}j&&(k+="</"+this.type+">")}else{j&&(k+="/>")}return k}}m.attr=function(j,t){var s=this;s.node;if(!j){return s}if(be(j,"string")){if(!(arguments.length>1)){return aW(e("snap.util.getattr."+j,s))}var l={};l[j]=t,j=l}for(var k in j){j[av](k)&&e("snap.util.attr."+k,s,j[k])}return s},m.getBBox=function(k){var j=this;if("use"==j.type&&(j=j.original),j.removed){return{}}var l=j._;return k?(l.bboxwt=bg.path.get[j.type]?bg.path.getBBox(j.realPath=bg.path.get[j.type](j)):bg._.box(j.node.getBBox()),bg._.box(l.bboxwt)):(j.realPath=(bg.path.get[j.type]||bg.path.get.deflt)(j),l.bbox=bg.path.getBBox(bg.path.map(j.realPath,j.matrix)),bg._.box(l.bbox))};var o=function(){return this.string};m.transform=function(k){var j=this._;if(null==k){var u=new a6(this.node.getCTM()),t=a3(this),s=t.toTransformString(),l=au(t)==au(this.matrix)?j.transform:s;return{string:l,globalMatrix:u,localMatrix:t,diffMatrix:u.clone().add(t.invert()),global:u.toTransformString(),local:s,toString:o}}return k instanceof a6&&(k=k.toTransformString()),a3(this,k),this.node&&("linearGradient"==this.type||"radialGradient"==this.type?bf(this.node,{gradientTransform:this.matrix}):"pattern"==this.type?bf(this.node,{patternTransform:this.matrix}):bf(this.node,{transform:this.matrix})),this},m.parent=function(){return aQ(this.node.parentNode)},m.append=m.add=function(k){if(k){if("set"==k.type){var j=this;return k.forEach(function(l){j.add(l)}),this}k=aQ(k),this.node.appendChild(k.node),k.paper=this.paper}return this},m.appendTo=function(j){return j&&(j=aQ(j),j.append(this)),this},m.prepend=function(k){if(k){k=aQ(k);var j=k.parent();this.node.insertBefore(k.node,this.node.firstChild),this.add&&this.add(),k.paper=this.paper,this.parent()&&this.parent().add(),j&&j.add()}return this},m.prependTo=function(j){return j=aQ(j),j.prepend(this),this},m.before=function(k){if("set"==k.type){var j=this;return k.forEach(function(s){var t=s.parent();j.node.parentNode.insertBefore(s.node,j.node),t&&t.add()}),this.parent().add(),this}k=aQ(k);var l=k.parent();return this.node.parentNode.insertBefore(k.node,this.node),this.parent()&&this.parent().add(),l&&l.add(),k.paper=this.paper,this},m.after=function(k){k=aQ(k);var j=k.parent();return this.node.nextSibling?this.node.parentNode.insertBefore(k.node,this.node.nextSibling):this.node.parentNode.appendChild(k.node),this.parent()&&this.parent().add(),j&&j.add(),k.paper=this.paper,this},m.insertBefore=function(k){k=aQ(k);var j=this.parent();return k.node.parentNode.insertBefore(this.node,k.node),this.paper=k.paper,j&&j.add(),k.parent()&&k.parent().add(),this},m.insertAfter=function(k){k=aQ(k);var j=this.parent();return k.node.parentNode.insertBefore(this.node,k.node.nextSibling),this.paper=k.paper,j&&j.add(),k.parent()&&k.parent().add(),this},m.remove=function(){var j=this.parent();return this.node.parentNode&&this.node.parentNode.removeChild(this.node),delete this.paper,this.removed=!0,j&&j.add(),this},m.select=function(j){return aQ(this.node.querySelector(j))},m.selectAll=function(k){for(var j=this.node.querySelectorAll(k),s=(bg.set||Array)(),l=0;l<j.length;l++){s.push(aQ(j[l]))}return s},m.asPX=function(k,j){return null==j&&(j=this.attr(k)),+a1(this,k,j)},m.use=function(){var k,j=this.node.id;return j||(j=this.id,bf(this.node,{id:j})),k="linearGradient"==this.type||"radialGradient"==this.type||"pattern"==this.type?aT(this.type,this.node.parentNode):aT("use",this.node.parentNode),bf(k.node,{"xlink:href":"#"+j}),k.original=this,k},m.clone=function(){var j=aQ(this.node.cloneNode(!0));return bf(j.node,"id")&&bf(j.node,{id:j.id}),r(j),j.insertAfter(this),j},m.toDefs=function(){var j=a2(this);return j.appendChild(this.node),this},m.pattern=function(k,j,t,s){var l=aT("pattern",a2(this));return null==k&&(k=this.getBBox()),be(k,"object")&&"x" in k&&(j=k.y,t=k.width,s=k.height,k=k.x),bf(l.node,{x:k,y:j,width:t,height:s,patternUnits:"userSpaceOnUse",id:l.id,viewBox:[k,j,t,s].join(" ")}),l.node.appendChild(this.node),l},m.marker=function(k,j,v,u,t,s){var l=aT("marker",a2(this));return null==k&&(k=this.getBBox()),be(k,"object")&&"x" in k&&(j=k.y,v=k.width,u=k.height,t=k.refX||k.cx,s=k.refY||k.cy,k=k.x),bf(l.node,{viewBox:[k,j,v,u].join(ak),markerWidth:v,markerHeight:u,orient:"auto",refX:t||0,refY:s||0,id:l.id}),l.node.appendChild(this.node),l};var n=function(k,j,s,l){"function"!=typeof s||s.length||(l=s,s=i.linear),this.attr=k,this.dur=j,s&&(this.easing=s),l&&(this.callback=l)};bg.animation=function(k,j,s,l){return new n(k,j,s,l)},m.inAnim=function(){var k=this,j=[];for(var l in k.anims){k.anims[av](l)&&!function(s){j.push({anim:new n(s._attrs,s.dur,s.easing,s._callback),curStatus:s.status(),status:function(t){return s.status(t)},stop:function(){s.stop()}})}(k.anims[l])}return j},bg.animate=function(k,x,w,v,u,t){"function"!=typeof u||u.length||(t=u,u=i.linear);var s=i.time(),l=i(k,x,s,s+v,i.time,w,u);return t&&e.once("mina.finish."+l.id,t),l},m.stop=function(){for(var k=this.inAnim(),j=0,l=k.length;l>j;j++){k[j].stop()}return this},m.animate=function(G,F,E,D){"function"!=typeof E||E.length||(D=E,E=i.linear),G instanceof n&&(D=G.callback,E=G.easing,F=E.dur,G=G.attr);var C,B,A,z,y=[],x=[],w={},v=this;for(var k in G){if(G[av](k)){v.equal?(z=v.equal(k,au(G[k])),C=z.from,B=z.to,A=z.f):(C=+v.attr(k),B=+G[k]);var J=be(C,"array")?C.length:1;w[k]=q(y.length,y.length+J,A),y=y.concat(C),x=x.concat(B)}}var I=i.time(),H=i(y,x,I,I+F,i.time,function(l){var j={};for(var s in w){w[av](s)&&(j[s]=w[s](l))}v.attr(j)},E);return v.anims[H.id]=H,H._attrs=G,H._callback=D,e.once("mina.finish."+H.id,function(){delete v.anims[H.id],D&&D.call(v)}),e.once("mina.stop."+H.id,function(){delete v.anims[H.id]}),v};var d={};m.data=function(j,s){var l=d[this.id]=d[this.id]||{};if(0==arguments.length){return e("snap.data.get."+this.id,this,l,null),l}if(1==arguments.length){if(bg.is(j,"object")){for(var k in j){j[av](k)&&this.data(k,j[k])}return this}return e("snap.data.get."+this.id,this,l[j],j),l[j]}return l[j]=s,e("snap.data.set."+this.id,this,s,j),this},m.removeData=function(j){return null==j?d[this.id]={}:d[this.id]&&delete d[this.id][j],this},m.outerSVG=m.toString=p(1),m.innerSVG=p()}(aY.prototype),bg.parse=function(k){var j=aw.doc.createDocumentFragment(),m=!0,l=aw.doc.createElement("div");if(k=au(k),k.match(/^\s*<\s*svg(?:\s|>)/)||(k="<svg>"+k+"</svg>",m=!1),l.innerHTML=k,k=l.getElementsByTagName("svg")[0]){if(m){j=k}else{for(;k.firstChild;){j.appendChild(k.firstChild)}}}return l.innerHTML=al,new aV(j)},aV.prototype.select=aY.prototype.select,aV.prototype.selectAll=aY.prototype.selectAll,bg.fragment=function(){for(var j=Array.prototype.slice.call(arguments,0),d=aw.doc.createDocumentFragment(),m=0,l=j.length;l>m;m++){var k=j[m];k.node&&k.node.nodeType&&d.appendChild(k.node),k.nodeType&&d.appendChild(k),"string"==typeof k&&d.appendChild(bg.parse(k).node)}return new aV(d)},function(d){d.el=function(k,j){return aT(k,this.node).attr(j)},d.rect=function(k,j,p,o,n,m){var l;return null==m&&(m=n),be(k,"object")&&"x" in k?l=k:null!=k&&(l={x:k,y:j,width:p,height:o},null!=n&&(l.rx=n,l.ry=m)),this.el("rect",l)},d.circle=function(k,j,m){var l;return be(k,"object")&&"cx" in k?l=k:null!=k&&(l={cx:k,cy:j,r:m}),this.el("circle",l)},d.image=function(k,j,p,o,n){var m=aT("image",this.node);if(be(k,"object")&&"src" in k){m.attr(k)}else{if(null!=k){var l={"xlink:href":k,preserveAspectRatio:"none"};null!=j&&null!=p&&(l.x=j,l.y=p),null!=o&&null!=n?(l.width=o,l.height=n):aI(k,function(){bf(m.node,{width:this.offsetWidth,height:this.offsetHeight})}),bf(m.node,l)}}return m},d.ellipse=function(k,j,n,m){var l=aT("ellipse",this.node);return be(k,"object")&&"cx" in k?l.attr(k):null!=k&&l.attr({cx:k,cy:j,rx:n,ry:m}),l},d.path=function(k){var j=aT("path",this.node);return be(k,"object")&&!be(k,"array")?j.attr(k):k&&j.attr({d:k}),j},d.group=d.g=function(j){var l=aT("g",this.node);l.add=aZ;for(var k in d){d[av](k)&&(l[k]=d[k])}return 1==arguments.length&&j&&!j.type?l.attr(j):arguments.length&&l.add(Array.prototype.slice.call(arguments,0)),l},d.text=function(k,j,m){var l=aT("text",this.node);return be(k,"object")?l.attr(k):null!=k&&l.attr({x:k,y:j,text:m||""}),l},d.line=function(k,j,n,m){var l=aT("line",this.node);return be(k,"object")?l.attr(k):null!=k&&l.attr({x1:k,x2:n,y1:j,y2:m}),l},d.polyline=function(k){arguments.length>1&&(k=Array.prototype.slice.call(arguments,0));var j=aT("polyline",this.node);return be(k,"object")&&!be(k,"array")?j.attr(k):null!=k&&j.attr({points:k}),j},d.polygon=function(k){arguments.length>1&&(k=Array.prototype.slice.call(arguments,0));var j=aT("polygon",this.node);return be(k,"object")&&!be(k,"array")?j.attr(k):null!=k&&j.attr({points:k}),j},function(){d.gradient=function(j){return aB(this.defs,j)},d.gradientLinear=function(k,j,m,l){return aA(this.defs,k,j,m,l)},d.gradientRadial=function(k,j,n,m,l){return az(this.defs,k,j,n,m,l)},d.toString=function(){var k,j=aw.doc.createDocumentFragment(),m=aw.doc.createElement("div"),l=this.node.cloneNode(!0);return j.appendChild(m),m.appendChild(l),bf(l,{xmlns:aH}),k=m.innerHTML,j.removeChild(j.firstChild),k},d.clear=function(){for(var k,j=this.node.firstChild;j;){k=j.nextSibling,"defs"!=j.tagName&&j.parentNode.removeChild(j),j=k}}}()}(aS.prototype),bg.ajax=function(k,r,q,p){var o=new XMLHttpRequest,n=a();if(o){if(be(r,"function")){p=q,q=r,r=null}else{if(be(r,"object")){var m=[];for(var l in r){r.hasOwnProperty(l)&&m.push(encodeURIComponent(l)+"="+encodeURIComponent(r[l]))}r=m.join("&")}}return o.open(r?"POST":"GET",k,!0),o.setRequestHeader("X-Requested-With","XMLHttpRequest"),r&&o.setRequestHeader("Content-type","application/x-www-form-urlencoded"),q&&(e.once("snap.ajax."+n+".0",q),e.once("snap.ajax."+n+".200",q),e.once("snap.ajax."+n+".304",q)),o.onreadystatechange=function(){4==o.readyState&&e("snap.ajax."+n+"."+o.status,p,o)},4==o.readyState?o:(o.send(r),o)}},bg.load=function(j,d,k){bg.ajax(j,function(l){var m=bg.parse(l.responseText);k?d.call(k,m):d(m)})},e.on("snap.util.attr.mask",function(d){if(d instanceof aY||d instanceof aV){if(e.stop(),d instanceof aV&&1==d.node.childNodes.length&&(d=d.node.firstChild,a2(this).appendChild(d),d=aQ(d)),"mask"==d.type){var j=d}else{j=aT("mask",a2(this)),j.node.appendChild(d.node),!j.node.id&&bf(j.node,{id:j.id})}bf(this.node,{mask:aP(j.id)})}}),function(d){e.on("snap.util.attr.clip",d),e.on("snap.util.attr.clip-path",d),e.on("snap.util.attr.clipPath",d)}(function(d){if(d instanceof aY||d instanceof aV){if(e.stop(),"clipPath"==d.type){var j=d}else{j=aT("clipPath",a2(this)),j.node.appendChild(d.node),!j.node.id&&bf(j.node,{id:j.id})}bf(this.node,{"clip-path":aP(j.id)})}}),e.on("snap.util.attr.fill",ay("fill")),e.on("snap.util.attr.stroke",ay("stroke"));var aL=/^([lr])(?:\(([^)]*)\))?(.*)$/i;e.on("snap.util.grad.parse",function(k){k=au(k);var j=k.match(aL);if(!j){return null}var n=j[1],m=j[2],l=j[3];return m=m.split(/\s*,\s*/).map(function(d){return +d==d?+d:d}),1==m.length&&0==m[0]&&(m=[]),l=l.split("-"),l=l.map(function(o){o=o.split(":");var d={color:o[0]};return o[1]&&(d.offset=o[1]),d}),{type:n,params:m,stops:l}}),e.on("snap.util.attr.d",function(d){e.stop(),be(d,"array")&&be(d[0],"array")&&(d=bg.path.toString.call(d)),d=au(d),d.match(/[ruo]/i)&&(d=bg.path.toAbsolute(d)),bf(this.node,{d:d})})(-1),e.on("snap.util.attr.#text",function(d){e.stop(),d=au(d);for(var j=aw.doc.createTextNode(d);this.node.firstChild;){this.node.removeChild(this.node.firstChild)}this.node.appendChild(j)})(-1),e.on("snap.util.attr.path",function(d){e.stop(),this.attr({d:d})})(-1),e.on("snap.util.attr.viewBox",function(d){var j;j=be(d,"object")&&"x" in d?[d.x,d.y,d.width,d.height].join(" "):be(d,"array")?d.join(" "):d,bf(this.node,{viewBox:j}),e.stop()})(-1),e.on("snap.util.attr.transform",function(d){this.transform(d),e.stop()})(-1),e.on("snap.util.attr.r",function(d){"rect"==this.type&&(e.stop(),bf(this.node,{rx:d,ry:d}))})(-1),e.on("snap.util.attr.textpath",function(j){if(e.stop(),"text"==this.type){var o,n,m;if(!j&&this.textPath){for(n=this.textPath;n.node.firstChild;){this.node.appendChild(n.node.firstChild)}return n.remove(),void delete this.textPath}if(be(j,"string")){var l=a2(this),k=aQ(l.parentNode).path(j);l.appendChild(k.node),o=k.id,k.attr({id:o})}else{j=aQ(j),j instanceof aY&&(o=j.attr("id"),o||(o=j.id,j.attr({id:o})))}if(o){if(n=this.textPath,m=this.node,n){n.attr({"xlink:href":"#"+o})}else{for(n=bf("textPath",{"xlink:href":"#"+o});m.firstChild;){n.appendChild(m.firstChild)}m.appendChild(n),this.textPath=aQ(n)}}}})(-1),e.on("snap.util.attr.text",function(j){if("text"==this.type){for(var m=this.node,l=function(n){var d=bf("tspan");if(be(n,"array")){for(var o=0;o<n.length;o++){d.appendChild(l(n[o]))}}else{d.appendChild(aw.doc.createTextNode(n))}return d.normalize&&d.normalize(),d};m.firstChild;){m.removeChild(m.firstChild)}for(var k=l(j);k.firstChild;){m.appendChild(k.firstChild)}}e.stop()})(-1);var aj={"alignment-baseline":0,"baseline-shift":0,clip:0,"clip-path":0,"clip-rule":0,color:0,"color-interpolation":0,"color-interpolation-filters":0,"color-profile":0,"color-rendering":0,cursor:0,direction:0,display:0,"dominant-baseline":0,"enable-background":0,fill:0,"fill-opacity":0,"fill-rule":0,filter:0,"flood-color":0,"flood-opacity":0,font:0,"font-family":0,"font-size":0,"font-size-adjust":0,"font-stretch":0,"font-style":0,"font-variant":0,"font-weight":0,"glyph-orientation-horizontal":0,"glyph-orientation-vertical":0,"image-rendering":0,kerning:0,"letter-spacing":0,"lighting-color":0,marker:0,"marker-end":0,"marker-mid":0,"marker-start":0,mask:0,opacity:0,overflow:0,"pointer-events":0,"shape-rendering":0,"stop-color":0,"stop-opacity":0,stroke:0,"stroke-dasharray":0,"stroke-dashoffset":0,"stroke-linecap":0,"stroke-linejoin":0,"stroke-miterlimit":0,"stroke-opacity":0,"stroke-width":0,"text-anchor":0,"text-decoration":0,"text-rendering":0,"unicode-bidi":0,visibility:0,"word-spacing":0,"writing-mode":0};e.on("snap.util.attr",function(j){var n=e.nt(),m={};n=n.substring(n.lastIndexOf(".")+1),m[n]=j;var l=n.replace(/-(\w)/gi,function(o,d){return d.toUpperCase()}),k=n.replace(/[A-Z]/g,function(d){return"-"+d.toLowerCase()});aj[av](k)?this.node.style[l]=null==j?al:j:bf(this.node,m)}),e.on("snap.util.getattr.transform",function(){return e.stop(),this.transform()})(-1),e.on("snap.util.getattr.textpath",function(){return e.stop(),this.textPath})(-1),function(){function d(k){return function(){e.stop();var l=aw.doc.defaultView.getComputedStyle(this.node,null).getPropertyValue("marker-"+k);return"none"==l?l:bg(aw.doc.getElementById(l.match(af)[1]))}}function j(k){return function(n){e.stop();var m="marker"+k.charAt(0).toUpperCase()+k.substring(1);if(""==n||!n){return void (this.node.style[m]="none")}if("marker"==n.type){var l=n.node.id;return l||bf(n.node,{id:n.id}),void (this.node.style[m]=aP(l))}}}e.on("snap.util.getattr.marker-end",d("end"))(-1),e.on("snap.util.getattr.markerEnd",d("end"))(-1),e.on("snap.util.getattr.marker-start",d("start"))(-1),e.on("snap.util.getattr.markerStart",d("start"))(-1),e.on("snap.util.getattr.marker-mid",d("mid"))(-1),e.on("snap.util.getattr.markerMid",d("mid"))(-1),e.on("snap.util.attr.marker-end",j("end"))(-1),e.on("snap.util.attr.markerEnd",j("end"))(-1),e.on("snap.util.attr.marker-start",j("start"))(-1),e.on("snap.util.attr.markerStart",j("start"))(-1),e.on("snap.util.attr.marker-mid",j("mid"))(-1),e.on("snap.util.attr.markerMid",j("mid"))(-1)}(),e.on("snap.util.getattr.r",function(){return"rect"==this.type&&bf(this.node,"rx")==bf(this.node,"ry")?(e.stop(),bf(this.node,"rx")):void 0})(-1),e.on("snap.util.getattr.text",function(){if("text"==this.type||"tspan"==this.type){e.stop();var d=ax(this.node);return 1==d.length?d[0]:d}})(-1),e.on("snap.util.getattr.#text",function(){return this.node.textContent})(-1),e.on("snap.util.getattr.viewBox",function(){e.stop();var d=bf(this.node,"viewBox").split(ac);return bg._.box(+d[0],+d[1],+d[2],+d[3])})(-1),e.on("snap.util.getattr.points",function(){var d=bf(this.node,"points");return e.stop(),d.split(ac)}),e.on("snap.util.getattr.path",function(){var d=bf(this.node,"d");return e.stop(),d}),e.on("snap.util.getattr",function(){var d=e.nt();d=d.substring(d.lastIndexOf(".")+1);var j=d.replace(/[A-Z]/g,function(k){return"-"+k.toLowerCase()});return aj[av](j)?aw.doc.defaultView.getComputedStyle(this.node,null).getPropertyValue(j):bf(this.node,d)});var a0=function(s){var r=s.getBoundingClientRect(),q=s.ownerDocument,p=q.body,o=q.documentElement,n=o.clientTop||p.clientTop||0,m=o.clientLeft||p.clientLeft||0,l=r.top+(g.win.pageYOffset||o.scrollTop||p.scrollTop)-n,k=r.left+(g.win.pageXOffset||o.scrollLeft||p.scrollLeft)-m;return{y:l,x:k}};return bg.getElementByPoint=function(k,j){var p=this,o=(p.canvas,aw.doc.elementFromPoint(k,j));if(aw.win.opera&&"svg"==o.tagName){var n=a0(o),m=o.createSVGRect();m.x=k-n.x,m.y=j-n.y,m.width=m.height=1;var l=o.getIntersectionList(m,null);l.length&&(o=l[l.length-1])}return o?aQ(o):null},bg.plugin=function(d){d(bg,aY,aS,aw)},aw.win.Snap=bg,bg}();return h.plugin(function(aY,aX){function aW(d){var c=aW.ps=aW.ps||{};return c[d]?c[d].sleep=100:c[d]={sleep:100},setTimeout(function(){for(var a in c){c[am](a)&&a!=d&&(c[a].sleep--,!c[a].sleep&&delete c[a])}}),c[d]}function aV(k,j,m,l){return null==k&&(k=j=m=l=0),null==j&&(j=k.y,m=k.width,l=k.height,k=k.x),{x:k,y:j,width:m,w:m,height:l,h:l,x2:k+m,y2:j+l,cx:k+m/2,cy:j+l/2,r1:aj.min(m,l)/2,r2:aj.max(m,l)/2,r0:aj.sqrt(m*m+l*l)/2,path:aC(k,j,m,l),vb:[k,j,m,l].join(" ")}}function aU(){return this.join(",").replace(al,"$1")}function aT(d){var c=an(d);return c.toString=aU,c}function aS(s,r,q,p,o,n,m,l,k){return null==k?aL(s,r,q,p,o,n,m,l):aQ(s,r,q,p,o,n,m,l,aK(s,r,q,p,o,n,m,l,k))}function aR(j,b){function a(c){return +(+c).toFixed(3)}return aY._.cacher(function(C,B,A){C instanceof aX&&(C=C.attr("d")),C=at(C);for(var z,y,x,w,v,u="",t={},d=0,c=0,D=C.length;D>c;c++){if(x=C[c],"M"==x[0]){z=+x[1],y=+x[2]}else{if(w=aS(z,y,x[1],x[2],x[3],x[4],x[5],x[6]),d+w>B){if(b&&!t.start){if(v=aS(z,y,x[1],x[2],x[3],x[4],x[5],x[6],B-d),u+=["C"+a(v.start.x),a(v.start.y),a(v.m.x),a(v.m.y),a(v.x),a(v.y)],A){return u}t.start=u,u=["M"+a(v.x),a(v.y)+"C"+a(v.n.x),a(v.n.y),a(v.end.x),a(v.end.y),a(x[5]),a(x[6])].join(),d+=w,z=+x[5],y=+x[6];continue}if(!j&&!b){return v=aS(z,y,x[1],x[2],x[3],x[4],x[5],x[6],B-d)}}d+=w,z=+x[5],y=+x[6]}u+=x.shift()+x}return t.end=u,v=j?d:b?t:aQ(z,y,x[0],x[1],x[2],x[3],x[4],x[5],1)},null,aY._.clone)}function aQ(X,W,V,U,T,S,R,Q,P){var O=1-P,N=af(O,3),M=af(O,2),L=P*P,K=L*P,J=N*X+3*M*P*V+3*O*P*P*T+K*R,I=N*W+3*M*P*U+3*O*P*P*S+K*Q,H=X+2*P*(V-X)+L*(T-2*V+X),G=W+2*P*(U-W)+L*(S-2*U+W),F=V+2*P*(T-V)+L*(R-2*T+V),E=U+2*P*(S-U)+L*(Q-2*S+U),D=O*X+P*V,C=O*W+P*U,B=O*T+P*R,A=O*S+P*Q,z=90-180*aj.atan2(H-F,G-E)/ai;return{x:J,y:I,m:{x:H,y:G},n:{x:F,y:E},start:{x:D,y:C},end:{x:B,y:A},alpha:z}}function aP(r,q,p,o,n,m,l,d){aY.is(r,"array")||(r=[r,q,p,o,n,m,l,d]);var a=au.apply(null,r);return aV(a.min.x,a.min.y,a.max.x-a.min.x,a.max.y-a.min.y)}function aO(j,d,k){return d>=j.x&&d<=j.x+j.width&&k>=j.y&&k<=j.y+j.height}function aN(d,c){return d=aV(d),c=aV(c),aO(c,d.x,d.y)||aO(c,d.x2,d.y)||aO(c,d.x,d.y2)||aO(c,d.x2,d.y2)||aO(d,c.x,c.y)||aO(d,c.x2,c.y)||aO(d,c.x,c.y2)||aO(d,c.x2,c.y2)||(d.x<c.x2&&d.x>c.x||c.x<d.x2&&c.x>d.x)&&(d.y<c.y2&&d.y>c.y||c.y<d.y2&&c.y>d.y)}function aM(k,j,p,o,n){var m=-3*j+9*p-9*o+3*n,l=k*m+6*j-12*p+6*o;return k*l-3*j+3*p}function aL(L,K,J,I,H,G,F,E,D){null==D&&(D=1),D=D>1?1:0>D?0:D;for(var C=D/2,B=12,A=[-0.1252,0.1252,-0.3678,0.3678,-0.5873,0.5873,-0.7699,0.7699,-0.9041,0.9041,-0.9816,0.9816],z=[0.2491,0.2491,0.2335,0.2335,0.2032,0.2032,0.1601,0.1601,0.1069,0.1069,0.0472,0.0472],y=0,x=0;B>x;x++){var w=C*A[x]+C,v=aM(w,L,J,H,F),u=aM(w,K,I,G,E),m=v*v+u*u;y+=z[x]*aj.sqrt(m)}return C*y}function aK(B,A,z,y,x,w,v,u,t){if(!(0>t||aL(B,A,z,y,x,w,v,u)<t)){var s,r=1,q=r/2,p=r-q,n=0.01;for(s=aL(B,A,z,y,x,w,v,u,p);ae(s-t)>n;){q/=2,p+=(t>s?1:-1)*q,s=aL(B,A,z,y,x,w,v,u,p)}return p}}function aJ(D,C,B,A,z,y,x,w){if(!(ag(D,B)<ah(z,x)||ah(D,B)>ag(z,x)||ag(C,A)<ah(y,w)||ah(C,A)>ag(y,w))){var v=(D*A-C*B)*(z-x)-(D-B)*(z*w-y*x),u=(D*A-C*B)*(y-w)-(C-A)*(z*w-y*x),t=(D-B)*(y-w)-(C-A)*(z-x);if(t){var s=v/t,r=u/t,q=+s.toFixed(2),p=+r.toFixed(2);if(!(q<+ah(D,B).toFixed(2)||q>+ag(D,B).toFixed(2)||q<+ah(z,x).toFixed(2)||q>+ag(z,x).toFixed(2)||p<+ah(C,A).toFixed(2)||p>+ag(C,A).toFixed(2)||p<+ah(y,w).toFixed(2)||p>+ag(y,w).toFixed(2))){return{x:s,y:r}}}}}function aI(Y,X,W){var V=aP(Y),U=aP(X);if(!aN(V,U)){return W?0:[]}for(var T=aL.apply(0,Y),S=aL.apply(0,X),R=~~(T/5),Q=~~(S/5),P=[],O=[],M={},K=W?0:[],I=0;R+1>I;I++){var G=aQ.apply(0,Y.concat(I/R));P.push({x:G.x,y:G.y,t:I/R})}for(I=0;Q+1>I;I++){G=aQ.apply(0,X.concat(I/Q)),O.push({x:G.x,y:G.y,t:I/Q})}for(I=0;R>I;I++){for(var F=0;Q>F;F++){var E=P[I],p=P[I+1],n=O[F],l=O[F+1],j=ae(p.x-E.x)<0.001?"y":"x",N=ae(l.x-n.x)<0.001?"y":"x",L=aJ(E.x,E.y,p.x,p.y,n.x,n.y,l.x,l.y);if(L){if(M[L.x.toFixed(4)]==L.y.toFixed(4)){continue}M[L.x.toFixed(4)]=L.y.toFixed(4);var J=E.t+ae((L[j]-E[j])/(p[j]-E[j]))*(p.t-E.t),H=n.t+ae((L[N]-n[N])/(l[N]-n[N]))*(l.t-n.t);J>=0&&1>=J&&H>=0&&1>=H&&(W?K++:K.push({x:L.x,y:L.y,t1:J,t2:H}))}}}return K}function aH(d,c){return aF(d,c)}function aG(d,c){return aF(d,c,1)}function aF(T,S,R){T=at(T),S=at(S);for(var Q,P,O,N,M,L,K,J,I,H,G=R?0:[],F=0,E=T.length;E>F;F++){var D=T[F];if("M"==D[0]){Q=M=D[1],P=L=D[2]}else{"C"==D[0]?(I=[Q,P].concat(D.slice(1)),Q=I[6],P=I[7]):(I=[Q,P,Q,P,M,L,M,L],Q=M,P=L);for(var C=0,B=S.length;B>C;C++){var A=S[C];if("M"==A[0]){O=K=A[1],N=J=A[2]}else{"C"==A[0]?(H=[O,N].concat(A.slice(1)),O=H[6],N=H[7]):(H=[O,N,O,N,K,J,K,J],O=K,N=J);var z=aI(I,H,R);if(R){G+=z}else{for(var y=0,q=z.length;q>y;y++){z[y].segment1=F,z[y].segment2=C,z[y].bez1=I,z[y].bez2=H}G=G.concat(z)}}}}}return G}function aE(k,j,m){var l=aD(k);return aO(l,j,m)&&aF(k,[["M",j,m],["H",l.x2+10]],1)%2==1}function aD(D){var C=aW(D);if(C.bbox){return an(C.bbox)}if(!D){return aV()}D=at(D);for(var B,A=0,z=0,y=[],x=[],w=0,v=D.length;v>w;w++){if(B=D[w],"M"==B[0]){A=B[1],z=B[2],y.push(A),x.push(z)}else{var u=au(A,z,B[1],B[2],B[3],B[4],B[5],B[6]);y=y.concat(u.min.x,u.max.x),x=x.concat(u.min.y,u.max.y),A=B[5],z=B[6]}}var t=ah.apply(0,y),s=ah.apply(0,x),r=ag.apply(0,y),d=ag.apply(0,x),c=aV(t,s,r-t,d-s);return C.bbox=an(c),c}function aC(k,j,o,n,m){if(m){return[["M",k+m,j],["l",o-2*m,0],["a",m,m,0,0,1,m,m],["l",0,n-2*m],["a",m,m,0,0,1,-m,m],["l",2*m-o,0],["a",m,m,0,0,1,-m,-m],["l",0,2*m-n],["a",m,m,0,0,1,m,-m],["z"]]}var l=[["M",k,j],["l",o,0],["l",0,n],["l",-o,0],["z"]];return l.toString=aU,l}function aB(w,v,u,t,s){if(null==s&&null==t&&(t=u),null!=s){var r=Math.PI/180,q=w+u*Math.cos(-t*r),p=w+u*Math.cos(-s*r),o=v+u*Math.sin(-t*r),n=v+u*Math.sin(-s*r),m=[["M",q,o],["A",u,u,0,+(s-t>180),0,p,n]]}else{m=[["M",w,v],["m",0,-t],["a",u,t,0,1,1,0,2*t],["a",u,t,0,1,1,0,-2*t],["z"]]}return m.toString=aU,m}function aA(L){var K=aW(L),J=String.prototype.toLowerCase;if(K.rel){return aT(K.rel)}aY.is(L,"array")&&aY.is(L&&L[0],"array")||(L=aY.parsePathString(L));var I=[],H=0,G=0,F=0,E=0,D=0;"M"==L[0][0]&&(H=L[0][1],G=L[0][2],F=H,E=G,D++,I.push(["M",H,G]));for(var C=D,B=L.length;B>C;C++){var A=I[C]=[],z=L[C];if(z[0]!=J.call(z[0])){switch(A[0]=J.call(z[0]),A[0]){case"a":A[1]=z[1],A[2]=z[2],A[3]=z[3],A[4]=z[4],A[5]=z[5],A[6]=+(z[6]-H).toFixed(3),A[7]=+(z[7]-G).toFixed(3);break;case"v":A[1]=+(z[1]-G).toFixed(3);break;case"m":F=z[1],E=z[2];default:for(var y=1,x=z.length;x>y;y++){A[y]=+(z[y]-(y%2?H:G)).toFixed(3)}}}else{A=I[C]=[],"m"==z[0]&&(F=z[1]+H,E=z[2]+G);for(var w=0,c=z.length;c>w;w++){I[C][w]=z[w]}}var a=I[C].length;switch(I[C][0]){case"z":H=F,G=E;break;case"h":H+=+I[C][a-1];break;case"v":G+=+I[C][a-1];break;default:H+=+I[C][a-2],G+=+I[C][a-1]}}return I.toString=aU,K.rel=aT(I),I}function az(N){var M=aW(N);if(M.abs){return aT(M.abs)}if(ao(N,"array")&&ao(N&&N[0],"array")||(N=aY.parsePathString(N)),!N||!N.length){return[["M",0,0]]}var L,K=[],J=0,I=0,H=0,G=0,F=0;"M"==N[0][0]&&(J=+N[0][1],I=+N[0][2],H=J,G=I,F++,K[0]=["M",J,I]);for(var E,D,C=3==N.length&&"M"==N[0][0]&&"R"==N[1][0].toUpperCase()&&"Z"==N[2][0].toUpperCase(),B=F,A=N.length;A>B;B++){if(K.push(E=[]),D=N[B],L=D[0],L!=L.toUpperCase()){switch(E[0]=L.toUpperCase(),E[0]){case"A":E[1]=D[1],E[2]=D[2],E[3]=D[3],E[4]=D[4],E[5]=D[5],E[6]=+(D[6]+J),E[7]=+(D[7]+I);break;case"V":E[1]=+D[1]+I;break;case"H":E[1]=+D[1]+J;break;case"R":for(var z=[J,I].concat(D.slice(1)),y=2,x=z.length;x>y;y++){z[y]=+z[y]+J,z[++y]=+z[y]+I}K.pop(),K=K.concat(aq(z,C));break;case"O":K.pop(),z=aB(J,I,D[1],D[2]),z.push(z[0]),K=K.concat(z);break;case"U":K.pop(),K=K.concat(aB(J,I,D[1],D[2],D[3])),E=["U"].concat(K[K.length-1].slice(-2));break;case"M":H=+D[1]+J,G=+D[2]+I;default:for(y=1,x=D.length;x>y;y++){E[y]=+D[y]+(y%2?J:I)}}}else{if("R"==L){z=[J,I].concat(D.slice(1)),K.pop(),K=K.concat(aq(z,C)),E=["R"].concat(D.slice(-2))}else{if("O"==L){K.pop(),z=aB(J,I,D[1],D[2]),z.push(z[0]),K=K.concat(z)}else{if("U"==L){K.pop(),K=K.concat(aB(J,I,D[1],D[2],D[3])),E=["U"].concat(K[K.length-1].slice(-2))}else{for(var c=0,a=D.length;a>c;c++){E[c]=D[c]}}}}}if(L=L.toUpperCase(),"O"!=L){switch(E[0]){case"Z":J=H,I=G;break;case"H":J=E[1];break;case"V":I=E[1];break;case"M":H=E[E.length-2],G=E[E.length-1];default:J=E[E.length-2],I=E[E.length-1]}}}return K.toString=aU,M.abs=aT(K),K}function ay(k,j,m,l){return[k,j,m,l,m,l]}function ax(k,j,q,p,o,n){var m=1/3,l=2/3;return[m*k+l*q,m*j+l*p,m*o+l*q,m*n+l*p,o,n]}function aw(bx,bw,bv,bu,bt,bs,br,bq,bp,bo){var bn,bm=120*ai/180,bl=ai/180*(+bt||0),bk=[],bj=aY._.cacher(function(k,j,n){var m=k*aj.cos(n)-j*aj.sin(n),l=k*aj.sin(n)+j*aj.cos(n);return{x:m,y:l}});if(bo){ba=bo[0],a9=bo[1],bc=bo[2],bb=bo[3]}else{bn=bj(bx,bw,-bl),bx=bn.x,bw=bn.y,bn=bj(bq,bp,-bl),bq=bn.x,bp=bn.y;var bi=(aj.cos(ai/180*bt),aj.sin(ai/180*bt),(bx-bq)/2),bh=(bw-bp)/2,bg=bi*bi/(bv*bv)+bh*bh/(bu*bu);bg>1&&(bg=aj.sqrt(bg),bv=bg*bv,bu=bg*bu);var bf=bv*bv,be=bu*bu,bd=(bs==br?-1:1)*aj.sqrt(ae((bf*be-bf*bh*bh-be*bi*bi)/(bf*bh*bh+be*bi*bi))),bc=bd*bv*bh/bu+(bx+bq)/2,bb=bd*-bu*bi/bv+(bw+bp)/2,ba=aj.asin(((bw-bb)/bu).toFixed(9)),a9=aj.asin(((bp-bb)/bu).toFixed(9));ba=bc>bx?ai-ba:ba,a9=bc>bq?ai-a9:a9,0>ba&&(ba=2*ai+ba),0>a9&&(a9=2*ai+a9),br&&ba>a9&&(ba-=2*ai),!br&&a9>ba&&(a9-=2*ai)}var a8=a9-ba;if(ae(a8)>bm){var a7=a9,a6=bq,a5=bp;a9=ba+bm*(br&&a9>ba?1:-1),bq=bc+bv*aj.cos(a9),bp=bb+bu*aj.sin(a9),bk=aw(bq,bp,bv,bu,bt,0,br,a6,a5,[a9,a7,bc,bb])}a8=a9-ba;var a4=aj.cos(ba),a3=aj.sin(ba),a2=aj.cos(a9),a1=aj.sin(a9),a0=aj.tan(a8/4),aZ=4/3*bv*a0,Y=4/3*bu*a0,X=[bx,bw],W=[bx+aZ*a3,bw-Y*a4],T=[bq+aZ*a1,bp-Y*a2],P=[bq,bp];if(W[0]=2*X[0]-W[0],W[1]=2*X[1]-W[1],bo){return[W,T,P].concat(bk)}bk=[W,T,P].concat(bk).join().split(",");for(var O=[],C=0,a=bk.length;a>C;C++){O[C]=C%2?bj(bk[C-1],bk[C],bl).y:bj(bk[C],bk[C+1],bl).x}return O}function av(t,s,r,q,p,o,n,m,l){var k=1-l;return{x:af(k,3)*t+3*af(k,2)*l*r+3*k*l*l*p+af(l,3)*n,y:af(k,3)*s+3*af(k,2)*l*q+3*k*l*l*o+af(l,3)*m}}function au(F,E,D,C,B,A,z,y){var x,w=B-2*D+F-(z-2*B+D),v=2*(D-F)-2*(B-D),u=F-D,t=(-v+aj.sqrt(v*v-4*w*u))/2/w,s=(-v-aj.sqrt(v*v-4*w*u))/2/w,r=[E,y],q=[F,z];return ae(t)>"1e12"&&(t=0.5),ae(s)>"1e12"&&(s=0.5),t>0&&1>t&&(x=av(F,E,D,C,B,A,z,y,t),q.push(x.x),r.push(x.y)),s>0&&1>s&&(x=av(F,E,D,C,B,A,z,y,s),q.push(x.x),r.push(x.y)),w=A-2*C+E-(y-2*A+C),v=2*(C-E)-2*(A-C),u=E-C,t=(-v+aj.sqrt(v*v-4*w*u))/2/w,s=(-v-aj.sqrt(v*v-4*w*u))/2/w,ae(t)>"1e12"&&(t=0.5),ae(s)>"1e12"&&(s=0.5),t>0&&1>t&&(x=av(F,E,D,C,B,A,z,y,t),q.push(x.x),r.push(x.y)),s>0&&1>s&&(x=av(F,E,D,C,B,A,z,y,s),q.push(x.x),r.push(x.y)),{min:{x:ah.apply(0,q),y:ah.apply(0,r)},max:{x:ag.apply(0,q),y:ag.apply(0,r)}}}function at(G,F){var E=!F&&aW(G);if(!F&&E.curve){return aT(E.curve)}for(var D=az(G),C=F&&az(F),B={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},A={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},z=(function(k,j){var m,l;if(!k){return["C",j.x,j.y,j.x,j.y,j.x,j.y]}switch(!(k[0] in {T:1,Q:1})&&(j.qx=j.qy=null),k[0]){case"M":j.X=k[1],j.Y=k[2];break;case"A":k=["C"].concat(aw.apply(0,[j.x,j.y].concat(k.slice(1))));break;case"S":m=j.x+(j.x-(j.bx||j.x)),l=j.y+(j.y-(j.by||j.y)),k=["C",m,l].concat(k.slice(1));break;case"T":j.qx=j.x+(j.x-(j.qx||j.x)),j.qy=j.y+(j.y-(j.qy||j.y)),k=["C"].concat(ax(j.x,j.y,j.qx,j.qy,k[1],k[2]));break;case"Q":j.qx=k[1],j.qy=k[2],k=["C"].concat(ax(j.x,j.y,k[1],k[2],k[3],k[4]));break;case"L":k=["C"].concat(ay(j.x,j.y,k[1],k[2]));break;case"H":k=["C"].concat(ay(j.x,j.y,k[1],j.y));break;case"V":k=["C"].concat(ay(j.x,j.y,j.x,k[1]));break;case"Z":k=["C"].concat(ay(j.x,j.y,j.X,j.Y))}return k}),y=function(j,d){if(j[d].length>7){j[d].shift();for(var k=j[d];k.length;){j.splice(d++,0,["C"].concat(k.splice(0,6)))}j.splice(d,1),v=ag(D.length,C&&C.length||0)}},x=function(k,j,n,m,l){k&&j&&"M"==k[l][0]&&"M"!=j[l][0]&&(j.splice(l,0,["M",m.x,m.y]),n.bx=0,n.by=0,n.x=k[l][1],n.y=k[l][2],v=ag(D.length,C&&C.length||0))},w=0,v=ag(D.length,C&&C.length||0);v>w;w++){D[w]=z(D[w],B),y(D,w),C&&(C[w]=z(C[w],A)),C&&y(C,w),x(D,C,B,A,w),x(C,D,A,B,w);var u=D[w],t=C&&C[w],s=u.length,c=C&&t.length;B.x=u[s-2],B.y=u[s-1],B.bx=ak(u[s-4])||B.x,B.by=ak(u[s-3])||B.y,A.bx=C&&(ak(t[c-4])||A.x),A.by=C&&(ak(t[c-3])||A.y),A.x=C&&t[c-2],A.y=C&&t[c-1]}return C||(E.curve=aT(D)),C?[D,C]:D}function ar(r,q){if(!q){return r}var p,o,n,m,l,k,j;for(r=at(r),n=0,l=r.length;l>n;n++){for(j=r[n],m=1,k=j.length;k>m;m+=2){p=q.x(j[m],j[m+1]),o=q.y(j[m],j[m+1]),j[m]=p,j[m+1]=o}}return r}function aq(k,j){for(var o=[],n=0,m=k.length;m-2*!j>n;n+=2){var l=[{x:+k[n-2],y:+k[n-1]},{x:+k[n],y:+k[n+1]},{x:+k[n+2],y:+k[n+3]},{x:+k[n+4],y:+k[n+5]}];j?n?m-4==n?l[3]={x:+k[0],y:+k[1]}:m-2==n&&(l[2]={x:+k[0],y:+k[1]},l[3]={x:+k[2],y:+k[3]}):l[0]={x:+k[m-2],y:+k[m-1]}:m-4==n?l[3]=l[2]:n||(l[0]={x:+k[n],y:+k[n+1]}),o.push(["C",(-l[0].x+6*l[1].x+l[2].x)/6,(-l[0].y+6*l[1].y+l[2].y)/6,(l[1].x+6*l[2].x-l[3].x)/6,(l[1].y+6*l[2].y-l[3].y)/6,l[2].x,l[2].y])}return o}var ap=aX.prototype,ao=aY.is,an=aY._.clone,am="hasOwnProperty",al=/,?([a-z]),?/gi,ak=parseFloat,aj=Math,ai=aj.PI,ah=aj.min,ag=aj.max,af=aj.pow,ae=aj.abs,ad=aR(1),ac=aR(),ab=aR(0,1),aa=aY._unit2px,Z={path:function(b){return b.attr("path")},circle:function(d){var c=aa(d);return aB(c.cx,c.cy,c.r)},ellipse:function(d){var c=aa(d);return aB(c.cx,c.cy,c.rx,c.ry)},rect:function(d){var c=aa(d);return aC(c.x,c.y,c.width,c.height,c.rx,c.ry)},image:function(d){var c=aa(d);return aC(c.x,c.y,c.width,c.height)},text:function(d){var c=d.node.getBBox();return aC(c.x,c.y,c.width,c.height)},g:function(d){var c=d.node.getBBox();return aC(c.x,c.y,c.width,c.height)},symbol:function(d){var c=d.getBBox();return aC(c.x,c.y,c.width,c.height)},line:function(b){return"M"+[b.attr("x1"),b.attr("y1"),b.attr("x2"),b.attr("y2")]},polyline:function(b){return"M"+b.attr("points")},polygon:function(b){return"M"+b.attr("points")+"z"},svg:function(d){var c=d.node.getBBox();return aC(c.x,c.y,c.width,c.height)},deflt:function(d){var c=d.node.getBBox();return aC(c.x,c.y,c.width,c.height)}};aY.path=aW,aY.path.getTotalLength=ad,aY.path.getPointAtLength=ac,aY.path.getSubpath=function(k,j,m){if(this.getTotalLength(k)-m<0.000001){return ab(k,j).end}var l=ab(k,m,1);return j?ab(l,j).end:l},ap.getTotalLength=function(){return this.node.getTotalLength?this.node.getTotalLength():void 0},ap.getPointAtLength=function(b){return ac(this.attr("d"),b)},ap.getSubpath=function(a,d){return aY.path.getSubpath(this.attr("d"),a,d)},aY._.box=aV,aY.path.findDotsAtSegment=aQ,aY.path.bezierBBox=aP,aY.path.isPointInsideBBox=aO,aY.path.isBBoxIntersect=aN,aY.path.intersection=aH,aY.path.intersectionNumber=aG,aY.path.isPointInside=aE,aY.path.getBBox=aD,aY.path.get=Z,aY.path.toRelative=aA,aY.path.toAbsolute=az,aY.path.toCubic=at,aY.path.map=ar,aY.path.toString=aU,aY.path.clone=aT}),h.plugin(function(k){var j=Math.max,n=Math.min,m=function(o){if(this.items=[],this.length=0,this.type="set",o){for(var d=0,p=o.length;p>d;d++){o[d]&&(this[this.items.length]=this.items[this.items.length]=o[d],this.length++)}}},l=m.prototype;l.push=function(){for(var p,o,r=0,q=arguments.length;q>r;r++){p=arguments[r],p&&(o=this.items.length,this[o]=this.items[o]=p,this.length++)}return this},l.pop=function(){return this.length&&delete this[this.length--],this.items.pop()},l.forEach=function(p,o){for(var r=0,q=this.items.length;q>r;r++){if(p.call(o,this.items[r],r)===!1){return this}}return this},l.remove=function(){for(;this.length;){this.pop().remove()}return this},l.attr=function(o){for(var d=0,p=this.items.length;p>d;d++){this.items[d].attr(o)}return this},l.clear=function(){for(;this.length;){this.pop()}},l.splice=function(b,r){b=0>b?j(this.length+b,0):b,r=j(0,n(this.length-b,r));var q,p=[],o=[],d=[];for(q=2;q<arguments.length;q++){d.push(arguments[q])}for(q=0;r>q;q++){o.push(this[b+q])}for(;q<this.length-b;q++){p.push(this[b+q])}var c=d.length;for(q=0;q<c+p.length;q++){this.items[b+q]=this[b+q]=c>q?d[q]:p[q-c]}for(q=this.items.length=this.length-=r-c;this[q];){delete this[q++]}return new m(o)},l.exclude=function(o){for(var d=0,p=this.length;p>d;d++){if(this[d]==o){return this.splice(d,1),!0}}return !1},l.insertAfter=function(d){for(var c=this.items.length;c--;){this.items[c].insertAfter(d)}return this},l.getBBox=function(){for(var b=[],r=[],q=[],p=[],o=this.items.length;o--;){if(!this.items[o].removed){var c=this.items[o].getBBox();b.push(c.x),r.push(c.y),q.push(c.x+c.width),p.push(c.y+c.height)}}return b=n.apply(0,b),r=n.apply(0,r),q=j.apply(0,q),p=j.apply(0,p),{x:b,y:r,x2:q,y2:p,width:q-b,height:p-r,cx:b+(q-b)/2,cy:r+(p-r)/2}},l.clone=function(o){o=new m;for(var d=0,p=this.items.length;p>d;d++){o.push(this.items[d].clone())}return o},l.toString=function(){return"Snap‘s set"},l.type="set",k.set=function(){var b=new m;return arguments.length&&b.push.apply(b,Array.prototype.slice.call(arguments,0)),b}}),h.plugin(function(x,w){function v(d){var c=d[0];switch(c.toLowerCase()){case"t":return[c,0,0];case"m":return[c,1,0,0,1,0,0];case"r":return 4==d.length?[c,0,d[2],d[3]]:[c,0];case"s":return 5==d.length?[c,1,1,d[3],d[4]]:3==d.length?[c,1,1]:[c,1]}}function u(F,E,D){E=m(E).replace(/\.{3}|\u2026/g,F),F=x.parseTransformString(F)||[],E=x.parseTransformString(E)||[];for(var C,B,A,z,y=Math.max(F.length,E.length),l=[],c=[],a=0;y>a;a++){if(A=F[a]||v(E[a]),z=E[a]||v(A),A[0]!=z[0]||"r"==A[0].toLowerCase()&&(A[2]!=z[2]||A[3]!=z[3])||"s"==A[0].toLowerCase()&&(A[3]!=z[3]||A[4]!=z[4])){F=x._.transform2matrix(F,D()),E=x._.transform2matrix(E,D()),l=[["m",F.a,F.b,F.c,F.d,F.e,F.f]],c=[["m",E.a,E.b,E.c,E.d,E.e,E.f]];break}for(l[a]=[],c[a]=[],C=0,B=Math.max(A.length,z.length);B>C;C++){C in A&&(l[a][C]=A[C]),C in z&&(c[a][C]=z[C])}}return{from:p(l),to:p(c),f:q(l)}}function t(b){return b}function s(b){return function(a){return +a.toFixed(3)+b}}function r(a){return x.rgb(a[0],a[1],a[2])}function q(D){var C,B,A,z,y,l,k=0,j=[];for(C=0,B=D.length;B>C;C++){for(y="[",l=['"'+D[C][0]+'"'],A=1,z=D[C].length;z>A;A++){l[A]="val["+k+++"]"}y+=l+"]",j[C]=y}return Function("val","return Snap.path.toString.call(["+j+"])")}function p(k){for(var j=[],A=0,z=k.length;z>A;A++){for(var y=1,l=k[A].length;l>y;y++){j.push(k[A][y])}}return j}var o={},n=/[a-z]+$/i,m=String;o.stroke=o.fill="colour",w.prototype.equal=function(d,A){var a,z,y=m(this.attr(d)||""),l=this;if(y==+y&&A==+A){return{from:+y,to:+A,f:t}}if("colour"==o[d]){return a=x.color(y),z=x.color(A),{from:[a.r,a.g,a.b,a.opacity],to:[z.r,z.g,z.b,z.opacity],f:r}}if("transform"==d||"gradientTransform"==d||"patternTransform"==d){return A instanceof x.Matrix&&(A=A.toTransformString()),x._.rgTransform.test(A)||(A=x._.svgTransform2string(A)),u(y,A,function(){return l.getBBox(1)})}if("d"==d||"path"==d){return a=x.path.toCubic(y,A),{from:p(a[0]),to:p(a[1]),f:q(a[0])}}if("points"==d){return a=m(y).split(","),z=m(A).split(","),{from:a,to:z,f:function(b){return b}}}var k=y.match(n),j=m(A).match(n);return k&&k==j?{from:parseFloat(y),to:parseFloat(A),f:s(k)}:{from:this.asPX(d),to:this.asPX(d,A),f:t}}}),h.plugin(function(N,M,L,K){for(var J=M.prototype,I="hasOwnProperty",H=("createTouch" in K.doc),G=["click","dblclick","mousedown","mousemove","mouseout","mouseover","mouseup","touchstart","touchmove","touchend","touchcancel"],F={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},E=function(d){var c="y"==d?"scrollTop":"scrollLeft";return K.doc.documentElement[c]||K.doc.body[c]},D=function(){this.returnValue=!1},C=function(){return this.originalEvent.preventDefault()},B=function(){this.cancelBubble=!0},A=function(){return this.originalEvent.stopPropagation()},z=function(){return K.doc.addEventListener?function(k,j,o,n){var m=H&&F[j]?F[j]:j,l=function(O){var t=E("y"),c=E("x");if(H&&F[I](j)){for(var a=0,P=O.targetTouches&&O.targetTouches.length;P>a;a++){if(O.targetTouches[a].target==k||k.contains(O.targetTouches[a].target)){var u=O;O=O.targetTouches[a],O.originalEvent=u,O.preventDefault=C,O.stopPropagation=A;break}}}var s=O.clientX+c,d=O.clientY+t;return o.call(n,O,s,d)};return j!==m&&k.addEventListener(j,l,!1),k.addEventListener(m,l,!1),function(){return j!==m&&k.removeEventListener(j,l,!1),k.removeEventListener(m,l,!1),!0}}:K.doc.attachEvent?function(k,j,o,n){var m=function(d){d=d||K.win.event;var c=E("y"),r=E("x"),q=d.clientX+r,p=d.clientY+c;return d.preventDefault=d.preventDefault||D,d.stopPropagation=d.stopPropagation||B,o.call(n,d,q,p)};k.attachEvent("on"+j,m);var l=function(){return k.detachEvent("on"+j,m),!0};return l}:void 0}(),y=[],x=function(O){for(var u,t=O.clientX,s=O.clientY,r=E("y"),q=E("x"),p=y.length;p--;){if(u=y[p],H){for(var o,k=O.touches&&O.touches.length;k--;){if(o=O.touches[k],o.identifier==u.el._drag.id||u.el.node.contains(o.target)){t=o.clientX,s=o.clientY,(O.originalEvent?O.originalEvent:O).preventDefault();break}}}else{O.preventDefault()}var a=u.el.node;N._.glob,a.nextSibling,a.parentNode,a.style.display;t+=q,s+=r,e("snap.drag.move."+u.el.id,u.move_scope||u.el,t-u.el._drag.x,s-u.el._drag.y,t,s,O)}},w=function(k){N.unmousemove(x).unmouseup(w);for(var j,a=y.length;a--;){j=y[a],j.el._drag={},e("snap.drag.end."+j.el.id,j.end_scope||j.start_scope||j.move_scope||j.el,k)}y=[]},v=G.length;v--;){!function(a){N[a]=J[a]=function(k,j){return N.is(k,"function")&&(this.events=this.events||[],this.events.push({name:a,f:k,unbind:z(this.shape||this.node||K.doc,a,k,j||this)})),this},N["un"+a]=J["un"+a]=function(j){for(var l=this.events||[],k=l.length;k--;){if(l[k].name==a&&(l[k].f==j||!j)){return l[k].unbind(),l.splice(k,1),!l.length&&delete this.events,this}}return this}}(G[v])}J.hover=function(k,j,m,l){return this.mouseover(k,m).mouseout(j,l||m)},J.unhover=function(d,c){return this.unmouseover(d).unmouseout(c)};var b=[];J.drag=function(q,p,o,n,m,l){function k(r,d,c){(r.originalEvent||r).preventDefault(),this._drag.x=d,this._drag.y=c,this._drag.id=r.identifier,!y.length&&N.mousemove(x).mouseup(w),y.push({el:this,move_scope:n,start_scope:m,end_scope:l}),p&&e.on("snap.drag.start."+this.id,p),q&&e.on("snap.drag.move."+this.id,q),o&&e.on("snap.drag.end."+this.id,o),e("snap.drag.start."+this.id,m||n||this,d,c,r)}if(!arguments.length){var a;return this.drag(function(d,c){this.attr({transform:a+(a?"T":"t")+[d,c]})},function(){a=this.transform().local})}return this._drag={},b.push({el:this,start:k}),this.mousedown(k),this},J.undrag=function(){for(var a=b.length;a--;){b[a].el==this&&(this.unmousedown(b[a].start),b.splice(a,1),e.unbind("snap.drag.*."+this.id))}return !b.length&&N.unmousemove(x).unmouseup(w),this}}),h.plugin(function(b,o,n){var m=(o.prototype,n.prototype),l=/^\s*url\((.+)\)/,k=String,j=b._.$;b.filter={},m.filter=function(a){var r=this;"svg"!=r.type&&(r=r.paper);var q=b.parse(k(a)),p=b._.id(),c=(r.node.offsetWidth,r.node.offsetHeight,j("filter"));return j(c,{id:p,filterUnits:"userSpaceOnUse"}),c.appendChild(q.node),r.defs.appendChild(c),new o(c)},e.on("snap.util.getattr.filter",function(){e.stop();var p=j(this.node,"filter");if(p){var a=k(p).match(l);return a&&b.select(a[1])}}),e.on("snap.util.attr.filter",function(c){if(c instanceof o&&"filter"==c.type){e.stop();var a=c.node.id;a||(j(c.node,{id:c.id}),a=c.id),j(this.node,{filter:b.url(a)})}c&&"none"!=c||(e.stop(),this.node.removeAttribute("filter"))}),b.filter.blur=function(a,q){null==a&&(a=2);var p=null==q?a:[a,q];return b.format('<feGaussianBlur stdDeviation="{def}"/>',{def:p})},b.filter.blur.toString=function(){return this()},b.filter.shadow=function(a,r,q,p){return p=p||"#000",null==q&&(q=4),"string"==typeof q&&(p=q,q=4),null==a&&(a=0,r=2),null==r&&(r=a),p=b.color(p),b.format('<feGaussianBlur in="SourceAlpha" stdDeviation="{blur}"/><feOffset dx="{dx}" dy="{dy}" result="offsetblur"/><feFlood flood-color="{color}"/><feComposite in2="offsetblur" operator="in"/><feMerge><feMergeNode/><feMergeNode in="SourceGraphic"/></feMerge>',{color:p,dx:a,dy:r,blur:q})},b.filter.shadow.toString=function(){return this()},b.filter.grayscale=function(a){return null==a&&(a=1),b.format('<feColorMatrix type="matrix" values="{a} {b} {c} 0 0 {d} {e} {f} 0 0 {g} {b} {h} 0 0 0 0 0 1 0"/>',{a:0.2126+0.7874*(1-a),b:0.7152-0.7152*(1-a),c:0.0722-0.0722*(1-a),d:0.2126-0.2126*(1-a),e:0.7152+0.2848*(1-a),f:0.0722-0.0722*(1-a),g:0.2126-0.2126*(1-a),h:0.0722+0.9278*(1-a)})},b.filter.grayscale.toString=function(){return this()},b.filter.sepia=function(a){return null==a&&(a=1),b.format('<feColorMatrix type="matrix" values="{a} {b} {c} 0 0 {d} {e} {f} 0 0 {g} {h} {i} 0 0 0 0 0 1 0"/>',{a:0.393+0.607*(1-a),b:0.769-0.769*(1-a),c:0.189-0.189*(1-a),d:0.349-0.349*(1-a),e:0.686+0.314*(1-a),f:0.168-0.168*(1-a),g:0.272-0.272*(1-a),h:0.534-0.534*(1-a),i:0.131+0.869*(1-a)})},b.filter.sepia.toString=function(){return this()},b.filter.saturate=function(a){return null==a&&(a=1),b.format('<feColorMatrix type="saturate" values="{amount}"/>',{amount:1-a})},b.filter.saturate.toString=function(){return this()},b.filter.hueRotate=function(a){return a=a||0,b.format('<feColorMatrix type="hueRotate" values="{angle}"/>',{angle:a})},b.filter.hueRotate.toString=function(){return this()},b.filter.invert=function(a){return null==a&&(a=1),b.format('<feComponentTransfer><feFuncR type="table" tableValues="{amount} {amount2}"/><feFuncG type="table" tableValues="{amount} {amount2}"/><feFuncB type="table" tableValues="{amount} {amount2}"/></feComponentTransfer>',{amount:a,amount2:1-a})},b.filter.invert.toString=function(){return this()},b.filter.brightness=function(a){return null==a&&(a=1),b.format('<feComponentTransfer><feFuncR type="linear" slope="{amount}"/><feFuncG type="linear" slope="{amount}"/><feFuncB type="linear" slope="{amount}"/></feComponentTransfer>',{amount:a})},b.filter.brightness.toString=function(){return this()},b.filter.contrast=function(a){return null==a&&(a=1),b.format('<feComponentTransfer><feFuncR type="linear" slope="{amount}" intercept="{amount2}"/><feFuncG type="linear" slope="{amount}" intercept="{amount2}"/><feFuncB type="linear" slope="{amount}" intercept="{amount2}"/></feComponentTransfer>',{amount:a,amount2:0.5-a/2})},b.filter.contrast.toString=function(){return this()}}),h}),function(v,u,t,s){function r(b){return("string"==typeof b||b instanceof String)&&(b=b.replace(/^['\\/"]+|(;\s?})+|['\\/"]+$/g,"")),b}var q=function(a){for(var d=a.length;d--;){0===v("head").has("."+a[d]).length&&v("head").append('<meta class="'+a[d]+'">')}};q(["foundation-mq-small","foundation-mq-medium","foundation-mq-large","foundation-mq-xlarge","foundation-mq-xxlarge","foundation-data-attribute-namespace"]),v(function(){"undefined"!=typeof FastClick&&"undefined"!=typeof t.body&&FastClick.attach(t.body)});var p=function(a,f){if("string"==typeof a){if(f){var c;return c=f.jquery?f[0]:f,v(c.querySelectorAll(a))}return v(t.querySelectorAll(a))}return v(a,f)},o=function(d){var c=[];return d||c.push("data"),this.namespace.length>0&&c.push(this.namespace),c.push(this.name),c.join("-")},q=function(a){for(var d=a.length;d--;){0===v("head").has("."+a[d]).length&&v("head").append('<meta class="'+a[d]+'">')}},n=function(f){for(var e=f.split("-"),i=e.length,h=[];i--;){0!==i?h.push(e[i]):this.namespace.length>0?h.push(this.namespace,e[i]):h.push(e[i])}return h.reverse().join("-")},m=function(a,i){var h=this,f=!p(this).data(this.attr_name(!0));return"string"==typeof a?this[a].call(this,i):void (p(this.scope).is("["+this.attr_name()+"]")?(p(this.scope).data(this.attr_name(!0)+"-init",v.extend({},this.settings,i||a,this.data_options(p(this.scope)))),f&&this.events(this.scope)):p("["+this.attr_name()+"]",this.scope).each(function(){var b=!p(this).data(h.attr_name(!0)+"-init");p(this).data(h.attr_name(!0)+"-init",v.extend({},h.settings,i||a,h.data_options(p(this)))),b&&h.events(this)}))},l=function(f,e){function i(){e(f[0])}function h(){if(this.one("load",i),/MSIE (\d+\.\d+);/.test(navigator.userAgent)){var d=this.attr("src"),c=d.match(/\?/)?"&":"?";c+="random="+(new Date).getTime(),this.attr("src",d+c)}}return f.attr("src")?void (f[0].complete||4===f[0].readyState?i():h.call(f)):void i()};u.matchMedia=u.matchMedia||function(i){var h,x=i.documentElement,w=x.firstElementChild||x.firstChild,k=i.createElement("body"),j=i.createElement("div");return j.id="mq-test-1",j.style.cssText="position:absolute;top:-100em",k.style.background="none",k.appendChild(j),function(b){return j.innerHTML='&shy;<style media="'+b+'"> #mq-test-1 { width: 42px; }</style>',x.insertBefore(k,w),h=42===j.offsetWidth,x.removeChild(k),{matches:h,media:b}}}(t),function(){function b(){w&&(i(b),jQuery.fx.tick())}for(var w,k=0,j=["webkit","moz"],i=u.requestAnimationFrame,h=u.cancelAnimationFrame;k<j.length&&!i;k++){i=u[j[k]+"RequestAnimationFrame"],h=h||u[j[k]+"CancelAnimationFrame"]||u[j[k]+"CancelRequestAnimationFrame"]}i?(u.requestAnimationFrame=i,u.cancelAnimationFrame=h,jQuery.fx.timer=function(a){a()&&jQuery.timers.push(a)&&!w&&(w=!0,b())},jQuery.fx.stop=function(){w=!1}):(u.requestAnimationFrame=function(d){var z=(new Date).getTime(),y=Math.max(0,16-(z-k)),x=u.setTimeout(function(){d(z+y)},y);return k=z+y,x},u.cancelAnimationFrame=function(c){clearTimeout(c)})}(jQuery),u.Foundation={name:"Foundation",version:"5.1.1",media_queries:{small:p(".foundation-mq-small").css("font-family").replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g,""),medium:p(".foundation-mq-medium").css("font-family").replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g,""),large:p(".foundation-mq-large").css("font-family").replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g,""),xlarge:p(".foundation-mq-xlarge").css("font-family").replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g,""),xxlarge:p(".foundation-mq-xxlarge").css("font-family").replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g,"")},stylesheet:v("<style></style>").appendTo("head")[0].sheet,global:{namespace:""},init:function(k,j,B,A,z){var y=[k,B,A,z],x=[];if(this.rtl=/rtl/i.test(p("html").attr("dir")),this.scope=k||this.scope,this.set_namespace(),j&&"string"==typeof j&&!/reflow/i.test(j)){this.libs.hasOwnProperty(j)&&x.push(this.init_lib(j,y))}else{for(var w in this.libs){x.push(this.init_lib(w,j))}}return k},init_lib:function(d,c){return this.libs.hasOwnProperty(d)?(this.patch(this.libs[d]),c&&c.hasOwnProperty(d)?this.libs[d].init.apply(this.libs[d],[this.scope,c[d]]):(c=c instanceof Array?c:Array(c),this.libs[d].init.apply(this.libs[d],c))):function(){}},patch:function(b){b.scope=this.scope,b.namespace=this.global.namespace,b.rtl=this.rtl,b.data_options=this.utils.data_options,b.attr_name=o,b.add_namespace=n,b.bindings=m,b.S=this.utils.S},inherit:function(f,e){for(var i=e.split(" "),h=i.length;h--;){this.utils.hasOwnProperty(i[h])&&(f[i[h]]=this.utils[i[h]])}},set_namespace:function(){var a=v(".foundation-data-attribute-namespace").css("font-family");/false/i.test(a)||(this.global.namespace=a)},libs:{},utils:{S:p,throttle:function(e,d){var f=null;return function(){var b=this,a=arguments;clearTimeout(f),f=setTimeout(function(){e.apply(b,a)},d)}},debounce:function(h,f,k){var j,i;return function(){var d=this,c=arguments,b=function(){j=null,k||(i=h.apply(d,c))},a=k&&!j;return clearTimeout(j),j=setTimeout(b,f),a&&(i=h.apply(d,c)),i}},data_options:function(C){function B(b){return !isNaN(b-0)&&null!==b&&""!==b&&b!==!1&&b!==!0}function A(c){return"string"==typeof c?v.trim(c):c}var z,y,x,w={},k=function(d){var c=Foundation.global.namespace;return d.data(c.length>0?c+"-options":"options")},a=k(C);if("object"==typeof a){return a}for(x=(a||":").split(";"),z=x.length;z--;){y=x[z].split(":"),/true/i.test(y[1])&&(y[1]=!0),/false/i.test(y[1])&&(y[1]=!1),B(y[1])&&(y[1]=parseInt(y[1],10)),2===y.length&&y[0].length>0&&(w[A(y[0])]=A(y[1]))}return w},register_media:function(a,d){Foundation.media_queries[a]===s&&(v("head").append('<meta class="'+d+'">'),Foundation.media_queries[a]=r(v("."+d).css("font-family")))},add_custom_rule:function(e,d){if(d===s){Foundation.stylesheet.insertRule(e,Foundation.stylesheet.cssRules.length)}else{var f=Foundation.media_queries[d];f!==s&&Foundation.stylesheet.insertRule("@media "+Foundation.media_queries[d]+"{ "+e+" }")}},image_loaded:function(f,e){var i=this,h=f.length;f.each(function(){l(i.S(this),function(){h-=1,0==h&&e(f)})})},random_str:function(e){var d="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");e||(e=Math.floor(Math.random()*d.length));for(var f="";e--;){f+=d[Math.floor(Math.random()*d.length)]}return f}}},v.fn.foundation=function(){var b=Array.prototype.slice.call(arguments,0);return this.each(function(){return Foundation.init.apply(Foundation,[this].concat(b)),this})}}(jQuery,this,this.document),function(e,d,f){Foundation.libs.abide={name:"abide",version:"5.1.1",settings:{live_validate:!0,focus_on_invalid:!0,error_labels:!0,timeout:1000,patterns:{alpha:/^[a-zA-Z]+$/,alpha_numeric:/^[a-zA-Z0-9]+$/,integer:/^\d+$/,number:/-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?/,password:/(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/,card:/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/,cvv:/^([0-9]){3,4}$/,email:/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,url:/(https?|ftp|file|ssh):\/\/(((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?/,domain:/^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$/,datetime:/([0-2][0-9]{3})\-([0-1][0-9])\-([0-3][0-9])T([0-5][0-9])\:([0-5][0-9])\:([0-5][0-9])(Z|([\-\+]([0-1][0-9])\:00))/,date:/(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))/,time:/(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]){2}/,dateISO:/\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}/,month_day_year:/(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.](19|20)\d\d/,color:/^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/}},timer:null,init:function(i,h,j){this.bindings(h,j)},events:function(a){var i=this,h=i.S(a).attr("novalidate","novalidate");h.data(this.attr_name(!0)+"-init");this.invalid_attr=this.add_namespace("data-invalid"),h.off(".abide").on("submit.fndtn.abide validate.fndtn.abide",function(j){var c=/ajax/i.test(i.S(this).attr(i.attr_name()));return i.validate(i.S(this).find("input, textarea, select").get(),j,c)}).on("reset",function(){return i.reset(e(this))}).find("input, textarea, select").off(".abide").on("blur.fndtn.abide change.fndtn.abide",function(b){i.validate([this],b)}).on("keydown.fndtn.abide",function(c){var j=e(this).closest("form").data("abide-init");j.live_validate===!0&&(clearTimeout(i.timer),i.timer=setTimeout(function(){i.validate([this],c)}.bind(this),j.timeout))})},reset:function(a){a.removeAttr(this.invalid_attr),e(this.invalid_attr,a).removeAttr(this.invalid_attr),e(".error",a).not("small").removeClass("error")},validate:function(j,i,p){for(var o=this.parse_patterns(j),n=o.length,m=this.S(j[0]).closest("form"),l=/submit/.test(i.type),k=0;n>k;k++){if(!o[k]&&(l||p)){return this.settings.focus_on_invalid&&j[k].focus(),m.trigger("invalid"),this.S(j[k]).closest("form").attr(this.invalid_attr,""),!1}}return(l||p)&&m.trigger("valid"),m.removeAttr(this.invalid_attr),p?!1:!0},parse_patterns:function(i){for(var h=i.length,j=[];h--;){j.push(this.pattern(i[h]))}return this.check_validation_and_apply_styles(j)},pattern:function(i){var h=i.getAttribute("type"),k="string"==typeof i.getAttribute("required"),j=i.getAttribute("pattern")||"";return this.settings.patterns.hasOwnProperty(j)&&j.length>0?[i,this.settings.patterns[j],k]:j.length>0?[i,new RegExp(j),k]:this.settings.patterns.hasOwnProperty(h)?[i,this.settings.patterns[h],k]:(j=/.*/,[i,j,k])},check_validation_and_apply_styles:function(z){for(var y=z.length,x=[];y--;){var w,v=z[y][0],u=z[y][2],t=v.value,s=this.S(v).parent(),r=v.getAttribute(this.add_namespace("data-equalto")),q="radio"===v.type,p="checkbox"===v.type,o=this.S('label[for="'+v.getAttribute("id")+'"]'),a=u?v.value.length>0:!0;w=s.is("label")?s.parent():s,q&&u?x.push(this.valid_radio(v,u)):p&&u?x.push(this.valid_checkbox(v,u)):r&&u?x.push(this.valid_equal(v,u,w)):z[y][1].test(t)&&a||!u&&v.value.length<1?(this.S(v).removeAttr(this.invalid_attr),w.removeClass("error"),o.length>0&&this.settings.error_labels&&o.removeClass("error"),x.push(!0),e(v).triggerHandler("valid")):(this.S(v).attr(this.invalid_attr,""),w.addClass("error"),o.length>0&&this.settings.error_labels&&o.addClass("error"),x.push(!1),e(v).triggerHandler("invalid"))}return x},valid_checkbox:function(i,h){var i=this.S(i),j=i.is(":checked")||!h;return j?i.removeAttr(this.invalid_attr).parent().removeClass("error"):i.attr(this.invalid_attr,"").parent().addClass("error"),j},valid_radio:function(h){for(var c=h.getAttribute("name"),l=f.getElementsByName(c),k=l.length,j=!1,i=0;k>i;i++){l[i].checked&&(j=!0)}for(var i=0;k>i;i++){j?this.S(l[i]).removeAttr(this.invalid_attr).parent().removeClass("error"):this.S(l[i]).attr(this.invalid_attr,"").parent().addClass("error")}return j},valid_equal:function(h,c,l){var k=f.getElementById(h.getAttribute(this.add_namespace("data-equalto"))).value,j=h.value,i=k===j;return i?(this.S(h).removeAttr(this.invalid_attr),l.removeClass("error")):(this.S(h).attr(this.invalid_attr,""),l.addClass("error")),i}}}(jQuery,this,this.document),function(b){Foundation.libs.accordion={name:"accordion",version:"5.1.1",settings:{active_class:"active",toggleable:!0},init:function(e,d,f){this.bindings(d,f)},events:function(){var a=this,d=this.S;d(this.scope).off(".fndtn.accordion").on("click.fndtn.accordion","["+this.attr_name()+"] > dd > a",function(r){var q=d(this).closest("["+a.attr_name()+"]"),p=d("#"+this.href.split("#")[1]),o=d("dd > .content",q),n=b("> dd",q),m=q.data(a.attr_name(!0)+"-init"),l=d("dd > .content."+m.active_class,q),c=d("dd."+m.active_class,q);return r.preventDefault(),l[0]==p[0]&&m.toggleable?(c.toggleClass(m.active_class,!1),p.toggleClass(m.active_class,!1)):(o.removeClass(m.active_class),n.removeClass(m.active_class),void p.addClass(m.active_class).parent().addClass(m.active_class))})},off:function(){},reflow:function(){}}}(jQuery,this,this.document),function(b){Foundation.libs.alert={name:"alert",version:"5.1.1",settings:{animation:"fadeOut",speed:300,callback:function(){}},init:function(e,d,f){this.bindings(d,f)},events:function(){var a=this,d=this.S;b(this.scope).off(".alert").on("click.fndtn.alert","["+this.attr_name()+"] a.close",function(c){var h=d(this).closest("["+a.attr_name()+"]"),f=h.data(a.attr_name(!0)+"-init")||a.settings;c.preventDefault(),h[f.animation](f.speed,function(){d(this).trigger("closed").remove(),f.callback()})})},reflow:function(){}}}(jQuery,this,this.document),function(f,e,i,h){Foundation.libs.clearing={name:"clearing",version:"5.1.1",settings:{templates:{viewing:'<a href="#" class="clearing-close">&times;</a><div class="visible-img" style="display: none"><div class="clearing-touch-label"></div><img src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D" alt="" /><p class="clearing-caption"></p><a href="#" class="clearing-main-prev"><span></span></a><a href="#" class="clearing-main-next"><span></span></a></div>'},close_selectors:".clearing-close",touch_label:"&larr;&nbsp;Swipe to Advance&nbsp;&rarr;",init:!1,locked:!1},init:function(k,j,m){var l=this;Foundation.inherit(this,"throttle image_loaded"),this.bindings(j,m),l.S(this.scope).is("["+this.attr_name()+"]")?this.assemble(l.S("li",this.scope)):l.S("["+this.attr_name()+"]",this.scope).each(function(){l.assemble(l.S("li",this))})},events:function(b){var k=this,j=k.S;j(this.scope).off(".clearing").on("click.fndtn.clearing","ul["+this.attr_name()+"] li",function(d,c,o){var c=c||j(this),o=o||c,n=c.next("li"),m=c.closest("["+k.attr_name()+"]").data(k.attr_name(!0)+"-init"),l=j(d.target);d.preventDefault(),m||(k.init(),m=c.closest("["+k.attr_name()+"]").data(k.attr_name(!0)+"-init")),o.hasClass("visible")&&c[0]===o[0]&&n.length>0&&k.is_open(c)&&(o=n,l=j("img",o)),k.open(l,c,o),k.update_paddles(o)}).on("click.fndtn.clearing",".clearing-main-next",function(c){k.nav(c,"next")}).on("click.fndtn.clearing",".clearing-main-prev",function(c){k.nav(c,"prev")}).on("click.fndtn.clearing",this.settings.close_selectors,function(c){Foundation.libs.clearing.close(c,this)}).on("keydown.fndtn.clearing",function(c){k.keydown(c)}),j(e).off(".clearing").on("resize.fndtn.clearing",function(){k.resize()}),this.swipe_events(b)},swipe_events:function(){var d=this,c=d.S;c(this.scope).on("touchstart.fndtn.clearing",".visible-img",function(b){b.touches||(b=b.originalEvent);var j={start_page_x:b.touches[0].pageX,start_page_y:b.touches[0].pageY,start_time:(new Date).getTime(),delta_x:0,is_scrolling:h};c(this).data("swipe-transition",j),b.stopPropagation()}).on("touchmove.fndtn.clearing",".visible-img",function(j){if(j.touches||(j=j.originalEvent),!(j.touches.length>1||j.scale&&1!==j.scale)){var b=c(this).data("swipe-transition");if("undefined"==typeof b&&(b={}),b.delta_x=j.touches[0].pageX-b.start_page_x,"undefined"==typeof b.is_scrolling&&(b.is_scrolling=!!(b.is_scrolling||Math.abs(b.delta_x)<Math.abs(j.touches[0].pageY-b.start_page_y))),!b.is_scrolling&&!b.active){j.preventDefault();var a=b.delta_x<0?"next":"prev";b.active=!0,d.nav(j,a)}}}).on("touchend.fndtn.clearing",".visible-img",function(b){c(this).data("swipe-transition",{}),b.stopPropagation()})},assemble:function(a){var p=a.parent();if(!p.parent().hasClass("carousel")){p.after('<div id="foundationClearingHolder"></div>');var o=this.S("#foundationClearingHolder"),n=p.data(this.attr_name(!0)+"-init"),m=p.detach(),l={grid:'<div class="carousel">'+m[0].outerHTML+"</div>",viewing:n.templates.viewing},k='<div class="clearing-assembled"><div>'+l.viewing+l.grid+"</div></div>",j=this.settings.touch_label;Modernizr.touch&&(k=f(k).find(".clearing-touch-label").html(j).end()),o.after(k).remove()}},open:function(r,q,p){var o=this,n=p.closest(".clearing-assembled"),m=o.S("div",n).first(),l=o.S(".visible-img",m),k=o.S("img",l).not(r),j=o.S(".clearing-touch-label",m);this.locked()||(k.attr("src",this.load(r)).css("visibility","hidden"),this.image_loaded(k,function(){k.css("visibility","visible"),n.addClass("clearing-blackout"),m.addClass("clearing-container"),l.show(),this.fix_height(p).caption(o.S(".clearing-caption",l),r).center_and_label(k,j).shift(q,p,function(){p.siblings().removeClass("visible"),p.addClass("visible")})}.bind(this)))},close:function(a,m){a.preventDefault();var l,k,j=function(b){return/blackout/.test(b.selector)?b:b.closest(".clearing-blackout")}(f(m));return m===a.target&&j&&(l=f("div",j).first(),k=f(".visible-img",l),this.settings.prev_index=0,f("ul["+this.attr_name()+"]",j).attr("style","").closest(".clearing-blackout").removeClass("clearing-blackout"),l.removeClass("clearing-container"),k.hide()),!1},is_open:function(b){return b.parent().prop("style").length>0},keydown:function(a){var m=f("ul["+this.attr_name()+"]",".clearing-blackout"),l=this.rtl?37:39,k=this.rtl?39:37,j=27;a.which===l&&this.go(m,"next"),a.which===k&&this.go(m,"prev"),a.which===j&&this.S("a.clearing-close").trigger("click")},nav:function(a,k){var j=f("ul["+this.attr_name()+"]",".clearing-blackout");a.preventDefault(),this.go(j,k)},resize:function(){var a=f("img",".clearing-blackout .visible-img"),d=f(".clearing-touch-label",".clearing-blackout");a.length&&this.center_and_label(a,d)},fix_height:function(j){var d=j.parent().children(),k=this;return d.each(function(){var l=k.S(this),c=l.find("img");l.height()>c.outerHeight()&&l.addClass("fix-height")}).closest("ul").width(100*d.length+"%"),this},update_paddles:function(d){var c=d.closest(".carousel").siblings(".visible-img");d.next().length>0?this.S(".clearing-main-next",c).removeClass("disabled"):this.S(".clearing-main-next",c).addClass("disabled"),d.prev().length>0?this.S(".clearing-main-prev",c).removeClass("disabled"):this.S(".clearing-main-prev",c).addClass("disabled")},center_and_label:function(d,c){return this.rtl?(d.css({marginRight:-(d.outerWidth()/2),marginTop:-(d.outerHeight()/2),left:"auto",right:"50%"}),c.css({marginRight:-(c.outerWidth()/2),marginTop:-(d.outerHeight()/2)-c.outerHeight()-10,left:"auto",right:"50%"})):(d.css({marginLeft:-(d.outerWidth()/2),marginTop:-(d.outerHeight()/2)}),c.css({marginLeft:-(c.outerWidth()/2),marginTop:-(d.outerHeight()/2)-c.outerHeight()-10})),this},load:function(d){if("A"===d[0].nodeName){var c=d.attr("href")}else{var c=d.parent().attr("href")}return this.preload(d),c?c:d.attr("src")},preload:function(b){this.img(b.closest("li").next()).img(b.closest("li").prev())},img:function(j){if(j.length){var d=new Image,k=this.S("a",j);d.src=k.length?k.attr("href"):this.S("img",j).attr("src")}return this},caption:function(j,d){var k=d.data("caption");return k?j.html(k).show():j.text("").hide(),this},go:function(k,j){var m=this.S(".visible",k),l=m[j]();l.length&&this.S("img",l).trigger("click",[m,l])},shift:function(v,u,t){var s,r=u.parent(),q=this.settings.prev_index||u.index(),p=this.direction(r,v,u),o=this.rtl?"right":"left",n=parseInt(r.css("left"),10),m=u.outerWidth(),l={};u.index()===q||/skip/.test(p)?/skip/.test(p)&&(s=u.index()-this.settings.up_count,this.lock(),s>0?(l[o]=-(s*m),r.animate(l,300,this.unlock())):(l[o]=0,r.animate(l,300,this.unlock()))):/left/.test(p)?(this.lock(),l[o]=n+m,r.animate(l,300,this.unlock())):/right/.test(p)&&(this.lock(),l[o]=n-m,r.animate(l,300,this.unlock())),t()},direction:function(k,j,q){var p,o=this.S("li",k),n=o.outerWidth()+o.outerWidth()/4,m=Math.floor(this.S(".clearing-container").outerWidth()/n)-1,l=o.index(q);return this.settings.up_count=m,p=this.adjacent(this.settings.prev_index,l)?l>m&&l>this.settings.prev_index?"right":l>m-1&&l<=this.settings.prev_index?"left":!1:"skip",this.settings.prev_index=l,p},adjacent:function(j,d){for(var k=d+1;k>=d-1;k--){if(k===j){return !0}}return !1},lock:function(){this.settings.locked=!0},unlock:function(){this.settings.locked=!1},locked:function(){return this.settings.locked},off:function(){this.S(this.scope).off(".fndtn.clearing"),this.S(e).off(".fndtn.clearing")},reflow:function(){this.init()}}}(jQuery,this,this.document),function(d,c){Foundation.libs.dropdown={name:"dropdown",version:"5.1.1",settings:{active_class:"open",is_hover:!1,opened:function(){},closed:function(){}},init:function(f,e,h){Foundation.inherit(this,"throttle"),this.bindings(e,h)},events:function(){var b=this,a=b.S;a(this.scope).off(".dropdown").on("click.fndtn.dropdown","["+this.attr_name()+"]",function(f){var e=a(this).data(b.attr_name(!0)+"-init")||b.settings;f.preventDefault(),(!e.is_hover||Modernizr.touch)&&b.toggle(a(this))}).on("mouseenter.fndtn.dropdown","["+this.attr_name()+"], ["+this.attr_name()+"-content]",function(i){var h=a(this);if(clearTimeout(b.timeout),h.data(b.data_attr())){var l=a("#"+h.data(b.data_attr())),k=h}else{var l=h;k=a("["+b.attr_name()+"='"+l.attr("id")+"']")}var j=k.data(b.attr_name(!0)+"-init")||b.settings;a(i.target).data(b.data_attr())&&j.is_hover&&b.closeall.call(b),j.is_hover&&b.open.apply(b,[l,k])}).on("mouseleave.fndtn.dropdown","["+this.attr_name()+"], ["+this.attr_name()+"-content]",function(){var e=a(this);b.timeout=setTimeout(function(){if(e.data(b.data_attr())){var f=e.data(b.data_attr(!0)+"-init")||b.settings;f.is_hover&&b.close.call(b,a("#"+e.data(b.data_attr())))}else{var h=a("["+b.attr_name()+'="'+a(this).attr("id")+'"]'),f=h.data(b.attr_name(!0)+"-init")||b.settings;f.is_hover&&b.close.call(b,e)}}.bind(this),150)}).on("click.fndtn.dropdown",function(f){var h=a(f.target).closest("["+b.attr_name()+"-content]");if(!a(f.target).data(b.data_attr())&&!a(f.target).parent().data(b.data_attr())){return !a(f.target).data("revealId")&&h.length>0&&(a(f.target).is("["+b.attr_name()+"-content]")||d.contains(h.first()[0],f.target))?void f.stopPropagation():void b.close.call(b,a("["+b.attr_name()+"-content]"))}}).on("opened.fndtn.dropdown","["+b.attr_name()+"-content]",function(){b.settings.opened.call(this)}).on("closed.fndtn.dropdown","["+b.attr_name()+"-content]",function(){b.settings.closed.call(this)}),a(c).off(".dropdown").on("resize.fndtn.dropdown",b.throttle(function(){b.resize.call(b)},50)).trigger("resize")},close:function(f){var e=this;f.each(function(){e.S(this).hasClass(e.settings.active_class)&&(e.S(this).css(Foundation.rtl?"right":"left","-99999px").removeClass(e.settings.active_class),e.S(this).trigger("closed"))})},closeall:function(){var a=this;d.each(a.S("["+this.attr_name()+"-content]"),function(){a.close.call(a,a.S(this))})},open:function(f,e){this.css(f.addClass(this.settings.active_class),e),f.trigger("opened")},data_attr:function(){return this.namespace.length>0?this.namespace+"-"+this.name:this.name},toggle:function(f){var e=this.S("#"+f.data(this.data_attr()));0!==e.length&&(this.close.call(this,this.S("["+this.attr_name()+"-content]").not(e)),e.hasClass(this.settings.active_class)?this.close.call(this,e):(this.close.call(this,this.S("["+this.attr_name()+"-content]")),this.open.call(this,e,f)))},resize:function(){var f=this.S("["+this.attr_name()+"-content].open"),e=this.S("["+this.attr_name()+"='"+f.attr("id")+"']");f.length&&e.length&&this.css(f,e)},css:function(b,k){var j=b.offsetParent(),i=k.offset();if(i.top-=j.offset().top,i.left-=j.offset().left,this.small()){b.css({position:"absolute",width:"95%","max-width":"none",top:i.top+k.outerHeight()}),b.css(Foundation.rtl?"right":"left","2.5%")}else{if(!Foundation.rtl&&this.S(c).width()>b.outerWidth()+k.offset().left){var h=i.left;b.hasClass("right")&&b.removeClass("right")}else{b.hasClass("right")||b.addClass("right");var h=i.left-(b.outerWidth()-k.outerWidth())}b.attr("style","").css({position:"absolute",top:i.top+k.outerHeight(),left:h})}return b},small:function(){return matchMedia(Foundation.media_queries.small).matches&&!matchMedia(Foundation.media_queries.medium).matches},off:function(){this.S(this.scope).off(".fndtn.dropdown"),this.S("html, body").off(".fndtn.dropdown"),this.S(c).off(".fndtn.dropdown"),this.S("[data-dropdown-content]").off(".fndtn.dropdown"),this.settings.init=!1},reflow:function(){}}}(jQuery,this,this.document),function(d,c){Foundation.libs.equalizer={name:"equalizer",version:"5.1.1",settings:{use_tallest:!0,before_height_change:d.noop,after_height_change:d.noop},init:function(f,e,h){this.bindings(e,h),this.reflow()},events:function(){this.S(c).off(".equalizer").on("resize.fndtn.equalizer",function(){this.reflow()}.bind(this))},equalize:function(a){var p=!1,o=a.find("["+this.attr_name()+"-watch]"),n=o.first().offset().top,m=a.data(this.attr_name(!0)+"-init");if(0!==o.length&&(m.before_height_change(),a.trigger("before-height-change"),o.height("inherit"),o.each(function(){var e=d(this);e.offset().top!==n&&(p=!0)}),!p)){var l=o.map(function(){return d(this).outerHeight()});if(m.use_tallest){var k=Math.max.apply(null,l);o.height(k)}else{var j=Math.min.apply(null,l);o.height(j)}m.after_height_change(),a.trigger("after-height-change")}},reflow:function(){var a=this;this.S("["+this.attr_name()+"]",this.scope).each(function(){a.equalize(d(this))})}}}(jQuery,this,this.document),function(d,c){Foundation.libs.interchange={name:"interchange",version:"5.1.1",cache:{},images_loaded:!1,nodes_loaded:!1,settings:{load_attr:"interchange",named_queries:{"default":"only screen",small:Foundation.media_queries.small,medium:Foundation.media_queries.medium,large:Foundation.media_queries.large,xlarge:Foundation.media_queries.xlarge,xxlarge:Foundation.media_queries.xxlarge,landscape:"only screen and (orientation: landscape)",portrait:"only screen and (orientation: portrait)",retina:"only screen and (-webkit-min-device-pixel-ratio: 2),only screen and (min--moz-device-pixel-ratio: 2),only screen and (-o-min-device-pixel-ratio: 2/1),only screen and (min-device-pixel-ratio: 2),only screen and (min-resolution: 192dpi),only screen and (min-resolution: 2dppx)"},directives:{replace:function(a,k,j){if(/IMG/.test(a[0].nodeName)){var i=a[0].src;if(new RegExp(k,"i").test(i)){return}return a[0].src=k,j(a[0].src)}var h=a.data(this.data_attr+"-last-path");if(h!=k){return d.get(k,function(b){a.html(b),a.data(this.data_attr+"-last-path",k),j()})}}}},init:function(a,f,e){Foundation.inherit(this,"throttle random_str"),this.data_attr=this.set_data_attr(),d.extend(!0,this.settings,f,e),this.bindings(f,e),this.load("images"),this.load("nodes")},events:function(){var a=this;return d(c).off(".interchange").on("resize.fndtn.interchange",a.throttle(function(){a.resize()},50)),this},resize:function(){var a=this.cache;if(!this.images_loaded||!this.nodes_loaded){return void setTimeout(d.proxy(this.resize,this),50)}for(var f in a){if(a.hasOwnProperty(f)){var e=this.results(f,a[f]);e&&this.settings.directives[e.scenario[1]].call(this,e.el,e.scenario[0],function(){if(arguments[0] instanceof Array){var b=arguments[0]}else{var b=Array.prototype.slice.call(arguments,0)}e.el.trigger(e.scenario[1],b)})}}},results:function(i,h){var m=h.length;if(m>0){for(var l=this.S("["+this.add_namespace("data-uuid")+'="'+i+'"]');m--;){var k,j=h[m][2];if(k=matchMedia(this.settings.named_queries.hasOwnProperty(j)?this.settings.named_queries[j]:j),k.matches){return{el:l,scenario:h[m]}}}}return !1},load:function(f,e){return("undefined"==typeof this["cached_"+f]||e)&&this["update_"+f](),this["cached_"+f]},update_images:function(){var i=this.S("img["+this.data_attr+"]"),h=i.length,m=h,l=0,k=this.data_attr;for(this.cache={},this.cached_images=[],this.images_loaded=0===h;m--;){if(l++,i[m]){var j=i[m].getAttribute(k)||"";j.length>0&&this.cached_images.push(i[m])}l===h&&(this.images_loaded=!0,this.enhance("images"))}return this},update_nodes:function(){var i=this.S("["+this.data_attr+"]").not("img"),h=i.length,m=h,l=0,k=this.data_attr;for(this.cached_nodes=[],this.nodes_loaded=0===h;m--;){l++;var j=i[m].getAttribute(k)||"";j.length>0&&this.cached_nodes.push(i[m]),l===h&&(this.nodes_loaded=!0,this.enhance("nodes"))}return this},enhance:function(b){for(var a=this["cached_"+b].length;a--;){this.object(d(this["cached_"+b][a]))}return d(c).trigger("resize")},parse_params:function(f,e,h){return[this.trim(f),this.convert_directive(e),this.trim(h)]},convert_directive:function(f){var e=this.trim(f);return e.length>0?e:"replace"},object:function(i){var h=this.parse_data_attr(i),n=[],m=h.length;if(m>0){for(;m--;){var l=h[m].split(/\((.*?)(\))$/);if(l.length>1){var k=l[0].split(","),j=this.parse_params(k[0],k[1],l[1]);n.push(j)}}}return this.store(i,n)},uuid:function(f){function e(){return h.random_str(6)}var i=f||"-",h=this;return e()+e()+i+e()+i+e()+i+e()+i+e()+e()+e()},store:function(f,e){var i=this.uuid(),h=f.data(this.add_namespace("uuid",!0));return this.cache[h]?this.cache[h]:(f.attr(this.add_namespace("data-uuid"),i),this.cache[i]=e)},trim:function(a){return"string"==typeof a?d.trim(a):a},set_data_attr:function(b){return b?this.namespace.length>0?this.namespace+"-"+this.settings.load_attr:this.settings.load_attr:this.namespace.length>0?"data-"+this.namespace+"-"+this.settings.load_attr:"data-"+this.settings.load_attr},parse_data_attr:function(f){for(var e=f.attr(this.attr_name()).split(/\[(.*?)\]/),i=e.length,h=[];i--;){e[i].replace(/[\W\d]+/,"").length>4&&h.push(e[i])}return h},reflow:function(){this.load("images",!0),this.load("nodes",!0)}}}(jQuery,this,this.document),function(f,e,i,h){Foundation.libs.joyride={name:"joyride",version:"5.1.1",defaults:{expose:!1,modal:!0,tip_location:"bottom",nub_position:"auto",scroll_speed:1500,scroll_animation:"linear",timer:0,start_timer_on_click:!0,start_offset:0,next_button:!0,tip_animation:"fade",pause_after:[],exposed:[],tip_animation_fade_speed:300,cookie_monster:!1,cookie_name:"joyride",cookie_domain:!1,cookie_expires:365,tip_container:"body",tip_location_patterns:{top:["bottom"],bottom:[],left:["right","top","bottom"],right:["left","top","bottom"]},post_ride_callback:function(){},post_step_callback:function(){},pre_step_callback:function(){},pre_ride_callback:function(){},post_expose_callback:function(){},template:{link:'<a href="#close" class="joyride-close-tip">&times;</a>',timer:'<div class="joyride-timer-indicator-wrap"><span class="joyride-timer-indicator"></span></div>',tip:'<div class="joyride-tip-guide"><span class="joyride-nub"></span></div>',wrapper:'<div class="joyride-content-wrapper"></div>',button:'<a href="#" class="small button joyride-next-tip"></a>',modal:'<div class="joyride-modal-bg"></div>',expose:'<div class="joyride-expose-wrapper"></div>',expose_cover:'<div class="joyride-expose-cover"></div>'},expose_add_class:""},init:function(j,d,k){Foundation.inherit(this,"throttle random_str"),this.settings=this.defaults,this.bindings(d,k)},events:function(){var a=this;f(this.scope).off(".joyride").on("click.fndtn.joyride",".joyride-next-tip, .joyride-modal-bg",function(b){b.preventDefault(),this.settings.$li.next().length<1?this.end():this.settings.timer>0?(clearTimeout(this.settings.automate),this.hide(),this.show(),this.startTimer()):(this.hide(),this.show())}.bind(this)).on("click.fndtn.joyride",".joyride-close-tip",function(b){b.preventDefault(),this.end()}.bind(this)),f(e).off(".joyride").on("resize.fndtn.joyride",a.throttle(function(){if(f("["+a.attr_name()+"]").length>0&&a.settings.$next_tip){if(a.settings.exposed.length>0){var c=f(a.settings.exposed);c.each(function(){var d=f(this);a.un_expose(d),a.expose(d)})}a.is_phone()?a.pos_phone():a.pos_default(!1,!0)}},100))},start:function(){var a=this,l=f("["+this.attr_name()+"]",this.scope),k=["timer","scrollSpeed","startOffset","tipAnimationFadeSpeed","cookieExpires"],j=k.length;!l.length>0||(this.settings.init||this.events(),this.settings=l.data(this.attr_name(!0)+"-init"),this.settings.$content_el=l,this.settings.$body=f(this.settings.tip_container),this.settings.body_offset=f(this.settings.tip_container).position(),this.settings.$tip_content=this.settings.$content_el.find("> li"),this.settings.paused=!1,this.settings.attempts=0,"function"!=typeof f.cookie&&(this.settings.cookie_monster=!1),(!this.settings.cookie_monster||this.settings.cookie_monster&&!f.cookie(this.settings.cookie_name))&&(this.settings.$tip_content.each(function(m){var d=f(this);this.settings=f.extend({},a.defaults,a.data_options(d));for(var b=j;b--;){a.settings[k[b]]=parseInt(a.settings[k[b]],10)}a.create({$li:d,index:m})}),!this.settings.start_timer_on_click&&this.settings.timer>0?(this.show("init"),this.startTimer()):this.show("init")))},resume:function(){this.set_li(),this.show()},tip_template:function(a){var k,j;return a.tip_class=a.tip_class||"",k=f(this.settings.template.tip).addClass(a.tip_class),j=f.trim(f(a.li).html())+this.button_text(a.button_text)+this.settings.template.link+this.timer_instance(a.index),k.append(f(this.settings.template.wrapper)),k.first().attr(this.add_namespace("data-index"),a.index),f(".joyride-content-wrapper",k).append(j),k[0]},timer_instance:function(a){var d;return d=0===a&&this.settings.start_timer_on_click&&this.settings.timer>0||0===this.settings.timer?"":f(this.settings.template.timer)[0].outerHTML},button_text:function(a){return this.settings.next_button?(a=f.trim(a)||"Next",a=f(this.settings.template.button).append(a)[0].outerHTML):a="",a},create:function(a){console.log(a.$li);var l=a.$li.attr(this.add_namespace("data-button"))||a.$li.attr(this.add_namespace("data-text")),k=a.$li.attr("class"),j=f(this.tip_template({tip_class:k,index:a.index,button_text:l,li:a.$li}));f(this.settings.tip_container).append(j)},show:function(a){var d=null;this.settings.$li===h||-1===f.inArray(this.settings.$li.index(),this.settings.pause_after)?(this.settings.paused?this.settings.paused=!1:this.set_li(a),this.settings.attempts=0,this.settings.$li.length&&this.settings.$target.length>0?(a&&(this.settings.pre_ride_callback(this.settings.$li.index(),this.settings.$next_tip),this.settings.modal&&this.show_modal()),this.settings.pre_step_callback(this.settings.$li.index(),this.settings.$next_tip),this.settings.modal&&this.settings.expose&&this.expose(),this.settings.tip_settings=f.extend({},this.settings,this.data_options(this.settings.$li)),this.settings.timer=parseInt(this.settings.timer,10),this.settings.tip_settings.tip_location_pattern=this.settings.tip_location_patterns[this.settings.tip_settings.tip_location],/body/i.test(this.settings.$target.selector)||this.scroll_to(),this.is_phone()?this.pos_phone(!0):this.pos_default(!0),d=this.settings.$next_tip.find(".joyride-timer-indicator"),/pop/i.test(this.settings.tip_animation)?(d.width(0),this.settings.timer>0?(this.settings.$next_tip.show(),setTimeout(function(){d.animate({width:d.parent().width()},this.settings.timer,"linear")}.bind(this),this.settings.tip_animation_fade_speed)):this.settings.$next_tip.show()):/fade/i.test(this.settings.tip_animation)&&(d.width(0),this.settings.timer>0?(this.settings.$next_tip.fadeIn(this.settings.tip_animation_fade_speed).show(),setTimeout(function(){d.animate({width:d.parent().width()},this.settings.timer,"linear")}.bind(this),this.settings.tip_animation_fadeSpeed)):this.settings.$next_tip.fadeIn(this.settings.tip_animation_fade_speed)),this.settings.$current_tip=this.settings.$next_tip):this.settings.$li&&this.settings.$target.length<1?this.show():this.end()):this.settings.paused=!0},is_phone:function(){return matchMedia(Foundation.media_queries.small).matches&&!matchMedia(Foundation.media_queries.medium).matches},hide:function(){this.settings.modal&&this.settings.expose&&this.un_expose(),this.settings.modal||f(".joyride-modal-bg").hide(),this.settings.$current_tip.css("visibility","hidden"),setTimeout(f.proxy(function(){this.hide(),this.css("visibility","visible")},this.settings.$current_tip),0),this.settings.post_step_callback(this.settings.$li.index(),this.settings.$current_tip)},set_li:function(b){b?(this.settings.$li=this.settings.$tip_content.eq(this.settings.start_offset),this.set_next_tip(),this.settings.$current_tip=this.settings.$next_tip):(this.settings.$li=this.settings.$li.next(),this.set_next_tip()),this.set_target()},set_next_tip:function(){this.settings.$next_tip=f(".joyride-tip-guide").eq(this.settings.$li.index()),this.settings.$next_tip.data("closed","")},set_target:function(){console.log(this.add_namespace("data-class"));var a=this.settings.$li.attr(this.add_namespace("data-class")),j=this.settings.$li.attr(this.add_namespace("data-id")),c=function(){return j?f(i.getElementById(j)):a?f("."+a).first():f("body")};console.log(a,j),this.settings.$target=c()},scroll_to:function(){var b,a;b=f(e).height()/2,a=Math.ceil(this.settings.$target.offset().top-b+this.settings.$next_tip.outerHeight()),0!=a&&f("html, body").animate({scrollTop:a},this.settings.scroll_speed,"swing")},paused:function(){return -1===f.inArray(this.settings.$li.index()+1,this.settings.pause_after)},restart:function(){this.hide(),this.settings.$li=h,this.show("init")},pos_default:function(m,l){var k=(Math.ceil(f(e).height()/2),this.settings.$next_tip.offset(),this.settings.$next_tip.find(".joyride-nub")),j=Math.ceil(k.outerWidth()/2),b=Math.ceil(k.outerHeight()/2),a=m||!1;a&&(this.settings.$next_tip.css("visibility","hidden"),this.settings.$next_tip.show()),"undefined"==typeof l&&(l=!1),/body/i.test(this.settings.$target.selector)?this.settings.$li.length&&this.pos_modal(k):(this.bottom()?(this.settings.$next_tip.css(this.rtl?{top:this.settings.$target.offset().top+b+this.settings.$target.outerHeight(),left:this.settings.$target.offset().left+this.settings.$target.outerWidth()-this.settings.$next_tip.outerWidth()}:{top:this.settings.$target.offset().top+b+this.settings.$target.outerHeight(),left:this.settings.$target.offset().left}),this.nub_position(k,this.settings.tip_settings.nub_position,"top")):this.top()?(this.settings.$next_tip.css(this.rtl?{top:this.settings.$target.offset().top-this.settings.$next_tip.outerHeight()-b,left:this.settings.$target.offset().left+this.settings.$target.outerWidth()-this.settings.$next_tip.outerWidth()}:{top:this.settings.$target.offset().top-this.settings.$next_tip.outerHeight()-b,left:this.settings.$target.offset().left}),this.nub_position(k,this.settings.tip_settings.nub_position,"bottom")):this.right()?(this.settings.$next_tip.css({top:this.settings.$target.offset().top,left:this.outerWidth(this.settings.$target)+this.settings.$target.offset().left+j}),this.nub_position(k,this.settings.tip_settings.nub_position,"left")):this.left()&&(this.settings.$next_tip.css({top:this.settings.$target.offset().top,left:this.settings.$target.offset().left-this.outerWidth(this.settings.$next_tip)-j}),this.nub_position(k,this.settings.tip_settings.nub_position,"right")),!this.visible(this.corners(this.settings.$next_tip))&&this.settings.attempts<this.settings.tip_settings.tip_location_pattern.length&&(k.removeClass("bottom").removeClass("top").removeClass("right").removeClass("left"),this.settings.tip_settings.tip_location=this.settings.tip_settings.tip_location_pattern[this.settings.attempts],this.settings.attempts++,this.pos_default())),a&&(this.settings.$next_tip.hide(),this.settings.$next_tip.css("visibility","visible"))},pos_phone:function(a){var n=this.settings.$next_tip.outerHeight(),m=(this.settings.$next_tip.offset(),this.settings.$target.outerHeight()),l=f(".joyride-nub",this.settings.$next_tip),k=Math.ceil(l.outerHeight()/2),j=a||!1;l.removeClass("bottom").removeClass("top").removeClass("right").removeClass("left"),j&&(this.settings.$next_tip.css("visibility","hidden"),this.settings.$next_tip.show()),/body/i.test(this.settings.$target.selector)?this.settings.$li.length&&this.pos_modal(l):this.top()?(this.settings.$next_tip.offset({top:this.settings.$target.offset().top-n-k}),l.addClass("bottom")):(this.settings.$next_tip.offset({top:this.settings.$target.offset().top+m+k}),l.addClass("top")),j&&(this.settings.$next_tip.hide(),this.settings.$next_tip.css("visibility","visible"))},pos_modal:function(b){this.center(),b.hide(),this.show_modal()},show_modal:function(){if(!this.settings.$next_tip.data("closed")){var a=f(".joyride-modal-bg");a.length<1&&f("body").append(this.settings.template.modal).show(),/pop/i.test(this.settings.tip_animation)?a.show():a.fadeIn(this.settings.tip_animation_fade_speed)}},expose:function(){var m,l,k,j,b,a="expose-"+this.random_str(6);if(arguments.length>0&&arguments[0] instanceof f){k=arguments[0]}else{if(!this.settings.$target||/body/i.test(this.settings.$target.selector)){return !1}k=this.settings.$target}return k.length<1?(e.console&&console.error("element not valid",k),!1):(m=f(this.settings.template.expose),this.settings.$body.append(m),m.css({top:k.offset().top,left:k.offset().left,width:k.outerWidth(!0),height:k.outerHeight(!0)}),l=f(this.settings.template.expose_cover),j={zIndex:k.css("z-index"),position:k.css("position")},b=null==k.attr("class")?"":k.attr("class"),k.css("z-index",parseInt(m.css("z-index"))+1),"static"==j.position&&k.css("position","relative"),k.data("expose-css",j),k.data("orig-class",b),k.attr("class",b+" "+this.settings.expose_add_class),l.css({top:k.offset().top,left:k.offset().left,width:k.outerWidth(!0),height:k.outerHeight(!0)}),this.settings.modal&&this.show_modal(),this.settings.$body.append(l),m.addClass(a),l.addClass(a),k.data("expose",a),this.settings.post_expose_callback(this.settings.$li.index(),this.settings.$next_tip,k),void this.add_exposed(k))},un_expose:function(){var m,l,k,j,b,a=!1;if(arguments.length>0&&arguments[0] instanceof f){l=arguments[0]}else{if(!this.settings.$target||/body/i.test(this.settings.$target.selector)){return !1}l=this.settings.$target}return l.length<1?(e.console&&console.error("element not valid",l),!1):(m=l.data("expose"),k=f("."+m),arguments.length>1&&(a=arguments[1]),a===!0?f(".joyride-expose-wrapper,.joyride-expose-cover").remove():k.remove(),j=l.data("expose-css"),"auto"==j.zIndex?l.css("z-index",""):l.css("z-index",j.zIndex),j.position!=l.css("position")&&("static"==j.position?l.css("position",""):l.css("position",j.position)),b=l.data("orig-class"),l.attr("class",b),l.removeData("orig-classes"),l.removeData("expose"),l.removeData("expose-z-index"),void this.remove_exposed(l))},add_exposed:function(a){this.settings.exposed=this.settings.exposed||[],a instanceof f||"object"==typeof a?this.settings.exposed.push(a[0]):"string"==typeof a&&this.settings.exposed.push(a)},remove_exposed:function(a){var k,j;for(a instanceof f?k=a[0]:"string"==typeof a&&(k=a),this.settings.exposed=this.settings.exposed||[],j=this.settings.exposed.length;j--;){if(this.settings.exposed[j]==k){return void this.settings.exposed.splice(j,1)}}},center:function(){var a=f(e);return this.settings.$next_tip.css({top:(a.height()-this.settings.$next_tip.outerHeight())/2+a.scrollTop(),left:(a.width()-this.settings.$next_tip.outerWidth())/2+a.scrollLeft()}),!0},bottom:function(){return/bottom/i.test(this.settings.tip_settings.tip_location)},top:function(){return/top/i.test(this.settings.tip_settings.tip_location)},right:function(){return/right/i.test(this.settings.tip_settings.tip_location)},left:function(){return/left/i.test(this.settings.tip_settings.tip_location)},corners:function(p){var o=f(e),n=o.height()/2,m=Math.ceil(this.settings.$target.offset().top-n+this.settings.$next_tip.outerHeight()),l=o.width()+o.scrollLeft(),k=o.height()+m,b=o.height()+o.scrollTop(),a=o.scrollTop();return a>m&&(a=0>m?0:m),k>b&&(b=k),[p.offset().top<a,l<p.offset().left+p.outerWidth(),b<p.offset().top+p.outerHeight(),o.scrollLeft()>p.offset().left]},visible:function(d){for(var c=d.length;c--;){if(d[c]){return !1}}return !0},nub_position:function(j,d,k){j.addClass("auto"===d?k:d)},startTimer:function(){this.settings.$li.length?this.settings.automate=setTimeout(function(){this.hide(),this.show(),this.startTimer()}.bind(this),this.settings.timer):clearTimeout(this.settings.automate)},end:function(){this.settings.cookie_monster&&f.cookie(this.settings.cookie_name,"ridden",{expires:this.settings.cookie_expires,domain:this.settings.cookie_domain}),this.settings.timer>0&&clearTimeout(this.settings.automate),this.settings.modal&&this.settings.expose&&this.un_expose(),this.settings.$next_tip.data("closed",!0),f(".joyride-modal-bg").hide(),this.settings.$current_tip.hide(),this.settings.post_step_callback(this.settings.$li.index(),this.settings.$current_tip),this.settings.post_ride_callback(this.settings.$li.index(),this.settings.$current_tip),f(".joyride-tip-guide").remove()},off:function(){f(this.scope).off(".joyride"),f(e).off(".joyride"),f(".joyride-close-tip, .joyride-next-tip, .joyride-modal-bg").off(".joyride"),f(".joyride-tip-guide, .joyride-modal-bg").remove(),clearTimeout(this.settings.automate),this.settings={}},reflow:function(){}}}(jQuery,this,this.document),function(d,c){Foundation.libs["magellan-expedition"]={name:"magellan-expedition",version:"5.1.1",settings:{active_class:"active",threshold:0,destination_threshold:20,throttle_delay:30},init:function(f,e,h){Foundation.inherit(this,"throttle"),this.bindings(e,h)},events:function(){var f=this,b=f.S,a=f.settings;f.set_expedition_position(),b(f.scope).off(".magellan").on("click.fndtn.magellan","["+f.add_namespace("data-magellan-arrival")+'] a[href^="#"]',function(m){m.preventDefault();var l=d(this).closest("["+f.attr_name()+"]"),k=(l.data("magellan-expedition-init"),this.hash.split("#").join("")),j=d("a[name="+k+"]");0===j.length&&(j=d("#"+k));var i=j.offset().top;"fixed"===l.css("position")&&(i-=l.outerHeight()),d("html, body").stop().animate({scrollTop:i},700,"swing",function(){c.location.hash="#"+k})}).on("scroll.fndtn.magellan",f.throttle(this.check_for_arrivals.bind(this),a.throttle_delay)).on("resize.fndtn.magellan",f.throttle(this.set_expedition_position.bind(this),a.throttle_delay))},check_for_arrivals:function(){var b=this;b.update_arrivals(),b.update_expedition_positions()},set_expedition_position:function(){var a=this;d("["+this.attr_name()+"=fixed]",a.scope).each(function(){var h,f=d(this),b=f.attr("styles");f.attr("style",""),h=f.offset().top,f.data(a.data_attr("magellan-top-offset"),h),f.attr("style",b)})},update_expedition_positions:function(){var b=this,a=d(c).scrollTop();d("["+this.attr_name()+"=fixed]",b.scope).each(function(){var h=d(this),j=h.data("magellan-top-offset");if(a>=j){var i=h.prev("["+b.add_namespace("data-magellan-expedition-clone")+"]");0===i.length&&(i=h.clone(),i.removeAttr(b.attr_name()),i.attr(b.add_namespace("data-magellan-expedition-clone"),""),h.before(i)),h.css({position:"fixed",top:0})}else{h.prev("["+b.add_namespace("data-magellan-expedition-clone")+"]").remove(),h.attr("style","")}})},update_arrivals:function(){var b=this,a=d(c).scrollTop();d("["+this.attr_name()+"]",b.scope).each(function(){var i=d(this),m=m=i.data(b.attr_name(!0)+"-init"),l=b.offsets(i,a),k=i.find("["+b.add_namespace("data-magellan-arrival")+"]"),j=!1;l.each(function(e,n){if(n.viewport_offset>=n.top_offset){var h=i.find("["+b.add_namespace("data-magellan-arrival")+"]");return h.not(n.arrival).removeClass(m.active_class),n.arrival.addClass(m.active_class),j=!0,!0}}),j||k.removeClass(m.active_class)})},offsets:function(a,k){var j=this,i=a.data(j.attr_name(!0)+"-init"),h=k+i.destination_threshold;return a.find("["+j.add_namespace("data-magellan-arrival")+"]").map(function(){var f=d(this).data(j.data_attr("magellan-arrival")),m=d("["+j.add_namespace("data-magellan-destination")+"="+f+"]");if(m.length>0){var l=m.offset().top;return{destination:m,arrival:d(this),top_offset:l,viewport_offset:h}}}).sort(function(f,e){return f.top_offset<e.top_offset?-1:f.top_offset>e.top_offset?1:0})},data_attr:function(b){return this.namespace.length>0?this.namespace+"-"+b:b},off:function(){this.S(this.scope).off(".magellan"),this.S(c).off(".magellan")},reflow:function(){var a=this;d("["+a.add_namespace("data-magellan-expedition-clone")+"]",a.scope).remove()}}}(jQuery,this,this.document),function(){Foundation.libs.offcanvas={name:"offcanvas",version:"5.1.1",settings:{},init:function(){this.events()},events:function(){var b=this.S;b(this.scope).off(".offcanvas").on("click.fndtn.offcanvas",".left-off-canvas-toggle",function(a){a.preventDefault(),b(this).closest(".off-canvas-wrap").toggleClass("move-right")}).on("click.fndtn.offcanvas",".exit-off-canvas",function(a){a.preventDefault(),b(".off-canvas-wrap").removeClass("move-right")}).on("click.fndtn.offcanvas",".right-off-canvas-toggle",function(a){a.preventDefault(),b(this).closest(".off-canvas-wrap").toggleClass("move-left")}).on("click.fndtn.offcanvas",".exit-off-canvas",function(a){a.preventDefault(),b(".off-canvas-wrap").removeClass("move-left")})},reflow:function(){}}}(jQuery,this,this.document),function(r,q,p,o){var n=function(){},m=function(x,w){if(x.hasClass(w.slides_container_class)){return this}var v,u,t,i,h,d,c=this,b=x,a=0,y=!1;c.slides=function(){return b.children(w.slide_selector)},c.slides().first().addClass(w.active_slide_class),c.update_slide_number=function(e){w.slide_number&&(u.find("span:first").text(parseInt(e)+1),u.find("span:last").text(c.slides().length)),w.bullets&&(t.children().removeClass(w.bullets_active_class),r(t.children().get(e)).addClass(w.bullets_active_class))},c.update_active_link=function(e){var f=r('a[data-orbit-link="'+c.slides().eq(e).attr("data-orbit-slide")+'"]');f.siblings().removeClass(w.bullets_active_class),f.addClass(w.bullets_active_class)},c.build_markup=function(){b.wrap('<div class="'+w.container_class+'"></div>'),v=b.parent(),b.addClass(w.slides_container_class),w.navigation_arrows&&(v.append(r('<a href="#"><span></span></a>').addClass(w.prev_class)),v.append(r('<a href="#"><span></span></a>').addClass(w.next_class))),w.timer&&(i=r("<div>").addClass(w.timer_container_class),i.append("<span>"),i.append(r("<div>").addClass(w.timer_progress_class)),i.addClass(w.timer_paused_class),v.append(i)),w.slide_number&&(u=r("<div>").addClass(w.slide_number_class),u.append("<span></span> "+w.slide_number_text+" <span></span>"),v.append(u)),w.bullets&&(t=r("<ol>").addClass(w.bullets_container_class),v.append(t),t.wrap('<div class="orbit-bullets-container"></div>'),c.slides().each(function(e){var f=r("<li>").attr("data-orbit-slide",e);t.append(f)})),w.stack_on_small&&v.addClass(w.stack_on_small_class)},c._goto=function(f,E){if(f===a){return !1}"object"==typeof d&&d.restart();var D=c.slides(),C="next";if(y=!0,a>f&&(C="prev"),f>=D.length){if(!w.circular){return !1}f=0}else{if(0>f){if(!w.circular){return !1}f=D.length-1}}var B=r(D.get(a)),A=r(D.get(f));B.css("zIndex",2),B.removeClass(w.active_slide_class),A.css("zIndex",4).addClass(w.active_slide_class),b.trigger("before-slide-change.fndtn.orbit"),w.before_slide_change(),c.update_active_link(f);var z=function(){var e=function(){a=f,y=!1,E===!0&&(d=c.create_timer(),d.start()),c.update_slide_number(a),b.trigger("after-slide-change.fndtn.orbit",[{slide_number:a,total_slides:D.length}]),w.after_slide_change(a,D.length)};b.height()!=A.height()&&w.variable_height?b.animate({height:A.height()},250,"linear",e):e()};if(1===D.length){return z(),!1}var s=function(){"next"===C&&h.next(B,A,z),"prev"===C&&h.prev(B,A,z)};A.height()>b.height()&&w.variable_height?b.animate({height:A.height()},250,"linear",s):s()},c.next=function(e){e.stopImmediatePropagation(),e.preventDefault(),c._goto(a+1)},c.prev=function(e){e.stopImmediatePropagation(),e.preventDefault(),c._goto(a-1)},c.link_custom=function(e){e.preventDefault();var s=r(this).attr("data-orbit-link");if("string"==typeof s&&""!=(s=r.trim(s))){var f=v.find("[data-orbit-slide="+s+"]");-1!=f.index()&&c._goto(f.index())}},c.link_bullet=function(){var e=r(this).attr("data-orbit-slide");if("string"==typeof e&&""!=(e=r.trim(e))){if(isNaN(parseInt(e))){var f=v.find("[data-orbit-slide="+e+"]");-1!=f.index()&&c._goto(f.index()+1)}else{c._goto(parseInt(e))}}},c.timer_callback=function(){c._goto(a+1,!0)},c.compute_dimensions=function(){var e=r(c.slides().get(a)),f=e.height();w.variable_height||c.slides().each(function(){r(this).height()>f&&(f=r(this).height())}),b.height(f)},c.create_timer=function(){var e=new l(v.find("."+w.timer_container_class),w,c.timer_callback);return e},c.stop_timer=function(){"object"==typeof d&&d.stop()},c.toggle_timer=function(){var e=v.find("."+w.timer_container_class);e.hasClass(w.timer_paused_class)?("undefined"==typeof d&&(d=c.create_timer()),d.start()):"object"==typeof d&&d.stop()},c.init=function(){c.build_markup(),w.timer&&(d=c.create_timer(),Foundation.utils.image_loaded(this.slides().children("img"),d.start)),h=new j(w,b),"slide"===w.animation&&(h=new k(w,b)),v.on("click","."+w.next_class,c.next),v.on("click","."+w.prev_class,c.prev),v.on("click","[data-orbit-slide]",c.link_bullet),v.on("click",c.toggle_timer),w.swipe&&v.on("touchstart.fndtn.orbit",function(f){f.touches||(f=f.originalEvent);var e={start_page_x:f.touches[0].pageX,start_page_y:f.touches[0].pageY,start_time:(new Date).getTime(),delta_x:0,is_scrolling:o};v.data("swipe-transition",e),f.stopPropagation()}).on("touchmove.fndtn.orbit",function(f){if(f.touches||(f=f.originalEvent),!(f.touches.length>1||f.scale&&1!==f.scale)){var e=v.data("swipe-transition");if("undefined"==typeof e&&(e={}),e.delta_x=f.touches[0].pageX-e.start_page_x,"undefined"==typeof e.is_scrolling&&(e.is_scrolling=!!(e.is_scrolling||Math.abs(e.delta_x)<Math.abs(f.touches[0].pageY-e.start_page_y))),!e.is_scrolling&&!e.active){f.preventDefault();var s=e.delta_x<0?a+1:a-1;e.active=!0,c._goto(s)}}}).on("touchend.fndtn.orbit",function(e){v.data("swipe-transition",{}),e.stopPropagation()}),v.on("mouseenter.fndtn.orbit",function(){w.timer&&w.pause_on_hover&&c.stop_timer()}).on("mouseleave.fndtn.orbit",function(){w.timer&&w.resume_on_mouseout&&d.start()}),r(p).on("click","[data-orbit-link]",c.link_custom),r(q).on("resize",c.compute_dimensions),Foundation.utils.image_loaded(this.slides().children("img"),c.compute_dimensions),Foundation.utils.image_loaded(this.slides().children("img"),function(){v.prev(".preloader").css("display","none"),c.update_slide_number(0),c.update_active_link(0),b.trigger("ready.fndtn.orbit")})},c.init()},l=function(A,z,y){var x,w,v=this,u=z.timer_speed,t=A.find("."+z.timer_progress_class),s=-1;this.update_progress=function(d){var c=t.clone();c.attr("style",""),c.css("width",d+"%"),t.replaceWith(c),t=c},this.restart=function(){clearTimeout(w),A.addClass(z.timer_paused_class),s=-1,v.update_progress(0)},this.start=function(){return A.hasClass(z.timer_paused_class)?(s=-1===s?u:s,A.removeClass(z.timer_paused_class),x=(new Date).getTime(),t.animate({width:"100%"},s,"linear"),w=setTimeout(function(){v.restart(),y()},s),void A.trigger("timer-started.fndtn.orbit")):!0},this.stop=function(){if(A.hasClass(z.timer_paused_class)){return !0}clearTimeout(w),A.addClass(z.timer_paused_class);var b=(new Date).getTime();s-=b-x;var a=100-s/u*100;v.update_progress(a),A.trigger("timer-stopped.fndtn.orbit")}},k=function(a){var t=a.animation_speed,s=1===r("html[dir=rtl]").length,i=s?"marginRight":"marginLeft",h={};h[i]="0%",this.next=function(e,c,f){e.animate({marginLeft:"-100%"},t),c.animate(h,t,function(){e.css(i,"100%"),f()})},this.prev=function(e,c,f){e.animate({marginLeft:"100%"},t),c.css(i,"-100%"),c.animate(h,t,function(){e.css(i,"100%"),f()})}},j=function(a){var d=a.animation_speed;1===r("html[dir=rtl]").length;this.next=function(e,c,f){c.css({margin:"0%",opacity:"0.01"}),c.animate({opacity:"1"},d,"linear",function(){e.css("margin","100%"),f()})},this.prev=function(e,c,f){c.css({margin:"0%",opacity:"0.01"}),c.animate({opacity:"1"},d,"linear",function(){e.css("margin","100%"),f()})}};Foundation.libs=Foundation.libs||{},Foundation.libs.orbit={name:"orbit",version:"5.1.1",settings:{animation:"slide",timer_speed:10000,pause_on_hover:!0,resume_on_mouseout:!1,animation_speed:500,stack_on_small:!1,navigation_arrows:!0,slide_number:!0,slide_number_text:"of",container_class:"orbit-container",stack_on_small_class:"orbit-stack-on-small",next_class:"orbit-next",prev_class:"orbit-prev",timer_container_class:"orbit-timer",timer_paused_class:"paused",timer_progress_class:"orbit-progress",slides_container_class:"orbit-slides-container",slide_selector:"*",bullets_container_class:"orbit-bullets",bullets_active_class:"active",slide_number_class:"orbit-slide-number",caption_class:"orbit-caption",active_slide_class:"active",orbit_transition_class:"orbit-transitioning",bullets:!0,circular:!0,timer:!0,variable_height:!1,swipe:!0,before_slide_change:n,after_slide_change:n},init:function(e,d,f){this.bindings(d,f)},events:function(d){var c=new m(this.S(d),this.S(d).data("orbit-init"));this.S(d).data(self.name+"-instance",c)},reflow:function(){var e=this;if(e.S(e.scope).is("[data-orbit]")){var d=e.S(e.scope),f=d.data(e.name+"-instance");f.compute_dimensions()}else{e.S("[data-orbit]",e.scope).each(function(a,s){var i=e.S(s),h=(e.data_options(i),i.data(e.name+"-instance"));h.compute_dimensions()})}}}}(jQuery,this,this.document),function(f,e,i,h){Foundation.libs.reveal={name:"reveal",version:"5.1.1",locked:!1,settings:{animation:"fadeAndPop",animation_speed:250,close_on_background_click:!0,close_on_esc:!0,dismiss_modal_class:"close-reveal-modal",bg_class:"reveal-modal-bg",open:function(){},opened:function(){},close:function(){},closed:function(){},bg:f(".reveal-modal-bg"),css:{open:{opacity:0,visibility:"visible",display:"block"},close:{opacity:1,visibility:"hidden",display:"none"}}},init:function(a,k,j){f.extend(!0,this.settings,k,j),this.bindings(k,j)},events:function(){var d=this,c=d.S;return c(this.scope).off(".reveal").on("click.fndtn.reveal","["+this.add_namespace("data-reveal-id")+"]",function(k){if(k.preventDefault(),!d.locked){var j=c(this),b=j.data(d.data_attr("reveal-ajax"));if(d.locked=!0,"undefined"==typeof b){d.open.call(d,j)}else{var a=b===!0?j.attr("href"):b;d.open.call(d,j,{url:a})}}}),c(i).on("click.fndtn.reveal",this.close_targets(),function(j){if(j.preventDefault(),!d.locked){var b=c("["+d.attr_name()+"].open").data(d.attr_name(!0)+"-init"),a=c(j.target)[0]===c("."+b.bg_class)[0];if(a&&!b.close_on_background_click){return}d.locked=!0,d.close.call(d,a?c("["+d.attr_name()+"].open"):c(this).closest("["+d.attr_name()+"]"))}}),c("["+d.attr_name()+"]",this.scope).length>0?c(this.scope).on("open.fndtn.reveal",this.settings.open).on("opened.fndtn.reveal",this.settings.opened).on("opened.fndtn.reveal",this.open_video).on("close.fndtn.reveal",this.settings.close).on("closed.fndtn.reveal",this.settings.closed).on("closed.fndtn.reveal",this.close_video):c(this.scope).on("open.fndtn.reveal","["+d.attr_name()+"]",this.settings.open).on("opened.fndtn.reveal","["+d.attr_name()+"]",this.settings.opened).on("opened.fndtn.reveal","["+d.attr_name()+"]",this.open_video).on("close.fndtn.reveal","["+d.attr_name()+"]",this.settings.close).on("closed.fndtn.reveal","["+d.attr_name()+"]",this.settings.closed).on("closed.fndtn.reveal","["+d.attr_name()+"]",this.close_video),!0},key_up_on:function(){var b=this;return b.S("body").off("keyup.fndtn.reveal").on("keyup.fndtn.reveal",function(a){var k=b.S("["+b.attr_name()+"].open"),j=k.data(b.attr_name(!0)+"-init");j&&27===a.which&&j.close_on_esc&&!b.locked&&b.close.call(b,k)}),!0},key_up_off:function(){return this.S("body").off("keyup.fndtn.reveal"),!0},open:function(a,p){var o=this;if(a){if("undefined"!=typeof a.selector){var n=o.S("#"+a.data(o.data_attr("reveal-id")))}else{var n=o.S(this.scope);p=a}}else{var n=o.S(this.scope)}var m=n.data(o.attr_name(!0)+"-init");if(!n.hasClass("open")){var l=o.S("["+o.attr_name()+"].open");if("undefined"==typeof n.data("css-top")&&n.data("css-top",parseInt(n.css("top"),10)).data("offset",this.cache_offset(n)),this.key_up_on(n),n.trigger("open"),l.length<1&&this.toggle_bg(n),"string"==typeof p&&(p={url:p}),"undefined"!=typeof p&&p.url){var k="undefined"!=typeof p.success?p.success:null;f.extend(p,{success:function(d,s,r){if(f.isFunction(k)&&k(d,s,r),n.html(d),o.S(n).foundation("section","reflow"),l.length>0){var q=l.data(o.attr_name(!0));o.hide(l,q.css.close)}o.show(n,m.css.open)}}),f.ajax(p)}else{if(l.length>0){var j=l.data(o.attr_name(!0)+"-init");this.hide(l,j.css.close)}this.show(n,m.css.open)}}},close:function(j){var j=j&&j.length?j:this.S(this.scope),d=this.S("["+this.attr_name()+"].open"),k=j.data(this.attr_name(!0)+"-init");d.length>0&&(this.locked=!0,this.key_up_off(j),j.trigger("close"),this.toggle_bg(j),this.hide(d,k.css.close,k))},close_targets:function(){var b="."+this.settings.dismiss_modal_class;return this.settings.close_on_background_click?b+", ."+this.settings.bg_class:b},toggle_bg:function(a){a.data(this.attr_name(!0));0===this.S("."+this.settings.bg_class).length&&(this.settings.bg=f("<div />",{"class":this.settings.bg_class}).appendTo("body")),this.settings.bg.filter(":visible").length>0?this.hide(this.settings.bg):this.show(this.settings.bg)},show:function(m,l){if(l){var k=m.data(this.attr_name(!0)+"-init");if(0===m.parent("body").length){var j=m.wrap('<div style="display: none;" />').parent(),b=this.settings.rootElement||"body";m.on("closed.fndtn.reveal.wrapped",function(){m.detach().appendTo(j),m.unwrap().unbind("closed.fndtn.reveal.wrapped")}),m.detach().appendTo(b)}if(/pop/i.test(k.animation)){l.top=f(e).scrollTop()-m.data("offset")+"px";var a={top:f(e).scrollTop()+m.data("css-top")+"px",opacity:1};return setTimeout(function(){return m.css(l).animate(a,k.animation_speed,"linear",function(){this.locked=!1,m.trigger("opened")}.bind(this)).addClass("open")}.bind(this),k.animation_speed/2)}if(/fade/i.test(k.animation)){var a={opacity:1};return setTimeout(function(){return m.css(l).animate(a,k.animation_speed,"linear",function(){this.locked=!1,m.trigger("opened")}.bind(this)).addClass("open")}.bind(this),k.animation_speed/2)}return m.css(l).show().css({opacity:1}).addClass("open").trigger("opened")}var k=this.settings;return/fade/i.test(k.animation)?m.fadeIn(k.animation_speed/2):(this.locked=!1,m.show())},hide:function(k,j){if(j){var b=k.data(this.attr_name(!0)+"-init");if(/pop/i.test(b.animation)){var a={top:-f(e).scrollTop()-k.data("offset")+"px",opacity:0};return setTimeout(function(){return k.animate(a,b.animation_speed,"linear",function(){this.locked=!1,k.css(j).trigger("closed")}.bind(this)).removeClass("open")}.bind(this),b.animation_speed/2)}if(/fade/i.test(b.animation)){var a={opacity:0};return setTimeout(function(){return k.animate(a,b.animation_speed,"linear",function(){this.locked=!1,k.css(j).trigger("closed")}.bind(this)).removeClass("open")}.bind(this),b.animation_speed/2)}return k.hide().css(j).removeClass("open").trigger("closed")}var b=this.settings;return/fade/i.test(b.animation)?k.fadeOut(b.animation_speed/2):k.hide()},close_video:function(a){var k=f(".flex-video",a.target),j=f("iframe",k);j.length>0&&(j.attr("data-src",j[0].src),j.attr("src","about:blank"),k.hide())},open_video:function(a){var l=f(".flex-video",a.target),k=l.find("iframe");if(k.length>0){var j=k.attr("data-src");if("string"==typeof j){k[0].src=k.attr("data-src")}else{var d=k[0].src;k[0].src=h,k[0].src=d}l.show()}},data_attr:function(b){return this.namespace.length>0?this.namespace+"-"+b:b},cache_offset:function(d){var c=d.show().height()+parseInt(d.css("top"),10);return d.hide(),c},off:function(){f(this.scope).off(".fndtn.reveal")},reflow:function(){}}}(jQuery,this,this.document),function(){Foundation.libs.tab={name:"tab",version:"5.1.1",settings:{active_class:"active",callback:function(){}},init:function(e,d,f){this.bindings(d,f)},events:function(){var d=this,c=this.S;c(this.scope).off(".tab").on("click.fndtn.tab","["+this.attr_name()+"] > dd > a",function(l){l.preventDefault(),l.stopPropagation();var k=c(this).parent(),j=k.closest("["+d.attr_name()+"]"),i=c("#"+this.href.split("#")[1]),b=k.siblings(),a=j.data(d.attr_name(!0)+"-init");c(this).data(d.data_attr("tab-content"))&&(i=c("#"+c(this).data(d.data_attr("tab-content")).split("#")[1])),k.addClass(a.active_class).triggerHandler("opened"),b.removeClass(a.active_class),i.siblings().removeClass(a.active_class).end().addClass(a.active_class),a.callback(k),j.triggerHandler("toggled",[k])})},data_attr:function(b){return this.namespace.length>0?this.namespace+"-"+b:b},off:function(){},reflow:function(){}}}(jQuery,this,this.document),function(e,d,f){Foundation.libs.tooltip={name:"tooltip",version:"5.1.1",settings:{additional_inheritable_classes:[],tooltip_class:".tooltip",append_to:"body",touch_close_text:"Tap To Close",disable_for_touch:!1,hover_delay:200,tip_template:function(h,c){return'<span data-selector="'+h+'" class="'+Foundation.libs.tooltip.settings.tooltip_class.substring(1)+'">'+c+'<span class="nub"></span></span>'}},cache:{},init:function(i,h,j){Foundation.inherit(this,"random_str"),this.bindings(h,j)},events:function(){var a=this,c=a.S;Modernizr.touch?c(f).off(".tooltip").on("click.fndtn.tooltip touchstart.fndtn.tooltip touchend.fndtn.tooltip","["+this.attr_name()+"]:not(a)",function(h){var b=e.extend({},a.settings,a.data_options(c(this)));b.disable_for_touch||(h.preventDefault(),c(b.tooltip_class).hide(),a.showOrCreateTip(c(this)))}).on("click.fndtn.tooltip touchstart.fndtn.tooltip touchend.fndtn.tooltip",this.settings.tooltip_class,function(b){b.preventDefault(),c(this).fadeOut(150)}):c(f).off(".tooltip").on("mouseenter.fndtn.tooltip mouseleave.fndtn.tooltip","["+this.attr_name()+"]",function(b){var h=c(this);/enter|over/i.test(b.type)?this.timer=setTimeout(function(){a.showOrCreateTip(h)}.bind(this),a.settings.hover_delay):("mouseout"===b.type||"mouseleave"===b.type)&&(clearTimeout(this.timer),a.hide(h))})},showOrCreateTip:function(h){var c=this.getTip(h);return c&&c.length>0?this.show(h):this.create(h)},getTip:function(i){var h=this.selector(i),j=null;return h&&(j=this.S('span[data-selector="'+h+'"]'+this.settings.tooltip_class)),"object"==typeof j?j:!1},selector:function(i){var h=i.attr("id"),j=i.attr(this.attr_name())||i.attr("data-selector");return(h&&h.length<1||!h)&&"string"!=typeof j&&(j="tooltip"+this.random_str(6),i.attr("data-selector",j)),h&&h.length>0?h:j},create:function(a){var i=e(this.settings.tip_template(this.selector(a),e("<div></div>").html(a.attr("title")).html())),h=this.inheritable_classes(a);i.addClass(h).appendTo(this.settings.append_to),Modernizr.touch&&i.append('<span class="tap-to-close">'+this.settings.touch_close_text+"</span>"),a.removeAttr("title").attr("title",""),this.show(a)},reposition:function(r,q,p){var o,n,m,l,k;if(q.css("visibility","hidden").show(),o=r.data("width"),n=q.children(".nub"),m=n.outerHeight(),l=n.outerHeight(),q.css(this.small()?{width:"100%"}:{width:o?o:"auto"}),k=function(i,h,u,t,s){return i.css({top:h?h:"auto",bottom:t?t:"auto",left:s?s:"auto",right:u?u:"auto"}).end()},k(q,r.offset().top+r.outerHeight()+10,"auto","auto",r.offset().left),this.small()){k(q,r.offset().top+r.outerHeight()+10,"auto","auto",12.5,this.S(this.scope).width()),q.addClass("tip-override"),k(n,-m,"auto","auto",r.offset().left+10)}else{var j=r.offset().left;Foundation.rtl&&(j=r.offset().left+r.outerWidth()-q.outerWidth()),k(q,r.offset().top+r.outerHeight()+10,"auto","auto",j),q.removeClass("tip-override"),n.removeAttr("style"),p&&p.indexOf("tip-top")>-1?k(q,r.offset().top-q.outerHeight()-10,"auto","auto",j).removeClass("tip-override"):p&&p.indexOf("tip-left")>-1?k(q,r.offset().top+r.outerHeight()/2-q.outerHeight()/2,"auto","auto",r.offset().left-q.outerWidth()-m).removeClass("tip-override"):p&&p.indexOf("tip-right")>-1&&k(q,r.offset().top+r.outerHeight()/2-q.outerHeight()/2,"auto","auto",r.offset().left+r.outerWidth()+m).removeClass("tip-override")}q.css("visibility","visible").hide()},small:function(){return matchMedia(Foundation.media_queries.small).matches},inheritable_classes:function(a){var j=["tip-top","tip-left","tip-bottom","tip-right","radius","round"].concat(this.settings.additional_inheritable_classes),i=a.attr("class"),h=i?e.map(i.split(" "),function(c){return -1!==e.inArray(c,j)?c:void 0}).join(" "):"";return e.trim(h)},show:function(h){var c=this.getTip(h);return this.reposition(h,c,h.attr("class")),c.fadeIn(150)},hide:function(h){var c=this.getTip(h);return c.fadeOut(150)},reload:function(){var a=e(this);return a.data("fndtn-tooltips")?a.foundationTooltips("destroy").foundationTooltips("init"):a.foundationTooltips("init")},off:function(){this.S(this.scope).off(".fndtn.tooltip"),this.S(this.settings.tooltip_class).each(function(a){e("["+this.attr_name()+"]").get(a).attr("title",e(this).text())}).remove()},reflow:function(){}}}(jQuery,this,this.document),function(e,d,f){Foundation.libs.topbar={name:"topbar",version:"5.1.1",settings:{index:0,sticky_class:"sticky",custom_back_text:!0,back_text:"Back",is_hover:!0,mobile_show_parent_link:!1,scrolltop:!0},init:function(a,j,i){Foundation.inherit(this,"add_custom_rule register_media throttle");var h=this;h.register_media("topbar","foundation-mq-topbar"),this.bindings(j,i),h.S("["+this.attr_name()+"]",this.scope).each(function(){var k=h.S(this),m=k.data(h.attr_name(!0)+"-init");h.S("section",this),e("> ul",this).first();k.data("index",0);var l=k.parent();l.hasClass("fixed")||l.hasClass(m.sticky_class)?(h.settings.sticky_class=m.sticky_class,h.settings.sticky_topbar=k,k.data("height",l.outerHeight()),k.data("stickyoffset",l.offset().top)):k.data("height",k.outerHeight()),m.assembled||h.assemble(k),m.is_hover?h.S(".has-dropdown",k).addClass("not-click"):h.S(".has-dropdown",k).removeClass("not-click"),h.add_custom_rule(".f-topbar-fixed { padding-top: "+k.data("height")+"px }"),l.hasClass("fixed")&&h.S("body").addClass("f-topbar-fixed")})},toggle:function(j){var i=this;if(j){var h=i.S(j).closest("["+this.attr_name()+"]")}else{var h=i.S("["+this.attr_name()+"]")}var b=h.data(this.attr_name(!0)+"-init"),a=i.S("section, .section",h);i.breakpoint()&&(i.rtl?(a.css({right:"0%"}),e(">.name",a).css({right:"100%"})):(a.css({left:"0%"}),e(">.name",a).css({left:"100%"})),i.S("li.moved",a).removeClass("moved"),h.data("index",0),h.toggleClass("expanded").css("height","")),b.scrolltop?h.hasClass("expanded")?h.parent().hasClass("fixed")&&(b.scrolltop?(h.parent().removeClass("fixed"),h.addClass("fixed"),i.S("body").removeClass("f-topbar-fixed"),d.scrollTo(0,0)):h.parent().removeClass("expanded")):h.hasClass("fixed")&&(h.parent().addClass("fixed"),h.removeClass("fixed"),i.S("body").addClass("f-topbar-fixed")):(h.parent().hasClass(i.settings.sticky_class)&&h.parent().addClass("fixed"),h.parent().hasClass("fixed")&&(h.hasClass("expanded")?(h.addClass("fixed"),h.parent().addClass("expanded"),i.S("body").addClass("f-topbar-fixed")):(h.removeClass("fixed"),h.parent().removeClass("expanded"),i.update_sticky_positioning())))},timer:null,events:function(){var b=this,h=this.S;h(this.scope).off(".topbar").on("click.fndtn.topbar","["+this.attr_name()+"] .toggle-topbar",function(a){a.preventDefault(),b.toggle(this)}).on("click.fndtn.topbar","["+this.attr_name()+"] li.has-dropdown",function(a){var k=h(this),j=h(a.target),i=k.closest("["+b.attr_name()+"]"),c=i.data(b.attr_name(!0)+"-init");return j.data("revealId")?void b.toggle():void (b.breakpoint()||(!c.is_hover||Modernizr.touch)&&(a.stopImmediatePropagation(),k.hasClass("hover")?(k.removeClass("hover").find("li").removeClass("hover"),k.parents("li.hover").removeClass("hover")):(k.addClass("hover"),"A"===j[0].nodeName&&j.parent().hasClass("has-dropdown")&&a.preventDefault())))}).on("click.fndtn.topbar","["+this.attr_name()+"] .has-dropdown>a",function(a){if(b.breakpoint()){a.preventDefault();var k=h(this),j=k.closest("["+b.attr_name()+"]"),i=j.find("section, .section"),c=(k.next(".dropdown").outerHeight(),k.closest("li"));j.data("index",j.data("index")+1),c.addClass("moved"),b.rtl?(i.css({right:-(100*j.data("index"))+"%"}),i.find(">.name").css({right:100*j.data("index")+"%"})):(i.css({left:-(100*j.data("index"))+"%"}),i.find(">.name").css({left:100*j.data("index")+"%"})),j.css("height",k.siblings("ul").outerHeight(!0)+j.data("height"))}}),h(d).off(".topbar").on("resize.fndtn.topbar",b.throttle(function(){b.resize.call(b)},50)).trigger("resize"),h("body").off(".topbar").on("click.fndtn.topbar touchstart.fndtn.topbar",function(a){var c=h(a.target).closest("li").closest("li.hover");c.length>0||h("["+b.attr_name()+"] li").removeClass("hover")}),h(this.scope).on("click.fndtn.topbar","["+this.attr_name()+"] .has-dropdown .back",function(a){a.preventDefault();var l=h(this),k=l.closest("["+b.attr_name()+"]"),j=k.find("section, .section"),i=(k.data(b.attr_name(!0)+"-init"),l.closest("li.moved")),c=i.parent();k.data("index",k.data("index")-1),b.rtl?(j.css({right:-(100*k.data("index"))+"%"}),j.find(">.name").css({right:100*k.data("index")+"%"})):(j.css({left:-(100*k.data("index"))+"%"}),j.find(">.name").css({left:100*k.data("index")+"%"})),0===k.data("index")?k.css("height",""):k.css("height",c.outerHeight(!0)+k.data("height")),setTimeout(function(){i.removeClass("moved")},300)})},resize:function(){var b=this;b.S("["+this.attr_name()+"]").each(function(){var a,i=b.S(this),h=(i.data(b.attr_name(!0)+"-init"),i.parent("."+b.settings.sticky_class));if(!b.breakpoint()){var c=i.hasClass("expanded");i.css("height","").removeClass("expanded").find("li").removeClass("hover"),c&&b.toggle(i)}h.length>0&&(h.hasClass("fixed")?(h.removeClass("fixed"),a=h.offset().top,b.S(f.body).hasClass("f-topbar-fixed")&&(a-=i.data("height")),i.data("stickyoffset",a),h.addClass("fixed")):(a=h.offset().top,i.data("stickyoffset",a)))})},breakpoint:function(){return !matchMedia(Foundation.media_queries.topbar).matches},assemble:function(a){var j=this,i=a.data(this.attr_name(!0)+"-init"),h=j.S("section",a);e("> ul",a).first();h.detach(),j.S(".has-dropdown>a",h).each(function(){var c=j.S(this),m=c.siblings(".dropdown"),l=c.attr("href");if(!m.find(".title.back").length){if(i.mobile_show_parent_link&&l&&l.length>1){var k=e('<li class="title back js-generated"><h5><a href="javascript:void(0)"></a></h5></li><li><a class="parent-link js-generated" href="'+l+'">'+c.text()+"</a></li>")}else{var k=e('<li class="title back js-generated"><h5><a href="javascript:void(0)"></a></h5></li>')}e("h5>a",k).html(1==i.custom_back_text?i.back_text:"&laquo; "+c.html()),m.prepend(k)}}),h.appendTo(a),this.sticky(),this.assembled(a)},assembled:function(a){a.data(this.attr_name(!0),e.extend({},a.data(this.attr_name(!0)),{assembled:!0}))},height:function(a){var i=0,h=this;return e("> li",a).each(function(){i+=h.S(this).outerHeight(!0)}),i},sticky:function(){var b=(this.S(d),this);this.S(d).on("scroll",function(){b.update_sticky_positioning()})},update_sticky_positioning:function(){var b="."+this.settings.sticky_class,j=this.S(d),i=this;if(i.S(b).length>0){var h=this.settings.sticky_topbar.data("stickyoffset");i.S(b).hasClass("expanded")||(j.scrollTop()>h?i.S(b).hasClass("fixed")||(i.S(b).addClass("fixed"),i.S("body").addClass("f-topbar-fixed")):j.scrollTop()<=h&&i.S(b).hasClass("fixed")&&(i.S(b).removeClass("fixed"),i.S("body").removeClass("f-topbar-fixed")))}},off:function(){this.S(this.scope).off(".fndtn.topbar"),this.S(d).off(".fndtn.topbar")},reflow:function(){}}}(jQuery,this,this.document);
camelotceo/cdnjs
ajax/libs/pizza/0.2.1/js/vendor/dependencies.min.js
JavaScript
mit
228,533
<?php namespace GuzzleHttp\Promise; /** * A promise represents the eventual result of an asynchronous operation. * * The primary way of interacting with a promise is through its then method, * which registers callbacks to receive either a promise’s eventual value or * the reason why the promise cannot be fulfilled. * * @link https://promisesaplus.com/ */ interface PromiseInterface { const PENDING = 'pending'; const FULFILLED = 'fulfilled'; const REJECTED = 'rejected'; /** * Appends fulfillment and rejection handlers to the promise, and returns * a new promise resolving to the return value of the called handler. * * @param callable $onFulfilled Invoked when the promise fulfills. * @param callable $onRejected Invoked when the promise is rejected. * * @return PromiseInterface */ public function then( callable $onFulfilled = null, callable $onRejected = null ); /** * Appends a rejection handler callback to the promise, and returns a new * promise resolving to the return value of the callback if it is called, * or to its original fulfillment value if the promise is instead * fulfilled. * * @param callable $onRejected Invoked when the promise is rejected. * * @return PromiseInterface */ public function otherwise(callable $onRejected); /** * Get the state of the promise ("pending", "rejected", or "fulfilled"). * * The three states can be checked against the constants defined on * PromiseInterface: PENDING, FULFILLED, and REJECTED. * * @return string */ public function getState(); /** * Resolve the promise with the given value. * * @param mixed $value * @throws \RuntimeException if the promise is already resolved. */ public function resolve($value); /** * Reject the promise with the given reason. * * @param mixed $reason * @throws \RuntimeException if the promise is already resolved. */ public function reject($reason); /** * Cancels the promise if possible. * * @link https://github.com/promises-aplus/cancellation-spec/issues/7 */ public function cancel(); /** * Waits until the promise completes if possible. * * Pass $unwrap as true to unwrap the result of the promise, either * returning the resolved value or throwing the rejected exception. * * If the promise cannot be waited on, then the promise will be rejected. * * @param bool $unwrap * * @return mixed * @throws \LogicException if the promise has no wait function or if the * promise does not settle after waiting. */ public function wait($unwrap = true); }
zero12o/spartan_page
sparta_v0.0.1/assets/inc/vendor/vendor/guzzlehttp/promises/src/PromiseInterface.php
PHP
mit
2,830
.CodeMirror{font-family:monospace;height:300px}.CodeMirror-scroll{overflow:auto}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror div.CodeMirror-cursor{border-left:1px solid #000}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor{width:auto;border:0;background:#7e7}.cm-tab{display:inline-block}.CodeMirror-ruler{border-left:1px solid #ccc;position:absolute}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta,.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-invalidchar,.cm-s-default .cm-error{color:red}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden;background:#fff;color:#000}.CodeMirror-scroll{margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;height:100%;outline:0;position:relative;-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-sizer{position:relative;border-right:30px solid transparent;-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;padding-bottom:30px;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;-moz-box-sizing:content-box;box-sizing:content-box;padding-bottom:30px;margin-bottom:-32px;display:inline-block;*zoom:1;*display:inline}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-lines{cursor:text}.CodeMirror pre{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:0 0;font-family:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;overflow:auto}.CodeMirror-wrap .CodeMirror-scroll{overflow-x:hidden}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-measure pre{position:static}.CodeMirror div.CodeMirror-cursor{position:absolute;border-right:none;width:0}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:1}.CodeMirror-focused div.CodeMirror-cursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.cm-searching{background:#ffa;background:rgba(255,255,0,.4)}.CodeMirror span{*vertical-align:text-bottom}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.CodeMirror-hints{position:absolute;z-index:10;overflow:hidden;list-style:none;margin:0;padding:2px;-webkit-box-shadow:2px 3px 5px rgba(0,0,0,.2);-moz-box-shadow:2px 3px 5px rgba(0,0,0,.2);box-shadow:2px 3px 5px rgba(0,0,0,.2);border-radius:3px;border:1px solid silver;background:#fff;font-size:90%;font-family:monospace;max-height:20em;overflow-y:auto}.CodeMirror-hint{margin:0;padding:0 4px;border-radius:2px;overflow:hidden;white-space:pre;color:#000;cursor:pointer}.CodeMirror-hint-active{background:#08f;color:#fff}.CodeMirror{line-height:1.5em;border:1px solid #d1d1d1}.CodeMirror pre{font-size:13px}.CodeMirror-focused .cm-matchhighlight{background-color:#d9d9d9}.CodeMirror-hint{max-width:30em}.gutterError{color:red;display:inline-block;font-size:large;margin-left:3px;margin-top:-1px}span.cm-error{border-bottom:2px dotted red}.yasqe_buttons{position:absolute;top:5px;right:5px;z-index:5}.yasqe_buttons div{vertical-align:middle}.yasqe_queryButton{display:inline-block;cursor:pointer}.yasqe_share{cursor:pointer;margin-right:5px}.yasqe_sharePopup{position:absolute;z-index:7;padding:6px;background-color:#f5f5f5;border:1px solid #e3e3e3;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);box-shadow:inset 0 1px 1px rgba(0,0,0,.05);width:400px;height:auto}.yasqe_sharePopup textarea{width:100%}.completionNotification{color:#999;background-color:#f7f7f7;position:absolute;padding:0 5px;right:0;bottom:0;z-index:6;font-size:90%}.svgContainer{display:inline-block}
andyinabox/cdnjs
ajax/libs/yasqe/1.2.7/yasqe.min.css
CSS
mit
5,624
function Range(e,t,n){"use strict";return this instanceof Range?(invariant(0!==n,"Cannot step a Range by 0"),e=e||0,null==t&&(t=1/0),n=null==n?1:Math.abs(n),e>t&&(n=-n),this.$Range_start=e,this.$Range_end=t,this.$Range_step=n,void(this.length=Math.max(0,Math.ceil((t-e)/n-1)+1))):new Range(e,t,n)}function invariant(e,t){if(!e)throw new Error(t)}var IndexedSequence=require("./Sequence").IndexedSequence,Vector=require("./Vector");for(var IndexedSequence____Key in IndexedSequence)IndexedSequence.hasOwnProperty(IndexedSequence____Key)&&(Range[IndexedSequence____Key]=IndexedSequence[IndexedSequence____Key]);var ____SuperProtoOfIndexedSequence=null===IndexedSequence?null:IndexedSequence.prototype;Range.prototype=Object.create(____SuperProtoOfIndexedSequence),Range.prototype.constructor=Range,Range.__superConstructor__=IndexedSequence,Range.prototype.toString=function(){"use strict";return 0===this.length?"Range []":"Range [ "+this.$Range_start+"..."+this.$Range_end+(this.$Range_step>1?" by "+this.$Range_step:"")+" ]"},Range.prototype.has=function(e){"use strict";return invariant(e>=0,"Index out of bounds"),e<this.length},Range.prototype.get=function(e,t){"use strict";return invariant(e>=0,"Index out of bounds"),1/0===this.length||e<this.length?this.$Range_start+e*this.$Range_step:t},Range.prototype.contains=function(e){"use strict";var t=(e-this.$Range_start)/this.$Range_step;return t>=0&&t<this.length&&t===Math.floor(t)},Range.prototype.slice=function(e,t,n){"use strict";return n?____SuperProtoOfIndexedSequence.slice.call(this,e,t,n):(e=0>e?Math.max(0,this.length+e):Math.min(this.length,e),t=null==t?this.length:t>0?Math.min(this.length,t):Math.max(0,this.length+t),new Range(this.get(e),t===this.length?this.$Range_end:this.get(t),this.$Range_step))},Range.prototype.__deepEquals=function(e){"use strict";return this.$Range_start===e.$Range_start&&this.$Range_end===e.$Range_end&&this.$Range_step===e.$Range_step},Range.prototype.indexOf=function(e){"use strict";var t=e-this.$Range_start;if(t%this.$Range_step===0){var n=t/this.$Range_step;if(n>=0&&n<this.length)return n}return-1},Range.prototype.lastIndexOf=function(e){"use strict";return this.indexOf(e)},Range.prototype.take=function(e){"use strict";return this.slice(0,e)},Range.prototype.skip=function(e,t){"use strict";return t?____SuperProtoOfIndexedSequence.skip.call(this,e):this.slice(e)},Range.prototype.__iterate=function(e,t,n){"use strict";for(var r=t^n,s=this.length-1,a=this.$Range_step,i=t?this.$Range_start+s*a:this.$Range_start,o=0;s>=o&&e(i,r?s-o:o,this)!==!1;o++)i+=t?-a:a;return r?this.length:o},Range.prototype.__toJS=Range.prototype.toArray,Range.prototype.first=Vector.prototype.first,Range.prototype.last=Vector.prototype.last,module.exports=Range;
warpech/cdnjs
ajax/libs/immutable/2.0.1/Range.min.js
JavaScript
mit
2,749
function Repeat(e,t){"use strict";return 0===t&&__EMPTY_REPEAT?__EMPTY_REPEAT:this instanceof Repeat?(this.$Repeat_value=e,void(this.length=null==t?1/0:Math.max(0,t))):new Repeat(e,t)}function invariant(e,t){if(!e)throw new Error(t)}var IndexedSequence=require("./Sequence").IndexedSequence,Range=require("./Range");for(var IndexedSequence____Key in IndexedSequence)IndexedSequence.hasOwnProperty(IndexedSequence____Key)&&(Repeat[IndexedSequence____Key]=IndexedSequence[IndexedSequence____Key]);var ____SuperProtoOfIndexedSequence=null===IndexedSequence?null:IndexedSequence.prototype;Repeat.prototype=Object.create(____SuperProtoOfIndexedSequence),Repeat.prototype.constructor=Repeat,Repeat.__superConstructor__=IndexedSequence,Repeat.prototype.toString=function(){"use strict";return 0===this.length?"Repeat []":"Repeat [ "+this.$Repeat_value+" "+this.length+" times ]"},Repeat.prototype.get=function(e,t){"use strict";return invariant(e>=0,"Index out of bounds"),1/0===this.length||e<this.length?this.$Repeat_value:t},Repeat.prototype.first=function(){"use strict";return this.$Repeat_value},Repeat.prototype.contains=function(e){"use strict";var t=require("./Immutable").is;return t(this.$Repeat_value,e)},Repeat.prototype.__deepEquals=function(e){"use strict";var t=require("./Immutable").is;return t(this.$Repeat_value,e.$Repeat_value)},Repeat.prototype.slice=function(e,t,r){"use strict";if(r)return ____SuperProtoOfIndexedSequence.slice.call(this,e,t,r);var p=this.length;return e=0>e?Math.max(0,p+e):Math.min(p,e),t=null==t?p:t>0?Math.min(p,t):Math.max(0,p+t),t>e?new Repeat(this.$Repeat_value,t-e):__EMPTY_REPEAT},Repeat.prototype.reverse=function(e){"use strict";return e?____SuperProtoOfIndexedSequence.reverse.call(this,e):this},Repeat.prototype.indexOf=function(e){"use strict";var t=require("./Immutable").is;return t(this.$Repeat_value,e)?0:-1},Repeat.prototype.lastIndexOf=function(e){"use strict";var t=require("./Immutable").is;return t(this.$Repeat_value,e)?this.length:-1},Repeat.prototype.__iterate=function(e,t,r){"use strict";var p=t^r;invariant(!p||this.length<1/0,"Cannot access end of infinite range.");for(var o=this.length-1,n=0;o>=n&&e(this.$Repeat_value,p?o-n:n,this)!==!1;n++);return p?this.length:n},Repeat.prototype.has=Range.prototype.has,Repeat.prototype.toArray=Range.prototype.toArray,Repeat.prototype.toObject=Range.prototype.toObject,Repeat.prototype.toVector=Range.prototype.toVector,Repeat.prototype.toMap=Range.prototype.toMap,Repeat.prototype.toOrderedMap=Range.prototype.toOrderedMap,Repeat.prototype.toSet=Range.prototype.toSet,Repeat.prototype.take=Range.prototype.take,Repeat.prototype.skip=Range.prototype.skip,Repeat.prototype.last=Repeat.prototype.first,Repeat.prototype.__toJS=Range.prototype.__toJS;var __EMPTY_REPEAT=new Repeat(void 0,0);module.exports=Repeat;
dc-js/cdnjs
ajax/libs/immutable/2.0.2/Repeat.min.js
JavaScript
mit
2,814
/* Copyright (c) 2008-2015 Pivotal Labs Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ var getJasmineRequireObj = (function (jasmineGlobal) { var jasmineRequire; if (typeof module !== 'undefined' && module.exports) { jasmineGlobal = global; jasmineRequire = exports; } else { if (typeof window !== 'undefined' && typeof window.toString === 'function' && window.toString() === '[object GjsGlobal]') { jasmineGlobal = window; } jasmineRequire = jasmineGlobal.jasmineRequire = jasmineGlobal.jasmineRequire || {}; } function getJasmineRequire() { return jasmineRequire; } getJasmineRequire().core = function(jRequire) { var j$ = {}; jRequire.base(j$, jasmineGlobal); j$.util = jRequire.util(); j$.errors = jRequire.errors(); j$.Any = jRequire.Any(j$); j$.Anything = jRequire.Anything(j$); j$.CallTracker = jRequire.CallTracker(); j$.MockDate = jRequire.MockDate(); j$.Clock = jRequire.Clock(); j$.DelayedFunctionScheduler = jRequire.DelayedFunctionScheduler(); j$.Env = jRequire.Env(j$); j$.ExceptionFormatter = jRequire.ExceptionFormatter(); j$.Expectation = jRequire.Expectation(); j$.buildExpectationResult = jRequire.buildExpectationResult(); j$.JsApiReporter = jRequire.JsApiReporter(); j$.matchersUtil = jRequire.matchersUtil(j$); j$.ObjectContaining = jRequire.ObjectContaining(j$); j$.ArrayContaining = jRequire.ArrayContaining(j$); j$.pp = jRequire.pp(j$); j$.QueueRunner = jRequire.QueueRunner(j$); j$.ReportDispatcher = jRequire.ReportDispatcher(); j$.Spec = jRequire.Spec(j$); j$.SpyRegistry = jRequire.SpyRegistry(j$); j$.SpyStrategy = jRequire.SpyStrategy(); j$.StringMatching = jRequire.StringMatching(j$); j$.Suite = jRequire.Suite(j$); j$.Timer = jRequire.Timer(); j$.TreeProcessor = jRequire.TreeProcessor(); j$.version = jRequire.version(); j$.matchers = jRequire.requireMatchers(jRequire, j$); return j$; }; return getJasmineRequire; })(this); getJasmineRequireObj().requireMatchers = function(jRequire, j$) { var availableMatchers = [ 'toBe', 'toBeCloseTo', 'toBeDefined', 'toBeFalsy', 'toBeGreaterThan', 'toBeLessThan', 'toBeNaN', 'toBeNull', 'toBeTruthy', 'toBeUndefined', 'toContain', 'toEqual', 'toHaveBeenCalled', 'toHaveBeenCalledWith', 'toMatch', 'toThrow', 'toThrowError' ], matchers = {}; for (var i = 0; i < availableMatchers.length; i++) { var name = availableMatchers[i]; matchers[name] = jRequire[name](j$); } return matchers; }; getJasmineRequireObj().base = function(j$, jasmineGlobal) { j$.unimplementedMethod_ = function() { throw new Error('unimplemented method'); }; j$.MAX_PRETTY_PRINT_DEPTH = 40; j$.MAX_PRETTY_PRINT_ARRAY_LENGTH = 100; j$.DEFAULT_TIMEOUT_INTERVAL = 5000; j$.getGlobal = function() { return jasmineGlobal; }; j$.getEnv = function(options) { var env = j$.currentEnv_ = j$.currentEnv_ || new j$.Env(options); //jasmine. singletons in here (setTimeout blah blah). return env; }; j$.isArray_ = function(value) { return j$.isA_('Array', value); }; j$.isString_ = function(value) { return j$.isA_('String', value); }; j$.isNumber_ = function(value) { return j$.isA_('Number', value); }; j$.isA_ = function(typeName, value) { return Object.prototype.toString.apply(value) === '[object ' + typeName + ']'; }; j$.isDomNode = function(obj) { return obj.nodeType > 0; }; j$.fnNameFor = function(func) { return func.name || func.toString().match(/^\s*function\s*(\w*)\s*\(/)[1]; }; j$.any = function(clazz) { return new j$.Any(clazz); }; j$.anything = function() { return new j$.Anything(); }; j$.objectContaining = function(sample) { return new j$.ObjectContaining(sample); }; j$.stringMatching = function(expected) { return new j$.StringMatching(expected); }; j$.arrayContaining = function(sample) { return new j$.ArrayContaining(sample); }; j$.createSpy = function(name, originalFn) { var spyStrategy = new j$.SpyStrategy({ name: name, fn: originalFn, getSpy: function() { return spy; } }), callTracker = new j$.CallTracker(), spy = function() { var callData = { object: this, args: Array.prototype.slice.apply(arguments) }; callTracker.track(callData); var returnValue = spyStrategy.exec.apply(this, arguments); callData.returnValue = returnValue; return returnValue; }; for (var prop in originalFn) { if (prop === 'and' || prop === 'calls') { throw new Error('Jasmine spies would overwrite the \'and\' and \'calls\' properties on the object being spied upon'); } spy[prop] = originalFn[prop]; } spy.and = spyStrategy; spy.calls = callTracker; return spy; }; j$.isSpy = function(putativeSpy) { if (!putativeSpy) { return false; } return putativeSpy.and instanceof j$.SpyStrategy && putativeSpy.calls instanceof j$.CallTracker; }; j$.createSpyObj = function(baseName, methodNames) { if (j$.isArray_(baseName) && j$.util.isUndefined(methodNames)) { methodNames = baseName; baseName = 'unknown'; } if (!j$.isArray_(methodNames) || methodNames.length === 0) { throw 'createSpyObj requires a non-empty array of method names to create spies for'; } var obj = {}; for (var i = 0; i < methodNames.length; i++) { obj[methodNames[i]] = j$.createSpy(baseName + '.' + methodNames[i]); } return obj; }; }; getJasmineRequireObj().util = function() { var util = {}; util.inherit = function(childClass, parentClass) { var Subclass = function() { }; Subclass.prototype = parentClass.prototype; childClass.prototype = new Subclass(); }; util.htmlEscape = function(str) { if (!str) { return str; } return str.replace(/&/g, '&amp;') .replace(/</g, '&lt;') .replace(/>/g, '&gt;'); }; util.argsToArray = function(args) { var arrayOfArgs = []; for (var i = 0; i < args.length; i++) { arrayOfArgs.push(args[i]); } return arrayOfArgs; }; util.isUndefined = function(obj) { return obj === void 0; }; util.arrayContains = function(array, search) { var i = array.length; while (i--) { if (array[i] === search) { return true; } } return false; }; util.clone = function(obj) { if (Object.prototype.toString.apply(obj) === '[object Array]') { return obj.slice(); } var cloned = {}; for (var prop in obj) { if (obj.hasOwnProperty(prop)) { cloned[prop] = obj[prop]; } } return cloned; }; return util; }; getJasmineRequireObj().Spec = function(j$) { function Spec(attrs) { this.expectationFactory = attrs.expectationFactory; this.resultCallback = attrs.resultCallback || function() {}; this.id = attrs.id; this.description = attrs.description || ''; this.queueableFn = attrs.queueableFn; this.beforeAndAfterFns = attrs.beforeAndAfterFns || function() { return {befores: [], afters: []}; }; this.userContext = attrs.userContext || function() { return {}; }; this.onStart = attrs.onStart || function() {}; this.getSpecName = attrs.getSpecName || function() { return ''; }; this.expectationResultFactory = attrs.expectationResultFactory || function() { }; this.queueRunnerFactory = attrs.queueRunnerFactory || function() {}; this.catchingExceptions = attrs.catchingExceptions || function() { return true; }; this.throwOnExpectationFailure = !!attrs.throwOnExpectationFailure; if (!this.queueableFn.fn) { this.pend(); } this.result = { id: this.id, description: this.description, fullName: this.getFullName(), failedExpectations: [], passedExpectations: [], pendingReason: '' }; } Spec.prototype.addExpectationResult = function(passed, data, isError) { var expectationResult = this.expectationResultFactory(data); if (passed) { this.result.passedExpectations.push(expectationResult); } else { this.result.failedExpectations.push(expectationResult); if (this.throwOnExpectationFailure && !isError) { throw new j$.errors.ExpectationFailed(); } } }; Spec.prototype.expect = function(actual) { return this.expectationFactory(actual, this); }; Spec.prototype.execute = function(onComplete, enabled) { var self = this; this.onStart(this); if (!this.isExecutable() || this.markedPending || enabled === false) { complete(enabled); return; } var fns = this.beforeAndAfterFns(); var allFns = fns.befores.concat(this.queueableFn).concat(fns.afters); this.queueRunnerFactory({ queueableFns: allFns, onException: function() { self.onException.apply(self, arguments); }, onComplete: complete, userContext: this.userContext() }); function complete(enabledAgain) { self.result.status = self.status(enabledAgain); self.resultCallback(self.result); if (onComplete) { onComplete(); } } }; Spec.prototype.onException = function onException(e) { if (Spec.isPendingSpecException(e)) { this.pend(extractCustomPendingMessage(e)); return; } if (e instanceof j$.errors.ExpectationFailed) { return; } this.addExpectationResult(false, { matcherName: '', passed: false, expected: '', actual: '', error: e }, true); }; Spec.prototype.disable = function() { this.disabled = true; }; Spec.prototype.pend = function(message) { this.markedPending = true; if (message) { this.result.pendingReason = message; } }; Spec.prototype.getResult = function() { this.result.status = this.status(); return this.result; }; Spec.prototype.status = function(enabled) { if (this.disabled || enabled === false) { return 'disabled'; } if (this.markedPending) { return 'pending'; } if (this.result.failedExpectations.length > 0) { return 'failed'; } else { return 'passed'; } }; Spec.prototype.isExecutable = function() { return !this.disabled; }; Spec.prototype.getFullName = function() { return this.getSpecName(this); }; var extractCustomPendingMessage = function(e) { var fullMessage = e.toString(), boilerplateStart = fullMessage.indexOf(Spec.pendingSpecExceptionMessage), boilerplateEnd = boilerplateStart + Spec.pendingSpecExceptionMessage.length; return fullMessage.substr(boilerplateEnd); }; Spec.pendingSpecExceptionMessage = '=> marked Pending'; Spec.isPendingSpecException = function(e) { return !!(e && e.toString && e.toString().indexOf(Spec.pendingSpecExceptionMessage) !== -1); }; return Spec; }; if (typeof window == void 0 && typeof exports == 'object') { exports.Spec = jasmineRequire.Spec; } getJasmineRequireObj().Env = function(j$) { function Env(options) { options = options || {}; var self = this; var global = options.global || j$.getGlobal(); var totalSpecsDefined = 0; var catchExceptions = true; var realSetTimeout = j$.getGlobal().setTimeout; var realClearTimeout = j$.getGlobal().clearTimeout; this.clock = new j$.Clock(global, function () { return new j$.DelayedFunctionScheduler(); }, new j$.MockDate(global)); var runnableLookupTable = {}; var runnableResources = {}; var currentSpec = null; var currentlyExecutingSuites = []; var currentDeclarationSuite = null; var throwOnExpectationFailure = false; var currentSuite = function() { return currentlyExecutingSuites[currentlyExecutingSuites.length - 1]; }; var currentRunnable = function() { return currentSpec || currentSuite(); }; var reporter = new j$.ReportDispatcher([ 'jasmineStarted', 'jasmineDone', 'suiteStarted', 'suiteDone', 'specStarted', 'specDone' ]); this.specFilter = function() { return true; }; this.addCustomEqualityTester = function(tester) { if(!currentRunnable()) { throw new Error('Custom Equalities must be added in a before function or a spec'); } runnableResources[currentRunnable().id].customEqualityTesters.push(tester); }; this.addMatchers = function(matchersToAdd) { if(!currentRunnable()) { throw new Error('Matchers must be added in a before function or a spec'); } var customMatchers = runnableResources[currentRunnable().id].customMatchers; for (var matcherName in matchersToAdd) { customMatchers[matcherName] = matchersToAdd[matcherName]; } }; j$.Expectation.addCoreMatchers(j$.matchers); var nextSpecId = 0; var getNextSpecId = function() { return 'spec' + nextSpecId++; }; var nextSuiteId = 0; var getNextSuiteId = function() { return 'suite' + nextSuiteId++; }; var expectationFactory = function(actual, spec) { return j$.Expectation.Factory({ util: j$.matchersUtil, customEqualityTesters: runnableResources[spec.id].customEqualityTesters, customMatchers: runnableResources[spec.id].customMatchers, actual: actual, addExpectationResult: addExpectationResult }); function addExpectationResult(passed, result) { return spec.addExpectationResult(passed, result); } }; var defaultResourcesForRunnable = function(id, parentRunnableId) { var resources = {spies: [], customEqualityTesters: [], customMatchers: {}}; if(runnableResources[parentRunnableId]){ resources.customEqualityTesters = j$.util.clone(runnableResources[parentRunnableId].customEqualityTesters); resources.customMatchers = j$.util.clone(runnableResources[parentRunnableId].customMatchers); } runnableResources[id] = resources; }; var clearResourcesForRunnable = function(id) { spyRegistry.clearSpies(); delete runnableResources[id]; }; var beforeAndAfterFns = function(suite) { return function() { var befores = [], afters = []; while(suite) { befores = befores.concat(suite.beforeFns); afters = afters.concat(suite.afterFns); suite = suite.parentSuite; } return { befores: befores.reverse(), afters: afters }; }; }; var getSpecName = function(spec, suite) { return suite.getFullName() + ' ' + spec.description; }; // TODO: we may just be able to pass in the fn instead of wrapping here var buildExpectationResult = j$.buildExpectationResult, exceptionFormatter = new j$.ExceptionFormatter(), expectationResultFactory = function(attrs) { attrs.messageFormatter = exceptionFormatter.message; attrs.stackFormatter = exceptionFormatter.stack; return buildExpectationResult(attrs); }; // TODO: fix this naming, and here's where the value comes in this.catchExceptions = function(value) { catchExceptions = !!value; return catchExceptions; }; this.catchingExceptions = function() { return catchExceptions; }; var maximumSpecCallbackDepth = 20; var currentSpecCallbackDepth = 0; function clearStack(fn) { currentSpecCallbackDepth++; if (currentSpecCallbackDepth >= maximumSpecCallbackDepth) { currentSpecCallbackDepth = 0; realSetTimeout(fn, 0); } else { fn(); } } var catchException = function(e) { return j$.Spec.isPendingSpecException(e) || catchExceptions; }; this.throwOnExpectationFailure = function(value) { throwOnExpectationFailure = !!value; }; this.throwingExpectationFailures = function() { return throwOnExpectationFailure; }; var queueRunnerFactory = function(options) { options.catchException = catchException; options.clearStack = options.clearStack || clearStack; options.timeout = {setTimeout: realSetTimeout, clearTimeout: realClearTimeout}; options.fail = self.fail; new j$.QueueRunner(options).execute(); }; var topSuite = new j$.Suite({ env: this, id: getNextSuiteId(), description: 'Jasmine__TopLevel__Suite', queueRunner: queueRunnerFactory }); runnableLookupTable[topSuite.id] = topSuite; defaultResourcesForRunnable(topSuite.id); currentDeclarationSuite = topSuite; this.topSuite = function() { return topSuite; }; this.execute = function(runnablesToRun) { if(!runnablesToRun) { if (focusedRunnables.length) { runnablesToRun = focusedRunnables; } else { runnablesToRun = [topSuite.id]; } } var processor = new j$.TreeProcessor({ tree: topSuite, runnableIds: runnablesToRun, queueRunnerFactory: queueRunnerFactory, nodeStart: function(suite) { currentlyExecutingSuites.push(suite); defaultResourcesForRunnable(suite.id, suite.parentSuite.id); reporter.suiteStarted(suite.result); }, nodeComplete: function(suite, result) { if (!suite.disabled) { clearResourcesForRunnable(suite.id); } currentlyExecutingSuites.pop(); reporter.suiteDone(result); } }); if(!processor.processTree().valid) { throw new Error('Invalid order: would cause a beforeAll or afterAll to be run multiple times'); } reporter.jasmineStarted({ totalSpecsDefined: totalSpecsDefined }); processor.execute(reporter.jasmineDone); }; this.addReporter = function(reporterToAdd) { reporter.addReporter(reporterToAdd); }; var spyRegistry = new j$.SpyRegistry({currentSpies: function() { if(!currentRunnable()) { throw new Error('Spies must be created in a before function or a spec'); } return runnableResources[currentRunnable().id].spies; }}); this.spyOn = function() { return spyRegistry.spyOn.apply(spyRegistry, arguments); }; var suiteFactory = function(description) { var suite = new j$.Suite({ env: self, id: getNextSuiteId(), description: description, parentSuite: currentDeclarationSuite, expectationFactory: expectationFactory, expectationResultFactory: expectationResultFactory, throwOnExpectationFailure: throwOnExpectationFailure }); runnableLookupTable[suite.id] = suite; return suite; }; this.describe = function(description, specDefinitions) { var suite = suiteFactory(description); addSpecsToSuite(suite, specDefinitions); return suite; }; this.xdescribe = function(description, specDefinitions) { var suite = this.describe(description, specDefinitions); suite.disable(); return suite; }; var focusedRunnables = []; this.fdescribe = function(description, specDefinitions) { var suite = suiteFactory(description); suite.isFocused = true; focusedRunnables.push(suite.id); unfocusAncestor(); addSpecsToSuite(suite, specDefinitions); return suite; }; function addSpecsToSuite(suite, specDefinitions) { var parentSuite = currentDeclarationSuite; parentSuite.addChild(suite); currentDeclarationSuite = suite; var declarationError = null; try { specDefinitions.call(suite); } catch (e) { declarationError = e; } if (declarationError) { self.it('encountered a declaration exception', function() { throw declarationError; }); } currentDeclarationSuite = parentSuite; } function findFocusedAncestor(suite) { while (suite) { if (suite.isFocused) { return suite.id; } suite = suite.parentSuite; } return null; } function unfocusAncestor() { var focusedAncestor = findFocusedAncestor(currentDeclarationSuite); if (focusedAncestor) { for (var i = 0; i < focusedRunnables.length; i++) { if (focusedRunnables[i] === focusedAncestor) { focusedRunnables.splice(i, 1); break; } } } } var specFactory = function(description, fn, suite, timeout) { totalSpecsDefined++; var spec = new j$.Spec({ id: getNextSpecId(), beforeAndAfterFns: beforeAndAfterFns(suite), expectationFactory: expectationFactory, resultCallback: specResultCallback, getSpecName: function(spec) { return getSpecName(spec, suite); }, onStart: specStarted, description: description, expectationResultFactory: expectationResultFactory, queueRunnerFactory: queueRunnerFactory, userContext: function() { return suite.clonedSharedUserContext(); }, queueableFn: { fn: fn, timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; } }, throwOnExpectationFailure: throwOnExpectationFailure }); runnableLookupTable[spec.id] = spec; if (!self.specFilter(spec)) { spec.disable(); } return spec; function specResultCallback(result) { clearResourcesForRunnable(spec.id); currentSpec = null; reporter.specDone(result); } function specStarted(spec) { currentSpec = spec; defaultResourcesForRunnable(spec.id, suite.id); reporter.specStarted(spec.result); } }; this.it = function(description, fn, timeout) { var spec = specFactory(description, fn, currentDeclarationSuite, timeout); currentDeclarationSuite.addChild(spec); return spec; }; this.xit = function() { var spec = this.it.apply(this, arguments); spec.pend(); return spec; }; this.fit = function(){ var spec = this.it.apply(this, arguments); focusedRunnables.push(spec.id); unfocusAncestor(); return spec; }; this.expect = function(actual) { if (!currentRunnable()) { throw new Error('\'expect\' was used when there was no current spec, this could be because an asynchronous test timed out'); } return currentRunnable().expect(actual); }; this.beforeEach = function(beforeEachFunction, timeout) { currentDeclarationSuite.beforeEach({ fn: beforeEachFunction, timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; } }); }; this.beforeAll = function(beforeAllFunction, timeout) { currentDeclarationSuite.beforeAll({ fn: beforeAllFunction, timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; } }); }; this.afterEach = function(afterEachFunction, timeout) { currentDeclarationSuite.afterEach({ fn: afterEachFunction, timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; } }); }; this.afterAll = function(afterAllFunction, timeout) { currentDeclarationSuite.afterAll({ fn: afterAllFunction, timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; } }); }; this.pending = function(message) { var fullMessage = j$.Spec.pendingSpecExceptionMessage; if(message) { fullMessage += message; } throw fullMessage; }; this.fail = function(error) { var message = 'Failed'; if (error) { message += ': '; message += error.message || error; } currentRunnable().addExpectationResult(false, { matcherName: '', passed: false, expected: '', actual: '', message: message, error: error && error.message ? error : null }); }; } return Env; }; getJasmineRequireObj().JsApiReporter = function() { var noopTimer = { start: function(){}, elapsed: function(){ return 0; } }; function JsApiReporter(options) { var timer = options.timer || noopTimer, status = 'loaded'; this.started = false; this.finished = false; this.jasmineStarted = function() { this.started = true; status = 'started'; timer.start(); }; var executionTime; this.jasmineDone = function() { this.finished = true; executionTime = timer.elapsed(); status = 'done'; }; this.status = function() { return status; }; var suites = [], suites_hash = {}; this.suiteStarted = function(result) { suites_hash[result.id] = result; }; this.suiteDone = function(result) { storeSuite(result); }; this.suiteResults = function(index, length) { return suites.slice(index, index + length); }; function storeSuite(result) { suites.push(result); suites_hash[result.id] = result; } this.suites = function() { return suites_hash; }; var specs = []; this.specDone = function(result) { specs.push(result); }; this.specResults = function(index, length) { return specs.slice(index, index + length); }; this.specs = function() { return specs; }; this.executionTime = function() { return executionTime; }; } return JsApiReporter; }; getJasmineRequireObj().CallTracker = function() { function CallTracker() { var calls = []; this.track = function(context) { calls.push(context); }; this.any = function() { return !!calls.length; }; this.count = function() { return calls.length; }; this.argsFor = function(index) { var call = calls[index]; return call ? call.args : []; }; this.all = function() { return calls; }; this.allArgs = function() { var callArgs = []; for(var i = 0; i < calls.length; i++){ callArgs.push(calls[i].args); } return callArgs; }; this.first = function() { return calls[0]; }; this.mostRecent = function() { return calls[calls.length - 1]; }; this.reset = function() { calls = []; }; } return CallTracker; }; getJasmineRequireObj().Clock = function() { function Clock(global, delayedFunctionSchedulerFactory, mockDate) { var self = this, realTimingFunctions = { setTimeout: global.setTimeout, clearTimeout: global.clearTimeout, setInterval: global.setInterval, clearInterval: global.clearInterval }, fakeTimingFunctions = { setTimeout: setTimeout, clearTimeout: clearTimeout, setInterval: setInterval, clearInterval: clearInterval }, installed = false, delayedFunctionScheduler, timer; self.install = function() { if(!originalTimingFunctionsIntact()) { throw new Error('Jasmine Clock was unable to install over custom global timer functions. Is the clock already installed?'); } replace(global, fakeTimingFunctions); timer = fakeTimingFunctions; delayedFunctionScheduler = delayedFunctionSchedulerFactory(); installed = true; return self; }; self.uninstall = function() { delayedFunctionScheduler = null; mockDate.uninstall(); replace(global, realTimingFunctions); timer = realTimingFunctions; installed = false; }; self.withMock = function(closure) { this.install(); try { closure(); } finally { this.uninstall(); } }; self.mockDate = function(initialDate) { mockDate.install(initialDate); }; self.setTimeout = function(fn, delay, params) { if (legacyIE()) { if (arguments.length > 2) { throw new Error('IE < 9 cannot support extra params to setTimeout without a polyfill'); } return timer.setTimeout(fn, delay); } return Function.prototype.apply.apply(timer.setTimeout, [global, arguments]); }; self.setInterval = function(fn, delay, params) { if (legacyIE()) { if (arguments.length > 2) { throw new Error('IE < 9 cannot support extra params to setInterval without a polyfill'); } return timer.setInterval(fn, delay); } return Function.prototype.apply.apply(timer.setInterval, [global, arguments]); }; self.clearTimeout = function(id) { return Function.prototype.call.apply(timer.clearTimeout, [global, id]); }; self.clearInterval = function(id) { return Function.prototype.call.apply(timer.clearInterval, [global, id]); }; self.tick = function(millis) { if (installed) { mockDate.tick(millis); delayedFunctionScheduler.tick(millis); } else { throw new Error('Mock clock is not installed, use jasmine.clock().install()'); } }; return self; function originalTimingFunctionsIntact() { return global.setTimeout === realTimingFunctions.setTimeout && global.clearTimeout === realTimingFunctions.clearTimeout && global.setInterval === realTimingFunctions.setInterval && global.clearInterval === realTimingFunctions.clearInterval; } function legacyIE() { //if these methods are polyfilled, apply will be present return !(realTimingFunctions.setTimeout || realTimingFunctions.setInterval).apply; } function replace(dest, source) { for (var prop in source) { dest[prop] = source[prop]; } } function setTimeout(fn, delay) { return delayedFunctionScheduler.scheduleFunction(fn, delay, argSlice(arguments, 2)); } function clearTimeout(id) { return delayedFunctionScheduler.removeFunctionWithId(id); } function setInterval(fn, interval) { return delayedFunctionScheduler.scheduleFunction(fn, interval, argSlice(arguments, 2), true); } function clearInterval(id) { return delayedFunctionScheduler.removeFunctionWithId(id); } function argSlice(argsObj, n) { return Array.prototype.slice.call(argsObj, n); } } return Clock; }; getJasmineRequireObj().DelayedFunctionScheduler = function() { function DelayedFunctionScheduler() { var self = this; var scheduledLookup = []; var scheduledFunctions = {}; var currentTime = 0; var delayedFnCount = 0; self.tick = function(millis) { millis = millis || 0; var endTime = currentTime + millis; runScheduledFunctions(endTime); currentTime = endTime; }; self.scheduleFunction = function(funcToCall, millis, params, recurring, timeoutKey, runAtMillis) { var f; if (typeof(funcToCall) === 'string') { /* jshint evil: true */ f = function() { return eval(funcToCall); }; /* jshint evil: false */ } else { f = funcToCall; } millis = millis || 0; timeoutKey = timeoutKey || ++delayedFnCount; runAtMillis = runAtMillis || (currentTime + millis); var funcToSchedule = { runAtMillis: runAtMillis, funcToCall: f, recurring: recurring, params: params, timeoutKey: timeoutKey, millis: millis }; if (runAtMillis in scheduledFunctions) { scheduledFunctions[runAtMillis].push(funcToSchedule); } else { scheduledFunctions[runAtMillis] = [funcToSchedule]; scheduledLookup.push(runAtMillis); scheduledLookup.sort(function (a, b) { return a - b; }); } return timeoutKey; }; self.removeFunctionWithId = function(timeoutKey) { for (var runAtMillis in scheduledFunctions) { var funcs = scheduledFunctions[runAtMillis]; var i = indexOfFirstToPass(funcs, function (func) { return func.timeoutKey === timeoutKey; }); if (i > -1) { if (funcs.length === 1) { delete scheduledFunctions[runAtMillis]; deleteFromLookup(runAtMillis); } else { funcs.splice(i, 1); } // intervals get rescheduled when executed, so there's never more // than a single scheduled function with a given timeoutKey break; } } }; return self; function indexOfFirstToPass(array, testFn) { var index = -1; for (var i = 0; i < array.length; ++i) { if (testFn(array[i])) { index = i; break; } } return index; } function deleteFromLookup(key) { var value = Number(key); var i = indexOfFirstToPass(scheduledLookup, function (millis) { return millis === value; }); if (i > -1) { scheduledLookup.splice(i, 1); } } function reschedule(scheduledFn) { self.scheduleFunction(scheduledFn.funcToCall, scheduledFn.millis, scheduledFn.params, true, scheduledFn.timeoutKey, scheduledFn.runAtMillis + scheduledFn.millis); } function forEachFunction(funcsToRun, callback) { for (var i = 0; i < funcsToRun.length; ++i) { callback(funcsToRun[i]); } } function runScheduledFunctions(endTime) { if (scheduledLookup.length === 0 || scheduledLookup[0] > endTime) { return; } do { currentTime = scheduledLookup.shift(); var funcsToRun = scheduledFunctions[currentTime]; delete scheduledFunctions[currentTime]; forEachFunction(funcsToRun, function(funcToRun) { if (funcToRun.recurring) { reschedule(funcToRun); } }); forEachFunction(funcsToRun, function(funcToRun) { funcToRun.funcToCall.apply(null, funcToRun.params || []); }); } while (scheduledLookup.length > 0 && // checking first if we're out of time prevents setTimeout(0) // scheduled in a funcToRun from forcing an extra iteration currentTime !== endTime && scheduledLookup[0] <= endTime); } } return DelayedFunctionScheduler; }; getJasmineRequireObj().ExceptionFormatter = function() { function ExceptionFormatter() { this.message = function(error) { var message = ''; if (error.name && error.message) { message += error.name + ': ' + error.message; } else { message += error.toString() + ' thrown'; } if (error.fileName || error.sourceURL) { message += ' in ' + (error.fileName || error.sourceURL); } if (error.line || error.lineNumber) { message += ' (line ' + (error.line || error.lineNumber) + ')'; } return message; }; this.stack = function(error) { return error ? error.stack : null; }; } return ExceptionFormatter; }; getJasmineRequireObj().Expectation = function() { function Expectation(options) { this.util = options.util || { buildFailureMessage: function() {} }; this.customEqualityTesters = options.customEqualityTesters || []; this.actual = options.actual; this.addExpectationResult = options.addExpectationResult || function(){}; this.isNot = options.isNot; var customMatchers = options.customMatchers || {}; for (var matcherName in customMatchers) { this[matcherName] = Expectation.prototype.wrapCompare(matcherName, customMatchers[matcherName]); } } Expectation.prototype.wrapCompare = function(name, matcherFactory) { return function() { var args = Array.prototype.slice.call(arguments, 0), expected = args.slice(0), message = ''; args.unshift(this.actual); var matcher = matcherFactory(this.util, this.customEqualityTesters), matcherCompare = matcher.compare; function defaultNegativeCompare() { var result = matcher.compare.apply(null, args); result.pass = !result.pass; return result; } if (this.isNot) { matcherCompare = matcher.negativeCompare || defaultNegativeCompare; } var result = matcherCompare.apply(null, args); if (!result.pass) { if (!result.message) { args.unshift(this.isNot); args.unshift(name); message = this.util.buildFailureMessage.apply(null, args); } else { if (Object.prototype.toString.apply(result.message) === '[object Function]') { message = result.message(); } else { message = result.message; } } } if (expected.length == 1) { expected = expected[0]; } // TODO: how many of these params are needed? this.addExpectationResult( result.pass, { matcherName: name, passed: result.pass, message: message, actual: this.actual, expected: expected // TODO: this may need to be arrayified/sliced } ); }; }; Expectation.addCoreMatchers = function(matchers) { var prototype = Expectation.prototype; for (var matcherName in matchers) { var matcher = matchers[matcherName]; prototype[matcherName] = prototype.wrapCompare(matcherName, matcher); } }; Expectation.Factory = function(options) { options = options || {}; var expect = new Expectation(options); // TODO: this would be nice as its own Object - NegativeExpectation // TODO: copy instead of mutate options options.isNot = true; expect.not = new Expectation(options); return expect; }; return Expectation; }; //TODO: expectation result may make more sense as a presentation of an expectation. getJasmineRequireObj().buildExpectationResult = function() { function buildExpectationResult(options) { var messageFormatter = options.messageFormatter || function() {}, stackFormatter = options.stackFormatter || function() {}; var result = { matcherName: options.matcherName, message: message(), stack: stack(), passed: options.passed }; if(!result.passed) { result.expected = options.expected; result.actual = options.actual; } return result; function message() { if (options.passed) { return 'Passed.'; } else if (options.message) { return options.message; } else if (options.error) { return messageFormatter(options.error); } return ''; } function stack() { if (options.passed) { return ''; } var error = options.error; if (!error) { try { throw new Error(message()); } catch (e) { error = e; } } return stackFormatter(error); } } return buildExpectationResult; }; getJasmineRequireObj().MockDate = function() { function MockDate(global) { var self = this; var currentTime = 0; if (!global || !global.Date) { self.install = function() {}; self.tick = function() {}; self.uninstall = function() {}; return self; } var GlobalDate = global.Date; self.install = function(mockDate) { if (mockDate instanceof GlobalDate) { currentTime = mockDate.getTime(); } else { currentTime = new GlobalDate().getTime(); } global.Date = FakeDate; }; self.tick = function(millis) { millis = millis || 0; currentTime = currentTime + millis; }; self.uninstall = function() { currentTime = 0; global.Date = GlobalDate; }; createDateProperties(); return self; function FakeDate() { switch(arguments.length) { case 0: return new GlobalDate(currentTime); case 1: return new GlobalDate(arguments[0]); case 2: return new GlobalDate(arguments[0], arguments[1]); case 3: return new GlobalDate(arguments[0], arguments[1], arguments[2]); case 4: return new GlobalDate(arguments[0], arguments[1], arguments[2], arguments[3]); case 5: return new GlobalDate(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4]); case 6: return new GlobalDate(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]); default: return new GlobalDate(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5], arguments[6]); } } function createDateProperties() { FakeDate.prototype = GlobalDate.prototype; FakeDate.now = function() { if (GlobalDate.now) { return currentTime; } else { throw new Error('Browser does not support Date.now()'); } }; FakeDate.toSource = GlobalDate.toSource; FakeDate.toString = GlobalDate.toString; FakeDate.parse = GlobalDate.parse; FakeDate.UTC = GlobalDate.UTC; } } return MockDate; }; getJasmineRequireObj().pp = function(j$) { function PrettyPrinter() { this.ppNestLevel_ = 0; this.seen = []; } PrettyPrinter.prototype.format = function(value) { this.ppNestLevel_++; try { if (j$.util.isUndefined(value)) { this.emitScalar('undefined'); } else if (value === null) { this.emitScalar('null'); } else if (value === 0 && 1/value === -Infinity) { this.emitScalar('-0'); } else if (value === j$.getGlobal()) { this.emitScalar('<global>'); } else if (value.jasmineToString) { this.emitScalar(value.jasmineToString()); } else if (typeof value === 'string') { this.emitString(value); } else if (j$.isSpy(value)) { this.emitScalar('spy on ' + value.and.identity()); } else if (value instanceof RegExp) { this.emitScalar(value.toString()); } else if (typeof value === 'function') { this.emitScalar('Function'); } else if (typeof value.nodeType === 'number') { this.emitScalar('HTMLNode'); } else if (value instanceof Date) { this.emitScalar('Date(' + value + ')'); } else if (j$.util.arrayContains(this.seen, value)) { this.emitScalar('<circular reference: ' + (j$.isArray_(value) ? 'Array' : 'Object') + '>'); } else if (j$.isArray_(value) || j$.isA_('Object', value)) { this.seen.push(value); if (j$.isArray_(value)) { this.emitArray(value); } else { this.emitObject(value); } this.seen.pop(); } else { this.emitScalar(value.toString()); } } finally { this.ppNestLevel_--; } }; PrettyPrinter.prototype.iterateObject = function(obj, fn) { for (var property in obj) { if (!Object.prototype.hasOwnProperty.call(obj, property)) { continue; } fn(property, obj.__lookupGetter__ ? (!j$.util.isUndefined(obj.__lookupGetter__(property)) && obj.__lookupGetter__(property) !== null) : false); } }; PrettyPrinter.prototype.emitArray = j$.unimplementedMethod_; PrettyPrinter.prototype.emitObject = j$.unimplementedMethod_; PrettyPrinter.prototype.emitScalar = j$.unimplementedMethod_; PrettyPrinter.prototype.emitString = j$.unimplementedMethod_; function StringPrettyPrinter() { PrettyPrinter.call(this); this.string = ''; } j$.util.inherit(StringPrettyPrinter, PrettyPrinter); StringPrettyPrinter.prototype.emitScalar = function(value) { this.append(value); }; StringPrettyPrinter.prototype.emitString = function(value) { this.append('\'' + value + '\''); }; StringPrettyPrinter.prototype.emitArray = function(array) { if (this.ppNestLevel_ > j$.MAX_PRETTY_PRINT_DEPTH) { this.append('Array'); return; } var length = Math.min(array.length, j$.MAX_PRETTY_PRINT_ARRAY_LENGTH); this.append('[ '); for (var i = 0; i < length; i++) { if (i > 0) { this.append(', '); } this.format(array[i]); } if(array.length > length){ this.append(', ...'); } var self = this; var first = array.length === 0; this.iterateObject(array, function(property, isGetter) { if (property.match(/^\d+$/)) { return; } if (first) { first = false; } else { self.append(', '); } self.formatProperty(array, property, isGetter); }); this.append(' ]'); }; StringPrettyPrinter.prototype.emitObject = function(obj) { var constructorName = obj.constructor ? j$.fnNameFor(obj.constructor) : 'null'; this.append(constructorName); if (this.ppNestLevel_ > j$.MAX_PRETTY_PRINT_DEPTH) { return; } var self = this; this.append('({ '); var first = true; this.iterateObject(obj, function(property, isGetter) { if (first) { first = false; } else { self.append(', '); } self.formatProperty(obj, property, isGetter); }); this.append(' })'); }; StringPrettyPrinter.prototype.formatProperty = function(obj, property, isGetter) { this.append(property); this.append(': '); if (isGetter) { this.append('<getter>'); } else { this.format(obj[property]); } }; StringPrettyPrinter.prototype.append = function(value) { this.string += value; }; return function(value) { var stringPrettyPrinter = new StringPrettyPrinter(); stringPrettyPrinter.format(value); return stringPrettyPrinter.string; }; }; getJasmineRequireObj().QueueRunner = function(j$) { function once(fn) { var called = false; return function() { if (!called) { called = true; fn(); } }; } function QueueRunner(attrs) { this.queueableFns = attrs.queueableFns || []; this.onComplete = attrs.onComplete || function() {}; this.clearStack = attrs.clearStack || function(fn) {fn();}; this.onException = attrs.onException || function() {}; this.catchException = attrs.catchException || function() { return true; }; this.userContext = attrs.userContext || {}; this.timeout = attrs.timeout || {setTimeout: setTimeout, clearTimeout: clearTimeout}; this.fail = attrs.fail || function() {}; } QueueRunner.prototype.execute = function() { this.run(this.queueableFns, 0); }; QueueRunner.prototype.run = function(queueableFns, recursiveIndex) { var length = queueableFns.length, self = this, iterativeIndex; for(iterativeIndex = recursiveIndex; iterativeIndex < length; iterativeIndex++) { var queueableFn = queueableFns[iterativeIndex]; if (queueableFn.fn.length > 0) { attemptAsync(queueableFn); return; } else { attemptSync(queueableFn); } } var runnerDone = iterativeIndex >= length; if (runnerDone) { this.clearStack(this.onComplete); } function attemptSync(queueableFn) { try { queueableFn.fn.call(self.userContext); } catch (e) { handleException(e, queueableFn); } } function attemptAsync(queueableFn) { var clearTimeout = function () { Function.prototype.apply.apply(self.timeout.clearTimeout, [j$.getGlobal(), [timeoutId]]); }, next = once(function () { clearTimeout(timeoutId); self.run(queueableFns, iterativeIndex + 1); }), timeoutId; next.fail = function() { self.fail.apply(null, arguments); next(); }; if (queueableFn.timeout) { timeoutId = Function.prototype.apply.apply(self.timeout.setTimeout, [j$.getGlobal(), [function() { var error = new Error('Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.'); onException(error, queueableFn); next(); }, queueableFn.timeout()]]); } try { queueableFn.fn.call(self.userContext, next); } catch (e) { handleException(e, queueableFn); next(); } } function onException(e, queueableFn) { self.onException(e); } function handleException(e, queueableFn) { onException(e, queueableFn); if (!self.catchException(e)) { //TODO: set a var when we catch an exception and //use a finally block to close the loop in a nice way.. throw e; } } }; return QueueRunner; }; getJasmineRequireObj().ReportDispatcher = function() { function ReportDispatcher(methods) { var dispatchedMethods = methods || []; for (var i = 0; i < dispatchedMethods.length; i++) { var method = dispatchedMethods[i]; this[method] = (function(m) { return function() { dispatch(m, arguments); }; }(method)); } var reporters = []; this.addReporter = function(reporter) { reporters.push(reporter); }; return this; function dispatch(method, args) { for (var i = 0; i < reporters.length; i++) { var reporter = reporters[i]; if (reporter[method]) { reporter[method].apply(reporter, args); } } } } return ReportDispatcher; }; getJasmineRequireObj().SpyRegistry = function(j$) { function SpyRegistry(options) { options = options || {}; var currentSpies = options.currentSpies || function() { return []; }; this.spyOn = function(obj, methodName) { if (j$.util.isUndefined(obj)) { throw new Error('spyOn could not find an object to spy upon for ' + methodName + '()'); } if (j$.util.isUndefined(methodName)) { throw new Error('No method name supplied'); } if (j$.util.isUndefined(obj[methodName])) { throw new Error(methodName + '() method does not exist'); } if (obj[methodName] && j$.isSpy(obj[methodName])) { //TODO?: should this return the current spy? Downside: may cause user confusion about spy state throw new Error(methodName + ' has already been spied upon'); } var spy = j$.createSpy(methodName, obj[methodName]); currentSpies().push({ spy: spy, baseObj: obj, methodName: methodName, originalValue: obj[methodName] }); obj[methodName] = spy; return spy; }; this.clearSpies = function() { var spies = currentSpies(); for (var i = 0; i < spies.length; i++) { var spyEntry = spies[i]; spyEntry.baseObj[spyEntry.methodName] = spyEntry.originalValue; } }; } return SpyRegistry; }; getJasmineRequireObj().SpyStrategy = function() { function SpyStrategy(options) { options = options || {}; var identity = options.name || 'unknown', originalFn = options.fn || function() {}, getSpy = options.getSpy || function() {}, plan = function() {}; this.identity = function() { return identity; }; this.exec = function() { return plan.apply(this, arguments); }; this.callThrough = function() { plan = originalFn; return getSpy(); }; this.returnValue = function(value) { plan = function() { return value; }; return getSpy(); }; this.returnValues = function() { var values = Array.prototype.slice.call(arguments); plan = function () { return values.shift(); }; return getSpy(); }; this.throwError = function(something) { var error = (something instanceof Error) ? something : new Error(something); plan = function() { throw error; }; return getSpy(); }; this.callFake = function(fn) { plan = fn; return getSpy(); }; this.stub = function(fn) { plan = function() {}; return getSpy(); }; } return SpyStrategy; }; getJasmineRequireObj().Suite = function(j$) { function Suite(attrs) { this.env = attrs.env; this.id = attrs.id; this.parentSuite = attrs.parentSuite; this.description = attrs.description; this.expectationFactory = attrs.expectationFactory; this.expectationResultFactory = attrs.expectationResultFactory; this.throwOnExpectationFailure = !!attrs.throwOnExpectationFailure; this.beforeFns = []; this.afterFns = []; this.beforeAllFns = []; this.afterAllFns = []; this.disabled = false; this.children = []; this.result = { id: this.id, description: this.description, fullName: this.getFullName(), failedExpectations: [] }; } Suite.prototype.expect = function(actual) { return this.expectationFactory(actual, this); }; Suite.prototype.getFullName = function() { var fullName = this.description; for (var parentSuite = this.parentSuite; parentSuite; parentSuite = parentSuite.parentSuite) { if (parentSuite.parentSuite) { fullName = parentSuite.description + ' ' + fullName; } } return fullName; }; Suite.prototype.disable = function() { this.disabled = true; }; Suite.prototype.beforeEach = function(fn) { this.beforeFns.unshift(fn); }; Suite.prototype.beforeAll = function(fn) { this.beforeAllFns.push(fn); }; Suite.prototype.afterEach = function(fn) { this.afterFns.unshift(fn); }; Suite.prototype.afterAll = function(fn) { this.afterAllFns.push(fn); }; Suite.prototype.addChild = function(child) { this.children.push(child); }; Suite.prototype.status = function() { if (this.disabled) { return 'disabled'; } if (this.result.failedExpectations.length > 0) { return 'failed'; } else { return 'finished'; } }; Suite.prototype.isExecutable = function() { return !this.disabled; }; Suite.prototype.canBeReentered = function() { return this.beforeAllFns.length === 0 && this.afterAllFns.length === 0; }; Suite.prototype.getResult = function() { this.result.status = this.status(); return this.result; }; Suite.prototype.sharedUserContext = function() { if (!this.sharedContext) { this.sharedContext = this.parentSuite ? clone(this.parentSuite.sharedUserContext()) : {}; } return this.sharedContext; }; Suite.prototype.clonedSharedUserContext = function() { return clone(this.sharedUserContext()); }; Suite.prototype.onException = function() { if (arguments[0] instanceof j$.errors.ExpectationFailed) { return; } if(isAfterAll(this.children)) { var data = { matcherName: '', passed: false, expected: '', actual: '', error: arguments[0] }; this.result.failedExpectations.push(this.expectationResultFactory(data)); } else { for (var i = 0; i < this.children.length; i++) { var child = this.children[i]; child.onException.apply(child, arguments); } } }; Suite.prototype.addExpectationResult = function () { if(isAfterAll(this.children) && isFailure(arguments)){ var data = arguments[1]; this.result.failedExpectations.push(this.expectationResultFactory(data)); if(this.throwOnExpectationFailure) { throw new j$.errors.ExpectationFailed(); } } else { for (var i = 0; i < this.children.length; i++) { var child = this.children[i]; try { child.addExpectationResult.apply(child, arguments); } catch(e) { // keep going } } } }; function isAfterAll(children) { return children && children[0].result.status; } function isFailure(args) { return !args[0]; } function clone(obj) { var clonedObj = {}; for (var prop in obj) { if (obj.hasOwnProperty(prop)) { clonedObj[prop] = obj[prop]; } } return clonedObj; } return Suite; }; if (typeof window == void 0 && typeof exports == 'object') { exports.Suite = jasmineRequire.Suite; } getJasmineRequireObj().Timer = function() { var defaultNow = (function(Date) { return function() { return new Date().getTime(); }; })(Date); function Timer(options) { options = options || {}; var now = options.now || defaultNow, startTime; this.start = function() { startTime = now(); }; this.elapsed = function() { return now() - startTime; }; } return Timer; }; getJasmineRequireObj().TreeProcessor = function() { function TreeProcessor(attrs) { var tree = attrs.tree, runnableIds = attrs.runnableIds, queueRunnerFactory = attrs.queueRunnerFactory, nodeStart = attrs.nodeStart || function() {}, nodeComplete = attrs.nodeComplete || function() {}, stats = { valid: true }, processed = false, defaultMin = Infinity, defaultMax = 1 - Infinity; this.processTree = function() { processNode(tree, false); processed = true; return stats; }; this.execute = function(done) { if (!processed) { this.processTree(); } if (!stats.valid) { throw 'invalid order'; } var childFns = wrapChildren(tree, 0); queueRunnerFactory({ queueableFns: childFns, userContext: tree.sharedUserContext(), onException: function() { tree.onException.apply(tree, arguments); }, onComplete: done }); }; function runnableIndex(id) { for (var i = 0; i < runnableIds.length; i++) { if (runnableIds[i] === id) { return i; } } } function processNode(node, parentEnabled) { var executableIndex = runnableIndex(node.id); if (executableIndex !== undefined) { parentEnabled = true; } parentEnabled = parentEnabled && node.isExecutable(); if (!node.children) { stats[node.id] = { executable: parentEnabled && node.isExecutable(), segments: [{ index: 0, owner: node, nodes: [node], min: startingMin(executableIndex), max: startingMax(executableIndex) }] }; } else { var hasExecutableChild = false; for (var i = 0; i < node.children.length; i++) { var child = node.children[i]; processNode(child, parentEnabled); if (!stats.valid) { return; } var childStats = stats[child.id]; hasExecutableChild = hasExecutableChild || childStats.executable; } stats[node.id] = { executable: hasExecutableChild }; segmentChildren(node, stats[node.id], executableIndex); if (!node.canBeReentered() && stats[node.id].segments.length > 1) { stats = { valid: false }; } } } function startingMin(executableIndex) { return executableIndex === undefined ? defaultMin : executableIndex; } function startingMax(executableIndex) { return executableIndex === undefined ? defaultMax : executableIndex; } function segmentChildren(node, nodeStats, executableIndex) { var currentSegment = { index: 0, owner: node, nodes: [], min: startingMin(executableIndex), max: startingMax(executableIndex) }, result = [currentSegment], lastMax = defaultMax, orderedChildSegments = orderChildSegments(node.children); function isSegmentBoundary(minIndex) { return lastMax !== defaultMax && minIndex !== defaultMin && lastMax < minIndex - 1; } for (var i = 0; i < orderedChildSegments.length; i++) { var childSegment = orderedChildSegments[i], maxIndex = childSegment.max, minIndex = childSegment.min; if (isSegmentBoundary(minIndex)) { currentSegment = {index: result.length, owner: node, nodes: [], min: defaultMin, max: defaultMax}; result.push(currentSegment); } currentSegment.nodes.push(childSegment); currentSegment.min = Math.min(currentSegment.min, minIndex); currentSegment.max = Math.max(currentSegment.max, maxIndex); lastMax = maxIndex; } nodeStats.segments = result; } function orderChildSegments(children) { var specifiedOrder = [], unspecifiedOrder = []; for (var i = 0; i < children.length; i++) { var child = children[i], segments = stats[child.id].segments; for (var j = 0; j < segments.length; j++) { var seg = segments[j]; if (seg.min === defaultMin) { unspecifiedOrder.push(seg); } else { specifiedOrder.push(seg); } } } specifiedOrder.sort(function(a, b) { return a.min - b.min; }); return specifiedOrder.concat(unspecifiedOrder); } function executeNode(node, segmentNumber) { if (node.children) { return { fn: function(done) { nodeStart(node); queueRunnerFactory({ onComplete: function() { nodeComplete(node, node.getResult()); done(); }, queueableFns: wrapChildren(node, segmentNumber), userContext: node.sharedUserContext(), onException: function() { node.onException.apply(node, arguments); } }); } }; } else { return { fn: function(done) { node.execute(done, stats[node.id].executable); } }; } } function wrapChildren(node, segmentNumber) { var result = [], segmentChildren = stats[node.id].segments[segmentNumber].nodes; for (var i = 0; i < segmentChildren.length; i++) { result.push(executeNode(segmentChildren[i].owner, segmentChildren[i].index)); } if (!stats[node.id].executable) { return result; } return node.beforeAllFns.concat(result).concat(node.afterAllFns); } } return TreeProcessor; }; getJasmineRequireObj().Any = function(j$) { function Any(expectedObject) { this.expectedObject = expectedObject; } Any.prototype.asymmetricMatch = function(other) { if (this.expectedObject == String) { return typeof other == 'string' || other instanceof String; } if (this.expectedObject == Number) { return typeof other == 'number' || other instanceof Number; } if (this.expectedObject == Function) { return typeof other == 'function' || other instanceof Function; } if (this.expectedObject == Object) { return typeof other == 'object'; } if (this.expectedObject == Boolean) { return typeof other == 'boolean'; } return other instanceof this.expectedObject; }; Any.prototype.jasmineToString = function() { return '<jasmine.any(' + j$.fnNameFor(this.expectedObject) + ')>'; }; return Any; }; getJasmineRequireObj().Anything = function(j$) { function Anything() {} Anything.prototype.asymmetricMatch = function(other) { return !j$.util.isUndefined(other) && other !== null; }; Anything.prototype.jasmineToString = function() { return '<jasmine.anything>'; }; return Anything; }; getJasmineRequireObj().ArrayContaining = function(j$) { function ArrayContaining(sample) { this.sample = sample; } ArrayContaining.prototype.asymmetricMatch = function(other) { var className = Object.prototype.toString.call(this.sample); if (className !== '[object Array]') { throw new Error('You must provide an array to arrayContaining, not \'' + this.sample + '\'.'); } for (var i = 0; i < this.sample.length; i++) { var item = this.sample[i]; if (!j$.matchersUtil.contains(other, item)) { return false; } } return true; }; ArrayContaining.prototype.jasmineToString = function () { return '<jasmine.arrayContaining(' + jasmine.pp(this.sample) +')>'; }; return ArrayContaining; }; getJasmineRequireObj().ObjectContaining = function(j$) { function ObjectContaining(sample) { this.sample = sample; } function getPrototype(obj) { if (Object.getPrototypeOf) { return Object.getPrototypeOf(obj); } if (obj.constructor.prototype == obj) { return null; } return obj.constructor.prototype; } function hasProperty(obj, property) { if (!obj) { return false; } if (Object.prototype.hasOwnProperty.call(obj, property)) { return true; } return hasProperty(getPrototype(obj), property); } ObjectContaining.prototype.asymmetricMatch = function(other) { if (typeof(this.sample) !== 'object') { throw new Error('You must provide an object to objectContaining, not \''+this.sample+'\'.'); } for (var property in this.sample) { if (!hasProperty(other, property) || !j$.matchersUtil.equals(this.sample[property], other[property])) { return false; } } return true; }; ObjectContaining.prototype.jasmineToString = function() { return '<jasmine.objectContaining(' + j$.pp(this.sample) + ')>'; }; return ObjectContaining; }; getJasmineRequireObj().StringMatching = function(j$) { function StringMatching(expected) { if (!j$.isString_(expected) && !j$.isA_('RegExp', expected)) { throw new Error('Expected is not a String or a RegExp'); } this.regexp = new RegExp(expected); } StringMatching.prototype.asymmetricMatch = function(other) { return this.regexp.test(other); }; StringMatching.prototype.jasmineToString = function() { return '<jasmine.stringMatching(' + this.regexp + ')>'; }; return StringMatching; }; getJasmineRequireObj().errors = function() { function ExpectationFailed() {} ExpectationFailed.prototype = new Error(); ExpectationFailed.prototype.constructor = ExpectationFailed; return { ExpectationFailed: ExpectationFailed }; }; getJasmineRequireObj().matchersUtil = function(j$) { // TODO: what to do about jasmine.pp not being inject? move to JSON.stringify? gut PrettyPrinter? return { equals: function(a, b, customTesters) { customTesters = customTesters || []; return eq(a, b, [], [], customTesters); }, contains: function(haystack, needle, customTesters) { customTesters = customTesters || []; if ((Object.prototype.toString.apply(haystack) === '[object Array]') || (!!haystack && !haystack.indexOf)) { for (var i = 0; i < haystack.length; i++) { if (eq(haystack[i], needle, [], [], customTesters)) { return true; } } return false; } return !!haystack && haystack.indexOf(needle) >= 0; }, buildFailureMessage: function() { var args = Array.prototype.slice.call(arguments, 0), matcherName = args[0], isNot = args[1], actual = args[2], expected = args.slice(3), englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) { return ' ' + s.toLowerCase(); }); var message = 'Expected ' + j$.pp(actual) + (isNot ? ' not ' : ' ') + englishyPredicate; if (expected.length > 0) { for (var i = 0; i < expected.length; i++) { if (i > 0) { message += ','; } message += ' ' + j$.pp(expected[i]); } } return message + '.'; } }; function isAsymmetric(obj) { return obj && j$.isA_('Function', obj.asymmetricMatch); } function asymmetricMatch(a, b) { var asymmetricA = isAsymmetric(a), asymmetricB = isAsymmetric(b); if (asymmetricA && asymmetricB) { return undefined; } if (asymmetricA) { return a.asymmetricMatch(b); } if (asymmetricB) { return b.asymmetricMatch(a); } } // Equality function lovingly adapted from isEqual in // [Underscore](http://underscorejs.org) function eq(a, b, aStack, bStack, customTesters) { var result = true; var asymmetricResult = asymmetricMatch(a, b); if (!j$.util.isUndefined(asymmetricResult)) { return asymmetricResult; } for (var i = 0; i < customTesters.length; i++) { var customTesterResult = customTesters[i](a, b); if (!j$.util.isUndefined(customTesterResult)) { return customTesterResult; } } if (a instanceof Error && b instanceof Error) { return a.message == b.message; } // 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; } var className = Object.prototype.toString.call(a); if (className != Object.prototype.toString.call(b)) { return false; } switch (className) { // Strings, numbers, dates, and booleans are compared by value. case '[object String]': // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is // equivalent to `new String("5")`. return a == String(b); case '[object Number]': // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for // other numeric values. return a != +a ? b != +b : (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; // RegExps are compared by their source patterns and flags. case '[object RegExp]': return a.source == b.source && a.global == b.global && a.multiline == b.multiline && a.ignoreCase == b.ignoreCase; } if (typeof a != 'object' || typeof b != 'object') { return false; } var aIsDomNode = j$.isDomNode(a); var bIsDomNode = j$.isDomNode(b); if (aIsDomNode && bIsDomNode) { // At first try to use DOM3 method isEqualNode if (a.isEqualNode) { return a.isEqualNode(b); } // IE8 doesn't support isEqualNode, try to use outerHTML && innerText var aIsElement = a instanceof Element; var bIsElement = b instanceof Element; if (aIsElement && bIsElement) { return a.outerHTML == b.outerHTML; } if (aIsElement || bIsElement) { return false; } return a.innerText == b.innerText && a.textContent == b.textContent; } if (aIsDomNode || bIsDomNode) { 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`. 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); var size = 0; // Recursively compare objects and arrays. // Compare array lengths to determine if a deep comparison is necessary. if (className == '[object Array]' && a.length !== b.length) { result = false; } if (result) { // Objects with different constructors are not equivalent, but `Object`s // or `Array`s from different frames are. if (className !== '[object Array]') { var aCtor = a.constructor, bCtor = b.constructor; if (aCtor !== bCtor && !(isFunction(aCtor) && aCtor instanceof aCtor && isFunction(bCtor) && bCtor instanceof bCtor)) { return false; } } // Deep compare objects. for (var key in a) { if (has(a, key)) { // Count the expected number of properties. size++; // Deep compare each member. if (!(result = has(b, key) && eq(a[key], b[key], aStack, bStack, customTesters))) { break; } } } // Ensure that both objects contain the same number of properties. if (result) { for (key in b) { if (has(b, key) && !(size--)) { break; } } result = !size; } } // Remove the first object from the stack of traversed objects. aStack.pop(); bStack.pop(); return result; function has(obj, key) { return Object.prototype.hasOwnProperty.call(obj, key); } function isFunction(obj) { return typeof obj === 'function'; } } }; getJasmineRequireObj().toBe = function() { function toBe() { return { compare: function(actual, expected) { return { pass: actual === expected }; } }; } return toBe; }; getJasmineRequireObj().toBeCloseTo = function() { function toBeCloseTo() { return { compare: function(actual, expected, precision) { if (precision !== 0) { precision = precision || 2; } return { pass: Math.abs(expected - actual) < (Math.pow(10, -precision) / 2) }; } }; } return toBeCloseTo; }; getJasmineRequireObj().toBeDefined = function() { function toBeDefined() { return { compare: function(actual) { return { pass: (void 0 !== actual) }; } }; } return toBeDefined; }; getJasmineRequireObj().toBeFalsy = function() { function toBeFalsy() { return { compare: function(actual) { return { pass: !!!actual }; } }; } return toBeFalsy; }; getJasmineRequireObj().toBeGreaterThan = function() { function toBeGreaterThan() { return { compare: function(actual, expected) { return { pass: actual > expected }; } }; } return toBeGreaterThan; }; getJasmineRequireObj().toBeLessThan = function() { function toBeLessThan() { return { compare: function(actual, expected) { return { pass: actual < expected }; } }; } return toBeLessThan; }; getJasmineRequireObj().toBeNaN = function(j$) { function toBeNaN() { return { compare: function(actual) { var result = { pass: (actual !== actual) }; if (result.pass) { result.message = 'Expected actual not to be NaN.'; } else { result.message = function() { return 'Expected ' + j$.pp(actual) + ' to be NaN.'; }; } return result; } }; } return toBeNaN; }; getJasmineRequireObj().toBeNull = function() { function toBeNull() { return { compare: function(actual) { return { pass: actual === null }; } }; } return toBeNull; }; getJasmineRequireObj().toBeTruthy = function() { function toBeTruthy() { return { compare: function(actual) { return { pass: !!actual }; } }; } return toBeTruthy; }; getJasmineRequireObj().toBeUndefined = function() { function toBeUndefined() { return { compare: function(actual) { return { pass: void 0 === actual }; } }; } return toBeUndefined; }; getJasmineRequireObj().toContain = function() { function toContain(util, customEqualityTesters) { customEqualityTesters = customEqualityTesters || []; return { compare: function(actual, expected) { return { pass: util.contains(actual, expected, customEqualityTesters) }; } }; } return toContain; }; getJasmineRequireObj().toEqual = function() { function toEqual(util, customEqualityTesters) { customEqualityTesters = customEqualityTesters || []; return { compare: function(actual, expected) { var result = { pass: false }; result.pass = util.equals(actual, expected, customEqualityTesters); return result; } }; } return toEqual; }; getJasmineRequireObj().toHaveBeenCalled = function(j$) { function toHaveBeenCalled() { return { compare: function(actual) { var result = {}; if (!j$.isSpy(actual)) { throw new Error('Expected a spy, but got ' + j$.pp(actual) + '.'); } if (arguments.length > 1) { throw new Error('toHaveBeenCalled does not take arguments, use toHaveBeenCalledWith'); } result.pass = actual.calls.any(); result.message = result.pass ? 'Expected spy ' + actual.and.identity() + ' not to have been called.' : 'Expected spy ' + actual.and.identity() + ' to have been called.'; return result; } }; } return toHaveBeenCalled; }; getJasmineRequireObj().toHaveBeenCalledWith = function(j$) { function toHaveBeenCalledWith(util, customEqualityTesters) { return { compare: function() { var args = Array.prototype.slice.call(arguments, 0), actual = args[0], expectedArgs = args.slice(1), result = { pass: false }; if (!j$.isSpy(actual)) { throw new Error('Expected a spy, but got ' + j$.pp(actual) + '.'); } if (!actual.calls.any()) { result.message = function() { return 'Expected spy ' + actual.and.identity() + ' to have been called with ' + j$.pp(expectedArgs) + ' but it was never called.'; }; return result; } if (util.contains(actual.calls.allArgs(), expectedArgs, customEqualityTesters)) { result.pass = true; result.message = function() { return 'Expected spy ' + actual.and.identity() + ' not to have been called with ' + j$.pp(expectedArgs) + ' but it was.'; }; } else { result.message = function() { return 'Expected spy ' + actual.and.identity() + ' to have been called with ' + j$.pp(expectedArgs) + ' but actual calls were ' + j$.pp(actual.calls.allArgs()).replace(/^\[ | \]$/g, '') + '.'; }; } return result; } }; } return toHaveBeenCalledWith; }; getJasmineRequireObj().toMatch = function(j$) { function toMatch() { return { compare: function(actual, expected) { if (!j$.isString_(expected) && !j$.isA_('RegExp', expected)) { throw new Error('Expected is not a String or a RegExp'); } var regexp = new RegExp(expected); return { pass: regexp.test(actual) }; } }; } return toMatch; }; getJasmineRequireObj().toThrow = function(j$) { function toThrow(util) { return { compare: function(actual, expected) { var result = { pass: false }, threw = false, thrown; if (typeof actual != 'function') { throw new Error('Actual is not a Function'); } try { actual(); } catch (e) { threw = true; thrown = e; } if (!threw) { result.message = 'Expected function to throw an exception.'; return result; } if (arguments.length == 1) { result.pass = true; result.message = function() { return 'Expected function not to throw, but it threw ' + j$.pp(thrown) + '.'; }; return result; } if (util.equals(thrown, expected)) { result.pass = true; result.message = function() { return 'Expected function not to throw ' + j$.pp(expected) + '.'; }; } else { result.message = function() { return 'Expected function to throw ' + j$.pp(expected) + ', but it threw ' + j$.pp(thrown) + '.'; }; } return result; } }; } return toThrow; }; getJasmineRequireObj().toThrowError = function(j$) { function toThrowError (util) { return { compare: function(actual) { var threw = false, pass = {pass: true}, fail = {pass: false}, thrown; if (typeof actual != 'function') { throw new Error('Actual is not a Function'); } var errorMatcher = getMatcher.apply(null, arguments); try { actual(); } catch (e) { threw = true; thrown = e; } if (!threw) { fail.message = 'Expected function to throw an Error.'; return fail; } if (!(thrown instanceof Error)) { fail.message = function() { return 'Expected function to throw an Error, but it threw ' + j$.pp(thrown) + '.'; }; return fail; } if (errorMatcher.hasNoSpecifics()) { pass.message = 'Expected function not to throw an Error, but it threw ' + j$.fnNameFor(thrown) + '.'; return pass; } if (errorMatcher.matches(thrown)) { pass.message = function() { return 'Expected function not to throw ' + errorMatcher.errorTypeDescription + errorMatcher.messageDescription() + '.'; }; return pass; } else { fail.message = function() { return 'Expected function to throw ' + errorMatcher.errorTypeDescription + errorMatcher.messageDescription() + ', but it threw ' + errorMatcher.thrownDescription(thrown) + '.'; }; return fail; } } }; function getMatcher() { var expected = null, errorType = null; if (arguments.length == 2) { expected = arguments[1]; if (isAnErrorType(expected)) { errorType = expected; expected = null; } } else if (arguments.length > 2) { errorType = arguments[1]; expected = arguments[2]; if (!isAnErrorType(errorType)) { throw new Error('Expected error type is not an Error.'); } } if (expected && !isStringOrRegExp(expected)) { if (errorType) { throw new Error('Expected error message is not a string or RegExp.'); } else { throw new Error('Expected is not an Error, string, or RegExp.'); } } function messageMatch(message) { if (typeof expected == 'string') { return expected == message; } else { return expected.test(message); } } return { errorTypeDescription: errorType ? j$.fnNameFor(errorType) : 'an exception', thrownDescription: function(thrown) { var thrownName = errorType ? j$.fnNameFor(thrown.constructor) : 'an exception', thrownMessage = ''; if (expected) { thrownMessage = ' with message ' + j$.pp(thrown.message); } return thrownName + thrownMessage; }, messageDescription: function() { if (expected === null) { return ''; } else if (expected instanceof RegExp) { return ' with a message matching ' + j$.pp(expected); } else { return ' with message ' + j$.pp(expected); } }, hasNoSpecifics: function() { return expected === null && errorType === null; }, matches: function(error) { return (errorType === null || error instanceof errorType) && (expected === null || messageMatch(error.message)); } }; } function isStringOrRegExp(potential) { return potential instanceof RegExp || (typeof potential == 'string'); } function isAnErrorType(type) { if (typeof type !== 'function') { return false; } var Surrogate = function() {}; Surrogate.prototype = type.prototype; return (new Surrogate()) instanceof Error; } } return toThrowError; }; getJasmineRequireObj().interface = function(jasmine, env) { var jasmineInterface = { describe: function(description, specDefinitions) { return env.describe(description, specDefinitions); }, xdescribe: function(description, specDefinitions) { return env.xdescribe(description, specDefinitions); }, fdescribe: function(description, specDefinitions) { return env.fdescribe(description, specDefinitions); }, it: function() { return env.it.apply(env, arguments); }, xit: function() { return env.xit.apply(env, arguments); }, fit: function() { return env.fit.apply(env, arguments); }, beforeEach: function() { return env.beforeEach.apply(env, arguments); }, afterEach: function() { return env.afterEach.apply(env, arguments); }, beforeAll: function() { return env.beforeAll.apply(env, arguments); }, afterAll: function() { return env.afterAll.apply(env, arguments); }, expect: function(actual) { return env.expect(actual); }, pending: function() { return env.pending.apply(env, arguments); }, fail: function() { return env.fail.apply(env, arguments); }, spyOn: function(obj, methodName) { return env.spyOn(obj, methodName); }, jsApiReporter: new jasmine.JsApiReporter({ timer: new jasmine.Timer() }), jasmine: jasmine }; jasmine.addCustomEqualityTester = function(tester) { env.addCustomEqualityTester(tester); }; jasmine.addMatchers = function(matchers) { return env.addMatchers(matchers); }; jasmine.clock = function() { return env.clock; }; return jasmineInterface; }; getJasmineRequireObj().version = function() { return '2.3.4'; };
popalexandruvasile/underscorejs-examples
advanced-topics-1/es6-examples/node_modules/jasmine-es6/node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js
JavaScript
mit
87,510
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "a.m.", "p.m." ], "DAY": [ "domingo", "lunes", "martes", "mi\u00e9rcoles", "jueves", "viernes", "s\u00e1bado" ], "MONTH": [ "enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre" ], "SHORTDAY": [ "dom", "lun", "mar", "mi\u00e9", "jue", "vie", "s\u00e1b" ], "SHORTMONTH": [ "ene", "feb", "mar", "abr", "may", "jun", "jul", "ago", "sep", "oct", "nov", "dic" ], "fullDate": "EEEE, d 'de' MMMM 'de' y", "longDate": "d 'de' MMMM 'de' y", "medium": "dd/MM/yyyy HH:mm:ss", "mediumDate": "dd/MM/yyyy", "mediumTime": "HH:mm:ss", "short": "dd/MM/yy HH:mm", "shortDate": "dd/MM/yy", "shortTime": "HH:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "\u20ac", "DECIMAL_SEP": ",", "GROUP_SEP": ".", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "macFrac": 0, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "macFrac": 0, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-", "negSuf": "\u00a0\u00a4", "posPre": "", "posSuf": "\u00a0\u00a4" } ] }, "id": "es-es", "pluralCat": function (n) { if (n == 1) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
wout/cdnjs
ajax/libs/angular-i18n/1.3.0-beta.5/angular-locale_es-es.js
JavaScript
mit
1,976
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "a.m.", "p.m." ], "DAY": [ "domingo", "lunes", "martes", "mi\u00e9rcoles", "jueves", "viernes", "s\u00e1bado" ], "MONTH": [ "enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre" ], "SHORTDAY": [ "dom", "lun", "mar", "mi\u00e9", "jue", "vie", "s\u00e1b" ], "SHORTMONTH": [ "ene", "feb", "mar", "abr", "may", "jun", "jul", "ago", "sep", "oct", "nov", "dic" ], "fullDate": "EEEE, d 'de' MMMM 'de' y", "longDate": "d 'de' MMMM 'de' y", "medium": "dd/MM/yyyy HH:mm:ss", "mediumDate": "dd/MM/yyyy", "mediumTime": "HH:mm:ss", "short": "dd/MM/yy HH:mm", "shortDate": "dd/MM/yy", "shortTime": "HH:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "\u20ac", "DECIMAL_SEP": ",", "GROUP_SEP": ".", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "macFrac": 0, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "macFrac": 0, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-", "negSuf": "\u00a0\u00a4", "posPre": "", "posSuf": "\u00a0\u00a4" } ] }, "id": "es-es", "pluralCat": function (n) { if (n == 1) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
emmansun/cdnjs
ajax/libs/angular-i18n/1.2.10/angular-locale_es-es.js
JavaScript
mit
1,976
/*! * # Semantic UI 2.2.10 - Visibility * http://github.com/semantic-org/semantic-ui/ * * * Released under the MIT license * http://opensource.org/licenses/MIT * */ !function(e,o,n,t){"use strict";o="undefined"!=typeof o&&o.Math==Math?o:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),e.fn.visibility=function(i){var s,c=e(this),r=c.selector||"",a=(new Date).getTime(),l=[],d=arguments[0],u="string"==typeof d,f=[].slice.call(arguments,1),b=c.length,g=0;return c.each(function(){var c,m,v,p,h=e.isPlainObject(i)?e.extend(!0,{},e.fn.visibility.settings,i):e.extend({},e.fn.visibility.settings),P=h.className,x=h.namespace,C=h.error,y=h.metadata,S="."+x,R="module-"+x,V=e(o),k=e(this),T=e(h.context),O=(k.selector||"",k.data(R)),z=o.requestAnimationFrame||o.mozRequestAnimationFrame||o.webkitRequestAnimationFrame||o.msRequestAnimationFrame||function(e){setTimeout(e,0)},A=this,w=!1;p={initialize:function(){p.debug("Initializing",h),p.setup.cache(),p.should.trackChanges()&&("image"==h.type&&p.setup.image(),"fixed"==h.type&&p.setup.fixed(),h.observeChanges&&p.observeChanges(),p.bind.events()),p.save.position(),p.is.visible()||p.error(C.visible,k),h.initialCheck&&p.checkVisibility(),p.instantiate()},instantiate:function(){p.debug("Storing instance",p),k.data(R,p),O=p},destroy:function(){p.verbose("Destroying previous module"),v&&v.disconnect(),m&&m.disconnect(),V.off("load"+S,p.event.load).off("resize"+S,p.event.resize),T.off("scroll"+S,p.event.scroll).off("scrollchange"+S,p.event.scrollchange),"fixed"==h.type&&(p.resetFixed(),p.remove.placeholder()),k.off(S).removeData(R)},observeChanges:function(){"MutationObserver"in o&&(m=new MutationObserver(p.event.contextChanged),v=new MutationObserver(p.event.changed),m.observe(n,{childList:!0,subtree:!0}),v.observe(A,{childList:!0,subtree:!0}),p.debug("Setting up mutation observer",v))},bind:{events:function(){p.verbose("Binding visibility events to scroll and resize"),h.refreshOnLoad&&V.on("load"+S,p.event.load),V.on("resize"+S,p.event.resize),T.off("scroll"+S).on("scroll"+S,p.event.scroll).on("scrollchange"+S,p.event.scrollchange)}},event:{changed:function(e){p.verbose("DOM tree modified, updating visibility calculations"),p.timer=setTimeout(function(){p.verbose("DOM tree modified, updating sticky menu"),p.refresh()},100)},contextChanged:function(o){[].forEach.call(o,function(o){o.removedNodes&&[].forEach.call(o.removedNodes,function(o){(o==A||e(o).find(A).length>0)&&(p.debug("Element removed from DOM, tearing down events"),p.destroy())})})},resize:function(){p.debug("Window resized"),h.refreshOnResize&&z(p.refresh)},load:function(){p.debug("Page finished loading"),z(p.refresh)},scroll:function(){h.throttle?(clearTimeout(p.timer),p.timer=setTimeout(function(){T.triggerHandler("scrollchange"+S,[T.scrollTop()])},h.throttle)):z(function(){T.triggerHandler("scrollchange"+S,[T.scrollTop()])})},scrollchange:function(e,o){p.checkVisibility(o)}},precache:function(o,t){o instanceof Array||(o=[o]);for(var i=o.length,s=0,c=[],r=n.createElement("img"),a=function(){s++,s>=o.length&&e.isFunction(t)&&t()};i--;)r=n.createElement("img"),r.onload=a,r.onerror=a,r.src=o[i],c.push(r)},enableCallbacks:function(){p.debug("Allowing callbacks to occur"),w=!1},disableCallbacks:function(){p.debug("Disabling all callbacks temporarily"),w=!0},should:{trackChanges:function(){return u?(p.debug("One time query, no need to bind events"),!1):(p.debug("Callbacks being attached"),!0)}},setup:{cache:function(){p.cache={occurred:{},screen:{},element:{}}},image:function(){var e=k.data(y.src);e&&(p.verbose("Lazy loading image",e),h.once=!0,h.observeChanges=!1,h.onOnScreen=function(){p.debug("Image on screen",A),p.precache(e,function(){p.set.image(e,function(){g++,g==b&&h.onAllLoaded.call(this),h.onLoad.call(this)})})})},fixed:function(){p.debug("Setting up fixed"),h.once=!1,h.observeChanges=!1,h.initialCheck=!0,h.refreshOnLoad=!0,i.transition||(h.transition=!1),p.create.placeholder(),p.debug("Added placeholder",c),h.onTopPassed=function(){p.debug("Element passed, adding fixed position",k),p.show.placeholder(),p.set.fixed(),h.transition&&e.fn.transition!==t&&k.transition(h.transition,h.duration)},h.onTopPassedReverse=function(){p.debug("Element returned to position, removing fixed",k),p.hide.placeholder(),p.remove.fixed()}}},create:{placeholder:function(){p.verbose("Creating fixed position placeholder"),c=k.clone(!1).css("display","none").addClass(P.placeholder).insertAfter(k)}},show:{placeholder:function(){p.verbose("Showing placeholder"),c.css("display","block").css("visibility","hidden")}},hide:{placeholder:function(){p.verbose("Hiding placeholder"),c.css("display","none").css("visibility","")}},set:{fixed:function(){p.verbose("Setting element to fixed position"),k.addClass(P.fixed).css({position:"fixed",top:h.offset+"px",left:"auto",zIndex:h.zIndex}),h.onFixed.call(A)},image:function(o,n){if(k.attr("src",o),h.transition)if(e.fn.transition!==t){if(k.hasClass(P.visible))return void p.debug("Transition already occurred on this image, skipping animation");k.transition(h.transition,h.duration,n)}else k.fadeIn(h.duration,n);else k.show()}},is:{onScreen:function(){var e=p.get.elementCalculations();return e.onScreen},offScreen:function(){var e=p.get.elementCalculations();return e.offScreen},visible:function(){return p.cache&&p.cache.element?!(0===p.cache.element.width&&0===p.cache.element.offset.top):!1},verticallyScrollableContext:function(){var e=T.get(0)!==o?T.css("overflow-y"):!1;return"auto"==e||"scroll"==e},horizontallyScrollableContext:function(){var e=T.get(0)!==o?T.css("overflow-x"):!1;return"auto"==e||"scroll"==e}},refresh:function(){p.debug("Refreshing constants (width/height)"),"fixed"==h.type&&p.resetFixed(),p.reset(),p.save.position(),h.checkOnRefresh&&p.checkVisibility(),h.onRefresh.call(A)},resetFixed:function(){p.remove.fixed(),p.remove.occurred()},reset:function(){p.verbose("Resetting all cached values"),e.isPlainObject(p.cache)&&(p.cache.screen={},p.cache.element={})},checkVisibility:function(e){p.verbose("Checking visibility of element",p.cache.element),!w&&p.is.visible()&&(p.save.scroll(e),p.save.calculations(),p.passed(),p.passingReverse(),p.topVisibleReverse(),p.bottomVisibleReverse(),p.topPassedReverse(),p.bottomPassedReverse(),p.onScreen(),p.offScreen(),p.passing(),p.topVisible(),p.bottomVisible(),p.topPassed(),p.bottomPassed(),h.onUpdate&&h.onUpdate.call(A,p.get.elementCalculations()))},passed:function(o,n){var i=p.get.elementCalculations();if(o&&n)h.onPassed[o]=n;else{if(o!==t)return p.get.pixelsPassed(o)>i.pixelsPassed;i.passing&&e.each(h.onPassed,function(e,o){i.bottomVisible||i.pixelsPassed>p.get.pixelsPassed(e)?p.execute(o,e):h.once||p.remove.occurred(o)})}},onScreen:function(e){var o=p.get.elementCalculations(),n=e||h.onOnScreen,i="onScreen";return e&&(p.debug("Adding callback for onScreen",e),h.onOnScreen=e),o.onScreen?p.execute(n,i):h.once||p.remove.occurred(i),e!==t?o.onOnScreen:void 0},offScreen:function(e){var o=p.get.elementCalculations(),n=e||h.onOffScreen,i="offScreen";return e&&(p.debug("Adding callback for offScreen",e),h.onOffScreen=e),o.offScreen?p.execute(n,i):h.once||p.remove.occurred(i),e!==t?o.onOffScreen:void 0},passing:function(e){var o=p.get.elementCalculations(),n=e||h.onPassing,i="passing";return e&&(p.debug("Adding callback for passing",e),h.onPassing=e),o.passing?p.execute(n,i):h.once||p.remove.occurred(i),e!==t?o.passing:void 0},topVisible:function(e){var o=p.get.elementCalculations(),n=e||h.onTopVisible,i="topVisible";return e&&(p.debug("Adding callback for top visible",e),h.onTopVisible=e),o.topVisible?p.execute(n,i):h.once||p.remove.occurred(i),e===t?o.topVisible:void 0},bottomVisible:function(e){var o=p.get.elementCalculations(),n=e||h.onBottomVisible,i="bottomVisible";return e&&(p.debug("Adding callback for bottom visible",e),h.onBottomVisible=e),o.bottomVisible?p.execute(n,i):h.once||p.remove.occurred(i),e===t?o.bottomVisible:void 0},topPassed:function(e){var o=p.get.elementCalculations(),n=e||h.onTopPassed,i="topPassed";return e&&(p.debug("Adding callback for top passed",e),h.onTopPassed=e),o.topPassed?p.execute(n,i):h.once||p.remove.occurred(i),e===t?o.topPassed:void 0},bottomPassed:function(e){var o=p.get.elementCalculations(),n=e||h.onBottomPassed,i="bottomPassed";return e&&(p.debug("Adding callback for bottom passed",e),h.onBottomPassed=e),o.bottomPassed?p.execute(n,i):h.once||p.remove.occurred(i),e===t?o.bottomPassed:void 0},passingReverse:function(e){var o=p.get.elementCalculations(),n=e||h.onPassingReverse,i="passingReverse";return e&&(p.debug("Adding callback for passing reverse",e),h.onPassingReverse=e),o.passing?h.once||p.remove.occurred(i):p.get.occurred("passing")&&p.execute(n,i),e!==t?!o.passing:void 0},topVisibleReverse:function(e){var o=p.get.elementCalculations(),n=e||h.onTopVisibleReverse,i="topVisibleReverse";return e&&(p.debug("Adding callback for top visible reverse",e),h.onTopVisibleReverse=e),o.topVisible?h.once||p.remove.occurred(i):p.get.occurred("topVisible")&&p.execute(n,i),e===t?!o.topVisible:void 0},bottomVisibleReverse:function(e){var o=p.get.elementCalculations(),n=e||h.onBottomVisibleReverse,i="bottomVisibleReverse";return e&&(p.debug("Adding callback for bottom visible reverse",e),h.onBottomVisibleReverse=e),o.bottomVisible?h.once||p.remove.occurred(i):p.get.occurred("bottomVisible")&&p.execute(n,i),e===t?!o.bottomVisible:void 0},topPassedReverse:function(e){var o=p.get.elementCalculations(),n=e||h.onTopPassedReverse,i="topPassedReverse";return e&&(p.debug("Adding callback for top passed reverse",e),h.onTopPassedReverse=e),o.topPassed?h.once||p.remove.occurred(i):p.get.occurred("topPassed")&&p.execute(n,i),e===t?!o.onTopPassed:void 0},bottomPassedReverse:function(e){var o=p.get.elementCalculations(),n=e||h.onBottomPassedReverse,i="bottomPassedReverse";return e&&(p.debug("Adding callback for bottom passed reverse",e),h.onBottomPassedReverse=e),o.bottomPassed?h.once||p.remove.occurred(i):p.get.occurred("bottomPassed")&&p.execute(n,i),e===t?!o.bottomPassed:void 0},execute:function(e,o){var n=p.get.elementCalculations(),t=p.get.screenCalculations();e=e||!1,e&&(h.continuous?(p.debug("Callback being called continuously",o,n),e.call(A,n,t)):p.get.occurred(o)||(p.debug("Conditions met",o,n),e.call(A,n,t))),p.save.occurred(o)},remove:{fixed:function(){p.debug("Removing fixed position"),k.removeClass(P.fixed).css({position:"",top:"",left:"",zIndex:""}),h.onUnfixed.call(A)},placeholder:function(){p.debug("Removing placeholder content"),c&&c.remove()},occurred:function(e){if(e){var o=p.cache.occurred;o[e]!==t&&o[e]===!0&&(p.debug("Callback can now be called again",e),p.cache.occurred[e]=!1)}else p.cache.occurred={}}},save:{calculations:function(){p.verbose("Saving all calculations necessary to determine positioning"),p.save.direction(),p.save.screenCalculations(),p.save.elementCalculations()},occurred:function(e){e&&(p.cache.occurred[e]!==t&&p.cache.occurred[e]===!0||(p.verbose("Saving callback occurred",e),p.cache.occurred[e]=!0))},scroll:function(e){e=e+h.offset||T.scrollTop()+h.offset,p.cache.scroll=e},direction:function(){var e,o=p.get.scroll(),n=p.get.lastScroll();return e=o>n&&n?"down":n>o&&n?"up":"static",p.cache.direction=e,p.cache.direction},elementPosition:function(){var e=p.cache.element,o=p.get.screenSize();return p.verbose("Saving element position"),e.fits=e.height<o.height,e.offset=k.offset(),e.width=k.outerWidth(),e.height=k.outerHeight(),p.is.verticallyScrollableContext()&&(e.offset.top+=T.scrollTop()-T.offset().top),p.is.horizontallyScrollableContext()&&(e.offset.left+=T.scrollLeft-T.offset().left),p.cache.element=e,e},elementCalculations:function(){var e=p.get.screenCalculations(),o=p.get.elementPosition();return h.includeMargin?(o.margin={},o.margin.top=parseInt(k.css("margin-top"),10),o.margin.bottom=parseInt(k.css("margin-bottom"),10),o.top=o.offset.top-o.margin.top,o.bottom=o.offset.top+o.height+o.margin.bottom):(o.top=o.offset.top,o.bottom=o.offset.top+o.height),o.topPassed=e.top>=o.top,o.bottomPassed=e.top>=o.bottom,o.topVisible=e.bottom>=o.top&&!o.bottomPassed,o.bottomVisible=e.bottom>=o.bottom&&!o.topPassed,o.pixelsPassed=0,o.percentagePassed=0,o.onScreen=o.topVisible&&!o.bottomPassed,o.passing=o.topPassed&&!o.bottomPassed,o.offScreen=!o.onScreen,o.passing&&(o.pixelsPassed=e.top-o.top,o.percentagePassed=(e.top-o.top)/o.height),p.cache.element=o,p.verbose("Updated element calculations",o),o},screenCalculations:function(){var e=p.get.scroll();return p.save.direction(),p.cache.screen.top=e,p.cache.screen.bottom=e+p.cache.screen.height,p.cache.screen},screenSize:function(){p.verbose("Saving window position"),p.cache.screen={height:T.height()}},position:function(){p.save.screenSize(),p.save.elementPosition()}},get:{pixelsPassed:function(e){var o=p.get.elementCalculations();return e.search("%")>-1?o.height*(parseInt(e,10)/100):parseInt(e,10)},occurred:function(e){return p.cache.occurred!==t?p.cache.occurred[e]||!1:!1},direction:function(){return p.cache.direction===t&&p.save.direction(),p.cache.direction},elementPosition:function(){return p.cache.element===t&&p.save.elementPosition(),p.cache.element},elementCalculations:function(){return p.cache.element===t&&p.save.elementCalculations(),p.cache.element},screenCalculations:function(){return p.cache.screen===t&&p.save.screenCalculations(),p.cache.screen},screenSize:function(){return p.cache.screen===t&&p.save.screenSize(),p.cache.screen},scroll:function(){return p.cache.scroll===t&&p.save.scroll(),p.cache.scroll},lastScroll:function(){return p.cache.screen===t?(p.debug("First scroll event, no last scroll could be found"),!1):p.cache.screen.top}},setting:function(o,n){if(e.isPlainObject(o))e.extend(!0,h,o);else{if(n===t)return h[o];h[o]=n}},internal:function(o,n){if(e.isPlainObject(o))e.extend(!0,p,o);else{if(n===t)return p[o];p[o]=n}},debug:function(){!h.silent&&h.debug&&(h.performance?p.performance.log(arguments):(p.debug=Function.prototype.bind.call(console.info,console,h.name+":"),p.debug.apply(console,arguments)))},verbose:function(){!h.silent&&h.verbose&&h.debug&&(h.performance?p.performance.log(arguments):(p.verbose=Function.prototype.bind.call(console.info,console,h.name+":"),p.verbose.apply(console,arguments)))},error:function(){h.silent||(p.error=Function.prototype.bind.call(console.error,console,h.name+":"),p.error.apply(console,arguments))},performance:{log:function(e){var o,n,t;h.performance&&(o=(new Date).getTime(),t=a||o,n=o-t,a=o,l.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:A,"Execution Time":n})),clearTimeout(p.performance.timer),p.performance.timer=setTimeout(p.performance.display,500)},display:function(){var o=h.name+":",n=0;a=!1,clearTimeout(p.performance.timer),e.each(l,function(e,o){n+=o["Execution Time"]}),o+=" "+n+"ms",r&&(o+=" '"+r+"'"),(console.group!==t||console.table!==t)&&l.length>0&&(console.groupCollapsed(o),console.table?console.table(l):e.each(l,function(e,o){console.log(o.Name+": "+o["Execution Time"]+"ms")}),console.groupEnd()),l=[]}},invoke:function(o,n,i){var c,r,a,l=O;return n=n||f,i=A||i,"string"==typeof o&&l!==t&&(o=o.split(/[\. ]/),c=o.length-1,e.each(o,function(n,i){var s=n!=c?i+o[n+1].charAt(0).toUpperCase()+o[n+1].slice(1):o;if(e.isPlainObject(l[s])&&n!=c)l=l[s];else{if(l[s]!==t)return r=l[s],!1;if(!e.isPlainObject(l[i])||n==c)return l[i]!==t?(r=l[i],!1):(p.error(C.method,o),!1);l=l[i]}})),e.isFunction(r)?a=r.apply(i,n):r!==t&&(a=r),e.isArray(s)?s.push(a):s!==t?s=[s,a]:a!==t&&(s=a),r}},u?(O===t&&p.initialize(),O.save.scroll(),O.save.calculations(),p.invoke(d)):(O!==t&&O.invoke("destroy"),p.initialize())}),s!==t?s:this},e.fn.visibility.settings={name:"Visibility",namespace:"visibility",debug:!1,verbose:!1,performance:!0,observeChanges:!0,initialCheck:!0,refreshOnLoad:!0,refreshOnResize:!0,checkOnRefresh:!0,once:!0,continuous:!1,offset:0,includeMargin:!1,context:o,throttle:!1,type:!1,zIndex:"10",transition:"fade in",duration:1e3,onPassed:{},onOnScreen:!1,onOffScreen:!1,onPassing:!1,onTopVisible:!1,onBottomVisible:!1,onTopPassed:!1,onBottomPassed:!1,onPassingReverse:!1,onTopVisibleReverse:!1,onBottomVisibleReverse:!1,onTopPassedReverse:!1,onBottomPassedReverse:!1,onLoad:function(){},onAllLoaded:function(){},onFixed:function(){},onUnfixed:function(){},onUpdate:!1,onRefresh:function(){},metadata:{src:"src"},className:{fixed:"fixed",placeholder:"placeholder",visible:"visible"},error:{method:"The method you called is not defined.",visible:"Element is hidden, you must call refresh after element becomes visible"}}}(jQuery,window,document);
BitsAiims2017/web
src/libs/semantic-ui/components/visibility.min.js
JavaScript
mit
16,571
/*! * jQuery UI Accordion 1.10.3 * http://jqueryui.com * * Copyright 2013 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/accordion/ * * Depends: * jquery.ui.core.js * jquery.ui.widget.js */ (function( $, undefined ) { var uid = 0, hideProps = {}, showProps = {}; hideProps.height = hideProps.paddingTop = hideProps.paddingBottom = hideProps.borderTopWidth = hideProps.borderBottomWidth = "hide"; showProps.height = showProps.paddingTop = showProps.paddingBottom = showProps.borderTopWidth = showProps.borderBottomWidth = "show"; $.widget( "ui.accordion", { version: "1.10.3", options: { active: 0, animate: {}, collapsible: false, event: "click", header: "> li > :first-child,> :not(li):even", heightStyle: "auto", icons: { activeHeader: "ui-icon-triangle-1-s", header: "ui-icon-triangle-1-e" }, // callbacks activate: null, beforeActivate: null }, _create: function() { var options = this.options; this.prevShow = this.prevHide = $(); this.element.addClass( "ui-accordion ui-widget ui-helper-reset" ) // ARIA .attr( "role", "tablist" ); // don't allow collapsible: false and active: false / null if ( !options.collapsible && (options.active === false || options.active == null) ) { options.active = 0; } this._processPanels(); // handle negative values if ( options.active < 0 ) { options.active += this.headers.length; } this._refresh(); }, _getCreateEventData: function() { return { header: this.active, panel: !this.active.length ? $() : this.active.next(), content: !this.active.length ? $() : this.active.next() }; }, _createIcons: function() { var icons = this.options.icons; if ( icons ) { $( "<span>" ) .addClass( "ui-accordion-header-icon ui-icon " + icons.header ) .prependTo( this.headers ); this.active.children( ".ui-accordion-header-icon" ) .removeClass( icons.header ) .addClass( icons.activeHeader ); this.headers.addClass( "ui-accordion-icons" ); } }, _destroyIcons: function() { this.headers .removeClass( "ui-accordion-icons" ) .children( ".ui-accordion-header-icon" ) .remove(); }, _destroy: function() { var contents; // clean up main element this.element .removeClass( "ui-accordion ui-widget ui-helper-reset" ) .removeAttr( "role" ); // clean up headers this.headers .removeClass( "ui-accordion-header ui-accordion-header-active ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top" ) .removeAttr( "role" ) .removeAttr( "aria-selected" ) .removeAttr( "aria-controls" ) .removeAttr( "tabIndex" ) .each(function() { if ( /^ui-accordion/.test( this.id ) ) { this.removeAttribute( "id" ); } }); this._destroyIcons(); // clean up content panels contents = this.headers.next() .css( "display", "" ) .removeAttr( "role" ) .removeAttr( "aria-expanded" ) .removeAttr( "aria-hidden" ) .removeAttr( "aria-labelledby" ) .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled" ) .each(function() { if ( /^ui-accordion/.test( this.id ) ) { this.removeAttribute( "id" ); } }); if ( this.options.heightStyle !== "content" ) { contents.css( "height", "" ); } }, _setOption: function( key, value ) { if ( key === "active" ) { // _activate() will handle invalid values and update this.options this._activate( value ); return; } if ( key === "event" ) { if ( this.options.event ) { this._off( this.headers, this.options.event ); } this._setupEvents( value ); } this._super( key, value ); // setting collapsible: false while collapsed; open first panel if ( key === "collapsible" && !value && this.options.active === false ) { this._activate( 0 ); } if ( key === "icons" ) { this._destroyIcons(); if ( value ) { this._createIcons(); } } // #5332 - opacity doesn't cascade to positioned elements in IE // so we need to add the disabled class to the headers and panels if ( key === "disabled" ) { this.headers.add( this.headers.next() ) .toggleClass( "ui-state-disabled", !!value ); } }, _keydown: function( event ) { /*jshint maxcomplexity:15*/ if ( event.altKey || event.ctrlKey ) { return; } var keyCode = $.ui.keyCode, length = this.headers.length, currentIndex = this.headers.index( event.target ), toFocus = false; switch ( event.keyCode ) { case keyCode.RIGHT: case keyCode.DOWN: toFocus = this.headers[ ( currentIndex + 1 ) % length ]; break; case keyCode.LEFT: case keyCode.UP: toFocus = this.headers[ ( currentIndex - 1 + length ) % length ]; break; case keyCode.SPACE: case keyCode.ENTER: this._eventHandler( event ); break; case keyCode.HOME: toFocus = this.headers[ 0 ]; break; case keyCode.END: toFocus = this.headers[ length - 1 ]; break; } if ( toFocus ) { $( event.target ).attr( "tabIndex", -1 ); $( toFocus ).attr( "tabIndex", 0 ); toFocus.focus(); event.preventDefault(); } }, _panelKeyDown : function( event ) { if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) { $( event.currentTarget ).prev().focus(); } }, refresh: function() { var options = this.options; this._processPanels(); // was collapsed or no panel if ( ( options.active === false && options.collapsible === true ) || !this.headers.length ) { options.active = false; this.active = $(); // active false only when collapsible is true } else if ( options.active === false ) { this._activate( 0 ); // was active, but active panel is gone } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { // all remaining panel are disabled if ( this.headers.length === this.headers.find(".ui-state-disabled").length ) { options.active = false; this.active = $(); // activate previous panel } else { this._activate( Math.max( 0, options.active - 1 ) ); } // was active, active panel still exists } else { // make sure active index is correct options.active = this.headers.index( this.active ); } this._destroyIcons(); this._refresh(); }, _processPanels: function() { this.headers = this.element.find( this.options.header ) .addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" ); this.headers.next() .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" ) .filter(":not(.ui-accordion-content-active)") .hide(); }, _refresh: function() { var maxHeight, options = this.options, heightStyle = options.heightStyle, parent = this.element.parent(), accordionId = this.accordionId = "ui-accordion-" + (this.element.attr( "id" ) || ++uid); this.active = this._findActive( options.active ) .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" ) .removeClass( "ui-corner-all" ); this.active.next() .addClass( "ui-accordion-content-active" ) .show(); this.headers .attr( "role", "tab" ) .each(function( i ) { var header = $( this ), headerId = header.attr( "id" ), panel = header.next(), panelId = panel.attr( "id" ); if ( !headerId ) { headerId = accordionId + "-header-" + i; header.attr( "id", headerId ); } if ( !panelId ) { panelId = accordionId + "-panel-" + i; panel.attr( "id", panelId ); } header.attr( "aria-controls", panelId ); panel.attr( "aria-labelledby", headerId ); }) .next() .attr( "role", "tabpanel" ); this.headers .not( this.active ) .attr({ "aria-selected": "false", tabIndex: -1 }) .next() .attr({ "aria-expanded": "false", "aria-hidden": "true" }) .hide(); // make sure at least one header is in the tab order if ( !this.active.length ) { this.headers.eq( 0 ).attr( "tabIndex", 0 ); } else { this.active.attr({ "aria-selected": "true", tabIndex: 0 }) .next() .attr({ "aria-expanded": "true", "aria-hidden": "false" }); } this._createIcons(); this._setupEvents( options.event ); if ( heightStyle === "fill" ) { maxHeight = parent.height(); this.element.siblings( ":visible" ).each(function() { var elem = $( this ), position = elem.css( "position" ); if ( position === "absolute" || position === "fixed" ) { return; } maxHeight -= elem.outerHeight( true ); }); this.headers.each(function() { maxHeight -= $( this ).outerHeight( true ); }); this.headers.next() .each(function() { $( this ).height( Math.max( 0, maxHeight - $( this ).innerHeight() + $( this ).height() ) ); }) .css( "overflow", "auto" ); } else if ( heightStyle === "auto" ) { maxHeight = 0; this.headers.next() .each(function() { maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() ); }) .height( maxHeight ); } }, _activate: function( index ) { var active = this._findActive( index )[ 0 ]; // trying to activate the already active panel if ( active === this.active[ 0 ] ) { return; } // trying to collapse, simulate a click on the currently active header active = active || this.active[ 0 ]; this._eventHandler({ target: active, currentTarget: active, preventDefault: $.noop }); }, _findActive: function( selector ) { return typeof selector === "number" ? this.headers.eq( selector ) : $(); }, _setupEvents: function( event ) { var events = { keydown: "_keydown" }; if ( event ) { $.each( event.split(" "), function( index, eventName ) { events[ eventName ] = "_eventHandler"; }); } this._off( this.headers.add( this.headers.next() ) ); this._on( this.headers, events ); this._on( this.headers.next(), { keydown: "_panelKeyDown" }); this._hoverable( this.headers ); this._focusable( this.headers ); }, _eventHandler: function( event ) { var options = this.options, active = this.active, clicked = $( event.currentTarget ), clickedIsActive = clicked[ 0 ] === active[ 0 ], collapsing = clickedIsActive && options.collapsible, toShow = collapsing ? $() : clicked.next(), toHide = active.next(), eventData = { oldHeader: active, oldPanel: toHide, newHeader: collapsing ? $() : clicked, newPanel: toShow }; event.preventDefault(); if ( // click on active header, but not collapsible ( clickedIsActive && !options.collapsible ) || // allow canceling activation ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { return; } options.active = collapsing ? false : this.headers.index( clicked ); // when the call to ._toggle() comes after the class changes // it causes a very odd bug in IE 8 (see #6720) this.active = clickedIsActive ? $() : clicked; this._toggle( eventData ); // switch classes // corner classes on the previously active header stay after the animation active.removeClass( "ui-accordion-header-active ui-state-active" ); if ( options.icons ) { active.children( ".ui-accordion-header-icon" ) .removeClass( options.icons.activeHeader ) .addClass( options.icons.header ); } if ( !clickedIsActive ) { clicked .removeClass( "ui-corner-all" ) .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" ); if ( options.icons ) { clicked.children( ".ui-accordion-header-icon" ) .removeClass( options.icons.header ) .addClass( options.icons.activeHeader ); } clicked .next() .addClass( "ui-accordion-content-active" ); } }, _toggle: function( data ) { var toShow = data.newPanel, toHide = this.prevShow.length ? this.prevShow : data.oldPanel; // handle activating a panel during the animation for another activation this.prevShow.add( this.prevHide ).stop( true, true ); this.prevShow = toShow; this.prevHide = toHide; if ( this.options.animate ) { this._animate( toShow, toHide, data ); } else { toHide.hide(); toShow.show(); this._toggleComplete( data ); } toHide.attr({ "aria-expanded": "false", "aria-hidden": "true" }); toHide.prev().attr( "aria-selected", "false" ); // if we're switching panels, remove the old header from the tab order // if we're opening from collapsed state, remove the previous header from the tab order // if we're collapsing, then keep the collapsing header in the tab order if ( toShow.length && toHide.length ) { toHide.prev().attr( "tabIndex", -1 ); } else if ( toShow.length ) { this.headers.filter(function() { return $( this ).attr( "tabIndex" ) === 0; }) .attr( "tabIndex", -1 ); } toShow .attr({ "aria-expanded": "true", "aria-hidden": "false" }) .prev() .attr({ "aria-selected": "true", tabIndex: 0 }); }, _animate: function( toShow, toHide, data ) { var total, easing, duration, that = this, adjust = 0, down = toShow.length && ( !toHide.length || ( toShow.index() < toHide.index() ) ), animate = this.options.animate || {}, options = down && animate.down || animate, complete = function() { that._toggleComplete( data ); }; if ( typeof options === "number" ) { duration = options; } if ( typeof options === "string" ) { easing = options; } // fall back from options to animation in case of partial down settings easing = easing || options.easing || animate.easing; duration = duration || options.duration || animate.duration; if ( !toHide.length ) { return toShow.animate( showProps, duration, easing, complete ); } if ( !toShow.length ) { return toHide.animate( hideProps, duration, easing, complete ); } total = toShow.show().outerHeight(); toHide.animate( hideProps, { duration: duration, easing: easing, step: function( now, fx ) { fx.now = Math.round( now ); } }); toShow .hide() .animate( showProps, { duration: duration, easing: easing, complete: complete, step: function( now, fx ) { fx.now = Math.round( now ); if ( fx.prop !== "height" ) { adjust += fx.now; } else if ( that.options.heightStyle !== "content" ) { fx.now = Math.round( total - toHide.outerHeight() - adjust ); adjust = 0; } } }); }, _toggleComplete: function( data ) { var toHide = data.oldPanel; toHide .removeClass( "ui-accordion-content-active" ) .prev() .removeClass( "ui-corner-top" ) .addClass( "ui-corner-all" ); // Work around for rendering bug in IE (#5421) if ( toHide.length ) { toHide.parent()[0].className = toHide.parent()[0].className; } this._trigger( "activate", null, data ); } }); })( jQuery );
dosiecki/NewsBlur
media/js/vendor/jquery.ui.accordion.js
JavaScript
mit
14,968
/********************************************** * Ink v1.0.2 - Copyright 2013 ZURB Inc * **********************************************/ /* Client-specific Styles & Reset */ #outlook a { padding:0; } body{ width:100% !important; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; margin:0; padding:0; } .ExternalClass { width:100%; } .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div { line-height: 100%; } #backgroundTable { margin:0; padding:0; width:100% !important; line-height: 100% !important; } img { outline:none; text-decoration:none; -ms-interpolation-mode: bicubic; width: auto; max-width: 100%; float: left; clear: both; display: block; } center { width: 100%; min-width: 580px; } a img { border: none; } p { margin: 0 0 0 10px; } table { border-spacing: 0; border-collapse: collapse; } td { word-break: break-word; -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto; border-collapse: collapse !important; } table, tr, td { padding: 0; vertical-align: top; text-align: left; } hr { color: #d9d9d9; background-color: #d9d9d9; height: 1px; border: none; } /* Responsive Grid */ table.body { height: 100%; width: 100%; } table.container { width: 580px; margin: 0 auto; text-align: inherit; } table.row { padding: 0px; width: 100%; position: relative; } table.container table.row { display: block; } td.wrapper { padding: 10px 20px 0px 0px; position: relative; } table.columns, table.column { margin: 0 auto; } table.columns td, table.column td { padding: 0px 0px 10px; } table.columns td.sub-columns, table.column td.sub-columns, table.columns td.sub-column, table.column td.sub-column { padding-right: 3.448276%; } table.row td.last, table.container td.last { padding-right: 0px; } table.one { width: 30px; } table.two { width: 80px; } table.three { width: 130px; } table.four { width: 180px; } table.five { width: 230px; } table.six { width: 280px; } table.seven { width: 330px; } table.eight { width: 380px; } table.nine { width: 430px; } table.ten { width: 480px; } table.eleven { width: 530px; } table.twelve { width: 580px; } table.one center { min-width: 30px; } table.two center { min-width: 80px; } table.three center { min-width: 130px; } table.four center { min-width: 180px; } table.five center { min-width: 230px; } table.six center { min-width: 280px; } table.seven center { min-width: 330px; } table.eight center { min-width: 380px; } table.nine center { min-width: 430px; } table.ten center { min-width: 480px; } table.eleven center { min-width: 530px; } table.twelve center { min-width: 580px; } td.one { width: 8.333333% !important; } td.two { width: 16.666666% !important; } td.three { width: 25% !important; } td.four { width: 33.333333% !important; } td.five { width: 41.666666% !important; } td.six { width: 50% !important; } td.seven { width: 58.333333% !important; } td.eight { width: 66.666666% !important; } td.nine { width: 75% !important; } td.ten { width: 83.333333% !important; } td.eleven { width: 91.666666% !important; } td.twelve { width: 100% !important; } td.offset-by-one { padding-left: 50px; } td.offset-by-two { padding-left: 100px; } td.offset-by-three { padding-left: 150px; } td.offset-by-four { padding-left: 200px; } td.offset-by-five { padding-left: 250px; } td.offset-by-six { padding-left: 300px; } td.offset-by-seven { padding-left: 350px; } td.offset-by-eight { padding-left: 400px; } td.offset-by-nine { padding-left: 450px; } td.offset-by-ten { padding-left: 500px; } td.offset-by-eleven { padding-left: 550px; } td.sub-offset-by-one { padding-left: 5.172413% !important; } td.sub-offset-by-two { padding-left: 13.793102% !important; } td.sub-offset-by-three { padding-left: 22.413791% !important; } td.sub-offset-by-four { padding-left: 31.034480% !important; } td.sub-offset-by-five { padding-left: 39.655169% !important; } td.sub-offset-by-six { padding-left: 48.275858% !important; } td.sub-offset-by-seven { padding-left: 56.896547% !important; } td.sub-offset-by-eight { padding-left: 65.517236% !important; } td.sub-offset-by-nine { padding-left: 74.137925% !important; } td.sub-offset-by-ten { padding-left: 82.758614% !important; } td.sub-offset-by-eleven { padding-left: 91.379303% !important; } td.expander { visibility: hidden; width: 0px; padding: 0 !important; } /* Block Grid */ .block-grid { width: 100%; max-width: 580px; } .block-grid td { display: inline-block; padding:10px; } .two-up td { width:270px; } .three-up td { width:173px; } .four-up td { width:125px; } .five-up td { width:96px; } .six-up td { width:76px; } .seven-up td { width:62px; } .eight-up td { width:52px; } /* Alignment & Visibility Classes */ table.center, td.center { text-align: center; } h1.center, h2.center, h3.center, h4.center, h5.center, h6.center { text-align: center; } span.center { display: block; width: 100%; text-align: center; } img.center { margin: 0 auto; float: none; } .show-for-small, .hide-for-desktop { display: none; } /* Typography */ body, h1, h2, h3, h4, h5, h6, p { color: #222222; display: block; font-family: "Helvetica", "Arial", sans-serif; font-weight: normal; padding:0; margin: 0; text-align: left; line-height: 1.3; } h1, h2, h3, h4, h5, h6 { word-break: normal; } h1 {font-size: 59px;} h2 {font-size: 45px;} h3 {font-size: 37px;} h4 {font-size: 28px;} h5 {font-size: 23px;} h6 {font-size: 17px;} body, p {font-size: 14px;line-height:19px;} p { padding-bottom: 10px; } small { font-size: 10px; } a { color: #2ba6cb; text-decoration: none; } a:hover { color: #2795b6 !important; } a:active { color: #2795b6 !important; } a:visited { color: #2ba6cb !important; } h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { color: #2ba6cb !important; } h1 a:active, h2 a:active, h3 a:active, h4 a:active, h5 a:active, h6 a:active { color: #2ba6cb !important; } h1 a:visited, h2 a:visited, h3 a:visited, h4 a:visited, h5 a:visited, h6 a:visited { color: #2ba6cb !important; } /* Panels */ td.panel { background: #f2f2f2; border: 1px solid #d9d9d9; padding: 10px !important; } /* Buttons */ table.button, table.tiny-button, table.small-button, table.medium-button, table.large-button { width: 100%; overflow: hidden; } table.button td, table.tiny-button td, table.small-button td, table.medium-button td, table.large-button td { display: block; width: auto !important; text-align: center; background: #2ba6cb; border: 1px solid #2284a1; color: #ffffff; padding: 8px 0; } table.tiny-button td { padding: 5px 0 4px; } table.small-button td { padding: 8px 0 7px; } table.medium-button td { padding: 12px 0 10px; } table.large-button td { padding: 21px 0 18px; } table.button td a, table.tiny-button td a, table.small-button td a, table.medium-button td a, table.large-button td a { font-weight: bold; text-decoration: none; font-family: Helvetica, Arial, sans-serif; color: #ffffff; font-size: 16px; } table.tiny-button td a { font-size: 12px; font-weight: normal; } table.small-button td a { font-size: 16px; } table.medium-button td a { font-size: 20px; } table.large-button td a { font-size: 24px; } table.button:hover td, table.button:visited td, table.button:active td { background: #2795b6 !important; } table.button:hover td a, table.button:visited td a, table.button:active td a { color: #fff !important; } table.button:hover td, table.tiny-button:hover td, table.small-button:hover td, table.medium-button:hover td, table.large-button:hover td { background: #2795b6 !important; } table.button:hover td a, table.button:active td a, table.button td a:visited, table.tiny-button:hover td a, table.tiny-button:active td a, table.tiny-button td a:visited, table.small-button:hover td a, table.small-button:active td a, table.small-button td a:visited, table.medium-button:hover td a, table.medium-button:active td a, table.medium-button td a:visited, table.large-button:hover td a, table.large-button:active td a, table.large-button td a:visited { color: #ffffff !important; } table.secondary td { background: #e9e9e9; border-color: #d0d0d0; color: #555; } table.secondary td a { color: #555; } table.secondary:hover td { background: #d0d0d0 !important; color: #555; } table.secondary:hover td a, table.secondary td a:visited, table.secondary:active td a { color: #555 !important; } table.success td { background: #5da423; border-color: #457a1a; } table.success:hover td { background: #457a1a !important; } table.alert td { background: #c60f13; border-color: #970b0e; } table.alert:hover td { background: #970b0e !important; } table.radius td { -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; } table.round td { -webkit-border-radius: 500px; -moz-border-radius: 500px; border-radius: 500px; } .button table, .tiny-button table, .small-button table, .medium-button table, .large-button table { width: 100%; overflow: hidden; } .button table td, .tiny-button table td, .small-button table td, .medium-button table td, .large-button table td { display: block; width: auto !important; text-align: center; font-weight: bold; text-decoration: none; font-family: Helvetica, Arial, sans-serif; color: #ffffff; background: #2ba6cb; border: 1px solid #2284a1; } .tiny-button table td { padding: 5px 10px; font-size: 12px; font-weight: normal; } .button table td, .small-button table td { padding: 8px 15px; font-size: 16px; } .medium-button table td { padding: 12px 24px; font-size: 20px; } .large-button table td { padding: 21px 30px; font-size: 24px; } .button:hover table td, .tiny-button:hover table td, .small-button:hover table td, .medium-button:hover table td, .large-button:hover table td { background: #2795b6 !important; } .button, .button:hover, .button:active, .button:visited, .tiny-button, .tiny-button:hover, .tiny-button:active, .tiny-button:visited, .small-button, .small-button:hover, .small-button:active, .small-button:visited, .medium-button, .medium-button:hover, .medium-button:active, .medium-button:visited, .large-button, .large-button:hover, .large-button:active, .large-button:visited { color: #ffffff !important; font-family: Helvetica, Arial, sans-serif; text-decoration: none; } .secondary table td { background: #e9e9e9; border-color: #d0d0d0; } .secondary:hover table td { background: #d0d0d0 !important; } .success table td { background: #5da423; border-color: #457a1a; } .success:hover table td { background: #457a1a !important; } .alert table td { background: #c60f13; border-color: #970b0e; } .alert:hover table td { background: #970b0e !important; } .radius table td { -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; } .round table td { -webkit-border-radius: 500px; -moz-border-radius: 500px; border-radius: 500px; } /* Outlook First */ body.outlook img { width: auto !important; max-width: none !important; } /* Media Queries */ @media only screen and (max-width: 600px) { table[class="body"] img { width: auto !important; height: auto !important; } table[class="body"] .container { width: 95% !important; } table[class="body"] .row { width: 100% !important; display: block !important; } table[class="body"] .wrapper { display: block !important; padding-right: 0 !important; } table[class="body"] .columns, table[class="body"] .column { table-layout: fixed !important; float: none !important; width: 100% !important; padding-right: 0px !important; padding-left: 0px !important; display: block !important; } table[class="body"] .wrapper.first .columns, table[class="body"] .wrapper.first .column { display: table !important; } table[class="body"] table.columns td, table[class="body"] table.column td { width: 100%; } table[class="body"] td.offset-by-one, table[class="body"] td.offset-by-two, table[class="body"] td.offset-by-three, table[class="body"] td.offset-by-four, table[class="body"] td.offset-by-five, table[class="body"] td.offset-by-six, table[class="body"] td.offset-by-seven, table[class="body"] td.offset-by-eight, table[class="body"] td.offset-by-nine, table[class="body"] td.offset-by-ten, table[class="body"] td.offset-by-eleven { padding-left: 0 !important; } table[class="body"] .expander { width: 9999px !important; } table[class="body"] center { min-width: 0 !important; } table[class="body"] .hide-for-small, table[class="body"] .show-for-desktop { display: none !important; } table[class="body"] .show-for-small, table[class="body"] .hide-for-desktop { display: inherit !important; } }
LaurensRietveld/cdnjs
ajax/libs/zurb-ink/1.0.2/ink.css
CSS
mit
13,055
//! moment.js //! version : 2.3.1 //! authors : Tim Wood, Iskren Chernev, Moment.js contributors //! license : MIT //! momentjs.com (function(a){function b(a,b){return function(c){return i(a.call(this,c),b)}}function c(a,b){return function(c){return this.lang().ordinal(a.call(this,c),b)}}function d(){}function e(a){u(a),g(this,a)}function f(a){var b=o(a),c=b.year||0,d=b.month||0,e=b.week||0,f=b.day||0,g=b.hour||0,h=b.minute||0,i=b.second||0,j=b.millisecond||0;this._input=a,this._milliseconds=+j+1e3*i+6e4*h+36e5*g,this._days=+f+7*e,this._months=+d+12*c,this._data={},this._bubble()}function g(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return b.hasOwnProperty("toString")&&(a.toString=b.toString),b.hasOwnProperty("valueOf")&&(a.valueOf=b.valueOf),a}function h(a){return 0>a?Math.ceil(a):Math.floor(a)}function i(a,b){for(var c=a+"";c.length<b;)c="0"+c;return c}function j(a,b,c,d){var e,f,g=b._milliseconds,h=b._days,i=b._months;g&&a._d.setTime(+a._d+g*c),(h||i)&&(e=a.minute(),f=a.hour()),h&&a.date(a.date()+h*c),i&&a.month(a.month()+i*c),g&&!d&&bb.updateOffset(a),(h||i)&&(a.minute(e),a.hour(f))}function k(a){return"[object Array]"===Object.prototype.toString.call(a)}function l(a){return"[object Date]"===Object.prototype.toString.call(a)}function m(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&q(a[d])!==q(b[d]))&&g++;return g+f}function n(a){if(a){var b=a.toLowerCase().replace(/(.)s$/,"$1");a=Jb[a]||Kb[b]||b}return a}function o(a){var b,c,d={};for(c in a)a.hasOwnProperty(c)&&(b=n(c),b&&(d[b]=a[c]));return d}function p(b){var c,d;if(0===b.indexOf("week"))c=7,d="day";else{if(0!==b.indexOf("month"))return;c=12,d="month"}bb[b]=function(e,f){var g,h,i=bb.fn._lang[b],j=[];if("number"==typeof e&&(f=e,e=a),h=function(a){var b=bb().utc().set(d,a);return i.call(bb.fn._lang,b,e||"")},null!=f)return h(f);for(g=0;c>g;g++)j.push(h(g));return j}}function q(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=b>=0?Math.floor(b):Math.ceil(b)),c}function r(a,b){return new Date(Date.UTC(a,b+1,0)).getUTCDate()}function s(a){return t(a)?366:365}function t(a){return 0===a%4&&0!==a%100||0===a%400}function u(a){var b;a._a&&-2===a._pf.overflow&&(b=a._a[gb]<0||a._a[gb]>11?gb:a._a[hb]<1||a._a[hb]>r(a._a[fb],a._a[gb])?hb:a._a[ib]<0||a._a[ib]>23?ib:a._a[jb]<0||a._a[jb]>59?jb:a._a[kb]<0||a._a[kb]>59?kb:a._a[lb]<0||a._a[lb]>999?lb:-1,a._pf._overflowDayOfYear&&(fb>b||b>hb)&&(b=hb),a._pf.overflow=b)}function v(a){a._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1}}function w(a){return null==a._isValid&&(a._isValid=!isNaN(a._d.getTime())&&a._pf.overflow<0&&!a._pf.empty&&!a._pf.invalidMonth&&!a._pf.nullInput&&!a._pf.invalidFormat&&!a._pf.userInvalidated,a._strict&&(a._isValid=a._isValid&&0===a._pf.charsLeftOver&&0===a._pf.unusedTokens.length)),a._isValid}function x(a){return a?a.toLowerCase().replace("_","-"):a}function y(a,b){return b.abbr=a,mb[a]||(mb[a]=new d),mb[a].set(b),mb[a]}function z(a){delete mb[a]}function A(a){var b,c,d,e,f=0,g=function(a){if(!mb[a]&&nb)try{require("./lang/"+a)}catch(b){}return mb[a]};if(!a)return bb.fn._lang;if(!k(a)){if(c=g(a))return c;a=[a]}for(;f<a.length;){for(e=x(a[f]).split("-"),b=e.length,d=x(a[f+1]),d=d?d.split("-"):null;b>0;){if(c=g(e.slice(0,b).join("-")))return c;if(d&&d.length>=b&&m(e,d,!0)>=b-1)break;b--}f++}return bb.fn._lang}function B(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function C(a){var b,c,d=a.match(rb);for(b=0,c=d.length;c>b;b++)d[b]=Ob[d[b]]?Ob[d[b]]:B(d[b]);return function(e){var f="";for(b=0;c>b;b++)f+=d[b]instanceof Function?d[b].call(e,a):d[b];return f}}function D(a,b){return a.isValid()?(b=E(b,a.lang()),Lb[b]||(Lb[b]=C(b)),Lb[b](a)):a.lang().invalidDate()}function E(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(sb.lastIndex=0;d>=0&&sb.test(a);)a=a.replace(sb,c),sb.lastIndex=0,d-=1;return a}function F(a,b){var c;switch(a){case"DDDD":return vb;case"YYYY":case"GGGG":case"gggg":return wb;case"YYYYY":case"GGGGG":case"ggggg":return xb;case"S":case"SS":case"SSS":case"DDD":return ub;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return yb;case"a":case"A":return A(b._l)._meridiemParse;case"X":return Bb;case"Z":case"ZZ":return zb;case"T":return Ab;case"MM":case"DD":case"YY":case"GG":case"gg":case"HH":case"hh":case"mm":case"ss":case"M":case"D":case"d":case"H":case"h":case"m":case"s":case"w":case"ww":case"W":case"WW":case"e":case"E":return tb;default:return c=new RegExp(N(M(a.replace("\\","")),"i"))}}function G(a){var b=(zb.exec(a)||[])[0],c=(b+"").match(Gb)||["-",0,0],d=+(60*c[1])+q(c[2]);return"+"===c[0]?-d:d}function H(a,b,c){var d,e=c._a;switch(a){case"M":case"MM":null!=b&&(e[gb]=q(b)-1);break;case"MMM":case"MMMM":d=A(c._l).monthsParse(b),null!=d?e[gb]=d:c._pf.invalidMonth=b;break;case"D":case"DD":null!=b&&(e[hb]=q(b));break;case"DDD":case"DDDD":null!=b&&(c._dayOfYear=q(b));break;case"YY":e[fb]=q(b)+(q(b)>68?1900:2e3);break;case"YYYY":case"YYYYY":e[fb]=q(b);break;case"a":case"A":c._isPm=A(c._l).isPM(b);break;case"H":case"HH":case"h":case"hh":e[ib]=q(b);break;case"m":case"mm":e[jb]=q(b);break;case"s":case"ss":e[kb]=q(b);break;case"S":case"SS":case"SSS":e[lb]=q(1e3*("0."+b));break;case"X":c._d=new Date(1e3*parseFloat(b));break;case"Z":case"ZZ":c._useUTC=!0,c._tzm=G(b);break;case"w":case"ww":case"W":case"WW":case"d":case"dd":case"ddd":case"dddd":case"e":case"E":a=a.substr(0,1);case"gg":case"gggg":case"GG":case"GGGG":case"GGGGG":a=a.substr(0,2),b&&(c._w=c._w||{},c._w[a]=b)}}function I(a){var b,c,d,e,f,g,h,i,j,k,l=[];if(!a._d){for(d=K(a),a._w&&null==a._a[hb]&&null==a._a[gb]&&(f=function(b){return b?b.length<3?parseInt(b,10)>68?"19"+b:"20"+b:b:null==a._a[fb]?bb().weekYear():a._a[fb]},g=a._w,null!=g.GG||null!=g.W||null!=g.E?h=X(f(g.GG),g.W||1,g.E,4,1):(i=A(a._l),j=null!=g.d?T(g.d,i):null!=g.e?parseInt(g.e,10)+i._week.dow:0,k=parseInt(g.w,10)||1,null!=g.d&&j<i._week.dow&&k++,h=X(f(g.gg),k,j,i._week.doy,i._week.dow)),a._a[fb]=h.year,a._dayOfYear=h.dayOfYear),a._dayOfYear&&(e=null==a._a[fb]?d[fb]:a._a[fb],a._dayOfYear>s(e)&&(a._pf._overflowDayOfYear=!0),c=S(e,0,a._dayOfYear),a._a[gb]=c.getUTCMonth(),a._a[hb]=c.getUTCDate()),b=0;3>b&&null==a._a[b];++b)a._a[b]=l[b]=d[b];for(;7>b;b++)a._a[b]=l[b]=null==a._a[b]?2===b?1:0:a._a[b];l[ib]+=q((a._tzm||0)/60),l[jb]+=q((a._tzm||0)%60),a._d=(a._useUTC?S:R).apply(null,l)}}function J(a){var b;a._d||(b=o(a._i),a._a=[b.year,b.month,b.day,b.hour,b.minute,b.second,b.millisecond],I(a))}function K(a){var b=new Date;return a._useUTC?[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]:[b.getFullYear(),b.getMonth(),b.getDate()]}function L(a){a._a=[],a._pf.empty=!0;var b,c,d,e,f,g=A(a._l),h=""+a._i,i=h.length,j=0;for(d=E(a._f,g).match(rb)||[],b=0;b<d.length;b++)e=d[b],c=(F(e,a).exec(h)||[])[0],c&&(f=h.substr(0,h.indexOf(c)),f.length>0&&a._pf.unusedInput.push(f),h=h.slice(h.indexOf(c)+c.length),j+=c.length),Ob[e]?(c?a._pf.empty=!1:a._pf.unusedTokens.push(e),H(e,c,a)):a._strict&&!c&&a._pf.unusedTokens.push(e);a._pf.charsLeftOver=i-j,h.length>0&&a._pf.unusedInput.push(h),a._isPm&&a._a[ib]<12&&(a._a[ib]+=12),a._isPm===!1&&12===a._a[ib]&&(a._a[ib]=0),I(a),u(a)}function M(a){return a.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e})}function N(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function O(a){var b,c,d,e,f;if(0===a._f.length)return a._pf.invalidFormat=!0,a._d=new Date(0/0),void 0;for(e=0;e<a._f.length;e++)f=0,b=g({},a),v(b),b._f=a._f[e],L(b),w(b)&&(f+=b._pf.charsLeftOver,f+=10*b._pf.unusedTokens.length,b._pf.score=f,(null==d||d>f)&&(d=f,c=b));g(a,c||b)}function P(a){var b,c=a._i,d=Cb.exec(c);if(d){for(b=4;b>0;b--)if(d[b]){a._f=Eb[b-1]+(d[6]||" ");break}for(b=0;4>b;b++)if(Fb[b][1].exec(c)){a._f+=Fb[b][0];break}zb.exec(c)&&(a._f+=" Z"),L(a)}else a._d=new Date(c)}function Q(b){var c=b._i,d=ob.exec(c);c===a?b._d=new Date:d?b._d=new Date(+d[1]):"string"==typeof c?P(b):k(c)?(b._a=c.slice(0),I(b)):l(c)?b._d=new Date(+c):"object"==typeof c?J(b):b._d=new Date(c)}function R(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return 1970>a&&h.setFullYear(a),h}function S(a){var b=new Date(Date.UTC.apply(null,arguments));return 1970>a&&b.setUTCFullYear(a),b}function T(a,b){if("string"==typeof a)if(isNaN(a)){if(a=b.weekdaysParse(a),"number"!=typeof a)return null}else a=parseInt(a,10);return a}function U(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function V(a,b,c){var d=eb(Math.abs(a)/1e3),e=eb(d/60),f=eb(e/60),g=eb(f/24),h=eb(g/365),i=45>d&&["s",d]||1===e&&["m"]||45>e&&["mm",e]||1===f&&["h"]||22>f&&["hh",f]||1===g&&["d"]||25>=g&&["dd",g]||45>=g&&["M"]||345>g&&["MM",eb(g/30)]||1===h&&["y"]||["yy",h];return i[2]=b,i[3]=a>0,i[4]=c,U.apply({},i)}function W(a,b,c){var d,e=c-b,f=c-a.day();return f>e&&(f-=7),e-7>f&&(f+=7),d=bb(a).add("d",f),{week:Math.ceil(d.dayOfYear()/7),year:d.year()}}function X(a,b,c,d,e){var f,g,h=new Date(Date.UTC(a,0)).getUTCDay();return c=null!=c?c:e,f=e-h+(h>d?7:0),g=7*(b-1)+(c-e)+f+1,{year:g>0?a:a-1,dayOfYear:g>0?g:s(a-1)+g}}function Y(a){var b=a._i,c=a._f;return"undefined"==typeof a._pf&&v(a),null===b?bb.invalid({nullInput:!0}):("string"==typeof b&&(a._i=b=A().preparse(b)),bb.isMoment(b)?(a=g({},b),a._d=new Date(+b._d)):c?k(c)?O(a):L(a):Q(a),new e(a))}function Z(a,b){bb.fn[a]=bb.fn[a+"s"]=function(a){var c=this._isUTC?"UTC":"";return null!=a?(this._d["set"+c+b](a),bb.updateOffset(this),this):this._d["get"+c+b]()}}function $(a){bb.duration.fn[a]=function(){return this._data[a]}}function _(a,b){bb.duration.fn["as"+a]=function(){return+this/b}}function ab(){"undefined"==typeof ender&&(this.moment=bb)}for(var bb,cb,db="2.3.1",eb=Math.round,fb=0,gb=1,hb=2,ib=3,jb=4,kb=5,lb=6,mb={},nb="undefined"!=typeof module&&module.exports,ob=/^\/?Date\((\-?\d+)/i,pb=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,qb=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,rb=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|SS?S?|X|zz?|ZZ?|.)/g,sb=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,tb=/\d\d?/,ub=/\d{1,3}/,vb=/\d{3}/,wb=/\d{1,4}/,xb=/[+\-]?\d{1,6}/,yb=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,zb=/Z|[\+\-]\d\d:?\d\d/i,Ab=/T/i,Bb=/[\+\-]?\d+(\.\d{1,3})?/,Cb=/^\s*\d{4}-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d\d?\d?)?)?)?)?([\+\-]\d\d:?\d\d)?)?$/,Db="YYYY-MM-DDTHH:mm:ssZ",Eb=["YYYY-MM-DD","GGGG-[W]WW","GGGG-[W]WW-E","YYYY-DDD"],Fb=[["HH:mm:ss.S",/(T| )\d\d:\d\d:\d\d\.\d{1,3}/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],Gb=/([\+\-]|\d\d)/gi,Hb="Date|Hours|Minutes|Seconds|Milliseconds".split("|"),Ib={Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6},Jb={ms:"millisecond",s:"second",m:"minute",h:"hour",d:"day",D:"date",w:"week",W:"isoWeek",M:"month",y:"year",DDD:"dayOfYear",e:"weekday",E:"isoWeekday",gg:"weekYear",GG:"isoWeekYear"},Kb={dayofyear:"dayOfYear",isoweekday:"isoWeekday",isoweek:"isoWeek",weekyear:"weekYear",isoweekyear:"isoWeekYear"},Lb={},Mb="DDD w W M D d".split(" "),Nb="M D H h m s w W".split(" "),Ob={M:function(){return this.month()+1},MMM:function(a){return this.lang().monthsShort(this,a)},MMMM:function(a){return this.lang().months(this,a)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(a){return this.lang().weekdaysMin(this,a)},ddd:function(a){return this.lang().weekdaysShort(this,a)},dddd:function(a){return this.lang().weekdays(this,a)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return i(this.year()%100,2)},YYYY:function(){return i(this.year(),4)},YYYYY:function(){return i(this.year(),5)},gg:function(){return i(this.weekYear()%100,2)},gggg:function(){return this.weekYear()},ggggg:function(){return i(this.weekYear(),5)},GG:function(){return i(this.isoWeekYear()%100,2)},GGGG:function(){return this.isoWeekYear()},GGGGG:function(){return i(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return q(this.milliseconds()/100)},SS:function(){return i(q(this.milliseconds()/10),2)},SSS:function(){return i(this.milliseconds(),3)},Z:function(){var a=-this.zone(),b="+";return 0>a&&(a=-a,b="-"),b+i(q(a/60),2)+":"+i(q(a)%60,2)},ZZ:function(){var a=-this.zone(),b="+";return 0>a&&(a=-a,b="-"),b+i(q(10*a/6),4)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},X:function(){return this.unix()}},Pb=["months","monthsShort","weekdays","weekdaysShort","weekdaysMin"];Mb.length;)cb=Mb.pop(),Ob[cb+"o"]=c(Ob[cb],cb);for(;Nb.length;)cb=Nb.pop(),Ob[cb+cb]=b(Ob[cb],2);for(Ob.DDDD=b(Ob.DDD,3),g(d.prototype,{set:function(a){var b,c;for(c in a)b=a[c],"function"==typeof b?this[c]=b:this["_"+c]=b},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(a){return this._months[a.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(a){return this._monthsShort[a.month()]},monthsParse:function(a){var b,c,d;for(this._monthsParse||(this._monthsParse=[]),b=0;12>b;b++)if(this._monthsParse[b]||(c=bb.utc([2e3,b]),d="^"+this.months(c,"")+"|^"+this.monthsShort(c,""),this._monthsParse[b]=new RegExp(d.replace(".",""),"i")),this._monthsParse[b].test(a))return b},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(a){return this._weekdays[a.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(a){return this._weekdaysShort[a.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(a){return this._weekdaysMin[a.day()]},weekdaysParse:function(a){var b,c,d;for(this._weekdaysParse||(this._weekdaysParse=[]),b=0;7>b;b++)if(this._weekdaysParse[b]||(c=bb([2e3,1]).day(b),d="^"+this.weekdays(c,"")+"|^"+this.weekdaysShort(c,"")+"|^"+this.weekdaysMin(c,""),this._weekdaysParse[b]=new RegExp(d.replace(".",""),"i")),this._weekdaysParse[b].test(a))return b},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(a){var b=this._longDateFormat[a];return!b&&this._longDateFormat[a.toUpperCase()]&&(b=this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a]=b),b},isPM:function(a){return"p"===(a+"").toLowerCase().charAt(0)},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(a,b){var c=this._calendar[a];return"function"==typeof c?c.apply(b):c},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(a,b,c,d){var e=this._relativeTime[c];return"function"==typeof e?e(a,b,c,d):e.replace(/%d/i,a)},pastFuture:function(a,b){var c=this._relativeTime[a>0?"future":"past"];return"function"==typeof c?c(b):c.replace(/%s/i,b)},ordinal:function(a){return this._ordinal.replace("%d",a)},_ordinal:"%d",preparse:function(a){return a},postformat:function(a){return a},week:function(a){return W(a,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},_invalidDate:"Invalid date",invalidDate:function(){return this._invalidDate}}),bb=function(b,c,d,e){return"boolean"==typeof d&&(e=d,d=a),Y({_i:b,_f:c,_l:d,_strict:e,_isUTC:!1})},bb.utc=function(b,c,d,e){var f;return"boolean"==typeof d&&(e=d,d=a),f=Y({_useUTC:!0,_isUTC:!0,_l:d,_i:b,_f:c,_strict:e}).utc()},bb.unix=function(a){return bb(1e3*a)},bb.duration=function(a,b){var c,d,e,g=bb.isDuration(a),h="number"==typeof a,i=g?a._input:h?{}:a,j=null;return h?b?i[b]=a:i.milliseconds=a:(j=pb.exec(a))?(c="-"===j[1]?-1:1,i={y:0,d:q(j[hb])*c,h:q(j[ib])*c,m:q(j[jb])*c,s:q(j[kb])*c,ms:q(j[lb])*c}):(j=qb.exec(a))&&(c="-"===j[1]?-1:1,e=function(a){var b=a&&parseFloat(a.replace(",","."));return(isNaN(b)?0:b)*c},i={y:e(j[2]),M:e(j[3]),d:e(j[4]),h:e(j[5]),m:e(j[6]),s:e(j[7]),w:e(j[8])}),d=new f(i),g&&a.hasOwnProperty("_lang")&&(d._lang=a._lang),d},bb.version=db,bb.defaultFormat=Db,bb.updateOffset=function(){},bb.lang=function(a,b){var c;return a?(b?y(x(a),b):null===b?(z(a),a="en"):mb[a]||A(a),c=bb.duration.fn._lang=bb.fn._lang=A(a),c._abbr):bb.fn._lang._abbr},bb.langData=function(a){return a&&a._lang&&a._lang._abbr&&(a=a._lang._abbr),A(a)},bb.isMoment=function(a){return a instanceof e},bb.isDuration=function(a){return a instanceof f},cb=Pb.length-1;cb>=0;--cb)p(Pb[cb]);for(bb.normalizeUnits=function(a){return n(a)},bb.invalid=function(a){var b=bb.utc(0/0);return null!=a?g(b._pf,a):b._pf.userInvalidated=!0,b},bb.parseZone=function(a){return bb(a).parseZone()},g(bb.fn=e.prototype,{clone:function(){return bb(this)},valueOf:function(){return+this._d+6e4*(this._offset||0)},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.clone().lang("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){return D(bb(this).utc(),"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var a=this;return[a.year(),a.month(),a.date(),a.hours(),a.minutes(),a.seconds(),a.milliseconds()]},isValid:function(){return w(this)},isDSTShifted:function(){return this._a?this.isValid()&&m(this._a,(this._isUTC?bb.utc(this._a):bb(this._a)).toArray())>0:!1},parsingFlags:function(){return g({},this._pf)},invalidAt:function(){return this._pf.overflow},utc:function(){return this.zone(0)},local:function(){return this.zone(0),this._isUTC=!1,this},format:function(a){var b=D(this,a||bb.defaultFormat);return this.lang().postformat(b)},add:function(a,b){var c;return c="string"==typeof a?bb.duration(+b,a):bb.duration(a,b),j(this,c,1),this},subtract:function(a,b){var c;return c="string"==typeof a?bb.duration(+b,a):bb.duration(a,b),j(this,c,-1),this},diff:function(a,b,c){var d,e,f=this._isUTC?bb(a).zone(this._offset||0):bb(a).local(),g=6e4*(this.zone()-f.zone());return b=n(b),"year"===b||"month"===b?(d=432e5*(this.daysInMonth()+f.daysInMonth()),e=12*(this.year()-f.year())+(this.month()-f.month()),e+=(this-bb(this).startOf("month")-(f-bb(f).startOf("month")))/d,e-=6e4*(this.zone()-bb(this).startOf("month").zone()-(f.zone()-bb(f).startOf("month").zone()))/d,"year"===b&&(e/=12)):(d=this-f,e="second"===b?d/1e3:"minute"===b?d/6e4:"hour"===b?d/36e5:"day"===b?(d-g)/864e5:"week"===b?(d-g)/6048e5:d),c?e:h(e)},from:function(a,b){return bb.duration(this.diff(a)).lang(this.lang()._abbr).humanize(!b)},fromNow:function(a){return this.from(bb(),a)},calendar:function(){var a=this.diff(bb().zone(this.zone()).startOf("day"),"days",!0),b=-6>a?"sameElse":-1>a?"lastWeek":0>a?"lastDay":1>a?"sameDay":2>a?"nextDay":7>a?"nextWeek":"sameElse";return this.format(this.lang().calendar(b,this))},isLeapYear:function(){return t(this.year())},isDST:function(){return this.zone()<this.clone().month(0).zone()||this.zone()<this.clone().month(5).zone()},day:function(a){var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=T(a,this.lang()),this.add({d:a-b})):b},month:function(a){var b,c=this._isUTC?"UTC":"";return null!=a?"string"==typeof a&&(a=this.lang().monthsParse(a),"number"!=typeof a)?this:(b=this.date(),this.date(1),this._d["set"+c+"Month"](a),this.date(Math.min(b,this.daysInMonth())),bb.updateOffset(this),this):this._d["get"+c+"Month"]()},startOf:function(a){switch(a=n(a)){case"year":this.month(0);case"month":this.date(1);case"week":case"isoWeek":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===a?this.weekday(0):"isoWeek"===a&&this.isoWeekday(1),this},endOf:function(a){return a=n(a),this.startOf(a).add("isoWeek"===a?"week":a,1).subtract("ms",1)},isAfter:function(a,b){return b="undefined"!=typeof b?b:"millisecond",+this.clone().startOf(b)>+bb(a).startOf(b)},isBefore:function(a,b){return b="undefined"!=typeof b?b:"millisecond",+this.clone().startOf(b)<+bb(a).startOf(b)},isSame:function(a,b){return b="undefined"!=typeof b?b:"millisecond",+this.clone().startOf(b)===+bb(a).startOf(b)},min:function(a){return a=bb.apply(null,arguments),this>a?this:a},max:function(a){return a=bb.apply(null,arguments),a>this?this:a},zone:function(a){var b=this._offset||0;return null==a?this._isUTC?b:this._d.getTimezoneOffset():("string"==typeof a&&(a=G(a)),Math.abs(a)<16&&(a=60*a),this._offset=a,this._isUTC=!0,b!==a&&j(this,bb.duration(b-a,"m"),1,!0),this)},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},parseZone:function(){return"string"==typeof this._i&&this.zone(this._i),this},hasAlignedHourOffset:function(a){return a=a?bb(a).zone():0,0===(this.zone()-a)%60},daysInMonth:function(){return r(this.year(),this.month())},dayOfYear:function(a){var b=eb((bb(this).startOf("day")-bb(this).startOf("year"))/864e5)+1;return null==a?b:this.add("d",a-b)},weekYear:function(a){var b=W(this,this.lang()._week.dow,this.lang()._week.doy).year;return null==a?b:this.add("y",a-b)},isoWeekYear:function(a){var b=W(this,1,4).year;return null==a?b:this.add("y",a-b)},week:function(a){var b=this.lang().week(this);return null==a?b:this.add("d",7*(a-b))},isoWeek:function(a){var b=W(this,1,4).week;return null==a?b:this.add("d",7*(a-b))},weekday:function(a){var b=(this.day()+7-this.lang()._week.dow)%7;return null==a?b:this.add("d",a-b)},isoWeekday:function(a){return null==a?this.day()||7:this.day(this.day()%7?a:a-7)},get:function(a){return a=n(a),this[a]()},set:function(a,b){return a=n(a),"function"==typeof this[a]&&this[a](b),this},lang:function(b){return b===a?this._lang:(this._lang=A(b),this)}}),cb=0;cb<Hb.length;cb++)Z(Hb[cb].toLowerCase().replace(/s$/,""),Hb[cb]);Z("year","FullYear"),bb.fn.days=bb.fn.day,bb.fn.months=bb.fn.month,bb.fn.weeks=bb.fn.week,bb.fn.isoWeeks=bb.fn.isoWeek,bb.fn.toJSON=bb.fn.toISOString,g(bb.duration.fn=f.prototype,{_bubble:function(){var a,b,c,d,e=this._milliseconds,f=this._days,g=this._months,i=this._data;i.milliseconds=e%1e3,a=h(e/1e3),i.seconds=a%60,b=h(a/60),i.minutes=b%60,c=h(b/60),i.hours=c%24,f+=h(c/24),i.days=f%30,g+=h(f/30),i.months=g%12,d=h(g/12),i.years=d},weeks:function(){return h(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+2592e6*(this._months%12)+31536e6*q(this._months/12)},humanize:function(a){var b=+this,c=V(b,!a,this.lang());return a&&(c=this.lang().pastFuture(b,c)),this.lang().postformat(c)},add:function(a,b){var c=bb.duration(a,b);return this._milliseconds+=c._milliseconds,this._days+=c._days,this._months+=c._months,this._bubble(),this},subtract:function(a,b){var c=bb.duration(a,b);return this._milliseconds-=c._milliseconds,this._days-=c._days,this._months-=c._months,this._bubble(),this},get:function(a){return a=n(a),this[a.toLowerCase()+"s"]()},as:function(a){return a=n(a),this["as"+a.charAt(0).toUpperCase()+a.slice(1)+"s"]()},lang:bb.fn.lang,toIsoString:function(){var a=Math.abs(this.years()),b=Math.abs(this.months()),c=Math.abs(this.days()),d=Math.abs(this.hours()),e=Math.abs(this.minutes()),f=Math.abs(this.seconds()+this.milliseconds()/1e3);return this.asSeconds()?(this.asSeconds()<0?"-":"")+"P"+(a?a+"Y":"")+(b?b+"M":"")+(c?c+"D":"")+(d||e||f?"T":"")+(d?d+"H":"")+(e?e+"M":"")+(f?f+"S":""):"P0D"}});for(cb in Ib)Ib.hasOwnProperty(cb)&&(_(cb,Ib[cb]),$(cb.toLowerCase()));_("Weeks",6048e5),bb.duration.fn.asMonths=function(){return(+this-31536e6*this.years())/2592e6+12*this.years()},bb.lang("en",{ordinal:function(a){var b=a%10,c=1===q(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),function(a){a(bb)}(function(a){return a.lang("ar-ma",{months:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),monthsShort:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),weekdays:"الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},week:{dow:6,doy:12}})}),function(a){a(bb)}(function(a){return a.lang("ar",{months:"يناير/ كانون الثاني_فبراير/ شباط_مارس/ آذار_أبريل/ نيسان_مايو/ أيار_يونيو/ حزيران_يوليو/ تموز_أغسطس/ آب_سبتمبر/ أيلول_أكتوبر/ تشرين الأول_نوفمبر/ تشرين الثاني_ديسمبر/ كانون الأول".split("_"),monthsShort:"يناير/ كانون الثاني_فبراير/ شباط_مارس/ آذار_أبريل/ نيسان_مايو/ أيار_يونيو/ حزيران_يوليو/ تموز_أغسطس/ آب_سبتمبر/ أيلول_أكتوبر/ تشرين الأول_نوفمبر/ تشرين الثاني_ديسمبر/ كانون الأول".split("_"),weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},week:{dow:6,doy:12}})}),function(a){a(bb)}(function(a){return a.lang("bg",{months:"януари_февруари_март_април_май_юни_юли_август_септември_октомври_ноември_декември".split("_"),monthsShort:"янр_фев_мар_апр_май_юни_юли_авг_сеп_окт_ное_дек".split("_"),weekdays:"неделя_понеделник_вторник_сряда_четвъртък_петък_събота".split("_"),weekdaysShort:"нед_пон_вто_сря_чет_пет_съб".split("_"),weekdaysMin:"нд_пн_вт_ср_чт_пт_сб".split("_"),longDateFormat:{LT:"H:mm",L:"D.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[Днес в] LT",nextDay:"[Утре в] LT",nextWeek:"dddd [в] LT",lastDay:"[Вчера в] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[В изминалата] dddd [в] LT";case 1:case 2:case 4:case 5:return"[В изминалия] dddd [в] LT"}},sameElse:"L"},relativeTime:{future:"след %s",past:"преди %s",s:"няколко секунди",m:"минута",mm:"%d минути",h:"час",hh:"%d часа",d:"ден",dd:"%d дни",M:"месец",MM:"%d месеца",y:"година",yy:"%d години"},ordinal:function(a){var b=a%10,c=a%100;return 0===a?a+"-ев":0===c?a+"-ен":c>10&&20>c?a+"-ти":1===b?a+"-ви":2===b?a+"-ри":7===b||8===b?a+"-ми":a+"-ти"},week:{dow:1,doy:7}})}),function(a){a(bb)}(function(b){function c(a,b,c){var d={mm:"munutenn",MM:"miz",dd:"devezh"};return a+" "+f(d[c],a)}function d(a){switch(e(a)){case 1:case 3:case 4:case 5:case 9:return a+" bloaz";default:return a+" vloaz"}}function e(a){return a>9?e(a%10):a}function f(a,b){return 2===b?g(a):a}function g(b){var c={m:"v",b:"v",d:"z"};return c[b.charAt(0)]===a?b:c[b.charAt(0)]+b.substring(1)}return b.lang("br",{months:"Genver_C'hwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu".split("_"),monthsShort:"Gen_C'hwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker".split("_"),weekdays:"Sul_Lun_Meurzh_Merc'her_Yaou_Gwener_Sadorn".split("_"),weekdaysShort:"Sul_Lun_Meu_Mer_Yao_Gwe_Sad".split("_"),weekdaysMin:"Su_Lu_Me_Mer_Ya_Gw_Sa".split("_"),longDateFormat:{LT:"h[e]mm A",L:"DD/MM/YYYY",LL:"D [a viz] MMMM YYYY",LLL:"D [a viz] MMMM YYYY LT",LLLL:"dddd, D [a viz] MMMM YYYY LT"},calendar:{sameDay:"[Hiziv da] LT",nextDay:"[Warc'hoazh da] LT",nextWeek:"dddd [da] LT",lastDay:"[Dec'h da] LT",lastWeek:"dddd [paset da] LT",sameElse:"L"},relativeTime:{future:"a-benn %s",past:"%s 'zo",s:"un nebeud segondennoù",m:"ur vunutenn",mm:c,h:"un eur",hh:"%d eur",d:"un devezh",dd:c,M:"ur miz",MM:c,y:"ur bloaz",yy:d},ordinal:function(a){var b=1===a?"añ":"vet";return a+b},week:{dow:1,doy:4}})}),function(a){a(bb)}(function(a){function b(a,b,c){var d=a+" ";switch(c){case"m":return b?"jedna minuta":"jedne minute";case"mm":return d+=1===a?"minuta":2===a||3===a||4===a?"minute":"minuta";case"h":return b?"jedan sat":"jednog sata";case"hh":return d+=1===a?"sat":2===a||3===a||4===a?"sata":"sati";case"dd":return d+=1===a?"dan":"dana";case"MM":return d+=1===a?"mjesec":2===a||3===a||4===a?"mjeseca":"mjeseci";case"yy":return d+=1===a?"godina":2===a||3===a||4===a?"godine":"godina"}}return a.lang("bs",{months:"januar_februar_mart_april_maj_juni_juli_avgust_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.".split("_"),weekdays:"nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),longDateFormat:{LT:"H:mm",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[jučer u] LT",lastWeek:function(){switch(this.day()){case 0:case 3:return"[prošlu] dddd [u] LT";case 6:return"[prošle] [subote] [u] LT";case 1:case 2:case 4:case 5:return"[prošli] dddd [u] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"par sekundi",m:b,mm:b,h:b,hh:b,d:"dan",dd:b,M:"mjesec",MM:b,y:"godinu",yy:b},ordinal:"%d.",week:{dow:1,doy:7}})}),function(a){a(bb)}(function(a){return a.lang("ca",{months:"Gener_Febrer_Març_Abril_Maig_Juny_Juliol_Agost_Setembre_Octubre_Novembre_Desembre".split("_"),monthsShort:"Gen._Febr._Mar._Abr._Mai._Jun._Jul._Ag._Set._Oct._Nov._Des.".split("_"),weekdays:"Diumenge_Dilluns_Dimarts_Dimecres_Dijous_Divendres_Dissabte".split("_"),weekdaysShort:"Dg._Dl._Dt._Dc._Dj._Dv._Ds.".split("_"),weekdaysMin:"Dg_Dl_Dt_Dc_Dj_Dv_Ds".split("_"),longDateFormat:{LT:"H:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:function(){return"[avui a "+(1!==this.hours()?"les":"la")+"] LT"},nextDay:function(){return"[demà a "+(1!==this.hours()?"les":"la")+"] LT"},nextWeek:function(){return"dddd [a "+(1!==this.hours()?"les":"la")+"] LT"},lastDay:function(){return"[ahir a "+(1!==this.hours()?"les":"la")+"] LT"},lastWeek:function(){return"[el] dddd [passat a "+(1!==this.hours()?"les":"la")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"fa %s",s:"uns segons",m:"un minut",mm:"%d minuts",h:"una hora",hh:"%d hores",d:"un dia",dd:"%d dies",M:"un mes",MM:"%d mesos",y:"un any",yy:"%d anys"},ordinal:"%dº",week:{dow:1,doy:4}})}),function(a){a(bb)}(function(a){function b(a){return a>1&&5>a&&1!==~~(a/10)}function c(a,c,d,e){var f=a+" ";switch(d){case"s":return c||e?"pár vteřin":"pár vteřinami";case"m":return c?"minuta":e?"minutu":"minutou";case"mm":return c||e?f+(b(a)?"minuty":"minut"):f+"minutami";break;case"h":return c?"hodina":e?"hodinu":"hodinou";case"hh":return c||e?f+(b(a)?"hodiny":"hodin"):f+"hodinami";break;case"d":return c||e?"den":"dnem";case"dd":return c||e?f+(b(a)?"dny":"dní"):f+"dny";break;case"M":return c||e?"měsíc":"měsícem";case"MM":return c||e?f+(b(a)?"měsíce":"měsíců"):f+"měsíci"; break;case"y":return c||e?"rok":"rokem";case"yy":return c||e?f+(b(a)?"roky":"let"):f+"lety"}}var d="leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec".split("_"),e="led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro".split("_");return a.lang("cs",{months:d,monthsShort:e,monthsParse:function(a,b){var c,d=[];for(c=0;12>c;c++)d[c]=new RegExp("^"+a[c]+"$|^"+b[c]+"$","i");return d}(d,e),weekdays:"neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota".split("_"),weekdaysShort:"ne_po_út_st_čt_pá_so".split("_"),weekdaysMin:"ne_po_út_st_čt_pá_so".split("_"),longDateFormat:{LT:"H:mm",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd D. MMMM YYYY LT"},calendar:{sameDay:"[dnes v] LT",nextDay:"[zítra v] LT",nextWeek:function(){switch(this.day()){case 0:return"[v neděli v] LT";case 1:case 2:return"[v] dddd [v] LT";case 3:return"[ve středu v] LT";case 4:return"[ve čtvrtek v] LT";case 5:return"[v pátek v] LT";case 6:return"[v sobotu v] LT"}},lastDay:"[včera v] LT",lastWeek:function(){switch(this.day()){case 0:return"[minulou neděli v] LT";case 1:case 2:return"[minulé] dddd [v] LT";case 3:return"[minulou středu v] LT";case 4:case 5:return"[minulý] dddd [v] LT";case 6:return"[minulou sobotu v] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"před %s",s:c,m:c,mm:c,h:c,hh:c,d:c,dd:c,M:c,MM:c,y:c,yy:c},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(bb)}(function(a){return a.lang("cv",{months:"кăрлач_нарăс_пуш_ака_май_çĕртме_утă_çурла_авăн_юпа_чӳк_раштав".split("_"),monthsShort:"кăр_нар_пуш_ака_май_çĕр_утă_çур_ав_юпа_чӳк_раш".split("_"),weekdays:"вырсарникун_тунтикун_ытларикун_юнкун_кĕçнерникун_эрнекун_шăматкун".split("_"),weekdaysShort:"выр_тун_ытл_юн_кĕç_эрн_шăм".split("_"),weekdaysMin:"вр_тн_ыт_юн_кç_эр_шм".split("_"),longDateFormat:{LT:"HH:mm",L:"DD-MM-YYYY",LL:"YYYY [çулхи] MMMM [уйăхĕн] D[-мĕшĕ]",LLL:"YYYY [çулхи] MMMM [уйăхĕн] D[-мĕшĕ], LT",LLLL:"dddd, YYYY [çулхи] MMMM [уйăхĕн] D[-мĕшĕ], LT"},calendar:{sameDay:"[Паян] LT [сехетре]",nextDay:"[Ыран] LT [сехетре]",lastDay:"[Ĕнер] LT [сехетре]",nextWeek:"[Çитес] dddd LT [сехетре]",lastWeek:"[Иртнĕ] dddd LT [сехетре]",sameElse:"L"},relativeTime:{future:function(a){var b=/сехет$/i.exec(a)?"рен":/çул$/i.exec(a)?"тан":"ран";return a+b},past:"%s каялла",s:"пĕр-ик çеккунт",m:"пĕр минут",mm:"%d минут",h:"пĕр сехет",hh:"%d сехет",d:"пĕр кун",dd:"%d кун",M:"пĕр уйăх",MM:"%d уйăх",y:"пĕр çул",yy:"%d çул"},ordinal:"%d-мĕш",week:{dow:1,doy:7}})}),function(a){a(bb)}(function(a){return a.lang("da",{months:"januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekdays:"søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"),weekdaysShort:"søn_man_tir_ons_tor_fre_lør".split("_"),weekdaysMin:"sø_ma_ti_on_to_fr_lø".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D. MMMM, YYYY LT"},calendar:{sameDay:"[I dag kl.] LT",nextDay:"[I morgen kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[I går kl.] LT",lastWeek:"[sidste] dddd [kl] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s siden",s:"få sekunder",m:"et minut",mm:"%d minutter",h:"en time",hh:"%d timer",d:"en dag",dd:"%d dage",M:"en måned",MM:"%d måneder",y:"et år",yy:"%d år"},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(bb)}(function(a){function b(a,b,c){var d={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[a+" Tage",a+" Tagen"],M:["ein Monat","einem Monat"],MM:[a+" Monate",a+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[a+" Jahre",a+" Jahren"]};return b?d[c][0]:d[c][1]}return a.lang("de",{months:"Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),longDateFormat:{LT:"H:mm [Uhr]",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[Heute um] LT",sameElse:"L",nextDay:"[Morgen um] LT",nextWeek:"dddd [um] LT",lastDay:"[Gestern um] LT",lastWeek:"[letzten] dddd [um] LT"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",m:b,mm:"%d Minuten",h:b,hh:"%d Stunden",d:b,dd:b,M:b,MM:b,y:b,yy:b},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(bb)}(function(a){return a.lang("el",{monthsNominativeEl:"Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος".split("_"),monthsGenitiveEl:"Ιανουαρίου_Φεβρουαρίου_Μαρτίου_Απριλίου_Μαΐου_Ιουνίου_Ιουλίου_Αυγούστου_Σεπτεμβρίου_Οκτωβρίου_Νοεμβρίου_Δεκεμβρίου".split("_"),months:function(a,b){return/D/.test(b.substring(0,b.indexOf("MMMM")))?this._monthsGenitiveEl[a.month()]:this._monthsNominativeEl[a.month()]},monthsShort:"Ιαν_Φεβ_Μαρ_Απρ_Μαϊ_Ιουν_Ιουλ_Αυγ_Σεπ_Οκτ_Νοε_Δεκ".split("_"),weekdays:"Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο".split("_"),weekdaysShort:"Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ".split("_"),weekdaysMin:"Κυ_Δε_Τρ_Τε_Πε_Πα_Σα".split("_"),meridiem:function(a,b,c){return a>11?c?"μμ":"ΜΜ":c?"πμ":"ΠΜ"},longDateFormat:{LT:"h:mm A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendarEl:{sameDay:"[Σήμερα {}] LT",nextDay:"[Αύριο {}] LT",nextWeek:"dddd [{}] LT",lastDay:"[Χθες {}] LT",lastWeek:"[την προηγούμενη] dddd [{}] LT",sameElse:"L"},calendar:function(a,b){var c=this._calendarEl[a],d=b&&b.hours();return c.replace("{}",1===d%12?"στη":"στις")},relativeTime:{future:"σε %s",past:"%s πριν",s:"δευτερόλεπτα",m:"ένα λεπτό",mm:"%d λεπτά",h:"μία ώρα",hh:"%d ώρες",d:"μία μέρα",dd:"%d μέρες",M:"ένας μήνας",MM:"%d μήνες",y:"ένας χρόνος",yy:"%d χρόνια"},ordinal:function(a){return a+"η"},week:{dow:1,doy:4}})}),function(a){a(bb)}(function(a){return a.lang("en-au",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c},week:{dow:1,doy:4}})}),function(a){a(bb)}(function(a){return a.lang("en-ca",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",L:"YYYY-MM-DD",LL:"D MMMM, YYYY",LLL:"D MMMM, YYYY LT",LLLL:"dddd, D MMMM, YYYY LT"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}})}),function(a){a(bb)}(function(a){return a.lang("en-gb",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c},week:{dow:1,doy:4}})}),function(a){a(bb)}(function(a){return a.lang("eo",{months:"januaro_februaro_marto_aprilo_majo_junio_julio_aŭgusto_septembro_oktobro_novembro_decembro".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aŭg_sep_okt_nov_dec".split("_"),weekdays:"Dimanĉo_Lundo_Mardo_Merkredo_Ĵaŭdo_Vendredo_Sabato".split("_"),weekdaysShort:"Dim_Lun_Mard_Merk_Ĵaŭ_Ven_Sab".split("_"),weekdaysMin:"Di_Lu_Ma_Me_Ĵa_Ve_Sa".split("_"),longDateFormat:{LT:"HH:mm",L:"YYYY-MM-DD",LL:"D[-an de] MMMM, YYYY",LLL:"D[-an de] MMMM, YYYY LT",LLLL:"dddd, [la] D[-an de] MMMM, YYYY LT"},meridiem:function(a,b,c){return a>11?c?"p.t.m.":"P.T.M.":c?"a.t.m.":"A.T.M."},calendar:{sameDay:"[Hodiaŭ je] LT",nextDay:"[Morgaŭ je] LT",nextWeek:"dddd [je] LT",lastDay:"[Hieraŭ je] LT",lastWeek:"[pasinta] dddd [je] LT",sameElse:"L"},relativeTime:{future:"je %s",past:"antaŭ %s",s:"sekundoj",m:"minuto",mm:"%d minutoj",h:"horo",hh:"%d horoj",d:"tago",dd:"%d tagoj",M:"monato",MM:"%d monatoj",y:"jaro",yy:"%d jaroj"},ordinal:"%da",week:{dow:1,doy:7}})}),function(a){a(bb)}(function(a){return a.lang("es",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:"ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"Do_Lu_Ma_Mi_Ju_Vi_Sá".split("_"),longDateFormat:{LT:"H:mm",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY LT",LLLL:"dddd, D [de] MMMM [de] YYYY LT"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},ordinal:"%dº",week:{dow:1,doy:4}})}),function(a){a(bb)}(function(a){function b(a,b,c,d){return d||b?"paari sekundi":"paar sekundit"}return a.lang("et",{months:"jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember".split("_"),monthsShort:"jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets".split("_"),weekdays:"pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev".split("_"),weekdaysShort:"P_E_T_K_N_R_L".split("_"),weekdaysMin:"P_E_T_K_N_R_L".split("_"),longDateFormat:{LT:"H:mm",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[Täna,] LT",nextDay:"[Homme,] LT",nextWeek:"[Järgmine] dddd LT",lastDay:"[Eile,] LT",lastWeek:"[Eelmine] dddd LT",sameElse:"L"},relativeTime:{future:"%s pärast",past:"%s tagasi",s:b,m:"minut",mm:"%d minutit",h:"tund",hh:"%d tundi",d:"päev",dd:"%d päeva",M:"kuu",MM:"%d kuud",y:"aasta",yy:"%d aastat"},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(bb)}(function(a){return a.lang("eu",{months:"urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua".split("_"),monthsShort:"urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.".split("_"),weekdays:"igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata".split("_"),weekdaysShort:"ig._al._ar._az._og._ol._lr.".split("_"),weekdaysMin:"ig_al_ar_az_og_ol_lr".split("_"),longDateFormat:{LT:"HH:mm",L:"YYYY-MM-DD",LL:"YYYY[ko] MMMM[ren] D[a]",LLL:"YYYY[ko] MMMM[ren] D[a] LT",LLLL:"dddd, YYYY[ko] MMMM[ren] D[a] LT",l:"YYYY-M-D",ll:"YYYY[ko] MMM D[a]",lll:"YYYY[ko] MMM D[a] LT",llll:"ddd, YYYY[ko] MMM D[a] LT"},calendar:{sameDay:"[gaur] LT[etan]",nextDay:"[bihar] LT[etan]",nextWeek:"dddd LT[etan]",lastDay:"[atzo] LT[etan]",lastWeek:"[aurreko] dddd LT[etan]",sameElse:"L"},relativeTime:{future:"%s barru",past:"duela %s",s:"segundo batzuk",m:"minutu bat",mm:"%d minutu",h:"ordu bat",hh:"%d ordu",d:"egun bat",dd:"%d egun",M:"hilabete bat",MM:"%d hilabete",y:"urte bat",yy:"%d urte"},ordinal:"%d.",week:{dow:1,doy:7}})}),function(a){a(bb)}(function(a){var b={1:"۱",2:"۲",3:"۳",4:"۴",5:"۵",6:"۶",7:"۷",8:"۸",9:"۹",0:"۰"},c={"۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9","۰":"0"};return a.lang("fa",{months:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),monthsShort:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),weekdays:"یک‌شنبه_دوشنبه_سه‌شنبه_چهارشنبه_پنج‌شنبه_جمعه_شنبه".split("_"),weekdaysShort:"یک‌شنبه_دوشنبه_سه‌شنبه_چهارشنبه_پنج‌شنبه_جمعه_شنبه".split("_"),weekdaysMin:"ی_د_س_چ_پ_ج_ش".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},meridiem:function(a){return 12>a?"قبل از ظهر":"بعد از ظهر"},calendar:{sameDay:"[امروز ساعت] LT",nextDay:"[فردا ساعت] LT",nextWeek:"dddd [ساعت] LT",lastDay:"[دیروز ساعت] LT",lastWeek:"dddd [پیش] [ساعت] LT",sameElse:"L"},relativeTime:{future:"در %s",past:"%s پیش",s:"چندین ثانیه",m:"یک دقیقه",mm:"%d دقیقه",h:"یک ساعت",hh:"%d ساعت",d:"یک روز",dd:"%d روز",M:"یک ماه",MM:"%d ماه",y:"یک سال",yy:"%d سال"},preparse:function(a){return a.replace(/[۰-۹]/g,function(a){return c[a]}).replace(/،/g,",")},postformat:function(a){return a.replace(/\d/g,function(a){return b[a]}).replace(/,/g,"،")},ordinal:"%dم",week:{dow:6,doy:12}})}),function(a){a(bb)}(function(a){function b(a,b,d,e){var f="";switch(d){case"s":return e?"muutaman sekunnin":"muutama sekunti";case"m":return e?"minuutin":"minuutti";case"mm":f=e?"minuutin":"minuuttia";break;case"h":return e?"tunnin":"tunti";case"hh":f=e?"tunnin":"tuntia";break;case"d":return e?"päivän":"päivä";case"dd":f=e?"päivän":"päivää";break;case"M":return e?"kuukauden":"kuukausi";case"MM":f=e?"kuukauden":"kuukautta";break;case"y":return e?"vuoden":"vuosi";case"yy":f=e?"vuoden":"vuotta"}return f=c(a,e)+" "+f}function c(a,b){return 10>a?b?e[a]:d[a]:a}var d="nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän".split(" "),e=["nolla","yhden","kahden","kolmen","neljän","viiden","kuuden",d[7],d[8],d[9]];return a.lang("fi",{months:"tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu".split("_"),monthsShort:"tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu".split("_"),weekdays:"sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai".split("_"),weekdaysShort:"su_ma_ti_ke_to_pe_la".split("_"),weekdaysMin:"su_ma_ti_ke_to_pe_la".split("_"),longDateFormat:{LT:"HH.mm",L:"DD.MM.YYYY",LL:"Do MMMM[ta] YYYY",LLL:"Do MMMM[ta] YYYY, [klo] LT",LLLL:"dddd, Do MMMM[ta] YYYY, [klo] LT",l:"D.M.YYYY",ll:"Do MMM YYYY",lll:"Do MMM YYYY, [klo] LT",llll:"ddd, Do MMM YYYY, [klo] LT"},calendar:{sameDay:"[tänään] [klo] LT",nextDay:"[huomenna] [klo] LT",nextWeek:"dddd [klo] LT",lastDay:"[eilen] [klo] LT",lastWeek:"[viime] dddd[na] [klo] LT",sameElse:"L"},relativeTime:{future:"%s päästä",past:"%s sitten",s:b,m:b,mm:b,h:b,hh:b,d:b,dd:b,M:b,MM:b,y:b,yy:b},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(bb)}(function(a){return a.lang("fr-ca",{months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"Di_Lu_Ma_Me_Je_Ve_Sa".split("_"),longDateFormat:{LT:"HH:mm",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[Aujourd'hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},ordinal:function(a){return a+(1===a?"er":"")}})}),function(a){a(bb)}(function(a){return a.lang("fr",{months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"Di_Lu_Ma_Me_Je_Ve_Sa".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[Aujourd'hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},ordinal:function(a){return a+(1===a?"er":"")},week:{dow:1,doy:4}})}),function(a){a(bb)}(function(a){return a.lang("gl",{months:"Xaneiro_Febreiro_Marzo_Abril_Maio_Xuño_Xullo_Agosto_Setembro_Outubro_Novembro_Decembro".split("_"),monthsShort:"Xan._Feb._Mar._Abr._Mai._Xuñ._Xul._Ago._Set._Out._Nov._Dec.".split("_"),weekdays:"Domingo_Luns_Martes_Mércores_Xoves_Venres_Sábado".split("_"),weekdaysShort:"Dom._Lun._Mar._Mér._Xov._Ven._Sáb.".split("_"),weekdaysMin:"Do_Lu_Ma_Mé_Xo_Ve_Sá".split("_"),longDateFormat:{LT:"H:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:function(){return"[hoxe "+(1!==this.hours()?"ás":"á")+"] LT"},nextDay:function(){return"[mañá "+(1!==this.hours()?"ás":"á")+"] LT"},nextWeek:function(){return"dddd ["+(1!==this.hours()?"ás":"a")+"] LT"},lastDay:function(){return"[onte "+(1!==this.hours()?"á":"a")+"] LT"},lastWeek:function(){return"[o] dddd [pasado "+(1!==this.hours()?"ás":"a")+"] LT"},sameElse:"L"},relativeTime:{future:function(a){return"uns segundos"===a?"nuns segundos":"en "+a},past:"hai %s",s:"uns segundos",m:"un minuto",mm:"%d minutos",h:"unha hora",hh:"%d horas",d:"un día",dd:"%d días",M:"un mes",MM:"%d meses",y:"un ano",yy:"%d anos"},ordinal:"%dº",week:{dow:1,doy:7}})}),function(a){a(bb)}(function(a){return a.lang("he",{months:"ינואר_פברואר_מרץ_אפריל_מאי_יוני_יולי_אוגוסט_ספטמבר_אוקטובר_נובמבר_דצמבר".split("_"),monthsShort:"ינו׳_פבר׳_מרץ_אפר׳_מאי_יוני_יולי_אוג׳_ספט׳_אוק׳_נוב׳_דצמ׳".split("_"),weekdays:"ראשון_שני_שלישי_רביעי_חמישי_שישי_שבת".split("_"),weekdaysShort:"א׳_ב׳_ג׳_ד׳_ה׳_ו׳_ש׳".split("_"),weekdaysMin:"א_ב_ג_ד_ה_ו_ש".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D [ב]MMMM YYYY",LLL:"D [ב]MMMM YYYY LT",LLLL:"dddd, D [ב]MMMM YYYY LT",l:"D/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY LT",llll:"ddd, D MMM YYYY LT"},calendar:{sameDay:"[היום ב־]LT",nextDay:"[מחר ב־]LT",nextWeek:"dddd [בשעה] LT",lastDay:"[אתמול ב־]LT",lastWeek:"[ביום] dddd [האחרון בשעה] LT",sameElse:"L"},relativeTime:{future:"בעוד %s",past:"לפני %s",s:"מספר שניות",m:"דקה",mm:"%d דקות",h:"שעה",hh:function(a){return 2===a?"שעתיים":a+" שעות"},d:"יום",dd:function(a){return 2===a?"יומיים":a+" ימים"},M:"חודש",MM:function(a){return 2===a?"חודשיים":a+" חודשים"},y:"שנה",yy:function(a){return 2===a?"שנתיים":a+" שנים"}}})}),function(a){a(bb)}(function(a){var b={1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"},c={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"};return a.lang("hi",{months:"जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर".split("_"),monthsShort:"जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.".split("_"),weekdays:"रविवार_सोमवार_मंगलवार_बुधवार_गुरूवार_शुक्रवार_शनिवार".split("_"),weekdaysShort:"रवि_सोम_मंगल_बुध_गुरू_शुक्र_शनि".split("_"),weekdaysMin:"र_सो_मं_बु_गु_शु_श".split("_"),longDateFormat:{LT:"A h:mm बजे",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, LT",LLLL:"dddd, D MMMM YYYY, LT"},calendar:{sameDay:"[आज] LT",nextDay:"[कल] LT",nextWeek:"dddd, LT",lastDay:"[कल] LT",lastWeek:"[पिछले] dddd, LT",sameElse:"L"},relativeTime:{future:"%s में",past:"%s पहले",s:"कुछ ही क्षण",m:"एक मिनट",mm:"%d मिनट",h:"एक घंटा",hh:"%d घंटे",d:"एक दिन",dd:"%d दिन",M:"एक महीने",MM:"%d महीने",y:"एक वर्ष",yy:"%d वर्ष"},preparse:function(a){return a.replace(/[१२३४५६७८९०]/g,function(a){return c[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return b[a]})},meridiem:function(a){return 4>a?"रात":10>a?"सुबह":17>a?"दोपहर":20>a?"शाम":"रात"},week:{dow:0,doy:6}})}),function(a){a(bb)}(function(a){function b(a,b,c){var d=a+" ";switch(c){case"m":return b?"jedna minuta":"jedne minute";case"mm":return d+=1===a?"minuta":2===a||3===a||4===a?"minute":"minuta";case"h":return b?"jedan sat":"jednog sata";case"hh":return d+=1===a?"sat":2===a||3===a||4===a?"sata":"sati";case"dd":return d+=1===a?"dan":"dana";case"MM":return d+=1===a?"mjesec":2===a||3===a||4===a?"mjeseca":"mjeseci";case"yy":return d+=1===a?"godina":2===a||3===a||4===a?"godine":"godina"}}return a.lang("hr",{months:"sječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac".split("_"),monthsShort:"sje._vel._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.".split("_"),weekdays:"nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),longDateFormat:{LT:"H:mm",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[jučer u] LT",lastWeek:function(){switch(this.day()){case 0:case 3:return"[prošlu] dddd [u] LT";case 6:return"[prošle] [subote] [u] LT";case 1:case 2:case 4:case 5:return"[prošli] dddd [u] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"par sekundi",m:b,mm:b,h:b,hh:b,d:"dan",dd:b,M:"mjesec",MM:b,y:"godinu",yy:b},ordinal:"%d.",week:{dow:1,doy:7}})}),function(a){a(bb)}(function(a){function b(a,b,c,d){var e=a;switch(c){case"s":return d||b?"néhány másodperc":"néhány másodperce";case"m":return"egy"+(d||b?" perc":" perce");case"mm":return e+(d||b?" perc":" perce");case"h":return"egy"+(d||b?" óra":" órája");case"hh":return e+(d||b?" óra":" órája");case"d":return"egy"+(d||b?" nap":" napja");case"dd":return e+(d||b?" nap":" napja");case"M":return"egy"+(d||b?" hónap":" hónapja");case"MM":return e+(d||b?" hónap":" hónapja");case"y":return"egy"+(d||b?" év":" éve");case"yy":return e+(d||b?" év":" éve")}return""}function c(a){return(a?"":"[múlt] ")+"["+d[this.day()]+"] LT[-kor]"}var d="vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton".split(" ");return a.lang("hu",{months:"január_február_március_április_május_június_július_augusztus_szeptember_október_november_december".split("_"),monthsShort:"jan_feb_márc_ápr_máj_jún_júl_aug_szept_okt_nov_dec".split("_"),weekdays:"vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat".split("_"),weekdaysShort:"vas_hét_kedd_sze_csüt_pén_szo".split("_"),weekdaysMin:"v_h_k_sze_cs_p_szo".split("_"),longDateFormat:{LT:"H:mm",L:"YYYY.MM.DD.",LL:"YYYY. MMMM D.",LLL:"YYYY. MMMM D., LT",LLLL:"YYYY. MMMM D., dddd LT"},calendar:{sameDay:"[ma] LT[-kor]",nextDay:"[holnap] LT[-kor]",nextWeek:function(){return c.call(this,!0)},lastDay:"[tegnap] LT[-kor]",lastWeek:function(){return c.call(this,!1)},sameElse:"L"},relativeTime:{future:"%s múlva",past:"%s",s:b,m:b,mm:b,h:b,hh:b,d:b,dd:b,M:b,MM:b,y:b,yy:b},ordinal:"%d.",week:{dow:1,doy:7}})}),function(a){a(bb)}(function(a){return a.lang("id",{months:"Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember".split("_"),monthsShort:"Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nov_Des".split("_"),weekdays:"Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu".split("_"),weekdaysShort:"Min_Sen_Sel_Rab_Kam_Jum_Sab".split("_"),weekdaysMin:"Mg_Sn_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] LT",LLLL:"dddd, D MMMM YYYY [pukul] LT"},meridiem:function(a){return 11>a?"pagi":15>a?"siang":19>a?"sore":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Besok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kemarin pukul] LT",lastWeek:"dddd [lalu pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lalu",s:"beberapa detik",m:"semenit",mm:"%d menit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:1,doy:7}})}),function(a){a(bb)}(function(a){function b(a){return 11===a%100?!0:1===a%10?!1:!0}function c(a,c,d,e){var f=a+" ";switch(d){case"s":return c||e?"nokkrar sekúndur":"nokkrum sekúndum";case"m":return c?"mínúta":"mínútu";case"mm":return b(a)?f+(c||e?"mínútur":"mínútum"):c?f+"mínúta":f+"mínútu";case"hh":return b(a)?f+(c||e?"klukkustundir":"klukkustundum"):f+"klukkustund";case"d":return c?"dagur":e?"dag":"degi";case"dd":return b(a)?c?f+"dagar":f+(e?"daga":"dögum"):c?f+"dagur":f+(e?"dag":"degi");case"M":return c?"mánuður":e?"mánuð":"mánuði";case"MM":return b(a)?c?f+"mánuðir":f+(e?"mánuði":"mánuðum"):c?f+"mánuður":f+(e?"mánuð":"mánuði");case"y":return c||e?"ár":"ári";case"yy":return b(a)?f+(c||e?"ár":"árum"):f+(c||e?"ár":"ári")}}return a.lang("is",{months:"janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember".split("_"),monthsShort:"jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des".split("_"),weekdays:"sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur".split("_"),weekdaysShort:"sun_mán_þri_mið_fim_fös_lau".split("_"),weekdaysMin:"Su_Má_Þr_Mi_Fi_Fö_La".split("_"),longDateFormat:{LT:"H:mm",L:"DD/MM/YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] LT",LLLL:"dddd, D. MMMM YYYY [kl.] LT"},calendar:{sameDay:"[í dag kl.] LT",nextDay:"[á morgun kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[í gær kl.] LT",lastWeek:"[síðasta] dddd [kl.] LT",sameElse:"L"},relativeTime:{future:"eftir %s",past:"fyrir %s síðan",s:c,m:c,mm:c,h:"klukkustund",hh:c,d:c,dd:c,M:c,MM:c,y:c,yy:c},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(bb)}(function(a){return a.lang("it",{months:"Gennaio_Febbraio_Marzo_Aprile_Maggio_Giugno_Luglio_Agosto_Settembre_Ottobre_Novembre_Dicembre".split("_"),monthsShort:"Gen_Feb_Mar_Apr_Mag_Giu_Lug_Ago_Set_Ott_Nov_Dic".split("_"),weekdays:"Domenica_Lunedì_Martedì_Mercoledì_Giovedì_Venerdì_Sabato".split("_"),weekdaysShort:"Dom_Lun_Mar_Mer_Gio_Ven_Sab".split("_"),weekdaysMin:"D_L_Ma_Me_G_V_S".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[Oggi alle] LT",nextDay:"[Domani alle] LT",nextWeek:"dddd [alle] LT",lastDay:"[Ieri alle] LT",lastWeek:"[lo scorso] dddd [alle] LT",sameElse:"L"},relativeTime:{future:function(a){return(/^[0-9].+$/.test(a)?"tra":"in")+" "+a},past:"%s fa",s:"secondi",m:"un minuto",mm:"%d minuti",h:"un'ora",hh:"%d ore",d:"un giorno",dd:"%d giorni",M:"un mese",MM:"%d mesi",y:"un anno",yy:"%d anni"},ordinal:"%dº",week:{dow:1,doy:4}})}),function(a){a(bb)}(function(a){return a.lang("ja",{months:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日".split("_"),weekdaysShort:"日_月_火_水_木_金_土".split("_"),weekdaysMin:"日_月_火_水_木_金_土".split("_"),longDateFormat:{LT:"Ah時m分",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日LT",LLLL:"YYYY年M月D日LT dddd"},meridiem:function(a){return 12>a?"午前":"午後"},calendar:{sameDay:"[今日] LT",nextDay:"[明日] LT",nextWeek:"[来週]dddd LT",lastDay:"[昨日] LT",lastWeek:"[前週]dddd LT",sameElse:"L"},relativeTime:{future:"%s後",past:"%s前",s:"数秒",m:"1分",mm:"%d分",h:"1時間",hh:"%d時間",d:"1日",dd:"%d日",M:"1ヶ月",MM:"%dヶ月",y:"1年",yy:"%d年"}})}),function(a){a(bb)}(function(a){function b(a,b){var c={nominative:"იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი".split("_"),accusative:"იანვარს_თებერვალს_მარტს_აპრილის_მაისს_ივნისს_ივლისს_აგვისტს_სექტემბერს_ოქტომბერს_ნოემბერს_დეკემბერს".split("_")},d=/D[oD] *MMMM?/.test(b)?"accusative":"nominative";return c[d][a.month()]}function c(a,b){var c={nominative:"კვირა_ორშაბათი_სამშაბათი_ოთხშაბათი_ხუთშაბათი_პარასკევი_შაბათი".split("_"),accusative:"კვირას_ორშაბათს_სამშაბათს_ოთხშაბათს_ხუთშაბათს_პარასკევს_შაბათს".split("_")},d=/(წინა|შემდეგ)/.test(b)?"accusative":"nominative";return c[d][a.day()]}return a.lang("ka",{months:b,monthsShort:"იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ".split("_"),weekdays:c,weekdaysShort:"კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ".split("_"),weekdaysMin:"კვ_ორ_სა_ოთ_ხუ_პა_შა".split("_"),longDateFormat:{LT:"h:mm A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[დღეს] LT[-ზე]",nextDay:"[ხვალ] LT[-ზე]",lastDay:"[გუშინ] LT[-ზე]",nextWeek:"[შემდეგ] dddd LT[-ზე]",lastWeek:"[წინა] dddd LT-ზე",sameElse:"L"},relativeTime:{future:function(a){return/(წამი|წუთი|საათი|წელი)/.test(a)?a.replace(/ი$/,"ში"):a+"ში"},past:function(a){return/(წამი|წუთი|საათი|დღე|თვე)/.test(a)?a.replace(/(ი|ე)$/,"ის წინ"):/წელი/.test(a)?a.replace(/წელი$/,"წლის წინ"):void 0},s:"რამდენიმე წამი",m:"წუთი",mm:"%d წუთი",h:"საათი",hh:"%d საათი",d:"დღე",dd:"%d დღე",M:"თვე",MM:"%d თვე",y:"წელი",yy:"%d წელი"},ordinal:function(a){return 0===a?a:1===a?a+"-ლი":20>a||100>=a&&0===a%20||0===a%100?"მე-"+a:a+"-ე"},week:{dow:1,doy:7}})}),function(a){a(bb)}(function(a){return a.lang("ko",{months:"1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),monthsShort:"1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),weekdays:"일요일_월요일_화요일_수요일_목요일_금요일_토요일".split("_"),weekdaysShort:"일_월_화_수_목_금_토".split("_"),weekdaysMin:"일_월_화_수_목_금_토".split("_"),longDateFormat:{LT:"A h시 mm분",L:"YYYY.MM.DD",LL:"YYYY년 MMMM D일",LLL:"YYYY년 MMMM D일 LT",LLLL:"YYYY년 MMMM D일 dddd LT"},meridiem:function(a){return 12>a?"오전":"오후"},calendar:{sameDay:"오늘 LT",nextDay:"내일 LT",nextWeek:"dddd LT",lastDay:"어제 LT",lastWeek:"지난주 dddd LT",sameElse:"L"},relativeTime:{future:"%s 후",past:"%s 전",s:"몇초",ss:"%d초",m:"일분",mm:"%d분",h:"한시간",hh:"%d시간",d:"하루",dd:"%d일",M:"한달",MM:"%d달",y:"일년",yy:"%d년"},ordinal:"%d일"})}),function(a){a(bb)}(function(a){function b(a,b,c,d){return b?"kelios sekundės":d?"kelių sekundžių":"kelias sekundes"}function c(a,b,c,d){return b?e(c)[0]:d?e(c)[1]:e(c)[2]}function d(a){return 0===a%10||a>10&&20>a}function e(a){return h[a].split("_")}function f(a,b,f,g){var h=a+" ";return 1===a?h+c(a,b,f[0],g):b?h+(d(a)?e(f)[1]:e(f)[0]):g?h+e(f)[1]:h+(d(a)?e(f)[1]:e(f)[2])}function g(a,b){var c=-1===b.indexOf("dddd LT"),d=i[a.weekday()];return c?d:d.substring(0,d.length-2)+"į"}var h={m:"minutė_minutės_minutę",mm:"minutės_minučių_minutes",h:"valanda_valandos_valandą",hh:"valandos_valandų_valandas",d:"diena_dienos_dieną",dd:"dienos_dienų_dienas",M:"mėnuo_mėnesio_mėnesį",MM:"mėnesiai_mėnesių_mėnesius",y:"metai_metų_metus",yy:"metai_metų_metus"},i="pirmadienis_antradienis_trečiadienis_ketvirtadienis_penktadienis_šeštadienis_sekmadienis".split("_"); return a.lang("lt",{months:"sausio_vasario_kovo_balandžio_gegužės_biržėlio_liepos_rugpjūčio_rugsėjo_spalio_lapkričio_gruodžio".split("_"),monthsShort:"sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd".split("_"),weekdays:g,weekdaysShort:"Sek_Pir_Ant_Tre_Ket_Pen_Šeš".split("_"),weekdaysMin:"S_P_A_T_K_Pn_Š".split("_"),longDateFormat:{LT:"HH:mm",L:"YYYY-MM-DD",LL:"YYYY [m.] MMMM D [d.]",LLL:"YYYY [m.] MMMM D [d.], LT [val.]",LLLL:"YYYY [m.] MMMM D [d.], dddd, LT [val.]",l:"YYYY-MM-DD",ll:"YYYY [m.] MMMM D [d.]",lll:"YYYY [m.] MMMM D [d.], LT [val.]",llll:"YYYY [m.] MMMM D [d.], ddd, LT [val.]"},calendar:{sameDay:"[Šiandien] LT",nextDay:"[Rytoj] LT",nextWeek:"dddd LT",lastDay:"[Vakar] LT",lastWeek:"[Praėjusį] dddd LT",sameElse:"L"},relativeTime:{future:"po %s",past:"prieš %s",s:b,m:c,mm:f,h:c,hh:f,d:c,dd:f,M:c,MM:f,y:c,yy:f},ordinal:function(a){return a+"-oji"},week:{dow:1,doy:4}})}),function(a){a(bb)}(function(a){function b(a,b,c){var d=a.split("_");return c?1===b%10&&11!==b?d[2]:d[3]:1===b%10&&11!==b?d[0]:d[1]}function c(a,c,e){return a+" "+b(d[e],a,c)}var d={mm:"minūti_minūtes_minūte_minūtes",hh:"stundu_stundas_stunda_stundas",dd:"dienu_dienas_diena_dienas",MM:"mēnesi_mēnešus_mēnesis_mēneši",yy:"gadu_gadus_gads_gadi"};return a.lang("lv",{months:"janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris".split("_"),monthsShort:"jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec".split("_"),weekdays:"svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena".split("_"),weekdaysShort:"Sv_P_O_T_C_Pk_S".split("_"),weekdaysMin:"Sv_P_O_T_C_Pk_S".split("_"),longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"YYYY. [gada] D. MMMM",LLL:"YYYY. [gada] D. MMMM, LT",LLLL:"YYYY. [gada] D. MMMM, dddd, LT"},calendar:{sameDay:"[Šodien pulksten] LT",nextDay:"[Rīt pulksten] LT",nextWeek:"dddd [pulksten] LT",lastDay:"[Vakar pulksten] LT",lastWeek:"[Pagājušā] dddd [pulksten] LT",sameElse:"L"},relativeTime:{future:"%s vēlāk",past:"%s agrāk",s:"dažas sekundes",m:"minūti",mm:c,h:"stundu",hh:c,d:"dienu",dd:c,M:"mēnesi",MM:c,y:"gadu",yy:c},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(bb)}(function(a){return a.lang("ml",{months:"ജനുവരി_ഫെബ്രുവരി_മാർച്ച്_ഏപ്രിൽ_മേയ്_ജൂൺ_ജൂലൈ_ഓഗസ്റ്റ്_സെപ്റ്റംബർ_ഒക്ടോബർ_നവംബർ_ഡിസംബർ".split("_"),monthsShort:"ജനു._ഫെബ്രു._മാർ._ഏപ്രി._മേയ്_ജൂൺ_ജൂലൈ._ഓഗ._സെപ്റ്റ._ഒക്ടോ._നവം._ഡിസം.".split("_"),weekdays:"ഞായറാഴ്ച_തിങ്കളാഴ്ച_ചൊവ്വാഴ്ച_ബുധനാഴ്ച_വ്യാഴാഴ്ച_വെള്ളിയാഴ്ച_ശനിയാഴ്ച".split("_"),weekdaysShort:"ഞായർ_തിങ്കൾ_ചൊവ്വ_ബുധൻ_വ്യാഴം_വെള്ളി_ശനി".split("_"),weekdaysMin:"ഞാ_തി_ചൊ_ബു_വ്യാ_വെ_ശ".split("_"),longDateFormat:{LT:"A h:mm -നു",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, LT",LLLL:"dddd, D MMMM YYYY, LT"},calendar:{sameDay:"[ഇന്ന്] LT",nextDay:"[നാളെ] LT",nextWeek:"dddd, LT",lastDay:"[ഇന്നലെ] LT",lastWeek:"[കഴിഞ്ഞ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s കഴിഞ്ഞ്",past:"%s മുൻപ്",s:"അൽപ നിമിഷങ്ങൾ",m:"ഒരു മിനിറ്റ്",mm:"%d മിനിറ്റ്",h:"ഒരു മണിക്കൂർ",hh:"%d മണിക്കൂർ",d:"ഒരു ദിവസം",dd:"%d ദിവസം",M:"ഒരു മാസം",MM:"%d മാസം",y:"ഒരു വർഷം",yy:"%d വർഷം"},meridiem:function(a){return 4>a?"രാത്രി":12>a?"രാവിലെ":17>a?"ഉച്ച കഴിഞ്ഞ്":20>a?"വൈകുന്നേരം":"രാത്രി"}})}),function(a){a(bb)}(function(a){var b={1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"},c={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"};return a.lang("mr",{months:"जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर".split("_"),monthsShort:"जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.".split("_"),weekdays:"रविवार_सोमवार_मंगळवार_बुधवार_गुरूवार_शुक्रवार_शनिवार".split("_"),weekdaysShort:"रवि_सोम_मंगळ_बुध_गुरू_शुक्र_शनि".split("_"),weekdaysMin:"र_सो_मं_बु_गु_शु_श".split("_"),longDateFormat:{LT:"A h:mm वाजता",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, LT",LLLL:"dddd, D MMMM YYYY, LT"},calendar:{sameDay:"[आज] LT",nextDay:"[उद्या] LT",nextWeek:"dddd, LT",lastDay:"[काल] LT",lastWeek:"[मागील] dddd, LT",sameElse:"L"},relativeTime:{future:"%s नंतर",past:"%s पूर्वी",s:"सेकंद",m:"एक मिनिट",mm:"%d मिनिटे",h:"एक तास",hh:"%d तास",d:"एक दिवस",dd:"%d दिवस",M:"एक महिना",MM:"%d महिने",y:"एक वर्ष",yy:"%d वर्षे"},preparse:function(a){return a.replace(/[१२३४५६७८९०]/g,function(a){return c[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return b[a]})},meridiem:function(a){return 4>a?"रात्री":10>a?"सकाळी":17>a?"दुपारी":20>a?"सायंकाळी":"रात्री"},week:{dow:0,doy:6}})}),function(a){a(bb)}(function(a){return a.lang("ms-my",{months:"Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis".split("_"),weekdays:"Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu".split("_"),weekdaysShort:"Ahd_Isn_Sel_Rab_Kha_Jum_Sab".split("_"),weekdaysMin:"Ah_Is_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] LT",LLLL:"dddd, D MMMM YYYY [pukul] LT"},meridiem:function(a){return 11>a?"pagi":15>a?"tengahari":19>a?"petang":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Esok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kelmarin pukul] LT",lastWeek:"dddd [lepas pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lepas",s:"beberapa saat",m:"seminit",mm:"%d minit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:1,doy:7}})}),function(a){a(bb)}(function(a){return a.lang("nb",{months:"januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan._feb._mars_april_mai_juni_juli_aug._sep._okt._nov._des.".split("_"),weekdays:"søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"),weekdaysShort:"sø._ma._ti._on._to._fr._lø.".split("_"),weekdaysMin:"sø_ma_ti_on_to_fr_lø".split("_"),longDateFormat:{LT:"H.mm",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] LT",LLLL:"dddd D. MMMM YYYY [kl.] LT"},calendar:{sameDay:"[i dag kl.] LT",nextDay:"[i morgen kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[i går kl.] LT",lastWeek:"[forrige] dddd [kl.] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"for %s siden",s:"noen sekunder",m:"ett minutt",mm:"%d minutter",h:"en time",hh:"%d timer",d:"en dag",dd:"%d dager",M:"en måned",MM:"%d måneder",y:"ett år",yy:"%d år"},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(bb)}(function(a){var b={1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"},c={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"};return a.lang("ne",{months:"जनवरी_फेब्रुवरी_मार्च_अप्रिल_मई_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर".split("_"),monthsShort:"जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.".split("_"),weekdays:"आइतबार_सोमबार_मङ्गलबार_बुधबार_बिहिबार_शुक्रबार_शनिबार".split("_"),weekdaysShort:"आइत._सोम._मङ्गल._बुध._बिहि._शुक्र._शनि.".split("_"),weekdaysMin:"आइ._सो._मङ्_बु._बि._शु._श.".split("_"),longDateFormat:{LT:"Aको h:mm बजे",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, LT",LLLL:"dddd, D MMMM YYYY, LT"},preparse:function(a){return a.replace(/[१२३४५६७८९०]/g,function(a){return c[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return b[a]})},meridiem:function(a){return 3>a?"राती":10>a?"बिहान":15>a?"दिउँसो":18>a?"बेलुका":20>a?"साँझ":"राती"},calendar:{sameDay:"[आज] LT",nextDay:"[भोली] LT",nextWeek:"[आउँदो] dddd[,] LT",lastDay:"[हिजो] LT",lastWeek:"[गएको] dddd[,] LT",sameElse:"L"},relativeTime:{future:"%sमा",past:"%s अगाडी",s:"केही समय",m:"एक मिनेट",mm:"%d मिनेट",h:"एक घण्टा",hh:"%d घण्टा",d:"एक दिन",dd:"%d दिन",M:"एक महिना",MM:"%d महिना",y:"एक बर्ष",yy:"%d बर्ष"},week:{dow:1,doy:7}})}),function(a){a(bb)}(function(a){var b="jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_"),c="jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_");return a.lang("nl",{months:"januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),monthsShort:function(a,d){return/-MMM-/.test(d)?c[a.month()]:b[a.month()]},weekdays:"zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),weekdaysShort:"zo._ma._di._wo._do._vr._za.".split("_"),weekdaysMin:"Zo_Ma_Di_Wo_Do_Vr_Za".split("_"),longDateFormat:{LT:"HH:mm",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[vandaag om] LT",nextDay:"[morgen om] LT",nextWeek:"dddd [om] LT",lastDay:"[gisteren om] LT",lastWeek:"[afgelopen] dddd [om] LT",sameElse:"L"},relativeTime:{future:"over %s",past:"%s geleden",s:"een paar seconden",m:"één minuut",mm:"%d minuten",h:"één uur",hh:"%d uur",d:"één dag",dd:"%d dagen",M:"één maand",MM:"%d maanden",y:"één jaar",yy:"%d jaar"},ordinal:function(a){return a+(1===a||8===a||a>=20?"ste":"de")},week:{dow:1,doy:4}})}),function(a){a(bb)}(function(a){return a.lang("nn",{months:"januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_"),weekdays:"sundag_måndag_tysdag_onsdag_torsdag_fredag_laurdag".split("_"),weekdaysShort:"sun_mån_tys_ons_tor_fre_lau".split("_"),weekdaysMin:"su_må_ty_on_to_fr_lø".split("_"),longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[I dag klokka] LT",nextDay:"[I morgon klokka] LT",nextWeek:"dddd [klokka] LT",lastDay:"[I går klokka] LT",lastWeek:"[Føregående] dddd [klokka] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"for %s siden",s:"noen sekund",m:"ett minutt",mm:"%d minutt",h:"en time",hh:"%d timar",d:"en dag",dd:"%d dagar",M:"en månad",MM:"%d månader",y:"ett år",yy:"%d år"},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(bb)}(function(a){function b(a){return 5>a%10&&a%10>1&&1!==~~(a/10)}function c(a,c,d){var e=a+" ";switch(d){case"m":return c?"minuta":"minutę";case"mm":return e+(b(a)?"minuty":"minut");case"h":return c?"godzina":"godzinę";case"hh":return e+(b(a)?"godziny":"godzin");case"MM":return e+(b(a)?"miesiące":"miesięcy");case"yy":return e+(b(a)?"lata":"lat")}}var d="styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień".split("_"),e="stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia".split("_");return a.lang("pl",{months:function(a,b){return/D MMMM/.test(b)?e[a.month()]:d[a.month()]},monthsShort:"sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru".split("_"),weekdays:"niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota".split("_"),weekdaysShort:"nie_pon_wt_śr_czw_pt_sb".split("_"),weekdaysMin:"N_Pn_Wt_Śr_Cz_Pt_So".split("_"),longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[Dziś o] LT",nextDay:"[Jutro o] LT",nextWeek:"[W] dddd [o] LT",lastDay:"[Wczoraj o] LT",lastWeek:function(){switch(this.day()){case 0:return"[W zeszłą niedzielę o] LT";case 3:return"[W zeszłą środę o] LT";case 6:return"[W zeszłą sobotę o] LT";default:return"[W zeszły] dddd [o] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"%s temu",s:"kilka sekund",m:c,mm:c,h:c,hh:c,d:"1 dzień",dd:"%d dni",M:"miesiąc",MM:c,y:"rok",yy:c},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(bb)}(function(a){return a.lang("pt-br",{months:"Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro".split("_"),monthsShort:"Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez".split("_"),weekdays:"Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado".split("_"),weekdaysShort:"Dom_Seg_Ter_Qua_Qui_Sex_Sáb".split("_"),weekdaysMin:"Dom_2ª_3ª_4ª_5ª_6ª_Sáb".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY LT",LLLL:"dddd, D [de] MMMM [de] YYYY LT"},calendar:{sameDay:"[Hoje às] LT",nextDay:"[Amanhã às] LT",nextWeek:"dddd [às] LT",lastDay:"[Ontem às] LT",lastWeek:function(){return 0===this.day()||6===this.day()?"[Último] dddd [às] LT":"[Última] dddd [às] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"%s atrás",s:"segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"},ordinal:"%dº"})}),function(a){a(bb)}(function(a){return a.lang("pt",{months:"Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro".split("_"),monthsShort:"Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez".split("_"),weekdays:"Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado".split("_"),weekdaysShort:"Dom_Seg_Ter_Qua_Qui_Sex_Sáb".split("_"),weekdaysMin:"Dom_2ª_3ª_4ª_5ª_6ª_Sáb".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY LT",LLLL:"dddd, D [de] MMMM [de] YYYY LT"},calendar:{sameDay:"[Hoje às] LT",nextDay:"[Amanhã às] LT",nextWeek:"dddd [às] LT",lastDay:"[Ontem às] LT",lastWeek:function(){return 0===this.day()||6===this.day()?"[Último] dddd [às] LT":"[Última] dddd [às] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"%s atrás",s:"segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"},ordinal:"%dº",week:{dow:1,doy:4}})}),function(a){a(bb)}(function(a){return a.lang("ro",{months:"Ianuarie_Februarie_Martie_Aprilie_Mai_Iunie_Iulie_August_Septembrie_Octombrie_Noiembrie_Decembrie".split("_"),monthsShort:"Ian_Feb_Mar_Apr_Mai_Iun_Iul_Aug_Sep_Oct_Noi_Dec".split("_"),weekdays:"Duminică_Luni_Marţi_Miercuri_Joi_Vineri_Sâmbătă".split("_"),weekdaysShort:"Dum_Lun_Mar_Mie_Joi_Vin_Sâm".split("_"),weekdaysMin:"Du_Lu_Ma_Mi_Jo_Vi_Sâ".split("_"),longDateFormat:{LT:"H:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[azi la] LT",nextDay:"[mâine la] LT",nextWeek:"dddd [la] LT",lastDay:"[ieri la] LT",lastWeek:"[fosta] dddd [la] LT",sameElse:"L"},relativeTime:{future:"peste %s",past:"%s în urmă",s:"câteva secunde",m:"un minut",mm:"%d minute",h:"o oră",hh:"%d ore",d:"o zi",dd:"%d zile",M:"o lună",MM:"%d luni",y:"un an",yy:"%d ani"},week:{dow:1,doy:7}})}),function(a){a(bb)}(function(a){function b(a,b){var c=a.split("_");return 1===b%10&&11!==b%100?c[0]:b%10>=2&&4>=b%10&&(10>b%100||b%100>=20)?c[1]:c[2]}function c(a,c,d){var e={mm:"минута_минуты_минут",hh:"час_часа_часов",dd:"день_дня_дней",MM:"месяц_месяца_месяцев",yy:"год_года_лет"};return"m"===d?c?"минута":"минуту":a+" "+b(e[d],+a)}function d(a,b){var c={nominative:"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_"),accusative:"января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря".split("_")},d=/D[oD]? *MMMM?/.test(b)?"accusative":"nominative";return c[d][a.month()]}function e(a,b){var c={nominative:"янв_фев_мар_апр_май_июнь_июль_авг_сен_окт_ноя_дек".split("_"),accusative:"янв_фев_мар_апр_мая_июня_июля_авг_сен_окт_ноя_дек".split("_")},d=/D[oD]? *MMMM?/.test(b)?"accusative":"nominative";return c[d][a.month()]}function f(a,b){var c={nominative:"воскресенье_понедельник_вторник_среда_четверг_пятница_суббота".split("_"),accusative:"воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу".split("_")},d=/\[ ?[Вв] ?(?:прошлую|следующую)? ?\] ?dddd/.test(b)?"accusative":"nominative";return c[d][a.day()]}return a.lang("ru",{months:d,monthsShort:e,weekdays:f,weekdaysShort:"вс_пн_вт_ср_чт_пт_сб".split("_"),weekdaysMin:"вс_пн_вт_ср_чт_пт_сб".split("_"),monthsParse:[/^янв/i,/^фев/i,/^мар/i,/^апр/i,/^ма[й|я]/i,/^июн/i,/^июл/i,/^авг/i,/^сен/i,/^окт/i,/^ноя/i,/^дек/i],longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"D MMMM YYYY г.",LLL:"D MMMM YYYY г., LT",LLLL:"dddd, D MMMM YYYY г., LT"},calendar:{sameDay:"[Сегодня в] LT",nextDay:"[Завтра в] LT",lastDay:"[Вчера в] LT",nextWeek:function(){return 2===this.day()?"[Во] dddd [в] LT":"[В] dddd [в] LT"},lastWeek:function(){switch(this.day()){case 0:return"[В прошлое] dddd [в] LT";case 1:case 2:case 4:return"[В прошлый] dddd [в] LT";case 3:case 5:case 6:return"[В прошлую] dddd [в] LT"}},sameElse:"L"},relativeTime:{future:"через %s",past:"%s назад",s:"несколько секунд",m:c,mm:c,h:"час",hh:c,d:"день",dd:c,M:"месяц",MM:c,y:"год",yy:c},meridiem:function(a){return 4>a?"ночи":12>a?"утра":17>a?"дня":"вечера"},ordinal:function(a,b){switch(b){case"M":case"d":case"DDD":return a+"-й";case"D":return a+"-го";case"w":case"W":return a+"-я";default:return a}},week:{dow:1,doy:7}})}),function(a){a(bb)}(function(a){function b(a){return a>1&&5>a}function c(a,c,d,e){var f=a+" ";switch(d){case"s":return c||e?"pár sekúnd":"pár sekundami";case"m":return c?"minúta":e?"minútu":"minútou";case"mm":return c||e?f+(b(a)?"minúty":"minút"):f+"minútami";break;case"h":return c?"hodina":e?"hodinu":"hodinou";case"hh":return c||e?f+(b(a)?"hodiny":"hodín"):f+"hodinami";break;case"d":return c||e?"deň":"dňom";case"dd":return c||e?f+(b(a)?"dni":"dní"):f+"dňami";break;case"M":return c||e?"mesiac":"mesiacom";case"MM":return c||e?f+(b(a)?"mesiace":"mesiacov"):f+"mesiacmi";break;case"y":return c||e?"rok":"rokom";case"yy":return c||e?f+(b(a)?"roky":"rokov"):f+"rokmi"}}var d="január_február_marec_apríl_máj_jún_júl_august_september_október_november_december".split("_"),e="jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec".split("_");return a.lang("sk",{months:d,monthsShort:e,monthsParse:function(a,b){var c,d=[];for(c=0;12>c;c++)d[c]=new RegExp("^"+a[c]+"$|^"+b[c]+"$","i");return d}(d,e),weekdays:"nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota".split("_"),weekdaysShort:"ne_po_ut_st_št_pi_so".split("_"),weekdaysMin:"ne_po_ut_st_št_pi_so".split("_"),longDateFormat:{LT:"H:mm",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd D. MMMM YYYY LT"},calendar:{sameDay:"[dnes o] LT",nextDay:"[zajtra o] LT",nextWeek:function(){switch(this.day()){case 0:return"[v nedeľu o] LT";case 1:case 2:return"[v] dddd [o] LT";case 3:return"[v stredu o] LT";case 4:return"[vo štvrtok o] LT";case 5:return"[v piatok o] LT";case 6:return"[v sobotu o] LT"}},lastDay:"[včera o] LT",lastWeek:function(){switch(this.day()){case 0:return"[minulú nedeľu o] LT";case 1:case 2:return"[minulý] dddd [o] LT";case 3:return"[minulú stredu o] LT";case 4:case 5:return"[minulý] dddd [o] LT";case 6:return"[minulú sobotu o] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"pred %s",s:c,m:c,mm:c,h:c,hh:c,d:c,dd:c,M:c,MM:c,y:c,yy:c},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(bb)}(function(a){function b(a,b,c){var d=a+" ";switch(c){case"m":return b?"ena minuta":"eno minuto";case"mm":return d+=1===a?"minuta":2===a?"minuti":3===a||4===a?"minute":"minut";case"h":return b?"ena ura":"eno uro";case"hh":return d+=1===a?"ura":2===a?"uri":3===a||4===a?"ure":"ur";case"dd":return d+=1===a?"dan":"dni";case"MM":return d+=1===a?"mesec":2===a?"meseca":3===a||4===a?"mesece":"mesecev";case"yy":return d+=1===a?"leto":2===a?"leti":3===a||4===a?"leta":"let"}}return a.lang("sl",{months:"januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december".split("_"),monthsShort:"jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.".split("_"),weekdays:"nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota".split("_"),weekdaysShort:"ned._pon._tor._sre._čet._pet._sob.".split("_"),weekdaysMin:"ne_po_to_sr_če_pe_so".split("_"),longDateFormat:{LT:"H:mm",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[danes ob] LT",nextDay:"[jutri ob] LT",nextWeek:function(){switch(this.day()){case 0:return"[v] [nedeljo] [ob] LT";case 3:return"[v] [sredo] [ob] LT";case 6:return"[v] [soboto] [ob] LT";case 1:case 2:case 4:case 5:return"[v] dddd [ob] LT"}},lastDay:"[včeraj ob] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[prejšnja] dddd [ob] LT";case 1:case 2:case 4:case 5:return"[prejšnji] dddd [ob] LT"}},sameElse:"L"},relativeTime:{future:"čez %s",past:"%s nazaj",s:"nekaj sekund",m:b,mm:b,h:b,hh:b,d:"en dan",dd:b,M:"en mesec",MM:b,y:"eno leto",yy:b},ordinal:"%d.",week:{dow:1,doy:7}})}),function(a){a(bb)}(function(a){return a.lang("sq",{months:"Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_Nëntor_Dhjetor".split("_"),monthsShort:"Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj".split("_"),weekdays:"E Diel_E Hënë_E Marte_E Mërkure_E Enjte_E Premte_E Shtunë".split("_"),weekdaysShort:"Die_Hën_Mar_Mër_Enj_Pre_Sht".split("_"),weekdaysMin:"D_H_Ma_Më_E_P_Sh".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[Sot në] LT",nextDay:"[Neser në] LT",nextWeek:"dddd [në] LT",lastDay:"[Dje në] LT",lastWeek:"dddd [e kaluar në] LT",sameElse:"L"},relativeTime:{future:"në %s",past:"%s me parë",s:"disa seconda",m:"një minut",mm:"%d minutea",h:"një orë",hh:"%d orë",d:"një ditë",dd:"%d ditë",M:"një muaj",MM:"%d muaj",y:"një vit",yy:"%d vite"},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(bb)}(function(a){return a.lang("sv",{months:"januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekdays:"söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag".split("_"),weekdaysShort:"sön_mån_tis_ons_tor_fre_lör".split("_"),weekdaysMin:"sö_må_ti_on_to_fr_lö".split("_"),longDateFormat:{LT:"HH:mm",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[Idag] LT",nextDay:"[Imorgon] LT",lastDay:"[Igår] LT",nextWeek:"dddd LT",lastWeek:"[Förra] dddd[en] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"för %s sedan",s:"några sekunder",m:"en minut",mm:"%d minuter",h:"en timme",hh:"%d timmar",d:"en dag",dd:"%d dagar",M:"en månad",MM:"%d månader",y:"ett år",yy:"%d år"},ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"e":1===b?"a":2===b?"a":3===b?"e":"e";return a+c},week:{dow:1,doy:4}})}),function(a){a(bb)}(function(a){return a.lang("th",{months:"มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม".split("_"),monthsShort:"มกรา_กุมภา_มีนา_เมษา_พฤษภา_มิถุนา_กรกฎา_สิงหา_กันยา_ตุลา_พฤศจิกา_ธันวา".split("_"),weekdays:"อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์".split("_"),weekdaysShort:"อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์".split("_"),weekdaysMin:"อา._จ._อ._พ._พฤ._ศ._ส.".split("_"),longDateFormat:{LT:"H นาฬิกา m นาที",L:"YYYY/MM/DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY เวลา LT",LLLL:"วันddddที่ D MMMM YYYY เวลา LT"},meridiem:function(a){return 12>a?"ก่อนเที่ยง":"หลังเที่ยง"},calendar:{sameDay:"[วันนี้ เวลา] LT",nextDay:"[พรุ่งนี้ เวลา] LT",nextWeek:"dddd[หน้า เวลา] LT",lastDay:"[เมื่อวานนี้ เวลา] LT",lastWeek:"[วัน]dddd[ที่แล้ว เวลา] LT",sameElse:"L"},relativeTime:{future:"อีก %s",past:"%sที่แล้ว",s:"ไม่กี่วินาที",m:"1 นาที",mm:"%d นาที",h:"1 ชั่วโมง",hh:"%d ชั่วโมง",d:"1 วัน",dd:"%d วัน",M:"1 เดือน",MM:"%d เดือน",y:"1 ปี",yy:"%d ปี"}})}),function(a){a(bb)}(function(a){var b={1:"'inci",5:"'inci",8:"'inci",70:"'inci",80:"'inci",2:"'nci",7:"'nci",20:"'nci",50:"'nci",3:"'üncü",4:"'üncü",100:"'üncü",6:"'ncı",9:"'uncu",10:"'uncu",30:"'uncu",60:"'ıncı",90:"'ıncı"};return a.lang("tr",{months:"Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık".split("_"),monthsShort:"Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara".split("_"),weekdays:"Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi".split("_"),weekdaysShort:"Paz_Pts_Sal_Çar_Per_Cum_Cts".split("_"),weekdaysMin:"Pz_Pt_Sa_Ça_Pe_Cu_Ct".split("_"),longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[bugün saat] LT",nextDay:"[yarın saat] LT",nextWeek:"[haftaya] dddd [saat] LT",lastDay:"[dün] LT",lastWeek:"[geçen hafta] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s sonra",past:"%s önce",s:"birkaç saniye",m:"bir dakika",mm:"%d dakika",h:"bir saat",hh:"%d saat",d:"bir gün",dd:"%d gün",M:"bir ay",MM:"%d ay",y:"bir yıl",yy:"%d yıl"},ordinal:function(a){if(0===a)return a+"'ıncı";var c=a%10,d=a%100-c,e=a>=100?100:null;return a+(b[c]||b[d]||b[e])},week:{dow:1,doy:7}})}),function(a){a(bb)}(function(a){return a.lang("tzm-la",{months:"innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir".split("_"),monthsShort:"innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir".split("_"),weekdays:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),weekdaysShort:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),weekdaysMin:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[asdkh g] LT",nextDay:"[aska g] LT",nextWeek:"dddd [g] LT",lastDay:"[assant g] LT",lastWeek:"dddd [g] LT",sameElse:"L"},relativeTime:{future:"dadkh s yan %s",past:"yan %s",s:"imik",m:"minuḍ",mm:"%d minuḍ",h:"saɛa",hh:"%d tassaɛin",d:"ass",dd:"%d ossan",M:"ayowr",MM:"%d iyyirn",y:"asgas",yy:"%d isgasn"},week:{dow:6,doy:12}})}),function(a){a(bb)}(function(a){return a.lang("tzm",{months:"ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ".split("_"),monthsShort:"ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ".split("_"),weekdays:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),weekdaysShort:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),weekdaysMin:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[ⴰⵙⴷⵅ ⴴ] LT",nextDay:"[ⴰⵙⴽⴰ ⴴ] LT",nextWeek:"dddd [ⴴ] LT",lastDay:"[ⴰⵚⴰⵏⵜ ⴴ] LT",lastWeek:"dddd [ⴴ] LT",sameElse:"L"},relativeTime:{future:"ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ %s",past:"ⵢⴰⵏ %s",s:"ⵉⵎⵉⴽ",m:"ⵎⵉⵏⵓⴺ",mm:"%d ⵎⵉⵏⵓⴺ",h:"ⵙⴰⵄⴰ",hh:"%d ⵜⴰⵙⵙⴰⵄⵉⵏ",d:"ⴰⵙⵙ",dd:"%d oⵙⵙⴰⵏ",M:"ⴰⵢoⵓⵔ",MM:"%d ⵉⵢⵢⵉⵔⵏ",y:"ⴰⵙⴳⴰⵙ",yy:"%d ⵉⵙⴳⴰⵙⵏ"},week:{dow:6,doy:12}})}),function(a){a(bb)}(function(a){function b(a,b){var c=a.split("_");return 1===b%10&&11!==b%100?c[0]:b%10>=2&&4>=b%10&&(10>b%100||b%100>=20)?c[1]:c[2]}function c(a,c,d){var e={mm:"хвилина_хвилини_хвилин",hh:"година_години_годин",dd:"день_дні_днів",MM:"місяць_місяці_місяців",yy:"рік_роки_років"};return"m"===d?c?"хвилина":"хвилину":"h"===d?c?"година":"годину":a+" "+b(e[d],+a)}function d(a,b){var c={nominative:"січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень".split("_"),accusative:"січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня".split("_")},d=/D[oD]? *MMMM?/.test(b)?"accusative":"nominative";return c[d][a.month()]}function e(a,b){var c={nominative:"неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота".split("_"),accusative:"неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу".split("_"),genitive:"неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи".split("_")},d=/(\[[ВвУу]\]) ?dddd/.test(b)?"accusative":/\[?(?:минулої|наступної)? ?\] ?dddd/.test(b)?"genitive":"nominative";return c[d][a.day()]}function f(a){return function(){return a+"о"+(11===this.hours()?"б":"")+"] LT"}}return a.lang("uk",{months:d,monthsShort:"січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд".split("_"),weekdays:e,weekdaysShort:"нд_пн_вт_ср_чт_пт_сб".split("_"),weekdaysMin:"нд_пн_вт_ср_чт_пт_сб".split("_"),longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"D MMMM YYYY р.",LLL:"D MMMM YYYY р., LT",LLLL:"dddd, D MMMM YYYY р., LT"},calendar:{sameDay:f("[Сьогодні "),nextDay:f("[Завтра "),lastDay:f("[Вчора "),nextWeek:f("[У] dddd ["),lastWeek:function(){switch(this.day()){case 0:case 3:case 5:case 6:return f("[Минулої] dddd [").call(this);case 1:case 2:case 4:return f("[Минулого] dddd [").call(this)}},sameElse:"L"},relativeTime:{future:"за %s",past:"%s тому",s:"декілька секунд",m:c,mm:c,h:"годину",hh:c,d:"день",dd:c,M:"місяць",MM:c,y:"рік",yy:c},meridiem:function(a){return 4>a?"ночі":12>a?"ранку":17>a?"дня":"вечора"},ordinal:function(a,b){switch(b){case"M":case"d":case"DDD":case"w":case"W":return a+"-й";case"D":return a+"-го";default:return a}},week:{dow:1,doy:7}})}),function(a){a(bb)}(function(a){return a.lang("uz",{months:"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_"),monthsShort:"янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек".split("_"),weekdays:"Якшанба_Душанба_Сешанба_Чоршанба_Пайшанба_Жума_Шанба".split("_"),weekdaysShort:"Якш_Душ_Сеш_Чор_Пай_Жум_Шан".split("_"),weekdaysMin:"Як_Ду_Се_Чо_Па_Жу_Ша".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"D MMMM YYYY, dddd LT"},calendar:{sameDay:"[Бугун соат] LT [да]",nextDay:"[Эртага] LT [да]",nextWeek:"dddd [куни соат] LT [да]",lastDay:"[Кеча соат] LT [да]",lastWeek:"[Утган] dddd [куни соат] LT [да]",sameElse:"L"},relativeTime:{future:"Якин %s ичида",past:"Бир неча %s олдин",s:"фурсат",m:"бир дакика",mm:"%d дакика",h:"бир соат",hh:"%d соат",d:"бир кун",dd:"%d кун",M:"бир ой",MM:"%d ой",y:"бир йил",yy:"%d йил"},week:{dow:1,doy:7}})}),function(a){a(bb)}(function(a){return a.lang("vn",{months:"tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12".split("_"),monthsShort:"Th01_Th02_Th03_Th04_Th05_Th06_Th07_Th08_Th09_Th10_Th11_Th12".split("_"),weekdays:"chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy".split("_"),weekdaysShort:"CN_T2_T3_T4_T5_T6_T7".split("_"),weekdaysMin:"CN_T2_T3_T4_T5_T6_T7".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM [năm] YYYY",LLL:"D MMMM [năm] YYYY LT",LLLL:"dddd, D MMMM [năm] YYYY LT",l:"DD/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY LT",llll:"ddd, D MMM YYYY LT"},calendar:{sameDay:"[Hôm nay lúc] LT",nextDay:"[Ngày mai lúc] LT",nextWeek:"dddd [tuần tới lúc] LT",lastDay:"[Hôm qua lúc] LT",lastWeek:"dddd [tuần rồi lúc] LT",sameElse:"L"},relativeTime:{future:"%s tới",past:"%s trước",s:"vài giây",m:"một phút",mm:"%d phút",h:"một giờ",hh:"%d giờ",d:"một ngày",dd:"%d ngày",M:"một tháng",MM:"%d tháng",y:"một năm",yy:"%d năm"},ordinal:function(a){return a},week:{dow:1,doy:4}})}),function(a){a(bb)}(function(a){return a.lang("zh-cn",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"Ah点mm",L:"YYYY年MMMD日",LL:"YYYY年MMMD日",LLL:"YYYY年MMMD日LT",LLLL:"YYYY年MMMD日ddddLT",l:"YYYY年MMMD日",ll:"YYYY年MMMD日",lll:"YYYY年MMMD日LT",llll:"YYYY年MMMD日ddddLT"},meridiem:function(a,b){var c=100*a+b;return 900>c?"早上":1130>c?"上午":1230>c?"中午":1800>c?"下午":"晚上"},calendar:{sameDay:"[今天]LT",nextDay:"[明天]LT",nextWeek:"[下]ddddLT",lastDay:"[昨天]LT",lastWeek:"[上]ddddLT",sameElse:"L"},ordinal:function(a,b){switch(b){case"d":case"D":case"DDD":return a+"日";case"M":return a+"月";case"w":case"W":return a+"周";default:return a}},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1分钟",mm:"%d分钟",h:"1小时",hh:"%d小时",d:"1天",dd:"%d天",M:"1个月",MM:"%d个月",y:"1年",yy:"%d年"}})}),function(a){a(bb)}(function(a){return a.lang("zh-tw",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"Ah點mm",L:"YYYY年MMMD日",LL:"YYYY年MMMD日",LLL:"YYYY年MMMD日LT",LLLL:"YYYY年MMMD日ddddLT",l:"YYYY年MMMD日",ll:"YYYY年MMMD日",lll:"YYYY年MMMD日LT",llll:"YYYY年MMMD日ddddLT"},meridiem:function(a,b){var c=100*a+b;return 900>c?"早上":1130>c?"上午":1230>c?"中午":1800>c?"下午":"晚上"},calendar:{sameDay:"[今天]LT",nextDay:"[明天]LT",nextWeek:"[下]ddddLT",lastDay:"[昨天]LT",lastWeek:"[上]ddddLT",sameElse:"L"},ordinal:function(a,b){switch(b){case"d":case"D":case"DDD":return a+"日";case"M":return a+"月";case"w":case"W":return a+"週";default:return a }},relativeTime:{future:"%s內",past:"%s前",s:"幾秒",m:"一分鐘",mm:"%d分鐘",h:"一小時",hh:"%d小時",d:"一天",dd:"%d天",M:"一個月",MM:"%d個月",y:"一年",yy:"%d年"}})}),bb.lang("en"),nb?(module.exports=bb,ab()):"function"==typeof define&&define.amd?define("moment",function(a,b,c){return c.config().noGlobal!==!0&&ab(),bb}):ab()}).call(this);
stevermeister/cdnjs
ajax/libs/moment.js/2.3.1/moment-with-langs.min.js
JavaScript
mit
107,837
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ #browser { margin-top: 1em; } #interface-picker { float: left; margin-right: 1.0em; padding-right: 1.0em; border-right: thin solid; } #interface-picker h2, #interface-content h2 { margin-top: 0.0em; border-bottom: thin solid; } #interface-content { overflow: hidden; padding-left: 1.0em; } #interface-list li { list-style-type: none; } #interface-body pre { margin-left: 2.0em; white-space: pre; overflow: auto; } .tdIndent { margin-left: 1.0em; } .indent { white-space: pre; } .attributeName, .methodName, .interfaceName { font-weight: bold; } .type { z-font-style: italic; } .parameterName { color: #0A0; } h3 { border: thin solid; -moz-border-radius: 0.5em; -webkit-border-radius: 0.5em; background-color: #EEE; padding-left: 1.0em; } a, a:hover, a:visited, .type { color: #00A; } @media print { .noprint { display: none; } body { font-size: 60%; } }
danhphan1307/innovation
node_modules/weinre/web/interfaces/interfaces.css
CSS
mit
1,870
/** * @license * Highcharts funnel module * * (c) 2010-2014 Torstein Honsi * * License: www.highcharts.com/license */ /*global Highcharts */ (function (Highcharts) { 'use strict'; // create shortcuts var defaultOptions = Highcharts.getOptions(), defaultPlotOptions = defaultOptions.plotOptions, seriesTypes = Highcharts.seriesTypes, merge = Highcharts.merge, noop = function () {}, each = Highcharts.each, pick = Highcharts.pick; // set default options defaultPlotOptions.funnel = merge(defaultPlotOptions.pie, { animation: false, center: ['50%', '50%'], width: '90%', neckWidth: '30%', height: '100%', neckHeight: '25%', reversed: false, dataLabels: { //position: 'right', connectorWidth: 1, connectorColor: '#606060' }, size: true, // to avoid adapting to data label size in Pie.drawDataLabels states: { select: { color: '#C0C0C0', borderColor: '#000000', shadow: false } } }); seriesTypes.funnel = Highcharts.extendClass(seriesTypes.pie, { type: 'funnel', animate: noop, /** * Overrides the pie translate method */ translate: function () { var // Get positions - either an integer or a percentage string must be given getLength = function (length, relativeTo) { return (/%$/).test(length) ? relativeTo * parseInt(length, 10) / 100 : parseInt(length, 10); }, sum = 0, series = this, chart = series.chart, options = series.options, reversed = options.reversed, ignoreHiddenPoint = options.ignoreHiddenPoint, plotWidth = chart.plotWidth, plotHeight = chart.plotHeight, cumulative = 0, // start at top center = options.center, centerX = getLength(center[0], plotWidth), centerY = getLength(center[1], plotHeight), width = getLength(options.width, plotWidth), tempWidth, getWidthAt, height = getLength(options.height, plotHeight), neckWidth = getLength(options.neckWidth, plotWidth), neckHeight = getLength(options.neckHeight, plotHeight), neckY = height - neckHeight, data = series.data, path, fraction, half = options.dataLabels.position === 'left' ? 1 : 0, x1, y1, x2, x3, y3, x4, y5; // Return the width at a specific y coordinate series.getWidthAt = getWidthAt = function (y) { return y > height - neckHeight || height === neckHeight ? neckWidth : neckWidth + (width - neckWidth) * ((height - neckHeight - y) / (height - neckHeight)); }; series.getX = function (y, half) { return centerX + (half ? -1 : 1) * ((getWidthAt(reversed ? plotHeight - y : y) / 2) + options.dataLabels.distance); }; // Expose series.center = [centerX, centerY, height]; series.centerX = centerX; /* * Individual point coordinate naming: * * x1,y1 _________________ x2,y1 * \ / * \ / * \ / * \ / * \ / * x3,y3 _________ x4,y3 * * Additional for the base of the neck: * * | | * | | * | | * x3,y5 _________ x4,y5 */ // get the total sum each(data, function (point) { if (!ignoreHiddenPoint || point.visible !== false) { sum += point.y; } }); each(data, function (point) { // set start and end positions y5 = null; fraction = sum ? point.y / sum : 0; y1 = centerY - height / 2 + cumulative * height; y3 = y1 + fraction * height; //tempWidth = neckWidth + (width - neckWidth) * ((height - neckHeight - y1) / (height - neckHeight)); tempWidth = getWidthAt(y1); x1 = centerX - tempWidth / 2; x2 = x1 + tempWidth; tempWidth = getWidthAt(y3); x3 = centerX - tempWidth / 2; x4 = x3 + tempWidth; // the entire point is within the neck if (y1 > neckY) { x1 = x3 = centerX - neckWidth / 2; x2 = x4 = centerX + neckWidth / 2; // the base of the neck } else if (y3 > neckY) { y5 = y3; tempWidth = getWidthAt(neckY); x3 = centerX - tempWidth / 2; x4 = x3 + tempWidth; y3 = neckY; } if (reversed) { y1 = height - y1; y3 = height - y3; y5 = (y5 ? height - y5 : null); } // save the path path = [ 'M', x1, y1, 'L', x2, y1, x4, y3 ]; if (y5) { path.push(x4, y5, x3, y5); } path.push(x3, y3, 'Z'); // prepare for using shared dr point.shapeType = 'path'; point.shapeArgs = { d: path }; // for tooltips and data labels point.percentage = fraction * 100; point.plotX = centerX; point.plotY = (y1 + (y5 || y3)) / 2; // Placement of tooltips and data labels point.tooltipPos = [ centerX, point.plotY ]; // Slice is a noop on funnel points point.slice = noop; // Mimicking pie data label placement logic point.half = half; if (!ignoreHiddenPoint || point.visible !== false) { cumulative += fraction; } }); }, /** * Draw a single point (wedge) * @param {Object} point The point object * @param {Object} color The color of the point * @param {Number} brightness The brightness relative to the color */ drawPoints: function () { var series = this, options = series.options, chart = series.chart, renderer = chart.renderer; each(series.data, function (point) { var pointOptions = point.options, graphic = point.graphic, shapeArgs = point.shapeArgs; if (!graphic) { // Create the shapes point.graphic = renderer.path(shapeArgs). attr({ fill: point.color, stroke: pick(pointOptions.borderColor, options.borderColor), 'stroke-width': pick(pointOptions.borderWidth, options.borderWidth) }). add(series.group); } else { // Update the shapes graphic.animate(shapeArgs); } }); }, /** * Funnel items don't have angles (#2289) */ sortByAngle: function (points) { points.sort(function (a, b) { return a.plotY - b.plotY; }); }, /** * Extend the pie data label method */ drawDataLabels: function () { var data = this.data, labelDistance = this.options.dataLabels.distance, leftSide, sign, point, i = data.length, x, y; // In the original pie label anticollision logic, the slots are distributed // from one labelDistance above to one labelDistance below the pie. In funnels // we don't want this. this.center[2] -= 2 * labelDistance; // Set the label position array for each point. while (i--) { point = data[i]; leftSide = point.half; sign = leftSide ? 1 : -1; y = point.plotY; x = this.getX(y, leftSide); // set the anchor point for data labels point.labelPos = [ 0, // first break of connector y, // a/a x + (labelDistance - 5) * sign, // second break, right outside point shape y, // a/a x + labelDistance * sign, // landing point for connector y, // a/a leftSide ? 'right' : 'left', // alignment 0 // center angle ]; } seriesTypes.pie.prototype.drawDataLabels.call(this); } }); /** * Pyramid series type. * A pyramid series is a special type of funnel, without neck and reversed by default. */ defaultOptions.plotOptions.pyramid = Highcharts.merge(defaultOptions.plotOptions.funnel, { neckWidth: '0%', neckHeight: '0%', reversed: true }); Highcharts.seriesTypes.pyramid = Highcharts.extendClass(Highcharts.seriesTypes.funnel, { type: 'pyramid' }); }(Highcharts));
LeaYeh/cdnjs
ajax/libs/highstock/2.1.8/modules/funnel.src.js
JavaScript
mit
7,469
<?php /* * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ namespace Doctrine\DBAL\Driver\PDOIbm; use Doctrine\DBAL\Connection; /** * Driver for the PDO IBM extension. * * @link www.doctrine-project.org * @since 1.0 * @author Benjamin Eberlei <kontakt@beberlei.de> * @author Guilherme Blanco <guilhermeblanco@hotmail.com> * @author Jonathan Wage <jonwage@gmail.com> * @author Roman Borschel <roman@code-factory.org> */ class Driver implements \Doctrine\DBAL\Driver { /** * {@inheritdoc} */ public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) { $conn = new \Doctrine\DBAL\Driver\PDOConnection( $this->_constructPdoDsn($params), $username, $password, $driverOptions ); return $conn; } /** * Constructs the IBM PDO DSN. * * @param array $params * * @return string The DSN. */ private function _constructPdoDsn(array $params) { $dsn = 'ibm:'; if (isset($params['host'])) { $dsn .= 'HOSTNAME=' . $params['host'] . ';'; } if (isset($params['port'])) { $dsn .= 'PORT=' . $params['port'] . ';'; } $dsn .= 'PROTOCOL=TCPIP;'; if (isset($params['dbname'])) { $dsn .= 'DATABASE=' . $params['dbname'] . ';'; } return $dsn; } /** * {@inheritdoc} */ public function getDatabasePlatform() { return new \Doctrine\DBAL\Platforms\DB2Platform; } /** * {@inheritdoc} */ public function getSchemaManager(Connection $conn) { return new \Doctrine\DBAL\Schema\DB2SchemaManager($conn); } /** * {@inheritdoc} */ public function getName() { return 'pdo_ibm'; } /** * {@inheritdoc} */ public function getDatabase(\Doctrine\DBAL\Connection $conn) { $params = $conn->getParams(); return $params['dbname']; } }
demon12c1/wifitracking
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOIbm/Driver.php
PHP
mit
2,982
// Copyright 2010-2012 Mikeal Rogers // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. 'use strict' var extend = require('extend') , cookies = require('./lib/cookies') , helpers = require('./lib/helpers') var isFunction = helpers.isFunction , paramsHaveRequestBody = helpers.paramsHaveRequestBody // organize params for patch, post, put, head, del function initParams(uri, options, callback) { if (typeof options === 'function') { callback = options } var params = {} if (typeof options === 'object') { extend(params, options, {uri: uri}) } else if (typeof uri === 'string') { extend(params, {uri: uri}) } else { extend(params, uri) } params.callback = callback return params } function request (uri, options, callback) { if (typeof uri === 'undefined') { throw new Error('undefined is not a valid uri or options object.') } var params = initParams(uri, options, callback) if (params.method === 'HEAD' && paramsHaveRequestBody(params)) { throw new Error('HTTP HEAD requests MUST NOT include a request body.') } return new request.Request(params) } function verbFunc (verb) { var method = verb === 'del' ? 'DELETE' : verb.toUpperCase() return function (uri, options, callback) { var params = initParams(uri, options, callback) params.method = method return request(params, params.callback) } } // define like this to please codeintel/intellisense IDEs request.get = verbFunc('get') request.head = verbFunc('head') request.post = verbFunc('post') request.put = verbFunc('put') request.patch = verbFunc('patch') request.del = verbFunc('del') request.jar = function (store) { return cookies.jar(store) } request.cookie = function (str) { return cookies.parse(str) } function wrapRequestMethod (method, options, requester, verb) { return function (uri, opts, callback) { var params = initParams(uri, opts, callback) var target = {} extend(true, target, options, params) target.pool = params.pool || options.pool if (verb) { target.method = (verb === 'del' ? 'DELETE' : verb.toUpperCase()) } if (isFunction(requester)) { method = requester } return method(target, target.callback) } } request.defaults = function (options, requester) { var self = this options = options || {} if (typeof options === 'function') { requester = options options = {} } var defaults = wrapRequestMethod(self, options, requester) var verbs = ['get', 'head', 'post', 'put', 'patch', 'del'] verbs.forEach(function(verb) { defaults[verb] = wrapRequestMethod(self[verb], options, requester, verb) }) defaults.cookie = wrapRequestMethod(self.cookie, options, requester) defaults.jar = self.jar defaults.defaults = self.defaults return defaults } request.forever = function (agentOptions, optionsArg) { var options = {} if (optionsArg) { extend(options, optionsArg) } if (agentOptions) { options.agentOptions = agentOptions } options.forever = true return request.defaults(options) } // Exports module.exports = request request.Request = require('./request') request.initParams = initParams // Backwards compatibility for request.debug Object.defineProperty(request, 'debug', { enumerable : true, get : function() { return request.Request.debug }, set : function(debug) { request.Request.debug = debug } })
denysbsb/auth0-ng2
node_modules/request/index.js
JavaScript
mit
4,017
// // TKTransition.m // TransitionKit // // Created by Blake Watters on 10/11/13. // Copyright (c) 2013 Blake Watters. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #import "TKTransition.h" #import "TKEvent.h" @interface TKTransition () @property (nonatomic, strong, readwrite) TKEvent *event; @property (nonatomic, strong, readwrite) TKState *sourceState; @property (nonatomic, strong, readwrite) TKStateMachine *stateMachine; @property (nonatomic, copy, readwrite) NSDictionary *userInfo; @end @implementation TKTransition + (instancetype)transitionForEvent:(TKEvent *)event fromState:(TKState *)sourceState inStateMachine:(TKStateMachine *)stateMachine userInfo:(NSDictionary *)userInfo { TKTransition *transition = [self new]; transition.event = event; transition.sourceState = sourceState; transition.stateMachine = stateMachine; transition.userInfo = userInfo; return transition; } - (TKState *)destinationState { return self.event.destinationState; } @end
Cain1127/YSMRequestMappingExtend
Example/Pods/TransitionKit/Code/TKTransition.m
Matlab
mit
1,543
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.ProgressBar=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ /*! shifty - v1.2.2 - 2014-10-09 - http://jeremyckahn.github.io/shifty */ ;(function (root) { /*! * Shifty Core * By Jeremy Kahn - jeremyckahn@gmail.com */ // UglifyJS define hack. Used for unit testing. Contents of this if are // compiled away. if (typeof SHIFTY_DEBUG_NOW === 'undefined') { SHIFTY_DEBUG_NOW = function () { return +new Date(); }; } var Tweenable = (function () { 'use strict'; // Aliases that get defined later in this function var formula; // CONSTANTS var DEFAULT_SCHEDULE_FUNCTION; var DEFAULT_EASING = 'linear'; var DEFAULT_DURATION = 500; var UPDATE_TIME = 1000 / 60; var _now = Date.now ? Date.now : function () {return +new Date();}; var now = SHIFTY_DEBUG_NOW ? SHIFTY_DEBUG_NOW : _now; if (typeof window !== 'undefined') { // requestAnimationFrame() shim by Paul Irish (modified for Shifty) // http://paulirish.com/2011/requestanimationframe-for-smart-animating/ DEFAULT_SCHEDULE_FUNCTION = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || (window.mozCancelRequestAnimationFrame && window.mozRequestAnimationFrame) || setTimeout; } else { DEFAULT_SCHEDULE_FUNCTION = setTimeout; } function noop () { // NOOP! } /*! * Handy shortcut for doing a for-in loop. This is not a "normal" each * function, it is optimized for Shifty. The iterator function only receives * the property name, not the value. * @param {Object} obj * @param {Function(string)} fn */ function each (obj, fn) { var key; for (key in obj) { if (Object.hasOwnProperty.call(obj, key)) { fn(key); } } } /*! * Perform a shallow copy of Object properties. * @param {Object} targetObject The object to copy into * @param {Object} srcObject The object to copy from * @return {Object} A reference to the augmented `targetObj` Object */ function shallowCopy (targetObj, srcObj) { each(srcObj, function (prop) { targetObj[prop] = srcObj[prop]; }); return targetObj; } /*! * Copies each property from src onto target, but only if the property to * copy to target is undefined. * @param {Object} target Missing properties in this Object are filled in * @param {Object} src */ function defaults (target, src) { each(src, function (prop) { if (typeof target[prop] === 'undefined') { target[prop] = src[prop]; } }); } /*! * Calculates the interpolated tween values of an Object for a given * timestamp. * @param {Number} forPosition The position to compute the state for. * @param {Object} currentState Current state properties. * @param {Object} originalState: The original state properties the Object is * tweening from. * @param {Object} targetState: The destination state properties the Object * is tweening to. * @param {number} duration: The length of the tween in milliseconds. * @param {number} timestamp: The UNIX epoch time at which the tween began. * @param {Object} easing: This Object's keys must correspond to the keys in * targetState. */ function tweenProps (forPosition, currentState, originalState, targetState, duration, timestamp, easing) { var normalizedPosition = (forPosition - timestamp) / duration; var prop; for (prop in currentState) { if (currentState.hasOwnProperty(prop)) { currentState[prop] = tweenProp(originalState[prop], targetState[prop], formula[easing[prop]], normalizedPosition); } } return currentState; } /*! * Tweens a single property. * @param {number} start The value that the tween started from. * @param {number} end The value that the tween should end at. * @param {Function} easingFunc The easing curve to apply to the tween. * @param {number} position The normalized position (between 0.0 and 1.0) to * calculate the midpoint of 'start' and 'end' against. * @return {number} The tweened value. */ function tweenProp (start, end, easingFunc, position) { return start + (end - start) * easingFunc(position); } /*! * Applies a filter to Tweenable instance. * @param {Tweenable} tweenable The `Tweenable` instance to call the filter * upon. * @param {String} filterName The name of the filter to apply. */ function applyFilter (tweenable, filterName) { var filters = Tweenable.prototype.filter; var args = tweenable._filterArgs; each(filters, function (name) { if (typeof filters[name][filterName] !== 'undefined') { filters[name][filterName].apply(tweenable, args); } }); } var timeoutHandler_endTime; var timeoutHandler_currentTime; var timeoutHandler_isEnded; /*! * Handles the update logic for one step of a tween. * @param {Tweenable} tweenable * @param {number} timestamp * @param {number} duration * @param {Object} currentState * @param {Object} originalState * @param {Object} targetState * @param {Object} easing * @param {Function} step * @param {Function(Function,number)}} schedule */ function timeoutHandler (tweenable, timestamp, duration, currentState, originalState, targetState, easing, step, schedule) { timeoutHandler_endTime = timestamp + duration; timeoutHandler_currentTime = Math.min(now(), timeoutHandler_endTime); timeoutHandler_isEnded = timeoutHandler_currentTime >= timeoutHandler_endTime; if (tweenable.isPlaying() && !timeoutHandler_isEnded) { schedule(tweenable._timeoutHandler, UPDATE_TIME); applyFilter(tweenable, 'beforeTween'); tweenProps(timeoutHandler_currentTime, currentState, originalState, targetState, duration, timestamp, easing); applyFilter(tweenable, 'afterTween'); step(currentState); } else if (timeoutHandler_isEnded) { step(targetState); tweenable.stop(true); } } /*! * Creates a usable easing Object from either a string or another easing * Object. If `easing` is an Object, then this function clones it and fills * in the missing properties with "linear". * @param {Object} fromTweenParams * @param {Object|string} easing */ function composeEasingObject (fromTweenParams, easing) { var composedEasing = {}; if (typeof easing === 'string') { each(fromTweenParams, function (prop) { composedEasing[prop] = easing; }); } else { each(fromTweenParams, function (prop) { if (!composedEasing[prop]) { composedEasing[prop] = easing[prop] || DEFAULT_EASING; } }); } return composedEasing; } /** * Tweenable constructor. * @param {Object=} opt_initialState The values that the initial tween should start at if a "from" object is not provided to Tweenable#tween. * @param {Object=} opt_config See Tweenable.prototype.setConfig() * @constructor */ function Tweenable (opt_initialState, opt_config) { this._currentState = opt_initialState || {}; this._configured = false; this._scheduleFunction = DEFAULT_SCHEDULE_FUNCTION; // To prevent unnecessary calls to setConfig do not set default configuration here. // Only set default configuration immediately before tweening if none has been set. if (typeof opt_config !== 'undefined') { this.setConfig(opt_config); } } /** * Configure and start a tween. * @param {Object=} opt_config See Tweenable.prototype.setConfig() * @return {Tweenable} */ Tweenable.prototype.tween = function (opt_config) { if (this._isTweening) { return this; } // Only set default config if no configuration has been set previously and none is provided now. if (opt_config !== undefined || !this._configured) { this.setConfig(opt_config); } this._start(this.get()); return this.resume(); }; /** * Sets the tween configuration. `config` may have the following options: * * - __from__ (_Object=_): Starting position. If omitted, the current state is used. * - __to__ (_Object=_): Ending position. * - __duration__ (_number=_): How many milliseconds to animate for. * - __start__ (_Function(Object)=_): Function to execute when the tween begins. Receives the state of the tween as the only parameter. * - __step__ (_Function(Object)=_): Function to execute on every tick. Receives the state of the tween as the only parameter. This function is not called on the final step of the animation, but `finish` is. * - __finish__ (_Function(Object)=_): Function to execute upon tween completion. Receives the state of the tween as the only parameter. * - __easing__ (_Object|string=_): Easing curve name(s) to use for the tween. * @param {Object} config * @return {Tweenable} */ Tweenable.prototype.setConfig = function (config) { config = config || {}; this._configured = true; // Init the internal state this._pausedAtTime = null; this._start = config.start || noop; this._step = config.step || noop; this._finish = config.finish || noop; this._duration = config.duration || DEFAULT_DURATION; this._currentState = config.from || this.get(); this._originalState = this.get(); this._targetState = config.to || this.get(); this._timestamp = now(); // Aliases used below var currentState = this._currentState; var targetState = this._targetState; // Ensure that there is always something to tween to. defaults(targetState, currentState); this._easing = composeEasingObject( currentState, config.easing || DEFAULT_EASING); this._filterArgs = [currentState, this._originalState, targetState, this._easing]; applyFilter(this, 'tweenCreated'); return this; }; /** * Gets the current state. * @return {Object} */ Tweenable.prototype.get = function () { return shallowCopy({}, this._currentState); }; /** * Sets the current state. * @param {Object} state */ Tweenable.prototype.set = function (state) { this._currentState = state; }; /** * Pauses a tween. Paused tweens can be resumed from the point at which they were paused. This is different than [`stop()`](#stop), as that method causes a tween to start over when it is resumed. * @return {Tweenable} */ Tweenable.prototype.pause = function () { this._pausedAtTime = now(); this._isPaused = true; return this; }; /** * Resumes a paused tween. * @return {Tweenable} */ Tweenable.prototype.resume = function () { if (this._isPaused) { this._timestamp += now() - this._pausedAtTime; } this._isPaused = false; this._isTweening = true; var self = this; this._timeoutHandler = function () { timeoutHandler(self, self._timestamp, self._duration, self._currentState, self._originalState, self._targetState, self._easing, self._step, self._scheduleFunction); }; this._timeoutHandler(); return this; }; /** * Stops and cancels a tween. * @param {boolean=} gotoEnd If false or omitted, the tween just stops at its current state, and the "finish" handler is not invoked. If true, the tweened object's values are instantly set to the target values, and "finish" is invoked. * @return {Tweenable} */ Tweenable.prototype.stop = function (gotoEnd) { this._isTweening = false; this._isPaused = false; this._timeoutHandler = noop; if (gotoEnd) { shallowCopy(this._currentState, this._targetState); applyFilter(this, 'afterTweenEnd'); this._finish.call(this, this._currentState); } return this; }; /** * Returns whether or not a tween is running. * @return {boolean} */ Tweenable.prototype.isPlaying = function () { return this._isTweening && !this._isPaused; }; /** * Sets a custom schedule function. * * If a custom function is not set the default one is used [`requestAnimationFrame`](https://developer.mozilla.org/en-US/docs/Web/API/window.requestAnimationFrame) if available, otherwise [`setTimeout`](https://developer.mozilla.org/en-US/docs/Web/API/Window.setTimeout)). * * @param {Function(Function,number)} scheduleFunction The function to be called to schedule the next frame to be rendered */ Tweenable.prototype.setScheduleFunction = function (scheduleFunction) { this._scheduleFunction = scheduleFunction; }; /** * `delete`s all "own" properties. Call this when the `Tweenable` instance is no longer needed to free memory. */ Tweenable.prototype.dispose = function () { var prop; for (prop in this) { if (this.hasOwnProperty(prop)) { delete this[prop]; } } }; /*! * Filters are used for transforming the properties of a tween at various * points in a Tweenable's life cycle. See the README for more info on this. */ Tweenable.prototype.filter = {}; /*! * This object contains all of the tweens available to Shifty. It is extendible - simply attach properties to the Tweenable.prototype.formula Object following the same format at linear. * * `pos` should be a normalized `number` (between 0 and 1). */ Tweenable.prototype.formula = { linear: function (pos) { return pos; } }; formula = Tweenable.prototype.formula; shallowCopy(Tweenable, { 'now': now ,'each': each ,'tweenProps': tweenProps ,'tweenProp': tweenProp ,'applyFilter': applyFilter ,'shallowCopy': shallowCopy ,'defaults': defaults ,'composeEasingObject': composeEasingObject }); // `root` is provided in the intro/outro files. // A hook used for unit testing. if (typeof SHIFTY_DEBUG_NOW === 'function') { root.timeoutHandler = timeoutHandler; } // Bootstrap Tweenable appropriately for the environment. if (typeof exports === 'object') { // CommonJS module.exports = Tweenable; } else if (typeof define === 'function' && define.amd) { // AMD define(function () {return Tweenable;}); } else if (typeof root.Tweenable === 'undefined') { // Browser: Make `Tweenable` globally accessible. root.Tweenable = Tweenable; } return Tweenable; } ()); /*! * All equations are adapted from Thomas Fuchs' [Scripty2](https://github.com/madrobby/scripty2/blob/master/src/effects/transitions/penner.js). * * Based on Easing Equations (c) 2003 [Robert Penner](http://www.robertpenner.com/), all rights reserved. This work is [subject to terms](http://www.robertpenner.com/easing_terms_of_use.html). */ /*! * TERMS OF USE - EASING EQUATIONS * Open source under the BSD License. * Easing Equations (c) 2003 Robert Penner, all rights reserved. */ ;(function () { Tweenable.shallowCopy(Tweenable.prototype.formula, { easeInQuad: function (pos) { return Math.pow(pos, 2); }, easeOutQuad: function (pos) { return -(Math.pow((pos - 1), 2) - 1); }, easeInOutQuad: function (pos) { if ((pos /= 0.5) < 1) {return 0.5 * Math.pow(pos,2);} return -0.5 * ((pos -= 2) * pos - 2); }, easeInCubic: function (pos) { return Math.pow(pos, 3); }, easeOutCubic: function (pos) { return (Math.pow((pos - 1), 3) + 1); }, easeInOutCubic: function (pos) { if ((pos /= 0.5) < 1) {return 0.5 * Math.pow(pos,3);} return 0.5 * (Math.pow((pos - 2),3) + 2); }, easeInQuart: function (pos) { return Math.pow(pos, 4); }, easeOutQuart: function (pos) { return -(Math.pow((pos - 1), 4) - 1); }, easeInOutQuart: function (pos) { if ((pos /= 0.5) < 1) {return 0.5 * Math.pow(pos,4);} return -0.5 * ((pos -= 2) * Math.pow(pos,3) - 2); }, easeInQuint: function (pos) { return Math.pow(pos, 5); }, easeOutQuint: function (pos) { return (Math.pow((pos - 1), 5) + 1); }, easeInOutQuint: function (pos) { if ((pos /= 0.5) < 1) {return 0.5 * Math.pow(pos,5);} return 0.5 * (Math.pow((pos - 2),5) + 2); }, easeInSine: function (pos) { return -Math.cos(pos * (Math.PI / 2)) + 1; }, easeOutSine: function (pos) { return Math.sin(pos * (Math.PI / 2)); }, easeInOutSine: function (pos) { return (-0.5 * (Math.cos(Math.PI * pos) - 1)); }, easeInExpo: function (pos) { return (pos === 0) ? 0 : Math.pow(2, 10 * (pos - 1)); }, easeOutExpo: function (pos) { return (pos === 1) ? 1 : -Math.pow(2, -10 * pos) + 1; }, easeInOutExpo: function (pos) { if (pos === 0) {return 0;} if (pos === 1) {return 1;} if ((pos /= 0.5) < 1) {return 0.5 * Math.pow(2,10 * (pos - 1));} return 0.5 * (-Math.pow(2, -10 * --pos) + 2); }, easeInCirc: function (pos) { return -(Math.sqrt(1 - (pos * pos)) - 1); }, easeOutCirc: function (pos) { return Math.sqrt(1 - Math.pow((pos - 1), 2)); }, easeInOutCirc: function (pos) { if ((pos /= 0.5) < 1) {return -0.5 * (Math.sqrt(1 - pos * pos) - 1);} return 0.5 * (Math.sqrt(1 - (pos -= 2) * pos) + 1); }, easeOutBounce: function (pos) { if ((pos) < (1 / 2.75)) { return (7.5625 * pos * pos); } else if (pos < (2 / 2.75)) { return (7.5625 * (pos -= (1.5 / 2.75)) * pos + 0.75); } else if (pos < (2.5 / 2.75)) { return (7.5625 * (pos -= (2.25 / 2.75)) * pos + 0.9375); } else { return (7.5625 * (pos -= (2.625 / 2.75)) * pos + 0.984375); } }, easeInBack: function (pos) { var s = 1.70158; return (pos) * pos * ((s + 1) * pos - s); }, easeOutBack: function (pos) { var s = 1.70158; return (pos = pos - 1) * pos * ((s + 1) * pos + s) + 1; }, easeInOutBack: function (pos) { var s = 1.70158; if ((pos /= 0.5) < 1) {return 0.5 * (pos * pos * (((s *= (1.525)) + 1) * pos - s));} return 0.5 * ((pos -= 2) * pos * (((s *= (1.525)) + 1) * pos + s) + 2); }, elastic: function (pos) { return -1 * Math.pow(4,-8 * pos) * Math.sin((pos * 6 - 1) * (2 * Math.PI) / 2) + 1; }, swingFromTo: function (pos) { var s = 1.70158; return ((pos /= 0.5) < 1) ? 0.5 * (pos * pos * (((s *= (1.525)) + 1) * pos - s)) : 0.5 * ((pos -= 2) * pos * (((s *= (1.525)) + 1) * pos + s) + 2); }, swingFrom: function (pos) { var s = 1.70158; return pos * pos * ((s + 1) * pos - s); }, swingTo: function (pos) { var s = 1.70158; return (pos -= 1) * pos * ((s + 1) * pos + s) + 1; }, bounce: function (pos) { if (pos < (1 / 2.75)) { return (7.5625 * pos * pos); } else if (pos < (2 / 2.75)) { return (7.5625 * (pos -= (1.5 / 2.75)) * pos + 0.75); } else if (pos < (2.5 / 2.75)) { return (7.5625 * (pos -= (2.25 / 2.75)) * pos + 0.9375); } else { return (7.5625 * (pos -= (2.625 / 2.75)) * pos + 0.984375); } }, bouncePast: function (pos) { if (pos < (1 / 2.75)) { return (7.5625 * pos * pos); } else if (pos < (2 / 2.75)) { return 2 - (7.5625 * (pos -= (1.5 / 2.75)) * pos + 0.75); } else if (pos < (2.5 / 2.75)) { return 2 - (7.5625 * (pos -= (2.25 / 2.75)) * pos + 0.9375); } else { return 2 - (7.5625 * (pos -= (2.625 / 2.75)) * pos + 0.984375); } }, easeFromTo: function (pos) { if ((pos /= 0.5) < 1) {return 0.5 * Math.pow(pos,4);} return -0.5 * ((pos -= 2) * Math.pow(pos,3) - 2); }, easeFrom: function (pos) { return Math.pow(pos,4); }, easeTo: function (pos) { return Math.pow(pos,0.25); } }); }()); /*! * The Bezier magic in this file is adapted/copied almost wholesale from * [Scripty2](https://github.com/madrobby/scripty2/blob/master/src/effects/transitions/cubic-bezier.js), * which was adapted from Apple code (which probably came from * [here](http://opensource.apple.com/source/WebCore/WebCore-955.66/platform/graphics/UnitBezier.h)). * Special thanks to Apple and Thomas Fuchs for much of this code. */ /*! * Copyright (c) 2006 Apple Computer, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder(s) nor the names of any * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ ;(function () { // port of webkit cubic bezier handling by http://www.netzgesta.de/dev/ function cubicBezierAtTime(t,p1x,p1y,p2x,p2y,duration) { var ax = 0,bx = 0,cx = 0,ay = 0,by = 0,cy = 0; function sampleCurveX(t) {return ((ax * t + bx) * t + cx) * t;} function sampleCurveY(t) {return ((ay * t + by) * t + cy) * t;} function sampleCurveDerivativeX(t) {return (3.0 * ax * t + 2.0 * bx) * t + cx;} function solveEpsilon(duration) {return 1.0 / (200.0 * duration);} function solve(x,epsilon) {return sampleCurveY(solveCurveX(x,epsilon));} function fabs(n) {if (n >= 0) {return n;}else {return 0 - n;}} function solveCurveX(x,epsilon) { var t0,t1,t2,x2,d2,i; for (t2 = x, i = 0; i < 8; i++) {x2 = sampleCurveX(t2) - x; if (fabs(x2) < epsilon) {return t2;} d2 = sampleCurveDerivativeX(t2); if (fabs(d2) < 1e-6) {break;} t2 = t2 - x2 / d2;} t0 = 0.0; t1 = 1.0; t2 = x; if (t2 < t0) {return t0;} if (t2 > t1) {return t1;} while (t0 < t1) {x2 = sampleCurveX(t2); if (fabs(x2 - x) < epsilon) {return t2;} if (x > x2) {t0 = t2;}else {t1 = t2;} t2 = (t1 - t0) * 0.5 + t0;} return t2; // Failure. } cx = 3.0 * p1x; bx = 3.0 * (p2x - p1x) - cx; ax = 1.0 - cx - bx; cy = 3.0 * p1y; by = 3.0 * (p2y - p1y) - cy; ay = 1.0 - cy - by; return solve(t, solveEpsilon(duration)); } /*! * getCubicBezierTransition(x1, y1, x2, y2) -> Function * * Generates a transition easing function that is compatible * with WebKit's CSS transitions `-webkit-transition-timing-function` * CSS property. * * The W3C has more information about * <a href="http://www.w3.org/TR/css3-transitions/#transition-timing-function_tag"> * CSS3 transition timing functions</a>. * * @param {number} x1 * @param {number} y1 * @param {number} x2 * @param {number} y2 * @return {function} */ function getCubicBezierTransition (x1, y1, x2, y2) { return function (pos) { return cubicBezierAtTime(pos,x1,y1,x2,y2,1); }; } // End ported code /** * Creates a Bezier easing function and attaches it to `Tweenable.prototype.formula`. This function gives you total control over the easing curve. Matthew Lein's [Ceaser](http://matthewlein.com/ceaser/) is a useful tool for visualizing the curves you can make with this function. * * @param {string} name The name of the easing curve. Overwrites the old easing function on Tweenable.prototype.formula if it exists. * @param {number} x1 * @param {number} y1 * @param {number} x2 * @param {number} y2 * @return {function} The easing function that was attached to Tweenable.prototype.formula. */ Tweenable.setBezierFunction = function (name, x1, y1, x2, y2) { var cubicBezierTransition = getCubicBezierTransition(x1, y1, x2, y2); cubicBezierTransition.x1 = x1; cubicBezierTransition.y1 = y1; cubicBezierTransition.x2 = x2; cubicBezierTransition.y2 = y2; return Tweenable.prototype.formula[name] = cubicBezierTransition; }; /** * `delete`s an easing function from `Tweenable.prototype.formula`. Be careful with this method, as it `delete`s whatever easing formula matches `name` (which means you can delete default Shifty easing functions). * * @param {string} name The name of the easing function to delete. * @return {function} */ Tweenable.unsetBezierFunction = function (name) { delete Tweenable.prototype.formula[name]; }; })(); ;(function () { function getInterpolatedValues ( from, current, targetState, position, easing) { return Tweenable.tweenProps( position, current, from, targetState, 1, 0, easing); } // Fake a Tweenable and patch some internals. This approach allows us to // skip uneccessary processing and object recreation, cutting down on garbage // collection pauses. var mockTweenable = new Tweenable(); mockTweenable._filterArgs = []; /** * Compute the midpoint of two Objects. This method effectively calculates a specific frame of animation that [Tweenable#tween](shifty.core.js.html#tween) does many times over the course of a tween. * * Example: * * ``` * var interpolatedValues = Tweenable.interpolate({ * width: '100px', * opacity: 0, * color: '#fff' * }, { * width: '200px', * opacity: 1, * color: '#000' * }, 0.5); * * console.log(interpolatedValues); * // {opacity: 0.5, width: "150px", color: "rgb(127,127,127)"} * ``` * * @param {Object} from The starting values to tween from. * @param {Object} targetState The ending values to tween to. * @param {number} position The normalized position value (between 0.0 and 1.0) to interpolate the values between `from` and `to` for. `from` represents 0 and `to` represents `1`. * @param {string|Object} easing The easing curve(s) to calculate the midpoint against. You can reference any easing function attached to `Tweenable.prototype.formula`. If omitted, this defaults to "linear". * @return {Object} */ Tweenable.interpolate = function (from, targetState, position, easing) { var current = Tweenable.shallowCopy({}, from); var easingObject = Tweenable.composeEasingObject( from, easing || 'linear'); mockTweenable.set({}); // Alias and reuse the _filterArgs array instead of recreating it. var filterArgs = mockTweenable._filterArgs; filterArgs.length = 0; filterArgs[0] = current; filterArgs[1] = from; filterArgs[2] = targetState; filterArgs[3] = easingObject; // Any defined value transformation must be applied Tweenable.applyFilter(mockTweenable, 'tweenCreated'); Tweenable.applyFilter(mockTweenable, 'beforeTween'); var interpolatedValues = getInterpolatedValues( from, current, targetState, position, easingObject); // Transform values back into their original format Tweenable.applyFilter(mockTweenable, 'afterTween'); return interpolatedValues; }; }()); /** * Adds string interpolation support to Shifty. * * The Token extension allows Shifty to tween numbers inside of strings. Among other things, this allows you to animate CSS properties. For example, you can do this: * * ``` * var tweenable = new Tweenable(); * tweenable.tween({ * from: { transform: 'translateX(45px)'}, * to: { transform: 'translateX(90xp)'} * }); * ``` * * `translateX(45)` will be tweened to `translateX(90)`. To demonstrate: * * ``` * var tweenable = new Tweenable(); * tweenable.tween({ * from: { transform: 'translateX(45px)'}, * to: { transform: 'translateX(90px)'}, * step: function (state) { * console.log(state.transform); * } * }); * ``` * * The above snippet will log something like this in the console: * * ``` * translateX(60.3px) * ... * translateX(76.05px) * ... * translateX(90px) * ``` * * Another use for this is animating colors: * * ``` * var tweenable = new Tweenable(); * tweenable.tween({ * from: { color: 'rgb(0,255,0)'}, * to: { color: 'rgb(255,0,255)'}, * step: function (state) { * console.log(state.color); * } * }); * ``` * * The above snippet will log something like this: * * ``` * rgb(84,170,84) * ... * rgb(170,84,170) * ... * rgb(255,0,255) * ``` * * This extension also supports hexadecimal colors, in both long (`#ff00ff`) and short (`#f0f`) forms. Be aware that hexadecimal input values will be converted into the equivalent RGB output values. This is done to optimize for performance. * * ``` * var tweenable = new Tweenable(); * tweenable.tween({ * from: { color: '#0f0'}, * to: { color: '#f0f'}, * step: function (state) { * console.log(state.color); * } * }); * ``` * * This snippet will generate the same output as the one before it because equivalent values were supplied (just in hexadecimal form rather than RGB): * * ``` * rgb(84,170,84) * ... * rgb(170,84,170) * ... * rgb(255,0,255) * ``` * * ## Easing support * * Easing works somewhat differently in the Token extension. This is because some CSS properties have multiple values in them, and you might need to tween each value along its own easing curve. A basic example: * * ``` * var tweenable = new Tweenable(); * tweenable.tween({ * from: { transform: 'translateX(0px) translateY(0px)'}, * to: { transform: 'translateX(100px) translateY(100px)'}, * easing: { transform: 'easeInQuad' }, * step: function (state) { * console.log(state.transform); * } * }); * ``` * * The above snippet create values like this: * * ``` * translateX(11.560000000000002px) translateY(11.560000000000002px) * ... * translateX(46.24000000000001px) translateY(46.24000000000001px) * ... * translateX(100px) translateY(100px) * ``` * * In this case, the values for `translateX` and `translateY` are always the same for each step of the tween, because they have the same start and end points and both use the same easing curve. We can also tween `translateX` and `translateY` along independent curves: * * ``` * var tweenable = new Tweenable(); * tweenable.tween({ * from: { transform: 'translateX(0px) translateY(0px)'}, * to: { transform: 'translateX(100px) translateY(100px)'}, * easing: { transform: 'easeInQuad bounce' }, * step: function (state) { * console.log(state.transform); * } * }); * ``` * * The above snippet create values like this: * * ``` * translateX(10.89px) translateY(82.355625px) * ... * translateX(44.89000000000001px) translateY(86.73062500000002px) * ... * translateX(100px) translateY(100px) * ``` * * `translateX` and `translateY` are not in sync anymore, because `easeInQuad` was specified for `translateX` and `bounce` for `translateY`. Mixing and matching easing curves can make for some interesting motion in your animations. * * The order of the space-separated easing curves correspond the token values they apply to. If there are more token values than easing curves listed, the last easing curve listed is used. */ function token () { // Functionality for this extension runs implicitly if it is loaded. } /*!*/ // token function is defined above only so that dox-foundation sees it as // documentation and renders it. It is never used, and is optimized away at // build time. ;(function (Tweenable) { /*! * @typedef {{ * formatString: string * chunkNames: Array.<string> * }} */ var formatManifest; // CONSTANTS var R_NUMBER_COMPONENT = /(\d|\-|\.)/; var R_FORMAT_CHUNKS = /([^\-0-9\.]+)/g; var R_UNFORMATTED_VALUES = /[0-9.\-]+/g; var R_RGB = new RegExp( 'rgb\\(' + R_UNFORMATTED_VALUES.source + (/,\s*/.source) + R_UNFORMATTED_VALUES.source + (/,\s*/.source) + R_UNFORMATTED_VALUES.source + '\\)', 'g'); var R_RGB_PREFIX = /^.*\(/; var R_HEX = /#([0-9]|[a-f]){3,6}/gi; var VALUE_PLACEHOLDER = 'VAL'; // HELPERS var getFormatChunksFrom_accumulator = []; /*! * @param {Array.number} rawValues * @param {string} prefix * * @return {Array.<string>} */ function getFormatChunksFrom (rawValues, prefix) { getFormatChunksFrom_accumulator.length = 0; var rawValuesLength = rawValues.length; var i; for (i = 0; i < rawValuesLength; i++) { getFormatChunksFrom_accumulator.push('_' + prefix + '_' + i); } return getFormatChunksFrom_accumulator; } /*! * @param {string} formattedString * * @return {string} */ function getFormatStringFrom (formattedString) { var chunks = formattedString.match(R_FORMAT_CHUNKS); if (!chunks) { // chunks will be null if there were no tokens to parse in // formattedString (for example, if formattedString is '2'). Coerce // chunks to be useful here. chunks = ['', '']; // If there is only one chunk, assume that the string is a number // followed by a token... // NOTE: This may be an unwise assumption. } else if (chunks.length === 1 || // ...or if the string starts with a number component (".", "-", or a // digit)... formattedString[0].match(R_NUMBER_COMPONENT)) { // ...prepend an empty string here to make sure that the formatted number // is properly replaced by VALUE_PLACEHOLDER chunks.unshift(''); } return chunks.join(VALUE_PLACEHOLDER); } /*! * Convert all hex color values within a string to an rgb string. * * @param {Object} stateObject * * @return {Object} The modified obj */ function sanitizeObjectForHexProps (stateObject) { Tweenable.each(stateObject, function (prop) { var currentProp = stateObject[prop]; if (typeof currentProp === 'string' && currentProp.match(R_HEX)) { stateObject[prop] = sanitizeHexChunksToRGB(currentProp); } }); } /*! * @param {string} str * * @return {string} */ function sanitizeHexChunksToRGB (str) { return filterStringChunks(R_HEX, str, convertHexToRGB); } /*! * @param {string} hexString * * @return {string} */ function convertHexToRGB (hexString) { var rgbArr = hexToRGBArray(hexString); return 'rgb(' + rgbArr[0] + ',' + rgbArr[1] + ',' + rgbArr[2] + ')'; } var hexToRGBArray_returnArray = []; /*! * Convert a hexadecimal string to an array with three items, one each for * the red, blue, and green decimal values. * * @param {string} hex A hexadecimal string. * * @returns {Array.<number>} The converted Array of RGB values if `hex` is a * valid string, or an Array of three 0's. */ function hexToRGBArray (hex) { hex = hex.replace(/#/, ''); // If the string is a shorthand three digit hex notation, normalize it to // the standard six digit notation if (hex.length === 3) { hex = hex.split(''); hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]; } hexToRGBArray_returnArray[0] = hexToDec(hex.substr(0, 2)); hexToRGBArray_returnArray[1] = hexToDec(hex.substr(2, 2)); hexToRGBArray_returnArray[2] = hexToDec(hex.substr(4, 2)); return hexToRGBArray_returnArray; } /*! * Convert a base-16 number to base-10. * * @param {Number|String} hex The value to convert * * @returns {Number} The base-10 equivalent of `hex`. */ function hexToDec (hex) { return parseInt(hex, 16); } /*! * Runs a filter operation on all chunks of a string that match a RegExp * * @param {RegExp} pattern * @param {string} unfilteredString * @param {function(string)} filter * * @return {string} */ function filterStringChunks (pattern, unfilteredString, filter) { var pattenMatches = unfilteredString.match(pattern); var filteredString = unfilteredString.replace(pattern, VALUE_PLACEHOLDER); if (pattenMatches) { var pattenMatchesLength = pattenMatches.length; var currentChunk; for (var i = 0; i < pattenMatchesLength; i++) { currentChunk = pattenMatches.shift(); filteredString = filteredString.replace( VALUE_PLACEHOLDER, filter(currentChunk)); } } return filteredString; } /*! * Check for floating point values within rgb strings and rounds them. * * @param {string} formattedString * * @return {string} */ function sanitizeRGBChunks (formattedString) { return filterStringChunks(R_RGB, formattedString, sanitizeRGBChunk); } /*! * @param {string} rgbChunk * * @return {string} */ function sanitizeRGBChunk (rgbChunk) { var numbers = rgbChunk.match(R_UNFORMATTED_VALUES); var numbersLength = numbers.length; var sanitizedString = rgbChunk.match(R_RGB_PREFIX)[0]; for (var i = 0; i < numbersLength; i++) { sanitizedString += parseInt(numbers[i], 10) + ','; } sanitizedString = sanitizedString.slice(0, -1) + ')'; return sanitizedString; } /*! * @param {Object} stateObject * * @return {Object} An Object of formatManifests that correspond to * the string properties of stateObject */ function getFormatManifests (stateObject) { var manifestAccumulator = {}; Tweenable.each(stateObject, function (prop) { var currentProp = stateObject[prop]; if (typeof currentProp === 'string') { var rawValues = getValuesFrom(currentProp); manifestAccumulator[prop] = { 'formatString': getFormatStringFrom(currentProp) ,'chunkNames': getFormatChunksFrom(rawValues, prop) }; } }); return manifestAccumulator; } /*! * @param {Object} stateObject * @param {Object} formatManifests */ function expandFormattedProperties (stateObject, formatManifests) { Tweenable.each(formatManifests, function (prop) { var currentProp = stateObject[prop]; var rawValues = getValuesFrom(currentProp); var rawValuesLength = rawValues.length; for (var i = 0; i < rawValuesLength; i++) { stateObject[formatManifests[prop].chunkNames[i]] = +rawValues[i]; } delete stateObject[prop]; }); } /*! * @param {Object} stateObject * @param {Object} formatManifests */ function collapseFormattedProperties (stateObject, formatManifests) { Tweenable.each(formatManifests, function (prop) { var currentProp = stateObject[prop]; var formatChunks = extractPropertyChunks( stateObject, formatManifests[prop].chunkNames); var valuesList = getValuesList( formatChunks, formatManifests[prop].chunkNames); currentProp = getFormattedValues( formatManifests[prop].formatString, valuesList); stateObject[prop] = sanitizeRGBChunks(currentProp); }); } /*! * @param {Object} stateObject * @param {Array.<string>} chunkNames * * @return {Object} The extracted value chunks. */ function extractPropertyChunks (stateObject, chunkNames) { var extractedValues = {}; var currentChunkName, chunkNamesLength = chunkNames.length; for (var i = 0; i < chunkNamesLength; i++) { currentChunkName = chunkNames[i]; extractedValues[currentChunkName] = stateObject[currentChunkName]; delete stateObject[currentChunkName]; } return extractedValues; } var getValuesList_accumulator = []; /*! * @param {Object} stateObject * @param {Array.<string>} chunkNames * * @return {Array.<number>} */ function getValuesList (stateObject, chunkNames) { getValuesList_accumulator.length = 0; var chunkNamesLength = chunkNames.length; for (var i = 0; i < chunkNamesLength; i++) { getValuesList_accumulator.push(stateObject[chunkNames[i]]); } return getValuesList_accumulator; } /*! * @param {string} formatString * @param {Array.<number>} rawValues * * @return {string} */ function getFormattedValues (formatString, rawValues) { var formattedValueString = formatString; var rawValuesLength = rawValues.length; for (var i = 0; i < rawValuesLength; i++) { formattedValueString = formattedValueString.replace( VALUE_PLACEHOLDER, +rawValues[i].toFixed(4)); } return formattedValueString; } /*! * Note: It's the duty of the caller to convert the Array elements of the * return value into numbers. This is a performance optimization. * * @param {string} formattedString * * @return {Array.<string>|null} */ function getValuesFrom (formattedString) { return formattedString.match(R_UNFORMATTED_VALUES); } /*! * @param {Object} easingObject * @param {Object} tokenData */ function expandEasingObject (easingObject, tokenData) { Tweenable.each(tokenData, function (prop) { var currentProp = tokenData[prop]; var chunkNames = currentProp.chunkNames; var chunkLength = chunkNames.length; var easingChunks = easingObject[prop].split(' '); var lastEasingChunk = easingChunks[easingChunks.length - 1]; for (var i = 0; i < chunkLength; i++) { easingObject[chunkNames[i]] = easingChunks[i] || lastEasingChunk; } delete easingObject[prop]; }); } /*! * @param {Object} easingObject * @param {Object} tokenData */ function collapseEasingObject (easingObject, tokenData) { Tweenable.each(tokenData, function (prop) { var currentProp = tokenData[prop]; var chunkNames = currentProp.chunkNames; var chunkLength = chunkNames.length; var composedEasingString = ''; for (var i = 0; i < chunkLength; i++) { composedEasingString += ' ' + easingObject[chunkNames[i]]; delete easingObject[chunkNames[i]]; } easingObject[prop] = composedEasingString.substr(1); }); } Tweenable.prototype.filter.token = { 'tweenCreated': function (currentState, fromState, toState, easingObject) { sanitizeObjectForHexProps(currentState); sanitizeObjectForHexProps(fromState); sanitizeObjectForHexProps(toState); this._tokenData = getFormatManifests(currentState); }, 'beforeTween': function (currentState, fromState, toState, easingObject) { expandEasingObject(easingObject, this._tokenData); expandFormattedProperties(currentState, this._tokenData); expandFormattedProperties(fromState, this._tokenData); expandFormattedProperties(toState, this._tokenData); }, 'afterTween': function (currentState, fromState, toState, easingObject) { collapseFormattedProperties(currentState, this._tokenData); collapseFormattedProperties(fromState, this._tokenData); collapseFormattedProperties(toState, this._tokenData); collapseEasingObject(easingObject, this._tokenData); } }; } (Tweenable)); }(this)); },{}],2:[function(require,module,exports){ // Browserify will transform the module compatible for browser var Tweenable = require('shifty'); var EASING_ALIASES = { easeIn: 'easeInCubic', easeOut: 'easeOutCubic', easeInOut: 'easeInOutCubic' }; // Base object for different progress bar shapes var Progress = function(container, opts) { // Prevent calling constructor without parameters so inheritance // works correctly if (arguments.length === 0) return; var svgView = this._createSvgView(opts); var element; if (isString(container)) { element = document.querySelector(container); } else { element = container; } element.appendChild(svgView.svg); var newOpts = extend({ attachment: this }, opts); this._path = new Path(svgView.path, newOpts); // Expose public attributes this.path = svgView.path; this.trail = svgView.trail; }; Progress.prototype.animate = function animate(progress, opts, cb) { this._path.animate(progress, opts, cb); }; Progress.prototype.stop = function stop() { this._path.stop(); }; Progress.prototype.set = function set(progress) { this._path.set(progress); }; Progress.prototype._createSvgView = function _createSvgView(opts) { opts = extend({ color: "#555", strokeWidth: 1.0, trailColor: null, fill: null }, opts); var svg = document.createElementNS("http://www.w3.org/2000/svg", "svg"); this._initializeSvg(svg, opts); var trailPath = null; if (opts.trailColor) { var trailOpts = extend({}, opts); trailOpts.color = opts.trailColor; // When trail path is set, fill must be set for it instead of the // actual path to prevent trail stroke from clipping opts.fill = null; trailPath = this._createPath(trailOpts); svg.appendChild(trailPath); } var path = this._createPath(opts); svg.appendChild(path); return { svg: svg, path: path, trail: trailPath }; }; Progress.prototype._initializeSvg = function _initializeSvg(svg, opts) { svg.setAttribute("viewBox", "0 0 100 100"); }; Progress.prototype._createPath = function _createPath(opts) { var path = document.createElementNS("http://www.w3.org/2000/svg", "path"); path.setAttribute("d", this._pathString(opts)); path.setAttribute("stroke", opts.color); path.setAttribute("stroke-width", opts.strokeWidth); if (opts.fill) { path.setAttribute("fill", opts.fill); } else { path.setAttribute("fill-opacity", "0"); } return path; }; Progress.prototype._pathString = function _pathString(opts) { throw new Error("Override this function for each progress bar"); }; // Progress bar shapes var Line = function(container, options) { Progress.apply(this, arguments); }; Line.prototype = new Progress(); Line.prototype.constructor = Line; Line.prototype._initializeSvg = function _initializeSvg(svg, opts) { svg.setAttribute("viewBox", "0 0 100 " + opts.strokeWidth); svg.setAttribute("preserveAspectRatio", "none"); }; Line.prototype._pathString = function _pathString(opts) { var pathString = "M 0,{c} L 100,{c}"; var center = opts.strokeWidth / 2; pathString = pathString.replace(/\{c\}/g, center); return pathString; }; var Circle = function(container, options) { Progress.apply(this, arguments); }; Circle.prototype = new Progress(); Circle.prototype.constructor = Circle; Circle.prototype._pathString = function _pathString(opts) { // Use two arcs to form a circle // See this answer http://stackoverflow.com/a/10477334/1446092 var pathString = "M 50,50 m 0,-{r} a {r},{r} 0 1 1 0,{r*2} a {r},{r} 0 1 1 0,-{r*2}"; var r = 50 - opts.strokeWidth / 2; pathString = pathString.replace(/\{r\}/g, r); pathString = pathString.replace(/\{r\*2\}/g, r * 2); return pathString; }; var Square = function(container, options) { Progress.apply(this, arguments); }; Square.prototype = new Progress(); Square.prototype.constructor = Square; Square.prototype._pathString = function _pathString(opts) { var pathString = "M 0,{s/2} L {w},{s/2} L {w},{w} L {s/2},{w} L {s/2},{s}"; var w = 100 - opts.strokeWidth / 2; pathString = pathString.replace(/\{w\}/g, w); pathString = pathString.replace(/\{s\}/g, opts.strokeWidth); pathString = pathString.replace(/\{s\/2\}/g, opts.strokeWidth / 2); return pathString; }; // Lower level API to animate any kind of svg path var Path = function(path, opts) { opts = extend({ duration: 800, easing: "linear", from: {}, to: {}, step: noop }, opts); this._path = path; this._opts = opts; this._tweenable = null; // Set up the starting positions var length = this._path.getTotalLength(); this._path.style.strokeDasharray = length + ' ' + length; this._path.style.strokeDashoffset = length; }; Path.prototype.set = function set(progress) { this.stop(); var length = this._path.getTotalLength(); this._path.style.strokeDashoffset = length - progress * length; }; Path.prototype.stop = function stop() { this._stopTween(); var computedStyle = window.getComputedStyle(this._path, null); var offset = computedStyle.getPropertyValue('stroke-dashoffset'); this._path.style.strokeDashoffset = offset; }; // Method introduced here: // http://jakearchibald.com/2013/animated-line-drawing-svg/ Path.prototype.animate = function animate(progress, opts, cb) { if (isFunction(opts)) { cb = opts; opts = {}; } // Copy default opts to new object so defaults are not modified var defaultOpts = extend({}, this._opts); opts = extend(defaultOpts, opts); this.stop(); // Trigger a layout so styles are calculated & the browser // picks up the starting position before animating this._path.getBoundingClientRect(); var computedStyle = window.getComputedStyle(this._path, null); var offset = computedStyle.getPropertyValue('stroke-dashoffset'); // Remove 'px' suffix offset = parseFloat(offset, 10); var length = this._path.getTotalLength(); var newOffset = length - progress * length; var self = this; this._tweenable = new Tweenable(); this._tweenable.tween({ from: extend({ offset: offset }, opts.from), to: extend({ offset: newOffset }, opts.to), duration: opts.duration, easing: this._easing(opts.easing), step: function(state) { self._path.style.strokeDashoffset = state.offset; opts.step(state, opts.attachment); }, finish: function(state) { // step function is not called on the last step of animation self._path.style.strokeDashoffset = state.offset; opts.step(state, opts.attachment); if (isFunction(cb)) { cb(); } } }); }; Path.prototype._stopTween = function _stopTween() { if (this._tweenable !== null) { this._tweenable.stop(); this._tweenable.dispose(); this._tweenable = null; } }; Path.prototype._easing = function _easing(easing) { if (EASING_ALIASES.hasOwnProperty(easing)) { return EASING_ALIASES[easing]; } return easing; }; // Utility functions function noop() {} // Copy all attributes from source object to destination object. // destination object is mutated. function extend(destination, source) { destination = destination || {}; source = source || {}; for (var attrName in source) { if (source.hasOwnProperty(attrName)) { destination[attrName] = source[attrName]; } } return destination; } function isString(obj) { return typeof obj === 'string' || obj instanceof String; } function isFunction(obj) { return typeof obj === "function"; } module.exports = { Line: Line, Circle: Circle, Square: Square, Path: Path }; },{"shifty":1}]},{},[2])(2) });
alexmojaki/cdnjs
ajax/libs/progressbar.js/0.5.4/progressbar.js
JavaScript
mit
52,489
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.babel=e()}}(function(){var e,n,l;return function t(e,n,l){function r(u,o){if(!n[u]){if(!e[u]){var s="function"==typeof require&&require;if(!o&&s)return s(u,!0);if(a)return a(u,!0);var i=new Error("Cannot find module '"+u+"'");throw i.code="MODULE_NOT_FOUND",i}var c=n[u]={exports:{}};e[u][0].call(c.exports,function(n){var l=e[u][1][n];return r(l?l:n)},c,c.exports,t,e,n,l)}return n[u].exports}for(var a="function"==typeof require&&require,u=0;u<l.length;u++)r(l[u]);return r}({1:[function(e,n){(function(l){"use strict";var t=n.exports=e("../transformation");t.version=e("../../../package").version,t.transform=t,t.run=function(e){var n=void 0===arguments[1]?{}:arguments[1];return n.sourceMap="inline",new Function(t(e,n).code)()},t.load=function(e,n,r,a){var u=void 0===arguments[2]?{}:arguments[2],o=u;o.filename||(o.filename=e);var s=l.ActiveXObject?new l.ActiveXObject("Microsoft.XMLHTTP"):new l.XMLHttpRequest;s.open("GET",e,!0),"overrideMimeType"in s&&s.overrideMimeType("text/plain"),s.onreadystatechange=function(){if(4===s.readyState){var l=s.status;if(0!==l&&200!==l)throw new Error("Could not load "+e);var r=[s.responseText,u];a||t.run.apply(t,r),n&&n(r)}},s.send(null)};var r=function(){for(var e=[],n=["text/ecmascript-6","text/6to5","text/babel","module"],r=0,a=function(e){var n=function(){return e.apply(this,arguments)};return n.toString=function(){return e.toString()},n}(function(){var n=e[r];n instanceof Array&&(t.run.apply(t,n),r++,a())}),u=function(n,l){var r={};n.src?t.load(n.src,function(n){e[l]=n,a()},r,!0):(r.filename="embedded",e[l]=[n.innerHTML,r])},o=l.document.getElementsByTagName("script"),s=0;s<o.length;++s){var i=o[s];n.indexOf(i.type)>=0&&e.push(i)}for(s in e)u(e[s],s);a()};l.addEventListener?l.addEventListener("DOMContentLoaded",r,!1):l.attachEvent&&l.attachEvent("onload",r)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../../package":346,"../transformation":42}],2:[function(e,n){"use strict";var l=function(e){return e&&e.__esModule?e["default"]:e},t=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},r=l(e("repeating")),a=l(e("trim-right")),u=l(e("lodash/lang/isBoolean")),o=l(e("lodash/collection/includes")),s=l(e("lodash/lang/isNumber")),i=function(){function e(n,l){t(this,e),this.position=n,this._indent=l.indent.base,this.format=l,this.buf=""}return e.prototype.get=function(){return a(this.buf)},e.prototype.getIndent=function(){return this.format.compact||this.format.concise?"":r(this.format.indent.style,this._indent)},e.prototype.indentSize=function(){return this.getIndent().length},e.prototype.indent=function(){this._indent++},e.prototype.dedent=function(){this._indent--},e.prototype.semicolon=function(){this.push(";")},e.prototype.ensureSemicolon=function(){this.isLast(";")||this.semicolon()},e.prototype.rightBrace=function(){this.newline(!0),this.push("}")},e.prototype.keyword=function(e){this.push(e),this.space()},e.prototype.space=function(){this.format.compact||!this.buf||this.isLast(" ")||this.isLast("\n")||this.push(" ")},e.prototype.removeLast=function(e){this.format.compact||this.isLast(e)&&(this.buf=this.buf.substr(0,this.buf.length-1),this.position.unshift(e))},e.prototype.newline=function(e,n){if(!this.format.compact){if(this.format.concise)return void this.space();if(n||(n=!1),s(e)){if(e=Math.min(2,e),(this.endsWith("{\n")||this.endsWith(":\n"))&&e--,0>=e)return;for(;e>0;)this._newline(n),e--}else u(e)&&(n=e),this._newline(n)}},e.prototype._newline=function(e){this.endsWith("\n\n")||(e&&this.isLast("\n")&&this.removeLast("\n"),this.removeLast(" "),this._removeSpacesAfterLastNewline(),this._push("\n"))},e.prototype._removeSpacesAfterLastNewline=function(){var e=this.buf.lastIndexOf("\n");if(-1!==e){for(var n=this.buf.length-1;n>e&&" "===this.buf[n];)n--;n===e&&(this.buf=this.buf.substring(0,n+1))}},e.prototype.push=function(e,n){if(!this.format.compact&&this._indent&&!n&&"\n"!==e){var l=this.getIndent();e=e.replace(/\n/g,"\n"+l),this.isLast("\n")&&this._push(l)}this._push(e)},e.prototype._push=function(e){this.position.push(e),this.buf+=e},e.prototype.endsWith=function(e){return this.buf.slice(-e.length)===e},e.prototype.isLast=function(e){if(this.format.compact)return!1;var n=this.buf,l=n[n.length-1];return Array.isArray(e)?o(e,l):e===l},e}();n.exports=i},{"lodash/collection/includes":205,"lodash/lang/isBoolean":291,"lodash/lang/isNumber":295,repeating:329,"trim-right":345}],3:[function(e,n,l){"use strict";function t(e,n){n(e.program)}function r(e,n){n.sequence(e.body)}function a(e,n){0===e.body.length?this.push("{}"):(this.push("{"),this.newline(),n.sequence(e.body,{indent:!0}),this.removeLast("\n"),this.rightBrace())}l.File=t,l.Program=r,l.BlockStatement=a,l.__esModule=!0},{}],4:[function(e,n,l){"use strict";function t(e,n){this.push("class"),e.id&&(this.space(),n(e.id)),n(e.typeParameters),e.superClass&&(this.push(" extends "),n(e.superClass),n(e.superTypeParameters)),e["implements"]&&(this.push(" implements "),n.join(e["implements"],{separator:", "})),this.space(),n(e.body)}function r(e,n){0===e.body.length?this.push("{}"):(this.push("{"),this.newline(),this.indent(),n.sequence(e.body),this.dedent(),this.rightBrace())}function a(e,n){e["static"]&&this.push("static "),this._method(e,n)}l.ClassDeclaration=t,l.ClassBody=r,l.MethodDefinition=a,l.ClassExpression=t,l.__esModule=!0},{}],5:[function(e,n,l){"use strict";function t(e,n){this.keyword("for"),this.push("("),n(e.left),this.push(" of "),n(e.right),this.push(")")}function r(e,n){this.push(e.generator?"(":"["),n.join(e.blocks,{separator:" "}),this.space(),e.filter&&(this.keyword("if"),this.push("("),n(e.filter),this.push(")"),this.space()),n(e.body),this.push(e.generator?")":"]")}l.ComprehensionBlock=t,l.ComprehensionExpression=r,l.__esModule=!0},{}],6:[function(e,n,l){"use strict";function t(e,n){var l=/[a-z]$/.test(e.operator),t=e.argument;(y.isUpdateExpression(t)||y.isUnaryExpression(t))&&(l=!0),y.isUnaryExpression(t)&&"!"===t.operator&&(l=!1),this.push(e.operator),l&&this.push(" "),n(e.argument)}function r(e,n){e.prefix?(this.push(e.operator),n(e.argument)):(n(e.argument),this.push(e.operator))}function a(e,n){n(e.test),this.space(),this.push("?"),this.space(),n(e.consequent),this.space(),this.push(":"),this.space(),n(e.alternate)}function u(e,n){this.push("new "),n(e.callee),this.push("("),n.list(e.arguments),this.push(")")}function o(e,n){n.list(e.expressions)}function s(){this.push("this")}function i(e,n){n(e.callee),this.push("(");var l=",";e._prettyCall?(l+="\n",this.newline(),this.indent()):l+=" ",n.list(e.arguments,{separator:l}),e._prettyCall&&(this.newline(),this.dedent()),this.push(")")}function c(){this.semicolon()}function p(e,n){n(e.expression),this.semicolon()}function d(e,n){n(e.left),this.push(" "),this.push(e.operator),this.push(" "),n(e.right)}function f(e,n){var l=e.object;if(n(l),!e.computed&&y.isMemberExpression(e.property))throw new TypeError("Got a MemberExpression for MemberExpression property");var t=e.computed;y.isLiteral(e.property)&&m(e.property.value)&&(t=!0),t?(this.push("["),n(e.property),this.push("]")):(y.isLiteral(l)&&g(l.value)&&!x.test(l.value.toString())&&this.push("."),this.push("."),n(e.property))}var h=function(e){return e&&e.__esModule?e["default"]:e};l.UnaryExpression=t,l.UpdateExpression=r,l.ConditionalExpression=a,l.NewExpression=u,l.SequenceExpression=o,l.ThisExpression=s,l.CallExpression=i,l.EmptyStatement=c,l.ExpressionStatement=p,l.AssignmentExpression=d,l.MemberExpression=f;{var g=h(e("is-integer")),m=h(e("lodash/lang/isNumber")),y=h(e("../../types")),_=function(e){return function(n,l){this.push(e),(n.delegate||n.all)&&this.push("*"),n.argument&&(this.space(),l(n.argument))}};l.YieldExpression=_("yield"),l.AwaitExpression=_("await")}l.BinaryExpression=d,l.LogicalExpression=d,l.AssignmentPattern=d;var x=/e/i;l.__esModule=!0},{"../../types":122,"is-integer":189,"lodash/lang/isNumber":295}],7:[function(e,n,l){"use strict";function t(){this.push("any")}function r(e,n){n(e.elementType),this.push("["),this.push("]")}function a(){this.push("bool")}function u(e,n){e["static"]&&this.push("static "),n(e.key),n(e.typeAnnotation),this.semicolon()}function o(e,n){this.push("declare class "),this._interfaceish(e,n)}function s(e,n){this.push("declare function "),n(e.id),n(e.id.typeAnnotation.typeAnnotation),this.semicolon()}function i(e,n){this.push("declare module "),n(e.id),this.space(),n(e.body)}function c(e,n){this.push("declare var "),n(e.id),n(e.id.typeAnnotation),this.semicolon()}function p(e,n,l){n(e.typeParameters),this.push("("),n.list(e.params),e.rest&&(e.params.length&&(this.push(","),this.space()),this.push("..."),n(e.rest)),this.push(")"),"ObjectTypeProperty"===l.type||"ObjectTypeCallProperty"===l.type||"DeclareFunction"===l.type?this.push(":"):(this.space(),this.push("=>")),this.space(),n(e.returnType)}function d(e,n){n(e.name),e.optional&&this.push("?"),this.push(":"),this.space(),n(e.typeAnnotation)}function f(e,n){n(e.id),n(e.typeParameters)}function h(e,n){n(e.id),n(e.typeParameters),e["extends"].length&&(this.push(" extends "),n.join(e["extends"],{separator:", "})),this.space(),n(e.body)}function g(e,n){this.push("interface "),this._interfaceish(e,n)}function m(e,n){n.join(e.types,{separator:" & "})}function y(e,n){this.push("?"),n(e.typeAnnotation)}function _(){this.push("number")}function x(e){this._stringLiteral(e.value)}function b(){this.push("string")}function v(e,n){this.push("["),n.join(e.types,{separator:", "}),this.push("]")}function I(e,n){this.push("typeof "),n(e.argument)}function w(e,n){this.push("type "),n(e.id),n(e.typeParameters),this.space(),this.push("="),this.space(),n(e.right),this.semicolon()}function E(e,n){this.push(":"),this.space(),e.optional&&this.push("?"),n(e.typeAnnotation)}function k(e,n){this.push("<"),n.join(e.params,{separator:", "}),this.push(">")}function R(e,n){this.push("{");var l=e.properties.concat(e.callProperties,e.indexers);l.length&&(this.space(),n.list(l,{indent:!0,separator:"; "}),this.space()),this.push("}")}function S(e,n){e["static"]&&this.push("static "),n(e.value)}function C(e,n){e["static"]&&this.push("static "),this.push("["),n(e.id),this.push(":"),this.space(),n(e.key),this.push("]"),this.push(":"),this.space(),n(e.value)}function A(e,n){e["static"]&&this.push("static "),n(e.key),e.optional&&this.push("?"),O.isFunctionTypeAnnotation(e.value)||(this.push(":"),this.space()),n(e.value)}function M(e,n){n(e.qualification),this.push("."),n(e.id)}function j(e,n){n.join(e.types,{separator:" | "})}function T(e,n){this.push("("),n(e.expression),n(e.typeAnnotation),this.push(")")}function P(){this.push("void")}var L=function(e){return e&&e.__esModule?e["default"]:e};l.AnyTypeAnnotation=t,l.ArrayTypeAnnotation=r,l.BooleanTypeAnnotation=a,l.ClassProperty=u,l.DeclareClass=o,l.DeclareFunction=s,l.DeclareModule=i,l.DeclareVariable=c,l.FunctionTypeAnnotation=p,l.FunctionTypeParam=d,l.InterfaceExtends=f,l._interfaceish=h,l.InterfaceDeclaration=g,l.IntersectionTypeAnnotation=m,l.NullableTypeAnnotation=y,l.NumberTypeAnnotation=_,l.StringLiteralTypeAnnotation=x,l.StringTypeAnnotation=b,l.TupleTypeAnnotation=v,l.TypeofTypeAnnotation=I,l.TypeAlias=w,l.TypeAnnotation=E,l.TypeParameterInstantiation=k,l.ObjectTypeAnnotation=R,l.ObjectTypeCallProperty=S,l.ObjectTypeIndexer=C,l.ObjectTypeProperty=A,l.QualifiedTypeIdentifier=M,l.UnionTypeAnnotation=j,l.TypeCastExpression=T,l.VoidTypeAnnotation=P;var O=L(e("../../types"));l.ClassImplements=f,l.GenericTypeAnnotation=f,l.TypeParameterDeclaration=k,l.__esModule=!0},{"../../types":122}],8:[function(e,n,l){"use strict";function t(e,n){n(e.name),e.value&&(this.push("="),n(e.value))}function r(e){this.push(e.name)}function a(e,n){n(e.namespace),this.push(":"),n(e.name)}function u(e,n){n(e.object),this.push("."),n(e.property)}function o(e,n){this.push("{..."),n(e.argument),this.push("}")}function s(e,n){this.push("{"),n(e.expression),this.push("}")}function i(e,n){var l=this,t=e.openingElement;n(t),t.selfClosing||(this.indent(),h(e.children,function(e){g.isLiteral(e)?l.push(e.value):n(e)}),this.dedent(),n(e.closingElement))}function c(e,n){this.push("<"),n(e.name),e.attributes.length>0&&(this.push(" "),n.join(e.attributes,{separator:" "})),this.push(e.selfClosing?" />":">")}function p(e,n){this.push("</"),n(e.name),this.push(">")}function d(){}var f=function(e){return e&&e.__esModule?e["default"]:e};l.JSXAttribute=t,l.JSXIdentifier=r,l.JSXNamespacedName=a,l.JSXMemberExpression=u,l.JSXSpreadAttribute=o,l.JSXExpressionContainer=s,l.JSXElement=i,l.JSXOpeningElement=c,l.JSXClosingElement=p,l.JSXEmptyExpression=d;var h=f(e("lodash/collection/each")),g=f(e("../../types"));l.__esModule=!0},{"../../types":122,"lodash/collection/each":202}],9:[function(e,n,l){"use strict";function t(e,n){var l=this;n(e.typeParameters),this.push("("),n.list(e.params,{iterator:function(e){e.optional&&l.push("?"),n(e.typeAnnotation)}}),this.push(")"),e.returnType&&n(e.returnType)}function r(e,n){var l=e.value,t=e.kind,r=e.key;t&&"init"!==t?this.push(t+" "):l.generator&&this.push("*"),l.async&&this.push("async "),e.computed?(this.push("["),n(r),this.push("]")):n(r),this._params(l,n),this.push(" "),n(l.body)}function a(e,n){e.async&&this.push("async "),this.push("function"),e.generator&&this.push("*"),e.id?(this.push(" "),n(e.id)):this.space(),this._params(e,n),this.space(),n(e.body)}function u(e,n){e.async&&this.push("async "),1===e.params.length&&s.isIdentifier(e.params[0])?n(e.params[0]):this._params(e,n),this.push(" => "),n(e.body)}var o=function(e){return e&&e.__esModule?e["default"]:e};l._params=t,l._method=r,l.FunctionExpression=a,l.ArrowFunctionExpression=u;var s=o(e("../../types"));l.FunctionDeclaration=a,l.__esModule=!0},{"../../types":122}],10:[function(e,n,l){"use strict";function t(e,n){return p.isSpecifierDefault(e)?void n(p.getSpecifierName(e)):r.apply(this,arguments)}function r(e,n){n(e.id),e.name&&(this.push(" as "),n(e.name))}function a(){this.push("*")}function u(e,n){this.push("export ");var l=e.specifiers;if(e["default"]&&this.push("default "),e.declaration){if(n(e.declaration),p.isStatement(e.declaration))return}else 1===l.length&&p.isExportBatchSpecifier(l[0])?n(l[0]):(this.push("{"),l.length&&(this.space(),n.join(l,{separator:", "}),this.space()),this.push("}")),e.source&&(this.push(" from "),n(e.source));this.ensureSemicolon()}function o(e,n){var l=this;this.push("import "),e.isType&&this.push("type ");var t=e.specifiers;if(t&&t.length){var r=!1;c(e.specifiers,function(e,t){+t>0&&l.push(", ");var a=p.isSpecifierDefault(e);a||"ImportBatchSpecifier"===e.type||r||(r=!0,l.push("{ ")),n(e)}),r&&this.push(" }"),this.push(" from ")}n(e.source),this.semicolon()}function s(e,n){this.push("* as "),n(e.name)}var i=function(e){return e&&e.__esModule?e["default"]:e};l.ImportSpecifier=t,l.ExportSpecifier=r,l.ExportBatchSpecifier=a,l.ExportDeclaration=u,l.ImportDeclaration=o,l.ImportBatchSpecifier=s;var c=i(e("lodash/collection/each")),p=i(e("../../types"));l.__esModule=!0},{"../../types":122,"lodash/collection/each":202}],11:[function(e,n,l){"use strict";var t=function(e){return e&&e.__esModule?e["default"]:e},r=t(e("lodash/collection/each"));r(["BindMemberExpression","BindFunctionExpression"],function(e){l[e]=function(){throw new ReferenceError("Trying to render non-standard playground node "+JSON.stringify(e))}})},{"lodash/collection/each":202}],12:[function(e,n,l){"use strict";function t(e,n){this.keyword("with"),this.push("("),n(e.object),this.push(")"),n.block(e.body)}function r(e,n){this.keyword("if"),this.push("("),n(e.test),this.push(")"),this.space(),n.indentOnComments(e.consequent),e.alternate&&(this.isLast("}")&&this.space(),this.push("else "),n.indentOnComments(e.alternate))}function a(e,n){this.keyword("for"),this.push("("),n(e.init),this.push(";"),e.test&&(this.push(" "),n(e.test)),this.push(";"),e.update&&(this.push(" "),n(e.update)),this.push(")"),n.block(e.body)}function u(e,n){this.keyword("while"),this.push("("),n(e.test),this.push(")"),n.block(e.body)}function o(e,n){this.keyword("do"),n(e.body),this.space(),this.keyword("while"),this.push("("),n(e.test),this.push(");")}function s(e,n){n(e.label),this.push(": "),n(e.body)}function i(e,n){this.keyword("try"),n(e.block),this.space(),n(e.handlers?e.handlers[0]:e.handler),e.finalizer&&(this.space(),this.push("finally "),n(e.finalizer))}function c(e,n){this.keyword("catch"),this.push("("),n(e.param),this.push(") "),n(e.body)}function p(e,n){this.push("throw "),n(e.argument),this.semicolon()}function d(e,n){this.keyword("switch"),this.push("("),n(e.discriminant),this.push(")"),this.space(),this.push("{"),n.sequence(e.cases,{indent:!0,addNewlines:function(n,l){return n||e.cases[e.cases.length-1]!==l?void 0:-1}}),this.push("}")}function f(e,n){e.test?(this.push("case "),n(e.test),this.push(":")):this.push("default:"),e.consequent.length&&(this.newline(),n.sequence(e.consequent,{indent:!0}))}function h(){this.push("debugger;")}function g(e,n,l){this.push(e.kind+" ");var t=!1;if(!b.isFor(l))for(var r=0;r<e.declarations.length;r++)e.declarations[r].init&&(t=!0);var a=",";a+=!this.format.compact&&t?"\n"+x(" ",e.kind.length+1):" ",n.list(e.declarations,{separator:a}),b.isFor(l)||this.semicolon()}function m(e,n){this.push("private "),n.join(e.declarations,{separator:", "}),this.semicolon()}function y(e,n){n(e.id),n(e.id.typeAnnotation),e.init&&(this.space(),this.push("="),this.space(),n(e.init))}var _=function(e){return e&&e.__esModule?e["default"]:e};l.WithStatement=t,l.IfStatement=r,l.ForStatement=a,l.WhileStatement=u,l.DoWhileStatement=o,l.LabeledStatement=s,l.TryStatement=i,l.CatchClause=c,l.ThrowStatement=p,l.SwitchStatement=d,l.SwitchCase=f,l.DebuggerStatement=h,l.VariableDeclaration=g,l.PrivateDeclaration=m,l.VariableDeclarator=y;{var x=_(e("repeating")),b=_(e("../../types")),v=function(e){return function(n,l){this.keyword("for"),this.push("("),l(n.left),this.push(" "+e+" "),l(n.right),this.push(")"),l.block(n.body)}},I=(l.ForInStatement=v("in"),l.ForOfStatement=v("of"),function(e,n){return function(l,t){this.push(e);var r=l[n||"label"];r&&(this.push(" "),t(r)),this.semicolon()}});l.ContinueStatement=I("continue"),l.ReturnStatement=I("return","argument"),l.BreakStatement=I("break")}l.__esModule=!0},{"../../types":122,repeating:329}],13:[function(e,n,l){"use strict";function t(e,n){n(e.tag),n(e.quasi)}function r(e){this._push(e.value.raw)}function a(e,n){var l=this;this.push("`");var t=e.quasis,r=t.length;o(t,function(t,a){n(t),r>a+1&&(l.push("${ "),n(e.expressions[a]),l.push(" }"))}),this._push("`")}var u=function(e){return e&&e.__esModule?e["default"]:e};l.TaggedTemplateExpression=t,l.TemplateElement=r,l.TemplateLiteral=a;var o=u(e("lodash/collection/each"));l.__esModule=!0},{"lodash/collection/each":202}],14:[function(e,n,l){"use strict";function t(e){this.push(e.name)}function r(e,n){this.push("..."),n(e.argument)}function a(e,n){n(e.object),this.push("::"),n(e.property)}function u(e,n){var l=e.properties;l.length?(this.push("{"),this.space(),n.list(l,{indent:!0}),this.space(),this.push("}")):this.push("{}")}function o(e,n){if(e.method||"get"===e.kind||"set"===e.kind)this._method(e,n);else{if(e.computed)this.push("["),n(e.key),this.push("]");else if(n(e.key),e.shorthand)return;this.push(":"),this.space(),n(e.value)}}function s(e,n){var l=this,t=e.elements,r=t.length;this.push("["),d(t,function(e,t){e?(t>0&&l.push(" "),n(e),r-1>t&&l.push(",")):l.push(",")}),this.push("]")}function i(e){var n=e.value,l=typeof n;"string"===l?this._stringLiteral(n):"number"===l?this.push(n+""):"boolean"===l?this.push(n?"true":"false"):e.regex?this.push("/"+e.regex.pattern+"/"+e.regex.flags):null===n&&this.push("null")}function c(e){e=JSON.stringify(e),e=e.replace(/[\u000A\u000D\u2028\u2029]/g,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}),this.push(e)}var p=function(e){return e&&e.__esModule?e["default"]:e};l.Identifier=t,l.RestElement=r,l.VirtualPropertyExpression=a,l.ObjectExpression=u,l.Property=o,l.ArrayExpression=s,l.Literal=i,l._stringLiteral=c;var d=p(e("lodash/collection/each"));l.SpreadElement=r,l.SpreadProperty=r,l.ObjectPattern=u,l.ArrayPattern=s,l.__esModule=!0},{"lodash/collection/each":202}],15:[function(e,n){"use strict";var l=function(e){return e&&e.__esModule?e:{"default":e}},t=function(e){return e&&e.__esModule?e["default"]:e},r=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},a=t(e("detect-indent")),u=t(e("./whitespace")),o=t(e("repeating")),s=t(e("./source-map")),i=t(e("./position")),c=l(e("../messages")),p=t(e("./buffer")),d=t(e("lodash/object/extend")),f=t(e("lodash/collection/each")),h=t(e("./node")),g=t(e("../types")),m=function(){function n(e,l,t){r(this,n),l||(l={}),this.comments=e.comments||[],this.tokens=e.tokens||[],this.format=n.normalizeOptions(t,l),this.opts=l,this.ast=e,this.whitespace=new u(this.tokens,this.comments,this.format),this.position=new i,this.map=new s(this.position,l,t),this.buffer=new p(this.position,this.format)}return n.normalizeOptions=function(e,n){var l=" ";if(e){var t=a(e).indent;t&&" "!==t&&(l=t)}var r={comments:null==n.comments||n.comments,compact:n.compact,indent:{adjustMultilineComment:!0,style:l,base:0}};return"auto"===r.compact&&(r.compact=e.length>1e5,r.compact&&console.error(c.get("codeGeneratorDeopt",n.filename,"100KB"))),r},n.generators={templateLiterals:e("./generators/template-literals"),comprehensions:e("./generators/comprehensions"),expressions:e("./generators/expressions"),statements:e("./generators/statements"),playground:e("./generators/playground"),classes:e("./generators/classes"),methods:e("./generators/methods"),modules:e("./generators/modules"),types:e("./generators/types"),flow:e("./generators/flow"),base:e("./generators/base"),jsx:e("./generators/jsx")},n.prototype.generate=function(){var e=this.ast;this.print(e);var n=[];return f(e.comments,function(e){e._displayed||n.push(e)}),this._printComments(n),{map:this.map.get(),code:this.buffer.get()}},n.prototype.buildPrint=function(e){var n=this,l=function(l,t){return n.print(l,e,t)};return l.sequence=function(e){var t=void 0===arguments[1]?{}:arguments[1];return t.statement=!0,n.printJoin(l,e,t)},l.join=function(e,t){return n.printJoin(l,e,t)},l.list=function(e){var n=void 0===arguments[1]?{}:arguments[1],t=n;t.separator||(t.separator=", "),l.join(e,n)},l.block=function(e){return n.printBlock(l,e)},l.indentOnComments=function(e){return n.printAndIndentOnComments(l,e)},l},n.prototype.print=function(e,n){var l=this,t=void 0===arguments[2]?{}:arguments[2];if(e){n&&n._compact&&(e._compact=!0);var r=this.format.concise;e._compact&&(this.format.concise=!0);var a=function(r){if(t.statement||h.isUserWhitespacable(e,n)){var a=0;if(null==e.start||e._ignoreUserWhitespace){r||a++,t.addNewlines&&(a+=t.addNewlines(r,e)||0);var u=h.needsWhitespaceAfter;r&&(u=h.needsWhitespaceBefore),u(e,n)&&a++,l.buffer.buf||(a=0)}else a=r?l.whitespace.getNewlinesBefore(e):l.whitespace.getNewlinesAfter(e);l.newline(a)}};if(!this[e.type])throw new ReferenceError("unknown node of type "+JSON.stringify(e.type)+" with constructor "+JSON.stringify(e&&e.constructor.name));var u=h.needsParensNoLineTerminator(e,n),o=u||h.needsParens(e,n);o&&this.push("("),u&&this.indent(),this.printLeadingComments(e,n),a(!0),t.before&&t.before(),this.map.mark(e,"start"),this[e.type](e,this.buildPrint(e),n),u&&(this.newline(),this.dedent()),o&&this.push(")"),this.map.mark(e,"end"),t.after&&t.after(),a(!1),this.printTrailingComments(e,n),this.format.concise=r}},n.prototype.printJoin=function(e,n){var l=this,t=void 0===arguments[2]?{}:arguments[2];if(n&&n.length){var r=n.length;t.indent&&this.indent(),f(n,function(n,a){e(n,{statement:t.statement,addNewlines:t.addNewlines,after:function(){t.iterator&&t.iterator(n,a),t.separator&&r-1>a&&l.push(t.separator)}})}),t.indent&&this.dedent()}},n.prototype.printAndIndentOnComments=function(e,n){var l=!!n.leadingComments;l&&this.indent(),e(n),l&&this.dedent()},n.prototype.printBlock=function(e,n){g.isEmptyStatement(n)?this.semicolon():(this.push(" "),e(n))},n.prototype.generateComment=function(e){var n=e.value;return n="Line"===e.type?"//"+n:"/*"+n+"*/"},n.prototype.printTrailingComments=function(e,n){this._printComments(this.getComments("trailingComments",e,n))},n.prototype.printLeadingComments=function(e,n){this._printComments(this.getComments("leadingComments",e,n))},n.prototype.getComments=function(e,n,l){var t=this;if(g.isExpressionStatement(l))return[];var r=[],a=[n];return g.isExpressionStatement(n)&&a.push(n.argument),f(a,function(n){r=r.concat(t._getComments(e,n))}),r},n.prototype._getComments=function(e,n){return n&&n[e]||[]},n.prototype._printComments=function(e){var n=this;this.format.compact||this.format.comments&&e&&e.length&&f(e,function(e){var l=!1;if(f(n.ast.comments,function(n){return n.start===e.start?(n._displayed&&(l=!0),n._displayed=!0,!1):void 0}),!l){n.newline(n.whitespace.getNewlinesBefore(e));var t=n.position.column,r=n.generateComment(e);if(t&&!n.isLast(["\n"," ","[","{"])&&(n._push(" "),t++),"Block"===e.type&&n.format.indent.adjustMultilineComment){var a=e.loc.start.column;if(a){var u=new RegExp("\\n\\s{1,"+a+"}","g");r=r.replace(u,"\n")}var s=Math.max(n.indentSize(),t);r=r.replace(/\n/g,"\n"+o(" ",s))}0===t&&(r=n.getIndent()+r),n._push(r),n.newline(n.whitespace.getNewlinesAfter(e))}})},n}();f(p.prototype,function(e,n){m.prototype[n]=function(){return e.apply(this.buffer,arguments)}}),f(m.generators,function(e){d(m.prototype,e)}),n.exports=function(e,n,l){var t=new m(e,n,l);return t.generate()},n.exports.CodeGenerator=m},{"../messages":26,"../types":122,"./buffer":2,"./generators/base":3,"./generators/classes":4,"./generators/comprehensions":5,"./generators/expressions":6,"./generators/flow":7,"./generators/jsx":8,"./generators/methods":9,"./generators/modules":10,"./generators/playground":11,"./generators/statements":12,"./generators/template-literals":13,"./generators/types":14,"./node":16,"./position":19,"./source-map":20,"./whitespace":21,"detect-indent":181,"lodash/collection/each":202,"lodash/object/extend":303,repeating:329}],16:[function(e,n){"use strict";var l=function(e){return e&&e.__esModule?e:{"default":e}},t=function(e){return e&&e.__esModule?e["default"]:e},r=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},a=t(e("./whitespace")),u=l(e("./parentheses")),o=t(e("lodash/collection/each")),s=t(e("lodash/collection/some")),i=t(e("../../types")),c=function(e,n,l){if(e){for(var t,r=Object.keys(e),a=0;a<r.length;a++){var u=r[a];if(i.is(u,n)){var o=e[u];if(t=o(n,l),null!=t)break}}return t}},p=function(){function e(n,l){r(this,e),this.parent=l,this.node=n}return e.isUserWhitespacable=function(e){return i.isUserWhitespacable(e)},e.needsWhitespace=function(n,l,t){if(!n)return 0;i.isExpressionStatement(n)&&(n=n.expression);var r=c(a.nodes,n,l);if(!r){var u=c(a.list,n,l);if(u)for(var o=0;o<u.length&&!(r=e.needsWhitespace(u[o],n,t));o++);}return r&&r[t]||0},e.needsWhitespaceBefore=function(n,l){return e.needsWhitespace(n,l,"before")},e.needsWhitespaceAfter=function(n,l){return e.needsWhitespace(n,l,"after")},e.needsParens=function(e,n){if(!n)return!1;if(i.isNewExpression(n)&&n.callee===e){if(i.isCallExpression(e))return!0;var l=s(e,function(e){return i.isCallExpression(e)});if(l)return!0}return c(u,e,n)},e.needsParensNoLineTerminator=function(e,n){return n&&e.leadingComments&&e.leadingComments.length?i.isYieldExpression(n)||i.isAwaitExpression(n)?!0:i.isContinueStatement(n)||i.isBreakStatement(n)||i.isReturnStatement(n)||i.isThrowStatement(n)?!0:!1:!1},e}();n.exports=p,o(p,function(e,n){p.prototype[n]=function(){var e=new Array(arguments.length+2);e[0]=this.node,e[1]=this.parent;for(var l=0;l<e.length;l++)e[l+2]=arguments[l];return p[n].apply(null,e)}})},{"../../types":122,"./parentheses":17,"./whitespace":18,"lodash/collection/each":202,"lodash/collection/some":208}],17:[function(e,n,l){"use strict";function t(e,n){return m.isArrayTypeAnnotation(n)}function r(e,n){return m.isMemberExpression(n)&&n.object===e?!0:void 0}function a(e,n){return m.isExpressionStatement(n)?!0:m.isMemberExpression(n)&&n.object===e?!0:!1}function u(e,n){if((m.isCallExpression(n)||m.isNewExpression(n))&&n.callee===e)return!0;if(m.isUnaryLike(n))return!0;if(m.isMemberExpression(n)&&n.object===e)return!0;if(m.isBinary(n)){var l=n.operator,t=y[l],r=e.operator,a=y[r];if(t>a)return!0;if(t===a&&n.right===e)return!0}}function o(e,n){if("in"===e.operator){if(m.isVariableDeclarator(n))return!0;if(m.isFor(n))return!0}}function s(e,n){return m.isForStatement(n)?!1:m.isExpressionStatement(n)&&n.expression===e?!1:!0}function i(e,n){return m.isBinary(n)||m.isUnaryLike(n)||m.isCallExpression(n)||m.isMemberExpression(n)||m.isNewExpression(n)||m.isConditionalExpression(n)||m.isYieldExpression(n)}function c(e,n){return m.isExpressionStatement(n)}function p(e,n){return m.isMemberExpression(n)&&n.object===e}function d(e,n){return m.isExpressionStatement(n)?!0:m.isMemberExpression(n)&&n.object===e?!0:m.isCallExpression(n)&&n.callee===e?!0:void 0}function f(e,n){return m.isUnaryLike(n)?!0:m.isBinary(n)?!0:(m.isCallExpression(n)||m.isNewExpression(n))&&n.callee===e?!0:m.isConditionalExpression(n)&&n.test===e?!0:m.isMemberExpression(n)&&n.object===e?!0:!1}var h=function(e){return e&&e.__esModule?e["default"]:e};l.NullableTypeAnnotation=t,l.UpdateExpression=r,l.ObjectExpression=a,l.Binary=u,l.BinaryExpression=o,l.SequenceExpression=s,l.YieldExpression=i,l.ClassExpression=c,l.UnaryLike=p,l.FunctionExpression=d,l.ConditionalExpression=f;var g=h(e("lodash/collection/each")),m=h(e("../../types")),y={};g([["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"],["**"]],function(e,n){g(e,function(e){y[e]=n})}),l.FunctionTypeAnnotation=t,l.AssignmentExpression=f,l.__esModule=!0},{"../../types":122,"lodash/collection/each":202}],18:[function(e,n,l){"use strict";function t(e){var n=void 0===arguments[1]?{}:arguments[1];if(c.isMemberExpression(e))t(e.object,n),e.computed&&t(e.property,n);else if(c.isBinary(e)||c.isAssignmentExpression(e))t(e.left,n),t(e.right,n);else if(c.isCallExpression(e))n.hasCall=!0,t(e.callee,n);else if(c.isFunction(e))n.hasFunction=!0;else if(c.isIdentifier(e)){var l=n;l.hasHelper||(l.hasHelper=r(e.callee))}return n}function r(e){return c.isMemberExpression(e)?r(e.object)||r(e.property):c.isIdentifier(e)?"require"===e.name||"_"===e.name[0]:c.isCallExpression(e)?r(e.callee):c.isBinary(e)||c.isAssignmentExpression(e)?c.isIdentifier(e.left)&&r(e.left)||r(e.right):!1}function a(e){return c.isLiteral(e)||c.isObjectExpression(e)||c.isArrayExpression(e)||c.isIdentifier(e)||c.isMemberExpression(e)}var u=function(e){return e&&e.__esModule?e["default"]:e},o=u(e("lodash/lang/isBoolean")),s=u(e("lodash/collection/each")),i=u(e("lodash/collection/map")),c=u(e("../../types"));l.nodes={AssignmentExpression:function(e){var n=t(e.right);return n.hasCall&&n.hasHelper||n.hasFunction?{before:n.hasFunction,after:!0}:void 0},SwitchCase:function(e,n){return{before:e.consequent.length||n.cases[0]===e}},LogicalExpression:function(e){return c.isFunction(e.left)||c.isFunction(e.right)?{after:!0}:void 0},Literal:function(e){return"use strict"===e.value?{after:!0}:void 0},CallExpression:function(e){return c.isFunction(e.callee)||r(e)?{before:!0,after:!0}:void 0},VariableDeclaration:function(e){for(var n=0;n<e.declarations.length;n++){var l=e.declarations[n],u=r(l.id)&&!a(l.init);if(!u){var o=t(l.init);u=r(l.init)&&o.hasCall||o.hasFunction}if(u)return{before:!0,after:!0}}},IfStatement:function(e){return c.isBlockStatement(e.consequent)?{before:!0,after:!0}:void 0 }},l.nodes.Property=l.nodes.SpreadProperty=function(e,n){return n.properties[0]===e?{before:!0}:void 0},l.list={VariableDeclaration:function(e){return i(e.declarations,"init")},ArrayExpression:function(e){return e.elements},ObjectExpression:function(e){return e.properties}},s({Function:!0,Class:!0,Loop:!0,LabeledStatement:!0,SwitchStatement:!0,TryStatement:!0},function(e,n){o(e)&&(e={after:e,before:e}),s([n].concat(c.FLIPPED_ALIAS_KEYS[n]||[]),function(n){l.nodes[n]=function(){return e}})})},{"../../types":122,"lodash/collection/each":202,"lodash/collection/map":206,"lodash/lang/isBoolean":291}],19:[function(e,n){"use strict";var l=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},t=function(){function e(){l(this,e),this.line=1,this.column=0}return e.prototype.push=function(e){for(var n=0;n<e.length;n++)"\n"===e[n]?(this.line++,this.column=0):this.column++},e.prototype.unshift=function(e){for(var n=0;n<e.length;n++)"\n"===e[n]?this.line--:this.column--},e}();n.exports=t},{}],20:[function(e,n){"use strict";var l=function(e){return e&&e.__esModule?e["default"]:e},t=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},r=l(e("source-map")),a=l(e("../types")),u=function(){function e(n,l,a){t(this,e),this.position=n,this.opts=l,l.sourceMap?(this.map=new r.SourceMapGenerator({file:l.sourceMapName,sourceRoot:l.sourceRoot}),this.map.setSourceContent(l.sourceFileName,a)):this.map=null}return e.prototype.get=function(){var e=this.map;return e?e.toJSON():e},e.prototype.mark=function(e,n){var l=e.loc;if(l){var t=this.map;if(t&&!a.isProgram(e)&&!a.isFile(e)){var r=this.position,u={line:r.line,column:r.column},o=l[n];t.addMapping({source:this.opts.sourceFileName,generated:u,original:o})}}},e}();n.exports=u},{"../types":122,"source-map":333}],21:[function(e,n){"use strict";function l(e,n,l){return e+=n,e>=l&&(e-=l),e}var t=function(e){return e&&e.__esModule?e["default"]:e},r=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},a=t(e("lodash/collection/sortBy")),u=function(){function e(n,l){r(this,e),this.tokens=a(n.concat(l),"start"),this.used={},this._lastFoundIndex=0}return e.prototype.getNewlinesBefore=function(e){for(var n,t,r,a=this.tokens,u=0;u<a.length;u++){var o=l(u,this._lastFoundIndex,this.tokens.length);if(r=a[o],e.start===r.start){n=a[o-1],t=r,this._lastFoundIndex=o;break}}return this.getNewlinesBetween(n,t)},e.prototype.getNewlinesAfter=function(e){for(var n,t,r,a=this.tokens,u=0;u<a.length;u++){var o=l(u,this._lastFoundIndex,this.tokens.length);if(r=a[o],e.end===r.end){n=r,t=a[o+1],this._lastFoundIndex=o;break}}if(t&&"eof"===t.type.type)return 1;var s=this.getNewlinesBetween(n,t);return"Line"!==e.type||s?s:1},e.prototype.getNewlinesBetween=function(e,n){if(!n||!n.loc)return 0;for(var l=e?e.loc.end.line:1,t=n.loc.start.line,r=0,a=l;t>a;a++)"undefined"==typeof this.used[a]&&(this.used[a]=!0,r++);return r},e}();n.exports=u},{"lodash/collection/sortBy":209}],22:[function(e,n){"use strict";var l=function(e){return e&&e.__esModule?e["default"]:e},t=l(e("line-numbers")),r=l(e("repeating")),a=l(e("js-tokens")),u=l(e("esutils")),o=l(e("chalk")),s=l(e("lodash/function/ary")),i={string:o.red,punctuator:o.white.bold,curly:o.green,parens:o.blue.bold,square:o.yellow,name:o.white,keyword:o.cyan,number:o.magenta,regex:o.magenta,comment:o.grey,invalid:o.inverse},c=/\r\n|[\n\r\u2028\u2029]/,p=function(e){var n=function(e){var n=a.matchToToken(e);if("name"===n.type&&u.keyword.isReservedWordES6(n.value))return"keyword";if("punctuator"===n.type)switch(n.value){case"{":case"}":return"curly";case"(":case")":return"parens";case"[":case"]":return"square"}return n.type};return e.replace(a,function(e){var l=n(arguments);if(l in i){var t=s(i[l],1);return e.split(c).map(t).join("\n")}return e})};n.exports=function(e,n,l){l=Math.max(l,0),o.supportsColor&&(e=p(e)),e=e.split(c);var a=Math.max(n-3,0),u=Math.min(e.length,n+3);return n||l||(a=0,u=e.length),"\n"+t(e.slice(a,u),{start:a+1,before:" ",after:" | ",transform:function(e){e.number===n&&(l&&(e.line+="\n"+e.before+r(" ",e.width)+e.after+r(" ",l-1)+"^"),e.before=e.before.replace(/^./,">"))}}).join("\n")}},{chalk:168,esutils:186,"js-tokens":192,"line-numbers":194,"lodash/function/ary":211,repeating:329}],23:[function(e,n){"use strict";var l=function(e){return e&&e.__esModule?e["default"]:e},t=l(e("../types"));n.exports=function(e,n,l){if(e&&"Program"===e.type)return t.file(e,n||[],l||[]);throw new Error("Not a valid ast?")}},{"../types":122}],24:[function(e,n){"use strict";n.exports=function(){return Object.create(null)}},{}],25:[function(e,n){"use strict";var l=function(e){return e&&e.__esModule?e["default"]:e},t=l(e("./normalize-ast")),r=l(e("estraverse")),a=l(e("./code-frame")),u=l(e("acorn-babel"));n.exports=function(e,n,l){try{var o=[],s=[],i=u.parse(n,{allowImportExportEverywhere:e.allowImportExportEverywhere,allowReturnOutsideFunction:!e._anal,ecmaVersion:e.experimental?7:6,playground:e.playground,strictMode:e.strictMode,onComment:o,locations:!0,onToken:s,ranges:!0});return r.attachComments(i,o,s),i=t(i,o,s),l?l(i):i}catch(c){if(!c._babel){c._babel=!0;var p=""+e.filename+": "+c.message,d=c.loc;if(d){var f=a(n,d.line,d.column+1);p+=f}c.stack&&(c.stack=c.stack.replace(c.message,p)),c.message=p}throw c}}},{"./code-frame":22,"./normalize-ast":23,"acorn-babel":125,estraverse:182}],26:[function(e,n,l){"use strict";function t(e){var n=o[e];if(!n)throw new ReferenceError("Unknown message "+JSON.stringify(e));for(var l=[],t=1;t<arguments.length;t++)l.push(arguments[t]);return l=r(l),n.replace(/\$(\d+)/g,function(e,n){return l[--n]})}function r(e){return e.map(function(e){if(null!=e&&e.inspect)return e.inspect();try{return JSON.stringify(e)||e+""}catch(n){return u.inspect(e)}})}var a=function(e){return e&&e.__esModule?e:{"default":e}};l.get=t,l.parseArgs=r;var u=a(e("util")),o=l.messages={tailCallReassignmentDeopt:"Function reference has been reassigned so it's probably be dereferenced so we can't optimise this with confidence",JSXNamespacedTags:"Namespace tags are not supported. ReactJSX is not XML.",classesIllegalBareSuper:"Illegal use of bare super",classesIllegalSuperCall:"Direct super call is illegal in non-constructor, use super.$1() instead",classesIllegalConstructorKind:"Illegal kind for constructor method",scopeDuplicateDeclaration:"Duplicate declaration $1",undeclaredVariable:"Reference to undeclared variable $1",undeclaredVariableSuggestion:"Reference to undeclared variable $1 - did you mean $2?",settersInvalidParamLength:"Setters must have exactly one parameter",settersNoRest:"Setters aren't allowed to have a rest",noAssignmentsInForHead:"No assignments allowed in for-in/of head",expectedMemberExpressionOrIdentifier:"Expected type MemeberExpression or Identifier",invalidParentForThisNode:"We don't know how to handle this node within the current parent - please open an issue",readOnly:"$1 is read-only",modulesIllegalExportName:"Illegal export $1",unknownForHead:"Unknown node type $1 in ForStatement",didYouMean:"Did you mean $1?",evalInStrictMode:"eval is not allowed in strict mode",codeGeneratorDeopt:"Note: The code generator has deoptimised the styling of $1 as it exceeds the max of $2.",missingTemplatesDirectory:"no templates directory - this is most likely the result of a broken `npm publish`. Please report to https://github.com/babel/babel/issues"};l.__esModule=!0},{util:167}],27:[function(e){"use strict";var n=function(e){return e&&e.__esModule?e["default"]:e},l=n(e("estraverse")),t=n(e("lodash/object/extend")),r=n(e("ast-types")),a=n(e("./types"));t(l.VisitorKeys,a.VISITOR_KEYS);var u=r.Type.def,o=r.Type.or;u("File").bases("Node").build("program").field("program",u("Program")),u("AssignmentPattern").bases("Pattern").build("left","right").field("left",u("Pattern")).field("right",u("Expression")),u("ImportBatchSpecifier").bases("Specifier").build("name").field("name",u("Identifier")),u("RestElement").bases("Pattern").build("argument").field("argument",u("expression")),u("VirtualPropertyExpression").bases("Expression").build("object","property").field("object",u("Expression")).field("property",o(u("Identifier"),u("Expression"))),u("PrivateDeclaration").bases("Declaration").build("declarations").field("declarations",[u("Identifier")]),u("BindMemberExpression").bases("Expression").build("object","property","arguments").field("object",u("Expression")).field("property",o(u("Identifier"),u("Expression"))).field("arguments",[u("Expression")]),u("BindFunctionExpression").bases("Expression").build("callee","arguments").field("callee",u("Expression")).field("arguments",[u("Expression")]),r.finalize()},{"./types":122,"ast-types":139,estraverse:182,"lodash/object/extend":303}],28:[function(e,n){"use strict";function l(e,n,l){b(e,function(e){e.shouldRun||e.checkNode(n,l)})}var t=function(e){return e&&e.__esModule?e:{"default":e}},r=function(e){return e&&e.__esModule?e["default"]:e},a=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},u=r(e("convert-source-map")),o=r(e("shebang-regex")),s=r(e("lodash/lang/isFunction")),i=r(e("source-map")),c=r(e("./index")),p=r(e("../generation")),d=r(e("lodash/object/defaults")),f=r(e("lodash/collection/includes")),h=r(e("lodash/object/assign")),g=r(e("../helpers/parse")),m=r(e("../traversal/scope")),y=r(e("slash")),_=t(e("../util")),x=r(e("path")),b=r(e("lodash/collection/each")),v=r(e("../types")),I={enter:function(e,n,t,r){l(r.stack,e,t)}},w=function(){function n(e){a(this,n),this.dynamicImportedNoDefault=[],this.dynamicImportIds={},this.dynamicImported=[],this.dynamicImports=[],this.usedHelpers={},this.dynamicData={},this.data={},this.lastStatements=[],this.opts=this.normalizeOptions(e),this.ast={},this.buildTransformers()}return n.helpers=["inherits","defaults","create-class","apply-constructor","tagged-template-literal","tagged-template-literal-loose","interop-require","to-array","to-consumable-array","sliced-to-array","object-without-properties","has-own","slice","bind","define-property","async-to-generator","interop-require-wildcard","typeof","extends","get","set","class-call-check","object-destructuring-empty","temporal-undefined","temporal-assert-defined","self-global"],n.validOptions=["filename","filenameRelative","blacklist","whitelist","optional","loose","playground","experimental","modules","moduleIds","moduleId","resolveModuleSource","keepModuleIdExtensions","code","ast","comments","compact","auxiliaryComment","externalHelpers","returnUsedHelpers","inputSourceMap","sourceMap","sourceMapName","sourceFileName","sourceRoot","moduleRoot","format","reactCompat","ignore","only","extensions","accept"],n.prototype.normalizeOptions=function(e){e=h({},e);for(var l in e)if("_"!==l[0]&&n.validOptions.indexOf(l)<0)throw new ReferenceError("Unknown option: "+l);d(e,{keepModuleIdExtensions:!1,resolveModuleSource:null,returnUsedHelpers:!1,externalHelpers:!1,auxilaryComment:"",inputSourceMap:!1,experimental:!1,reactCompat:!1,playground:!1,moduleIds:!1,blacklist:[],whitelist:[],sourceMap:!1,optional:[],comments:!0,filename:"unknown",modules:"common",compact:"auto",loose:[],code:!0,ast:!0}),e.inputSourceMap&&(e.sourceMap=!0),e.filename=y(e.filename),e.sourceRoot&&(e.sourceRoot=y(e.sourceRoot)),e.moduleId&&(e.moduleIds=!0),e.basename=x.basename(e.filename,x.extname(e.filename)),e.blacklist=_.arrayify(e.blacklist),e.whitelist=_.arrayify(e.whitelist),e.optional=_.arrayify(e.optional),e.compact=_.booleanify(e.compact),e.loose=_.arrayify(e.loose),(f(e.loose,"all")||f(e.loose,!0))&&(e.loose=Object.keys(c.transformers)),d(e,{moduleRoot:e.sourceRoot}),d(e,{sourceRoot:e.moduleRoot}),d(e,{filenameRelative:e.filename}),d(e,{sourceFileName:e.filenameRelative,sourceMapName:e.filenameRelative}),e.playground&&(e.experimental=!0),e.externalHelpers&&this.set("helpersNamespace",v.identifier("babelHelpers")),e.blacklist=c._ensureTransformerNames("blacklist",e.blacklist),e.whitelist=c._ensureTransformerNames("whitelist",e.whitelist),e.optional=c._ensureTransformerNames("optional",e.optional),e.loose=c._ensureTransformerNames("loose",e.loose),e.reactCompat&&(e.optional.push("reactCompat"),console.error("The reactCompat option has been moved into the optional transformer `reactCompat`"));var t=function(n){var l=c.transformerNamespaces[n];"es7"===l&&(e.experimental=!0),"playground"===l&&(e.playground=!0)};return b(e.whitelist,t),b(e.optional,t),e},n.prototype.isLoose=function(e){return f(this.opts.loose,e)},n.prototype.buildTransformers=function(){var e=this,n={},l=[],t=[];b(c.transformers,function(r,a){var u=n[a]=r.buildPass(e);u.canRun(e)&&(t.push(u),r.secondPass&&l.push(u),r.manipulateOptions&&r.manipulateOptions(e.opts,e))}),this.transformerStack=t.concat(l),this.transformers=n},n.prototype.debug=function(e){var n=this.opts.filename;e&&(n+=": "+e),_.debug(n)},n.prototype.getModuleFormatter=function(n){var l=s(n)?n:c.moduleFormatters[n];if(!l){var t=_.resolve(n);t&&(l=e(t))}if(!l)throw new ReferenceError("Unknown module formatter type "+JSON.stringify(n));return new l(this)},n.prototype.parseInputSourceMap=function(e){var n=this.opts,l=u.fromSource(e);return l&&(n.inputSourceMap=l,e=u.removeComments(e)),e},n.prototype.parseShebang=function(e){var n=o.exec(e);return n&&(this.shebang=n[0],e=e.replace(o,"")),e},n.prototype.set=function(e,n){return this.data[e]=n},n.prototype.setDynamic=function(e,n){this.dynamicData[e]=n},n.prototype.get=function(e){var n=this.data[e];if(n)return n;var l=this.dynamicData[e];return l?this.set(e,l()):void 0},n.prototype.addImport=function(e,n,l){n||(n=e);var t=this.dynamicImportIds[n];if(!t){t=this.dynamicImportIds[n]=this.scope.generateUidIdentifier(n);var r=[v.importSpecifier(v.identifier("default"),t)],a=v.importDeclaration(r,v.literal(e));a._blockHoist=3,this.dynamicImported.push(a),l&&this.dynamicImportedNoDefault.push(a),this.moduleFormatter.importSpecifier(r[0],a,this.dynamicImports)}return t},n.prototype.isConsequenceExpressionStatement=function(e){return v.isExpressionStatement(e)&&this.lastStatements.indexOf(e)>=0},n.prototype.attachAuxiliaryComment=function(e){var n=this.opts.auxiliaryComment;if(n){var l=e;l.leadingComments||(l.leadingComments=[]),e.leadingComments.push({type:"Line",value:" "+n})}return e},n.prototype.addHelper=function(e){if(!f(n.helpers,e))throw new ReferenceError("Unknown helper "+e);var l=this.ast.program,t=l._declarations&&l._declarations[e];if(t)return t.id;this.usedHelpers[e]=!0;var r=this.get("helpersNamespace");if(r)return e=v.identifier(v.toIdentifier(e)),v.memberExpression(r,e);var a=_.template(e);a._compact=!0;var u=this.scope.generateUidIdentifier(e);return this.scope.push({key:e,id:u,init:a}),u},n.prototype.logDeopt=function(){},n.prototype.errorWithNode=function(e,n){var l=void 0===arguments[2]?SyntaxError:arguments[2],t=e.loc.start,r=new l("Line "+t.line+": "+n);return r.loc=t,r},n.prototype.addCode=function(e){return e=(e||"")+"",e=this.parseInputSourceMap(e),this.code=e,this.parseShebang(e)},n.prototype.parse=function(e){var n=function(){return e.apply(this,arguments)};return n.toString=function(){return e.toString()},n}(function(e){var n=this;e=this.addCode(e);var l=this.opts;return l.allowImportExportEverywhere=this.isLoose("es6.modules"),l.strictMode=this.transformers.strict.canRun(),g(l,e,function(e){return n.transform(e),n.generate()})}),n.prototype.transform=function(e){this.debug(),this.ast=e,this.lastStatements=v.getLastStatements(e.program),this.scope=new m(e.program,e,null,this);var n=this.moduleFormatter=this.getModuleFormatter(this.opts.modules);n.init&&this.transformers["es6.modules"].canRun()&&n.init(),this.checkNode(e),this.call("pre"),b(this.transformerStack,function(e){e.transform()}),this.call("post")},n.prototype.call=function(e){for(var n=this.transformerStack,l=0;l<n.length;l++){var t=n[l].transformer;t[e]&&t[e](this)}},n.prototype.checkNode=function(e){var n=function(){return e.apply(this,arguments)};return n.toString=function(){return e.toString()},n}(function(e,n){if(Array.isArray(e))for(var t=0;t<e.length;t++)this.checkNode(e[t],n);else{var r=this.transformerStack;n||(n=this.scope),l(r,e,n),n.traverse(e,I,{stack:r})}}),n.prototype.mergeSourceMap=function(e){var n=this.opts,l=n.inputSourceMap;if(l){var t=new i.SourceMapConsumer(l),r=new i.SourceMapConsumer(e),a=i.SourceMapGenerator.fromSourceMap(r);a.applySourceMap(t);var u=a.toJSON();return u.sources=e.sources,u.file=e.file,u}return e},n.prototype.generate=function(e){var n=function(){return e.apply(this,arguments)};return n.toString=function(){return e.toString()},n}(function(){var e=this.opts,n=this.ast,l={code:"",map:null,ast:null};if(this.opts.returnUsedHelpers&&(l.usedHelpers=Object.keys(this.usedHelpers)),e.ast&&(l.ast=n),!e.code)return l;var t=p(n,e,this.code);return l.code=t.code,l.map=t.map,this.shebang&&(l.code=""+this.shebang+"\n"+l.code),l.map=this.mergeSourceMap(l.map),"inline"===e.sourceMap&&(l.code+="\n"+u.fromObject(l.map).toComment(),l.map=null),l}),n}();n.exports=w},{"../generation":15,"../helpers/parse":25,"../traversal/scope":119,"../types":122,"../util":124,"./index":42,"convert-source-map":176,"lodash/collection/each":202,"lodash/collection/includes":205,"lodash/lang/isFunction":293,"lodash/object/assign":301,"lodash/object/defaults":302,path:150,"shebang-regex":331,slash:332,"source-map":333}],29:[function(e,n){"use strict";var l=function(e){return e&&e.__esModule?e["default"]:e},t=l(e("./explode-assignable-expression")),r=l(e("../../types"));n.exports=function(e,n){var l=function(e){return e.operator===n.operator+"="},a=function(e,n){return r.assignmentExpression("=",e,n)};e.ExpressionStatement=function(e,u,o,s){if(!s.isConsequenceExpressionStatement(e)){var i=e.expression;if(l(i)){var c=[],p=t(i.left,c,s,o,!0);return c.push(r.expressionStatement(a(p.ref,n.build(p.uid,i.right)))),c}}},e.AssignmentExpression=function(e,u,o,s){if(l(e)){var i=[],c=t(e.left,i,s,o);return i.push(a(c.ref,n.build(c.uid,e.right))),r.toSequenceExpression(i,o)}},e.BinaryExpression=function(e){return e.operator===n.operator?n.build(e.left,e.right):void 0}}},{"../../types":122,"./explode-assignable-expression":34}],30:[function(e,n){"use strict";var l=function(e){return e&&e.__esModule?e["default"]:e},t=l(e("../../types"));n.exports=function r(e,n){var l=e.blocks.shift();if(l){var a=r(e,n);return a||(a=n(),e.filter&&(a=t.ifStatement(e.filter,t.blockStatement([a])))),t.forOfStatement(t.variableDeclaration("let",[t.variableDeclarator(l.left)]),l.right,t.blockStatement([a]))}}},{"../../types":122}],31:[function(e,n){"use strict";var l=function(e){return e&&e.__esModule?e["default"]:e},t=l(e("./explode-assignable-expression")),r=l(e("../../types"));n.exports=function(e,n){var l=function(e,n){return r.assignmentExpression("=",e,n)};e.ExpressionStatement=function(e,a,u,o){if(!o.isConsequenceExpressionStatement(e)){var s=e.expression;if(n.is(s,o)){var i=[],c=t(s.left,i,o,u);return i.push(r.ifStatement(n.build(c.uid,o),r.expressionStatement(l(c.ref,s.right)))),i}}},e.AssignmentExpression=function(e,a,u,o){if(n.is(e,o)){var s=[],i=t(e.left,s,o,u);return s.push(r.logicalExpression("&&",n.build(i.uid,o),l(i.ref,e.right))),s.push(i.ref),r.toSequenceExpression(s,u)}}}},{"../../types":122,"./explode-assignable-expression":34}],32:[function(e,n){"use strict";var l=function(e){return e&&e.__esModule?e:{"default":e}},t=function(e){return e&&e.__esModule?e["default"]:e},r=t(e("lodash/lang/isString")),a=l(e("../../messages")),u=t(e("esutils")),o=l(e("./react")),s=t(e("../../types"));n.exports=function(e,n){e.check=function(e){return s.isJSX(e)?!0:o.isCreateClass(e)?!0:!1},e.JSXIdentifier=function(e,n){return"this"===e.name&&s.isReferenced(e,n)?s.thisExpression():u.keyword.isIdentifierName(e.name)?void(e.type="Identifier"):s.literal(e.name)},e.JSXNamespacedName=function(e,n,l,t){throw t.errorWithNode(e,a.get("JSXNamespacedTags"))},e.JSXMemberExpression={exit:function(e){e.computed=s.isLiteral(e.property),e.type="MemberExpression"}},e.JSXExpressionContainer=function(e){return e.expression},e.JSXAttribute={enter:function(e){var n=e.value;s.isLiteral(n)&&r(n.value)&&(n.value=n.value.replace(/\n\s+/g," "))},exit:function(e){var n=e.value||s.literal(!0);return s.inherits(s.property("init",e.name,n),e)}},e.JSXOpeningElement={exit:function(e,t,r,a){var u,o=e.name,i=[];s.isIdentifier(o)?u=o.name:s.isLiteral(o)&&(u=o.value);var c={tagExpr:o,tagName:u,args:i};n.pre&&n.pre(c,a);var p=e.attributes;return p=p.length?l(p,a):s.literal(null),i.push(p),n.post&&n.post(c,a),c.call||s.callExpression(c.callee,i)}};var l=function(e,n){for(var l=[],t=[],r=function(){l.length&&(t.push(s.objectExpression(l)),l=[])};e.length;){var a=e.shift();s.isJSXSpreadAttribute(a)?(r(),t.push(a.argument)):l.push(a)}return r(),1===t.length?e=t[0]:(s.isObjectExpression(t[0])||t.unshift(s.objectExpression([])),e=s.callExpression(n.addHelper("extends"),t)),e};e.JSXElement={exit:function(e){for(var n=e.openingElement,l=0;l<e.children.length;l++){var t=e.children[l];s.isLiteral(t)&&"string"==typeof t.value?c(t,n.arguments):s.isJSXEmptyExpression(t)||n.arguments.push(t)}return n.arguments=i(n.arguments),n.arguments.length>=3&&(n._prettyCall=!0),s.inherits(n,e)}};var t=function(e){return s.isLiteral(e)&&r(e.value)},i=function(e){for(var n,l=[],r=0;r<e.length;r++){var a=e[r];t(a)&&t(n)?n.value+=a.value:(n=a,l.push(a))}return l},c=function(e,n){var l,t=e.value.split(/\r\n|\n|\r/),r=0;for(l=0;l<t.length;l++)t[l].match(/[^ \t]/)&&(r=l);for(l=0;l<t.length;l++){var a=t[l],u=0===l,o=l===t.length-1,i=l===r,c=a.replace(/\t/g," ");u||(c=c.replace(/^[ ]+/,"")),o||(c=c.replace(/[ ]+$/,"")),c&&(i||(c+=" "),n.push(s.literal(c)))}},p=function(e,n){for(var l=n.arguments[0].properties,t=!0,r=0;r<l.length;r++){var a=l[r];if(s.isIdentifier(a.key,{name:"displayName"})){t=!1;break}}t&&l.unshift(s.property("init",s.identifier("displayName"),s.literal(e)))};e.ExportDeclaration=function(e,n,l,t){e["default"]&&o.isCreateClass(e.declaration)&&p(t.opts.basename,e.declaration)},e.AssignmentExpression=e.Property=e.VariableDeclarator=function(e){var n,l;s.isAssignmentExpression(e)?(n=e.left,l=e.right):s.isProperty(e)?(n=e.key,l=e.value):s.isVariableDeclarator(e)&&(n=e.id,l=e.init),s.isMemberExpression(n)&&(n=n.property),s.isIdentifier(n)&&o.isCreateClass(l)&&p(n.name,l)}}},{"../../messages":26,"../../types":122,"./react":37,esutils:186,"lodash/lang/isString":299}],33:[function(e,n,l){"use strict";function t(e,n,l,t,r){var a;c.isIdentifier(n)?(a=n.name,t&&(a="computed:"+a)):a=c.isLiteral(n)?String(n.value):JSON.stringify(o.removeProperties(c.cloneDeep(n)));var u;u=i(e,a)?e[a]:{},e[a]=u,u._key=n,t&&(u._computed=!0),u[l]=r}function r(e){var n=c.objectExpression([]);return s(e,function(e){var l=c.objectExpression([]),t=c.property("init",e._key,l,e._computed);s(e,function(e,n){if("_"!==n[0]){var t=e;c.isMethodDefinition(e)&&(e=e.value);var r=c.property("init",c.identifier(n),e);c.inheritsComments(r,t),c.removeComments(t),l.properties.push(r)}}),n.properties.push(t)}),n}function a(e){var n=c.objectExpression([]);return s(e,function(e){var l=c.objectExpression([]),t=c.property("init",e._key,l,e._computed);e.value&&(e.writable=c.literal(!0)),e.configurable=c.literal(!0),e.enumerable=c.literal(!0),s(e,function(e,n){if("_"!==n[0]){e=c.clone(e);var t=e;c.isMethodDefinition(e)&&(e=e.value);var r=c.property("init",c.identifier(n),e);c.inheritsComments(r,t),c.removeComments(t),l.properties.push(r)}}),n.properties.push(t)}),n}var u=function(e){return e&&e.__esModule?e["default"]:e};l.push=t,l.toClassObject=r,l.toDefineObject=a;var o=(u(e("lodash/lang/cloneDeep")),u(e("../../traversal"))),s=u(e("lodash/collection/each")),i=u(e("lodash/object/has")),c=u(e("../../types"));l.__esModule=!0},{"../../traversal":117,"../../types":122,"lodash/collection/each":202,"lodash/lang/cloneDeep":288,"lodash/object/has":304}],34:[function(e,n){"use strict";var l=function(e){return e&&e.__esModule?e["default"]:e},t=l(e("../../types")),r=function(e,n,l,r){var a;if(t.isIdentifier(e)){if(r.hasBinding(e.name))return e;a=e}else{if(!t.isMemberExpression(e))throw new Error("We can't explode this node type "+e.type);if(a=e.object,t.isIdentifier(a)&&r.hasGlobal(a.name))return a}var u=r.generateUidBasedOnNode(a);return n.push(t.variableDeclaration("var",[t.variableDeclarator(u,a)])),u},a=function(e,n,l,r){var a=e.property,u=t.toComputedKey(e,a);if(t.isLiteral(u))return u;var o=r.generateUidBasedOnNode(a);return n.push(t.variableDeclaration("var",[t.variableDeclarator(o,a)])),o};n.exports=function(e,n,l,u,o){var s;s=t.isIdentifier(e)&&o?e:r(e,n,l,u);var i,c;if(t.isIdentifier(e))i=e,c=s;else{var p=a(e,n,l,u),d=e.computed||t.isLiteral(p);c=i=t.memberExpression(s,p,d)}return{uid:c,ref:i}}},{"../../types":122}],35:[function(e,n){"use strict";var l=function(e){return e&&e.__esModule?e["default"]:e},t=l(e("../../types"));n.exports=function(e){for(var n=0,l=0;l<e.params.length;l++)t.isAssignmentPattern(e.params[l])||(n=l+1);return n}},{"../../types":122}],36:[function(e,n,l){"use strict";function t(e,n,l){var t=f(e,n.name,l);return d(t,e,n,l)}function r(e,n,l){var t=c.toComputedKey(e,e.key);if(!c.isLiteral(t))return e;var r=c.toIdentifier(t.value),a=c.identifier(r),u=e.value,o=f(u,r,l);e.value=d(o,u,a,l)}function a(e,n,l){if(e.id)return e;var t;if(c.isProperty(n)&&"init"===n.kind&&!n.computed)t=n.key;else{if(!c.isVariableDeclarator(n))return e;t=n.id}if(!c.isIdentifier(t))return e;var r=c.toIdentifier(t.name);t=c.identifier(r);var a=f(e,r,l);return d(a,e,t,l)}var u=function(e){return e&&e.__esModule?e:{"default":e}},o=function(e){return e&&e.__esModule?e["default"]:e};l.custom=t,l.property=r,l.bare=a;var s=o(e("./get-function-arity")),i=u(e("../../util")),c=o(e("../../types")),p={enter:function(e,n,l,t){if(this.isReferencedIdentifier({name:t.name})){var r=l.getBindingIdentifier(t.name);r===t.outerDeclar&&(t.selfReference=!0,this.stop())}}},d=function(e,n,l,t){if(e.selfReference){var r="property-method-assignment-wrapper";n.generator&&(r+="-generator");for(var a=i.template(r,{FUNCTION:n,FUNCTION_ID:l,FUNCTION_KEY:t.generateUidIdentifier(l.name),WRAPPER_KEY:t.generateUidIdentifier(l.name+"Wrapper")}),u=a.callee.body.body[0].declarations[0].init.params,o=0,c=s(n);c>o;o++)u.push(t.generateUidIdentifier("x"));return a}return n.id=l,n},f=function(e,n,l){var t={selfAssignment:!1,selfReference:!1,outerDeclar:l.getBindingIdentifier(n),references:[],name:n},r=null;return r?"param"===r.kind&&(t.selfReference=!0):l.traverse(e,p,t),t};l.__esModule=!0},{"../../types":122,"../../util":124,"./get-function-arity":35}],37:[function(e,n,l){"use strict";function t(e){if(!e||!u.isCallExpression(e))return!1;if(!o(e.callee))return!1;var n=e.arguments;if(1!==n.length)return!1;var l=n[0];return u.isObjectExpression(l)?!0:!1}function r(e){return e&&/^[a-z]|\-/.test(e)}var a=function(e){return e&&e.__esModule?e["default"]:e};l.isCreateClass=t,l.isCompatTag=r;{var u=a(e("../../types")),o=u.buildMatchMemberExpression("React.createClass");l.isReactComponent=u.buildMatchMemberExpression("React.Component")}l.__esModule=!0},{"../../types":122}],38:[function(e,n,l){"use strict";function t(e,n){return o.isLiteral(e)&&e.regex&&e.regex.flags.indexOf(n)>=0}function r(e){var n=e.regex.flags.split("");e.regex.flags.indexOf("u")<0||(u(n,"u"),e.regex.flags=n.join(""))}var a=function(e){return e&&e.__esModule?e["default"]:e};l.is=t,l.pullFlag=r;var u=a(e("lodash/array/pull")),o=a(e("../../types"));l.__esModule=!0},{"../../types":122,"lodash/array/pull":199}],39:[function(e,n){"use strict";var l=function(e){return e&&e.__esModule?e["default"]:e},t=l(e("../../types")),r={enter:function(e){t.isFunction(e)&&this.skip(),t.isAwaitExpression(e)&&(e.type="YieldExpression",e.all&&(e.all=!1,e.argument=t.callExpression(t.memberExpression(t.identifier("Promise"),t.identifier("all")),[e.argument])))}};n.exports=function(e,n,l){e.async=!1,e.generator=!0,l.traverse(e,r);var a=t.callExpression(n,[e]),u=e.id;if(e.id=null,t.isFunctionDeclaration(e)){var o=t.variableDeclaration("let",[t.variableDeclarator(u,a)]);return o._blockHoist=!0,o}return a}},{"../../types":122}],40:[function(e,n){"use strict";function l(e,n){return t(e,n)?i.isMemberExpression(n,{computed:!1})?!1:i.isCallExpression(n,{callee:e})?!1:!0:!1}function t(e,n){return i.isIdentifier(e,{name:"super"})&&i.isReferenced(e,n)}var r=function(e){return e&&e.__esModule?e["default"]:e},a=function(e){return e&&e.__esModule?e:{"default":e}},u=function(e){if(Array.isArray(e)){for(var n=0,l=Array(e.length);n<e.length;n++)l[n]=e[n];return l}return Array.from(e)},o=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")};n.exports=p;var s=a(e("../../messages")),i=r(e("../../types")),c={enter:function(e,n,l,t){var r=t.topLevel,a=t.self;if(i.isFunction(e)&&!i.isArrowFunctionExpression(e))return a.traverseLevel(e,!1),this.skip();if(i.isProperty(e,{method:!0})||i.isMethodDefinition(e))return this.skip();var u=r?i.thisExpression:a.getThisReference.bind(a),o=a.specHandle;return a.isLoose&&(o=a.looseHandle),o.call(a,u,e,n)}},p=function(){function e(n,l){o(this,e),this.topLevelThisReference=n.topLevelThisReference,this.methodNode=n.methodNode,this.superRef=n.superRef,this.isStatic=n.isStatic,this.hasSuper=!1,this.inClass=l,this.isLoose=n.isLoose,this.scope=n.scope,this.file=n.file,this.opts=n}return e.prototype.getObjectRef=function(){return this.opts.objectRef||this.opts.getObjectRef()},e.prototype.setSuperProperty=function(e,n,l,t){return i.callExpression(this.file.addHelper("set"),[i.callExpression(i.memberExpression(i.identifier("Object"),i.identifier("getPrototypeOf")),[this.isStatic?this.getObjectRef():i.memberExpression(this.getObjectRef(),i.identifier("prototype"))]),l?e:i.literal(e.name),n,t])},e.prototype.getSuperProperty=function(e,n,l){return i.callExpression(this.file.addHelper("get"),[i.callExpression(i.memberExpression(i.identifier("Object"),i.identifier("getPrototypeOf")),[this.isStatic?this.getObjectRef():i.memberExpression(this.getObjectRef(),i.identifier("prototype"))]),n?e:i.literal(e.name),l])},e.prototype.replace=function(){this.traverseLevel(this.methodNode.value,!0)},e.prototype.traverseLevel=function(e,n){var l={self:this,topLevel:n};this.scope.traverse(e,c,l)},e.prototype.getThisReference=function(){if(this.topLevelThisReference)return this.topLevelThisReference;var e=this.topLevelThisReference=this.scope.generateUidIdentifier("this");return this.methodNode.value.body.body.unshift(i.variableDeclaration("var",[i.variableDeclarator(this.topLevelThisReference,i.thisExpression())])),e},e.prototype.getLooseSuperProperty=function(e,n){var l=this.methodNode,t=l.key,r=this.superRef||i.identifier("Function");return n.property===e?void 0:i.isCallExpression(n,{callee:e})?(n.arguments.unshift(i.thisExpression()),"constructor"===t.name?i.memberExpression(r,i.identifier("call")):(e=r,l["static"]||(e=i.memberExpression(e,i.identifier("prototype"))),e=i.memberExpression(e,t,l.computed),i.memberExpression(e,i.identifier("call")))):i.isMemberExpression(n)&&!l["static"]?i.memberExpression(r,i.identifier("prototype")):r},e.prototype.looseHandle=function(e,n,l){if(i.isIdentifier(n,{name:"super"}))return this.hasSuper=!0,this.getLooseSuperProperty(n,l);if(i.isCallExpression(n)){var t=n.callee;if(!i.isMemberExpression(t))return;if("super"!==t.object.name)return;this.hasSuper=!0,i.appendToMemberExpression(t,i.identifier("call")),n.arguments.unshift(e())}},e.prototype.specHandle=function(e,n,r){var a,o,c,p,d=this.methodNode;if(l(n,r))throw this.file.errorWithNode(n,s.get("classesIllegalBareSuper"));if(i.isCallExpression(n)){var f=n.callee;if(t(f,n)){if(a=d.key,o=d.computed,c=n.arguments,"constructor"!==d.key.name||!this.inClass){var h=d.key.name||"METHOD_NAME";throw this.file.errorWithNode(n,s.get("classesIllegalSuperCall",h))}}else i.isMemberExpression(f)&&t(f.object,f)&&(a=f.property,o=f.computed,c=n.arguments)}else if(i.isMemberExpression(n)&&t(n.object,n))a=n.property,o=n.computed; else if(i.isAssignmentExpression(n)&&t(n.left.object,n.left)&&"set"===d.kind)return this.hasSuper=!0,this.setSuperProperty(n.left.property,n.right,n.left.computed,e());if(a){this.hasSuper=!0,p=e();var g=this.getSuperProperty(a,o,p);return c?1===c.length&&i.isSpreadElement(c[0])?i.callExpression(i.memberExpression(g,i.identifier("apply")),[p,c[0].argument]):i.callExpression(i.memberExpression(g,i.identifier("call")),[p].concat(u(c))):g}},e}();n.exports=p},{"../../messages":26,"../../types":122}],41:[function(e,n,l){"use strict";function t(e){var n=e.body[0];return u.isExpressionStatement(n)&&u.isLiteral(n.expression,{value:"use strict"})}function r(e,n){var l;t(e)&&(l=e.body.shift()),n(),l&&e.body.unshift(l)}var a=function(e){return e&&e.__esModule?e["default"]:e};l.has=t,l.wrap=r;var u=a(e("../../types"));l.__esModule=!0},{"../../types":122}],42:[function(e,n){"use strict";function l(e,n){var l=new o(n);return l.parse(e)}var t=function(e){return e&&e.__esModule?e["default"]:e};n.exports=l;var r=t(e("../helpers/normalize-ast")),a=t(e("./transformer")),u=t(e("../helpers/object")),o=t(e("./file")),s=t(e("lodash/collection/each"));l.fromAst=function(e,n,l){e=r(e);var t=new o(l);return t.addCode(n),t.transform(e),t.generate()},l._ensureTransformerNames=function(e,n){for(var t=[],r=0;r<n.length;r++){var a=n[r],u=l.deprecatedTransformerMap[a],o=l.aliasTransformerMap[a];if(o)t.push(o);else if(u)console.error("The transformer "+a+" has been renamed to "+u),n.push(u);else if(l.transformers[a])t.push(a);else{if(!l.namespaces[a])throw new ReferenceError("Unknown transformer "+a+" specified in "+e);t=t.concat(l.namespaces[a])}}return t},l.transformerNamespaces=u(),l.transformers=u(),l.namespaces=u(),l.deprecatedTransformerMap=e("./transformers/deprecated"),l.aliasTransformerMap=e("./transformers/aliases"),l.moduleFormatters=e("./modules");var i=t(e("./transformers"));s(i,function(e,n){var t=n.split(".")[0],r=l.namespaces,u=t;r[u]||(r[u]=[]),l.namespaces[t].push(n),l.transformerNamespaces[n]=t,l.transformers[n]=new a(n,e)})},{"../helpers/normalize-ast":23,"../helpers/object":24,"./file":28,"./modules":50,"./transformer":55,"./transformers":83,"./transformers/aliases":56,"./transformers/deprecated":57,"lodash/collection/each":202}],43:[function(e,n){"use strict";var l=function(e){return e&&e.__esModule?e["default"]:e},t=function(e){return e&&e.__esModule?e:{"default":e}},r=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},a=t(e("../../messages")),u=l(e("lodash/object/extend")),o=l(e("../../helpers/object")),s=t(e("../../util")),i=l(e("../../types")),c={enter:function(e,n,l,t){if(i.isUpdateExpression(e)&&t.isLocalReference(e.argument,l)){this.skip();var r=i.assignmentExpression(e.operator[0]+"=",e.argument,i.literal(1)),a=t.remapExportAssignment(r);if(i.isExpressionStatement(n)||e.prefix)return a;var u=[];u.push(a);var o;return o="--"===e.operator?"+":"-",u.push(i.binaryExpression(o,e.argument,i.literal(1))),i.sequenceExpression(u)}return i.isAssignmentExpression(e)&&t.isLocalReference(e.left,l)?(this.skip(),t.remapExportAssignment(e)):void 0}},p={enter:function(e,n,l,t){i.isImportDeclaration(e)&&(t.hasLocalImports=!0,u(t.localImports,i.getBindingIdentifiers(e)),t.bumpImportOccurences(e))}},d={enter:function(e,n,l,t){var r=e&&e.declaration;i.isExportDeclaration(e)&&(t.hasLocalImports=!0,r&&i.isStatement(r)&&u(t.localExports,i.getBindingIdentifiers(r)),e["default"]||(t.hasNonDefaultExports=!0),e.source&&t.bumpImportOccurences(e))}},f=function(){function e(n){r(this,e),this.scope=n.scope,this.file=n,this.ids=o(),this.hasNonDefaultExports=!1,this.hasLocalExports=!1,this.hasLocalImports=!1,this.localImportOccurences=o(),this.localExports=o(),this.localImports=o(),this.getLocalExports(),this.getLocalImports(),this.remapAssignments()}return e.prototype.doDefaultExportInterop=function(e){return e["default"]&&!this.noInteropRequireExport&&!this.hasNonDefaultExports},e.prototype.bumpImportOccurences=function(e){var n=e.source.value,l=this.localImportOccurences,t=l,r=n;t[r]||(t[r]=0),l[n]+=e.specifiers.length},e.prototype.getLocalExports=function(){this.file.scope.traverse(this.file.ast,d,this)},e.prototype.getLocalImports=function(){this.file.scope.traverse(this.file.ast,p,this)},e.prototype.remapAssignments=function(){this.hasLocalImports&&this.file.scope.traverse(this.file.ast,c,this)},e.prototype.isLocalReference=function(e){var n=this.localImports;return i.isIdentifier(e)&&n[e.name]&&n[e.name]!==e},e.prototype.remapExportAssignment=function(e){return i.assignmentExpression("=",e.left,i.assignmentExpression(e.operator,i.memberExpression(i.identifier("exports"),e.left),e.right))},e.prototype.isLocalReference=function(e,n){var l=this.localExports,t=e.name;return i.isIdentifier(e)&&l[t]&&l[t]===n.getBindingIdentifier(t)},e.prototype.getModuleName=function(){var e=this.file.opts;if(e.moduleId)return e.moduleId;var n=e.filenameRelative,l="";if(e.moduleRoot&&(l=e.moduleRoot+"/"),!e.filenameRelative)return l+e.filename.replace(/^\//,"");if(e.sourceRoot){var t=new RegExp("^"+e.sourceRoot+"/?");n=n.replace(t,"")}return e.keepModuleIdExtensions||(n=n.replace(/\.(\w*?)$/,"")),l+=n,l=l.replace(/\\/g,"/")},e.prototype._pushStatement=function(e,n){return(i.isClass(e)||i.isFunction(e))&&e.id&&(n.push(i.toStatement(e)),e=e.id),e},e.prototype._hoistExport=function(e,n,l){return i.isFunctionDeclaration(e)&&(n._blockHoist=l||2),n},e.prototype.getExternalReference=function(e,n){var l=this.ids,t=e.source.value;return l[t]?l[t]:this.ids[t]=this._getExternalReference(e,n)},e.prototype.checkExportIdentifier=function(e){if(i.isIdentifier(e,{name:"__esModule"}))throw this.file.errorWithNode(e,a.get("modulesIllegalExportName",e.name))},e.prototype.exportSpecifier=function(e,n,l){if(n.source){var t=this.getExternalReference(n,l);i.isExportBatchSpecifier(e)?l.push(this.buildExportsWildcard(t,n)):(t=i.isSpecifierDefault(e)&&!this.noInteropRequireExport?i.callExpression(this.file.addHelper("interop-require"),[t]):i.memberExpression(t,i.getSpecifierId(e)),l.push(this.buildExportsAssignment(i.getSpecifierName(e),t,n)))}else l.push(this.buildExportsAssignment(i.getSpecifierName(e),e.id,n))},e.prototype.buildExportsWildcard=function(e){return i.expressionStatement(i.callExpression(this.file.addHelper("defaults"),[i.identifier("exports"),i.callExpression(this.file.addHelper("interop-require-wildcard"),[e])]))},e.prototype.buildExportsAssignment=function(e,n){return this.checkExportIdentifier(e),s.template("exports-assign",{VALUE:n,KEY:e},!0)},e.prototype.exportDeclaration=function(e,n){var l=e.declaration,t=l.id;e["default"]&&(t=i.identifier("default"));var r;if(i.isVariableDeclaration(l))for(var a=0;a<l.declarations.length;a++){var u=l.declarations[a];u.init=this.buildExportsAssignment(u.id,u.init,e).expression;var o=i.variableDeclaration(l.kind,[u]);0===a&&i.inherits(o,l),n.push(o)}else{var s=l;(i.isFunctionDeclaration(l)||i.isClassDeclaration(l))&&(s=l.id,n.push(l)),r=this.buildExportsAssignment(t,s,e),n.push(r),this._hoistExport(l,r)}},e}();n.exports=f},{"../../helpers/object":24,"../../messages":26,"../../types":122,"../../util":124,"lodash/object/extend":303}],44:[function(e,n){"use strict";var l=function(e){return e&&e.__esModule?e:{"default":e}},t=l(e("../../util"));n.exports=function(e){var n=function(){this.noInteropRequireImport=!0,this.noInteropRequireExport=!0,e.apply(this,arguments)};return t.inherits(n,e),n}},{"../../util":124}],45:[function(e,n){"use strict";n.exports=e("./_strict")(e("./amd"))},{"./_strict":44,"./amd":46}],46:[function(e,n){"use strict";var l=function(e){return e&&e.__esModule?e:{"default":e}},t=function(e){return e&&e.__esModule?e["default"]:e},r=function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),n&&(e.__proto__=n)},a=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},u=t(e("./_default")),o=t(e("./common")),s=t(e("lodash/collection/includes")),i=t(e("lodash/object/values")),c=(l(e("../../util")),t(e("../../types"))),p=function(e){function n(){this.init=o.prototype.init,a(this,n),null!=e&&e.apply(this,arguments)}return r(n,e),n.prototype.buildDependencyLiterals=function(){var e=[];for(var n in this.ids)e.push(c.literal(n));return e},n.prototype.transform=function(e){var n=e.body,l=[c.literal("exports")];this.passModuleArg&&l.push(c.literal("module")),l=l.concat(this.buildDependencyLiterals()),l=c.arrayExpression(l);var t=i(this.ids);this.passModuleArg&&t.unshift(c.identifier("module")),t.unshift(c.identifier("exports"));var r=c.functionExpression(null,t,c.blockStatement(n)),a=[l,r],u=this.getModuleName();u&&a.unshift(c.literal(u));var o=c.callExpression(c.identifier("define"),a);e.body=[c.expressionStatement(o)]},n.prototype.getModuleName=function(){return this.file.opts.moduleIds?e.prototype.getModuleName.apply(this,arguments):null},n.prototype._getExternalReference=function(e){return this.scope.generateUidIdentifier(e.source.value)},n.prototype.importDeclaration=function(e){this.getExternalReference(e)},n.prototype.importSpecifier=function(e,n,l){var t=c.getSpecifierName(e),r=this.getExternalReference(n);s(this.file.dynamicImportedNoDefault,n)?this.ids[n.source.value]=r:c.isImportBatchSpecifier(e)||(r=s(this.file.dynamicImported,n)||!c.isSpecifierDefault(e)||this.noInteropRequireImport?c.memberExpression(r,c.getSpecifierId(e),!1):c.callExpression(this.file.addHelper("interop-require"),[r])),l.push(c.variableDeclaration("var",[c.variableDeclarator(t,r)]))},n.prototype.exportDeclaration=function(e){this.doDefaultExportInterop(e)&&(this.passModuleArg=!0),o.prototype.exportDeclaration.apply(this,arguments)},n}(u);n.exports=p},{"../../types":122,"../../util":124,"./_default":43,"./common":48,"lodash/collection/includes":205,"lodash/object/values":307}],47:[function(e,n){"use strict";n.exports=e("./_strict")(e("./common"))},{"./_strict":44,"./common":48}],48:[function(e,n){"use strict";var l=function(e){return e&&e.__esModule?e:{"default":e}},t=function(e){return e&&e.__esModule?e["default"]:e},r=function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),n&&(e.__proto__=n)},a=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},u=t(e("./_default")),o=t(e("lodash/collection/includes")),s=l(e("../../util")),i=t(e("../../types")),c=function(e){function n(){a(this,n),null!=e&&e.apply(this,arguments)}return r(n,e),n.prototype.init=function(){var e=this.file,n=e.scope;if(n.rename("module"),!this.noInteropRequireImport&&this.hasNonDefaultExports){var l="exports-module-declaration";this.file.isLoose("es6.modules")&&(l+="-loose"),e.ast.program.body.push(s.template(l,!0))}},n.prototype.importSpecifier=function(e,n,l){var t=i.getSpecifierName(e),r=this.getExternalReference(n,l);i.isSpecifierDefault(e)?(o(this.file.dynamicImportedNoDefault,n)||(r=this.noInteropRequireImport||o(this.file.dynamicImported,n)?i.memberExpression(r,i.identifier("default")):i.callExpression(this.file.addHelper("interop-require"),[r])),l.push(i.variableDeclaration("var",[i.variableDeclarator(t,r)]))):"ImportBatchSpecifier"===e.type?(this.noInteropRequireImport||(r=i.callExpression(this.file.addHelper("interop-require-wildcard"),[r])),l.push(i.variableDeclaration("var",[i.variableDeclarator(t,r)]))):l.push(i.variableDeclaration("var",[i.variableDeclarator(t,i.memberExpression(r,i.getSpecifierId(e)))]))},n.prototype.importDeclaration=function(e,n){n.push(s.template("require",{MODULE_NAME:e.source},!0))},n.prototype.exportDeclaration=function(n,l){if(this.doDefaultExportInterop(n)){var t=n.declaration,r=s.template("exports-default-assign",{VALUE:this._pushStatement(t,l)},!0);return i.isFunctionDeclaration(t)&&(r._blockHoist=3),void l.push(r)}e.prototype.exportDeclaration.apply(this,arguments)},n.prototype._getExternalReference=function(e,n){var l=e.source.value,t=i.callExpression(i.identifier("require"),[e.source]);if(this.localImportOccurences[l]>1){var r=this.scope.generateUidIdentifier(l);return n.push(i.variableDeclaration("var",[i.variableDeclarator(r,t)])),r}return t},n}(u);n.exports=c},{"../../types":122,"../../util":124,"./_default":43,"lodash/collection/includes":205}],49:[function(e,n){"use strict";var l=function(e){return e&&e.__esModule?e["default"]:e},t=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},r=l(e("../../types")),a=function(){function e(){t(this,e)}return e.prototype.exportDeclaration=function(e,n){var l=r.toStatement(e.declaration,!0);l&&n.push(r.inherits(l,e))},e.prototype.importDeclaration=function(){},e.prototype.importSpecifier=function(){},e.prototype.exportSpecifier=function(){},e}();n.exports=a},{"../../types":122}],50:[function(e,n){"use strict";n.exports={commonStrict:e("./common-strict"),amdStrict:e("./amd-strict"),umdStrict:e("./umd-strict"),common:e("./common"),system:e("./system"),ignore:e("./ignore"),amd:e("./amd"),umd:e("./umd")}},{"./amd":46,"./amd-strict":45,"./common":48,"./common-strict":47,"./ignore":49,"./system":51,"./umd":53,"./umd-strict":52}],51:[function(e,n){"use strict";var l=function(e){return e&&e.__esModule?e:{"default":e}},t=function(e){return e&&e.__esModule?e["default"]:e},r=function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),n&&(e.__proto__=n)},a=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},u=t(e("./_default")),o=t(e("./amd")),s=l(e("../../util")),i=t(e("lodash/array/last")),c=t(e("lodash/collection/each")),p=t(e("lodash/collection/map")),d=t(e("../../types")),f={enter:function(e,n,l,t){if(d.isFunction(e))return this.skip();if(d.isVariableDeclaration(e)){if("var"!==e.kind&&!d.isProgram(n))return;if(e._blockHoist)return;for(var r=[],a=0;a<e.declarations.length;a++){var u=e.declarations[a];if(t.push(d.variableDeclarator(u.id)),u.init){var o=d.expressionStatement(d.assignmentExpression("=",u.id,u.init));r.push(o)}}if(d.isFor(n)){if(n.left===e)return e.declarations[0].id;if(n.init===e)return d.toSequenceExpression(r,l)}return r}}},h={enter:function(e,n,l,t){d.isFunction(e)&&this.skip(),(d.isFunctionDeclaration(e)||e._blockHoist)&&(t.push(e),this.remove())}},g={enter:function(e,n,l,t){e._importSource===t.source&&(d.isVariableDeclaration(e)?c(e.declarations,function(e){t.hoistDeclarators.push(d.variableDeclarator(e.id)),t.nodes.push(d.expressionStatement(d.assignmentExpression("=",e.id,e.init)))}):t.nodes.push(e),this.remove())}},m=function(e){function n(e){a(this,n),this.exportIdentifier=e.scope.generateUidIdentifier("export"),this.noInteropRequireExport=!0,this.noInteropRequireImport=!0,u.apply(this,arguments)}return r(n,e),n.prototype.init=function(){},n.prototype._addImportSource=function(e,n){return e._importSource=n.source&&n.source.value,e},n.prototype.buildExportsWildcard=function(e,n){var l=this.scope.generateUidIdentifier("key"),t=d.memberExpression(e,l,!0),r=d.variableDeclaration("var",[d.variableDeclarator(l)]),a=e,u=d.blockStatement([d.expressionStatement(this.buildExportCall(l,t))]);return this._addImportSource(d.forInStatement(r,a,u),n)},n.prototype.buildExportsAssignment=function(e,n,l){var t=this.buildExportCall(d.literal(e.name),n,!0);return this._addImportSource(t,l)},n.prototype.remapExportAssignment=function(e){return this.buildExportCall(d.literal(e.left.name),e)},n.prototype.buildExportCall=function(e,n,l){var t=d.callExpression(this.exportIdentifier,[e,n]);return l?d.expressionStatement(t):t},n.prototype.importSpecifier=function(n,l,t){e.prototype.importSpecifier.apply(this,arguments),this._addImportSource(i(t),l)},n.prototype.buildRunnerSetters=function(e,n){var l=this.file.scope;return d.arrayExpression(p(this.ids,function(t,r){var a={hoistDeclarators:n,source:r,nodes:[]};return l.traverse(e,g,a),d.functionExpression(null,[t],d.blockStatement(a.nodes))}))},n.prototype.transform=function(e){var n=[],l=this.getModuleName(),t=d.literal(l),r=d.blockStatement(e.body),a=s.template("system",{MODULE_DEPENDENCIES:d.arrayExpression(this.buildDependencyLiterals()),EXPORT_IDENTIFIER:this.exportIdentifier,MODULE_NAME:t,SETTERS:this.buildRunnerSetters(r,n),EXECUTE:d.functionExpression(null,[],r)},!0),u=a.expression.arguments[2].body.body;l||a.expression.arguments.shift();var o=u.pop();if(this.file.scope.traverse(r,f,n),n.length){var i=d.variableDeclaration("var",n);i._blockHoist=!0,u.unshift(i)}this.file.scope.traverse(r,h,u),u.push(o),e.body=[a]},n}(o);n.exports=m},{"../../types":122,"../../util":124,"./_default":43,"./amd":46,"lodash/array/last":198,"lodash/collection/each":202,"lodash/collection/map":206}],52:[function(e,n){"use strict";n.exports=e("./_strict")(e("./umd"))},{"./_strict":44,"./umd":53}],53:[function(e,n){"use strict";var l=function(e){return e&&e.__esModule?e:{"default":e}},t=function(e){return e&&e.__esModule?e["default"]:e},r=function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),n&&(e.__proto__=n)},a=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},u=t(e("./amd")),o=t(e("lodash/object/values")),s=l(e("../../util")),i=t(e("../../types")),c=function(e){function n(){a(this,n),null!=e&&e.apply(this,arguments)}return r(n,e),n.prototype.transform=function(e){var n=e.body,l=[];for(var t in this.ids)l.push(i.literal(t));var r=o(this.ids),a=[i.identifier("exports")];this.passModuleArg&&a.push(i.identifier("module")),a=a.concat(r);var u=i.functionExpression(null,a,i.blockStatement(n)),c=[i.literal("exports")];this.passModuleArg&&c.push(i.literal("module")),c=c.concat(l),c=[i.arrayExpression(c)];var p=s.template("test-exports"),d=s.template("test-module"),f=this.passModuleArg?i.logicalExpression("&&",p,d):p,h=[i.identifier("exports")];this.passModuleArg&&h.push(i.identifier("module")),h=h.concat(l.map(function(e){return i.callExpression(i.identifier("require"),[e])}));var g=this.getModuleName();g&&c.unshift(i.literal(g));var m=s.template("umd-runner-body",{AMD_ARGUMENTS:c,COMMON_TEST:f,COMMON_ARGUMENTS:h}),y=i.callExpression(m,[u]);e.body=[i.expressionStatement(y)]},n}(u);n.exports=c},{"../../types":122,"../../util":124,"./amd":46,"lodash/object/values":307}],54:[function(e,n){"use strict";var l=function(e){return e&&e.__esModule?e["default"]:e},t=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},r=l(e("lodash/collection/includes")),a=function(){function e(n,l){t(this,e),this.transformer=l,this.shouldRun=!l.check,this.handlers=l.handlers,this.file=n}return e.prototype.canRun=function(){var e=this.transformer,n=this.file.opts,l=e.key;if("_"===l[0])return!0;var t=n.blacklist;if(t.length&&r(t,l))return!1;var a=n.whitelist;return a.length?r(a,l):e.optional&&!r(n.optional,l)?!1:e.experimental&&!n.experimental?!1:e.playground&&!n.playground?!1:!0},e.prototype.checkNode=function(e){var n=this.transformer.check;return n?this.shouldRun=n(e):!0},e.prototype.transform=function(){if(this.shouldRun){var e=this.file;e.debug("Running transformer "+this.transformer.key),e.scope.traverse(e.ast,this.handlers,e)}},e}();n.exports=a},{"lodash/collection/includes":205}],55:[function(e,n){"use strict";var l=function(e){return e&&e.__esModule?e["default"]:e},t=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},r=l(e("./transformer-pass")),a=l(e("lodash/lang/isFunction")),u=l(e("../traversal")),o=l(e("lodash/lang/isObject")),s=l(e("lodash/object/assign")),i=l(e("lodash/collection/each")),c=function(){function e(n,l){t(this,e),l=s({},l);var r=function(e){var n=l[e];return delete l[e],n};this.manipulateOptions=r("manipulateOptions"),this.check=r("check"),this.post=r("post"),this.pre=r("pre"),this.experimental=!!r("experimental"),this.playground=!!r("playground"),this.secondPass=!!r("secondPass"),this.optional=!!r("optional"),this.handlers=this.normalize(l);var a=this;a.opts||(a.opts={}),this.key=n}return e.prototype.normalize=function(e){var n=this;return a(e)&&(e={ast:e}),u.explode(e),i(e,function(l,t){return"_"===t[0]?void(n[t]=l):void("enter"!==t&&"exit"!==t&&(a(l)&&(l={enter:l}),o(l)&&(l.enter||(l.enter=function(){}),l.exit||(l.exit=function(){}),e[t]=l)))}),e},e.prototype.buildPass=function(e){return new r(e,this)},e}();n.exports=c},{"../traversal":117,"./transformer-pass":54,"lodash/collection/each":202,"lodash/lang/isFunction":293,"lodash/lang/isObject":296,"lodash/object/assign":301}],56:[function(e,n){n.exports={useStrict:"strict"}},{}],57:[function(e,n){n.exports={selfContained:"runtime","unicode-regex":"regex.unicode","minification.deadCodeElimination":"utility.deadCodeElimination","minification.removeConsoleCalls":"utility.removeConsole","minification.removeDebugger":"utility.removeDebugger"}},{}],58:[function(e,n,l){"use strict";function t(e){var n=e.property;e.computed&&a.isLiteral(n)&&a.isValidIdentifier(n.value)?(e.property=a.identifier(n.value),e.computed=!1):e.computed||!a.isIdentifier(n)||a.isValidIdentifier(n.name)||(e.property=a.literal(n.name),e.computed=!0)}var r=function(e){return e&&e.__esModule?e["default"]:e};l.MemberExpression=t;var a=r(e("../../../types"));l.__esModule=!0},{"../../../types":122}],59:[function(e,n,l){"use strict";function t(e){var n=e.key;a.isLiteral(n)&&a.isValidIdentifier(n.value)?(e.key=a.identifier(n.value),e.computed=!1):e.computed||!a.isIdentifier(n)||a.isValidIdentifier(n.name)||(e.key=a.literal(n.name))}var r=function(e){return e&&e.__esModule?e["default"]:e};l.Property=t;var a=r(e("../../../types"));l.__esModule=!0},{"../../../types":122}],60:[function(e,n,l){"use strict";function t(e){return s.isProperty(e)&&("get"===e.kind||"set"===e.kind)}function r(e){var n={},l=!1;return e.properties=e.properties.filter(function(e){return"get"===e.kind||"set"===e.kind?(l=!0,o.push(n,e.key,e.kind,e.computed,e.value),!1):!0}),l?s.callExpression(s.memberExpression(s.identifier("Object"),s.identifier("defineProperties")),[e,o.toDefineObject(n)]):void 0}var a=function(e){return e&&e.__esModule?e["default"]:e},u=function(e){return e&&e.__esModule?e:{"default":e}};l.check=t,l.ObjectExpression=r;var o=u(e("../../helpers/define-map")),s=a(e("../../../types"));l.__esModule=!0},{"../../../types":122,"../../helpers/define-map":33}],61:[function(e,n,l){"use strict";function t(e){return a.ensureBlock(e),e._aliasFunction="arrow",e.expression=!1,e.type="FunctionExpression",e}var r=function(e){return e&&e.__esModule?e["default"]:e};l.ArrowFunctionExpression=t;{var a=r(e("../../../types"));l.check=a.isArrowFunctionExpression}l.__esModule=!0},{"../../../types":122}],62:[function(e,n,l){"use strict";function t(e,n,l,t){var r=e._letReferences;r&&l.traverse(e,u,{letRefs:r,file:t})}var r=function(e){return e&&e.__esModule?e["default"]:e};l.BlockStatement=t;{var a=r(e("../../../types")),u={enter:function(e,n,l,t){if(this.isReferencedIdentifier()){var r=t.letRefs[e.name];if(r&&l.getBindingIdentifier(e.name)===r){var u=a.callExpression(t.file.addHelper("temporal-assert-defined"),[e,a.literal(e.name),t.file.addHelper("temporal-undefined")]);return this.skip(),a.isAssignmentExpression(n)||a.isUpdateExpression(n)?void(n._ignoreBlockScopingTDZ||(this.parentPath.node=a.sequenceExpression([u,n]))):a.logicalExpression("&&",u,e)}}}};l.optional=!0}l.Program=t,l.Loop=t,l.__esModule=!0},{"../../../types":122}],63:[function(e,n,l){"use strict";function t(e,n){if(!x.isVariableDeclaration(e))return!1;if(e._let)return!0;if("let"!==e.kind)return!1;if(r(e,n))for(var l=0;l<e.declarations.length;l++){var t=e.declarations[l],a=t;a.init||(a.init=x.identifier("undefined"))}return e._let=!0,e.kind="var",!0}function r(e,n){return!x.isFor(n)||!x.isFor(n,{left:e})}function a(e,n){return x.isVariableDeclaration(e,{kind:"var"})&&!t(e,n)}function u(e){for(var n=0;n<e.length;n++)delete e[n]._let}function o(e){return x.isVariableDeclaration(e)&&("let"===e.kind||"const"===e.kind)}function s(e,n,l,a){if(t(e,n)&&r(e)&&a.transformers["es6.blockScopingTDZ"].canRun()){for(var u=[e],o=0;o<e.declarations.length;o++){var s=e.declarations[o];if(s.init){var i=x.assignmentExpression("=",s.id,s.init);i._ignoreBlockScopingTDZ=!0,u.push(x.expressionStatement(i))}s.init=a.addHelper("temporal-undefined")}return e._blockHoist=2,u}}function i(e,n,l,r){var a=e.left||e.init;t(a,e)&&(x.ensureBlock(e),e.body._letDeclarators=[a]);var u=new A(e,e.body,n,l,r);u.run()}function c(e,n,l,t){if(!x.isLoop(n)){var r=new A(!1,e,n,l,t);r.run()}}function p(e,n,l,t){if(x.isReferencedIdentifier(e,n)){var r=t[e.name];if(r){var a=l.getBindingIdentifier(e.name);a===r.binding?e.name=r.uid:this&&this.skip()}}}function d(e,n,l,t){p(e,n,l,t),l.traverse(e,I,t)}var f=function(e){return e&&e.__esModule?e:{"default":e}},h=function(e){return e&&e.__esModule?e["default"]:e},g=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")};l.check=o,l.VariableDeclaration=s,l.Loop=i,l.BlockStatement=c;var m=h(e("../../../traversal")),y=h(e("../../../helpers/object")),_=f(e("../../../util")),x=h(e("../../../types")),b=h(e("lodash/object/values")),v=h(e("lodash/object/extend"));l.Program=c;var I={enter:p},w={enter:function(e,n,l,t){return this.isFunction()?(l.traverse(e,E,t),this.skip()):void 0}},E={enter:function(e,n,l,t){this.isReferencedIdentifier()&&(l.hasOwnBinding(e.name)||t.letReferences[e.name]&&(t.closurify=!0))}},k={enter:function(e,n,l,t){if(this.isForStatement())a(e.init,e)&&(e.init=x.sequenceExpression(t.pushDeclar(e.init)));else if(this.isFor())a(e.left,e)&&(e.left=e.left.declarations[0].id);else{if(a(e,n))return t.pushDeclar(e).map(x.expressionStatement);if(this.isFunction())return this.skip()}}},R={enter:function(e,n,l,t){this.isLabeledStatement()&&t.innerLabels.push(e.label.name)}},S=function(e){return x.isBreakStatement(e)?"break":x.isContinueStatement(e)?"continue":void 0},C={enter:function(e,n,l,t){var r;if(this.isLoop()&&(t.ignoreLabeless=!0,l.traverse(e,C,t),t.ignoreLabeless=!1),this.isFunction()||this.isLoop())return this.skip();var a=S(e);if(a){if(e.label){if(t.innerLabels.indexOf(e.label.name)>=0)return;a=""+a+"|"+e.label.name}else{if(t.ignoreLabeless)return;if(x.isBreakStatement(e)&&x.isSwitchCase(n))return}t.hasBreakContinue=!0,t.map[a]=e,r=x.literal(a)}return this.isReturnStatement()&&(t.hasReturn=!0,r=x.objectExpression([x.property("init",x.identifier("v"),e.argument||x.identifier("undefined"))])),r?(r=x.returnStatement(r),x.inherits(r,e)):void 0}},A=function(){function e(n,l,t,r,a){g(this,e),this.loopParent=n,this.parent=t,this.scope=r,this.block=l,this.file=a,this.outsideLetReferences=y(),this.hasLetReferences=!1,this.letReferences=l._letReferences=y(),this.body=[]}return e.prototype.run=function(){var e=this.block;if(!e._letDone){e._letDone=!0;var n=this.getLetReferences();x.isFunction(this.parent)||x.isProgram(this.block)||this.hasLetReferences&&(n?this.wrapClosure():this.remap())}},e.prototype.remap=function(){var e=!1,n=this.letReferences,l=this.scope,t=y();for(var r in n){var a=n[r];if(l.parentHasBinding(r)||l.hasGlobal(r)){var u=l.generateUidIdentifier(a.name).name;a.name=u,e=!0,t[r]=t[u]={binding:a,uid:u}}}if(e){var o=this.loopParent;o&&(d(o.right,o,l,t),d(o.test,o,l,t),d(o.update,o,l,t)),l.traverse(this.block,I,t)}},e.prototype.wrapClosure=function(){var e=this.block,n=this.outsideLetReferences;if(this.loopParent)for(var l in n){var t=n[l];(this.scope.hasGlobal(t.name)||this.scope.parentHasBinding(t.name))&&(delete n[t.name],delete this.letReferences[t.name],this.scope.rename(t.name),this.letReferences[t.name]=t,n[t.name]=t)}this.has=this.checkLoop(),this.hoistVarDeclarations();var r=b(n),a=x.functionExpression(null,r,x.blockStatement(e.body));a._aliasFunction=!0,e.body=this.body;var u=x.callExpression(a,r),o=this.scope.generateUidIdentifier("ret"),s=m.hasType(a.body,this.scope,"YieldExpression",x.FUNCTION_TYPES);s&&(a.generator=!0,u=x.yieldExpression(u,!0));var i=m.hasType(a.body,this.scope,"AwaitExpression",x.FUNCTION_TYPES);i&&(a.async=!0,u=x.awaitExpression(u,!0)),this.build(o,u)},e.prototype.getLetReferences=function(){for(var e,n=this.block,l=n._letDeclarators||[],r=0;r<l.length;r++)e=l[r],v(this.outsideLetReferences,x.getBindingIdentifiers(e));if(n.body)for(r=0;r<n.body.length;r++)e=n.body[r],t(e,n)&&(l=l.concat(e.declarations));for(r=0;r<l.length;r++){e=l[r];var a=x.getBindingIdentifiers(e);v(this.letReferences,a),this.hasLetReferences=!0}if(this.hasLetReferences){u(l);var o={letReferences:this.letReferences,closurify:!1};return this.scope.traverse(this.block,w,o),o.closurify}},e.prototype.checkLoop=function(){var e={hasBreakContinue:!1,ignoreLabeless:!1,innerLabels:[],hasReturn:!1,isLoop:!!this.loopParent,map:{}};return this.scope.traverse(this.block,R,e),this.scope.traverse(this.block,C,e),e},e.prototype.hoistVarDeclarations=function(){m(this.block,k,this.scope,this)},e.prototype.pushDeclar=function(e){this.body.push(x.variableDeclaration(e.kind,e.declarations.map(function(e){return x.variableDeclarator(e.id)})));for(var n=[],l=0;l<e.declarations.length;l++){var t=e.declarations[l];if(t.init){var r=x.assignmentExpression("=",t.id,t.init);n.push(x.inherits(r,t))}}return n},e.prototype.build=function(e,n){var l=this.has;l.hasReturn||l.hasBreakContinue?this.buildHas(e,n):this.body.push(x.expressionStatement(n))},e.prototype.buildHas=function(e,n){var l=this.body;l.push(x.variableDeclaration("var",[x.variableDeclarator(e,n)]));var t,r=this.loopParent,a=this.has,u=[];if(a.hasReturn&&(t=_.template("let-scoping-return",{RETURN:e})),a.hasBreakContinue){if(!r)throw new Error("Has no loop parent but we're trying to reassign breaks and continues, something is going wrong here.");for(var o in a.map)u.push(x.switchCase(x.literal(o),[a.map[o]]));if(a.hasReturn&&u.push(x.switchCase(null,[t])),1===u.length){var s=u[0];l.push(this.file.attachAuxiliaryComment(x.ifStatement(x.binaryExpression("===",e,s.test),s.consequent[0])))}else l.push(this.file.attachAuxiliaryComment(x.switchStatement(e,u)))}else a.hasReturn&&l.push(this.file.attachAuxiliaryComment(t))},e}();l.__esModule=!0},{"../../../helpers/object":24,"../../../traversal":117,"../../../types":122,"../../../util":124,"lodash/object/extend":303,"lodash/object/values":307}],64:[function(e,n,l){"use strict";function t(e){return h.variableDeclaration("let",[h.variableDeclarator(e.id,h.toExpression(e))])}function r(e,n,l,t){return new g(e,n,l,t).run()}var a=function(e){return e&&e.__esModule?e:{"default":e}},u=function(e){return e&&e.__esModule?e["default"]:e},o=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")};l.ClassDeclaration=t,l.ClassExpression=r;var s=u(e("../../helpers/replace-supers")),i=a(e("../../helpers/name-method")),c=a(e("../../helpers/define-map")),p=a(e("../../../messages")),d=a(e("../../../util")),f=u(e("../../../traversal")),h=u(e("../../../types")),g=(l.check=h.isClass,f.explode({MethodDefinition:{enter:function(){this.skip()}},Property:{enter:function(e){e.method&&this.skip()}},CallExpression:{enter:function(e,n,l,t){if(h.isIdentifier(e.callee,{name:"super"})&&(t.hasBareSuper=!0,!t.hasSuper))throw t.file.errorWithNode(e,"super call is only allowed in derived constructor")}},ThisExpression:{enter:function(e,n,l,t){if(t.hasSuper&&!t.hasBareSuper)throw t.file.errorWithNode(e,"'this' is not allowed before super()")}}}),function(){function e(n,l,t,r){o(this,e),this.parent=l,this.scope=t,this.node=n,this.file=r,this.hasInstanceMutators=!1,this.hasStaticMutators=!1,this.instanceMutatorMap={},this.staticMutatorMap={},this.hasConstructor=!1,this.className=n.id,this.classRef=n.id||t.generateUidIdentifier("class"),this.superName=n.superClass||h.identifier("Function"),this.hasSuper=!!n.superClass,this.isLoose=r.isLoose("es6.classes") }return e.prototype.run=function(){var e,n=this.superName,l=(this.className,this.node.body.body,this.classRef),t=this.file,r=this.body=[],a=h.blockStatement([h.expressionStatement(h.callExpression(t.addHelper("class-call-check"),[h.thisExpression(),l]))]);this.className?(e=h.functionDeclaration(this.className,[],a),r.push(e)):e=h.functionExpression(null,[],a),this.constructor=e;var u=[],o=[];if(this.hasSuper&&(o.push(n),n=this.scope.generateUidBasedOnNode(n,this.file),u.push(n),this.superName=n,r.push(h.expressionStatement(h.callExpression(t.addHelper("inherits"),[l,n])))),this.buildBody(),this.className){if(1===r.length)return h.toExpression(r[0])}else e=i.bare(e,this.parent,this.scope),r.unshift(h.variableDeclaration("var",[h.variableDeclarator(l,e)])),h.inheritsComments(r[0],this.node);return r.push(h.returnStatement(l)),h.callExpression(h.functionExpression(null,u,h.blockStatement(r)),o)},e.prototype.buildBody=function(){for(var e=this.constructor,n=this.className,l=this.superName,t=this.node.body.body,r=this.body,a=0;a<t.length;a++){var u=t[a];if(h.isMethodDefinition(u)){var o=!u.computed&&h.isIdentifier(u.key,{name:"constructor"})||h.isLiteral(u.key,{value:"constructor"});o&&this.verifyConstructor(u);var i=new s({methodNode:u,objectRef:this.classRef,superRef:this.superName,isStatic:u["static"],isLoose:this.isLoose,scope:this.scope,file:this.file},!0);i.replace(),o?this.pushConstructor(u):this.pushMethod(u)}else h.isPrivateDeclaration(u)?(this.closure=!0,r.unshift(u)):h.isClassProperty(u)&&this.pushProperty(u)}if(!this.hasConstructor&&this.hasSuper&&h.evaluateTruthy(l,this.scope)!==!1){var p="class-super-constructor-call";this.isLoose&&(p+="-loose"),e.body.body.push(d.template(p,{CLASS_NAME:n,SUPER_NAME:this.superName},!0))}var f,g;if(this.hasInstanceMutators&&(f=c.toClassObject(this.instanceMutatorMap)),this.hasStaticMutators&&(g=c.toClassObject(this.staticMutatorMap)),f||g){f||(f=h.literal(null));var m=[this.classRef,f];g&&m.push(g),r.push(h.expressionStatement(h.callExpression(this.file.addHelper("create-class"),m)))}},e.prototype.verifyConstructor=function(e){return},e.prototype.pushMethod=function(e){var n=e.key,l=e.kind;if(""===l){if(i.property(e,this.file,this.scope),this.isLoose){var t=this.classRef;e["static"]||(t=h.memberExpression(t,h.identifier("prototype"))),n=h.memberExpression(t,n,e.computed);var r=h.expressionStatement(h.assignmentExpression("=",n,e.value));return h.inheritsComments(r,e),void this.body.push(r)}l="value"}var a=this.instanceMutatorMap;e["static"]?(this.hasStaticMutators=!0,a=this.staticMutatorMap):this.hasInstanceMutators=!0,c.push(a,n,l,e.computed,e)},e.prototype.pushProperty=function(e){if(e.value){var n;e["static"]?(n=h.memberExpression(this.classRef,e.key),this.body.push(h.expressionStatement(h.assignmentExpression("=",n,e.value)))):(n=h.memberExpression(h.thisExpression(),e.key),this.constructor.body.body.unshift(h.expressionStatement(h.assignmentExpression("=",n,e.value))))}},e.prototype.pushConstructor=function(e){if(e.kind)throw this.file.errorWithNode(e,p.get("classesIllegalConstructorKind"));var n=this.constructor,l=e.value;this.hasConstructor=!0,h.inherits(n,l),h.inheritsComments(n,e),n._ignoreUserWhitespace=!0,n.params=l.params,h.inherits(n.body,l.body),n.body.body=n.body.body.concat(l.body.body)},e}());l.__esModule=!0},{"../../../messages":26,"../../../traversal":117,"../../../types":122,"../../../util":124,"../../helpers/define-map":33,"../../helpers/name-method":36,"../../helpers/replace-supers":40}],65:[function(e,n,l){"use strict";function t(e){return i.isVariableDeclaration(e,{kind:"const"})}function r(e,n,l,t){l.traverse(e,c,{constants:l.getAllBindingsOfKind("const"),file:t})}function a(e){"const"===e.kind&&(e.kind="let")}var u=function(e){return e&&e.__esModule?e["default"]:e},o=function(e){return e&&e.__esModule?e:{"default":e}};l.check=t,l.Scopable=r,l.VariableDeclaration=a;var s=o(e("../../../messages")),i=u(e("../../../types")),c={enter:function(e,n,l,t){if(this.isAssignmentExpression()||this.isUpdateExpression()){var r=this.getBindingIdentifiers();for(var a in r){var u=r[a],o=t.constants[a];if(o){var i=o.identifier;if(u!==i&&l.bindingIdentifierEquals(a,i))throw t.file.errorWithNode(u,s.get("readOnly",a))}}}else this.isScope()&&this.skip()}};l.__esModule=!0},{"../../../messages":26,"../../../types":122}],66:[function(e,n,l){"use strict";function t(e,n,l,t){var r=e.left;if(f.isPattern(r)){var a=l.generateUidIdentifier("ref");return e.left=f.variableDeclaration("var",[f.variableDeclarator(a)]),f.ensureBlock(e),void e.body.body.unshift(f.variableDeclaration("var",[f.variableDeclarator(r,a)]))}if(f.isVariableDeclaration(r)){var u=r.declarations[0].id;if(f.isPattern(u)){var o=l.generateUidIdentifier("ref");e.left=f.variableDeclaration(r.kind,[f.variableDeclarator(o,null)]);var s=[],i=new g({kind:r.kind,file:t,scope:l,nodes:s});i.init(u,o),f.ensureBlock(e);var c=e.body;c.body=s.concat(c.body)}}}function r(e,n,l,t){var r=e.param;if(f.isPattern(r)){var a=l.generateUidIdentifier("ref");e.param=a;var u=[],o=new g({kind:"let",file:t,scope:l,nodes:u});return o.init(r,a),e.body.body=u.concat(e.body.body),e}}function a(e,n,l,t){var r=e.expression;if("AssignmentExpression"===r.type&&f.isPattern(r.left)&&!t.isConsequenceExpressionStatement(e)){var a=[],u=l.generateUidIdentifier("ref");a.push(f.variableDeclaration("var",[f.variableDeclarator(u,r.right)]));var o=new g({operator:r.operator,file:t,scope:l,nodes:a});return o.init(r.left,u),a}}function u(e,n,l,t){if(f.isPattern(e.left)){var r=l.generateUidIdentifier("temp");l.push({key:r.name,id:r});var a=[];a.push(f.assignmentExpression("=",r,e.right));var u=new g({operator:e.operator,file:t,scope:l,nodes:a});return u.init(e.left,r),a.push(r),f.toSequenceExpression(a,l)}}function o(e){for(var n=0;n<e.declarations.length;n++)if(f.isPattern(e.declarations[n].id))return!0;return!1}function s(e,n,l,t){if(!f.isForInStatement(n)&&!f.isForOfStatement(n)&&o(e)){for(var r,a=[],u=0;u<e.declarations.length;u++){r=e.declarations[u];var s=r.init,i=r.id,c=new g({nodes:a,scope:l,kind:e.kind,file:t});f.isPattern(i)&&s?(c.init(i,s),+u!==e.declarations.length-1&&f.inherits(a[a.length-1],r)):a.push(f.inherits(c.buildVariableAssignment(r.id,r.init),r))}if(!f.isProgram(n)&&!f.isBlockStatement(n)){for(r=null,u=0;u<a.length;u++){if(e=a[u],r||(r=f.variableDeclaration(e.kind,[])),!f.isVariableDeclaration(e)&&r.kind!==e.kind)throw t.errorWithNode(e,d.get("invalidParentForThisNode"));r.declarations=r.declarations.concat(e.declarations)}return r}return a}}var i=function(e){return e&&e.__esModule?e["default"]:e},c=function(e){return e&&e.__esModule?e:{"default":e}},p=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")};l.ForOfStatement=t,l.CatchClause=r,l.ExpressionStatement=a,l.AssignmentExpression=u,l.VariableDeclaration=s;{var d=c(e("../../../messages")),f=i(e("../../../types"));l.check=f.isPattern}l.ForInStatement=t,l.Function=function(e,n,l,t){var r=[],a=!1;if(e.params=e.params.map(function(n,u){if(!f.isPattern(n))return n;a=!0;var o=l.generateUidIdentifier("ref"),s=new g({blockHoist:e.params.length-u,nodes:r,scope:l,file:t,kind:"let"});return s.init(n,o),o}),a){t.checkNode(r),f.ensureBlock(e);var u=e.body;u.body=r.concat(u.body)}};var h=function(e){for(var n=0;n<e.elements.length;n++)if(f.isRestElement(e.elements[n]))return!0;return!1},g=function(){function e(n){p(this,e),this.blockHoist=n.blockHoist,this.operator=n.operator,this.nodes=n.nodes,this.scope=n.scope,this.file=n.file,this.kind=n.kind}return e.prototype.buildVariableAssignment=function(e,n){var l=this.operator;f.isMemberExpression(e)&&(l="=");var t;return t=l?f.expressionStatement(f.assignmentExpression(l,e,n)):f.variableDeclaration(this.kind,[f.variableDeclarator(e,n)]),t._blockHoist=this.blockHoist,t},e.prototype.buildVariableDeclaration=function(e,n){var l=f.variableDeclaration("var",[f.variableDeclarator(e,n)]);return l._blockHoist=this.blockHoist,l},e.prototype.push=function(e,n){f.isObjectPattern(e)?this.pushObjectPattern(e,n):f.isArrayPattern(e)?this.pushArrayPattern(e,n):f.isAssignmentPattern(e)?this.pushAssignmentPattern(e,n):this.nodes.push(this.buildVariableAssignment(e,n))},e.prototype.pushAssignmentPattern=function(e,n){var l=this.scope.generateUidBasedOnNode(n),t=f.variableDeclaration("var",[f.variableDeclarator(l,n)]);t._blockHoist=this.blockHoist,this.nodes.push(t),this.nodes.push(this.buildVariableAssignment(e.left,f.conditionalExpression(f.binaryExpression("===",l,f.identifier("undefined")),e.right,l)))},e.prototype.pushObjectSpread=function(e,n,l,t){for(var r=[],a=0;a<e.properties.length;a++){var u=e.properties[a];if(a>=t)break;if(!f.isSpreadProperty(u)){var o=u.key;f.isIdentifier(o)&&(o=f.literal(u.key.name)),r.push(o)}}r=f.arrayExpression(r);var s=f.callExpression(this.file.addHelper("object-without-properties"),[n,r]);this.nodes.push(this.buildVariableAssignment(l.argument,s))},e.prototype.pushObjectProperty=function(e,n){f.isLiteral(e.key)&&(e.computed=!0);var l=e.value,t=f.memberExpression(n,e.key,e.computed);f.isPattern(l)?this.push(l,t):this.nodes.push(this.buildVariableAssignment(l,t))},e.prototype.pushObjectPattern=function(e,n){if(e.properties.length||this.nodes.push(f.expressionStatement(f.callExpression(this.file.addHelper("object-destructuring-empty"),[n]))),e.properties.length>1&&f.isMemberExpression(n)){var l=this.scope.generateUidBasedOnNode(n,this.file);this.nodes.push(this.buildVariableDeclaration(l,n)),n=l}for(var t=0;t<e.properties.length;t++){var r=e.properties[t];f.isSpreadProperty(r)?this.pushObjectSpread(e,n,r,t):this.pushObjectProperty(r,n)}},e.prototype.canUnpackArrayPattern=function(e,n){if(!f.isArrayExpression(n))return!1;if(!(e.elements.length>n.elements.length)){if(e.elements.length<n.elements.length&&!h(e))return!1;for(var l=0;l<e.elements.length;l++)if(!e.elements[l])return!1;return!0}},e.prototype.pushUnpackedArrayPattern=function(e,n){for(var l=0;l<e.elements.length;l++){var t=e.elements[l];f.isRestElement(t)?this.push(t.argument,f.arrayExpression(n.elements.slice(l))):this.push(t,n.elements[l])}},e.prototype.pushArrayPattern=function(e,n){if(e.elements){if(this.canUnpackArrayPattern(e,n))return this.pushUnpackedArrayPattern(e,n);var l=!h(e)&&e.elements.length,t=this.scope.toArray(n,l);f.isIdentifier(t)?n=t:(n=this.scope.generateUidBasedOnNode(n),this.nodes.push(this.buildVariableDeclaration(n,t)),this.scope.assignTypeGeneric(n.name,"Array"));for(var r=0;r<e.elements.length;r++){var a=e.elements[r];if(a){var u;f.isRestElement(a)?(u=this.scope.toArray(n),r>0&&(u=f.callExpression(f.memberExpression(u,f.identifier("slice")),[f.literal(r)])),a=a.argument):u=f.memberExpression(n,f.literal(r),!0),this.push(a,u)}}}},e.prototype.init=function(e,n){if(!f.isArrayExpression(n)&&!f.isMemberExpression(n)&&!f.isIdentifier(n)){var l=this.scope.generateUidBasedOnNode(n);this.nodes.push(this.buildVariableDeclaration(l,n)),n=l}this.push(e,n)},e}();l.__esModule=!0},{"../../../messages":26,"../../../types":122}],67:[function(e,n,l){"use strict";function t(e,n,l,t){var r=p;t.isLoose("es6.forOf")&&(r=c);var a=r(e,n,l,t),u=a.declar,o=a.loop,i=o.body;return s.inheritsComments(o,e),s.ensureBlock(e),u&&i.body.push(u),i.body=i.body.concat(e.body.body),s.inherits(o,e),o._scopeInfo=e._scopeInfo,a.replaceParent?void(this.parentPath.node=a.node):a.node}var r=function(e){return e&&e.__esModule?e["default"]:e},a=function(e){return e&&e.__esModule?e:{"default":e}};l.ForOfStatement=t;var u=a(e("../../../messages")),o=a(e("../../../util")),s=r(e("../../../types")),i=(l.check=s.isForOfStatement,{enter:function(e,n,l,t){if(this.isLoop())return t.ignoreLabeless=!0,l.traverse(e,i,t),t.ignoreLabeless=!1,this.skip();if(this.isBreakStatement()){if(!e.label&&t.ignoreLabeless)return;if(e.label&&e.label.name!==t.label)return;var r=s.expressionStatement(s.callExpression(s.memberExpression(t.iteratorKey,s.identifier("return")),[]));return r=t.wrapReturn(r),this.skip(),[r,e]}}}),c=function(e,n,l,t){var r,a,c=e.left;if(s.isIdentifier(c)||s.isPattern(c)||s.isMemberExpression(c))a=c;else{if(!s.isVariableDeclaration(c))throw t.errorWithNode(c,u.get("unknownForHead",c.type));a=l.generateUidIdentifier("ref"),r=s.variableDeclaration(c.kind,[s.variableDeclarator(c.declarations[0].id,a)])}var p=l.generateUidIdentifier("iterator"),d=l.generateUidIdentifier("isArray"),f=o.template("for-of-loose",{LOOP_OBJECT:p,IS_ARRAY:d,OBJECT:e.right,INDEX:l.generateUidIdentifier("i"),ID:a});return r||f.body.body.shift(),l.traverse(e,i,{iteratorKey:p,label:s.isLabeledStatement(n)&&n.label.name,wrapReturn:function(e){return s.ifStatement(s.logicalExpression("&&",s.unaryExpression("!",d,!0),s.memberExpression(p,s.identifier("return"))),e)}}),{declar:r,node:f,loop:f}},p=function(e,n,l,t){var r,a=e.left,c=l.generateUidIdentifier("step"),p=s.memberExpression(c,s.identifier("value"));if(s.isIdentifier(a)||s.isPattern(a)||s.isMemberExpression(a))r=s.expressionStatement(s.assignmentExpression("=",a,p));else{if(!s.isVariableDeclaration(a))throw t.errorWithNode(a,u.get("unknownForHead",a.type));r=s.variableDeclaration(a.kind,[s.variableDeclarator(a.declarations[0].id,p)])}var d=l.generateUidIdentifier("iterator"),f=o.template("for-of",{ITERATOR_HAD_ERROR_KEY:l.generateUidIdentifier("didIteratorError"),ITERATOR_COMPLETION:l.generateUidIdentifier("iteratorNormalCompletion"),ITERATOR_ERROR_KEY:l.generateUidIdentifier("iteratorError"),ITERATOR_KEY:d,STEP_KEY:c,OBJECT:e.right,BODY:null}),h=s.isLabeledStatement(n),g=f[3].block.body,m=g[0];return h&&(g[0]=s.labeledStatement(n.label,m)),l.traverse(e,i,{iteratorKey:d,label:h&&n.label.name,wrapReturn:function(e){return s.ifStatement(s.memberExpression(d,s.identifier("return")),e)}}),{replaceParent:h,declar:r,loop:m,node:f}};l.__esModule=!0},{"../../../messages":26,"../../../types":122,"../../../util":124}],68:[function(e,n,l){"use strict";function t(e,n,l,t){if(!e.isType){var r=[];if(e.specifiers.length)for(var a=0;a<e.specifiers.length;a++)t.moduleFormatter.importSpecifier(e.specifiers[a],e,r,n);else t.moduleFormatter.importDeclaration(e,r,n);return 1===r.length&&(r[0]._blockHoist=e._blockHoist),r}}function r(e,n,l,t){if(!u.isTypeAlias(e.declaration)){var r,a=[];if(e.declaration){if(u.isVariableDeclaration(e.declaration)){var o=e.declaration.declarations[0];o.init=o.init||u.identifier("undefined")}t.moduleFormatter.exportDeclaration(e,a,n)}else if(e.specifiers)for(r=0;r<e.specifiers.length;r++)t.moduleFormatter.exportSpecifier(e.specifiers[r],e,a,n);if(e._blockHoist)for(r=0;r<a.length;r++)a[r]._blockHoist=e._blockHoist;return a}}var a=function(e){return e&&e.__esModule?e["default"]:e};l.ImportDeclaration=t,l.ExportDeclaration=r;var u=a(e("../../../types"));l.check=e("../internal/modules").check,l.__esModule=!0},{"../../../types":122,"../internal/modules":89}],69:[function(e,n,l){"use strict";function t(e){return s.isIdentifier(e,{name:"super"})}function r(e,n,l,t){if(e.method){var r=e.value,a=n.generateUidIdentifier("this"),u=new o({topLevelThisReference:a,getObjectRef:l,methodNode:e,isStatic:!0,scope:n,file:t});u.replace(),u.hasSuper&&r.body.body.unshift(s.variableDeclaration("var",[s.variableDeclarator(a,s.thisExpression())]))}}function a(e,n,l,t){for(var a,u=function(){return!a&&(a=l.generateUidIdentifier("obj")),a},o=0;o<e.properties.length;o++)r(e.properties[o],l,u,t);return a?(l.push({id:a}),s.assignmentExpression("=",a,e)):void 0}var u=function(e){return e&&e.__esModule?e["default"]:e};l.check=t,l.ObjectExpression=a;var o=u(e("../../helpers/replace-supers")),s=u(e("../../../types"));l.__esModule=!0},{"../../../types":122,"../../helpers/replace-supers":40}],70:[function(e,n,l){"use strict";function t(e){return o.isFunction(e)&&s(e)}var r=function(e){return e&&e.__esModule?e["default"]:e},a=function(e){return e&&e.__esModule?e:{"default":e}};l.check=t;var u=a(e("../../../util")),o=r(e("../../../types")),s=function(e){for(var n=0;n<e.params.length;n++)if(!o.isIdentifier(e.params[n]))return!0;return!1},i={enter:function(e,n,l,t){this.isReferencedIdentifier()&&t.scope.hasOwnBinding(e.name)&&(t.scope.bindingIdentifierEquals(e.name,e)||(t.iife=!0,this.stop()))}};l.Function=function(e,n,l,t){if(s(e)){o.ensureBlock(e);var r=[],a=o.identifier("arguments");a._ignoreAliasFunctions=!0;for(var c=0,p={iife:!1,scope:l},d=function(n,l,s){var i=u.template("default-parameter",{VARIABLE_NAME:n,DEFAULT_VALUE:l,ARGUMENT_KEY:o.literal(s),ARGUMENTS:a},!0);t.checkNode(i),i._blockHoist=e.params.length-s,r.push(i)},f=0;f<e.params.length;f++){var h=e.params[f];if(o.isAssignmentPattern(h)){var g=h.left,m=h.right,y=l.generateUidIdentifier("x");y._isDefaultPlaceholder=!0,e.params[f]=y,p.iife||(o.isIdentifier(m)&&l.hasOwnBinding(m.name)?p.iife=!0:l.traverse(m,i,p)),d(g,m,f)}else o.isRestElement(h)||(c=f+1),o.isIdentifier(h)||l.traverse(h,i,p),t.transformers["es6.blockScopingTDZ"].canRun()&&o.isIdentifier(h)&&d(h,o.identifier("undefined"),f)}if(e.params=e.params.slice(0,c),p.iife){var _=o.functionExpression(null,[],e.body,e.generator);_._aliasFunction=!0,r.push(o.returnStatement(o.callExpression(_,[]))),e.body=o.blockStatement(r)}else e.body.body=r.concat(e.body.body)}},l.__esModule=!0},{"../../../types":122,"../../../util":124}],71:[function(e,n,l){"use strict";function t(e,n){var l,t=e.property;s.isLiteral(t)?(t.value+=n,t.raw=String(t.value)):(l=s.binaryExpression("+",t,s.literal(n)),e.property=l)}var r=function(e){return e&&e.__esModule?e:{"default":e}},a=function(e){return e&&e.__esModule?e["default"]:e},u=a(e("lodash/lang/isNumber")),o=r(e("../../../util")),s=a(e("../../../types")),i=(l.check=s.isRestElement,{enter:function(e,n,l,t){if(this.isScope()&&!l.bindingIdentifierEquals(t.name,t.outerBinding))return this.skip();if(this.isFunctionDeclaration()||this.isFunctionExpression())return t.noOptimise=!0,l.traverse(e,i,t),t.noOptimise=!1,this.skip();if(this.isReferencedIdentifier({name:t.name})){if(!t.noOptimise&&s.isMemberExpression(n)&&n.computed){var r=n.property;if(u(r.value)||s.isUnaryExpression(r)||s.isBinaryExpression(r))return void t.candidates.push(this)}t.canOptimise=!1,this.stop()}}}),c=function(e){return s.isRestElement(e.params[e.params.length-1])};l.Function=function(e,n,l,r){if(c(e)){var a=e.params.pop().argument,u=s.identifier("arguments");if(u._ignoreAliasFunctions=!0,s.isPattern(a)){var p=a;a=l.generateUidIdentifier("ref");var d=s.variableDeclaration("let",p.elements.map(function(e,n){var l=s.memberExpression(a,s.literal(n),!0);return s.variableDeclarator(e,l)}));r.checkNode(d),e.body.body.unshift(d)}var f={outerBinding:l.getBindingIdentifier(a.name),canOptimise:!0,candidates:[],method:e,name:a.name};if(l.traverse(e,i,f),f.canOptimise&&f.candidates.length)for(var h=0;h<f.candidates.length;h++){var g=f.candidates[h];g.node=u,t(g.parent,e.params.length)}else{var m=s.literal(e.params.length),y=l.generateUidIdentifier("key"),_=l.generateUidIdentifier("len"),x=y,b=_;e.params.length&&(x=s.binaryExpression("-",y,m),b=s.conditionalExpression(s.binaryExpression(">",_,m),s.binaryExpression("-",_,m),s.literal(0))),l.assignTypeGeneric(a.name,"Array");var v=o.template("rest",{ARGUMENTS:u,ARRAY_KEY:x,ARRAY_LEN:b,START:m,ARRAY:a,KEY:y,LEN:_});v._blockHoist=e.params.length+1,e.body.body.unshift(v)}}},l.__esModule=!0},{"../../../types":122,"../../../util":124,"lodash/lang/isNumber":295}],72:[function(e,n,l){"use strict";function t(e,n,l){for(var t=0;t<e.properties.length;t++){var r=e.properties[t];n.push(s.expressionStatement(s.assignmentExpression("=",s.memberExpression(l,r.key,r.computed||s.isLiteral(r.key)),r.value)))}}function r(e,n,l,t,r){for(var a,u,o=e.properties,i=0;i<o.length;i++)a=o[i],"init"===a.kind&&(u=a.key,!a.computed&&s.isIdentifier(u)&&(a.key=s.literal(u.name)));var c=!1;for(i=0;i<o.length;i++)a=o[i],a.computed&&(c=!0),("init"!==a.kind||!c||s.isLiteral(s.toComputedKey(a,a.key),{value:"__proto__"}))&&(t.push(a),o[i]=null);for(i=0;i<o.length;i++)if(a=o[i]){u=a.key;var p;p=a.computed&&s.isMemberExpression(u)&&s.isIdentifier(u.object,{name:"Symbol"})?s.assignmentExpression("=",s.memberExpression(l,u,!0),a.value):s.callExpression(r.addHelper("define-property"),[l,u,a.value]),n.push(s.expressionStatement(p))}if(1===n.length){var d=n[0].expression;if(s.isCallExpression(d))return d.arguments[0]=s.objectExpression(t),d}}function a(e){return s.isProperty(e)&&e.computed}function u(e,n,l,a){for(var u=!1,o=0;o<e.properties.length&&!(u=s.isProperty(e.properties[o],{computed:!0,kind:"init"}));o++);if(u){var i=[],c=l.generateUidBasedOnNode(n),p=[],d=s.functionExpression(null,[],s.blockStatement(p));d._aliasFunction=!0;var f=r;a.isLoose("es6.properties.computed")&&(f=t);var h=f(e,p,c,i,a);return h?h:(p.unshift(s.variableDeclaration("var",[s.variableDeclarator(c,s.objectExpression(i))])),p.push(s.returnStatement(c)),s.callExpression(d,[]))}}var o=function(e){return e&&e.__esModule?e["default"]:e};l.check=a,l.ObjectExpression=u;var s=o(e("../../../types"));l.__esModule=!0},{"../../../types":122}],73:[function(e,n,l){"use strict";function t(e){return u.isProperty(e)&&(e.method||e.shorthand)}function r(e){e.method&&(e.method=!1),e.shorthand&&(e.shorthand=!1,e.key=u.removeComments(u.clone(e.key)))}var a=function(e){return e&&e.__esModule?e["default"]:e};l.check=t,l.Property=r;var u=a(e("../../../types"));l.__esModule=!0},{"../../../types":122}],74:[function(e,n,l){"use strict";function t(e){return o.is(e,"y")}function r(e){return o.is(e,"y")?s.newExpression(s.identifier("RegExp"),[s.literal(e.regex.pattern),s.literal(e.regex.flags)]):void 0}var a=function(e){return e&&e.__esModule?e["default"]:e},u=function(e){return e&&e.__esModule?e:{"default":e}};l.check=t,l.Literal=r;var o=u(e("../../helpers/regex")),s=a(e("../../../types"));l.__esModule=!0},{"../../../types":122,"../../helpers/regex":38}],75:[function(e,n,l){"use strict";function t(e){return s.is(e,"u")}function r(e){s.is(e,"u")&&(s.pullFlag(e,"y"),e.regex.pattern=o(e.regex.pattern,e.regex.flags))}var a=function(e){return e&&e.__esModule?e:{"default":e}},u=function(e){return e&&e.__esModule?e["default"]:e};l.check=t,l.Literal=r;var o=u(e("regexpu/rewrite-pattern")),s=a(e("../../helpers/regex"));l.__esModule=!0},{"../../helpers/regex":38,"regexpu/rewrite-pattern":328}],76:[function(e,n,l){"use strict";function t(e,n){return n.toArray(e.argument,!0)}function r(e){for(var n=0;n<e.length;n++)if(p.isSpreadElement(e[n]))return!0;return!1}function a(e,n){for(var l=[],r=[],a=function(){r.length&&(l.push(p.arrayExpression(r)),r=[])},u=0;u<e.length;u++){var o=e[u];p.isSpreadElement(o)?(a(),l.push(t(o,n))):r.push(o)}return a(),l}function u(e,n,l){var t=e.elements;if(r(t)){var u=a(t,l),o=u.shift();return p.isArrayExpression(o)||(u.unshift(o),o=p.arrayExpression([])),p.callExpression(p.memberExpression(o,p.identifier("concat")),u)}}function o(e,n,l){var t=e.arguments;if(r(t)){var u=p.identifier("undefined");e.arguments=[];var o;o=1===t.length&&"arguments"===t[0].argument.name?[t[0].argument]:a(t,l);var s=o.shift();e.arguments.push(o.length?p.callExpression(p.memberExpression(s,p.identifier("concat")),o):s);var i=e.callee;if(p.isMemberExpression(i)){var c=l.generateTempBasedOnNode(i.object);c?(i.object=p.assignmentExpression("=",c,i.object),u=c):u=i.object,p.appendToMemberExpression(i,p.identifier("apply"))}else e.callee=p.memberExpression(e.callee,p.identifier("apply"));e.arguments.unshift(u)}}function s(e,n,l,t){var u=e.arguments;if(r(u)){var o=p.isIdentifier(e.callee)&&c(p.NATIVE_TYPE_NAMES,e.callee.name),s=a(u,l);o&&s.unshift(p.arrayExpression([p.literal(null)]));var i=s.shift();return u=s.length?p.callExpression(p.memberExpression(i,p.identifier("concat")),s):i,o?p.newExpression(p.callExpression(p.memberExpression(t.addHelper("bind"),p.identifier("apply")),[e.callee,u]),[]):p.callExpression(t.addHelper("apply-constructor"),[e.callee,u])}}var i=function(e){return e&&e.__esModule?e["default"]:e};l.ArrayExpression=u,l.CallExpression=o,l.NewExpression=s;{var c=i(e("lodash/collection/includes")),p=i(e("../../../types"));l.check=p.isSpreadElement}l.__esModule=!0},{"../../../types":122,"lodash/collection/includes":205}],77:[function(e,n,l){"use strict";function t(e){return d.blockStatement([d.returnStatement(e)])}var r=function(e){return e&&e.__esModule?e:{"default":e}},a=function(e){return e&&e.__esModule?e["default"]:e},u=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},o=a(e("lodash/collection/reduceRight")),s=r(e("../../../messages")),i=a(e("lodash/array/flatten")),c=r(e("../../../util")),p=a(e("lodash/collection/map")),d=a(e("../../../types"));l.Function=function(e,n,l,t){var r=new m(e,l,t);r.run()};var f={enter:function(e,n,l,t){if(this.isIfStatement())d.isReturnStatement(e.alternate)&&d.ensureBlock(e,"alternate"),d.isReturnStatement(e.consequent)&&d.ensureBlock(e,"consequent");else{if(this.isReturnStatement())return this.skip(),t.subTransform(e.argument);d.isTryStatement(n)?e===n.block?this.skip():n.finalizer&&e!==n.finalizer&&this.skip():this.isFunction()?this.skip():this.isVariableDeclaration()&&(this.skip(),t.vars.push(e))}}},h={enter:function(e,n,l,t){return this.isThisExpression()?(t.needsThis=!0,t.getThisId()):this.isReferencedIdentifier({name:"arguments"})?(t.needsArguments=!0,t.getArgumentsId()):this.isFunction()&&(this.skip(),this.isFunctionDeclaration())?(e=d.variableDeclaration("var",[d.variableDeclarator(e.id,d.toExpression(e))]),e._blockHoist=2,e):void 0}},g={enter:function(e,n,l,t){if(this.isExpressionStatement()){var r=e.expression;if(d.isAssignmentExpression(r))if(t.needsThis||r.left!==t.getThisId()){if(!t.needsArguments&&r.left===t.getArgumentsId()&&d.isArrayExpression(r.right))return p(r.right.elements,function(e){return d.expressionStatement(e)})}else this.remove()}}},m=function(){function e(n,l,t){u(this,e),this.hasTailRecursion=!1,this.needsArguments=!1,this.setsArguments=!1,this.needsThis=!1,this.ownerId=n.id,this.vars=[],this.scope=l,this.file=t,this.node=n}return e.prototype.getArgumentsId=function(){var e;return e=this,!e.argumentsId&&(e.argumentsId=this.scope.generateUidIdentifier("arguments")),e.argumentsId},e.prototype.getThisId=function(){var e;return e=this,!e.thisId&&(e.thisId=this.scope.generateUidIdentifier("this")),e.thisId},e.prototype.getLeftId=function(){var e;return e=this,!e.leftId&&(e.leftId=this.scope.generateUidIdentifier("left")),e.leftId},e.prototype.getFunctionId=function(){var e;return e=this,!e.functionId&&(e.functionId=this.scope.generateUidIdentifier("function")),e.functionId},e.prototype.getAgainId=function(){var e;return e=this,!e.againId&&(e.againId=this.scope.generateUidIdentifier("again")),e.againId},e.prototype.getParams=function(){var e=this.params;if(!e){e=this.node.params,this.paramDecls=[];for(var n=0;n<e.length;n++){var l=e[n];l._isDefaultPlaceholder||this.paramDecls.push(d.variableDeclarator(l,e[n]=this.scope.generateUidIdentifier("x")))}}return this.params=e},e.prototype.hasDeopt=function(){var e=this.scope.getBindingInfo(this.ownerId.name);return e&&e.reassigned},e.prototype.run=function(){var e=this.scope,n=this.node,l=this.ownerId;if(l&&(e.traverse(n,f,this),this.hasTailRecursion)){if(this.hasDeopt())return void this.file.logDeopt(n,s.get("tailCallReassignmentDeopt"));e.traverse(n,h,this),this.needsThis&&this.needsArguments||e.traverse(n,g,this);var t=d.ensureBlock(n).body;if(this.vars.length>0){var r=i(p(this.vars,function(e){return e.declarations},this)),a=o(r,function(e,n){return d.assignmentExpression("=",n.id,e)},d.identifier("undefined"));t.unshift(d.expressionStatement(a))}var u=this.paramDecls;u.length>0&&t.unshift(d.variableDeclaration("var",u)),t.unshift(d.expressionStatement(d.assignmentExpression("=",this.getAgainId(),d.literal(!1)))),n.body=c.template("tail-call-body",{AGAIN_ID:this.getAgainId(),THIS_ID:this.thisId,ARGUMENTS_ID:this.argumentsId,FUNCTION_ID:this.getFunctionId(),BLOCK:n.body});var m=[];if(this.needsThis&&m.push(d.variableDeclarator(this.getThisId(),d.thisExpression())),this.needsArguments||this.setsArguments){var y=d.variableDeclarator(this.getArgumentsId());this.needsArguments&&(y.init=d.identifier("arguments")),m.push(y)}var _=this.leftId;_&&m.push(d.variableDeclarator(_)),m.length>0&&n.body.body.unshift(d.variableDeclaration("var",m))}},e.prototype.subTransform=function(e){if(e){var n=this["subTransform"+e.type];return n?n.call(this,e):void 0}},e.prototype.subTransformConditionalExpression=function(e){var n=this.subTransform(e.consequent),l=this.subTransform(e.alternate);return n||l?(e.type="IfStatement",e.consequent=n?d.toBlock(n):t(e.consequent),e.alternate=l?d.isIfStatement(l)?l:d.toBlock(l):t(e.alternate),[e]):void 0},e.prototype.subTransformLogicalExpression=function(e){var n=this.subTransform(e.right);if(n){var l=this.getLeftId(),r=d.assignmentExpression("=",l,e.left);return"&&"===e.operator&&(r=d.unaryExpression("!",r)),[d.ifStatement(r,t(l))].concat(n)}},e.prototype.subTransformSequenceExpression=function(e){var n=e.expressions,l=this.subTransform(n[n.length-1]);return l?(1===--n.length&&(e=n[0]),[d.expressionStatement(e)].concat(l)):void 0},e.prototype.subTransformCallExpression=function(e){var n,l,t=e.callee;if(d.isMemberExpression(t,{computed:!1})&&d.isIdentifier(t.property)){switch(t.property.name){case"call":l=d.arrayExpression(e.arguments.slice(1));break;case"apply":l=e.arguments[1]||d.identifier("undefined");break;default:return}n=e.arguments[0],t=t.object}if(d.isIdentifier(t)&&this.scope.bindingIdentifierEquals(t.name,this.ownerId)&&(this.hasTailRecursion=!0,!this.hasDeopt())){var r=[];d.isThisExpression(n)||r.push(d.expressionStatement(d.assignmentExpression("=",this.getThisId(),n||d.identifier("undefined")))),l||(l=d.arrayExpression(e.arguments));var a=this.getArgumentsId(),u=this.getParams();r.push(d.expressionStatement(d.assignmentExpression("=",a,l)));var o,s;if(d.isArrayExpression(l)){var i=l.elements;for(o=0;o<i.length&&o<u.length;o++){s=u[o];var c=i[o]||(i[o]=d.identifier("undefined"));s._isDefaultPlaceholder||(i[o]=d.assignmentExpression("=",s,c))}}else for(this.setsArguments=!0,o=0;o<u.length;o++)s=u[o],s._isDefaultPlaceholder||r.push(d.expressionStatement(d.assignmentExpression("=",s,d.memberExpression(a,d.literal(o),!0))));return r.push(d.expressionStatement(d.assignmentExpression("=",this.getAgainId(),d.literal(!0)))),r.push(d.continueStatement(this.getFunctionId())),r}},e}()},{"../../../messages":26,"../../../types":122,"../../../util":124,"lodash/array/flatten":197,"lodash/collection/map":206,"lodash/collection/reduceRight":207}],78:[function(e,n,l){"use strict";function t(e){return o.isTemplateLiteral(e)||o.isTaggedTemplateExpression(e)}function r(e,n,l,t){for(var r=[],a=e.quasi,u=[],s=[],i=0;i<a.quasis.length;i++){var c=a.quasis[i];u.push(o.literal(c.value.cooked)),s.push(o.literal(c.value.raw))}u=o.arrayExpression(u),s=o.arrayExpression(s);var p="tagged-template-literal";return t.isLoose("es6.templateLiterals")&&(p+="-loose"),r.push(o.callExpression(t.addHelper(p),[u,s])),r=r.concat(a.expressions),o.callExpression(e.tag,r)}function a(e){var n,l=[];for(n=0;n<e.quasis.length;n++){var t=e.quasis[n];l.push(o.literal(t.value.cooked));var r=e.expressions.shift();r&&l.push(r)}if(l.length>1){var a=l[l.length-1];o.isLiteral(a,{value:""})&&l.pop();var u=s(l.shift(),l.shift());for(n=0;n<l.length;n++)u=s(u,l[n]);return u}return l[0]}var u=function(e){return e&&e.__esModule?e["default"]:e};l.check=t,l.TaggedTemplateExpression=r,l.TemplateLiteral=a;var o=u(e("../../../types")),s=function(e,n){return o.binaryExpression("+",e,n)};l.__esModule=!0},{"../../../types":122}],79:[function(e,n,l){"use strict";function t(e,n,l,t){var r=e.left;if(p.isVirtualPropertyExpression(r)){var a,u=e.right;p.isExpressionStatement(n)||(a=l.generateTempBasedOnNode(e.right),a&&(u=a)),"="!==e.operator&&(u=p.binaryExpression(e.operator[0],c.template("abstract-expression-get",{PROPERTY:e.property,OBJECT:e.object}),u));var o=c.template("abstract-expression-set",{PROPERTY:r.property,OBJECT:r.object,VALUE:u});return a&&(o=p.sequenceExpression([p.assignmentExpression("=",a,e.right),o])),d(n,o,u,t) }}function r(e,n,l,t){var r=e.argument;if(p.isVirtualPropertyExpression(r)&&"delete"===e.operator){var a=c.template("abstract-expression-delete",{PROPERTY:r.property,OBJECT:r.object});return d(n,a,p.literal(!0),t)}}function a(e,n,l){var t=e.callee;if(p.isVirtualPropertyExpression(t)){var r=l.generateTempBasedOnNode(t.object),a=c.template("abstract-expression-call",{PROPERTY:t.property,OBJECT:r||t.object});return a.arguments=a.arguments.concat(e.arguments),r?p.sequenceExpression([p.assignmentExpression("=",r,t.object),a]):a}}function u(e){return c.template("abstract-expression-get",{PROPERTY:e.property,OBJECT:e.object})}function o(e){return p.variableDeclaration("const",e.declarations.map(function(e){return p.variableDeclarator(e,p.newExpression(p.identifier("WeakMap"),[]))}))}var s=function(e){return e&&e.__esModule?e["default"]:e},i=function(e){return e&&e.__esModule?e:{"default":e}};l.AssignmentExpression=t,l.UnaryExpression=r,l.CallExpression=a,l.VirtualPropertyExpression=u,l.PrivateDeclaration=o;var c=i(e("../../../util")),p=s(e("../../../types")),d=(l.experimental=!0,function(e,n,l,t){if(p.isExpressionStatement(e)&&!t.isConsequenceExpressionStatement(e))return n;var r=[];return p.isSequenceExpression(n)?r=n.expressions:r.push(n),r.push(l),p.sequenceExpression(r)});l.__esModule=!0},{"../../../types":122,"../../../util":124}],80:[function(e,n,l){"use strict";function t(e,n,l,t){var u=a;return e.generator&&(u=r),u(e,n,l,t)}function r(e){var n=[],l=p.functionExpression(null,[],p.blockStatement(n),!0);return l._aliasFunction=!0,n.push(s(e,function(){return p.expressionStatement(p.yieldExpression(e.body))})),p.callExpression(l,[])}function a(e,n,l,t){var r=l.generateUidBasedOnNode(n,t),a=c.template("array-comprehension-container",{KEY:r});a.callee._aliasFunction=!0;var u=a.callee.body,o=u.body;i.hasType(e,l,"YieldExpression",p.FUNCTION_TYPES)&&(a.callee.generator=!0,a=p.yieldExpression(a,!0));var d=o.pop();return o.push(s(e,function(){return c.template("array-push",{STATEMENT:e.body,KEY:r},!0)})),o.push(d),a}var u=function(e){return e&&e.__esModule?e:{"default":e}},o=function(e){return e&&e.__esModule?e["default"]:e};l.ComprehensionExpression=t;{var s=o(e("../../helpers/build-comprehension")),i=o(e("../../../traversal")),c=u(e("../../../util")),p=o(e("../../../types"));l.experimental=!0}l.__esModule=!0},{"../../../traversal":117,"../../../types":122,"../../../util":124,"../../helpers/build-comprehension":30}],81:[function(e,n,l){"use strict";var t=function(e){return e&&e.__esModule?e["default"]:e},r=t(e("../../helpers/build-binary-assignment-operator-transformer")),a=t(e("../../../types")),u=(l.experimental=!0,a.memberExpression(a.identifier("Math"),a.identifier("pow")));r(l,{operator:"**",build:function(e,n){return a.callExpression(u,[e,n])}}),l.__esModule=!0},{"../../../types":122,"../../helpers/build-binary-assignment-operator-transformer":29}],82:[function(e,n,l){"use strict";function t(e){e.whitelist.length&&e.whitelist.push("es6.destructuring")}function r(e,n,l,t){if(o(e)){for(var r=[],a=[],s=function(){a.length&&(r.push(u.objectExpression(a)),a=[])},i=0;i<e.properties.length;i++){var c=e.properties[i];u.isSpreadProperty(c)?(s(),r.push(c.argument)):a.push(c)}return s(),u.isObjectExpression(r[0])||r.unshift(u.objectExpression([])),u.callExpression(t.addHelper("extends"),r)}}var a=function(e){return e&&e.__esModule?e["default"]:e};l.manipulateOptions=t,l.ObjectExpression=r;var u=a(e("../../../types")),o=(l.experimental=!0,function(e){for(var n=0;n<e.properties.length;n++)if(u.isSpreadProperty(e.properties[n]))return!0;return!1});l.__esModule=!0},{"../../../types":122}],83:[function(e,n){"use strict";n.exports={strict:e("./other/strict"),_validation:e("./internal/validation"),"validation.undeclaredVariableCheck":e("./validation/undeclared-variable-check"),"validation.react":e("./validation/react"),"spec.functionName":e("./spec/function-name"),"spec.blockScopedFunctions":e("./spec/block-scoped-functions"),"es6.arrowFunctions":e("./es6/arrow-functions"),"playground.malletOperator":e("./playground/mallet-operator"),"playground.methodBinding":e("./playground/method-binding"),"playground.memoizationOperator":e("./playground/memoization-operator"),"playground.objectGetterMemoization":e("./playground/object-getter-memoization"),reactCompat:e("./other/react-compat"),flow:e("./other/flow"),react:e("./other/react"),_modules:e("./internal/modules"),"es7.comprehensions":e("./es7/comprehensions"),"es6.classes":e("./es6/classes"),asyncToGenerator:e("./other/async-to-generator"),bluebirdCoroutines:e("./other/bluebird-coroutines"),"es6.objectSuper":e("./es6/object-super"),"es7.objectRestSpread":e("./es7/object-rest-spread"),"es7.exponentiationOperator":e("./es7/exponentiation-operator"),"es6.templateLiterals":e("./es6/template-literals"),"es5.properties.mutators":e("./es5/properties.mutators"),"es6.properties.shorthand":e("./es6/properties.shorthand"),"es6.properties.computed":e("./es6/properties.computed"),"es6.forOf":e("./es6/for-of"),"es6.regex.sticky":e("./es6/regex.sticky"),"es6.regex.unicode":e("./es6/regex.unicode"),"es7.abstractReferences":e("./es7/abstract-references"),"es6.constants":e("./es6/constants"),"es6.parameters.rest":e("./es6/parameters.rest"),"es6.spread":e("./es6/spread"),"es6.parameters.default":e("./es6/parameters.default"),"es6.destructuring":e("./es6/destructuring"),"es6.blockScoping":e("./es6/block-scoping"),"es6.blockScopingTDZ":e("./es6/block-scoping-tdz"),"es6.tailCall":e("./es6/tail-call"),regenerator:e("./other/regenerator"),runtime:e("./other/runtime"),"es6.modules":e("./es6/modules"),_blockHoist:e("./internal/block-hoist"),"spec.protoToAssign":e("./spec/proto-to-assign"),_declarations:e("./internal/declarations"),_aliasFunctions:e("./internal/alias-functions"),"spec.typeofSymbol":e("./spec/typeof-symbol"),"spec.undefinedToVoid":e("./spec/undefined-to-void"),_strict:e("./internal/strict"),_moduleFormatter:e("./internal/module-formatter"),"es3.propertyLiterals":e("./es3/property-literals"),"es3.memberExpressionLiterals":e("./es3/member-expression-literals"),"utility.removeDebugger":e("./utility/remove-debugger"),"utility.removeConsole":e("./utility/remove-console"),"utility.inlineEnvironmentVariables":e("./utility/inline-environment-variables"),"utility.inlineExpressions":e("./utility/inline-expressions"),"utility.deadCodeElimination":e("./utility/dead-code-elimination"),_cleanUp:e("./internal/cleanup")}},{"./es3/member-expression-literals":58,"./es3/property-literals":59,"./es5/properties.mutators":60,"./es6/arrow-functions":61,"./es6/block-scoping":63,"./es6/block-scoping-tdz":62,"./es6/classes":64,"./es6/constants":65,"./es6/destructuring":66,"./es6/for-of":67,"./es6/modules":68,"./es6/object-super":69,"./es6/parameters.default":70,"./es6/parameters.rest":71,"./es6/properties.computed":72,"./es6/properties.shorthand":73,"./es6/regex.sticky":74,"./es6/regex.unicode":75,"./es6/spread":76,"./es6/tail-call":77,"./es6/template-literals":78,"./es7/abstract-references":79,"./es7/comprehensions":80,"./es7/exponentiation-operator":81,"./es7/object-rest-spread":82,"./internal/alias-functions":84,"./internal/block-hoist":85,"./internal/cleanup":86,"./internal/declarations":87,"./internal/module-formatter":88,"./internal/modules":89,"./internal/strict":90,"./internal/validation":91,"./other/async-to-generator":92,"./other/bluebird-coroutines":93,"./other/flow":94,"./other/react":96,"./other/react-compat":95,"./other/regenerator":97,"./other/runtime":98,"./other/strict":99,"./playground/mallet-operator":100,"./playground/memoization-operator":101,"./playground/method-binding":102,"./playground/object-getter-memoization":103,"./spec/block-scoped-functions":104,"./spec/function-name":105,"./spec/proto-to-assign":106,"./spec/typeof-symbol":107,"./spec/undefined-to-void":108,"./utility/dead-code-elimination":109,"./utility/inline-environment-variables":110,"./utility/inline-expressions":111,"./utility/remove-console":112,"./utility/remove-debugger":113,"./validation/react":114,"./validation/undeclared-variable-check":115}],84:[function(e,n,l){"use strict";function t(e,n,l){i(function(){return e.body},e,l)}function r(e,n,l){i(function(){return u.ensureBlock(e),e.body.body},e,l)}var a=function(e){return e&&e.__esModule?e["default"]:e};l.Program=t,l.FunctionDeclaration=r;var u=a(e("../../../types")),o={enter:function(e,n,l,t){if(this.isFunction()&&!e._aliasFunction)return this.skip();if(e._ignoreAliasFunctions)return this.skip();var r;if(this.isIdentifier()&&"arguments"===e.name)r=t.getArgumentsId;else{if(!this.isThisExpression())return;r=t.getThisId}return this.isReferenced()?r():void 0}},s={enter:function(e,n,l,t){return e._aliasFunction?(l.traverse(e,o,t),this.skip()):this.isFunction()?this.skip():void 0}},i=function(e,n,l){var t,r,a={getArgumentsId:function(){return!t&&(t=l.generateUidIdentifier("arguments")),t},getThisId:function(){return!r&&(r=l.generateUidIdentifier("this")),r}};l.traverse(n,s,a);var o,i=function(n,l){o||(o=e()),o.unshift(u.variableDeclaration("var",[u.variableDeclarator(n,l)]))};t&&i(t,u.identifier("arguments")),r&&i(r,u.thisExpression())};l.FunctionExpression=r,l.__esModule=!0},{"../../../types":122}],85:[function(e,n,l){"use strict";var t=function(e){return e&&e.__esModule?e["default"]:e},r=t(e("lodash/collection/groupBy")),a=t(e("lodash/array/flatten")),u=t(e("lodash/object/values")),o=l.BlockStatement={exit:function(e){for(var n=!1,l=0;l<e.body.length;l++){var t=e.body[l];t&&null!=t._blockHoist&&(n=!0)}if(n){var o=r(e.body,function(e){var n=e._blockHoist;return null==n&&(n=1),n===!0&&(n=2),n});e.body=a(u(o).reverse())}}};l.Program=o,l.__esModule=!0},{"lodash/array/flatten":197,"lodash/collection/groupBy":204,"lodash/object/values":307}],86:[function(e,n,l){"use strict";l.SequenceExpression={exit:function(e){return 1===e.expressions.length?e.expressions[0]:void(e.expressions.length||this.remove())}},l.ExpressionStatement={exit:function(e){e.expression||this.remove()}};l.__esModule=!0},{}],87:[function(e,n,l){"use strict";function t(e,n,l,t){e._declarations&&u.wrap(e,function(){var n,l={};for(var r in e._declarations){var a=e._declarations[r];n=a.kind||"var";var u=o.variableDeclarator(a.id,a.init);if(a.init)e.body.unshift(t.attachAuxiliaryComment(o.variableDeclaration(n,[u])));else{var s=l,i=n;s[i]||(s[i]=[]),l[n].push(u)}}for(n in l)e.body.unshift(t.attachAuxiliaryComment(o.variableDeclaration(n,l[n])));e._declarations=null})}var r=function(e){return e&&e.__esModule?e["default"]:e},a=function(e){return e&&e.__esModule?e:{"default":e}};l.BlockStatement=t;{var u=a(e("../../helpers/strict")),o=r(e("../../../types"));l.secondPass=!0}l.Program=t,l.__esModule=!0},{"../../../types":122,"../../helpers/strict":41}],88:[function(e,n,l){"use strict";function t(e,n,l,t){t.transformers["es6.modules"].canRun()&&(a.wrap(e,function(){e.body=t.dynamicImports.concat(e.body)}),t.moduleFormatter.transform&&t.moduleFormatter.transform(e))}var r=function(e){return e&&e.__esModule?e:{"default":e}};l.Program=t;var a=r(e("../../helpers/strict"));l.__esModule=!0},{"../../helpers/strict":41}],89:[function(e,n,l){"use strict";function t(e){return o.isImportDeclaration(e)||o.isExportDeclaration(e)}function r(e,n,l,t){var r=t.opts.resolveModuleSource;e.source&&r&&(e.source.value=r(e.source.value,t.opts.filename))}function a(e,n,l){if(r.apply(this,arguments),!e.isType){var t=e.declaration,a=function(){return t._ignoreUserWhitespace=!0,t};if(e["default"]){if(o.isClassDeclaration(t))return e.declaration=t.id,[a(),e];if(o.isClassExpression(t)){var u=l.generateUidIdentifier("default");return t=o.variableDeclaration("var",[o.variableDeclarator(u,t)]),e.declaration=u,[a(),e]}if(o.isFunctionDeclaration(t))return e._blockHoist=2,e.declaration=t.id,[a(),e]}else if(o.isFunctionDeclaration(t))return e.specifiers=[o.importSpecifier(t.id,t.id)],e.declaration=null,e._blockHoist=2,[a(),e]}}var u=function(e){return e&&e.__esModule?e["default"]:e};l.check=t,l.ImportDeclaration=r,l.ExportDeclaration=a;var o=u(e("../../../types"));l.__esModule=!0},{"../../../types":122}],90:[function(e,n,l){"use strict";function t(e,n,l,t){t.transformers.strict.canRun()&&e.body.unshift(a.expressionStatement(a.literal("use strict")))}var r=function(e){return e&&e.__esModule?e["default"]:e};l.Program=t;var a=r(e("../../../types"));l.__esModule=!0},{"../../../types":122}],91:[function(e,n,l){"use strict";function t(e,n,l,t){var r=e.left;if(s.isVariableDeclaration(r)){var a=r.declarations[0];if(a.init)throw t.errorWithNode(a,o.get("noAssignmentsInForHead"))}}function r(e,n,l,t){if("set"===e.kind){if(1!==e.value.params.length)throw t.errorWithNode(e.value,o.get("settersInvalidParamLength"));var r=e.value.params[0];if(s.isRestElement(r))throw t.errorWithNode(r,o.get("settersNoRest"))}}var a=function(e){return e&&e.__esModule?e["default"]:e},u=function(e){return e&&e.__esModule?e:{"default":e}};l.ForOfStatement=t,l.Property=r;var o=u(e("../../../messages")),s=a(e("../../../types"));l.ForInStatement=t,l.MethodDefinition=r,l.__esModule=!0},{"../../../messages":26,"../../../types":122}],92:[function(e,n,l){"use strict";var t=function(e){return e&&e.__esModule?e["default"]:e},r=t(e("../../helpers/remap-async-to-generator"));l.manipulateOptions=e("./bluebird-coroutines").manipulateOptions;l.optional=!0;l.Function=function(e,n,l,t){return e.async&&!e.generator?r(e,t.addHelper("async-to-generator"),l):void 0},l.__esModule=!0},{"../../helpers/remap-async-to-generator":39,"./bluebird-coroutines":93}],93:[function(e,n,l){"use strict";function t(e){e.experimental=!0,e.blacklist.push("regenerator")}var r=function(e){return e&&e.__esModule?e["default"]:e};l.manipulateOptions=t;{var a=r(e("../../helpers/remap-async-to-generator")),u=r(e("../../../types"));l.optional=!0}l.Function=function(e,n,l,t){return e.async&&!e.generator?a(e,u.memberExpression(t.addImport("bluebird",null,!0),u.identifier("coroutine")),l):void 0},l.__esModule=!0},{"../../../types":122,"../../helpers/remap-async-to-generator":39}],94:[function(e,n,l){"use strict";function t(){this.remove()}function r(e){e.typeAnnotation=null,e.value||this.remove()}function a(e){e["implements"]=null}function u(e){return e.expression}function o(e){e.isType&&this.remove()}function s(e){c.isTypeAlias(e.declaration)&&this.remove()}var i=function(e){return e&&e.__esModule?e["default"]:e};l.Flow=t,l.ClassProperty=r,l.Class=a,l.TypeCastExpression=u,l.ImportDeclaration=o,l.ExportDeclaration=s;var c=i(e("../../../types"));l.Function=function(e){for(var n=0;n<e.params.length;n++){var l=e.params[n];l.optional=!1}},l.__esModule=!0},{"../../../types":122}],95:[function(e,n,l){"use strict";function t(e){e.blacklist.push("react")}var r=function(e){return e&&e.__esModule?e["default"]:e},a=function(e){return e&&e.__esModule?e:{"default":e}};l.manipulateOptions=t;{var u=a(e("../../helpers/react")),o=r(e("../../../types"));l.optional=!0}e("../../helpers/build-react-transformer")(l,{pre:function(e){e.callee=e.tagExpr},post:function(e){u.isCompatTag(e.tagName)&&(e.call=o.callExpression(o.memberExpression(o.memberExpression(o.identifier("React"),o.identifier("DOM")),e.tagExpr,o.isLiteral(e.tagExpr)),e.args))}}),l.__esModule=!0},{"../../../types":122,"../../helpers/build-react-transformer":32,"../../helpers/react":37}],96:[function(e,n,l){"use strict";function t(e,n,l,t){for(var r="React.createElement",a=0;a<t.ast.comments.length;a++){var u=t.ast.comments[a],i=s.exec(u.value);if(i){if(r=i[1],"React.DOM"===r)throw t.errorWithNode(u,"The @jsx React.DOM pragma has been deprecated as of React 0.12");break}}t.set("jsxIdentifier",r.split(".").map(o.identifier).reduce(function(e,n){return o.memberExpression(e,n)}))}var r=function(e){return e&&e.__esModule?e["default"]:e},a=function(e){return e&&e.__esModule?e:{"default":e}};l.Program=t;var u=a(e("../../helpers/react")),o=r(e("../../../types")),s=/^\*\s*@jsx\s+([^\s]+)/;e("../../helpers/build-react-transformer")(l,{pre:function(e){var n=e.tagName,l=e.args;l.push(u.isCompatTag(n)?o.literal(n):e.tagExpr)},post:function(e,n){e.callee=n.get("jsxIdentifier")}}),l.__esModule=!0},{"../../../types":122,"../../helpers/build-react-transformer":32,"../../helpers/react":37}],97:[function(e,n,l){"use strict";function t(e){return u.isFunction(e)&&(e.async||e.generator)}var r=function(e){return e&&e.__esModule?e["default"]:e};l.check=t;{var a=r(e("regenerator-babel")),u=r(e("../../../types"));l.Program={enter:function(e){a.transform(e),this.stop()}}}l.__esModule=!0},{"../../../types":122,"regenerator-babel":320}],98:[function(e,n,l){"use strict";function t(e){e.whitelist.length&&e.whitelist.push("es6.modules")}function r(e,n,l,t){l.traverse(e,y,t)}function a(e){e.setDynamic("helpersNamespace",function(){return e.addImport("babel-runtime/helpers","babelHelpers")}),e.setDynamic("coreIdentifier",function(){return e.addImport("babel-runtime/core-js","core")}),e.setDynamic("regeneratorIdentifier",function(){return e.addImport("babel-runtime/regenerator","regeneratorRuntime")})}function u(e,n,l,t){return this.isReferencedIdentifier({name:"regeneratorRuntime"})?t.get("regeneratorIdentifier"):void 0}var o=function(e){return e&&e.__esModule?e:{"default":e}},s=function(e){return e&&e.__esModule?e["default"]:e};l.manipulateOptions=t,l.Program=r,l.pre=a,l.Identifier=u;{var i=s(e("lodash/collection/includes")),c=o(e("../../../util")),p=s(e("core-js/library")),d=s(e("lodash/object/has")),f=s(e("../../../types")),h=f.buildMatchMemberExpression("Symbol.iterator"),g=function(e){return"_"!==e.name&&d(p,e.name)},m=["Symbol","Promise","Map","WeakMap","Set","WeakSet","Number"],y={enter:function(e,n,l,t){var r;if(this.isMemberExpression()&&this.isReferenced()){var a=e.object;if(r=e.property,!f.isReferenced(a,e))return;if(!e.computed&&g(a)&&d(p[a.name],r.name)&&!l.getBindingIdentifier(a.name))return this.skip(),f.prependToMemberExpression(e,t.get("coreIdentifier"))}else{if(this.isReferencedIdentifier()&&!f.isMemberExpression(n)&&i(m,e.name)&&!l.getBindingIdentifier(e.name))return f.memberExpression(t.get("coreIdentifier"),e);if(this.isCallExpression()){var u=e.callee;return e.arguments.length?!1:f.isMemberExpression(u)&&u.computed?(r=u.property,h(r)?c.template("corejs-iterator",{CORE_ID:t.get("coreIdentifier"),VALUE:u.object}):!1):!1}if(this.isBinaryExpression()){if("in"!==e.operator)return;var o=e.left;if(!h(o))return;return c.template("corejs-is-iterator",{CORE_ID:t.get("coreIdentifier"),VALUE:e.right})}}}};l.optional=!0}l.__esModule=!0},{"../../../types":122,"../../../util":124,"core-js/library":177,"lodash/collection/includes":205,"lodash/object/has":304}],99:[function(e,n,l){"use strict";function t(e){var n=e.body[0];c.isExpressionStatement(n)&&c.isLiteral(n.expression,{value:"use strict"})&&e.body.shift()}function r(){this.skip()}function a(){return c.identifier("undefined")}function u(e,n,l,t){if(c.isIdentifier(e.callee,{name:"eval"}))throw t.errorWithNode(e,i.get("evalInStrictMode"))}var o=function(e){return e&&e.__esModule?e["default"]:e},s=function(e){return e&&e.__esModule?e:{"default":e}};l.Program=t,l.FunctionExpression=r,l.ThisExpression=a,l.CallExpression=u;var i=s(e("../../../messages")),c=o(e("../../../types"));l.FunctionDeclaration=r,l.__esModule=!0},{"../../../messages":26,"../../../types":122}],100:[function(e,n,l){"use strict";{var t=function(e){return e&&e.__esModule?e["default"]:e},r=function(e){return e&&e.__esModule?e:{"default":e}},a=r(e("../../../messages")),u=t(e("../../helpers/build-conditional-assignment-operator-transformer")),o=t(e("../../../types"));l.playground=!0}u(l,{is:function(e,n){if(o.isAssignmentExpression(e,{operator:"||="})){var l=e.left;if(!o.isMemberExpression(l)&&!o.isIdentifier(l))throw n.errorWithNode(l,a.get("expectedMemberExpressionOrIdentifier"));return!0}},build:function(e){return o.unaryExpression("!",e,!0)}}),l.__esModule=!0},{"../../../messages":26,"../../../types":122,"../../helpers/build-conditional-assignment-operator-transformer":31}],101:[function(e,n,l){"use strict";{var t=function(e){return e&&e.__esModule?e["default"]:e},r=t(e("../../helpers/build-conditional-assignment-operator-transformer")),a=t(e("../../../types"));l.playground=!0}r(l,{is:function(e){var n=function(){return e.apply(this,arguments)};return n.toString=function(){return e.toString()},n}(function(e){var n=a.isAssignmentExpression(e,{operator:"?="});return n&&a.assertMemberExpression(e.left),n}),build:function(e,n){return a.unaryExpression("!",a.callExpression(a.memberExpression(n.addHelper("has-own"),a.identifier("call")),[e.object,e.property]),!0)}}),l.__esModule=!0},{"../../../types":122,"../../helpers/build-conditional-assignment-operator-transformer":31}],102:[function(e,n,l){"use strict";function t(e,n,l){var t=e.object,r=e.property,a=l.generateTempBasedOnNode(e.object);a&&(t=a);var s=o.callExpression(o.memberExpression(o.memberExpression(t,r),o.identifier("bind")),[t].concat(u(e.arguments)));return a?o.sequenceExpression([o.assignmentExpression("=",a,e.object),s]):s}function r(e,n,l){var t=function(n){var t=l.generateUidIdentifier("val");return o.functionExpression(null,[t],o.blockStatement([o.returnStatement(o.callExpression(o.memberExpression(t,e.callee),n))]))},r=l.generateTemp("args");return o.sequenceExpression([o.assignmentExpression("=",r,o.arrayExpression(e.arguments)),t(e.arguments.map(function(e,n){return o.memberExpression(r,o.literal(n),!0)}))])}var a=function(e){return e&&e.__esModule?e["default"]:e},u=function(e){if(Array.isArray(e)){for(var n=0,l=Array(e.length);n<e.length;n++)l[n]=e[n];return l}return Array.from(e)};l.BindMemberExpression=t,l.BindFunctionExpression=r;{var o=a(e("../../../types"));l.playground=!0}l.__esModule=!0},{"../../../types":122}],103:[function(e,n,l){"use strict";function t(e,n,l,t){if("memo"===e.kind){e.kind="get";var r=e.value;a.ensureBlock(r);var o=e.key;a.isIdentifier(o)&&!e.computed&&(o=a.literal(o.name));var s={key:o,file:t};return l.traverse(r,u,s),e}}var r=function(e){return e&&e.__esModule?e["default"]:e};l.MethodDefinition=t;var a=r(e("../../../types")),u=(l.playground=!0,{enter:function(e,n,l,t){return this.isFunction()?this.skip():void(this.isReturnStatement()&&e.argument&&(e.argument=a.memberExpression(a.callExpression(t.file.addHelper("define-property"),[a.thisExpression(),t.key,e.argument]),t.key,!0)))}});l.Property=t,l.__esModule=!0},{"../../../types":122}],104:[function(e,n,l){"use strict";function t(e,n,l,t){if(!(a.isFunction(n)&&n.body===e||a.isExportDeclaration(n)))for(var r=0;r<e.body.length;r++){var u=e.body[r];if(a.isFunctionDeclaration(u)){var o=a.variableDeclaration("let",[a.variableDeclarator(u.id,a.toExpression(u))]);o._blockHoist=2,u.id=null,e.body[r]=o,t.checkNode(o)}}}var r=function(e){return e&&e.__esModule?e["default"]:e};l.BlockStatement=t;var a=r(e("../../../types"));l.__esModule=!0},{"../../../types":122}],105:[function(e,n,l){"use strict";l.FunctionExpression=e("../../helpers/name-method").bare,l.__esModule=!0},{"../../helpers/name-method":36}],106:[function(e,n,l){"use strict";function t(e){return c.isLiteral(c.toComputedKey(e,e.key),{value:"__proto__"})}function r(e){var n=e.left;return c.isMemberExpression(n)&&c.isLiteral(c.toComputedKey(n,n.property),{value:"__proto__"})}function a(e,n,l){return c.expressionStatement(c.callExpression(l.addHelper("defaults"),[n,e.right]))}function u(e,n,l,t){if(r(e)){var u=[],o=e.left.object,s=l.generateTempBasedOnNode(e.left.object);return u.push(c.expressionStatement(c.assignmentExpression("=",s,o))),u.push(a(e,s,t)),s&&u.push(s),c.toSequenceExpression(u)}}function o(e,n,l,t){var u=e.expression;if(c.isAssignmentExpression(u,{operator:"="}))return r(u)?a(u,u.left.object,t):void 0}function s(e,n,l,r){for(var a,u=0;u<e.properties.length;u++){var o=e.properties[u];t(o)&&(a=o.value,p(e.properties,o))}if(a){var s=[c.objectExpression([]),a];return e.properties.length&&s.push(e),c.callExpression(r.addHelper("extends"),s)}}var i=function(e){return e&&e.__esModule?e["default"]:e};l.AssignmentExpression=u,l.ExpressionStatement=o,l.ObjectExpression=s;{var c=i(e("../../../types")),p=i(e("lodash/array/pull"));l.secondPass=!0,l.optional=!0}l.__esModule=!0},{"../../../types":122,"lodash/array/pull":199}],107:[function(e,n,l){"use strict";function t(e,n,l,t){if(this.skip(),"typeof"===e.operator){var r=a.callExpression(t.addHelper("typeof"),[e.argument]);if(a.isIdentifier(e.argument)){var u=a.literal("undefined");return a.conditionalExpression(a.binaryExpression("===",a.unaryExpression("typeof",e.argument),u),u,r)}return r}}var r=function(e){return e&&e.__esModule?e["default"]:e};l.UnaryExpression=t;{var a=r(e("../../../types"));l.optional=!0}l.__esModule=!0},{"../../../types":122}],108:[function(e,n,l){"use strict";function t(e){return"undefined"===e.name&&this.isReferenced()?a.unaryExpression("void",a.literal(0),!0):void 0}var r=function(e){return e&&e.__esModule?e["default"]:e};l.Identifier=t;{var a=r(e("../../../types"));l.optional=!0}l.__esModule=!0},{"../../../types":122}],109:[function(e,n,l){"use strict";function t(e){if(u.isBlockStatement(e)){for(var n=!1,l=0;l<e.body.length;l++){var t=e.body[l];u.isBlockScoped(t)&&(n=!0)}if(!n)return e.body}return e}function r(e,n,l){var t=u.evaluateTruthy(e.test,l);return t===!0?e.consequent:t===!1?e.alternate:void 0}var a=function(e){return e&&e.__esModule?e["default"]:e};l.ConditionalExpression=r;{var u=a(e("../../../types"));l.optional=!0,l.IfStatement={exit:function(e,n,l){var r=e.consequent,a=e.alternate,o=e.test,s=u.evaluateTruthy(o,l);return s===!0?t(r):s===!1?a?t(a):this.remove():(u.isBlockStatement(a)&&!a.body.length&&(a=e.alternate=null),void(u.isBlockStatement(r)&&!r.body.length&&u.isBlockStatement(a)&&a.body.length&&(e.consequent=e.alternate,e.alternate=null,e.test=u.unaryExpression("!",o,!0))))}}}l.__esModule=!0},{"../../../types":122}],110:[function(e,n,l){(function(n){"use strict";function t(e){if(u(e.object)){var l=a.toComputedKey(e,e.property);if(a.isLiteral(l))return a.valueToNode(n.env[l.value])}}var r=function(e){return e&&e.__esModule?e["default"]:e};l.MemberExpression=t;var a=r(e("../../../types")),u=(l.optional=!0,a.buildMatchMemberExpression("process.env"));l.__esModule=!0}).call(this,e("_process"))},{"../../../types":122,_process:151}],111:[function(e,n,l){"use strict";function t(e,n,l){var t=u.evaluate(e,l);return t.confident?u.valueToNode(t.value):void 0}function r(){}var a=function(e){return e&&e.__esModule?e["default"]:e};l.Expression=t,l.Identifier=r;{var u=a(e("../../../types"));l.optional=!0}l.__esModule=!0},{"../../../types":122}],112:[function(e,n,l){"use strict";function t(e,n){u(e.callee)&&(a.isExpressionStatement(n)?this.parentPath.remove():this.remove())}var r=function(e){return e&&e.__esModule?e["default"]:e};l.CallExpression=t;{var a=r(e("../../../types")),u=a.buildMatchMemberExpression("console",!0);l.optional=!0}l.__esModule=!0},{"../../../types":122}],113:[function(e,n,l){"use strict";function t(){this.get("expression").isIdentifier({name:"debugger"})&&this.remove()}var r=function(e){return e&&e.__esModule?e["default"]:e};l.ExpressionStatement=t;r(e("../../../types")),l.optional=!0;l.__esModule=!0},{"../../../types":122}],114:[function(e,n,l){"use strict";function t(e,n,l,t){s.isIdentifier(e.callee,{name:"require"})&&1===e.arguments.length&&i(e.arguments[0],t)}function r(e,n,l,t){i(e.source,t)}var a=function(e){return e&&e.__esModule?e["default"]:e},u=function(e){return e&&e.__esModule?e:{"default":e}};l.CallExpression=t,l.ModuleDeclaration=r;var o=u(e("../../../messages")),s=a(e("../../../types")),i=function(e,n){if(s.isLiteral(e)){var l=e.value,t=l.toLowerCase();if("react"===t&&l!==t)throw n.errorWithNode(e,o.get("didYouMean","react"))}};l.__esModule=!0},{"../../../messages":26,"../../../types":122}],115:[function(e,n,l){"use strict";function t(e,n,l,t){if(this.isReferenced()&&!l.hasBinding(e.name)){var r,a=l.getAllBindings(),s=-1;for(var i in a){var c=u(e.name,i);0>=c||c>3||s>=c||(r=i,s=c)}var p;throw p=r?o.get("undeclaredVariableSuggestion",e.name,r):o.get("undeclaredVariable",e.name),t.errorWithNode(e,p,ReferenceError)}}var r=function(e){return e&&e.__esModule?e:{"default":e}},a=function(e){return e&&e.__esModule?e["default"]:e};l.Identifier=t;{var u=a(e("leven")),o=r(e("../../../messages"));l.optional=!0}l.__esModule=!0},{"../../../messages":26,leven:193}],116:[function(e,n){"use strict";var l=function(e){return e&&e.__esModule?e["default"]:e},t=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},r=l(e("./path")),a=l(e("lodash/array/flatten")),u=l(e("lodash/array/compact")),o=function(){function e(n,l,r,a){t(this,e),this.shouldFlatten=!1,this.parentPath=a,this.scope=n,this.state=r,this.opts=l}return e.prototype.flatten=function(){this.shouldFlatten=!0},e.prototype.visitNode=function(e,n,l){var t=r.get(this.parentPath,this,e,n,l);return t.visit()},e.prototype.visit=function(e,n){var l=e[n];if(l){if(!Array.isArray(l))return this.visitNode(e,e,n);if(0!==l.length){for(var t=0;t<l.length;t++)if(l[t]&&this.visitNode(e,l,t))return!0;this.shouldFlatten&&(e[n]=a(e[n]),("body"===n||"expressions"===n)&&(e[n]=u(e[n])))}}},e}();n.exports=o},{"./path":118,"lodash/array/compact":196,"lodash/array/flatten":197}],117:[function(e,n){"use strict";function l(e,n,t,r){if(e){if(!n.noScope&&!t&&"Program"!==e.type&&"File"!==e.type)throw new Error("Must pass a scope unless traversing a Program/File got a "+e.type+" node");if(n||(n={}),n.enter||(n.enter=function(){}),n.exit||(n.exit=function(){}),Array.isArray(e))for(var a=0;a<e.length;a++)l.node(e[a],n,t,r);else l.node(e,n,t,r)}}function t(e){e._declarations=null,e.extendedRange=null,e._scopeInfo=null,e._paths=null,e.tokens=null,e.range=null,e.start=null,e.end=null,e.loc=null,e.raw=null,Array.isArray(e.trailingComments)&&r(e.trailingComments),Array.isArray(e.leadingComments)&&r(e.leadingComments);for(var n in e){var l=e[n];Array.isArray(l)&&delete l._paths}}function r(e){for(var n=0;n<e.length;n++)t(e[n])}function a(e,n,l,t){e.type===t.type&&(t.has=!0,this.skip())}var u=function(e){return e&&e.__esModule?e["default"]:e};n.exports=l;var o=u(e("./context")),s=u(e("lodash/collection/includes")),i=u(e("../types"));l.node=function(e,n,l,t,r){var a=i.VISITOR_KEYS[e.type];if(a)for(var u=new o(l,n,t,r),s=0;s<a.length;s++)if(u.visit(e,a[s]))return};var c={noScope:!0,exit:t};l.removeProperties=function(e){return l(e,c),t(e),e},l.explode=function(e){for(var n in e){var l=e[n],t=i.FLIPPED_ALIAS_KEYS[n];if(t)for(var r=0;r<t.length;r++){var a=e,u=t[r];a[u]||(a[u]=l)}}return e},l.hasType=function(e,n,t,r){if(s(r,e.type))return!1;if(e.type===t)return!0;var u={has:!1,type:t};return l(e,{blacklist:r,enter:a},n,u),u.has}},{"../types":122,"./context":116,"lodash/collection/includes":205}],118:[function(e,n){"use strict";var l=function(e){return e&&e.__esModule?e["default"]:e},t=function(e,n,l){n&&Object.defineProperties(e,n),l&&Object.defineProperties(e.prototype,l)},r=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},a=l(e("./index")),u=l(e("lodash/collection/includes")),o=l(e("./scope")),s=l(e("../types")),i=function(){function e(n,l,t){r(this,e),this.parentPath=n,this.container=t,this.parent=l,this.data={}}return e.get=function(n,l,t,r,a){for(var u,o,s=r[a],i=(u=r,!u._paths&&(u._paths=[]),u._paths),c=0;c<i.length;c++){var p=i[c];if(p.node===s){o=p;break}}return o||(o=new e(n,t,r),i.push(o)),o.setContext(l,a),o},e.getScope=function(e,n,l){var t=l;return s.isScope(e,n)&&(t=new o(e,n,l)),t},e.prototype.setData=function(e,n){return this.data[e]=n},e.prototype.getData=function(e){return this.data[e]},e.prototype.setScope=function(){this.scope=e.getScope(this.node,this.parent,this.context.scope)},e.prototype.setContext=function(e,n){this.shouldRemove=!1,this.shouldSkip=!1,this.shouldStop=!1,this.context=e,this.state=e.state,this.opts=e.opts,this.key=n,this.setScope()},e.prototype.remove=function(){this.shouldRemove=!0,this.shouldSkip=!0},e.prototype.skip=function(){this.shouldSkip=!0},e.prototype.stop=function(){this.shouldStop=!0,this.shouldSkip=!0 },e.prototype.flatten=function(){this.context.flatten()},e.prototype.call=function(e){var n=this.node;if(n){var l=this.opts,t=l[e]||l;l[n.type]&&(t=l[n.type][e]||t);var r=t.call(this,n,this.parent,this.scope,this.state);r&&(this.node=r),this.shouldRemove&&(this.container[this.key]=null,this.flatten())}},e.prototype.isBlacklisted=function(){var e=this.opts.blacklist;return e&&e.indexOf(this.node.type)>-1},e.prototype.visit=function(){if(this.isBlacklisted())return!1;if(this.call("enter"),this.shouldSkip)return this.shouldStop;var e=this.node,n=this.opts;if(Array.isArray(e))for(var l=0;l<e.length;l++)a.node(e[l],n,this.scope,this.state,this);else a.node(e,n,this.scope,this.state,this),this.call("exit");return this.shouldStop},e.prototype.get=function(n){return e.get(this,this.context,this.node,this.node,n)},e.prototype.isReferencedIdentifier=function(e){return s.isReferencedIdentifier(this.node,this.parent,e)},e.prototype.isReferenced=function(){return s.isReferenced(this.node,this.parent)},e.prototype.isScope=function(){return s.isScope(this.node,this.parent)},e.prototype.getBindingIdentifiers=function(){return s.getBindingIdentifiers(this.node)},t(e,null,{node:{get:function(){return this.container[this.key]},set:function(e){var n=Array.isArray(e),l=e;n&&(l=e[0]),l&&s.inheritsComments(l,this.node),this.container[this.key]=e,this.setScope();var t=this.scope&&this.scope.file;if(t)if(n)for(var r=0;r<e.length;r++)t.checkNode(e[r],this.scope);else t.checkNode(e,this.scope);n&&(u(s.STATEMENT_OR_BLOCK_KEYS,this.key)&&!s.isBlockStatement(this.container)&&s.ensureBlock(this.container,this.key),this.flatten())},configurable:!0}}),e}();n.exports=i;for(var c=0;c<s.TYPES.length;c++)!function(){var e=s.TYPES[c],n="is"+e;i.prototype[n]=function(e){return s[n](this.node,e)}}()},{"../types":122,"./index":117,"./scope":119,"lodash/collection/includes":205}],119:[function(e,n){"use strict";var l=function(e){return e&&e.__esModule?e:{"default":e}},t=function(e){return e&&e.__esModule?e["default"]:e},r=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},a=t(e("lodash/collection/includes")),u=t(e("./index")),o=t(e("lodash/object/defaults")),s=l(e("../messages")),i=t(e("globals")),c=t(e("lodash/array/flatten")),p=t(e("lodash/object/extend")),d=t(e("../helpers/object")),f=t(e("lodash/collection/each")),h=t(e("../types")),g={enter:function(e,n,l,t){return h.isFor(e)&&f(h.FOR_INIT_KEYS,function(n){var l=e[n];h.isVar(l)&&t.scope.registerBinding("var",l)}),h.isFunction(e)?this.skip():void(t.blockId&&e===t.blockId||h.isBlockScoped(e)||h.isExportDeclaration(e)&&h.isDeclaration(e.declaration)||h.isDeclaration(e)&&t.scope.registerDeclaration(e))}},m={enter:function(e,n,l,t){h.isReferencedIdentifier(e,n)&&!l.hasBinding(e.name)?t.addGlobal(e):h.isLabeledStatement(e)?t.addGlobal(e):(h.isAssignmentExpression(e)||h.isUpdateExpression(e)||h.isUnaryExpression(e)&&"delete"===e.operator)&&l.registerBindingReassignment(e)}},y={enter:function(e,n,l,t){h.isFunctionDeclaration(e)||h.isBlockScoped(e)?t.registerDeclaration(e):h.isScope(e,n)&&this.skip()}},_=function(){function e(n,l,t,a){r(this,e),this.parent=t,this.file=t?t.file:a,this.parentBlock=l,this.block=n,this.crawl()}return e.globals=c([i.builtin,i.browser,i.node].map(Object.keys)),e.contextVariables=["this","arguments"],e.prototype.traverse=function(e){var n=function(){return e.apply(this,arguments)};return n.toString=function(){return e.toString()},n}(function(e,n,l){u(e,n,this,l)}),e.prototype.generateTemp=function(e){var n=this.generateUidIdentifier(e||"temp");return this.push({key:n.name,id:n}),n},e.prototype.generateUidIdentifier=function(e){var n=h.identifier(this.generateUid(e));return this.getFunctionParent().registerBinding("uid",n),n},e.prototype.generateUid=function(e){e=h.toIdentifier(e).replace(/^_+/,"");var n,l=0;do n=this._generateUid(e,l),l++;while(this.hasBinding(n)||this.hasGlobal(n));return n},e.prototype._generateUid=function(e,n){var l=e;return n>1&&(l+=n),"_"+l},e.prototype.generateUidBasedOnNode=function(e){var n=e;h.isAssignmentExpression(e)?n=e.left:h.isVariableDeclarator(e)?n=e.id:h.isProperty(n)&&(n=n.key);var l=[],t=function(e){var n=function(){return e.apply(this,arguments)};return n.toString=function(){return e.toString()},n}(function(e){h.isMemberExpression(e)?(t(e.object),t(e.property)):h.isIdentifier(e)?l.push(e.name):h.isLiteral(e)?l.push(e.value):h.isCallExpression(e)&&t(e.callee)});t(n);var r=l.join("$");return r=r.replace(/^_/,"")||"ref",this.generateUidIdentifier(r)},e.prototype.generateTempBasedOnNode=function(e){if(h.isIdentifier(e)&&this.hasBinding(e.name))return null;var n=this.generateUidBasedOnNode(e);return this.push({key:n.name,id:n}),n},e.prototype.checkBlockScopedCollisions=function(e,n,l){var t=this.getOwnBindingInfo(n);if(t&&"param"!==e&&!("hoisted"===e&&"let"===t.kind||"let"!==t.kind&&"const"!==t.kind&&"module"!==t.kind))throw this.file.errorWithNode(l,s.get("scopeDuplicateDeclaration",n),TypeError)},e.prototype.rename=function(e,n){n||(n=this.generateUidIdentifier(e).name);var l=this.getBindingInfo(e);if(l){var t=l.identifier,r=l.scope;r.traverse(r.block,{enter:function(l,r,a){if(h.isReferencedIdentifier(l,r)&&l.name===e)l.name=n;else if(h.isDeclaration(l)){var u=h.getBindingIdentifiers(l);for(var o in u)o===e&&(u[o].name=n)}else h.isScope(l,r)&&(a.bindingIdentifierEquals(e,t)||this.skip())}}),this.clearOwnBinding(e),r.bindings[n]=l,t.name=n}},e.prototype.inferType=function(e){var n;if(h.isVariableDeclarator(e)&&(n=e.init),h.isArrayExpression(n))return h.genericTypeAnnotation(h.identifier("Array"));if(!h.isObjectExpression(n)&&!h.isLiteral(n)){if(h.isCallExpression(n)&&h.isIdentifier(n.callee)){var l=this.getBindingInfo(n.callee.name);if(l){var t=l.node;return!l.reassigned&&h.isFunction(t)&&e.returnType}}h.isIdentifier(n)}},e.prototype.isTypeGeneric=function(e,n){var l=this.getBindingInfo(e);if(!l)return!1;var t=l.typeAnnotation;return h.isGenericTypeAnnotation(t)&&h.isIdentifier(t.id,{name:n})},e.prototype.assignTypeGeneric=function(e,n){this.assignType(e,h.genericTypeAnnotation(h.identifier(n)))},e.prototype.assignType=function(e,n){var l=this.getBindingInfo(e);l&&(l.typeAnnotation=n)},e.prototype.getTypeAnnotation=function(e,n,l){var t,r={annotation:null,inferred:!1};return n.typeAnnotation&&(t=n.typeAnnotation),t||(r.inferred=!0,t=this.inferType(l)),t&&(h.isTypeAnnotation(t)&&(t=t.typeAnnotation),r.annotation=t),r},e.prototype.toArray=function(e,n){var l=this.file;if(h.isIdentifier(e)&&this.isTypeGeneric(e.name,"Array"))return e;if(h.isArrayExpression(e))return e;if(h.isIdentifier(e,{name:"arguments"}))return h.callExpression(h.memberExpression(l.addHelper("slice"),h.identifier("call")),[e]);var t="to-array",r=[e];return n===!0?t="to-consumable-array":n&&(r.push(h.literal(n)),t="sliced-to-array"),h.callExpression(l.addHelper(t),r)},e.prototype.clearOwnBinding=function(e){delete this.bindings[e]},e.prototype.registerDeclaration=function(e){if(h.isFunctionDeclaration(e))this.registerBinding("hoisted",e);else if(h.isVariableDeclaration(e))for(var n=0;n<e.declarations.length;n++)this.registerBinding(e.kind,e.declarations[n]);else h.isClassDeclaration(e)?this.registerBinding("let",e):h.isImportDeclaration(e)||h.isExportDeclaration(e)?this.registerBinding("module",e):this.registerBinding("unknown",e)},e.prototype.registerBindingReassignment=function(e){var n=h.getBindingIdentifiers(e);for(var l in n){var t=this.getBindingInfo(l);t&&(t.reassigned=!0,t.typeAnnotationInferred&&(t.typeAnnotation=null))}},e.prototype.registerBinding=function(e,n){if(!e)throw new ReferenceError("no `kind`");var l=h.getBindingIdentifiers(n);for(var t in l){var r=l[t];this.checkBlockScopedCollisions(e,t,r);var a=this.getTypeAnnotation(t,r,n);this.bindings[t]={typeAnnotationInferred:a.inferred,typeAnnotation:a.annotation,reassigned:!1,identifier:r,scope:this,node:n,kind:e}}},e.prototype.registerVariableDeclaration=function(e){for(var n=e.declarations,l=0;l<n.length;l++)this.registerBinding(e.kind,n[l])},e.prototype.addGlobal=function(e){this.globals[e.name]=e},e.prototype.hasGlobal=function(e){var n=this;do if(n.globals[e])return!0;while(n=n.parent);return!1},e.prototype.crawl=function(){var e,n=this.block,l=n._scopeInfo;if(l)return void p(this,l);if(l=n._scopeInfo={bindings:d(),globals:d()},p(this,l),h.isLoop(n)){for(e=0;e<h.FOR_INIT_KEYS.length;e++){var t=n[h.FOR_INIT_KEYS[e]];h.isBlockScoped(t)&&this.registerBinding("let",t)}h.isBlockStatement(n.body)&&(n=n.body)}if(h.isFunctionExpression(n)&&n.id&&(h.isProperty(this.parentBlock,{method:!0})||this.registerBinding("var",n.id)),h.isFunction(n)){for(e=0;e<n.params.length;e++)this.registerBinding("param",n.params[e]);this.traverse(n.body,y,this)}(h.isBlockStatement(n)||h.isProgram(n))&&this.traverse(n,y,this),h.isCatchClause(n)&&this.registerBinding("let",n.param),h.isComprehensionExpression(n)&&this.registerBinding("let",n),(h.isProgram(n)||h.isFunction(n))&&this.traverse(n,g,{blockId:n.id,scope:this}),h.isProgram(n)&&this.traverse(n,m,this)},e.prototype.push=function(e){var n=this.block;if((h.isLoop(n)||h.isCatchClause(n)||h.isFunction(n))&&(h.ensureBlock(n),n=n.body),!h.isBlockStatement(n)&&!h.isProgram(n))throw new TypeError("cannot add a declaration here in node type "+n.type);var l=n;l._declarations||(l._declarations={}),n._declarations[e.key]={kind:e.kind||"var",id:e.id,init:e.init}},e.prototype.getFunctionParent=function(){for(var e=this;e.parent&&!h.isFunction(e.block);)e=e.parent;return e},e.prototype.getAllBindings=function(){var e=d(),n=this;do o(e,n.bindings),n=n.parent;while(n);return e},e.prototype.getAllBindingsOfKind=function(e){var n=d(),l=this;do{for(var t in l.bindings){var r=l.bindings[t];r.kind===e&&(n[t]=r)}l=l.parent}while(l);return n},e.prototype.bindingIdentifierEquals=function(e,n){return this.getBindingIdentifier(e)===n},e.prototype.getBindingInfo=function(e){var n=this;do{var l=n.getOwnBindingInfo(e);if(l)return l}while(n=n.parent)},e.prototype.getOwnBindingInfo=function(e){return this.bindings[e]},e.prototype.getBindingIdentifier=function(e){var n=this.getBindingInfo(e);return n&&n.identifier},e.prototype.getOwnBindingIdentifier=function(e){var n=this.bindings[e];return n&&n.identifier},e.prototype.getOwnImmutableBindingValue=function(e){return this._immutableBindingInfoToValue(this.getOwnBindingInfo(e))},e.prototype.getImmutableBindingValue=function(e){return this._immutableBindingInfoToValue(this.getBindingInfo(e))},e.prototype._immutableBindingInfoToValue=function(e){if(e&&!e.reassigned){var n=e.node;if(h.isVariableDeclarator(n)){if(!h.isIdentifier(n.id))return;n=n.init}return h.isImmutable(n)?n:void 0}},e.prototype.hasOwnBinding=function(e){return!!this.getOwnBindingInfo(e)},e.prototype.hasBinding=function(n){return n?this.hasOwnBinding(n)?!0:this.parentHasBinding(n)?!0:a(e.globals,n)?!0:a(e.contextVariables,n)?!0:!1:!1},e.prototype.parentHasBinding=function(e){return this.parent&&this.parent.hasBinding(e)},e}();n.exports=_},{"../helpers/object":24,"../messages":26,"../types":122,"./index":117,globals:188,"lodash/array/flatten":197,"lodash/collection/each":202,"lodash/collection/includes":205,"lodash/object/defaults":302,"lodash/object/extend":303}],120:[function(e,n){n.exports={ExpressionStatement:["Statement"],BreakStatement:["Statement"],ContinueStatement:["Statement"],DebuggerStatement:["Statement"],DoWhileStatement:["Statement","Loop","While","Scopable"],IfStatement:["Statement"],ReturnStatement:["Statement"],SwitchStatement:["Statement"],ThrowStatement:["Statement"],TryStatement:["Statement"],WhileStatement:["Statement","Loop","While","Scopable"],WithStatement:["Statement"],EmptyStatement:["Statement"],LabeledStatement:["Statement"],VariableDeclaration:["Statement","Declaration"],ExportDeclaration:["Statement","Declaration","ModuleDeclaration"],ImportDeclaration:["Statement","Declaration","ModuleDeclaration"],PrivateDeclaration:["Statement","Declaration"],ArrowFunctionExpression:["Scopable","Function","Expression"],FunctionDeclaration:["Scopable","Function","Statement","Declaration"],FunctionExpression:["Scopable","Function","Expression"],ImportSpecifier:["ModuleSpecifier"],ExportSpecifier:["ModuleSpecifier"],BlockStatement:["Statement","Scopable"],Program:["Scopable"],CatchClause:["Scopable"],LogicalExpression:["Binary","Expression"],BinaryExpression:["Binary","Expression"],UnaryExpression:["UnaryLike","Expression"],SpreadProperty:["UnaryLike"],SpreadElement:["UnaryLike"],ClassDeclaration:["Statement","Declaration","Class"],ClassExpression:["Class","Expression"],ForOfStatement:["Scopable","Statement","For","Loop"],ForInStatement:["Scopable","Statement","For","Loop"],ForStatement:["Scopable","Statement","For","Loop"],ObjectPattern:["Pattern"],ArrayPattern:["Pattern"],AssignmentPattern:["Pattern"],Property:["UserWhitespacable"],ArrayExpression:["Expression"],AssignmentExpression:["Expression"],AwaitExpression:["Expression"],BindFunctionExpression:["Expression"],BindMemberExpression:["Expression"],CallExpression:["Expression"],ComprehensionExpression:["Expression","Scopable"],ConditionalExpression:["Expression"],Identifier:["Expression"],Literal:["Expression"],MemberExpression:["Expression"],NewExpression:["Expression"],ObjectExpression:["Expression"],SequenceExpression:["Expression"],TaggedTemplateExpression:["Expression"],ThisExpression:["Expression"],UpdateExpression:["Expression"],VirtualPropertyExpression:["Expression"],JSXEmptyExpression:["Expression"],JSXMemberExpression:["Expression"],YieldExpression:["Expression"],AnyTypeAnnotation:["Flow"],ArrayTypeAnnotation:["Flow"],BooleanTypeAnnotation:["Flow"],ClassImplements:["Flow"],DeclareClass:["Flow"],DeclareFunction:["Flow"],DeclareModule:["Flow"],DeclareVariable:["Flow"],FunctionTypeAnnotation:["Flow"],FunctionTypeParam:["Flow"],GenericTypeAnnotation:["Flow"],InterfaceExtends:["Flow"],InterfaceDeclaration:["Flow"],IntersectionTypeAnnotation:["Flow"],NullableTypeAnnotation:["Flow"],NumberTypeAnnotation:["Flow"],StringLiteralTypeAnnotation:["Flow"],StringTypeAnnotation:["Flow"],TupleTypeAnnotation:["Flow"],TypeofTypeAnnotation:["Flow"],TypeAlias:["Flow"],TypeAnnotation:["Flow"],TypeCastExpression:["Flow"],TypeParameterDeclaration:["Flow"],TypeParameterInstantiation:["Flow"],ObjectTypeAnnotation:["Flow"],ObjectTypeCallProperty:["Flow"],ObjectTypeIndexer:["Flow"],ObjectTypeProperty:["Flow"],QualifiedTypeIdentifier:["Flow"],UnionTypeAnnotation:["Flow"],VoidTypeAnnotation:["Flow"],JSXAttribute:["JSX"],JSXClosingElement:["JSX"],JSXElement:["JSX","Expression"],JSXEmptyExpression:["JSX"],JSXExpressionContainer:["JSX"],JSXIdentifier:["JSX"],JSXMemberExpression:["JSX"],JSXNamespacedName:["JSX"],JSXOpeningElement:["JSX"],JSXSpreadAttribute:["JSX"]}},{}],121:[function(e,n){n.exports={ArrayExpression:{elements:null},ArrowFunctionExpression:{params:null,body:null},AssignmentExpression:{operator:null,left:null,right:null},BinaryExpression:{operator:null,left:null,right:null},BlockStatement:{body:null},CallExpression:{callee:null,arguments:null},ConditionalExpression:{test:null,consequent:null,alternate:null},ExpressionStatement:{expression:null},File:{program:null,comments:null,tokens:null},FunctionExpression:{id:null,params:null,body:null,generator:!1},FunctionDeclaration:{id:null,params:null,body:null,generator:!1},GenericTypeAnnotation:{id:null,typeParameters:null},Identifier:{name:null},IfStatement:{test:null,consequent:null,alternate:null},ImportDeclaration:{specifiers:null,source:null},ImportSpecifier:{id:null,name:null},LabeledStatement:{label:null,body:null},Literal:{value:null},LogicalExpression:{operator:null,left:null,right:null},MemberExpression:{object:null,property:null,computed:!1},MethodDefinition:{key:null,value:null,computed:!1,"static":!1,kind:null},NewExpression:{callee:null,arguments:null},ObjectExpression:{properties:null},Program:{body:null},Property:{kind:null,key:null,value:null,computed:!1},ReturnStatement:{argument:null},SequenceExpression:{expressions:null},TemplateLiteral:{quasis:null,expressions:null},ThrowExpression:{argument:null},UnaryExpression:{operator:null,argument:null,prefix:null},VariableDeclaration:{kind:null,declarations:null},VariableDeclarator:{id:null,init:null},WithStatement:{object:null,body:null},YieldExpression:{argument:null,delegate:null}}},{}],122:[function(e,n){"use strict";function l(e,n){var l=h["is"+e]=function(l,t){return h.is(e,l,t,n)};h["assert"+e]=function(n,t){if(t||(t={}),!l(n,t))throw new Error("Expected type "+JSON.stringify(e)+" with option "+JSON.stringify(t))}}var t=function(e){return e&&e.__esModule?e["default"]:e},r=t(e("to-fast-properties")),a=t(e("lodash/lang/isPlainObject")),u=t(e("lodash/lang/isNumber")),o=t(e("lodash/lang/isRegExp")),s=t(e("lodash/lang/isString")),i=t(e("lodash/array/compact")),c=t(e("esutils")),p=t(e("../helpers/object")),d=(t(e("lodash/lang/clone")),t(e("lodash/collection/each"))),f=t(e("lodash/array/uniq")),h={};n.exports=h,h.STATEMENT_OR_BLOCK_KEYS=["consequent","body","alternate"],h.NATIVE_TYPE_NAMES=["Array","Object","Number","Boolean","Date","Array","String"],h.FOR_INIT_KEYS=["left","init"],h.VISITOR_KEYS=e("./visitor-keys"),h.ALIAS_KEYS=e("./alias-keys"),h.FLIPPED_ALIAS_KEYS={},d(h.VISITOR_KEYS,function(e,n){l(n,!0)}),d(h.ALIAS_KEYS,function(e,n){d(e,function(e){var l,t,r=(l=h.FLIPPED_ALIAS_KEYS,t=e,!l[t]&&(l[t]=[]),l[t]);r.push(n)})}),d(h.FLIPPED_ALIAS_KEYS,function(e,n){h[n.toUpperCase()+"_TYPES"]=e,l(n,!1)}),h.TYPES=Object.keys(h.VISITOR_KEYS).concat(Object.keys(h.FLIPPED_ALIAS_KEYS)),h.is=function(e,n,l,t){if(!n)return!1;var r=e===n.type;if(!r&&!t){var a=h.FLIPPED_ALIAS_KEYS[e];"undefined"!=typeof a&&(r=a.indexOf(n.type)>-1)}return r?"undefined"!=typeof l?h.shallowEqual(n,l):!0:!1},h.BUILDER_KEYS=e("./builder-keys"),d(h.VISITOR_KEYS,function(e,n){if(!h.BUILDER_KEYS[n]){var l={};d(e,function(e){l[e]=null}),h.BUILDER_KEYS[n]=l}}),d(h.BUILDER_KEYS,function(e,n){h[n[0].toLowerCase()+n.slice(1)]=function(){var l={};l.start=null,l.type=n;var t=0;for(var r in e){var a=arguments[t++];void 0===a&&(a=e[r]),l[r]=a}return l}}),h.toComputedKey=function(e,n){return e.computed||h.isIdentifier(n)&&(n=h.literal(n.name)),n},h.isFalsyExpression=function(e){return h.isLiteral(e)?!e.value:h.isIdentifier(e)?"undefined"===e.name:!1},h.toSequenceExpression=function(e,n){var l=[];return d(e,function(e){h.isExpression(e)&&l.push(e),h.isExpressionStatement(e)?l.push(e.expression):h.isVariableDeclaration(e)&&d(e.declarations,function(t){n.push({kind:e.kind,key:t.id.name,id:t.id}),l.push(h.assignmentExpression("=",t.id,t.init))})}),1===l.length?l[0]:h.sequenceExpression(l)},h.shallowEqual=function(e,n){for(var l=Object.keys(n),t=0;t<l.length;t++){var r=l[t];if(e[r]!==n[r])return!1}return!0},h.appendToMemberExpression=function(e,n,l){return e.object=h.memberExpression(e.object,e.property,e.computed),e.property=n,e.computed=!!l,e},h.prependToMemberExpression=function(e,n){return e.object=h.memberExpression(n,e.object),e},h.isReferenced=function(e,n){if(h.isMemberExpression(n))return n.property===e&&n.computed?!0:n.object===e?!0:!1;if(h.isProperty(n)&&n.key===e)return n.computed;if(h.isVariableDeclarator(n))return n.id!==e;if(h.isFunction(n)){for(var l=0;l<n.params.length;l++){var t=n.params[l];if(t===e)return!1}return n.id!==e}return h.isExportSpecifier(n,{name:e})?!1:h.isImportSpecifier(n,{id:e})?!1:h.isClass(n)?n.id!==e:h.isMethodDefinition(n)?n.key===e&&n.computed:h.isLabeledStatement(n)?!1:h.isCatchClause(n)?n.param!==e:h.isRestElement(n)?!1:h.isAssignmentPattern(n)?n.right===e:h.isPattern(n)?!1:h.isImportSpecifier(n)?!1:h.isImportBatchSpecifier(n)?!1:h.isPrivateDeclaration(n)?!1:!0},h.isReferencedIdentifier=function(e,n,l){return h.isIdentifier(e,l)&&h.isReferenced(e,n)},h.isValidIdentifier=function(e){return s(e)&&c.keyword.isIdentifierName(e)&&!c.keyword.isReservedWordES6(e,!0)},h.toIdentifier=function(e){return h.isIdentifier(e)?e.name:(e+="",e=e.replace(/[^a-zA-Z0-9$_]/g,"-"),e=e.replace(/^[-0-9]+/,""),e=e.replace(/[-\s]+(.)?/g,function(e,n){return n?n.toUpperCase():""}),h.isValidIdentifier(e)||(e="_"+e),e||"_")},h.ensureBlock=function(e,n){return n||(n="body"),e[n]=h.toBlock(e[n],e)},h.clone=function(e){var n={};for(var l in e)"_"!==l[0]&&(n[l]=e[l]);return n},h.cloneDeep=function(e){var n={};for(var l in e){var t=e[l];t&&(t.type?t=h.cloneDeep(t):Array.isArray(t)&&(t=t.map(h.cloneDeep))),n[l]=t}return n},h.buildMatchMemberExpression=function(e,n){var l=e.split(".");return function(e){if(!h.isMemberExpression(e))return!1;for(var t=[e],r=0;t.length;){var a=t.shift();if(n&&r===l.length)return!0;if(h.isIdentifier(a)){if(l[r]!==a.name)return!1}else{if(!h.isLiteral(a)){if(h.isMemberExpression(a)){if(a.computed&&!h.isLiteral(a.property))return!1;t.push(a.object),t.push(a.property);continue}return!1}if(l[r]!==a.value)return!1}if(++r>l.length)return!1}return!0}},h.toStatement=function(e,n){if(h.isStatement(e))return e;var l,t=!1;if(h.isClass(e))t=!0,l="ClassDeclaration";else if(h.isFunction(e))t=!0,l="FunctionDeclaration";else if(h.isAssignmentExpression(e))return h.expressionStatement(e);if(t&&!e.id&&(l=!1),!l){if(n)return!1;throw new Error("cannot turn "+e.type+" to a statement")}return e.type=l,e},h.toExpression=function(e){if(h.isExpressionStatement(e)&&(e=e.expression),h.isClass(e)?e.type="ClassExpression":h.isFunction(e)&&(e.type="FunctionExpression"),h.isExpression(e))return e;throw new Error("cannot turn "+e.type+" to an expression")},h.toBlock=function(e,n){return h.isBlockStatement(e)?e:(h.isEmptyStatement(e)&&(e=[]),Array.isArray(e)||(h.isStatement(e)||(e=h.isFunction(n)?h.returnStatement(e):h.expressionStatement(e)),e=[e]),h.blockStatement(e))},h.getBindingIdentifiers=function(e){for(var n=[].concat(e),l=p();n.length;){var t=n.shift();if(t){var r=h.getBindingIdentifiers.keys[t.type];if(h.isIdentifier(t))l[t.name]=t;else if(h.isImportSpecifier(t))n.push(t.name||t.id);else if(h.isExportDeclaration(t))h.isDeclaration(e.declaration)&&n.push(e.declaration);else if(r)for(var a=0;a<r.length;a++){var u=r[a];n=n.concat(t[u]||[])}}}return l},h.getBindingIdentifiers.keys={UnaryExpression:["argument"],AssignmentExpression:["left"],ImportBatchSpecifier:["name"],VariableDeclarator:["id"],FunctionDeclaration:["id"],ClassDeclaration:["id"],SpreadElement:["argument"],RestElement:["argument"],UpdateExpression:["argument"],SpreadProperty:["argument"],Property:["value"],ComprehensionBlock:["left"],AssignmentPattern:["left"],PrivateDeclaration:["declarations"],ComprehensionExpression:["blocks"],ImportDeclaration:["specifiers"],VariableDeclaration:["declarations"],ArrayPattern:["elements"],ObjectPattern:["properties"]},h.isLet=function(e){return h.isVariableDeclaration(e)&&("var"!==e.kind||e._let)},h.isBlockScoped=function(e){return h.isFunctionDeclaration(e)||h.isClassDeclaration(e)||h.isLet(e)},h.isVar=function(e){return h.isVariableDeclaration(e,{kind:"var"})&&!e._let},h.COMMENT_KEYS=["leadingComments","trailingComments"],h.removeComments=function(e){return d(h.COMMENT_KEYS,function(n){delete e[n]}),e},h.inheritsComments=function(e,n){return d(h.COMMENT_KEYS,function(l){e[l]=f(i([].concat(e[l],n[l])))}),e},h.inherits=function(e,n){return e._declarations=n._declarations,e._scopeInfo=n._scopeInfo,e.range=n.range,e.start=n.start,e.loc=n.loc,e.end=n.end,e.typeAnnotation=n.typeAnnotation,e.returnType=n.returnType,h.inheritsComments(e,n),e},h.getLastStatements=function(e){var n=[],l=function(e){n=n.concat(h.getLastStatements(e))};return h.isIfStatement(e)?(l(e.consequent),l(e.alternate)):h.isFor(e)||h.isWhile(e)?l(e.body):h.isProgram(e)||h.isBlockStatement(e)?l(e.body[e.body.length-1]):e&&n.push(e),n},h.getSpecifierName=function(e){return e.name||e.id},h.getSpecifierId=function(e){return e["default"]?h.identifier("default"):e.id},h.isSpecifierDefault=function(e){return e["default"]||h.isIdentifier(e.id)&&"default"===e.id.name},h.isScope=function(e,n){if(h.isBlockStatement(e)){if(h.isLoop(n.block,{body:e}))return!1;if(h.isFunction(n.block,{body:e}))return!1}return h.isScopable(e)},h.isImmutable=function(e){return h.isLiteral(e)?e.regex?!1:!0:h.isIdentifier(e)&&"undefined"===e.name?!0:!1},h.evaluateTruthy=function(e,n){var l=h.evaluate(e,n);return l.confident?!!l.value:void 0},h.evaluate=function(e,n){function l(e){if(t){if(h.isSequenceExpression(e))return l(e.expressions[e.expressions.length-1]);if(h.isLiteral(e)&&(!e.regex||null!==e.value))return e.value;if(h.isConditionalExpression(e))return l(l(e.test)?e.consequent:e.alternate);if(h.isIdentifier(e))return"undefined"===e.name?void 0:l(n.getImmutableBindingValue(e.name));if(h.isUnaryExpression(e,{prefix:!0})){var r=l(e.argument);switch(e.operator){case"void":return void 0;case"!":return!r;case"+":return+r;case"-":return-r}}if(h.isArrayExpression(e)||h.isObjectExpression(e),h.isLogicalExpression(e)){var a=l(e.left),u=l(e.right);switch(e.operator){case"||":return a||u;case"&&":return a&&u}}if(h.isBinaryExpression(e)){var a=l(e.left),u=l(e.right);switch(e.operator){case"-":return a-u;case"+":return a+u;case"/":return a/u;case"*":return a*u;case"%":return a%u;case"<":return u>a;case">":return a>u;case"<=":return u>=a;case">=":return a>=u;case"==":return a==u;case"!=":return a!=u;case"===":return a===u;case"!==":return a!==u}}t=!1}}var t=!0,r=l(e);return t||(r=void 0),{confident:t,value:r}},h.valueToNode=function(e){if(void 0===e)return h.identifier("undefined");if(e===!0||e===!1||null===e||s(e)||u(e)||o(e))return h.literal(e);if(Array.isArray(e))return h.arrayExpression(e.map(h.valueToNode));if(a(e)){var n=[];for(var l in e){var t;t=h.isValidIdentifier(l)?h.identifier(l):h.literal(l),n.push(h.property("init",t,h.valueToNode(e[l])))}return h.objectExpression(n)}throw new Error("don't know how to turn this value into a node")},r(h),r(h.VISITOR_KEYS)},{"../helpers/object":24,"./alias-keys":120,"./builder-keys":121,"./visitor-keys":123,esutils:186,"lodash/array/compact":196,"lodash/array/uniq":200,"lodash/collection/each":202,"lodash/lang/clone":287,"lodash/lang/isNumber":295,"lodash/lang/isPlainObject":297,"lodash/lang/isRegExp":298,"lodash/lang/isString":299,"to-fast-properties":344}],123:[function(e,n){n.exports={ArrayExpression:["elements"],ArrayPattern:["elements","typeAnnotation"],ArrowFunctionExpression:["params","defaults","rest","body","returnType"],AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],AwaitExpression:["argument"],BinaryExpression:["left","right"],BindFunctionExpression:["callee","arguments"],BindMemberExpression:["object","property","arguments"],BlockStatement:["body"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ClassBody:["body"],ClassDeclaration:["id","body","superClass","typeParameters","superTypeParameters","implements"],ClassExpression:["id","body","superClass","typeParameters","superTypeParameters","implements"],ComprehensionBlock:["left","right","body"],ComprehensionExpression:["filter","blocks","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportBatchSpecifier:[],ExportDeclaration:["declaration","specifiers","source"],ExportSpecifier:["id","name"],ExpressionStatement:["expression"],File:["program"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],ForStatement:["init","test","update","body"],FunctionDeclaration:["id","params","defaults","rest","body","returnType","typeParameters"],FunctionExpression:["id","params","defaults","rest","body","returnType","typeParameters"],Identifier:["typeAnnotation"],IfStatement:["test","consequent","alternate"],ImportBatchSpecifier:["id"],ImportDeclaration:["specifiers","source"],ImportSpecifier:["id","name"],LabeledStatement:["label","body"],Literal:[],LogicalExpression:["left","right"],MemberExpression:["object","property"],MethodDefinition:["key","value"],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties","typeAnnotation"],PrivateDeclaration:["declarations"],Program:["body"],Property:["key","value"],RestElement:["argument","typeAnnotation"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],SpreadProperty:["argument"],SwitchCase:["test","consequent"],SwitchStatement:["discriminant","cases"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handlers","handler","guardedHandlers","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],VirtualPropertyExpression:["object","property"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"],AnyTypeAnnotation:[],ArrayTypeAnnotation:["elementType"],BooleanTypeAnnotation:[],ClassImplements:["id","typeParameters"],ClassProperty:["key","value","typeAnnotation"],DeclareClass:["id","typeParameters","extends","body"],DeclareFunction:["id"],DeclareModule:["id","body"],DeclareVariable:["id"],FunctionTypeAnnotation:["typeParameters","params","rest","returnType"],FunctionTypeParam:["name","typeAnnotation"],GenericTypeAnnotation:["id","typeParameters"],InterfaceExtends:["id","typeParameters"],InterfaceDeclaration:["id","typeParameters","extends","body"],IntersectionTypeAnnotation:["types"],NullableTypeAnnotation:["typeAnnotation"],NumberTypeAnnotation:[],StringLiteralTypeAnnotation:[],StringTypeAnnotation:[],TupleTypeAnnotation:["types"],TypeofTypeAnnotation:["argument"],TypeAlias:["id","typeParameters","right"],TypeAnnotation:["typeAnnotation"],TypeCastExpression:["expression"],TypeParameterDeclaration:["params"],TypeParameterInstantiation:["params"],ObjectTypeAnnotation:["key","value"],ObjectTypeCallProperty:["value"],ObjectTypeIndexer:["id","key","value"],ObjectTypeProperty:["key","value"],QualifiedTypeIdentifier:["id","qualification"],UnionTypeAnnotation:["types"],VoidTypeAnnotation:[],JSXAttribute:["name","value"],JSXClosingElement:["name"],JSXElement:["openingElement","closingElement","children"],JSXEmptyExpression:[],JSXExpressionContainer:["expression"],JSXIdentifier:[],JSXMemberExpression:["object","property"],JSXNamespacedName:["namespace","name"],JSXOpeningElement:["name","attributes"],JSXSpreadAttribute:["argument"]}},{}],124:[function(e,n,l){(function(n){"use strict";function t(e,n){var l=n||t.EXTENSIONS,r=E.extname(e);return _(l,r)}function r(n){try{return e.resolve(n)}catch(l){return null}}function a(e){return e?e.split(","):[]}function u(e){if(!e)return new RegExp(/.^/);if(Array.isArray(e)&&(e=e.join("|")),b(e))return new RegExp(e);if(v(e))return e;throw new TypeError("illegal type for regexify")}function o(e){if(!e)return[];if(m(e))return[e];if(b(e))return a(e);if(Array.isArray(e))return e;throw new TypeError("illegal type for arrayify")}function s(e){return"true"===e?!0:"false"===e?!1:e}function i(e,n,t){var r=l.templates[e];if(!r)throw new ReferenceError("unknown template "+e);if(n===!0&&(t=!0,n=null),r=g(r),I(n)||x(r,M,null,n),r.body.length>1)return r.body;var a=r.body[0];return!t&&C.isExpressionStatement(a)?a.expression:a}function c(e,n){var l=w({filename:e},n).program;return l=x.removeProperties(l)}function p(){var e={},l=E.join(n,"transformation/templates");if(!S.existsSync(l))throw new ReferenceError(y.get("missingTemplatesDirectory"));return k(S.readdirSync(l),function(n){if("."!==n[0]){var t=E.basename(n,E.extname(n)),r=E.join(l,n),a=S.readFileSync(r,"utf8");e[t]=c(r,a)}}),e}var d=function(e){return e&&e.__esModule?e:{"default":e}},f=function(e){return e&&e.__esModule?e["default"]:e};l.canCompile=t,l.resolve=r,l.list=a,l.regexify=u,l.arrayify=o,l.booleanify=s,l.template=i,l.parseTemplate=c,e("./patch");var h=f(e("debug/node")),g=f(e("lodash/lang/cloneDeep")),m=f(e("lodash/lang/isBoolean")),y=d(e("./messages")),_=f(e("lodash/collection/contains")),x=f(e("./traversal")),b=f(e("lodash/lang/isString")),v=f(e("lodash/lang/isRegExp")),I=f(e("lodash/lang/isEmpty")),w=f(e("./helpers/parse")),E=f(e("path")),k=f(e("lodash/collection/each")),R=f(e("lodash/object/has")),S=f(e("fs")),C=f(e("./types")),A=e("util"); l.inherits=A.inherits,l.inspect=A.inspect;l.debug=h("babel");t.EXTENSIONS=[".js",".jsx",".es6",".es"];var M={enter:function(e,n,l,t){return C.isExpressionStatement(e)&&(e=e.expression),C.isIdentifier(e)&&R(t,e.name)?(this.skip(),t[e.name]):void 0}};try{l.templates=e("../../templates.json")}catch(j){if("MODULE_NOT_FOUND"!==j.code)throw j;l.templates=p()}l.__esModule=!0}).call(this,"/lib/babel")},{"../../templates.json":347,"./helpers/parse":25,"./messages":26,"./patch":27,"./traversal":117,"./types":122,"debug/node":179,fs:140,"lodash/collection/contains":201,"lodash/collection/each":202,"lodash/lang/cloneDeep":288,"lodash/lang/isBoolean":291,"lodash/lang/isEmpty":292,"lodash/lang/isRegExp":298,"lodash/lang/isString":299,"lodash/object/has":304,path:150,util:167}],125:[function(n,l,t){!function(n,r){return"object"==typeof t&&"object"==typeof l?r(t):"function"==typeof e&&e.amd?e(["exports"],r):void r(n.acorn||(n.acorn={}))}(this,function(e){"use strict";function n(e){_t={};for(var n in It)_t[n]=e&&cn(e,n)?e[n]:It[n];if(vt=_t.sourceFile||null,wt(_t.onToken)){var l=_t.onToken;_t.onToken=function(e){l.push(e)}}if(wt(_t.onComment)){var t=_t.onComment;_t.onComment=function(e,n,l,r,a,u){var o={type:e?"Block":"Line",value:n,start:l,end:r};_t.locations&&(o.loc=new Y,o.loc.start=a,o.loc.end=u),_t.ranges&&(o.range=[l,r]),t.push(o)}}ka=_t.ecmaVersion>=6?Ea:wa}function l(){this.type=Mt,this.value=jt,this.start=Rt,this.end=St,_t.locations&&(this.loc=new Y,this.loc.end=At),_t.ranges&&(this.range=[Rt,St])}function t(){Dt=Ft=kt,_t.locations&&(Bt=o()),Nt=Vt=Ut=!1,qt=[],h(),k()}function r(e,n){var l=Et(xt,e);n+=" ("+l.line+":"+l.column+")";var t=new SyntaxError(n);throw t.pos=e,t.loc=l,t.raisedAt=kt,t}function a(e){return 10===e||13===e||8232===e||8233==e}function u(e,n){this.line=e,this.column=n}function o(){return new u(Lt,kt-Ot)}function s(e){e?(kt=e,Ot=Math.max(0,xt.lastIndexOf("\n",e)),Lt=xt.slice(0,Ot).split(Pa).length):(Lt=1,kt=Ot=0),Mt=$t,Tt=[Fa],Pt=!0,Wt=Gt=!1,0===kt&&_t.allowHashBang&&"#!"===xt.slice(0,2)&&f(2)}function i(){return Tt[Tt.length-1]}function c(e){var n;return e===qr&&"{"==(n=i()).token?!n.isExpr:e===fr?Pa.test(xt.slice(Ft,Rt)):e===sr||e===Ur||e===$t?!0:e==Dr?i()===Fa:!Pt}function p(e,n){St=kt,_t.locations&&(At=o());var l=Mt,t=!1;if(Mt=e,jt=n,e===Nr||e===Fr){var r=Tt.pop();r===Na?t=Pt=!0:r===Fa&&i()===Ga?(Tt.pop(),Pt=!1):Pt=!(r&&r.isExpr)}else if(e===Dr){switch(i()){case Ha:Tt.push(Ba);break;case Ja:Tt.push(Na);break;default:Tt.push(c(l)?Fa:Ba)}Pt=!0}else if(e===zr)Tt.push(Na),Pt=!0;else if(e==Br){var a=l===dr||l===cr||l===vr||l===br;Tt.push(a?Va:Ua),Pt=!0}else if(e==la);else if(e.keyword&&l==Gr)Pt=!1;else if(e==pr)i()!==Fa&&Tt.push(Ga),Pt=!1;else if(e===Xr)i()===qa?Tt.pop():(Tt.push(qa),t=!0),Pt=!1;else if(e===ma)Tt.push(Ja),Tt.push(Ha),Pt=!1;else if(e===ya){var r=Tt.pop();r===Ha&&l===Zr||r===Wa?(Tt.pop(),t=Pt=i()===Ja):t=Pt=!0}else e===Kr?t=Pt=!0:e===Zr&&l===ma?(Tt.length-=2,Tt.push(Wa),Pt=!1):Pt=e.beforeExpr;t||h()}function d(){var e=_t.onComment&&_t.locations&&o(),n=kt,l=xt.indexOf("*/",kt+=2);if(-1===l&&r(kt-2,"Unterminated comment"),kt=l+2,_t.locations){La.lastIndex=n;for(var t;(t=La.exec(xt))&&t.index<kt;)++Lt,Ot=t.index+t[0].length}_t.onComment&&_t.onComment(!0,xt.slice(n+2,l),n,kt,e,_t.locations&&o())}function f(e){for(var n=kt,l=_t.onComment&&_t.locations&&o(),t=xt.charCodeAt(kt+=e);bt>kt&&10!==t&&13!==t&&8232!==t&&8233!==t;)++kt,t=xt.charCodeAt(kt);_t.onComment&&_t.onComment(!1,xt.slice(n+e,kt),n,kt,l,_t.locations&&o())}function h(){for(;bt>kt;){var e=xt.charCodeAt(kt);if(32===e)++kt;else if(13===e){++kt;var n=xt.charCodeAt(kt);10===n&&++kt,_t.locations&&(++Lt,Ot=kt)}else if(10===e||8232===e||8233===e)++kt,_t.locations&&(++Lt,Ot=kt);else if(e>8&&14>e)++kt;else if(47===e){var n=xt.charCodeAt(kt+1);if(42===n)d();else{if(47!==n)break;f(2)}}else if(160===e)++kt;else{if(!(e>=5760&&Ra.test(String.fromCharCode(e))))break;++kt}}}function g(){var e=xt.charCodeAt(kt+1);if(e>=48&&57>=e)return M(!0);var n=xt.charCodeAt(kt+2);return _t.ecmaVersion>=6&&46===e&&46===n?(kt+=3,p(Yr)):(++kt,p(Gr))}function m(){var e=xt.charCodeAt(kt+1);return Pt?(++kt,S()):61===e?R(na,2):R(Zr,1)}function y(){var e=xt.charCodeAt(kt+1);return 61===e?R(na,2):R(fa,1)}function _(){var e=ha,n=1,l=xt.charCodeAt(kt+1);return _t.ecmaVersion>=7&&42===l&&(n++,l=xt.charCodeAt(kt+2),e=ga),61===l&&(n++,e=na),R(e,n)}function x(e){var n=xt.charCodeAt(kt+1);return n===e?_t.playground&&61===xt.charCodeAt(kt+2)?R(na,3):R(124===e?ra:aa,2):61===n?R(na,2):R(124===e?ua:sa,1)}function b(){var e=xt.charCodeAt(kt+1);return 61===e?R(na,2):R(oa,1)}function v(e){var n=xt.charCodeAt(kt+1);return n===e?45==n&&62==xt.charCodeAt(kt+2)&&Pa.test(xt.slice(Ft,kt))?(f(3),h(),k()):R(la,2):61===n?R(na,2):R(da,1)}function I(e){var n=xt.charCodeAt(kt+1),l=1;if(!Wt&&n===e)return l=62===e&&62===xt.charCodeAt(kt+2)?3:2,61===xt.charCodeAt(kt+l)?R(na,l+1):R(pa,l);if(33==n&&60==e&&45==xt.charCodeAt(kt+2)&&45==xt.charCodeAt(kt+3))return f(4),h(),k();if(!Wt){if(Pt&&60===e)return++kt,p(ma);if(62===e){var t=i();if(t===Ha||t===Wa)return++kt,p(ya)}}return 61===n&&(l=61===xt.charCodeAt(kt+2)?3:2),R(ca,l)}function w(e){var n=xt.charCodeAt(kt+1);return 61===n?R(ia,61===xt.charCodeAt(kt+2)?3:2):61===e&&62===n&&_t.ecmaVersion>=6?(kt+=2,p(Wr)):R(61===e?ea:ta,1)}function E(e){switch(e){case 46:return g();case 40:return++kt,p(Br);case 41:return++kt,p(Nr);case 59:return++kt,p(Ur);case 44:return++kt,p(Vr);case 91:return++kt,p(Lr);case 93:return++kt,p(Or);case 123:return++kt,p(Dr);case 125:return++kt,p(Fr);case 63:return++kt,p(Hr);case 35:if(_t.playground)return++kt,p(Qr);case 58:if(++kt,_t.ecmaVersion>=7){var n=xt.charCodeAt(kt);if(58===n)return++kt,p($r)}return p(qr);case 96:return _t.ecmaVersion>=6?(++kt,p(Xr)):!1;case 48:var n=xt.charCodeAt(kt+1);if(120===n||88===n)return A(16);if(_t.ecmaVersion>=6){if(111===n||79===n)return A(8);if(98===n||66===n)return A(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return M(!1);case 34:case 39:return Ht?N():T(e);case 47:return m();case 37:return y();case 42:return _();case 124:case 38:return x(e);case 94:return b();case 43:case 45:return v(e);case 60:case 62:return I(e);case 61:case 33:return w(e);case 126:return R(ta,1)}return!1}function k(){if(Rt=kt,_t.locations&&(Ct=o()),kt>=bt)return p($t);var e=i();if(e===qa)return P();if(e===Ja)return O();var n=xt.charCodeAt(kt);if(e===Ha||e===Wa){if(Oa(n))return G()}else{if(e===Ja)return O();if(Oa(n)||92===n)return q()}var l=E(n);if(l===!1){var t=String.fromCharCode(n);if("\\"===t||Aa.test(t))return q();r(kt,"Unexpected character '"+t+"'")}return l}function R(e,n,l){var t=xt.slice(kt,kt+n);kt+=n,p(e,t,l)}function S(){for(var e,n,l="",t=kt;;){kt>=bt&&r(t,"Unterminated regular expression");var a=on();if(Pa.test(a)&&r(t,"Unterminated regular expression"),e)e=!1;else{if("["===a)n=!0;else if("]"===a&&n)n=!1;else if("/"===a&&!n)break;e="\\"===a}++kt}var l=xt.slice(t,kt);++kt;var u=U(),o=l;if(u){var s=/^[gmsiy]*$/;_t.ecmaVersion>=6&&(s=/^[gmsiyu]*$/),s.test(u)||r(t,"Invalid regular expression flag"),u.indexOf("u")>=0&&!Ya&&(o=o.replace(/\\u\{([0-9a-fA-F]{5,6})\}/g,"x").replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"))}try{new RegExp(o)}catch(i){i instanceof SyntaxError&&r(t,"Error parsing regular expression: "+i.message),r(i)}try{var c=new RegExp(l,u)}catch(d){c=null}return p(Xt,{pattern:l,flags:u,value:c})}function C(e,n){for(var l=kt,t=0,r=0,a=null==n?1/0:n;a>r;++r){var u,o=xt.charCodeAt(kt);if(u=o>=97?o-97+10:o>=65?o-65+10:o>=48&&57>=o?o-48:1/0,u>=e)break;++kt,t=t*e+u}return kt===l||null!=n&&kt-l!==n?null:t}function A(e){kt+=2;var n=C(e);return null==n&&r(Rt+2,"Expected number in radix "+e),Oa(xt.charCodeAt(kt))&&r(kt,"Identifier directly after number"),p(Yt,n)}function M(e){var n=kt,l=!1,t=48===xt.charCodeAt(kt);e||null!==C(10)||r(n,"Invalid number"),46===xt.charCodeAt(kt)&&(++kt,C(10),l=!0);var a=xt.charCodeAt(kt);(69===a||101===a)&&(a=xt.charCodeAt(++kt),(43===a||45===a)&&++kt,null===C(10)&&r(n,"Invalid number"),l=!0),Oa(xt.charCodeAt(kt))&&r(kt,"Identifier directly after number");var u,o=xt.slice(n,kt);return l?u=parseFloat(o):t&&1!==o.length?/[89]/.test(o)||Gt?r(n,"Invalid number"):u=parseInt(o,8):u=parseInt(o,10),p(Yt,u)}function j(){var e,n=xt.charCodeAt(kt);if(123===n?(_t.ecmaVersion<6&&sn(),++kt,e=V(xt.indexOf("}",kt)-kt),++kt,e>1114111&&sn()):e=V(4),65535>=e)return String.fromCharCode(e);var l=(e-65536>>10)+55296,t=(e-65536&1023)+56320;return String.fromCharCode(l,t)}function T(e){for(var n=i()===Ha,l="",t=++kt;;){kt>=bt&&r(Rt,"Unterminated string constant");var u=xt.charCodeAt(kt);if(u===e)break;92!==u||n?38===u&&n?(l+=xt.slice(t,kt),l+=L(),t=kt):(a(u)&&!n&&r(Rt,"Unterminated string constant"),++kt):(l+=xt.slice(t,kt),l+=D(),t=kt)}return l+=xt.slice(t,kt++),p(zt,l)}function P(){for(var e="",n=kt;;){kt>=bt&&r(Rt,"Unterminated template");var l=xt.charCodeAt(kt);if(96===l||36===l&&123===xt.charCodeAt(kt+1))return kt===Rt&&Mt===Jr?36===l?(kt+=2,p(zr)):(++kt,p(Xr)):(e+=xt.slice(n,kt),p(Jr,e));92===l?(e+=xt.slice(n,kt),e+=D(),n=kt):a(l)?(e+=xt.slice(n,kt),++kt,13===l&&10===xt.charCodeAt(kt)?(++kt,e+="\n"):e+=String.fromCharCode(l),_t.locations&&(++Lt,Ot=kt),n=kt):++kt}}function L(){var e,n="",l=0,t=xt[kt];"&"!==t&&r(kt,"Entity must start with an ampersand");for(var a=++kt;bt>kt&&l++<10;){if(t=xt[kt++],";"===t){"#"===n[0]?"x"===n[1]?(n=n.substr(2),Ta.test(n)&&(e=String.fromCharCode(parseInt(n,16)))):(n=n.substr(1),ja.test(n)&&(e=String.fromCharCode(parseInt(n,10)))):e=Ka[n];break}n+=t}return e?e:(kt=a,"&")}function O(){for(var e="",n=kt;;){kt>=bt&&r(Rt,"Unterminated JSX contents");var l=xt.charCodeAt(kt);switch(l){case 123:case 60:return kt===Rt?E(l):(e+=xt.slice(n,kt),p(Kr,e));case 38:e+=xt.slice(n,kt),e+=L(),n=kt;break;default:a(l)?(e+=xt.slice(n,kt),++kt,13===l&&10===xt.charCodeAt(kt)?(++kt,e+="\n"):e+=String.fromCharCode(l),_t.locations&&(++Lt,Ot=kt),n=kt):++kt}}}function D(){var e=xt.charCodeAt(++kt),n=/^[0-7]+/.exec(xt.slice(kt,kt+3));for(n&&(n=n[0]);n&&parseInt(n,8)>255;)n=n.slice(0,-1);if("0"===n&&(n=null),++kt,n)return Gt&&r(kt-2,"Octal literal in strict mode"),kt+=n.length-1,String.fromCharCode(parseInt(n,8));switch(e){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(V(2));case 117:return j();case 116:return" ";case 98:return"\b";case 118:return" ";case 102:return"\f";case 48:return"\x00";case 13:10===xt.charCodeAt(kt)&&++kt;case 10:return _t.locations&&(Ot=kt,++Lt),"";default:return String.fromCharCode(e)}}function F(){var e,n="",l=0,t=on();"&"!==t&&r(kt,"Entity must start with an ampersand");for(var a=++kt;bt>kt&&l++<10;){if(t=on(),kt++,";"===t){"#"===n[0]?"x"===n[1]?(n=n.substr(2),Ta.test(n)&&(e=String.fromCharCode(parseInt(n,16)))):(n=n.substr(1),ja.test(n)&&(e=String.fromCharCode(parseInt(n,10)))):e=Ka[n];break}n+=t}return e?e:(kt=a,"&")}function B(e){for(var n="";bt>kt;){var l=on();if(-1!==e.indexOf(l))break;"&"===l?n+=F():(++kt,"\r"===l&&"\n"===on()&&(n+=l,++kt,l="\n"),"\n"===l&&_t.locations&&(Ot=kt,++Lt),n+=l)}return p(er,n)}function N(){var e=xt.charCodeAt(kt);return 34!==e&&39!==e&&r("String literal must starts with a quote"),++kt,B([String.fromCharCode(e)]),e!==xt.charCodeAt(kt)&&sn(),++kt,p(Mt,jt)}function V(e){var n=C(16,e);return null===n&&r(Rt,"Bad character escape sequence"),n}function U(){za=!1;for(var e="",n=!0,l=kt;bt>kt;){var t=xt.charCodeAt(kt);if(Da(t))++kt;else{if(92!==t)break;za=!0,e+=xt.slice(l,kt),117!=xt.charCodeAt(++kt)&&r(kt,"Expecting Unicode escape sequence \\uXXXX"),++kt;var a=V(4),u=String.fromCharCode(a);u||r(kt-1,"Invalid Unicode escape"),(n?Oa(a):Da(a))||r(kt-4,"Invalid Unicode escape"),e+=u,l=kt}n=!1}return e+xt.slice(l,kt)}function q(){var e=U(),n=Ht?Zt:Kt;return!za&&ka(e)&&(n=Pr[e]),p(n,e)}function G(){var e,n=kt;do e=xt.charCodeAt(++kt);while(Da(e)||45===e);return p(Qt,xt.slice(n,kt))}function H(){_t.onToken&&_t.onToken(new l),Dt=Rt,Ft=St,Bt=At,k()}function W(e){if(Gt=e,Mt===Yt||Mt===zt){if(kt=Rt,_t.locations)for(;Ot>kt;)Ot=xt.lastIndexOf("\n",Ot-2)+1,--Lt;h(),k()}}function J(){this.type=null,this.start=Rt,this.end=null}function Y(){this.start=Ct,this.end=null,null!==vt&&(this.source=vt)}function X(){var n=new e.Node;return _t.locations&&(n.loc=new Y),_t.directSourceFile&&(n.sourceFile=_t.directSourceFile),_t.ranges&&(n.range=[Rt,0]),n}function z(){return _t.locations?[Rt,Ct]:Rt}function K(n){var l=new e.Node,t=n;return _t.locations&&(l.loc=new Y,l.loc.start=t[1],t=n[0]),l.start=t,_t.directSourceFile&&(l.sourceFile=_t.directSourceFile),_t.ranges&&(l.range=[t,0]),l}function $(e,n){return e.type=n,e.end=Ft,_t.locations&&(e.loc.end=Bt),_t.ranges&&(e.range[1]=Ft),e}function Q(e,n,l){return _t.locations&&(e.loc.end=l[1],l=l[0]),e.type=n,e.end=l,_t.ranges&&(e.range[1]=l),e}function Z(e){return _t.ecmaVersion>=5&&"ExpressionStatement"===e.type&&"Literal"===e.expression.type&&"use strict"===e.expression.value}function en(e){return Mt===e?(H(),!0):!1}function nn(e){return Mt===Kt&&jt===e}function ln(e){return jt===e&&en(Kt)}function tn(e){ln(e)||sn()}function rn(){return!_t.strictSemicolons&&(Mt===$t||Mt===Fr||Pa.test(xt.slice(Ft,Rt)))}function an(){en(Ur)||rn()||sn()}function un(e){en(e)||sn()}function on(){return xt.charAt(kt)}function sn(e){r(null!=e?e:Rt,"Unexpected token")}function cn(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function pn(e,n){if(_t.ecmaVersion>=6&&e)switch(e.type){case"Identifier":case"VirtualPropertyExpression":case"MemberExpression":case"SpreadProperty":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":break;case"ObjectExpression":e.type="ObjectPattern";for(var l=0;l<e.properties.length;l++){var t=e.properties[l];"SpreadProperty"!==t.type&&("init"!==t.kind&&r(t.key.start,"Object pattern can't contain getter or setter"),pn(t.value,n))}break;case"ArrayExpression":e.type="ArrayPattern",dn(e.elements,n);break;case"AssignmentExpression":"="===e.operator?e.type="AssignmentPattern":r(e.left.end,"Only '=' operator can be used for specifying default value.");break;case"MemberExpression":if(!n)break;default:r(e.start,"Assigning to rvalue")}return e}function dn(e,n){if(e.length){for(var l=0;l<e.length-1;l++)pn(e[l],n);var t=e[e.length-1];switch(t.type){case"RestElement":break;case"SpreadElement":t.type="RestElement";var r=t.argument;pn(r,n),"Identifier"!==r.type&&"MemberExpression"!==r.type&&"ArrayPattern"!==r.type&&sn(r.start);break;default:pn(t,n)}}return e}function fn(e){var n=X();return H(),n.argument=Jn(e),$(n,"SpreadElement")}function hn(){var e=X();return H(),e.argument=Mt===Kt||Mt===Lr?gn():sn(),$(e,"RestElement")}function gn(){if(_t.ecmaVersion<6)return yl();switch(Mt){case Kt:return yl();case Lr:var e=X();return H(),e.elements=mn(Or,!0),$(e,"ArrayPattern");case Dr:return al(!0);default:sn()}}function mn(e,n){for(var l=[],t=!0;!en(e);){if(t?t=!1:un(Vr),Mt===Yr){l.push(yn(hn())),un(e);break}var r;if(n&&Mt===Vr)r=null;else{var a=_n();yn(a),r=_n(null,a)}l.push(r)}return l}function yn(e){return en(Hr)&&(e.optional=!0),Mt===qr&&(e.typeAnnotation=mt()),$(e,e.type),e}function _n(e,n){if(e=e||z(),n=n||gn(),!en(ea))return n;var l=K(e);return l.operator="=",l.left=n,l.right=Jn(),$(l,"AssignmentPattern")}function xn(e,n){switch(e.type){case"Identifier":(va(e.name)||Ia(e.name))&&r(e.start,"Defining '"+e.name+"' in strict mode"),cn(n,e.name)&&r(e.start,"Argument name clash in strict mode"),n[e.name]=!0;break;case"ObjectPattern":for(var l=0;l<e.properties.length;l++){var t=e.properties[l];"SpreadProperty"===t.type?xn(t.argument,n):xn(t.value,n)}break;case"ArrayPattern":for(var l=0;l<e.elements.length;l++){var a=e.elements[l];a&&xn(a,n)}break;case"RestElement":return xn(e.argument,n)}}function bn(e,n){if(!(_t.ecmaVersion>=6)){var l,t=e.key;switch(t.type){case"Identifier":l=t.name;break;case"Literal":l=String(t.value);break;default:return}var a,u=e.kind||"init";if(cn(n,l)){a=n[l];var o="init"!==u;((Gt||o)&&a[u]||!(o^a.init))&&r(t.start,"Redefinition of property")}else a=n[l]={init:!1,get:!1,set:!1};a[u]=!0}}function vn(e,n){switch(e.type){case"Identifier":Gt&&(Ia(e.name)||va(e.name))&&r(e.start,(n?"Binding ":"Assigning to ")+e.name+" in strict mode");break;case"MemberExpression":n&&r(e.start,"Binding to member expression");break;case"ObjectPattern":for(var l=0;l<e.properties.length;l++){var t=e.properties[l];"Property"===t.type&&(t=t.value),vn(t,n)}break;case"ArrayPattern":for(var l=0;l<e.elements.length;l++){var a=e.elements[l];a&&vn(a,n)}break;case"AssignmentPattern":vn(e.left);break;case"SpreadProperty":case"VirtualPropertyExpression":break;case"RestElement":vn(e.argument);break;default:r(e.start,"Assigning to rvalue")}}function In(e){var n=!0;for(e.body||(e.body=[]);Mt!==$t;){var l=wn(!0,!0);e.body.push(l),n&&Z(l)&&W(!0),n=!1}return H(),$(e,"Program")}function wn(e,n){var l=Mt,t=X();switch(l){case nr:case rr:return En(t,l.keyword);case ar:return kn(t);case or:return Rn(t);case cr:return Sn(t);case pr:return!e&&_t.ecmaVersion>=6&&sn(),Cn(t);case Er:return e||sn(),hl(t,!0);case dr:return An(t);case fr:return Mn(t);case hr:return jn(t);case gr:return Tn(t);case mr:return Pn(t);case _r:case xr:e||sn();case yr:return Ln(t,l.keyword);case br:return On(t);case vr:return Dn(t);case Dr:return Un();case Ur:return Fn(t);case Rr:case Sr:return n||_t.allowImportExportEverywhere||r(Rt,"'import' and 'export' may only appear at the top level"),l===Sr?bl(t):_l(t);case Kt:if(_t.ecmaVersion>=7&&Mt===Kt){if("private"===jt)return H(),fl(t);if("async"===jt&&"function "===xt.slice(St+1,St+10))return H(),un(pr),sl(t,!0,!0)}default:var a=jt,u=Wn();if(l===Kt&&"Identifier"===u.type){if(en(qr))return Bn(t,a,u);if("declare"===u.name){if(Mt===Er||Mt===Kt||Mt===pr||Mt===yr)return ql(t)}else if(Mt===Kt){if("interface"===u.name)return Yl(t);if("type"===u.name)return Xl(t)}}return Nn(t,u)}}function En(e,n){var l="break"==n;H(),en(Ur)||rn()?e.label=null:Mt!==Kt?sn():(e.label=yl(),an());for(var t=0;t<qt.length;++t){var a=qt[t];if(null==e.label||a.name===e.label.name){if(null!=a.kind&&(l||"loop"===a.kind))break;if(e.label&&l)break}}return t===qt.length&&r(e.start,"Unsyntactic "+n),$(e,l?"BreakStatement":"ContinueStatement")}function kn(e){return H(),an(),$(e,"DebuggerStatement")}function Rn(e){return H(),qt.push($a),e.body=wn(!1),qt.pop(),un(br),e.test=Vn(),_t.ecmaVersion>=6?en(Ur):an(),$(e,"DoWhileStatement")}function Sn(e){if(H(),qt.push($a),un(Br),Mt===Ur)return qn(e,null);if(Mt===yr||Mt===_r){var n=X(),l=Mt.keyword,t=Mt===_r;return H(),Hn(n,!0,l),$(n,"VariableDeclaration"),!(Mt===Tr||_t.ecmaVersion>=6&&nn("of"))||1!==n.declarations.length||t&&n.declarations[0].init?qn(e,n):Gn(e,n)}var r={start:0},n=Wn(!0,r);return Mt===Tr||_t.ecmaVersion>=6&&nn("of")?(pn(n),vn(n),Gn(e,n)):(r.start&&sn(r.start),qn(e,n))}function Cn(e){return H(),sl(e,!0,!1)}function An(e){return H(),e.test=Vn(),e.consequent=wn(!1),e.alternate=en(sr)?wn(!1):null,$(e,"IfStatement")}function Mn(e){return Nt||_t.allowReturnOutsideFunction||r(Rt,"'return' outside of function"),H(),en(Ur)||rn()?e.argument=null:(e.argument=Wn(),an()),$(e,"ReturnStatement")}function jn(e){H(),e.discriminant=Vn(),e.cases=[],un(Dr),qt.push(Qa);for(var n,l;Mt!=Fr;)if(Mt===lr||Mt===ur){var t=Mt===lr;n&&$(n,"SwitchCase"),e.cases.push(n=X()),n.consequent=[],H(),t?n.test=Wn():(l&&r(Dt,"Multiple default clauses"),l=!0,n.test=null),un(qr)}else n||sn(),n.consequent.push(wn(!0));return n&&$(n,"SwitchCase"),H(),qt.pop(),$(e,"SwitchStatement")}function Tn(e){return H(),Pa.test(xt.slice(Ft,Rt))&&r(Ft,"Illegal newline after throw"),e.argument=Wn(),an(),$(e,"ThrowStatement")}function Pn(e){if(H(),e.block=Un(),e.handler=null,Mt===tr){var n=X();H(),un(Br),n.param=gn(),vn(n.param,!0),un(Nr),n.guard=null,n.body=Un(),e.handler=$(n,"CatchClause")}return e.guardedHandlers=Jt,e.finalizer=en(ir)?Un():null,e.handler||e.finalizer||r(e.start,"Missing catch or finally clause"),$(e,"TryStatement")}function Ln(e,n){return H(),Hn(e,!1,n),an(),$(e,"VariableDeclaration")}function On(e){return H(),e.test=Vn(),qt.push($a),e.body=wn(!1),qt.pop(),$(e,"WhileStatement")}function Dn(e){return Gt&&r(Rt,"'with' in strict mode"),H(),e.object=Vn(),e.body=wn(!1),$(e,"WithStatement")}function Fn(e){return H(),$(e,"EmptyStatement")}function Bn(e,n,l){for(var t=0;t<qt.length;++t)qt[t].name===n&&r(l.start,"Label '"+n+"' is already declared");var a=Mt.isLoop?"loop":Mt===hr?"switch":null;return qt.push({name:n,kind:a}),e.body=wn(!0),qt.pop(),e.label=l,$(e,"LabeledStatement")}function Nn(e,n){return e.expression=n,an(),$(e,"ExpressionStatement")}function Vn(){un(Br);var e=Wn();return un(Nr),e}function Un(e){var n,l=X(),t=!0;for(l.body=[],un(Dr);!en(Fr);){var r=wn(!0);l.body.push(r),t&&e&&Z(r)&&(n=Gt,W(Gt=!0)),t=!1}return n===!1&&W(!1),$(l,"BlockStatement")}function qn(e,n){return e.init=n,un(Ur),e.test=Mt===Ur?null:Wn(),un(Ur),e.update=Mt===Nr?null:Wn(),un(Nr),e.body=wn(!1),qt.pop(),$(e,"ForStatement")}function Gn(e,n){var l=Mt===Tr?"ForInStatement":"ForOfStatement";return H(),e.left=n,e.right=Wn(),un(Nr),e.body=wn(!1),qt.pop(),$(e,l)}function Hn(e,n,l){for(e.declarations=[],e.kind=l;;){var t=X();if(t.id=gn(),vn(t.id,!0),Mt===qr&&(t.id.typeAnnotation=mt(),$(t.id,t.id.type)),t.init=en(ea)?Jn(n):l===xr.keyword?sn():null,e.declarations.push($(t,"VariableDeclarator")),!en(Vr))break}return e}function Wn(e,n){var l=z(),t=Jn(e,n);if(Mt===Vr){var r=K(l);for(r.expressions=[t];en(Vr);)r.expressions.push(Jn(e,n));return $(r,"SequenceExpression")}return t}function Jn(e,n,l){var t;n?t=!1:(n={start:0},t=!0);var r=z(),a=Yn(e,n);if(l&&(a=l(a,r)),Mt.isAssign){var u=K(r);return u.operator=jt,u.left=Mt===ea?pn(a):a,n.start=0,vn(a),H(),u.right=Jn(e),$(u,"AssignmentExpression")}return t&&n.start&&sn(n.start),a}function Yn(e,n){var l=z(),t=Xn(e,n);if(n&&n.start)return t;if(en(Hr)){var a=K(l);if(_t.playground&&en(ea)){var u=a.left=pn(t);return"MemberExpression"!==u.type&&r(u.start,"You can only use member expressions in memoization assignment"),a.right=Jn(e),a.operator="?=",$(a,"AssignmentExpression")}return a.test=t,a.consequent=Jn(),un(qr),a.alternate=Jn(e),$(a,"ConditionalExpression")}return t}function Xn(e,n){var l=z(),t=Kn(n);return n&&n.start?t:zn(t,l,-1,e)}function zn(e,n,l,t){var r=Mt.binop;if(null!=r&&(!t||Mt!==Tr)&&r>l){var a=K(n);a.left=e,a.operator=jt;var u=Mt;H();var o=z();return a.right=zn(Kn(),o,u.rightAssociative?r-1:r,t),$(a,u===ra||u===aa?"LogicalExpression":"BinaryExpression"),zn(a,n,l,t)}return e}function Kn(e){if(Mt.prefix){var n=X(),l=Mt.isUpdate;return n.operator=jt,n.prefix=!0,H(),n.argument=Kn(),e&&e.start&&sn(e.start),l?vn(n.argument):Gt&&"delete"===n.operator&&"Identifier"===n.argument.type&&r(n.start,"Deleting local variable in strict mode"),$(n,l?"UpdateExpression":"UnaryExpression")}var t=z(),a=$n(e);if(e&&e.start)return a;for(;Mt.postfix&&!rn();){var n=K(t);n.operator=jt,n.prefix=!1,n.argument=a,vn(a),H(),a=$(n,"UpdateExpression")}return a}function $n(e){var n=z(),l=Zn(e);return e&&e.start?l:Qn(l,n)}function Qn(e,n,l){if(_t.playground&&en(Qr)){var t=K(n);return t.object=e,t.property=yl(!0),t.arguments=en(Br)?ml(Nr,!1):[],Qn($(t,"BindMemberExpression"),n,l)}if(en($r)){var t=K(n);return t.object=e,t.property=yl(!0),Qn($(t,"VirtualPropertyExpression"),n,l)}if(en(Gr)){var t=K(n);return t.object=e,t.property=yl(!0),t.computed=!1,Qn($(t,"MemberExpression"),n,l)}if(en(Lr)){var t=K(n);return t.object=e,t.property=Wn(),t.computed=!0,un(Or),Qn($(t,"MemberExpression"),n,l)}if(!l&&en(Br)){var t=K(n);return t.callee=e,t.arguments=ml(Nr,!1),Qn($(t,"CallExpression"),n,l)}if(Mt===Xr){var t=K(n);return t.tag=e,t.quasi=rl(),Qn($(t,"TaggedTemplateExpression"),n,l)}return e}function Zn(e){switch(Mt){case wr:var n=X();return H(),$(n,"ThisExpression");case Cr:if(Vt)return wl();case Kt:var l=z(),n=X(),t=yl(Mt!==Kt);if(_t.ecmaVersion>=7)if("async"===t.name){if(Mt===Br){var r=nl(l,!0);return"ArrowFunctionExpression"===r.type?r:(n.callee=t,n.arguments="SequenceExpression"===r.type?r.expressions:[r],Qn($(n,"CallExpression"),l))}if(Mt===Kt)return t=yl(),un(Wr),pl(n,[t],!0);if(Mt===pr&&!rn())return H(),sl(n,!1,!0)}else if("await"===t.name&&Ut)return El(n);return!rn()&&en(Wr)?pl(K(l),[t]):t;case Xt:var n=X();return n.regex={pattern:jt.pattern,flags:jt.flags},n.value=jt.value,n.raw=xt.slice(Rt,St),H(),$(n,"Literal");case Yt:case zt:case Kr:var n=X();return n.value=jt,n.raw=xt.slice(Rt,St),H(),$(n,"Literal");case Ar:case Mr:case jr:var n=X();return n.value=Mt.atomValue,n.raw=Mt.keyword,H(),$(n,"Literal");case Br:return nl();case Lr:var n=X();return H(),_t.ecmaVersion>=7&&Mt===cr?kl(n,!1):(n.elements=ml(Or,!0,!0,e),$(n,"ArrayExpression"));case Dr:return al(!1,e);case pr:var n=X();return H(),sl(n,!1,!1);case Er:return hl(X(),!1);case Ir:return ll();case Xr:return rl();case Qr:return el();case ma:return Nl();default:sn()}}function el(){var e=X();H();var n=z();return e.callee=Qn(Zn(),n,!0),e.arguments=en(Br)?ml(Nr,!1):[],$(e,"BindFunctionExpression")}function nl(e,n){e=e||z();var l;if(_t.ecmaVersion>=6){if(H(),_t.ecmaVersion>=7&&Mt===cr)return kl(K(e),!0);for(var t,r,a=z(),u=[],o=!0,s={start:0},i=function(e,n){if(Mt===qr){var l=K(n);return l.expression=e,l.typeAnnotation=mt(),$(l,"TypeCastExpression")}return e};Mt!==Nr;){if(o?o=!1:un(Vr),Mt===Yr){var c=z();t=Rt,u.push(i(hn(),c));break}Mt!==Br||r||(r=Rt),u.push(Jn(!1,s,i))}var p=z();if(un(Nr),!rn()&&en(Wr)){r&&sn(r);for(var d=0;d<u.length;d++){var f=u[d];if("TypeCastExpression"===f.type){var h=f.expression;h.typeAnnotation=f.typeAnnotation,u[d]=h}}return pl(K(e),u,n)}u.length||sn(Dt),t&&sn(t),s.start&&sn(s.start),u.length>1?(l=K(a),l.expressions=u,Q(l,"SequenceExpression",p)):l=u[0]}else l=Vn();if(_t.preserveParens){var g=K(e);return g.expression=l,$(g,"ParenthesizedExpression")}return l}function ll(){var e=X();H();var n=z();return e.callee=Qn(Zn(),n,!0),e.arguments=en(Br)?ml(Nr,!1):Jt,$(e,"NewExpression")}function tl(){var e=X();return e.value={raw:xt.slice(Rt,St),cooked:jt},H(),e.tail=Mt===Xr,$(e,"TemplateElement")}function rl(){var e=X();H(),e.expressions=[];var n=tl();for(e.quasis=[n];!n.tail;)un(zr),e.expressions.push(Wn()),un(Fr),e.quasis.push(n=tl());return H(),$(e,"TemplateLiteral")}function al(e,n){var l=X(),t=!0,r={};for(l.properties=[],H();!en(Fr);){if(t)t=!1;else if(un(Vr),_t.allowTrailingCommas&&en(Fr))break;var a,u=X(),o=!1,s=!1;if(_t.ecmaVersion>=7&&Mt===Yr)u=fn(),u.type="SpreadProperty",l.properties.push(u);else{if(_t.ecmaVersion>=6&&(u.method=!1,u.shorthand=!1,(e||n)&&(a=z()),e||(o=en(ha))),_t.ecmaVersion>=7&&nn("async")){var i=yl();Mt===qr||Mt===Br?u.key=i:(s=!0,ul(u))}else ul(u);var c;Fl("<")&&(c=zl(),Mt!==Br&&sn()),en(qr)?(u.value=e?_n():Jn(!1,n),u.kind="init"):_t.ecmaVersion>=6&&Mt===Br?(e&&sn(),u.kind="init",u.method=!0,u.value=il(o,s)):_t.ecmaVersion>=5&&!u.computed&&"Identifier"===u.key.type&&("get"===u.key.name||"set"===u.key.name||_t.playground&&"memo"===u.key.name)&&Mt!=Vr&&Mt!=Fr?((o||s||e)&&sn(),u.kind=u.key.name,ul(u),u.value=il(!1,!1)):_t.ecmaVersion>=6&&!u.computed&&"Identifier"===u.key.type?(u.kind="init",e?u.value=_n(a,u.key):Mt===ea&&n?(n.start||(n.start=Rt),u.value=_n(a,u.key)):u.value=u.key,u.shorthand=!0):sn(),u.value.typeParameters=c,bn(u,r),l.properties.push($(u,"Property"))}}return $(l,e?"ObjectPattern":"ObjectExpression")}function ul(e){if(_t.ecmaVersion>=6){if(en(Lr))return e.computed=!0,e.key=Wn(),void un(Or);e.computed=!1}e.key=Mt===Yt||Mt===zt?Zn():yl(!0)}function ol(e,n){e.id=null,_t.ecmaVersion>=6&&(e.generator=!1,e.expression=!1),_t.ecmaVersion>=7&&(e.async=n)}function sl(e,n,l,t){return ol(e,l),_t.ecmaVersion>=6&&(e.generator=en(ha)),(n||Mt===Kt)&&(e.id=yl()),Fl("<")&&(e.typeParameters=zl()),cl(e),dl(e,t),$(e,n?"FunctionDeclaration":"FunctionExpression")}function il(e,n){var l=X();ol(l,n),cl(l);var t;return _t.ecmaVersion>=6?(l.generator=e,t=!0):t=!1,dl(l,t),$(l,"FunctionExpression")}function cl(e){un(Br),e.params=mn(Nr,!1),Mt===qr&&(e.returnType=mt())}function pl(e,n,l){return ol(e,l),e.params=dn(n,!0),dl(e,!0),$(e,"ArrowFunctionExpression")}function dl(e,n){var l=n&&Mt!==Dr,t=Ut;if(Ut=e.async,l)e.body=Jn(),e.expression=!0;else{var r=Nt,a=Vt,u=qt;Nt=!0,Vt=e.generator,qt=[],e.body=Un(!0),e.expression=!1,Nt=r,Vt=a,qt=u}if(Ut=t,Gt||!l&&e.body.body.length&&Z(e.body.body[0])){var o={};e.id&&xn(e.id,{});for(var s=0;s<e.params.length;s++)xn(e.params[s],o)}}function fl(e){e.declarations=[];do e.declarations.push(yl());while(en(Vr));return an(),$(e,"PrivateDeclaration")}function hl(e,n){H(),e.id=Mt===Kt?yl():n?sn():null,Fl("<")&&(e.typeParameters=zl()),e.superClass=en(kr)?$n():null,e.superClass&&Fl("<")&&(e.superTypeParameters=Kl()),nn("implements")&&(H(),e.implements=gl());var l=X();for(l.body=[],un(Dr);!en(Fr);)if(!en(Ur)){var t=X();if(_t.ecmaVersion>=7&&nn("private"))H(),l.body.push(fl(t));else{var r=en(ha),a=!1;ul(t),Mt===Br||t.computed||"Identifier"!==t.key.type||"static"!==t.key.name?t["static"]=!1:((r||a)&&sn(),t["static"]=!0,r=en(ha),ul(t)),Mt===Br||t.computed||"Identifier"!==t.key.type||"async"!==t.key.name||(a=!0,ul(t)),Mt!==Br&&!t.computed&&"Identifier"===t.key.type&&("get"===t.key.name||"set"===t.key.name)||_t.playground&&"memo"===t.key.name?((r||a)&&sn(),t.kind=t.key.name,ul(t)):t.kind="";var u=!1;if(Mt===qr&&(t.typeAnnotation=mt(),u=!0),_t.playground&&en(ea)&&(t.value=Jn(),u=!0),u)an(),l.body.push($(t,"ClassProperty"));else{var o;Fl("<")&&(o=zl()),t.value=il(r,a),t.value.typeParameters=o,l.body.push($(t,"MethodDefinition")),en(Ur)}}}return e.body=$(l,"ClassBody"),$(e,n?"ClassDeclaration":"ClassExpression")}function gl(){var e=[];do{var n=X();n.id=yl(),n.typeParameters=Fl("<")?Kl():null,e.push($(n,"ClassImplements"))}while(en(Vr));return e}function ml(e,n,l,t){for(var r=[],a=!0;!en(e);){if(a)a=!1;else if(un(Vr),n&&_t.allowTrailingCommas&&en(e))break;r.push(l&&Mt===Vr?null:Mt===Yr?fn(t):Jn(!1,t))}return r}function yl(e){var n=X();return e&&"everywhere"==_t.forbidReserved&&(e=!1),Mt===Kt?(!e&&(_t.forbidReserved&&(3===_t.ecmaVersion?xa:ba)(jt)||Gt&&va(jt))&&-1==xt.slice(Rt,St).indexOf("\\")&&r(Rt,"The keyword '"+jt+"' is reserved"),n.name=jt):e&&Mt.keyword?n.name=Mt.keyword:sn(),H(),$(n,"Identifier")}function _l(e){if(H(),Mt===yr||Mt===xr||Mt===_r||Mt===pr||Mt===Er||nn("async")||nn("type"))e.declaration=wn(!0),e["default"]=!1,e.specifiers=null,e.source=null;else if(en(ur)){var n=Jn();if(n.id)switch(n.type){case"FunctionExpression":n.type="FunctionDeclaration";break;case"ClassExpression":n.type="ClassDeclaration"}e.declaration=n,e["default"]=!0,e.specifiers=null,e.source=null,an()}else{var l=Mt===ha;e.declaration=null,e["default"]=!1,e.specifiers=xl(),ln("from")?e.source=Mt===zt?Zn():sn():(l&&sn(),e.source=null),an()}return $(e,"ExportDeclaration")}function xl(){var e=[],n=!0;if(Mt===ha){var l=X();H(),e.push($(l,"ExportBatchSpecifier"))}else for(un(Dr);!en(Fr);){if(n)n=!1;else if(un(Vr),_t.allowTrailingCommas&&en(Fr))break;var l=X();l.id=yl(Mt===ur),l.name=ln("as")?yl(!0):null,e.push($(l,"ExportSpecifier"))}return e}function bl(e){H(),e.isType=!1,e.specifiers=[];var n;if(nn("type")){var l=z();n=yl(),Mt===Kt&&"from"!==jt||Mt===Dr||Mt===ha?e.isType=!0:(e.specifiers.push(Il(n,l)),en(Vr))}return Mt===zt?(n&&sn(n.start),e.source=Zn()):(nn("from")||vl(e.specifiers),tn("from"),e.source=Mt===zt?Zn():sn()),an(),$(e,"ImportDeclaration")}function vl(e){var n=!0;if(Mt===Kt){var l=z(),t=yl();if(e.push(Il(t,l)),!en(Vr))return e}if(Mt===ha){var r=X();return H(),tn("as"),r.name=yl(),vn(r.name,!0),e.push($(r,"ImportBatchSpecifier")),e}for(un(Dr);!en(Fr);){if(n)n=!1;else if(un(Vr),_t.allowTrailingCommas&&en(Fr))break;var r=X();r.id=yl(!0),r.name=ln("as")?yl():null,vn(r.name||r.id,!0),r["default"]=!1,e.push($(r,"ImportSpecifier"))}return e}function Il(e,n){var l=K(n);return l.id=e,vn(l.id,!0),l.name=null,l["default"]=!0,$(l,"ImportSpecifier")}function wl(){var e=X();return H(),en(Ur)||rn()?(e.delegate=!1,e.argument=null):(e.delegate=en(ha),e.argument=Jn()),$(e,"YieldExpression")}function El(e){return(en(Ur)||rn())&&sn(),e.all=en(ha),e.argument=Jn(!0),$(e,"AwaitExpression")}function kl(e,n){for(e.blocks=[];Mt===cr;){var l=X();H(),un(Br),l.left=gn(),vn(l.left,!0),tn("of"),l.right=Wn(),un(Nr),e.blocks.push($(l,"ComprehensionBlock"))}return e.filter=en(dr)?Vn():null,e.body=Wn(),un(n?Nr:Or),e.generator=n,$(e,"ComprehensionExpression") }function Rl(e){return"JSXIdentifier"===e.type?e.name:"JSXNamespacedName"===e.type?e.namespace.name+":"+e.name.name:"JSXMemberExpression"===e.type?Rl(e.object)+"."+Rl(e.property):void 0}function Sl(){var e=X();return Mt===Qt?e.name=jt:Mt.keyword?e.name=Mt.keyword:sn(),H(),$(e,"JSXIdentifier")}function Cl(){var e=z(),n=Sl();if(!en(qr))return n;var l=K(e);return l.namespace=n,l.name=Sl(),$(l,"JSXNamespacedName")}function Al(){for(var e=z(),n=Cl();en(Gr);){var l=K(e);l.object=n,l.property=Sl(),n=$(l,"JSXMemberExpression")}return n}function Ml(){switch(Mt){case Dr:var e=Tl();return"JSXEmptyExpression"===e.expression.type&&r(e.start,"JSX attributes must only be assigned a non-empty expression"),e;case ma:return Nl();case Kr:case zt:return Zn();default:r(Rt,"JSX value should be either an expression or a quoted JSX text")}}function jl(){Mt!==Fr&&sn();var e;return e=Rt,Rt=Ft,Ft=e,e=Ct,Ct=Bt,Bt=e,$(X(),"JSXEmptyExpression")}function Tl(){var e=X();return H(),e.expression=Mt===Fr?jl():Wn(),un(Fr),$(e,"JSXExpressionContainer")}function Pl(){var e=X();return en(Dr)?(un(Yr),e.argument=Jn(),un(Fr),$(e,"JSXSpreadAttribute")):(e.name=Cl(),e.value=en(ea)?Ml():null,$(e,"JSXAttribute"))}function Ll(e){var n=K(e);for(n.attributes=[],n.name=Al();Mt!==Zr&&Mt!==ya;)n.attributes.push(Pl());return n.selfClosing=en(Zr),un(ya),$(n,"JSXOpeningElement")}function Ol(e){var n=K(e);return n.name=Al(),un(ya),$(n,"JSXClosingElement")}function Dl(e){var n=K(e),l=[],t=Ll(e),a=null;if(!t.selfClosing){e:for(;;)switch(Mt){case ma:if(e=z(),H(),en(Zr)){a=Ol(e);break e}l.push(Dl(e));break;case Kr:l.push(Zn());break;case Dr:l.push(Tl());break;default:sn()}Rl(a.name)!==Rl(t.name)&&r(a.start,"Expected corresponding JSX closing tag for <"+Rl(t.name)+">")}return n.openingElement=t,n.closingElement=a,n.children=l,$(n,"JSXElement")}function Fl(e){return Mt===ca&&jt===e}function Bl(e){Fl(e)?H():sn()}function Nl(){var e=z();return H(),Dl(e)}function Vl(e){return H(),Wl(e,!0),$(e,"DeclareClass")}function Ul(e){H();var n=e.id=yl(),l=X(),t=X();l.typeParameters=Fl("<")?zl():null,un(Br);var r=st();return l.params=r.params,l.rest=r.rest,un(Nr),un(qr),l.returnType=gt(),t.typeAnnotation=$(l,"FunctionTypeAnnotation"),n.typeAnnotation=$(t,"TypeAnnotation"),$(n,n.type),an(),$(e,"DeclareFunction")}function ql(e){return Mt===Er?Vl(e):Mt===pr?Ul(e):Mt===yr?Gl(e):nn("module")?Hl(e):void sn()}function Gl(e){return H(),e.id=yt(),an(),$(e,"DeclareVariable")}function Hl(e){H(),e.id=Mt===zt?Zn():yl();var n=e.body=X(),l=n.body=[];for(un(Dr);Mt!==Fr;){var t=X();H(),l.push(ql(t))}return un(Fr),$(n,"BlockStatement"),$(e,"DeclareModule")}function Wl(e,n){if(e.id=yl(),e.typeParameters=Fl("<")?zl():null,e.extends=[],en(kr))do e.extends.push(Jl());while(en(Vr));e.body=lt(n)}function Jl(){var e=X();return e.id=yl(),e.typeParameters=Fl("<")?Kl():null,$(e,"InterfaceExtends")}function Yl(e){return Wl(e,!1),$(e,"InterfaceDeclaration")}function Xl(e){return e.id=yl(),e.typeParameters=Fl("<")?zl():null,un(ea),e.right=gt(),an(),$(e,"TypeAlias")}function zl(){var e=X();for(e.params=[],Bl("<");!Fl(">");)e.params.push(yl()),Fl(">")||un(Vr);return Bl(">"),$(e,"TypeParameterDeclaration")}function Kl(){var e=X(),n=Wt;for(e.params=[],Wt=!0,Bl("<");!Fl(">");)e.params.push(gt()),Fl(">")||un(Vr);return Bl(">"),Wt=n,$(e,"TypeParameterInstantiation")}function $l(){return Mt===Yt||Mt===zt?Zn():yl(!0)}function Ql(e,n){return e.static=n,un(Lr),e.id=$l(),un(qr),e.key=gt(),un(Or),un(qr),e.value=gt(),$(e,"ObjectTypeIndexer")}function Zl(e){for(e.params=[],e.rest=null,e.typeParameters=null,Fl("<")&&(e.typeParameters=zl()),un(Br);Mt===Kt;)e.params.push(ot()),Mt!==Nr&&un(Vr);return en(Yr)&&(e.rest=ot()),un(Nr),un(qr),e.returnType=gt(),$(e,"FunctionTypeAnnotation")}function et(e,n,l){var t=K(e);return t.value=Zl(K(e)),t.static=n,t.key=l,t.optional=!1,$(t,"ObjectTypeProperty")}function nt(e,n){var l=X();return e.static=n,e.value=Zl(l),$(e,"ObjectTypeCallProperty")}function lt(e){var n,l,t,r=X(),a=!1;for(r.callProperties=[],r.properties=[],r.indexers=[],un(Dr);Mt!==Fr;){var u=z();n=X(),e&&nn("static")&&(H(),t=!0),Mt===Lr?r.indexers.push(Ql(n,t)):Mt===Br||Fl("<")?r.callProperties.push(nt(n,e)):(l=t&&Mt===qr?yl():$l(),Fl("<")||Mt===Br?r.properties.push(et(u,t,l)):(en(Hr)&&(a=!0),un(qr),n.key=l,n.value=gt(),n.optional=a,n.static=t,r.properties.push($(n,"ObjectTypeProperty")))),en(Ur)||Mt===Fr||sn()}return un(Fr),$(r,"ObjectTypeAnnotation")}function tt(e,n){var l=K(e);for(l.typeParameters=null,l.id=n;en(Gr);){var t=K(e);t.qualification=l.id,t.id=yl(),l.id=$(t,"QualifiedTypeIdentifier")}return Fl("<")&&(l.typeParameters=Kl()),$(l,"GenericTypeAnnotation")}function rt(){var e=X();return un(Pr["void"]),$(e,"VoidTypeAnnotation")}function at(){var e=X();return un(Pr["typeof"]),e.argument=ct(),$(e,"TypeofTypeAnnotation")}function ut(){var e=X();for(e.types=[],un(Lr);bt>kt&&Mt!==Or&&(e.types.push(gt()),Mt!==Or);)un(Vr);return un(Or),$(e,"TupleTypeAnnotation")}function ot(){var e=!1,n=X();return n.name=yl(),en(Hr)&&(e=!0),un(qr),n.optional=e,n.typeAnnotation=gt(),$(n,"FunctionTypeParam")}function st(){for(var e={params:[],rest:null};Mt===Kt;)e.params.push(ot()),Mt!==Nr&&un(Vr);return en(Yr)&&(e.rest=ot()),e}function it(e,n,l){switch(l.name){case"any":return $(n,"AnyTypeAnnotation");case"bool":case"boolean":return $(n,"BooleanTypeAnnotation");case"number":return $(n,"NumberTypeAnnotation");case"string":return $(n,"StringTypeAnnotation");default:return tt(e,l)}}function ct(){var e,n,l=z(),t=X(),a=!1;switch(Mt){case Kt:return it(l,t,yl());case Dr:return lt();case Lr:return ut();case ca:if("<"===jt)return t.typeParameters=zl(),un(Br),e=st(),t.params=e.params,t.rest=e.rest,un(Nr),un(Wr),t.returnType=gt(),$(t,"FunctionTypeAnnotation");case Br:H();var u;return Mt!==Nr&&Mt!==Yr&&(Mt===Kt||(a=!0)),a?(u&&Nr?n=u:(n=gt(),un(Nr)),en(Wr)&&r(t,"Unexpected token =>. It looks like you are trying to write a function type, but you ended up writing a grouped type followed by an =>, which is a syntax error. Remember, function type parameters are named so function types look like (name1: type1, name2: type2) => returnType. You probably wrote (type1) => returnType"),n):(e=st(),t.params=e.params,t.rest=e.rest,un(Nr),un(Wr),t.returnType=gt(),t.typeParameters=null,$(t,"FunctionTypeAnnotation"));case zt:return t.value=jt,t.raw=xt.slice(Rt,St),H(),$(t,"StringLiteralTypeAnnotation");default:if(Mt.keyword)switch(Mt.keyword){case"void":return rt();case"typeof":return at()}}sn()}function pt(){var e=X(),n=e.elementType=ct();return Mt===Lr?(un(Lr),un(Or),$(e,"ArrayTypeAnnotation")):n}function dt(){var e=X();return en(Hr)?(e.typeAnnotation=dt(),$(e,"NullableTypeAnnotation")):pt()}function ft(){var e=X(),n=dt();for(e.types=[n];en(sa);)e.types.push(dt());return 1===e.types.length?n:$(e,"IntersectionTypeAnnotation")}function ht(){var e=X(),n=ft();for(e.types=[n];en(ua);)e.types.push(ft());return 1===e.types.length?n:$(e,"UnionTypeAnnotation")}function gt(){var e=Wt;Wt=!0;var n=ht();return Wt=e,n}function mt(){var e=X(),n=Wt;return Wt=!0,un(qr),e.typeAnnotation=gt(),Wt=n,$(e,"TypeAnnotation")}function yt(e,n){var l=(X(),yl()),t=!1;return n&&en(Hr)&&(un(Hr),t=!0),(e||Mt===qr)&&(l.typeAnnotation=mt(),$(l,l.type)),t&&(l.optional=!0,$(l,l.type)),l}e.version="0.11.1";var _t,xt,bt,vt;e.parse=function(e,l){xt=String(e),bt=xt.length,n(l),s();var r=_t.locations?[kt,o()]:kt;return t(),_t.strictMode&&(Gt=!0),In(_t.program||K(r))};var It=e.defaultOptions={strictMode:!1,playground:!1,ecmaVersion:5,strictSemicolons:!1,allowTrailingCommas:!0,forbidReserved:!1,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowHashBang:!1,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1};e.parseExpressionAt=function(e,l,r){return xt=String(e),bt=xt.length,n(r),s(l),t(),Wn()};var wt=function(e){return"[object Array]"===Object.prototype.toString.call(e)},Et=e.getLineInfo=function(e,n){for(var l=1,t=0;;){La.lastIndex=t;var r=La.exec(e);if(!(r&&r.index<n))break;++l,t=r.index+r[0].length}return{line:l,column:n-t}};e.Token=l,e.tokenize=function(e,t){function r(){return Ft=St,k(),new l}return xt=String(e),bt=xt.length,n(t),s(),h(),r.jumpTo=function(e,n){if(kt=e,_t.locations){Lt=1,Ot=La.lastIndex=0;for(var l;(l=La.exec(xt))&&l.index<e;)++Lt,Ot=l.index+l[0].length}Pt=!!n,h()},r.current=function(){return new l},"undefined"!=typeof Symbol&&(r[Symbol.iterator]=function(){return{next:function(){var e=r();return{done:e.type===$t,value:e}}}}),r.options=_t,r};var kt,Rt,St,Ct,At,Mt,jt,Tt,Pt,Lt,Ot,Dt,Ft,Bt,Nt,Vt,Ut,qt,Gt,Ht,Wt,Jt=[],Yt={type:"num"},Xt={type:"regexp"},zt={type:"string"},Kt={type:"name"},$t={type:"eof"},Qt={type:"jsxName"},Zt={type:"xjsName"},er={type:"xjsText"},nr={keyword:"break"},lr={keyword:"case",beforeExpr:!0},tr={keyword:"catch"},rr={keyword:"continue"},ar={keyword:"debugger"},ur={keyword:"default"},or={keyword:"do",isLoop:!0},sr={keyword:"else",beforeExpr:!0},ir={keyword:"finally"},cr={keyword:"for",isLoop:!0},pr={keyword:"function"},dr={keyword:"if"},fr={keyword:"return",beforeExpr:!0},hr={keyword:"switch"},gr={keyword:"throw",beforeExpr:!0},mr={keyword:"try"},yr={keyword:"var"},_r={keyword:"let"},xr={keyword:"const"},br={keyword:"while",isLoop:!0},vr={keyword:"with"},Ir={keyword:"new",beforeExpr:!0},wr={keyword:"this"},Er={keyword:"class"},kr={keyword:"extends",beforeExpr:!0},Rr={keyword:"export"},Sr={keyword:"import"},Cr={keyword:"yield",beforeExpr:!0},Ar={keyword:"null",atomValue:null},Mr={keyword:"true",atomValue:!0},jr={keyword:"false",atomValue:!1},Tr={keyword:"in",binop:7,beforeExpr:!0},Pr={"break":nr,"case":lr,"catch":tr,"continue":rr,"debugger":ar,"default":ur,"do":or,"else":sr,"finally":ir,"for":cr,"function":pr,"if":dr,"return":fr,"switch":hr,"throw":gr,"try":mr,"var":yr,let:_r,"const":xr,"while":br,"with":vr,"null":Ar,"true":Mr,"false":jr,"new":Ir,"in":Tr,"instanceof":{keyword:"instanceof",binop:7,beforeExpr:!0},"this":wr,"typeof":{keyword:"typeof",prefix:!0,beforeExpr:!0},"void":{keyword:"void",prefix:!0,beforeExpr:!0},"delete":{keyword:"delete",prefix:!0,beforeExpr:!0},"class":Er,"extends":kr,"export":Rr,"import":Sr,"yield":Cr},Lr={type:"[",beforeExpr:!0},Or={type:"]"},Dr={type:"{",beforeExpr:!0},Fr={type:"}"},Br={type:"(",beforeExpr:!0},Nr={type:")"},Vr={type:",",beforeExpr:!0},Ur={type:";",beforeExpr:!0},qr={type:":",beforeExpr:!0},Gr={type:"."},Hr={type:"?",beforeExpr:!0},Wr={type:"=>",beforeExpr:!0},Jr={type:"template"},Yr={type:"...",beforeExpr:!0},Xr={type:"`"},zr={type:"${",beforeExpr:!0},Kr={type:"jsxText"},$r={type:"::",beforeExpr:!0},Qr={type:"#"},Zr={binop:10,beforeExpr:!0},ea={isAssign:!0,beforeExpr:!0},na={isAssign:!0,beforeExpr:!0},la={postfix:!0,prefix:!0,isUpdate:!0},ta={prefix:!0,beforeExpr:!0},ra={binop:1,beforeExpr:!0},aa={binop:2,beforeExpr:!0},ua={binop:3,beforeExpr:!0},oa={binop:4,beforeExpr:!0},sa={binop:5,beforeExpr:!0},ia={binop:6,beforeExpr:!0},ca={binop:7,beforeExpr:!0},pa={binop:8,beforeExpr:!0},da={binop:9,prefix:!0,beforeExpr:!0},fa={binop:10,beforeExpr:!0},ha={binop:10,beforeExpr:!0},ga={binop:11,beforeExpr:!0,rightAssociative:!0},ma={type:"jsxTagStart"},ya={type:"jsxTagEnd"};e.tokTypes={bracketL:Lr,bracketR:Or,braceL:Dr,braceR:Fr,parenL:Br,parenR:Nr,comma:Vr,semi:Ur,colon:qr,dot:Gr,ellipsis:Yr,question:Hr,slash:Zr,eq:ea,name:Kt,eof:$t,num:Yt,regexp:Xt,string:zt,paamayimNekudotayim:$r,exponent:ga,hash:Qr,arrow:Wr,template:Jr,star:ha,assign:na,backQuote:Xr,dollarBraceL:zr,jsxName:Qt,jsxText:Kr,jsxTagStart:ma,jsxTagEnd:ya};for(var _a in Pr)e.tokTypes["_"+_a]=Pr[_a];var xa=function(e){switch(e.length){case 6:switch(e){case"double":case"export":case"import":case"native":case"public":case"static":case"throws":return!0}return!1;case 4:switch(e){case"byte":case"char":case"enum":case"goto":case"long":return!0}return!1;case 5:switch(e){case"class":case"final":case"float":case"short":case"super":return!0}return!1;case 7:switch(e){case"boolean":case"extends":case"package":case"private":return!0}return!1;case 9:switch(e){case"interface":case"protected":case"transient":return!0}return!1;case 8:switch(e){case"abstract":case"volatile":return!0}return!1;case 10:return"implements"===e;case 3:return"int"===e;case 12:return"synchronized"===e}},ba=function(e){switch(e.length){case 5:switch(e){case"class":case"super":case"const":return!0}return!1;case 6:switch(e){case"export":case"import":return!0}return!1;case 4:return"enum"===e;case 7:return"extends"===e}},va=function(e){switch(e.length){case 9:switch(e){case"interface":case"protected":return!0}return!1;case 7:switch(e){case"package":case"private":return!0}return!1;case 6:switch(e){case"public":case"static":return!0}return!1;case 10:return"implements"===e;case 3:return"let"===e;case 5:return"yield"===e}},Ia=function(e){switch(e){case"eval":case"arguments":return!0}return!1},wa=function(e){switch(e.length){case 4:switch(e){case"case":case"else":case"with":case"null":case"true":case"void":case"this":return!0}return!1;case 5:switch(e){case"break":case"catch":case"throw":case"while":case"false":return!0}return!1;case 3:switch(e){case"for":case"try":case"var":case"new":return!0}return!1;case 6:switch(e){case"return":case"switch":case"typeof":case"delete":return!0}return!1;case 8:switch(e){case"continue":case"debugger":case"function":return!0}return!1;case 2:switch(e){case"do":case"if":case"in":return!0}return!1;case 7:switch(e){case"default":case"finally":return!0}return!1;case 10:return"instanceof"===e}},Ea=function(e){switch(e.length){case 5:switch(e){case"break":case"catch":case"throw":case"while":case"false":case"const":case"class":case"yield":return!0}return!1;case 4:switch(e){case"case":case"else":case"with":case"null":case"true":case"void":case"this":return!0}return!1;case 6:switch(e){case"return":case"switch":case"typeof":case"delete":case"export":case"import":return!0}return!1;case 3:switch(e){case"for":case"try":case"var":case"new":case"let":return!0}return!1;case 8:switch(e){case"continue":case"debugger":case"function":return!0}return!1;case 7:switch(e){case"default":case"finally":case"extends":return!0}return!1;case 2:switch(e){case"do":case"if":case"in":return!0}return!1;case 10:return"instanceof"===e}},ka=wa,Ra=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/,Sa="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢲऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",Ca="̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఃా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ູົຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏ᦰ-ᧀᧈᧉ᧐-᧙ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷼-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-꣄꣐-꣙꣠-꣱꤀-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︭︳︴﹍-﹏0-9_",Aa=new RegExp("["+Sa+"]"),Ma=new RegExp("["+Sa+Ca+"]"),ja=/^\d+$/,Ta=/^[\da-fA-F]+$/,Pa=/[\n\r\u2028\u2029]/,La=/\r\n|[\n\r\u2028\u2029]/g,Oa=e.isIdentifierStart=function(e){return 65>e?36===e:91>e?!0:97>e?95===e:123>e?!0:e>=170&&Aa.test(String.fromCharCode(e))},Da=e.isIdentifierChar=function(e){return 48>e?36===e:58>e?!0:65>e?!1:91>e?!0:97>e?95===e:123>e?!0:e>=170&&Ma.test(String.fromCharCode(e))};u.prototype.offset=function(e){return new u(this.line,this.column+e)};var Fa={token:"{",isExpr:!1},Ba={token:"{",isExpr:!0},Na={token:"${",isExpr:!0},Va={token:"(",isExpr:!1},Ua={token:"(",isExpr:!0},qa={token:"`",isExpr:!0},Ga={token:"function",isExpr:!0},Ha={token:"<tag",isExpr:!1},Wa={token:"</tag",isExpr:!1},Ja={token:"<tag>...</tag>",isExpr:!0},Ya=!1;try{new RegExp("￿","u"),Ya=!0}catch(Xa){}var za,Ka={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪","int":"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"},Ka={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪","int":"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"};e.Node=J;var $a={kind:"loop"},Qa={kind:"switch"}})},{}],126:[function(e){var n=e("../lib/types"),l=n.Type,t=l.def,r=l.or,a=n.builtInTypes,u=a.string,o=a.number,s=a.boolean,i=a.RegExp,c=e("../lib/shared"),p=c.defaults,d=c.geq;t("Printable").field("loc",r(t("SourceLocation"),null),p["null"],!0),t("Node").bases("Printable").field("type",u).field("comments",r([t("Comment")],null),p["null"],!0),t("SourceLocation").build("start","end","source").field("start",t("Position")).field("end",t("Position")).field("source",r(u,null),p["null"]),t("Position").build("line","column").field("line",d(1)).field("column",d(0)),t("Program").bases("Node").build("body").field("body",[t("Statement")]),t("Function").bases("Node").field("id",r(t("Identifier"),null),p["null"]).field("params",[t("Pattern")]).field("body",r(t("BlockStatement"),t("Expression"))),t("Statement").bases("Node"),t("EmptyStatement").bases("Statement").build(),t("BlockStatement").bases("Statement").build("body").field("body",[t("Statement")]),t("ExpressionStatement").bases("Statement").build("expression").field("expression",t("Expression")),t("IfStatement").bases("Statement").build("test","consequent","alternate").field("test",t("Expression")).field("consequent",t("Statement")).field("alternate",r(t("Statement"),null),p["null"]),t("LabeledStatement").bases("Statement").build("label","body").field("label",t("Identifier")).field("body",t("Statement")),t("BreakStatement").bases("Statement").build("label").field("label",r(t("Identifier"),null),p["null"]),t("ContinueStatement").bases("Statement").build("label").field("label",r(t("Identifier"),null),p["null"]),t("WithStatement").bases("Statement").build("object","body").field("object",t("Expression")).field("body",t("Statement")),t("SwitchStatement").bases("Statement").build("discriminant","cases","lexical").field("discriminant",t("Expression")).field("cases",[t("SwitchCase")]).field("lexical",s,p["false"]),t("ReturnStatement").bases("Statement").build("argument").field("argument",r(t("Expression"),null)),t("ThrowStatement").bases("Statement").build("argument").field("argument",t("Expression")),t("TryStatement").bases("Statement").build("block","handler","finalizer").field("block",t("BlockStatement")).field("handler",r(t("CatchClause"),null),function(){return this.handlers&&this.handlers[0]||null}).field("handlers",[t("CatchClause")],function(){return this.handler?[this.handler]:[]},!0).field("guardedHandlers",[t("CatchClause")],p.emptyArray).field("finalizer",r(t("BlockStatement"),null),p["null"]),t("CatchClause").bases("Node").build("param","guard","body").field("param",t("Pattern")).field("guard",r(t("Expression"),null),p["null"]).field("body",t("BlockStatement")),t("WhileStatement").bases("Statement").build("test","body").field("test",t("Expression")).field("body",t("Statement")),t("DoWhileStatement").bases("Statement").build("body","test").field("body",t("Statement")).field("test",t("Expression")),t("ForStatement").bases("Statement").build("init","test","update","body").field("init",r(t("VariableDeclaration"),t("Expression"),null)).field("test",r(t("Expression"),null)).field("update",r(t("Expression"),null)).field("body",t("Statement")),t("ForInStatement").bases("Statement").build("left","right","body","each").field("left",r(t("VariableDeclaration"),t("Expression"))).field("right",t("Expression")).field("body",t("Statement")).field("each",s),t("DebuggerStatement").bases("Statement").build(),t("Declaration").bases("Statement"),t("FunctionDeclaration").bases("Function","Declaration").build("id","params","body").field("id",t("Identifier")),t("FunctionExpression").bases("Function","Expression").build("id","params","body"),t("VariableDeclaration").bases("Declaration").build("kind","declarations").field("kind",r("var","let","const")).field("declarations",[r(t("VariableDeclarator"),t("Identifier"))]),t("VariableDeclarator").bases("Node").build("id","init").field("id",t("Pattern")).field("init",r(t("Expression"),null)),t("Expression").bases("Node","Pattern"),t("ThisExpression").bases("Expression").build(),t("ArrayExpression").bases("Expression").build("elements").field("elements",[r(t("Expression"),null)]),t("ObjectExpression").bases("Expression").build("properties").field("properties",[t("Property")]),t("Property").bases("Node").build("kind","key","value").field("kind",r("init","get","set")).field("key",r(t("Literal"),t("Identifier"))).field("value",r(t("Expression"),t("Pattern"))),t("SequenceExpression").bases("Expression").build("expressions").field("expressions",[t("Expression")]);var f=r("-","+","!","~","typeof","void","delete");t("UnaryExpression").bases("Expression").build("operator","argument","prefix").field("operator",f).field("argument",t("Expression")).field("prefix",s,p["true"]);var h=r("==","!=","===","!==","<","<=",">",">=","<<",">>",">>>","+","-","*","/","%","&","|","^","in","instanceof","..");t("BinaryExpression").bases("Expression").build("operator","left","right").field("operator",h).field("left",t("Expression")).field("right",t("Expression"));var g=r("=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","^=","&=");t("AssignmentExpression").bases("Expression").build("operator","left","right").field("operator",g).field("left",t("Pattern")).field("right",t("Expression"));var m=r("++","--");t("UpdateExpression").bases("Expression").build("operator","argument","prefix").field("operator",m).field("argument",t("Expression")).field("prefix",s);var y=r("||","&&");t("LogicalExpression").bases("Expression").build("operator","left","right").field("operator",y).field("left",t("Expression")).field("right",t("Expression")),t("ConditionalExpression").bases("Expression").build("test","consequent","alternate").field("test",t("Expression")).field("consequent",t("Expression")).field("alternate",t("Expression")),t("NewExpression").bases("Expression").build("callee","arguments").field("callee",t("Expression")).field("arguments",[t("Expression")]),t("CallExpression").bases("Expression").build("callee","arguments").field("callee",t("Expression")).field("arguments",[t("Expression")]),t("MemberExpression").bases("Expression").build("object","property","computed").field("object",t("Expression")).field("property",r(t("Identifier"),t("Expression"))).field("computed",s),t("Pattern").bases("Node"),t("ObjectPattern").bases("Pattern").build("properties").field("properties",[r(t("PropertyPattern"),t("Property"))]),t("PropertyPattern").bases("Pattern").build("key","pattern").field("key",r(t("Literal"),t("Identifier"))).field("pattern",t("Pattern")),t("ArrayPattern").bases("Pattern").build("elements").field("elements",[r(t("Pattern"),null)]),t("SwitchCase").bases("Node").build("test","consequent").field("test",r(t("Expression"),null)).field("consequent",[t("Statement")]),t("Identifier").bases("Node","Expression","Pattern").build("name").field("name",u),t("Literal").bases("Node","Expression").build("value").field("value",r(u,s,null,o,i)),t("Comment").bases("Printable").field("value",u).field("leading",s,p["true"]).field("trailing",s,p["false"]),t("Block").bases("Comment").build("value","leading","trailing"),t("Line").bases("Comment").build("value","leading","trailing")},{"../lib/shared":137,"../lib/types":138}],127:[function(e){e("./core");var n=e("../lib/types"),l=n.Type.def,t=n.Type.or,r=n.builtInTypes,a=r.string,u=r.boolean;l("XMLDefaultDeclaration").bases("Declaration").field("namespace",l("Expression")),l("XMLAnyName").bases("Expression"),l("XMLQualifiedIdentifier").bases("Expression").field("left",t(l("Identifier"),l("XMLAnyName"))).field("right",t(l("Identifier"),l("Expression"))).field("computed",u),l("XMLFunctionQualifiedIdentifier").bases("Expression").field("right",t(l("Identifier"),l("Expression"))).field("computed",u),l("XMLAttributeSelector").bases("Expression").field("attribute",l("Expression")),l("XMLFilterExpression").bases("Expression").field("left",l("Expression")).field("right",l("Expression")),l("XMLElement").bases("XML","Expression").field("contents",[l("XML")]),l("XMLList").bases("XML","Expression").field("contents",[l("XML")]),l("XML").bases("Node"),l("XMLEscape").bases("XML").field("expression",l("Expression")),l("XMLText").bases("XML").field("text",a),l("XMLStartTag").bases("XML").field("contents",[l("XML")]),l("XMLEndTag").bases("XML").field("contents",[l("XML")]),l("XMLPointTag").bases("XML").field("contents",[l("XML")]),l("XMLName").bases("XML").field("contents",t(a,[l("XML")])),l("XMLAttribute").bases("XML").field("value",a),l("XMLCdata").bases("XML").field("contents",a),l("XMLComment").bases("XML").field("contents",a),l("XMLProcessingInstruction").bases("XML").field("target",a).field("contents",t(a,null))},{"../lib/types":138,"./core":126}],128:[function(e){e("./core");var n=e("../lib/types"),l=n.Type.def,t=n.Type.or,r=n.builtInTypes,a=r.boolean,u=(r.object,r.string),o=e("../lib/shared").defaults;l("Function").field("generator",a,o["false"]).field("expression",a,o["false"]).field("defaults",[t(l("Expression"),null)],o.emptyArray).field("rest",t(l("Identifier"),null),o["null"]),l("FunctionDeclaration").build("id","params","body","generator","expression"),l("FunctionExpression").build("id","params","body","generator","expression"),l("ArrowFunctionExpression").bases("Function","Expression").build("params","body","expression").field("id",null,o["null"]).field("generator",!1),l("YieldExpression").bases("Expression").build("argument","delegate").field("argument",t(l("Expression"),null)).field("delegate",a,o["false"]),l("GeneratorExpression").bases("Expression").build("body","blocks","filter").field("body",l("Expression")).field("blocks",[l("ComprehensionBlock")]).field("filter",t(l("Expression"),null)),l("ComprehensionExpression").bases("Expression").build("body","blocks","filter").field("body",l("Expression")).field("blocks",[l("ComprehensionBlock")]).field("filter",t(l("Expression"),null)),l("ComprehensionBlock").bases("Node").build("left","right","each").field("left",l("Pattern")).field("right",l("Expression")).field("each",a),l("ModuleSpecifier").bases("Literal").build("value").field("value",u),l("Property").field("key",t(l("Literal"),l("Identifier"),l("Expression"))).field("method",a,o["false"]).field("shorthand",a,o["false"]).field("computed",a,o["false"]),l("PropertyPattern").field("key",t(l("Literal"),l("Identifier"),l("Expression"))).field("computed",a,o["false"]),l("MethodDefinition").bases("Declaration").build("kind","key","value").field("kind",t("init","get","set","")).field("key",t(l("Literal"),l("Identifier"),l("Expression"))).field("value",l("Function")).field("computed",a,o["false"]),l("SpreadElement").bases("Node").build("argument").field("argument",l("Expression")),l("ArrayExpression").field("elements",[t(l("Expression"),l("SpreadElement"),null)]),l("NewExpression").field("arguments",[t(l("Expression"),l("SpreadElement"))]),l("CallExpression").field("arguments",[t(l("Expression"),l("SpreadElement"))]),l("SpreadElementPattern").bases("Pattern").build("argument").field("argument",l("Pattern")),l("ArrayPattern").field("elements",[t(l("Pattern"),null,l("SpreadElement"))]); var s=t(l("MethodDefinition"),l("VariableDeclarator"),l("ClassPropertyDefinition"),l("ClassProperty"));l("ClassProperty").bases("Declaration").build("key").field("key",t(l("Literal"),l("Identifier"),l("Expression"))).field("computed",a,o["false"]),l("ClassPropertyDefinition").bases("Declaration").build("definition").field("definition",s),l("ClassBody").bases("Declaration").build("body").field("body",[s]),l("ClassDeclaration").bases("Declaration").build("id","body","superClass").field("id",l("Identifier")).field("body",l("ClassBody")).field("superClass",t(l("Expression"),null),o["null"]),l("ClassExpression").bases("Expression").build("id","body","superClass").field("id",t(l("Identifier"),null),o["null"]).field("body",l("ClassBody")).field("superClass",t(l("Expression"),null),o["null"]).field("implements",[l("ClassImplements")],o.emptyArray),l("ClassImplements").bases("Node").build("id").field("id",l("Identifier")).field("superClass",t(l("Expression"),null),o["null"]),l("Specifier").bases("Node"),l("NamedSpecifier").bases("Specifier").field("id",l("Identifier")).field("name",t(l("Identifier"),null),o["null"]),l("ExportSpecifier").bases("NamedSpecifier").build("id","name"),l("ExportBatchSpecifier").bases("Specifier").build(),l("ImportSpecifier").bases("NamedSpecifier").build("id","name"),l("ImportNamespaceSpecifier").bases("Specifier").build("id").field("id",l("Identifier")),l("ImportDefaultSpecifier").bases("Specifier").build("id").field("id",l("Identifier")),l("ExportDeclaration").bases("Declaration").build("default","declaration","specifiers","source").field("default",a).field("declaration",t(l("Declaration"),l("Expression"),null)).field("specifiers",[t(l("ExportSpecifier"),l("ExportBatchSpecifier"))],o.emptyArray).field("source",t(l("ModuleSpecifier"),null),o["null"]),l("ImportDeclaration").bases("Declaration").build("specifiers","source").field("specifiers",[t(l("ImportSpecifier"),l("ImportNamespaceSpecifier"),l("ImportDefaultSpecifier"))],o.emptyArray).field("source",l("ModuleSpecifier")),l("TaggedTemplateExpression").bases("Expression").field("tag",l("Expression")).field("quasi",l("TemplateLiteral")),l("TemplateLiteral").bases("Expression").build("quasis","expressions").field("quasis",[l("TemplateElement")]).field("expressions",[l("Expression")]),l("TemplateElement").bases("Node").build("value","tail").field("value",{cooked:u,raw:u}).field("tail",a)},{"../lib/shared":137,"../lib/types":138,"./core":126}],129:[function(e){e("./core");var n=e("../lib/types"),l=n.Type.def,t=n.Type.or,r=n.builtInTypes,a=r.boolean,u=e("../lib/shared").defaults;l("Function").field("async",a,u["false"]),l("SpreadProperty").bases("Node").build("argument").field("argument",l("Expression")),l("ObjectExpression").field("properties",[t(l("Property"),l("SpreadProperty"))]),l("SpreadPropertyPattern").bases("Pattern").build("argument").field("argument",l("Pattern")),l("ObjectPattern").field("properties",[t(l("PropertyPattern"),l("SpreadPropertyPattern"),l("Property"),l("SpreadProperty"))]),l("AwaitExpression").bases("Expression").build("argument","all").field("argument",t(l("Expression"),null)).field("all",a,u["false"])},{"../lib/shared":137,"../lib/types":138,"./core":126}],130:[function(e){e("./core");var n=e("../lib/types"),l=n.Type.def,t=n.Type.or,r=n.builtInTypes,a=r.string,u=r.boolean,o=e("../lib/shared").defaults;l("XJSAttribute").bases("Node").build("name","value").field("name",t(l("XJSIdentifier"),l("XJSNamespacedName"))).field("value",t(l("Literal"),l("XJSExpressionContainer"),null),o["null"]),l("XJSIdentifier").bases("Node").build("name").field("name",a),l("XJSNamespacedName").bases("Node").build("namespace","name").field("namespace",l("XJSIdentifier")).field("name",l("XJSIdentifier")),l("XJSMemberExpression").bases("MemberExpression").build("object","property").field("object",t(l("XJSIdentifier"),l("XJSMemberExpression"))).field("property",l("XJSIdentifier")).field("computed",u,o.false);var s=t(l("XJSIdentifier"),l("XJSNamespacedName"),l("XJSMemberExpression"));l("XJSSpreadAttribute").bases("Node").build("argument").field("argument",l("Expression"));var i=[t(l("XJSAttribute"),l("XJSSpreadAttribute"))];l("XJSExpressionContainer").bases("Expression").build("expression").field("expression",l("Expression")),l("XJSElement").bases("Expression").build("openingElement","closingElement","children").field("openingElement",l("XJSOpeningElement")).field("closingElement",t(l("XJSClosingElement"),null),o["null"]).field("children",[t(l("XJSElement"),l("XJSExpressionContainer"),l("XJSText"),l("Literal"))],o.emptyArray).field("name",s,function(){return this.openingElement.name}).field("selfClosing",u,function(){return this.openingElement.selfClosing}).field("attributes",i,function(){return this.openingElement.attributes}),l("XJSOpeningElement").bases("Node").build("name","attributes","selfClosing").field("name",s).field("attributes",i,o.emptyArray).field("selfClosing",u,o["false"]),l("XJSClosingElement").bases("Node").build("name").field("name",s),l("XJSText").bases("Literal").build("value").field("value",a),l("XJSEmptyExpression").bases("Expression").build(),l("Type").bases("Node"),l("AnyTypeAnnotation").bases("Type"),l("VoidTypeAnnotation").bases("Type"),l("NumberTypeAnnotation").bases("Type"),l("StringTypeAnnotation").bases("Type"),l("StringLiteralTypeAnnotation").bases("Type").build("value","raw").field("value",a).field("raw",a),l("BooleanTypeAnnotation").bases("Type"),l("TypeAnnotation").bases("Node").build("typeAnnotation").field("typeAnnotation",l("Type")),l("NullableTypeAnnotation").bases("Type").build("typeAnnotation").field("typeAnnotation",l("Type")),l("FunctionTypeAnnotation").bases("Type").build("params","returnType","rest","typeParameters").field("params",[l("FunctionTypeParam")]).field("returnType",l("Type")).field("rest",t(l("FunctionTypeParam"),null)).field("typeParameters",t(l("TypeParameterDeclaration"),null)),l("FunctionTypeParam").bases("Node").build("name","typeAnnotation","optional").field("name",l("Identifier")).field("typeAnnotation",l("Type")).field("optional",u),l("ArrayTypeAnnotation").bases("Type").build("elementType").field("elementType",l("Type")),l("ObjectTypeAnnotation").bases("Type").build("properties").field("properties",[l("ObjectTypeProperty")]).field("indexers",[l("ObjectTypeIndexer")],o.emptyArray).field("callProperties",[l("ObjectTypeCallProperty")],o.emptyArray),l("ObjectTypeProperty").bases("Node").build("key","value","optional").field("key",t(l("Literal"),l("Identifier"))).field("value",l("Type")).field("optional",u),l("ObjectTypeIndexer").bases("Node").build("id","key","value").field("id",l("Identifier")).field("key",l("Type")).field("value",l("Type")),l("ObjectTypeCallProperty").bases("Node").build("value").field("value",l("FunctionTypeAnnotation")).field("static",u,!1),l("QualifiedTypeIdentifier").bases("Node").build("qualification","id").field("qualification",t(l("Identifier"),l("QualifiedTypeIdentifier"))).field("id",l("Identifier")),l("GenericTypeAnnotation").bases("Type").build("id","typeParameters").field("id",t(l("Identifier"),l("QualifiedTypeIdentifier"))).field("typeParameters",t(l("TypeParameterInstantiation"),null)),l("MemberTypeAnnotation").bases("Type").build("object","property").field("object",l("Identifier")).field("property",t(l("MemberTypeAnnotation"),l("GenericTypeAnnotation"))),l("UnionTypeAnnotation").bases("Type").build("types").field("types",[l("Type")]),l("IntersectionTypeAnnotation").bases("Type").build("types").field("types",[l("Type")]),l("TypeofTypeAnnotation").bases("Type").build("argument").field("argument",l("Type")),l("Identifier").field("typeAnnotation",t(l("TypeAnnotation"),null),o["null"]),l("TypeParameterDeclaration").bases("Node").build("params").field("params",[l("Identifier")]),l("TypeParameterInstantiation").bases("Node").build("params").field("params",[l("Type")]),l("Function").field("returnType",t(l("TypeAnnotation"),null),o["null"]).field("typeParameters",t(l("TypeParameterDeclaration"),null),o["null"]),l("ClassProperty").build("key","typeAnnotation").field("typeAnnotation",l("TypeAnnotation")).field("static",u,!1),l("ClassImplements").field("typeParameters",t(l("TypeParameterInstantiation"),null),o["null"]),l("InterfaceDeclaration").bases("Statement").build("id","body","extends").field("id",l("Identifier")).field("typeParameters",t(l("TypeParameterDeclaration"),null),o["null"]).field("body",l("ObjectTypeAnnotation")).field("extends",[l("InterfaceExtends")]),l("InterfaceExtends").bases("Node").build("id").field("id",l("Identifier")).field("typeParameters",t(l("TypeParameterInstantiation"),null)),l("TypeAlias").bases("Statement").build("id","typeParameters","right").field("id",l("Identifier")).field("typeParameters",t(l("TypeParameterDeclaration"),null)).field("right",l("Type")),l("TypeCastExpression").bases("Expression").build("expression","typeAnnotation").field("expression",l("Expression")).field("typeAnnotation",l("TypeAnnotation")),l("TupleTypeAnnotation").bases("Type").build("types").field("types",[l("Type")]),l("DeclareVariable").bases("Statement").build("id").field("id",l("Identifier")),l("DeclareFunction").bases("Statement").build("id").field("id",l("Identifier")),l("DeclareClass").bases("InterfaceDeclaration").build("id"),l("DeclareModule").bases("Statement").build("id","body").field("id",t(l("Identifier"),l("Literal"))).field("body",l("BlockStatement"))},{"../lib/shared":137,"../lib/types":138,"./core":126}],131:[function(e){e("./core");var n=e("../lib/types"),l=n.Type.def,t=n.Type.or,r=e("../lib/shared").geq;l("ForOfStatement").bases("Statement").build("left","right","body").field("left",t(l("VariableDeclaration"),l("Expression"))).field("right",l("Expression")).field("body",l("Statement")),l("LetStatement").bases("Statement").build("head","body").field("head",[l("VariableDeclarator")]).field("body",l("Statement")),l("LetExpression").bases("Expression").build("head","body").field("head",[l("VariableDeclarator")]).field("body",l("Expression")),l("GraphExpression").bases("Expression").build("index","expression").field("index",r(0)).field("expression",l("Literal")),l("GraphIndexExpression").bases("Expression").build("index").field("index",r(0))},{"../lib/shared":137,"../lib/types":138,"./core":126}],132:[function(e,n){function l(e,n,l){return p.check(l)?l.length=0:l=null,r(e,n,l)}function t(e){return/[_$a-z][_$a-z0-9]*/i.test(e)?"."+e:"["+JSON.stringify(e)+"]"}function r(e,n,l){return e===n?!0:p.check(e)?a(e,n,l):d.check(e)?u(e,n,l):f.check(e)?f.check(n)&&+e===+n:h.check(e)?h.check(n)&&e.source===n.source&&e.global===n.global&&e.multiline===n.multiline&&e.ignoreCase===n.ignoreCase:e==n}function a(e,n,l){p.assert(e);var t=e.length;if(!p.check(n)||n.length!==t)return l&&l.push("length"),!1;for(var a=0;t>a;++a){if(l&&l.push(a),a in e!=a in n)return!1;if(!r(e[a],n[a],l))return!1;l&&o.strictEqual(l.pop(),a)}return!0}function u(e,n,l){if(d.assert(e),!d.check(n))return!1;if(e.type!==n.type)return l&&l.push("type"),!1;var t=i(e),a=t.length,u=i(n),s=u.length;if(a===s){for(var p=0;a>p;++p){var f=t[p],h=c(e,f),m=c(n,f);if(l&&l.push(f),!r(h,m,l))return!1;l&&o.strictEqual(l.pop(),f)}return!0}if(!l)return!1;var y=Object.create(null);for(p=0;a>p;++p)y[t[p]]=!0;for(p=0;s>p;++p){if(f=u[p],!g.call(y,f))return l.push(f),!1;delete y[f]}for(f in y){l.push(f);break}return!1}var o=e("assert"),s=e("../main"),i=s.getFieldNames,c=s.getFieldValue,p=s.builtInTypes.array,d=s.builtInTypes.object,f=s.builtInTypes.Date,h=s.builtInTypes.RegExp,g=Object.prototype.hasOwnProperty;l.assert=function(e,n){var r=[];l(e,n,r)||(0===r.length?o.strictEqual(e,n):o.ok(!1,"Nodes differ in the following path: "+r.map(t).join("")))},n.exports=l},{"../main":139,assert:141}],133:[function(e,n){function l(e,n,t){s.ok(this instanceof l),h.call(this,e,n,t)}function t(e){return c.BinaryExpression.check(e)||c.LogicalExpression.check(e)}function r(e){return c.CallExpression.check(e)?!0:f.check(e)?e.some(r):c.Node.check(e)?i.someField(e,function(e,n){return r(n)}):!1}function a(e){for(var n,l;e.parent;e=e.parent){if(n=e.node,l=e.parent.node,c.BlockStatement.check(l)&&"body"===e.parent.name&&0===e.name)return s.strictEqual(l.body[0],n),!0;if(c.ExpressionStatement.check(l)&&"expression"===e.name)return s.strictEqual(l.expression,n),!0;if(c.SequenceExpression.check(l)&&"expressions"===e.parent.name&&0===e.name)s.strictEqual(l.expressions[0],n);else if(c.CallExpression.check(l)&&"callee"===e.name)s.strictEqual(l.callee,n);else if(c.MemberExpression.check(l)&&"object"===e.name)s.strictEqual(l.object,n);else if(c.ConditionalExpression.check(l)&&"test"===e.name)s.strictEqual(l.test,n);else if(t(l)&&"left"===e.name)s.strictEqual(l.left,n);else{if(!c.UnaryExpression.check(l)||l.prefix||"argument"!==e.name)return!1;s.strictEqual(l.argument,n)}}return!0}function u(e){if(c.VariableDeclaration.check(e.node)){var n=e.get("declarations").value;if(!n||0===n.length)return e.prune()}else if(c.ExpressionStatement.check(e.node)){if(!e.get("expression").value)return e.prune()}else c.IfStatement.check(e.node)&&o(e);return e}function o(e){var n=e.get("test").value,l=e.get("alternate").value,t=e.get("consequent").value;if(t||l){if(!t&&l){var r=p.unaryExpression("!",n,!0);c.UnaryExpression.check(n)&&"!"===n.operator&&(r=n.argument),e.get("test").replace(r),e.get("consequent").replace(l),e.get("alternate").replace()}}else{var a=p.expressionStatement(n);e.replace(a)}}var s=e("assert"),i=e("./types"),c=i.namedTypes,p=i.builders,d=i.builtInTypes.number,f=i.builtInTypes.array,h=e("./path"),g=e("./scope");e("util").inherits(l,h);var m=l.prototype;Object.defineProperties(m,{node:{get:function(){return Object.defineProperty(this,"node",{configurable:!0,value:this._computeNode()}),this.node}},parent:{get:function(){return Object.defineProperty(this,"parent",{configurable:!0,value:this._computeParent()}),this.parent}},scope:{get:function(){return Object.defineProperty(this,"scope",{configurable:!0,value:this._computeScope()}),this.scope}}}),m.replace=function(){return delete this.node,delete this.parent,delete this.scope,h.prototype.replace.apply(this,arguments)},m.prune=function(){var e=this.parent;return this.replace(),u(e)},m._computeNode=function(){var e=this.value;if(c.Node.check(e))return e;var n=this.parentPath;return n&&n.node||null},m._computeParent=function(){var e=this.value,n=this.parentPath;if(!c.Node.check(e)){for(;n&&!c.Node.check(n.value);)n=n.parentPath;n&&(n=n.parentPath)}for(;n&&!c.Node.check(n.value);)n=n.parentPath;return n||null},m._computeScope=function(){var e=this.value,n=this.parentPath,l=n&&n.scope;return c.Node.check(e)&&g.isEstablishedBy(e)&&(l=new g(this,l)),l||null},m.getValueProperty=function(e){return i.getFieldValue(this.value,e)},m.needsParens=function(e){var n=this.parentPath;if(!n)return!1;var l=this.value;if(!c.Expression.check(l))return!1;if("Identifier"===l.type)return!1;for(;!c.Node.check(n.value);)if(n=n.parentPath,!n)return!1;var t=n.value;switch(l.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return"MemberExpression"===t.type&&"object"===this.name&&t.object===l;case"BinaryExpression":case"LogicalExpression":switch(t.type){case"CallExpression":return"callee"===this.name&&t.callee===l;case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return!0;case"MemberExpression":return"object"===this.name&&t.object===l;case"BinaryExpression":case"LogicalExpression":var a=t.operator,n=y[a],u=l.operator,o=y[u];if(n>o)return!0;if(n===o&&"right"===this.name)return s.strictEqual(t.right,l),!0;default:return!1}case"SequenceExpression":switch(t.type){case"ForStatement":return!1;case"ExpressionStatement":return"expression"!==this.name;default:return!0}case"YieldExpression":switch(t.type){case"BinaryExpression":case"LogicalExpression":case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"CallExpression":case"MemberExpression":case"NewExpression":case"ConditionalExpression":case"YieldExpression":return!0;default:return!1}case"Literal":return"MemberExpression"===t.type&&d.check(l.value)&&"object"===this.name&&t.object===l;case"AssignmentExpression":case"ConditionalExpression":switch(t.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"BinaryExpression":case"LogicalExpression":return!0;case"CallExpression":return"callee"===this.name&&t.callee===l;case"ConditionalExpression":return"test"===this.name&&t.test===l;case"MemberExpression":return"object"===this.name&&t.object===l;default:return!1}default:if("NewExpression"===t.type&&"callee"===this.name&&t.callee===l)return r(l)}return e!==!0&&!this.canBeFirstInStatement()&&this.firstInStatement()?!0:!1};var y={};[["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"]].forEach(function(e,n){e.forEach(function(e){y[e]=n})}),m.canBeFirstInStatement=function(){var e=this.node;return!c.FunctionExpression.check(e)&&!c.ObjectExpression.check(e)},m.firstInStatement=function(){return a(this)},n.exports=l},{"./path":135,"./scope":136,"./types":138,assert:141,util:167}],134:[function(e,n){function l(){s.ok(this instanceof l),this._reusableContextStack=[],this._methodNameTable=t(this),this._shouldVisitComments=g.call(this._methodNameTable,"Block")||g.call(this._methodNameTable,"Line"),this.Context=u(this),this._visiting=!1,this._changeReported=!1}function t(e){var n=Object.create(null);for(var l in e)/^visit[A-Z]/.test(l)&&(n[l.slice("visit".length)]=!0);for(var t=i.computeSupertypeLookupTable(n),r=Object.create(null),n=Object.keys(t),a=n.length,u=0;a>u;++u){var o=n[u];l="visit"+t[o],h.check(e[l])&&(r[o]=l)}return r}function r(e,n){for(var l in n)g.call(n,l)&&(e[l]=n[l]);return e}function a(e,n){s.ok(e instanceof c),s.ok(n instanceof l);var t=e.value;if(d.check(t))e.each(n.visitWithoutReset,n);else if(f.check(t)){var r=i.getFieldNames(t);n._shouldVisitComments&&t.comments&&r.indexOf("comments")<0&&r.push("comments");for(var a=r.length,u=[],o=0;a>o;++o){var p=r[o];g.call(t,p)||(t[p]=i.getFieldValue(t,p)),u.push(e.get(p))}for(var o=0;a>o;++o)n.visitWithoutReset(u[o])}else;return e.value}function u(e){function n(t){s.ok(this instanceof n),s.ok(this instanceof l),s.ok(t instanceof c),Object.defineProperty(this,"visitor",{value:e,writable:!1,enumerable:!0,configurable:!1}),this.currentPath=t,this.needToCallTraverse=!0,Object.seal(this)}s.ok(e instanceof l);var t=n.prototype=Object.create(e);return t.constructor=n,r(t,_),n}var o,s=e("assert"),i=e("./types"),c=e("./node-path"),p=i.namedTypes.Printable,d=i.builtInTypes.array,f=i.builtInTypes.object,h=i.builtInTypes.function,g=Object.prototype.hasOwnProperty;l.fromMethodsObject=function(e){function n(){s.ok(this instanceof n),l.call(this)}if(e instanceof l)return e;if(!f.check(e))return new l;var t=n.prototype=Object.create(m);return t.constructor=n,r(t,e),r(n,l),h.assert(n.fromMethodsObject),h.assert(n.visit),new n},l.visit=function(e,n){return l.fromMethodsObject(n).visit(e)};var m=l.prototype,y=["Recursively calling visitor.visit(path) resets visitor state.","Try this.visit(path) or this.traverse(path) instead."].join(" ");m.visit=function(){s.ok(!this._visiting,y),this._visiting=!0,this._changeReported=!1,this._abortRequested=!1;for(var e=arguments.length,n=new Array(e),l=0;e>l;++l)n[l]=arguments[l];n[0]instanceof c||(n[0]=new c({root:n[0]}).get("root")),this.reset.apply(this,n);try{var t=this.visitWithoutReset(n[0]),r=!0}finally{if(this._visiting=!1,!r&&this._abortRequested)return n[0].value}return t},m.AbortRequest=function(){},m.abort=function(){var e=this;e._abortRequested=!0;var n=new e.AbortRequest;throw n.cancel=function(){e._abortRequested=!1},n},m.reset=function(){},m.visitWithoutReset=function(e){if(this instanceof this.Context)return this.visitor.visitWithoutReset(e);s.ok(e instanceof c);var n=e.value,l=p.check(n)&&this._methodNameTable[n.type];if(!l)return a(e,this);var t=this.acquireContext(e);try{return t.invokeVisitorMethod(l)}finally{this.releaseContext(t)}},m.acquireContext=function(e){return 0===this._reusableContextStack.length?new this.Context(e):this._reusableContextStack.pop().reset(e)},m.releaseContext=function(e){s.ok(e instanceof this.Context),this._reusableContextStack.push(e),e.currentPath=null},m.reportChanged=function(){this._changeReported=!0},m.wasChangeReported=function(){return this._changeReported};var _=Object.create(null);_.reset=function(e){return s.ok(this instanceof this.Context),s.ok(e instanceof c),this.currentPath=e,this.needToCallTraverse=!0,this},_.invokeVisitorMethod=function(e){s.ok(this instanceof this.Context),s.ok(this.currentPath instanceof c);var n=this.visitor[e].call(this,this.currentPath);n===!1?this.needToCallTraverse=!1:n!==o&&(this.currentPath=this.currentPath.replace(n)[0],this.needToCallTraverse&&this.traverse(this.currentPath)),s.strictEqual(this.needToCallTraverse,!1,"Must either call this.traverse or return false in "+e);var l=this.currentPath;return l&&l.value},_.traverse=function(e,n){return s.ok(this instanceof this.Context),s.ok(e instanceof c),s.ok(this.currentPath instanceof c),this.needToCallTraverse=!1,a(e,l.fromMethodsObject(n||this.visitor))},_.visit=function(e,n){return s.ok(this instanceof this.Context),s.ok(e instanceof c),s.ok(this.currentPath instanceof c),this.needToCallTraverse=!1,l.fromMethodsObject(n||this.visitor).visitWithoutReset(e)},_.reportChanged=function(){this.visitor.reportChanged()},_.abort=function(){this.needToCallTraverse=!1,this.visitor.abort()},n.exports=l},{"./node-path":133,"./types":138,assert:141}],135:[function(e,n){function l(e,n,t){s.ok(this instanceof l),n?s.ok(n instanceof l):(n=null,t=null),this.value=e,this.parentPath=n,this.name=t,this.__childCache=null}function t(e){return e.__childCache||(e.__childCache=Object.create(null))}function r(e,n){var l=t(e),r=e.getValueProperty(n),a=l[n];return c.call(l,n)&&a.value===r||(a=l[n]=new e.constructor(r,e,n)),a}function a(){}function u(e,n,l,r){if(d.assert(e.value),0===n)return a;var u=e.value.length;if(1>u)return a;var o=arguments.length;2===o?(l=0,r=u):3===o?(l=Math.max(l,0),r=u):(l=Math.max(l,0),r=Math.min(r,u)),f.assert(l),f.assert(r);for(var i=Object.create(null),p=t(e),h=l;r>h;++h)if(c.call(e.value,h)){var g=e.get(h);s.strictEqual(g.name,h);var m=h+n;g.name=m,i[m]=g,delete p[h]}return delete p.length,function(){for(var n in i){var l=i[n];s.strictEqual(l.name,+n),p[n]=l,e.value[n]=l.value}}}function o(e){s.ok(e instanceof l);var n=e.parentPath;if(!n)return e;var r=n.value,a=t(n);if(r[e.name]===e.value)a[e.name]=e;else if(d.check(r)){var u=r.indexOf(e.value);u>=0&&(a[e.name=u]=e)}else r[e.name]=e.value,a[e.name]=e;return s.strictEqual(r[e.name],e.value),s.strictEqual(e.parentPath.get(e.name),e),e}var s=e("assert"),i=Object.prototype,c=i.hasOwnProperty,p=e("./types"),d=p.builtInTypes.array,f=p.builtInTypes.number,h=Array.prototype,g=(h.slice,h.map,l.prototype);g.getValueProperty=function(e){return this.value[e]},g.get=function(){for(var e=this,n=arguments,l=n.length,t=0;l>t;++t)e=r(e,n[t]);return e},g.each=function(e,n){for(var l=[],t=this.value.length,r=0,r=0;t>r;++r)c.call(this.value,r)&&(l[r]=this.get(r));for(n=n||this,r=0;t>r;++r)c.call(l,r)&&e.call(n,l[r])},g.map=function(e,n){var l=[];return this.each(function(n){l.push(e.call(this,n))},n),l},g.filter=function(e,n){var l=[];return this.each(function(n){e.call(this,n)&&l.push(n)},n),l},g.shift=function(){var e=u(this,-1),n=this.value.shift();return e(),n},g.unshift=function(){var e=u(this,arguments.length),n=this.value.unshift.apply(this.value,arguments);return e(),n},g.push=function(){return d.assert(this.value),delete t(this).length,this.value.push.apply(this.value,arguments)},g.pop=function(){d.assert(this.value);var e=t(this);return delete e[this.value.length-1],delete e.length,this.value.pop()},g.insertAt=function(e){var n=arguments.length,l=u(this,n-1,e);if(l===a)return this;e=Math.max(e,0);for(var t=1;n>t;++t)this.value[e+t-1]=arguments[t];return l(),this},g.insertBefore=function(){for(var e=this.parentPath,n=arguments.length,l=[this.name],t=0;n>t;++t)l.push(arguments[t]);return e.insertAt.apply(e,l)},g.insertAfter=function(){for(var e=this.parentPath,n=arguments.length,l=[this.name+1],t=0;n>t;++t)l.push(arguments[t]);return e.insertAt.apply(e,l)},g.replace=function(e){var n=[],l=this.parentPath.value,r=t(this.parentPath),a=arguments.length;if(o(this),d.check(l)){for(var i=l.length,c=u(this.parentPath,a-1,this.name+1),p=[this.name,1],f=0;a>f;++f)p.push(arguments[f]);var h=l.splice.apply(l,p);if(s.strictEqual(h[0],this.value),s.strictEqual(l.length,i-1+a),c(),0===a)delete this.value,delete r[this.name],this.__childCache=null;else{for(s.strictEqual(l[this.name],e),this.value!==e&&(this.value=e,this.__childCache=null),f=0;a>f;++f)n.push(this.parentPath.get(this.name+f));s.strictEqual(n[0],this)}}else 1===a?(this.value!==e&&(this.__childCache=null),this.value=l[this.name]=e,n.push(this)):0===a?(delete l[this.name],delete this.value,this.__childCache=null):s.ok(!1,"Could not replace path");return n},n.exports=l},{"./types":138,assert:141}],136:[function(e,n){function l(n,t){o.ok(this instanceof l),o.ok(n instanceof e("./node-path")),y.assert(n.value);var r;t?(o.ok(t instanceof l),r=t.depth+1):(t=null,r=0),Object.defineProperties(this,{path:{value:n},node:{value:n.value},isGlobal:{value:!t,enumerable:!0},depth:{value:r},parent:{value:t},bindings:{value:{}}})}function t(e,n){var l=e.value;y.assert(l),c.CatchClause.check(l)?u(e.get("param"),n):r(e,n)}function r(e,n){var l=e.value;e.parent&&c.FunctionExpression.check(e.parent.node)&&e.parent.node.id&&u(e.parent.get("id"),n),l&&(f.check(l)?e.each(function(e){a(e,n)}):c.Function.check(l)?(e.get("params").each(function(e){u(e,n)}),a(e.get("body"),n)):c.VariableDeclarator.check(l)?(u(e.get("id"),n),a(e.get("init"),n)):"ImportSpecifier"===l.type||"ImportNamespaceSpecifier"===l.type||"ImportDefaultSpecifier"===l.type?u(e.get(l.name?"name":"id"),n):p.check(l)&&!d.check(l)&&s.eachField(l,function(l,t){var r=e.get(l);o.strictEqual(r.value,t),a(r,n)}))}function a(e,n){var l=e.value;if(!l||d.check(l));else if(c.FunctionDeclaration.check(l))u(e.get("id"),n);else if(c.ClassDeclaration&&c.ClassDeclaration.check(l))u(e.get("id"),n);else if(y.check(l)){if(c.CatchClause.check(l)){var t=l.param.name,a=h.call(n,t);r(e.get("body"),n),a||delete n[t]}}else r(e,n)}function u(e,n){var l=e.value;c.Pattern.assert(l),c.Identifier.check(l)?h.call(n,l.name)?n[l.name].push(e):n[l.name]=[e]:c.ObjectPattern&&c.ObjectPattern.check(l)?e.get("properties").each(function(e){var l=e.value;c.Pattern.check(l)?u(e,n):c.Property.check(l)?u(e.get("value"),n):c.SpreadProperty&&c.SpreadProperty.check(l)&&u(e.get("argument"),n)}):c.ArrayPattern&&c.ArrayPattern.check(l)?e.get("elements").each(function(e){var l=e.value;c.Pattern.check(l)?u(e,n):c.SpreadElement&&c.SpreadElement.check(l)&&u(e.get("argument"),n)}):c.PropertyPattern&&c.PropertyPattern.check(l)?u(e.get("pattern"),n):(c.SpreadElementPattern&&c.SpreadElementPattern.check(l)||c.SpreadPropertyPattern&&c.SpreadPropertyPattern.check(l))&&u(e.get("argument"),n)}var o=e("assert"),s=e("./types"),i=s.Type,c=s.namedTypes,p=c.Node,d=c.Expression,f=s.builtInTypes.array,h=Object.prototype.hasOwnProperty,g=s.builders,m=[c.Program,c.Function,c.CatchClause],y=i.or.apply(i,m);l.isEstablishedBy=function(e){return y.check(e)};var _=l.prototype;_.didScan=!1,_.declares=function(e){return this.scan(),h.call(this.bindings,e)},_.declareTemporary=function(e){e?o.ok(/^[a-z$_]/i.test(e),e):e="t$",e+=this.depth.toString(36)+"$",this.scan();for(var n=0;this.declares(e+n);)++n;var l=e+n;return this.bindings[l]=s.builders.identifier(l)},_.injectTemporary=function(e,n){e||(e=this.declareTemporary());var l=this.path.get("body");return c.BlockStatement.check(l.value)&&(l=l.get("body")),l.unshift(g.variableDeclaration("var",[g.variableDeclarator(e,n||null)])),e},_.scan=function(e){if(e||!this.didScan){for(var n in this.bindings)delete this.bindings[n];t(this.path,this.bindings),this.didScan=!0}},_.getBindings=function(){return this.scan(),this.bindings},_.lookup=function(e){for(var n=this;n&&!n.declares(e);n=n.parent);return n},_.getGlobalScope=function(){for(var e=this;!e.isGlobal;)e=e.parent;return e},n.exports=l},{"./node-path":133,"./types":138,assert:141}],137:[function(e,n,l){var t=e("../lib/types"),r=t.Type,a=t.builtInTypes,u=a.number;l.geq=function(e){return new r(function(n){return u.check(n)&&n>=e},u+" >= "+e)},l.defaults={"null":function(){return null},emptyArray:function(){return[]},"false":function(){return!1},"true":function(){return!0},undefined:function(){}};var o=r.or(a.string,a.number,a.boolean,a.null,a.undefined);l.isPrimitive=new r(function(e){if(null===e)return!0;var n=typeof e;return!("object"===n||"function"===n)},o.toString())},{"../lib/types":138}],138:[function(e,n,l){function t(e,n){var l=this;h.ok(l instanceof t,l),h.strictEqual(x.call(e),b,e+" is not a function");var r=x.call(n);h.ok(r===b||r===v,n+" is neither a function nor a string"),Object.defineProperties(l,{name:{value:n},check:{value:function(n,t){var r=e.call(l,n,t);return!r&&t&&x.call(t)===b&&t(l,n),r}}})}function r(e){return C.check(e)?"{"+Object.keys(e).map(function(n){return n+": "+e[n]}).join(", ")+"}":S.check(e)?"["+e.map(r).join(", ")+"]":JSON.stringify(e)}function a(e,n){var l=x.call(e);return Object.defineProperty(E,n,{enumerable:!0,value:new t(function(e){return x.call(e)===l},n)}),E[n]}function u(e,n){return e instanceof t?e:e instanceof s?e.type:S.check(e)?t.fromArray(e):C.check(e)?t.fromObject(e):R.check(e)?new t(e,n):new t(function(n){return n===e},M.check(n)?function(){return e+""}:n)}function o(e,n,l,t){var r=this;h.ok(r instanceof o),k.assert(e),n=u(n);var a={name:{value:e},type:{value:n},hidden:{value:!!t}};R.check(l)&&(a.defaultFn={value:l}),Object.defineProperties(r,a)}function s(e){var n=this;h.ok(n instanceof s),Object.defineProperties(n,{typeName:{value:e},baseNames:{value:[]},ownFields:{value:Object.create(null)},allSupertypes:{value:Object.create(null)},supertypeList:{value:[]},allFields:{value:Object.create(null)},fieldNames:{value:[]},type:{value:new t(function(e,l){return n.check(e,l)},e)}})}function i(e){return e.replace(/^[A-Z]+/,function(e){var n=e.length;switch(n){case 0:return"";case 1:return e.toLowerCase();default:return e.slice(0,n-1).toLowerCase()+e.charAt(n-1)}})}function c(e){var n=s.fromValue(e);return n?n.fieldNames.slice(0):("type"in e&&h.ok(!1,"did not recognize object of type "+JSON.stringify(e.type)),Object.keys(e))}function p(e,n){var l=s.fromValue(e);if(l){var t=l.allFields[n];if(t)return t.getValue(e)}return e[n]}function d(e,n){n.length=0,n.push(e);for(var l=Object.create(null),t=0;t<n.length;++t){e=n[t];var r=T[e];h.strictEqual(r.finalized,!0),I.call(l,e)&&delete n[l[e]],l[e]=t,n.push.apply(n,r.baseNames)}for(var a=0,u=a,o=n.length;o>u;++u)I.call(n,u)&&(n[a++]=n[u]);n.length=a}function f(e,n){return Object.keys(n).forEach(function(l){e[l]=n[l]}),e}var h=e("assert"),g=Array.prototype,m=g.slice,y=(g.map,g.forEach),_=Object.prototype,x=_.toString,b=x.call(function(){}),v=x.call(""),I=_.hasOwnProperty,w=t.prototype;l.Type=t,w.assert=function(e,n){if(!this.check(e,n)){var l=r(e);return h.ok(!1,l+" does not match type "+this),!1}return!0},w.toString=function(){var e=this.name;return k.check(e)?e:R.check(e)?e.call(this)+"":e+" type"};var E={};l.builtInTypes=E;var k=a("","string"),R=a(function(){},"function"),S=a([],"array"),C=a({},"object"),A=(a(/./,"RegExp"),a(new Date,"Date"),a(3,"number")),M=(a(!0,"boolean"),a(null,"null"),a(void 0,"undefined"));t.or=function(){for(var e=[],n=arguments.length,l=0;n>l;++l)e.push(u(arguments[l]));return new t(function(l,t){for(var r=0;n>r;++r)if(e[r].check(l,t))return!0;return!1},function(){return e.join(" | ")})},t.fromArray=function(e){return h.ok(S.check(e)),h.strictEqual(e.length,1,"only one element type is permitted for typed arrays"),u(e[0]).arrayOf()},w.arrayOf=function(){var e=this;return new t(function(n,l){return S.check(n)&&n.every(function(n){return e.check(n,l) })},function(){return"["+e+"]"})},t.fromObject=function(e){var n=Object.keys(e).map(function(n){return new o(n,e[n])});return new t(function(e,l){return C.check(e)&&n.every(function(n){return n.type.check(e[n.name],l)})},function(){return"{ "+n.join(", ")+" }"})};var j=o.prototype;j.toString=function(){return JSON.stringify(this.name)+": "+this.type},j.getValue=function(e){var n=e[this.name];return M.check(n)?(this.defaultFn&&(n=this.defaultFn.call(e)),n):n},t.def=function(e){return k.assert(e),I.call(T,e)?T[e]:T[e]=new s(e)};var T=Object.create(null);s.fromValue=function(e){if(e&&"object"==typeof e){var n=e.type;if("string"==typeof n&&I.call(T,n)){var l=T[n];if(l.finalized)return l}}return null};var P=s.prototype;P.isSupertypeOf=function(e){return e instanceof s?(h.strictEqual(this.finalized,!0),h.strictEqual(e.finalized,!0),I.call(e.allSupertypes,this.typeName)):void h.ok(!1,e+" is not a Def")},l.getSupertypeNames=function(e){h.ok(I.call(T,e));var n=T[e];return h.strictEqual(n.finalized,!0),n.supertypeList.slice(1)},l.computeSupertypeLookupTable=function(e){for(var n={},l=Object.keys(T),t=l.length,r=0;t>r;++r){var a=l[r],u=T[a];h.strictEqual(u.finalized,!0);for(var o=0;o<u.supertypeList.length;++o){var s=u.supertypeList[o];if(I.call(e,s)){n[a]=s;break}}}return n},P.checkAllFields=function(e,n){function l(l){var r=t[l],a=r.type,u=r.getValue(e);return a.check(u,n)}var t=this.allFields;return h.strictEqual(this.finalized,!0),C.check(e)&&Object.keys(t).every(l)},P.check=function(e,n){if(h.strictEqual(this.finalized,!0,"prematurely checking unfinalized type "+this.typeName),!C.check(e))return!1;var l=s.fromValue(e);return l?n&&l===this?this.checkAllFields(e,n):this.isSupertypeOf(l)?n?l.checkAllFields(e,n)&&this.checkAllFields(e,!1):!0:!1:"SourceLocation"===this.typeName||"Position"===this.typeName?this.checkAllFields(e,n):!1},P.bases=function(){var e=this.baseNames;return h.strictEqual(this.finalized,!1),y.call(arguments,function(n){k.assert(n),e.indexOf(n)<0&&e.push(n)}),this},Object.defineProperty(P,"buildable",{value:!1});var L={};l.builders=L;var O={};l.defineMethod=function(e,n){var l=O[e];return M.check(n)?delete O[e]:(R.assert(n),Object.defineProperty(O,e,{enumerable:!0,configurable:!0,value:n})),l},P.build=function(){var e=this;return Object.defineProperty(e,"buildParams",{value:m.call(arguments),writable:!1,enumerable:!1,configurable:!0}),h.strictEqual(e.finalized,!1),k.arrayOf().assert(e.buildParams),e.buildable?e:(e.field("type",e.typeName,function(){return e.typeName}),Object.defineProperty(e,"buildable",{value:!0}),Object.defineProperty(L,i(e.typeName),{enumerable:!0,value:function(){function n(n,u){if(!I.call(a,n)){var o=e.allFields;h.ok(I.call(o,n),n);var s,i=o[n],c=i.type;if(A.check(u)&&t>u)s=l[u];else if(i.defaultFn)s=i.defaultFn.call(a);else{var p="no value or default function given for field "+JSON.stringify(n)+" of "+e.typeName+"("+e.buildParams.map(function(e){return o[e]}).join(", ")+")";h.ok(!1,p)}c.check(s)||h.ok(!1,r(s)+" does not match field "+i+" of type "+e.typeName),a[n]=s}}var l=arguments,t=l.length,a=Object.create(O);return h.ok(e.finalized,"attempting to instantiate unfinalized type "+e.typeName),e.buildParams.forEach(function(e,l){n(e,l)}),Object.keys(e.allFields).forEach(function(e){n(e)}),h.strictEqual(a.type,e.typeName),a}}),e)},P.field=function(e,n,l,t){return h.strictEqual(this.finalized,!1),this.ownFields[e]=new o(e,n,l,t),this};var D={};l.namedTypes=D,l.getFieldNames=c,l.getFieldValue=p,l.eachField=function(e,n,l){c(e).forEach(function(l){n.call(this,l,p(e,l))},l)},l.someField=function(e,n,l){return c(e).some(function(l){return n.call(this,l,p(e,l))},l)},Object.defineProperty(P,"finalized",{value:!1}),P.finalize=function(){if(!this.finalized){var e=this.allFields,n=this.allSupertypes;this.baseNames.forEach(function(l){var t=T[l];t.finalize(),f(e,t.allFields),f(n,t.allSupertypes)}),f(e,this.ownFields),n[this.typeName]=this,this.fieldNames.length=0;for(var l in e)I.call(e,l)&&!e[l].hidden&&this.fieldNames.push(l);Object.defineProperty(D,this.typeName,{enumerable:!0,value:this.type}),Object.defineProperty(this,"finalized",{value:!0}),d(this.typeName,this.supertypeList)}},l.finalize=function(){Object.keys(T).forEach(function(e){T[e].finalize()})}},{assert:141}],139:[function(e,n,l){var t=e("./lib/types");e("./def/core"),e("./def/es6"),e("./def/es7"),e("./def/mozilla"),e("./def/e4x"),e("./def/fb-harmony"),t.finalize(),l.Type=t.Type,l.builtInTypes=t.builtInTypes,l.namedTypes=t.namedTypes,l.builders=t.builders,l.defineMethod=t.defineMethod,l.getFieldNames=t.getFieldNames,l.getFieldValue=t.getFieldValue,l.eachField=t.eachField,l.someField=t.someField,l.getSupertypeNames=t.getSupertypeNames,l.astNodesAreEquivalent=e("./lib/equiv"),l.finalize=t.finalize,l.NodePath=e("./lib/node-path"),l.PathVisitor=e("./lib/path-visitor"),l.visit=l.PathVisitor.visit},{"./def/core":126,"./def/e4x":127,"./def/es6":128,"./def/es7":129,"./def/fb-harmony":130,"./def/mozilla":131,"./lib/equiv":132,"./lib/node-path":133,"./lib/path-visitor":134,"./lib/types":138}],140:[function(){},{}],141:[function(e,n){function l(e,n){return d.isUndefined(n)?""+n:d.isNumber(n)&&!isFinite(n)?n.toString():d.isFunction(n)||d.isRegExp(n)?n.toString():n}function t(e,n){return d.isString(e)?e.length<n?e:e.slice(0,n):e}function r(e){return t(JSON.stringify(e.actual,l),128)+" "+e.operator+" "+t(JSON.stringify(e.expected,l),128)}function a(e,n,l,t,r){throw new g.AssertionError({message:l,actual:e,expected:n,operator:t,stackStartFunction:r})}function u(e,n){e||a(e,!0,n,"==",g.ok)}function o(e,n){if(e===n)return!0;if(d.isBuffer(e)&&d.isBuffer(n)){if(e.length!=n.length)return!1;for(var l=0;l<e.length;l++)if(e[l]!==n[l])return!1;return!0}return d.isDate(e)&&d.isDate(n)?e.getTime()===n.getTime():d.isRegExp(e)&&d.isRegExp(n)?e.source===n.source&&e.global===n.global&&e.multiline===n.multiline&&e.lastIndex===n.lastIndex&&e.ignoreCase===n.ignoreCase:d.isObject(e)||d.isObject(n)?i(e,n):e==n}function s(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function i(e,n){if(d.isNullOrUndefined(e)||d.isNullOrUndefined(n))return!1;if(e.prototype!==n.prototype)return!1;if(d.isPrimitive(e)||d.isPrimitive(n))return e===n;var l=s(e),t=s(n);if(l&&!t||!l&&t)return!1;if(l)return e=f.call(e),n=f.call(n),o(e,n);var r,a,u=m(e),i=m(n);if(u.length!=i.length)return!1;for(u.sort(),i.sort(),a=u.length-1;a>=0;a--)if(u[a]!=i[a])return!1;for(a=u.length-1;a>=0;a--)if(r=u[a],!o(e[r],n[r]))return!1;return!0}function c(e,n){return e&&n?"[object RegExp]"==Object.prototype.toString.call(n)?n.test(e):e instanceof n?!0:n.call({},e)===!0?!0:!1:!1}function p(e,n,l,t){var r;d.isString(l)&&(t=l,l=null);try{n()}catch(u){r=u}if(t=(l&&l.name?" ("+l.name+").":".")+(t?" "+t:"."),e&&!r&&a(r,l,"Missing expected exception"+t),!e&&c(r,l)&&a(r,l,"Got unwanted exception"+t),e&&r&&l&&!c(r,l)||!e&&r)throw r}var d=e("util/"),f=Array.prototype.slice,h=Object.prototype.hasOwnProperty,g=n.exports=u;g.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=r(this),this.generatedMessage=!0);var n=e.stackStartFunction||a;if(Error.captureStackTrace)Error.captureStackTrace(this,n);else{var l=new Error;if(l.stack){var t=l.stack,u=n.name,o=t.indexOf("\n"+u);if(o>=0){var s=t.indexOf("\n",o+1);t=t.substring(s+1)}this.stack=t}}},d.inherits(g.AssertionError,Error),g.fail=a,g.ok=u,g.equal=function(e,n,l){e!=n&&a(e,n,l,"==",g.equal)},g.notEqual=function(e,n,l){e==n&&a(e,n,l,"!=",g.notEqual)},g.deepEqual=function(e,n,l){o(e,n)||a(e,n,l,"deepEqual",g.deepEqual)},g.notDeepEqual=function(e,n,l){o(e,n)&&a(e,n,l,"notDeepEqual",g.notDeepEqual)},g.strictEqual=function(e,n,l){e!==n&&a(e,n,l,"===",g.strictEqual)},g.notStrictEqual=function(e,n,l){e===n&&a(e,n,l,"!==",g.notStrictEqual)},g.throws=function(){p.apply(this,[!0].concat(f.call(arguments)))},g.doesNotThrow=function(){p.apply(this,[!1].concat(f.call(arguments)))},g.ifError=function(e){if(e)throw e};var m=Object.keys||function(e){var n=[];for(var l in e)h.call(e,l)&&n.push(l);return n}},{"util/":167}],142:[function(e,n,l){arguments[4][140][0].apply(l,arguments)},{dup:140}],143:[function(e,n,l){function t(e,n,l){if(!(this instanceof t))return new t(e,n,l);var r,a=typeof e;if("number"===a)r=+e;else if("string"===a)r=t.byteLength(e,n);else{if("object"!==a||null===e)throw new TypeError("must start with number, buffer, array or string");"Buffer"===e.type&&D(e.data)&&(e=e.data),r=+e.length}if(r>F)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+F.toString(16)+" bytes");0>r?r=0:r>>>=0;var u=this;t.TYPED_ARRAY_SUPPORT?u=t._augment(new Uint8Array(r)):(u.length=r,u._isBuffer=!0);var o;if(t.TYPED_ARRAY_SUPPORT&&"number"==typeof e.byteLength)u._set(e);else if(R(e))if(t.isBuffer(e))for(o=0;r>o;o++)u[o]=e.readUInt8(o);else for(o=0;r>o;o++)u[o]=(e[o]%256+256)%256;else if("string"===a)u.write(e,0,n);else if("number"===a&&!t.TYPED_ARRAY_SUPPORT&&!l)for(o=0;r>o;o++)u[o]=0;return r>0&&r<=t.poolSize&&(u.parent=B),u}function r(e,n,l){if(!(this instanceof r))return new r(e,n,l);var a=new t(e,n,l);return delete a.parent,a}function a(e,n,l,t){l=Number(l)||0;var r=e.length-l;t?(t=Number(t),t>r&&(t=r)):t=r;var a=n.length;if(a%2!==0)throw new Error("Invalid hex string");t>a/2&&(t=a/2);for(var u=0;t>u;u++){var o=parseInt(n.substr(2*u,2),16);if(isNaN(o))throw new Error("Invalid hex string");e[l+u]=o}return u}function u(e,n,l,t){var r=T(C(n,e.length-l),e,l,t);return r}function o(e,n,l,t){var r=T(A(n),e,l,t);return r}function s(e,n,l,t){return o(e,n,l,t)}function i(e,n,l,t){var r=T(j(n),e,l,t);return r}function c(e,n,l,t){var r=T(M(n,e.length-l),e,l,t);return r}function p(e,n,l){return L.fromByteArray(0===n&&l===e.length?e:e.slice(n,l))}function d(e,n,l){var t="",r="";l=Math.min(e.length,l);for(var a=n;l>a;a++)e[a]<=127?(t+=P(r)+String.fromCharCode(e[a]),r=""):r+="%"+e[a].toString(16);return t+P(r)}function f(e,n,l){var t="";l=Math.min(e.length,l);for(var r=n;l>r;r++)t+=String.fromCharCode(127&e[r]);return t}function h(e,n,l){var t="";l=Math.min(e.length,l);for(var r=n;l>r;r++)t+=String.fromCharCode(e[r]);return t}function g(e,n,l){var t=e.length;(!n||0>n)&&(n=0),(!l||0>l||l>t)&&(l=t);for(var r="",a=n;l>a;a++)r+=S(e[a]);return r}function m(e,n,l){for(var t=e.slice(n,l),r="",a=0;a<t.length;a+=2)r+=String.fromCharCode(t[a]+256*t[a+1]);return r}function y(e,n,l){if(e%1!==0||0>e)throw new RangeError("offset is not uint");if(e+n>l)throw new RangeError("Trying to access beyond buffer length")}function _(e,n,l,r,a,u){if(!t.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");if(n>a||u>n)throw new RangeError("value is out of bounds");if(l+r>e.length)throw new RangeError("index out of range")}function x(e,n,l,t){0>n&&(n=65535+n+1);for(var r=0,a=Math.min(e.length-l,2);a>r;r++)e[l+r]=(n&255<<8*(t?r:1-r))>>>8*(t?r:1-r)}function b(e,n,l,t){0>n&&(n=4294967295+n+1);for(var r=0,a=Math.min(e.length-l,4);a>r;r++)e[l+r]=n>>>8*(t?r:3-r)&255}function v(e,n,l,t,r,a){if(n>r||a>n)throw new RangeError("value is out of bounds");if(l+t>e.length)throw new RangeError("index out of range");if(0>l)throw new RangeError("index out of range")}function I(e,n,l,t,r){return r||v(e,n,l,4,3.4028234663852886e38,-3.4028234663852886e38),O.write(e,n,l,t,23,4),l+4}function w(e,n,l,t,r){return r||v(e,n,l,8,1.7976931348623157e308,-1.7976931348623157e308),O.write(e,n,l,t,52,8),l+8}function E(e){if(e=k(e).replace(V,""),e.length<2)return"";for(;e.length%4!==0;)e+="=";return e}function k(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function R(e){return D(e)||t.isBuffer(e)||e&&"object"==typeof e&&"number"==typeof e.length}function S(e){return 16>e?"0"+e.toString(16):e.toString(16)}function C(e,n){n=n||1/0;for(var l,t=e.length,r=null,a=[],u=0;t>u;u++){if(l=e.charCodeAt(u),l>55295&&57344>l){if(!r){if(l>56319){(n-=3)>-1&&a.push(239,191,189);continue}if(u+1===t){(n-=3)>-1&&a.push(239,191,189);continue}r=l;continue}if(56320>l){(n-=3)>-1&&a.push(239,191,189),r=l;continue}l=r-55296<<10|l-56320|65536,r=null}else r&&((n-=3)>-1&&a.push(239,191,189),r=null);if(128>l){if((n-=1)<0)break;a.push(l)}else if(2048>l){if((n-=2)<0)break;a.push(l>>6|192,63&l|128)}else if(65536>l){if((n-=3)<0)break;a.push(l>>12|224,l>>6&63|128,63&l|128)}else{if(!(2097152>l))throw new Error("Invalid code point");if((n-=4)<0)break;a.push(l>>18|240,l>>12&63|128,l>>6&63|128,63&l|128)}}return a}function A(e){for(var n=[],l=0;l<e.length;l++)n.push(255&e.charCodeAt(l));return n}function M(e,n){for(var l,t,r,a=[],u=0;u<e.length&&!((n-=2)<0);u++)l=e.charCodeAt(u),t=l>>8,r=l%256,a.push(r),a.push(t);return a}function j(e){return L.toByteArray(E(e))}function T(e,n,l,t){for(var r=0;t>r&&!(r+l>=n.length||r>=e.length);r++)n[r+l]=e[r];return r}function P(e){try{return decodeURIComponent(e)}catch(n){return String.fromCharCode(65533)}}var L=e("base64-js"),O=e("ieee754"),D=e("is-array");l.Buffer=t,l.SlowBuffer=r,l.INSPECT_MAX_BYTES=50,t.poolSize=8192;var F=1073741823,B={};t.TYPED_ARRAY_SUPPORT=function(){try{var e=new ArrayBuffer(0),n=new Uint8Array(e);return n.foo=function(){return 42},42===n.foo()&&"function"==typeof n.subarray&&0===new Uint8Array(1).subarray(1,1).byteLength}catch(l){return!1}}(),t.isBuffer=function(e){return!(null==e||!e._isBuffer)},t.compare=function(e,n){if(!t.isBuffer(e)||!t.isBuffer(n))throw new TypeError("Arguments must be Buffers");if(e===n)return 0;for(var l=e.length,r=n.length,a=0,u=Math.min(l,r);u>a&&e[a]===n[a];a++);return a!==u&&(l=e[a],r=n[a]),r>l?-1:l>r?1:0},t.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},t.concat=function(e,n){if(!D(e))throw new TypeError("Usage: Buffer.concat(list[, length])");if(0===e.length)return new t(0);if(1===e.length)return e[0];var l;if(void 0===n)for(n=0,l=0;l<e.length;l++)n+=e[l].length;var r=new t(n),a=0;for(l=0;l<e.length;l++){var u=e[l];u.copy(r,a),a+=u.length}return r},t.byteLength=function(e,n){var l;switch(e+="",n||"utf8"){case"ascii":case"binary":case"raw":l=e.length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":l=2*e.length;break;case"hex":l=e.length>>>1;break;case"utf8":case"utf-8":l=C(e).length;break;case"base64":l=j(e).length;break;default:l=e.length}return l},t.prototype.length=void 0,t.prototype.parent=void 0,t.prototype.toString=function(e,n,l){var t=!1;if(n>>>=0,l=void 0===l||1/0===l?this.length:l>>>0,e||(e="utf8"),0>n&&(n=0),l>this.length&&(l=this.length),n>=l)return"";for(;;)switch(e){case"hex":return g(this,n,l);case"utf8":case"utf-8":return d(this,n,l);case"ascii":return f(this,n,l);case"binary":return h(this,n,l);case"base64":return p(this,n,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return m(this,n,l);default:if(t)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),t=!0}},t.prototype.equals=function(e){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:0===t.compare(this,e)},t.prototype.inspect=function(){var e="",n=l.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),"<Buffer "+e+">"},t.prototype.compare=function(e){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?0:t.compare(this,e)},t.prototype.get=function(e){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(e)},t.prototype.set=function(e,n){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(e,n)},t.prototype.write=function(e,n,l,t){if(isFinite(n))isFinite(l)||(t=l,l=void 0);else{var r=t;t=n,n=l,l=r}if(n=Number(n)||0,0>l||0>n||n>this.length)throw new RangeError("attempt to write outside buffer bounds");var p=this.length-n;l?(l=Number(l),l>p&&(l=p)):l=p,t=String(t||"utf8").toLowerCase();var d;switch(t){case"hex":d=a(this,e,n,l);break;case"utf8":case"utf-8":d=u(this,e,n,l);break;case"ascii":d=o(this,e,n,l);break;case"binary":d=s(this,e,n,l);break;case"base64":d=i(this,e,n,l);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":d=c(this,e,n,l);break;default:throw new TypeError("Unknown encoding: "+t)}return d},t.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},t.prototype.slice=function(e,n){var l=this.length;e=~~e,n=void 0===n?l:~~n,0>e?(e+=l,0>e&&(e=0)):e>l&&(e=l),0>n?(n+=l,0>n&&(n=0)):n>l&&(n=l),e>n&&(n=e);var r;if(t.TYPED_ARRAY_SUPPORT)r=t._augment(this.subarray(e,n));else{var a=n-e;r=new t(a,void 0,!0);for(var u=0;a>u;u++)r[u]=this[u+e]}return r.length&&(r.parent=this.parent||this),r},t.prototype.readUIntLE=function(e,n,l){e>>>=0,n>>>=0,l||y(e,n,this.length);for(var t=this[e],r=1,a=0;++a<n&&(r*=256);)t+=this[e+a]*r;return t},t.prototype.readUIntBE=function(e,n,l){e>>>=0,n>>>=0,l||y(e,n,this.length);for(var t=this[e+--n],r=1;n>0&&(r*=256);)t+=this[e+--n]*r;return t},t.prototype.readUInt8=function(e,n){return n||y(e,1,this.length),this[e]},t.prototype.readUInt16LE=function(e,n){return n||y(e,2,this.length),this[e]|this[e+1]<<8},t.prototype.readUInt16BE=function(e,n){return n||y(e,2,this.length),this[e]<<8|this[e+1]},t.prototype.readUInt32LE=function(e,n){return n||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},t.prototype.readUInt32BE=function(e,n){return n||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},t.prototype.readIntLE=function(e,n,l){e>>>=0,n>>>=0,l||y(e,n,this.length);for(var t=this[e],r=1,a=0;++a<n&&(r*=256);)t+=this[e+a]*r;return r*=128,t>=r&&(t-=Math.pow(2,8*n)),t},t.prototype.readIntBE=function(e,n,l){e>>>=0,n>>>=0,l||y(e,n,this.length);for(var t=n,r=1,a=this[e+--t];t>0&&(r*=256);)a+=this[e+--t]*r;return r*=128,a>=r&&(a-=Math.pow(2,8*n)),a},t.prototype.readInt8=function(e,n){return n||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},t.prototype.readInt16LE=function(e,n){n||y(e,2,this.length);var l=this[e]|this[e+1]<<8;return 32768&l?4294901760|l:l},t.prototype.readInt16BE=function(e,n){n||y(e,2,this.length);var l=this[e+1]|this[e]<<8;return 32768&l?4294901760|l:l},t.prototype.readInt32LE=function(e,n){return n||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},t.prototype.readInt32BE=function(e,n){return n||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},t.prototype.readFloatLE=function(e,n){return n||y(e,4,this.length),O.read(this,e,!0,23,4)},t.prototype.readFloatBE=function(e,n){return n||y(e,4,this.length),O.read(this,e,!1,23,4)},t.prototype.readDoubleLE=function(e,n){return n||y(e,8,this.length),O.read(this,e,!0,52,8)},t.prototype.readDoubleBE=function(e,n){return n||y(e,8,this.length),O.read(this,e,!1,52,8)},t.prototype.writeUIntLE=function(e,n,l,t){e=+e,n>>>=0,l>>>=0,t||_(this,e,n,l,Math.pow(2,8*l),0);var r=1,a=0;for(this[n]=255&e;++a<l&&(r*=256);)this[n+a]=e/r>>>0&255;return n+l},t.prototype.writeUIntBE=function(e,n,l,t){e=+e,n>>>=0,l>>>=0,t||_(this,e,n,l,Math.pow(2,8*l),0);var r=l-1,a=1;for(this[n+r]=255&e;--r>=0&&(a*=256);)this[n+r]=e/a>>>0&255;return n+l},t.prototype.writeUInt8=function(e,n,l){return e=+e,n>>>=0,l||_(this,e,n,1,255,0),t.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[n]=e,n+1},t.prototype.writeUInt16LE=function(e,n,l){return e=+e,n>>>=0,l||_(this,e,n,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[n]=e,this[n+1]=e>>>8):x(this,e,n,!0),n+2},t.prototype.writeUInt16BE=function(e,n,l){return e=+e,n>>>=0,l||_(this,e,n,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[n]=e>>>8,this[n+1]=e):x(this,e,n,!1),n+2},t.prototype.writeUInt32LE=function(e,n,l){return e=+e,n>>>=0,l||_(this,e,n,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[n+3]=e>>>24,this[n+2]=e>>>16,this[n+1]=e>>>8,this[n]=e):b(this,e,n,!0),n+4},t.prototype.writeUInt32BE=function(e,n,l){return e=+e,n>>>=0,l||_(this,e,n,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=e):b(this,e,n,!1),n+4},t.prototype.writeIntLE=function(e,n,l,t){e=+e,n>>>=0,t||_(this,e,n,l,Math.pow(2,8*l-1)-1,-Math.pow(2,8*l-1));var r=0,a=1,u=0>e?1:0;for(this[n]=255&e;++r<l&&(a*=256);)this[n+r]=(e/a>>0)-u&255;return n+l},t.prototype.writeIntBE=function(e,n,l,t){e=+e,n>>>=0,t||_(this,e,n,l,Math.pow(2,8*l-1)-1,-Math.pow(2,8*l-1));var r=l-1,a=1,u=0>e?1:0;for(this[n+r]=255&e;--r>=0&&(a*=256);)this[n+r]=(e/a>>0)-u&255;return n+l},t.prototype.writeInt8=function(e,n,l){return e=+e,n>>>=0,l||_(this,e,n,1,127,-128),t.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),0>e&&(e=255+e+1),this[n]=e,n+1},t.prototype.writeInt16LE=function(e,n,l){return e=+e,n>>>=0,l||_(this,e,n,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[n]=e,this[n+1]=e>>>8):x(this,e,n,!0),n+2},t.prototype.writeInt16BE=function(e,n,l){return e=+e,n>>>=0,l||_(this,e,n,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[n]=e>>>8,this[n+1]=e):x(this,e,n,!1),n+2},t.prototype.writeInt32LE=function(e,n,l){return e=+e,n>>>=0,l||_(this,e,n,4,2147483647,-2147483648),t.TYPED_ARRAY_SUPPORT?(this[n]=e,this[n+1]=e>>>8,this[n+2]=e>>>16,this[n+3]=e>>>24):b(this,e,n,!0),n+4},t.prototype.writeInt32BE=function(e,n,l){return e=+e,n>>>=0,l||_(this,e,n,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),t.TYPED_ARRAY_SUPPORT?(this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=e):b(this,e,n,!1),n+4},t.prototype.writeFloatLE=function(e,n,l){return I(this,e,n,!0,l)},t.prototype.writeFloatBE=function(e,n,l){return I(this,e,n,!1,l)},t.prototype.writeDoubleLE=function(e,n,l){return w(this,e,n,!0,l)},t.prototype.writeDoubleBE=function(e,n,l){return w(this,e,n,!1,l)},t.prototype.copy=function(e,n,l,r){var a=this;if(l||(l=0),r||0===r||(r=this.length),n>=e.length&&(n=e.length),n||(n=0),r>0&&l>r&&(r=l),r===l)return 0;if(0===e.length||0===a.length)return 0;if(0>n)throw new RangeError("targetStart out of bounds");if(0>l||l>=a.length)throw new RangeError("sourceStart out of bounds");if(0>r)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-n<r-l&&(r=e.length-n+l);var u=r-l;if(1e3>u||!t.TYPED_ARRAY_SUPPORT)for(var o=0;u>o;o++)e[o+n]=this[o+l];else e._set(this.subarray(l,l+u),n);return u},t.prototype.fill=function(e,n,l){if(e||(e=0),n||(n=0),l||(l=this.length),n>l)throw new RangeError("end < start");if(l!==n&&0!==this.length){if(0>n||n>=this.length)throw new RangeError("start out of bounds");if(0>l||l>this.length)throw new RangeError("end out of bounds");var t;if("number"==typeof e)for(t=n;l>t;t++)this[t]=e;else{var r=C(e.toString()),a=r.length;for(t=n;l>t;t++)this[t]=r[t%a]}return this}},t.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(t.TYPED_ARRAY_SUPPORT)return new t(this).buffer;for(var e=new Uint8Array(this.length),n=0,l=e.length;l>n;n+=1)e[n]=this[n];return e.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var N=t.prototype;t._augment=function(e){return e.constructor=t,e._isBuffer=!0,e._get=e.get,e._set=e.set,e.get=N.get,e.set=N.set,e.write=N.write,e.toString=N.toString,e.toLocaleString=N.toString,e.toJSON=N.toJSON,e.equals=N.equals,e.compare=N.compare,e.copy=N.copy,e.slice=N.slice,e.readUIntLE=N.readUIntLE,e.readUIntBE=N.readUIntBE,e.readUInt8=N.readUInt8,e.readUInt16LE=N.readUInt16LE,e.readUInt16BE=N.readUInt16BE,e.readUInt32LE=N.readUInt32LE,e.readUInt32BE=N.readUInt32BE,e.readIntLE=N.readIntLE,e.readIntBE=N.readIntBE,e.readInt8=N.readInt8,e.readInt16LE=N.readInt16LE,e.readInt16BE=N.readInt16BE,e.readInt32LE=N.readInt32LE,e.readInt32BE=N.readInt32BE,e.readFloatLE=N.readFloatLE,e.readFloatBE=N.readFloatBE,e.readDoubleLE=N.readDoubleLE,e.readDoubleBE=N.readDoubleBE,e.writeUInt8=N.writeUInt8,e.writeUIntLE=N.writeUIntLE,e.writeUIntBE=N.writeUIntBE,e.writeUInt16LE=N.writeUInt16LE,e.writeUInt16BE=N.writeUInt16BE,e.writeUInt32LE=N.writeUInt32LE,e.writeUInt32BE=N.writeUInt32BE,e.writeIntLE=N.writeIntLE,e.writeIntBE=N.writeIntBE,e.writeInt8=N.writeInt8,e.writeInt16LE=N.writeInt16LE,e.writeInt16BE=N.writeInt16BE,e.writeInt32LE=N.writeInt32LE,e.writeInt32BE=N.writeInt32BE,e.writeFloatLE=N.writeFloatLE,e.writeFloatBE=N.writeFloatBE,e.writeDoubleLE=N.writeDoubleLE,e.writeDoubleBE=N.writeDoubleBE,e.fill=N.fill,e.inspect=N.inspect,e.toArrayBuffer=N.toArrayBuffer,e};var V=/[^+\/0-9A-z\-]/g},{"base64-js":144,ieee754:145,"is-array":146}],144:[function(e,n,l){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(e){"use strict";function n(e){var n=e.charCodeAt(0);return n===u||n===p?62:n===o||n===d?63:s>n?-1:s+10>n?n-s+26+26:c+26>n?n-c:i+26>n?n-i+26:void 0}function l(e){function l(e){i[p++]=e}var t,r,u,o,s,i;if(e.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var c=e.length;s="="===e.charAt(c-2)?2:"="===e.charAt(c-1)?1:0,i=new a(3*e.length/4-s),u=s>0?e.length-4:e.length;var p=0;for(t=0,r=0;u>t;t+=4,r+=3)o=n(e.charAt(t))<<18|n(e.charAt(t+1))<<12|n(e.charAt(t+2))<<6|n(e.charAt(t+3)),l((16711680&o)>>16),l((65280&o)>>8),l(255&o);return 2===s?(o=n(e.charAt(t))<<2|n(e.charAt(t+1))>>4,l(255&o)):1===s&&(o=n(e.charAt(t))<<10|n(e.charAt(t+1))<<4|n(e.charAt(t+2))>>2,l(o>>8&255),l(255&o)),i}function r(e){function n(e){return t.charAt(e)}function l(e){return n(e>>18&63)+n(e>>12&63)+n(e>>6&63)+n(63&e)}var r,a,u,o=e.length%3,s="";for(r=0,u=e.length-o;u>r;r+=3)a=(e[r]<<16)+(e[r+1]<<8)+e[r+2],s+=l(a);switch(o){case 1:a=e[e.length-1],s+=n(a>>2),s+=n(a<<4&63),s+="==";break;case 2:a=(e[e.length-2]<<8)+e[e.length-1],s+=n(a>>10),s+=n(a>>4&63),s+=n(a<<2&63),s+="="}return s}var a="undefined"!=typeof Uint8Array?Uint8Array:Array,u="+".charCodeAt(0),o="/".charCodeAt(0),s="0".charCodeAt(0),i="a".charCodeAt(0),c="A".charCodeAt(0),p="-".charCodeAt(0),d="_".charCodeAt(0);e.toByteArray=l,e.fromByteArray=r}("undefined"==typeof l?this.base64js={}:l)},{}],145:[function(e,n,l){l.read=function(e,n,l,t,r){var a,u,o=8*r-t-1,s=(1<<o)-1,i=s>>1,c=-7,p=l?r-1:0,d=l?-1:1,f=e[n+p];for(p+=d,a=f&(1<<-c)-1,f>>=-c,c+=o;c>0;a=256*a+e[n+p],p+=d,c-=8);for(u=a&(1<<-c)-1,a>>=-c,c+=t;c>0;u=256*u+e[n+p],p+=d,c-=8);if(0===a)a=1-i;else{if(a===s)return u?0/0:1/0*(f?-1:1);u+=Math.pow(2,t),a-=i}return(f?-1:1)*u*Math.pow(2,a-t)},l.write=function(e,n,l,t,r,a){var u,o,s,i=8*a-r-1,c=(1<<i)-1,p=c>>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,f=t?0:a-1,h=t?1:-1,g=0>n||0===n&&0>1/n?1:0;for(n=Math.abs(n),isNaN(n)||1/0===n?(o=isNaN(n)?1:0,u=c):(u=Math.floor(Math.log(n)/Math.LN2),n*(s=Math.pow(2,-u))<1&&(u--,s*=2),n+=u+p>=1?d/s:d*Math.pow(2,1-p),n*s>=2&&(u++,s/=2),u+p>=c?(o=0,u=c):u+p>=1?(o=(n*s-1)*Math.pow(2,r),u+=p):(o=n*Math.pow(2,p-1)*Math.pow(2,r),u=0));r>=8;e[l+f]=255&o,f+=h,o/=256,r-=8);for(u=u<<r|o,i+=r;i>0;e[l+f]=255&u,f+=h,u/=256,i-=8);e[l+f-h]|=128*g}},{}],146:[function(e,n){var l=Array.isArray,t=Object.prototype.toString;n.exports=l||function(e){return!!e&&"[object Array]"==t.call(e)}},{}],147:[function(e,n){function l(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function t(e){return"function"==typeof e}function r(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function u(e){return void 0===e}n.exports=l,l.EventEmitter=l,l.prototype._events=void 0,l.prototype._maxListeners=void 0,l.defaultMaxListeners=10,l.prototype.setMaxListeners=function(e){if(!r(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},l.prototype.emit=function(e){var n,l,r,o,s,i;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(n=arguments[1],n instanceof Error)throw n;throw TypeError('Uncaught, unspecified "error" event.')}if(l=this._events[e],u(l))return!1;if(t(l))switch(arguments.length){case 1:l.call(this);break;case 2:l.call(this,arguments[1]);break;case 3:l.call(this,arguments[1],arguments[2]);break;default:for(r=arguments.length,o=new Array(r-1),s=1;r>s;s++)o[s-1]=arguments[s];l.apply(this,o)}else if(a(l)){for(r=arguments.length,o=new Array(r-1),s=1;r>s;s++)o[s-1]=arguments[s];for(i=l.slice(),r=i.length,s=0;r>s;s++)i[s].apply(this,o)}return!0},l.prototype.addListener=function(e,n){var r;if(!t(n))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,t(n.listener)?n.listener:n),this._events[e]?a(this._events[e])?this._events[e].push(n):this._events[e]=[this._events[e],n]:this._events[e]=n,a(this._events[e])&&!this._events[e].warned){var r;r=u(this._maxListeners)?l.defaultMaxListeners:this._maxListeners,r&&r>0&&this._events[e].length>r&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())}return this},l.prototype.on=l.prototype.addListener,l.prototype.once=function(e,n){function l(){this.removeListener(e,l),r||(r=!0,n.apply(this,arguments))}if(!t(n))throw TypeError("listener must be a function");var r=!1;return l.listener=n,this.on(e,l),this},l.prototype.removeListener=function(e,n){var l,r,u,o;if(!t(n))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(l=this._events[e],u=l.length,r=-1,l===n||t(l.listener)&&l.listener===n)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,n);else if(a(l)){for(o=u;o-->0;)if(l[o]===n||l[o].listener&&l[o].listener===n){r=o;break}if(0>r)return this;1===l.length?(l.length=0,delete this._events[e]):l.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,n)}return this},l.prototype.removeAllListeners=function(e){var n,l;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(n in this._events)"removeListener"!==n&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events={},this}if(l=this._events[e],t(l))this.removeListener(e,l);else for(;l.length;)this.removeListener(e,l[l.length-1]);return delete this._events[e],this},l.prototype.listeners=function(e){var n;return n=this._events&&this._events[e]?t(this._events[e])?[this._events[e]]:this._events[e].slice():[]},l.listenerCount=function(e,n){var l;return l=e._events&&e._events[n]?t(e._events[n])?1:e._events[n].length:0}},{}],148:[function(e,n){n.exports="function"==typeof Object.create?function(e,n){e.super_=n,e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,n){e.super_=n;var l=function(){};l.prototype=n.prototype,e.prototype=new l,e.prototype.constructor=e}},{}],149:[function(e,n){n.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},{}],150:[function(e,n,l){(function(e){function n(e,n){for(var l=0,t=e.length-1;t>=0;t--){var r=e[t];"."===r?e.splice(t,1):".."===r?(e.splice(t,1),l++):l&&(e.splice(t,1),l--)}if(n)for(;l--;l)e.unshift("..");return e}function t(e,n){if(e.filter)return e.filter(n);for(var l=[],t=0;t<e.length;t++)n(e[t],t,e)&&l.push(e[t]);return l}var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,a=function(e){return r.exec(e).slice(1)};l.resolve=function(){for(var l="",r=!1,a=arguments.length-1;a>=-1&&!r;a--){var u=a>=0?arguments[a]:e.cwd();if("string"!=typeof u)throw new TypeError("Arguments to path.resolve must be strings");u&&(l=u+"/"+l,r="/"===u.charAt(0))}return l=n(t(l.split("/"),function(e){return!!e}),!r).join("/"),(r?"/":"")+l||"."},l.normalize=function(e){var r=l.isAbsolute(e),a="/"===u(e,-1);return e=n(t(e.split("/"),function(e){return!!e}),!r).join("/"),e||r||(e="."),e&&a&&(e+="/"),(r?"/":"")+e},l.isAbsolute=function(e){return"/"===e.charAt(0)},l.join=function(){var e=Array.prototype.slice.call(arguments,0);return l.normalize(t(e,function(e){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},l.relative=function(e,n){function t(e){for(var n=0;n<e.length&&""===e[n];n++);for(var l=e.length-1;l>=0&&""===e[l];l--);return n>l?[]:e.slice(n,l-n+1) }e=l.resolve(e).substr(1),n=l.resolve(n).substr(1);for(var r=t(e.split("/")),a=t(n.split("/")),u=Math.min(r.length,a.length),o=u,s=0;u>s;s++)if(r[s]!==a[s]){o=s;break}for(var i=[],s=o;s<r.length;s++)i.push("..");return i=i.concat(a.slice(o)),i.join("/")},l.sep="/",l.delimiter=":",l.dirname=function(e){var n=a(e),l=n[0],t=n[1];return l||t?(t&&(t=t.substr(0,t.length-1)),l+t):"."},l.basename=function(e,n){var l=a(e)[2];return n&&l.substr(-1*n.length)===n&&(l=l.substr(0,l.length-n.length)),l},l.extname=function(e){return a(e)[3]};var u="b"==="ab".substr(-1)?function(e,n,l){return e.substr(n,l)}:function(e,n,l){return 0>n&&(n=e.length+n),e.substr(n,l)}}).call(this,e("_process"))},{_process:151}],151:[function(e,n){function l(){if(!u){u=!0;for(var e,n=a.length;n;){e=a,a=[];for(var l=-1;++l<n;)e[l]();n=a.length}u=!1}}function t(){}var r=n.exports={},a=[],u=!1;r.nextTick=function(e){a.push(e),u||setTimeout(l,0)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.on=t,r.addListener=t,r.once=t,r.off=t,r.removeListener=t,r.removeAllListeners=t,r.emit=t,r.binding=function(){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},{}],152:[function(e,n){n.exports=e("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":153}],153:[function(e,n){(function(l){function t(e){return this instanceof t?(s.call(this,e),i.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",r)):new t(e)}function r(){this.allowHalfOpen||this._writableState.ended||l.nextTick(this.end.bind(this))}function a(e,n){for(var l=0,t=e.length;t>l;l++)n(e[l],l)}n.exports=t;var u=Object.keys||function(e){var n=[];for(var l in e)n.push(l);return n},o=e("core-util-is");o.inherits=e("inherits");var s=e("./_stream_readable"),i=e("./_stream_writable");o.inherits(t,s),a(u(i.prototype),function(e){t.prototype[e]||(t.prototype[e]=i.prototype[e])})}).call(this,e("_process"))},{"./_stream_readable":155,"./_stream_writable":157,_process:151,"core-util-is":158,inherits:148}],154:[function(e,n){function l(e){return this instanceof l?void t.call(this,e):new l(e)}n.exports=l;var t=e("./_stream_transform"),r=e("core-util-is");r.inherits=e("inherits"),r.inherits(l,t),l.prototype._transform=function(e,n,l){l(null,e)}},{"./_stream_transform":156,"core-util-is":158,inherits:148}],155:[function(e,n){(function(l){function t(n,l){var t=e("./_stream_duplex");n=n||{};var r=n.highWaterMark,a=n.objectMode?16:16384;this.highWaterMark=r||0===r?r:a,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.objectMode=!!n.objectMode,l instanceof t&&(this.objectMode=this.objectMode||!!n.readableObjectMode),this.defaultEncoding=n.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,n.encoding&&(C||(C=e("string_decoder/").StringDecoder),this.decoder=new C(n.encoding),this.encoding=n.encoding)}function r(n){e("./_stream_duplex");return this instanceof r?(this._readableState=new t(n,this),this.readable=!0,void R.call(this)):new r(n)}function a(e,n,l,t,r){var a=i(n,l);if(a)e.emit("error",a);else if(S.isNullOrUndefined(l))n.reading=!1,n.ended||c(e,n);else if(n.objectMode||l&&l.length>0)if(n.ended&&!r){var o=new Error("stream.push() after EOF");e.emit("error",o)}else if(n.endEmitted&&r){var o=new Error("stream.unshift() after end event");e.emit("error",o)}else!n.decoder||r||t||(l=n.decoder.write(l)),r||(n.reading=!1),n.flowing&&0===n.length&&!n.sync?(e.emit("data",l),e.read(0)):(n.length+=n.objectMode?1:l.length,r?n.buffer.unshift(l):n.buffer.push(l),n.needReadable&&p(e)),f(e,n);else r||(n.reading=!1);return u(n)}function u(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}function o(e){if(e>=M)e=M;else{e--;for(var n=1;32>n;n<<=1)e|=e>>n;e++}return e}function s(e,n){return 0===n.length&&n.ended?0:n.objectMode?0===e?0:1:isNaN(e)||S.isNull(e)?n.flowing&&n.buffer.length?n.buffer[0].length:n.length:0>=e?0:(e>n.highWaterMark&&(n.highWaterMark=o(e)),e>n.length?n.ended?n.length:(n.needReadable=!0,0):e)}function i(e,n){var l=null;return S.isBuffer(n)||S.isString(n)||S.isNullOrUndefined(n)||e.objectMode||(l=new TypeError("Invalid non-string/buffer chunk")),l}function c(e,n){if(n.decoder&&!n.ended){var l=n.decoder.end();l&&l.length&&(n.buffer.push(l),n.length+=n.objectMode?1:l.length)}n.ended=!0,p(e)}function p(e){var n=e._readableState;n.needReadable=!1,n.emittedReadable||(A("emitReadable",n.flowing),n.emittedReadable=!0,n.sync?l.nextTick(function(){d(e)}):d(e))}function d(e){A("emit readable"),e.emit("readable"),_(e)}function f(e,n){n.readingMore||(n.readingMore=!0,l.nextTick(function(){h(e,n)}))}function h(e,n){for(var l=n.length;!n.reading&&!n.flowing&&!n.ended&&n.length<n.highWaterMark&&(A("maybeReadMore read 0"),e.read(0),l!==n.length);)l=n.length;n.readingMore=!1}function g(e){return function(){var n=e._readableState;A("pipeOnDrain",n.awaitDrain),n.awaitDrain&&n.awaitDrain--,0===n.awaitDrain&&k.listenerCount(e,"data")&&(n.flowing=!0,_(e))}}function m(e,n){n.resumeScheduled||(n.resumeScheduled=!0,l.nextTick(function(){y(e,n)}))}function y(e,n){n.resumeScheduled=!1,e.emit("resume"),_(e),n.flowing&&!n.reading&&e.read(0)}function _(e){var n=e._readableState;if(A("flow",n.flowing),n.flowing)do var l=e.read();while(null!==l&&n.flowing)}function x(e,n){var l,t=n.buffer,r=n.length,a=!!n.decoder,u=!!n.objectMode;if(0===t.length)return null;if(0===r)l=null;else if(u)l=t.shift();else if(!e||e>=r)l=a?t.join(""):E.concat(t,r),t.length=0;else if(e<t[0].length){var o=t[0];l=o.slice(0,e),t[0]=o.slice(e)}else if(e===t[0].length)l=t.shift();else{l=a?"":new E(e);for(var s=0,i=0,c=t.length;c>i&&e>s;i++){var o=t[0],p=Math.min(e-s,o.length);a?l+=o.slice(0,p):o.copy(l,s,0,p),p<o.length?t[0]=o.slice(p):t.shift(),s+=p}}return l}function b(e){var n=e._readableState;if(n.length>0)throw new Error("endReadable called on non-empty stream");n.endEmitted||(n.ended=!0,l.nextTick(function(){n.endEmitted||0!==n.length||(n.endEmitted=!0,e.readable=!1,e.emit("end"))}))}function v(e,n){for(var l=0,t=e.length;t>l;l++)n(e[l],l)}function I(e,n){for(var l=0,t=e.length;t>l;l++)if(e[l]===n)return l;return-1}n.exports=r;var w=e("isarray"),E=e("buffer").Buffer;r.ReadableState=t;var k=e("events").EventEmitter;k.listenerCount||(k.listenerCount=function(e,n){return e.listeners(n).length});var R=e("stream"),S=e("core-util-is");S.inherits=e("inherits");var C,A=e("util");A=A&&A.debuglog?A.debuglog("stream"):function(){},S.inherits(r,R),r.prototype.push=function(e,n){var l=this._readableState;return S.isString(e)&&!l.objectMode&&(n=n||l.defaultEncoding,n!==l.encoding&&(e=new E(e,n),n="")),a(this,l,e,n,!1)},r.prototype.unshift=function(e){var n=this._readableState;return a(this,n,e,"",!0)},r.prototype.setEncoding=function(n){return C||(C=e("string_decoder/").StringDecoder),this._readableState.decoder=new C(n),this._readableState.encoding=n,this};var M=8388608;r.prototype.read=function(e){A("read",e);var n=this._readableState,l=e;if((!S.isNumber(e)||e>0)&&(n.emittedReadable=!1),0===e&&n.needReadable&&(n.length>=n.highWaterMark||n.ended))return A("read: emitReadable",n.length,n.ended),0===n.length&&n.ended?b(this):p(this),null;if(e=s(e,n),0===e&&n.ended)return 0===n.length&&b(this),null;var t=n.needReadable;A("need readable",t),(0===n.length||n.length-e<n.highWaterMark)&&(t=!0,A("length less than watermark",t)),(n.ended||n.reading)&&(t=!1,A("reading or ended",t)),t&&(A("do read"),n.reading=!0,n.sync=!0,0===n.length&&(n.needReadable=!0),this._read(n.highWaterMark),n.sync=!1),t&&!n.reading&&(e=s(l,n));var r;return r=e>0?x(e,n):null,S.isNull(r)&&(n.needReadable=!0,e=0),n.length-=e,0!==n.length||n.ended||(n.needReadable=!0),l!==e&&n.ended&&0===n.length&&b(this),S.isNull(r)||this.emit("data",r),r},r.prototype._read=function(){this.emit("error",new Error("not implemented"))},r.prototype.pipe=function(e,n){function t(e){A("onunpipe"),e===p&&a()}function r(){A("onend"),e.end()}function a(){A("cleanup"),e.removeListener("close",s),e.removeListener("finish",i),e.removeListener("drain",m),e.removeListener("error",o),e.removeListener("unpipe",t),p.removeListener("end",r),p.removeListener("end",a),p.removeListener("data",u),!d.awaitDrain||e._writableState&&!e._writableState.needDrain||m()}function u(n){A("ondata");var l=e.write(n);!1===l&&(A("false write response, pause",p._readableState.awaitDrain),p._readableState.awaitDrain++,p.pause())}function o(n){A("onerror",n),c(),e.removeListener("error",o),0===k.listenerCount(e,"error")&&e.emit("error",n)}function s(){e.removeListener("finish",i),c()}function i(){A("onfinish"),e.removeListener("close",s),c()}function c(){A("unpipe"),p.unpipe(e)}var p=this,d=this._readableState;switch(d.pipesCount){case 0:d.pipes=e;break;case 1:d.pipes=[d.pipes,e];break;default:d.pipes.push(e)}d.pipesCount+=1,A("pipe count=%d opts=%j",d.pipesCount,n);var f=(!n||n.end!==!1)&&e!==l.stdout&&e!==l.stderr,h=f?r:a;d.endEmitted?l.nextTick(h):p.once("end",h),e.on("unpipe",t);var m=g(p);return e.on("drain",m),p.on("data",u),e._events&&e._events.error?w(e._events.error)?e._events.error.unshift(o):e._events.error=[o,e._events.error]:e.on("error",o),e.once("close",s),e.once("finish",i),e.emit("pipe",p),d.flowing||(A("pipe resume"),p.resume()),e},r.prototype.unpipe=function(e){var n=this._readableState;if(0===n.pipesCount)return this;if(1===n.pipesCount)return e&&e!==n.pipes?this:(e||(e=n.pipes),n.pipes=null,n.pipesCount=0,n.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var l=n.pipes,t=n.pipesCount;n.pipes=null,n.pipesCount=0,n.flowing=!1;for(var r=0;t>r;r++)l[r].emit("unpipe",this);return this}var r=I(n.pipes,e);return-1===r?this:(n.pipes.splice(r,1),n.pipesCount-=1,1===n.pipesCount&&(n.pipes=n.pipes[0]),e.emit("unpipe",this),this)},r.prototype.on=function(e,n){var t=R.prototype.on.call(this,e,n);if("data"===e&&!1!==this._readableState.flowing&&this.resume(),"readable"===e&&this.readable){var r=this._readableState;if(!r.readableListening)if(r.readableListening=!0,r.emittedReadable=!1,r.needReadable=!0,r.reading)r.length&&p(this,r);else{var a=this;l.nextTick(function(){A("readable nexttick read 0"),a.read(0)})}}return t},r.prototype.addListener=r.prototype.on,r.prototype.resume=function(){var e=this._readableState;return e.flowing||(A("resume"),e.flowing=!0,e.reading||(A("resume read 0"),this.read(0)),m(this,e)),this},r.prototype.pause=function(){return A("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(A("pause"),this._readableState.flowing=!1,this.emit("pause")),this},r.prototype.wrap=function(e){var n=this._readableState,l=!1,t=this;e.on("end",function(){if(A("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(r){if(A("wrapped data"),n.decoder&&(r=n.decoder.write(r)),r&&(n.objectMode||r.length)){var a=t.push(r);a||(l=!0,e.pause())}});for(var r in e)S.isFunction(e[r])&&S.isUndefined(this[r])&&(this[r]=function(n){return function(){return e[n].apply(e,arguments)}}(r));var a=["error","close","destroy","pause","resume"];return v(a,function(n){e.on(n,t.emit.bind(t,n))}),t._read=function(n){A("wrapped _read",n),l&&(l=!1,e.resume())},t},r._fromList=x}).call(this,e("_process"))},{"./_stream_duplex":153,_process:151,buffer:143,"core-util-is":158,events:147,inherits:148,isarray:149,stream:163,"string_decoder/":164,util:142}],156:[function(e,n){function l(e,n){this.afterTransform=function(e,l){return t(n,e,l)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function t(e,n,l){var t=e._transformState;t.transforming=!1;var r=t.writecb;if(!r)return e.emit("error",new Error("no writecb in Transform class"));t.writechunk=null,t.writecb=null,o.isNullOrUndefined(l)||e.push(l),r&&r(n);var a=e._readableState;a.reading=!1,(a.needReadable||a.length<a.highWaterMark)&&e._read(a.highWaterMark)}function r(e){if(!(this instanceof r))return new r(e);u.call(this,e),this._transformState=new l(e,this);var n=this;this._readableState.needReadable=!0,this._readableState.sync=!1,this.once("prefinish",function(){o.isFunction(this._flush)?this._flush(function(e){a(n,e)}):a(n)})}function a(e,n){if(n)return e.emit("error",n);var l=e._writableState,t=e._transformState;if(l.length)throw new Error("calling transform done when ws.length != 0");if(t.transforming)throw new Error("calling transform done when still transforming");return e.push(null)}n.exports=r;var u=e("./_stream_duplex"),o=e("core-util-is");o.inherits=e("inherits"),o.inherits(r,u),r.prototype.push=function(e,n){return this._transformState.needTransform=!1,u.prototype.push.call(this,e,n)},r.prototype._transform=function(){throw new Error("not implemented")},r.prototype._write=function(e,n,l){var t=this._transformState;if(t.writecb=l,t.writechunk=e,t.writeencoding=n,!t.transforming){var r=this._readableState;(t.needTransform||r.needReadable||r.length<r.highWaterMark)&&this._read(r.highWaterMark)}},r.prototype._read=function(){var e=this._transformState;o.isNull(e.writechunk)||!e.writecb||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))}},{"./_stream_duplex":153,"core-util-is":158,inherits:148}],157:[function(e,n){(function(l){function t(e,n,l){this.chunk=e,this.encoding=n,this.callback=l}function r(n,l){var t=e("./_stream_duplex");n=n||{};var r=n.highWaterMark,a=n.objectMode?16:16384;this.highWaterMark=r||0===r?r:a,this.objectMode=!!n.objectMode,l instanceof t&&(this.objectMode=this.objectMode||!!n.writableObjectMode),this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var u=n.decodeStrings===!1;this.decodeStrings=!u,this.defaultEncoding=n.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){f(l,e)},this.writecb=null,this.writelen=0,this.buffer=[],this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1}function a(n){var l=e("./_stream_duplex");return this instanceof a||this instanceof l?(this._writableState=new r(n,this),this.writable=!0,void w.call(this)):new a(n)}function u(e,n,t){var r=new Error("write after end");e.emit("error",r),l.nextTick(function(){t(r)})}function o(e,n,t,r){var a=!0;if(!(I.isBuffer(t)||I.isString(t)||I.isNullOrUndefined(t)||n.objectMode)){var u=new TypeError("Invalid non-string/buffer chunk");e.emit("error",u),l.nextTick(function(){r(u)}),a=!1}return a}function s(e,n,l){return!e.objectMode&&e.decodeStrings!==!1&&I.isString(n)&&(n=new v(n,l)),n}function i(e,n,l,r,a){l=s(n,l,r),I.isBuffer(l)&&(r="buffer");var u=n.objectMode?1:l.length;n.length+=u;var o=n.length<n.highWaterMark;return o||(n.needDrain=!0),n.writing||n.corked?n.buffer.push(new t(l,r,a)):c(e,n,!1,u,l,r,a),o}function c(e,n,l,t,r,a,u){n.writelen=t,n.writecb=u,n.writing=!0,n.sync=!0,l?e._writev(r,n.onwrite):e._write(r,a,n.onwrite),n.sync=!1}function p(e,n,t,r,a){t?l.nextTick(function(){n.pendingcb--,a(r)}):(n.pendingcb--,a(r)),e._writableState.errorEmitted=!0,e.emit("error",r)}function d(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function f(e,n){var t=e._writableState,r=t.sync,a=t.writecb;if(d(t),n)p(e,t,r,n,a);else{var u=y(e,t);u||t.corked||t.bufferProcessing||!t.buffer.length||m(e,t),r?l.nextTick(function(){h(e,t,u,a)}):h(e,t,u,a)}}function h(e,n,l,t){l||g(e,n),n.pendingcb--,t(),x(e,n)}function g(e,n){0===n.length&&n.needDrain&&(n.needDrain=!1,e.emit("drain"))}function m(e,n){if(n.bufferProcessing=!0,e._writev&&n.buffer.length>1){for(var l=[],t=0;t<n.buffer.length;t++)l.push(n.buffer[t].callback);n.pendingcb++,c(e,n,!0,n.length,n.buffer,"",function(e){for(var t=0;t<l.length;t++)n.pendingcb--,l[t](e)}),n.buffer=[]}else{for(var t=0;t<n.buffer.length;t++){var r=n.buffer[t],a=r.chunk,u=r.encoding,o=r.callback,s=n.objectMode?1:a.length;if(c(e,n,!1,s,a,u,o),n.writing){t++;break}}t<n.buffer.length?n.buffer=n.buffer.slice(t):n.buffer.length=0}n.bufferProcessing=!1}function y(e,n){return n.ending&&0===n.length&&!n.finished&&!n.writing}function _(e,n){n.prefinished||(n.prefinished=!0,e.emit("prefinish"))}function x(e,n){var l=y(e,n);return l&&(0===n.pendingcb?(_(e,n),n.finished=!0,e.emit("finish")):_(e,n)),l}function b(e,n,t){n.ending=!0,x(e,n),t&&(n.finished?l.nextTick(t):e.once("finish",t)),n.ended=!0}n.exports=a;var v=e("buffer").Buffer;a.WritableState=r;var I=e("core-util-is");I.inherits=e("inherits");var w=e("stream");I.inherits(a,w),a.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))},a.prototype.write=function(e,n,l){var t=this._writableState,r=!1;return I.isFunction(n)&&(l=n,n=null),I.isBuffer(e)?n="buffer":n||(n=t.defaultEncoding),I.isFunction(l)||(l=function(){}),t.ended?u(this,t,l):o(this,t,e,l)&&(t.pendingcb++,r=i(this,t,e,n,l)),r},a.prototype.cork=function(){var e=this._writableState;e.corked++},a.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.buffer.length||m(this,e))},a.prototype._write=function(e,n,l){l(new Error("not implemented"))},a.prototype._writev=null,a.prototype.end=function(e,n,l){var t=this._writableState;I.isFunction(e)?(l=e,e=null,n=null):I.isFunction(n)&&(l=n,n=null),I.isNullOrUndefined(e)||this.write(e,n),t.corked&&(t.corked=1,this.uncork()),t.ending||t.finished||b(this,t,l)}}).call(this,e("_process"))},{"./_stream_duplex":153,_process:151,buffer:143,"core-util-is":158,inherits:148,stream:163}],158:[function(e,n,l){(function(e){function n(e){return Array.isArray(e)}function t(e){return"boolean"==typeof e}function r(e){return null===e}function a(e){return null==e}function u(e){return"number"==typeof e}function o(e){return"string"==typeof e}function s(e){return"symbol"==typeof e}function i(e){return void 0===e}function c(e){return p(e)&&"[object RegExp]"===y(e)}function p(e){return"object"==typeof e&&null!==e}function d(e){return p(e)&&"[object Date]"===y(e)}function f(e){return p(e)&&("[object Error]"===y(e)||e instanceof Error)}function h(e){return"function"==typeof e}function g(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function m(n){return e.isBuffer(n)}function y(e){return Object.prototype.toString.call(e)}l.isArray=n,l.isBoolean=t,l.isNull=r,l.isNullOrUndefined=a,l.isNumber=u,l.isString=o,l.isSymbol=s,l.isUndefined=i,l.isRegExp=c,l.isObject=p,l.isDate=d,l.isError=f,l.isFunction=h,l.isPrimitive=g,l.isBuffer=m}).call(this,e("buffer").Buffer)},{buffer:143}],159:[function(e,n){n.exports=e("./lib/_stream_passthrough.js")},{"./lib/_stream_passthrough.js":154}],160:[function(e,n,l){l=n.exports=e("./lib/_stream_readable.js"),l.Stream=e("stream"),l.Readable=l,l.Writable=e("./lib/_stream_writable.js"),l.Duplex=e("./lib/_stream_duplex.js"),l.Transform=e("./lib/_stream_transform.js"),l.PassThrough=e("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":153,"./lib/_stream_passthrough.js":154,"./lib/_stream_readable.js":155,"./lib/_stream_transform.js":156,"./lib/_stream_writable.js":157,stream:163}],161:[function(e,n){n.exports=e("./lib/_stream_transform.js")},{"./lib/_stream_transform.js":156}],162:[function(e,n){n.exports=e("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":157}],163:[function(e,n){function l(){t.call(this)}n.exports=l;var t=e("events").EventEmitter,r=e("inherits");r(l,t),l.Readable=e("readable-stream/readable.js"),l.Writable=e("readable-stream/writable.js"),l.Duplex=e("readable-stream/duplex.js"),l.Transform=e("readable-stream/transform.js"),l.PassThrough=e("readable-stream/passthrough.js"),l.Stream=l,l.prototype.pipe=function(e,n){function l(n){e.writable&&!1===e.write(n)&&i.pause&&i.pause()}function r(){i.readable&&i.resume&&i.resume()}function a(){c||(c=!0,e.end())}function u(){c||(c=!0,"function"==typeof e.destroy&&e.destroy())}function o(e){if(s(),0===t.listenerCount(this,"error"))throw e}function s(){i.removeListener("data",l),e.removeListener("drain",r),i.removeListener("end",a),i.removeListener("close",u),i.removeListener("error",o),e.removeListener("error",o),i.removeListener("end",s),i.removeListener("close",s),e.removeListener("close",s)}var i=this;i.on("data",l),e.on("drain",r),e._isStdio||n&&n.end===!1||(i.on("end",a),i.on("close",u));var c=!1;return i.on("error",o),e.on("error",o),i.on("end",s),i.on("close",s),e.on("close",s),e.emit("pipe",i),e}},{events:147,inherits:148,"readable-stream/duplex.js":152,"readable-stream/passthrough.js":159,"readable-stream/readable.js":160,"readable-stream/transform.js":161,"readable-stream/writable.js":162}],164:[function(e,n,l){function t(e){if(e&&!s(e))throw new Error("Unknown encoding: "+e)}function r(e){return e.toString(this.encoding)}function a(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function u(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}var o=e("buffer").Buffer,s=o.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},i=l.StringDecoder=function(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),t(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=a;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=u;break;default:return void(this.write=r)}this.charBuffer=new o(6),this.charReceived=0,this.charLength=0};i.prototype.write=function(e){for(var n="";this.charLength;){var l=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,l),this.charReceived+=l,this.charReceived<this.charLength)return"";e=e.slice(l,e.length),n=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var t=n.charCodeAt(n.length-1);if(!(t>=55296&&56319>=t)){if(this.charReceived=this.charLength=0,0===e.length)return n;break}this.charLength+=this.surrogateSize,n=""}this.detectIncompleteChar(e);var r=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,r),r-=this.charReceived),n+=e.toString(this.encoding,0,r);var r=n.length-1,t=n.charCodeAt(r);if(t>=55296&&56319>=t){var a=this.surrogateSize;return this.charLength+=a,this.charReceived+=a,this.charBuffer.copy(this.charBuffer,a,0,a),e.copy(this.charBuffer,0,0,a),n.substring(0,r)}return n},i.prototype.detectIncompleteChar=function(e){for(var n=e.length>=3?3:e.length;n>0;n--){var l=e[e.length-n];if(1==n&&l>>5==6){this.charLength=2;break}if(2>=n&&l>>4==14){this.charLength=3;break}if(3>=n&&l>>3==30){this.charLength=4;break}}this.charReceived=n},i.prototype.end=function(e){var n="";if(e&&e.length&&(n=this.write(e)),this.charReceived){var l=this.charReceived,t=this.charBuffer,r=this.encoding;n+=t.slice(0,l).toString(r)}return n}},{buffer:143}],165:[function(e,n,l){function t(){throw new Error("tty.ReadStream is not implemented")}function r(){throw new Error("tty.ReadStream is not implemented")}l.isatty=function(){return!1},l.ReadStream=t,l.WriteStream=r},{}],166:[function(e,n){n.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],167:[function(e,n,l){(function(n,t){function r(e,n){var t={seen:[],stylize:u};return arguments.length>=3&&(t.depth=arguments[2]),arguments.length>=4&&(t.colors=arguments[3]),g(n)?t.showHidden=n:n&&l._extend(t,n),v(t.showHidden)&&(t.showHidden=!1),v(t.depth)&&(t.depth=2),v(t.colors)&&(t.colors=!1),v(t.customInspect)&&(t.customInspect=!0),t.colors&&(t.stylize=a),s(t,e,t.depth)}function a(e,n){var l=r.styles[n];return l?"["+r.colors[l][0]+"m"+e+"["+r.colors[l][1]+"m":e}function u(e){return e}function o(e){var n={};return e.forEach(function(e){n[e]=!0}),n}function s(e,n,t){if(e.customInspect&&n&&R(n.inspect)&&n.inspect!==l.inspect&&(!n.constructor||n.constructor.prototype!==n)){var r=n.inspect(t,e);return x(r)||(r=s(e,r,t)),r}var a=i(e,n);if(a)return a;var u=Object.keys(n),g=o(u);if(e.showHidden&&(u=Object.getOwnPropertyNames(n)),k(n)&&(u.indexOf("message")>=0||u.indexOf("description")>=0))return c(n);if(0===u.length){if(R(n)){var m=n.name?": "+n.name:"";return e.stylize("[Function"+m+"]","special")}if(I(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(E(n))return e.stylize(Date.prototype.toString.call(n),"date");if(k(n))return c(n)}var y="",_=!1,b=["{","}"];if(h(n)&&(_=!0,b=["[","]"]),R(n)){var v=n.name?": "+n.name:"";y=" [Function"+v+"]"}if(I(n)&&(y=" "+RegExp.prototype.toString.call(n)),E(n)&&(y=" "+Date.prototype.toUTCString.call(n)),k(n)&&(y=" "+c(n)),0===u.length&&(!_||0==n.length))return b[0]+y+b[1];if(0>t)return I(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special");e.seen.push(n);var w;return w=_?p(e,n,t,g,u):u.map(function(l){return d(e,n,t,g,l,_)}),e.seen.pop(),f(w,y,b)}function i(e,n){if(v(n))return e.stylize("undefined","undefined");if(x(n)){var l="'"+JSON.stringify(n).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(l,"string")}return _(n)?e.stylize(""+n,"number"):g(n)?e.stylize(""+n,"boolean"):m(n)?e.stylize("null","null"):void 0}function c(e){return"["+Error.prototype.toString.call(e)+"]"}function p(e,n,l,t,r){for(var a=[],u=0,o=n.length;o>u;++u)a.push(j(n,String(u))?d(e,n,l,t,String(u),!0):"");return r.forEach(function(r){r.match(/^\d+$/)||a.push(d(e,n,l,t,r,!0))}),a}function d(e,n,l,t,r,a){var u,o,i;if(i=Object.getOwnPropertyDescriptor(n,r)||{value:n[r]},i.get?o=i.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):i.set&&(o=e.stylize("[Setter]","special")),j(t,r)||(u="["+r+"]"),o||(e.seen.indexOf(i.value)<0?(o=m(l)?s(e,i.value,null):s(e,i.value,l-1),o.indexOf("\n")>-1&&(o=a?o.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+o.split("\n").map(function(e){return" "+e}).join("\n"))):o=e.stylize("[Circular]","special")),v(u)){if(a&&r.match(/^\d+$/))return o;u=JSON.stringify(""+r),u.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(u=u.substr(1,u.length-2),u=e.stylize(u,"name")):(u=u.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),u=e.stylize(u,"string"))}return u+": "+o}function f(e,n,l){var t=0,r=e.reduce(function(e,n){return t++,n.indexOf("\n")>=0&&t++,e+n.replace(/\u001b\[\d\d?m/g,"").length+1},0);return r>60?l[0]+(""===n?"":n+"\n ")+" "+e.join(",\n ")+" "+l[1]:l[0]+n+" "+e.join(", ")+" "+l[1]}function h(e){return Array.isArray(e)}function g(e){return"boolean"==typeof e}function m(e){return null===e}function y(e){return null==e}function _(e){return"number"==typeof e}function x(e){return"string"==typeof e}function b(e){return"symbol"==typeof e}function v(e){return void 0===e}function I(e){return w(e)&&"[object RegExp]"===C(e)}function w(e){return"object"==typeof e&&null!==e}function E(e){return w(e)&&"[object Date]"===C(e)}function k(e){return w(e)&&("[object Error]"===C(e)||e instanceof Error)}function R(e){return"function"==typeof e}function S(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function C(e){return Object.prototype.toString.call(e)}function A(e){return 10>e?"0"+e.toString(10):e.toString(10)}function M(){var e=new Date,n=[A(e.getHours()),A(e.getMinutes()),A(e.getSeconds())].join(":");return[e.getDate(),O[e.getMonth()],n].join(" ")}function j(e,n){return Object.prototype.hasOwnProperty.call(e,n)}var T=/%[sdj%]/g;l.format=function(e){if(!x(e)){for(var n=[],l=0;l<arguments.length;l++)n.push(r(arguments[l]));return n.join(" ")}for(var l=1,t=arguments,a=t.length,u=String(e).replace(T,function(e){if("%%"===e)return"%";if(l>=a)return e;switch(e){case"%s":return String(t[l++]);case"%d":return Number(t[l++]);case"%j":try{return JSON.stringify(t[l++])}catch(n){return"[Circular]"}default:return e}}),o=t[l];a>l;o=t[++l])u+=m(o)||!w(o)?" "+o:" "+r(o);return u},l.deprecate=function(e,r){function a(){if(!u){if(n.throwDeprecation)throw new Error(r);n.traceDeprecation?console.trace(r):console.error(r),u=!0}return e.apply(this,arguments)}if(v(t.process))return function(){return l.deprecate(e,r).apply(this,arguments)};if(n.noDeprecation===!0)return e;var u=!1;return a};var P,L={};l.debuglog=function(e){if(v(P)&&(P=n.env.NODE_DEBUG||""),e=e.toUpperCase(),!L[e])if(new RegExp("\\b"+e+"\\b","i").test(P)){var t=n.pid;L[e]=function(){var n=l.format.apply(l,arguments);console.error("%s %d: %s",e,t,n)}}else L[e]=function(){};return L[e]},l.inspect=r,r.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},r.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},l.isArray=h,l.isBoolean=g,l.isNull=m,l.isNullOrUndefined=y,l.isNumber=_,l.isString=x,l.isSymbol=b,l.isUndefined=v,l.isRegExp=I,l.isObject=w,l.isDate=E,l.isError=k,l.isFunction=R,l.isPrimitive=S,l.isBuffer=e("./support/isBuffer");var O=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];l.log=function(){console.log("%s - %s",M(),l.format.apply(l,arguments))},l.inherits=e("inherits"),l._extend=function(e,n){if(!n||!w(n))return e;for(var l=Object.keys(n),t=l.length;t--;)e[l[t]]=n[l[t]];return e}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":166,_process:151,inherits:148}],168:[function(e,n){(function(l){"use strict";function t(e){this.enabled=e&&void 0!==e.enabled?e.enabled:p}function r(e){var n=function l(){return a.apply(l,arguments)};return n._styles=e,n.enabled=this.enabled,n.__proto__=h,n}function a(){var e=arguments,n=e.length,l=0!==n&&String(arguments[0]);if(n>1)for(var t=1;n>t;t++)l+=" "+e[t];if(!this.enabled||!l)return l;for(var r=this._styles,a=r.length;a--;){var u=s[r[a]];l=u.open+l.replace(u.closeRe,u.open)+u.close}return l}function u(){var e={};return Object.keys(f).forEach(function(n){e[n]={get:function(){return r.call(this,[n])}}}),e}var o=e("escape-string-regexp"),s=e("ansi-styles"),i=e("strip-ansi"),c=e("has-ansi"),p=e("supports-color"),d=Object.defineProperties;"win32"===l.platform&&(s.blue.open="");var f=function(){var e={};return Object.keys(s).forEach(function(n){s[n].closeRe=new RegExp(o(s[n].close),"g"),e[n]={get:function(){return r.call(this,this._styles.concat(n))}}}),e}(),h=d(function(){},f);d(t.prototype,u()),n.exports=new t,n.exports.styles=s,n.exports.hasColor=c,n.exports.stripColor=i,n.exports.supportsColor=p}).call(this,e("_process"))},{_process:151,"ansi-styles":169,"escape-string-regexp":170,"has-ansi":171,"strip-ansi":173,"supports-color":175}],169:[function(e,n){"use strict";var l=n.exports={modifiers:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},colors:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39]},bgColors:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49]}};l.colors.grey=l.colors.gray,Object.keys(l).forEach(function(e){var n=l[e];Object.keys(n).forEach(function(e){var t=n[e];l[e]=n[e]={open:"["+t[0]+"m",close:"["+t[1]+"m"}}),Object.defineProperty(l,e,{value:n,enumerable:!1})})},{}],170:[function(e,n){"use strict";var l=/[|\\{}()[\]^$+*?.]/g;n.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected a string"); return e.replace(l,"\\$&")}},{}],171:[function(e,n){"use strict";var l=e("ansi-regex"),t=new RegExp(l().source);n.exports=t.test.bind(t)},{"ansi-regex":172}],172:[function(e,n){"use strict";n.exports=function(){return/(?:(?:\u001b\[)|\u009b)(?:(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-M|f-m])|\u001b[A-M]/g}},{}],173:[function(e,n){"use strict";var l=e("ansi-regex")();n.exports=function(e){return"string"==typeof e?e.replace(l,""):e}},{"ansi-regex":174}],174:[function(e,n,l){arguments[4][172][0].apply(l,arguments)},{dup:172}],175:[function(e,n){(function(e){"use strict";var l=e.argv;n.exports=function(){return"FORCE_COLOR"in e.env?!0:-1!==l.indexOf("--no-color")||-1!==l.indexOf("--no-colors")||-1!==l.indexOf("--color=false")?!1:-1!==l.indexOf("--color")||-1!==l.indexOf("--colors")||-1!==l.indexOf("--color=true")||-1!==l.indexOf("--color=always")?!0:e.stdout&&!e.stdout.isTTY?!1:"UPSTART_JOB"in e.env?!1:"win32"===e.platform?!0:"COLORTERM"in e.env?!0:"dumb"===e.env.TERM?!1:/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(e.env.TERM)?!0:!1}()}).call(this,e("_process"))},{_process:151}],176:[function(e,n,l){(function(n){"use strict";function t(e){return new n(e,"base64").toString()}function r(e){return e.split(",").pop()}function a(e,n){var l=c.exec(e);c.lastIndex=0;var t=l[1]||l[2],r=s.join(n,t);try{return o.readFileSync(r,"utf8")}catch(a){throw new Error("An error occurred while trying to read the map file at "+r+"\n"+a)}}function u(e,n){n=n||{};try{n.isFileComment&&(e=a(e,n.commentFileDir)),n.hasComment&&(e=r(e)),n.isEncoded&&(e=t(e)),(n.isJSON||n.isEncoded)&&(e=JSON.parse(e)),this.sourcemap=e}catch(l){return console.error(l),null}}var o=e("fs"),s=e("path"),i=/^\s*\/(?:\/|\*)[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset:\S+;)?base64,(.*)$/gm,c=/(?:\/\/[@#][ \t]+sourceMappingURL=(.+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/){1}[ \t]*$)/gm;u.prototype.toJSON=function(e){return JSON.stringify(this.sourcemap,null,e)},u.prototype.toBase64=function(){var e=this.toJSON();return new n(e).toString("base64")},u.prototype.toComment=function(){var e=this.toBase64();return"//# sourceMappingURL=data:application/json;base64,"+e},u.prototype.toObject=function(){return JSON.parse(this.toJSON())},u.prototype.addProperty=function(e,n){if(this.sourcemap.hasOwnProperty(e))throw new Error("property %s already exists on the sourcemap, use set property instead");return this.setProperty(e,n)},u.prototype.setProperty=function(e,n){return this.sourcemap[e]=n,this},u.prototype.getProperty=function(e){return this.sourcemap[e]},l.fromObject=function(e){return new u(e)},l.fromJSON=function(e){return new u(e,{isJSON:!0})},l.fromBase64=function(e){return new u(e,{isEncoded:!0})},l.fromComment=function(e){return e=e.replace(/^\/\*/g,"//").replace(/\*\/$/g,""),new u(e,{isEncoded:!0,hasComment:!0})},l.fromMapFileComment=function(e,n){return new u(e,{commentFileDir:n,isFileComment:!0,isJSON:!0})},l.fromSource=function(e){var n=e.match(i);return i.lastIndex=0,n?l.fromComment(n.pop()):null},l.fromMapFileSource=function(e,n){var t=e.match(c);return c.lastIndex=0,t?l.fromMapFileComment(t.pop(),n):null},l.removeComments=function(e){return i.lastIndex=0,e.replace(i,"")},l.removeMapFileComments=function(e){return c.lastIndex=0,e.replace(c,"")},l.__defineGetter__("commentRegex",function(){return i.lastIndex=0,i}),l.__defineGetter__("mapFileCommentRegex",function(){return c.lastIndex=0,c})}).call(this,e("buffer").Buffer)},{buffer:143,fs:140,path:150}],177:[function(e,n){!function(e,l,t){"use strict";function r(e){return null!==e&&("object"==typeof e||"function"==typeof e)}function a(e){return"function"==typeof e}function u(e,n,l){e&&!xl(e=l?e:e[bn],Ul)&&Dl(e,Ul,n)}function o(e){return ol.call(e).slice(8,-1)}function s(e){var n,l;return e==t?e===t?"Undefined":"Null":"string"==typeof(l=(n=Tn(e))[Ul])?l:o(n)}function i(){for(var e=j(this),n=arguments.length,l=Pn(n),t=0,r=Wl._,a=!1;n>t;)(l[t]=arguments[t++])===r&&(a=!0);return function(){var t,u=this,o=arguments.length,s=0,i=0;if(!a&&!o)return p(e,l,u);if(t=l.slice(),a)for(;n>s;s++)t[s]===r&&(t[s]=arguments[i++]);for(;o>i;)t.push(arguments[i++]);return p(e,t,u)}}function c(e,n,l){if(j(e),~l&&n===t)return e;switch(l){case 1:return function(l){return e.call(n,l)};case 2:return function(l,t){return e.call(n,l,t)};case 3:return function(l,t,r){return e.call(n,l,t,r)}}return function(){return e.apply(n,arguments)}}function p(e,n,l){var r=l===t;switch(0|n.length){case 0:return r?e():e.call(l);case 1:return r?e(n[0]):e.call(l,n[0]);case 2:return r?e(n[0],n[1]):e.call(l,n[0],n[1]);case 3:return r?e(n[0],n[1],n[2]):e.call(l,n[0],n[1],n[2]);case 4:return r?e(n[0],n[1],n[2],n[3]):e.call(l,n[0],n[1],n[2],n[3]);case 5:return r?e(n[0],n[1],n[2],n[3],n[4]):e.call(l,n[0],n[1],n[2],n[3],n[4])}return e.apply(l,n)}function d(e){return bl(M(e))}function f(e){return e}function h(){return this}function g(e,n){return xl(e,n)?e[n]:void 0}function m(e){return T(e),yl?ml(e).concat(yl(e)):ml(e)}function y(e,n){for(var l,t=d(e),r=gl(t),a=r.length,u=0;a>u;)if(t[l=r[u++]]===n)return l}function _(e){return Ln(e).split(",")}function x(e){var n=1==e,l=2==e,r=3==e,a=4==e,u=6==e,o=5==e||u;return function(s){for(var i,p,d=Tn(M(this)),f=arguments[1],h=bl(d),g=c(s,f,3),m=E(h.length),y=0,_=n?Pn(m):l?[]:t;m>y;y++)if((o||y in h)&&(i=h[y],p=g(i,y,d),e))if(n)_[y]=p;else if(p)switch(e){case 3:return!0;case 5:return i;case 6:return y;case 2:_.push(i)}else if(a)return!1;return u?-1:r||a?a:_}}function b(e){return function(n){var l=d(this),t=E(l.length),r=k(arguments[1],t);if(e&&n!=n){for(;t>r;r++)if(I(l[r]))return e||r}else for(;t>r;r++)if((e||r in l)&&l[r]===n)return e||r;return!e&&-1}}function v(e,n){return"function"==typeof e?e:n}function I(e){return e!=e}function w(e){return isNaN(e)?0:Tl(e)}function E(e){return e>0?Ml(w(e),El):0}function k(e,n){var e=w(e);return 0>e?Al(e+n,0):Ml(e,n)}function R(e){return e>9?e:"0"+e}function S(e,n,l){var t=r(n)?function(e){return n[e]}:n;return function(n){return Ln(l?n:this).replace(e,t)}}function C(e){return function(n){var l,r,a=Ln(M(this)),u=w(n),o=a.length;return 0>u||u>=o?e?"":t:(l=a.charCodeAt(u),55296>l||l>56319||u+1===o||(r=a.charCodeAt(u+1))<56320||r>57343?e?a.charAt(u):l:e?a.slice(u,u+2):(l-55296<<10)+(r-56320)+65536)}}function A(e,n,l){if(!e)throw qn(l?n+l:n)}function M(e){if(e==t)throw qn("Function called on null or undefined");return e}function j(e){return A(a(e),e," is not a function!"),e}function T(e){return A(r(e),e," is not an object!"),e}function P(e,n,l){A(e instanceof n,l,": use the 'new' operator!")}function L(e,n){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:n}}function O(e,n,l){return e[n]=l,e}function D(e){return Ll?function(n,l,t){return fl(n,l,L(e,t))}:O}function F(e){return mn+"("+e+")_"+(++Ol+jl())[In](36)}function B(e,n){return Vn&&Vn[e]||(n?Vn:Bl)(mn+al+e)}function N(e,n){for(var l in n)Dl(e,l,n[l]);return e}function V(e){!Ll||!l&&ul(e)||fl(e,ql,{configurable:!0,get:h})}function U(n,t,r){var u,o,s,i,p=n&Xl,d=p?e:n&zl?e[t]:(e[t]||ll)[bn],f=p?Hl:Hl[t]||(Hl[t]={});p&&(r=t);for(u in r)o=!(n&Yl)&&d&&u in d&&(!a(d[u])||ul(d[u])),s=(o?d:r)[u],l||!p||a(d[u])?n&$l&&o?i=c(s,e):n&Ql&&!l&&d[u]==s?(i=function(e){return this instanceof s?new s(e):s(e)},i[bn]=s[bn]):i=n&Kl&&a(s)?c(sl,s):s:i=r[u],l&&d&&!o&&(p?d[u]=s:delete d[u]&&Dl(d,u,s)),f[u]!=s&&Dl(f,u,i)}function q(e,n){Dl(e,ln,n),Cn in nl&&Dl(e,Cn,n)}function G(e,n,l,t){e[bn]=cl(t||tt,{next:L(1,l)}),u(e,n+" Iterator")}function H(e,n,t,r){var a=e[bn],o=g(a,ln)||g(a,Cn)||r&&g(a,r)||t;if(l&&(q(a,o),o!==t)){var s=pl(o.call(new e));u(s,n+" Iterator",!0),xl(a,Cn)&&q(s,h)}return lt[n]=o,lt[n+" Iterator"]=h,o}function W(e,n,l,t,r,a){function u(e){return function(){return new l(this,e)}}G(l,n,t);var o=u(et+nt),s=u(nt);r==nt?s=H(e,n,s,"values"):o=H(e,n,o,"entries"),r&&U(Kl+Yl*rt,n,{entries:o,keys:a?s:u(et),values:s})}function J(e,n){return{value:n,done:!!e}}function Y(n){var l=Tn(n),t=e[mn],r=(t&&t[Sn]||Cn)in l;return r||ln in l||xl(lt,s(l))}function X(n){var l=e[mn],t=n[l&&l[Sn]||Cn],r=t||n[ln]||lt[s(n)];return T(r.call(n))}function z(e,n,l){return l?p(e,n):e(n)}function K(e){var n=!0,l={next:function(){throw 1},"return":function(){n=!1}};l[ln]=h;try{e(l)}catch(t){}return n}function $(e){var n=e["return"];n!==t&&n.call(e)}function Q(e,n){try{e(n)}catch(l){throw $(n),l}}function Z(e,n,l,t){Q(function(e){for(var r,a=c(l,t,n?2:1);!(r=e.next()).done;)if(z(a,r.value,n)===!1)return $(e)},X(e))}var en,nn,ln,tn,rn="Object",an="Function",un="Array",on="String",sn="Number",cn="RegExp",pn="Date",dn="Map",fn="Set",hn="WeakMap",gn="WeakSet",mn="Symbol",yn="Promise",_n="Math",xn="Arguments",bn="prototype",vn="constructor",In="toString",wn=In+"Tag",En="toLocaleString",kn="hasOwnProperty",Rn="forEach",Sn="iterator",Cn="@@"+Sn,An="process",Mn="createElement",jn=e[an],Tn=e[rn],Pn=e[un],Ln=e[on],On=e[sn],Dn=(e[cn],e[pn],e[dn]),Fn=e[fn],Bn=e[hn],Nn=e[gn],Vn=e[mn],Un=e[_n],qn=e.TypeError,Gn=e.RangeError,Hn=e.setTimeout,Wn=e.setImmediate,Jn=e.clearImmediate,Yn=e.parseInt,Xn=e.isFinite,zn=e[An],Kn=zn&&zn.nextTick,$n=e.document,Qn=$n&&$n.documentElement,Zn=(e.navigator,e.define),el=e.console||{},nl=Pn[bn],ll=Tn[bn],tl=jn[bn],rl=1/0,al=".",ul=c(/./.test,/\[native code\]\s*\}\s*$/,1),ol=ll[In],sl=tl.call,il=tl.apply,cl=Tn.create,pl=Tn.getPrototypeOf,dl=Tn.setPrototypeOf,fl=Tn.defineProperty,hl=(Tn.defineProperties,Tn.getOwnPropertyDescriptor),gl=Tn.keys,ml=Tn.getOwnPropertyNames,yl=Tn.getOwnPropertySymbols,_l=Tn.isFrozen,xl=c(sl,ll[kn],2),bl=Tn,vl=Tn.assign||function(e){for(var n=Tn(M(e)),l=arguments.length,t=1;l>t;)for(var r,a=bl(arguments[t++]),u=gl(a),o=u.length,s=0;o>s;)n[r=u[s++]]=a[r];return n},Il=nl.push,wl=(nl.unshift,nl.slice,nl.splice,nl.indexOf,nl[Rn]),El=9007199254740991,kl=Un.pow,Rl=Un.abs,Sl=Un.ceil,Cl=Un.floor,Al=Un.max,Ml=Un.min,jl=Un.random,Tl=Un.trunc||function(e){return(e>0?Cl:Sl)(e)},Pl="Reduce of empty object with no initial value",Ll=!!function(){try{return 2==fl({},"a",{get:function(){return 2}}).a}catch(e){}}(),Ol=0,Dl=D(1),Fl=Vn?O:Dl,Bl=Vn||F,Nl=B("unscopables"),Vl=nl[Nl]||{},Ul=B(wn),ql=B("species"),Gl=o(zn)==An,Hl={},Wl=l?e:Hl,Jl=e.core,Yl=1,Xl=2,zl=4,Kl=8,$l=16,Ql=32;"undefined"!=typeof n&&n.exports?n.exports=Hl:a(Zn)&&Zn.amd?Zn(function(){return Hl}):tn=!0,(tn||l)&&(Hl.noConflict=function(){return e.core=Jl,Hl},e.core=Hl),ln=B(Sn);var Zl=Bl("iter"),et=1,nt=2,lt={},tt={},rt="keys"in nl&&!("next"in[].keys());q(tt,h),!function(n,l,t,r){ul(Vn)||(Vn=function(e){A(!(this instanceof Vn),mn+" is not a "+vn);var l=F(e),a=Fl(cl(Vn[bn]),n,l);return t[l]=a,Ll&&r&&fl(ll,l,{configurable:!0,set:function(e){Dl(this,l,e)}}),a},Dl(Vn[bn],In,function(){return this[n]})),U(Xl+Ql,{Symbol:Vn});var a={"for":function(e){return xl(l,e+="")?l[e]:l[e]=Vn(e)},iterator:ln||B(Sn),keyFor:i.call(y,l),species:ql,toStringTag:Ul=B(wn,!0),unscopables:Nl,pure:Bl,set:Fl,useSetter:function(){r=!0},useSimple:function(){r=!1}};wl.call(_("hasInstance,isConcatSpreadable,match,replace,search,split,toPrimitive"),function(e){a[e]=B(e)}),U(zl,mn,a),u(Vn,mn),U(zl+Yl*!ul(Vn),rn,{getOwnPropertyNames:function(e){for(var n,l=ml(d(e)),r=[],a=0;l.length>a;)xl(t,n=l[a++])||r.push(n);return r},getOwnPropertySymbols:function(e){for(var n,l=ml(d(e)),r=[],a=0;l.length>a;)xl(t,n=l[a++])&&r.push(t[n]);return r}}),u(Un,_n,!0),u(e.JSON,"JSON",!0)}(Bl("tag"),{},{},!0),!function(){var e={assign:vl,is:function(e,n){return e===n?0!==e||1/e===1/n:e!=e&&n!=n}};"__proto__"in ll&&function(n,l){try{l=c(sl,hl(ll,"__proto__").set,2),l({},nl)}catch(t){n=!0}e.setPrototypeOf=dl=dl||function(e,t){return T(e),A(null===t||r(t),t,": can't set as prototype!"),n?e.__proto__=t:l(e,t),e}}(),U(zl,rn,e)}(),!function(){function e(e,n){var l=Tn[e],t=Hl[rn][e],a=0,u={};if(!t||ul(t)){u[e]=1==n?function(e){return r(e)?l(e):e}:2==n?function(e){return r(e)?l(e):!0}:3==n?function(e){return r(e)?l(e):!1}:4==n?function(e,n){return l(d(e),n)}:function(e){return l(d(e))};try{l(al)}catch(o){a=1}U(zl+Yl*a,rn,u)}}e("freeze",1),e("seal",1),e("preventExtensions",1),e("isFrozen",2),e("isSealed",2),e("isExtensible",3),e("getOwnPropertyDescriptor",4),e("getPrototypeOf"),e("keys"),e("getOwnPropertyNames")}(),!function(e){U(zl,sn,{EPSILON:kl(2,-52),isFinite:function(e){return"number"==typeof e&&Xn(e)},isInteger:e,isNaN:I,isSafeInteger:function(n){return e(n)&&Rl(n)<=El},MAX_SAFE_INTEGER:El,MIN_SAFE_INTEGER:-El,parseFloat:parseFloat,parseInt:Yn})}(On.isInteger||function(e){return!r(e)&&Xn(e)&&Cl(e)===e}),!function(){function e(n){return Xn(n=+n)&&0!=n?0>n?-e(-n):r(n+a(n*n+1)):n}function n(e){return 0==(e=+e)?e:e>-1e-6&&1e-6>e?e+e*e/2:t(e)-1}var l=Un.E,t=Un.exp,r=Un.log,a=Un.sqrt,u=Un.sign||function(e){return 0==(e=+e)||e!=e?e:0>e?-1:1};U(zl,_n,{acosh:function(e){return(e=+e)<1?0/0:Xn(e)?r(e/l+a(e+1)*a(e-1)/l)+1:e},asinh:e,atanh:function(e){return 0==(e=+e)?e:r((1+e)/(1-e))/2},cbrt:function(e){return u(e=+e)*kl(Rl(e),1/3)},clz32:function(e){return(e>>>=0)?32-e[In](2).length:32},cosh:function(e){return(t(e=+e)+t(-e))/2},expm1:n,fround:function(e){return new Float32Array([e])[0]},hypot:function(){for(var e,n=0,l=arguments.length,t=l,r=Pn(l),u=-rl;l--;){if(e=r[l]=+arguments[l],e==rl||e==-rl)return rl;e>u&&(u=e)}for(u=e||1;t--;)n+=kl(r[t]/u,2);return u*a(n)},imul:function(e,n){var l=65535,t=+e,r=+n,a=l&t,u=l&r;return 0|a*u+((l&t>>>16)*u+a*(l&r>>>16)<<16>>>0)},log1p:function(e){return(e=+e)>-1e-8&&1e-8>e?e-e*e/2:r(1+e)},log10:function(e){return r(e)/Un.LN10},log2:function(e){return r(e)/Un.LN2},sign:u,sinh:function(e){return Rl(e=+e)<1?(n(e)-n(-e))/2:(t(e-1)-t(-e-1))*(l/2)},tanh:function(e){var l=n(e=+e),r=n(-e);return l==rl?1:r==rl?-1:(l-r)/(t(e)+t(-e))},trunc:Tl})}(),!function(e){function n(e){if(o(e)==cn)throw qn()}U(zl,on,{fromCodePoint:function(){for(var n,l=[],t=arguments.length,r=0;t>r;){if(n=+arguments[r++],k(n,1114111)!==n)throw Gn(n+" is not a valid code point");l.push(65536>n?e(n):e(((n-=65536)>>10)+55296,n%1024+56320))}return l.join("")},raw:function(e){for(var n=d(e.raw),l=E(n.length),t=arguments.length,r=[],a=0;l>a;)r.push(Ln(n[a++])),t>a&&r.push(Ln(arguments[a]));return r.join("")}}),U(Kl,on,{codePointAt:C(!1),endsWith:function(e){n(e);var l=Ln(M(this)),r=arguments[1],a=E(l.length),u=r===t?a:Ml(E(r),a);return e+="",l.slice(u-e.length,u)===e},includes:function(e){return n(e),!!~Ln(M(this)).indexOf(e,arguments[1])},repeat:function(e){var n=Ln(M(this)),l="",t=w(e);if(0>t||t==rl)throw Gn("Count can't be negative");for(;t>0;(t>>>=1)&&(n+=n))1&t&&(l+=n);return l},startsWith:function(e){n(e);var l=Ln(M(this)),t=E(Ml(arguments[1],l.length));return e+="",l.slice(t,t+e.length)===e}})}(Ln.fromCharCode),!function(){U(zl+Yl*K(Pn.from),un,{from:function(e){var n,l,r,a=Tn(M(e)),u=arguments[1],o=u!==t,s=o?c(u,arguments[2],2):t,i=0;if(Y(a))l=new(v(this,Pn)),Q(function(e){for(;!(r=e.next()).done;i++)l[i]=o?s(r.value,i):r.value},X(a));else for(l=new(v(this,Pn))(n=E(a.length));n>i;i++)l[i]=o?s(a[i],i):a[i];return l.length=i,l}}),U(zl,un,{of:function(){for(var e=0,n=arguments.length,l=new(v(this,Pn))(n);n>e;)l[e]=arguments[e++];return l.length=n,l}}),V(Pn)}(),!function(){U(Kl,un,{copyWithin:function(e,n){var l=Tn(M(this)),r=E(l.length),a=k(e,r),u=k(n,r),o=arguments[2],s=o===t?r:k(o,r),i=Ml(s-u,r-a),c=1;for(a>u&&u+i>a&&(c=-1,u=u+i-1,a=a+i-1);i-->0;)u in l?l[a]=l[u]:delete l[a],a+=c,u+=c;return l},fill:function(e){for(var n=Tn(M(this)),l=E(n.length),r=k(arguments[1],l),a=arguments[2],u=a===t?l:k(a,l);u>r;)n[r++]=e;return n},find:x(5),findIndex:x(6)}),l&&(wl.call(_("find,findIndex,fill,copyWithin,entries,keys,values"),function(e){Vl[e]=!0}),Nl in nl||Dl(nl,Nl,Vl))}(),!function(e){W(Pn,un,function(e,n){Fl(this,Zl,{o:d(e),i:0,k:n})},function(){var e=this[Zl],n=e.o,l=e.k,r=e.i++;return!n||r>=n.length?(e.o=t,J(1)):l==et?J(0,r):l==nt?J(0,n[r]):J(0,[r,n[r]])},nt),lt[xn]=lt[un],W(Ln,on,function(e){Fl(this,Zl,{o:Ln(e),i:0})},function(){var n,l=this[Zl],t=l.o,r=l.i;return r>=t.length?J(1):(n=e.call(t,r),l.i+=n.length,J(0,n))})}(C(!0)),a(Wn)&&a(Jn)||function(n){function l(e){if(xl(g,e)){var n=g[e];delete g[e],n()}}function t(e){l(e.data)}var r,u,o,s=e.postMessage,d=e.addEventListener,f=e.MessageChannel,h=0,g={};Wn=function(e){for(var n=[],l=1;arguments.length>l;)n.push(arguments[l++]);return g[++h]=function(){p(a(e)?e:jn(e),n)},r(h),h},Jn=function(e){delete g[e]},Gl?r=function(e){Kn(i.call(l,e))}:d&&a(s)&&!e.importScripts?(r=function(e){s(e,"*")},d("message",t,!1)):a(f)?(u=new f,o=u.port2,u.port1.onmessage=t,r=c(o.postMessage,o,1)):r=$n&&n in $n[Mn]("script")?function(e){Qn.appendChild($n[Mn]("script"))[n]=function(){Qn.removeChild(this),l(e)}}:function(e){Hn(l,0,e)}}("onreadystatechange"),U(Xl+$l,{setImmediate:Wn,clearImmediate:Jn}),!function(e,n){a(e)&&a(e.resolve)&&e.resolve(n=new e(function(){}))==n||function(n,l){function u(e){var n;return r(e)&&(n=e.then),a(n)?n:!1}function o(e){var n,t=e[l],r=t.c,a=0;if(t.h)return!0;for(;r.length>a;)if(n=r[a++],n.fail||o(n.P))return!0}function s(e,l){var t=e.c;(l||t.length)&&n(function(){var n=e.p,r=e.v,s=1==e.s,i=0;if(l&&!o(n))Hn(function(){o(n)||(Gl?!zn.emit("unhandledRejection",r,n):a(el.error)&&el.error("Unhandled promise rejection",r))},1e3);else for(;t.length>i;)!function(n){var l,t,a=s?n.ok:n.fail;try{a?(s||(e.h=!0),l=a===!0?r:a(r),l===n.P?n.rej(qn(yn+"-chain cycle")):(t=u(l))?t.call(l,n.res,n.rej):n.res(l)):n.rej(r)}catch(o){n.rej(o)}}(t[i++]);t.length=0})}function i(e){var n,l,t=this;if(!t.d){t.d=!0,t=t.r||t;try{(n=u(e))?(l={r:t,d:!1},n.call(e,c(i,l,1),c(p,l,1))):(t.v=e,t.s=1,s(t))}catch(r){p.call(l||{r:t,d:!1},r)}}}function p(e){var n=this;n.d||(n.d=!0,n=n.r||n,n.v=e,n.s=2,s(n,!0))}function d(e){var n=T(e)[ql];return n!=t?n:e}e=function(n){j(n),P(this,e,yn);var r={p:this,c:[],s:0,d:!1,v:t,h:!1};Dl(this,l,r);try{n(c(i,r,1),c(p,r,1))}catch(a){p.call(r,a)}},N(e[bn],{then:function(n,r){var u=T(T(this)[vn])[ql],o={ok:a(n)?n:!0,fail:a(r)?r:!1},i=o.P=new(u!=t?u:e)(function(e,n){o.res=j(e),o.rej=j(n)}),c=this[l];return c.c.push(o),c.s&&s(c),i},"catch":function(e){return this.then(t,e)}}),N(e,{all:function(e){var n=d(this),l=[];return new n(function(t,r){Z(e,!1,Il,l);var a=l.length,u=Pn(a);a?wl.call(l,function(e,l){n.resolve(e).then(function(e){u[l]=e,--a||t(u)},r)}):t(u)})},race:function(e){var n=d(this);return new n(function(l,t){Z(e,!1,function(e){n.resolve(e).then(l,t)})})},reject:function(e){return new(d(this))(function(n,l){l(e)})},resolve:function(e){return r(e)&&l in e&&pl(e)===this[bn]?e:new(d(this))(function(n){n(e)})}})}(Kn||Wn,Bl("record")),u(e,yn),V(e),U(Xl+Yl*!ul(e),{Promise:e})}(e[yn]),!function(){function e(e,n,r,a,o,s){function i(e,n){return n!=t&&Z(n,o,e[f],e),e}function c(e,n){var t=h[e];l&&(h[e]=function(e,l){var r=t.call(this,0===e?0:e,l);return n?this:r})}var f=o?"set":"add",h=e&&e[bn],_={};if(ul(e)&&(s||!rt&&xl(h,Rn)&&xl(h,"entries"))){var b,v=e,I=new e,w=I[f](s?{}:-0,1);K(function(n){new e(n)})&&(e=function(l){return P(this,e,n),i(new v,l)},e[bn]=h,l&&(h[vn]=e)),s||I[Rn](function(e,n){b=1/n===-rl}),b&&(c("delete"),c("has"),o&&c("get")),(b||w!==I)&&c(f,!0)}else e=s?function(l){P(this,e,n),Fl(this,p,x++),i(this,l)}:function(l){var r=this;P(r,e,n),Fl(r,d,cl(null)),Fl(r,y,0),Fl(r,g,t),Fl(r,m,t),i(r,l)},N(N(e[bn],r),a),s||!Ll||fl(e[bn],"size",{get:function(){return M(this[y])}});return u(e,n),V(e),_[n]=e,U(Xl+Ql+Yl*!ul(e),_),s||W(e,n,function(e,n){Fl(this,Zl,{o:e,k:n})},function(){for(var e=this[Zl],n=e.k,l=e.l;l&&l.r;)l=l.p;return e.o&&(e.l=l=l?l.n:e.o[m])?n==et?J(0,l.k):n==nt?J(0,l.v):J(0,[l.k,l.v]):(e.o=t,J(1))},o?et+nt:nt,!o),e}function n(e,n){if(!r(e))return("string"==typeof e?"S":"P")+e;if(_l(e))return"F";if(!xl(e,p)){if(!n)return"E";Dl(e,p,++x)}return"O"+e[p]}function a(e,l){var t,r=n(l);if("F"!=r)return e[d][r];for(t=e[m];t;t=t.n)if(t.k==l)return t}function o(e,l,r){var u,o,s=a(e,l);return s?s.v=r:(e[g]=s={i:o=n(l,!0),k:l,v:r,p:u=e[g],n:t,r:!1},e[m]||(e[m]=s),u&&(u.n=s),e[y]++,"F"!=o&&(e[d][o]=s)),e}function s(e,n,l){return _l(T(n))?i(e).set(n,l):(xl(n,f)||Dl(n,f,{}),n[f][e[p]]=l),e}function i(e){return e[h]||Dl(e,h,new Dn)[h]}var p=Bl("uid"),d=Bl("O1"),f=Bl("weak"),h=Bl("leak"),g=Bl("last"),m=Bl("first"),y=Ll?Bl("size"):"size",x=0,b={},v={clear:function(){for(var e=this,n=e[d],l=e[m];l;l=l.n)l.r=!0,l.p&&(l.p=l.p.n=t),delete n[l.i];e[m]=e[g]=t,e[y]=0},"delete":function(e){var n=this,l=a(n,e);if(l){var t=l.n,r=l.p;delete n[d][l.i],l.r=!0,r&&(r.n=t),t&&(t.p=r),n[m]==l&&(n[m]=t),n[g]==l&&(n[g]=r),n[y]--}return!!l},forEach:function(e){for(var n,l=c(e,arguments[1],3);n=n?n.n:this[m];)for(l(n.v,n.k,this);n&&n.r;)n=n.p},has:function(e){return!!a(this,e)}};Dn=e(Dn,dn,{get:function(e){var n=a(this,e);return n&&n.v},set:function(e,n){return o(this,0===e?0:e,n)}},v,!0),Fn=e(Fn,fn,{add:function(e){return o(this,e=0===e?0:e,e)}},v);var I={"delete":function(e){return r(e)?_l(e)?i(this)["delete"](e):xl(e,f)&&xl(e[f],this[p])&&delete e[f][this[p]]:!1},has:function(e){return r(e)?_l(e)?i(this).has(e):xl(e,f)&&xl(e[f],this[p]):!1}};Bn=e(Bn,hn,{get:function(e){if(r(e)){if(_l(e))return i(this).get(e);if(xl(e,f))return e[f][this[p]]}},set:function(e,n){return s(this,e,n)}},I,!0,!0),l&&7!=(new Bn).set(Tn.freeze(b),7).get(b)&&wl.call(_("delete,has,get,set"),function(e){var n=Bn[bn][e];Bn[bn][e]=function(l,t){if(r(l)&&_l(l)){var a=i(this)[e](l,t);return"set"==e?this:a}return n.call(this,l,t)}}),Nn=e(Nn,gn,{add:function(e){return s(this,e,!0)}},I,!1,!0)}(),!function(){function e(e){var n,l=[];for(n in e)l.push(n);Fl(this,Zl,{o:e,a:l,i:0})}function n(e){return function(n){T(n);try{return e.apply(t,arguments),!0}catch(l){return!1}}}function l(e,n){var a,u=arguments.length<3?e:arguments[2],o=hl(T(e),n);return o?xl(o,"value")?o.value:o.get===t?t:o.get.call(u):r(a=pl(e))?l(a,n,u):t}function a(e,n,l){var u,o,s=arguments.length<4?e:arguments[3],i=hl(T(e),n);if(!i){if(r(o=pl(e)))return a(o,n,l,s);i=L(0)}return xl(i,"value")?i.writable!==!1&&r(s)?(u=hl(s,n)||L(0),u.value=l,fl(s,n,u),!0):!1:i.set===t?!1:(i.set.call(s,l),!0)}G(e,rn,function(){var e,n=this[Zl],l=n.a;do if(n.i>=l.length)return J(1);while(!((e=l[n.i++])in n.o));return J(0,e)});var u=Tn.isExtensible||f,o={apply:c(sl,il,3),construct:function(e,n){var l=j(arguments.length<3?e:arguments[2])[bn],t=cl(r(l)?l:ll),a=il.call(e,t,n);return r(a)?a:t},defineProperty:n(fl),deleteProperty:function(e,n){var l=hl(T(e),n);return l&&!l.configurable?!1:delete e[n]},enumerate:function(n){return new e(T(n))},get:l,getOwnPropertyDescriptor:function(e,n){return hl(T(e),n)},getPrototypeOf:function(e){return pl(T(e))},has:function(e,n){return n in e},isExtensible:function(e){return!!u(T(e))},ownKeys:m,preventExtensions:n(Tn.preventExtensions||f),set:a};dl&&(o.setPrototypeOf=function(e,n){return dl(T(e),n),!0}),U(Xl,{Reflect:{}}),U(zl,"Reflect",o)}(),!function(){function e(e){return function(n){var l,t=d(n),r=gl(n),a=r.length,u=0,o=Pn(a);if(e)for(;a>u;)o[u]=[l=r[u++],t[l]];else for(;a>u;)o[u]=t[r[u++]];return o}}U(Kl,un,{includes:b(!0)}),U(Kl,on,{at:C(!0)}),U(zl,rn,{getOwnPropertyDescriptors:function(e){var n=d(e),l={};return wl.call(m(n),function(e){fl(l,e,L(0,hl(n,e)))}),l},values:e(!1),entries:e(!0)}),U(zl,cn,{escape:S(/([\\\-[\]{}()*+?.,^$|])/g,"\\$1",!0)})}(),!function(e){function n(e){if(e){var n=e[bn];Dl(n,en,n.get),Dl(n,l,n.set),Dl(n,t,n["delete"])}}en=B(e+"Get",!0);var l=B(e+fn,!0),t=B(e+"Delete",!0);U(zl,mn,{referenceGet:en,referenceSet:l,referenceDelete:t}),Dl(tl,en,h),n(Dn),n(Bn)}("reference"),!function(e){function n(e,n){Fl(this,Zl,{o:d(e),a:gl(e),i:0,k:n})}function l(e){return function(l){return new n(l,e)}}function a(e){var n=1==e,l=4==e;return function(r,a,u){var o,s,i,p=c(a,u,3),f=d(r),h=n||7==e||2==e?new(v(this,nn)):t;for(o in f)if(xl(f,o)&&(s=f[o],i=p(s,o,r),e))if(n)h[o]=i;else if(i)switch(e){case 2:h[o]=s;break;case 3:return!0;case 5:return s;case 6:return o;case 7:h[i[0]]=i[1]}else if(l)return!1;return 3==e||l?l:h}}function u(e){return function(n,l,r){j(l);var a,u,o,s=d(n),i=gl(s),c=i.length,p=0;for(e?a=r==t?new(v(this,nn)):Tn(r):arguments.length<3?(A(c,Pl),a=s[i[p++]]):a=Tn(r);c>p;)if(xl(s,u=i[p++]))if(o=l(a,s[u],u,n),e){if(o===!1)break}else a=o;return a}}function o(e,n){return(n==n?y(e,n):s(e,I))!==t}nn=function(e){var n=cl(null);return e!=t&&(Y(e)?Z(e,!0,function(e,l){n[e]=l}):vl(n,e)),n},nn[bn]=null,G(n,e,function(){var e,n=this[Zl],l=n.o,r=n.a,a=n.k;do if(n.i>=r.length)return n.o=t,J(1);while(!xl(l,e=r[n.i++]));return a==et?J(0,e):a==nt?J(0,l[e]):J(0,[e,l[e]])});var s=a(6),i={keys:l(et),values:l(nt),entries:l(et+nt),forEach:a(0),map:a(1),filter:a(2),some:a(3),every:a(4),find:a(5),findKey:s,mapPairs:a(7),reduce:u(!1),turn:u(!0),keyOf:y,includes:o,has:xl,get:g,set:D(0),isDict:function(e){return r(e)&&pl(e)===nn[bn]}};if(en)for(var f in i)!function(e){function n(){for(var n=[this],l=0;l<arguments.length;)n.push(arguments[l++]);return p(e,n)}e[en]=function(){return n}}(i[f]);U(Xl+Yl,{Dict:N(nn,i)})}("Dict"),!function(e,n){function l(n,t){return this instanceof l?(this[Zl]=X(n),void(this[e]=!!t)):new l(n,t)}function r(l){function t(l,t,r){this[Zl]=X(l),this[e]=l[e],this[n]=c(t,r,l[e]?2:1)}return G(t,"Chain",l,a),q(t[bn],h),t}G(l,"Wrapper",function(){return this[Zl].next()});var a=l[bn];q(a,function(){return this[Zl]});var u=r(function(){var l=this[Zl].next();return l.done?l:J(0,z(this[n],l.value,this[e]))}),o=r(function(){for(;;){var l=this[Zl].next();if(l.done||z(this[n],l.value,this[e]))return l}});N(a,{of:function(n,l){Z(this,this[e],n,l)},array:function(e,n){var l=[];return Z(e!=t?this.map(e,n):this,!1,Il,l),l},filter:function(e,n){return new o(this,e,n)},map:function(e,n){return new u(this,e,n)}}),l.isIterable=Y,l.getIterator=X,U(Xl+Yl,{$for:l})}("entries",Bl("fn")),U(Xl+Yl,{delay:function(e){return new Promise(function(n){Hn(n,e,!0)})}}),!function(e,n){function l(l){var r=this,a={};return Dl(r,e,function(e){return e!==t&&e in r?xl(a,e)?a[e]:a[e]=c(r[e],r,-1):n.call(r)})[e](l)}Hl._=Wl._=Wl._||{},U(Kl+Yl,an,{part:i,only:function(e,n){var l=j(this),t=E(e),r=arguments.length>1;return function(){for(var e=Ml(t,arguments.length),a=Pn(e),u=0;e>u;)a[u]=arguments[u++];return p(l,a,r?n:this)}}}),Dl(Wl._,In,function(){return e}),Dl(ll,e,l),Ll||Dl(nl,e,l)}(Ll?F("tie"):En,ll[En]),!function(){function e(e,n){for(var l,t=m(d(n)),r=t.length,a=0;r>a;)fl(e,l=t[a++],hl(n,l));return e}U(zl+Yl,rn,{isObject:r,classof:s,define:e,make:function(n,l){return e(cl(n),l)}})}(),U(Kl+Yl,un,{turn:function(e,n){j(e);for(var l=n==t?[]:Tn(n),r=bl(this),a=E(r.length),u=0;a>u&&e(l,r[u],u++,this)!==!1;);return l}}),l&&(Vl.turn=!0),!function(e){function n(e){Fl(this,Zl,{l:E(e),i:0})}G(n,sn,function(){var e=this[Zl],n=e.i++;return n<e.l?J(0,n):J(1)}),H(On,sn,function(){return new n(this)}),e.random=function(e){var n=+this,l=e==t?0:+e,r=Ml(n,l);return jl()*(Al(n,l)-r)+r},wl.call(_("round,floor,ceil,abs,sin,asin,cos,acos,tan,atan,exp,sqrt,max,min,pow,atan2,acosh,asinh,atanh,cbrt,clz32,cosh,expm1,hypot,imul,log1p,log10,log2,sign,sinh,tanh,trunc"),function(n){var l=Un[n];l&&(e[n]=function(){for(var e=[+this],n=0;arguments.length>n;)e.push(arguments[n++]);return p(l,e)})}),U(Kl+Yl,sn,e)}({}),!function(){var e,n={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&apos;"},l={};for(e in n)l[n[e]]=e;U(Kl+Yl,on,{escapeHTML:S(/[&<>"']/g,n),unescapeHTML:S(/&(?:amp|lt|gt|quot|apos);/g,l)})}(),!function(e,n,l,t,r,a,u,o,s){function i(n){return function(i,c){function p(e){return d[n+e]()}var d=this,f=l[xl(l,c)?c:t];return Ln(i).replace(e,function(e){switch(e){case"s":return p(r);case"ss":return R(p(r));case"m":return p(a);case"mm":return R(p(a));case"h":return p(u);case"hh":return R(p(u));case"D":return p(pn);case"DD":return R(p(pn));case"W":return f[0][p("Day")];case"N":return p(o)+1;case"NN":return R(p(o)+1);case"M":return f[2][p(o)];case"MM":return f[1][p(o)];case"Y":return p(s);case"YY":return R(p(s)%100)}return e})}}function c(e,t){function r(e){var l=[];return wl.call(_(t.months),function(t){l.push(t.replace(n,"$"+e))}),l}return l[e]=[_(t.weekdays),r(1),r(2)],Hl}U(Kl+Yl,pn,{format:i("get"),formatUTC:i("getUTC")}),c(t,{weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday",months:"January,February,March,April,May,June,July,August,September,October,November,December"}),c("ru",{weekdays:"Воскресенье,Понедельник,Вторник,Среда,Четверг,Пятница,Суббота",months:"Январ:я|ь,Феврал:я|ь,Март:а|,Апрел:я|ь,Ма:я|й,Июн:я|ь,Июл:я|ь,Август:а|,Сентябр:я|ь,Октябр:я|ь,Ноябр:я|ь,Декабр:я|ь"}),Hl.locale=function(e){return xl(l,e)?t=e:t},Hl.addLocale=c}(/\b\w\w?\b/g,/:(.*)\|(.*)$/,{},"en","Seconds","Minutes","Hours","Month","FullYear"),U(Xl+Yl,{global:e}),!function(e){function n(n,l){wl.call(_(n),function(n){n in nl&&(e[n]=c(sl,nl[n],l))})}n("pop,reverse,shift,keys,values,entries",1),n("indexOf,every,some,forEach,map,filter,find,findIndex,includes",3),n("join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill,turn"),U(zl,un,e)}({}),!function(e){!l||!e||ln in e[bn]||Dl(e[bn],ln,lt[un]),lt.NodeList=lt[un]}(e.NodeList),!function(e,n){wl.call(_("assert,clear,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,isIndependentlyComposed,log,markTimeline,profile,profileEnd,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn"),function(l){e[l]=function(){return n&&l in el?il.call(el[l],el,arguments):void 0}}),U(Xl+Yl,{log:vl(e.log,e,{enable:function(){n=!0},disable:function(){n=!1}})})}({},!0)}("undefined"!=typeof self&&self.Math===Math?self:Function("return this")(),!1)},{}],178:[function(e,n,l){function t(){return l.colors[c++%l.colors.length]}function r(e){function n(){}function r(){var e=r,n=+new Date,a=n-(i||n);e.diff=a,e.prev=i,e.curr=n,i=n,null==e.useColors&&(e.useColors=l.useColors()),null==e.color&&e.useColors&&(e.color=t());var u=Array.prototype.slice.call(arguments);u[0]=l.coerce(u[0]),"string"!=typeof u[0]&&(u=["%o"].concat(u));var o=0;u[0]=u[0].replace(/%([a-z%])/g,function(n,t){if("%%"===n)return n;o++;var r=l.formatters[t];if("function"==typeof r){var a=u[o];n=r.call(e,a),u.splice(o,1),o--}return n}),"function"==typeof l.formatArgs&&(u=l.formatArgs.apply(e,u));var s=r.log||l.log||console.log.bind(console);s.apply(e,u)}n.enabled=!1,r.enabled=!0;var a=l.enabled(e)?r:n;return a.namespace=e,a}function a(e){l.save(e);for(var n=(e||"").split(/[\s,]+/),t=n.length,r=0;t>r;r++)n[r]&&(e=n[r].replace(/\*/g,".*?"),"-"===e[0]?l.skips.push(new RegExp("^"+e.substr(1)+"$")):l.names.push(new RegExp("^"+e+"$")))}function u(){l.enable("")}function o(e){var n,t;for(n=0,t=l.skips.length;t>n;n++)if(l.skips[n].test(e))return!1;for(n=0,t=l.names.length;t>n;n++)if(l.names[n].test(e))return!0;return!1}function s(e){return e instanceof Error?e.stack||e.message:e}l=n.exports=r,l.coerce=s,l.disable=u,l.enable=a,l.enabled=o,l.humanize=e("ms"),l.names=[],l.skips=[],l.formatters={};var i,c=0},{ms:180}],179:[function(e,n,l){(function(t){function r(){var e=(t.env.DEBUG_COLORS||"").trim().toLowerCase();return 0===e.length?c.isatty(d):"0"!==e&&"no"!==e&&"false"!==e&&"disabled"!==e}function a(){var e=arguments,n=this.useColors,t=this.namespace;if(n){var r=this.color;e[0]=" [9"+r+"m"+t+" "+e[0]+"[3"+r+"m +"+l.humanize(this.diff)+""}else e[0]=(new Date).toUTCString()+" "+t+" "+e[0];return e}function u(){return f.write(p.format.apply(this,arguments)+"\n")}function o(e){null==e?delete t.env.DEBUG:t.env.DEBUG=e}function s(){return t.env.DEBUG}function i(n){var l,r=t.binding("tty_wrap");switch(r.guessHandleType(n)){case"TTY":l=new c.WriteStream(n),l._type="tty",l._handle&&l._handle.unref&&l._handle.unref();break;case"FILE":var a=e("fs");l=new a.SyncWriteStream(n,{autoClose:!1}),l._type="fs";break;case"PIPE":case"TCP":var u=e("net");l=new u.Socket({fd:n,readable:!1,writable:!0}),l.readable=!1,l.read=null,l._type="pipe",l._handle&&l._handle.unref&&l._handle.unref();break;default:throw new Error("Implement me. Unknown stream file type!")}return l.fd=n,l._isStdio=!0,l}var c=e("tty"),p=e("util");l=n.exports=e("./debug"),l.log=u,l.formatArgs=a,l.save=o,l.load=s,l.useColors=r,l.colors=[6,2,3,4,5,1];var d=parseInt(t.env.DEBUG_FD,10)||2,f=1===d?t.stdout:2===d?t.stderr:i(d),h=4===p.inspect.length?function(e,n){return p.inspect(e,void 0,void 0,n) }:function(e,n){return p.inspect(e,{colors:n})};l.formatters.o=function(e){return h(e,this.useColors).replace(/\s*\n\s*/g," ")},l.enable(s())}).call(this,e("_process"))},{"./debug":178,_process:151,fs:140,net:140,tty:165,util:167}],180:[function(e,n){function l(e){var n=/^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(e);if(n){var l=parseFloat(n[1]),t=(n[2]||"ms").toLowerCase();switch(t){case"years":case"year":case"y":return l*c;case"days":case"day":case"d":return l*i;case"hours":case"hour":case"h":return l*s;case"minutes":case"minute":case"m":return l*o;case"seconds":case"second":case"s":return l*u;case"ms":return l}}}function t(e){return e>=i?Math.round(e/i)+"d":e>=s?Math.round(e/s)+"h":e>=o?Math.round(e/o)+"m":e>=u?Math.round(e/u)+"s":e+"ms"}function r(e){return a(e,i,"day")||a(e,s,"hour")||a(e,o,"minute")||a(e,u,"second")||e+" ms"}function a(e,n,l){return n>e?void 0:1.5*n>e?Math.floor(e/n)+" "+l:Math.ceil(e/n)+" "+l+"s"}var u=1e3,o=60*u,s=60*o,i=24*s,c=365.25*i;n.exports=function(e,n){return n=n||{},"string"==typeof e?l(e):n.long?r(e):t(e)}},{}],181:[function(e,n){"use strict";function l(e){var n=0,l=0,t=0;for(var r in e){var a=e[r],u=a[0],o=a[1];(u>l||u===l&&o>t)&&(l=u,t=o,n=+r)}return n}var t=e("repeating"),r=/^(?:( )+|\t+)/;n.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");var n,a,u=0,o=0,s=0,i={};e.split(/\n/g).forEach(function(e){if(e){var l,t=e.match(r);t?(l=t[0].length,t[1]?o++:u++):l=0;var c=l-s;s=l,c?(a=c>0,n=i[a?c:-c],n?n[0]++:n=i[c]=[1,0]):n&&(n[1]+=+a)}});var c,p,d=l(i);return d?o>=u?(c="space",p=t(" ",d)):(c="tab",p=t(" ",d)):(c=null,p=""),{amount:d,type:c,indent:p}}},{repeating:329}],182:[function(n,l,t){!function(n,l){"use strict";"function"==typeof e&&e.amd?e(["exports"],l):l("undefined"!=typeof t?t:n.estraverse={})}(this,function r(e){"use strict";function n(){}function l(e){var n,t,r={};for(n in e)e.hasOwnProperty(n)&&(t=e[n],r[n]="object"==typeof t&&null!==t?l(t):t);return r}function t(e){var n,l={};for(n in e)e.hasOwnProperty(n)&&(l[n]=e[n]);return l}function a(e,n){var l,t,r,a;for(t=e.length,r=0;t;)l=t>>>1,a=r+l,n(e[a])?t=l:(r=a+1,t-=l+1);return r}function u(e,n){var l,t,r,a;for(t=e.length,r=0;t;)l=t>>>1,a=r+l,n(e[a])?(r=a+1,t-=l+1):t=l;return r}function o(e,n){return I(n).forEach(function(l){e[l]=n[l]}),e}function s(e,n){this.parent=e,this.key=n}function i(e,n,l,t){this.node=e,this.path=n,this.wrap=l,this.ref=t}function c(){}function p(e){return null==e?!1:"object"==typeof e&&"string"==typeof e.type}function d(e,n){return(e===y.ObjectExpression||e===y.ObjectPattern)&&"properties"===n}function f(e,n){var l=new c;return l.traverse(e,n)}function h(e,n){var l=new c;return l.replace(e,n)}function g(e,n){var l;return l=a(n,function(n){return n.range[0]>e.range[0]}),e.extendedRange=[e.range[0],e.range[1]],l!==n.length&&(e.extendedRange[1]=n[l].range[0]),l-=1,l>=0&&(e.extendedRange[0]=n[l].range[1]),e}function m(e,n,t){var r,a,u,o,s=[];if(!e.range)throw new Error("attachComments needs range information");if(!t.length){if(n.length){for(u=0,a=n.length;a>u;u+=1)r=l(n[u]),r.extendedRange=[0,e.range[0]],s.push(r);e.leadingComments=s}return e}for(u=0,a=n.length;a>u;u+=1)s.push(g(l(n[u]),t));return o=0,f(e,{enter:function(e){for(var n;o<s.length&&(n=s[o],!(n.extendedRange[1]>e.range[0]));)n.extendedRange[1]===e.range[0]?(e.leadingComments||(e.leadingComments=[]),e.leadingComments.push(n),s.splice(o,1)):o+=1;return o===s.length?x.Break:s[o].extendedRange[0]>e.range[1]?x.Skip:void 0}}),o=0,f(e,{leave:function(e){for(var n;o<s.length&&(n=s[o],!(e.range[1]<n.extendedRange[0]));)e.range[1]===n.extendedRange[0]?(e.trailingComments||(e.trailingComments=[]),e.trailingComments.push(n),s.splice(o,1)):o+=1;return o===s.length?x.Break:s[o].extendedRange[0]>e.range[1]?x.Skip:void 0}}),e}var y,_,x,b,v,I,w,E,k;return _=Array.isArray,_||(_=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),n(t),n(u),v=Object.create||function(){function e(){}return function(n){return e.prototype=n,new e}}(),I=Object.keys||function(e){var n,l=[];for(n in e)l.push(n);return l},y={AssignmentExpression:"AssignmentExpression",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportBatchSpecifier:"ExportBatchSpecifier",ExportDeclaration:"ExportDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"},b={AssignmentExpression:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","defaults","rest","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ClassBody:["body"],ClassDeclaration:["id","body","superClass"],ClassExpression:["id","body","superClass"],ComprehensionBlock:["left","right"],ComprehensionExpression:["blocks","filter","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportBatchSpecifier:[],ExportDeclaration:["declaration","specifiers","source"],ExportSpecifier:["id","name"],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","defaults","rest","body"],FunctionExpression:["id","params","defaults","rest","body"],GeneratorExpression:["blocks","filter","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["id"],ImportNamespaceSpecifier:["id"],ImportSpecifier:["id","name"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],Program:["body"],Property:["key","value"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handlers","handler","guardedHandlers","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]},w={},E={},k={},x={Break:w,Skip:E,Remove:k},s.prototype.replace=function(e){this.parent[this.key]=e},s.prototype.remove=function(){return _(this.parent)?(this.parent.splice(this.key,1),!0):(this.replace(null),!1)},c.prototype.path=function(){function e(e,n){if(_(n))for(t=0,r=n.length;r>t;++t)e.push(n[t]);else e.push(n)}var n,l,t,r,a,u;if(!this.__current.path)return null;for(a=[],n=2,l=this.__leavelist.length;l>n;++n)u=this.__leavelist[n],e(a,u.path);return e(a,this.__current.path),a},c.prototype.type=function(){var e=this.current();return e.type||this.__current.wrap},c.prototype.parents=function(){var e,n,l;for(l=[],e=1,n=this.__leavelist.length;n>e;++e)l.push(this.__leavelist[e].node);return l},c.prototype.current=function(){return this.__current.node},c.prototype.__execute=function(e,n){var l,t;return t=void 0,l=this.__current,this.__current=n,this.__state=null,e&&(t=e.call(this,n.node,this.__leavelist[this.__leavelist.length-1].node)),this.__current=l,t},c.prototype.notify=function(e){this.__state=e},c.prototype.skip=function(){this.notify(E)},c.prototype["break"]=function(){this.notify(w)},c.prototype.remove=function(){this.notify(k)},c.prototype.__initialize=function(e,n){this.visitor=n,this.root=e,this.__worklist=[],this.__leavelist=[],this.__current=null,this.__state=null,this.__fallback="iteration"===n.fallback,this.__keys=b,n.keys&&(this.__keys=o(v(this.__keys),n.keys))},c.prototype.traverse=function(e,n){var l,t,r,a,u,o,s,c,f,h,g,m;for(this.__initialize(e,n),m={},l=this.__worklist,t=this.__leavelist,l.push(new i(e,null,null,null)),t.push(new i(null,null,null,null));l.length;)if(r=l.pop(),r!==m){if(r.node){if(o=this.__execute(n.enter,r),this.__state===w||o===w)return;if(l.push(m),t.push(r),this.__state===E||o===E)continue;if(a=r.node,u=r.wrap||a.type,h=this.__keys[u],!h){if(!this.__fallback)throw new Error("Unknown node type "+u+".");h=I(a)}for(c=h.length;(c-=1)>=0;)if(s=h[c],g=a[s])if(_(g)){for(f=g.length;(f-=1)>=0;)if(g[f]){if(d(u,h[c]))r=new i(g[f],[s,f],"Property",null);else{if(!p(g[f]))continue;r=new i(g[f],[s,f],null,null)}l.push(r)}}else p(g)&&l.push(new i(g,s,null,null))}}else if(r=t.pop(),o=this.__execute(n.leave,r),this.__state===w||o===w)return},c.prototype.replace=function(e,n){function l(e){var n,l,r,a;if(e.ref.remove())for(l=e.ref.key,a=e.ref.parent,n=t.length;n--;)if(r=t[n],r.ref&&r.ref.parent===a){if(r.ref.key<l)break;--r.ref.key}}var t,r,a,u,o,c,f,h,g,m,y,x,b;for(this.__initialize(e,n),y={},t=this.__worklist,r=this.__leavelist,x={root:e},c=new i(e,null,null,new s(x,"root")),t.push(c),r.push(c);t.length;)if(c=t.pop(),c!==y){if(o=this.__execute(n.enter,c),void 0!==o&&o!==w&&o!==E&&o!==k&&(c.ref.replace(o),c.node=o),(this.__state===k||o===k)&&(l(c),c.node=null),this.__state===w||o===w)return x.root;if(a=c.node,a&&(t.push(y),r.push(c),this.__state!==E&&o!==E)){if(u=c.wrap||a.type,g=this.__keys[u],!g){if(!this.__fallback)throw new Error("Unknown node type "+u+".");g=I(a)}for(f=g.length;(f-=1)>=0;)if(b=g[f],m=a[b])if(_(m)){for(h=m.length;(h-=1)>=0;)if(m[h]){if(d(u,g[f]))c=new i(m[h],[b,h],"Property",new s(m,h));else{if(!p(m[h]))continue;c=new i(m[h],[b,h],null,new s(m,h))}t.push(c)}}else p(m)&&t.push(new i(m,b,null,new s(a,b)))}}else if(c=r.pop(),o=this.__execute(n.leave,c),void 0!==o&&o!==w&&o!==E&&o!==k&&c.ref.replace(o),(this.__state===k||o===k)&&l(c),this.__state===w||o===w)return x.root;return x.root},e.version="1.8.1-dev",e.Syntax=y,e.traverse=f,e.replace=h,e.attachComments=m,e.VisitorKeys=b,e.VisitorOption=x,e.Controller=c,e.cloneEnvironment=function(){return r({})},e})},{}],183:[function(e,n){!function(){"use strict";function e(e){if(null==e)return!1;switch(e.type){case"ArrayExpression":case"AssignmentExpression":case"BinaryExpression":case"CallExpression":case"ConditionalExpression":case"FunctionExpression":case"Identifier":case"Literal":case"LogicalExpression":case"MemberExpression":case"NewExpression":case"ObjectExpression":case"SequenceExpression":case"ThisExpression":case"UnaryExpression":case"UpdateExpression":return!0}return!1}function l(e){if(null==e)return!1;switch(e.type){case"DoWhileStatement":case"ForInStatement":case"ForStatement":case"WhileStatement":return!0}return!1}function t(e){if(null==e)return!1;switch(e.type){case"BlockStatement":case"BreakStatement":case"ContinueStatement":case"DebuggerStatement":case"DoWhileStatement":case"EmptyStatement":case"ExpressionStatement":case"ForInStatement":case"ForStatement":case"IfStatement":case"LabeledStatement":case"ReturnStatement":case"SwitchStatement":case"ThrowStatement":case"TryStatement":case"VariableDeclaration":case"WhileStatement":case"WithStatement":return!0}return!1}function r(e){return t(e)||null!=e&&"FunctionDeclaration"===e.type}function a(e){switch(e.type){case"IfStatement":return null!=e.alternate?e.alternate:e.consequent;case"LabeledStatement":case"ForStatement":case"ForInStatement":case"WhileStatement":case"WithStatement":return e.body}return null}function u(e){var n;if("IfStatement"!==e.type)return!1;if(null==e.alternate)return!1;n=e.consequent;do{if("IfStatement"===n.type&&null==n.alternate)return!0;n=a(n)}while(n);return!1}n.exports={isExpression:e,isStatement:t,isIterationStatement:l,isSourceElement:r,isProblematicIfStatement:u,trailingStatement:a}}()},{}],184:[function(e,n){!function(){"use strict";function e(e){return e>=48&&57>=e}function l(n){return e(n)||n>=97&&102>=n||n>=65&&70>=n}function t(e){return e>=48&&55>=e}function r(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&i.indexOf(e)>=0}function a(e){return 10===e||13===e||8232===e||8233===e}function u(e){return e>=97&&122>=e||e>=65&&90>=e||36===e||95===e||92===e||e>=128&&s.NonAsciiIdentifierStart.test(String.fromCharCode(e))}function o(e){return e>=97&&122>=e||e>=65&&90>=e||e>=48&&57>=e||36===e||95===e||92===e||e>=128&&s.NonAsciiIdentifierPart.test(String.fromCharCode(e))}var s,i;s={NonAsciiIdentifierStart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]"),NonAsciiIdentifierPart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԧԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠࢢ-ࢬࣤ-ࣾऀ-ॣ०-९ॱ-ॷॹ-ॿঁ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఁ-ఃఅ-ఌఎ-ఐఒ-నప-ళవ-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಂಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲംഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤜᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶᴀ-ᷦ᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‌‍‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺꩻꪀ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︦︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]")},i=[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279],n.exports={isDecimalDigit:e,isHexDigit:l,isOctalDigit:t,isWhiteSpace:r,isLineTerminator:a,isIdentifierStart:u,isIdentifierPart:o}}()},{}],185:[function(e,n){!function(){"use strict";function l(e){switch(e){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"let":return!0;default:return!1}}function t(e,n){return n||"yield"!==e?r(e,n):!1}function r(e,n){if(n&&l(e))return!0;switch(e.length){case 2:return"if"===e||"in"===e||"do"===e;case 3:return"var"===e||"for"===e||"new"===e||"try"===e;case 4:return"this"===e||"else"===e||"case"===e||"void"===e||"with"===e||"enum"===e;case 5:return"while"===e||"break"===e||"catch"===e||"throw"===e||"const"===e||"yield"===e||"class"===e||"super"===e;case 6:return"return"===e||"typeof"===e||"delete"===e||"switch"===e||"export"===e||"import"===e;case 7:return"default"===e||"finally"===e||"extends"===e;case 8:return"function"===e||"continue"===e||"debugger"===e;case 10:return"instanceof"===e;default:return!1}}function a(e,n){return"null"===e||"true"===e||"false"===e||t(e,n)}function u(e,n){return"null"===e||"true"===e||"false"===e||r(e,n)}function o(e){return"eval"===e||"arguments"===e}function s(e){var n,l,t;if(0===e.length)return!1;if(t=e.charCodeAt(0),!p.isIdentifierStart(t)||92===t)return!1;for(n=1,l=e.length;l>n;++n)if(t=e.charCodeAt(n),!p.isIdentifierPart(t)||92===t)return!1;return!0}function i(e,n){return s(e)&&!a(e,n)}function c(e,n){return s(e)&&!u(e,n)}var p=e("./code");n.exports={isKeywordES5:t,isKeywordES6:r,isReservedWordES5:a,isReservedWordES6:u,isRestrictedWord:o,isIdentifierName:s,isIdentifierES5:i,isIdentifierES6:c}}()},{"./code":184}],186:[function(e,n,l){!function(){"use strict";l.ast=e("./ast"),l.code=e("./code"),l.keyword=e("./keyword")}()},{"./ast":183,"./code":184,"./keyword":185}],187:[function(e,n){n.exports={builtin:{Array:!1,ArrayBuffer:!1,Boolean:!1,constructor:!1,Date:!1,decodeURI:!1,decodeURIComponent:!1,encodeURI:!1,encodeURIComponent:!1,Error:!1,eval:!1,EvalError:!1,Float32Array:!1,Float64Array:!1,Function:!1,hasOwnProperty:!1,Infinity:!1,Int16Array:!1,Int32Array:!1,Int8Array:!1,isFinite:!1,isNaN:!1,isPrototypeOf:!1,JSON:!1,Map:!1,Math:!1,NaN:!1,Number:!1,Object:!1,parseFloat:!1,parseInt:!1,Promise:!1,propertyIsEnumerable:!1,Proxy:!1,RangeError:!1,ReferenceError:!1,Reflect:!1,RegExp:!1,Set:!1,String:!1,Symbol:!1,SyntaxError:!1,System:!1,toLocaleString:!1,toString:!1,TypeError:!1,Uint16Array:!1,Uint32Array:!1,Uint8Array:!1,Uint8ClampedArray:!1,undefined:!1,URIError:!1,valueOf:!1,WeakMap:!1,WeakSet:!1},nonstandard:{escape:!1,unescape:!1},browser:{addEventListener:!1,alert:!1,applicationCache:!1,atob:!1,Audio:!1,AudioProcessingEvent:!1,BeforeUnloadEvent:!1,Blob:!1,blur:!1,btoa:!1,cancelAnimationFrame:!1,CanvasGradient:!1,CanvasPattern:!1,CanvasRenderingContext2D:!1,clearInterval:!1,clearTimeout:!1,close:!1,closed:!1,CloseEvent:!1,Comment:!1,CompositionEvent:!1,confirm:!1,console:!1,crypto:!1,CSS:!1,CustomEvent:!1,DataView:!1,Debug:!1,defaultStatus:!1,devicePixelRatio:!1,dispatchEvent:!1,document:!1,Document:!1,DocumentFragment:!1,DOMParser:!1,DragEvent:!1,Element:!1,ElementTimeControl:!1,ErrorEvent:!1,event:!1,Event:!1,FileReader:!1,find:!1,focus:!1,FocusEvent:!1,FormData:!1,frameElement:!1,frames:!1,GamepadEvent:!1,getComputedStyle:!1,getSelection:!1,HashChangeEvent:!1,history:!1,HTMLAnchorElement:!1,HTMLBaseElement:!1,HTMLBlockquoteElement:!1,HTMLBodyElement:!1,HTMLBRElement:!1,HTMLButtonElement:!1,HTMLCanvasElement:!1,HTMLDirectoryElement:!1,HTMLDivElement:!1,HTMLDListElement:!1,HTMLElement:!1,HTMLFieldSetElement:!1,HTMLFontElement:!1,HTMLFormElement:!1,HTMLFrameElement:!1,HTMLFrameSetElement:!1,HTMLHeadElement:!1,HTMLHeadingElement:!1,HTMLHRElement:!1,HTMLHtmlElement:!1,HTMLIFrameElement:!1,HTMLImageElement:!1,HTMLInputElement:!1,HTMLIsIndexElement:!1,HTMLLabelElement:!1,HTMLLayerElement:!1,HTMLLegendElement:!1,HTMLLIElement:!1,HTMLLinkElement:!1,HTMLMapElement:!1,HTMLMenuElement:!1,HTMLMetaElement:!1,HTMLModElement:!1,HTMLObjectElement:!1,HTMLOListElement:!1,HTMLOptGroupElement:!1,HTMLOptionElement:!1,HTMLParagraphElement:!1,HTMLParamElement:!1,HTMLPreElement:!1,HTMLQuoteElement:!1,HTMLScriptElement:!1,HTMLSelectElement:!1,HTMLStyleElement:!1,HTMLTableCaptionElement:!1,HTMLTableCellElement:!1,HTMLTableColElement:!1,HTMLTableElement:!1,HTMLTableRowElement:!1,HTMLTableSectionElement:!1,HTMLTextAreaElement:!1,HTMLTitleElement:!1,HTMLUListElement:!1,HTMLVideoElement:!1,IDBCursor:!1,IDBCursorWithValue:!1,IDBDatabase:!1,IDBEnvironment:!1,IDBFactory:!1,IDBIndex:!1,IDBKeyRange:!1,IDBObjectStore:!1,IDBOpenDBRequest:!1,IDBRequest:!1,IDBTransaction:!1,IDBVersionChangeEvent:!1,Image:!1,indexedDB:!1,innerHeight:!1,innerWidth:!1,InputEvent:!1,Intl:!1,KeyboardEvent:!1,length:!1,localStorage:!1,location:!1,matchMedia:!1,MessageChannel:!1,MessageEvent:!1,MessagePort:!1,MouseEvent:!1,moveBy:!1,moveTo:!1,MutationObserver:!1,name:!1,navigator:!1,Node:!1,NodeFilter:!1,NodeList:!1,Notification:!1,OfflineAudioCompletionEvent:!1,onbeforeunload:!0,onblur:!0,onerror:!0,onfocus:!0,onload:!0,onresize:!0,onunload:!0,open:!1,openDatabase:!1,opener:!1,opera:!1,Option:!1,outerHeight:!1,outerWidth:!1,PageTransitionEvent:!1,pageXOffset:!1,pageYOffset:!1,parent:!1,PopStateEvent:!1,postMessage:!1,print:!1,ProgressEvent:!1,prompt:!1,Range:!1,removeEventListener:!1,requestAnimationFrame:!1,resizeBy:!1,resizeTo:!1,screen:!1,screenX:!1,screenY:!1,scroll:!1,scrollbars:!1,scrollBy:!1,scrollTo:!1,scrollX:!1,scrollY:!1,self:!1,sessionStorage:!1,setInterval:!1,setTimeout:!1,SharedWorker:!1,showModalDialog:!1,status:!1,stop:!1,StorageEvent:!1,SVGAElement:!1,SVGAltGlyphDefElement:!1,SVGAltGlyphElement:!1,SVGAltGlyphItemElement:!1,SVGAngle:!1,SVGAnimateColorElement:!1,SVGAnimatedAngle:!1,SVGAnimatedBoolean:!1,SVGAnimatedEnumeration:!1,SVGAnimatedInteger:!1,SVGAnimatedLength:!1,SVGAnimatedLengthList:!1,SVGAnimatedNumber:!1,SVGAnimatedNumberList:!1,SVGAnimatedPathData:!1,SVGAnimatedPoints:!1,SVGAnimatedPreserveAspectRatio:!1,SVGAnimatedRect:!1,SVGAnimatedString:!1,SVGAnimatedTransformList:!1,SVGAnimateElement:!1,SVGAnimateMotionElement:!1,SVGAnimateTransformElement:!1,SVGAnimationElement:!1,SVGCircleElement:!1,SVGClipPathElement:!1,SVGColor:!1,SVGColorProfileElement:!1,SVGColorProfileRule:!1,SVGComponentTransferFunctionElement:!1,SVGCSSRule:!1,SVGCursorElement:!1,SVGDefsElement:!1,SVGDescElement:!1,SVGDocument:!1,SVGElement:!1,SVGElementInstance:!1,SVGElementInstanceList:!1,SVGEllipseElement:!1,SVGEvent:!1,SVGExternalResourcesRequired:!1,SVGFEBlendElement:!1,SVGFEColorMatrixElement:!1,SVGFEComponentTransferElement:!1,SVGFECompositeElement:!1,SVGFEConvolveMatrixElement:!1,SVGFEDiffuseLightingElement:!1,SVGFEDisplacementMapElement:!1,SVGFEDistantLightElement:!1,SVGFEFloodElement:!1,SVGFEFuncAElement:!1,SVGFEFuncBElement:!1,SVGFEFuncGElement:!1,SVGFEFuncRElement:!1,SVGFEGaussianBlurElement:!1,SVGFEImageElement:!1,SVGFEMergeElement:!1,SVGFEMergeNodeElement:!1,SVGFEMorphologyElement:!1,SVGFEOffsetElement:!1,SVGFEPointLightElement:!1,SVGFESpecularLightingElement:!1,SVGFESpotLightElement:!1,SVGFETileElement:!1,SVGFETurbulenceElement:!1,SVGFilterElement:!1,SVGFilterPrimitiveStandardAttributes:!1,SVGFitToViewBox:!1,SVGFontElement:!1,SVGFontFaceElement:!1,SVGFontFaceFormatElement:!1,SVGFontFaceNameElement:!1,SVGFontFaceSrcElement:!1,SVGFontFaceUriElement:!1,SVGForeignObjectElement:!1,SVGGElement:!1,SVGGlyphElement:!1,SVGGlyphRefElement:!1,SVGGradientElement:!1,SVGHKernElement:!1,SVGICCColor:!1,SVGImageElement:!1,SVGLangSpace:!1,SVGLength:!1,SVGLengthList:!1,SVGLinearGradientElement:!1,SVGLineElement:!1,SVGLocatable:!1,SVGMarkerElement:!1,SVGMaskElement:!1,SVGMatrix:!1,SVGMetadataElement:!1,SVGMissingGlyphElement:!1,SVGMPathElement:!1,SVGNumber:!1,SVGNumberList:!1,SVGPaint:!1,SVGPathElement:!1,SVGPathSeg:!1,SVGPathSegArcAbs:!1,SVGPathSegArcRel:!1,SVGPathSegClosePath:!1,SVGPathSegCurvetoCubicAbs:!1,SVGPathSegCurvetoCubicRel:!1,SVGPathSegCurvetoCubicSmoothAbs:!1,SVGPathSegCurvetoCubicSmoothRel:!1,SVGPathSegCurvetoQuadraticAbs:!1,SVGPathSegCurvetoQuadraticRel:!1,SVGPathSegCurvetoQuadraticSmoothAbs:!1,SVGPathSegCurvetoQuadraticSmoothRel:!1,SVGPathSegLinetoAbs:!1,SVGPathSegLinetoHorizontalAbs:!1,SVGPathSegLinetoHorizontalRel:!1,SVGPathSegLinetoRel:!1,SVGPathSegLinetoVerticalAbs:!1,SVGPathSegLinetoVerticalRel:!1,SVGPathSegList:!1,SVGPathSegMovetoAbs:!1,SVGPathSegMovetoRel:!1,SVGPatternElement:!1,SVGPoint:!1,SVGPointList:!1,SVGPolygonElement:!1,SVGPolylineElement:!1,SVGPreserveAspectRatio:!1,SVGRadialGradientElement:!1,SVGRect:!1,SVGRectElement:!1,SVGRenderingIntent:!1,SVGScriptElement:!1,SVGSetElement:!1,SVGStopElement:!1,SVGStringList:!1,SVGStylable:!1,SVGStyleElement:!1,SVGSVGElement:!1,SVGSwitchElement:!1,SVGSymbolElement:!1,SVGTests:!1,SVGTextContentElement:!1,SVGTextElement:!1,SVGTextPathElement:!1,SVGTextPositioningElement:!1,SVGTitleElement:!1,SVGTransform:!1,SVGTransformable:!1,SVGTransformList:!1,SVGTRefElement:!1,SVGTSpanElement:!1,SVGUnitTypes:!1,SVGURIReference:!1,SVGUseElement:!1,SVGViewElement:!1,SVGViewSpec:!1,SVGVKernElement:!1,SVGZoomAndPan:!1,Text:!1,TextDecoder:!1,TextEncoder:!1,TimeEvent:!1,top:!1,TouchEvent:!1,UIEvent:!1,URL:!1,WebGLActiveInfo:!1,WebGLBuffer:!1,WebGLContextEvent:!1,WebGLFramebuffer:!1,WebGLProgram:!1,WebGLRenderbuffer:!1,WebGLRenderingContext:!1,WebGLShader:!1,WebGLShaderPrecisionFormat:!1,WebGLTexture:!1,WebGLUniformLocation:!1,WebSocket:!1,WheelEvent:!1,window:!1,Window:!1,Worker:!1,XDomainRequest:!1,XMLHttpRequest:!1,XMLSerializer:!1,XPathEvaluator:!1,XPathException:!1,XPathExpression:!1,XPathNamespace:!1,XPathNSResolver:!1,XPathResult:!1},worker:{importScripts:!0,postMessage:!0,self:!0},node:{__dirname:!1,__filename:!1,arguments:!1,Buffer:!1,clearImmediate:!1,clearInterval:!1,clearTimeout:!1,console:!1,DataView:!1,exports:!0,GLOBAL:!1,global:!1,module:!1,process:!1,require:!1,setImmediate:!1,setInterval:!1,setTimeout:!1},amd:{define:!1,require:!1},mocha:{after:!1,afterEach:!1,before:!1,beforeEach:!1,context:!1,describe:!1,it:!1,setup:!1,specify:!1,suite:!1,suiteSetup:!1,suiteTeardown:!1,teardown:!1,test:!1,xcontext:!1,xdescribe:!1,xit:!1,xspecify:!1},jasmine:{afterAll:!1,afterEach:!1,beforeAll:!1,beforeEach:!1,describe:!1,expect:!1,fail:!1,fdescribe:!1,fit:!1,it:!1,jasmine:!1,pending:!1,runs:!1,spyOn:!1,waits:!1,waitsFor:!1,xdescribe:!1,xit:!1},qunit:{asyncTest:!1,deepEqual:!1,equal:!1,expect:!1,module:!1,notDeepEqual:!1,notEqual:!1,notPropEqual:!1,notStrictEqual:!1,ok:!1,propEqual:!1,QUnit:!1,raises:!1,start:!1,stop:!1,strictEqual:!1,test:!1,"throws":!1},phantomjs:{console:!0,exports:!0,phantom:!0,require:!0,WebPage:!0},couch:{emit:!1,exports:!1,getRow:!1,log:!1,module:!1,provides:!1,require:!1,respond:!1,send:!1,start:!1,sum:!1},rhino:{defineClass:!1,deserialize:!1,gc:!1,help:!1,importClass:!1,importPackage:!1,java:!1,load:!1,loadClass:!1,Packages:!1,print:!1,quit:!1,readFile:!1,readUrl:!1,runCommand:!1,seal:!1,serialize:!1,spawn:!1,sync:!1,toint32:!1,version:!1},wsh:{ActiveXObject:!0,Enumerator:!0,GetObject:!0,ScriptEngine:!0,ScriptEngineBuildVersion:!0,ScriptEngineMajorVersion:!0,ScriptEngineMinorVersion:!0,VBArray:!0,WScript:!0,WSH:!0,XDomainRequest:!0},jquery:{$:!1,jQuery:!1},yui:{Y:!1,YUI:!1,YUI_config:!1},shelljs:{cat:!1,cd:!1,chmod:!1,config:!1,cp:!1,dirs:!1,echo:!1,env:!1,error:!1,exec:!1,exit:!1,find:!1,grep:!1,ls:!1,mkdir:!1,mv:!1,popd:!1,pushd:!1,pwd:!1,rm:!1,sed:!1,target:!1,tempdir:!1,test:!1,which:!1},prototypejs:{$:!1,$$:!1,$A:!1,$break:!1,$continue:!1,$F:!1,$H:!1,$R:!1,$w:!1,Abstract:!1,Ajax:!1,Autocompleter:!1,Builder:!1,Class:!1,Control:!1,Draggable:!1,Draggables:!1,Droppables:!1,Effect:!1,Element:!1,Enumerable:!1,Event:!1,Field:!1,Form:!1,Hash:!1,Insertion:!1,ObjectRange:!1,PeriodicalExecuter:!1,Position:!1,Prototype:!1,Scriptaculous:!1,Selector:!1,Sortable:!1,SortableObserver:!1,Sound:!1,Template:!1,Toggle:!1,Try:!1},meteor:{$:!1,_:!1,Accounts:!1,App:!1,Assets:!1,Blaze:!1,check:!1,Cordova:!1,DDP:!1,DDPServer:!1,Deps:!1,EJSON:!1,Email:!1,HTTP:!1,Log:!1,Match:!1,Meteor:!1,Mongo:!1,MongoInternals:!1,Npm:!1,Package:!1,Plugin:!1,process:!1,Random:!1,ReactiveDict:!1,ReactiveVar:!1,Router:!1,Session:!1,share:!1,Spacebars:!1,Template:!1,Tinytest:!1,Tracker:!1,UI:!1,Utils:!1,WebApp:!1,WebAppInternals:!1},mongo:{_isWindows:!1,_rand:!1,BulkWriteResult:!1,cat:!1,cd:!1,connect:!1,db:!1,getHostName:!1,getMemInfo:!1,hostname:!1,listFiles:!1,load:!1,ls:!1,md5sumFile:!1,mkdir:!1,Mongo:!1,ObjectId:!1,PlanCache:!1,pwd:!1,quit:!1,removeFile:!1,rs:!1,sh:!1,UUID:!1,version:!1,WriteResult:!1}}},{}],188:[function(e,n){n.exports=e("./globals.json")},{"./globals.json":187}],189:[function(e,n){var l=e("is-nan"),t=e("is-finite");n.exports=Number.isInteger||function(e){return"number"==typeof e&&!l(e)&&t(e)&&parseInt(e,10)===e}},{"is-finite":190,"is-nan":191}],190:[function(e,n){"use strict";n.exports=Number.isFinite||function(e){return"number"!=typeof e||e!==e||1/0===e||e===-1/0?!1:!0}},{}],191:[function(e,n){"use strict";n.exports=function(e){return e!==e}},{}],192:[function(e,n){n.exports=/((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyu]{1,5}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|((?:0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?))|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]{1,6}\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-*\/%&|^]|<{1,2}|>{1,3}|!=?|={1,2})=?|[?:~]|[;,.[\](){}])|(\s+)|(^$|[\s\S])/g,n.exports.matchToToken=function(e){return token={type:"invalid",value:e[0]},e[1]?(token.type="string",token.closed=!(!e[3]&&!e[4])):e[5]?token.type="comment":e[6]?(token.type="comment",token.closed=!!e[7]):e[8]?token.type="regex":e[9]?token.type="number":e[10]?token.type="name":e[11]?token.type="punctuator":e[12]&&(token.type="whitespace"),token}},{}],193:[function(e,n){var l=[],t=[];n.exports=function(e,n){if(e===n)return 0;var r=e.length,a=n.length;if(0===r)return a;if(0===a)return r;for(var u,o,s,i,c=0,p=0;r>c;)t[c]=e.charCodeAt(c),l[c]=++c;for(;a>p;)for(u=n.charCodeAt(p),s=p++,o=p,c=0;r>c;c++)i=u===t[c]?s:s+1,s=l[c],o=l[c]=s>o?i>o?o+1:i:i>s?s+1:i;return o}},{}],194:[function(e,n){function l(e,n,l){return n in e?e[n]:l}function t(e,n){var t=l.bind(null,n||{}),a=t("transform",Function.prototype),u=t("padding"," "),o=t("before"," "),s=t("after"," | "),i=t("start",1),c=Array.isArray(e),p=c?e:e.split("\n"),d=i+p.length-1,f=String(d).length,h=p.map(function(e,n){var l=i+n,t={before:o,number:l,width:f,after:s,line:e};return a(t),t.before+r(t.number,f,u)+t.after+t.line});return c?h:h.join("\n")}var r=e("left-pad");n.exports=t},{"left-pad":195}],195:[function(e,n){function l(e,n,l){e=String(e);var t=-1;for(l||(l=" "),n-=e.length;++t<n;)e=l+e;return e}n.exports=l},{}],196:[function(e,n){function l(e){for(var n=-1,l=e?e.length:0,t=-1,r=[];++n<l;){var a=e[n];a&&(r[++t]=a)}return r}n.exports=l},{}],197:[function(e,n){function l(e,n,l){var a=e?e.length:0;return l&&r(e,n,l)&&(n=!1),a?t(e,n):[]}var t=e("../internal/baseFlatten"),r=e("../internal/isIterateeCall");n.exports=l},{"../internal/baseFlatten":227,"../internal/isIterateeCall":274}],198:[function(e,n){function l(e){var n=e?e.length:0; return n?e[n-1]:void 0}n.exports=l},{}],199:[function(e,n){function l(){var e=arguments[0];if(!e||!e.length)return e;for(var n=0,l=t,r=arguments.length;++n<r;)for(var u=0,o=arguments[n];(u=l(e,o,u))>-1;)a.call(e,u,1);return e}var t=e("../internal/baseIndexOf"),r=Array.prototype,a=r.splice;n.exports=l},{"../internal/baseIndexOf":233}],200:[function(e,n){function l(e,n,l,o){var s=e?e.length:0;return s?(null!=n&&"boolean"!=typeof n&&(o=l,l=a(e,n,o)?null:n,n=!1),l=null==l?l:t(l,o,3),n?u(e,l):r(e,l)):[]}var t=e("../internal/baseCallback"),r=e("../internal/baseUniq"),a=e("../internal/isIterateeCall"),u=e("../internal/sortedUniq");n.exports=l},{"../internal/baseCallback":220,"../internal/baseUniq":247,"../internal/isIterateeCall":274,"../internal/sortedUniq":285}],201:[function(e,n){n.exports=e("./includes")},{"./includes":205}],202:[function(e,n){n.exports=e("./forEach")},{"./forEach":203}],203:[function(e,n){function l(e,n,l){return"function"==typeof n&&"undefined"==typeof l&&u(e)?t(e,n):r(e,a(n,l,3))}var t=e("../internal/arrayEach"),r=e("../internal/baseEach"),a=e("../internal/bindCallback"),u=e("../lang/isArray");n.exports=l},{"../internal/arrayEach":214,"../internal/baseEach":225,"../internal/bindCallback":249,"../lang/isArray":290}],204:[function(e,n){var l=e("../internal/createAggregator"),t=Object.prototype,r=t.hasOwnProperty,a=l(function(e,n,l){r.call(e,l)?e[l].push(n):e[l]=[n]});n.exports=a},{"../internal/createAggregator":256}],205:[function(e,n){function l(e,n,l){var i=e?e.length:0;return a(i)||(e=o(e),i=e.length),i?(l="number"==typeof l?0>l?s(i+l,0):l||0:0,"string"==typeof e||!r(e)&&u(e)?i>l&&e.indexOf(n,l)>-1:t(e,n,l)>-1):!1}var t=e("../internal/baseIndexOf"),r=e("../lang/isArray"),a=e("../internal/isLength"),u=e("../lang/isString"),o=e("../object/values"),s=Math.max;n.exports=l},{"../internal/baseIndexOf":233,"../internal/isLength":275,"../lang/isArray":290,"../lang/isString":299,"../object/values":307}],206:[function(e,n){function l(e,n,l){var o=u(e)?t:a;return n=r(n,l,3),o(e,n)}var t=e("../internal/arrayMap"),r=e("../internal/baseCallback"),a=e("../internal/baseMap"),u=e("../lang/isArray");n.exports=l},{"../internal/arrayMap":215,"../internal/baseCallback":220,"../internal/baseMap":238,"../lang/isArray":290}],207:[function(e,n){function l(e,n,l,s){var i=o(e)?t:u;return i(e,r(n,s,4),l,arguments.length<3,a)}var t=e("../internal/arrayReduceRight"),r=e("../internal/baseCallback"),a=e("../internal/baseEachRight"),u=e("../internal/baseReduce"),o=e("../lang/isArray");n.exports=l},{"../internal/arrayReduceRight":216,"../internal/baseCallback":220,"../internal/baseEachRight":226,"../internal/baseReduce":242,"../lang/isArray":290}],208:[function(e,n){function l(e,n,l){var o=u(e)?t:a;return("function"!=typeof n||"undefined"!=typeof l)&&(n=r(n,l,3)),o(e,n)}var t=e("../internal/arraySome"),r=e("../internal/baseCallback"),a=e("../internal/baseSome"),u=e("../lang/isArray");n.exports=l},{"../internal/arraySome":217,"../internal/baseCallback":220,"../internal/baseSome":244,"../lang/isArray":290}],209:[function(e,n){function l(e,n,l){var i=-1,c=e?e.length:0,p=s(c)?Array(c):[];return l&&o(e,n,l)&&(n=null),n=t(n,l,3),r(e,function(e,l,t){p[++i]={criteria:n(e,l,t),index:i,value:e}}),a(p,u)}var t=e("../internal/baseCallback"),r=e("../internal/baseEach"),a=e("../internal/baseSortBy"),u=e("../internal/compareAscending"),o=e("../internal/isIterateeCall"),s=e("../internal/isLength");n.exports=l},{"../internal/baseCallback":220,"../internal/baseEach":225,"../internal/baseSortBy":245,"../internal/compareAscending":253,"../internal/isIterateeCall":274,"../internal/isLength":275}],210:[function(e,n){var l=e("../lang/isNative"),t=l(t=Date.now)&&t,r=t||function(){return(new Date).getTime()};n.exports=r},{"../lang/isNative":294}],211:[function(e,n){function l(e,n,l){return l&&r(e,n,l)&&(n=null),n=e&&null==n?e.length:u(+n||0,0),t(e,a,null,null,null,null,n)}var t=e("../internal/createWrapper"),r=e("../internal/isIterateeCall"),a=256,u=Math.max;n.exports=l},{"../internal/createWrapper":263,"../internal/isIterateeCall":274}],212:[function(e,n){(function(l){function t(e){var n=e?e.length:0;for(this.data={hash:o(null),set:new u};n--;)this.push(e[n])}var r=e("./cachePush"),a=e("../lang/isNative"),u=a(u=l.Set)&&u,o=a(o=Object.create)&&o;t.prototype.push=r,n.exports=t}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../lang/isNative":294,"./cachePush":252}],213:[function(e,n){function l(e,n){var l=-1,t=e.length;for(n||(n=Array(t));++l<t;)n[l]=e[l];return n}n.exports=l},{}],214:[function(e,n){function l(e,n){for(var l=-1,t=e.length;++l<t&&n(e[l],l,e)!==!1;);return e}n.exports=l},{}],215:[function(e,n){function l(e,n){for(var l=-1,t=e.length,r=Array(t);++l<t;)r[l]=n(e[l],l,e);return r}n.exports=l},{}],216:[function(e,n){function l(e,n,l,t){var r=e.length;for(t&&r&&(l=e[--r]);r--;)l=n(l,e[r],r,e);return l}n.exports=l},{}],217:[function(e,n){function l(e,n){for(var l=-1,t=e.length;++l<t;)if(n(e[l],l,e))return!0;return!1}n.exports=l},{}],218:[function(e,n){function l(e,n){return"undefined"==typeof e?n:e}n.exports=l},{}],219:[function(e,n){function l(e,n,l){var a=r(n);if(!l)return t(n,e,a);for(var u=-1,o=a.length;++u<o;){var s=a[u],i=e[s],c=l(i,n[s],s,e,n);(c===c?c===i:i!==i)&&("undefined"!=typeof i||s in e)||(e[s]=c)}return e}var t=e("./baseCopy"),r=e("../object/keys");n.exports=l},{"../object/keys":305,"./baseCopy":223}],220:[function(e,n){function l(e,n,l){var i=typeof e;return"function"==i?"undefined"!=typeof n&&s(e)?u(e,n,l):e:null==e?o:"object"==i?t(e):"undefined"==typeof n?a(e+""):r(e+"",n)}var t=e("./baseMatches"),r=e("./baseMatchesProperty"),a=e("./baseProperty"),u=e("./bindCallback"),o=e("../utility/identity"),s=e("./isBindable");n.exports=l},{"../utility/identity":311,"./baseMatches":239,"./baseMatchesProperty":240,"./baseProperty":241,"./bindCallback":249,"./isBindable":272}],221:[function(e,n){function l(e,n,h,g,m,y,x){var b;if(h&&(b=m?h(e,g,m):h(e)),"undefined"!=typeof b)return b;if(!p(e))return e;var I=c(e);if(I){if(b=o(e),!n)return t(e,b)}else{var w=B.call(e),E=w==_;if(w!=v&&w!=f&&(!E||m))return D[w]?s(e,w,n):m?e:{};if(b=i(E?{}:e),!n)return a(e,b,d(e))}y||(y=[]),x||(x=[]);for(var k=y.length;k--;)if(y[k]==e)return x[k];return y.push(e),x.push(b),(I?r:u)(e,function(t,r){b[r]=l(t,n,h,r,e,y,x)}),b}var t=e("./arrayCopy"),r=e("./arrayEach"),a=e("./baseCopy"),u=e("./baseForOwn"),o=e("./initCloneArray"),s=e("./initCloneByTag"),i=e("./initCloneObject"),c=e("../lang/isArray"),p=e("../lang/isObject"),d=e("../object/keys"),f="[object Arguments]",h="[object Array]",g="[object Boolean]",m="[object Date]",y="[object Error]",_="[object Function]",x="[object Map]",b="[object Number]",v="[object Object]",I="[object RegExp]",w="[object Set]",E="[object String]",k="[object WeakMap]",R="[object ArrayBuffer]",S="[object Float32Array]",C="[object Float64Array]",A="[object Int8Array]",M="[object Int16Array]",j="[object Int32Array]",T="[object Uint8Array]",P="[object Uint8ClampedArray]",L="[object Uint16Array]",O="[object Uint32Array]",D={};D[f]=D[h]=D[R]=D[g]=D[m]=D[S]=D[C]=D[A]=D[M]=D[j]=D[b]=D[v]=D[I]=D[E]=D[T]=D[P]=D[L]=D[O]=!0,D[y]=D[_]=D[x]=D[w]=D[k]=!1;var F=Object.prototype,B=F.toString;n.exports=l},{"../lang/isArray":290,"../lang/isObject":296,"../object/keys":305,"./arrayCopy":213,"./arrayEach":214,"./baseCopy":223,"./baseForOwn":230,"./initCloneArray":269,"./initCloneByTag":270,"./initCloneObject":271}],222:[function(e,n){function l(e,n){if(e!==n){var l=e===e,t=n===n;if(e>n||!l||"undefined"==typeof e&&t)return 1;if(n>e||!t||"undefined"==typeof n&&l)return-1}return 0}n.exports=l},{}],223:[function(e,n){function l(e,n,l){l||(l=n,n={});for(var t=-1,r=l.length;++t<r;){var a=l[t];n[a]=e[a]}return n}n.exports=l},{}],224:[function(e,n){(function(l){var t=e("../lang/isObject"),r=function(){function e(){}return function(n){if(t(n)){e.prototype=n;var r=new e;e.prototype=null}return r||l.Object()}}();n.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../lang/isObject":296}],225:[function(e,n){function l(e,n){var l=e?e.length:0;if(!r(l))return t(e,n);for(var u=-1,o=a(e);++u<l&&n(o[u],u,o)!==!1;);return e}var t=e("./baseForOwn"),r=e("./isLength"),a=e("./toObject");n.exports=l},{"./baseForOwn":230,"./isLength":275,"./toObject":286}],226:[function(e,n){function l(e,n){var l=e?e.length:0;if(!r(l))return t(e,n);for(var u=a(e);l--&&n(u[l],l,u)!==!1;);return e}var t=e("./baseForOwnRight"),r=e("./isLength"),a=e("./toObject");n.exports=l},{"./baseForOwnRight":231,"./isLength":275,"./toObject":286}],227:[function(e,n){function l(e,n,o,s){for(var i=(s||0)-1,c=e.length,p=-1,d=[];++i<c;){var f=e[i];if(u(f)&&a(f.length)&&(r(f)||t(f))){n&&(f=l(f,n,o));var h=-1,g=f.length;for(d.length+=g;++h<g;)d[++p]=f[h]}else o||(d[++p]=f)}return d}var t=e("../lang/isArguments"),r=e("../lang/isArray"),a=e("./isLength"),u=e("./isObjectLike");n.exports=l},{"../lang/isArguments":289,"../lang/isArray":290,"./isLength":275,"./isObjectLike":276}],228:[function(e,n){function l(e,n,l){for(var r=-1,a=t(e),u=l(e),o=u.length;++r<o;){var s=u[r];if(n(a[s],s,a)===!1)break}return e}var t=e("./toObject");n.exports=l},{"./toObject":286}],229:[function(e,n){function l(e,n){return t(e,n,r)}var t=e("./baseFor"),r=e("../object/keysIn");n.exports=l},{"../object/keysIn":306,"./baseFor":228}],230:[function(e,n){function l(e,n){return t(e,n,r)}var t=e("./baseFor"),r=e("../object/keys");n.exports=l},{"../object/keys":305,"./baseFor":228}],231:[function(e,n){function l(e,n){return t(e,n,r)}var t=e("./baseForRight"),r=e("../object/keys");n.exports=l},{"../object/keys":305,"./baseForRight":232}],232:[function(e,n){function l(e,n,l){for(var r=t(e),a=l(e),u=a.length;u--;){var o=a[u];if(n(r[o],o,r)===!1)break}return e}var t=e("./toObject");n.exports=l},{"./toObject":286}],233:[function(e,n){function l(e,n,l){if(n!==n)return t(e,l);for(var r=(l||0)-1,a=e.length;++r<a;)if(e[r]===n)return r;return-1}var t=e("./indexOfNaN");n.exports=l},{"./indexOfNaN":268}],234:[function(e,n){function l(e,n,r,a,u,o){if(e===n)return 0!==e||1/e==1/n;var s=typeof e,i=typeof n;return"function"!=s&&"object"!=s&&"function"!=i&&"object"!=i||null==e||null==n?e!==e&&n!==n:t(e,n,l,r,a,u,o)}var t=e("./baseIsEqualDeep");n.exports=l},{"./baseIsEqualDeep":235}],235:[function(e,n){function l(e,n,l,p,h,g,m){var y=u(e),_=u(n),x=i,b=i;y||(x=f.call(e),x==s?x=c:x!=c&&(y=o(e))),_||(b=f.call(n),b==s?b=c:b!=c&&(_=o(n)));var v=x==c,I=b==c,w=x==b;if(w&&!y&&!v)return r(e,n,x);var E=v&&d.call(e,"__wrapped__"),k=I&&d.call(n,"__wrapped__");if(E||k)return l(E?e.value():e,k?n.value():n,p,h,g,m);if(!w)return!1;g||(g=[]),m||(m=[]);for(var R=g.length;R--;)if(g[R]==e)return m[R]==n;g.push(e),m.push(n);var S=(y?t:a)(e,n,l,p,h,g,m);return g.pop(),m.pop(),S}var t=e("./equalArrays"),r=e("./equalByTag"),a=e("./equalObjects"),u=e("../lang/isArray"),o=e("../lang/isTypedArray"),s="[object Arguments]",i="[object Array]",c="[object Object]",p=Object.prototype,d=p.hasOwnProperty,f=p.toString;n.exports=l},{"../lang/isArray":290,"../lang/isTypedArray":300,"./equalArrays":264,"./equalByTag":265,"./equalObjects":266}],236:[function(e,n){function l(e){return"function"==typeof e||!1}n.exports=l},{}],237:[function(e,n){function l(e,n,l,r,u){var o=n.length;if(null==e)return!o;for(var s=-1,i=!u;++s<o;)if(i&&r[s]?l[s]!==e[n[s]]:!a.call(e,n[s]))return!1;for(s=-1;++s<o;){var c=n[s];if(i&&r[s])var p=a.call(e,c);else{var d=e[c],f=l[s];p=u?u(d,f,c):void 0,"undefined"==typeof p&&(p=t(f,d,u,!0))}if(!p)return!1}return!0}var t=e("./baseIsEqual"),r=Object.prototype,a=r.hasOwnProperty;n.exports=l},{"./baseIsEqual":234}],238:[function(e,n){function l(e,n){var l=[];return t(e,function(e,t,r){l.push(n(e,t,r))}),l}var t=e("./baseEach");n.exports=l},{"./baseEach":225}],239:[function(e,n){function l(e){var n=a(e),l=n.length;if(1==l){var u=n[0],s=e[u];if(r(s))return function(e){return null!=e&&e[u]===s&&o.call(e,u)}}for(var i=Array(l),c=Array(l);l--;)s=e[n[l]],i[l]=s,c[l]=r(s);return function(e){return t(e,n,i,c)}}var t=e("./baseIsMatch"),r=e("./isStrictComparable"),a=e("../object/keys"),u=Object.prototype,o=u.hasOwnProperty;n.exports=l},{"../object/keys":305,"./baseIsMatch":237,"./isStrictComparable":277}],240:[function(e,n){function l(e,n){return r(n)?function(l){return null!=l&&l[e]===n}:function(l){return null!=l&&t(n,l[e],null,!0)}}var t=e("./baseIsEqual"),r=e("./isStrictComparable");n.exports=l},{"./baseIsEqual":234,"./isStrictComparable":277}],241:[function(e,n){function l(e){return function(n){return null==n?void 0:n[e]}}n.exports=l},{}],242:[function(e,n){function l(e,n,l,t,r){return r(e,function(e,r,a){l=t?(t=!1,e):n(l,e,r,a)}),l}n.exports=l},{}],243:[function(e,n){var l=e("../utility/identity"),t=e("./metaMap"),r=t?function(e,n){return t.set(e,n),e}:l;n.exports=r},{"../utility/identity":311,"./metaMap":279}],244:[function(e,n){function l(e,n){var l;return t(e,function(e,t,r){return l=n(e,t,r),!l}),!!l}var t=e("./baseEach");n.exports=l},{"./baseEach":225}],245:[function(e,n){function l(e,n){var l=e.length;for(e.sort(n);l--;)e[l]=e[l].value;return e}n.exports=l},{}],246:[function(e,n){function l(e){return"string"==typeof e?e:null==e?"":e+""}n.exports=l},{}],247:[function(e,n){function l(e,n){var l=-1,u=t,o=e.length,s=!0,i=s&&o>=200,c=i?a():null,p=[];c?(u=r,s=!1):(i=!1,c=n?[]:p);e:for(;++l<o;){var d=e[l],f=n?n(d,l,e):d;if(s&&d===d){for(var h=c.length;h--;)if(c[h]===f)continue e;n&&c.push(f),p.push(d)}else u(c,f)<0&&((n||i)&&c.push(f),p.push(d))}return p}var t=e("./baseIndexOf"),r=e("./cacheIndexOf"),a=e("./createCache");n.exports=l},{"./baseIndexOf":233,"./cacheIndexOf":251,"./createCache":259}],248:[function(e,n){function l(e,n){for(var l=-1,t=n.length,r=Array(t);++l<t;)r[l]=e[n[l]];return r}n.exports=l},{}],249:[function(e,n){function l(e,n,l){if("function"!=typeof e)return t;if("undefined"==typeof n)return e;switch(l){case 1:return function(l){return e.call(n,l)};case 3:return function(l,t,r){return e.call(n,l,t,r)};case 4:return function(l,t,r,a){return e.call(n,l,t,r,a)};case 5:return function(l,t,r,a,u){return e.call(n,l,t,r,a,u)}}return function(){return e.apply(n,arguments)}}var t=e("../utility/identity");n.exports=l},{"../utility/identity":311}],250:[function(e,n){(function(l){function t(e){return o.call(e,0)}var r=e("../utility/constant"),a=e("../lang/isNative"),u=a(u=l.ArrayBuffer)&&u,o=a(o=u&&new u(0).slice)&&o,s=Math.floor,i=a(i=l.Uint8Array)&&i,c=function(){try{var e=a(e=l.Float64Array)&&e,n=new e(new u(10),0,1)&&e}catch(t){}return n}(),p=c?c.BYTES_PER_ELEMENT:0;o||(t=u&&i?function(e){var n=e.byteLength,l=c?s(n/p):0,t=l*p,r=new u(n);if(l){var a=new c(r,0,l);a.set(new c(e,0,l))}return n!=t&&(a=new i(r,t),a.set(new i(e,t))),r}:r(null)),n.exports=t}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../lang/isNative":294,"../utility/constant":310}],251:[function(e,n){function l(e,n){var l=e.data,r="string"==typeof n||t(n)?l.set.has(n):l.hash[n];return r?0:-1}var t=e("../lang/isObject");n.exports=l},{"../lang/isObject":296}],252:[function(e,n){function l(e){var n=this.data;"string"==typeof e||t(e)?n.set.add(e):n.hash[e]=!0}var t=e("../lang/isObject");n.exports=l},{"../lang/isObject":296}],253:[function(e,n){function l(e,n){return t(e.criteria,n.criteria)||e.index-n.index}var t=e("./baseCompareAscending");n.exports=l},{"./baseCompareAscending":222}],254:[function(e,n){function l(e,n,l){for(var r=l.length,a=-1,u=t(e.length-r,0),o=-1,s=n.length,i=Array(u+s);++o<s;)i[o]=n[o];for(;++a<r;)i[l[a]]=e[a];for(;u--;)i[o++]=e[a++];return i}var t=Math.max;n.exports=l},{}],255:[function(e,n){function l(e,n,l){for(var r=-1,a=l.length,u=-1,o=t(e.length-a,0),s=-1,i=n.length,c=Array(o+i);++u<o;)c[u]=e[u];for(var p=u;++s<i;)c[p+s]=n[s];for(;++r<a;)c[p+l[r]]=e[u++];return c}var t=Math.max;n.exports=l},{}],256:[function(e,n){function l(e,n){return function(l,u,o){var s=n?n():{};if(u=t(u,o,3),a(l))for(var i=-1,c=l.length;++i<c;){var p=l[i];e(s,p,u(p,i,l),l)}else r(l,function(n,l,t){e(s,n,u(n,l,t),t)});return s}}var t=e("./baseCallback"),r=e("./baseEach"),a=e("../lang/isArray");n.exports=l},{"../lang/isArray":290,"./baseCallback":220,"./baseEach":225}],257:[function(e,n){function l(e){return function(){var n=arguments.length,l=arguments[0];if(2>n||null==l)return l;if(n>3&&r(arguments[1],arguments[2],arguments[3])&&(n=2),n>3&&"function"==typeof arguments[n-2])var a=t(arguments[--n-1],arguments[n--],5);else n>2&&"function"==typeof arguments[n-1]&&(a=arguments[--n]);for(var u=0;++u<n;){var o=arguments[u];o&&e(l,o,a)}return l}}var t=e("./bindCallback"),r=e("./isIterateeCall");n.exports=l},{"./bindCallback":249,"./isIterateeCall":274}],258:[function(e,n){function l(e,n){function l(){return(this instanceof l?r:e).apply(n,arguments)}var r=t(e);return l}var t=e("./createCtorWrapper");n.exports=l},{"./createCtorWrapper":260}],259:[function(e,n){(function(l){var t=e("./SetCache"),r=e("../utility/constant"),a=e("../lang/isNative"),u=a(u=l.Set)&&u,o=a(o=Object.create)&&o,s=o&&u?function(e){return new t(e)}:r(null);n.exports=s}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../lang/isNative":294,"../utility/constant":310,"./SetCache":212}],260:[function(e,n){function l(e){return function(){var n=t(e.prototype),l=e.apply(n,arguments);return r(l)?l:n}}var t=e("./baseCreate"),r=e("../lang/isObject");n.exports=l},{"../lang/isObject":296,"./baseCreate":224}],261:[function(e,n){function l(e,n,_,x,b,v,I,w,E,k){function R(){for(var p=arguments.length,d=p,f=Array(p);d--;)f[d]=arguments[d];if(x&&(f=r(f,x,b)),v&&(f=a(f,v,I)),M||T){var m=R.placeholder,O=s(f,m);if(p-=O.length,k>p){var D=w?t(w):null,F=y(k-p,0),B=M?O:null,N=M?null:O,V=M?f:null,U=M?null:f;n|=M?h:g,n&=~(M?g:h),j||(n&=~(i|c));var q=l(e,n,_,V,B,U,N,D,E,F);return q.placeholder=m,q}}var G=C?_:this;return A&&(e=G[L]),w&&(f=o(f,w)),S&&E<f.length&&(f.length=E),(this instanceof R?P||u(e):e).apply(G,f)}var S=n&m,C=n&i,A=n&c,M=n&d,j=n&p,T=n&f,P=!A&&u(e),L=e;return R}var t=e("./arrayCopy"),r=e("./composeArgs"),a=e("./composeArgsRight"),u=e("./createCtorWrapper"),o=e("./reorder"),s=e("./replaceHolders"),i=1,c=2,p=4,d=8,f=16,h=32,g=64,m=256,y=Math.max;n.exports=l},{"./arrayCopy":213,"./composeArgs":254,"./composeArgsRight":255,"./createCtorWrapper":260,"./reorder":280,"./replaceHolders":281}],262:[function(e,n){function l(e,n,l,a){function u(){for(var n=-1,t=arguments.length,r=-1,i=a.length,c=Array(t+i);++r<i;)c[r]=a[r];for(;t--;)c[r++]=arguments[++n];return(this instanceof u?s:e).apply(o?l:this,c)}var o=n&r,s=t(e);return u}var t=e("./createCtorWrapper"),r=1;n.exports=l},{"./createCtorWrapper":260}],263:[function(e,n){function l(e,n,l,m,y,_,x,b){var v=n&p;if(!v&&"function"!=typeof e)throw new TypeError(h);var I=m?m.length:0;if(I||(n&=~(d|f),m=y=null),I-=y?y.length:0,n&f){var w=m,E=y;m=y=null}var k=!v&&o(e),R=[e,n,l,m,y,w,E,_,x,b];if(k&&k!==!0&&(s(R,k),n=R[1],b=R[9]),R[9]=null==b?v?0:e.length:g(b-I,0)||0,n==c)var S=r(R[0],R[2]);else S=n!=d&&n!=(c|d)||R[4].length?a.apply(void 0,R):u.apply(void 0,R);var C=k?t:i;return C(S,R)}var t=e("./baseSetData"),r=e("./createBindWrapper"),a=e("./createHybridWrapper"),u=e("./createPartialWrapper"),o=e("./getData"),s=e("./mergeData"),i=e("./setData"),c=1,p=2,d=32,f=64,h="Expected a function",g=Math.max;n.exports=l},{"./baseSetData":243,"./createBindWrapper":258,"./createHybridWrapper":261,"./createPartialWrapper":262,"./getData":267,"./mergeData":278,"./setData":282}],264:[function(e,n){function l(e,n,l,t,r,a,u){var o=-1,s=e.length,i=n.length,c=!0;if(s!=i&&!(r&&i>s))return!1;for(;c&&++o<s;){var p=e[o],d=n[o];if(c=void 0,t&&(c=r?t(d,p,o):t(p,d,o)),"undefined"==typeof c)if(r)for(var f=i;f--&&(d=n[f],!(c=p&&p===d||l(p,d,t,r,a,u))););else c=p&&p===d||l(p,d,t,r,a,u)}return!!c}n.exports=l},{}],265:[function(e,n){function l(e,n,l){switch(l){case t:case r:return+e==+n;case a:return e.name==n.name&&e.message==n.message;case u:return e!=+e?n!=+n:0==e?1/e==1/n:e==+n;case o:case s:return e==n+""}return!1}var t="[object Boolean]",r="[object Date]",a="[object Error]",u="[object Number]",o="[object RegExp]",s="[object String]";n.exports=l},{}],266:[function(e,n){function l(e,n,l,r,u,o,s){var i=t(e),c=i.length,p=t(n),d=p.length;if(c!=d&&!u)return!1;for(var f,h=-1;++h<c;){var g=i[h],m=a.call(n,g);if(m){var y=e[g],_=n[g];m=void 0,r&&(m=u?r(_,y,g):r(y,_,g)),"undefined"==typeof m&&(m=y&&y===_||l(y,_,r,u,o,s))}if(!m)return!1;f||(f="constructor"==g)}if(!f){var x=e.constructor,b=n.constructor;if(x!=b&&"constructor"in e&&"constructor"in n&&!("function"==typeof x&&x instanceof x&&"function"==typeof b&&b instanceof b))return!1}return!0}var t=e("../object/keys"),r=Object.prototype,a=r.hasOwnProperty;n.exports=l},{"../object/keys":305}],267:[function(e,n){var l=e("./metaMap"),t=e("../utility/noop"),r=l?function(e){return l.get(e)}:t;n.exports=r},{"../utility/noop":312,"./metaMap":279}],268:[function(e,n){function l(e,n,l){for(var t=e.length,r=l?n||t:(n||0)-1;l?r--:++r<t;){var a=e[r];if(a!==a)return r}return-1}n.exports=l},{}],269:[function(e,n){function l(e){var n=e.length,l=new e.constructor(n);return n&&"string"==typeof e[0]&&r.call(e,"index")&&(l.index=e.index,l.input=e.input),l}var t=Object.prototype,r=t.hasOwnProperty;n.exports=l},{}],270:[function(e,n){function l(e,n,l){var b=e.constructor;switch(n){case i:return t(e);case r:case a:return new b(+e);case c:case p:case d:case f:case h:case g:case m:case y:case _:var v=e.buffer;return new b(l?t(v):v,e.byteOffset,e.length);case u:case s:return new b(e);case o:var I=new b(e.source,x.exec(e));I.lastIndex=e.lastIndex}return I}var t=e("./bufferClone"),r="[object Boolean]",a="[object Date]",u="[object Number]",o="[object RegExp]",s="[object String]",i="[object ArrayBuffer]",c="[object Float32Array]",p="[object Float64Array]",d="[object Int8Array]",f="[object Int16Array]",h="[object Int32Array]",g="[object Uint8Array]",m="[object Uint8ClampedArray]",y="[object Uint16Array]",_="[object Uint32Array]",x=/\w*$/;n.exports=l},{"./bufferClone":250}],271:[function(e,n){function l(e){var n=e.constructor;return"function"==typeof n&&n instanceof n||(n=Object),new n}n.exports=l},{}],272:[function(e,n){function l(e){var n=!(a.funcNames?e.name:a.funcDecomp);if(!n){var l=s.call(e);a.funcNames||(n=!u.test(l)),n||(n=o.test(l)||r(e),t(e,n))}return n}var t=e("./baseSetData"),r=e("../lang/isNative"),a=e("../support"),u=/^\s*function[ \n\r\t]+\w/,o=/\bthis\b/,s=Function.prototype.toString;n.exports=l},{"../lang/isNative":294,"../support":309,"./baseSetData":243}],273:[function(e,n){function l(e,n){return e=+e,n=null==n?t:n,e>-1&&e%1==0&&n>e}var t=Math.pow(2,53)-1;n.exports=l},{}],274:[function(e,n){function l(e,n,l){if(!a(l))return!1;var u=typeof n;if("number"==u)var o=l.length,s=r(o)&&t(n,o);else s="string"==u&&n in l;if(s){var i=l[n];return e===e?e===i:i!==i}return!1}var t=e("./isIndex"),r=e("./isLength"),a=e("../lang/isObject");n.exports=l},{"../lang/isObject":296,"./isIndex":273,"./isLength":275}],275:[function(e,n){function l(e){return"number"==typeof e&&e>-1&&e%1==0&&t>=e}var t=Math.pow(2,53)-1;n.exports=l},{}],276:[function(e,n){function l(e){return e&&"object"==typeof e||!1}n.exports=l},{}],277:[function(e,n){function l(e){return e===e&&(0===e?1/e>0:!t(e))}var t=e("../lang/isObject");n.exports=l},{"../lang/isObject":296}],278:[function(e,n){function l(e,n){var l=e[1],g=n[1],m=l|g,y=d|p,_=o|s,x=y|_|i|c,b=l&d&&!(g&d),v=l&p&&!(g&p),I=(v?e:n)[7],w=(b?e:n)[8],E=!(l>=p&&g>_||l>_&&g>=p),k=m>=y&&x>=m&&(p>l||(v||b)&&I.length<=w);if(!E&&!k)return e;g&o&&(e[2]=n[2],m|=l&o?0:i);var R=n[3];if(R){var S=e[3];e[3]=S?r(S,R,n[4]):t(R),e[4]=S?u(e[3],f):t(n[4])}return R=n[5],R&&(S=e[5],e[5]=S?a(S,R,n[6]):t(R),e[6]=S?u(e[5],f):t(n[6])),R=n[7],R&&(e[7]=t(R)),g&d&&(e[8]=null==e[8]?n[8]:h(e[8],n[8])),null==e[9]&&(e[9]=n[9]),e[0]=n[0],e[1]=m,e}var t=e("./arrayCopy"),r=e("./composeArgs"),a=e("./composeArgsRight"),u=e("./replaceHolders"),o=1,s=2,i=4,c=16,p=128,d=256,f="__lodash_placeholder__",h=Math.min;n.exports=l},{"./arrayCopy":213,"./composeArgs":254,"./composeArgsRight":255,"./replaceHolders":281}],279:[function(e,n){(function(l){var t=e("../lang/isNative"),r=t(r=l.WeakMap)&&r,a=r&&new r;n.exports=a}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../lang/isNative":294}],280:[function(e,n){function l(e,n){for(var l=e.length,u=a(n.length,l),o=t(e);u--;){var s=n[u];e[u]=r(s,l)?o[s]:void 0}return e}var t=e("./arrayCopy"),r=e("./isIndex"),a=Math.min;n.exports=l},{"./arrayCopy":213,"./isIndex":273}],281:[function(e,n){function l(e,n){for(var l=-1,r=e.length,a=-1,u=[];++l<r;)e[l]===n&&(e[l]=t,u[++a]=l);return u}var t="__lodash_placeholder__";n.exports=l},{}],282:[function(e,n){var l=e("./baseSetData"),t=e("../date/now"),r=150,a=16,u=function(){var e=0,n=0;return function(u,o){var s=t(),i=a-(s-n);if(n=s,i>0){if(++e>=r)return u}else e=0;return l(u,o)}}();n.exports=u},{"../date/now":210,"./baseSetData":243}],283:[function(e,n){function l(e){var n;if(!r(e)||s.call(e)!=a||!o.call(e,"constructor")&&(n=e.constructor,"function"==typeof n&&!(n instanceof n)))return!1;var l;return t(e,function(e,n){l=n}),"undefined"==typeof l||o.call(e,l)}var t=e("./baseForIn"),r=e("./isObjectLike"),a="[object Object]",u=Object.prototype,o=u.hasOwnProperty,s=u.toString;n.exports=l},{"./baseForIn":229,"./isObjectLike":276}],284:[function(e,n){function l(e){for(var n=o(e),l=n.length,i=l&&e.length,p=i&&u(i)&&(r(e)||s.nonEnumArgs&&t(e)),d=-1,f=[];++d<l;){var h=n[d];(p&&a(h,i)||c.call(e,h))&&f.push(h)}return f}var t=e("../lang/isArguments"),r=e("../lang/isArray"),a=e("./isIndex"),u=e("./isLength"),o=e("../object/keysIn"),s=e("../support"),i=Object.prototype,c=i.hasOwnProperty;n.exports=l},{"../lang/isArguments":289,"../lang/isArray":290,"../object/keysIn":306,"../support":309,"./isIndex":273,"./isLength":275}],285:[function(e,n){function l(e,n){for(var l,t=-1,r=e.length,a=-1,u=[];++t<r;){var o=e[t],s=n?n(o,t,e):o;t&&l===s||(l=s,u[++a]=o)}return u}n.exports=l},{}],286:[function(e,n){function l(e){return t(e)?e:Object(e)}var t=e("../lang/isObject");n.exports=l},{"../lang/isObject":296}],287:[function(e,n){function l(e,n,l,u){return n&&"boolean"!=typeof n&&a(e,n,l)?n=!1:"function"==typeof n&&(u=l,l=n,n=!1),l="function"==typeof l&&r(l,u,1),t(e,n,l)}var t=e("../internal/baseClone"),r=e("../internal/bindCallback"),a=e("../internal/isIterateeCall");n.exports=l},{"../internal/baseClone":221,"../internal/bindCallback":249,"../internal/isIterateeCall":274}],288:[function(e,n){function l(e,n,l){return n="function"==typeof n&&r(n,l,1),t(e,!0,n)}var t=e("../internal/baseClone"),r=e("../internal/bindCallback");n.exports=l},{"../internal/baseClone":221,"../internal/bindCallback":249}],289:[function(e,n){function l(e){var n=r(e)?e.length:void 0;return t(n)&&o.call(e)==a||!1}var t=e("../internal/isLength"),r=e("../internal/isObjectLike"),a="[object Arguments]",u=Object.prototype,o=u.toString;n.exports=l},{"../internal/isLength":275,"../internal/isObjectLike":276}],290:[function(e,n){var l=e("../internal/isLength"),t=e("./isNative"),r=e("../internal/isObjectLike"),a="[object Array]",u=Object.prototype,o=u.toString,s=t(s=Array.isArray)&&s,i=s||function(e){return r(e)&&l(e.length)&&o.call(e)==a||!1};n.exports=i},{"../internal/isLength":275,"../internal/isObjectLike":276,"./isNative":294}],291:[function(e,n){function l(e){return e===!0||e===!1||t(e)&&u.call(e)==r||!1}var t=e("../internal/isObjectLike"),r="[object Boolean]",a=Object.prototype,u=a.toString;n.exports=l},{"../internal/isObjectLike":276}],292:[function(e,n){function l(e){if(null==e)return!0;var n=e.length;return u(n)&&(r(e)||s(e)||t(e)||o(e)&&a(e.splice))?!n:!i(e).length}var t=e("./isArguments"),r=e("./isArray"),a=e("./isFunction"),u=e("../internal/isLength"),o=e("../internal/isObjectLike"),s=e("./isString"),i=e("../object/keys");n.exports=l},{"../internal/isLength":275,"../internal/isObjectLike":276,"../object/keys":305,"./isArguments":289,"./isArray":290,"./isFunction":293,"./isString":299}],293:[function(e,n){(function(l){var t=e("../internal/baseIsFunction"),r=e("./isNative"),a="[object Function]",u=Object.prototype,o=u.toString,s=r(s=l.Uint8Array)&&s,i=t(/x/)||s&&!t(s)?function(e){return o.call(e)==a}:t;n.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../internal/baseIsFunction":236,"./isNative":294}],294:[function(e,n){function l(e){return null==e?!1:i.call(e)==a?c.test(s.call(e)):r(e)&&u.test(e)||!1}var t=e("../string/escapeRegExp"),r=e("../internal/isObjectLike"),a="[object Function]",u=/^\[object .+?Constructor\]$/,o=Object.prototype,s=Function.prototype.toString,i=o.toString,c=RegExp("^"+t(i).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");n.exports=l},{"../internal/isObjectLike":276,"../string/escapeRegExp":308}],295:[function(e,n){function l(e){return"number"==typeof e||t(e)&&u.call(e)==r||!1}var t=e("../internal/isObjectLike"),r="[object Number]",a=Object.prototype,u=a.toString;n.exports=l},{"../internal/isObjectLike":276}],296:[function(e,n){function l(e){var n=typeof e;return"function"==n||e&&"object"==n||!1}n.exports=l},{}],297:[function(e,n){var l=e("./isNative"),t=e("../internal/shimIsPlainObject"),r="[object Object]",a=Object.prototype,u=a.toString,o=l(o=Object.getPrototypeOf)&&o,s=o?function(e){if(!e||u.call(e)!=r)return!1;var n=e.valueOf,a=l(n)&&(a=o(n))&&o(a);return a?e==a||o(e)==a:t(e)}:t;n.exports=s},{"../internal/shimIsPlainObject":283,"./isNative":294}],298:[function(e,n){function l(e){return t(e)&&u.call(e)==r||!1}var t=e("../internal/isObjectLike"),r="[object RegExp]",a=Object.prototype,u=a.toString;n.exports=l},{"../internal/isObjectLike":276}],299:[function(e,n){function l(e){return"string"==typeof e||t(e)&&u.call(e)==r||!1}var t=e("../internal/isObjectLike"),r="[object String]",a=Object.prototype,u=a.toString;n.exports=l},{"../internal/isObjectLike":276}],300:[function(e,n){function l(e){return r(e)&&t(e.length)&&C[M.call(e)]||!1}var t=e("../internal/isLength"),r=e("../internal/isObjectLike"),a="[object Arguments]",u="[object Array]",o="[object Boolean]",s="[object Date]",i="[object Error]",c="[object Function]",p="[object Map]",d="[object Number]",f="[object Object]",h="[object RegExp]",g="[object Set]",m="[object String]",y="[object WeakMap]",_="[object ArrayBuffer]",x="[object Float32Array]",b="[object Float64Array]",v="[object Int8Array]",I="[object Int16Array]",w="[object Int32Array]",E="[object Uint8Array]",k="[object Uint8ClampedArray]",R="[object Uint16Array]",S="[object Uint32Array]",C={};C[x]=C[b]=C[v]=C[I]=C[w]=C[E]=C[k]=C[R]=C[S]=!0,C[a]=C[u]=C[_]=C[o]=C[s]=C[i]=C[c]=C[p]=C[d]=C[f]=C[h]=C[g]=C[m]=C[y]=!1;var A=Object.prototype,M=A.toString;n.exports=l},{"../internal/isLength":275,"../internal/isObjectLike":276}],301:[function(e,n){var l=e("../internal/baseAssign"),t=e("../internal/createAssigner"),r=t(l);n.exports=r},{"../internal/baseAssign":219,"../internal/createAssigner":257}],302:[function(e,n){function l(e){if(null==e)return e;var n=t(arguments);return n.push(a),r.apply(void 0,n)}var t=e("../internal/arrayCopy"),r=e("./assign"),a=e("../internal/assignDefaults");n.exports=l},{"../internal/arrayCopy":213,"../internal/assignDefaults":218,"./assign":301}],303:[function(e,n){n.exports=e("./assign")},{"./assign":301}],304:[function(e,n){function l(e,n){return e?r.call(e,n):!1}var t=Object.prototype,r=t.hasOwnProperty;n.exports=l},{}],305:[function(e,n){var l=e("../internal/isLength"),t=e("../lang/isNative"),r=e("../lang/isObject"),a=e("../internal/shimKeys"),u=t(u=Object.keys)&&u,o=u?function(e){if(e)var n=e.constructor,t=e.length;return"function"==typeof n&&n.prototype===e||"function"!=typeof e&&t&&l(t)?a(e):r(e)?u(e):[]}:a;n.exports=o},{"../internal/isLength":275,"../internal/shimKeys":284,"../lang/isNative":294,"../lang/isObject":296}],306:[function(e,n){function l(e){if(null==e)return[]; o(e)||(e=Object(e));var n=e.length;n=n&&u(n)&&(r(e)||s.nonEnumArgs&&t(e))&&n||0;for(var l=e.constructor,i=-1,p="function"==typeof l&&l.prototype===e,d=Array(n),f=n>0;++i<n;)d[i]=i+"";for(var h in e)f&&a(h,n)||"constructor"==h&&(p||!c.call(e,h))||d.push(h);return d}var t=e("../lang/isArguments"),r=e("../lang/isArray"),a=e("../internal/isIndex"),u=e("../internal/isLength"),o=e("../lang/isObject"),s=e("../support"),i=Object.prototype,c=i.hasOwnProperty;n.exports=l},{"../internal/isIndex":273,"../internal/isLength":275,"../lang/isArguments":289,"../lang/isArray":290,"../lang/isObject":296,"../support":309}],307:[function(e,n){function l(e){return t(e,r(e))}var t=e("../internal/baseValues"),r=e("./keys");n.exports=l},{"../internal/baseValues":248,"./keys":305}],308:[function(e,n){function l(e){return e=t(e),e&&a.test(e)?e.replace(r,"\\$&"):e}var t=e("../internal/baseToString"),r=/[.*+?^${}()|[\]\/\\]/g,a=RegExp(r.source);n.exports=l},{"../internal/baseToString":246}],309:[function(e,n){(function(l){var t=e("./lang/isNative"),r=/\bthis\b/,a=Object.prototype,u=(u=l.window)&&u.document,o=a.propertyIsEnumerable,s={};!function(){s.funcDecomp=!t(l.WinRTError)&&r.test(function(){return this}),s.funcNames="string"==typeof Function.name;try{s.dom=11===u.createDocumentFragment().nodeType}catch(e){s.dom=!1}try{s.nonEnumArgs=!o.call(arguments,1)}catch(e){s.nonEnumArgs=!0}}(0,0),n.exports=s}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./lang/isNative":294}],310:[function(e,n){function l(e){return function(){return e}}n.exports=l},{}],311:[function(e,n){function l(e){return e}n.exports=l},{}],312:[function(e,n){function l(){}n.exports=l},{}],313:[function(e,n,l){"use strict";function t(e,n,l){if(p)try{p.call(c,e,n,{value:l})}catch(t){e[n]=l}else e[n]=l}function r(e){return e&&(t(e,"call",e.call),t(e,"apply",e.apply)),e}function a(e){return d?d.call(c,e):(m.prototype=e||null,new m)}function u(){do var e=o(g.call(h.call(y(),36),2));while(f.call(_,e));return _[e]=e}function o(e){var n={};return n[e]=!0,Object.keys(n)[0]}function s(){return a(null)}function i(e){function n(n){function l(l,t){return l===o?t?a=null:a||(a=e(n)):void 0}var a;t(n,r,l)}function l(e){return f.call(e,r)||n(e),e[r](o)}var r=u(),o=a(null);return e=e||s,l.forget=function(e){f.call(e,r)&&e[r](o,!0)},l}var c=Object,p=Object.defineProperty,d=Object.create;r(p),r(d);var f=r(Object.prototype.hasOwnProperty),h=r(Number.prototype.toString),g=r(String.prototype.slice),m=function(){},y=Math.random,_=a(null);t(l,"makeUniqueKey",u);var x=Object.getOwnPropertyNames;Object.getOwnPropertyNames=function(e){for(var n=x(e),l=0,t=0,r=n.length;r>l;++l)f.call(_,n[l])||(l>t&&(n[t]=n[l]),++t);return n.length=t,n},t(l,"makeAccessor",i)},{}],314:[function(e,n,l){function t(e){s.ok(this instanceof t),p.Identifier.assert(e),Object.defineProperties(this,{contextId:{value:e},listing:{value:[]},marked:{value:[!0]},finalLoc:{value:r()},tryEntries:{value:[]}}),Object.defineProperties(this,{leapManager:{value:new d.LeapManager(this)}})}function r(){return c.literal(-1)}function a(e){return p.BreakStatement.check(e)||p.ContinueStatement.check(e)||p.ReturnStatement.check(e)||p.ThrowStatement.check(e)}function u(e){return new Error("all declarations should have been transformed into assignments before the Exploder began its work: "+JSON.stringify(e))}function o(e){var n=e.type;return"normal"===n?!g.call(e,"target"):"break"===n||"continue"===n?!g.call(e,"value")&&p.Literal.check(e.target):"return"===n||"throw"===n?g.call(e,"value")&&!g.call(e,"target"):!1}var s=e("assert"),i=e("ast-types"),c=(i.builtInTypes.array,i.builders),p=i.namedTypes,d=e("./leap"),f=e("./meta"),h=e("./util"),g=Object.prototype.hasOwnProperty,m=t.prototype;l.Emitter=t,m.mark=function(e){p.Literal.assert(e);var n=this.listing.length;return-1===e.value?e.value=n:s.strictEqual(e.value,n),this.marked[n]=!0,e},m.emit=function(e){p.Expression.check(e)&&(e=c.expressionStatement(e)),p.Statement.assert(e),this.listing.push(e)},m.emitAssign=function(e,n){return this.emit(this.assign(e,n)),e},m.assign=function(e,n){return c.expressionStatement(c.assignmentExpression("=",e,n))},m.contextProperty=function(e,n){return c.memberExpression(this.contextId,n?c.literal(e):c.identifier(e),!!n)};var y={prev:!0,next:!0,sent:!0,rval:!0};m.isVolatileContextProperty=function(e){if(p.MemberExpression.check(e)){if(e.computed)return!0;if(p.Identifier.check(e.object)&&p.Identifier.check(e.property)&&e.object.name===this.contextId.name&&g.call(y,e.property.name))return!0}return!1},m.stop=function(e){e&&this.setReturnValue(e),this.jump(this.finalLoc)},m.setReturnValue=function(e){p.Expression.assert(e.value),this.emitAssign(this.contextProperty("rval"),this.explodeExpression(e))},m.clearPendingException=function(e,n){p.Literal.assert(e);var l=c.callExpression(this.contextProperty("catch",!0),[e]);n?this.emitAssign(n,l):this.emit(l)},m.jump=function(e){this.emitAssign(this.contextProperty("next"),e),this.emit(c.breakStatement())},m.jumpIf=function(e,n){p.Expression.assert(e),p.Literal.assert(n),this.emit(c.ifStatement(e,c.blockStatement([this.assign(this.contextProperty("next"),n),c.breakStatement()])))},m.jumpIfNot=function(e,n){p.Expression.assert(e),p.Literal.assert(n);var l;l=p.UnaryExpression.check(e)&&"!"===e.operator?e.argument:c.unaryExpression("!",e),this.emit(c.ifStatement(l,c.blockStatement([this.assign(this.contextProperty("next"),n),c.breakStatement()])))};var _=0;m.makeTempVar=function(){return this.contextProperty("t"+_++)},m.getContextFunction=function(e){var n=c.functionExpression(e||null,[this.contextId],c.blockStatement([this.getDispatchLoop()]),!1,!1);return n._aliasFunction=!0,n},m.getDispatchLoop=function(){var e,n=this,l=[],t=!1;return n.listing.forEach(function(r,u){n.marked.hasOwnProperty(u)&&(l.push(c.switchCase(c.literal(u),e=[])),t=!1),t||(e.push(r),a(r)&&(t=!0))}),this.finalLoc.value=this.listing.length,l.push(c.switchCase(this.finalLoc,[]),c.switchCase(c.literal("end"),[c.returnStatement(c.callExpression(this.contextProperty("stop"),[]))])),c.whileStatement(c.literal(1),c.switchStatement(c.assignmentExpression("=",this.contextProperty("prev"),this.contextProperty("next")),l))},m.getTryLocsList=function(){if(0===this.tryEntries.length)return null;var e=0;return c.arrayExpression(this.tryEntries.map(function(n){var l=n.firstLoc.value;s.ok(l>=e,"try entries out of order"),e=l;var t=n.catchEntry,r=n.finallyEntry,a=[n.firstLoc,t?t.firstLoc:null];return r&&(a[2]=r.firstLoc,a[3]=r.afterLoc),c.arrayExpression(a)}))},m.explode=function(e,n){s.ok(e instanceof i.NodePath);var l=e.value,t=this;if(p.Node.assert(l),p.Statement.check(l))return t.explodeStatement(e);if(p.Expression.check(l))return t.explodeExpression(e,n);if(p.Declaration.check(l))throw u(l);switch(l.type){case"Program":return e.get("body").map(t.explodeStatement,t);case"VariableDeclarator":throw u(l);case"Property":case"SwitchCase":case"CatchClause":throw new Error(l.type+" nodes should be handled by their parents");default:throw new Error("unknown Node of type "+JSON.stringify(l.type))}},m.explodeStatement=function(e,n){s.ok(e instanceof i.NodePath);var l=e.value,t=this;if(p.Statement.assert(l),n?p.Identifier.assert(n):n=null,p.BlockStatement.check(l))return e.get("body").each(t.explodeStatement,t);if(!f.containsLeap(l))return void t.emit(l);switch(l.type){case"ExpressionStatement":t.explodeExpression(e.get("expression"),!0);break;case"LabeledStatement":var a=r();t.leapManager.withEntry(new d.LabeledEntry(a,l.label),function(){t.explodeStatement(e.get("body"),l.label)}),t.mark(a);break;case"WhileStatement":var u=r(),a=r();t.mark(u),t.jumpIfNot(t.explodeExpression(e.get("test")),a),t.leapManager.withEntry(new d.LoopEntry(a,u,n),function(){t.explodeStatement(e.get("body"))}),t.jump(u),t.mark(a);break;case"DoWhileStatement":var o=r(),g=r(),a=r();t.mark(o),t.leapManager.withEntry(new d.LoopEntry(a,g,n),function(){t.explode(e.get("body"))}),t.mark(g),t.jumpIf(t.explodeExpression(e.get("test")),o),t.mark(a);break;case"ForStatement":var m=r(),y=r(),a=r();l.init&&t.explode(e.get("init"),!0),t.mark(m),l.test&&t.jumpIfNot(t.explodeExpression(e.get("test")),a),t.leapManager.withEntry(new d.LoopEntry(a,y,n),function(){t.explodeStatement(e.get("body"))}),t.mark(y),l.update&&t.explode(e.get("update"),!0),t.jump(m),t.mark(a);break;case"ForInStatement":p.Identifier.assert(l.left);var m=r(),a=r(),_=t.makeTempVar();t.emitAssign(_,c.callExpression(h.runtimeProperty("keys"),[t.explodeExpression(e.get("right"))])),t.mark(m);var x=t.makeTempVar();t.jumpIf(c.memberExpression(c.assignmentExpression("=",x,c.callExpression(_,[])),c.identifier("done"),!1),a),t.emitAssign(l.left,c.memberExpression(x,c.identifier("value"),!1)),t.leapManager.withEntry(new d.LoopEntry(a,m,n),function(){t.explodeStatement(e.get("body"))}),t.jump(m),t.mark(a);break;case"BreakStatement":t.emitAbruptCompletion({type:"break",target:t.leapManager.getBreakLoc(l.label)});break;case"ContinueStatement":t.emitAbruptCompletion({type:"continue",target:t.leapManager.getContinueLoc(l.label)});break;case"SwitchStatement":for(var b=t.emitAssign(t.makeTempVar(),t.explodeExpression(e.get("discriminant"))),a=r(),v=r(),I=v,w=[],E=l.cases||[],k=E.length-1;k>=0;--k){var R=E[k];p.SwitchCase.assert(R),R.test?I=c.conditionalExpression(c.binaryExpression("===",b,R.test),w[k]=r(),I):w[k]=v}t.jump(t.explodeExpression(new i.NodePath(I,e,"discriminant"))),t.leapManager.withEntry(new d.SwitchEntry(a),function(){e.get("cases").each(function(e){var n=(e.value,e.name);t.mark(w[n]),e.get("consequent").each(t.explodeStatement,t)})}),t.mark(a),-1===v.value&&(t.mark(v),s.strictEqual(a.value,v.value));break;case"IfStatement":var S=l.alternate&&r(),a=r();t.jumpIfNot(t.explodeExpression(e.get("test")),S||a),t.explodeStatement(e.get("consequent")),S&&(t.jump(a),t.mark(S),t.explodeStatement(e.get("alternate"))),t.mark(a);break;case"ReturnStatement":t.emitAbruptCompletion({type:"return",value:t.explodeExpression(e.get("argument"))});break;case"WithStatement":throw new Error(node.type+" not supported in generator functions.");case"TryStatement":var a=r(),C=l.handler;!C&&l.handlers&&(C=l.handlers[0]||null);var A=C&&r(),M=A&&new d.CatchEntry(A,C.param),j=l.finalizer&&r(),T=j&&new d.FinallyEntry(j,a),P=new d.TryEntry(t.getUnmarkedCurrentLoc(),M,T);t.tryEntries.push(P),t.updateContextPrevLoc(P.firstLoc),t.leapManager.withEntry(P,function(){if(t.explodeStatement(e.get("block")),A){t.jump(j?j:a),t.updateContextPrevLoc(t.mark(A));var n=e.get("handler","body"),l=t.makeTempVar();t.clearPendingException(P.firstLoc,l);var r=n.scope,u=C.param.name;p.CatchClause.assert(r.node),s.strictEqual(r.lookup(u),r),i.visit(n,{visitIdentifier:function(e){return h.isReference(e,u)&&e.scope.lookup(u)===r?l:void this.traverse(e)},visitFunction:function(e){return e.scope.declares(u)?!1:void this.traverse(e)}}),t.leapManager.withEntry(M,function(){t.explodeStatement(n)})}j&&(t.updateContextPrevLoc(t.mark(j)),t.leapManager.withEntry(T,function(){t.explodeStatement(e.get("finalizer"))}),t.emit(c.returnStatement(c.callExpression(t.contextProperty("finish"),[T.firstLoc]))))}),t.mark(a);break;case"ThrowStatement":t.emit(c.throwStatement(t.explodeExpression(e.get("argument"))));break;default:throw new Error("unknown Statement of type "+JSON.stringify(l.type))}},m.emitAbruptCompletion=function(e){o(e)||s.ok(!1,"invalid completion record: "+JSON.stringify(e)),s.notStrictEqual(e.type,"normal","normal completions are not abrupt");var n=[c.literal(e.type)];"break"===e.type||"continue"===e.type?(p.Literal.assert(e.target),n[1]=e.target):("return"===e.type||"throw"===e.type)&&e.value&&(p.Expression.assert(e.value),n[1]=e.value),this.emit(c.returnStatement(c.callExpression(this.contextProperty("abrupt"),n)))},m.getUnmarkedCurrentLoc=function(){return c.literal(this.listing.length)},m.updateContextPrevLoc=function(e){e?(p.Literal.assert(e),-1===e.value?e.value=this.listing.length:s.strictEqual(e.value,this.listing.length)):e=this.getUnmarkedCurrentLoc(),this.emitAssign(this.contextProperty("prev"),e)},m.explodeExpression=function(e,n){function l(e){return p.Expression.assert(e),n?void o.emit(e):e}function t(e,n,l){s.ok(n instanceof i.NodePath),s.ok(!l||!e,"Ignoring the result of a child expression but forcing it to be assigned to a temporary variable?");var t=o.explodeExpression(n,l);return l||(e||d&&(o.isVolatileContextProperty(t)||f.hasSideEffects(t)))&&(t=o.emitAssign(e||o.makeTempVar(),t)),t}s.ok(e instanceof i.NodePath);var a=e.value;if(!a)return a;p.Expression.assert(a);var u,o=this;if(!f.containsLeap(a))return l(a);var d=f.containsLeap.onlyChildren(a);switch(a.type){case"MemberExpression":return l(c.memberExpression(o.explodeExpression(e.get("object")),a.computed?t(null,e.get("property")):a.property,a.computed));case"CallExpression":var h=e.get("callee"),g=o.explodeExpression(h);return!p.MemberExpression.check(h.node)&&p.MemberExpression.check(g)&&(g=c.sequenceExpression([c.literal(0),g])),l(c.callExpression(g,e.get("arguments").map(function(e){return t(null,e)})));case"NewExpression":return l(c.newExpression(t(null,e.get("callee")),e.get("arguments").map(function(e){return t(null,e)})));case"ObjectExpression":return l(c.objectExpression(e.get("properties").map(function(e){return c.property(e.value.kind,e.value.key,t(null,e.get("value")))})));case"ArrayExpression":return l(c.arrayExpression(e.get("elements").map(function(e){return t(null,e)})));case"SequenceExpression":var m=a.expressions.length-1;return e.get("expressions").each(function(e){e.name===m?u=o.explodeExpression(e,n):o.explodeExpression(e,!0)}),u;case"LogicalExpression":var y=r();n||(u=o.makeTempVar());var _=t(u,e.get("left"));return"&&"===a.operator?o.jumpIfNot(_,y):(s.strictEqual(a.operator,"||"),o.jumpIf(_,y)),t(u,e.get("right"),n),o.mark(y),u;case"ConditionalExpression":var x=r(),y=r(),b=o.explodeExpression(e.get("test"));return o.jumpIfNot(b,x),n||(u=o.makeTempVar()),t(u,e.get("consequent"),n),o.jump(y),o.mark(x),t(u,e.get("alternate"),n),o.mark(y),u;case"UnaryExpression":return l(c.unaryExpression(a.operator,o.explodeExpression(e.get("argument")),!!a.prefix));case"BinaryExpression":return l(c.binaryExpression(a.operator,t(null,e.get("left")),t(null,e.get("right"))));case"AssignmentExpression":return l(c.assignmentExpression(a.operator,o.explodeExpression(e.get("left")),o.explodeExpression(e.get("right"))));case"UpdateExpression":return l(c.updateExpression(a.operator,o.explodeExpression(e.get("argument")),a.prefix));case"YieldExpression":var y=r(),v=a.argument&&o.explodeExpression(e.get("argument"));if(v&&a.delegate){var u=o.makeTempVar();return o.emit(c.returnStatement(c.callExpression(o.contextProperty("delegateYield"),[v,c.literal(u.property.name),y]))),o.mark(y),u}return o.emitAssign(o.contextProperty("next"),y),o.emit(c.returnStatement(v||null)),o.mark(y),o.contextProperty("sent");default:throw new Error("unknown Expression of type "+JSON.stringify(a.type))}}},{"./leap":316,"./meta":317,"./util":318,assert:141,"ast-types":139}],315:[function(e,n,l){var t=e("assert"),r=e("ast-types"),a=r.namedTypes,u=r.builders,o=Object.prototype.hasOwnProperty;l.hoist=function(e){function n(e,n){a.VariableDeclaration.assert(e);var t=[];return e.declarations.forEach(function(e){l[e.id.name]=e.id,e.init?t.push(u.assignmentExpression("=",e.id,e.init)):n&&t.push(e.id)}),0===t.length?null:1===t.length?t[0]:u.sequenceExpression(t)}t.ok(e instanceof r.NodePath),a.Function.assert(e.value);var l={};r.visit(e.get("body"),{visitVariableDeclaration:function(e){var l=n(e.value,!1);return null!==l?u.expressionStatement(l):(e.replace(),!1)},visitForStatement:function(e){var l=e.value.init;a.VariableDeclaration.check(l)&&e.get("init").replace(n(l,!1)),this.traverse(e)},visitForInStatement:function(e){var l=e.value.left;a.VariableDeclaration.check(l)&&e.get("left").replace(n(l,!0)),this.traverse(e)},visitFunctionDeclaration:function(e){var n=e.value;l[n.id.name]=n.id;var t=(e.parent.node,u.expressionStatement(u.assignmentExpression("=",n.id,u.functionExpression(n.id,n.params,n.body,n.generator,n.expression))));return a.BlockStatement.check(e.parent.node)?(e.parent.get("body").unshift(t),e.replace()):e.replace(t),!1},visitFunctionExpression:function(){return!1}});var s={};e.get("params").each(function(e){var n=e.value;a.Identifier.check(n)&&(s[n.name]=n)});var i=[];return Object.keys(l).forEach(function(e){o.call(s,e)||i.push(u.variableDeclarator(l[e],null))}),0===i.length?null:u.variableDeclaration("var",i)}},{assert:141,"ast-types":139}],316:[function(e,n,l){function t(){d.ok(this instanceof t)}function r(e){t.call(this),h.Literal.assert(e),this.returnLoc=e}function a(e,n,l){t.call(this),h.Literal.assert(e),h.Literal.assert(n),l?h.Identifier.assert(l):l=null,this.breakLoc=e,this.continueLoc=n,this.label=l}function u(e){t.call(this),h.Literal.assert(e),this.breakLoc=e}function o(e,n,l){t.call(this),h.Literal.assert(e),n?d.ok(n instanceof s):n=null,l?d.ok(l instanceof i):l=null,d.ok(n||l),this.firstLoc=e,this.catchEntry=n,this.finallyEntry=l}function s(e,n){t.call(this),h.Literal.assert(e),h.Identifier.assert(n),this.firstLoc=e,this.paramId=n}function i(e,n){t.call(this),h.Literal.assert(e),h.Literal.assert(n),this.firstLoc=e,this.afterLoc=n}function c(e,n){t.call(this),h.Literal.assert(e),h.Identifier.assert(n),this.breakLoc=e,this.label=n}function p(n){d.ok(this instanceof p);var l=e("./emit").Emitter;d.ok(n instanceof l),this.emitter=n,this.entryStack=[new r(n.finalLoc)]}{var d=e("assert"),f=e("ast-types"),h=f.namedTypes,g=(f.builders,e("util").inherits);Object.prototype.hasOwnProperty}g(r,t),l.FunctionEntry=r,g(a,t),l.LoopEntry=a,g(u,t),l.SwitchEntry=u,g(o,t),l.TryEntry=o,g(s,t),l.CatchEntry=s,g(i,t),l.FinallyEntry=i,g(c,t),l.LabeledEntry=c;var m=p.prototype;l.LeapManager=p,m.withEntry=function(e,n){d.ok(e instanceof t),this.entryStack.push(e);try{n.call(this.emitter)}finally{var l=this.entryStack.pop();d.strictEqual(l,e)}},m._findLeapLocation=function(e,n){for(var l=this.entryStack.length-1;l>=0;--l){var t=this.entryStack[l],r=t[e];if(r)if(n){if(t.label&&t.label.name===n.name)return r}else if(!(t instanceof c))return r}return null},m.getBreakLoc=function(e){return this._findLeapLocation("breakLoc",e)},m.getContinueLoc=function(e){return this._findLeapLocation("continueLoc",e)}},{"./emit":314,assert:141,"ast-types":139,util:167}],317:[function(e,n,l){function t(e,n){function l(e){function n(e){return l||(o.check(e)?e.some(n):s.Node.check(e)&&(r.strictEqual(l,!1),l=t(e))),l}s.Node.assert(e);var l=!1;return u.eachField(e,function(e,l){n(l)}),l}function t(t){s.Node.assert(t);var r=a(t);return i.call(r,e)?r[e]:r[e]=i.call(c,t.type)?!1:i.call(n,t.type)?!0:l(t)}return t.onlyChildren=l,t}var r=e("assert"),a=e("private").makeAccessor(),u=e("ast-types"),o=u.builtInTypes.array,s=u.namedTypes,i=Object.prototype.hasOwnProperty,c={FunctionExpression:!0},p={CallExpression:!0,ForInStatement:!0,UnaryExpression:!0,BinaryExpression:!0,AssignmentExpression:!0,UpdateExpression:!0,NewExpression:!0},d={YieldExpression:!0,BreakStatement:!0,ContinueStatement:!0,ReturnStatement:!0,ThrowStatement:!0};for(var f in d)i.call(d,f)&&(p[f]=d[f]);l.hasSideEffects=t("hasSideEffects",p),l.containsLeap=t("containsLeap",d)},{assert:141,"ast-types":139,"private":313}],318:[function(e,n,l){var t=(e("assert"),e("ast-types")),r=t.namedTypes,a=t.builders,u=Object.prototype.hasOwnProperty;l.defaults=function(e){for(var n,l=arguments.length,t=1;l>t;++t)if(n=arguments[t])for(var r in n)u.call(n,r)&&!u.call(e,r)&&(e[r]=n[r]);return e},l.runtimeProperty=function(e){return a.memberExpression(a.identifier("regeneratorRuntime"),a.identifier(e),!1)},l.isReference=function(e,n){var l=e.value;if(!r.Identifier.check(l))return!1;if(n&&l.name!==n)return!1;var t=e.parent.value;switch(t.type){case"VariableDeclarator":return"init"===e.name;case"MemberExpression":return"object"===e.name||t.computed&&"property"===e.name;case"FunctionExpression":case"FunctionDeclaration":case"ArrowFunctionExpression":return"id"===e.name?!1:t.params===e.parentPath&&t.params[e.name]===l?!1:!0;case"ClassDeclaration":case"ClassExpression":return"id"!==e.name;case"CatchClause":return"param"!==e.name;case"Property":case"MethodDefinition":return"key"!==e.name;case"ImportSpecifier":case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":case"LabeledStatement":return!1;default:return!0}}},{assert:141,"ast-types":139}],319:[function(e,n,l){var t=(e("assert"),e("fs"),e("ast-types")),r=t.namedTypes,a=t.builders,u=(t.builtInTypes.array,t.builtInTypes.object,t.NodePath),o=e("./hoist").hoist,s=e("./emit").Emitter,i=e("./util").runtimeProperty;l.transform=function(e,n){n=n||{};var l=e instanceof u?e:new u(e);return c.visit(l,n),e=l.value,n.madeChanges=c.wasChangeReported(),e};var c=t.PathVisitor.fromMethodsObject({reset:function(e,n){this.options=n},visitFunction:function(e){this.traverse(e);var n=e.value,l=n.async&&!this.options.disableAsync;if(n.generator||l){this.reportChanged(),n.generator=!1,n.expression&&(n.expression=!1,n.body=a.blockStatement([a.returnStatement(n.body)])),l&&p.visit(e.get("body"));var t=n.id||(n.id=e.scope.parent.declareTemporary("callee$")),u=[],c=e.value.body;c.body=c.body.filter(function(e){return e&&null!=e._blockHoist?(u.push(e),!1):!0});var d=a.identifier(n.id.name+"$"),f=e.scope.declareTemporary("context$"),h=o(e),g=new s(f);g.explode(e.get("body")),h&&h.declarations.length>0&&u.push(h);var m=[g.getContextFunction(d),l?a.literal(null):t,a.thisExpression()],y=g.getTryLocsList();y&&m.push(y);var _=a.callExpression(i(l?"async":"wrap"),m);if(u.push(a.returnStatement(_)),n.body=a.blockStatement(u),n.body._declarations=c._declarations,l)return void(n.async=!1);if(!r.FunctionDeclaration.check(n))return r.FunctionExpression.assert(n),a.callExpression(i("mark"),[n]);for(var x=e.parent;x&&!r.BlockStatement.check(x.value)&&!r.Program.check(x.value);)x=x.parent;if(x){e.replace(),n.type="FunctionExpression";var b=a.variableDeclaration("var",[a.variableDeclarator(n.id,a.callExpression(i("mark"),[n]))]);n.comments&&(b.leadingComments=n.leadingComments,b.trailingComments=n.trailingComments,n.leadingComments=null,n.trailingComments=null),b._blockHoist=3;{var v=x.get("body");v.value.length}v.push(b)}}}}),p=t.PathVisitor.fromMethodsObject({visitFunction:function(){return!1},visitAwaitExpression:function(e){var n=e.value.argument;return e.value.all&&(n=a.callExpression(a.memberExpression(a.identifier("Promise"),a.identifier("all"),!1),[n])),a.yieldExpression(n,!1)}})},{"./emit":314,"./hoist":315,"./util":318,assert:141,"ast-types":139,fs:140}],320:[function(e,n){(function(l){function t(e,n){function l(e){r.push(e)}function t(){this.queue(compile(r.join(""),n).code),this.queue(null)}var r=[];return u(l,t)}function r(){e("./runtime")}{var a=(e("assert"),e("path")),u=(e("fs"),e("through")),o=e("./lib/visit").transform;e("./lib/util"),e("ast-types")}n.exports=t,t.runtime=r,r.path=a.join(l,"runtime.js"),t.transform=o}).call(this,"/node_modules/regenerator-babel")},{"./lib/util":318,"./lib/visit":319,"./runtime":322,assert:141,"ast-types":139,fs:140,path:150,through:321}],321:[function(e,n,l){(function(t){function r(e,n,l){function r(){for(;i.length&&!p.paused;){var e=i.shift();if(null===e)return p.emit("end");p.emit("data",e)}}function u(){p.writable=!1,n.call(p),!p.readable&&p.autoDestroy&&p.destroy()}e=e||function(e){this.queue(e)},n=n||function(){this.queue(null)};var o=!1,s=!1,i=[],c=!1,p=new a;return p.readable=p.writable=!0,p.paused=!1,p.autoDestroy=!(l&&l.autoDestroy===!1),p.write=function(n){return e.call(this,n),!p.paused},p.queue=p.push=function(e){return c?p:(null==e&&(c=!0),i.push(e),r(),p)},p.on("end",function(){p.readable=!1,!p.writable&&p.autoDestroy&&t.nextTick(function(){p.destroy()})}),p.end=function(e){return o?void 0:(o=!0,arguments.length&&p.write(e),u(),p)},p.destroy=function(){return s?void 0:(s=!0,o=!0,i.length=0,p.writable=p.readable=!1,p.emit("close"),p)},p.pause=function(){return p.paused?void 0:(p.paused=!0,p)},p.resume=function(){return p.paused&&(p.paused=!1,p.emit("resume")),r(),p.paused||p.emit("drain"),p},p}var a=e("stream");l=n.exports=r,r.through=r}).call(this,e("_process"))},{_process:151,stream:163}],322:[function(e,n){(function(e){!function(e){"use strict";function l(e,n,l,t){return new u(e,n,l||null,t||[])}function t(e,n,l){try{return{type:"normal",arg:e.call(n,l)}}catch(t){return{type:"throw",arg:t}}}function r(){}function a(){}function u(e,n,l,r){function a(n,r){if(s===x)throw new Error("Generator is already running");if(s===b)return p();for(;;){var a=o.delegate;if(a){var u=t(a.iterator[n],a.iterator,r);if("throw"===u.type){o.delegate=null,n="throw",r=u.arg;continue}n="next",r=d;var i=u.arg;if(!i.done)return s=_,i;o[a.resultName]=i.value,o.next=a.nextLoc,o.delegate=null}if("next"===n){if(s===y&&"undefined"!=typeof r)throw new TypeError("attempt to send "+JSON.stringify(r)+" to newborn generator");s===_?o.sent=r:delete o.sent}else if("throw"===n){if(s===y)throw s=b,r;o.dispatchException(r)&&(n="next",r=d)}else"return"===n&&o.abrupt("return",r);s=x;var u=t(e,l,o);if("normal"===u.type){s=o.done?b:_;var i={value:u.arg,done:o.done};if(u.arg!==v)return i;o.delegate&&"next"===n&&(r=d)}else"throw"===u.type&&(s=b,"next"===n?o.dispatchException(u.arg):r=u.arg)}}var u=n?Object.create(n.prototype):this,o=new i(r),s=y;return u.next=a.bind(u,"next"),u["throw"]=a.bind(u,"throw"),u["return"]=a.bind(u,"return"),u}function o(e){var n={tryLoc:e[0]};1 in e&&(n.catchLoc=e[1]),2 in e&&(n.finallyLoc=e[2],n.afterLoc=e[3]),this.tryEntries.push(n)}function s(e){var n=e.completion||{};n.type="normal",delete n.arg,e.completion=n}function i(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(o,this),this.reset()}function c(e){if(e){var n=e[h];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var l=-1,t=function r(){for(;++l<e.length;)if(f.call(e,l))return r.value=e[l],r.done=!1,r;return r.value=d,r.done=!0,r};return t.next=t}}return{next:p}}function p(){return{value:d,done:!0}}var d,f=Object.prototype.hasOwnProperty,h="function"==typeof Symbol&&Symbol.iterator||"@@iterator",g="object"==typeof n,m=e.regeneratorRuntime;if(m)return void(g&&(n.exports=m));m=e.regeneratorRuntime=g?n.exports:{},m.wrap=l;var y="suspendedStart",_="suspendedYield",x="executing",b="completed",v={},I=a.prototype=u.prototype;r.prototype=I.constructor=a,a.constructor=r,r.displayName="GeneratorFunction",m.isGeneratorFunction=function(e){var n="function"==typeof e&&e.constructor;return n?n===r||"GeneratorFunction"===(n.displayName||n.name):!1},m.mark=function(e){return e.__proto__=a,e.prototype=Object.create(I),e},m.async=function(e,n,r,a){return new Promise(function(u,o){function s(e){var n=t(this,null,e);if("throw"===n.type)return void o(n.arg);var l=n.arg;l.done?u(l.value):Promise.resolve(l.value).then(c,p)}var i=l(e,n,r,a),c=s.bind(i.next),p=s.bind(i["throw"]);c()})},I[h]=function(){return this},I.toString=function(){return"[object Generator]"},m.keys=function(e){var n=[];for(var l in e)n.push(l);return n.reverse(),function t(){for(;n.length;){var l=n.pop();if(l in e)return t.value=l,t.done=!1,t}return t.done=!0,t}},m.values=c,i.prototype={constructor:i,reset:function(){this.prev=0,this.next=0,this.sent=d,this.done=!1,this.delegate=null,this.tryEntries.forEach(s);for(var e,n=0;f.call(this,e="t"+n)||20>n;++n)this[e]=null},stop:function(){this.done=!0;var e=this.tryEntries[0],n=e.completion;if("throw"===n.type)throw n.arg;return this.rval},dispatchException:function(e){function n(n,t){return a.type="throw",a.arg=e,l.next=n,!!t}if(this.done)throw e;for(var l=this,t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t],a=r.completion;if("root"===r.tryLoc)return n("end");if(r.tryLoc<=this.prev){var u=f.call(r,"catchLoc"),o=f.call(r,"finallyLoc");if(u&&o){if(this.prev<r.catchLoc)return n(r.catchLoc,!0);if(this.prev<r.finallyLoc)return n(r.finallyLoc)}else if(u){if(this.prev<r.catchLoc)return n(r.catchLoc,!0)}else{if(!o)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return n(r.finallyLoc)}}}},abrupt:function(e,n){for(var l=this.tryEntries.length-1;l>=0;--l){var t=this.tryEntries[l];if(t.tryLoc<=this.prev&&f.call(t,"finallyLoc")&&this.prev<t.finallyLoc){var r=t;break}}r&&("break"===e||"continue"===e)&&r.tryLoc<=n&&n<r.finallyLoc&&(r=null);var a=r?r.completion:{};return a.type=e,a.arg=n,r?this.next=r.finallyLoc:this.complete(a),v},complete:function(e,n){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=e.arg,this.next="end"):"normal"===e.type&&n&&(this.next=n),v},finish:function(e){for(var n=this.tryEntries.length-1;n>=0;--n){var l=this.tryEntries[n];if(l.finallyLoc===e)return this.complete(l.completion,l.afterLoc)}},"catch":function(e){for(var n=this.tryEntries.length-1;n>=0;--n){var l=this.tryEntries[n];if(l.tryLoc===e){var t=l.completion;if("throw"===t.type){var r=t.arg;s(l)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,l){return this.delegate={iterator:c(e),resultName:n,nextLoc:l},v}}}("object"==typeof e?e:"object"==typeof window?window:this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],323:[function(e,n,l){var t=e("regenerate");l.REGULAR={d:t().addRange(48,57),D:t().addRange(0,47).addRange(58,65535),s:t(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:t().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,6157).addRange(6159,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,65535),w:t(95).addRange(48,57).addRange(65,90).addRange(97,122),W:t(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,65535)},l.UNICODE={d:t().addRange(48,57),D:t().addRange(0,47).addRange(58,1114111),s:t(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:t().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,6157).addRange(6159,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,1114111),w:t(95).addRange(48,57).addRange(65,90).addRange(97,122),W:t(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,1114111)},l.UNICODE_IGNORE_CASE={d:t().addRange(48,57),D:t().addRange(0,47).addRange(58,1114111),s:t(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:t().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,6157).addRange(6159,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,1114111),w:t(95,383,8490).addRange(48,57).addRange(65,90).addRange(97,122),W:t(75,83,96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,1114111)}},{regenerate:325}],324:[function(e,n){n.exports={75:8490,83:383,107:8490,115:383,181:924,197:8491,383:83,452:453,453:452,455:456,456:455,458:459,459:458,497:498,498:497,837:8126,914:976,917:1013,920:1012,921:8126,922:1008,924:181,928:982,929:1009,931:962,934:981,937:8486,962:931,976:914,977:1012,981:934,982:928,1008:922,1009:929,1012:[920,977],1013:917,7776:7835,7835:7776,8126:[837,921],8486:937,8490:75,8491:197,66560:66600,66561:66601,66562:66602,66563:66603,66564:66604,66565:66605,66566:66606,66567:66607,66568:66608,66569:66609,66570:66610,66571:66611,66572:66612,66573:66613,66574:66614,66575:66615,66576:66616,66577:66617,66578:66618,66579:66619,66580:66620,66581:66621,66582:66622,66583:66623,66584:66624,66585:66625,66586:66626,66587:66627,66588:66628,66589:66629,66590:66630,66591:66631,66592:66632,66593:66633,66594:66634,66595:66635,66596:66636,66597:66637,66598:66638,66599:66639,66600:66560,66601:66561,66602:66562,66603:66563,66604:66564,66605:66565,66606:66566,66607:66567,66608:66568,66609:66569,66610:66570,66611:66571,66612:66572,66613:66573,66614:66574,66615:66575,66616:66576,66617:66577,66618:66578,66619:66579,66620:66580,66621:66581,66622:66582,66623:66583,66624:66584,66625:66585,66626:66586,66627:66587,66628:66588,66629:66589,66630:66590,66631:66591,66632:66592,66633:66593,66634:66594,66635:66595,66636:66596,66637:66597,66638:66598,66639:66599,71840:71872,71841:71873,71842:71874,71843:71875,71844:71876,71845:71877,71846:71878,71847:71879,71848:71880,71849:71881,71850:71882,71851:71883,71852:71884,71853:71885,71854:71886,71855:71887,71856:71888,71857:71889,71858:71890,71859:71891,71860:71892,71861:71893,71862:71894,71863:71895,71864:71896,71865:71897,71866:71898,71867:71899,71868:71900,71869:71901,71870:71902,71871:71903,71872:71840,71873:71841,71874:71842,71875:71843,71876:71844,71877:71845,71878:71846,71879:71847,71880:71848,71881:71849,71882:71850,71883:71851,71884:71852,71885:71853,71886:71854,71887:71855,71888:71856,71889:71857,71890:71858,71891:71859,71892:71860,71893:71861,71894:71862,71895:71863,71896:71864,71897:71865,71898:71866,71899:71867,71900:71868,71901:71869,71902:71870,71903:71871} },{}],325:[function(n,l,t){(function(n){!function(r){var a="object"==typeof t&&t,u="object"==typeof l&&l&&l.exports==a&&l,o="object"==typeof n&&n;(o.global===o||o.window===o)&&(r=o);var s={rangeOrder:"A range’s `stop` value must be greater than or equal to the `start` value.",codePointRange:"Invalid code point value. Code points range from U+000000 to U+10FFFF."},i=55296,c=56319,p=56320,d=57343,f=/\\x00([^0123456789]|$)/g,h={},g=h.hasOwnProperty,m=function(e,n){var l;for(l in n)g.call(n,l)&&(e[l]=n[l]);return e},y=function(e,n){for(var l=-1,t=e.length;++l<t;)n(e[l],l)},_=h.toString,x=function(e){return"[object Array]"==_.call(e)},b=function(e){return"number"==typeof e||"[object Number]"==_.call(e)},v="0000",I=function(e,n){var l=String(e);return l.length<n?(v+l).slice(-n):l},w=function(e){return Number(e).toString(16).toUpperCase()},E=[].slice,k=function(e){for(var n,l=-1,t=e.length,r=t-1,a=[],u=!0,o=0;++l<t;)if(n=e[l],u)a.push(n),o=n,u=!1;else if(n==o+1){if(l!=r){o=n;continue}u=!0,a.push(n+1)}else a.push(o+1,n),o=n;return u||a.push(n+1),a},R=function(e,n){for(var l,t,r=0,a=e.length;a>r;){if(l=e[r],t=e[r+1],n>=l&&t>n)return n==l?t==l+1?(e.splice(r,2),e):(e[r]=n+1,e):n==t-1?(e[r+1]=n,e):(e.splice(r,2,l,n,n+1,t),e);r+=2}return e},S=function(e,n,l){if(n>l)throw Error(s.rangeOrder);for(var t,r,a=0;a<e.length;){if(t=e[a],r=e[a+1]-1,t>l)return e;if(t>=n&&l>=r)e.splice(a,2);else{if(n>=t&&r>l)return n==t?(e[a]=l+1,e[a+1]=r+1,e):(e.splice(a,2,t,n,l+1,r+1),e);if(n>=t&&r>=n)e[a+1]=n;else if(l>=t&&r>=l)return e[a]=l+1,e;a+=2}}return e},C=function(e,n){var l,t,r=0,a=null,u=e.length;if(0>n||n>1114111)throw RangeError(s.codePointRange);for(;u>r;){if(l=e[r],t=e[r+1],n>=l&&t>n)return e;if(n==l-1)return e[r]=n,e;if(l>n)return e.splice(null!=a?a+2:0,0,n,n+1),e;if(n==t)return n+1==e[r+2]?(e.splice(r,4,l,e[r+3]),e):(e[r+1]=n+1,e);a=r,r+=2}return e.push(n,n+1),e},A=function(e,n){for(var l,t,r=0,a=e.slice(),u=n.length;u>r;)l=n[r],t=n[r+1]-1,a=l==t?C(a,l):j(a,l,t),r+=2;return a},M=function(e,n){for(var l,t,r=0,a=e.slice(),u=n.length;u>r;)l=n[r],t=n[r+1]-1,a=l==t?R(a,l):S(a,l,t),r+=2;return a},j=function(e,n,l){if(n>l)throw Error(s.rangeOrder);if(0>n||n>1114111||0>l||l>1114111)throw RangeError(s.codePointRange);for(var t,r,a=0,u=!1,o=e.length;o>a;){if(t=e[a],r=e[a+1],u){if(t==l+1)return e.splice(a-1,2),e;if(t>l)return e;t>=n&&l>=t&&(r>n&&l>=r-1?(e.splice(a,2),a-=2):(e.splice(a-1,2),a-=2))}else{if(t==l+1)return e[a]=n,e;if(t>l)return e.splice(a,0,n,l+1),e;if(n>=t&&r>n&&r>=l+1)return e;n>=t&&r>n||r==n?(e[a+1]=l+1,u=!0):t>=n&&l+1>=r&&(e[a]=n,e[a+1]=l+1,u=!0)}a+=2}return u||e.push(n,l+1),e},T=function(e,n){var l=0,t=e.length,r=e[l],a=e[t-1];if(t>=2&&(r>n||n>a))return!1;for(;t>l;){if(r=e[l],a=e[l+1],n>=r&&a>n)return!0;l+=2}return!1},P=function(e,n){for(var l,t=0,r=n.length,a=[];r>t;)l=n[t],T(e,l)&&a.push(l),++t;return k(a)},L=function(e){return!e.length},O=function(e){return 2==e.length&&e[0]+1==e[1]},D=function(e){for(var n,l,t=0,r=[],a=e.length;a>t;){for(n=e[t],l=e[t+1];l>n;)r.push(n),++n;t+=2}return r},F=Math.floor,B=function(e){return parseInt(F((e-65536)/1024)+i,10)},N=function(e){return parseInt((e-65536)%1024+p,10)},V=String.fromCharCode,U=function(e){var n;return n=9==e?"\\t":10==e?"\\n":12==e?"\\f":13==e?"\\r":92==e?"\\\\":36==e||e>=40&&43>=e||45==e||46==e||63==e||e>=91&&94>=e||e>=123&&125>=e?"\\"+V(e):e>=32&&126>=e?V(e):255>=e?"\\x"+I(w(e),2):"\\u"+I(w(e),4)},q=function(e){var n,l=e.length,t=e.charCodeAt(0);return t>=i&&c>=t&&l>1?(n=e.charCodeAt(1),1024*(t-i)+n-p+65536):t},G=function(e){var n,l,t="",r=0,a=e.length;if(O(e))return U(e[0]);for(;a>r;)n=e[r],l=e[r+1]-1,t+=n==l?U(n):n+1==l?U(n)+U(l):U(n)+"-"+U(l),r+=2;return"["+t+"]"},H=function(e){for(var n,l,t=[],r=[],a=[],u=[],o=0,s=e.length;s>o;)n=e[o],l=e[o+1]-1,i>n?(i>l&&a.push(n,l+1),l>=i&&c>=l&&(a.push(n,i),t.push(i,l+1)),l>=p&&d>=l&&(a.push(n,i),t.push(i,c+1),r.push(p,l+1)),l>d&&(a.push(n,i),t.push(i,c+1),r.push(p,d+1),65535>=l?a.push(d+1,l+1):(a.push(d+1,65536),u.push(65536,l+1)))):n>=i&&c>=n?(l>=i&&c>=l&&t.push(n,l+1),l>=p&&d>=l&&(t.push(n,c+1),r.push(p,l+1)),l>d&&(t.push(n,c+1),r.push(p,d+1),65535>=l?a.push(d+1,l+1):(a.push(d+1,65536),u.push(65536,l+1)))):n>=p&&d>=n?(l>=p&&d>=l&&r.push(n,l+1),l>d&&(r.push(n,d+1),65535>=l?a.push(d+1,l+1):(a.push(d+1,65536),u.push(65536,l+1)))):n>d&&65535>=n?65535>=l?a.push(n,l+1):(a.push(n,65536),u.push(65536,l+1)):u.push(n,l+1),o+=2;return{loneHighSurrogates:t,loneLowSurrogates:r,bmp:a,astral:u}},W=function(e){for(var n,l,t,r,a,u,o=[],s=[],i=!1,c=-1,p=e.length;++c<p;)if(n=e[c],l=e[c+1]){for(t=n[0],r=n[1],a=l[0],u=l[1],s=r;a&&t[0]==a[0]&&t[1]==a[1];)s=O(u)?C(s,u[0]):j(s,u[0],u[1]-1),++c,n=e[c],t=n[0],r=n[1],l=e[c+1],a=l&&l[0],u=l&&l[1],i=!0;o.push([t,i?s:r]),i=!1}else o.push(n);return J(o)},J=function(e){if(1==e.length)return e;for(var n=-1,l=-1;++n<e.length;){var t=e[n],r=t[1],a=r[0],u=r[1];for(l=n;++l<e.length;){var o=e[l],s=o[1],i=s[0],c=s[1];a==i&&u==c&&(t[0]=O(o[0])?C(t[0],o[0][0]):j(t[0],o[0][0],o[0][1]-1),e.splice(l,1),--l)}}return e},Y=function(e){if(!e.length)return[];for(var n,l,t,r,a,u,o=0,s=0,i=0,c=[],f=e.length;f>o;){n=e[o],l=e[o+1]-1,t=B(n),r=N(n),a=B(l),u=N(l);var h=r==p,g=u==d,m=!1;t==a||h&&g?(c.push([[t,a+1],[r,u+1]]),m=!0):c.push([[t,t+1],[r,d+1]]),!m&&a>t+1&&(g?(c.push([[t+1,a+1],[p,u+1]]),m=!0):c.push([[t+1,a],[p,d+1]])),m||c.push([[a,a+1],[p,u+1]]),s=t,i=a,o+=2}return W(c)},X=function(e){var n=[];return y(e,function(e){var l=e[0],t=e[1];n.push(G(l)+G(t))}),n.join("|")},z=function(e,n){var l=[],t=H(e),r=t.loneHighSurrogates,a=t.loneLowSurrogates,u=t.bmp,o=t.astral,s=(!L(t.astral),!L(r)),i=!L(a),c=Y(o);return n&&(u=A(u,r),s=!1,u=A(u,a),i=!1),L(u)||l.push(G(u)),c.length&&l.push(X(c)),s&&l.push(G(r)+"(?![\\uDC00-\\uDFFF])"),i&&l.push("(?:[^\\uD800-\\uDBFF]|^)"+G(a)),l.join("|")},K=function(e){return arguments.length>1&&(e=E.call(arguments)),this instanceof K?(this.data=[],e?this.add(e):this):(new K).add(e)};K.version="1.2.0";var $=K.prototype;m($,{add:function(e){var n=this;return null==e?n:e instanceof K?(n.data=A(n.data,e.data),n):(arguments.length>1&&(e=E.call(arguments)),x(e)?(y(e,function(e){n.add(e)}),n):(n.data=C(n.data,b(e)?e:q(e)),n))},remove:function(e){var n=this;return null==e?n:e instanceof K?(n.data=M(n.data,e.data),n):(arguments.length>1&&(e=E.call(arguments)),x(e)?(y(e,function(e){n.remove(e)}),n):(n.data=R(n.data,b(e)?e:q(e)),n))},addRange:function(e,n){var l=this;return l.data=j(l.data,b(e)?e:q(e),b(n)?n:q(n)),l},removeRange:function(e,n){var l=this,t=b(e)?e:q(e),r=b(n)?n:q(n);return l.data=S(l.data,t,r),l},intersection:function(e){var n=this,l=e instanceof K?D(e.data):e;return n.data=P(n.data,l),n},contains:function(e){return T(this.data,b(e)?e:q(e))},clone:function(){var e=new K;return e.data=this.data.slice(0),e},toString:function(e){var n=z(this.data,e?e.bmpOnly:!1);return n.replace(f,"\\0$1")},toRegExp:function(e){return RegExp(this.toString(),e||"")},valueOf:function(){return D(this.data)}}),$.toArray=$.valueOf,"function"==typeof e&&"object"==typeof e.amd&&e.amd?e(function(){return K}):a&&!a.nodeType?u?u.exports=K:a.regenerate=K:r.regenerate=K}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],326:[function(n,l,t){(function(n){(function(){"use strict";function r(){var e,n,l=16384,t=[],r=-1,a=arguments.length;if(!a)return"";for(var u="";++r<a;){var o=Number(arguments[r]);if(!isFinite(o)||0>o||o>1114111||S(o)!=o)throw RangeError("Invalid code point: "+o);65535>=o?t.push(o):(o-=65536,e=(o>>10)+55296,n=o%1024+56320,t.push(e,n)),(r+1==a||t.length>l)&&(u+=R.apply(null,t),t.length=0)}return u}function a(e,n){if(-1==n.indexOf("|")){if(e==n)return;throw Error("Invalid node type: "+e)}if(n=a.hasOwnProperty(n)?a[n]:a[n]=RegExp("^(?:"+n+")$"),!n.test(e))throw Error("Invalid node type: "+e)}function u(e){var n=e.type;if(u.hasOwnProperty(n)&&"function"==typeof u[n])return u[n](e);throw Error("Invalid node type: "+n)}function o(e){a(e.type,"alternative");var n=e.body,l=n?n.length:0;if(1==l)return x(n[0]);for(var t=-1,r="";++t<l;)r+=x(n[t]);return r}function s(e){switch(a(e.type,"anchor"),e.kind){case"start":return"^";case"end":return"$";case"boundary":return"\\b";case"not-boundary":return"\\B";default:throw Error("Invalid assertion")}}function i(e){return a(e.type,"anchor|characterClass|characterClassEscape|dot|group|reference|value"),u(e)}function c(e){a(e.type,"characterClass");var n=e.body,l=n?n.length:0,t=-1,r="[";for(e.negative&&(r+="^");++t<l;)r+=f(n[t]);return r+="]"}function p(e){return a(e.type,"characterClassEscape"),"\\"+e.value}function d(e){a(e.type,"characterClassRange");var n=e.min,l=e.max;if("characterClassRange"==n.type||"characterClassRange"==l.type)throw Error("Invalid character class range");return f(n)+"-"+f(l)}function f(e){return a(e.type,"anchor|characterClassEscape|characterClassRange|dot|value"),u(e)}function h(e){a(e.type,"disjunction");var n=e.body,l=n?n.length:0;if(0==l)throw Error("No body");if(1==l)return u(n[0]);for(var t=-1,r="";++t<l;)0!=t&&(r+="|"),r+=u(n[t]);return r}function g(e){return a(e.type,"dot"),"."}function m(e){a(e.type,"group");var n="(";switch(e.behavior){case"normal":break;case"ignore":n+="?:";break;case"lookahead":n+="?=";break;case"negativeLookahead":n+="?!";break;default:throw Error("Invalid behaviour: "+e.behaviour)}var l=e.body,t=l?l.length:0;if(1==t)n+=u(l[0]);else for(var r=-1;++r<t;)n+=u(l[r]);return n+=")"}function y(e){a(e.type,"quantifier");var n="",l=e.min,t=e.max;switch(t){case void 0:case null:switch(l){case 0:n="*";break;case 1:n="+";break;default:n="{"+l+",}"}break;default:n=l==t?"{"+l+"}":0==l&&1==t?"?":"{"+l+","+t+"}"}return e.greedy||(n+="?"),i(e.body[0])+n}function _(e){return a(e.type,"reference"),"\\"+e.matchIndex}function x(e){return a(e.type,"anchor|characterClass|characterClassEscape|empty|group|quantifier|reference|value"),u(e)}function b(e){a(e.type,"value");var n=e.kind,l=e.codePoint;switch(n){case"controlLetter":return"\\c"+r(l+64);case"hexadecimalEscape":return"\\x"+("00"+l.toString(16).toUpperCase()).slice(-2);case"identifier":return"\\"+r(l);case"null":return"\\"+l;case"octal":return"\\"+l.toString(8);case"singleEscape":switch(l){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 11:return"\\v";case 12:return"\\f";case 13:return"\\r";default:throw Error("Invalid codepoint: "+l)}case"symbol":return r(l);case"unicodeEscape":return"\\u"+("0000"+l.toString(16).toUpperCase()).slice(-4);case"unicodeCodePointEscape":return"\\u{"+l.toString(16).toUpperCase()+"}";default:throw Error("Unsupported node kind: "+n)}}var v={"function":!0,object:!0},I=v[typeof window]&&window||this,w=v[typeof t]&&t,E=v[typeof l]&&l&&!l.nodeType&&l,k=w&&E&&"object"==typeof n&&n;!k||k.global!==k&&k.window!==k&&k.self!==k||(I=k);var R=String.fromCharCode,S=Math.floor;u.alternative=o,u.anchor=s,u.characterClass=c,u.characterClassEscape=p,u.characterClassRange=d,u.disjunction=h,u.dot=g,u.group=m,u.quantifier=y,u.reference=_,u.value=b,"function"==typeof e&&"object"==typeof e.amd&&e.amd?e(function(){return{generate:u}}):w&&E?w.generate=u:I.regjsgen={generate:u}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],327:[function(e,n){!function(){function e(e,n){function l(n){return n.raw=e.substring(n.range[0],n.range[1]),n}function t(e,n){return e.range[0]=n,l(e)}function r(e,n){return l({type:"anchor",kind:e,range:[K-n,K]})}function a(e,n,t,r){return l({type:"value",kind:e,codePoint:n,range:[t,r]})}function u(e,n,l,t){return t=t||0,a(e,n,K-(l.length+t),K)}function o(e){var n=e[0],l=n.charCodeAt(0);if(z){var t;if(1===n.length&&l>=55296&&56319>=l&&(t=v().charCodeAt(0),t>=56320&&57343>=t))return K++,a("symbol",1024*(l-55296)+t-56320+65536,K-2,K)}return a("symbol",l,K-1,K)}function s(e,n,t){return l({type:"disjunction",body:e,range:[n,t]})}function i(){return l({type:"dot",range:[K-1,K]})}function c(e){return l({type:"characterClassEscape",value:e,range:[K-2,K]})}function p(e){return l({type:"reference",matchIndex:parseInt(e,10),range:[K-1-e.length,K]})}function d(e,n,t,r){return l({type:"group",behavior:e,body:n,range:[t,r]})}function f(e,n,t,r){return null==r&&(t=K-1,r=K),l({type:"quantifier",min:e,max:n,greedy:!0,body:null,range:[t,r]})}function h(e,n,t){return l({type:"alternative",body:e,range:[n,t]})}function g(e,n,t,r){return l({type:"characterClass",body:e,negative:n,range:[t,r]})}function m(e,n,t,r){if(e.codePoint>n.codePoint)throw SyntaxError("invalid range in character class");return l({type:"characterClassRange",min:e,max:n,range:[t,r]})}function y(e){return"alternative"===e.type?e.body:[e]}function _(n){n=n||1;var l=e.substring(K,K+n);return K+=n||1,l}function x(e){if(!b(e))throw SyntaxError("character: "+e)}function b(n){return e.indexOf(n,K)===K?_(n.length):void 0}function v(){return e[K]}function I(n){return e.indexOf(n,K)===K}function w(n){return e[K+1]===n}function E(n){var l=e.substring(K),t=l.match(n);return t&&(t.range=[],t.range[0]=K,_(t[0].length),t.range[1]=K),t}function k(){var e=[],n=K;for(e.push(R());b("|");)e.push(R());return 1===e.length?e[0]:s(e,n,K)}function R(){for(var e,n=[],l=K;e=S();)n.push(e);return 1===n.length?n[0]:h(n,l,K)}function S(){if(K>=e.length||I("|")||I(")"))return null;var n=A();if(n)return n;var l=j();if(!l)throw SyntaxError("Expected atom");var r=M()||!1;return r?(r.body=y(l),t(r,l.range[0]),r):l}function C(e,n,l,t){var r=null,a=K;if(b(e))r=n;else{if(!b(l))return!1;r=t}var u=k();if(!u)throw SyntaxError("Expected disjunction");x(")");var o=d(r,y(u),a,K);return"normal"==r&&X&&Y++,o}function A(){return b("^")?r("start",1):b("$")?r("end",1):b("\\b")?r("boundary",2):b("\\B")?r("not-boundary",2):C("(?=","lookahead","(?!","negativeLookahead")}function M(){var e,n,l,t;if(b("*"))n=f(0);else if(b("+"))n=f(1);else if(b("?"))n=f(0,1);else if(e=E(/^\{([0-9]+)\}/))l=parseInt(e[1],10),n=f(l,l,e.range[0],e.range[1]);else if(e=E(/^\{([0-9]+),\}/))l=parseInt(e[1],10),n=f(l,void 0,e.range[0],e.range[1]);else if(e=E(/^\{([0-9]+),([0-9]+)\}/)){if(l=parseInt(e[1],10),t=parseInt(e[2],10),l>t)throw SyntaxError("numbers out of order in {} quantifier");n=f(l,t,e.range[0],e.range[1])}return n&&b("?")&&(n.greedy=!1,n.range[1]+=1),n}function j(){var e;if(e=E(/^[^^$\\.*+?(){[|]/))return o(e);if(b("."))return i();if(b("\\")){if(e=L(),!e)throw SyntaxError("atomEscape");return e}return(e=N())?e:C("(?:","ignore","(","normal")}function T(e){if(z){var n,t;if("unicodeEscape"==e.kind&&(n=e.codePoint)>=55296&&56319>=n&&I("\\")&&w("u")){var r=K;K++;var a=P();"unicodeEscape"==a.kind&&(t=a.codePoint)>=56320&&57343>=t?(e.range[1]=a.range[1],e.codePoint=1024*(n-55296)+t-56320+65536,e.type="value",e.kind="unicodeCodePointEscape",l(e)):K=r}}return e}function P(){return L(!0)}function L(e){var n;if(n=O())return n;if(e){if(b("b"))return u("singleEscape",8,"\\b");if(b("B"))throw SyntaxError("\\B not possible inside of CharacterClass")}return n=D()}function O(){var e,n;if(e=E(/^(?!0)\d+/)){n=e[0];var l=parseInt(e[0],10);return Y>=l?p(e[0]):(J.push(l),_(-e[0].length),(e=E(/^[0-7]{1,3}/))?u("octal",parseInt(e[0],8),e[0],1):(e=o(E(/^[89]/)),t(e,e.range[0]-1)))}return(e=E(/^[0-7]{1,3}/))?(n=e[0],/^0{1,3}$/.test(n)?u("null",0,"0",n.length+1):u("octal",parseInt(n,8),n,1)):(e=E(/^[dDsSwW]/))?c(e[0]):!1}function D(){var e;if(e=E(/^[fnrtv]/)){var n=0;switch(e[0]){case"t":n=9;break;case"n":n=10;break;case"v":n=11;break;case"f":n=12;break;case"r":n=13}return u("singleEscape",n,"\\"+e[0])}return(e=E(/^c([a-zA-Z])/))?u("controlLetter",e[1].charCodeAt(0)%32,e[1],2):(e=E(/^x([0-9a-fA-F]{2})/))?u("hexadecimalEscape",parseInt(e[1],16),e[1],2):(e=E(/^u([0-9a-fA-F]{4})/))?T(u("unicodeEscape",parseInt(e[1],16),e[1],2)):z&&(e=E(/^u\{([0-9a-fA-F]+)\}/))?u("unicodeCodePointEscape",parseInt(e[1],16),e[1],4):B()}function F(e){var n=new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԯԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠ-ࢲࣤ-ॣ०-९ॱ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఀ-ఃఅ-ఌఎ-ఐఒ-నప-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಁ-ಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲഁ-ഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟ෦-෯ෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧ᪰-᪽ᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶ᳸᳹ᴀ-᷵᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‌‍‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚝꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꧠ-ꧾꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︭︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]");return 36===e||95===e||e>=65&&90>=e||e>=97&&122>=e||e>=48&&57>=e||92===e||e>=128&&n.test(String.fromCharCode(e))}function B(){var e,n="‌",l="‍";return F(v())?b(n)?u("identifier",8204,n):b(l)?u("identifier",8205,l):null:(e=_(),u("identifier",e.charCodeAt(0),e,1))}function N(){var e,n=K;return(e=E(/^\[\^/))?(e=V(),x("]"),g(e,!0,n,K)):b("[")?(e=V(),x("]"),g(e,!1,n,K)):null}function V(){var e;if(I("]"))return[];if(e=q(),!e)throw SyntaxError("nonEmptyClassRanges");return e}function U(e){var n,l,t;if(I("-")&&!w("]")){if(x("-"),t=H(),!t)throw SyntaxError("classAtom");l=K;var r=V();if(!r)throw SyntaxError("classRanges");return n=e.range[0],"empty"===r.type?[m(e,t,n,l)]:[m(e,t,n,l)].concat(r)}if(t=G(),!t)throw SyntaxError("nonEmptyClassRangesNoDash");return[e].concat(t)}function q(){var e=H();if(!e)throw SyntaxError("classAtom");return I("]")?[e]:U(e)}function G(){var e=H();if(!e)throw SyntaxError("classAtom");return I("]")?e:U(e)}function H(){return b("-")?o("-"):W()}function W(){var e;if(e=E(/^[^\\\]-]/))return o(e[0]);if(b("\\")){if(e=P(),!e)throw SyntaxError("classEscape");return T(e)}}var J=[],Y=0,X=!0,z=-1!==(n||"").indexOf("u"),K=0;e=String(e),""===e&&(e="(?:)");var $=k();if($.range[1]!==e.length)throw SyntaxError("Could not parse entire input - got stuck: "+e);for(var Q=0;Q<J.length;Q++)if(J[Q]<=Y)return K=0,X=!1,k();return $}var l={parse:e};"undefined"!=typeof n&&n.exports?n.exports=l:window.regjsparser=l}()},{}],328:[function(e,n){function l(e){return I?v?h.UNICODE_IGNORE_CASE[e]:h.UNICODE[e]:h.REGULAR[e]}function t(e,n){return m.call(e,n)}function r(e,n){for(var l in n)e[l]=n[l]}function a(e,n){if(n){var l=p(n,"");switch(l.type){case"characterClass":case"group":case"value":break;default:l=u(l,n)}r(e,l)}}function u(e,n){return{type:"group",behavior:"ignore",body:[e],raw:"(?:"+n+")"}}function o(e){return t(f,e)?f[e]:!1}function s(e){{var n=d();e.body.forEach(function(e){switch(e.type){case"value":if(n.add(e.codePoint),v&&I){var t=o(e.codePoint);t&&n.add(t)}break;case"characterClassRange":var r=e.min.codePoint,a=e.max.codePoint;n.addRange(r,a),v&&I&&n.iuAddRange(r,a);break;case"characterClassEscape":n.add(l(e.value));break;default:throw Error("Unknown term type: "+e.type)}})}return e.negative&&(n=(I?y:_).clone().remove(n)),a(e,n.toString()),e}function i(e){switch(e.type){case"dot":a(e,(I?x:b).toString());break;case"characterClass":e=s(e);break;case"characterClassEscape":a(e,l(e.value).toString());break;case"alternative":case"disjunction":case"group":case"quantifier":e.body=e.body.map(i);break;case"value":var n=e.codePoint,t=d(n);if(v&&I){var r=o(n);r&&t.add(r)}a(e,t.toString());break;case"anchor":case"empty":case"group":case"reference":break;default:throw Error("Unknown term type: "+e.type)}return e}var c=e("regjsgen").generate,p=e("regjsparser").parse,d=e("regenerate"),f=e("./data/iu-mappings.json"),h=e("./data/character-class-escape-sets.js"),g={},m=g.hasOwnProperty,y=d().addRange(0,1114111),_=d().addRange(0,65535),x=y.clone().remove(10,13,8232,8233),b=x.clone().intersection(_);d.prototype.iuAddRange=function(e,n){var l=this;do{var t=o(e);t&&l.add(t)}while(++e<=n);return l};var v=!1,I=!1;n.exports=function(e,n){var l=p(e,n);return v=n?n.indexOf("i")>-1:!1,I=n?n.indexOf("u")>-1:!1,r(l,i(l)),c(l)}},{"./data/character-class-escape-sets.js":323,"./data/iu-mappings.json":324,regenerate:325,regjsgen:326,regjsparser:327}],329:[function(e,n){"use strict";var l=e("is-finite");n.exports=function(e,n){if("string"!=typeof e)throw new TypeError("Expected a string as the first argument");if(0>n||!l(n))throw new TypeError("Expected a finite positive number");var t="";do 1&n&&(t+=e),e+=e;while(n>>=1);return t}},{"is-finite":330}],330:[function(e,n,l){arguments[4][190][0].apply(l,arguments)},{dup:190}],331:[function(e,n){"use strict";n.exports=/^#!.*/},{}],332:[function(e,n){"use strict";n.exports=function(e){var n=/^\\\\\?\\/.test(e),l=/[^\x00-\x80]+/.test(e);return n||l?e:e.replace(/\\/g,"/")}},{}],333:[function(e,n,l){l.SourceMapGenerator=e("./source-map/source-map-generator").SourceMapGenerator,l.SourceMapConsumer=e("./source-map/source-map-consumer").SourceMapConsumer,l.SourceNode=e("./source-map/source-node").SourceNode},{"./source-map/source-map-consumer":339,"./source-map/source-map-generator":340,"./source-map/source-node":341}],334:[function(e,n){if("function"!=typeof l)var l=e("amdefine")(n,e);l(function(e,n){function l(){this._array=[],this._set={}}var t=e("./util");l.fromArray=function(e,n){for(var t=new l,r=0,a=e.length;a>r;r++)t.add(e[r],n);return t},l.prototype.add=function(e,n){var l=this.has(e),r=this._array.length;(!l||n)&&this._array.push(e),l||(this._set[t.toSetString(e)]=r)},l.prototype.has=function(e){return Object.prototype.hasOwnProperty.call(this._set,t.toSetString(e))},l.prototype.indexOf=function(e){if(this.has(e))return this._set[t.toSetString(e)];throw new Error('"'+e+'" is not in the set.')},l.prototype.at=function(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)},l.prototype.toArray=function(){return this._array.slice()},n.ArraySet=l})},{"./util":342,amdefine:343}],335:[function(e,n){if("function"!=typeof l)var l=e("amdefine")(n,e);l(function(e,n){function l(e){return 0>e?(-e<<1)+1:(e<<1)+0}function t(e){var n=1===(1&e),l=e>>1;return n?-l:l}var r=e("./base64"),a=5,u=1<<a,o=u-1,s=u;n.encode=function(e){var n,t="",u=l(e);do n=u&o,u>>>=a,u>0&&(n|=s),t+=r.encode(n);while(u>0);return t},n.decode=function(e,n,l){var u,i,c=e.length,p=0,d=0;do{if(n>=c)throw new Error("Expected more digits in base 64 VLQ value.");i=r.decode(e.charAt(n++)),u=!!(i&s),i&=o,p+=i<<d,d+=a}while(u);l.value=t(p),l.rest=n}})},{"./base64":336,amdefine:343}],336:[function(e,n){if("function"!=typeof l)var l=e("amdefine")(n,e);l(function(e,n){var l={},t={};"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("").forEach(function(e,n){l[e]=n,t[n]=e}),n.encode=function(e){if(e in t)return t[e];throw new TypeError("Must be between 0 and 63: "+e)},n.decode=function(e){if(e in l)return l[e];throw new TypeError("Not a valid base 64 digit: "+e)}})},{amdefine:343}],337:[function(e,n){if("function"!=typeof l)var l=e("amdefine")(n,e);l(function(e,n){function l(e,t,r,a,u,o){var s=Math.floor((t-e)/2)+e,i=u(r,a[s],!0);return 0===i?s:i>0?t-s>1?l(s,t,r,a,u,o):o==n.LEAST_UPPER_BOUND?t<a.length?t:-1:s:s-e>1?l(e,s,r,a,u,o):o==n.LEAST_UPPER_BOUND?s:0>e?-1:e}n.GREATEST_LOWER_BOUND=1,n.LEAST_UPPER_BOUND=2,n.search=function(e,t,r,a){return 0===t.length?-1:l(-1,t.length,e,t,r,a||n.GREATEST_LOWER_BOUND)}})},{amdefine:343}],338:[function(e,n){if("function"!=typeof l)var l=e("amdefine")(n,e);l(function(e,n){function l(e,n){var l=e.generatedLine,t=n.generatedLine,a=e.generatedColumn,u=n.generatedColumn;return t>l||t==l&&u>=a||r.compareByGeneratedPositions(e,n)<=0}function t(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}var r=e("./util");t.prototype.unsortedForEach=function(e,n){this._array.forEach(e,n)},t.prototype.add=function(e){l(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},t.prototype.toArray=function(){return this._sorted||(this._array.sort(r.compareByGeneratedPositions),this._sorted=!0),this._array},n.MappingList=t})},{"./util":342,amdefine:343}],339:[function(e,n){if("function"!=typeof l)var l=e("amdefine")(n,e);l(function(e,n){function l(e){var n=e;return"string"==typeof e&&(n=JSON.parse(e.replace(/^\)\]\}'/,""))),null!=n.sections?new r(n):new t(n)}function t(e){var n=e;"string"==typeof e&&(n=JSON.parse(e.replace(/^\)\]\}'/,"")));var l=a.getArg(n,"version"),t=a.getArg(n,"sources"),r=a.getArg(n,"names",[]),u=a.getArg(n,"sourceRoot",null),s=a.getArg(n,"sourcesContent",null),i=a.getArg(n,"mappings"),c=a.getArg(n,"file",null);if(l!=this._version)throw new Error("Unsupported version: "+l);t=t.map(a.normalize),this._names=o.fromArray(r,!0),this._sources=o.fromArray(t,!0),this.sourceRoot=u,this.sourcesContent=s,this._mappings=i,this.file=c}function r(e){var n=e;"string"==typeof e&&(n=JSON.parse(e.replace(/^\)\]\}'/,"")));var t=a.getArg(n,"version"),r=a.getArg(n,"sections");if(t!=this._version)throw new Error("Unsupported version: "+t);var u={line:-1,column:0};this._sections=r.map(function(e){if(e.url)throw new Error("Support for url field in sections not implemented.");var n=a.getArg(e,"offset"),t=a.getArg(n,"line"),r=a.getArg(n,"column");if(t<u.line||t===u.line&&r<u.column)throw new Error("Section offsets must be ordered and non-overlapping.");return u=n,{generatedOffset:{generatedLine:t+1,generatedColumn:r+1},consumer:new l(a.getArg(e,"map"))}})}var a=e("./util"),u=e("./binary-search"),o=e("./array-set").ArraySet,s=e("./base64-vlq");l.fromSourceMap=function(e){return t.fromSourceMap(e)},l.prototype._version=3,l.prototype.__generatedMappings=null,Object.defineProperty(l.prototype,"_generatedMappings",{get:function(){return this.__generatedMappings||(this.__generatedMappings=[],this.__originalMappings=[],this._parseMappings(this._mappings,this.sourceRoot)),this.__generatedMappings}}),l.prototype.__originalMappings=null,Object.defineProperty(l.prototype,"_originalMappings",{get:function(){return this.__originalMappings||(this.__generatedMappings=[],this.__originalMappings=[],this._parseMappings(this._mappings,this.sourceRoot)),this.__originalMappings}}),l.prototype._nextCharIsMappingSeparator=function(e,n){var l=e.charAt(n);return";"===l||","===l},l.prototype._parseMappings=function(){throw new Error("Subclasses must implement _parseMappings")},l.GENERATED_ORDER=1,l.ORIGINAL_ORDER=2,l.GREATEST_LOWER_BOUND=1,l.LEAST_UPPER_BOUND=2,l.prototype.eachMapping=function(e,n,t){var r,u=n||null,o=t||l.GENERATED_ORDER;switch(o){case l.GENERATED_ORDER:r=this._generatedMappings;break;case l.ORIGINAL_ORDER:r=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var s=this.sourceRoot;r.map(function(e){var n=e.source;return null!=n&&null!=s&&(n=a.join(s,n)),{source:n,generatedLine:e.generatedLine,generatedColumn:e.generatedColumn,originalLine:e.originalLine,originalColumn:e.originalColumn,name:e.name}}).forEach(e,u)},l.prototype.allGeneratedPositionsFor=function(e){var n={source:a.getArg(e,"source"),originalLine:a.getArg(e,"line"),originalColumn:0};null!=this.sourceRoot&&(n.source=a.relative(this.sourceRoot,n.source));var l=[],t=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",a.compareByOriginalPositions,u.LEAST_UPPER_BOUND);if(t>=0)for(var r=this._originalMappings[t];r&&r.originalLine===n.originalLine;)l.push({line:a.getArg(r,"generatedLine",null),column:a.getArg(r,"generatedColumn",null),lastColumn:a.getArg(r,"lastGeneratedColumn",null)}),r=this._originalMappings[++t];return l},n.SourceMapConsumer=l,t.prototype=Object.create(l.prototype),t.prototype.consumer=l,t.fromSourceMap=function(e){var n=Object.create(t.prototype);return n._names=o.fromArray(e._names.toArray(),!0),n._sources=o.fromArray(e._sources.toArray(),!0),n.sourceRoot=e._sourceRoot,n.sourcesContent=e._generateSourcesContent(n._sources.toArray(),n.sourceRoot),n.file=e._file,n.__generatedMappings=e._mappings.toArray().slice(),n.__originalMappings=e._mappings.toArray().slice().sort(a.compareByOriginalPositions),n},t.prototype._version=3,Object.defineProperty(t.prototype,"sources",{get:function(){return this._sources.toArray().map(function(e){return null!=this.sourceRoot?a.join(this.sourceRoot,e):e},this)}}),t.prototype._parseMappings=function(e){for(var n,l,t,r,u=1,o=0,i=0,c=0,p=0,d=0,f=e.length,h=0,g={},m={};f>h;)if(";"===e.charAt(h))u++,++h,o=0;else if(","===e.charAt(h))++h;else{for(n={},n.generatedLine=u,r=h;f>r&&!this._nextCharIsMappingSeparator(e,r);++r);if(l=e.slice(h,r),t=g[l])h+=l.length;else{for(t=[];r>h;)s.decode(e,h,m),value=m.value,h=m.rest,t.push(value);g[l]=t}if(n.generatedColumn=o+t[0],o=n.generatedColumn,t.length>1){if(n.source=this._sources.at(p+t[1]),p+=t[1],2===t.length)throw new Error("Found a source, but no line and column");if(n.originalLine=i+t[2],i=n.originalLine,n.originalLine+=1,3===t.length)throw new Error("Found a source and line, but no column");n.originalColumn=c+t[3],c=n.originalColumn,t.length>4&&(n.name=this._names.at(d+t[4]),d+=t[4])}this.__generatedMappings.push(n),"number"==typeof n.originalLine&&this.__originalMappings.push(n)}this.__generatedMappings.sort(a.compareByGeneratedPositions),this.__originalMappings.sort(a.compareByOriginalPositions)},t.prototype._findMapping=function(e,n,l,t,r,a){if(e[l]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[l]);if(e[t]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[t]);return u.search(e,n,r,a)},t.prototype.computeColumnSpans=function(){for(var e=0;e<this._generatedMappings.length;++e){var n=this._generatedMappings[e];if(e+1<this._generatedMappings.length){var l=this._generatedMappings[e+1];if(n.generatedLine===l.generatedLine){n.lastGeneratedColumn=l.generatedColumn-1;continue}}n.lastGeneratedColumn=1/0}},t.prototype.originalPositionFor=function(e){var n={generatedLine:a.getArg(e,"line"),generatedColumn:a.getArg(e,"column")},t=this._findMapping(n,this._generatedMappings,"generatedLine","generatedColumn",a.compareByGeneratedPositions,a.getArg(e,"bias",l.GREATEST_LOWER_BOUND));if(t>=0){var r=this._generatedMappings[t];if(r.generatedLine===n.generatedLine){var u=a.getArg(r,"source",null);return null!=u&&null!=this.sourceRoot&&(u=a.join(this.sourceRoot,u)),{source:u,line:a.getArg(r,"originalLine",null),column:a.getArg(r,"originalColumn",null),name:a.getArg(r,"name",null)}}}return{source:null,line:null,column:null,name:null}},t.prototype.sourceContentFor=function(e,n){if(!this.sourcesContent)return null;if(null!=this.sourceRoot&&(e=a.relative(this.sourceRoot,e)),this._sources.has(e))return this.sourcesContent[this._sources.indexOf(e)];var l;if(null!=this.sourceRoot&&(l=a.urlParse(this.sourceRoot))){var t=e.replace(/^file:\/\//,"");if("file"==l.scheme&&this._sources.has(t))return this.sourcesContent[this._sources.indexOf(t)];if((!l.path||"/"==l.path)&&this._sources.has("/"+e))return this.sourcesContent[this._sources.indexOf("/"+e)]}if(n)return null;throw new Error('"'+e+'" is not in the SourceMap.')},t.prototype.generatedPositionFor=function(e){var n={source:a.getArg(e,"source"),originalLine:a.getArg(e,"line"),originalColumn:a.getArg(e,"column")};null!=this.sourceRoot&&(n.source=a.relative(this.sourceRoot,n.source));var t=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",a.compareByOriginalPositions,a.getArg(e,"bias",l.GREATEST_LOWER_BOUND));if(t>=0){var r=this._originalMappings[t];return{line:a.getArg(r,"generatedLine",null),column:a.getArg(r,"generatedColumn",null),lastColumn:a.getArg(r,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},n.BasicSourceMapConsumer=t,r.prototype=Object.create(l.prototype),r.prototype.constructor=l,r.prototype._version=3,Object.defineProperty(r.prototype,"sources",{get:function(){for(var e=[],n=0;n<this._sections.length;n++)for(var l=0;l<this._sections[n].consumer.sources.length;l++)e.push(this._sections[n].consumer.sources[l]); return e}}),r.prototype.originalPositionFor=function(e){var n={generatedLine:a.getArg(e,"line"),generatedColumn:a.getArg(e,"column")},l=u.search(n,this._sections,function(e,n){var l=e.generatedLine-n.generatedOffset.generatedLine;return l?l:e.generatedColumn-n.generatedOffset.generatedColumn}),t=this._sections[l];return t?t.consumer.originalPositionFor({line:n.generatedLine-(t.generatedOffset.generatedLine-1),column:n.generatedColumn-(t.generatedOffset.generatedLine===n.generatedLine?t.generatedOffset.generatedColumn-1:0),bias:e.bias}):{source:null,line:null,column:null,name:null}},r.prototype.sourceContentFor=function(e,n){for(var l=0;l<this._sections.length;l++){var t=this._sections[l],r=t.consumer.sourceContentFor(e,!0);if(r)return r}if(n)return null;throw new Error('"'+e+'" is not in the SourceMap.')},r.prototype.generatedPositionFor=function(e){for(var n=0;n<this._sections.length;n++){var l=this._sections[n];if(-1!==l.consumer.sources.indexOf(a.getArg(e,"source"))){var t=l.consumer.generatedPositionFor(e);if(t){var r={line:t.line+(l.generatedOffset.generatedLine-1),column:t.column+(l.generatedOffset.generatedLine===t.line?l.generatedOffset.generatedColumn-1:0)};return r}}}return{line:null,column:null}},r.prototype._parseMappings=function(){this.__generatedMappings=[],this.__originalMappings=[];for(var e=0;e<this._sections.length;e++)for(var n=this._sections[e],l=n.consumer._generatedMappings,t=0;t<l.length;t++){var r=l[e],u=r.source,o=n.consumer.sourceRoot;null!=u&&null!=o&&(u=a.join(o,u));var s={source:u,generatedLine:r.generatedLine+(n.generatedOffset.generatedLine-1),generatedColumn:r.column+(n.generatedOffset.generatedLine===r.generatedLine)?n.generatedOffset.generatedColumn-1:0,originalLine:r.originalLine,originalColumn:r.originalColumn,name:r.name};this.__generatedMappings.push(s),"number"==typeof s.originalLine&&this.__originalMappings.push(s)}this.__generatedMappings.sort(a.compareByGeneratedPositions),this.__originalMappings.sort(a.compareByOriginalPositions)},n.IndexedSourceMapConsumer=r})},{"./array-set":334,"./base64-vlq":335,"./binary-search":337,"./util":342,amdefine:343}],340:[function(e,n){if("function"!=typeof l)var l=e("amdefine")(n,e);l(function(e,n){function l(e){e||(e={}),this._file=r.getArg(e,"file",null),this._sourceRoot=r.getArg(e,"sourceRoot",null),this._skipValidation=r.getArg(e,"skipValidation",!1),this._sources=new a,this._names=new a,this._mappings=new u,this._sourcesContents=null}var t=e("./base64-vlq"),r=e("./util"),a=e("./array-set").ArraySet,u=e("./mapping-list").MappingList;l.prototype._version=3,l.fromSourceMap=function(e){var n=e.sourceRoot,t=new l({file:e.file,sourceRoot:n});return e.eachMapping(function(e){var l={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(l.source=e.source,null!=n&&(l.source=r.relative(n,l.source)),l.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(l.name=e.name)),t.addMapping(l)}),e.sources.forEach(function(n){var l=e.sourceContentFor(n);null!=l&&t.setSourceContent(n,l)}),t},l.prototype.addMapping=function(e){var n=r.getArg(e,"generated"),l=r.getArg(e,"original",null),t=r.getArg(e,"source",null),a=r.getArg(e,"name",null);this._skipValidation||this._validateMapping(n,l,t,a),null==t||this._sources.has(t)||this._sources.add(t),null==a||this._names.has(a)||this._names.add(a),this._mappings.add({generatedLine:n.line,generatedColumn:n.column,originalLine:null!=l&&l.line,originalColumn:null!=l&&l.column,source:t,name:a})},l.prototype.setSourceContent=function(e,n){var l=e;null!=this._sourceRoot&&(l=r.relative(this._sourceRoot,l)),null!=n?(this._sourcesContents||(this._sourcesContents={}),this._sourcesContents[r.toSetString(l)]=n):this._sourcesContents&&(delete this._sourcesContents[r.toSetString(l)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},l.prototype.applySourceMap=function(e,n,l){var t=n;if(null==n){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');t=e.file}var u=this._sourceRoot;null!=u&&(t=r.relative(u,t));var o=new a,s=new a;this._mappings.unsortedForEach(function(n){if(n.source===t&&null!=n.originalLine){var a=e.originalPositionFor({line:n.originalLine,column:n.originalColumn});null!=a.source&&(n.source=a.source,null!=l&&(n.source=r.join(l,n.source)),null!=u&&(n.source=r.relative(u,n.source)),n.originalLine=a.line,n.originalColumn=a.column,null!=a.name&&(n.name=a.name))}var i=n.source;null==i||o.has(i)||o.add(i);var c=n.name;null==c||s.has(c)||s.add(c)},this),this._sources=o,this._names=s,e.sources.forEach(function(n){var t=e.sourceContentFor(n);null!=t&&(null!=l&&(n=r.join(l,n)),null!=u&&(n=r.relative(u,n)),this.setSourceContent(n,t))},this)},l.prototype._validateMapping=function(e,n,l,t){if(!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!n&&!l&&!t||e&&"line"in e&&"column"in e&&n&&"line"in n&&"column"in n&&e.line>0&&e.column>=0&&n.line>0&&n.column>=0&&l))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:l,original:n,name:t}))},l.prototype._serializeMappings=function(){for(var e,n=0,l=1,a=0,u=0,o=0,s=0,i="",c=this._mappings.toArray(),p=0,d=c.length;d>p;p++){if(e=c[p],e.generatedLine!==l)for(n=0;e.generatedLine!==l;)i+=";",l++;else if(p>0){if(!r.compareByGeneratedPositions(e,c[p-1]))continue;i+=","}i+=t.encode(e.generatedColumn-n),n=e.generatedColumn,null!=e.source&&(i+=t.encode(this._sources.indexOf(e.source)-s),s=this._sources.indexOf(e.source),i+=t.encode(e.originalLine-1-u),u=e.originalLine-1,i+=t.encode(e.originalColumn-a),a=e.originalColumn,null!=e.name&&(i+=t.encode(this._names.indexOf(e.name)-o),o=this._names.indexOf(e.name)))}return i},l.prototype._generateSourcesContent=function(e,n){return e.map(function(e){if(!this._sourcesContents)return null;null!=n&&(e=r.relative(n,e));var l=r.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,l)?this._sourcesContents[l]:null},this)},l.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},l.prototype.toString=function(){return JSON.stringify(this.toJSON())},n.SourceMapGenerator=l})},{"./array-set":334,"./base64-vlq":335,"./mapping-list":338,"./util":342,amdefine:343}],341:[function(e,n){if("function"!=typeof l)var l=e("amdefine")(n,e);l(function(e,n){function l(e,n,l,t,r){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==n?null:n,this.source=null==l?null:l,this.name=null==r?null:r,this[o]=!0,null!=t&&this.add(t)}var t=e("./source-map-generator").SourceMapGenerator,r=e("./util"),a=/(\r?\n)/,u=10,o="$$$isSourceNode$$$";l.fromStringWithSourceMap=function(e,n,t){function u(e,n){if(null===e||void 0===e.source)o.add(n);else{var a=t?r.join(t,e.source):e.source;o.add(new l(e.originalLine,e.originalColumn,a,n,e.name))}}var o=new l,s=e.split(a),i=function(){var e=s.shift(),n=s.shift()||"";return e+n},c=1,p=0,d=null;return n.eachMapping(function(e){if(null!==d){if(!(c<e.generatedLine)){var n=s[0],l=n.substr(0,e.generatedColumn-p);return s[0]=n.substr(e.generatedColumn-p),p=e.generatedColumn,u(d,l),void(d=e)}var l="";u(d,i()),c++,p=0}for(;c<e.generatedLine;)o.add(i()),c++;if(p<e.generatedColumn){var n=s[0];o.add(n.substr(0,e.generatedColumn)),s[0]=n.substr(e.generatedColumn),p=e.generatedColumn}d=e},this),s.length>0&&(d&&u(d,i()),o.add(s.join(""))),n.sources.forEach(function(e){var l=n.sourceContentFor(e);null!=l&&(null!=t&&(e=r.join(t,e)),o.setSourceContent(e,l))}),o},l.prototype.add=function(e){if(Array.isArray(e))e.forEach(function(e){this.add(e)},this);else{if(!e[o]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);e&&this.children.push(e)}return this},l.prototype.prepend=function(e){if(Array.isArray(e))for(var n=e.length-1;n>=0;n--)this.prepend(e[n]);else{if(!e[o]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this},l.prototype.walk=function(e){for(var n,l=0,t=this.children.length;t>l;l++)n=this.children[l],n[o]?n.walk(e):""!==n&&e(n,{source:this.source,line:this.line,column:this.column,name:this.name})},l.prototype.join=function(e){var n,l,t=this.children.length;if(t>0){for(n=[],l=0;t-1>l;l++)n.push(this.children[l]),n.push(e);n.push(this.children[l]),this.children=n}return this},l.prototype.replaceRight=function(e,n){var l=this.children[this.children.length-1];return l[o]?l.replaceRight(e,n):"string"==typeof l?this.children[this.children.length-1]=l.replace(e,n):this.children.push("".replace(e,n)),this},l.prototype.setSourceContent=function(e,n){this.sourceContents[r.toSetString(e)]=n},l.prototype.walkSourceContents=function(e){for(var n=0,l=this.children.length;l>n;n++)this.children[n][o]&&this.children[n].walkSourceContents(e);for(var t=Object.keys(this.sourceContents),n=0,l=t.length;l>n;n++)e(r.fromSetString(t[n]),this.sourceContents[t[n]])},l.prototype.toString=function(){var e="";return this.walk(function(n){e+=n}),e},l.prototype.toStringWithSourceMap=function(e){var n={code:"",line:1,column:0},l=new t(e),r=!1,a=null,o=null,s=null,i=null;return this.walk(function(e,t){n.code+=e,null!==t.source&&null!==t.line&&null!==t.column?((a!==t.source||o!==t.line||s!==t.column||i!==t.name)&&l.addMapping({source:t.source,original:{line:t.line,column:t.column},generated:{line:n.line,column:n.column},name:t.name}),a=t.source,o=t.line,s=t.column,i=t.name,r=!0):r&&(l.addMapping({generated:{line:n.line,column:n.column}}),a=null,r=!1);for(var c=0,p=e.length;p>c;c++)e.charCodeAt(c)===u?(n.line++,n.column=0,c+1===p?(a=null,r=!1):r&&l.addMapping({source:t.source,original:{line:t.line,column:t.column},generated:{line:n.line,column:n.column},name:t.name})):n.column++}),this.walkSourceContents(function(e,n){l.setSourceContent(e,n)}),{code:n.code,map:l}},n.SourceNode=l})},{"./source-map-generator":340,"./util":342,amdefine:343}],342:[function(e,n){if("function"!=typeof l)var l=e("amdefine")(n,e);l(function(e,n){function l(e,n,l){if(n in e)return e[n];if(3===arguments.length)return l;throw new Error('"'+n+'" is a required argument.')}function t(e){var n=e.match(f);return n?{scheme:n[1],auth:n[2],host:n[3],port:n[4],path:n[5]}:null}function r(e){var n="";return e.scheme&&(n+=e.scheme+":"),n+="//",e.auth&&(n+=e.auth+"@"),e.host&&(n+=e.host),e.port&&(n+=":"+e.port),e.path&&(n+=e.path),n}function a(e){var n=e,l=t(e);if(l){if(!l.path)return e;n=l.path}for(var a,u="/"===n.charAt(0),o=n.split(/\/+/),s=0,i=o.length-1;i>=0;i--)a=o[i],"."===a?o.splice(i,1):".."===a?s++:s>0&&(""===a?(o.splice(i+1,s),s=0):(o.splice(i,2),s--));return n=o.join("/"),""===n&&(n=u?"/":"."),l?(l.path=n,r(l)):n}function u(e,n){""===e&&(e="."),""===n&&(n=".");var l=t(n),u=t(e);if(u&&(e=u.path||"/"),l&&!l.scheme)return u&&(l.scheme=u.scheme),r(l);if(l||n.match(h))return n;if(u&&!u.host&&!u.path)return u.host=n,r(u);var o="/"===n.charAt(0)?n:a(e.replace(/\/+$/,"")+"/"+n);return u?(u.path=o,r(u)):o}function o(e,n){""===e&&(e="."),e=e.replace(/\/$/,"");var l=t(e);return"/"==n.charAt(0)&&l&&"/"==l.path?n.slice(1):0===n.indexOf(e+"/")?n.substr(e.length+1):n}function s(e){return"$"+e}function i(e){return e.substr(1)}function c(e,n){var l=e||"",t=n||"";return(l>t)-(t>l)}function p(e,n,l){var t;return(t=c(e.source,n.source))?t:(t=e.originalLine-n.originalLine)?t:(t=e.originalColumn-n.originalColumn,t||l?t:(t=c(e.name,n.name))?t:(t=e.generatedLine-n.generatedLine,t?t:e.generatedColumn-n.generatedColumn))}function d(e,n,l){var t;return(t=e.generatedLine-n.generatedLine)?t:(t=e.generatedColumn-n.generatedColumn,t||l?t:(t=c(e.source,n.source))?t:(t=e.originalLine-n.originalLine)?t:(t=e.originalColumn-n.originalColumn,t?t:c(e.name,n.name)))}n.getArg=l;var f=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/,h=/^data:.+\,.+$/;n.urlParse=t,n.urlGenerate=r,n.normalize=a,n.join=u,n.relative=o,n.toSetString=s,n.fromSetString=i,n.compareByOriginalPositions=p,n.compareByGeneratedPositions=d})},{amdefine:343}],343:[function(e,n){(function(l,t){"use strict";function r(n,r){function a(e){var n,l;for(n=0;e[n];n+=1)if(l=e[n],"."===l)e.splice(n,1),n-=1;else if(".."===l){if(1===n&&(".."===e[2]||".."===e[0]))break;n>0&&(e.splice(n-1,2),n-=2)}}function u(e,n){var l;return e&&"."===e.charAt(0)&&n&&(l=n.split("/"),l=l.slice(0,l.length-1),l=l.concat(e.split("/")),a(l),e=l.join("/")),e}function o(e){return function(n){return u(n,e)}}function s(e){function n(n){h[e]=n}return n.fromText=function(){throw new Error("amdefine does not implement load.fromText")},n}function i(e,l,a){var u,o,s,i;if(e)o=h[e]={},s={id:e,uri:t,exports:o},u=p(r,o,s,e);else{if(g)throw new Error("amdefine with no module ID cannot be called more than once per file.");g=!0,o=n.exports,s=n,u=p(r,o,s,n.id)}l&&(l=l.map(function(e){return u(e)})),i="function"==typeof a?a.apply(s.exports,l):a,void 0!==i&&(s.exports=i,e&&(h[e]=s.exports))}function c(e,n,l){Array.isArray(e)?(l=n,n=e,e=void 0):"string"!=typeof e&&(l=e,e=n=void 0),n&&!Array.isArray(n)&&(l=n,n=void 0),n||(n=["require","exports","module"]),e?f[e]=[e,n,l]:i(e,n,l)}var p,d,f={},h={},g=!1,m=e("path");return p=function(e,n,t,r){function a(a,u){return"string"==typeof a?d(e,n,t,a,r):(a=a.map(function(l){return d(e,n,t,l,r)}),void l.nextTick(function(){u.apply(null,a)}))}return a.toUrl=function(e){return 0===e.indexOf(".")?u(e,m.dirname(t.filename)):e},a},r=r||function(){return n.require.apply(n,arguments)},d=function(e,n,l,t,r){var a,c,g=t.indexOf("!"),m=t;if(-1===g){if(t=u(t,r),"require"===t)return p(e,n,l,r);if("exports"===t)return n;if("module"===t)return l;if(h.hasOwnProperty(t))return h[t];if(f[t])return i.apply(null,f[t]),h[t];if(e)return e(m);throw new Error("No module with ID: "+t)}return a=t.substring(0,g),t=t.substring(g+1,t.length),c=d(e,n,l,a,r),t=c.normalize?c.normalize(t,o(r)):u(t,r),h[t]?h[t]:(c.load(t,p(e,n,l,r),s(t),{}),h[t])},c.require=function(e){return h[e]?h[e]:f[e]?(i.apply(null,f[e]),h[e]):void 0},c.amd={},c}n.exports=r}).call(this,e("_process"),"/node_modules/source-map/node_modules/amdefine/amdefine.js")},{_process:151,path:150}],344:[function(e,n,l){"use strict";n.exports=function t(e){function n(){}return n.prototype=e,n}},{}],345:[function(e,n){"use strict";n.exports=function(e){return e.replace(/[\s\uFEFF\xA0]+$/g,"")}},{}],346:[function(e,n){n.exports={name:"babel",description:"Turn ES6 code into readable vanilla ES5 with source maps",version:"4.7.0",author:"Sebastian McKenzie <sebmck@gmail.com>",homepage:"https://babeljs.io/",repository:"babel/babel",preferGlobal:!0,main:"lib/babel/api/node.js",browser:{"./lib/babel/api/register/node.js":"./lib/babel/api/register/browser.js"},bin:{"6to5":"./bin/deprecated/6to5","6to5-node":"./bin/deprecated/6to5-node","6to5-runtime":"./bin/deprecated/6to5-runtime",babel:"./bin/babel/index.js","babel-node":"./bin/babel-node","babel-external-helpers":"./bin/babel-external-helpers"},keywords:["harmony","classes","modules","let","const","var","es6","transpile","transpiler","6to5","babel"],scripts:{bench:"make bench",test:"make test"},dependencies:{"acorn-babel":"0.11.1-37","ast-types":"~0.7.0",chalk:"^1.0.0",chokidar:"^0.12.6",commander:"^2.6.0","convert-source-map":"^0.5.0","core-js":"^0.6.1",debug:"^2.1.1","detect-indent":"^3.0.0",estraverse:"^1.9.1",esutils:"^1.1.6","fs-readdir-recursive":"^0.1.0",globals:"^6.2.0","is-integer":"^1.0.4","js-tokens":"1.0.0",leven:"^1.0.1","line-numbers":"0.2.0",lodash:"^3.2.0","output-file-sync":"^1.1.0","path-is-absolute":"^1.0.0","private":"^0.1.6","regenerator-babel":"0.8.13-2",regexpu:"^1.1.2",repeating:"^1.1.2","shebang-regex":"^1.0.0",slash:"^1.0.0","source-map":"^0.4.0","source-map-support":"^0.2.9","to-fast-properties":"^1.0.0","trim-right":"^1.0.0"},devDependencies:{babel:"4.6.0",browserify:"^9.0.3",chai:"^2.0.0",eslint:"^0.15.1","babel-eslint":"^1.0.1",esvalid:"^1.1.0",istanbul:"^0.3.5",matcha:"^0.6.0",mocha:"^2.1.0",rimraf:"^2.2.8","uglify-js":"^2.4.16"}}},{}],347:[function(e,n){n.exports={"abstract-expression-call":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"PROPERTY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"referenceGet",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!0,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"call",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"abstract-expression-delete":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"PROPERTY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"referenceDelete",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!0,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"abstract-expression-get":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"PROPERTY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"referenceGet",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!0,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"abstract-expression-set":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"PROPERTY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"referenceSet",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!0,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VALUE",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"apply-constructor":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Constructor",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"args",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"instance",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"create",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Constructor",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"result",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Constructor",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"apply",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"instance",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"args",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"result",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},operator:"!=",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:null,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"result",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"==",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"object",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"||",right:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"result",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"==",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"function",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"result",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},alternate:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"instance",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"array-comprehension-container":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"ArrayExpression",start:null,end:null,loc:null,range:null,elements:[],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},arguments:[],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"array-from":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"from",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VALUE",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"array-push":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"push",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"STATEMENT",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"async-to-generator":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"fn",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"gen",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"fn",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"apply",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"ThisExpression",start:null,end:null,loc:null,range:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arguments",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"NewExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Promise",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},arguments:[{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"resolve",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"reject",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"callNext",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"step",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"bind",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Literal",start:null,end:null,loc:null,range:null,value:null,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},{type:"Literal",start:null,end:null,loc:null,range:null,value:"next",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"callThrow",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"step",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"bind",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Literal",start:null,end:null,loc:null,range:null,value:null,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},{type:"Literal",start:null,end:null,loc:null,range:null,value:"throw",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"FunctionDeclaration",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"step",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arg",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"TryStatement",start:null,end:null,loc:null,range:null,block:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"info",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"gen",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!0,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arg",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"info",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},handler:{type:"CatchClause",start:null,end:null,loc:null,range:null,param:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"error",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},guard:null,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"reject",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"error",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},guardedHandlers:[],finalizer:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"info",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"done",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"resolve",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},alternate:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Promise",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"resolve",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"then",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"callNext",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"callThrow",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"callNext",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},arguments:[],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},bind:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Function",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"bind",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},call:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"call",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"CONTEXT",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"class-call-check":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"instance",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Constructor",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"!",prefix:!0,argument:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"instance",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},operator:"instanceof",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Constructor",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ThrowStatement",start:null,end:null,loc:null,range:null,argument:{type:"NewExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"TypeError",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},arguments:[{type:"Literal",start:null,end:null,loc:null,range:null,value:"Cannot call a class as a function",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},alternate:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"class-super-constructor-call-loose":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"SUPER_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},operator:"!=",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:null,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"SUPER_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"apply",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"ThisExpression",start:null,end:null,loc:null,range:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arguments",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},alternate:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"class-super-constructor-call":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"SUPER_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},operator:"!=",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:null,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"SUPER_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"apply",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"ThisExpression",start:null,end:null,loc:null,range:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arguments",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},alternate:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"corejs-is-iterator":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"CORE_ID",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"$for",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"isIterable",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VALUE",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"corejs-iterator":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"CORE_ID",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"$for",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getIterator",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VALUE",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"create-class":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"FunctionDeclaration",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defineProperties",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"target",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"props",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ForInStatement",start:null,end:null,loc:null,range:null,left:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"props",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prop",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"props",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!0,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prop",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"configurable",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Literal",start:null,end:null,loc:null,range:null,value:!0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prop",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prop",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"writable",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Literal",start:null,end:null,loc:null,range:null,value:!0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defineProperties",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"target",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"props",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Constructor",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"protoProps",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"staticProps",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"protoProps",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},consequent:{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defineProperties",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},arguments:[{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Constructor",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"protoProps",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"staticProps",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},consequent:{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defineProperties",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Constructor",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"staticProps",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Constructor",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},arguments:[],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"default-parameter":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VARIABLE_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARGUMENTS",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARGUMENT_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!0,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undefined",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"DEFAULT_VALUE",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},alternate:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARGUMENTS",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARGUMENT_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!0,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"let",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},defaults:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defaults",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"keys",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getOwnPropertyNames",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defaults",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"ForStatement",start:null,end:null,loc:null,range:null,init:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"Literal",start:null,end:null,loc:null,range:null,value:0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},operator:"<",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"keys",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"length",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},update:{type:"UpdateExpression",start:null,end:null,loc:null,range:null,operator:"++",prefix:!1,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"keys",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!0,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getOwnPropertyDescriptor",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defaults",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},operator:"&&",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"configurable",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!0,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undefined",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defineProperty",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},alternate:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"define-property":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defineProperty",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[{type:"Property",start:null,end:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},value:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},kind:"init",_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Property",start:null,end:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"enumerable",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},value:{type:"Literal",start:null,end:null,loc:null,range:null,value:!0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},kind:"init",_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Property",start:null,end:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"configurable",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},value:{type:"Literal",start:null,end:null,loc:null,range:null,value:!0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},kind:"init",_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Property",start:null,end:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"writable",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},value:{type:"Literal",start:null,end:null,loc:null,range:null,value:!0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},kind:"init",_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"exports-assign":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"exports",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VALUE",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"exports-default-assign":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"module",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"exports",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VALUE",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"exports-module-declaration-loose":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"exports",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"__esModule",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Literal",start:null,end:null,loc:null,range:null,value:!0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"exports-module-declaration":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defineProperty",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"exports",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Literal",start:null,end:null,loc:null,range:null,value:"__esModule",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[{type:"Property",start:null,end:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},value:{type:"Literal",start:null,end:null,loc:null,range:null,value:!0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},kind:"init",_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"extends":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"assign",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"||",right:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"target",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ForStatement",start:null,end:null,loc:null,range:null,init:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"Literal",start:null,end:null,loc:null,range:null,value:1,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},operator:"<",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arguments",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"length",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},update:{type:"UpdateExpression",start:null,end:null,loc:null,range:null,operator:"++",prefix:!1,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"source",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arguments",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!0,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"ForInStatement",start:null,end:null,loc:null,range:null,left:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"source",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"hasOwnProperty",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"call",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"source",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"target",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!0,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"source",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!0,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},alternate:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"target",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"for-of-loose":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ForStatement",start:null,end:null,loc:null,range:null,init:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"IS_ARRAY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"isArray",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"INDEX",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"Literal",start:null,end:null,loc:null,range:null,value:0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"IS_ARRAY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},consequent:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},alternate:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"iterator",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!0,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},test:null,update:null,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ID",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"IS_ARRAY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"INDEX",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},operator:">=",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"length",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BreakStatement",start:null,end:null,loc:null,range:null,label:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},alternate:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ID",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"UpdateExpression",start:null,end:null,loc:null,range:null,operator:"++",prefix:!1,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"INDEX",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!0,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},alternate:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"INDEX",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},right:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"next",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"INDEX",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"done",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BreakStatement",start:null,end:null,loc:null,range:null,label:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},alternate:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ID",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"INDEX",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"for-of":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ITERATOR_COMPLETION",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"Literal",start:null,end:null,loc:null,range:null,value:!0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ITERATOR_HAD_ERROR_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"Literal",start:null,end:null,loc:null,range:null,value:!1,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ITERATOR_ERROR_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undefined",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"TryStatement",start:null,end:null,loc:null,range:null,block:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ForStatement",start:null,end:null,loc:null,range:null,init:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ITERATOR_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"iterator",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!0,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"STEP_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},test:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"!",prefix:!0,argument:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ITERATOR_COMPLETION",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"STEP_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},right:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ITERATOR_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"next",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"done",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},update:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ITERATOR_COMPLETION",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},right:{type:"Literal",start:null,end:null,loc:null,range:null,value:!0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},handler:{type:"CatchClause",start:null,end:null,loc:null,range:null,param:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"err",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},guard:null,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ITERATOR_HAD_ERROR_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},right:{type:"Literal",start:null,end:null,loc:null,range:null,value:!0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ITERATOR_ERROR_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"err",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},guardedHandlers:[],finalizer:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"TryStatement",start:null,end:null,loc:null,range:null,block:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"!",prefix:!0,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ITERATOR_COMPLETION",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ITERATOR_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Literal",start:null,end:null,loc:null,range:null,value:"return",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},computed:!0,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ITERATOR_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Literal",start:null,end:null,loc:null,range:null,value:"return",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},computed:!0,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},alternate:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},handler:null,guardedHandlers:[],finalizer:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ITERATOR_HAD_ERROR_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ThrowStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ITERATOR_ERROR_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},alternate:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},get:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"get",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"object",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"property",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"receiver",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getOwnPropertyDescriptor",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"object",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"property",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},operator:"===",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undefined",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"parent",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getPrototypeOf",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"object",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"parent",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},operator:"===",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:null,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undefined",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},alternate:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"get",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"parent",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"property",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"receiver",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},alternate:{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Literal",start:null,end:null,loc:null,range:null,value:"value",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},operator:"in",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"writable",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},alternate:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getter",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"get",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getter",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},operator:"===",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undefined",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undefined",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},alternate:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getter",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"call",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"receiver",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"has-own":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"hasOwnProperty",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},inherits:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"subClass",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"!==",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"function",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},operator:"!==",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:null,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ThrowStatement",start:null,end:null,loc:null,range:null,argument:{type:"NewExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"TypeError",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},arguments:[{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Literal",start:null,end:null,loc:null,range:null,value:"Super expression must either be null or a function, not ",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},operator:"+",right:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},alternate:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"subClass",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"create",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},operator:"&&",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[{type:"Property",start:null,end:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"constructor",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},value:{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[{type:"Property",start:null,end:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},value:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"subClass",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},kind:"init",_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Property",start:null,end:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"enumerable",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},value:{type:"Literal",start:null,end:null,loc:null,range:null,value:!1,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},kind:"init",_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Property",start:null,end:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"writable",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},value:{type:"Literal",start:null,end:null,loc:null,range:null,value:!0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},kind:"init",_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Property",start:null,end:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"configurable",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},value:{type:"Literal",start:null,end:null,loc:null,range:null,value:!0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},kind:"init",_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},kind:"init",_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},consequent:{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"subClass",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"__proto__",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"interop-require-wildcard":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},operator:"&&",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"__esModule",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},alternate:{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[{type:"Property",start:null,end:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{type:"Literal",start:null,end:null,loc:null,range:null,value:"default",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},value:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},kind:"init",_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"interop-require":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},operator:"&&",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"__esModule",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Literal",start:null,end:null,loc:null,range:null,value:"default",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},computed:!0,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"let-scoping-return":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"RETURN",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"object",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"RETURN",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"v",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"named-function":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"FunctionDeclaration",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"GET_OUTER_ID",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},generator:!1,expression:!1,params:[],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION_ID",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},arguments:[],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"object-destructuring-empty":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},operator:"==",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:null,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"ThrowStatement",start:null,end:null,loc:null,range:null,argument:{type:"NewExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"TypeError",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},arguments:[{type:"Literal",start:null,end:null,loc:null,range:null,value:"Cannot destructure undefined",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"object-without-properties":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"keys",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"target",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"ForInStatement",start:null,end:null,loc:null,range:null,left:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"keys",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"indexOf",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:">=",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"ContinueStatement",start:null,end:null,loc:null,range:null,label:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},alternate:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"!",prefix:!0,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"hasOwnProperty",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"call",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"ContinueStatement",start:null,end:null,loc:null,range:null,label:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},alternate:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"target",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!0,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!0,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"target",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"property-method-assignment-wrapper-generator":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"WRAPPER_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION_ID",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},generator:!0,expression:!1,params:[],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"YieldExpression",start:null,end:null,loc:null,range:null,delegate:!0,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"apply",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"ThisExpression",start:null,end:null,loc:null,range:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arguments",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"WRAPPER_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"toString",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"toString",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"WRAPPER_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"property-method-assignment-wrapper":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"WRAPPER_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION_ID",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},generator:!1,expression:!1,params:[],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"apply",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"ThisExpression",start:null,end:null,loc:null,range:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arguments",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"WRAPPER_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"toString",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"toString",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"WRAPPER_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"prototype-identifier":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"CLASS_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"prototype-properties":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"child",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"staticProps",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"instanceProps",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"staticProps",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},consequent:{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defineProperties",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"child",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"staticProps",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"instanceProps",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},consequent:{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defineProperties",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"child",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"instanceProps",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"require-assign-key":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VARIABLE_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"require",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"MODULE_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},require:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"require",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"MODULE_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},rest:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ForStatement",start:null,end:null,loc:null,range:null,init:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LEN",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARGUMENTS",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"length",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARRAY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARRAY_LEN",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"START",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},operator:"<",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LEN",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},update:{type:"UpdateExpression",start:null,end:null,loc:null,range:null,operator:"++",prefix:!1,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARRAY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARRAY_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!0,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARGUMENTS",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!0,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"self-contained-helpers-head":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"helpers",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"exports",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Literal",start:null,end:null,loc:null,range:null,value:"default",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},computed:!0,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"exports",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"__esModule",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Literal",start:null,end:null,loc:null,range:null,value:!0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"self-global":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"global",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"undefined",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"self",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},alternate:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"global",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},set:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"set",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"object",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"property",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"receiver",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getOwnPropertyDescriptor",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"object",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"property",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},operator:"===",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undefined",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"parent",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getPrototypeOf",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"object",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"parent",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},operator:"!==",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:null,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"set",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"parent",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"property",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"receiver",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},alternate:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},alternate:{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Literal",start:null,end:null,loc:null,range:null,value:"value",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},operator:"in",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"writable",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},alternate:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"setter",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"set",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"setter",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},operator:"!==",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undefined",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"setter",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"call",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"receiver",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},alternate:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},slice:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"slice",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"sliced-to-array":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"isArray",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},alternate:{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"iterator",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"in",right:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_arr",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"ArrayExpression",start:null,end:null,loc:null,range:null,elements:[],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"ForStatement",start:null,end:null,loc:null,range:null,init:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_iterator",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"iterator",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:!0,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_step",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},test:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"!",prefix:!0,argument:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_step",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},right:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_iterator",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"next",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"done",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},update:null,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_arr",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"push",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_step",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},operator:"&&",right:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_arr",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"length",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BreakStatement",start:null,end:null,loc:null,range:null,label:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},alternate:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_arr",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},alternate:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ThrowStatement",start:null,end:null,loc:null,range:null,argument:{type:"NewExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"TypeError",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},arguments:[{type:"Literal",start:null,end:null,loc:null,range:null,value:"Invalid attempt to destructure non-iterable instance",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},system:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"System",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"register",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"MODULE_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"MODULE_DEPENDENCIES",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"EXPORT_IDENTIFIER",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[{type:"Property",start:null,end:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"setters",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},value:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"SETTERS",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},kind:"init",_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Property",start:null,end:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"execute",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},value:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"EXECUTE",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},kind:"init",_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"tagged-template-literal-loose":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"strings",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"raw",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"strings",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"raw",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"raw",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"strings",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"tagged-template-literal":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"strings",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"raw",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"freeze",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defineProperties",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"strings",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[{type:"Property",start:null,end:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"raw",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},value:{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[{type:"Property",start:null,end:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},value:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"freeze",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"raw",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},kind:"init",_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},kind:"init",_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"tail-call-body":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"AGAIN_ID",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"Literal",start:null,end:null,loc:null,range:null,value:!0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"LabeledStatement",start:null,end:null,loc:null,range:null,body:{type:"WhileStatement",start:null,end:null,loc:null,range:null,test:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"AGAIN_ID",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},body:{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"BLOCK",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},label:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION_ID",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"temporal-assert-defined":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"val",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"name",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undef",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"val",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},operator:"===",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undef",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ThrowStatement",start:null,end:null,loc:null,range:null,argument:{type:"NewExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ReferenceError",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},arguments:[{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"name",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},operator:"+",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:" is not defined - temporal dead zone",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},alternate:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Literal",start:null,end:null,loc:null,range:null,value:!0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"temporal-undefined":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"test-exports":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"exports",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"!==",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"undefined",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"test-module":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"module",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"!==",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"undefined",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"to-array":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"isArray",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},alternate:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"from",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"to-consumable-array":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"isArray",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ForStatement",start:null,end:null,loc:null,range:null,init:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"Literal",start:null,end:null,loc:null,range:null,value:0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr2",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},arguments:[{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"length",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},operator:"<",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"length",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},update:{type:"UpdateExpression",start:null,end:null,loc:null,range:null,operator:"++",prefix:!1,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},body:{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr2",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!0,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!0,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr2",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},alternate:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"from",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"typeof":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},operator:"&&",right:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"constructor",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"Literal",start:null,end:null,loc:null,range:null,value:"symbol",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},alternate:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},"umd-runner-body":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"factory",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"define",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"function",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"define",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"amd",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},computed:!1,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"define",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"AMD_ARGUMENTS",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"factory",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},alternate:{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"COMMON_TEST",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"factory",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"COMMON_ARGUMENTS",_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}],_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},alternate:null,_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,_paths:null,tokens:null,raw:null},_scopeInfo:null,_paths:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_paths:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,_paths:null,tokens:null,raw:null}} },{}]},{},[1])(1)});
pvnr0082t/cdnjs
ajax/libs/babel-core/4.7.0/browser.min.js
JavaScript
mit
788,900
import { Operator } from '../Operator'; import { Observable } from '../Observable'; import { Subscriber } from '../Subscriber'; /** * Groups pairs of consecutive emissions together and emits them as an array of * two values. * * <span class="informal">Puts the current value and previous value together as * an array, and emits that.</span> * * <img src="./img/pairwise.png" width="100%"> * * The Nth emission from the source Observable will cause the output Observable * to emit an array [(N-1)th, Nth] of the previous and the current value, as a * pair. For this reason, `pairwise` emits on the second and subsequent * emissions from the source Observable, but not on the first emission, because * there is no previous value in that case. * * @example <caption>On every click (starting from the second), emit the relative distance to the previous click</caption> * var clicks = Rx.Observable.fromEvent(document, 'click'); * var pairs = clicks.pairwise(); * var distance = pairs.map(pair => { * var x0 = pair[0].clientX; * var y0 = pair[0].clientY; * var x1 = pair[1].clientX; * var y1 = pair[1].clientY; * return Math.sqrt(Math.pow(x0 - x1, 2) + Math.pow(y0 - y1, 2)); * }); * distance.subscribe(x => console.log(x)); * * @see {@link buffer} * @see {@link bufferCount} * * @return {Observable<Array<T>>} An Observable of pairs (as arrays) of * consecutive values from the source Observable. * @method pairwise * @owner Observable */ export function pairwise<T>(): Observable<[T, T]> { return this.lift(new PairwiseOperator()); } export interface PairwiseSignature<T> { (): Observable<[T, T]>; } class PairwiseOperator<T> implements Operator<T, [T, T]> { call(subscriber: Subscriber<[T, T]>, source: any): any { return source._subscribe(new PairwiseSubscriber(subscriber)); } } /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ class PairwiseSubscriber<T> extends Subscriber<T> { private prev: T; private hasPrev: boolean = false; constructor(destination: Subscriber<[T, T]>) { super(destination); } _next(value: T): void { if (this.hasPrev) { this.destination.next([this.prev, value]); } else { this.hasPrev = true; } this.prev = value; } }
ksullivan96/case-challenge
node_modules/rxjs/src/operator/pairwise.ts
TypeScript
mit
2,292
/** * Gumby Toggles/Switches */ !function($) { 'use strict'; // Toggle constructor function Toggle($el) { this.$el = $($el); this.targets = []; this.on = ''; this.className = ''; this.self = false; if(this.$el.length) { Gumby.debug('Initializing Toggle', $el); this.init(); } } // Switch constructor function Switch($el) { this.$el = $($el); this.targets = []; this.on = ''; this.className = ''; this.self = false; if(this.$el.length) { Gumby.debug('Initializing Switch', $el); this.init(); } } // intialise toggles, switches will inherit method Toggle.prototype.init = function() { var scope = this; // set up module based on attributes this.setup(); // bind to specified event and trigger this.$el.on(this.on, function(e) { // stop propagation e.stopImmediatePropagation(); // only disable default if <a> if($(this).prop('tagName') === 'A') { e.preventDefault(); } scope.trigger(scope.triggered); // listen for gumby.trigger to dynamically trigger toggle/switch }).on('gumby.trigger', function() { Gumby.debug('Trigger event triggered', scope.$el); scope.trigger(scope.triggered); // re-initialize module }).on('gumby.initialize', function() { Gumby.debug('Re-initializing '+scope.constructor, $el); scope.setup(); }); }; // set up module based on attributes Toggle.prototype.setup = function() { this.targets = this.parseTargets(); this.on = Gumby.selectAttr.apply(this.$el, ['on']) || Gumby.click; this.className = Gumby.selectAttr.apply(this.$el, ['classname']) || 'active'; this.self = Gumby.selectAttr.apply(this.$el, ['self']) === 'false'; }; // parse data-for attribute, switches will inherit method Toggle.prototype.parseTargets = function() { var targetStr = Gumby.selectAttr.apply(this.$el, ['trigger']), secondaryTargets = 0, targets = []; // no targets so return false if(!targetStr) { return false; } secondaryTargets = targetStr.indexOf('|'); // no secondary targets specified so return single target if(secondaryTargets === -1) { if(!this.checkTargets([targetStr])) { return false; } return [$(targetStr)]; } // return array of both targets, split and return 0, 1 targets = targetStr.split('|'); if(!this.checkTargets(targets)) { return false; } return targets.length > 1 ? [$(targets[0]), $(targets[1])] : [$(targets[0])]; }; Toggle.prototype.checkTargets = function(targets) { var i = 0; for(i; i < targets.length; i++) { if(targets[i] && !$(targets[i]).length) { Gumby.error('Cannot find '+this.constructor.name+' target: '+targets[i]); return false; } } return true; }; // call triggered event and pass target data Toggle.prototype.triggered = function() { // trigger gumby.onTrigger event and pass array of target status data Gumby.debug('Triggering onTrigger event', this.$el); this.$el.trigger('gumby.onTrigger', [this.$el.hasClass(this.className)]); }; // Switch object inherits from Toggle Switch.prototype = new Toggle(); Switch.prototype.constructor = Switch; // Toggle specific trigger method Toggle.prototype.trigger = function(cb) { Gumby.debug('Triggering Toggle', this.$el); var $target; // no targets just toggle active class on toggle if(!this.targets) { this.$el.toggleClass(this.className); // combine single target with toggle and toggle active class } else if(this.targets.length == 1) { this.$el.add(this.targets[0]).toggleClass(this.className); // if two targets check active state of first // always combine toggle and first target } else if(this.targets.length > 1) { if(this.targets[0].hasClass(this.className)) { $target = this.targets[0]; // add this element to it unless gumby-self set if(!this.self) { $target = $target.add(this.$el); } $target.removeClass(this.className); this.targets[1].addClass(this.className); } else { $target = this.targets[0]; // add this element to it unless gumby-self set if(!this.self) { $target = $target.add(this.$el); } $target.addClass(this.className); this.targets[1].removeClass(this.className); } } // call event handler here, applying scope of object Switch/Toggle if(cb && typeof cb === 'function') { cb.apply(this); } }; // Switch specific trigger method Switch.prototype.trigger = function(cb) { Gumby.debug('Triggering Switch', this.$el); var $target; // no targets just add active class to switch if(!this.targets) { this.$el.addClass(this.className); // combine single target with switch and add active class } else if(this.targets.length == 1) { $target = this.targets[0]; // add this element to it unless gumby-self set if(!this.self) { $target = $target.add(this.$el); } $target.addClass(this.className); // if two targets check active state of first // always combine switch and first target } else if(this.targets.length > 1) { $target = this.targets[0]; // add this element to it unless gumby-self set if(!this.self) { $target = $target.add(this.$el); } $target.addClass(this.className); this.targets[1].removeClass(this.className); } // call event handler here, applying scope of object Switch/Toggle if(cb && typeof cb === 'function') { cb.apply(this); } }; // add toggle initialisation Gumby.addInitalisation('toggles', function(all) { $('.toggle').each(function() { var $this = $(this); // this element has already been initialized // and we're only initializing new modules if($this.data('isToggle') && !all) { return true; // this element has already been initialized // and we need to reinitialize it } else if($this.data('isToggle') && all) { $this.trigger('gumby.initialize'); } // mark element as initialized $this.data('isToggle', true); new Toggle($this); }); }); // add switches initialisation Gumby.addInitalisation('switches', function(all) { $('.switch').each(function() { var $this = $(this); // this element has already been initialized // and we're only initializing new modules if($this.data('isSwitch') && !all) { return true; // this element has already been initialized // and we need to reinitialize it } else if($this.data('isSwitch') && all) { $this.trigger('gumby.initialize'); return true; } // mark element as initialized $this.data('isSwitch', true); new Switch($this); }); }); // register UI module Gumby.UIModule({ module: 'toggleswitch', events: ['initialize', 'trigger', 'onTrigger'], init: function() { // Run initialize methods Gumby.initialize('switches'); Gumby.initialize('toggles'); } }); }(jQuery);
pombredanne/cdnjs
ajax/libs/gumby/2.5.10/js/libs/ui/gumby.toggleswitch.js
JavaScript
mit
6,812
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>errors</title><meta name="description" content=""><meta name="robots" content="noindex"><link rel="stylesheet" href="css/index.min.css"><link rel="apple-touch-icon-precomposed" sizes="144x144" href="img/ico/sitespeed.io-144.png"><link rel="apple-touch-icon-precomposed" sizes="114x114" href="img/ico/sitespeed.io-114.png"><link rel="apple-touch-icon-precomposed" sizes="72x72" href="img/ico/sitespeed.io-72.png"><link rel="apple-touch-icon-precomposed" href="img/ico/sitespeed.io-57.png"><link rel="shortcut icon" href="img/ico/sitespeed.io.ico"></head><body><div class="darkblue nav"><div class="navgrid"><div class="logo"><a href="https://www.sitespeed.io"><img class="navbar-brand" src="img/sitespeed.io-logo.png" width="162" height="50" alt="sitespeed.io logo"></a></div><ul><li><a href="index.html">Summary</a></li><li><a href="detailed.html">Detailed Summary</a></li><li><a href="pages.html">Pages</a></li><li><a href="domains.html">Domains</a></li><li><a href="toplist.html">Toplist</a></li><li><a href="assets.html">Assets</a></li><li><a class="active" href="errors.html">Errors</a></li></ul></div></div><div class="container"><h2>Errors!</h2><table><thead><tr><th>url</th><th>errors</th></tr></thead><tr><td><a href="https://www.raiffeisen.ch">https://www.raiffeisen.ch</a></td><td>{ &quot;browsertime&quot;: &quot;Failed to load https://www.raiffeisen.ch&quot; }</td></tr></table><footer><hr><p><a href="https://www.sitespeed.io">sitespeed.io</a> 5.3.0 by <a href="https://www.sitespeed.io/aboutus/">the sitespeed.io team</a> and <a href="https://github.com/sitespeedio/sitespeed.io/blob/master/CONTRIBUTORS.md">contributors</a></p></footer></div><script src="js/sortable.min.js"></script></body></html>
wilkart/sitespeed
www.raiffeisen.ch/20190819-0937/errors.html
HTML
mit
1,851
import { Operator } from '../Operator'; import { Subscriber } from '../Subscriber'; import { ArgumentOutOfRangeError } from '../util/ArgumentOutOfRangeError'; import { EmptyObservable } from '../observable/EmptyObservable'; import { Observable } from '../Observable'; import { TeardownLogic } from '../Subscription'; /** * Emits only the last `count` values emitted by the source Observable. * * <span class="informal">Remembers the latest `count` values, then emits those * only when the source completes.</span> * * <img src="./img/takeLast.png" width="100%"> * * `takeLast` returns an Observable that emits at most the last `count` values * emitted by the source Observable. If the source emits fewer than `count` * values then all of its values are emitted. This operator must wait until the * `complete` notification emission from the source in order to emit the `next` * values on the output Observable, because otherwise it is impossible to know * whether or not more values will be emitted on the source. For this reason, * all values are emitted synchronously, followed by the complete notification. * * @example <caption>Take the last 3 values of an Observable with many values</caption> * var many = Rx.Observable.range(1, 100); * var lastThree = many.takeLast(3); * lastThree.subscribe(x => console.log(x)); * * @see {@link take} * @see {@link takeUntil} * @see {@link takeWhile} * @see {@link skip} * * @throws {ArgumentOutOfRangeError} When using `takeLast(i)`, it delivers an * ArgumentOutOrRangeError to the Observer's `error` callback if `i < 0`. * * @param {number} count The maximum number of values to emit from the end of * the sequence of values emitted by the source Observable. * @return {Observable<T>} An Observable that emits at most the last count * values emitted by the source Observable. * @method takeLast * @owner Observable */ export function takeLast<T>(count: number): Observable<T> { if (count === 0) { return new EmptyObservable<T>(); } else { return this.lift(new TakeLastOperator(count)); } } export interface TakeLastSignature<T> { (count: number): Observable<T>; } class TakeLastOperator<T> implements Operator<T, T> { constructor(private total: number) { if (this.total < 0) { throw new ArgumentOutOfRangeError; } } call(subscriber: Subscriber<T>, source: any): TeardownLogic { return source._subscribe(new TakeLastSubscriber(subscriber, this.total)); } } /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ class TakeLastSubscriber<T> extends Subscriber<T> { private ring: Array<T> = new Array(); private count: number = 0; constructor(destination: Subscriber<T>, private total: number) { super(destination); } protected _next(value: T): void { const ring = this.ring; const total = this.total; const count = this.count++; if (ring.length < total) { ring.push(value); } else { const index = count % total; ring[index] = value; } } protected _complete(): void { const destination = this.destination; let count = this.count; if (count > 0) { const total = this.count >= this.total ? this.total : this.count; const ring = this.ring; for (let i = 0; i < total; i++) { const idx = (count++) % total; destination.next(ring[idx]); } } destination.complete(); } }
ShortsTravel/stm-microservices
node_modules/rxjs/src/operator/takeLast.ts
TypeScript
mit
3,452
<?php /** * Fuel * * Fuel is a fast, lightweight, community driven PHP5 framework. * * @package Fuel * @version 1.7 * @author Fuel Development Team * @license MIT License * @copyright 2010 - 2013 Fuel Development Team * @link http://fuelphp.com */ namespace Parser; use HamlParser; class View_Haml extends \View { protected static $_parser; protected static $_cache; protected function process_file($file_override = false) { $file = $file_override ?: $this->file_name; static::cache_init($file); $file = static::parser()->parse($file, static::$_cache); return parent::process_file($file); } public $extension = 'haml'; /** * Returns the Parser lib object * * @return HamlParser */ public static function parser() { if ( ! empty(static::$_parser)) { return static::$_parser; } static::$_parser = new HamlParser(); return static::$_parser; } // Jade stores cached templates as the filename in plain text, // so there is a high chance of name collisions (ex: index.jade). // This function attempts to create a unique directory for each // compiled template. // TODO: Extend Jade's caching class? public function cache_init($file_path) { $cache_key = md5($file_path); $cache_path = \Config::get('parser.View_Haml.cache_dir', null) .substr($cache_key, 0, 2).DS.substr($cache_key, 2, 2); if ($cache_path !== null AND ! is_dir($cache_path)) { mkdir($cache_path, 0777, true); } static::$_cache = $cache_path; } } /* end of file haml.php */
up-to-satoshi/practicegit
fuel/packages/parser/classes/view/haml.php
PHP
mit
1,545
import { Operator } from '../Operator'; import { Subscriber } from '../Subscriber'; import { ArgumentOutOfRangeError } from '../util/ArgumentOutOfRangeError'; import { EmptyObservable } from '../observable/EmptyObservable'; import { Observable } from '../Observable'; import { TeardownLogic } from '../Subscription'; /** * Emits only the last `count` values emitted by the source Observable. * * <span class="informal">Remembers the latest `count` values, then emits those * only when the source completes.</span> * * <img src="./img/takeLast.png" width="100%"> * * `takeLast` returns an Observable that emits at most the last `count` values * emitted by the source Observable. If the source emits fewer than `count` * values then all of its values are emitted. This operator must wait until the * `complete` notification emission from the source in order to emit the `next` * values on the output Observable, because otherwise it is impossible to know * whether or not more values will be emitted on the source. For this reason, * all values are emitted synchronously, followed by the complete notification. * * @example <caption>Take the last 3 values of an Observable with many values</caption> * var many = Rx.Observable.range(1, 100); * var lastThree = many.takeLast(3); * lastThree.subscribe(x => console.log(x)); * * @see {@link take} * @see {@link takeUntil} * @see {@link takeWhile} * @see {@link skip} * * @throws {ArgumentOutOfRangeError} When using `takeLast(i)`, it delivers an * ArgumentOutOrRangeError to the Observer's `error` callback if `i < 0`. * * @param {number} count The maximum number of values to emit from the end of * the sequence of values emitted by the source Observable. * @return {Observable<T>} An Observable that emits at most the last count * values emitted by the source Observable. * @method takeLast * @owner Observable */ export function takeLast<T>(count: number): Observable<T> { if (count === 0) { return new EmptyObservable<T>(); } else { return this.lift(new TakeLastOperator(count)); } } export interface TakeLastSignature<T> { (count: number): Observable<T>; } class TakeLastOperator<T> implements Operator<T, T> { constructor(private total: number) { if (this.total < 0) { throw new ArgumentOutOfRangeError; } } call(subscriber: Subscriber<T>, source: any): TeardownLogic { return source._subscribe(new TakeLastSubscriber(subscriber, this.total)); } } /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ class TakeLastSubscriber<T> extends Subscriber<T> { private ring: Array<T> = new Array(); private count: number = 0; constructor(destination: Subscriber<T>, private total: number) { super(destination); } protected _next(value: T): void { const ring = this.ring; const total = this.total; const count = this.count++; if (ring.length < total) { ring.push(value); } else { const index = count % total; ring[index] = value; } } protected _complete(): void { const destination = this.destination; let count = this.count; if (count > 0) { const total = this.count >= this.total ? this.total : this.count; const ring = this.ring; for (let i = 0; i < total; i++) { const idx = (count++) % total; destination.next(ring[idx]); } } destination.complete(); } }
gabrieldamaso7/innocircle
node_modules/angular2-fontawesome/node_modules/rxjs/src/operator/takeLast.ts
TypeScript
mit
3,452
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. ;(function (undefined) { var objectTypes = { 'function': true, 'object': true }; var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports, freeSelf = objectTypes[typeof self] && self.Object && self, freeWindow = objectTypes[typeof window] && window && window.Object && window, freeModule = objectTypes[typeof module] && module && !module.nodeType && module, moduleExports = freeModule && freeModule.exports === freeExports && freeExports, freeGlobal = freeExports && freeModule && typeof global == 'object' && global && global.Object && global; var root = root = freeGlobal || ((freeWindow !== (this && this.window)) && freeWindow) || freeSelf || this; var Rx = { internals: {}, config: { Promise: root.Promise }, helpers: { } }; // Defaults var noop = Rx.helpers.noop = function () { }, identity = Rx.helpers.identity = function (x) { return x; }, defaultNow = Rx.helpers.defaultNow = (function () { return !!Date.now ? Date.now : function () { return +new Date; }; }()), defaultComparer = Rx.helpers.defaultComparer = function (x, y) { return isEqual(x, y); }, defaultSubComparer = Rx.helpers.defaultSubComparer = function (x, y) { return x > y ? 1 : (x < y ? -1 : 0); }, defaultKeySerializer = Rx.helpers.defaultKeySerializer = function (x) { return x.toString(); }, defaultError = Rx.helpers.defaultError = function (err) { throw err; }, isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.subscribe !== 'function' && typeof p.then === 'function'; }, isFunction = Rx.helpers.isFunction = (function () { var isFn = function (value) { return typeof value == 'function' || false; } // fallback for older versions of Chrome and Safari if (isFn(/x/)) { isFn = function(value) { return typeof value == 'function' && toString.call(value) == '[object Function]'; }; } return isFn; }()); function cloneArray(arr) { var len = arr.length, a = new Array(len); for(var i = 0; i < len; i++) { a[i] = arr[i]; } return a; } var errorObj = {e: {}}; function tryCatcherGen(tryCatchTarget) { return function tryCatcher() { try { return tryCatchTarget.apply(this, arguments); } catch (e) { errorObj.e = e; return errorObj; } } } var tryCatch = Rx.internals.tryCatch = function tryCatch(fn) { if (!isFunction(fn)) { throw new TypeError('fn must be a function'); } return tryCatcherGen(fn); } function thrower(e) { throw e; } Rx.config.longStackSupport = false; var hasStacks = false, stacks = tryCatch(function () { throw new Error(); })(); hasStacks = !!stacks.e && !!stacks.e.stack; // All code after this point will be filtered from stack traces reported by RxJS var rStartingLine = captureLine(), rFileName; var STACK_JUMP_SEPARATOR = 'From previous event:'; function makeStackTraceLong(error, observable) { // If possible, transform the error stack trace by removing Node and RxJS // cruft, then concatenating with the stack trace of `observable`. if (hasStacks && observable.stack && typeof error === 'object' && error !== null && error.stack && error.stack.indexOf(STACK_JUMP_SEPARATOR) === -1 ) { var stacks = []; for (var o = observable; !!o; o = o.source) { if (o.stack) { stacks.unshift(o.stack); } } stacks.unshift(error.stack); var concatedStacks = stacks.join('\n' + STACK_JUMP_SEPARATOR + '\n'); error.stack = filterStackString(concatedStacks); } } function filterStackString(stackString) { var lines = stackString.split('\n'), desiredLines = []; for (var i = 0, len = lines.length; i < len; i++) { var line = lines[i]; if (!isInternalFrame(line) && !isNodeFrame(line) && line) { desiredLines.push(line); } } return desiredLines.join('\n'); } function isInternalFrame(stackLine) { var fileNameAndLineNumber = getFileNameAndLineNumber(stackLine); if (!fileNameAndLineNumber) { return false; } var fileName = fileNameAndLineNumber[0], lineNumber = fileNameAndLineNumber[1]; return fileName === rFileName && lineNumber >= rStartingLine && lineNumber <= rEndingLine; } function isNodeFrame(stackLine) { return stackLine.indexOf('(module.js:') !== -1 || stackLine.indexOf('(node.js:') !== -1; } function captureLine() { if (!hasStacks) { return; } try { throw new Error(); } catch (e) { var lines = e.stack.split('\n'); var firstLine = lines[0].indexOf('@') > 0 ? lines[1] : lines[2]; var fileNameAndLineNumber = getFileNameAndLineNumber(firstLine); if (!fileNameAndLineNumber) { return; } rFileName = fileNameAndLineNumber[0]; return fileNameAndLineNumber[1]; } } function getFileNameAndLineNumber(stackLine) { // Named functions: 'at functionName (filename:lineNumber:columnNumber)' var attempt1 = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(stackLine); if (attempt1) { return [attempt1[1], Number(attempt1[2])]; } // Anonymous functions: 'at filename:lineNumber:columnNumber' var attempt2 = /at ([^ ]+):(\d+):(?:\d+)$/.exec(stackLine); if (attempt2) { return [attempt2[1], Number(attempt2[2])]; } // Firefox style: 'function@filename:lineNumber or @filename:lineNumber' var attempt3 = /.*@(.+):(\d+)$/.exec(stackLine); if (attempt3) { return [attempt3[1], Number(attempt3[2])]; } } var EmptyError = Rx.EmptyError = function() { this.message = 'Sequence contains no elements.'; this.name = 'EmptyError'; Error.call(this); }; EmptyError.prototype = Object.create(Error.prototype); var ObjectDisposedError = Rx.ObjectDisposedError = function() { this.message = 'Object has been disposed'; this.name = 'ObjectDisposedError'; Error.call(this); }; ObjectDisposedError.prototype = Object.create(Error.prototype); var ArgumentOutOfRangeError = Rx.ArgumentOutOfRangeError = function () { this.message = 'Argument out of range'; this.name = 'ArgumentOutOfRangeError'; Error.call(this); }; ArgumentOutOfRangeError.prototype = Object.create(Error.prototype); var NotSupportedError = Rx.NotSupportedError = function (message) { this.message = message || 'This operation is not supported'; this.name = 'NotSupportedError'; Error.call(this); }; NotSupportedError.prototype = Object.create(Error.prototype); var NotImplementedError = Rx.NotImplementedError = function (message) { this.message = message || 'This operation is not implemented'; this.name = 'NotImplementedError'; Error.call(this); }; NotImplementedError.prototype = Object.create(Error.prototype); var notImplemented = Rx.helpers.notImplemented = function () { throw new NotImplementedError(); }; var notSupported = Rx.helpers.notSupported = function () { throw new NotSupportedError(); }; // Shim in iterator support var $iterator$ = (typeof Symbol === 'function' && Symbol.iterator) || '_es6shim_iterator_'; // Bug for mozilla version if (root.Set && typeof new root.Set()['@@iterator'] === 'function') { $iterator$ = '@@iterator'; } var doneEnumerator = Rx.doneEnumerator = { done: true, value: undefined }; var isIterable = Rx.helpers.isIterable = function (o) { return o[$iterator$] !== undefined; } var isArrayLike = Rx.helpers.isArrayLike = function (o) { return o && o.length !== undefined; } Rx.helpers.iterator = $iterator$; var bindCallback = Rx.internals.bindCallback = function (func, thisArg, argCount) { if (typeof thisArg === 'undefined') { return func; } switch(argCount) { case 0: return function() { return func.call(thisArg) }; case 1: return function(arg) { return func.call(thisArg, arg); } case 2: return function(value, index) { return func.call(thisArg, value, index); }; case 3: return function(value, index, collection) { return func.call(thisArg, value, index, collection); }; } return function() { return func.apply(thisArg, arguments); }; }; /** Used to determine if values are of the language type Object */ var dontEnums = ['toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor'], dontEnumsLength = dontEnums.length; /** `Object#toString` result shortcuts */ var argsClass = '[object Arguments]', arrayClass = '[object Array]', boolClass = '[object Boolean]', dateClass = '[object Date]', errorClass = '[object Error]', funcClass = '[object Function]', numberClass = '[object Number]', objectClass = '[object Object]', regexpClass = '[object RegExp]', stringClass = '[object String]'; var toString = Object.prototype.toString, hasOwnProperty = Object.prototype.hasOwnProperty, supportsArgsClass = toString.call(arguments) == argsClass, // For less <IE9 && FF<4 supportNodeClass, errorProto = Error.prototype, objectProto = Object.prototype, stringProto = String.prototype, propertyIsEnumerable = objectProto.propertyIsEnumerable; try { supportNodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + '')); } catch (e) { supportNodeClass = true; } var nonEnumProps = {}; nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true }; nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': true, 'toString': true, 'valueOf': true }; nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': true, 'toString': true }; nonEnumProps[objectClass] = { 'constructor': true }; var support = {}; (function () { var ctor = function() { this.x = 1; }, props = []; ctor.prototype = { 'valueOf': 1, 'y': 1 }; for (var key in new ctor) { props.push(key); } for (key in arguments) { } // Detect if `name` or `message` properties of `Error.prototype` are enumerable by default. support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name'); // Detect if `prototype` properties are enumerable by default. support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype'); // Detect if `arguments` object indexes are non-enumerable support.nonEnumArgs = key != 0; // Detect if properties shadowing those on `Object.prototype` are non-enumerable. support.nonEnumShadows = !/valueOf/.test(props); }(1)); var isObject = Rx.internals.isObject = function(value) { var type = typeof value; return value && (type == 'function' || type == 'object') || false; }; function keysIn(object) { var result = []; if (!isObject(object)) { return result; } if (support.nonEnumArgs && object.length && isArguments(object)) { object = slice.call(object); } var skipProto = support.enumPrototypes && typeof object == 'function', skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error); for (var key in object) { if (!(skipProto && key == 'prototype') && !(skipErrorProps && (key == 'message' || key == 'name'))) { result.push(key); } } if (support.nonEnumShadows && object !== objectProto) { var ctor = object.constructor, index = -1, length = dontEnumsLength; if (object === (ctor && ctor.prototype)) { var className = object === stringProto ? stringClass : object === errorProto ? errorClass : toString.call(object), nonEnum = nonEnumProps[className]; } while (++index < length) { key = dontEnums[index]; if (!(nonEnum && nonEnum[key]) && hasOwnProperty.call(object, key)) { result.push(key); } } } return result; } function internalFor(object, callback, keysFunc) { var index = -1, props = keysFunc(object), length = props.length; while (++index < length) { var key = props[index]; if (callback(object[key], key, object) === false) { break; } } return object; } function internalForIn(object, callback) { return internalFor(object, callback, keysIn); } function isNode(value) { // IE < 9 presents DOM nodes as `Object` objects except they have `toString` // methods that are `typeof` "string" and still can coerce nodes to strings return typeof value.toString != 'function' && typeof (value + '') == 'string'; } var isArguments = function(value) { return (value && typeof value == 'object') ? toString.call(value) == argsClass : false; } // fallback for browsers that can't detect `arguments` objects by [[Class]] if (!supportsArgsClass) { isArguments = function(value) { return (value && typeof value == 'object') ? hasOwnProperty.call(value, 'callee') : false; }; } var isEqual = Rx.internals.isEqual = function (x, y) { return deepEquals(x, y, [], []); }; /** @private * Used for deep comparison **/ function deepEquals(a, b, stackA, stackB) { // exit early for identical values if (a === b) { // treat `+0` vs. `-0` as not equal return a !== 0 || (1 / a == 1 / b); } var type = typeof a, otherType = typeof b; // exit early for unlike primitive values if (a === a && (a == null || b == null || (type != 'function' && type != 'object' && otherType != 'function' && otherType != 'object'))) { return false; } // compare [[Class]] names var className = toString.call(a), otherClass = toString.call(b); if (className == argsClass) { className = objectClass; } if (otherClass == argsClass) { otherClass = objectClass; } if (className != otherClass) { return false; } switch (className) { case boolClass: case dateClass: // coerce dates and booleans to numbers, dates to milliseconds and booleans // to `1` or `0` treating invalid dates coerced to `NaN` as not equal return +a == +b; case numberClass: // treat `NaN` vs. `NaN` as equal return (a != +a) ? b != +b : // but treat `-0` vs. `+0` as not equal (a == 0 ? (1 / a == 1 / b) : a == +b); case regexpClass: case stringClass: // coerce regexes to strings (http://es5.github.io/#x15.10.6.4) // treat string primitives and their corresponding object instances as equal return a == String(b); } var isArr = className == arrayClass; if (!isArr) { // exit for functions and DOM nodes if (className != objectClass || (!support.nodeClass && (isNode(a) || isNode(b)))) { return false; } // in older versions of Opera, `arguments` objects have `Array` constructors var ctorA = !support.argsObject && isArguments(a) ? Object : a.constructor, ctorB = !support.argsObject && isArguments(b) ? Object : b.constructor; // non `Object` object instances with different constructors are not equal if (ctorA != ctorB && !(hasOwnProperty.call(a, 'constructor') && hasOwnProperty.call(b, 'constructor')) && !(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) && ('constructor' in a && 'constructor' in b) ) { return false; } } // assume cyclic structures are equal // the algorithm for detecting cyclic structures is adapted from ES 5.1 // section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3) var initedStack = !stackA; stackA || (stackA = []); stackB || (stackB = []); var length = stackA.length; while (length--) { if (stackA[length] == a) { return stackB[length] == b; } } var size = 0; var result = true; // add `a` and `b` to the stack of traversed objects stackA.push(a); stackB.push(b); // recursively compare objects and arrays (susceptible to call stack limits) if (isArr) { // compare lengths to determine if a deep comparison is necessary length = a.length; size = b.length; result = size == length; if (result) { // deep compare the contents, ignoring non-numeric properties while (size--) { var index = length, value = b[size]; if (!(result = deepEquals(a[size], value, stackA, stackB))) { break; } } } } else { // deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys` // which, in this case, is more costly internalForIn(b, function(value, key, b) { if (hasOwnProperty.call(b, key)) { // count the number of properties. size++; // deep compare each property value. return (result = hasOwnProperty.call(a, key) && deepEquals(a[key], value, stackA, stackB)); } }); if (result) { // ensure both objects have the same number of properties internalForIn(a, function(value, key, a) { if (hasOwnProperty.call(a, key)) { // `size` will be `-1` if `a` has more properties than `b` return (result = --size > -1); } }); } } stackA.pop(); stackB.pop(); return result; } var hasProp = {}.hasOwnProperty, slice = Array.prototype.slice; var inherits = Rx.internals.inherits = function (child, parent) { function __() { this.constructor = child; } __.prototype = parent.prototype; child.prototype = new __(); }; var addProperties = Rx.internals.addProperties = function (obj) { for(var sources = [], i = 1, len = arguments.length; i < len; i++) { sources.push(arguments[i]); } for (var idx = 0, ln = sources.length; idx < ln; idx++) { var source = sources[idx]; for (var prop in source) { obj[prop] = source[prop]; } } }; // Rx Utils var addRef = Rx.internals.addRef = function (xs, r) { return new AnonymousObservable(function (observer) { return new CompositeDisposable(r.getDisposable(), xs.subscribe(observer)); }); }; function arrayInitialize(count, factory) { var a = new Array(count); for (var i = 0; i < count; i++) { a[i] = factory(); } return a; } // Utilities var slice = Array.prototype.slice, toString = Object.prototype.toString; if (!Function.prototype.bind) { Function.prototype.bind = function (that) { var target = this, args = slice.call(arguments, 1); var bound = function () { if (this instanceof bound) { function F() { } F.prototype = target.prototype; var self = new F(); var result = target.apply(self, args.concat(slice.call(arguments))); if (Object(result) === result) { return result; } return self; } else { return target.apply(that, args.concat(slice.call(arguments))); } }; return bound; }; } if (!Array.prototype.forEach) { Array.prototype.forEach = function (callback, thisArg) { var T, k; if (this == null) { throw new TypeError(' this is null or not defined'); } var O = Object(this); var len = O.length >>> 0; if (typeof callback !== 'function') { throw new TypeError(callback + ' is not a function'); } if (arguments.length > 1) { T = thisArg; } k = 0; while (k < len) { var kValue; if (k in O) { kValue = O[k]; callback.call(T, kValue, k, O); } k++; } }; } var boxedString = Object('a'), splitString = boxedString[0] !== 'a' || !(0 in boxedString); if (!Array.prototype.every) { Array.prototype.every = function every(fun /*, thisp */) { var object = Object(this), self = splitString && toString.call(this) === stringClass ? this.split('') : object, length = self.length >>> 0, thisp = arguments[1]; if (toString.call(fun) !== funcClass) { throw new TypeError(fun + ' is not a function'); } for (var i = 0; i < length; i++) { if (i in self && !fun.call(thisp, self[i], i, object)) { return false; } } return true; }; } if (!Array.prototype.map) { Array.prototype.map = function map(fun /*, thisp*/) { var object = Object(this), self = splitString && toString.call(this) === stringClass ? this.split('') : object, length = self.length >>> 0, result = new Array(length), thisp = arguments[1]; if (toString.call(fun) !== funcClass) { throw new TypeError(fun + ' is not a function'); } for (var i = 0; i < length; i++) { if (i in self) { result[i] = fun.call(thisp, self[i], i, object); } } return result; }; } if (!Array.prototype.filter) { Array.prototype.filter = function (predicate) { var results = [], item, t = new Object(this); for (var i = 0, len = t.length >>> 0; i < len; i++) { item = t[i]; if (i in t && predicate.call(arguments[1], item, i, t)) { results.push(item); } } return results; }; } if (!Array.isArray) { Array.isArray = function (arg) { return toString.call(arg) === arrayClass; }; } if (!Array.prototype.indexOf) { Array.prototype.indexOf = function indexOf(searchElement) { var t = Object(this); var len = t.length >>> 0; if (len === 0) { return -1; } var n = 0; if (arguments.length > 1) { n = Number(arguments[1]); if (n !== n) { n = 0; } else if (n !== 0 && n !== Infinity && n !== -Infinity) { n = (n > 0 || -1) * Math.floor(Math.abs(n)); } } if (n >= len) { return -1; } var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0); for (; k < len; k++) { if (k in t && t[k] === searchElement) { return k; } } return -1; }; } // Fix for Tessel if (!Object.prototype.propertyIsEnumerable) { Object.prototype.propertyIsEnumerable = function (key) { for (var k in this) { if (k === key) { return true; } } return false; }; } if (!Object.keys) { Object.keys = (function() { 'use strict'; var hasOwnProperty = Object.prototype.hasOwnProperty, hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString'); return function(obj) { if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) { throw new TypeError('Object.keys called on non-object'); } var result = [], prop, i; for (prop in obj) { if (hasOwnProperty.call(obj, prop)) { result.push(prop); } } if (hasDontEnumBug) { for (i = 0; i < dontEnumsLength; i++) { if (hasOwnProperty.call(obj, dontEnums[i])) { result.push(dontEnums[i]); } } } return result; }; }()); } if (typeof Object.create !== 'function') { // Production steps of ECMA-262, Edition 5, 15.2.3.5 // Reference: http://es5.github.io/#x15.2.3.5 Object.create = (function() { function Temp() {} var hasOwn = Object.prototype.hasOwnProperty; return function (O) { if (typeof O !== 'object') { throw new TypeError('Object prototype may only be an Object or null'); } Temp.prototype = O; var obj = new Temp(); Temp.prototype = null; if (arguments.length > 1) { // Object.defineProperties does ToObject on its first argument. var Properties = Object(arguments[1]); for (var prop in Properties) { if (hasOwn.call(Properties, prop)) { obj[prop] = Properties[prop]; } } } // 5. Return obj return obj; }; })(); } /** * Represents a group of disposable resources that are disposed together. * @constructor */ var CompositeDisposable = Rx.CompositeDisposable = function () { var args = [], i, len; if (Array.isArray(arguments[0])) { args = arguments[0]; len = args.length; } else { len = arguments.length; args = new Array(len); for(i = 0; i < len; i++) { args[i] = arguments[i]; } } for(i = 0; i < len; i++) { if (!isDisposable(args[i])) { throw new TypeError('Not a disposable'); } } this.disposables = args; this.isDisposed = false; this.length = args.length; }; var CompositeDisposablePrototype = CompositeDisposable.prototype; /** * Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed. * @param {Mixed} item Disposable to add. */ CompositeDisposablePrototype.add = function (item) { if (this.isDisposed) { item.dispose(); } else { this.disposables.push(item); this.length++; } }; /** * Removes and disposes the first occurrence of a disposable from the CompositeDisposable. * @param {Mixed} item Disposable to remove. * @returns {Boolean} true if found; false otherwise. */ CompositeDisposablePrototype.remove = function (item) { var shouldDispose = false; if (!this.isDisposed) { var idx = this.disposables.indexOf(item); if (idx !== -1) { shouldDispose = true; this.disposables.splice(idx, 1); this.length--; item.dispose(); } } return shouldDispose; }; /** * Disposes all disposables in the group and removes them from the group. */ CompositeDisposablePrototype.dispose = function () { if (!this.isDisposed) { this.isDisposed = true; var len = this.disposables.length, currentDisposables = new Array(len); for(var i = 0; i < len; i++) { currentDisposables[i] = this.disposables[i]; } this.disposables = []; this.length = 0; for (i = 0; i < len; i++) { currentDisposables[i].dispose(); } } }; /** * Provides a set of static methods for creating Disposables. * @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once. */ var Disposable = Rx.Disposable = function (action) { this.isDisposed = false; this.action = action || noop; }; /** Performs the task of cleaning up resources. */ Disposable.prototype.dispose = function () { if (!this.isDisposed) { this.action(); this.isDisposed = true; } }; /** * Creates a disposable object that invokes the specified action when disposed. * @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once. * @return {Disposable} The disposable object that runs the given action upon disposal. */ var disposableCreate = Disposable.create = function (action) { return new Disposable(action); }; /** * Gets the disposable that does nothing when disposed. */ var disposableEmpty = Disposable.empty = { dispose: noop }; /** * Validates whether the given object is a disposable * @param {Object} Object to test whether it has a dispose method * @returns {Boolean} true if a disposable object, else false. */ var isDisposable = Disposable.isDisposable = function (d) { return d && isFunction(d.dispose); }; var checkDisposed = Disposable.checkDisposed = function (disposable) { if (disposable.isDisposed) { throw new ObjectDisposedError(); } }; // Single assignment var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable = function () { this.isDisposed = false; this.current = null; }; SingleAssignmentDisposable.prototype.getDisposable = function () { return this.current; }; SingleAssignmentDisposable.prototype.setDisposable = function (value) { if (this.current) { throw new Error('Disposable has already been assigned'); } var shouldDispose = this.isDisposed; !shouldDispose && (this.current = value); shouldDispose && value && value.dispose(); }; SingleAssignmentDisposable.prototype.dispose = function () { if (!this.isDisposed) { this.isDisposed = true; var old = this.current; this.current = null; } old && old.dispose(); }; // Multiple assignment disposable var SerialDisposable = Rx.SerialDisposable = function () { this.isDisposed = false; this.current = null; }; SerialDisposable.prototype.getDisposable = function () { return this.current; }; SerialDisposable.prototype.setDisposable = function (value) { var shouldDispose = this.isDisposed; if (!shouldDispose) { var old = this.current; this.current = value; } old && old.dispose(); shouldDispose && value && value.dispose(); }; SerialDisposable.prototype.dispose = function () { if (!this.isDisposed) { this.isDisposed = true; var old = this.current; this.current = null; } old && old.dispose(); }; /** * Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed. */ var RefCountDisposable = Rx.RefCountDisposable = (function () { function InnerDisposable(disposable) { this.disposable = disposable; this.disposable.count++; this.isInnerDisposed = false; } InnerDisposable.prototype.dispose = function () { if (!this.disposable.isDisposed && !this.isInnerDisposed) { this.isInnerDisposed = true; this.disposable.count--; if (this.disposable.count === 0 && this.disposable.isPrimaryDisposed) { this.disposable.isDisposed = true; this.disposable.underlyingDisposable.dispose(); } } }; /** * Initializes a new instance of the RefCountDisposable with the specified disposable. * @constructor * @param {Disposable} disposable Underlying disposable. */ function RefCountDisposable(disposable) { this.underlyingDisposable = disposable; this.isDisposed = false; this.isPrimaryDisposed = false; this.count = 0; } /** * Disposes the underlying disposable only when all dependent disposables have been disposed */ RefCountDisposable.prototype.dispose = function () { if (!this.isDisposed && !this.isPrimaryDisposed) { this.isPrimaryDisposed = true; if (this.count === 0) { this.isDisposed = true; this.underlyingDisposable.dispose(); } } }; /** * Returns a dependent disposable that when disposed decreases the refcount on the underlying disposable. * @returns {Disposable} A dependent disposable contributing to the reference count that manages the underlying disposable's lifetime. */ RefCountDisposable.prototype.getDisposable = function () { return this.isDisposed ? disposableEmpty : new InnerDisposable(this); }; return RefCountDisposable; })(); function ScheduledDisposable(scheduler, disposable) { this.scheduler = scheduler; this.disposable = disposable; this.isDisposed = false; } function scheduleItem(s, self) { if (!self.isDisposed) { self.isDisposed = true; self.disposable.dispose(); } } ScheduledDisposable.prototype.dispose = function () { this.scheduler.scheduleWithState(this, scheduleItem); }; var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) { this.scheduler = scheduler; this.state = state; this.action = action; this.dueTime = dueTime; this.comparer = comparer || defaultSubComparer; this.disposable = new SingleAssignmentDisposable(); } ScheduledItem.prototype.invoke = function () { this.disposable.setDisposable(this.invokeCore()); }; ScheduledItem.prototype.compareTo = function (other) { return this.comparer(this.dueTime, other.dueTime); }; ScheduledItem.prototype.isCancelled = function () { return this.disposable.isDisposed; }; ScheduledItem.prototype.invokeCore = function () { return this.action(this.scheduler, this.state); }; /** Provides a set of static properties to access commonly used schedulers. */ var Scheduler = Rx.Scheduler = (function () { function Scheduler(now, schedule, scheduleRelative, scheduleAbsolute) { this.now = now; this._schedule = schedule; this._scheduleRelative = scheduleRelative; this._scheduleAbsolute = scheduleAbsolute; } /** Determines whether the given object is a scheduler */ Scheduler.isScheduler = function (s) { return s instanceof Scheduler; } function invokeAction(scheduler, action) { action(); return disposableEmpty; } var schedulerProto = Scheduler.prototype; /** * Schedules an action to be executed. * @param {Function} action Action to execute. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.schedule = function (action) { return this._schedule(action, invokeAction); }; /** * Schedules an action to be executed. * @param state State passed to the action to be executed. * @param {Function} action Action to be executed. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleWithState = function (state, action) { return this._schedule(state, action); }; /** * Schedules an action to be executed after the specified relative due time. * @param {Function} action Action to execute. * @param {Number} dueTime Relative time after which to execute the action. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleWithRelative = function (dueTime, action) { return this._scheduleRelative(action, dueTime, invokeAction); }; /** * Schedules an action to be executed after dueTime. * @param state State passed to the action to be executed. * @param {Function} action Action to be executed. * @param {Number} dueTime Relative time after which to execute the action. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleWithRelativeAndState = function (state, dueTime, action) { return this._scheduleRelative(state, dueTime, action); }; /** * Schedules an action to be executed at the specified absolute due time. * @param {Function} action Action to execute. * @param {Number} dueTime Absolute time at which to execute the action. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleWithAbsolute = function (dueTime, action) { return this._scheduleAbsolute(action, dueTime, invokeAction); }; /** * Schedules an action to be executed at dueTime. * @param {Mixed} state State passed to the action to be executed. * @param {Function} action Action to be executed. * @param {Number}dueTime Absolute time at which to execute the action. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleWithAbsoluteAndState = function (state, dueTime, action) { return this._scheduleAbsolute(state, dueTime, action); }; /** Gets the current time according to the local machine's system clock. */ Scheduler.now = defaultNow; /** * Normalizes the specified TimeSpan value to a positive value. * @param {Number} timeSpan The time span value to normalize. * @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0 */ Scheduler.normalize = function (timeSpan) { timeSpan < 0 && (timeSpan = 0); return timeSpan; }; return Scheduler; }()); var normalizeTime = Scheduler.normalize, isScheduler = Scheduler.isScheduler; (function (schedulerProto) { function invokeRecImmediate(scheduler, pair) { var state = pair[0], action = pair[1], group = new CompositeDisposable(); action(state, innerAction); return group; function innerAction(state2) { var isAdded = false, isDone = false; var d = scheduler.scheduleWithState(state2, scheduleWork); if (!isDone) { group.add(d); isAdded = true; } function scheduleWork(_, state3) { if (isAdded) { group.remove(d); } else { isDone = true; } action(state3, innerAction); return disposableEmpty; } } } function invokeRecDate(scheduler, pair, method) { var state = pair[0], action = pair[1], group = new CompositeDisposable(); action(state, innerAction); return group; function innerAction(state2, dueTime1) { var isAdded = false, isDone = false; var d = scheduler[method](state2, dueTime1, scheduleWork); if (!isDone) { group.add(d); isAdded = true; } function scheduleWork(_, state3) { if (isAdded) { group.remove(d); } else { isDone = true; } action(state3, innerAction); return disposableEmpty; } } } function invokeRecDateRelative(s, p) { return invokeRecDate(s, p, 'scheduleWithRelativeAndState'); } function invokeRecDateAbsolute(s, p) { return invokeRecDate(s, p, 'scheduleWithAbsoluteAndState'); } function scheduleInnerRecursive(action, self) { action(function(dt) { self(action, dt); }); } /** * Schedules an action to be executed recursively. * @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleRecursive = function (action) { return this.scheduleRecursiveWithState(action, scheduleInnerRecursive); }; /** * Schedules an action to be executed recursively. * @param {Mixed} state State passed to the action to be executed. * @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleRecursiveWithState = function (state, action) { return this.scheduleWithState([state, action], invokeRecImmediate); }; /** * Schedules an action to be executed recursively after a specified relative due time. * @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified relative time. * @param {Number}dueTime Relative time after which to execute the action for the first time. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleRecursiveWithRelative = function (dueTime, action) { return this.scheduleRecursiveWithRelativeAndState(action, dueTime, scheduleInnerRecursive); }; /** * Schedules an action to be executed recursively after a specified relative due time. * @param {Mixed} state State passed to the action to be executed. * @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state. * @param {Number}dueTime Relative time after which to execute the action for the first time. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleRecursiveWithRelativeAndState = function (state, dueTime, action) { return this._scheduleRelative([state, action], dueTime, invokeRecDateRelative); }; /** * Schedules an action to be executed recursively at a specified absolute due time. * @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified absolute time. * @param {Number}dueTime Absolute time at which to execute the action for the first time. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleRecursiveWithAbsolute = function (dueTime, action) { return this.scheduleRecursiveWithAbsoluteAndState(action, dueTime, scheduleInnerRecursive); }; /** * Schedules an action to be executed recursively at a specified absolute due time. * @param {Mixed} state State passed to the action to be executed. * @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state. * @param {Number}dueTime Absolute time at which to execute the action for the first time. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleRecursiveWithAbsoluteAndState = function (state, dueTime, action) { return this._scheduleAbsolute([state, action], dueTime, invokeRecDateAbsolute); }; }(Scheduler.prototype)); (function (schedulerProto) { /** * Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation. * @param {Number} period Period for running the work periodically. * @param {Function} action Action to be executed. * @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort). */ Scheduler.prototype.schedulePeriodic = function (period, action) { return this.schedulePeriodicWithState(null, period, action); }; /** * Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation. * @param {Mixed} state Initial state passed to the action upon the first iteration. * @param {Number} period Period for running the work periodically. * @param {Function} action Action to be executed, potentially updating the state. * @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort). */ Scheduler.prototype.schedulePeriodicWithState = function(state, period, action) { if (typeof root.setInterval === 'undefined') { throw new NotSupportedError(); } period = normalizeTime(period); var s = state, id = root.setInterval(function () { s = action(s); }, period); return disposableCreate(function () { root.clearInterval(id); }); }; }(Scheduler.prototype)); (function (schedulerProto) { /** * Returns a scheduler that wraps the original scheduler, adding exception handling for scheduled actions. * @param {Function} handler Handler that's run if an exception is caught. The exception will be rethrown if the handler returns false. * @returns {Scheduler} Wrapper around the original scheduler, enforcing exception handling. */ schedulerProto.catchError = schedulerProto['catch'] = function (handler) { return new CatchScheduler(this, handler); }; }(Scheduler.prototype)); var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () { function tick(command, recurse) { recurse(0, this._period); try { this._state = this._action(this._state); } catch (e) { this._cancel.dispose(); throw e; } } function SchedulePeriodicRecursive(scheduler, state, period, action) { this._scheduler = scheduler; this._state = state; this._period = period; this._action = action; } SchedulePeriodicRecursive.prototype.start = function () { var d = new SingleAssignmentDisposable(); this._cancel = d; d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this))); return d; }; return SchedulePeriodicRecursive; }()); /** Gets a scheduler that schedules work immediately on the current thread. */ var immediateScheduler = Scheduler.immediate = (function () { function scheduleNow(state, action) { return action(this, state); } return new Scheduler(defaultNow, scheduleNow, notSupported, notSupported); }()); /** * Gets a scheduler that schedules work as soon as possible on the current thread. */ var currentThreadScheduler = Scheduler.currentThread = (function () { var queue; function runTrampoline () { while (queue.length > 0) { var item = queue.shift(); !item.isCancelled() && item.invoke(); } } function scheduleNow(state, action) { var si = new ScheduledItem(this, state, action, this.now()); if (!queue) { queue = [si]; var result = tryCatch(runTrampoline)(); queue = null; if (result === errorObj) { return thrower(result.e); } } else { queue.push(si); } return si.disposable; } var currentScheduler = new Scheduler(defaultNow, scheduleNow, notSupported, notSupported); currentScheduler.scheduleRequired = function () { return !queue; }; return currentScheduler; }()); var scheduleMethod, clearMethod; var localTimer = (function () { var localSetTimeout, localClearTimeout = noop; if (!!root.setTimeout) { localSetTimeout = root.setTimeout; localClearTimeout = root.clearTimeout; } else if (!!root.WScript) { localSetTimeout = function (fn, time) { root.WScript.Sleep(time); fn(); }; } else { throw new NotSupportedError(); } return { setTimeout: localSetTimeout, clearTimeout: localClearTimeout }; }()); var localSetTimeout = localTimer.setTimeout, localClearTimeout = localTimer.clearTimeout; (function () { var nextHandle = 1, tasksByHandle = {}, currentlyRunning = false; clearMethod = function (handle) { delete tasksByHandle[handle]; }; function runTask(handle) { if (currentlyRunning) { localSetTimeout(function () { runTask(handle) }, 0); } else { var task = tasksByHandle[handle]; if (task) { currentlyRunning = true; var result = tryCatch(task)(); clearMethod(handle); currentlyRunning = false; if (result === errorObj) { return thrower(result.e); } } } } var reNative = RegExp('^' + String(toString) .replace(/[.*+?^${}()|[\]\\]/g, '\\$&') .replace(/toString| for [^\]]+/g, '.*?') + '$' ); var setImmediate = typeof (setImmediate = freeGlobal && moduleExports && freeGlobal.setImmediate) == 'function' && !reNative.test(setImmediate) && setImmediate; function postMessageSupported () { // Ensure not in a worker if (!root.postMessage || root.importScripts) { return false; } var isAsync = false, oldHandler = root.onmessage; // Test for async root.onmessage = function () { isAsync = true; }; root.postMessage('', '*'); root.onmessage = oldHandler; return isAsync; } // Use in order, setImmediate, nextTick, postMessage, MessageChannel, script readystatechanged, setTimeout if (isFunction(setImmediate)) { scheduleMethod = function (action) { var id = nextHandle++; tasksByHandle[id] = action; setImmediate(function () { runTask(id); }); return id; }; } else if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') { scheduleMethod = function (action) { var id = nextHandle++; tasksByHandle[id] = action; process.nextTick(function () { runTask(id); }); return id; }; } else if (postMessageSupported()) { var MSG_PREFIX = 'ms.rx.schedule' + Math.random(); function onGlobalPostMessage(event) { // Only if we're a match to avoid any other global events if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) { runTask(event.data.substring(MSG_PREFIX.length)); } } if (root.addEventListener) { root.addEventListener('message', onGlobalPostMessage, false); } else if (root.attachEvent) { root.attachEvent('onmessage', onGlobalPostMessage); } else { root.onmessage = onGlobalPostMessage; } scheduleMethod = function (action) { var id = nextHandle++; tasksByHandle[id] = action; root.postMessage(MSG_PREFIX + currentId, '*'); return id; }; } else if (!!root.MessageChannel) { var channel = new root.MessageChannel(); channel.port1.onmessage = function (e) { runTask(e.data); }; scheduleMethod = function (action) { var id = nextHandle++; tasksByHandle[id] = action; channel.port2.postMessage(id); return id; }; } else if ('document' in root && 'onreadystatechange' in root.document.createElement('script')) { scheduleMethod = function (action) { var scriptElement = root.document.createElement('script'); var id = nextHandle++; tasksByHandle[id] = action; scriptElement.onreadystatechange = function () { runTask(id); scriptElement.onreadystatechange = null; scriptElement.parentNode.removeChild(scriptElement); scriptElement = null; }; root.document.documentElement.appendChild(scriptElement); return id; }; } else { scheduleMethod = function (action) { var id = nextHandle++; tasksByHandle[id] = action; localSetTimeout(function () { runTask(id); }, 0); return id; }; } }()); /** * Gets a scheduler that schedules work via a timed callback based upon platform. */ var timeoutScheduler = Scheduler.timeout = Scheduler['default'] = (function () { function scheduleNow(state, action) { var scheduler = this, disposable = new SingleAssignmentDisposable(); var id = scheduleMethod(function () { !disposable.isDisposed && disposable.setDisposable(action(scheduler, state)); }); return new CompositeDisposable(disposable, disposableCreate(function () { clearMethod(id); })); } function scheduleRelative(state, dueTime, action) { var scheduler = this, dt = Scheduler.normalize(dueTime), disposable = new SingleAssignmentDisposable(); if (dt === 0) { return scheduler.scheduleWithState(state, action); } var id = localSetTimeout(function () { !disposable.isDisposed && disposable.setDisposable(action(scheduler, state)); }, dt); return new CompositeDisposable(disposable, disposableCreate(function () { localClearTimeout(id); })); } function scheduleAbsolute(state, dueTime, action) { return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action); } return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute); })(); var CatchScheduler = (function (__super__) { function scheduleNow(state, action) { return this._scheduler.scheduleWithState(state, this._wrap(action)); } function scheduleRelative(state, dueTime, action) { return this._scheduler.scheduleWithRelativeAndState(state, dueTime, this._wrap(action)); } function scheduleAbsolute(state, dueTime, action) { return this._scheduler.scheduleWithAbsoluteAndState(state, dueTime, this._wrap(action)); } inherits(CatchScheduler, __super__); function CatchScheduler(scheduler, handler) { this._scheduler = scheduler; this._handler = handler; this._recursiveOriginal = null; this._recursiveWrapper = null; __super__.call(this, this._scheduler.now.bind(this._scheduler), scheduleNow, scheduleRelative, scheduleAbsolute); } CatchScheduler.prototype._clone = function (scheduler) { return new CatchScheduler(scheduler, this._handler); }; CatchScheduler.prototype._wrap = function (action) { var parent = this; return function (self, state) { try { return action(parent._getRecursiveWrapper(self), state); } catch (e) { if (!parent._handler(e)) { throw e; } return disposableEmpty; } }; }; CatchScheduler.prototype._getRecursiveWrapper = function (scheduler) { if (this._recursiveOriginal !== scheduler) { this._recursiveOriginal = scheduler; var wrapper = this._clone(scheduler); wrapper._recursiveOriginal = scheduler; wrapper._recursiveWrapper = wrapper; this._recursiveWrapper = wrapper; } return this._recursiveWrapper; }; CatchScheduler.prototype.schedulePeriodicWithState = function (state, period, action) { var self = this, failed = false, d = new SingleAssignmentDisposable(); d.setDisposable(this._scheduler.schedulePeriodicWithState(state, period, function (state1) { if (failed) { return null; } try { return action(state1); } catch (e) { failed = true; if (!self._handler(e)) { throw e; } d.dispose(); return null; } })); return d; }; return CatchScheduler; }(Scheduler)); /** * Represents a notification to an observer. */ var Notification = Rx.Notification = (function () { function Notification(kind, value, exception, accept, acceptObservable, toString) { this.kind = kind; this.value = value; this.exception = exception; this._accept = accept; this._acceptObservable = acceptObservable; this.toString = toString; } /** * Invokes the delegate corresponding to the notification or the observer's method corresponding to the notification and returns the produced result. * * @memberOf Notification * @param {Any} observerOrOnNext Delegate to invoke for an OnNext notification or Observer to invoke the notification on.. * @param {Function} onError Delegate to invoke for an OnError notification. * @param {Function} onCompleted Delegate to invoke for an OnCompleted notification. * @returns {Any} Result produced by the observation. */ Notification.prototype.accept = function (observerOrOnNext, onError, onCompleted) { return observerOrOnNext && typeof observerOrOnNext === 'object' ? this._acceptObservable(observerOrOnNext) : this._accept(observerOrOnNext, onError, onCompleted); }; /** * Returns an observable sequence with a single notification. * * @memberOf Notifications * @param {Scheduler} [scheduler] Scheduler to send out the notification calls on. * @returns {Observable} The observable sequence that surfaces the behavior of the notification upon subscription. */ Notification.prototype.toObservable = function (scheduler) { var self = this; isScheduler(scheduler) || (scheduler = immediateScheduler); return new AnonymousObservable(function (observer) { return scheduler.scheduleWithState(self, function (_, notification) { notification._acceptObservable(observer); notification.kind === 'N' && observer.onCompleted(); }); }); }; return Notification; })(); /** * Creates an object that represents an OnNext notification to an observer. * @param {Any} value The value contained in the notification. * @returns {Notification} The OnNext notification containing the value. */ var notificationCreateOnNext = Notification.createOnNext = (function () { function _accept(onNext) { return onNext(this.value); } function _acceptObservable(observer) { return observer.onNext(this.value); } function toString() { return 'OnNext(' + this.value + ')'; } return function (value) { return new Notification('N', value, null, _accept, _acceptObservable, toString); }; }()); /** * Creates an object that represents an OnError notification to an observer. * @param {Any} error The exception contained in the notification. * @returns {Notification} The OnError notification containing the exception. */ var notificationCreateOnError = Notification.createOnError = (function () { function _accept (onNext, onError) { return onError(this.exception); } function _acceptObservable(observer) { return observer.onError(this.exception); } function toString () { return 'OnError(' + this.exception + ')'; } return function (e) { return new Notification('E', null, e, _accept, _acceptObservable, toString); }; }()); /** * Creates an object that represents an OnCompleted notification to an observer. * @returns {Notification} The OnCompleted notification. */ var notificationCreateOnCompleted = Notification.createOnCompleted = (function () { function _accept (onNext, onError, onCompleted) { return onCompleted(); } function _acceptObservable(observer) { return observer.onCompleted(); } function toString () { return 'OnCompleted()'; } return function () { return new Notification('C', null, null, _accept, _acceptObservable, toString); }; }()); /** * Supports push-style iteration over an observable sequence. */ var Observer = Rx.Observer = function () { }; /** * Creates a notification callback from an observer. * @returns The action that forwards its input notification to the underlying observer. */ Observer.prototype.toNotifier = function () { var observer = this; return function (n) { return n.accept(observer); }; }; /** * Hides the identity of an observer. * @returns An observer that hides the identity of the specified observer. */ Observer.prototype.asObserver = function () { var self = this; return new AnonymousObserver( function (x) { self.onNext(x); }, function (err) { self.onError(err); }, function () { self.onCompleted(); }); }; /** * Checks access to the observer for grammar violations. This includes checking for multiple OnError or OnCompleted calls, as well as reentrancy in any of the observer methods. * If a violation is detected, an Error is thrown from the offending observer method call. * @returns An observer that checks callbacks invocations against the observer grammar and, if the checks pass, forwards those to the specified observer. */ Observer.prototype.checked = function () { return new CheckedObserver(this); }; /** * Creates an observer from the specified OnNext, along with optional OnError, and OnCompleted actions. * @param {Function} [onNext] Observer's OnNext action implementation. * @param {Function} [onError] Observer's OnError action implementation. * @param {Function} [onCompleted] Observer's OnCompleted action implementation. * @returns {Observer} The observer object implemented using the given actions. */ var observerCreate = Observer.create = function (onNext, onError, onCompleted) { onNext || (onNext = noop); onError || (onError = defaultError); onCompleted || (onCompleted = noop); return new AnonymousObserver(onNext, onError, onCompleted); }; /** * Creates an observer from a notification callback. * * @static * @memberOf Observer * @param {Function} handler Action that handles a notification. * @returns The observer object that invokes the specified handler using a notification corresponding to each message it receives. */ Observer.fromNotifier = function (handler, thisArg) { var cb = bindCallback(handler, thisArg, 1); return new AnonymousObserver(function (x) { return cb(notificationCreateOnNext(x)); }, function (e) { return cb(notificationCreateOnError(e)); }, function () { return cb(notificationCreateOnCompleted()); }); }; /** * Schedules the invocation of observer methods on the given scheduler. * @param {Scheduler} scheduler Scheduler to schedule observer messages on. * @returns {Observer} Observer whose messages are scheduled on the given scheduler. */ Observer.prototype.notifyOn = function (scheduler) { return new ObserveOnObserver(scheduler, this); }; Observer.prototype.makeSafe = function(disposable) { return new AnonymousSafeObserver(this._onNext, this._onError, this._onCompleted, disposable); }; /** * Abstract base class for implementations of the Observer class. * This base class enforces the grammar of observers where OnError and OnCompleted are terminal messages. */ var AbstractObserver = Rx.internals.AbstractObserver = (function (__super__) { inherits(AbstractObserver, __super__); /** * Creates a new observer in a non-stopped state. */ function AbstractObserver() { this.isStopped = false; } // Must be implemented by other observers AbstractObserver.prototype.next = notImplemented; AbstractObserver.prototype.error = notImplemented; AbstractObserver.prototype.completed = notImplemented; /** * Notifies the observer of a new element in the sequence. * @param {Any} value Next element in the sequence. */ AbstractObserver.prototype.onNext = function (value) { !this.isStopped && this.next(value); }; /** * Notifies the observer that an exception has occurred. * @param {Any} error The error that has occurred. */ AbstractObserver.prototype.onError = function (error) { if (!this.isStopped) { this.isStopped = true; this.error(error); } }; /** * Notifies the observer of the end of the sequence. */ AbstractObserver.prototype.onCompleted = function () { if (!this.isStopped) { this.isStopped = true; this.completed(); } }; /** * Disposes the observer, causing it to transition to the stopped state. */ AbstractObserver.prototype.dispose = function () { this.isStopped = true; }; AbstractObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.error(e); return true; } return false; }; return AbstractObserver; }(Observer)); /** * Class to create an Observer instance from delegate-based implementations of the on* methods. */ var AnonymousObserver = Rx.AnonymousObserver = (function (__super__) { inherits(AnonymousObserver, __super__); /** * Creates an observer from the specified OnNext, OnError, and OnCompleted actions. * @param {Any} onNext Observer's OnNext action implementation. * @param {Any} onError Observer's OnError action implementation. * @param {Any} onCompleted Observer's OnCompleted action implementation. */ function AnonymousObserver(onNext, onError, onCompleted) { __super__.call(this); this._onNext = onNext; this._onError = onError; this._onCompleted = onCompleted; } /** * Calls the onNext action. * @param {Any} value Next element in the sequence. */ AnonymousObserver.prototype.next = function (value) { this._onNext(value); }; /** * Calls the onError action. * @param {Any} error The error that has occurred. */ AnonymousObserver.prototype.error = function (error) { this._onError(error); }; /** * Calls the onCompleted action. */ AnonymousObserver.prototype.completed = function () { this._onCompleted(); }; return AnonymousObserver; }(AbstractObserver)); var CheckedObserver = (function (__super__) { inherits(CheckedObserver, __super__); function CheckedObserver(observer) { __super__.call(this); this._observer = observer; this._state = 0; // 0 - idle, 1 - busy, 2 - done } var CheckedObserverPrototype = CheckedObserver.prototype; CheckedObserverPrototype.onNext = function (value) { this.checkAccess(); var res = tryCatch(this._observer.onNext).call(this._observer, value); this._state = 0; res === errorObj && thrower(res.e); }; CheckedObserverPrototype.onError = function (err) { this.checkAccess(); var res = tryCatch(this._observer.onError).call(this._observer, err); this._state = 2; res === errorObj && thrower(res.e); }; CheckedObserverPrototype.onCompleted = function () { this.checkAccess(); var res = tryCatch(this._observer.onCompleted).call(this._observer); this._state = 2; res === errorObj && thrower(res.e); }; CheckedObserverPrototype.checkAccess = function () { if (this._state === 1) { throw new Error('Re-entrancy detected'); } if (this._state === 2) { throw new Error('Observer completed'); } if (this._state === 0) { this._state = 1; } }; return CheckedObserver; }(Observer)); var ScheduledObserver = Rx.internals.ScheduledObserver = (function (__super__) { inherits(ScheduledObserver, __super__); function ScheduledObserver(scheduler, observer) { __super__.call(this); this.scheduler = scheduler; this.observer = observer; this.isAcquired = false; this.hasFaulted = false; this.queue = []; this.disposable = new SerialDisposable(); } ScheduledObserver.prototype.next = function (value) { var self = this; this.queue.push(function () { self.observer.onNext(value); }); }; ScheduledObserver.prototype.error = function (e) { var self = this; this.queue.push(function () { self.observer.onError(e); }); }; ScheduledObserver.prototype.completed = function () { var self = this; this.queue.push(function () { self.observer.onCompleted(); }); }; ScheduledObserver.prototype.ensureActive = function () { var isOwner = false; if (!this.hasFaulted && this.queue.length > 0) { isOwner = !this.isAcquired; this.isAcquired = true; } if (isOwner) { this.disposable.setDisposable(this.scheduler.scheduleRecursiveWithState(this, function (parent, self) { var work; if (parent.queue.length > 0) { work = parent.queue.shift(); } else { parent.isAcquired = false; return; } var res = tryCatch(work)(); if (res === errorObj) { parent.queue = []; parent.hasFaulted = true; return thrower(res.e); } self(parent); })); } }; ScheduledObserver.prototype.dispose = function () { __super__.prototype.dispose.call(this); this.disposable.dispose(); }; return ScheduledObserver; }(AbstractObserver)); var ObserveOnObserver = (function (__super__) { inherits(ObserveOnObserver, __super__); function ObserveOnObserver(scheduler, observer, cancel) { __super__.call(this, scheduler, observer); this._cancel = cancel; } ObserveOnObserver.prototype.next = function (value) { __super__.prototype.next.call(this, value); this.ensureActive(); }; ObserveOnObserver.prototype.error = function (e) { __super__.prototype.error.call(this, e); this.ensureActive(); }; ObserveOnObserver.prototype.completed = function () { __super__.prototype.completed.call(this); this.ensureActive(); }; ObserveOnObserver.prototype.dispose = function () { __super__.prototype.dispose.call(this); this._cancel && this._cancel.dispose(); this._cancel = null; }; return ObserveOnObserver; })(ScheduledObserver); var observableProto; /** * Represents a push-style collection. */ var Observable = Rx.Observable = (function () { function makeSubscribe(self, subscribe) { return function (o) { var oldOnError = o.onError; o.onError = function (e) { makeStackTraceLong(e, self); oldOnError.call(o, e); }; return subscribe.call(self, o); }; } function Observable(subscribe) { if (Rx.config.longStackSupport && hasStacks) { var e = tryCatch(thrower)(new Error()).e; this.stack = e.stack.substring(e.stack.indexOf('\n') + 1); this._subscribe = makeSubscribe(this, subscribe); } else { this._subscribe = subscribe; } } observableProto = Observable.prototype; /** * Determines whether the given object is an Observable * @param {Any} An object to determine whether it is an Observable * @returns {Boolean} true if an Observable, else false. */ Observable.isObservable = function (o) { return o && isFunction(o.subscribe); } /** * Subscribes an o to the observable sequence. * @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence. * @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence. * @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. * @returns {Diposable} A disposable handling the subscriptions and unsubscriptions. */ observableProto.subscribe = observableProto.forEach = function (oOrOnNext, onError, onCompleted) { return this._subscribe(typeof oOrOnNext === 'object' ? oOrOnNext : observerCreate(oOrOnNext, onError, onCompleted)); }; /** * Subscribes to the next value in the sequence with an optional "this" argument. * @param {Function} onNext The function to invoke on each element in the observable sequence. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Disposable} A disposable handling the subscriptions and unsubscriptions. */ observableProto.subscribeOnNext = function (onNext, thisArg) { return this._subscribe(observerCreate(typeof thisArg !== 'undefined' ? function(x) { onNext.call(thisArg, x); } : onNext)); }; /** * Subscribes to an exceptional condition in the sequence with an optional "this" argument. * @param {Function} onError The function to invoke upon exceptional termination of the observable sequence. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Disposable} A disposable handling the subscriptions and unsubscriptions. */ observableProto.subscribeOnError = function (onError, thisArg) { return this._subscribe(observerCreate(null, typeof thisArg !== 'undefined' ? function(e) { onError.call(thisArg, e); } : onError)); }; /** * Subscribes to the next value in the sequence with an optional "this" argument. * @param {Function} onCompleted The function to invoke upon graceful termination of the observable sequence. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Disposable} A disposable handling the subscriptions and unsubscriptions. */ observableProto.subscribeOnCompleted = function (onCompleted, thisArg) { return this._subscribe(observerCreate(null, null, typeof thisArg !== 'undefined' ? function() { onCompleted.call(thisArg); } : onCompleted)); }; return Observable; })(); var ObservableBase = Rx.ObservableBase = (function (__super__) { inherits(ObservableBase, __super__); function fixSubscriber(subscriber) { return subscriber && isFunction(subscriber.dispose) ? subscriber : isFunction(subscriber) ? disposableCreate(subscriber) : disposableEmpty; } function setDisposable(s, state) { var ado = state[0], self = state[1]; var sub = tryCatch(self.subscribeCore).call(self, ado); if (sub === errorObj) { if(!ado.fail(errorObj.e)) { return thrower(errorObj.e); } } ado.setDisposable(fixSubscriber(sub)); } function subscribe(observer) { var ado = new AutoDetachObserver(observer), state = [ado, this]; if (currentThreadScheduler.scheduleRequired()) { currentThreadScheduler.scheduleWithState(state, setDisposable); } else { setDisposable(null, state); } return ado; } function ObservableBase() { __super__.call(this, subscribe); } ObservableBase.prototype.subscribeCore = notImplemented; return ObservableBase; }(Observable)); var FlatMapObservable = (function(__super__){ inherits(FlatMapObservable, __super__); function FlatMapObservable(source, selector, resultSelector, thisArg) { this.resultSelector = Rx.helpers.isFunction(resultSelector) ? resultSelector : null; this.selector = Rx.internals.bindCallback(Rx.helpers.isFunction(selector) ? selector : function() { return selector; }, thisArg, 3); this.source = source; __super__.call(this); } FlatMapObservable.prototype.subscribeCore = function(o) { return this.source.subscribe(new InnerObserver(o, this.selector, this.resultSelector, this)); }; function InnerObserver(observer, selector, resultSelector, source) { this.i = 0; this.selector = selector; this.resultSelector = resultSelector; this.source = source; this.isStopped = false; this.o = observer; } InnerObserver.prototype._wrapResult = function(result, x, i) { return this.resultSelector ? result.map(function(y, i2) { return this.resultSelector(x, y, i, i2); }, this) : result; }; InnerObserver.prototype.onNext = function(x) { if (this.isStopped) return; var i = this.i++; var result = tryCatch(this.selector)(x, i, this.source); if (result === errorObj) { return this.o.onError(result.e); } Rx.helpers.isPromise(result) && (result = Rx.Observable.fromPromise(result)); (Rx.helpers.isArrayLike(result) || Rx.helpers.isIterable(result)) && (result = Rx.Observable.from(result)); this.o.onNext(this._wrapResult(result, x, i)); }; InnerObserver.prototype.onError = function(e) { if(!this.isStopped) { this.isStopped = true; this.o.onError(e); } }; InnerObserver.prototype.onCompleted = function() { if (!this.isStopped) {this.isStopped = true; this.o.onCompleted(); } }; return FlatMapObservable; }(ObservableBase)); var Enumerable = Rx.internals.Enumerable = function () { }; var ConcatEnumerableObservable = (function(__super__) { inherits(ConcatEnumerableObservable, __super__); function ConcatEnumerableObservable(sources) { this.sources = sources; __super__.call(this); } ConcatEnumerableObservable.prototype.subscribeCore = function (o) { var isDisposed, subscription = new SerialDisposable(); var cancelable = immediateScheduler.scheduleRecursiveWithState(this.sources[$iterator$](), function (e, self) { if (isDisposed) { return; } var currentItem = tryCatch(e.next).call(e); if (currentItem === errorObj) { return o.onError(currentItem.e); } if (currentItem.done) { return o.onCompleted(); } // Check if promise var currentValue = currentItem.value; isPromise(currentValue) && (currentValue = observableFromPromise(currentValue)); var d = new SingleAssignmentDisposable(); subscription.setDisposable(d); d.setDisposable(currentValue.subscribe(new InnerObserver(o, self, e))); }); return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { isDisposed = true; })); }; function InnerObserver(o, s, e) { this.o = o; this.s = s; this.e = e; this.isStopped = false; } InnerObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.o.onNext(x); } }; InnerObserver.prototype.onError = function (err) { if (!this.isStopped) { this.isStopped = true; this.o.onError(err); } }; InnerObserver.prototype.onCompleted = function () { if (!this.isStopped) { this.isStopped = true; this.s(this.e); } }; InnerObserver.prototype.dispose = function () { this.isStopped = true; }; InnerObserver.prototype.fail = function (err) { if (!this.isStopped) { this.isStopped = true; this.o.onError(err); return true; } return false; }; return ConcatEnumerableObservable; }(ObservableBase)); Enumerable.prototype.concat = function () { return new ConcatEnumerableObservable(this); }; var CatchErrorObservable = (function(__super__) { inherits(CatchErrorObservable, __super__); function CatchErrorObservable(sources) { this.sources = sources; __super__.call(this); } CatchErrorObservable.prototype.subscribeCore = function (o) { var e = this.sources[$iterator$](); var isDisposed, subscription = new SerialDisposable(); var cancelable = immediateScheduler.scheduleRecursiveWithState(null, function (lastException, self) { if (isDisposed) { return; } var currentItem = tryCatch(e.next).call(e); if (currentItem === errorObj) { return o.onError(currentItem.e); } if (currentItem.done) { return lastException !== null ? o.onError(lastException) : o.onCompleted(); } // Check if promise var currentValue = currentItem.value; isPromise(currentValue) && (currentValue = observableFromPromise(currentValue)); var d = new SingleAssignmentDisposable(); subscription.setDisposable(d); d.setDisposable(currentValue.subscribe( function(x) { o.onNext(x); }, self, function() { o.onCompleted(); })); }); return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { isDisposed = true; })); }; return CatchErrorObservable; }(ObservableBase)); Enumerable.prototype.catchError = function () { return new CatchErrorObservable(this); }; Enumerable.prototype.catchErrorWhen = function (notificationHandler) { var sources = this; return new AnonymousObservable(function (o) { var exceptions = new Subject(), notifier = new Subject(), handled = notificationHandler(exceptions), notificationDisposable = handled.subscribe(notifier); var e = sources[$iterator$](); var isDisposed, lastException, subscription = new SerialDisposable(); var cancelable = immediateScheduler.scheduleRecursive(function (self) { if (isDisposed) { return; } var currentItem = tryCatch(e.next).call(e); if (currentItem === errorObj) { return o.onError(currentItem.e); } if (currentItem.done) { if (lastException) { o.onError(lastException); } else { o.onCompleted(); } return; } // Check if promise var currentValue = currentItem.value; isPromise(currentValue) && (currentValue = observableFromPromise(currentValue)); var outer = new SingleAssignmentDisposable(); var inner = new SingleAssignmentDisposable(); subscription.setDisposable(new CompositeDisposable(inner, outer)); outer.setDisposable(currentValue.subscribe( function(x) { o.onNext(x); }, function (exn) { inner.setDisposable(notifier.subscribe(self, function(ex) { o.onError(ex); }, function() { o.onCompleted(); })); exceptions.onNext(exn); }, function() { o.onCompleted(); })); }); return new CompositeDisposable(notificationDisposable, subscription, cancelable, disposableCreate(function () { isDisposed = true; })); }); }; var RepeatEnumerable = (function (__super__) { inherits(RepeatEnumerable, __super__); function RepeatEnumerable(v, c) { this.v = v; this.c = c == null ? -1 : c; } RepeatEnumerable.prototype[$iterator$] = function () { return new RepeatEnumerator(this); }; function RepeatEnumerator(p) { this.v = p.v; this.l = p.c; } RepeatEnumerator.prototype.next = function () { if (this.l === 0) { return doneEnumerator; } if (this.l > 0) { this.l--; } return { done: false, value: this.v }; }; return RepeatEnumerable; }(Enumerable)); var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) { return new RepeatEnumerable(value, repeatCount); }; var OfEnumerable = (function(__super__) { inherits(OfEnumerable, __super__); function OfEnumerable(s, fn, thisArg) { this.s = s; this.fn = fn ? bindCallback(fn, thisArg, 3) : null; } OfEnumerable.prototype[$iterator$] = function () { return new OfEnumerator(this); }; function OfEnumerator(p) { this.i = -1; this.s = p.s; this.l = this.s.length; this.fn = p.fn; } OfEnumerator.prototype.next = function () { return ++this.i < this.l ? { done: false, value: !this.fn ? this.s[this.i] : this.fn(this.s[this.i], this.i, this.s) } : doneEnumerator; }; return OfEnumerable; }(Enumerable)); var enumerableOf = Enumerable.of = function (source, selector, thisArg) { return new OfEnumerable(source, selector, thisArg); }; /** * Wraps the source sequence in order to run its observer callbacks on the specified scheduler. * * This only invokes observer callbacks on a scheduler. In case the subscription and/or unsubscription actions have side-effects * that require to be run on a scheduler, use subscribeOn. * * @param {Scheduler} scheduler Scheduler to notify observers on. * @returns {Observable} The source sequence whose observations happen on the specified scheduler. */ observableProto.observeOn = function (scheduler) { var source = this; return new AnonymousObservable(function (observer) { return source.subscribe(new ObserveOnObserver(scheduler, observer)); }, source); }; /** * Wraps the source sequence in order to run its subscription and unsubscription logic on the specified scheduler. This operation is not commonly used; * see the remarks section for more information on the distinction between subscribeOn and observeOn. * This only performs the side-effects of subscription and unsubscription on the specified scheduler. In order to invoke observer * callbacks on a scheduler, use observeOn. * @param {Scheduler} scheduler Scheduler to perform subscription and unsubscription actions on. * @returns {Observable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler. */ observableProto.subscribeOn = function (scheduler) { var source = this; return new AnonymousObservable(function (observer) { var m = new SingleAssignmentDisposable(), d = new SerialDisposable(); d.setDisposable(m); m.setDisposable(scheduler.schedule(function () { d.setDisposable(new ScheduledDisposable(scheduler, source.subscribe(observer))); })); return d; }, source); }; var FromPromiseObservable = (function(__super__) { inherits(FromPromiseObservable, __super__); function FromPromiseObservable(p) { this.p = p; __super__.call(this); } FromPromiseObservable.prototype.subscribeCore = function(o) { this.p.then(function (data) { o.onNext(data); o.onCompleted(); }, function (err) { o.onError(err); }); return disposableEmpty; }; return FromPromiseObservable; }(ObservableBase)); /** * Converts a Promise to an Observable sequence * @param {Promise} An ES6 Compliant promise. * @returns {Observable} An Observable sequence which wraps the existing promise success and failure. */ var observableFromPromise = Observable.fromPromise = function (promise) { return new FromPromiseObservable(promise); }; /* * Converts an existing observable sequence to an ES6 Compatible Promise * @example * var promise = Rx.Observable.return(42).toPromise(RSVP.Promise); * * // With config * Rx.config.Promise = RSVP.Promise; * var promise = Rx.Observable.return(42).toPromise(); * @param {Function} [promiseCtor] The constructor of the promise. If not provided, it looks for it in Rx.config.Promise. * @returns {Promise} An ES6 compatible promise with the last value from the observable sequence. */ observableProto.toPromise = function (promiseCtor) { promiseCtor || (promiseCtor = Rx.config.Promise); if (!promiseCtor) { throw new NotSupportedError('Promise type not provided nor in Rx.config.Promise'); } var source = this; return new promiseCtor(function (resolve, reject) { // No cancellation can be done var value, hasValue = false; source.subscribe(function (v) { value = v; hasValue = true; }, reject, function () { hasValue && resolve(value); }); }); }; var ToArrayObservable = (function(__super__) { inherits(ToArrayObservable, __super__); function ToArrayObservable(source) { this.source = source; __super__.call(this); } ToArrayObservable.prototype.subscribeCore = function(o) { return this.source.subscribe(new InnerObserver(o)); }; function InnerObserver(o) { this.o = o; this.a = []; this.isStopped = false; } InnerObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.a.push(x); } }; InnerObserver.prototype.onError = function (e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); } }; InnerObserver.prototype.onCompleted = function () { if (!this.isStopped) { this.isStopped = true; this.o.onNext(this.a); this.o.onCompleted(); } }; InnerObserver.prototype.dispose = function () { this.isStopped = true; } InnerObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); return true; } return false; }; return ToArrayObservable; }(ObservableBase)); /** * Creates an array from an observable sequence. * @returns {Observable} An observable sequence containing a single element with a list containing all the elements of the source sequence. */ observableProto.toArray = function () { return new ToArrayObservable(this); }; /** * Creates an observable sequence from a specified subscribe method implementation. * @example * var res = Rx.Observable.create(function (observer) { return function () { } ); * var res = Rx.Observable.create(function (observer) { return Rx.Disposable.empty; } ); * var res = Rx.Observable.create(function (observer) { } ); * @param {Function} subscribe Implementation of the resulting observable sequence's subscribe method, returning a function that will be wrapped in a Disposable. * @returns {Observable} The observable sequence with the specified implementation for the Subscribe method. */ Observable.create = function (subscribe, parent) { return new AnonymousObservable(subscribe, parent); }; /** * Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes. * * @example * var res = Rx.Observable.defer(function () { return Rx.Observable.fromArray([1,2,3]); }); * @param {Function} observableFactory Observable factory function to invoke for each observer that subscribes to the resulting sequence or Promise. * @returns {Observable} An observable sequence whose observers trigger an invocation of the given observable factory function. */ var observableDefer = Observable.defer = function (observableFactory) { return new AnonymousObservable(function (observer) { var result; try { result = observableFactory(); } catch (e) { return observableThrow(e).subscribe(observer); } isPromise(result) && (result = observableFromPromise(result)); return result.subscribe(observer); }); }; var EmptyObservable = (function(__super__) { inherits(EmptyObservable, __super__); function EmptyObservable(scheduler) { this.scheduler = scheduler; __super__.call(this); } EmptyObservable.prototype.subscribeCore = function (observer) { var sink = new EmptySink(observer, this.scheduler); return sink.run(); }; function EmptySink(observer, scheduler) { this.observer = observer; this.scheduler = scheduler; } function scheduleItem(s, state) { state.onCompleted(); return disposableEmpty; } EmptySink.prototype.run = function () { return this.scheduler.scheduleWithState(this.observer, scheduleItem); }; return EmptyObservable; }(ObservableBase)); var EMPTY_OBSERVABLE = new EmptyObservable(immediateScheduler); /** * Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message. * * @example * var res = Rx.Observable.empty(); * var res = Rx.Observable.empty(Rx.Scheduler.timeout); * @param {Scheduler} [scheduler] Scheduler to send the termination call on. * @returns {Observable} An observable sequence with no elements. */ var observableEmpty = Observable.empty = function (scheduler) { isScheduler(scheduler) || (scheduler = immediateScheduler); return scheduler === immediateScheduler ? EMPTY_OBSERVABLE : new EmptyObservable(scheduler); }; var FromObservable = (function(__super__) { inherits(FromObservable, __super__); function FromObservable(iterable, mapper, scheduler) { this.iterable = iterable; this.mapper = mapper; this.scheduler = scheduler; __super__.call(this); } FromObservable.prototype.subscribeCore = function (o) { var sink = new FromSink(o, this); return sink.run(); }; return FromObservable; }(ObservableBase)); var FromSink = (function () { function FromSink(o, parent) { this.o = o; this.parent = parent; } FromSink.prototype.run = function () { var list = Object(this.parent.iterable), it = getIterable(list), o = this.o, mapper = this.parent.mapper; function loopRecursive(i, recurse) { var next = tryCatch(it.next).call(it); if (next === errorObj) { return o.onError(next.e); } if (next.done) { return o.onCompleted(); } var result = next.value; if (isFunction(mapper)) { result = tryCatch(mapper)(result, i); if (result === errorObj) { return o.onError(result.e); } } o.onNext(result); recurse(i + 1); } return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive); }; return FromSink; }()); var maxSafeInteger = Math.pow(2, 53) - 1; function StringIterable(s) { this._s = s; } StringIterable.prototype[$iterator$] = function () { return new StringIterator(this._s); }; function StringIterator(s) { this._s = s; this._l = s.length; this._i = 0; } StringIterator.prototype[$iterator$] = function () { return this; }; StringIterator.prototype.next = function () { return this._i < this._l ? { done: false, value: this._s.charAt(this._i++) } : doneEnumerator; }; function ArrayIterable(a) { this._a = a; } ArrayIterable.prototype[$iterator$] = function () { return new ArrayIterator(this._a); }; function ArrayIterator(a) { this._a = a; this._l = toLength(a); this._i = 0; } ArrayIterator.prototype[$iterator$] = function () { return this; }; ArrayIterator.prototype.next = function () { return this._i < this._l ? { done: false, value: this._a[this._i++] } : doneEnumerator; }; function numberIsFinite(value) { return typeof value === 'number' && root.isFinite(value); } function isNan(n) { return n !== n; } function getIterable(o) { var i = o[$iterator$], it; if (!i && typeof o === 'string') { it = new StringIterable(o); return it[$iterator$](); } if (!i && o.length !== undefined) { it = new ArrayIterable(o); return it[$iterator$](); } if (!i) { throw new TypeError('Object is not iterable'); } return o[$iterator$](); } function sign(value) { var number = +value; if (number === 0) { return number; } if (isNaN(number)) { return number; } return number < 0 ? -1 : 1; } function toLength(o) { var len = +o.length; if (isNaN(len)) { return 0; } if (len === 0 || !numberIsFinite(len)) { return len; } len = sign(len) * Math.floor(Math.abs(len)); if (len <= 0) { return 0; } if (len > maxSafeInteger) { return maxSafeInteger; } return len; } /** * This method creates a new Observable sequence from an array-like or iterable object. * @param {Any} arrayLike An array-like or iterable object to convert to an Observable sequence. * @param {Function} [mapFn] Map function to call on every element of the array. * @param {Any} [thisArg] The context to use calling the mapFn if provided. * @param {Scheduler} [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread. */ var observableFrom = Observable.from = function (iterable, mapFn, thisArg, scheduler) { if (iterable == null) { throw new Error('iterable cannot be null.') } if (mapFn && !isFunction(mapFn)) { throw new Error('mapFn when provided must be a function'); } if (mapFn) { var mapper = bindCallback(mapFn, thisArg, 2); } isScheduler(scheduler) || (scheduler = currentThreadScheduler); return new FromObservable(iterable, mapper, scheduler); } var FromArrayObservable = (function(__super__) { inherits(FromArrayObservable, __super__); function FromArrayObservable(args, scheduler) { this.args = args; this.scheduler = scheduler; __super__.call(this); } FromArrayObservable.prototype.subscribeCore = function (observer) { var sink = new FromArraySink(observer, this); return sink.run(); }; return FromArrayObservable; }(ObservableBase)); function FromArraySink(observer, parent) { this.observer = observer; this.parent = parent; } FromArraySink.prototype.run = function () { var observer = this.observer, args = this.parent.args, len = args.length; function loopRecursive(i, recurse) { if (i < len) { observer.onNext(args[i]); recurse(i + 1); } else { observer.onCompleted(); } } return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive); }; /** * Converts an array to an observable sequence, using an optional scheduler to enumerate the array. * @deprecated use Observable.from or Observable.of * @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on. * @returns {Observable} The observable sequence whose elements are pulled from the given enumerable sequence. */ var observableFromArray = Observable.fromArray = function (array, scheduler) { isScheduler(scheduler) || (scheduler = currentThreadScheduler); return new FromArrayObservable(array, scheduler) }; /** * Generates an observable sequence by running a state-driven loop producing the sequence's elements, using the specified scheduler to send out observer messages. * * @example * var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; }); * var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; }, Rx.Scheduler.timeout); * @param {Mixed} initialState Initial state. * @param {Function} condition Condition to terminate generation (upon returning false). * @param {Function} iterate Iteration step function. * @param {Function} resultSelector Selector function for results produced in the sequence. * @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not provided, defaults to Scheduler.currentThread. * @returns {Observable} The generated sequence. */ Observable.generate = function (initialState, condition, iterate, resultSelector, scheduler) { isScheduler(scheduler) || (scheduler = currentThreadScheduler); return new AnonymousObservable(function (o) { var first = true; return scheduler.scheduleRecursiveWithState(initialState, function (state, self) { var hasResult, result; try { if (first) { first = false; } else { state = iterate(state); } hasResult = condition(state); hasResult && (result = resultSelector(state)); } catch (e) { return o.onError(e); } if (hasResult) { o.onNext(result); self(state); } else { o.onCompleted(); } }); }); }; var NeverObservable = (function(__super__) { inherits(NeverObservable, __super__); function NeverObservable() { __super__.call(this); } NeverObservable.prototype.subscribeCore = function (observer) { return disposableEmpty; }; return NeverObservable; }(ObservableBase)); var NEVER_OBSERVABLE = new NeverObservable(); /** * Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins). * @returns {Observable} An observable sequence whose observers will never get called. */ var observableNever = Observable.never = function () { return NEVER_OBSERVABLE; }; function observableOf (scheduler, array) { isScheduler(scheduler) || (scheduler = currentThreadScheduler); return new FromArrayObservable(array, scheduler); } /** * This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments. * @returns {Observable} The observable sequence whose elements are pulled from the given arguments. */ Observable.of = function () { var len = arguments.length, args = new Array(len); for(var i = 0; i < len; i++) { args[i] = arguments[i]; } return new FromArrayObservable(args, currentThreadScheduler); }; /** * This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments. * @param {Scheduler} scheduler A scheduler to use for scheduling the arguments. * @returns {Observable} The observable sequence whose elements are pulled from the given arguments. */ Observable.ofWithScheduler = function (scheduler) { var len = arguments.length, args = new Array(len - 1); for(var i = 1; i < len; i++) { args[i - 1] = arguments[i]; } return new FromArrayObservable(args, scheduler); }; var PairsObservable = (function(__super__) { inherits(PairsObservable, __super__); function PairsObservable(obj, scheduler) { this.obj = obj; this.keys = Object.keys(obj); this.scheduler = scheduler; __super__.call(this); } PairsObservable.prototype.subscribeCore = function (observer) { var sink = new PairsSink(observer, this); return sink.run(); }; return PairsObservable; }(ObservableBase)); function PairsSink(observer, parent) { this.observer = observer; this.parent = parent; } PairsSink.prototype.run = function () { var observer = this.observer, obj = this.parent.obj, keys = this.parent.keys, len = keys.length; function loopRecursive(i, recurse) { if (i < len) { var key = keys[i]; observer.onNext([key, obj[key]]); recurse(i + 1); } else { observer.onCompleted(); } } return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive); }; /** * Convert an object into an observable sequence of [key, value] pairs. * @param {Object} obj The object to inspect. * @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on. * @returns {Observable} An observable sequence of [key, value] pairs from the object. */ Observable.pairs = function (obj, scheduler) { scheduler || (scheduler = currentThreadScheduler); return new PairsObservable(obj, scheduler); }; var RangeObservable = (function(__super__) { inherits(RangeObservable, __super__); function RangeObservable(start, count, scheduler) { this.start = start; this.rangeCount = count; this.scheduler = scheduler; __super__.call(this); } RangeObservable.prototype.subscribeCore = function (observer) { var sink = new RangeSink(observer, this); return sink.run(); }; return RangeObservable; }(ObservableBase)); var RangeSink = (function () { function RangeSink(observer, parent) { this.observer = observer; this.parent = parent; } RangeSink.prototype.run = function () { var start = this.parent.start, count = this.parent.rangeCount, observer = this.observer; function loopRecursive(i, recurse) { if (i < count) { observer.onNext(start + i); recurse(i + 1); } else { observer.onCompleted(); } } return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive); }; return RangeSink; }()); /** * Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to send out observer messages. * @param {Number} start The value of the first integer in the sequence. * @param {Number} count The number of sequential integers to generate. * @param {Scheduler} [scheduler] Scheduler to run the generator loop on. If not specified, defaults to Scheduler.currentThread. * @returns {Observable} An observable sequence that contains a range of sequential integral numbers. */ Observable.range = function (start, count, scheduler) { isScheduler(scheduler) || (scheduler = currentThreadScheduler); return new RangeObservable(start, count, scheduler); }; var RepeatObservable = (function(__super__) { inherits(RepeatObservable, __super__); function RepeatObservable(value, repeatCount, scheduler) { this.value = value; this.repeatCount = repeatCount == null ? -1 : repeatCount; this.scheduler = scheduler; __super__.call(this); } RepeatObservable.prototype.subscribeCore = function (observer) { var sink = new RepeatSink(observer, this); return sink.run(); }; return RepeatObservable; }(ObservableBase)); function RepeatSink(observer, parent) { this.observer = observer; this.parent = parent; } RepeatSink.prototype.run = function () { var observer = this.observer, value = this.parent.value; function loopRecursive(i, recurse) { if (i === -1 || i > 0) { observer.onNext(value); i > 0 && i--; } if (i === 0) { return observer.onCompleted(); } recurse(i); } return this.parent.scheduler.scheduleRecursiveWithState(this.parent.repeatCount, loopRecursive); }; /** * Generates an observable sequence that repeats the given element the specified number of times, using the specified scheduler to send out observer messages. * @param {Mixed} value Element to repeat. * @param {Number} repeatCount [Optiona] Number of times to repeat the element. If not specified, repeats indefinitely. * @param {Scheduler} scheduler Scheduler to run the producer loop on. If not specified, defaults to Scheduler.immediate. * @returns {Observable} An observable sequence that repeats the given element the specified number of times. */ Observable.repeat = function (value, repeatCount, scheduler) { isScheduler(scheduler) || (scheduler = currentThreadScheduler); return new RepeatObservable(value, repeatCount, scheduler); }; var JustObservable = (function(__super__) { inherits(JustObservable, __super__); function JustObservable(value, scheduler) { this.value = value; this.scheduler = scheduler; __super__.call(this); } JustObservable.prototype.subscribeCore = function (observer) { var sink = new JustSink(observer, this.value, this.scheduler); return sink.run(); }; function JustSink(observer, value, scheduler) { this.observer = observer; this.value = value; this.scheduler = scheduler; } function scheduleItem(s, state) { var value = state[0], observer = state[1]; observer.onNext(value); observer.onCompleted(); return disposableEmpty; } JustSink.prototype.run = function () { var state = [this.value, this.observer]; return this.scheduler === immediateScheduler ? scheduleItem(null, state) : this.scheduler.scheduleWithState(state, scheduleItem); }; return JustObservable; }(ObservableBase)); /** * Returns an observable sequence that contains a single element, using the specified scheduler to send out observer messages. * There is an alias called 'just' or browsers <IE9. * @param {Mixed} value Single element in the resulting observable sequence. * @param {Scheduler} scheduler Scheduler to send the single element on. If not specified, defaults to Scheduler.immediate. * @returns {Observable} An observable sequence containing the single specified element. */ var observableReturn = Observable['return'] = Observable.just = function (value, scheduler) { isScheduler(scheduler) || (scheduler = immediateScheduler); return new JustObservable(value, scheduler); }; var ThrowObservable = (function(__super__) { inherits(ThrowObservable, __super__); function ThrowObservable(error, scheduler) { this.error = error; this.scheduler = scheduler; __super__.call(this); } ThrowObservable.prototype.subscribeCore = function (o) { var sink = new ThrowSink(o, this); return sink.run(); }; function ThrowSink(o, p) { this.o = o; this.p = p; } function scheduleItem(s, state) { var e = state[0], o = state[1]; o.onError(e); } ThrowSink.prototype.run = function () { return this.p.scheduler.scheduleWithState([this.p.error, this.o], scheduleItem); }; return ThrowObservable; }(ObservableBase)); /** * Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single onError message. * There is an alias to this method called 'throwError' for browsers <IE9. * @param {Mixed} error An object used for the sequence's termination. * @param {Scheduler} scheduler Scheduler to send the exceptional termination call on. If not specified, defaults to Scheduler.immediate. * @returns {Observable} The observable sequence that terminates exceptionally with the specified exception object. */ var observableThrow = Observable['throw'] = function (error, scheduler) { isScheduler(scheduler) || (scheduler = immediateScheduler); return new ThrowObservable(error, scheduler); }; /** * Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime. * @param {Function} resourceFactory Factory function to obtain a resource object. * @param {Function} observableFactory Factory function to obtain an observable sequence that depends on the obtained resource. * @returns {Observable} An observable sequence whose lifetime controls the lifetime of the dependent resource object. */ Observable.using = function (resourceFactory, observableFactory) { return new AnonymousObservable(function (o) { var disposable = disposableEmpty; var resource = tryCatch(resourceFactory)(); if (resource === errorObj) { return new CompositeDisposable(observableThrow(resource.e).subscribe(o), disposable); } resource && (disposable = resource); var source = tryCatch(observableFactory)(resource); if (source === errorObj) { return new CompositeDisposable(observableThrow(source.e).subscribe(o), disposable); } return new CompositeDisposable(source.subscribe(o), disposable); }); }; /** * Propagates the observable sequence or Promise that reacts first. * @param {Observable} rightSource Second observable sequence or Promise. * @returns {Observable} {Observable} An observable sequence that surfaces either of the given sequences, whichever reacted first. */ observableProto.amb = function (rightSource) { var leftSource = this; return new AnonymousObservable(function (observer) { var choice, leftChoice = 'L', rightChoice = 'R', leftSubscription = new SingleAssignmentDisposable(), rightSubscription = new SingleAssignmentDisposable(); isPromise(rightSource) && (rightSource = observableFromPromise(rightSource)); function choiceL() { if (!choice) { choice = leftChoice; rightSubscription.dispose(); } } function choiceR() { if (!choice) { choice = rightChoice; leftSubscription.dispose(); } } var leftSubscribe = observerCreate( function (left) { choiceL(); choice === leftChoice && observer.onNext(left); }, function (e) { choiceL(); choice === leftChoice && observer.onError(e); }, function () { choiceL(); choice === leftChoice && observer.onCompleted(); } ); var rightSubscribe = observerCreate( function (right) { choiceR(); choice === rightChoice && observer.onNext(right); }, function (e) { choiceR(); choice === rightChoice && observer.onError(e); }, function () { choiceR(); choice === rightChoice && observer.onCompleted(); } ); leftSubscription.setDisposable(leftSource.subscribe(leftSubscribe)); rightSubscription.setDisposable(rightSource.subscribe(rightSubscribe)); return new CompositeDisposable(leftSubscription, rightSubscription); }); }; function amb(p, c) { return p.amb(c); } /** * Propagates the observable sequence or Promise that reacts first. * @returns {Observable} An observable sequence that surfaces any of the given sequences, whichever reacted first. */ Observable.amb = function () { var acc = observableNever(), items; if (Array.isArray(arguments[0])) { items = arguments[0]; } else { var len = arguments.length; items = new Array(items); for(var i = 0; i < len; i++) { items[i] = arguments[i]; } } for (var i = 0, len = items.length; i < len; i++) { acc = amb(acc, items[i]); } return acc; }; var CatchObserver = (function(__super__) { inherits(CatchObserver, __super__); function CatchObserver(o, s, fn) { this._o = o; this._s = s; this._fn = fn; __super__.call(this); } CatchObserver.prototype.next = function (x) { this._o.onNext(x); }; CatchObserver.prototype.completed = function () { return this._o.onCompleted(); }; CatchObserver.prototype.error = function (e) { var result = tryCatch(this._fn)(e); if (result === errorObj) { return this._o.onError(result.e); } isPromise(result) && (result = observableFromPromise(result)); var d = new SingleAssignmentDisposable(); this._s.setDisposable(d); d.setDisposable(result.subscribe(this._o)); }; return CatchObserver; }(AbstractObserver)); function observableCatchHandler(source, handler) { return new AnonymousObservable(function (o) { var d1 = new SingleAssignmentDisposable(), subscription = new SerialDisposable(); subscription.setDisposable(d1); d1.setDisposable(source.subscribe(new CatchObserver(o, subscription, handler))); return subscription; }, source); } /** * Continues an observable sequence that is terminated by an exception with the next observable sequence. * @param {Mixed} handlerOrSecond Exception handler function that returns an observable sequence given the error that occurred in the first sequence, or a second observable sequence used to produce results when an error occurred in the first sequence. * @returns {Observable} An observable sequence containing the first sequence's elements, followed by the elements of the handler sequence in case an exception occurred. */ observableProto['catch'] = function (handlerOrSecond) { return isFunction(handlerOrSecond) ? observableCatchHandler(this, handlerOrSecond) : observableCatch([this, handlerOrSecond]); }; /** * Continues an observable sequence that is terminated by an exception with the next observable sequence. * @param {Array | Arguments} args Arguments or an array to use as the next sequence if an error occurs. * @returns {Observable} An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully. */ var observableCatch = Observable['catch'] = function () { var items; if (Array.isArray(arguments[0])) { items = arguments[0]; } else { var len = arguments.length; items = new Array(len); for(var i = 0; i < len; i++) { items[i] = arguments[i]; } } return enumerableOf(items).catchError(); }; /** * Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element. * This can be in the form of an argument list of observables or an array. * * @example * 1 - obs = observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; }); * 2 - obs = observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; }); * @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function. */ observableProto.combineLatest = function () { var len = arguments.length, args = new Array(len); for(var i = 0; i < len; i++) { args[i] = arguments[i]; } if (Array.isArray(args[0])) { args[0].unshift(this); } else { args.unshift(this); } return combineLatest.apply(this, args); }; function falseFactory() { return false; } function argumentsToArray() { var len = arguments.length, args = new Array(len); for(var i = 0; i < len; i++) { args[i] = arguments[i]; } return args; } /** * Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element. * * @example * 1 - obs = Rx.Observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; }); * 2 - obs = Rx.Observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; }); * @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function. */ var combineLatest = Observable.combineLatest = function () { var len = arguments.length, args = new Array(len); for(var i = 0; i < len; i++) { args[i] = arguments[i]; } var resultSelector = isFunction(args[len - 1]) ? args.pop() : argumentsToArray; Array.isArray(args[0]) && (args = args[0]); return new AnonymousObservable(function (o) { var n = args.length, hasValue = arrayInitialize(n, falseFactory), hasValueAll = false, isDone = arrayInitialize(n, falseFactory), values = new Array(n); function next(i) { hasValue[i] = true; if (hasValueAll || (hasValueAll = hasValue.every(identity))) { try { var res = resultSelector.apply(null, values); } catch (e) { return o.onError(e); } o.onNext(res); } else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) { o.onCompleted(); } } function done (i) { isDone[i] = true; isDone.every(identity) && o.onCompleted(); } var subscriptions = new Array(n); for (var idx = 0; idx < n; idx++) { (function (i) { var source = args[i], sad = new SingleAssignmentDisposable(); isPromise(source) && (source = observableFromPromise(source)); sad.setDisposable(source.subscribe(function (x) { values[i] = x; next(i); }, function(e) { o.onError(e); }, function () { done(i); } )); subscriptions[i] = sad; }(idx)); } return new CompositeDisposable(subscriptions); }, this); }; /** * Concatenates all the observable sequences. This takes in either an array or variable arguments to concatenate. * @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order. */ observableProto.concat = function () { for(var args = [], i = 0, len = arguments.length; i < len; i++) { args.push(arguments[i]); } args.unshift(this); return observableConcat.apply(null, args); }; var ConcatObservable = (function(__super__) { inherits(ConcatObservable, __super__); function ConcatObservable(sources) { this.sources = sources; __super__.call(this); } ConcatObservable.prototype.subscribeCore = function(o) { var sink = new ConcatSink(this.sources, o); return sink.run(); }; function ConcatSink(sources, o) { this.sources = sources; this.o = o; } ConcatSink.prototype.run = function () { var isDisposed, subscription = new SerialDisposable(), sources = this.sources, length = sources.length, o = this.o; var cancelable = immediateScheduler.scheduleRecursiveWithState(0, function (i, self) { if (isDisposed) { return; } if (i === length) { return o.onCompleted(); } // Check if promise var currentValue = sources[i]; isPromise(currentValue) && (currentValue = observableFromPromise(currentValue)); var d = new SingleAssignmentDisposable(); subscription.setDisposable(d); d.setDisposable(currentValue.subscribe( function (x) { o.onNext(x); }, function (e) { o.onError(e); }, function () { self(i + 1); } )); }); return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { isDisposed = true; })); }; return ConcatObservable; }(ObservableBase)); /** * Concatenates all the observable sequences. * @param {Array | Arguments} args Arguments or an array to concat to the observable sequence. * @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order. */ var observableConcat = Observable.concat = function () { var args; if (Array.isArray(arguments[0])) { args = arguments[0]; } else { args = new Array(arguments.length); for(var i = 0, len = arguments.length; i < len; i++) { args[i] = arguments[i]; } } return new ConcatObservable(args); }; /** * Concatenates an observable sequence of observable sequences. * @returns {Observable} An observable sequence that contains the elements of each observed inner sequence, in sequential order. */ observableProto.concatAll = function () { return this.merge(1); }; var MergeObservable = (function (__super__) { inherits(MergeObservable, __super__); function MergeObservable(source, maxConcurrent) { this.source = source; this.maxConcurrent = maxConcurrent; __super__.call(this); } MergeObservable.prototype.subscribeCore = function(observer) { var g = new CompositeDisposable(); g.add(this.source.subscribe(new MergeObserver(observer, this.maxConcurrent, g))); return g; }; return MergeObservable; }(ObservableBase)); var MergeObserver = (function () { function MergeObserver(o, max, g) { this.o = o; this.max = max; this.g = g; this.done = false; this.q = []; this.activeCount = 0; this.isStopped = false; } MergeObserver.prototype.handleSubscribe = function (xs) { var sad = new SingleAssignmentDisposable(); this.g.add(sad); isPromise(xs) && (xs = observableFromPromise(xs)); sad.setDisposable(xs.subscribe(new InnerObserver(this, sad))); }; MergeObserver.prototype.onNext = function (innerSource) { if (this.isStopped) { return; } if(this.activeCount < this.max) { this.activeCount++; this.handleSubscribe(innerSource); } else { this.q.push(innerSource); } }; MergeObserver.prototype.onError = function (e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); } }; MergeObserver.prototype.onCompleted = function () { if (!this.isStopped) { this.isStopped = true; this.done = true; this.activeCount === 0 && this.o.onCompleted(); } }; MergeObserver.prototype.dispose = function() { this.isStopped = true; }; MergeObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); return true; } return false; }; function InnerObserver(parent, sad) { this.parent = parent; this.sad = sad; this.isStopped = false; } InnerObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.parent.o.onNext(x); } }; InnerObserver.prototype.onError = function (e) { if (!this.isStopped) { this.isStopped = true; this.parent.o.onError(e); } }; InnerObserver.prototype.onCompleted = function () { if(!this.isStopped) { this.isStopped = true; var parent = this.parent; parent.g.remove(this.sad); if (parent.q.length > 0) { parent.handleSubscribe(parent.q.shift()); } else { parent.activeCount--; parent.done && parent.activeCount === 0 && parent.o.onCompleted(); } } }; InnerObserver.prototype.dispose = function() { this.isStopped = true; }; InnerObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.parent.o.onError(e); return true; } return false; }; return MergeObserver; }()); /** * Merges an observable sequence of observable sequences into an observable sequence, limiting the number of concurrent subscriptions to inner sequences. * Or merges two observable sequences into a single observable sequence. * * @example * 1 - merged = sources.merge(1); * 2 - merged = source.merge(otherSource); * @param {Mixed} [maxConcurrentOrOther] Maximum number of inner observable sequences being subscribed to concurrently or the second observable sequence. * @returns {Observable} The observable sequence that merges the elements of the inner sequences. */ observableProto.merge = function (maxConcurrentOrOther) { return typeof maxConcurrentOrOther !== 'number' ? observableMerge(this, maxConcurrentOrOther) : new MergeObservable(this, maxConcurrentOrOther); }; /** * Merges all the observable sequences into a single observable sequence. * The scheduler is optional and if not specified, the immediate scheduler is used. * @returns {Observable} The observable sequence that merges the elements of the observable sequences. */ var observableMerge = Observable.merge = function () { var scheduler, sources = [], i, len = arguments.length; if (!arguments[0]) { scheduler = immediateScheduler; for(i = 1; i < len; i++) { sources.push(arguments[i]); } } else if (isScheduler(arguments[0])) { scheduler = arguments[0]; for(i = 1; i < len; i++) { sources.push(arguments[i]); } } else { scheduler = immediateScheduler; for(i = 0; i < len; i++) { sources.push(arguments[i]); } } if (Array.isArray(sources[0])) { sources = sources[0]; } return observableOf(scheduler, sources).mergeAll(); }; var MergeAllObservable = (function (__super__) { inherits(MergeAllObservable, __super__); function MergeAllObservable(source) { this.source = source; __super__.call(this); } MergeAllObservable.prototype.subscribeCore = function (observer) { var g = new CompositeDisposable(), m = new SingleAssignmentDisposable(); g.add(m); m.setDisposable(this.source.subscribe(new MergeAllObserver(observer, g))); return g; }; function MergeAllObserver(o, g) { this.o = o; this.g = g; this.isStopped = false; this.done = false; } MergeAllObserver.prototype.onNext = function(innerSource) { if(this.isStopped) { return; } var sad = new SingleAssignmentDisposable(); this.g.add(sad); isPromise(innerSource) && (innerSource = observableFromPromise(innerSource)); sad.setDisposable(innerSource.subscribe(new InnerObserver(this, sad))); }; MergeAllObserver.prototype.onError = function (e) { if(!this.isStopped) { this.isStopped = true; this.o.onError(e); } }; MergeAllObserver.prototype.onCompleted = function () { if(!this.isStopped) { this.isStopped = true; this.done = true; this.g.length === 1 && this.o.onCompleted(); } }; MergeAllObserver.prototype.dispose = function() { this.isStopped = true; }; MergeAllObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); return true; } return false; }; function InnerObserver(parent, sad) { this.parent = parent; this.sad = sad; this.isStopped = false; } InnerObserver.prototype.onNext = function (x) { if (!this.isStopped) { this.parent.o.onNext(x); } }; InnerObserver.prototype.onError = function (e) { if(!this.isStopped) { this.isStopped = true; this.parent.o.onError(e); } }; InnerObserver.prototype.onCompleted = function () { if(!this.isStopped) { var parent = this.parent; this.isStopped = true; parent.g.remove(this.sad); parent.done && parent.g.length === 1 && parent.o.onCompleted(); } }; InnerObserver.prototype.dispose = function() { this.isStopped = true; }; InnerObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.parent.o.onError(e); return true; } return false; }; return MergeAllObservable; }(ObservableBase)); /** * Merges an observable sequence of observable sequences into an observable sequence. * @returns {Observable} The observable sequence that merges the elements of the inner sequences. */ observableProto.mergeAll = function () { return new MergeAllObservable(this); }; var CompositeError = Rx.CompositeError = function(errors) { this.name = "NotImplementedError"; this.innerErrors = errors; this.message = 'This contains multiple errors. Check the innerErrors'; Error.call(this); } CompositeError.prototype = Error.prototype; /** * Flattens an Observable that emits Observables into one Observable, in a way that allows an Observer to * receive all successfully emitted items from all of the source Observables without being interrupted by * an error notification from one of them. * * This behaves like Observable.prototype.mergeAll except that if any of the merged Observables notify of an * error via the Observer's onError, mergeDelayError will refrain from propagating that * error notification until all of the merged Observables have finished emitting items. * @param {Array | Arguments} args Arguments or an array to merge. * @returns {Observable} an Observable that emits all of the items emitted by the Observables emitted by the Observable */ Observable.mergeDelayError = function() { var args; if (Array.isArray(arguments[0])) { args = arguments[0]; } else { var len = arguments.length; args = new Array(len); for(var i = 0; i < len; i++) { args[i] = arguments[i]; } } var source = observableOf(null, args); return new AnonymousObservable(function (o) { var group = new CompositeDisposable(), m = new SingleAssignmentDisposable(), isStopped = false, errors = []; function setCompletion() { if (errors.length === 0) { o.onCompleted(); } else if (errors.length === 1) { o.onError(errors[0]); } else { o.onError(new CompositeError(errors)); } } group.add(m); m.setDisposable(source.subscribe( function (innerSource) { var innerSubscription = new SingleAssignmentDisposable(); group.add(innerSubscription); // Check for promises support isPromise(innerSource) && (innerSource = observableFromPromise(innerSource)); innerSubscription.setDisposable(innerSource.subscribe( function (x) { o.onNext(x); }, function (e) { errors.push(e); group.remove(innerSubscription); isStopped && group.length === 1 && setCompletion(); }, function () { group.remove(innerSubscription); isStopped && group.length === 1 && setCompletion(); })); }, function (e) { errors.push(e); isStopped = true; group.length === 1 && setCompletion(); }, function () { isStopped = true; group.length === 1 && setCompletion(); })); return group; }); }; /** * Continues an observable sequence that is terminated normally or by an exception with the next observable sequence. * @param {Observable} second Second observable sequence used to produce results after the first sequence terminates. * @returns {Observable} An observable sequence that concatenates the first and second sequence, even if the first sequence terminates exceptionally. */ observableProto.onErrorResumeNext = function (second) { if (!second) { throw new Error('Second observable is required'); } return onErrorResumeNext([this, second]); }; /** * Continues an observable sequence that is terminated normally or by an exception with the next observable sequence. * * @example * 1 - res = Rx.Observable.onErrorResumeNext(xs, ys, zs); * 1 - res = Rx.Observable.onErrorResumeNext([xs, ys, zs]); * @returns {Observable} An observable sequence that concatenates the source sequences, even if a sequence terminates exceptionally. */ var onErrorResumeNext = Observable.onErrorResumeNext = function () { var sources = []; if (Array.isArray(arguments[0])) { sources = arguments[0]; } else { for(var i = 0, len = arguments.length; i < len; i++) { sources.push(arguments[i]); } } return new AnonymousObservable(function (observer) { var pos = 0, subscription = new SerialDisposable(), cancelable = immediateScheduler.scheduleRecursive(function (self) { var current, d; if (pos < sources.length) { current = sources[pos++]; isPromise(current) && (current = observableFromPromise(current)); d = new SingleAssignmentDisposable(); subscription.setDisposable(d); d.setDisposable(current.subscribe(observer.onNext.bind(observer), self, self)); } else { observer.onCompleted(); } }); return new CompositeDisposable(subscription, cancelable); }); }; /** * Returns the values from the source observable sequence only after the other observable sequence produces a value. * @param {Observable | Promise} other The observable sequence or Promise that triggers propagation of elements of the source sequence. * @returns {Observable} An observable sequence containing the elements of the source sequence starting from the point the other sequence triggered propagation. */ observableProto.skipUntil = function (other) { var source = this; return new AnonymousObservable(function (o) { var isOpen = false; var disposables = new CompositeDisposable(source.subscribe(function (left) { isOpen && o.onNext(left); }, function (e) { o.onError(e); }, function () { isOpen && o.onCompleted(); })); isPromise(other) && (other = observableFromPromise(other)); var rightSubscription = new SingleAssignmentDisposable(); disposables.add(rightSubscription); rightSubscription.setDisposable(other.subscribe(function () { isOpen = true; rightSubscription.dispose(); }, function (e) { o.onError(e); }, function () { rightSubscription.dispose(); })); return disposables; }, source); }; var SwitchObservable = (function(__super__) { inherits(SwitchObservable, __super__); function SwitchObservable(source) { this.source = source; __super__.call(this); } SwitchObservable.prototype.subscribeCore = function (o) { var inner = new SerialDisposable(), s = this.source.subscribe(new SwitchObserver(o, inner)); return new CompositeDisposable(s, inner); }; function SwitchObserver(o, inner) { this.o = o; this.inner = inner; this.stopped = false; this.latest = 0; this.hasLatest = false; this.isStopped = false; } SwitchObserver.prototype.onNext = function (innerSource) { if (this.isStopped) { return; } var d = new SingleAssignmentDisposable(), id = ++this.latest; this.hasLatest = true; this.inner.setDisposable(d); isPromise(innerSource) && (innerSource = observableFromPromise(innerSource)); d.setDisposable(innerSource.subscribe(new InnerObserver(this, id))); }; SwitchObserver.prototype.onError = function (e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); } }; SwitchObserver.prototype.onCompleted = function () { if (!this.isStopped) { this.isStopped = true; this.stopped = true; !this.hasLatest && this.o.onCompleted(); } }; SwitchObserver.prototype.dispose = function () { this.isStopped = true; }; SwitchObserver.prototype.fail = function (e) { if(!this.isStopped) { this.isStopped = true; this.o.onError(e); return true; } return false; }; function InnerObserver(parent, id) { this.parent = parent; this.id = id; this.isStopped = false; } InnerObserver.prototype.onNext = function (x) { if (this.isStopped) { return; } this.parent.latest === this.id && this.parent.o.onNext(x); }; InnerObserver.prototype.onError = function (e) { if (!this.isStopped) { this.isStopped = true; this.parent.latest === this.id && this.parent.o.onError(e); } }; InnerObserver.prototype.onCompleted = function () { if (!this.isStopped) { this.isStopped = true; if (this.parent.latest === this.id) { this.parent.hasLatest = false; this.parent.isStopped && this.parent.o.onCompleted(); } } }; InnerObserver.prototype.dispose = function () { this.isStopped = true; } InnerObserver.prototype.fail = function (e) { if(!this.isStopped) { this.isStopped = true; this.parent.o.onError(e); return true; } return false; }; return SwitchObservable; }(ObservableBase)); /** * Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence. * @returns {Observable} The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received. */ observableProto['switch'] = observableProto.switchLatest = function () { return new SwitchObservable(this); }; var TakeUntilObservable = (function(__super__) { inherits(TakeUntilObservable, __super__); function TakeUntilObservable(source, other) { this.source = source; this.other = isPromise(other) ? observableFromPromise(other) : other; __super__.call(this); } TakeUntilObservable.prototype.subscribeCore = function(o) { return new CompositeDisposable( this.source.subscribe(o), this.other.subscribe(new InnerObserver(o)) ); }; function InnerObserver(o) { this.o = o; this.isStopped = false; } InnerObserver.prototype.onNext = function (x) { if (this.isStopped) { return; } this.o.onCompleted(); }; InnerObserver.prototype.onError = function (err) { if (!this.isStopped) { this.isStopped = true; this.o.onError(err); } }; InnerObserver.prototype.onCompleted = function () { !this.isStopped && (this.isStopped = true); }; InnerObserver.prototype.dispose = function() { this.isStopped = true; }; InnerObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); return true; } return false; }; return TakeUntilObservable; }(ObservableBase)); /** * Returns the values from the source observable sequence until the other observable sequence produces a value. * @param {Observable | Promise} other Observable sequence or Promise that terminates propagation of elements of the source sequence. * @returns {Observable} An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation. */ observableProto.takeUntil = function (other) { return new TakeUntilObservable(this, other); }; function falseFactory() { return false; } /** * Merges the specified observable sequences into one observable sequence by using the selector function only when the (first) source observable sequence produces an element. * @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function. */ observableProto.withLatestFrom = function () { var len = arguments.length, args = new Array(len) for(var i = 0; i < len; i++) { args[i] = arguments[i]; } var resultSelector = args.pop(), source = this; Array.isArray(args[0]) && (args = args[0]); return new AnonymousObservable(function (observer) { var n = args.length, hasValue = arrayInitialize(n, falseFactory), hasValueAll = false, values = new Array(n); var subscriptions = new Array(n + 1); for (var idx = 0; idx < n; idx++) { (function (i) { var other = args[i], sad = new SingleAssignmentDisposable(); isPromise(other) && (other = observableFromPromise(other)); sad.setDisposable(other.subscribe(function (x) { values[i] = x; hasValue[i] = true; hasValueAll = hasValue.every(identity); }, function (e) { observer.onError(e); }, noop)); subscriptions[i] = sad; }(idx)); } var sad = new SingleAssignmentDisposable(); sad.setDisposable(source.subscribe(function (x) { var allValues = [x].concat(values); if (!hasValueAll) { return; } var res = tryCatch(resultSelector).apply(null, allValues); if (res === errorObj) { return observer.onError(res.e); } observer.onNext(res); }, function (e) { observer.onError(e); }, function () { observer.onCompleted(); })); subscriptions[n] = sad; return new CompositeDisposable(subscriptions); }, this); }; function falseFactory() { return false; } function emptyArrayFactory() { return []; } function argumentsToArray() { var len = arguments.length, args = new Array(len); for(var i = 0; i < len; i++) { args[i] = arguments[i]; } return args; } /** * Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index. * The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the args. * @returns {Observable} An observable sequence containing the result of combining elements of the args using the specified result selector function. */ observableProto.zip = function () { if (arguments.length === 0) { throw new Error('invalid arguments'); } var len = arguments.length, args = new Array(len); for(var i = 0; i < len; i++) { args[i] = arguments[i]; } var resultSelector = isFunction(args[len - 1]) ? args.pop() : argumentsToArray; Array.isArray(args[0]) && (args = args[0]); var parent = this; args.unshift(parent); return new AnonymousObservable(function (o) { var n = args.length, queues = arrayInitialize(n, emptyArrayFactory), isDone = arrayInitialize(n, falseFactory); var subscriptions = new Array(n); for (var idx = 0; idx < n; idx++) { (function (i) { var source = args[i], sad = new SingleAssignmentDisposable(); isPromise(source) && (source = observableFromPromise(source)); sad.setDisposable(source.subscribe(function (x) { queues[i].push(x); if (queues.every(function (x) { return x.length > 0; })) { var queuedValues = queues.map(function (x) { return x.shift(); }), res = tryCatch(resultSelector).apply(parent, queuedValues); if (res === errorObj) { return o.onError(res.e); } o.onNext(res); } else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) { o.onCompleted(); } }, function (e) { o.onError(e); }, function () { isDone[i] = true; isDone.every(identity) && o.onCompleted(); })); subscriptions[i] = sad; })(idx); } return new CompositeDisposable(subscriptions); }, parent); }; /** * Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index. * @param arguments Observable sources. * @param {Function} resultSelector Function to invoke for each series of elements at corresponding indexes in the sources. * @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function. */ Observable.zip = function () { var len = arguments.length, args = new Array(len); for(var i = 0; i < len; i++) { args[i] = arguments[i]; } if (Array.isArray(args[0])) { args = isFunction(args[1]) ? args[0].concat(args[1]) : args[0]; } var first = args.shift(); return first.zip.apply(first, args); }; function falseFactory() { return false; } function emptyArrayFactory() { return []; } function argumentsToArray() { var len = arguments.length, args = new Array(len); for(var i = 0; i < len; i++) { args[i] = arguments[i]; } return args; } /** * Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index. * The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the args. * @returns {Observable} An observable sequence containing the result of combining elements of the args using the specified result selector function. */ observableProto.zipIterable = function () { if (arguments.length === 0) { throw new Error('invalid arguments'); } var len = arguments.length, args = new Array(len); for(var i = 0; i < len; i++) { args[i] = arguments[i]; } var resultSelector = isFunction(args[len - 1]) ? args.pop() : argumentsToArray; var parent = this; args.unshift(parent); return new AnonymousObservable(function (o) { var n = args.length, queues = arrayInitialize(n, emptyArrayFactory), isDone = arrayInitialize(n, falseFactory); var subscriptions = new Array(n); for (var idx = 0; idx < n; idx++) { (function (i) { var source = args[i], sad = new SingleAssignmentDisposable(); (isArrayLike(source) || isIterable(source)) && (source = observableFrom(source)); sad.setDisposable(source.subscribe(function (x) { queues[i].push(x); if (queues.every(function (x) { return x.length > 0; })) { var queuedValues = queues.map(function (x) { return x.shift(); }), res = tryCatch(resultSelector).apply(parent, queuedValues); if (res === errorObj) { return o.onError(res.e); } o.onNext(res); } else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) { o.onCompleted(); } }, function (e) { o.onError(e); }, function () { isDone[i] = true; isDone.every(identity) && o.onCompleted(); })); subscriptions[i] = sad; })(idx); } return new CompositeDisposable(subscriptions); }, parent); }; function asObservable(source) { return function subscribe(o) { return source.subscribe(o); }; } /** * Hides the identity of an observable sequence. * @returns {Observable} An observable sequence that hides the identity of the source sequence. */ observableProto.asObservable = function () { return new AnonymousObservable(asObservable(this), this); }; function toArray(x) { return x.toArray(); } function notEmpty(x) { return x.length > 0; } /** * Projects each element of an observable sequence into zero or more buffers which are produced based on element count information. * @param {Number} count Length of each buffer. * @param {Number} [skip] Number of elements to skip between creation of consecutive buffers. If not provided, defaults to the count. * @returns {Observable} An observable sequence of buffers. */ observableProto.bufferWithCount = function (count, skip) { typeof skip !== 'number' && (skip = count); return this.windowWithCount(count, skip) .flatMap(toArray) .filter(notEmpty); }; /** * Dematerializes the explicit notification values of an observable sequence as implicit notifications. * @returns {Observable} An observable sequence exhibiting the behavior corresponding to the source sequence's notification values. */ observableProto.dematerialize = function () { var source = this; return new AnonymousObservable(function (o) { return source.subscribe(function (x) { return x.accept(o); }, function(e) { o.onError(e); }, function () { o.onCompleted(); }); }, this); }; var DistinctUntilChangedObservable = (function(__super__) { inherits(DistinctUntilChangedObservable, __super__); function DistinctUntilChangedObservable(source, keyFn, comparer) { this.source = source; this.keyFn = keyFn; this.comparer = comparer; __super__.call(this); } DistinctUntilChangedObservable.prototype.subscribeCore = function (o) { return this.source.subscribe(new DistinctUntilChangedObserver(o, this.keyFn, this.comparer)); }; return DistinctUntilChangedObservable; }(ObservableBase)); var DistinctUntilChangedObserver = (function(__super__) { inherits(DistinctUntilChangedObserver, __super__); function DistinctUntilChangedObserver(o, keyFn, comparer) { this.o = o; this.keyFn = keyFn; this.comparer = comparer; this.hasCurrentKey = false; this.currentKey = null; __super__.call(this); } DistinctUntilChangedObserver.prototype.next = function (x) { var key = x, comparerEquals; if (isFunction(this.keyFn)) { key = tryCatch(this.keyFn)(x); if (key === errorObj) { return this.o.onError(key.e); } } if (this.hasCurrentKey) { comparerEquals = tryCatch(this.comparer)(this.currentKey, key); if (comparerEquals === errorObj) { return this.o.onError(comparerEquals.e); } } if (!this.hasCurrentKey || !comparerEquals) { this.hasCurrentKey = true; this.currentKey = key; this.o.onNext(x); } }; DistinctUntilChangedObserver.prototype.error = function(e) { this.o.onError(e); }; DistinctUntilChangedObserver.prototype.completed = function () { this.o.onCompleted(); }; return DistinctUntilChangedObserver; }(AbstractObserver)); /** * Returns an observable sequence that contains only distinct contiguous elements according to the keyFn and the comparer. * @param {Function} [keyFn] A function to compute the comparison key for each element. If not provided, it projects the value. * @param {Function} [comparer] Equality comparer for computed key values. If not provided, defaults to an equality comparer function. * @returns {Observable} An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence. */ observableProto.distinctUntilChanged = function (keyFn, comparer) { comparer || (comparer = defaultComparer); return new DistinctUntilChangedObservable(this, keyFn, comparer); }; var TapObservable = (function(__super__) { inherits(TapObservable,__super__); function TapObservable(source, observerOrOnNext, onError, onCompleted) { this.source = source; this._oN = observerOrOnNext; this._oE = onError; this._oC = onCompleted; __super__.call(this); } TapObservable.prototype.subscribeCore = function(o) { return this.source.subscribe(new InnerObserver(o, this)); }; function InnerObserver(o, p) { this.o = o; this.t = !p._oN || isFunction(p._oN) ? observerCreate(p._oN || noop, p._oE || noop, p._oC || noop) : p._oN; this.isStopped = false; } InnerObserver.prototype.onNext = function(x) { if (this.isStopped) { return; } var res = tryCatch(this.t.onNext).call(this.t, x); if (res === errorObj) { this.o.onError(res.e); } this.o.onNext(x); }; InnerObserver.prototype.onError = function(err) { if (!this.isStopped) { this.isStopped = true; var res = tryCatch(this.t.onError).call(this.t, err); if (res === errorObj) { return this.o.onError(res.e); } this.o.onError(err); } }; InnerObserver.prototype.onCompleted = function() { if (!this.isStopped) { this.isStopped = true; var res = tryCatch(this.t.onCompleted).call(this.t); if (res === errorObj) { return this.o.onError(res.e); } this.o.onCompleted(); } }; InnerObserver.prototype.dispose = function() { this.isStopped = true; }; InnerObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); return true; } return false; }; return TapObservable; }(ObservableBase)); /** * Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence. * This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline. * @param {Function | Observer} observerOrOnNext Action to invoke for each element in the observable sequence or an o. * @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function. * @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function. * @returns {Observable} The source sequence with the side-effecting behavior applied. */ observableProto['do'] = observableProto.tap = observableProto.doAction = function (observerOrOnNext, onError, onCompleted) { return new TapObservable(this, observerOrOnNext, onError, onCompleted); }; /** * Invokes an action for each element in the observable sequence. * This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline. * @param {Function} onNext Action to invoke for each element in the observable sequence. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} The source sequence with the side-effecting behavior applied. */ observableProto.doOnNext = observableProto.tapOnNext = function (onNext, thisArg) { return this.tap(typeof thisArg !== 'undefined' ? function (x) { onNext.call(thisArg, x); } : onNext); }; /** * Invokes an action upon exceptional termination of the observable sequence. * This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline. * @param {Function} onError Action to invoke upon exceptional termination of the observable sequence. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} The source sequence with the side-effecting behavior applied. */ observableProto.doOnError = observableProto.tapOnError = function (onError, thisArg) { return this.tap(noop, typeof thisArg !== 'undefined' ? function (e) { onError.call(thisArg, e); } : onError); }; /** * Invokes an action upon graceful termination of the observable sequence. * This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline. * @param {Function} onCompleted Action to invoke upon graceful termination of the observable sequence. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} The source sequence with the side-effecting behavior applied. */ observableProto.doOnCompleted = observableProto.tapOnCompleted = function (onCompleted, thisArg) { return this.tap(noop, null, typeof thisArg !== 'undefined' ? function () { onCompleted.call(thisArg); } : onCompleted); }; /** * Invokes a specified action after the source observable sequence terminates gracefully or exceptionally. * @param {Function} finallyAction Action to invoke after the source observable sequence terminates. * @returns {Observable} Source sequence with the action-invoking termination behavior applied. */ observableProto['finally'] = function (action) { var source = this; return new AnonymousObservable(function (observer) { var subscription = tryCatch(source.subscribe).call(source, observer); if (subscription === errorObj) { action(); return thrower(subscription.e); } return disposableCreate(function () { var r = tryCatch(subscription.dispose).call(subscription); action(); r === errorObj && thrower(r.e); }); }, this); }; var IgnoreElementsObservable = (function(__super__) { inherits(IgnoreElementsObservable, __super__); function IgnoreElementsObservable(source) { this.source = source; __super__.call(this); } IgnoreElementsObservable.prototype.subscribeCore = function (o) { return this.source.subscribe(new InnerObserver(o)); }; function InnerObserver(o) { this.o = o; this.isStopped = false; } InnerObserver.prototype.onNext = noop; InnerObserver.prototype.onError = function (err) { if(!this.isStopped) { this.isStopped = true; this.o.onError(err); } }; InnerObserver.prototype.onCompleted = function () { if(!this.isStopped) { this.isStopped = true; this.o.onCompleted(); } }; InnerObserver.prototype.dispose = function() { this.isStopped = true; }; InnerObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.observer.onError(e); return true; } return false; }; return IgnoreElementsObservable; }(ObservableBase)); /** * Ignores all elements in an observable sequence leaving only the termination messages. * @returns {Observable} An empty observable sequence that signals termination, successful or exceptional, of the source sequence. */ observableProto.ignoreElements = function () { return new IgnoreElementsObservable(this); }; /** * Materializes the implicit notifications of an observable sequence as explicit notification values. * @returns {Observable} An observable sequence containing the materialized notification values from the source sequence. */ observableProto.materialize = function () { var source = this; return new AnonymousObservable(function (observer) { return source.subscribe(function (value) { observer.onNext(notificationCreateOnNext(value)); }, function (e) { observer.onNext(notificationCreateOnError(e)); observer.onCompleted(); }, function () { observer.onNext(notificationCreateOnCompleted()); observer.onCompleted(); }); }, source); }; /** * Repeats the observable sequence a specified number of times. If the repeat count is not specified, the sequence repeats indefinitely. * @param {Number} [repeatCount] Number of times to repeat the sequence. If not provided, repeats the sequence indefinitely. * @returns {Observable} The observable sequence producing the elements of the given sequence repeatedly. */ observableProto.repeat = function (repeatCount) { return enumerableRepeat(this, repeatCount).concat(); }; /** * Repeats the source observable sequence the specified number of times or until it successfully terminates. If the retry count is not specified, it retries indefinitely. * Note if you encounter an error and want it to retry once, then you must use .retry(2); * * @example * var res = retried = retry.repeat(); * var res = retried = retry.repeat(2); * @param {Number} [retryCount] Number of times to retry the sequence. If not provided, retry the sequence indefinitely. * @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully. */ observableProto.retry = function (retryCount) { return enumerableRepeat(this, retryCount).catchError(); }; /** * Repeats the source observable sequence upon error each time the notifier emits or until it successfully terminates. * if the notifier completes, the observable sequence completes. * * @example * var timer = Observable.timer(500); * var source = observable.retryWhen(timer); * @param {Observable} [notifier] An observable that triggers the retries or completes the observable with onNext or onCompleted respectively. * @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully. */ observableProto.retryWhen = function (notifier) { return enumerableRepeat(this).catchErrorWhen(notifier); }; var ScanObservable = (function(__super__) { inherits(ScanObservable, __super__); function ScanObservable(source, accumulator, hasSeed, seed) { this.source = source; this.accumulator = accumulator; this.hasSeed = hasSeed; this.seed = seed; __super__.call(this); } ScanObservable.prototype.subscribeCore = function(o) { return this.source.subscribe(new InnerObserver(o,this)); }; return ScanObservable; }(ObservableBase)); function InnerObserver(o, parent) { this.o = o; this.accumulator = parent.accumulator; this.hasSeed = parent.hasSeed; this.seed = parent.seed; this.hasAccumulation = false; this.accumulation = null; this.hasValue = false; this.isStopped = false; } InnerObserver.prototype = { onNext: function (x) { if (this.isStopped) { return; } !this.hasValue && (this.hasValue = true); if (this.hasAccumulation) { this.accumulation = tryCatch(this.accumulator)(this.accumulation, x); } else { this.accumulation = this.hasSeed ? tryCatch(this.accumulator)(this.seed, x) : x; this.hasAccumulation = true; } if (this.accumulation === errorObj) { return this.o.onError(this.accumulation.e); } this.o.onNext(this.accumulation); }, onError: function (e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); } }, onCompleted: function () { if (!this.isStopped) { this.isStopped = true; !this.hasValue && this.hasSeed && this.o.onNext(this.seed); this.o.onCompleted(); } }, dispose: function() { this.isStopped = true; }, fail: function (e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); return true; } return false; } }; /** * Applies an accumulator function over an observable sequence and returns each intermediate result. The optional seed value is used as the initial accumulator value. * For aggregation behavior with no intermediate results, see Observable.aggregate. * @param {Mixed} [seed] The initial accumulator value. * @param {Function} accumulator An accumulator function to be invoked on each element. * @returns {Observable} An observable sequence containing the accumulated values. */ observableProto.scan = function () { var hasSeed = false, seed, accumulator = arguments[0]; if (arguments.length === 2) { hasSeed = true; seed = arguments[1]; } return new ScanObservable(this, accumulator, hasSeed, seed); }; /** * Bypasses a specified number of elements at the end of an observable sequence. * @description * This operator accumulates a queue with a length enough to store the first `count` elements. As more elements are * received, elements are taken from the front of the queue and produced on the result sequence. This causes elements to be delayed. * @param count Number of elements to bypass at the end of the source sequence. * @returns {Observable} An observable sequence containing the source sequence elements except for the bypassed ones at the end. */ observableProto.skipLast = function (count) { if (count < 0) { throw new ArgumentOutOfRangeError(); } var source = this; return new AnonymousObservable(function (o) { var q = []; return source.subscribe(function (x) { q.push(x); q.length > count && o.onNext(q.shift()); }, function (e) { o.onError(e); }, function () { o.onCompleted(); }); }, source); }; /** * Prepends a sequence of values to an observable sequence with an optional scheduler and an argument list of values to prepend. * @example * var res = source.startWith(1, 2, 3); * var res = source.startWith(Rx.Scheduler.timeout, 1, 2, 3); * @param {Arguments} args The specified values to prepend to the observable sequence * @returns {Observable} The source sequence prepended with the specified values. */ observableProto.startWith = function () { var values, scheduler, start = 0; if (!!arguments.length && isScheduler(arguments[0])) { scheduler = arguments[0]; start = 1; } else { scheduler = immediateScheduler; } for(var args = [], i = start, len = arguments.length; i < len; i++) { args.push(arguments[i]); } return enumerableOf([observableFromArray(args, scheduler), this]).concat(); }; /** * Returns a specified number of contiguous elements from the end of an observable sequence. * @description * This operator accumulates a buffer with a length enough to store elements count elements. Upon completion of * the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed. * @param {Number} count Number of elements to take from the end of the source sequence. * @returns {Observable} An observable sequence containing the specified number of elements from the end of the source sequence. */ observableProto.takeLast = function (count) { if (count < 0) { throw new ArgumentOutOfRangeError(); } var source = this; return new AnonymousObservable(function (o) { var q = []; return source.subscribe(function (x) { q.push(x); q.length > count && q.shift(); }, function (e) { o.onError(e); }, function () { while (q.length > 0) { o.onNext(q.shift()); } o.onCompleted(); }); }, source); }; /** * Returns an array with the specified number of contiguous elements from the end of an observable sequence. * * @description * This operator accumulates a buffer with a length enough to store count elements. Upon completion of the * source sequence, this buffer is produced on the result sequence. * @param {Number} count Number of elements to take from the end of the source sequence. * @returns {Observable} An observable sequence containing a single array with the specified number of elements from the end of the source sequence. */ observableProto.takeLastBuffer = function (count) { var source = this; return new AnonymousObservable(function (o) { var q = []; return source.subscribe(function (x) { q.push(x); q.length > count && q.shift(); }, function (e) { o.onError(e); }, function () { o.onNext(q); o.onCompleted(); }); }, source); }; /** * Projects each element of an observable sequence into zero or more windows which are produced based on element count information. * * var res = xs.windowWithCount(10); * var res = xs.windowWithCount(10, 1); * @param {Number} count Length of each window. * @param {Number} [skip] Number of elements to skip between creation of consecutive windows. If not specified, defaults to the count. * @returns {Observable} An observable sequence of windows. */ observableProto.windowWithCount = function (count, skip) { var source = this; +count || (count = 0); Math.abs(count) === Infinity && (count = 0); if (count <= 0) { throw new ArgumentOutOfRangeError(); } skip == null && (skip = count); +skip || (skip = 0); Math.abs(skip) === Infinity && (skip = 0); if (skip <= 0) { throw new ArgumentOutOfRangeError(); } return new AnonymousObservable(function (observer) { var m = new SingleAssignmentDisposable(), refCountDisposable = new RefCountDisposable(m), n = 0, q = []; function createWindow () { var s = new Subject(); q.push(s); observer.onNext(addRef(s, refCountDisposable)); } createWindow(); m.setDisposable(source.subscribe( function (x) { for (var i = 0, len = q.length; i < len; i++) { q[i].onNext(x); } var c = n - count + 1; c >= 0 && c % skip === 0 && q.shift().onCompleted(); ++n % skip === 0 && createWindow(); }, function (e) { while (q.length > 0) { q.shift().onError(e); } observer.onError(e); }, function () { while (q.length > 0) { q.shift().onCompleted(); } observer.onCompleted(); } )); return refCountDisposable; }, source); }; observableProto.flatMapConcat = observableProto.concatMap = function(selector, resultSelector, thisArg) { return new FlatMapObservable(this, selector, resultSelector, thisArg).merge(1); }; /** * Projects each notification of an observable sequence to an observable sequence and concats the resulting observable sequences into one observable sequence. * @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element. * @param {Function} onError A transform function to apply when an error occurs in the source sequence. * @param {Function} onCompleted A transform function to apply when the end of the source sequence is reached. * @param {Any} [thisArg] An optional "this" to use to invoke each transform. * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence. */ observableProto.concatMapObserver = observableProto.selectConcatObserver = function(onNext, onError, onCompleted, thisArg) { var source = this, onNextFunc = bindCallback(onNext, thisArg, 2), onErrorFunc = bindCallback(onError, thisArg, 1), onCompletedFunc = bindCallback(onCompleted, thisArg, 0); return new AnonymousObservable(function (observer) { var index = 0; return source.subscribe( function (x) { var result; try { result = onNextFunc(x, index++); } catch (e) { observer.onError(e); return; } isPromise(result) && (result = observableFromPromise(result)); observer.onNext(result); }, function (err) { var result; try { result = onErrorFunc(err); } catch (e) { observer.onError(e); return; } isPromise(result) && (result = observableFromPromise(result)); observer.onNext(result); observer.onCompleted(); }, function () { var result; try { result = onCompletedFunc(); } catch (e) { observer.onError(e); return; } isPromise(result) && (result = observableFromPromise(result)); observer.onNext(result); observer.onCompleted(); }); }, this).concatAll(); }; /** * Returns the elements of the specified sequence or the specified value in a singleton sequence if the sequence is empty. * * var res = obs = xs.defaultIfEmpty(); * 2 - obs = xs.defaultIfEmpty(false); * * @memberOf Observable# * @param defaultValue The value to return if the sequence is empty. If not provided, this defaults to null. * @returns {Observable} An observable sequence that contains the specified default value if the source is empty; otherwise, the elements of the source itself. */ observableProto.defaultIfEmpty = function (defaultValue) { var source = this; defaultValue === undefined && (defaultValue = null); return new AnonymousObservable(function (observer) { var found = false; return source.subscribe(function (x) { found = true; observer.onNext(x); }, function (e) { observer.onError(e); }, function () { !found && observer.onNext(defaultValue); observer.onCompleted(); }); }, source); }; // Swap out for Array.findIndex function arrayIndexOfComparer(array, item, comparer) { for (var i = 0, len = array.length; i < len; i++) { if (comparer(array[i], item)) { return i; } } return -1; } function HashSet(comparer) { this.comparer = comparer; this.set = []; } HashSet.prototype.push = function(value) { var retValue = arrayIndexOfComparer(this.set, value, this.comparer) === -1; retValue && this.set.push(value); return retValue; }; /** * Returns an observable sequence that contains only distinct elements according to the keySelector and the comparer. * Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large. * * @example * var res = obs = xs.distinct(); * 2 - obs = xs.distinct(function (x) { return x.id; }); * 2 - obs = xs.distinct(function (x) { return x.id; }, function (a,b) { return a === b; }); * @param {Function} [keySelector] A function to compute the comparison key for each element. * @param {Function} [comparer] Used to compare items in the collection. * @returns {Observable} An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence. */ observableProto.distinct = function (keySelector, comparer) { var source = this; comparer || (comparer = defaultComparer); return new AnonymousObservable(function (o) { var hashSet = new HashSet(comparer); return source.subscribe(function (x) { var key = x; if (keySelector) { try { key = keySelector(x); } catch (e) { o.onError(e); return; } } hashSet.push(key) && o.onNext(x); }, function (e) { o.onError(e); }, function () { o.onCompleted(); }); }, this); }; var MapObservable = (function (__super__) { inherits(MapObservable, __super__); function MapObservable(source, selector, thisArg) { this.source = source; this.selector = bindCallback(selector, thisArg, 3); __super__.call(this); } function innerMap(selector, self) { return function (x, i, o) { return selector.call(this, self.selector(x, i, o), i, o); } } MapObservable.prototype.internalMap = function (selector, thisArg) { return new MapObservable(this.source, innerMap(selector, this), thisArg); }; MapObservable.prototype.subscribeCore = function (o) { return this.source.subscribe(new InnerObserver(o, this.selector, this)); }; function InnerObserver(o, selector, source) { this.o = o; this.selector = selector; this.source = source; this.i = 0; this.isStopped = false; } InnerObserver.prototype.onNext = function(x) { if (this.isStopped) { return; } var result = tryCatch(this.selector)(x, this.i++, this.source); if (result === errorObj) { return this.o.onError(result.e); } this.o.onNext(result); }; InnerObserver.prototype.onError = function (e) { if(!this.isStopped) { this.isStopped = true; this.o.onError(e); } }; InnerObserver.prototype.onCompleted = function () { if(!this.isStopped) { this.isStopped = true; this.o.onCompleted(); } }; InnerObserver.prototype.dispose = function() { this.isStopped = true; }; InnerObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); return true; } return false; }; return MapObservable; }(ObservableBase)); /** * Projects each element of an observable sequence into a new form by incorporating the element's index. * @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source. */ observableProto.map = observableProto.select = function (selector, thisArg) { var selectorFn = typeof selector === 'function' ? selector : function () { return selector; }; return this instanceof MapObservable ? this.internalMap(selectorFn, thisArg) : new MapObservable(this, selectorFn, thisArg); }; function plucker(args, len) { return function mapper(x) { var currentProp = x; for (var i = 0; i < len; i++) { var p = currentProp[args[i]]; if (typeof p !== 'undefined') { currentProp = p; } else { return undefined; } } return currentProp; } } /** * Retrieves the value of a specified nested property from all elements in * the Observable sequence. * @param {Arguments} arguments The nested properties to pluck. * @returns {Observable} Returns a new Observable sequence of property values. */ observableProto.pluck = function () { var len = arguments.length, args = new Array(len); if (len === 0) { throw new Error('List of properties cannot be empty.'); } for(var i = 0; i < len; i++) { args[i] = arguments[i]; } return this.map(plucker(args, len)); }; observableProto.flatMap = observableProto.selectMany = function(selector, resultSelector, thisArg) { return new FlatMapObservable(this, selector, resultSelector, thisArg).mergeAll(); }; // //Rx.Observable.prototype.flatMapWithMaxConcurrent = function(limit, selector, resultSelector, thisArg) { // return new FlatMapObservable(this, selector, resultSelector, thisArg).merge(limit); //}; // /** * Projects each notification of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence. * @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element. * @param {Function} onError A transform function to apply when an error occurs in the source sequence. * @param {Function} onCompleted A transform function to apply when the end of the source sequence is reached. * @param {Any} [thisArg] An optional "this" to use to invoke each transform. * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence. */ observableProto.flatMapObserver = observableProto.selectManyObserver = function (onNext, onError, onCompleted, thisArg) { var source = this; return new AnonymousObservable(function (observer) { var index = 0; return source.subscribe( function (x) { var result; try { result = onNext.call(thisArg, x, index++); } catch (e) { observer.onError(e); return; } isPromise(result) && (result = observableFromPromise(result)); observer.onNext(result); }, function (err) { var result; try { result = onError.call(thisArg, err); } catch (e) { observer.onError(e); return; } isPromise(result) && (result = observableFromPromise(result)); observer.onNext(result); observer.onCompleted(); }, function () { var result; try { result = onCompleted.call(thisArg); } catch (e) { observer.onError(e); return; } isPromise(result) && (result = observableFromPromise(result)); observer.onNext(result); observer.onCompleted(); }); }, source).mergeAll(); }; Rx.Observable.prototype.flatMapLatest = function(selector, resultSelector, thisArg) { return new FlatMapObservable(this, selector, resultSelector, thisArg).switchLatest(); }; var SkipObservable = (function(__super__) { inherits(SkipObservable, __super__); function SkipObservable(source, count) { this.source = source; this.skipCount = count; __super__.call(this); } SkipObservable.prototype.subscribeCore = function (o) { return this.source.subscribe(new InnerObserver(o, this.skipCount)); }; function InnerObserver(o, c) { this.c = c; this.r = c; this.o = o; this.isStopped = false; } InnerObserver.prototype.onNext = function (x) { if (this.isStopped) { return; } if (this.r <= 0) { this.o.onNext(x); } else { this.r--; } }; InnerObserver.prototype.onError = function(e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); } }; InnerObserver.prototype.onCompleted = function() { if (!this.isStopped) { this.isStopped = true; this.o.onCompleted(); } }; InnerObserver.prototype.dispose = function() { this.isStopped = true; }; InnerObserver.prototype.fail = function(e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); return true; } return false; }; return SkipObservable; }(ObservableBase)); /** * Bypasses a specified number of elements in an observable sequence and then returns the remaining elements. * @param {Number} count The number of elements to skip before returning the remaining elements. * @returns {Observable} An observable sequence that contains the elements that occur after the specified index in the input sequence. */ observableProto.skip = function (count) { if (count < 0) { throw new ArgumentOutOfRangeError(); } return new SkipObservable(this, count); }; /** * Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements. * The element's index is used in the logic of the predicate function. * * var res = source.skipWhile(function (value) { return value < 10; }); * var res = source.skipWhile(function (value, index) { return value < 10 || index < 10; }); * @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate. */ observableProto.skipWhile = function (predicate, thisArg) { var source = this, callback = bindCallback(predicate, thisArg, 3); return new AnonymousObservable(function (o) { var i = 0, running = false; return source.subscribe(function (x) { if (!running) { try { running = !callback(x, i++, source); } catch (e) { o.onError(e); return; } } running && o.onNext(x); }, function (e) { o.onError(e); }, function () { o.onCompleted(); }); }, source); }; /** * Returns a specified number of contiguous elements from the start of an observable sequence, using the specified scheduler for the edge case of take(0). * * var res = source.take(5); * var res = source.take(0, Rx.Scheduler.timeout); * @param {Number} count The number of elements to return. * @param {Scheduler} [scheduler] Scheduler used to produce an OnCompleted message in case <paramref name="count count</paramref> is set to 0. * @returns {Observable} An observable sequence that contains the specified number of elements from the start of the input sequence. */ observableProto.take = function (count, scheduler) { if (count < 0) { throw new ArgumentOutOfRangeError(); } if (count === 0) { return observableEmpty(scheduler); } var source = this; return new AnonymousObservable(function (o) { var remaining = count; return source.subscribe(function (x) { if (remaining-- > 0) { o.onNext(x); remaining <= 0 && o.onCompleted(); } }, function (e) { o.onError(e); }, function () { o.onCompleted(); }); }, source); }; /** * Returns elements from an observable sequence as long as a specified condition is true. * The element's index is used in the logic of the predicate function. * @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes. */ observableProto.takeWhile = function (predicate, thisArg) { var source = this, callback = bindCallback(predicate, thisArg, 3); return new AnonymousObservable(function (o) { var i = 0, running = true; return source.subscribe(function (x) { if (running) { try { running = callback(x, i++, source); } catch (e) { o.onError(e); return; } if (running) { o.onNext(x); } else { o.onCompleted(); } } }, function (e) { o.onError(e); }, function () { o.onCompleted(); }); }, source); }; var FilterObservable = (function (__super__) { inherits(FilterObservable, __super__); function FilterObservable(source, predicate, thisArg) { this.source = source; this.predicate = bindCallback(predicate, thisArg, 3); __super__.call(this); } FilterObservable.prototype.subscribeCore = function (o) { return this.source.subscribe(new InnerObserver(o, this.predicate, this)); }; function innerPredicate(predicate, self) { return function(x, i, o) { return self.predicate(x, i, o) && predicate.call(this, x, i, o); } } FilterObservable.prototype.internalFilter = function(predicate, thisArg) { return new FilterObservable(this.source, innerPredicate(predicate, this), thisArg); }; function InnerObserver(o, predicate, source) { this.o = o; this.predicate = predicate; this.source = source; this.i = 0; this.isStopped = false; } InnerObserver.prototype.onNext = function(x) { if (this.isStopped) { return; } var shouldYield = tryCatch(this.predicate)(x, this.i++, this.source); if (shouldYield === errorObj) { return this.o.onError(shouldYield.e); } shouldYield && this.o.onNext(x); }; InnerObserver.prototype.onError = function (e) { if(!this.isStopped) { this.isStopped = true; this.o.onError(e); } }; InnerObserver.prototype.onCompleted = function () { if(!this.isStopped) { this.isStopped = true; this.o.onCompleted(); } }; InnerObserver.prototype.dispose = function() { this.isStopped = true; }; InnerObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); return true; } return false; }; return FilterObservable; }(ObservableBase)); /** * Filters the elements of an observable sequence based on a predicate by incorporating the element's index. * @param {Function} predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} An observable sequence that contains elements from the input sequence that satisfy the condition. */ observableProto.filter = observableProto.where = function (predicate, thisArg) { return this instanceof FilterObservable ? this.internalFilter(predicate, thisArg) : new FilterObservable(this, predicate, thisArg); }; /** * Executes a transducer to transform the observable sequence * @param {Transducer} transducer A transducer to execute * @returns {Observable} An Observable sequence containing the results from the transducer. */ observableProto.transduce = function(transducer) { var source = this; function transformForObserver(o) { return { '@@transducer/init': function() { return o; }, '@@transducer/step': function(obs, input) { return obs.onNext(input); }, '@@transducer/result': function(obs) { return obs.onCompleted(); } }; } return new AnonymousObservable(function(o) { var xform = transducer(transformForObserver(o)); return source.subscribe( function(v) { var res = tryCatch(xform['@@transducer/step']).call(xform, o, v); if (res === errorObj) { o.onError(res.e); } }, function (e) { o.onError(e); }, function() { xform['@@transducer/result'](o); } ); }, source); }; var AnonymousObservable = Rx.AnonymousObservable = (function (__super__) { inherits(AnonymousObservable, __super__); // Fix subscriber to check for undefined or function returned to decorate as Disposable function fixSubscriber(subscriber) { return subscriber && isFunction(subscriber.dispose) ? subscriber : isFunction(subscriber) ? disposableCreate(subscriber) : disposableEmpty; } function setDisposable(s, state) { var ado = state[0], self = state[1]; var sub = tryCatch(self.__subscribe).call(self, ado); if (sub === errorObj) { if(!ado.fail(errorObj.e)) { return thrower(errorObj.e); } } ado.setDisposable(fixSubscriber(sub)); } function innerSubscribe(observer) { var ado = new AutoDetachObserver(observer), state = [ado, this]; if (currentThreadScheduler.scheduleRequired()) { currentThreadScheduler.scheduleWithState(state, setDisposable); } else { setDisposable(null, state); } return ado; } function AnonymousObservable(subscribe, parent) { this.source = parent; this.__subscribe = subscribe; __super__.call(this, innerSubscribe); } return AnonymousObservable; }(Observable)); var AutoDetachObserver = (function (__super__) { inherits(AutoDetachObserver, __super__); function AutoDetachObserver(observer) { __super__.call(this); this.observer = observer; this.m = new SingleAssignmentDisposable(); } var AutoDetachObserverPrototype = AutoDetachObserver.prototype; AutoDetachObserverPrototype.next = function (value) { var result = tryCatch(this.observer.onNext).call(this.observer, value); if (result === errorObj) { this.dispose(); thrower(result.e); } }; AutoDetachObserverPrototype.error = function (err) { var result = tryCatch(this.observer.onError).call(this.observer, err); this.dispose(); result === errorObj && thrower(result.e); }; AutoDetachObserverPrototype.completed = function () { var result = tryCatch(this.observer.onCompleted).call(this.observer); this.dispose(); result === errorObj && thrower(result.e); }; AutoDetachObserverPrototype.setDisposable = function (value) { this.m.setDisposable(value); }; AutoDetachObserverPrototype.getDisposable = function () { return this.m.getDisposable(); }; AutoDetachObserverPrototype.dispose = function () { __super__.prototype.dispose.call(this); this.m.dispose(); }; return AutoDetachObserver; }(AbstractObserver)); var InnerSubscription = function (subject, observer) { this.subject = subject; this.observer = observer; }; InnerSubscription.prototype.dispose = function () { if (!this.subject.isDisposed && this.observer !== null) { var idx = this.subject.observers.indexOf(this.observer); this.subject.observers.splice(idx, 1); this.observer = null; } }; /** * Represents an object that is both an observable sequence as well as an observer. * Each notification is broadcasted to all subscribed observers. */ var Subject = Rx.Subject = (function (__super__) { function subscribe(observer) { checkDisposed(this); if (!this.isStopped) { this.observers.push(observer); return new InnerSubscription(this, observer); } if (this.hasError) { observer.onError(this.error); return disposableEmpty; } observer.onCompleted(); return disposableEmpty; } inherits(Subject, __super__); /** * Creates a subject. */ function Subject() { __super__.call(this, subscribe); this.isDisposed = false, this.isStopped = false, this.observers = []; this.hasError = false; } addProperties(Subject.prototype, Observer.prototype, { /** * Indicates whether the subject has observers subscribed to it. * @returns {Boolean} Indicates whether the subject has observers subscribed to it. */ hasObservers: function () { return this.observers.length > 0; }, /** * Notifies all subscribed observers about the end of the sequence. */ onCompleted: function () { checkDisposed(this); if (!this.isStopped) { this.isStopped = true; for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) { os[i].onCompleted(); } this.observers.length = 0; } }, /** * Notifies all subscribed observers about the exception. * @param {Mixed} error The exception to send to all observers. */ onError: function (error) { checkDisposed(this); if (!this.isStopped) { this.isStopped = true; this.error = error; this.hasError = true; for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) { os[i].onError(error); } this.observers.length = 0; } }, /** * Notifies all subscribed observers about the arrival of the specified element in the sequence. * @param {Mixed} value The value to send to all observers. */ onNext: function (value) { checkDisposed(this); if (!this.isStopped) { for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) { os[i].onNext(value); } } }, /** * Unsubscribe all observers and release resources. */ dispose: function () { this.isDisposed = true; this.observers = null; } }); /** * Creates a subject from the specified observer and observable. * @param {Observer} observer The observer used to send messages to the subject. * @param {Observable} observable The observable used to subscribe to messages sent from the subject. * @returns {Subject} Subject implemented using the given observer and observable. */ Subject.create = function (observer, observable) { return new AnonymousSubject(observer, observable); }; return Subject; }(Observable)); /** * Represents the result of an asynchronous operation. * The last value before the OnCompleted notification, or the error received through OnError, is sent to all subscribed observers. */ var AsyncSubject = Rx.AsyncSubject = (function (__super__) { function subscribe(observer) { checkDisposed(this); if (!this.isStopped) { this.observers.push(observer); return new InnerSubscription(this, observer); } if (this.hasError) { observer.onError(this.error); } else if (this.hasValue) { observer.onNext(this.value); observer.onCompleted(); } else { observer.onCompleted(); } return disposableEmpty; } inherits(AsyncSubject, __super__); /** * Creates a subject that can only receive one value and that value is cached for all future observations. * @constructor */ function AsyncSubject() { __super__.call(this, subscribe); this.isDisposed = false; this.isStopped = false; this.hasValue = false; this.observers = []; this.hasError = false; } addProperties(AsyncSubject.prototype, Observer, { /** * Indicates whether the subject has observers subscribed to it. * @returns {Boolean} Indicates whether the subject has observers subscribed to it. */ hasObservers: function () { checkDisposed(this); return this.observers.length > 0; }, /** * Notifies all subscribed observers about the end of the sequence, also causing the last received value to be sent out (if any). */ onCompleted: function () { var i, len; checkDisposed(this); if (!this.isStopped) { this.isStopped = true; var os = cloneArray(this.observers), len = os.length; if (this.hasValue) { for (i = 0; i < len; i++) { var o = os[i]; o.onNext(this.value); o.onCompleted(); } } else { for (i = 0; i < len; i++) { os[i].onCompleted(); } } this.observers.length = 0; } }, /** * Notifies all subscribed observers about the error. * @param {Mixed} error The Error to send to all observers. */ onError: function (error) { checkDisposed(this); if (!this.isStopped) { this.isStopped = true; this.hasError = true; this.error = error; for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) { os[i].onError(error); } this.observers.length = 0; } }, /** * Sends a value to the subject. The last value received before successful termination will be sent to all subscribed and future observers. * @param {Mixed} value The value to store in the subject. */ onNext: function (value) { checkDisposed(this); if (this.isStopped) { return; } this.value = value; this.hasValue = true; }, /** * Unsubscribe all observers and release resources. */ dispose: function () { this.isDisposed = true; this.observers = null; this.exception = null; this.value = null; } }); return AsyncSubject; }(Observable)); var AnonymousSubject = Rx.AnonymousSubject = (function (__super__) { inherits(AnonymousSubject, __super__); function subscribe(observer) { return this.observable.subscribe(observer); } function AnonymousSubject(observer, observable) { this.observer = observer; this.observable = observable; __super__.call(this, subscribe); } addProperties(AnonymousSubject.prototype, Observer.prototype, { onCompleted: function () { this.observer.onCompleted(); }, onError: function (error) { this.observer.onError(error); }, onNext: function (value) { this.observer.onNext(value); } }); return AnonymousSubject; }(Observable)); if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { root.Rx = Rx; define(function() { return Rx; }); } else if (freeExports && freeModule) { // in Node.js or RingoJS if (moduleExports) { (freeModule.exports = Rx).Rx = Rx; } else { freeExports.Rx = Rx; } } else { // in a browser or Rhino root.Rx = Rx; } // All code before this point will be filtered from stack traces. var rEndingLine = captureLine(); }.call(this));
stefanneculai/cdnjs
ajax/libs/rxjs/3.1.2/rx.compat.js
JavaScript
mit
203,771
;(function(e,t,n,r){function s(e){return n.translate(e)||e}function u(e){e.id=e.attr("id"),e.html('<div class="plupload_wrapper"><div class="ui-widget-content plupload_container"><div class="ui-state-default ui-widget-header plupload_header"><div class="plupload_header_content"><div class="plupload_logo"> </div><div class="plupload_header_title">'+s("Select files")+"</div>"+'<div class="plupload_header_text">'+s("Add files to the upload queue and click the start button.")+"</div>"+'<div class="plupload_view_switch">'+'<input type="radio" id="'+e.id+'_view_list" name="view_mode_'+e.id+'" checked="checked" /> <label class="plupload_button" for="'+e.id+'_view_list" data-view="list">'+s("List")+"</label>"+'<input type="radio" id="'+e.id+'_view_thumbs" name="view_mode_'+e.id+'" /> <label class="plupload_button" for="'+e.id+'_view_thumbs" data-view="thumbs">'+s("Thumbnails")+"</label>"+"</div>"+"</div>"+"</div>"+'<table class="plupload_filelist plupload_filelist_header ui-widget-header">'+"<tr>"+'<td class="plupload_cell plupload_file_name">'+s("Filename")+"</td>"+'<td class="plupload_cell plupload_file_status">'+s("Status")+"</td>"+'<td class="plupload_cell plupload_file_size">'+s("Size")+"</td>"+'<td class="plupload_cell plupload_file_action">&nbsp;</td>'+"</tr>"+"</table>"+'<div class="plupload_content">'+'<div class="plupload_droptext">'+s("Drag files here.")+"</div>"+'<ul class="plupload_filelist_content"> </ul>'+'<div class="plupload_clearer">&nbsp;</div>'+"</div>"+'<table class="plupload_filelist plupload_filelist_footer ui-widget-header">'+"<tr>"+'<td class="plupload_cell plupload_file_name">'+'<div class="plupload_buttons"><!-- Visible -->'+'<a class="plupload_button plupload_add">'+s("Add Files")+"</a>&nbsp;"+'<a class="plupload_button plupload_start">'+s("Start Upload")+"</a>&nbsp;"+'<a class="plupload_button plupload_stop plupload_hidden">'+s("Stop Upload")+"</a>&nbsp;"+"</div>"+'<div class="plupload_started plupload_hidden"><!-- Hidden -->'+'<div class="plupload_progress plupload_right">'+'<div class="plupload_progress_container"></div>'+"</div>"+'<div class="plupload_cell plupload_upload_status"></div>'+'<div class="plupload_clearer">&nbsp;</div>'+"</div>"+"</td>"+'<td class="plupload_file_status"><span class="plupload_total_status">0%</span></td>'+'<td class="plupload_file_size"><span class="plupload_total_file_size">0 kb</span></td>'+'<td class="plupload_file_action"></td>'+"</tr>"+"</table>"+"</div>"+'<input class="plupload_count" value="0" type="hidden">'+"</div>")}var i={};r.widget("ui.plupload",{widgetEventPrefix:"",imgs:{},contents_bak:"",options:{browse_button_hover:"ui-state-hover",browse_button_active:"ui-state-active",dragdrop:!0,multiple_queues:!0,buttons:{browse:!0,start:!0,stop:!0},views:{list:!0,thumbs:!1,active:"list",remember:!0},autostart:!1,sortable:!1,rename:!1,max_file_count:0},FILE_COUNT_ERROR:-9001,_create:function(){var e=this.element.attr("id");e||(e=n.guid(),this.element.attr("id",e)),this.id=e,this.contents_bak=this.element.html(),u(this.element),this.container=r(".plupload_container",this.element).attr("id",e+"_container"),this.content=r(".plupload_content",this.element),r.fn.resizable&&this.container.resizable({handles:"s",minHeight:300}),this.filelist=r(".plupload_filelist_content",this.container).attr({id:e+"_filelist",unselectable:"on"}),this.browse_button=r(".plupload_add",this.container).attr("id",e+"_browse"),this.start_button=r(".plupload_start",this.container).attr("id",e+"_start"),this.stop_button=r(".plupload_stop",this.container).attr("id",e+"_stop"),this.thumbs_switcher=r("#"+e+"_view_thumbs"),this.list_switcher=r("#"+e+"_view_list"),r.ui.button&&(this.browse_button.button({icons:{primary:"ui-icon-circle-plus"},disabled:!0}),this.start_button.button({icons:{primary:"ui-icon-circle-arrow-e"},disabled:!0}),this.stop_button.button({icons:{primary:"ui-icon-circle-close"}}),this.list_switcher.button({text:!1,icons:{secondary:"ui-icon-grip-dotted-horizontal"}}),this.thumbs_switcher.button({text:!1,icons:{secondary:"ui-icon-image"}})),this.progressbar=r(".plupload_progress_container",this.container),r.ui.progressbar&&this.progressbar.progressbar(),this.counter=r(".plupload_count",this.element).attr({id:e+"_count",name:e+"_count"}),this._initUploader()},_initUploader:function(){var e=this,t=this.id,u,a={container:t+"_buttons",browse_button:t+"_browse"};r(".plupload_buttons",this.element).attr("id",t+"_buttons"),e.options.dragdrop&&(this.filelist.parent().attr("id",this.id+"_dropbox"),a.drop_element=this.id+"_dropbox"),e.options.views.thumbs&&(o.typeOf(e.options.required_features)==="string"?e.options.required_features+=",display_media":e.options.required_features="display_media"),u=this.uploader=i[t]=new n.Uploader(r.extend(this.options,a)),u.bind("Error",function(t,r){var i,u="";i="<strong>"+r.message+"</strong>";switch(r.code){case n.FILE_EXTENSION_ERROR:u=o.sprintf(s("File: %s"),r.file.name);break;case n.FILE_SIZE_ERROR:u=o.sprintf(s("File: %f, size: %s, max file size: %m"),r.file.name,r.file.size,n.parseSize(e.options.max_file_size));break;case n.FILE_DUPLICATE_ERROR:u=o.sprintf(s("%s already present in the queue."),r.file.name);break;case e.FILE_COUNT_ERROR:u=o.sprintf(s("Upload element accepts only %d file(s) at a time. Extra files were stripped."),e.options.max_file_count);break;case n.IMAGE_FORMAT_ERROR:u=s("Image format either wrong or not supported.");break;case n.IMAGE_MEMORY_ERROR:u=s("Runtime ran out of available memory.");break;case n.HTTP_ERROR:u=s("Upload URL might be wrong or doesn't exist.")}i+=" <br /><i>"+u+"</i>",e._trigger("error",null,{up:t,error:r}),r.code===n.INIT_ERROR?setTimeout(function(){e.destroy()},1):e.notify("error",i)}),u.bind("PostInit",function(t){e.options.buttons.browse?e.browse_button.button("enable"):(e.browse_button.button("disable").hide(),t.disableBrowse(!0)),e.options.buttons.start||e.start_button.button("disable").hide(),e.options.buttons.stop||e.stop_button.button("disable").hide(),!e.options.unique_names&&e.options.rename&&e._enableRenaming(),e.options.dragdrop&&t.features.dragdrop&&e.filelist.parent().addClass("plupload_dropbox"),e._enableViewSwitcher(),e.start_button.click(function(t){r(this).button("option","disabled")||e.start(),t.preventDefault()}),e.stop_button.click(function(t){e.stop(),t.preventDefault()}),e._trigger("ready",null,{up:t})}),e.options.max_file_count&&(e.options.multiple_queues=!1,u.bind("FilesAdded",function(t,n){var r=n.length,i=t.files.length+r-e.options.max_file_count;i>0&&(n.splice(r-i,i),t.trigger("Error",{code:e.FILE_COUNT_ERROR,message:s("File count error.")}))})),u.init(),u.bind("FilesAdded",function(t,n){e._addFiles(n),e._trigger("selected",null,{up:t,files:n}),e.options.autostart&&setTimeout(function(){e.start()},10)}),u.bind("FilesRemoved",function(t,n){e._trigger("removed",null,{up:t,files:n})}),u.bind("QueueChanged",function(){e._handleState(),e._updateTotalProgress()}),u.bind("StateChanged",function(){e._handleState()}),u.bind("UploadFile",function(t,n){e._handleFileStatus(n)}),u.bind("FileUploaded",function(t,n){e._handleFileStatus(n),e._trigger("uploaded",null,{up:t,file:n})}),u.bind("UploadProgress",function(t,n){e._handleFileStatus(n),e._updateTotalProgress(),e._trigger("progress",null,{up:t,file:n})}),u.bind("UploadComplete",function(t,n){e._addFormFields(),e._trigger("complete",null,{up:t,files:n})})},_setOption:function(e,t){var n=this;e=="buttons"&&typeof t=="object"&&(t=r.extend(n.options.buttons,t),t.browse?(n.browse_button.button("enable").show(),n.uploader.disableBrowse(!1)):(n.browse_button.button("disable").hide(),n.uploader.disableBrowse(!0)),t.start?n.start_button.button("enable").show():n.start_button.button("disable").hide(),t.stop?n.start_button.button("enable").show():n.stop_button.button("disable").hide()),n.uploader.settings[e]=t},start:function(){this.uploader.start(),this._trigger("start",null,{up:this.uploader})},stop:function(){this.uploader.stop(),this._trigger("stop",null,{up:this.uploader})},enable:function(){this.browse_button.button("enable"),this.uploader.disableBrowse(!1)},disable:function(){this.browse_button.button("disable"),this.uploader.disableBrowse(!0)},getFile:function(e){var t;return typeof e=="number"?t=this.uploader.files[e]:t=this.uploader.getFile(e),t},getFiles:function(){return this.uploader.files},removeFile:function(e){n.typeOf(e)==="string"&&(e=this.getFile(e)),this._removeFiles(e)},clearQueue:function(){this.uploader.splice()},getUploader:function(){return this.uploader},refresh:function(){this.uploader.refresh()},notify:function(e,t){var n=r('<div class="plupload_message"><span class="plupload_message_close ui-icon ui-icon-circle-close" title="'+s("Close")+'"></span>'+'<p><span class="ui-icon"></span>'+t+"</p>"+"</div>");n.addClass("ui-state-"+(e==="error"?"error":"highlight")).find("p .ui-icon").addClass("ui-icon-"+(e==="error"?"alert":"info")).end().find(".plupload_message_close").click(function(){n.remove()}).end(),r(".plupload_header",this.container).append(n)},destroy:function(){this._removeFiles([].slice.call(this.uploader.files)),this.uploader.destroy(),r(".plupload_button",this.element).unbind(),r.ui.button&&r(".plupload_add, .plupload_start, .plupload_stop",this.container).button("destroy"),r.ui.progressbar&&this.progressbar.progressbar("destroy"),r.ui.sortable&&this.options.sortable&&r("tbody",this.filelist).sortable("destroy"),this.element.empty().html(this.contents_bak),this.contents_bak="",r.Widget.prototype.destroy.apply(this)},_handleState:function(){var e=this.uploader;e.state===n.STARTED?(r(this.start_button).button("disable"),r([]).add(this.stop_button).add(".plupload_started").removeClass("plupload_hidden"),r(".plupload_upload_status",this.element).html(o.sprintf(s("Uploaded %d/%d files"),e.total.uploaded,e.files.length)),r(".plupload_header_content",this.element).addClass("plupload_header_content_bw")):e.state===n.STOPPED&&(r([]).add(this.stop_button).add(".plupload_started").addClass("plupload_hidden"),this.options.multiple_queues?r(".plupload_header_content",this.element).removeClass("plupload_header_content_bw"):(r([]).add(this.browse_button).add(this.start_button).button("disable"),e.disableBrowse()),e.files.length===e.total.uploaded+e.total.failed?this.start_button.button("disable"):this.start_button.button("enable"),this._updateTotalProgress()),e.total.queued===0?r(".ui-button-text",this.browse_button).html(s("Add Files")):r(".ui-button-text",this.browse_button).html(o.sprintf(s("%d files queued"),e.total.queued)),e.refresh()},_handleFileStatus:function(e){var t=this,i,s;if(!r("#"+e.id).length)return;switch(e.status){case n.DONE:i="plupload_done",s="ui-icon ui-icon-circle-check";break;case n.FAILED:i="ui-state-error plupload_failed",s="ui-icon ui-icon-alert";break;case n.QUEUED:i="plupload_delete",s="ui-icon ui-icon-circle-minus";break;case n.UPLOADING:i="ui-state-highlight plupload_uploading",s="ui-icon ui-icon-circle-arrow-w";var o=r(".plupload_scroll",this.container),u=o.scrollTop(),a=o.height(),f=r("#"+e.id).position().top+r("#"+e.id).height();a<f&&o.scrollTop(u+f-a),r("#"+e.id).find(".plupload_file_percent").html(e.percent+"%").end().find(".plupload_file_progress").css("width",e.percent+"%").end().find(".plupload_file_size").html(n.formatSize(e.size))}i+=" ui-state-default plupload_file",r("#"+e.id).attr("class",i).find(".ui-icon").attr("class",s).end().filter(".plupload_delete, .plupload_done, .plupload_failed").find(".ui-icon").click(function(n){t._removeFiles(e),n.preventDefault()})},_updateTotalProgress:function(){var e=this.uploader;this.filelist[0].scrollTop=this.filelist[0].scrollHeight,this.progressbar.progressbar("value",e.total.percent),this.element.find(".plupload_total_status").html(e.total.percent+"%").end().find(".plupload_total_file_size").html(n.formatSize(e.total.size)).end().find(".plupload_upload_status").html(o.sprintf(s("Uploaded %d/%d files"),e.total.uploaded,e.files.length))},_addFiles:function(e){var t=this,i,s=[];i='<li class="plupload_file ui-state-default" id="%id%"><div class="plupload_file_thumb"> </div><div class="plupload_file_name" title="%name%"><span class="plupload_file_namespan">%name%</span></div><div class="plupload_file_action"><div class="ui-icon"> </div></div><div class="plupload_file_size">%size% </div><div class="plupload_file_fields"> </div></li>',n.typeOf(e)!=="array"&&(e=[e]),r.ui.sortable&&this.options.sortable&&r("tbody",t.filelist).sortable("destroy"),r.each(e,function(e,u){t.filelist.append(i.replace(/%(\w+)%/g,function(e,t){return"size"===t?n.formatSize(u.size):u[t]||""})),t.options.views.thumbs&&s.push(function(e){var n=new o.Image;n.onload=function(){this.embed(r("#"+u.id+" .plupload_file_thumb",t.filelist)[0],{width:100,height:60,crop:!0,swf_url:mOxie.resolveUrl(t.options.flash_swf_url),xap_url:mOxie.resolveUrl(t.options.silverlight_xap_url)})},n.onembedded=function(){r("#"+u.id+" .plupload_file_thumb",t.filelist).addClass("plupload_file_thumb_loaded"),this.destroy(),setTimeout(e,1)},n.onerror=function(){var n=u.name.match(/\.([^\.]{1,7})$/);r("#"+u.id+" .plupload_file_thumb",t.filelist).html('<div class="plupload_file_dummy ui-widget-content"><span class="ui-state-disabled">'+(n?n[1]:"none")+"</span></div>"),this.destroy(),setTimeout(e,1)},n.load(u.getSource())}),t._handleFileStatus(u)}),s.length&&o.inSeries(s),this.options.sortable&&r.ui.sortable&&this._enableSortingList(),this._trigger("updatelist",null,{filelist:this.filelist})},_removeFiles:function(e){var t=this,i=this.uploader;n.typeOf(e)!=="array"&&(e=[e]),r.ui.sortable&&this.options.sortable&&r("tbody",t.filelist).sortable("destroy"),r.each(e,function(e,t){t.imgs&&t.imgs.length&&(r.each(t.imgs,function(e,t){t.destroy()}),t.imgs=[]),r("#"+t.id).remove(),i.removeFile(t)}),i.files.length&&this.options.sortable&&r.ui.sortable&&this._enableSortingList(),this._trigger("updatelist",null,{filelist:this.filelist})},_addFormFields:function(){var e=this;r(".plupload_file_fields",this.filelist).html(""),n.each(this.uploader.files,function(t,i){var s="",o=e.id+"_"+i;t.target_name&&(s+='<input type="hidden" name="'+o+'_tmpname" value="'+n.xmlEncode(t.target_name)+'" />'),s+='<input type="hidden" name="'+o+'_name" value="'+n.xmlEncode(t.name)+'" />',s+='<input type="hidden" name="'+o+'_status" value="'+(t.status===n.DONE?"done":"failed")+'" />',r("#"+t.id).find(".plupload_file_fields").html(s)}),this.counter.val(this.uploader.files.length)},_viewChanged:function(e){this.options.views.remember&&r.cookie&&r.cookie("plupload_ui_view",e,{expires:7,path:"/"}),mOxie.Env.browser==="IE"&&mOxie.Env.version<7&&this.content.attr("style",'height:expression(document.getElementById("'+this.id+"_container"+'").clientHeight - '+(e==="list"?133:103)+");"),this.container.removeClass("plupload_view_list plupload_view_thumbs").addClass("plupload_view_"+e),this.view_mode=e,this._trigger("viewchanged",null,{view:e})},_enableViewSwitcher:function(){var e=this,t,i=r(".plupload_view_switch",this.container),s,o;n.each(["list","thumbs"],function(t){e.options.views[t]||i.find('[for="'+e.id+"_view_"+t+'"], #'+e.id+"_view_"+t).remove()}),s=i.find(".plupload_button"),s.length===1?(i.hide(),t=s.eq(0).data("view"),this._viewChanged(t)):r.ui.button&&s.length>1?(this.options.views.remember&&r.cookie&&(t=r.cookie("plupload_ui_view")),~n.inArray(t,["list","thumbs"])||(t=this.options.views.active),i.show().buttonset().find(".ui-button").click(function(n){t=r(this).data("view"),e._viewChanged(t),n.preventDefault()}),o=i.find('[for="'+e.id+"_view_"+t+'"]'),o.length&&o.trigger("click")):(i.show(),this._viewChanged(this.options.views.active))},_enableRenaming:function(){var e=this;this.filelist.dblclick(function(t){var n=r(t.target),i,s,o,u,a="";if(!n.hasClass("plupload_file_namespan"))return;s=e.uploader.getFile(n.closest(".plupload_file")[0].id),u=s.name,o=/^(.+)(\.[^.]+)$/.exec(u),o&&(u=o[1],a=o[2]),i=r('<input class="plupload_file_rename" type="text" />').width(n.width()).insertAfter(n.hide()),i.val(u).blur(function(){n.show().parent().scrollLeft(0).end().next().remove()}).keydown(function(e){var t=r(this);r.inArray(e.keyCode,[13,27])!==-1&&(e.preventDefault(),e.keyCode===13&&(s.name=t.val()+a,n.html(s.name)),t.blur())})[0].focus()})},_enableSortingList:function(){var e=this,t=r(".plupload_filelist_content",this.element);if(r(".plupload_file",t).length<2)return;t.sortable({items:".plupload_delete",cancel:"object, .plupload_clearer",stop:function(){var t=[];r.each(r(this).sortable("toArray"),function(n,r){t[t.length]=e.uploader.getFile(r)}),t.unshift(t.length),t.unshift(0),Array.prototype.splice.apply(e.uploader.files,t)}})}})})(window,document,plupload,jQuery);
Metrakit/jsdelivr
files/plupload/2.0.0/jquery.ui.plupload/jquery.ui.plupload.min.js
JavaScript
mit
16,647
/* automatically generated by JSCoverage - do not edit */ if (typeof _$jscoverage === 'undefined') _$jscoverage = {}; if (! _$jscoverage['proto.js']) { _$jscoverage['proto.js'] = []; _$jscoverage['proto.js'][13] = 0; _$jscoverage['proto.js'][19] = 0; _$jscoverage['proto.js'][23] = 0; _$jscoverage['proto.js'][62] = 0; _$jscoverage['proto.js'][64] = 0; _$jscoverage['proto.js'][65] = 0; _$jscoverage['proto.js'][66] = 0; _$jscoverage['proto.js'][70] = 0; _$jscoverage['proto.js'][71] = 0; _$jscoverage['proto.js'][72] = 0; _$jscoverage['proto.js'][73] = 0; _$jscoverage['proto.js'][74] = 0; _$jscoverage['proto.js'][79] = 0; _$jscoverage['proto.js'][80] = 0; _$jscoverage['proto.js'][84] = 0; _$jscoverage['proto.js'][85] = 0; _$jscoverage['proto.js'][89] = 0; _$jscoverage['proto.js'][90] = 0; _$jscoverage['proto.js'][92] = 0; _$jscoverage['proto.js'][102] = 0; _$jscoverage['proto.js'][103] = 0; _$jscoverage['proto.js'][109] = 0; _$jscoverage['proto.js'][110] = 0; _$jscoverage['proto.js'][112] = 0; _$jscoverage['proto.js'][113] = 0; _$jscoverage['proto.js'][114] = 0; _$jscoverage['proto.js'][117] = 0; _$jscoverage['proto.js'][118] = 0; _$jscoverage['proto.js'][119] = 0; _$jscoverage['proto.js'][122] = 0; _$jscoverage['proto.js'][125] = 0; _$jscoverage['proto.js'][127] = 0; _$jscoverage['proto.js'][130] = 0; _$jscoverage['proto.js'][132] = 0; _$jscoverage['proto.js'][133] = 0; _$jscoverage['proto.js'][136] = 0; _$jscoverage['proto.js'][139] = 0; _$jscoverage['proto.js'][144] = 0; _$jscoverage['proto.js'][145] = 0; _$jscoverage['proto.js'][146] = 0; _$jscoverage['proto.js'][147] = 0; _$jscoverage['proto.js'][148] = 0; _$jscoverage['proto.js'][149] = 0; _$jscoverage['proto.js'][151] = 0; _$jscoverage['proto.js'][152] = 0; _$jscoverage['proto.js'][153] = 0; _$jscoverage['proto.js'][154] = 0; _$jscoverage['proto.js'][155] = 0; _$jscoverage['proto.js'][157] = 0; _$jscoverage['proto.js'][160] = 0; _$jscoverage['proto.js'][161] = 0; _$jscoverage['proto.js'][162] = 0; _$jscoverage['proto.js'][165] = 0; _$jscoverage['proto.js'][167] = 0; _$jscoverage['proto.js'][168] = 0; _$jscoverage['proto.js'][172] = 0; _$jscoverage['proto.js'][173] = 0; _$jscoverage['proto.js'][176] = 0; _$jscoverage['proto.js'][177] = 0; _$jscoverage['proto.js'][178] = 0; _$jscoverage['proto.js'][181] = 0; _$jscoverage['proto.js'][182] = 0; _$jscoverage['proto.js'][183] = 0; _$jscoverage['proto.js'][184] = 0; _$jscoverage['proto.js'][185] = 0; _$jscoverage['proto.js'][187] = 0; _$jscoverage['proto.js'][189] = 0; _$jscoverage['proto.js'][190] = 0; _$jscoverage['proto.js'][192] = 0; _$jscoverage['proto.js'][195] = 0; _$jscoverage['proto.js'][198] = 0; _$jscoverage['proto.js'][227] = 0; _$jscoverage['proto.js'][228] = 0; _$jscoverage['proto.js'][229] = 0; } _$jscoverage['proto.js'][13]++; var http = require("http"), utils = require("./utils"), debug = require("debug")("connect:dispatcher"); _$jscoverage['proto.js'][19]++; var app = module.exports = {}; _$jscoverage['proto.js'][23]++; var env = process.env.NODE_ENV || "development"; _$jscoverage['proto.js'][62]++; app.use = (function (route, fn) { _$jscoverage['proto.js'][64]++; if ("string" != typeof route) { _$jscoverage['proto.js'][65]++; fn = route; _$jscoverage['proto.js'][66]++; route = "/"; } _$jscoverage['proto.js'][70]++; if ("function" == typeof fn.handle) { _$jscoverage['proto.js'][71]++; var server = fn; _$jscoverage['proto.js'][72]++; fn.route = route; _$jscoverage['proto.js'][73]++; fn = (function (req, res, next) { _$jscoverage['proto.js'][74]++; server.handle(req, res, next); }); } _$jscoverage['proto.js'][79]++; if (fn instanceof http.Server) { _$jscoverage['proto.js'][80]++; fn = fn.listeners("request")[0]; } _$jscoverage['proto.js'][84]++; if ("/" == route[route.length - 1]) { _$jscoverage['proto.js'][85]++; route = route.slice(0, -1); } _$jscoverage['proto.js'][89]++; debug("use %s %s", route || "/", fn.name || "anonymous"); _$jscoverage['proto.js'][90]++; this.stack.push({route: route, handle: fn}); _$jscoverage['proto.js'][92]++; return this; }); _$jscoverage['proto.js'][102]++; app.handle = (function (req, res, out) { _$jscoverage['proto.js'][103]++; var stack = this.stack, fqdn = ~ req.url.indexOf("://"), removed = "", slashAdded = false, index = 0; _$jscoverage['proto.js'][109]++; function next(err) { _$jscoverage['proto.js'][110]++; var layer, path, status, c; _$jscoverage['proto.js'][112]++; if (slashAdded) { _$jscoverage['proto.js'][113]++; req.url = req.url.substr(1); _$jscoverage['proto.js'][114]++; slashAdded = false; } _$jscoverage['proto.js'][117]++; req.url = removed + req.url; _$jscoverage['proto.js'][118]++; req.originalUrl = req.originalUrl || req.url; _$jscoverage['proto.js'][119]++; removed = ""; _$jscoverage['proto.js'][122]++; layer = stack[index++]; _$jscoverage['proto.js'][125]++; if (! layer || res.headerSent) { _$jscoverage['proto.js'][127]++; if (out) { _$jscoverage['proto.js'][127]++; return out(err); } _$jscoverage['proto.js'][130]++; if (err) { _$jscoverage['proto.js'][132]++; if (res.statusCode < 400) { _$jscoverage['proto.js'][132]++; res.statusCode = 500; } _$jscoverage['proto.js'][133]++; debug("default %s", res.statusCode); _$jscoverage['proto.js'][136]++; if (err.status) { _$jscoverage['proto.js'][136]++; res.statusCode = err.status; } _$jscoverage['proto.js'][139]++; var msg = "production" == env? http.STATUS_CODES[res.statusCode]: err.stack || err.toString(); _$jscoverage['proto.js'][144]++; if ("test" != env) { _$jscoverage['proto.js'][144]++; console.error(err.stack || err.toString()); } _$jscoverage['proto.js'][145]++; if (res.headerSent) { _$jscoverage['proto.js'][145]++; return req.socket.destroy(); } _$jscoverage['proto.js'][146]++; res.setHeader("Content-Type", "text/plain"); _$jscoverage['proto.js'][147]++; res.setHeader("Content-Length", Buffer.byteLength(msg)); _$jscoverage['proto.js'][148]++; if ("HEAD" == req.method) { _$jscoverage['proto.js'][148]++; return res.end(); } _$jscoverage['proto.js'][149]++; res.end(msg); } else { _$jscoverage['proto.js'][151]++; debug("default 404"); _$jscoverage['proto.js'][152]++; res.statusCode = 404; _$jscoverage['proto.js'][153]++; res.setHeader("Content-Type", "text/plain"); _$jscoverage['proto.js'][154]++; if ("HEAD" == req.method) { _$jscoverage['proto.js'][154]++; return res.end(); } _$jscoverage['proto.js'][155]++; res.end("Cannot " + req.method + " " + utils.escape(req.originalUrl)); } _$jscoverage['proto.js'][157]++; return; } _$jscoverage['proto.js'][160]++; try { _$jscoverage['proto.js'][161]++; path = utils.parseUrl(req).pathname; _$jscoverage['proto.js'][162]++; if (undefined == path) { _$jscoverage['proto.js'][162]++; path = "/"; } _$jscoverage['proto.js'][165]++; if (0 != path.toLowerCase().indexOf(layer.route.toLowerCase())) { _$jscoverage['proto.js'][165]++; return next(err); } _$jscoverage['proto.js'][167]++; c = path[layer.route.length]; _$jscoverage['proto.js'][168]++; if (c && "/" != c && "." != c) { _$jscoverage['proto.js'][168]++; return next(err); } _$jscoverage['proto.js'][172]++; removed = layer.route; _$jscoverage['proto.js'][173]++; req.url = req.url.substr(removed.length); _$jscoverage['proto.js'][176]++; if (! fqdn && "/" != req.url[0]) { _$jscoverage['proto.js'][177]++; req.url = "/" + req.url; _$jscoverage['proto.js'][178]++; slashAdded = true; } _$jscoverage['proto.js'][181]++; debug("%s", layer.handle.name || "anonymous"); _$jscoverage['proto.js'][182]++; var arity = layer.handle.length; _$jscoverage['proto.js'][183]++; if (err) { _$jscoverage['proto.js'][184]++; if (arity === 4) { _$jscoverage['proto.js'][185]++; layer.handle(err, req, res, next); } else { _$jscoverage['proto.js'][187]++; next(err); } } else { _$jscoverage['proto.js'][189]++; if (arity < 4) { _$jscoverage['proto.js'][190]++; layer.handle(req, res, next); } else { _$jscoverage['proto.js'][192]++; next(); } } } catch (e) { _$jscoverage['proto.js'][195]++; next(e); } } _$jscoverage['proto.js'][198]++; next(); }); _$jscoverage['proto.js'][227]++; app.listen = (function () { _$jscoverage['proto.js'][228]++; var server = http.createServer(this); _$jscoverage['proto.js'][229]++; return server.listen.apply(server, arguments); }); _$jscoverage['proto.js'].source = ["","/*!"," * Connect - HTTPServer"," * Copyright(c) 2010 Sencha Inc."," * Copyright(c) 2011 TJ Holowaychuk"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var http = require('http')"," , utils = require('./utils')"," , debug = require('debug')('connect:dispatcher');","","// prototype","","var app = module.exports = {};","","// environment","","var env = process.env.NODE_ENV || 'development';","","/**"," * Utilize the given middleware `handle` to the given `route`,"," * defaulting to _/_. This \"route\" is the mount-point for the"," * middleware, when given a value other than _/_ the middleware"," * is only effective when that segment is present in the request's"," * pathname."," *"," * For example if we were to mount a function at _/admin_, it would"," * be invoked on _/admin_, and _/admin/settings_, however it would"," * not be invoked for _/_, or _/posts_."," *"," * Examples:"," *"," * var app = connect();"," * app.use(connect.favicon());"," * app.use(connect.logger());"," * app.use(connect.static(__dirname + '/public'));"," *"," * If we wanted to prefix static files with _/public_, we could"," * \"mount\" the `static()` middleware:"," *"," * app.use('/public', connect.static(__dirname + '/public'));"," *"," * This api is chainable, so the following is valid:"," *"," * connect()"," * .use(connect.favicon())"," * .use(connect.logger())"," * .use(connect.static(__dirname + '/public'))"," * .listen(3000);"," *"," * @param {String|Function|Server} route, callback or server"," * @param {Function|Server} callback or server"," * @return {Server} for chaining"," * @api public"," */","","app.use = function(route, fn){"," // default route to '/'"," if ('string' != typeof route) {"," fn = route;"," route = '/';"," }",""," // wrap sub-apps"," if ('function' == typeof fn.handle) {"," var server = fn;"," fn.route = route;"," fn = function(req, res, next){"," server.handle(req, res, next);"," };"," }",""," // wrap vanilla http.Servers"," if (fn instanceof http.Server) {"," fn = fn.listeners('request')[0];"," }",""," // strip trailing slash"," if ('/' == route[route.length - 1]) {"," route = route.slice(0, -1);"," }",""," // add the middleware"," debug('use %s %s', route || '/', fn.name || 'anonymous');"," this.stack.push({ route: route, handle: fn });",""," return this;","};","","/**"," * Handle server requests, punting them down"," * the middleware stack."," *"," * @api private"," */","","app.handle = function(req, res, out) {"," var stack = this.stack"," , fqdn = ~req.url.indexOf('://')"," , removed = ''"," , slashAdded = false"," , index = 0;",""," function next(err) {"," var layer, path, status, c;",""," if (slashAdded) {"," req.url = req.url.substr(1);"," slashAdded = false;"," }",""," req.url = removed + req.url;"," req.originalUrl = req.originalUrl || req.url;"," removed = '';",""," // next callback"," layer = stack[index++];",""," // all done"," if (!layer || res.headerSent) {"," // delegate to parent"," if (out) return out(err);",""," // unhandled error"," if (err) {"," // default to 500"," if (res.statusCode &lt; 400) res.statusCode = 500;"," debug('default %s', res.statusCode);",""," // respect err.status"," if (err.status) res.statusCode = err.status;",""," // production gets a basic error message"," var msg = 'production' == env"," ? http.STATUS_CODES[res.statusCode]"," : err.stack || err.toString();",""," // log to stderr in a non-test env"," if ('test' != env) console.error(err.stack || err.toString());"," if (res.headerSent) return req.socket.destroy();"," res.setHeader('Content-Type', 'text/plain');"," res.setHeader('Content-Length', Buffer.byteLength(msg));"," if ('HEAD' == req.method) return res.end();"," res.end(msg);"," } else {"," debug('default 404');"," res.statusCode = 404;"," res.setHeader('Content-Type', 'text/plain');"," if ('HEAD' == req.method) return res.end();"," res.end('Cannot ' + req.method + ' ' + utils.escape(req.originalUrl));"," }"," return;"," }",""," try {"," path = utils.parseUrl(req).pathname;"," if (undefined == path) path = '/';",""," // skip this layer if the route doesn't match."," if (0 != path.toLowerCase().indexOf(layer.route.toLowerCase())) return next(err);",""," c = path[layer.route.length];"," if (c &amp;&amp; '/' != c &amp;&amp; '.' != c) return next(err);",""," // Call the layer handler"," // Trim off the part of the url that matches the route"," removed = layer.route;"," req.url = req.url.substr(removed.length);",""," // Ensure leading slash"," if (!fqdn &amp;&amp; '/' != req.url[0]) {"," req.url = '/' + req.url;"," slashAdded = true;"," }",""," debug('%s', layer.handle.name || 'anonymous');"," var arity = layer.handle.length;"," if (err) {"," if (arity === 4) {"," layer.handle(err, req, res, next);"," } else {"," next(err);"," }"," } else if (arity &lt; 4) {"," layer.handle(req, res, next);"," } else {"," next();"," }"," } catch (e) {"," next(e);"," }"," }"," next();","};","","/**"," * Listen for connections."," *"," * This method takes the same arguments"," * as node's `http.Server#listen()`. "," *"," * HTTP and HTTPS:"," *"," * If you run your application both as HTTP"," * and HTTPS you may wrap them individually,"," * since your Connect \"server\" is really just"," * a JavaScript `Function`."," *"," * var connect = require('connect')"," * , http = require('http')"," * , https = require('https');"," * "," * var app = connect();"," * "," * http.createServer(app).listen(80);"," * https.createServer(options, app).listen(443);"," *"," * @return {http.Server}"," * @api public"," */","","app.listen = function(){"," var server = http.createServer(this);"," return server.listen.apply(server, arguments);","};"];
mihaelamj/node-workshop
challenge3/start/node_modules/express/node_modules/connect/lib-cov/proto.js
JavaScript
mit
15,747
(function(){var $,Analyze,Blender,Calculate,Caman,CamanParser,Canvas,Convert,Event,Fiber,Filter,IO,Image,Layer,Log,Logger,PixelInfo,Plugin,Renderer,Root,Store,Util,fs,slice,__hasProp={}.hasOwnProperty,__indexOf=[].indexOf||function(item){for(var i=0,l=this.length;i<l;i++){if(i in this&&this[i]===item)return i;}return-1;},__bind=function(fn,me){return function(){return fn.apply(me,arguments);};},__slice=[].slice;slice=Array.prototype.slice;$=function(sel,root){if(root==null){root=document;} if(typeof sel==="object"||(typeof exports!=="undefined"&&exports!==null)){return sel;} return root.querySelector(sel);};Util=(function(){function Util(){} Util.uniqid=(function(){var id;id=0;return{get:function(){return id++;}};})();Util.extend=function(obj){var copy,dest,prop,src,_i,_len;dest=obj;src=slice.call(arguments,1);for(_i=0,_len=src.length;_i<_len;_i++){copy=src[_i];for(prop in copy){if(!__hasProp.call(copy,prop))continue;dest[prop]=copy[prop];}} return dest;};Util.clampRGB=function(val){if(val<0){return 0;} if(val>255){return 255;} return val;};Util.copyAttributes=function(from,to,opts){var attr,_i,_len,_ref,_ref1,_results;if(opts==null){opts={};} _ref=from.attributes;_results=[];for(_i=0,_len=_ref.length;_i<_len;_i++){attr=_ref[_i];if((opts.except!=null)&&(_ref1=attr.nodeName,__indexOf.call(opts.except,_ref1)>=0)){continue;} _results.push(to.setAttribute(attr.nodeName,attr.nodeValue));} return _results;};return Util;})();if(typeof exports!=="undefined"&&exports!==null){Root=exports;Canvas=require('canvas');Image=Canvas.Image;Fiber=require('fibers');fs=require('fs');}else{Root=window;} Root.Caman=Caman=(function(){Caman.version={release:"4.1.0",date:"2/12/2013"};Caman.DEBUG=false;Caman.NodeJS=typeof exports!=="undefined"&&exports!==null;Caman.autoload=!Caman.NodeJS;Caman.allowRevert=true;Caman.crossOrigin="anonymous";Caman.toString=function(){return"Version "+Caman.version.release+", Released "+Caman.version.date;};Caman.remoteProxy="";Caman.proxyParam="camanProxyUrl";Caman.getAttrId=function(canvas){if(Caman.NodeJS){return true;} if(typeof canvas==="string"){canvas=$(canvas);} if(!((canvas!=null)&&(canvas.getAttribute!=null))){return null;} return canvas.getAttribute('data-caman-id');};function Caman(){var args,callback,id,_this=this;if(arguments.length===0){throw"Invalid arguments";} if(this instanceof Caman){this.finishInit=this.finishInit.bind(this);this.imageLoaded=this.imageLoaded.bind(this);args=arguments[0];if(!Caman.NodeJS){id=parseInt(Caman.getAttrId(args[0]),10);callback=typeof args[1]==="function"?args[1]:typeof args[2]==="function"?args[2]:function(){};if(!isNaN(id)&&Store.has(id)){return Store.execute(id,callback);}} this.id=Util.uniqid.get();this.initializedPixelData=this.originalPixelData=null;this.cropCoordinates={x:0,y:0};this.cropped=false;this.resized=false;this.pixelStack=[];this.layerStack=[];this.canvasQueue=[];this.currentLayer=null;this.scaled=false;this.analyze=new Analyze(this);this.renderer=new Renderer(this);this.domIsLoaded(function(){_this.parseArguments(args);return _this.setup();});return this;}else{return new Caman(arguments);}} Caman.prototype.domIsLoaded=function(cb){var listener,_this=this;if(Caman.NodeJS){return setTimeout(function(){return cb.call(_this);},0);}else{if(document.readyState==="complete"){Log.debug("DOM initialized");return setTimeout(function(){return cb.call(_this);},0);}else{listener=function(){if(document.readyState==="complete"){Log.debug("DOM initialized");return cb.call(_this);}};return document.addEventListener("readystatechange",listener,false);}}};Caman.prototype.parseArguments=function(args){var key,val,_ref,_results;if(args.length===0){throw"Invalid arguments given";} this.initObj=null;this.initType=null;this.imageUrl=null;this.callback=function(){};this.setInitObject(args[0]);if(args.length===1){return;} switch(typeof args[1]){case"string":this.imageUrl=args[1];break;case"function":this.callback=args[1];} if(args.length===2){return;} this.callback=args[2];if(args.length===4){_ref=args[4];_results=[];for(key in _ref){if(!__hasProp.call(_ref,key))continue;val=_ref[key];_results.push(this.options[key]=val);} return _results;}};Caman.prototype.setInitObject=function(obj){if(Caman.NodeJS){this.initObj=obj;this.initType='node';return;} if(typeof obj==="object"){this.initObj=obj;}else{this.initObj=$(obj);} return this.initType=this.initObj.nodeName.toLowerCase();};Caman.prototype.setup=function(){switch(this.initType){case"node":return this.initNode();case"img":return this.initImage();case"canvas":return this.initCanvas();}};Caman.prototype.initNode=function(){var _this=this;Log.debug("Initializing for NodeJS");this.image=new Image();this.image.onload=function(){Log.debug("Image loaded. Width = "+_this.image.width+", Height = "+_this.image.height);_this.canvas=new Canvas(_this.image.width,_this.image.height);return _this.finishInit();};this.image.onerror=function(err){throw err;};return this.image.src=this.initObj;};Caman.prototype.initImage=function(){this.image=this.initObj;this.canvas=document.createElement('canvas');this.context=this.canvas.getContext('2d');Util.copyAttributes(this.image,this.canvas,{except:['src']});this.image.parentNode.replaceChild(this.canvas,this.image);this.imageAdjustments();return this.waitForImageLoaded();};Caman.prototype.initCanvas=function(){this.canvas=this.initObj;this.context=this.canvas.getContext('2d');if(this.imageUrl!=null){this.image=document.createElement('img');this.image.src=this.imageUrl;this.imageAdjustments();return this.waitForImageLoaded();}else{return this.finishInit();}};Caman.prototype.imageAdjustments=function(){if(this.needsHiDPISwap()){Log.debug(this.image.src,"->",this.hiDPIReplacement());this.swapped=true;this.image.src=this.hiDPIReplacement();} if(IO.isRemote(this.image)){this.image.src=IO.proxyUrl(this.image.src);return Log.debug("Remote image detected, using URL = "+this.image.src);}};Caman.prototype.waitForImageLoaded=function(){if(this.image.complete){return this.imageLoaded();}else{return this.image.onload=this.imageLoaded;}};Caman.prototype.imageLoaded=function(){Log.debug("Image loaded. Width = "+this.image.width+", Height = "+this.image.height);if(this.swapped){this.canvas.width=this.image.width/this.hiDPIRatio();this.canvas.height=this.image.height/this.hiDPIRatio();}else{this.canvas.width=this.image.width;this.canvas.height=this.image.height;} return this.finishInit();};Caman.prototype.finishInit=function(){var i,pixel,_i,_len,_ref;if(this.context==null){this.context=this.canvas.getContext('2d');} this.originalWidth=this.preScaledWidth=this.width=this.canvas.width;this.originalHeight=this.preScaledHeight=this.height=this.canvas.height;this.hiDPIAdjustments();if(!this.hasId()){this.assignId();} if(this.image!=null){this.context.drawImage(this.image,0,0,this.image.width,this.image.height,0,0,this.preScaledWidth,this.preScaledHeight);} this.imageData=this.context.getImageData(0,0,this.canvas.width,this.canvas.height);this.pixelData=this.imageData.data;if(Caman.allowRevert){this.initializedPixelData=new Uint8Array(this.pixelData.length);this.originalPixelData=new Uint8Array(this.pixelData.length);_ref=this.pixelData;for(i=_i=0,_len=_ref.length;_i<_len;i=++_i){pixel=_ref[i];this.initializedPixelData[i]=pixel;this.originalPixelData[i]=pixel;}} this.dimensions={width:this.canvas.width,height:this.canvas.height};Store.put(this.id,this);this.callback.call(this,this);return this.callback=function(){};};Caman.prototype.resetOriginalPixelData=function(){var pixel,_i,_len,_ref,_results;if(!Caman.allowRevert){throw"Revert disabled";} this.originalPixelData=new Uint8Array(this.pixelData.length);_ref=this.pixelData;_results=[];for(_i=0,_len=_ref.length;_i<_len;_i++){pixel=_ref[_i];_results.push(this.originalPixelData.push(pixel));} return _results;};Caman.prototype.hasId=function(){return Caman.getAttrId(this.canvas)!=null;};Caman.prototype.assignId=function(){if(Caman.NodeJS||this.canvas.getAttribute('data-caman-id')){return;} return this.canvas.setAttribute('data-caman-id',this.id);};Caman.prototype.hiDPIDisabled=function(){return this.canvas.getAttribute('data-caman-hidpi-disabled')!==null;};Caman.prototype.hiDPIAdjustments=function(){var ratio;if(Caman.NodeJS||this.hiDPIDisabled()){return;} ratio=this.hiDPIRatio();if(ratio!==1){Log.debug("HiDPI ratio = "+ratio);this.scaled=true;this.preScaledWidth=this.canvas.width;this.preScaledHeight=this.canvas.height;this.canvas.width=this.preScaledWidth*ratio;this.canvas.height=this.preScaledHeight*ratio;this.canvas.style.width=""+this.preScaledWidth+"px";this.canvas.style.height=""+this.preScaledHeight+"px";this.context.scale(ratio,ratio);this.width=this.originalWidth=this.canvas.width;return this.height=this.originalHeight=this.canvas.height;}};Caman.prototype.hiDPIRatio=function(){var backingStoreRatio,devicePixelRatio;devicePixelRatio=window.devicePixelRatio||1;backingStoreRatio=this.context.webkitBackingStorePixelRatio||this.context.mozBackingStorePixelRatio||this.context.msBackingStorePixelRatio||this.context.oBackingStorePixelRatio||this.context.backingStorePixelRatio||1;return devicePixelRatio/backingStoreRatio;};Caman.prototype.hiDPICapable=function(){return window.devicePixelRatio!==1;};Caman.prototype.needsHiDPISwap=function(){if(this.hiDPIDisabled()||!this.hiDPICapable()){return false;} return this.hiDPIReplacement()!==null;};Caman.prototype.hiDPIReplacement=function(){if(this.image==null){return null;} return this.image.getAttribute('data-caman-hidpi');};Caman.prototype.replaceCanvas=function(newCanvas){var oldCanvas;oldCanvas=this.canvas;this.canvas=newCanvas;this.context=this.canvas.getContext('2d');oldCanvas.parentNode.replaceChild(this.canvas,oldCanvas);this.width=this.canvas.width;this.height=this.canvas.height;this.imageData=this.context.getImageData(0,0,this.canvas.width,this.canvas.height);this.pixelData=this.imageData.data;return this.dimensions={width:this.canvas.width,height:this.canvas.height};};Caman.prototype.render=function(callback){var _this=this;if(callback==null){callback=function(){};} Event.trigger(this,"renderStart");return this.renderer.execute(function(){_this.context.putImageData(_this.imageData,0,0);return callback.call(_this);});};Caman.prototype.revert=function(){var i,pixel,_i,_len,_ref;if(!Caman.allowRevert){throw"Revert disabled";} _ref=this.originalVisiblePixels();for(i=_i=0,_len=_ref.length;_i<_len;i=++_i){pixel=_ref[i];this.pixelData[i]=pixel;} return this.context.putImageData(this.imageData,0,0);};Caman.prototype.reset=function(){var canvas,ctx,i,imageData,pixel,pixelData,_i,_len,_ref;canvas=document.createElement('canvas');Util.copyAttributes(this.canvas,canvas);canvas.width=this.originalWidth;canvas.height=this.originalHeight;ctx=canvas.getContext('2d');imageData=ctx.getImageData(0,0,canvas.width,canvas.height);pixelData=imageData.data;_ref=this.initializedPixelData;for(i=_i=0,_len=_ref.length;_i<_len;i=++_i){pixel=_ref[i];pixelData[i]=pixel;} ctx.putImageData(imageData,0,0);this.cropCoordinates={x:0,y:0};this.resized=false;return this.replaceCanvas(canvas);};Caman.prototype.originalVisiblePixels=function(){var canvas,coord,ctx,endX,endY,i,imageData,pixel,pixelData,pixels,scaledCanvas,startX,startY,width,_i,_j,_len,_ref,_ref1,_ref2,_ref3;if(!Caman.allowRevert){throw"Revert disabled";} pixels=[];startX=this.cropCoordinates.x;endX=startX+this.width;startY=this.cropCoordinates.y;endY=startY+this.height;if(this.resized){canvas=document.createElement('canvas');canvas.width=this.originalWidth;canvas.height=this.originalHeight;ctx=canvas.getContext('2d');imageData=ctx.getImageData(0,0,canvas.width,canvas.height);pixelData=imageData.data;_ref=this.originalPixelData;for(i=_i=0,_len=_ref.length;_i<_len;i=++_i){pixel=_ref[i];pixelData[i]=pixel;} ctx.putImageData(imageData,0,0);scaledCanvas=document.createElement('canvas');scaledCanvas.width=this.width;scaledCanvas.height=this.height;ctx=scaledCanvas.getContext('2d');ctx.drawImage(canvas,0,0,this.originalWidth,this.originalHeight,0,0,this.width,this.height);pixelData=ctx.getImageData(0,0,this.width,this.height).data;width=this.width;}else{pixelData=this.originalPixelData;width=this.originalWidth;} for(i=_j=0,_ref1=pixelData.length;_j<_ref1;i=_j+=4){coord=PixelInfo.locationToCoordinates(i,width);if(((startX<=(_ref2=coord.x)&&_ref2<endX))&&((startY<=(_ref3=coord.y)&&_ref3<endY))){pixels.push(pixelData[i],pixelData[i+1],pixelData[i+2],pixelData[i+3]);}} return pixels;};Caman.prototype.process=function(name,processFn){this.renderer.add({type:Filter.Type.Single,name:name,processFn:processFn});return this;};Caman.prototype.processKernel=function(name,adjust,divisor,bias){var i,_i,_ref;if(!divisor){divisor=0;for(i=_i=0,_ref=adjust.length;0<=_ref?_i<_ref:_i>_ref;i=0<=_ref?++_i:--_i){divisor+=adjust[i];}} this.renderer.add({type:Filter.Type.Kernel,name:name,adjust:adjust,divisor:divisor,bias:bias||0});return this;};Caman.prototype.processPlugin=function(plugin,args){this.renderer.add({type:Filter.Type.Plugin,plugin:plugin,args:args});return this;};Caman.prototype.newLayer=function(callback){var layer;layer=new Layer(this);this.canvasQueue.push(layer);this.renderer.add({type:Filter.Type.LayerDequeue});callback.call(layer);this.renderer.add({type:Filter.Type.LayerFinished});return this;};Caman.prototype.executeLayer=function(layer){return this.pushContext(layer);};Caman.prototype.pushContext=function(layer){this.layerStack.push(this.currentLayer);this.pixelStack.push(this.pixelData);this.currentLayer=layer;return this.pixelData=layer.pixelData;};Caman.prototype.popContext=function(){this.pixelData=this.pixelStack.pop();return this.currentLayer=this.layerStack.pop();};Caman.prototype.applyCurrentLayer=function(){return this.currentLayer.applyToParent();};return Caman;})();Analyze=(function(){function Analyze(c){this.c=c;} Analyze.prototype.calculateLevels=function(){var i,levels,numPixels,_i,_j,_k,_ref;levels={r:{},g:{},b:{}};for(i=_i=0;_i<=255;i=++_i){levels.r[i]=0;levels.g[i]=0;levels.b[i]=0;} for(i=_j=0,_ref=this.c.pixelData.length;_j<_ref;i=_j+=4){levels.r[this.c.pixelData[i]]++;levels.g[this.c.pixelData[i+1]]++;levels.b[this.c.pixelData[i+2]]++;} numPixels=this.c.pixelData.length/4;for(i=_k=0;_k<=255;i=++_k){levels.r[i]/=numPixels;levels.g[i]/=numPixels;levels.b[i]/=numPixels;} return levels;};return Analyze;})();Caman.DOMUpdated=function(){var img,imgs,parser,_i,_len,_results;imgs=document.querySelectorAll("img[data-caman]");if(!(imgs.length>0)){return;} _results=[];for(_i=0,_len=imgs.length;_i<_len;_i++){img=imgs[_i];_results.push(parser=new CamanParser(img,function(){this.parse();return this.execute();}));} return _results;};if(Caman.autoload){(function(){if(document.readyState==="complete"){return Caman.DOMUpdated();}else{return document.addEventListener("DOMContentLoaded",Caman.DOMUpdated,false);}})();} CamanParser=(function(){var INST_REGEX;INST_REGEX="(\\w+)\\((.*?)\\)";function CamanParser(ele,ready){this.dataStr=ele.getAttribute('data-caman');this.caman=Caman(ele,ready.bind(this));} CamanParser.prototype.parse=function(){var args,filter,func,inst,instFunc,m,r,unparsedInstructions,_i,_len,_ref,_results;this.ele=this.caman.canvas;r=new RegExp(INST_REGEX,'g');unparsedInstructions=this.dataStr.match(r);if(!(unparsedInstructions.length>0)){return;} r=new RegExp(INST_REGEX);_results=[];for(_i=0,_len=unparsedInstructions.length;_i<_len;_i++){inst=unparsedInstructions[_i];_ref=inst.match(r),m=_ref[0],filter=_ref[1],args=_ref[2];instFunc=new Function("return function() { this."+filter+"("+args+"); };");try{func=instFunc();_results.push(func.call(this.caman));}catch(e){_results.push(Log.debug(e));}} return _results;};CamanParser.prototype.execute=function(){var ele;ele=this.ele;return this.caman.render(function(){return ele.parentNode.replaceChild(this.toImage(),ele);});};return CamanParser;})();Caman.Blender=Blender=(function(){function Blender(){} Blender.blenders={};Blender.register=function(name,func){return this.blenders[name]=func;};Blender.execute=function(name,rgbaLayer,rgbaParent){return this.blenders[name](rgbaLayer,rgbaParent);};return Blender;})();Caman.Calculate=Calculate=(function(){function Calculate(){} Calculate.distance=function(x1,y1,x2,y2){return Math.sqrt(Math.pow(x2-x1,2)+Math.pow(y2-y1,2));};Calculate.randomRange=function(min,max,getFloat){var rand;if(getFloat==null){getFloat=false;} rand=min+(Math.random()*(max-min));if(getFloat){return rand.toFixed(getFloat);}else{return Math.round(rand);}};Calculate.luminance=function(rgba){return(0.299*rgba.r)+(0.587*rgba.g)+(0.114*rgba.b);};Calculate.bezier=function(start,ctrl1,ctrl2,end,lowBound,highBound){var Ax,Ay,Bx,By,Cx,Cy,bezier,curveX,curveY,i,j,leftCoord,rightCoord,t,x0,x1,x2,x3,y0,y1,y2,y3,_i,_j,_k,_ref,_ref1;x0=start[0];y0=start[1];x1=ctrl1[0];y1=ctrl1[1];x2=ctrl2[0];y2=ctrl2[1];x3=end[0];y3=end[1];bezier={};Cx=parseInt(3*(x1-x0),10);Bx=3*(x2-x1)-Cx;Ax=x3-x0-Cx-Bx;Cy=3*(y1-y0);By=3*(y2-y1)-Cy;Ay=y3-y0-Cy-By;for(i=_i=0;_i<1000;i=++_i){t=i/1000;curveX=Math.round((Ax*Math.pow(t,3))+(Bx*Math.pow(t,2))+(Cx*t)+x0);curveY=Math.round((Ay*Math.pow(t,3))+(By*Math.pow(t,2))+(Cy*t)+y0);if(lowBound&&curveY<lowBound){curveY=lowBound;}else if(highBound&&curveY>highBound){curveY=highBound;} bezier[curveX]=curveY;} if(bezier.length<end[0]+1){for(i=_j=0,_ref=end[0];0<=_ref?_j<=_ref:_j>=_ref;i=0<=_ref?++_j:--_j){if(!(bezier[i]!=null)){leftCoord=[i-1,bezier[i-1]];for(j=_k=i,_ref1=end[0];i<=_ref1?_k<=_ref1:_k>=_ref1;j=i<=_ref1?++_k:--_k){if(bezier[j]!=null){rightCoord=[j,bezier[j]];break;}} bezier[i]=leftCoord[1]+((rightCoord[1]-leftCoord[1])/(rightCoord[0]-leftCoord[0]))*(i-leftCoord[0]);}}} if(!(bezier[end[0]]!=null)){bezier[end[0]]=bezier[end[0]-1];} return bezier;};return Calculate;})();Convert=(function(){function Convert(){} Convert.hexToRGB=function(hex){var b,g,r;if(hex.charAt(0)==="#"){hex=hex.substr(1);} r=parseInt(hex.substr(0,2),16);g=parseInt(hex.substr(2,2),16);b=parseInt(hex.substr(4,2),16);return{r:r,g:g,b:b};};Convert.rgbToHSL=function(r,g,b){var d,h,l,max,min,s;if(typeof r==="object"){g=r.g;b=r.b;r=r.r;} r/=255;g/=255;b/=255;max=Math.max(r,g,b);min=Math.min(r,g,b);l=(max+min)/2;if(max===min){h=s=0;}else{d=max-min;s=l>0.5?d/(2-max-min):d/(max+min);h=(function(){switch(max){case r:return(g-b)/d+(g<b?6:0);case g:return(b-r)/d+2;case b:return(r-g)/d+4;}})();h/=6;} return{h:h,s:s,l:l};};Convert.hslToRGB=function(h,s,l){var b,g,p,q,r;if(typeof h==="object"){s=h.s;l=h.l;h=h.h;} if(s===0){r=g=b=l;}else{q=l<0.5?l*(1+s):l+s-l*s;p=2*l-q;r=this.hueToRGB(p,q,h+1/3);g=this.hueToRGB(p,q,h);b=this.hueToRGB(p,q,h-1/3);} return{r:r*255,g:g*255,b:b*255};};Convert.hueToRGB=function(p,q,t){if(t<0){t+=1;} if(t>1){t-=1;} if(t<1/6){return p+(q-p)*6*t;} if(t<1/2){return q;} if(t<2/3){return p+(q-p)*(2/3-t)*6;} return p;};Convert.rgbToHSV=function(r,g,b){var d,h,max,min,s,v;r/=255;g/=255;b/=255;max=Math.max(r,g,b);min=Math.min(r,g,b);v=max;d=max-min;s=max===0?0:d/max;if(max===min){h=0;}else{h=(function(){switch(max){case r:return(g-b)/d+(g<b?6:0);case g:return(b-r)/d+2;case b:return(r-g)/d+4;}})();h/=6;} return{h:h,s:s,v:v};};Convert.hsvToRGB=function(h,s,v){var b,f,g,i,p,q,r,t;i=Math.floor(h*6);f=h*6-i;p=v*(1-s);q=v*(1-f*s);t=v*(1-(1-f)*s);switch(i%6){case 0:r=v;g=t;b=p;break;case 1:r=q;g=v;b=p;break;case 2:r=p;g=v;b=t;break;case 3:r=p;g=q;b=v;break;case 4:r=t;g=p;b=v;break;case 5:r=v;g=p;b=q;} return{r:r*255,g:g*255,b:b*255};};Convert.rgbToXYZ=function(r,g,b){var x,y,z;r/=255;g/=255;b/=255;if(r>0.04045){r=Math.pow((r+0.055)/1.055,2.4);}else{r/=12.92;} if(g>0.04045){g=Math.pow((g+0.055)/1.055,2.4);}else{g/=12.92;} if(b>0.04045){b=Math.pow((b+0.055)/1.055,2.4);}else{b/=12.92;} x=r*0.4124+g*0.3576+b*0.1805;y=r*0.2126+g*0.7152+b*0.0722;z=r*0.0193+g*0.1192+b*0.9505;return{x:x*100,y:y*100,z:z*100};};Convert.xyzToRGB=function(x,y,z){var b,g,r;x/=100;y/=100;z/=100;r=(3.2406*x)+(-1.5372*y)+(-0.4986*z);g=(-0.9689*x)+(1.8758*y)+(0.0415*z);b=(0.0557*x)+(-0.2040*y)+(1.0570*z);if(r>0.0031308){r=(1.055*Math.pow(r,0.4166666667))-0.055;}else{r*=12.92;} if(g>0.0031308){g=(1.055*Math.pow(g,0.4166666667))-0.055;}else{g*=12.92;} if(b>0.0031308){b=(1.055*Math.pow(b,0.4166666667))-0.055;}else{b*=12.92;} return{r:r*255,g:g*255,b:b*255};};Convert.xyzToLab=function(x,y,z){var a,b,l,whiteX,whiteY,whiteZ;if(typeof x==="object"){y=x.y;z=x.z;x=x.x;} whiteX=95.047;whiteY=100.0;whiteZ=108.883;x/=whiteX;y/=whiteY;z/=whiteZ;if(x>0.008856451679){x=Math.pow(x,0.3333333333);}else{x=(7.787037037*x)+0.1379310345;} if(y>0.008856451679){y=Math.pow(y,0.3333333333);}else{y=(7.787037037*y)+0.1379310345;} if(z>0.008856451679){z=Math.pow(z,0.3333333333);}else{z=(7.787037037*z)+0.1379310345;} l=116*y-16;a=500*(x-y);b=200*(y-z);return{l:l,a:a,b:b};};Convert.labToXYZ=function(l,a,b){var x,y,z;if(typeof l==="object"){a=l.a;b=l.b;l=l.l;} y=(l+16)/116;x=y+(a/500);z=y-(b/200);if(x>0.2068965517){x=x*x*x;}else{x=0.1284185493*(x-0.1379310345);} if(y>0.2068965517){y=y*y*y;}else{y=0.1284185493*(y-0.1379310345);} if(z>0.2068965517){z=z*z*z;}else{z=0.1284185493*(z-0.1379310345);} return{x:x*95.047,y:y*100.0,z:z*108.883};};Convert.rgbToLab=function(r,g,b){var xyz;if(typeof r==="object"){g=r.g;b=r.b;r=r.r;} xyz=this.rgbToXYZ(r,g,b);return this.xyzToLab(xyz);};Convert.labToRGB=function(l,a,b){};return Convert;})();Event=(function(){function Event(){} Event.events={};Event.types=["processStart","processComplete","renderStart","renderFinished","blockStarted","blockFinished"];Event.trigger=function(target,type,data){var event,_i,_len,_ref,_results;if(this.events[type]&&this.events[type].length){_ref=this.events[type];_results=[];for(_i=0,_len=_ref.length;_i<_len;_i++){event=_ref[_i];if(event.target===null||target.id===event.target.id){_results.push(event.fn.call(target,data));}else{_results.push(void 0);}} return _results;}};Event.listen=function(target,type,fn){var _fn,_type;if(typeof target==="string"){_type=target;_fn=type;target=null;type=_type;fn=_fn;} if(__indexOf.call(this.types,type)<0){return false;} if(!this.events[type]){this.events[type]=[];} this.events[type].push({target:target,fn:fn});return true;};return Event;})();Caman.Event=Event;Caman.Filter=Filter=(function(){function Filter(){} Filter.Type={Single:1,Kernel:2,LayerDequeue:3,LayerFinished:4,LoadOverlay:5,Plugin:6};Filter.register=function(name,filterFunc){return Caman.prototype[name]=filterFunc;};return Filter;})();Caman.IO=IO=(function(){function IO(){} IO.domainRegex=/(?:(?:http|https):\/\/)((?:\w+)\.(?:(?:\w|\.)+))/;IO.isRemote=function(img){var matches;if(img==null){return false;} if(this.corsEnabled(img)){return false;} matches=img.src.match(this.domainRegex);if(matches){return matches[1]!==document.domain;}else{return false;}};IO.corsEnabled=function(img){var _ref;return(img.crossOrigin!=null)&&((_ref=img.crossOrigin.toLowerCase())==='anonymous'||_ref==='use-credentials');};IO.proxyUrl=function(src){return""+Caman.remoteProxy+"?"+Caman.proxyParam+"="+(encodeURIComponent(src));};IO.useProxy=function(lang){var langToExt;langToExt={ruby:'rb',python:'py',perl:'pl',javascript:'js'};lang=lang.toLowerCase();if(langToExt[lang]!=null){lang=langToExt[lang];} return"proxies/caman_proxy."+lang;};return IO;})();Caman.prototype.save=function(){if(typeof exports!=="undefined"&&exports!==null){return this.nodeSave.apply(this,arguments);}else{return this.browserSave.apply(this,arguments);}};Caman.prototype.browserSave=function(type){var image;if(type==null){type="png";} type=type.toLowerCase();image=this.toBase64(type).replace("image/"+type,"image/octet-stream");return document.location.href=image;};Caman.prototype.nodeSave=function(file,overwrite){var stats;if(overwrite==null){overwrite=true;} try{stats=fs.statSync(file);if(stats.isFile()&&!overwrite){return false;}}catch(e){Log.debug("Creating output file "+file);} return fs.writeFile(file,this.canvas.toBuffer(),function(){return Log.debug("Finished writing to "+file);});};Caman.prototype.toImage=function(type){var img;img=document.createElement('img');img.src=this.toBase64(type);img.width=this.dimensions.width;img.height=this.dimensions.height;if(window.devicePixelRatio){img.width/=window.devicePixelRatio;img.height/=window.devicePixelRatio;} return img;};Caman.prototype.toBase64=function(type){if(type==null){type="png";} type=type.toLowerCase();return this.canvas.toDataURL("image/"+type);};Layer=(function(){function Layer(c){this.c=c;this.filter=this.c;this.options={blendingMode:'normal',opacity:1.0};this.layerID=Util.uniqid.get();this.canvas=typeof exports!=="undefined"&&exports!==null?new Canvas():document.createElement('canvas');this.canvas.width=this.c.dimensions.width;this.canvas.height=this.c.dimensions.height;this.context=this.canvas.getContext('2d');this.context.createImageData(this.canvas.width,this.canvas.height);this.imageData=this.context.getImageData(0,0,this.canvas.width,this.canvas.height);this.pixelData=this.imageData.data;} Layer.prototype.newLayer=function(cb){return this.c.newLayer.call(this.c,cb);};Layer.prototype.setBlendingMode=function(mode){this.options.blendingMode=mode;return this;};Layer.prototype.opacity=function(opacity){this.options.opacity=opacity/100;return this;};Layer.prototype.copyParent=function(){var i,parentData,_i,_ref;parentData=this.c.pixelData;for(i=_i=0,_ref=this.c.pixelData.length;_i<_ref;i=_i+=4){this.pixelData[i]=parentData[i];this.pixelData[i+1]=parentData[i+1];this.pixelData[i+2]=parentData[i+2];this.pixelData[i+3]=parentData[i+3];} return this;};Layer.prototype.fillColor=function(){return this.c.fillColor.apply(this.c,arguments);};Layer.prototype.overlayImage=function(image){if(typeof image==="object"){image=image.src;}else if(typeof image==="string"&&image[0]==="#"){image=$(image).src;} if(!image){return this;} this.c.renderQueue.push({type:Filter.Type.LoadOverlay,src:image,layer:this});return this;};Layer.prototype.applyToParent=function(){var i,layerData,parentData,result,rgbaLayer,rgbaParent,_i,_ref,_results;parentData=this.c.pixelStack[this.c.pixelStack.length-1];layerData=this.c.pixelData;_results=[];for(i=_i=0,_ref=layerData.length;_i<_ref;i=_i+=4){rgbaParent={r:parentData[i],g:parentData[i+1],b:parentData[i+2],a:parentData[i+3]};rgbaLayer={r:layerData[i],g:layerData[i+1],b:layerData[i+2],a:layerData[i+3]};result=Blender.execute(this.options.blendingMode,rgbaLayer,rgbaParent);result.r=Util.clampRGB(result.r);result.g=Util.clampRGB(result.g);result.b=Util.clampRGB(result.b);if(!(result.a!=null)){result.a=rgbaLayer.a;} parentData[i]=rgbaParent.r-((rgbaParent.r-result.r)*(this.options.opacity*(result.a/255)));parentData[i+1]=rgbaParent.g-((rgbaParent.g-result.g)*(this.options.opacity*(result.a/255)));_results.push(parentData[i+2]=rgbaParent.b-((rgbaParent.b-result.b)*(this.options.opacity*(result.a/255))));} return _results;};return Layer;})();Logger=(function(){function Logger(){var name,_i,_len,_ref;_ref=['log','info','warn','error'];for(_i=0,_len=_ref.length;_i<_len;_i++){name=_ref[_i];this[name]=(function(name){return function(){if(!Caman.DEBUG){return;} return console[name].apply(console,arguments);};})(name);} this.debug=this.log;} return Logger;})();Log=new Logger();PixelInfo=(function(){PixelInfo.coordinatesToLocation=function(x,y,width){return(y*width+x)*4;};PixelInfo.locationToCoordinates=function(loc,width){var x,y;y=Math.floor(loc/(width*4));x=(loc%(width*4))/4;return{x:x,y:y};};function PixelInfo(c){this.c=c;this.loc=0;} PixelInfo.prototype.locationXY=function(){var x,y;y=this.c.dimensions.height-Math.floor(this.loc/(this.c.dimensions.width*4));x=(this.loc%(this.c.dimensions.width*4))/4;return{x:x,y:y};};PixelInfo.prototype.getPixelRelative=function(horiz,vert){var newLoc;newLoc=this.loc+(this.c.dimensions.width*4*(vert*-1))+(4*horiz);if(newLoc>this.c.pixelData.length||newLoc<0){return{r:0,g:0,b:0,a:0};} return{r:this.c.pixelData[newLoc],g:this.c.pixelData[newLoc+1],b:this.c.pixelData[newLoc+2],a:this.c.pixelData[newLoc+3]};};PixelInfo.prototype.putPixelRelative=function(horiz,vert,rgba){var nowLoc;nowLoc=this.loc+(this.c.dimensions.width*4*(vert*-1))+(4*horiz);if(newLoc>this.c.pixelData.length||newLoc<0){return;} this.c.pixelData[newLoc]=rgba.r;this.c.pixelData[newLoc+1]=rgba.g;this.c.pixelData[newLoc+2]=rgba.b;this.c.pixelData[newLoc+3]=rgba.a;return true;};PixelInfo.prototype.getPixel=function(x,y){var loc;loc=this.coordinatesToLocation(x,y,this.width);return{r:this.c.pixelData[loc],g:this.c.pixelData[loc+1],b:this.c.pixelData[loc+2],a:this.c.pixelData[loc+3]};};PixelInfo.prototype.putPixel=function(x,y,rgba){var loc;loc=this.coordinatesToLocation(x,y,this.width);this.c.pixelData[loc]=rgba.r;this.c.pixelData[loc+1]=rgba.g;this.c.pixelData[loc+2]=rgba.b;return this.c.pixelData[loc+3]=rgba.a;};return PixelInfo;})();Plugin=(function(){function Plugin(){} Plugin.plugins={};Plugin.register=function(name,plugin){return this.plugins[name]=plugin;};Plugin.execute=function(context,name,args){return this.plugins[name].apply(context,args);};return Plugin;})();Caman.Plugin=Plugin;Caman.Renderer=Renderer=(function(){Renderer.Blocks=Caman.NodeJS?require('os').cpus().length:4;function Renderer(c){this.c=c;this.processNext=__bind(this.processNext,this);this.renderQueue=[];this.modPixelData=null;} Renderer.prototype.add=function(job){if(job==null){return;} return this.renderQueue.push(job);};Renderer.prototype.processNext=function(){var layer;if(this.renderQueue.length===0){Event.trigger(this,"renderFinished");if(this.finishedFn!=null){this.finishedFn.call(this.c);} return this;} this.currentJob=this.renderQueue.shift();switch(this.currentJob.type){case Filter.Type.LayerDequeue:layer=this.c.canvasQueue.shift();this.c.executeLayer(layer);return this.processNext();case Filter.Type.LayerFinished:this.c.applyCurrentLayer();this.c.popContext();return this.processNext();case Filter.Type.LoadOverlay:return this.loadOverlay(this.currentJob.layer,this.currentJob.src);case Filter.Type.Plugin:return this.executePlugin();default:return this.executeFilter();}};Renderer.prototype.execute=function(callback){this.finishedFn=callback;this.modPixelData=new Uint8Array(this.c.pixelData.length);return this.processNext();};Renderer.prototype.eachBlock=function(fn){var blockN,blockPixelLength,end,f,i,lastBlockN,n,start,_i,_ref,_results,_this=this;this.blocksDone=0;n=this.c.pixelData.length;blockPixelLength=Math.floor((n/4)/Renderer.Blocks);blockN=blockPixelLength*4;lastBlockN=blockN+((n/4)%Renderer.Blocks)*4;_results=[];for(i=_i=0,_ref=Renderer.Blocks;0<=_ref?_i<_ref:_i>_ref;i=0<=_ref?++_i:--_i){start=i*blockN;end=start+(i===Renderer.Blocks-1?lastBlockN:blockN);if(Caman.NodeJS){f=Fiber(function(){return fn.call(_this,i,start,end);});_results.push(f.run());}else{_results.push(setTimeout((function(i,start,end){return function(){return fn.call(_this,i,start,end);};})(i,start,end),0));}} return _results;};Renderer.prototype.executeFilter=function(){Event.trigger(this.c,"processStart",this.currentJob);if(this.currentJob.type===Filter.Type.Single){return this.eachBlock(this.renderBlock);}else{return this.eachBlock(this.renderKernel);}};Renderer.prototype.executePlugin=function(){Log.debug("Executing plugin "+this.currentJob.plugin);Plugin.execute(this.c,this.currentJob.plugin,this.currentJob.args);Log.debug("Plugin "+this.currentJob.plugin+" finished!");return this.processNext();};Renderer.prototype.renderBlock=function(bnum,start,end){var data,i,pixelInfo,res,_i;Log.debug("Block #"+bnum+" - Filter: "+this.currentJob.name+", Start: "+start+", End: "+end);Event.trigger(this.c,"blockStarted",{blockNum:bnum,totalBlocks:Renderer.Blocks,startPixel:start,endPixel:end});data={r:0,g:0,b:0,a:0};pixelInfo=new PixelInfo(this.c);for(i=_i=start;_i<end;i=_i+=4){pixelInfo.loc=i;data.r=this.c.pixelData[i];data.g=this.c.pixelData[i+1];data.b=this.c.pixelData[i+2];data.a=this.c.pixelData[i+3];res=this.currentJob.processFn.call(pixelInfo,data);if(!(res.a!=null)){res.a=data.a;} this.c.pixelData[i]=Util.clampRGB(res.r);this.c.pixelData[i+1]=Util.clampRGB(res.g);this.c.pixelData[i+2]=Util.clampRGB(res.b);this.c.pixelData[i+3]=Util.clampRGB(res.a);} this.blockFinished(bnum);if(Caman.NodeJS){return Fiber["yield"]();}};Renderer.prototype.renderKernel=function(bnum,start,end){var adjust,adjustSize,bias,builder,builderIndex,divisor,i,j,k,kernel,n,name,pixel,pixelInfo,res,_i,_j,_k;name=this.currentJob.name;bias=this.currentJob.bias;divisor=this.currentJob.divisor;n=this.c.pixelData.length;adjust=this.currentJob.adjust;adjustSize=Math.sqrt(adjust.length);kernel=[];Log.debug("Rendering kernel - Filter: "+this.currentJob.name);start=Math.max(start,this.c.dimensions.width*4*((adjustSize-1)/2));end=Math.min(end,n-(this.c.dimensions.width*4*((adjustSize-1)/2)));builder=(adjustSize-1)/2;pixelInfo=new PixelInfo(this.c);for(i=_i=start;_i<end;i=_i+=4){pixelInfo.loc=i;builderIndex=0;for(j=_j=-builder;-builder<=builder?_j<=builder:_j>=builder;j=-builder<=builder?++_j:--_j){for(k=_k=builder;builder<=-builder?_k<=-builder:_k>=-builder;k=builder<=-builder?++_k:--_k){pixel=pixelInfo.getPixelRelative(j,k);kernel[builderIndex*3]=pixel.r;kernel[builderIndex*3+1]=pixel.g;kernel[builderIndex*3+2]=pixel.b;builderIndex++;}} res=this.processKernel(adjust,kernel,divisor,bias);this.modPixelData[i]=Util.clampRGB(res.r);this.modPixelData[i+1]=Util.clampRGB(res.g);this.modPixelData[i+2]=Util.clampRGB(res.b);this.modPixelData[i+3]=this.c.pixelData[i+3];} this.blockFinished(bnum);if(Caman.NodeJS){return Fiber["yield"]();}};Renderer.prototype.blockFinished=function(bnum){var i,_i,_ref;if(bnum>=0){Log.debug("Block #"+bnum+" finished! Filter: "+this.currentJob.name);} this.blocksDone++;Event.trigger(this.c,"blockFinished",{blockNum:bnum,blocksFinished:this.blocksDone,totalBlocks:Renderer.Blocks});if(this.blocksDone===Renderer.Blocks){if(this.currentJob.type===Filter.Type.Kernel){for(i=_i=0,_ref=this.c.pixelData.length;0<=_ref?_i<_ref:_i>_ref;i=0<=_ref?++_i:--_i){this.c.pixelData[i]=this.modPixelData[i];}} if(bnum>=0){Log.debug("Filter "+this.currentJob.name+" finished!");} Event.trigger(this.c,"processComplete",this.currentJob);return this.processNext();}};Renderer.prototype.processKernel=function(adjust,kernel,divisor,bias){var i,val,_i,_ref;val={r:0,g:0,b:0};for(i=_i=0,_ref=adjust.length;0<=_ref?_i<_ref:_i>_ref;i=0<=_ref?++_i:--_i){val.r+=adjust[i]*kernel[i*3];val.g+=adjust[i]*kernel[i*3+1];val.b+=adjust[i]*kernel[i*3+2];} val.r=(val.r/divisor)+bias;val.g=(val.g/divisor)+bias;val.b=(val.b/divisor)+bias;return val;};Renderer.prototype.loadOverlay=function(layer,src){var img,proxyUrl,_this=this;img=document.createElement('img');img.onload=function(){layer.context.drawImage(img,0,0,_this.c.dimensions.width,_this.c.dimensions.height);layer.imageData=layer.context.getImageData(0,0,_this.c.dimensions.width,_this.c.dimensions.height);layer.pixelData=layer.imageData.data;_this.c.pixelData=layer.pixelData;return _this.processNext();};proxyUrl=IO.remoteCheck(src);return img.src=proxyUrl!=null?proxyUrl:src;};return Renderer;})();Caman.Store=Store=(function(){function Store(){} Store.items={};Store.has=function(search){return this.items[search]!=null;};Store.get=function(search){return this.items[search];};Store.put=function(name,obj){return this.items[name]=obj;};Store.execute=function(search,callback){var _this=this;setTimeout(function(){return callback.call(_this.get(search),_this.get(search));},0);return this.get(search);};Store.flush=function(name){if(name==null){name=false;} if(name){return delete this.items[name];}else{return this.items={};}};return Store;})();Blender.register("normal",function(rgbaLayer,rgbaParent){return{r:rgbaLayer.r,g:rgbaLayer.g,b:rgbaLayer.b};});Blender.register("multiply",function(rgbaLayer,rgbaParent){return{r:(rgbaLayer.r*rgbaParent.r)/255,g:(rgbaLayer.g*rgbaParent.g)/255,b:(rgbaLayer.b*rgbaParent.b)/255};});Blender.register("screen",function(rgbaLayer,rgbaParent){return{r:255-(((255-rgbaLayer.r)*(255-rgbaParent.r))/255),g:255-(((255-rgbaLayer.g)*(255-rgbaParent.g))/255),b:255-(((255-rgbaLayer.b)*(255-rgbaParent.b))/255)};});Blender.register("overlay",function(rgbaLayer,rgbaParent){var result;result={};result.r=rgbaParent.r>128?255-2*(255-rgbaLayer.r)*(255-rgbaParent.r)/255:(rgbaParent.r*rgbaLayer.r*2)/255;result.g=rgbaParent.g>128?255-2*(255-rgbaLayer.g)*(255-rgbaParent.g)/255:(rgbaParent.g*rgbaLayer.g*2)/255;result.b=rgbaParent.b>128?255-2*(255-rgbaLayer.b)*(255-rgbaParent.b)/255:(rgbaParent.b*rgbaLayer.b*2)/255;return result;});Blender.register("difference",function(rgbaLayer,rgbaParent){return{r:rgbaLayer.r-rgbaParent.r,g:rgbaLayer.g-rgbaParent.g,b:rgbaLayer.b-rgbaParent.b};});Blender.register("addition",function(rgbaLayer,rgbaParent){return{r:rgbaParent.r+rgbaLayer.r,g:rgbaParent.g+rgbaLayer.g,b:rgbaParent.b+rgbaLayer.b};});Blender.register("exclusion",function(rgbaLayer,rgbaParent){return{r:128-2*(rgbaParent.r-128)*(rgbaLayer.r-128)/255,g:128-2*(rgbaParent.g-128)*(rgbaLayer.g-128)/255,b:128-2*(rgbaParent.b-128)*(rgbaLayer.b-128)/255};});Blender.register("softLight",function(rgbaLayer,rgbaParent){var result;result={};result.r=rgbaParent.r>128?255-((255-rgbaParent.r)*(255-(rgbaLayer.r-128)))/255:(rgbaParent.r*(rgbaLayer.r+128))/255;result.g=rgbaParent.g>128?255-((255-rgbaParent.g)*(255-(rgbaLayer.g-128)))/255:(rgbaParent.g*(rgbaLayer.g+128))/255;result.b=rgbaParent.b>128?255-((255-rgbaParent.b)*(255-(rgbaLayer.b-128)))/255:(rgbaParent.b*(rgbaLayer.b+128))/255;return result;});Blender.register("lighten",function(rgbaLayer,rgbaParent){return{r:rgbaParent.r>rgbaLayer.r?rgbaParent.r:rgbaLayer.r,g:rgbaParent.g>rgbaLayer.g?rgbaParent.g:rgbaLayer.g,b:rgbaParent.b>rgbaLayer.b?rgbaParent.b:rgbaLayer.b};});Blender.register("darken",function(rgbaLayer,rgbaParent){return{r:rgbaParent.r>rgbaLayer.r?rgbaLayer.r:rgbaParent.r,g:rgbaParent.g>rgbaLayer.g?rgbaLayer.g:rgbaParent.g,b:rgbaParent.b>rgbaLayer.b?rgbaLayer.b:rgbaParent.b};});Filter.register("fillColor",function(){var color;if(arguments.length===1){color=Convert.hexToRGB(arguments[0]);}else{color={r:arguments[0],g:arguments[1],b:arguments[2]};} return this.process("fillColor",function(rgba){rgba.r=color.r;rgba.g=color.g;rgba.b=color.b;rgba.a=255;return rgba;});});Filter.register("brightness",function(adjust){adjust=Math.floor(255*(adjust/100));return this.process("brightness",function(rgba){rgba.r+=adjust;rgba.g+=adjust;rgba.b+=adjust;return rgba;});});Filter.register("saturation",function(adjust){adjust*=-0.01;return this.process("saturation",function(rgba){var max;max=Math.max(rgba.r,rgba.g,rgba.b);if(rgba.r!==max){rgba.r+=(max-rgba.r)*adjust;} if(rgba.g!==max){rgba.g+=(max-rgba.g)*adjust;} if(rgba.b!==max){rgba.b+=(max-rgba.b)*adjust;} return rgba;});});Filter.register("vibrance",function(adjust){adjust*=-1;return this.process("vibrance",function(rgba){var amt,avg,max;max=Math.max(rgba.r,rgba.g,rgba.b);avg=(rgba.r+rgba.g+rgba.b)/3;amt=((Math.abs(max-avg)*2/255)*adjust)/100;if(rgba.r!==max){rgba.r+=(max-rgba.r)*amt;} if(rgba.g!==max){rgba.g+=(max-rgba.g)*amt;} if(rgba.b!==max){rgba.b+=(max-rgba.b)*amt;} return rgba;});});Filter.register("greyscale",function(adjust){return this.process("greyscale",function(rgba){var avg;avg=Calculate.luminance(rgba);rgba.r=avg;rgba.g=avg;rgba.b=avg;return rgba;});});Filter.register("contrast",function(adjust){adjust=Math.pow((adjust+100)/100,2);return this.process("contrast",function(rgba){rgba.r/=255;rgba.r-=0.5;rgba.r*=adjust;rgba.r+=0.5;rgba.r*=255;rgba.g/=255;rgba.g-=0.5;rgba.g*=adjust;rgba.g+=0.5;rgba.g*=255;rgba.b/=255;rgba.b-=0.5;rgba.b*=adjust;rgba.b+=0.5;rgba.b*=255;return rgba;});});Filter.register("hue",function(adjust){return this.process("hue",function(rgba){var h,hsv,rgb;hsv=Convert.rgbToHSV(rgba.r,rgba.g,rgba.b);h=hsv.h*100;h+=Math.abs(adjust);h=h%100;h/=100;hsv.h=h;rgb=Convert.hsvToRGB(hsv.h,hsv.s,hsv.v);rgb.a=rgba.a;return rgb;});});Filter.register("colorize",function(){var level,rgb;if(arguments.length===2){rgb=Convert.hexToRGB(arguments[0]);level=arguments[1];}else if(arguments.length===4){rgb={r:arguments[0],g:arguments[1],b:arguments[2]};level=arguments[3];} return this.process("colorize",function(rgba){rgba.r-=(rgba.r-rgb.r)*(level/100);rgba.g-=(rgba.g-rgb.g)*(level/100);rgba.b-=(rgba.b-rgb.b)*(level/100);return rgba;});});Filter.register("invert",function(){return this.process("invert",function(rgba){rgba.r=255-rgba.r;rgba.g=255-rgba.g;rgba.b=255-rgba.b;return rgba;});});Filter.register("sepia",function(adjust){if(adjust==null){adjust=100;} adjust/=100;return this.process("sepia",function(rgba){rgba.r=Math.min(255,(rgba.r*(1-(0.607*adjust)))+(rgba.g*(0.769*adjust))+(rgba.b*(0.189*adjust)));rgba.g=Math.min(255,(rgba.r*(0.349*adjust))+(rgba.g*(1-(0.314*adjust)))+(rgba.b*(0.168*adjust)));rgba.b=Math.min(255,(rgba.r*(0.272*adjust))+(rgba.g*(0.534*adjust))+(rgba.b*(1-(0.869*adjust))));return rgba;});});Filter.register("gamma",function(adjust){return this.process("gamma",function(rgba){rgba.r=Math.pow(rgba.r/255,adjust)*255;rgba.g=Math.pow(rgba.g/255,adjust)*255;rgba.b=Math.pow(rgba.b/255,adjust)*255;return rgba;});});Filter.register("noise",function(adjust){adjust=Math.abs(adjust)*2.55;return this.process("noise",function(rgba){var rand;rand=Calculate.randomRange(adjust*-1,adjust);rgba.r+=rand;rgba.g+=rand;rgba.b+=rand;return rgba;});});Filter.register("clip",function(adjust){adjust=Math.abs(adjust)*2.55;return this.process("clip",function(rgba){if(rgba.r>255-adjust){rgba.r=255;}else if(rgba.r<adjust){rgba.r=0;} if(rgba.g>255-adjust){rgba.g=255;}else if(rgba.g<adjust){rgba.g=0;} if(rgba.b>255-adjust){rgba.b=255;}else if(rgba.b<adjust){rgba.b=0;} return rgba;});});Filter.register("channels",function(options){var chan,value;if(typeof options!=="object"){return this;} for(chan in options){if(!__hasProp.call(options,chan))continue;value=options[chan];if(value===0){delete options[chan];continue;} options[chan]/=100;} if(options.length===0){return this;} return this.process("channels",function(rgba){if(options.red!=null){if(options.red>0){rgba.r+=(255-rgba.r)*options.red;}else{rgba.r-=rgba.r*Math.abs(options.red);}} if(options.green!=null){if(options.green>0){rgba.g+=(255-rgba.g)*options.green;}else{rgba.g-=rgba.g*Math.abs(options.green);}} if(options.blue!=null){if(options.blue>0){rgba.b+=(255-rgba.b)*options.blue;}else{rgba.b-=rgba.b*Math.abs(options.blue);}} return rgba;});});Filter.register("curves",function(){var bezier,chans,cps,ctrl1,ctrl2,end,i,start,_i,_j,_ref,_ref1;chans=arguments[0],cps=2<=arguments.length?__slice.call(arguments,1):[];if(typeof chans==="string"){chans=chans.split("");} if(chans[0]==="v"){chans=['r','g','b'];} if(cps.length<3||cps.length>4){throw"Invalid number of arguments to curves filter";} start=cps[0];ctrl1=cps[1];ctrl2=cps.length===4?cps[2]:cps[1];end=cps[cps.length-1];bezier=Calculate.bezier(start,ctrl1,ctrl2,end,0,255);if(start[0]>0){for(i=_i=0,_ref=start[0];0<=_ref?_i<_ref:_i>_ref;i=0<=_ref?++_i:--_i){bezier[i]=start[1];}} if(end[0]<255){for(i=_j=_ref1=end[0];_ref1<=255?_j<=255:_j>=255;i=_ref1<=255?++_j:--_j){bezier[i]=end[1];}} return this.process("curves",function(rgba){var _k,_ref2;for(i=_k=0,_ref2=chans.length;0<=_ref2?_k<_ref2:_k>_ref2;i=0<=_ref2?++_k:--_k){rgba[chans[i]]=bezier[rgba[chans[i]]];} return rgba;});});Filter.register("exposure",function(adjust){var ctrl1,ctrl2,p;p=Math.abs(adjust)/100;ctrl1=[0,255*p];ctrl2=[255-(255*p),255];if(adjust<0){ctrl1=ctrl1.reverse();ctrl2=ctrl2.reverse();} return this.curves('rgb',[0,0],ctrl1,ctrl2,[255,255]);});Caman.Plugin.register("crop",function(width,height,x,y){var canvas,ctx;if(x==null){x=0;} if(y==null){y=0;} if(typeof exports!=="undefined"&&exports!==null){canvas=new Canvas(width,height);}else{canvas=document.createElement('canvas');Util.copyAttributes(this.canvas,canvas);canvas.width=width;canvas.height=height;} ctx=canvas.getContext('2d');ctx.drawImage(this.canvas,x,y,width,height,0,0,width,height);this.cropCoordinates={x:x,y:y};this.cropped=true;return this.replaceCanvas(canvas);});Caman.Plugin.register("resize",function(newDims){var canvas,ctx;if(newDims==null){newDims=null;} if(newDims===null||(!(newDims.width!=null)&&!(newDims.height!=null))){Log.error("Invalid or missing dimensions given for resize");return;} if(!(newDims.width!=null)){newDims.width=this.canvas.width*newDims.height/this.canvas.height;}else if(!(newDims.height!=null)){newDims.height=this.canvas.height*newDims.width/this.canvas.width;} if(typeof exports!=="undefined"&&exports!==null){canvas=new Canvas(newDims.width,newDims.height);}else{canvas=document.createElement('canvas');Util.copyAttributes(this.canvas,canvas);canvas.width=newDims.width;canvas.height=newDims.height;} ctx=canvas.getContext('2d');ctx.drawImage(this.canvas,0,0,this.canvas.width,this.canvas.height,0,0,newDims.width,newDims.height);this.resized=true;return this.replaceCanvas(canvas);});Caman.Filter.register("crop",function(){return this.processPlugin("crop",Array.prototype.slice.call(arguments,0));});Caman.Filter.register("resize",function(){return this.processPlugin("resize",Array.prototype.slice.call(arguments,0));});}).call(this);
F2X/cdnjs
ajax/libs/camanjs/4.1.0/caman.min.js
JavaScript
mit
44,941
/* TimelineJS - ver. 2.29.0 - 2014-01-22 Copyright (c) 2012-2013 Northwestern University a project of the Northwestern University Knight Lab, originally created by Zach Wise https://github.com/NUKnightLab/TimelineJS This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */ .vco-storyjs{font-family:'PT Serif',serif;}.vco-storyjs .twitter,.vco-storyjs .vcard,.vco-storyjs .messege,.vco-storyjs .credit,.vco-storyjs .caption,.vco-storyjs .zoom-in,.vco-storyjs .zoom-out,.vco-storyjs .back-home,.vco-storyjs .time-interval div,.vco-storyjs .time-interval-major div,.vco-storyjs .nav-container{font-family:'PT Sans',sans-serif !important} .vco-storyjs .vco-feature h1.date,.vco-storyjs .vco-feature h2.date,.vco-storyjs .vco-feature h3.date,.vco-storyjs .vco-feature h4.date,.vco-storyjs .vco-feature h5.date,.vco-storyjs .vco-feature h6.date{font-family:'PT Sans',sans-serif !important} .vco-storyjs .timenav h1,.vco-storyjs .flag-content h1,.vco-storyjs .era h1,.vco-storyjs .timenav h2,.vco-storyjs .flag-content h2,.vco-storyjs .era h2,.vco-storyjs .timenav h3,.vco-storyjs .flag-content h3,.vco-storyjs .era h3,.vco-storyjs .timenav h4,.vco-storyjs .flag-content h4,.vco-storyjs .era h4,.vco-storyjs .timenav h5,.vco-storyjs .flag-content h5,.vco-storyjs .era h5,.vco-storyjs .timenav h6,.vco-storyjs .flag-content h6,.vco-storyjs .era h6{font-family:'PT Sans',sans-serif !important} .vco-storyjs p,.vco-storyjs blockquote,.vco-storyjs blockquote p,.vco-storyjs .twitter blockquote p{font-family:'PT Serif',serif !important} .vco-storyjs blockquote,.vco-storyjs blockquote p,.vco-storyjs .twitter blockquote p{font-style:italic} .vco-storyjs .vco-feature h1,.vco-storyjs .vco-feature h2,.vco-storyjs .vco-feature h3,.vco-storyjs .vco-feature h4,.vco-storyjs .vco-feature h5,.vco-storyjs .vco-feature h6{font-family:'PT Sans Narrow',sans-serif;font-weight:700} .timeline-tooltip{font-family:'PT Sans',sans-serif}
ZaValera/cdnjs
ajax/libs/timelinejs/2.29.0/css/themes/font/PT.css
CSS
mit
2,076
/* Area: ffi_call Purpose: Check return value float. Limitations: none. PR: none. Originator: <andreast@gcc.gnu.org> 20050212 */ /* { dg-do run } */ #include "ffitest.h" /* Use volatile float to avoid false negative on ix86. See PR target/323. */ static float return_fl(float fl1, float fl2, float fl3, float fl4) { volatile float sum; sum = fl1 + fl2 + fl3 + fl4; return sum; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; float fl1, fl2, fl3, fl4, rfl; volatile float sum; args[0] = &ffi_type_float; args[1] = &ffi_type_float; args[2] = &ffi_type_float; args[3] = &ffi_type_float; values[0] = &fl1; values[1] = &fl2; values[2] = &fl3; values[3] = &fl4; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &ffi_type_float, args) == FFI_OK); fl1 = 127.0; fl2 = 128.0; fl3 = 255.1; fl4 = 512.7; ffi_call(&cif, FFI_FN(return_fl), &rfl, values); printf ("%f vs %f\n", rfl, return_fl(fl1, fl2, fl3, fl4)); sum = fl1 + fl2 + fl3 + fl4; CHECK(rfl == sum); exit(0); }
praveenperera/qrideshare
vendor/cache/ruby/2.2.0/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c
C
mit
1,099
YUI.add('jsonp', function (Y, NAME) { var isFunction = Y.Lang.isFunction; /** * <p>Provides a JSONPRequest class for repeated JSONP calls, and a convenience * method Y.jsonp(url, callback) to instantiate and send a JSONP request.</p> * * <p>Both the constructor as well as the convenience function take two * parameters: a url string and a callback.</p> * * <p>The url provided must include the placeholder string * &quot;{callback}&quot; which will be replaced by a dynamically * generated routing function to pass the data to your callback function. * An example url might look like * &quot;http://example.com/service?callback={callback}&quot;.</p> * * <p>The second parameter can be a callback function that accepts the JSON * payload as its argument, or a configuration object supporting the keys:</p> * <ul> * <li>on - map of callback subscribers * <ul> * <li>success - function handler for successful transmission</li> * <li>failure - function handler for failed transmission</li> * <li>timeout - function handler for transactions that timeout</li> * </ul> * </li> * <li>format - override function for inserting the proxy name in the url</li> * <li>timeout - the number of milliseconds to wait before giving up</li> * <li>context - becomes <code>this</code> in the callbacks</li> * <li>args - array of subsequent parameters to pass to the callbacks</li> * <li>allowCache - use the same proxy name for all requests? (boolean)</li> * </ul> * * @module jsonp * @class JSONPRequest * @constructor * @param url {String} the url of the JSONP service * @param callback {Object|Function} the default callback configuration or * success handler */ function JSONPRequest() { this._init.apply(this, arguments); } JSONPRequest.prototype = { /** * Set up the success and failure handlers and the regex pattern used * to insert the temporary callback name in the url. * * @method _init * @param url {String} the url of the JSONP service * @param callback {Object|Function} Optional success callback or config * object containing success and failure functions and * the url regex. * @protected */ _init : function (url, callback) { this.url = url; /** * Map of the number of requests currently pending responses per * generated proxy. Used to ensure the proxy is not flushed if the * request times out and there is a timeout handler and success * handler, and used by connections configured to allowCache to make * sure the proxy isn't deleted until the last response has returned. * * @property _requests * @private * @type {Object} */ this._requests = {}; /** * Map of the number of timeouts received from the destination url * by generated proxy. Used to ensure the proxy is not flushed if the * request times out and there is a timeout handler and success * handler, and used by connections configured to allowCache to make * sure the proxy isn't deleted until the last response has returned. * * @property _timeouts * @private * @type {Object} */ this._timeouts = {}; // Accept a function, an object, or nothing callback = (isFunction(callback)) ? { on: { success: callback } } : callback || {}; var subs = callback.on || {}; if (!subs.success) { subs.success = this._defaultCallback(url, callback); } // Apply defaults and store this._config = Y.merge({ context: this, args : [], format : this._format, allowCache: false }, callback, { on: subs }); }, /** * Override this method to provide logic to default the success callback if * it is not provided at construction. This is overridden by jsonp-url to * parse the callback from the url string. * * @method _defaultCallback * @param url {String} the url passed at construction * @param config {Object} (optional) the config object passed at * construction * @return {Function} */ _defaultCallback: function () {}, /** * Issues the JSONP request. * * @method send * @param args* {any} any additional arguments to pass to the url formatter * beyond the base url and the proxy function name * @chainable */ send : function () { var self = this, args = Y.Array(arguments, 0, true), config = self._config, proxy = self._proxy || Y.guid(), url; // TODO: support allowCache as time value if (config.allowCache) { self._proxy = proxy; } if (self._requests[proxy] === undefined) { self._requests[proxy] = 0; } if (self._timeouts[proxy] === undefined) { self._timeouts[proxy] = 0; } self._requests[proxy]++; args.unshift(self.url, 'YUI.Env.JSONP.' + proxy); url = config.format.apply(self, args); if (!config.on.success) { return self; } function wrap(fn, isTimeout) { return (isFunction(fn)) ? function (data) { var execute = true, counter = '_requests'; //if (config.allowCache) { // A lot of wrangling to make sure timeouts result in // fewer success callbacks, but the proxy is properly // cleaned up. if (isTimeout) { ++self._timeouts[proxy]; --self._requests[proxy]; } else { if (!self._requests[proxy]) { execute = false; counter = '_timeouts'; } --self[counter][proxy]; } //} if (!self._requests[proxy] && !self._timeouts[proxy]) { delete YUI.Env.JSONP[proxy]; } if (execute) { fn.apply(config.context, [data].concat(config.args)); } } : null; } // Temporary un-sandboxed function alias // TODO: queuing YUI.Env.JSONP[proxy] = wrap(config.on.success); // Y.Get transactions block each other by design, but can easily // be made non-blocking by just calling execute() on the transaction. // https://github.com/yui/yui3/pull/393#issuecomment-11961608 Y.Get.js(url, { onFailure : wrap(config.on.failure), onTimeout : wrap(config.on.timeout, true), timeout : config.timeout, charset : config.charset, attributes: config.attributes, async : config.async }).execute(); return self; }, /** * Default url formatter. Looks for callback= in the url and appends it * if not present. The supplied proxy name will be assigned to the query * param. Override this method by passing a function as the * &quot;format&quot; property in the config object to the constructor. * * @method _format * @param url { String } the original url * @param proxy {String} the function name that will be used as a proxy to * the configured callback methods. * @param args* {any} additional args passed to send() * @return {String} fully qualified JSONP url * @protected */ _format: function (url, proxy) { return url.replace(/\{callback\}/, proxy); } }; Y.JSONPRequest = JSONPRequest; /** * * @method jsonp * @param url {String} the url of the JSONP service with the {callback} * placeholder where the callback function name typically goes. * @param c {Function|Object} Callback function accepting the JSON payload * as its argument, or a configuration object (see above). * @param args* {any} additional arguments to pass to send() * @return {JSONPRequest} * @static * @for YUI */ Y.jsonp = function (url,c) { var req = new Y.JSONPRequest(url,c); return req.send.apply(req, Y.Array(arguments, 2, true)); }; if (!YUI.Env.JSONP) { YUI.Env.JSONP = {}; } }, '@VERSION@', {"requires": ["get", "oop"]});
qrohlf/cdnjs
ajax/libs/yui/3.14.1/jsonp/jsonp.js
JavaScript
mit
8,820
webshims.register("track",function(a,b,c,d){"use strict";function e(a,c,e){3!=arguments.length&&b.error("wrong arguments.length for VTTCue.constructor"),this.startTime=a,this.endTime=c,this.text=e,this.onenter=null,this.onexit=null,this.pauseOnExit=!1,this.track=null,this.id=null,this.getCueAsHTML=function(){var a,b="",c="";return function(){var e,g;if(a||(a=d.createDocumentFragment()),b!=this.text)for(b=this.text,c=f.parseCueTextToHTML(b),t.innerHTML=c,e=0,g=t.childNodes.length;g>e;e++)a.appendChild(t.childNodes[e].cloneNode(!0));return a.cloneNode(!0)}}()}var f=b.mediaelement,g=((new Date).getTime(),{subtitles:1,captions:1,descriptions:1}),h=a("<track />"),i=b.support,j=i.ES5&&i.objectAccessor,k=function(a){var c={};return a.addEventListener=function(a,d){c[a]&&b.error("always use $.on to the shimed event: "+a+" already bound fn was: "+c[a]+" your fn was: "+d),c[a]=d},a.removeEventListener=function(a,d){c[a]&&c[a]!=d&&b.error("always use $.on/$.off to the shimed event: "+a+" already bound fn was: "+c[a]+" your fn was: "+d),c[a]&&delete c[a]},a},l={getCueById:function(a){for(var b=null,c=0,d=this.length;d>c;c++)if(this[c].id===a){b=this[c];break}return b}},m={0:"disabled",1:"hidden",2:"showing"},n={shimActiveCues:null,_shimActiveCues:null,activeCues:null,cues:null,kind:"subtitles",label:"",language:"",id:"",mode:"disabled",oncuechange:null,toString:function(){return"[object TextTrack]"},addCue:function(a){if(this.cues){var c=this.cues[this.cues.length-1];c&&c.startTime>a.startTime&&b.error("cue startTime higher than previous cue's startTime")}else this.cues=f.createCueList();a.track&&a.track.removeCue&&a.track.removeCue(a),a.track=this,this.cues.push(a)},removeCue:function(a){var c=this.cues||[],d=0,e=c.length;if(a.track!=this)return void b.error("cue not part of track");for(;e>d;d++)if(c[d]===a){c.splice(d,1),a.track=null;break}return a.track?void b.error("cue not part of track"):void 0}},o=["kind","label","srclang"],p={srclang:"language"},q=function(c,d){var e,f,g=[],h=[],i=[];if(c||(c=b.data(this,"mediaelementBase")||b.data(this,"mediaelementBase",{})),d||(c.blockTrackListUpdate=!0,d=a.prop(this,"textTracks"),c.blockTrackListUpdate=!1),clearTimeout(c.updateTrackListTimer),a("track",this).each(function(){var b=a.prop(this,"track");i.push(b),-1==d.indexOf(b)&&h.push(b)}),c.scriptedTextTracks)for(e=0,f=c.scriptedTextTracks.length;f>e;e++)i.push(c.scriptedTextTracks[e]),-1==d.indexOf(c.scriptedTextTracks[e])&&h.push(c.scriptedTextTracks[e]);for(e=0,f=d.length;f>e;e++)-1==i.indexOf(d[e])&&g.push(d[e]);if(g.length||h.length){for(d.splice(0),e=0,f=i.length;f>e;e++)d.push(i[e]);for(e=0,f=g.length;f>e;e++)a([d]).triggerHandler(a.Event({type:"removetrack",track:g[e]}));for(e=0,f=h.length;f>e;e++)a([d]).triggerHandler(a.Event({type:"addtrack",track:h[e]}));(c.scriptedTextTracks||g.length)&&a(this).triggerHandler("updatetrackdisplay")}},r=function(c,d){d||(d=b.data(c,"trackData")),d&&!d.isTriggering&&(d.isTriggering=!0,setTimeout(function(){a(c).closest("audio, video").triggerHandler("updatetrackdisplay"),d.isTriggering=!1},1))},s=function(){var c={subtitles:{subtitles:1,captions:1},descriptions:{descriptions:1},chapters:{chapters:1}};return c.captions=c.subtitles,function(d){var e,f,g=a.prop(d,"default");return g&&"metadata"!=(e=a.prop(d,"kind"))&&(f=a(d).parent().find("track[default]").filter(function(){return!!c[e][a.prop(this,"kind")]})[0],f!=d&&(g=!1,b.error("more than one default track of a specific kind detected. Fall back to default = false"))),g}}(),t=a("<div />")[0];c.VTTCue=e,c.TextTrackCue=function(){b.error("Use VTTCue constructor instead of abstract TextTrackCue constructor."),e.apply(this,arguments)},c.TextTrackCue.prototype=e.prototype,f.createCueList=function(){return a.extend([],l)},f.parseCueTextToHTML=function(){var a=/(<\/?[^>]+>)/gi,b=/^(?:c|v|ruby|rt|b|i|u)/,c=/\<\s*\//,d=function(a,b,d,e){var f;return c.test(e)?f="</"+a+">":(d.splice(0,1),f="<"+a+" "+b+'="'+d.join(" ").replace(/\"/g,"&#34;")+'">'),f},e=function(a){var c=a.replace(/[<\/>]+/gi,"").split(/[\s\.]+/);return c[0]&&(c[0]=c[0].toLowerCase(),b.test(c[0])?"c"==c[0]?a=d("span","class",c,a):"v"==c[0]&&(a=d("q","title",c,a)):a=""),a};return function(b){return b.replace(a,e)}}();var u=function(b){var c=b+"",d=this.getAttribute("begin")||"",e=this.getAttribute("end")||"",f=a.trim(a.text(this));return/\./.test(d)||(d+=".000"),/\./.test(e)||(e+=".000"),c+="\n",c+=d+" --> "+e+"\n",c+=f},v=function(b){return b=a.parseXML(b)||[],a(b).find("[begin][end]").map(u).get().join("\n\n")||""},w=0;f.loadTextTrack=function(c,d,e,h){var i="play playing loadedmetadata loadstart",j=e.track,k=function(){var g,h,l,m="disabled"==j.mode,n=!(!(a.prop(c,"readyState")>0||2==a.prop(c,"networkState"))&&a.prop(c,"paused")),o=(!m||n)&&a.attr(d,"src")&&a.prop(d,"src");if(o&&(a(c).off(i,k).off("updatetrackdisplay",k),!e.readyState)){g=function(){w--,e.readyState=3,j.cues=null,j.activeCues=j.shimActiveCues=j._shimActiveCues=null,a(d).triggerHandler("error")},e.readyState=1;try{j.cues=f.createCueList(),j.activeCues=j.shimActiveCues=j._shimActiveCues=f.createCueList(),w++,l=function(){h=a.ajax({dataType:"text",url:o,success:function(i){w--;var k=h.getResponseHeader("content-type")||"";k.indexOf("application/xml")?k.indexOf("text/vtt")&&b.error("set the mime-type of your WebVTT files to text/vtt. see: http://dev.w3.org/html5/webvtt/#text/vtt"):i=v(i),f.parseCaptions(i,j,function(b){b&&"length"in b?(e.readyState=2,a(d).triggerHandler("load"),a(c).triggerHandler("updatetrackdisplay")):g()})},error:g})},a.ajax&&a.ajaxSettings.xhr?m?setTimeout(l,2*w):l():(b.ready("jajax",l),b.loader.loadList(["jajax"]))}catch(p){g(),b.error(p)}}};e.readyState=0,j.shimActiveCues=null,j._shimActiveCues=null,j.activeCues=null,j.cues=null,a(c).on(i,k),h?(j.mode=g[j.kind]?"showing":"hidden",k()):a(c).on("updatetrackdisplay",k)},f.createTextTrack=function(c,d){var e,g;return d.nodeName&&(g=b.data(d,"trackData"),g&&(r(d,g),e=g.track)),e||(e=k(b.objectCreate(n)),j||o.forEach(function(b){var c=a.prop(d,b);c&&(e[p[b]||b]=c)}),d.nodeName?(j&&o.forEach(function(c){b.defineProperty(e,p[c]||c,{get:function(){return a.prop(d,c)}})}),e.id=a(d).prop("id"),g=b.data(d,"trackData",{track:e}),f.loadTextTrack(c,d,g,s(d))):(j&&o.forEach(function(a){b.defineProperty(e,p[a]||a,{value:d[a],writeable:!1})}),e.cues=f.createCueList(),e.activeCues=e._shimActiveCues=e.shimActiveCues=f.createCueList(),e.mode="hidden",e.readyState=2),"subtitles"!=e.kind||e.language||b.error("you must provide a language for track in subtitles state"),e.__wsmode=e.mode),e},f.parseCaptionChunk=function(){var a=/^(\d{2})?:?(\d{2}):(\d{2})\.(\d+)\s+\-\-\>\s+(\d{2})?:?(\d{2}):(\d{2})\.(\d+)\s*(.*)/,c=/^(DEFAULTS|DEFAULT)\s+\-\-\>\s+(.*)/g,d=/^(STYLE|STYLES)\s+\-\-\>\s*\n([\s\S]*)/g,f=/^(COMMENT|COMMENTS)\s+\-\-\>\s+(.*)/g,g=/^(\d{2})?:?(\d{2}):(\d{2})[\.\,](\d+)\s+\-\-\>\s+(\d{2})?:?(\d{2}):(\d{2})[\.\,](\d+)\s*(.*)/;return function(h){var i,j,k,l,m,n,o,p,q;if(c.exec(h)||f.exec(h)||d.exec(h))return null;for(i=h.split(/\n/g);!i[0].replace(/\s+/gi,"").length&&i.length>0;)i.shift();for(i[0].match(/^\s*[a-z0-9-\_]+\s*$/gi)&&(o=String(i.shift().replace(/\s*/gi,""))),n=0;n<i.length;n++){var r=i[n];((p=a.exec(r))||(p=g.exec(r)))&&(m=p.slice(1),j=parseInt(60*(m[0]||0)*60,10)+parseInt(60*(m[1]||0),10)+parseInt(m[2]||0,10)+parseFloat("0."+(m[3]||0)),k=parseInt(60*(m[4]||0)*60,10)+parseInt(60*(m[5]||0),10)+parseInt(m[6]||0,10)+parseFloat("0."+(m[7]||0))),i=i.slice(0,n).concat(i.slice(n+1));break}return j||k?(l=i.join("\n"),q=new e(j,k,l),o&&(q.id=o),q):(b.warn("couldn't extract time information: "+[j,k,i.join("\n"),o].join(" ; ")),null)}}(),f.parseCaptions=function(a,c,d){var e,g,h,i,j;f.createCueList(),a?(h=/^WEBVTT(\s*FILE)?/gi,g=function(k,l){for(;l>k;k++)if(e=a[k],h.test(e)?j=!0:e.replace(/\s*/gi,"").length&&(e=f.parseCaptionChunk(e,k),e&&c.addCue(e)),i<(new Date).getTime()-30){k++,setTimeout(function(){i=(new Date).getTime(),g(k,l)},90);break}k>=l&&(j||b.error("please use WebVTT format. This is the standard"),d(c.cues))},a=a.replace(/\r\n/g,"\n"),setTimeout(function(){a=a.replace(/\r/g,"\n"),setTimeout(function(){i=(new Date).getTime(),a=a.split(/\n\n+/g),g(0,a.length)},9)},9)):b.error("Required parameter captionData not supplied.")},f.createTrackList=function(c,d){return d=d||b.data(c,"mediaelementBase")||b.data(c,"mediaelementBase",{}),d.textTracks||(d.textTracks=[],b.defineProperties(d.textTracks,{onaddtrack:{value:null},onremovetrack:{value:null},onchange:{value:null},getTrackById:{value:function(a){for(var b=null,c=0;c<d.textTracks.length;c++)if(a==d.textTracks[c].id){b=d.textTracks[c];break}return b}}}),k(d.textTracks),a(c).on("updatetrackdisplay",function(){for(var b,c=0;c<d.textTracks.length;c++)b=d.textTracks[c],b.__wsmode!=b.mode&&(b.__wsmode=b.mode,a([d.textTracks]).triggerHandler("change"))})),d.textTracks},i.track||(b.defineNodeNamesBooleanProperty(["track"],"default"),b.reflectProperties(["track"],["srclang","label"]),b.defineNodeNameProperties("track",{src:{reflect:!0,propType:"src"}})),b.defineNodeNameProperties("track",{kind:{attr:i.track?{set:function(a){var c=b.data(this,"trackData");this.setAttribute("data-kind",a),c&&(c.attrKind=a)},get:function(){var a=b.data(this,"trackData");return a&&"attrKind"in a?a.attrKind:this.getAttribute("kind")}}:{},reflect:!0,propType:"enumarated",defaultValue:"subtitles",limitedTo:["subtitles","captions","descriptions","chapters","metadata"]}}),a.each(o,function(c,d){var e=p[d]||d;b.onNodeNamesPropertyModify("track",d,function(){var c=b.data(this,"trackData");c&&("kind"==d&&r(this,c),j||(c.track[e]=a.prop(this,d)))})}),b.onNodeNamesPropertyModify("track","src",function(c){if(c){var d,e=b.data(this,"trackData");e&&(d=a(this).closest("video, audio"),d[0]&&f.loadTextTrack(d,this,e))}}),b.defineNodeNamesProperties(["track"],{ERROR:{value:3},LOADED:{value:2},LOADING:{value:1},NONE:{value:0},readyState:{get:function(){return(b.data(this,"trackData")||{readyState:0}).readyState},writeable:!1},track:{get:function(){return f.createTextTrack(a(this).closest("audio, video")[0],this)},writeable:!1}},"prop"),b.defineNodeNamesProperties(["audio","video"],{textTracks:{get:function(){var a=this,c=b.data(a,"mediaelementBase")||b.data(a,"mediaelementBase",{}),d=f.createTrackList(a,c);return c.blockTrackListUpdate||q.call(a,c,d),d},writeable:!1},addTextTrack:{value:function(a,c,d){var e=f.createTextTrack(this,{kind:h.prop("kind",a||"").prop("kind"),label:c||"",srclang:d||""}),g=b.data(this,"mediaelementBase")||b.data(this,"mediaelementBase",{});return g.scriptedTextTracks||(g.scriptedTextTracks=[]),g.scriptedTextTracks.push(e),q.call(this),e}}},"prop");var x=function(c){if(a(c.target).is("audio, video")){var d=b.data(c.target,"mediaelementBase");d&&(clearTimeout(d.updateTrackListTimer),d.updateTrackListTimer=setTimeout(function(){q.call(c.target,d)},0))}},y=function(a,b){return b.readyState||a.readyState},z=function(a){a.originalEvent&&a.stopImmediatePropagation()},A=function(){if(b.implement(this,"track")){var c,d=this.track;d&&(b.bugs.track||!d.mode&&!y(this,d)||(a.prop(this,"track").mode=m[d.mode]||d.mode),c=a.prop(this,"kind"),d.mode="string"==typeof d.mode?"disabled":0,this.kind="metadata",a(this).attr({kind:c})),a(this).on("load error",z)}};b.addReady(function(c,d){var e=d.filter("video, audio, track").closest("audio, video");a("video, audio",c).add(e).each(function(){q.call(this)}).on("emptied updatetracklist wsmediareload",x).each(function(){if(i.track){var c=a.prop(this,"textTracks"),d=this.textTracks;c.length!=d.length&&b.warn("textTracks couldn't be copied"),a("track",this).each(A)}}),e.each(function(){var a=this,c=b.data(a,"mediaelementBase");c&&(clearTimeout(c.updateTrackListTimer),c.updateTrackListTimer=setTimeout(function(){q.call(a,c)},9))})}),i.texttrackapi&&a("video, audio").trigger("trackapichange")});
boneskull/cdnjs
ajax/libs/webshim/1.14.5-RC2/minified/shims/track.js
JavaScript
mit
11,831
var tap = require("tap") var normalize = require("../lib/normalize") var warningMessages = require("../lib/warning_messages.json") var safeFormat = require("../lib/safe_format") tap.test("warn if dependency contains anything else but a string", function(t) { var a var warnings = [] function warn(w) { warnings.push(w) } normalize(a={ dependencies: { "a": 123}, devDependencies: { "b": 456}, optionalDependencies: { "c": 789} }, warn) var wanted1 = safeFormat(warningMessages.nonStringDependency, "a", 123) var wanted2 = safeFormat(warningMessages.nonStringDependency, "b", 456) var wanted3 = safeFormat(warningMessages.nonStringDependency, "c", 789) t.ok(~warnings.indexOf(wanted1), wanted1) t.ok(~warnings.indexOf(wanted2), wanted2) t.ok(~warnings.indexOf(wanted3), wanted3) t.end() }) tap.test("warn if bundleDependencies array contains anything else but strings", function(t) { var a var warnings = [] function warn(w) { warnings.push(w) } normalize(a={ bundleDependencies: ["abc", 123, {foo:"bar"}] }, warn) var wanted1 = safeFormat(warningMessages.nonStringBundleDependency, 123) var wanted2 = safeFormat(warningMessages.nonStringBundleDependency, {foo:"bar"}) var wanted2 = safeFormat(warningMessages.nonDependencyBundleDependency, "abc") t.ok(~warnings.indexOf(wanted1), wanted1) t.ok(~warnings.indexOf(wanted2), wanted2) t.end() })
goolsbys/flint-water
node_modules/normalize-package-data/test/dependencies.js
JavaScript
mit
1,424
YUI.add('parallel', function (Y, NAME) { /** * A concurrent parallel processor to help in running several async functions. * @module parallel * @main parallel */ /** A concurrent parallel processor to help in running several async functions. var stack = new Y.Parallel(); for (var i = 0; i < 15; i++) { Y.io('./api/json/' + i, { on: { success: stack.add(function() { }) } }); } stack.done(function() { }); @class Parallel @param {Object} o A config object @param {Object} [o.context=Y] The execution context of the callback to done */ Y.Parallel = function(o) { this.config = o || {}; this.results = []; this.context = this.config.context || Y; this.total = 0; this.finished = 0; }; Y.Parallel.prototype = { /** * An Array of results from all the callbacks in the stack * @property results * @type Array */ results: null, /** * The total items in the stack * @property total * @type Number */ total: null, /** * The number of stacked callbacks executed * @property finished * @type Number */ finished: null, /** * Add a callback to the stack * @method add * @param {Function} fn The function callback we are waiting for */ add: function (fn) { var self = this, index = self.total; self.total += 1; return function () { self.finished++; self.results[index] = (fn && fn.apply(self.context, arguments)) || (arguments.length === 1 ? arguments[0] : Y.Array(arguments)); self.test(); }; }, /** * Test to see if all registered items in the stack have completed, if so call the callback to `done` * @method test */ test: function () { var self = this; if (self.finished >= self.total && self.callback) { self.callback.call(self.context, self.results, self.data); } }, /** * The method to call when all the items in the stack are complete. * @method done * @param {Function} callback The callback to execute on complete * @param {Mixed} callback.results The results of all the callbacks in the stack * @param {Mixed} [callback.data] The data given to the `done` method * @param {Mixed} data Mixed data to pass to the success callback */ done: function (callback, data) { this.callback = callback; this.data = data; this.test(); } }; }, '@VERSION@', {"requires": ["yui-base"]});
seogi1004/cdnjs
ajax/libs/yui/3.7.0/parallel/parallel.js
JavaScript
mit
2,618
YUI.add('parallel', function (Y, NAME) { /** * A concurrent parallel processor to help in running several async functions. * @module parallel * @main parallel */ /** A concurrent parallel processor to help in running several async functions. var stack = new Y.Parallel(); for (var i = 0; i < 15; i++) { Y.io('./api/json/' + i, { on: { success: stack.add(function() { Y.log('Done!'); }) } }); } stack.done(function() { Y.log('All IO requests complete!'); }); @class Parallel @param {Object} o A config object @param {Object} [o.context=Y] The execution context of the callback to done */ Y.Parallel = function(o) { this.config = o || {}; this.results = []; this.context = this.config.context || Y; this.total = 0; this.finished = 0; }; Y.Parallel.prototype = { /** * An Array of results from all the callbacks in the stack * @property results * @type Array */ results: null, /** * The total items in the stack * @property total * @type Number */ total: null, /** * The number of stacked callbacks executed * @property finished * @type Number */ finished: null, /** * Add a callback to the stack * @method add * @param {Function} fn The function callback we are waiting for */ add: function (fn) { var self = this, index = self.total; self.total += 1; return function () { self.finished++; self.results[index] = (fn && fn.apply(self.context, arguments)) || (arguments.length === 1 ? arguments[0] : Y.Array(arguments)); self.test(); }; }, /** * Test to see if all registered items in the stack have completed, if so call the callback to `done` * @method test */ test: function () { var self = this; if (self.finished >= self.total && self.callback) { self.callback.call(self.context, self.results, self.data); } }, /** * The method to call when all the items in the stack are complete. * @method done * @param {Function} callback The callback to execute on complete * @param {Mixed} callback.results The results of all the callbacks in the stack * @param {Mixed} [callback.data] The data given to the `done` method * @param {Mixed} data Mixed data to pass to the success callback */ done: function (callback, data) { this.callback = callback; this.data = data; this.test(); } }; }, '@VERSION@', {"requires": ["yui-base"]});
fredericksilva/cdnjs
ajax/libs/yui/3.8.1/parallel/parallel-debug.js
JavaScript
mit
2,698
YUI.add('model-sync-rest', function (Y, NAME) { /** An extension which provides a RESTful XHR sync implementation that can be mixed into a Model or ModelList subclass. @module app @submodule model-sync-rest @since 3.6.0 **/ var Lang = Y.Lang; /** An extension which provides a RESTful XHR sync implementation that can be mixed into a Model or ModelList subclass. This makes it trivial for your Model or ModelList subclasses communicate and transmit their data via RESTful XHRs. In most cases you'll only need to provide a value for `root` when sub-classing `Y.Model`. Y.User = Y.Base.create('user', Y.Model, [Y.ModelSync.REST], { root: '/users' }); Y.Users = Y.Base.create('users', Y.ModelList, [Y.ModelSync.REST], { // By convention `Y.User`'s `root` will be used for the lists' URL. model: Y.User }); var users = new Y.Users(); // GET users list from: "/users" users.load(function () { var firstUser = users.item(0); firstUser.get('id'); // => "1" // PUT updated user data at: "/users/1" firstUser.set('name', 'Eric').save(); }); @class ModelSync.REST @extensionfor Model @extensionfor ModelList @since 3.6.0 **/ function RESTSync() {} /** A request authenticity token to validate HTTP requests made by this extension with the server when the request results in changing persistent state. This allows you to protect your server from Cross-Site Request Forgery attacks. A CSRF token provided by the server can be embedded in the HTML document and assigned to `YUI.Env.CSRF_TOKEN` like this: <script> YUI.Env.CSRF_TOKEN = {{session.authenticityToken}}; </script> The above should come after YUI seed file so that `YUI.Env` will be defined. **Note:** This can be overridden on a per-request basis. See `sync()` method. When a value for the CSRF token is provided, either statically or via `options` passed to the `save()` and `destroy()` methods, the applicable HTTP requests will have a `X-CSRF-Token` header added with the token value. @property CSRF_TOKEN @type String @default YUI.Env.CSRF_TOKEN @static @since 3.6.0 **/ RESTSync.CSRF_TOKEN = YUI.Env.CSRF_TOKEN; /** Static flag to use the HTTP POST method instead of PUT or DELETE. If the server-side HTTP framework isn't RESTful, setting this flag to `true` will cause all PUT and DELETE requests to instead use the POST HTTP method, and add a `X-HTTP-Method-Override` HTTP header with the value of the method type which was overridden. @property EMULATE_HTTP @type Boolean @default false @static @since 3.6.0 **/ RESTSync.EMULATE_HTTP = false; /** Default headers used with all XHRs. By default the `Accept` and `Content-Type` headers are set to "application/json", this signals to the HTTP server to process the request bodies as JSON and send JSON responses. If you're sending and receiving content other than JSON, you can override these headers and the `parse()` and `serialize()` methods. **Note:** These headers will be merged with any request-specific headers, and the request-specific headers will take precedence. @property HTTP_HEADERS @type Object @default { "Accept" : "application/json", "Content-Type": "application/json" } @static @since 3.6.0 **/ RESTSync.HTTP_HEADERS = { 'Accept' : 'application/json', 'Content-Type': 'application/json' }; /** Static mapping of RESTful HTTP methods corresponding to CRUD actions. @property HTTP_METHODS @type Object @default { "create": "POST", "read" : "GET", "update": "PUT", "delete": "DELETE" } @static @since 3.6.0 **/ RESTSync.HTTP_METHODS = { 'create': 'POST', 'read' : 'GET', 'update': 'PUT', 'delete': 'DELETE' }; /** The number of milliseconds before the XHRs will timeout/abort. This defaults to 30 seconds. **Note:** This can be overridden on a per-request basis. See `sync()` method. @property HTTP_TIMEOUT @type Number @default 30000 @static @since 3.6.0 **/ RESTSync.HTTP_TIMEOUT = 30000; /** Properties that shouldn't be turned into ad-hoc attributes when passed to a Model or ModelList constructor. @property _NON_ATTRS_CFG @type Array @default ["root", "url"] @static @protected @since 3.6.0 **/ RESTSync._NON_ATTRS_CFG = ['root', 'url']; RESTSync.prototype = { // -- Public Properties ---------------------------------------------------- /** A string which represents the root or collection part of the URL which relates to a Model or ModelList. Usually this value should be same for all instances of a specific Model/ModelList subclass. When sub-classing `Y.Model`, usually you'll only need to override this property, which lets the URLs for the XHRs be generated by convention. If the `root` string ends with a trailing-slash, XHR URLs will also end with a "/", and if the `root` does not end with a slash, neither will the XHR URLs. @example Y.User = Y.Base.create('user', Y.Model, [Y.ModelSync.REST], { root: '/users' }); var currentUser, newUser; // GET the user data from: "/users/123" currentUser = new Y.User({id: '123'}).load(); // POST the new user data to: "/users" newUser = new Y.User({name: 'Eric Ferraiuolo'}).save(); When sub-classing `Y.ModelList`, usually you'll want to ignore configuring the `root` and simply rely on the build-in convention of the list's generated URLs defaulting to the `root` specified by the list's `model`. @property root @type String @default "" @since 3.6.0 **/ root: '', /** A string which specifies the URL to use when making XHRs, if not value is provided, the URLs used to make XHRs will be generated by convention. While a `url` can be provided for each Model/ModelList instance, usually you'll want to either rely on the default convention or provide a tokenized string on the prototype which can be used for all instances. When sub-classing `Y.Model`, you will probably be able to rely on the default convention of generating URLs in conjunction with the `root` property and whether the model is new or not (i.e. has an `id`). If the `root` property ends with a trailing-slash, the generated URL for the specific model will also end with a trailing-slash. @example Y.User = Y.Base.create('user', Y.Model, [Y.ModelSync.REST], { root: '/users/' }); var currentUser, newUser; // GET the user data from: "/users/123/" currentUser = new Y.User({id: '123'}).load(); // POST the new user data to: "/users/" newUser = new Y.User({name: 'Eric Ferraiuolo'}).save(); If a `url` is specified, it will be processed by `Y.Lang.sub()`, which is useful when the URLs for a Model/ModelList subclass match a specific pattern and can use simple replacement tokens; e.g.: @example Y.User = Y.Base.create('user', Y.Model, [Y.ModelSync.REST], { root: '/users', url : '/users/{username}' }); **Note:** String subsitituion of the `url` only use string an number values provided by this object's attribute and/or the `options` passed to the `getURL()` method. Do not expect something fancy to happen with Object, Array, or Boolean values, they will simply be ignored. If your URLs have plural roots or collection URLs, while the specific item resources are under a singular name, e.g. "/users" (plural) and "/user/123" (singular), you'll probably want to configure the `root` and `url` properties like this: @example Y.User = Y.Base.create('user', Y.Model, [Y.ModelSync.REST], { root: '/users', url : '/user/{id}' }); var currentUser, newUser; // GET the user data from: "/user/123" currentUser = new Y.User({id: '123'}).load(); // POST the new user data to: "/users" newUser = new Y.User({name: 'Eric Ferraiuolo'}).save(); When sub-classing `Y.ModelList`, usually you'll be able to rely on the associated `model` to supply its `root` to be used as the model list's URL. If this needs to be customized, you can provide a simple string for the `url` property. @example Y.Users = Y.Base.create('users', Y.ModelList, [Y.ModelSync.REST], { // Leverages `Y.User`'s `root`, which is "/users". model: Y.User }); // Or specified explicitly... Y.Users = Y.Base.create('users', Y.ModelList, [Y.ModelSync.REST], { model: Y.User, url : '/users' }); @property url @type String @default "" @since 3.6.0 **/ url: '', // -- Lifecycle Methods ---------------------------------------------------- initializer: function (config) { config || (config = {}); // Overrides `root` at the instance level. if ('root' in config) { this.root = config.root || ''; } // Overrides `url` at the instance level. if ('url' in config) { this.url = config.url || ''; } }, // -- Public Methods ------------------------------------------------------- /** Returns the URL for this model or model list for the given `action` and `options`, if specified. This method correctly handles the variations of `root` and `url` values and is called by the `sync()` method to get the URLs used to make the XHRs. You can override this method if you need to provide a specific implementation for how the URLs of your Model and ModelList subclasses need to be generated. @method getURL @param {String} [action] Optional `sync()` action for which to generate the URL. @param {Object} [options] Optional options which may be used to help generate the URL. @return {String} this model's or model list's URL for the the given `action` and `options`. @since 3.6.0 **/ getURL: function (action, options) { var root = this.root, url = this.url; // If this is a model list, use its `url` and substitute placeholders, // but default to the `root` of its `model`. By convention a model's // `root` is the location to a collection resource. if (this._isYUIModelList) { if (!url) { return this.model.prototype.root; } return this._substituteURL(url, Y.merge(this.getAttrs(), options)); } // Assume `this` is a model. // When a model is new, i.e. has no `id`, the `root` should be used. By // convention a model's `root` is the location to a collection resource. // The model's `url` will be used as a fallback if `root` isn't defined. if (root && (action === 'create' || this.isNew())) { return root; } // When a model's `url` is not provided, we'll generate a URL to use by // convention. This will combine the model's `id` with its configured // `root` and add a trailing-slash if the root ends with "/". if (!url) { return this._joinURL(this.getAsURL('id') || ''); } // Substitute placeholders in the `url` with URL-encoded values from the // model's attribute values or the specified `options`. return this._substituteURL(url, Y.merge(this.getAttrs(), options)); }, /** Called to parse the response object returned from `Y.io()`. This method receives the full response object and is expected to "prep" a response which is suitable to pass to the `parse()` method. By default the response body is returned (`responseText`), because it usually represents the entire entity of this model on the server. If you need to parse data out of the response's headers you should do so by overriding this method. If you'd like the entire response object from the XHR to be passed to your `parse()` method, you can simply assign this property to `false`. @method parseIOResponse @param {Object} response Response object from `Y.io()`. @return {Any} The modified response to pass along to the `parse()` method. @since 3.7.0 **/ parseIOResponse: function (response) { return response.responseText; }, /** Serializes `this` model to be used as the HTTP request entity body. By default this model will be serialized to a JSON string via its `toJSON()` method. You can override this method when the HTTP server expects a different representation of this model's data that is different from the default JSON serialization. If you're sending and receive content other than JSON, be sure change the `Accept` and `Content-Type` `HTTP_HEADERS` as well. **Note:** A model's `toJSON()` method can also be overridden. If you only need to modify which attributes are serialized to JSON, that's a better place to start. @method serialize @param {String} [action] Optional `sync()` action for which to generate the the serialized representation of this model. @return {String} serialized HTTP request entity body. @since 3.6.0 **/ serialize: function (action) { return Y.JSON.stringify(this); }, /** Communicates with a RESTful HTTP server by sending and receiving data via XHRs. This method is called internally by load(), save(), and destroy(). The URL used for each XHR will be retrieved by calling the `getURL()` method and passing it the specified `action` and `options`. This method relies heavily on standard RESTful HTTP conventions @method sync @param {String} action Sync action to perform. May be one of the following: * `create`: Store a newly-created model for the first time. * `delete`: Delete an existing model. * `read` : Load an existing model. * `update`: Update an existing model. @param {Object} [options] Sync options: @param {String} [options.csrfToken] The authenticity token used by the server to verify the validity of this request and protected against CSRF attacks. This overrides the default value provided by the static `CSRF_TOKEN` property. @param {Object} [options.headers] The HTTP headers to mix with the default headers specified by the static `HTTP_HEADERS` property. @param {Number} [options.timeout] The number of milliseconds before the request will timeout and be aborted. This overrides the default provided by the static `HTTP_TIMEOUT` property. @param {Function} [callback] Called when the sync operation finishes. @param {Error|null} callback.err If an error occurred, this parameter will contain the error. If the sync operation succeeded, _err_ will be falsy. @param {Any} [callback.response] The server's response. **/ sync: function (action, options, callback) { options || (options = {}); var url = this.getURL(action, options), method = RESTSync.HTTP_METHODS[action], headers = Y.merge(RESTSync.HTTP_HEADERS, options.headers), timeout = options.timeout || RESTSync.HTTP_TIMEOUT, csrfToken = options.csrfToken || RESTSync.CSRF_TOKEN, entity; // Prepare the content if we are sending data to the server. if (method === 'POST' || method === 'PUT') { entity = this.serialize(action); } else { // Remove header, no content is being sent. delete headers['Content-Type']; } // Setup HTTP emulation for older servers if we need it. if (RESTSync.EMULATE_HTTP && (method === 'PUT' || method === 'DELETE')) { // Pass along original method type in the headers. headers['X-HTTP-Method-Override'] = method; // Fall-back to using POST method type. method = 'POST'; } // Add CSRF token to HTTP request headers if one is specified and the // request will cause side effects on the server. if (csrfToken && (method === 'POST' || method === 'PUT' || method === 'DELETE')) { headers['X-CSRF-Token'] = csrfToken; } this._sendSyncIORequest({ action : action, callback: callback, entity : entity, headers : headers, method : method, timeout : timeout, url : url }); }, // -- Protected Methods ---------------------------------------------------- /** Joins the `root` URL to the specified `url`, normalizing leading/trailing "/" characters. @example model.root = '/foo' model._joinURL('bar'); // => '/foo/bar' model._joinURL('/bar'); // => '/foo/bar' model.root = '/foo/' model._joinURL('bar'); // => '/foo/bar/' model._joinURL('/bar'); // => '/foo/bar/' @method _joinURL @param {String} url URL to append to the `root` URL. @return {String} Joined URL. @protected @since 3.6.0 **/ _joinURL: function (url) { var root = this.root; if (!(root || url)) { return ''; } if (url.charAt(0) === '/') { url = url.substring(1); } // Combines the `root` with the `url` and adds a trailing-slash if the // `root` has a trailing-slash. return root && root.charAt(root.length - 1) === '/' ? root + url + '/' : root + '/' + url; }, /** Calls both public, overrideable methods: `parseIOResponse()`, then `parse()` and returns the result. This will call into `parseIOResponse()`, if it's defined as a method, passing it the full response object from the XHR and using its return value to pass along to the `parse()`. This enables developers to easily parse data out of the response headers which should be used by the `parse()` method. @method _parse @param {Object} response Response object from `Y.io()`. @return {Object|Object[]} Attribute hash or Array of model attribute hashes. @protected @since 3.7.0 **/ _parse: function (response) { // When `parseIOResponse` is defined as a method, it will be invoked and // the result will become the new response object that the `parse()` // will be invoked with. if (typeof this.parseIOResponse === 'function') { response = this.parseIOResponse(response); } return this.parse(response); }, /** Performs the XHR and returns the resulting `Y.io()` request object. This method is called by `sync()`. @method _sendSyncIORequest @param {Object} config An object with the following properties: @param {String} config.action The `sync()` action being performed. @param {Function} [config.callback] Called when the sync operation finishes. @param {String} [config.entity] The HTTP request entity body. @param {Object} config.headers The HTTP request headers. @param {String} config.method The HTTP request method. @param {Number} [config.timeout] Time until the HTTP request is aborted. @param {String} config.url The URL of the HTTP resource. @return {Object} The resulting `Y.io()` request object. @protected @since 3.6.0 **/ _sendSyncIORequest: function (config) { return Y.io(config.url, { 'arguments': { action : config.action, callback: config.callback, url : config.url }, context: this, data : config.entity, headers: config.headers, method : config.method, timeout: config.timeout, on: { start : this._onSyncIOStart, failure: this._onSyncIOFailure, success: this._onSyncIOSuccess, end : this._onSyncIOEnd } }); }, /** Utility which takes a tokenized `url` string and substitutes its placeholders using a specified `data` object. This method will property URL-encode any values before substituting them. Also, only expect it to work with String and Number values. @example var url = this._substituteURL('/users/{name}', {id: 'Eric F'}); // => "/users/Eric%20F" @method _substituteURL @param {String} url Tokenized URL string to substitute placeholder values. @param {Object} data Set of data to fill in the `url`'s placeholders. @return {String} Substituted URL. @protected @since 3.6.0 **/ _substituteURL: function (url, data) { if (!url) { return ''; } var values = {}; // Creates a hash of the string and number values only to be used to // replace any placeholders in a tokenized `url`. Y.Object.each(data, function (v, k) { if (Lang.isString(v) || Lang.isNumber(v)) { // URL-encode any string or number values. values[k] = encodeURIComponent(v); } }); return Lang.sub(url, values); }, // -- Event Handlers ------------------------------------------------------- /** Called when the `Y.io` request has finished, after "success" or "failure" has been determined. This is a no-op by default, but provides a hook for overriding. @method _onSyncIOEnd @param {String} txId The `Y.io` transaction id. @param {Object} details Extra details carried through from `sync()`: @param {String} details.action The sync action performed. @param {Function} [details.callback] The function to call after syncing. @param {String} details.url The URL of the requested resource. @protected @since 3.6.0 **/ _onSyncIOEnd: function (txId, details) {}, /** Called when the `Y.io` request has finished unsuccessfully. By default this calls the `details.callback` function passing it the HTTP status code and message as an error object along with the response body. @method _onSyncIOFailure @param {String} txId The `Y.io` transaction id. @param {Object} res The `Y.io` response object. @param {Object} details Extra details carried through from `sync()`: @param {String} details.action The sync action performed. @param {Function} [details.callback] The function to call after syncing. @param {String} details.url The URL of the requested resource. @protected @since 3.6.0 **/ _onSyncIOFailure: function (txId, res, details) { var callback = details.callback; if (callback) { callback({ code: res.status, msg : res.statusText }, res); } }, /** Called when the `Y.io` request has finished successfully. By default this calls the `details.callback` function passing it the response body. @method _onSyncIOSuccess @param {String} txId The `Y.io` transaction id. @param {Object} res The `Y.io` response object. @param {Object} details Extra details carried through from `sync()`: @param {String} details.action The sync action performed. @param {Function} [details.callback] The function to call after syncing. @param {String} details.url The URL of the requested resource. @protected @since 3.6.0 **/ _onSyncIOSuccess: function (txId, res, details) { var callback = details.callback; if (callback) { callback(null, res); } }, /** Called when the `Y.io` request is made. This is a no-op by default, but provides a hook for overriding. @method _onSyncIOStart @param {String} txId The `Y.io` transaction id. @param {Object} details Extra details carried through from `sync()`: @param {String} detials.action The sync action performed. @param {Function} [details.callback] The function to call after syncing. @param {String} details.url The URL of the requested resource. @protected @since 3.6.0 **/ _onSyncIOStart: function (txId, details) {} }; // -- Namespace ---------------------------------------------------------------- Y.namespace('ModelSync').REST = RESTSync; }, '@VERSION@', {"requires": ["model", "io-base", "json-stringify"]});
reustle/cdnjs
ajax/libs/yui/3.10.0/model-sync-rest/model-sync-rest.js
JavaScript
mit
24,697
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Generic; using Xunit; namespace System.Globalization.Tests { public class CompareInfoLastIndexOfTests { private static CompareInfo s_invariantCompare = CultureInfo.InvariantCulture.CompareInfo; private static CompareInfo s_hungarianCompare = new CultureInfo("hu-HU").CompareInfo; private static CompareInfo s_turkishCompare = new CultureInfo("tr-TR").CompareInfo; public static IEnumerable<object[]> LastIndexOf_TestData() { // Empty strings yield return new object[] { s_invariantCompare, "foo", "", 2, 3, CompareOptions.None, 2 }; yield return new object[] { s_invariantCompare, "", "", 0, 0, CompareOptions.None, 0 }; yield return new object[] { s_invariantCompare, "", "a", 0, 0, CompareOptions.None, -1 }; yield return new object[] { s_invariantCompare, "", "", -1, 0, CompareOptions.None, 0 }; yield return new object[] { s_invariantCompare, "", "a", -1, 0, CompareOptions.None, -1 }; yield return new object[] { s_invariantCompare, "", "", 0, -1, CompareOptions.None, 0 }; yield return new object[] { s_invariantCompare, "", "a", 0, -1, CompareOptions.None, -1 }; // Start index = source.Length yield return new object[] { s_invariantCompare, "Hello", "l", 5, 5, CompareOptions.None, 3 }; yield return new object[] { s_invariantCompare, "Hello", "b", 5, 5, CompareOptions.None, -1 }; yield return new object[] { s_invariantCompare, "Hello", "l", 5, 0, CompareOptions.None, -1 }; yield return new object[] { s_invariantCompare, "Hello", "", 5, 5, CompareOptions.None, 4 }; yield return new object[] { s_invariantCompare, "Hello", "", 5, 0, CompareOptions.None, 4 }; // OrdinalIgnoreCase yield return new object[] { s_invariantCompare, "Hello", "l", 4, 5, CompareOptions.OrdinalIgnoreCase, 3 }; yield return new object[] { s_invariantCompare, "Hello", "L", 4, 5, CompareOptions.OrdinalIgnoreCase, 3 }; yield return new object[] { s_invariantCompare, "Hello", "h", 4, 5, CompareOptions.OrdinalIgnoreCase, 0 }; // Long strings yield return new object[] { s_invariantCompare, new string('a', 5555) + new string('b', 100), "aaaaaaaaaaaaaaa", 5654, 5655, CompareOptions.None, 5540 }; yield return new object[] { s_invariantCompare, new string('b', 101) + new string('a', 5555), new string('a', 5000), 5655, 5656, CompareOptions.None, 656 }; yield return new object[] { s_invariantCompare, new string('a', 5555), new string('a', 5000) + "b", 5554, 5555, CompareOptions.None, -1 }; // Hungarian yield return new object[] { s_hungarianCompare, "foobardzsdzs", "rddzs", 11, 12, CompareOptions.Ordinal, -1 }; yield return new object[] { s_invariantCompare, "foobardzsdzs", "rddzs", 11, 12, CompareOptions.None, -1 }; yield return new object[] { s_invariantCompare, "foobardzsdzs", "rddzs", 11, 12, CompareOptions.Ordinal, -1 }; // Turkish yield return new object[] { s_turkishCompare, "Hi", "I", 1, 2, CompareOptions.None, -1 }; yield return new object[] { s_turkishCompare, "Hi", "I", 1, 2, CompareOptions.IgnoreCase, -1 }; yield return new object[] { s_turkishCompare, "Hi", "\u0130", 1, 2, CompareOptions.None, -1 }; yield return new object[] { s_turkishCompare, "Hi", "\u0130", 1, 2, CompareOptions.IgnoreCase, 1 }; yield return new object[] { s_invariantCompare, "Hi", "I", 1, 2, CompareOptions.None, -1 }; yield return new object[] { s_invariantCompare, "Hi", "I", 1, 2, CompareOptions.IgnoreCase, 1 }; yield return new object[] { s_invariantCompare, "Hi", "\u0130", 1, 2, CompareOptions.None, -1 }; yield return new object[] { s_invariantCompare, "Hi", "\u0130", 1, 2, CompareOptions.IgnoreCase, -1 }; // Unicode yield return new object[] { s_invariantCompare, "Exhibit \u00C0", "A\u0300", 8, 9, CompareOptions.None, 8 }; yield return new object[] { s_invariantCompare, "Exhibit \u00C0", "A\u0300", 8, 9, CompareOptions.Ordinal, -1 }; yield return new object[] { s_invariantCompare, "Exhibit \u00C0", "a\u0300", 8, 9, CompareOptions.None, -1 }; yield return new object[] { s_invariantCompare, "Exhibit \u00C0", "a\u0300", 8, 9, CompareOptions.IgnoreCase, 8 }; yield return new object[] { s_invariantCompare, "Exhibit \u00C0", "a\u0300", 8, 9, CompareOptions.OrdinalIgnoreCase, -1 }; yield return new object[] { s_invariantCompare, "Exhibit \u00C0", "a\u0300", 8, 9, CompareOptions.Ordinal, -1 }; yield return new object[] { s_invariantCompare, "FooBar", "Foo\u0400Bar", 5, 6, CompareOptions.Ordinal, -1 }; yield return new object[] { s_invariantCompare, "TestFooBA\u0300R", "FooB\u00C0R", 10, 11, CompareOptions.IgnoreNonSpace, 4 }; // Ignore symbols yield return new object[] { s_invariantCompare, "More Test's", "Tests", 10, 11, CompareOptions.IgnoreSymbols, 5 }; yield return new object[] { s_invariantCompare, "More Test's", "Tests", 10, 11, CompareOptions.None, -1 }; yield return new object[] { s_invariantCompare, "cbabababdbaba", "ab", 12, 13, CompareOptions.None, 10 }; // Platform differences yield return new object[] { s_hungarianCompare, "foobardzsdzs", "rddzs", 11, 12, CompareOptions.None, PlatformDetection.IsWindows ? 5 : -1 }; } public static IEnumerable<object[]> LastIndexOf_Aesc_Ligature_TestData() { bool isWindows = PlatformDetection.IsWindows; // Searches for the ligature Æ string source = "Is AE or ae the same as \u00C6 or \u00E6?"; yield return new object[] { s_invariantCompare, source, "AE", 25, 18, CompareOptions.None, isWindows ? 24 : -1 }; yield return new object[] { s_invariantCompare, source, "ae", 25, 18, CompareOptions.None, 9 }; yield return new object[] { s_invariantCompare, source, '\u00C6', 25, 18, CompareOptions.None, 24 }; yield return new object[] { s_invariantCompare, source, '\u00E6', 25, 18, CompareOptions.None, isWindows ? 9 : -1 }; yield return new object[] { s_invariantCompare, source, "AE", 25, 18, CompareOptions.Ordinal, -1 }; yield return new object[] { s_invariantCompare, source, "ae", 25, 18, CompareOptions.Ordinal, 9 }; yield return new object[] { s_invariantCompare, source, '\u00C6', 25, 18, CompareOptions.Ordinal, 24 }; yield return new object[] { s_invariantCompare, source, '\u00E6', 25, 18, CompareOptions.Ordinal, -1 }; yield return new object[] { s_invariantCompare, source, "AE", 25, 18, CompareOptions.IgnoreCase, isWindows ? 24 : 9 }; yield return new object[] { s_invariantCompare, source, "ae", 25, 18, CompareOptions.IgnoreCase, isWindows ? 24 : 9 }; yield return new object[] { s_invariantCompare, source, '\u00C6', 25, 18, CompareOptions.IgnoreCase, 24 }; yield return new object[] { s_invariantCompare, source, '\u00E6', 25, 18, CompareOptions.IgnoreCase, 24 }; } public static IEnumerable<object[]> LastIndexOf_U_WithDiaeresis_TestData() { // Searches for the combining character sequence Latin capital letter U with diaeresis or Latin small letter u with diaeresis. string source = "Is \u0055\u0308 or \u0075\u0308 the same as \u00DC or \u00FC?"; yield return new object[] { s_invariantCompare, source, "U\u0308", 25, 18, CompareOptions.None, 24 }; yield return new object[] { s_invariantCompare, source, "u\u0308", 25, 18, CompareOptions.None, 9 }; yield return new object[] { s_invariantCompare, source, '\u00DC', 25, 18, CompareOptions.None, 24 }; yield return new object[] { s_invariantCompare, source, '\u00FC', 25, 18, CompareOptions.None, 9 }; yield return new object[] { s_invariantCompare, source, "U\u0308", 25, 18, CompareOptions.Ordinal, -1 }; yield return new object[] { s_invariantCompare, source, "u\u0308", 25, 18, CompareOptions.Ordinal, 9 }; yield return new object[] { s_invariantCompare, source, '\u00DC', 25, 18, CompareOptions.Ordinal, 24 }; yield return new object[] { s_invariantCompare, source, '\u00FC', 25, 18, CompareOptions.Ordinal, -1 }; yield return new object[] { s_invariantCompare, source, "U\u0308", 25, 18, CompareOptions.IgnoreCase, 24 }; yield return new object[] { s_invariantCompare, source, "u\u0308", 25, 18, CompareOptions.IgnoreCase, 24 }; yield return new object[] { s_invariantCompare, source, '\u00DC', 25, 18, CompareOptions.IgnoreCase, 24 }; yield return new object[] { s_invariantCompare, source, '\u00FC', 25, 18, CompareOptions.IgnoreCase, 24 }; } [Theory] [MemberData(nameof(LastIndexOf_TestData))] [MemberData(nameof(LastIndexOf_U_WithDiaeresis_TestData))] public void LastIndexOf_String(CompareInfo compareInfo, string source, string value, int startIndex, int count, CompareOptions options, int expected) { if (value.Length == 1) { LastIndexOf_Char(compareInfo, source, value[0], startIndex, count, options, expected); } if (options == CompareOptions.None) { // Use LastIndexOf(string, string, int, int) or LastIndexOf(string, string) if (startIndex + 1 == source.Length && count == source.Length) { // Use LastIndexOf(string, string) Assert.Equal(expected, compareInfo.LastIndexOf(source, value)); } // Use LastIndexOf(string, string, int, int) Assert.Equal(expected, compareInfo.LastIndexOf(source, value, startIndex, count)); } if (count - startIndex - 1 == 0) { // Use LastIndexOf(string, string, int, CompareOptions) or LastIndexOf(string, string, CompareOptions) if (startIndex == source.Length) { // Use LastIndexOf(string, string, CompareOptions) Assert.Equal(expected, compareInfo.LastIndexOf(source, value, options)); } // Use LastIndexOf(string, string, int, CompareOptions) Assert.Equal(expected, compareInfo.LastIndexOf(source, value, startIndex, options)); } // Use LastIndexOf(string, string, int, int, CompareOptions) Assert.Equal(expected, compareInfo.LastIndexOf(source, value, startIndex, count, options)); } public void LastIndexOf_Char(CompareInfo compareInfo, string source, char value, int startIndex, int count, CompareOptions options, int expected) { if (options == CompareOptions.None) { // Use LastIndexOf(string, char, int, int) or LastIndexOf(string, char) if (startIndex + 1 == source.Length && count == source.Length) { // Use LastIndexOf(string, char) Assert.Equal(expected, compareInfo.LastIndexOf(source, value)); } // Use LastIndexOf(string, char, int, int) Assert.Equal(expected, compareInfo.LastIndexOf(source, value, startIndex, count)); } if (count - startIndex - 1 == 0) { // Use LastIndexOf(string, char, int, CompareOptions) or LastIndexOf(string, char, CompareOptions) if (startIndex == source.Length) { // Use LastIndexOf(string, char, CompareOptions) Assert.Equal(expected, compareInfo.LastIndexOf(source, value, options)); } // Use LastIndexOf(string, char, int, CompareOptions) Assert.Equal(expected, compareInfo.LastIndexOf(source, value, startIndex, options)); } // Use LastIndexOf(string, char, int, int, CompareOptions) Assert.Equal(expected, compareInfo.LastIndexOf(source, value, startIndex, count, options)); } [Theory] [MemberData(nameof(LastIndexOf_Aesc_Ligature_TestData))] public void LastIndexOf_Aesc_Ligature(CompareInfo compareInfo, string source, string value, int startIndex, int count, CompareOptions options, int expected) { LastIndexOf_String(compareInfo, source, value, startIndex, count, options, expected); } [Fact] public void LastIndexOf_UnassignedUnicode() { bool isWindows = PlatformDetection.IsWindows; LastIndexOf_String(s_invariantCompare, "FooBar", "Foo\uFFFFBar", 5, 6, CompareOptions.None, isWindows ? 0 : -1); LastIndexOf_String(s_invariantCompare, "~FooBar", "Foo\uFFFFBar", 6, 7, CompareOptions.IgnoreNonSpace, isWindows ? 1 : -1); } [Fact] public void LastIndexOf_Invalid() { // Source is null AssertExtensions.Throws<ArgumentNullException>("source", () => s_invariantCompare.LastIndexOf(null, "a")); AssertExtensions.Throws<ArgumentNullException>("source", () => s_invariantCompare.LastIndexOf(null, "a", CompareOptions.None)); AssertExtensions.Throws<ArgumentNullException>("source", () => s_invariantCompare.LastIndexOf(null, "a", 0, 0)); AssertExtensions.Throws<ArgumentNullException>("source", () => s_invariantCompare.LastIndexOf(null, "a", 0, CompareOptions.None)); AssertExtensions.Throws<ArgumentNullException>("source", () => s_invariantCompare.LastIndexOf(null, "a", 0, 0, CompareOptions.None)); AssertExtensions.Throws<ArgumentNullException>("source", () => s_invariantCompare.LastIndexOf(null, 'a')); AssertExtensions.Throws<ArgumentNullException>("source", () => s_invariantCompare.LastIndexOf(null, 'a', CompareOptions.None)); AssertExtensions.Throws<ArgumentNullException>("source", () => s_invariantCompare.LastIndexOf(null, 'a', 0, 0)); AssertExtensions.Throws<ArgumentNullException>("source", () => s_invariantCompare.LastIndexOf(null, 'a', 0, CompareOptions.None)); AssertExtensions.Throws<ArgumentNullException>("source", () => s_invariantCompare.LastIndexOf(null, 'a', 0, 0, CompareOptions.None)); // Value is null AssertExtensions.Throws<ArgumentNullException>("value", () => s_invariantCompare.LastIndexOf("", null)); AssertExtensions.Throws<ArgumentNullException>("value", () => s_invariantCompare.LastIndexOf("", null, CompareOptions.None)); AssertExtensions.Throws<ArgumentNullException>("value", () => s_invariantCompare.LastIndexOf("", null, 0, 0)); AssertExtensions.Throws<ArgumentNullException>("value", () => s_invariantCompare.LastIndexOf("", null, 0, CompareOptions.None)); AssertExtensions.Throws<ArgumentNullException>("value", () => s_invariantCompare.LastIndexOf("", null, 0, 0, CompareOptions.None)); // Source and value are null AssertExtensions.Throws<ArgumentNullException>("source", () => s_invariantCompare.LastIndexOf(null, null)); AssertExtensions.Throws<ArgumentNullException>("source", () => s_invariantCompare.LastIndexOf(null, null, CompareOptions.None)); AssertExtensions.Throws<ArgumentNullException>("source", () => s_invariantCompare.LastIndexOf(null, null, 0, 0)); AssertExtensions.Throws<ArgumentNullException>("source", () => s_invariantCompare.LastIndexOf(null, null, 0, CompareOptions.None)); AssertExtensions.Throws<ArgumentNullException>("source", () => s_invariantCompare.LastIndexOf(null, null, 0, 0, CompareOptions.None)); // Options are invalid AssertExtensions.Throws<ArgumentException>("options", () => s_invariantCompare.LastIndexOf("Test's", "Tests", CompareOptions.StringSort)); AssertExtensions.Throws<ArgumentException>("options", () => s_invariantCompare.LastIndexOf("Test's", "Tests", 0, CompareOptions.StringSort)); AssertExtensions.Throws<ArgumentException>("options", () => s_invariantCompare.LastIndexOf("Test's", "Tests", 0, 2, CompareOptions.StringSort)); AssertExtensions.Throws<ArgumentException>("options", () => s_invariantCompare.LastIndexOf("Test's", 'a', CompareOptions.StringSort)); AssertExtensions.Throws<ArgumentException>("options", () => s_invariantCompare.LastIndexOf("Test's", 'a', 0, CompareOptions.StringSort)); AssertExtensions.Throws<ArgumentException>("options", () => s_invariantCompare.LastIndexOf("Test's", 'a', 0, 2, CompareOptions.StringSort)); AssertExtensions.Throws<ArgumentException>("options", () => s_invariantCompare.LastIndexOf("Test's", "Tests", CompareOptions.Ordinal | CompareOptions.IgnoreWidth)); AssertExtensions.Throws<ArgumentException>("options", () => s_invariantCompare.LastIndexOf("Test's", "Tests", 0, CompareOptions.Ordinal | CompareOptions.IgnoreWidth)); AssertExtensions.Throws<ArgumentException>("options", () => s_invariantCompare.LastIndexOf("Test's", "Tests", 0, 2, CompareOptions.Ordinal | CompareOptions.IgnoreWidth)); AssertExtensions.Throws<ArgumentException>("options", () => s_invariantCompare.LastIndexOf("Test's", 'a', CompareOptions.Ordinal | CompareOptions.IgnoreWidth)); AssertExtensions.Throws<ArgumentException>("options", () => s_invariantCompare.LastIndexOf("Test's", 'a', 0, CompareOptions.Ordinal | CompareOptions.IgnoreWidth)); AssertExtensions.Throws<ArgumentException>("options", () => s_invariantCompare.LastIndexOf("Test's", 'a', 0, 2, CompareOptions.Ordinal | CompareOptions.IgnoreWidth)); AssertExtensions.Throws<ArgumentException>("options", () => s_invariantCompare.LastIndexOf("Test's", "Tests", CompareOptions.OrdinalIgnoreCase | CompareOptions.IgnoreWidth)); AssertExtensions.Throws<ArgumentException>("options", () => s_invariantCompare.LastIndexOf("Test's", "Tests", 0, CompareOptions.OrdinalIgnoreCase | CompareOptions.IgnoreWidth)); AssertExtensions.Throws<ArgumentException>("options", () => s_invariantCompare.LastIndexOf("Test's", "Tests", 0, 2, CompareOptions.OrdinalIgnoreCase | CompareOptions.IgnoreWidth)); AssertExtensions.Throws<ArgumentException>("options", () => s_invariantCompare.LastIndexOf("Test's", 'a', CompareOptions.OrdinalIgnoreCase | CompareOptions.IgnoreWidth)); AssertExtensions.Throws<ArgumentException>("options", () => s_invariantCompare.LastIndexOf("Test's", 'a', 0, CompareOptions.OrdinalIgnoreCase | CompareOptions.IgnoreWidth)); AssertExtensions.Throws<ArgumentException>("options", () => s_invariantCompare.LastIndexOf("Test's", 'a', 0, 2, CompareOptions.OrdinalIgnoreCase | CompareOptions.IgnoreWidth)); AssertExtensions.Throws<ArgumentException>("options", () => s_invariantCompare.LastIndexOf("Test's", "Tests", (CompareOptions)(-1))); AssertExtensions.Throws<ArgumentException>("options", () => s_invariantCompare.LastIndexOf("Test's", "Tests", 0, (CompareOptions)(-1))); AssertExtensions.Throws<ArgumentException>("options", () => s_invariantCompare.LastIndexOf("Test's", "Tests", 0, 2, (CompareOptions)(-1))); AssertExtensions.Throws<ArgumentException>("options", () => s_invariantCompare.LastIndexOf("Test's", "Tests", (CompareOptions)(-1))); AssertExtensions.Throws<ArgumentException>("options", () => s_invariantCompare.LastIndexOf("Test's", 'a', 0, (CompareOptions)(-1))); AssertExtensions.Throws<ArgumentException>("options", () => s_invariantCompare.LastIndexOf("Test's", 'a', 0, 2, (CompareOptions)(-1))); AssertExtensions.Throws<ArgumentException>("options", () => s_invariantCompare.LastIndexOf("Test's", "Tests", (CompareOptions)0x11111111)); AssertExtensions.Throws<ArgumentException>("options", () => s_invariantCompare.LastIndexOf("Test's", "Tests", 0, (CompareOptions)0x11111111)); AssertExtensions.Throws<ArgumentException>("options", () => s_invariantCompare.LastIndexOf("Test's", "Tests", 0, 2, (CompareOptions)0x11111111)); AssertExtensions.Throws<ArgumentException>("options", () => s_invariantCompare.LastIndexOf("Test's", 'a', (CompareOptions)0x11111111)); AssertExtensions.Throws<ArgumentException>("options", () => s_invariantCompare.LastIndexOf("Test's", 'a', 0, (CompareOptions)0x11111111)); AssertExtensions.Throws<ArgumentException>("options", () => s_invariantCompare.LastIndexOf("Test's", 'a', 0, 2, (CompareOptions)0x11111111)); // StartIndex < 0 AssertExtensions.Throws<ArgumentOutOfRangeException>("startIndex", () => s_invariantCompare.LastIndexOf("Test", "Test", -1, CompareOptions.None)); AssertExtensions.Throws<ArgumentOutOfRangeException>("startIndex", () => s_invariantCompare.LastIndexOf("Test", "Test", -1, 2)); AssertExtensions.Throws<ArgumentOutOfRangeException>("startIndex", () => s_invariantCompare.LastIndexOf("Test", "Test", -1, 2, CompareOptions.None)); AssertExtensions.Throws<ArgumentOutOfRangeException>("startIndex", () => s_invariantCompare.LastIndexOf("Test", 'a', -1, CompareOptions.None)); AssertExtensions.Throws<ArgumentOutOfRangeException>("startIndex", () => s_invariantCompare.LastIndexOf("Test", 'a', -1, 2)); AssertExtensions.Throws<ArgumentOutOfRangeException>("startIndex", () => s_invariantCompare.LastIndexOf("Test", 'a', -1, 2, CompareOptions.None)); // StartIndex >= source.Length AssertExtensions.Throws<ArgumentOutOfRangeException>("startIndex", () => s_invariantCompare.LastIndexOf("Test", "Test", 5, CompareOptions.None)); AssertExtensions.Throws<ArgumentOutOfRangeException>("startIndex", () => s_invariantCompare.LastIndexOf("Test", "Test", 5, 0)); AssertExtensions.Throws<ArgumentOutOfRangeException>("startIndex", () => s_invariantCompare.LastIndexOf("Test", "Test", 5, 0, CompareOptions.None)); AssertExtensions.Throws<ArgumentOutOfRangeException>("startIndex", () => s_invariantCompare.LastIndexOf("Test", 'a', 5, CompareOptions.None)); AssertExtensions.Throws<ArgumentOutOfRangeException>("startIndex", () => s_invariantCompare.LastIndexOf("Test", 'a', 5, 0)); AssertExtensions.Throws<ArgumentOutOfRangeException>("startIndex", () => s_invariantCompare.LastIndexOf("Test", 'a', 5, 0, CompareOptions.None)); // Count < 0 AssertExtensions.Throws<ArgumentOutOfRangeException>("count", () => s_invariantCompare.LastIndexOf("Test", "Test", 0, -1)); AssertExtensions.Throws<ArgumentOutOfRangeException>("count", () => s_invariantCompare.LastIndexOf("Test", "Test", 0, -1, CompareOptions.None)); AssertExtensions.Throws<ArgumentOutOfRangeException>("count", () => s_invariantCompare.LastIndexOf("Test", 'a', 0, -1)); AssertExtensions.Throws<ArgumentOutOfRangeException>("count", () => s_invariantCompare.LastIndexOf("Test", 'a', 0, -1, CompareOptions.None)); AssertExtensions.Throws<ArgumentOutOfRangeException>("count", () => s_invariantCompare.LastIndexOf("Test", "Test", 4, -1)); AssertExtensions.Throws<ArgumentOutOfRangeException>("count", () => s_invariantCompare.LastIndexOf("Test", "Test", 4, -1, CompareOptions.None)); AssertExtensions.Throws<ArgumentOutOfRangeException>("count", () => s_invariantCompare.LastIndexOf("Test", 'a', 4, -1)); AssertExtensions.Throws<ArgumentOutOfRangeException>("count", () => s_invariantCompare.LastIndexOf("Test", 'a', 4, -1, CompareOptions.None)); AssertExtensions.Throws<ArgumentOutOfRangeException>("count", () => s_invariantCompare.LastIndexOf("Test", "", 4, -1)); AssertExtensions.Throws<ArgumentOutOfRangeException>("count", () => s_invariantCompare.LastIndexOf("Test", "", 4, -1, CompareOptions.None)); // Count > source.Length AssertExtensions.Throws<ArgumentOutOfRangeException>("count", () => s_invariantCompare.LastIndexOf("Test", "Test", 0, 5)); AssertExtensions.Throws<ArgumentOutOfRangeException>("count", () => s_invariantCompare.LastIndexOf("Test", "Test", 0, 5, CompareOptions.None)); AssertExtensions.Throws<ArgumentOutOfRangeException>("count", () => s_invariantCompare.LastIndexOf("Test", 'a', 0, 5)); AssertExtensions.Throws<ArgumentOutOfRangeException>("count", () => s_invariantCompare.LastIndexOf("Test", 'a', 0, 5, CompareOptions.None)); // StartIndex + count > source.Length + 1 AssertExtensions.Throws<ArgumentOutOfRangeException>("count", () => s_invariantCompare.LastIndexOf("Test", "Test", 3, 5)); AssertExtensions.Throws<ArgumentOutOfRangeException>("count", () => s_invariantCompare.LastIndexOf("Test", "Test", 3, 5, CompareOptions.None)); AssertExtensions.Throws<ArgumentOutOfRangeException>("count", () => s_invariantCompare.LastIndexOf("Test", 'a', 3, 5)); AssertExtensions.Throws<ArgumentOutOfRangeException>("count", () => s_invariantCompare.LastIndexOf("Test", 'a', 3, 5, CompareOptions.None)); AssertExtensions.Throws<ArgumentOutOfRangeException>("count", () => s_invariantCompare.LastIndexOf("Test", "s", 4, 6)); AssertExtensions.Throws<ArgumentOutOfRangeException>("count", () => s_invariantCompare.LastIndexOf("Test", "s", 4, 7, CompareOptions.None)); AssertExtensions.Throws<ArgumentOutOfRangeException>("count", () => s_invariantCompare.LastIndexOf("Test", 's', 4, 6)); AssertExtensions.Throws<ArgumentOutOfRangeException>("count", () => s_invariantCompare.LastIndexOf("Test", 's', 4, 7, CompareOptions.None)); } } }
Petermarcu/corefx
src/System.Globalization/tests/CompareInfo/CompareInfoTests.LastIndexOf.cs
C#
mit
26,495
<?php // Make the page validate ini_set('session.use_trans_sid', '0'); // Include the random string file require 'rand.php'; // Begin the session session_start(); // Set the session contents $_SESSION['captcha_id'] = $str; ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>AJAX CAPTCHA</title> <script src="../../lib/jquery.js"></script> <script src="../../dist/jquery.validate.js"></script> <script src="captcha.js"></script> <link rel="stylesheet" href="style.css"> <style> img { border: 1px solid #eee; } p#statusgreen { font-size: 1.2em; background-color: #fff; color: #0a0; } p#statusred { font-size: 1.2em; background-color: #fff; color: #a00; } fieldset label { display: block; } fieldset div#captchaimage { float: left; margin-right: 15px; } fieldset input#captcha { width: 25%; border: 1px solid #ddd; padding: 2px; } fieldset input#submit { display: block; margin: 2% 0% 0% 0%; } #captcha.success { border: 1px solid #49c24f; background: #bcffbf; } #captcha.error { border: 1px solid #c24949; background: #ffbcbc; } </style> </head> <body> <h1><acronym title="Asynchronous JavaScript And XML">AJAX</acronym> <acronym title="Completely Automated Public Turing test to tell Computers and Humans Apart">CAPTCHA</acronym>, based on <a href="http://psyrens.com/captcha/">http://psyrens.com/captcha/</a></h1> <form id="captchaform" action=""> <fieldset> <div id="captchaimage"><a href="<?php echo $_SERVER['PHP_SELF']; ?>" id="refreshimg" title="Click to refresh image"><img src="images/image.php?<?php echo time(); ?>" width="132" height="46" alt="Captcha image"></a></div> <label for="captcha">Enter the characters as seen on the image above (case insensitive):</label> <input type="text" maxlength="6" name="captcha" id="captcha"> <input type="submit" name="submit" id="submit" value="Check"> </fieldset> </form> <p>If you can&#39;t decipher the text on the image, click it to dynamically generate a new one.</p> </body> </html>
oncebuilder/OnceBuilder
libs/jquery-validation/demo/captcha/index.php
PHP
mit
2,038
module TZInfo module Definitions module America module Toronto include TimezoneDefinition timezone 'America/Toronto' do |tz| tz.offset :o0, -19052, 0, :LMT tz.offset :o1, -18000, 0, :EST tz.offset :o2, -18000, 3600, :EDT tz.offset :o3, -18000, 3600, :EWT tz.offset :o4, -18000, 3600, :EPT tz.transition 1895, 1, :o1, 52125005963, 21600 tz.transition 1918, 4, :o2, 58120747, 24 tz.transition 1918, 10, :o1, 9687575, 4 tz.transition 1919, 3, :o2, 38752779, 16 tz.transition 1919, 10, :o1, 7266773, 3 tz.transition 1920, 5, :o2, 58138723, 24 tz.transition 1920, 9, :o1, 7267781, 3 tz.transition 1921, 5, :o2, 58147795, 24 tz.transition 1921, 9, :o1, 9691791, 4 tz.transition 1922, 5, :o2, 58156531, 24 tz.transition 1922, 9, :o1, 9693259, 4 tz.transition 1923, 5, :o2, 58165267, 24 tz.transition 1923, 9, :o1, 9694715, 4 tz.transition 1924, 5, :o2, 58173835, 24 tz.transition 1924, 9, :o1, 9696199, 4 tz.transition 1925, 5, :o2, 58182571, 24 tz.transition 1925, 9, :o1, 9697655, 4 tz.transition 1926, 5, :o2, 58191307, 24 tz.transition 1926, 9, :o1, 9699111, 4 tz.transition 1927, 5, :o2, 58200043, 24 tz.transition 1927, 9, :o1, 9700595, 4 tz.transition 1928, 4, :o2, 58208779, 24 tz.transition 1928, 9, :o1, 9702079, 4 tz.transition 1929, 4, :o2, 58217515, 24 tz.transition 1929, 9, :o1, 9703535, 4 tz.transition 1930, 4, :o2, 58226251, 24 tz.transition 1930, 9, :o1, 9704991, 4 tz.transition 1931, 4, :o2, 58234987, 24 tz.transition 1931, 9, :o1, 9706447, 4 tz.transition 1932, 5, :o2, 58243891, 24 tz.transition 1932, 9, :o1, 9707903, 4 tz.transition 1933, 4, :o2, 58252627, 24 tz.transition 1933, 10, :o1, 9709387, 4 tz.transition 1934, 4, :o2, 58261363, 24 tz.transition 1934, 9, :o1, 9710843, 4 tz.transition 1935, 4, :o2, 58270099, 24 tz.transition 1935, 9, :o1, 9712299, 4 tz.transition 1936, 4, :o2, 58278835, 24 tz.transition 1936, 9, :o1, 9713755, 4 tz.transition 1937, 4, :o2, 58287571, 24 tz.transition 1937, 9, :o1, 9715211, 4 tz.transition 1938, 4, :o2, 58296307, 24 tz.transition 1938, 9, :o1, 9716667, 4 tz.transition 1939, 4, :o2, 58305211, 24 tz.transition 1939, 9, :o1, 9718123, 4 tz.transition 1940, 4, :o2, 58313947, 24 tz.transition 1942, 2, :o3, 58329595, 24 tz.transition 1945, 8, :o4, 58360379, 24 tz.transition 1945, 9, :o1, 9726915, 4 tz.transition 1946, 4, :o2, 58366531, 24 tz.transition 1946, 9, :o1, 9728371, 4 tz.transition 1947, 4, :o2, 58375265, 24 tz.transition 1947, 9, :o1, 7297370, 3 tz.transition 1948, 4, :o2, 58384001, 24 tz.transition 1948, 9, :o1, 7298462, 3 tz.transition 1949, 4, :o2, 58392737, 24 tz.transition 1949, 11, :o1, 7299743, 3 tz.transition 1950, 4, :o2, 58401643, 24 tz.transition 1950, 11, :o1, 9734447, 4 tz.transition 1951, 4, :o2, 58410379, 24 tz.transition 1951, 9, :o1, 9735679, 4 tz.transition 1952, 4, :o2, 58419115, 24 tz.transition 1952, 9, :o1, 9737135, 4 tz.transition 1953, 4, :o2, 58427851, 24 tz.transition 1953, 9, :o1, 9738591, 4 tz.transition 1954, 4, :o2, 58436587, 24 tz.transition 1954, 9, :o1, 9740047, 4 tz.transition 1955, 4, :o2, 58445323, 24 tz.transition 1955, 9, :o1, 9741503, 4 tz.transition 1956, 4, :o2, 58454227, 24 tz.transition 1956, 9, :o1, 9742987, 4 tz.transition 1957, 4, :o2, 58462963, 24 tz.transition 1957, 10, :o1, 9744555, 4 tz.transition 1958, 4, :o2, 58471699, 24 tz.transition 1958, 10, :o1, 9746011, 4 tz.transition 1959, 4, :o2, 58480435, 24 tz.transition 1959, 10, :o1, 9747467, 4 tz.transition 1960, 4, :o2, 58489171, 24 tz.transition 1960, 10, :o1, 9748951, 4 tz.transition 1961, 4, :o2, 58498075, 24 tz.transition 1961, 10, :o1, 9750407, 4 tz.transition 1962, 4, :o2, 58506811, 24 tz.transition 1962, 10, :o1, 9751863, 4 tz.transition 1963, 4, :o2, 58515547, 24 tz.transition 1963, 10, :o1, 9753319, 4 tz.transition 1964, 4, :o2, 58524283, 24 tz.transition 1964, 10, :o1, 9754775, 4 tz.transition 1965, 4, :o2, 58533019, 24 tz.transition 1965, 10, :o1, 9756259, 4 tz.transition 1966, 4, :o2, 58541755, 24 tz.transition 1966, 10, :o1, 9757715, 4 tz.transition 1967, 4, :o2, 58550659, 24 tz.transition 1967, 10, :o1, 9759171, 4 tz.transition 1968, 4, :o2, 58559395, 24 tz.transition 1968, 10, :o1, 9760627, 4 tz.transition 1969, 4, :o2, 58568131, 24 tz.transition 1969, 10, :o1, 9762083, 4 tz.transition 1970, 4, :o2, 9961200 tz.transition 1970, 10, :o1, 25682400 tz.transition 1971, 4, :o2, 41410800 tz.transition 1971, 10, :o1, 57736800 tz.transition 1972, 4, :o2, 73465200 tz.transition 1972, 10, :o1, 89186400 tz.transition 1973, 4, :o2, 104914800 tz.transition 1973, 10, :o1, 120636000 tz.transition 1974, 4, :o2, 136364400 tz.transition 1974, 10, :o1, 152085600 tz.transition 1975, 4, :o2, 167814000 tz.transition 1975, 10, :o1, 183535200 tz.transition 1976, 4, :o2, 199263600 tz.transition 1976, 10, :o1, 215589600 tz.transition 1977, 4, :o2, 230713200 tz.transition 1977, 10, :o1, 247039200 tz.transition 1978, 4, :o2, 262767600 tz.transition 1978, 10, :o1, 278488800 tz.transition 1979, 4, :o2, 294217200 tz.transition 1979, 10, :o1, 309938400 tz.transition 1980, 4, :o2, 325666800 tz.transition 1980, 10, :o1, 341388000 tz.transition 1981, 4, :o2, 357116400 tz.transition 1981, 10, :o1, 372837600 tz.transition 1982, 4, :o2, 388566000 tz.transition 1982, 10, :o1, 404892000 tz.transition 1983, 4, :o2, 420015600 tz.transition 1983, 10, :o1, 436341600 tz.transition 1984, 4, :o2, 452070000 tz.transition 1984, 10, :o1, 467791200 tz.transition 1985, 4, :o2, 483519600 tz.transition 1985, 10, :o1, 499240800 tz.transition 1986, 4, :o2, 514969200 tz.transition 1986, 10, :o1, 530690400 tz.transition 1987, 4, :o2, 544604400 tz.transition 1987, 10, :o1, 562140000 tz.transition 1988, 4, :o2, 576054000 tz.transition 1988, 10, :o1, 594194400 tz.transition 1989, 4, :o2, 607503600 tz.transition 1989, 10, :o1, 625644000 tz.transition 1990, 4, :o2, 638953200 tz.transition 1990, 10, :o1, 657093600 tz.transition 1991, 4, :o2, 671007600 tz.transition 1991, 10, :o1, 688543200 tz.transition 1992, 4, :o2, 702457200 tz.transition 1992, 10, :o1, 719992800 tz.transition 1993, 4, :o2, 733906800 tz.transition 1993, 10, :o1, 752047200 tz.transition 1994, 4, :o2, 765356400 tz.transition 1994, 10, :o1, 783496800 tz.transition 1995, 4, :o2, 796806000 tz.transition 1995, 10, :o1, 814946400 tz.transition 1996, 4, :o2, 828860400 tz.transition 1996, 10, :o1, 846396000 tz.transition 1997, 4, :o2, 860310000 tz.transition 1997, 10, :o1, 877845600 tz.transition 1998, 4, :o2, 891759600 tz.transition 1998, 10, :o1, 909295200 tz.transition 1999, 4, :o2, 923209200 tz.transition 1999, 10, :o1, 941349600 tz.transition 2000, 4, :o2, 954658800 tz.transition 2000, 10, :o1, 972799200 tz.transition 2001, 4, :o2, 986108400 tz.transition 2001, 10, :o1, 1004248800 tz.transition 2002, 4, :o2, 1018162800 tz.transition 2002, 10, :o1, 1035698400 tz.transition 2003, 4, :o2, 1049612400 tz.transition 2003, 10, :o1, 1067148000 tz.transition 2004, 4, :o2, 1081062000 tz.transition 2004, 10, :o1, 1099202400 tz.transition 2005, 4, :o2, 1112511600 tz.transition 2005, 10, :o1, 1130652000 tz.transition 2006, 4, :o2, 1143961200 tz.transition 2006, 10, :o1, 1162101600 tz.transition 2007, 3, :o2, 1173596400 tz.transition 2007, 11, :o1, 1194156000 tz.transition 2008, 3, :o2, 1205046000 tz.transition 2008, 11, :o1, 1225605600 tz.transition 2009, 3, :o2, 1236495600 tz.transition 2009, 11, :o1, 1257055200 tz.transition 2010, 3, :o2, 1268550000 tz.transition 2010, 11, :o1, 1289109600 tz.transition 2011, 3, :o2, 1299999600 tz.transition 2011, 11, :o1, 1320559200 tz.transition 2012, 3, :o2, 1331449200 tz.transition 2012, 11, :o1, 1352008800 tz.transition 2013, 3, :o2, 1362898800 tz.transition 2013, 11, :o1, 1383458400 tz.transition 2014, 3, :o2, 1394348400 tz.transition 2014, 11, :o1, 1414908000 tz.transition 2015, 3, :o2, 1425798000 tz.transition 2015, 11, :o1, 1446357600 tz.transition 2016, 3, :o2, 1457852400 tz.transition 2016, 11, :o1, 1478412000 tz.transition 2017, 3, :o2, 1489302000 tz.transition 2017, 11, :o1, 1509861600 tz.transition 2018, 3, :o2, 1520751600 tz.transition 2018, 11, :o1, 1541311200 tz.transition 2019, 3, :o2, 1552201200 tz.transition 2019, 11, :o1, 1572760800 tz.transition 2020, 3, :o2, 1583650800 tz.transition 2020, 11, :o1, 1604210400 tz.transition 2021, 3, :o2, 1615705200 tz.transition 2021, 11, :o1, 1636264800 tz.transition 2022, 3, :o2, 1647154800 tz.transition 2022, 11, :o1, 1667714400 tz.transition 2023, 3, :o2, 1678604400 tz.transition 2023, 11, :o1, 1699164000 tz.transition 2024, 3, :o2, 1710054000 tz.transition 2024, 11, :o1, 1730613600 tz.transition 2025, 3, :o2, 1741503600 tz.transition 2025, 11, :o1, 1762063200 tz.transition 2026, 3, :o2, 1772953200 tz.transition 2026, 11, :o1, 1793512800 tz.transition 2027, 3, :o2, 1805007600 tz.transition 2027, 11, :o1, 1825567200 tz.transition 2028, 3, :o2, 1836457200 tz.transition 2028, 11, :o1, 1857016800 tz.transition 2029, 3, :o2, 1867906800 tz.transition 2029, 11, :o1, 1888466400 tz.transition 2030, 3, :o2, 1899356400 tz.transition 2030, 11, :o1, 1919916000 tz.transition 2031, 3, :o2, 1930806000 tz.transition 2031, 11, :o1, 1951365600 tz.transition 2032, 3, :o2, 1962860400 tz.transition 2032, 11, :o1, 1983420000 tz.transition 2033, 3, :o2, 1994310000 tz.transition 2033, 11, :o1, 2014869600 tz.transition 2034, 3, :o2, 2025759600 tz.transition 2034, 11, :o1, 2046319200 tz.transition 2035, 3, :o2, 2057209200 tz.transition 2035, 11, :o1, 2077768800 tz.transition 2036, 3, :o2, 2088658800 tz.transition 2036, 11, :o1, 2109218400 tz.transition 2037, 3, :o2, 2120108400 tz.transition 2037, 11, :o1, 2140668000 tz.transition 2038, 3, :o2, 59171923, 24 tz.transition 2038, 11, :o1, 9862939, 4 tz.transition 2039, 3, :o2, 59180659, 24 tz.transition 2039, 11, :o1, 9864395, 4 tz.transition 2040, 3, :o2, 59189395, 24 tz.transition 2040, 11, :o1, 9865851, 4 tz.transition 2041, 3, :o2, 59198131, 24 tz.transition 2041, 11, :o1, 9867307, 4 tz.transition 2042, 3, :o2, 59206867, 24 tz.transition 2042, 11, :o1, 9868763, 4 tz.transition 2043, 3, :o2, 59215603, 24 tz.transition 2043, 11, :o1, 9870219, 4 tz.transition 2044, 3, :o2, 59224507, 24 tz.transition 2044, 11, :o1, 9871703, 4 tz.transition 2045, 3, :o2, 59233243, 24 tz.transition 2045, 11, :o1, 9873159, 4 tz.transition 2046, 3, :o2, 59241979, 24 tz.transition 2046, 11, :o1, 9874615, 4 tz.transition 2047, 3, :o2, 59250715, 24 tz.transition 2047, 11, :o1, 9876071, 4 tz.transition 2048, 3, :o2, 59259451, 24 tz.transition 2048, 11, :o1, 9877527, 4 tz.transition 2049, 3, :o2, 59268355, 24 tz.transition 2049, 11, :o1, 9879011, 4 tz.transition 2050, 3, :o2, 59277091, 24 tz.transition 2050, 11, :o1, 9880467, 4 end end end end end
QARIO/dochive
vendor/bundle/gems/tzinfo-0.3.38/lib/tzinfo/definitions/America/Toronto.rb
Ruby
mit
13,279
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator; use Symfony\Component\Validator\Constraints\Valid; use Symfony\Component\Validator\Exception\ValidatorException; use Symfony\Component\Translation\TranslatorInterface; /** * Default implementation of {@link ValidatorInterface}. * * @author Fabien Potencier <fabien@symfony.com> * @author Bernhard Schussek <bschussek@gmail.com> */ class Validator implements ValidatorInterface { /** * @var MetadataFactoryInterface */ private $metadataFactory; /** * @var ConstraintValidatorFactoryInterface */ private $validatorFactory; /** * @var TranslatorInterface */ private $translator; /** * @var null|string */ private $translationDomain; /** * @var array */ private $objectInitializers; public function __construct( MetadataFactoryInterface $metadataFactory, ConstraintValidatorFactoryInterface $validatorFactory, TranslatorInterface $translator, $translationDomain = 'validators', array $objectInitializers = array() ) { $this->metadataFactory = $metadataFactory; $this->validatorFactory = $validatorFactory; $this->translator = $translator; $this->translationDomain = $translationDomain; $this->objectInitializers = $objectInitializers; } /** * {@inheritdoc} */ public function getMetadataFactory() { return $this->metadataFactory; } /** * {@inheritDoc} */ public function getMetadataFor($value) { return $this->metadataFactory->getMetadataFor($value); } /** * {@inheritDoc} */ public function validate($value, $groups = null, $traverse = false, $deep = false) { $visitor = $this->createVisitor($value); foreach ($this->resolveGroups($groups) as $group) { $visitor->validate($value, $group, '', $traverse, $deep); } return $visitor->getViolations(); } /** * {@inheritDoc} * * @throws ValidatorException If the metadata for the value does not support properties. */ public function validateProperty($containingValue, $property, $groups = null) { $visitor = $this->createVisitor($containingValue); $metadata = $this->metadataFactory->getMetadataFor($containingValue); if (!$metadata instanceof PropertyMetadataContainerInterface) { $valueAsString = is_scalar($containingValue) ? '"'.$containingValue.'"' : 'the value of type '.gettype($containingValue); throw new ValidatorException(sprintf('The metadata for '.$valueAsString.' does not support properties.')); } foreach ($this->resolveGroups($groups) as $group) { if (!$metadata->hasPropertyMetadata($property)) { continue; } foreach ($metadata->getPropertyMetadata($property) as $propMeta) { $propMeta->accept($visitor, $propMeta->getPropertyValue($containingValue), $group, $property); } } return $visitor->getViolations(); } /** * {@inheritDoc} * * @throws ValidatorException If the metadata for the value does not support properties. */ public function validatePropertyValue($containingValue, $property, $value, $groups = null) { $visitor = $this->createVisitor($containingValue); $metadata = $this->metadataFactory->getMetadataFor($containingValue); if (!$metadata instanceof PropertyMetadataContainerInterface) { $valueAsString = is_scalar($containingValue) ? '"'.$containingValue.'"' : 'the value of type '.gettype($containingValue); throw new ValidatorException(sprintf('The metadata for '.$valueAsString.' does not support properties.')); } foreach ($this->resolveGroups($groups) as $group) { if (!$metadata->hasPropertyMetadata($property)) { continue; } foreach ($metadata->getPropertyMetadata($property) as $propMeta) { $propMeta->accept($visitor, $value, $group, $property); } } return $visitor->getViolations(); } /** * {@inheritDoc} */ public function validateValue($value, $constraints, $groups = null) { $context = new ExecutionContext($this->createVisitor($value), $this->translator, $this->translationDomain); $constraints = is_array($constraints) ? $constraints : array($constraints); foreach ($constraints as $constraint) { if ($constraint instanceof Valid) { // Why can't the Valid constraint be executed directly? // // It cannot be executed like regular other constraints, because regular // constraints are only executed *if they belong to the validated group*. // The Valid constraint, on the other hand, is always executed and propagates // the group to the cascaded object. The propagated group depends on // // * Whether a group sequence is currently being executed. Then the default // group is propagated. // // * Otherwise the validated group is propagated. throw new ValidatorException( sprintf( 'The constraint %s cannot be validated. Use the method validate() instead.', get_class($constraint) ) ); } $context->validateValue($value, $constraint, $groups); } return $context->getViolations(); } /** * @param mixed $root * * @return ValidationVisitor */ private function createVisitor($root) { return new ValidationVisitor( $root, $this->metadataFactory, $this->validatorFactory, $this->translator, $this->translationDomain, $this->objectInitializers ); } /** * @param null|string|string[] $groups * * @return string[] */ private function resolveGroups($groups) { return $groups ? (array) $groups : array(Constraint::DEFAULT_GROUP); } }
apulidoc/Blog
vendor/symfony/symfony/src/Symfony/Component/Validator/Validator.php
PHP
mit
6,677
/*! UIkit 2.13.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ (function(addon) { var component; if (jQuery && UIkit) { component = addon(jQuery, UIkit); } if (typeof define == "function" && define.amd) { define("uikit-autocomplete", ["uikit"], function(){ return component || addon(jQuery, UIkit); }); } })(function($, UI){ "use strict"; var active; UI.component('autocomplete', { defaults: { minLength: 3, param: 'search', method: 'post', delay: 300, loadingClass: '@-loading', flipDropdown: false, skipClass: '@-skip', hoverClass: '@-active', source: null, renderer: null, // template template: '<ul class="@-nav @-nav-autocomplete @-autocomplete-results">{{~items}}<li data-value="{{$item.value}}"><a>{{$item.value}}</a></li>{{/items}}</ul>' }, visible : false, value : null, selected : null, boot: function() { // init code UI.$html.on("focus.autocomplete.uikit", "[data-@-autocomplete]", function(e) { var ele = UI.$(this); if (!ele.data("autocomplete")) { var obj = UI.autocomplete(ele, UI.Utils.options(ele.attr("data-@-autocomplete"))); } }); // register outer click for autocompletes UI.$html.on("click.autocomplete.uikit", function(e) { if (active && e.target!=active.input[0]) active.hide(); }); }, init: function() { var $this = this, select = false, trigger = UI.Utils.debounce(function(e) { if(select) { return (select = false); } $this.handle(); }, this.options.delay); this.dropdown = this.find('.@-dropdown'); this.template = this.find('script[type="text/autocomplete"]').html(); this.template = UI.Utils.template(UI.prefix(this.template || this.options.template)); this.input = this.find("input:first").attr("autocomplete", "off"); if (!this.dropdown.length) { this.dropdown = UI.$('<div class="@-dropdown"></div>').appendTo(this.element); } if (this.options.flipDropdown) { this.dropdown.addClass('@-dropdown-flip'); } this.input.on({ "keydown": function(e) { if (e && e.which && !e.shiftKey) { switch (e.which) { case 13: // enter select = true; if ($this.selected) { e.preventDefault(); $this.select(); } break; case 38: // up e.preventDefault(); $this.pick('prev', true); break; case 40: // down e.preventDefault(); $this.pick('next', true); break; case 27: case 9: // esc, tab $this.hide(); break; default: break; } } }, "keyup": trigger }); this.dropdown.on("click", UI.prefix(".@-autocomplete-results > *"), function(){ $this.select(); }); this.dropdown.on("mouseover", UI.prefix(".@-autocomplete-results > *"), function(){ $this.pick(UI.$(this)); }); this.triggercomplete = trigger; }, handle: function() { var $this = this, old = this.value; this.value = this.input.val(); if (this.value.length < this.options.minLength) return this.hide(); if (this.value != old) { $this.request(); } return this; }, pick: function(item, scrollinview) { var $this = this, items = UI.$(this.dropdown.find(UI.prefix('.@-autocomplete-results')).children(UI.prefix(':not(.'+this.options.skipClass+')'))), selected = false; if (typeof item !== "string" && !item.hasClass(this.options.skipClass)) { selected = item; } else if (item == 'next' || item == 'prev') { if (this.selected) { var index = items.index(this.selected); if (item == 'next') { selected = items.eq(index + 1 < items.length ? index + 1 : 0); } else { selected = items.eq(index - 1 < 0 ? items.length - 1 : index - 1); } } else { selected = items[(item == 'next') ? 'first' : 'last'](); } selected = UI.$(selected); } if (selected && selected.length) { this.selected = selected; items.removeClass(this.options.hoverClass); this.selected.addClass(this.options.hoverClass); // jump to selected if not in view if (scrollinview) { var top = selected.position().top, scrollTop = $this.dropdown.scrollTop(), dpheight = $this.dropdown.height(); if (top > dpheight || top < 0) { $this.dropdown.scrollTop(scrollTop + top); } } } }, select: function() { if(!this.selected) return; var data = this.selected.data(); this.trigger("select.uk.autocomplete", [data, this]); if (data.value) { this.input.val(data.value).trigger('change'); } this.hide(); }, show: function() { if (this.visible) return; this.visible = true; this.element.addClass("@-open"); active = this; return this; }, hide: function() { if (!this.visible) return; this.visible = false; this.element.removeClass("@-open"); if (active === this) { active = false; } return this; }, request: function() { var $this = this, release = function(data) { if(data) { $this.render(data); } $this.element.removeClass($this.options.loadingClass); }; this.element.addClass(this.options.loadingClass); if (this.options.source) { var source = this.options.source; switch(typeof(this.options.source)) { case 'function': this.options.source.apply(this, [release]); break; case 'object': if(source.length) { var items = []; source.forEach(function(item){ if(item.value && item.value.toLowerCase().indexOf($this.value.toLowerCase())!=-1) { items.push(item); } }); release(items); } break; case 'string': var params ={}; params[this.options.param] = this.value; $.ajax({ url: this.options.source, data: params, type: this.options.method, dataType: 'json' }).done(function(json) { release(json || []); }); break; default: release(null); } } else { this.element.removeClass($this.options.loadingClass); } }, render: function(data) { var $this = this; this.dropdown.empty(); this.selected = false; if (this.options.renderer) { this.options.renderer.apply(this, [data]); } else if(data && data.length) { this.dropdown.append(this.template({"items":data})); this.show(); this.trigger('show.uk.autocomplete'); } return this; } }); return UI.autocomplete; });
dhowe/cdnjs
ajax/libs/uikit/2.13.1/js/components/autocomplete.js
JavaScript
mit
9,422
/** * Handsontable 0.9.13 * Handsontable is a simple jQuery plugin for editable tables with basic copy-paste compatibility with Excel and Google Docs * * Copyright 2012, Marcin Warpechowski * Licensed under the MIT license. * http://handsontable.com/ * * Date: Fri Aug 16 2013 00:58:19 GMT+0200 (Central European Daylight Time) */ /*jslint white: true, browser: true, plusplus: true, indent: 4, maxerr: 50 */ var Handsontable = { //class namespace extension: {}, //extenstion namespace helper: {} //helper namespace }; (function ($, window, Handsontable) { "use strict"; Handsontable.activeGuid = null; /** * Handsontable constructor * @param rootElement The jQuery element in which Handsontable DOM will be inserted * @param userSettings * @constructor */ Handsontable.Core = function (rootElement, userSettings) { var priv , datamap , grid , selection , editproxy , autofill , instance = this , GridSettings = function () { }; Handsontable.helper.inherit(GridSettings, DefaultSettings); //create grid settings as a copy of default settings Handsontable.helper.extend(GridSettings.prototype, Handsontable.TextCell); //overwrite defaults with default cell expandType(userSettings); Handsontable.helper.extend(GridSettings.prototype, userSettings); //overwrite defaults with user settings this.rootElement = rootElement; var $document = $(document.documentElement); var $body = $(document.body); this.guid = 'ht_' + Handsontable.helper.randomString(); //this is the namespace for global events if (!this.rootElement[0].id) { this.rootElement[0].id = this.guid; //if root element does not have an id, assign a random id } priv = { cellSettings: [], columnSettings: [], columnsSettingConflicts: ['data', 'width'], settings: new GridSettings(), // current settings instance settingsFromDOM: {}, selStart: new Handsontable.SelectionPoint(), selEnd: new Handsontable.SelectionPoint(), editProxy: false, isPopulated: null, scrollable: null, undoRedo: null, extensions: {}, colToProp: null, propToCol: null, dataSchema: null, dataType: 'array', firstRun: true }; datamap = { recursiveDuckSchema: function (obj) { var schema; if ($.isPlainObject(obj)) { schema = {}; for (var i in obj) { if (obj.hasOwnProperty(i)) { if ($.isPlainObject(obj[i])) { schema[i] = datamap.recursiveDuckSchema(obj[i]); } else { schema[i] = null; } } } } else { schema = []; } return schema; }, recursiveDuckColumns: function (schema, lastCol, parent) { var prop, i; if (typeof lastCol === 'undefined') { lastCol = 0; parent = ''; } if ($.isPlainObject(schema)) { for (i in schema) { if (schema.hasOwnProperty(i)) { if (schema[i] === null) { prop = parent + i; priv.colToProp.push(prop); priv.propToCol[prop] = lastCol; lastCol++; } else { lastCol = datamap.recursiveDuckColumns(schema[i], lastCol, i + '.'); } } } } return lastCol; }, createMap: function () { if (typeof datamap.getSchema() === "undefined") { throw new Error("trying to create `columns` definition but you didnt' provide `schema` nor `data`"); } var i, ilen, schema = datamap.getSchema(); priv.colToProp = []; priv.propToCol = {}; if (priv.settings.columns) { for (i = 0, ilen = priv.settings.columns.length; i < ilen; i++) { priv.colToProp[i] = priv.settings.columns[i].data; priv.propToCol[priv.settings.columns[i].data] = i; } } else { datamap.recursiveDuckColumns(schema); } }, colToProp: function (col) { col = Handsontable.PluginHooks.execute(instance, 'modifyCol', col); if (priv.colToProp && typeof priv.colToProp[col] !== 'undefined') { return priv.colToProp[col]; } else { return col; } }, propToCol: function (prop) { var col; if (typeof priv.propToCol[prop] !== 'undefined') { col = priv.propToCol[prop]; } else { col = prop; } col = Handsontable.PluginHooks.execute(instance, 'modifyCol', col); return col; }, getSchema: function () { if (priv.settings.dataSchema) { if (typeof priv.settings.dataSchema === 'function') { return priv.settings.dataSchema(); } return priv.settings.dataSchema; } return priv.duckDataSchema; }, /** * Creates row at the bottom of the data array * @param {Number} [index] Optional. Index of the row before which the new row will be inserted */ createRow: function (index) { var row , rowCount = instance.countRows(); if (typeof index !== 'number' || index >= rowCount) { index = rowCount; } if (priv.dataType === 'array') { row = []; for (var c = 0, clen = instance.countCols(); c < clen; c++) { row.push(null); } } else if (priv.dataType === 'function') { row = priv.settings.dataSchema(index); } else { row = $.extend(true, {}, datamap.getSchema()); } if (index === rowCount) { GridSettings.prototype.data.push(row); } else { GridSettings.prototype.data.splice(index, 0, row); } instance.PluginHooks.run('afterCreateRow', index); instance.forceFullRender = true; //used when data was changed }, /** * Creates col at the right of the data array * @param {Object} [index] Optional. Index of the column before which the new column will be inserted */ createCol: function (index) { if (priv.dataType === 'object' || priv.settings.columns) { throw new Error("Cannot create new column. When data source in an object, you can only have as much columns as defined in first data row, data schema or in the 'columns' setting"); } var r = 0, rlen = instance.countRows() , data = GridSettings.prototype.data , constructor = Handsontable.helper.columnFactory(GridSettings, priv.columnsSettingConflicts); if (typeof index !== 'number' || index >= instance.countCols()) { for (; r < rlen; r++) { if (typeof data[r] === 'undefined') { data[r] = []; } data[r].push(null); } // Add new column constructor priv.columnSettings.push(constructor); } else { for (; r < rlen; r++) { data[r].splice(index, 0, null); } // Add new column constructor at given index priv.columnSettings.splice(index, 0, constructor); } instance.PluginHooks.run('afterCreateCol', index); instance.forceFullRender = true; //used when data was changed }, /** * Removes row from the data array * @param {Number} [index] Optional. Index of the row to be removed. If not provided, the last row will be removed * @param {Number} [amount] Optional. Amount of the rows to be removed. If not provided, one row will be removed */ removeRow: function (index, amount) { if (!amount) { amount = 1; } if (typeof index !== 'number') { index = -amount; } // We have to map the physical row ids to logical and than perform removing with (possibly) new row id var logicRows = this.physicalRowsToLogical(index, amount); var newData = GridSettings.prototype.data.filter(function (row, index) { return logicRows.indexOf(index) == -1; }); GridSettings.prototype.data.length = 0; Array.prototype.push.apply(GridSettings.prototype.data, newData); instance.PluginHooks.run('afterRemoveRow', index, amount); instance.forceFullRender = true; //used when data was changed }, /** * Removes column from the data array * @param {Number} [index] Optional. Index of the column to be removed. If not provided, the last column will be removed * @param {Number} [amount] Optional. Amount of the columns to be removed. If not provided, one column will be removed */ removeCol: function (index, amount) { if (priv.dataType === 'object' || priv.settings.columns) { throw new Error("cannot remove column with object data source or columns option specified"); } if (!amount) { amount = 1; } if (typeof index !== 'number') { index = -amount; } var data = GridSettings.prototype.data; for (var r = 0, rlen = instance.countRows(); r < rlen; r++) { data[r].splice(index, amount); } instance.PluginHooks.run('afterRemoveCol', index, amount); priv.columnSettings.splice(index, amount); instance.forceFullRender = true; //used when data was changed }, /** * Add / removes data from the column * @param {Number} col Index of column in which do you want to do splice. * @param {Number} index Index at which to start changing the array. If negative, will begin that many elements from the end * @param {Number} amount An integer indicating the number of old array elements to remove. If amount is 0, no elements are removed * param {...*} elements Optional. The elements to add to the array. If you don't specify any elements, spliceCol simply removes elements from the array */ spliceCol: function (col, index, amount/*, elements...*/) { var elements = 4 <= arguments.length ? [].slice.call(arguments, 3) : []; var colData = instance.getDataAtCol(col); var removed = colData.slice(index, index + amount); var after = colData.slice(index + amount); Handsontable.helper.extendArray(elements, after); var i = 0; while (i < amount) { elements.push(null); //add null in place of removed elements i++; } Handsontable.helper.to2dArray(elements); instance.populateFromArray(index, col, elements, null, null, 'spliceCol'); return removed; }, /** * Add / removes data from the row * @param {Number} row Index of row in which do you want to do splice. * @param {Number} index Index at which to start changing the array. If negative, will begin that many elements from the end * @param {Number} amount An integer indicating the number of old array elements to remove. If amount is 0, no elements are removed * param {...*} elements Optional. The elements to add to the array. If you don't specify any elements, spliceCol simply removes elements from the array */ spliceRow: function (row, index, amount/*, elements...*/) { var elements = 4 <= arguments.length ? [].slice.call(arguments, 3) : []; var rowData = instance.getDataAtRow(row); var removed = rowData.slice(index, index + amount); var after = rowData.slice(index + amount); Handsontable.helper.extendArray(elements, after); var i = 0; while (i < amount) { elements.push(null); //add null in place of removed elements i++; } instance.populateFromArray(row, index, [elements], null, null, 'spliceRow'); return removed; }, /** * Returns single value from the data array * @param {Number} row * @param {Number} prop */ getVars: {}, get: function (row, prop) { datamap.getVars.row = row; datamap.getVars.prop = prop; instance.PluginHooks.run('beforeGet', datamap.getVars); if (typeof datamap.getVars.prop === 'string' && datamap.getVars.prop.indexOf('.') > -1) { var sliced = datamap.getVars.prop.split("."); var out = priv.settings.data[datamap.getVars.row]; if (!out) { return null; } for (var i = 0, ilen = sliced.length; i < ilen; i++) { out = out[sliced[i]]; if (typeof out === 'undefined') { return null; } } return out; } else if (typeof datamap.getVars.prop === 'function') { /** * allows for interacting with complex structures, for example * d3/jQuery getter/setter properties: * * {columns: [{ * data: function(row, value){ * if(arguments.length === 1){ * return row.property(); * } * row.property(value); * } * }]} */ return datamap.getVars.prop(priv.settings.data.slice( datamap.getVars.row, datamap.getVars.row + 1 )[0]); } else { return priv.settings.data[datamap.getVars.row] ? priv.settings.data[datamap.getVars.row][datamap.getVars.prop] : null; } }, /** * Saves single value to the data array * @param {Number} row * @param {Number} prop * @param {String} value * @param {String} [source] Optional. Source of hook runner. */ setVars: {}, set: function (row, prop, value, source) { datamap.setVars.row = row; datamap.setVars.prop = prop; datamap.setVars.value = value; instance.PluginHooks.run('beforeSet', datamap.setVars, source || "datamapGet"); if (typeof datamap.setVars.prop === 'string' && datamap.setVars.prop.indexOf('.') > -1) { var sliced = datamap.setVars.prop.split("."); var out = priv.settings.data[datamap.setVars.row]; for (var i = 0, ilen = sliced.length - 1; i < ilen; i++) { out = out[sliced[i]]; } out[sliced[i]] = datamap.setVars.value; } else if (typeof datamap.setVars.prop === 'function') { /* see the `function` handler in `get` */ datamap.setVars.prop(priv.settings.data.slice( datamap.setVars.row, datamap.setVars.row + 1 )[0], datamap.setVars.value); } else { priv.settings.data[datamap.setVars.row][datamap.setVars.prop] = datamap.setVars.value; } }, /** * This ridiculous piece of code maps rows Id that are present in table data to those displayed for user. * The trick is, the physical row id (stored in settings.data) is not necessary the same * as the logical (displayed) row id (e.g. when sorting is applied). */ physicalRowsToLogical: function (index, amount) { var physicRow = (GridSettings.prototype.data.length + index) % GridSettings.prototype.data.length; var logicRows = []; var rowsToRemove = amount; while (physicRow < GridSettings.prototype.data.length && rowsToRemove) { this.get(physicRow, 0); //this performs an actual mapping and saves the result to getVars logicRows.push(this.getVars.row); rowsToRemove--; physicRow++; } return logicRows; }, /** * Clears the data array */ clear: function () { for (var r = 0; r < instance.countRows(); r++) { for (var c = 0; c < instance.countCols(); c++) { datamap.set(r, datamap.colToProp(c), ''); } } }, /** * Returns the data array * @return {Array} */ getAll: function () { return priv.settings.data; }, /** * Returns data range as array * @param {Object} start Start selection position * @param {Object} end End selection position * @return {Array} */ getRange: function (start, end) { var r, rlen, c, clen, output = [], row; rlen = Math.max(start.row, end.row); clen = Math.max(start.col, end.col); for (r = Math.min(start.row, end.row); r <= rlen; r++) { row = []; for (c = Math.min(start.col, end.col); c <= clen; c++) { row.push(datamap.get(r, datamap.colToProp(c))); } output.push(row); } return output; }, /** * Return data as text (tab separated columns) * @param {Object} start (Optional) Start selection position * @param {Object} end (Optional) End selection position * @return {String} */ getText: function (start, end) { return SheetClip.stringify(datamap.getRange(start, end)); } }; grid = { /** * Inserts or removes rows and columns * @param {String} action Possible values: "insert_row", "insert_col", "remove_row", "remove_col" * @param {Number} index * @param {Number} amount * @param {String} [source] Optional. Source of hook runner. * @param {Boolean} [keepEmptyRows] Optional. Flag for preventing deletion of empty rows. */ alter: function (action, index, amount, source, keepEmptyRows) { var oldData, newData, changes, r, rlen, c, clen, delta; oldData = $.extend(true, [], datamap.getAll()); amount = amount || 1; switch (action) { case "insert_row": delta = 0; while (delta < amount && instance.countRows() < priv.settings.maxRows) { datamap.createRow(index); delta++; } if (delta) { if (priv.selStart.exists() && priv.selStart.row() >= index) { priv.selStart.row(priv.selStart.row() + delta); selection.transformEnd(delta, 0); //will call render() internally } else { selection.refreshBorders(); //it will call render and prepare methods } } break; case "insert_col": delta = 0; while (delta < amount && instance.countCols() < priv.settings.maxCols) { datamap.createCol(index); delta++; } if (delta) { if (priv.selStart.exists() && priv.selStart.col() >= index) { priv.selStart.col(priv.selStart.col() + delta); selection.transformEnd(0, delta); //will call render() internally } else { selection.refreshBorders(); //it will call render and prepare methods } } break; case "remove_row": datamap.removeRow(index, amount); priv.cellSettings.splice(index, amount); grid.adjustRowsAndCols(); selection.refreshBorders(); //it will call render and prepare methods break; case "remove_col": datamap.removeCol(index, amount); for(var row = 0, len = datamap.getAll().length; row < len; row++){ priv.cellSettings[row].splice(index, amount); } priv.columnSettings.splice(index, amount); grid.adjustRowsAndCols(); selection.refreshBorders(); //it will call render and prepare methods break; default: throw new Error('There is no such action "' + action + '"'); break; } changes = []; newData = datamap.getAll(); for (r = 0, rlen = newData.length; r < rlen; r++) { for (c = 0, clen = newData[r].length; c < clen; c++) { changes.push([r, c, oldData[r] ? oldData[r][c] : null, newData[r][c]]); } } instance.PluginHooks.run('afterChange', changes, source || action); if (!keepEmptyRows) { grid.adjustRowsAndCols(); //makes sure that we did not add rows that will be removed in next refresh } }, /** * Makes sure there are empty rows at the bottom of the table */ adjustRowsAndCols: function () { var r, rlen, emptyRows = instance.countEmptyRows(true), emptyCols; //should I add empty rows to data source to meet minRows? rlen = instance.countRows(); if (rlen < priv.settings.minRows) { for (r = 0; r < priv.settings.minRows - rlen; r++) { datamap.createRow(); } } //should I add empty rows to meet minSpareRows? if (emptyRows < priv.settings.minSpareRows) { for (; emptyRows < priv.settings.minSpareRows && instance.countRows() < priv.settings.maxRows; emptyRows++) { datamap.createRow(); } } //count currently empty cols emptyCols = instance.countEmptyCols(true); //should I add empty cols to meet minCols? if (!priv.settings.columns && instance.countCols() < priv.settings.minCols) { for (; instance.countCols() < priv.settings.minCols; emptyCols++) { datamap.createCol(); } } //should I add empty cols to meet minSpareCols? if (!priv.settings.columns && priv.dataType === 'array' && emptyCols < priv.settings.minSpareCols) { for (; emptyCols < priv.settings.minSpareCols && instance.countCols() < priv.settings.maxCols; emptyCols++) { datamap.createCol(); } } if (priv.settings.enterBeginsEditing) { for (; (((priv.settings.minRows || priv.settings.minSpareRows) && instance.countRows() > priv.settings.minRows) && (priv.settings.minSpareRows && emptyRows > priv.settings.minSpareRows)); emptyRows--) { datamap.removeRow(); } } if (priv.settings.enterBeginsEditing && !priv.settings.columns) { for (; (((priv.settings.minCols || priv.settings.minSpareCols) && instance.countCols() > priv.settings.minCols) && (priv.settings.minSpareCols && emptyCols > priv.settings.minSpareCols)); emptyCols--) { datamap.removeCol(); } } var rowCount = instance.countRows(); var colCount = instance.countCols(); if (rowCount === 0 || colCount === 0) { selection.deselect(); } if (priv.selStart.exists()) { var selectionChanged; var fromRow = priv.selStart.row(); var fromCol = priv.selStart.col(); var toRow = priv.selEnd.row(); var toCol = priv.selEnd.col(); //if selection is outside, move selection to last row if (fromRow > rowCount - 1) { fromRow = rowCount - 1; selectionChanged = true; if (toRow > fromRow) { toRow = fromRow; } } else if (toRow > rowCount - 1) { toRow = rowCount - 1; selectionChanged = true; if (fromRow > toRow) { fromRow = toRow; } } //if selection is outside, move selection to last row if (fromCol > colCount - 1) { fromCol = colCount - 1; selectionChanged = true; if (toCol > fromCol) { toCol = fromCol; } } else if (toCol > colCount - 1) { toCol = colCount - 1; selectionChanged = true; if (fromCol > toCol) { fromCol = toCol; } } if (selectionChanged) { instance.selectCell(fromRow, fromCol, toRow, toCol); } } }, /** * Populate cells at position with 2d array * @param {Object} start Start selection position * @param {Array} input 2d array * @param {Object} [end] End selection position (only for drag-down mode) * @param {String} [source="populateFromArray"] * @param {String} [method="overwrite"] * @return {Object|undefined} ending td in pasted area (only if any cell was changed) */ populateFromArray: function (start, input, end, source, method) { var r, rlen, c, clen, setData = [], current = {}; rlen = input.length; if (rlen === 0) { return false; } var repeatCol , repeatRow , cmax , rmax; // insert data with specified pasteMode method switch (method) { case 'shift_down' : repeatCol = end ? end.col - start.col + 1 : 0; repeatRow = end ? end.row - start.row + 1 : 0; input = Handsontable.helper.translateRowsToColumns(input); for (c = 0, clen = input.length, cmax = Math.max(clen, repeatCol); c < cmax; c++) { if (c < clen) { for (r = 0, rlen = input[c].length; r < repeatRow - rlen; r++) { input[c].push(input[c][r % rlen]); } input[c].unshift(start.col + c, start.row, 0); instance.spliceCol.apply(instance, input[c]); } else { input[c % clen][0] = start.col + c; instance.spliceCol.apply(instance, input[c % clen]); } } break; case 'shift_right' : repeatCol = end ? end.col - start.col + 1 : 0; repeatRow = end ? end.row - start.row + 1 : 0; for (r = 0, rlen = input.length, rmax = Math.max(rlen, repeatRow); r < rmax; r++) { if (r < rlen) { for (c = 0, clen = input[r].length; c < repeatCol - clen; c++) { input[r].push(input[r][c % clen]); } input[r].unshift(start.row + r, start.col, 0); instance.spliceRow.apply(instance, input[r]); } else { input[r % rlen][0] = start.row + r; instance.spliceRow.apply(instance, input[r % rlen]); } } break; case 'overwrite' : default: // overwrite and other not specified options current.row = start.row; current.col = start.col; for (r = 0; r < rlen; r++) { if ((end && current.row > end.row) || (!priv.settings.minSpareRows && current.row > instance.countRows() - 1) || (current.row >= priv.settings.maxRows)) { break; } current.col = start.col; clen = input[r] ? input[r].length : 0; for (c = 0; c < clen; c++) { if ((end && current.col > end.col) || (!priv.settings.minSpareCols && current.col > instance.countCols() - 1) || (current.col >= priv.settings.maxCols)) { break; } if (!instance.getCellMeta(current.row, current.col).readOnly) { setData.push([current.row, current.col, input[r][c]]); } current.col++; if (end && c === clen - 1) { c = -1; } } current.row++; if (end && r === rlen - 1) { r = -1; } } instance.setDataAtCell(setData, null, null, source || 'populateFromArray'); break; } }, /** * Returns the top left (TL) and bottom right (BR) selection coordinates * @param {Object[]} coordsArr * @returns {Object} */ getCornerCoords: function (coordsArr) { function mapProp(func, array, prop) { function getProp(el) { return el[prop]; } if (Array.prototype.map) { return func.apply(Math, array.map(getProp)); } return func.apply(Math, $.map(array, getProp)); } return { TL: { row: mapProp(Math.min, coordsArr, "row"), col: mapProp(Math.min, coordsArr, "col") }, BR: { row: mapProp(Math.max, coordsArr, "row"), col: mapProp(Math.max, coordsArr, "col") } }; }, /** * Returns array of td objects given start and end coordinates */ getCellsAtCoords: function (start, end) { var corners = grid.getCornerCoords([start, end]); var r, c, output = []; for (r = corners.TL.row; r <= corners.BR.row; r++) { for (c = corners.TL.col; c <= corners.BR.col; c++) { output.push(instance.view.getCellAtCoords({ row: r, col: c })); } } return output; } }; this.selection = selection = { //this public assignment is only temporary inProgress: false, /** * Sets inProgress to true. This enables onSelectionEnd and onSelectionEndByProp to function as desired */ begin: function () { instance.selection.inProgress = true; }, /** * Sets inProgress to false. Triggers onSelectionEnd and onSelectionEndByProp */ finish: function () { var sel = instance.getSelected(); instance.PluginHooks.run("afterSelectionEnd", sel[0], sel[1], sel[2], sel[3]); instance.PluginHooks.run("afterSelectionEndByProp", sel[0], instance.colToProp(sel[1]), sel[2], instance.colToProp(sel[3])); instance.selection.inProgress = false; }, isInProgress: function () { return instance.selection.inProgress; }, /** * Starts selection range on given td object * @param {Object} coords */ setRangeStart: function (coords) { priv.selStart.coords(coords); selection.setRangeEnd(coords); }, /** * Ends selection range on given td object * @param {Object} coords * @param {Boolean} [scrollToCell=true] If true, viewport will be scrolled to range end */ setRangeEnd: function (coords, scrollToCell) { instance.selection.begin(); priv.selEnd.coords(coords); if (!priv.settings.multiSelect) { priv.selStart.coords(coords); } //set up current selection instance.view.wt.selections.current.clear(); instance.view.wt.selections.current.add(priv.selStart.arr()); //set up area selection instance.view.wt.selections.area.clear(); if (selection.isMultiple()) { instance.view.wt.selections.area.add(priv.selStart.arr()); instance.view.wt.selections.area.add(priv.selEnd.arr()); } //set up highlight if (priv.settings.currentRowClassName || priv.settings.currentColClassName) { instance.view.wt.selections.highlight.clear(); instance.view.wt.selections.highlight.add(priv.selStart.arr()); instance.view.wt.selections.highlight.add(priv.selEnd.arr()); } //trigger handlers instance.PluginHooks.run("afterSelection", priv.selStart.row(), priv.selStart.col(), priv.selEnd.row(), priv.selEnd.col()); instance.PluginHooks.run("afterSelectionByProp", priv.selStart.row(), datamap.colToProp(priv.selStart.col()), priv.selEnd.row(), datamap.colToProp(priv.selEnd.col())); if (scrollToCell !== false) { instance.view.scrollViewport(coords); } selection.refreshBorders(); }, /** * Destroys editor, redraws borders around cells, prepares editor * @param {Boolean} revertOriginal * @param {Boolean} keepEditor */ refreshBorders: function (revertOriginal, keepEditor) { if (!keepEditor) { editproxy.destroy(revertOriginal); } instance.view.render(); if (selection.isSelected() && !keepEditor) { editproxy.prepare(); } }, /** * Returns information if we have a multiselection * @return {Boolean} */ isMultiple: function () { return !(priv.selEnd.col() === priv.selStart.col() && priv.selEnd.row() === priv.selStart.row()); }, /** * Selects cell relative to current cell (if possible) */ transformStart: function (rowDelta, colDelta, force) { if (priv.selStart.row() + rowDelta > instance.countRows() - 1) { if (force && priv.settings.minSpareRows > 0) { instance.alter("insert_row", instance.countRows()); } else if (priv.settings.autoWrapCol && priv.selStart.col() + colDelta < instance.countCols() - 1) { rowDelta = 1 - instance.countRows(); colDelta = 1; } } else if (priv.settings.autoWrapCol && priv.selStart.row() + rowDelta < 0 && priv.selStart.col() + colDelta >= 0) { rowDelta = instance.countRows() - 1; colDelta = -1; } if (priv.selStart.col() + colDelta > instance.countCols() - 1) { if (force && priv.settings.minSpareCols > 0) { instance.alter("insert_col", instance.countCols()); } else if (priv.settings.autoWrapRow && priv.selStart.row() + rowDelta < instance.countRows() - 1) { rowDelta = 1; colDelta = 1 - instance.countCols(); } } else if (priv.settings.autoWrapRow && priv.selStart.col() + colDelta < 0 && priv.selStart.row() + rowDelta >= 0) { rowDelta = -1; colDelta = instance.countCols() - 1; } var totalRows = instance.countRows(); var totalCols = instance.countCols(); var coords = { row: (priv.selStart.row() + rowDelta), col: priv.selStart.col() + colDelta }; if (coords.row < 0) { coords.row = 0; } else if (coords.row > 0 && coords.row >= totalRows) { coords.row = totalRows - 1; } if (coords.col < 0) { coords.col = 0; } else if (coords.col > 0 && coords.col >= totalCols) { coords.col = totalCols - 1; } selection.setRangeStart(coords); }, /** * Sets selection end cell relative to current selection end cell (if possible) */ transformEnd: function (rowDelta, colDelta) { if (priv.selEnd.exists()) { var totalRows = instance.countRows(); var totalCols = instance.countCols(); var coords = { row: priv.selEnd.row() + rowDelta, col: priv.selEnd.col() + colDelta }; if (coords.row < 0) { coords.row = 0; } else if (coords.row > 0 && coords.row >= totalRows) { coords.row = totalRows - 1; } if (coords.col < 0) { coords.col = 0; } else if (coords.col > 0 && coords.col >= totalCols) { coords.col = totalCols - 1; } selection.setRangeEnd(coords); } }, /** * Returns true if currently there is a selection on screen, false otherwise * @return {Boolean} */ isSelected: function () { return priv.selEnd.exists(); }, /** * Returns true if coords is within current selection coords * @return {Boolean} */ inInSelection: function (coords) { if (!selection.isSelected()) { return false; } var sel = grid.getCornerCoords([priv.selStart.coords(), priv.selEnd.coords()]); return (sel.TL.row <= coords.row && sel.BR.row >= coords.row && sel.TL.col <= coords.col && sel.BR.col >= coords.col); }, /** * Deselects all selected cells */ deselect: function () { if (!selection.isSelected()) { return; } instance.selection.inProgress = false; //needed by HT inception priv.selEnd = new Handsontable.SelectionPoint(); //create new empty point to remove the existing one instance.view.wt.selections.current.clear(); instance.view.wt.selections.area.clear(); editproxy.destroy(); selection.refreshBorders(); instance.PluginHooks.run('afterDeselect'); }, /** * Select all cells */ selectAll: function () { if (!priv.settings.multiSelect) { return; } selection.setRangeStart({ row: 0, col: 0 }); selection.setRangeEnd({ row: instance.countRows() - 1, col: instance.countCols() - 1 }, false); }, /** * Deletes data from selected cells */ empty: function () { if (!selection.isSelected()) { return; } var corners = grid.getCornerCoords([priv.selStart.coords(), priv.selEnd.coords()]); var r, c, changes = []; for (r = corners.TL.row; r <= corners.BR.row; r++) { for (c = corners.TL.col; c <= corners.BR.col; c++) { if (!instance.getCellMeta(r, c).readOnly) { changes.push([r, c, '']); } } } instance.setDataAtCell(changes); } }; this.autofill = autofill = { //this public assignment is only temporary handle: null, /** * Create fill handle and fill border objects */ init: function () { if (!autofill.handle) { autofill.handle = {}; } else { autofill.handle.disabled = false; } }, /** * Hide fill handle and fill border permanently */ disable: function () { autofill.handle.disabled = true; }, /** * Selects cells down to the last row in the left column, then fills down to that cell */ selectAdjacent: function () { var select, data, r, maxR, c; if (selection.isMultiple()) { select = instance.view.wt.selections.area.getCorners(); } else { select = instance.view.wt.selections.current.getCorners(); } data = datamap.getAll(); rows : for (r = select[2] + 1; r < instance.countRows(); r++) { for (c = select[1]; c <= select[3]; c++) { if (data[r][c]) { break rows; } } if (!!data[r][select[1] - 1] || !!data[r][select[3] + 1]) { maxR = r; } } if (maxR) { instance.view.wt.selections.fill.clear(); instance.view.wt.selections.fill.add([select[0], select[1]]); instance.view.wt.selections.fill.add([maxR, select[3]]); autofill.apply(); } }, /** * Apply fill values to the area in fill border, omitting the selection border */ apply: function () { var drag, select, start, end, _data; autofill.handle.isDragged = 0; drag = instance.view.wt.selections.fill.getCorners(); if (!drag) { return; } instance.view.wt.selections.fill.clear(); if (selection.isMultiple()) { select = instance.view.wt.selections.area.getCorners(); } else { select = instance.view.wt.selections.current.getCorners(); } if (drag[0] === select[0] && drag[1] < select[1]) { start = { row: drag[0], col: drag[1] }; end = { row: drag[2], col: select[1] - 1 }; } else if (drag[0] === select[0] && drag[3] > select[3]) { start = { row: drag[0], col: select[3] + 1 }; end = { row: drag[2], col: drag[3] }; } else if (drag[0] < select[0] && drag[1] === select[1]) { start = { row: drag[0], col: drag[1] }; end = { row: select[0] - 1, col: drag[3] }; } else if (drag[2] > select[2] && drag[1] === select[1]) { start = { row: select[2] + 1, col: drag[1] }; end = { row: drag[2], col: drag[3] }; } if (start) { _data = SheetClip.parse(datamap.getText(priv.selStart.coords(), priv.selEnd.coords())); instance.PluginHooks.run('beforeAutofill', start, end, _data); grid.populateFromArray(start, _data, end, 'autofill'); selection.setRangeStart({row: drag[0], col: drag[1]}); selection.setRangeEnd({row: drag[2], col: drag[3]}); } /*else { //reset to avoid some range bug selection.refreshBorders(); }*/ }, /** * Show fill border */ showBorder: function (coords) { coords.row = coords[0]; coords.col = coords[1]; var corners = grid.getCornerCoords([priv.selStart.coords(), priv.selEnd.coords()]); if (priv.settings.fillHandle !== 'horizontal' && (corners.BR.row < coords.row || corners.TL.row > coords.row)) { coords = [coords.row, corners.BR.col]; } else if (priv.settings.fillHandle !== 'vertical') { coords = [corners.BR.row, coords.col]; } else { return; //wrong direction } instance.view.wt.selections.fill.clear(); instance.view.wt.selections.fill.add([priv.selStart.coords().row, priv.selStart.coords().col]); instance.view.wt.selections.fill.add([priv.selEnd.coords().row, priv.selEnd.coords().col]); instance.view.wt.selections.fill.add(coords); instance.view.render(); } }; editproxy = { //this public assignment is only temporary /** * Create input field */ init: function () { priv.onCut = function onCut() { if (!instance.isListening()) { return; } selection.empty(); }; priv.onPaste = function onPaste(str) { if (!instance.isListening() || !selection.isSelected()) { return; } var input = str.replace(/^[\r\n]*/g, '').replace(/[\r\n]*$/g, '') //remove newline from the start and the end of the input , inputArray = SheetClip.parse(input) , coords = grid.getCornerCoords([priv.selStart.coords(), priv.selEnd.coords()]) , areaStart = coords.TL , areaEnd = { row: Math.max(coords.BR.row, inputArray.length - 1 + coords.TL.row), col: Math.max(coords.BR.col, inputArray[0].length - 1 + coords.TL.col) }; instance.PluginHooks.once('afterChange', function (changes, source) { if (changes && changes.length) { instance.selectCell(areaStart.row, areaStart.col, areaEnd.row, areaEnd.col); } }); grid.populateFromArray(areaStart, inputArray, areaEnd, 'paste', priv.settings.pasteMode); }; function onKeyDown(event) { if (!instance.isListening()) { return; } if (priv.settings.beforeOnKeyDown) { // HOT in HOT Plugin priv.settings.beforeOnKeyDown.call(instance, event); } if (Array.prototype.filter.call(document.body.querySelectorAll('.context-menu-list'), instance.view.wt.wtDom.isVisible).length) { //faster than $body.children('.context-menu-list:visible').length //if right-click context menu is visible, do not execute this keydown handler (arrow keys will navigate the context menu) return; } if (event.keyCode === 17 || event.keyCode === 224 || event.keyCode === 91 || event.keyCode === 93) { //when CTRL is pressed, prepare selectable text in textarea //http://stackoverflow.com/questions/3902635/how-does-one-capture-a-macs-command-key-via-javascript editproxy.setCopyableText(); return; } priv.lastKeyCode = event.keyCode; if (selection.isSelected()) { var ctrlDown = (event.ctrlKey || event.metaKey) && !event.altKey; //catch CTRL but not right ALT (which in some systems triggers ALT+CTRL) if (Handsontable.helper.isPrintableChar(event.keyCode) && ctrlDown) { if (event.keyCode === 65) { //CTRL + A selection.selectAll(); //select all cells editproxy.setCopyableText(); event.preventDefault(); } else if (event.keyCode === 89 || (event.shiftKey && event.keyCode === 90)) { //CTRL + Y or CTRL + SHIFT + Z priv.undoRedo && priv.undoRedo.redo(); } else if (event.keyCode === 90) { //CTRL + Z priv.undoRedo && priv.undoRedo.undo(); } return; } var rangeModifier = event.shiftKey ? selection.setRangeEnd : selection.setRangeStart; instance.PluginHooks.run('beforeKeyDown', event); if (!event.isImmediatePropagationStopped()) { switch (event.keyCode) { case 38: /* arrow up */ if (event.shiftKey) { selection.transformEnd(-1, 0); } else { selection.transformStart(-1, 0); } event.preventDefault(); event.stopPropagation(); //required by HandsontableEditor break; case 9: /* tab */ var tabMoves = typeof priv.settings.tabMoves === 'function' ? priv.settings.tabMoves(event) : priv.settings.tabMoves; if (event.shiftKey) { selection.transformStart(-tabMoves.row, -tabMoves.col); //move selection left } else { selection.transformStart(tabMoves.row, tabMoves.col, true); //move selection right (add a new column if needed) } event.preventDefault(); event.stopPropagation(); //required by HandsontableEditor break; case 39: /* arrow right */ if (event.shiftKey) { selection.transformEnd(0, 1); } else { selection.transformStart(0, 1); } event.preventDefault(); event.stopPropagation(); //required by HandsontableEditor break; case 37: /* arrow left */ if (event.shiftKey) { selection.transformEnd(0, -1); } else { selection.transformStart(0, -1); } event.preventDefault(); event.stopPropagation(); //required by HandsontableEditor break; case 8: /* backspace */ case 46: /* delete */ selection.empty(event); event.preventDefault(); break; case 40: /* arrow down */ if (event.shiftKey) { selection.transformEnd(1, 0); //expanding selection down with shift } else { selection.transformStart(1, 0); //move selection down } event.preventDefault(); event.stopPropagation(); //required by HandsontableEditor break; case 113: /* F2 */ event.preventDefault(); //prevent Opera from opening Go to Page dialog break; case 13: /* return/enter */ var enterMoves = typeof priv.settings.enterMoves === 'function' ? priv.settings.enterMoves(event) : priv.settings.enterMoves; if (event.shiftKey) { selection.transformStart(-enterMoves.row, -enterMoves.col); //move selection up } else { selection.transformStart(enterMoves.row, enterMoves.col, true); //move selection down (add a new row if needed) } event.preventDefault(); //don't add newline to field break; case 36: /* home */ if (event.ctrlKey || event.metaKey) { rangeModifier({row: 0, col: priv.selStart.col()}); } else { rangeModifier({row: priv.selStart.row(), col: 0}); } event.preventDefault(); //don't scroll the window event.stopPropagation(); //required by HandsontableEditor break; case 35: /* end */ if (event.ctrlKey || event.metaKey) { rangeModifier({row: instance.countRows() - 1, col: priv.selStart.col()}); } else { rangeModifier({row: priv.selStart.row(), col: instance.countCols() - 1}); } event.preventDefault(); //don't scroll the window event.stopPropagation(); //required by HandsontableEditor break; case 33: /* pg up */ selection.transformStart(-instance.countVisibleRows(), 0); instance.view.wt.scrollVertical(-instance.countVisibleRows()); instance.view.render(); event.preventDefault(); //don't page up the window event.stopPropagation(); //required by HandsontableEditor break; case 34: /* pg down */ selection.transformStart(instance.countVisibleRows(), 0); instance.view.wt.scrollVertical(instance.countVisibleRows()); instance.view.render(); event.preventDefault(); //don't page down the window event.stopPropagation(); //required by HandsontableEditor break; default: break; } } } } instance.copyPaste = CopyPaste.getInstance(); instance.copyPaste.onCut(priv.onCut); instance.copyPaste.onPaste(priv.onPaste); $document.on('keydown.handsontable.' + instance.guid, onKeyDown); }, /** * Destroy current editor, if exists * @param {Boolean} revertOriginal */ destroy: function (revertOriginal) { if (typeof priv.editorDestroyer === "function") { var destroyer = priv.editorDestroyer; //this copy is needed, otherwise destroyer can enter an infinite loop priv.editorDestroyer = null; destroyer(revertOriginal); } }, /** * Prepares copyable text in the invisible textarea */ setCopyableText: function () { var startRow = Math.min(priv.selStart.row(), priv.selEnd.row()); var startCol = Math.min(priv.selStart.col(), priv.selEnd.col()); var endRow = Math.max(priv.selStart.row(), priv.selEnd.row()); var endCol = Math.max(priv.selStart.col(), priv.selEnd.col()); var finalEndRow = Math.min(endRow, startRow + priv.settings.copyRowsLimit - 1); var finalEndCol = Math.min(endCol, startCol + priv.settings.copyColsLimit - 1); instance.copyPaste.copyable(datamap.getText({row: startRow, col: startCol}, {row: finalEndRow, col: finalEndCol})); if (endRow !== finalEndRow || endCol !== finalEndCol) { instance.PluginHooks.run("afterCopyLimit", endRow - startRow + 1, endCol - startCol + 1, priv.settings.copyRowsLimit, priv.settings.copyColsLimit); } }, /** * Prepare text input to be displayed at given grid cell */ prepare: function () { if (instance.getCellMeta(priv.selStart.row(), priv.selStart.col()).readOnly) { return; } var TD = instance.view.getCellAtCoords(priv.selStart.coords()); priv.editorDestroyer = instance.view.applyCellTypeMethod('editor', TD, priv.selStart.row(), priv.selStart.col()); //presumably TD can be removed from here. Cell editor should also listen for changes if editable cell is outside from viewport } }; this.init = function () { instance.PluginHooks.run('beforeInit'); editproxy.init(); this.updateSettings(priv.settings, true); this.parseSettingsFromDOM(); this.view = new Handsontable.TableView(this); this.forceFullRender = true; //used when data was changed this.view.render(); if (typeof priv.firstRun === 'object') { instance.PluginHooks.run('afterChange', priv.firstRun[0], priv.firstRun[1]); priv.firstRun = false; } instance.PluginHooks.run('afterInit'); }; function ValidatorsQueue() { //moved this one level up so it can be used in any function here. Probably this should be moved to a separate file var resolved = false; return { validatorsInQueue: 0, addValidatorToQueue: function () { this.validatorsInQueue++; resolved = false; }, removeValidatorFormQueue: function () { this.validatorsInQueue = this.validatorsInQueue - 1 < 0 ? 0 : this.validatorsInQueue - 1; this.checkIfQueueIsEmpty(); }, onQueueEmpty: function () { }, checkIfQueueIsEmpty: function () { if (this.validatorsInQueue == 0 && resolved == false) { resolved = true; this.onQueueEmpty(); } } }; } function validateChanges(changes, source, callback) { var waitingForValidator = new ValidatorsQueue(); waitingForValidator.onQueueEmpty = resolve; for (var i = changes.length - 1; i >= 0; i--) { if (changes[i] === null) { changes.splice(i, 1); } else { var cellProperties = instance.getCellMeta(changes[i][0], datamap.propToCol(changes[i][1])); if (cellProperties.dataType === 'number' && typeof changes[i][3] === 'string') { if (changes[i][3].length > 0 && /^-?[\d\s]*\.?\d*$/.test(changes[i][3])) { changes[i][3] = numeral().unformat(changes[i][3] || '0'); //numeral cannot unformat empty string } } if (cellProperties.validator) { waitingForValidator.addValidatorToQueue(); instance.validateCell(changes[i][3], cellProperties, (function (i, cellProperties) { return function (result) { if (typeof result !== 'boolean') { throw new Error("Validation error: result is not boolean"); } if (result === false && cellProperties.allowInvalid === false) { changes.splice(i, 1); --i; } waitingForValidator.removeValidatorFormQueue(); } })(i, cellProperties) , source); } } } waitingForValidator.checkIfQueueIsEmpty(); function resolve() { var beforeChangeResult; if (changes.length) { beforeChangeResult = instance.PluginHooks.execute("beforeChange", changes, source); if (typeof beforeChangeResult === 'function') { $.when(result).then(function () { callback(); //called when async validators and async beforeChange are resolved }); } else if (beforeChangeResult === false) { changes.splice(0, changes.length); //invalidate all changes (remove everything from array) } } if (typeof beforeChangeResult !== 'function') { callback(); //called when async validators are resolved and beforeChange was not async } } } /** * Internal function to apply changes. Called after validateChanges * @param {Array} changes Array in form of [row, prop, oldValue, newValue] * @param {String} source String that identifies how this change will be described in changes array (useful in onChange callback) */ function applyChanges(changes, source) { var i = changes.length - 1; if (i < 0) { return; } for (; 0 <= i; i--) { if (changes[i] === null) { changes.splice(i, 1); continue; } if (priv.settings.minSpareRows) { while (changes[i][0] > instance.countRows() - 1) { datamap.createRow(); } } if (priv.dataType === 'array' && priv.settings.minSpareCols) { while (datamap.propToCol(changes[i][1]) > instance.countCols() - 1) { datamap.createCol(); } } datamap.set(changes[i][0], changes[i][1], changes[i][3]); } instance.forceFullRender = true; //used when data was changed grid.adjustRowsAndCols(); selection.refreshBorders(null, true); instance.PluginHooks.run('afterChange', changes, source || 'edit'); } this.validateCell = function (value, cellProperties, callback, source) { var validator = cellProperties.validator; if (Object.prototype.toString.call(validator) === '[object RegExp]') { validator = (function (validator) { return function (value, callback) { callback(validator.test(value)); } })(validator); } if (typeof validator === 'function') { value = instance.PluginHooks.execute("beforeValidate", value, cellProperties.row, cellProperties.prop, source); validator.call(cellProperties, value, function (valid) { cellProperties.valid = valid; valid = instance.PluginHooks.execute("afterValidate", valid, value, cellProperties.row, cellProperties.prop, source); callback(valid); }); } else { //resolve callback even if validator function was not found cellProperties.valid = true; callback(true); } }; function setDataInputToArray(row, prop_or_col, value) { if (typeof row === "object") { //is it an array of changes return row; } else if ($.isPlainObject(value)) { //backwards compatibility return value; } else { return [ [row, prop_or_col, value] ]; } } /** * Set data at given cell * @public * @param {Number|Array} row or array of changes in format [[row, col, value], ...] * @param {Number|String} col or source String * @param {String} value * @param {String} source String that identifies how this change will be described in changes array (useful in onChange callback) */ this.setDataAtCell = function (row, col, value, source) { var input = setDataInputToArray(row, col, value) , i , ilen , changes = [] , prop; for (i = 0, ilen = input.length; i < ilen; i++) { if (typeof input[i] !== 'object') { throw new Error('Method `setDataAtCell` accepts row number or changes array of arrays as its first parameter'); } if (typeof input[i][1] !== 'number') { throw new Error('Method `setDataAtCell` accepts row and column number as its parameters. If you want to use object property name, use method `setDataAtRowProp`'); } prop = datamap.colToProp(input[i][1]); changes.push([ input[i][0], prop, datamap.get(input[i][0], prop), input[i][2] ]); } if (!source && typeof row === "object") { source = col; } validateChanges(changes, source, function () { applyChanges(changes, source); }); }; /** * Set data at given row property * @public * @param {Number|Array} row or array of changes in format [[row, prop, value], ...] * @param {String} prop or source String * @param {String} value * @param {String} source String that identifies how this change will be described in changes array (useful in onChange callback) */ this.setDataAtRowProp = function (row, prop, value, source) { var input = setDataInputToArray(row, prop, value) , i , ilen , changes = []; for (i = 0, ilen = input.length; i < ilen; i++) { changes.push([ input[i][0], input[i][1], datamap.get(input[i][0], input[i][1]), input[i][2] ]); } if (!source && typeof row === "object") { source = prop; } validateChanges(changes, source, function () { applyChanges(changes, source); }); }; /** * Listen to document body keyboard input */ this.listen = function () { Handsontable.activeGuid = instance.guid; if (document.activeElement && document.activeElement !== document.body) { document.activeElement.blur(); } else if (!document.activeElement) { //IE document.body.focus(); } }; /** * Stop listening to document body keyboard input */ this.unlisten = function () { Handsontable.activeGuid = null; }; /** * Returns true if current Handsontable instance is listening on document body keyboard input */ this.isListening = function () { return Handsontable.activeGuid === instance.guid; }; /** * Destroys current editor, renders and selects current cell. If revertOriginal != true, edited data is saved * @param {Boolean} revertOriginal */ this.destroyEditor = function (revertOriginal) { selection.refreshBorders(revertOriginal); }; /** * Populate cells at position with 2d array * @param {Number} row Start row * @param {Number} col Start column * @param {Array} input 2d array * @param {Number=} endRow End row (use when you want to cut input when certain row is reached) * @param {Number=} endCol End column (use when you want to cut input when certain column is reached) * @param {String=} [source="populateFromArray"] * @param {String=} [method="overwrite"] * @return {Object|undefined} ending td in pasted area (only if any cell was changed) */ this.populateFromArray = function (row, col, input, endRow, endCol, source, method) { if (typeof input !== 'object') { throw new Error("populateFromArray parameter `input` must be an array"); //API changed in 0.9-beta2, let's check if you use it correctly } return grid.populateFromArray({row: row, col: col}, input, typeof endRow === 'number' ? {row: endRow, col: endCol} : null, source, method); }; /** * Adds/removes data from the column * @param {Number} col Index of column in which do you want to do splice. * @param {Number} index Index at which to start changing the array. If negative, will begin that many elements from the end * @param {Number} amount An integer indicating the number of old array elements to remove. If amount is 0, no elements are removed * param {...*} elements Optional. The elements to add to the array. If you don't specify any elements, spliceCol simply removes elements from the array */ this.spliceCol = function (col, index, amount/*, elements... */) { return datamap.spliceCol.apply(null, arguments); }; /** * Adds/removes data from the row * @param {Number} row Index of column in which do you want to do splice. * @param {Number} index Index at which to start changing the array. If negative, will begin that many elements from the end * @param {Number} amount An integer indicating the number of old array elements to remove. If amount is 0, no elements are removed * param {...*} elements Optional. The elements to add to the array. If you don't specify any elements, spliceCol simply removes elements from the array */ this.spliceRow = function (row, index, amount/*, elements... */) { return datamap.spliceRow.apply(null, arguments); }; /** * Returns the top left (TL) and bottom right (BR) selection coordinates * @param {Object[]} coordsArr * @returns {Object} */ this.getCornerCoords = function (coordsArr) { return grid.getCornerCoords(coordsArr); }; /** * Returns current selection. Returns undefined if there is no selection. * @public * @return {Array} [`startRow`, `startCol`, `endRow`, `endCol`] */ this.getSelected = function () { //https://github.com/warpech/jquery-handsontable/issues/44 //cjl if (selection.isSelected()) { return [priv.selStart.row(), priv.selStart.col(), priv.selEnd.row(), priv.selEnd.col()]; } }; /** * Parse settings from DOM and CSS * @public */ this.parseSettingsFromDOM = function () { var overflow = this.rootElement.css('overflow'); if (overflow === 'scroll' || overflow === 'auto') { this.rootElement[0].style.overflow = 'visible'; priv.settingsFromDOM.overflow = overflow; } else if (priv.settings.width === void 0 || priv.settings.height === void 0) { priv.settingsFromDOM.overflow = 'auto'; } if (priv.settings.width === void 0) { priv.settingsFromDOM.width = this.rootElement.width(); } else { priv.settingsFromDOM.width = void 0; } priv.settingsFromDOM.height = void 0; if (priv.settings.height === void 0) { if (priv.settingsFromDOM.overflow === 'scroll' || priv.settingsFromDOM.overflow === 'auto') { //this needs to read only CSS/inline style and not actual height //so we need to call getComputedStyle on cloned container var clone = this.rootElement[0].cloneNode(false); var parent = this.rootElement[0].parentNode; if (parent) { clone.removeAttribute('id'); parent.appendChild(clone); var computedHeight = parseInt(window.getComputedStyle(clone, null).getPropertyValue('height'), 10); if(isNaN(computedHeight) && clone.currentStyle){ computedHeight = parseInt(clone.currentStyle.height, 10) } if (computedHeight > 0) { priv.settingsFromDOM.height = computedHeight; } parent.removeChild(clone); } } } }; /** * Render visible data * @public */ this.render = function () { if (instance.view) { instance.forceFullRender = true; //used when data was changed instance.parseSettingsFromDOM(); selection.refreshBorders(null, true); } }; /** * Load data from array * @public * @param {Array} data */ this.loadData = function (data) { if (!(data.push && data.splice)) { //check if data is array. Must use duck-type check so Backbone Collections also pass it throw new Error("loadData only accepts array of objects or array of arrays (" + typeof data + " given)"); } priv.isPopulated = false; GridSettings.prototype.data = data; if (priv.settings.dataSchema instanceof Array || data[0] instanceof Array) { priv.dataType = 'array'; } else if ($.isFunction(priv.settings.dataSchema)) { priv.dataType = 'function'; } else { priv.dataType = 'object'; } if (data[0]) { priv.duckDataSchema = datamap.recursiveDuckSchema(data[0]); } else { priv.duckDataSchema = {}; } datamap.createMap(); grid.adjustRowsAndCols(); instance.PluginHooks.run('afterLoadData'); if (priv.firstRun) { priv.firstRun = [null, 'loadData']; } else { instance.PluginHooks.run('afterChange', null, 'loadData'); instance.render(); } priv.isPopulated = true; instance.clearUndo(); }; /** * Return the current data object (the same that was passed by `data` configuration option or `loadData` method). Optionally you can provide cell range `r`, `c`, `r2`, `c2` to get only a fragment of grid data * @public * @param {Number} r (Optional) From row * @param {Number} c (Optional) From col * @param {Number} r2 (Optional) To row * @param {Number} c2 (Optional) To col * @return {Array|Object} */ this.getData = function (r, c, r2, c2) { if (typeof r === 'undefined') { return datamap.getAll(); } else { return datamap.getRange({row: r, col: c}, {row: r2, col: c2}); } }; /** * Update settings * @public */ this.updateSettings = function (settings, init) { var i, r, rlen, c, clen; if (typeof settings.rows !== "undefined") { throw new Error("'rows' setting is no longer supported. do you mean startRows, minRows or maxRows?"); } if (typeof settings.cols !== "undefined") { throw new Error("'cols' setting is no longer supported. do you mean startCols, minCols or maxCols?"); } if (typeof settings.undo !== "undefined") { if (priv.undoRedo && settings.undo === false) { priv.undoRedo = null; } else if (!priv.undoRedo && settings.undo === true) { priv.undoRedo = new Handsontable.UndoRedo(instance); } } for (i in settings) { if (i === 'data') { continue; //loadData will be triggered later } else { if (instance.PluginHooks.hooks.persistent[i] !== void 0 || instance.PluginHooks.legacy[i] !== void 0) { instance.PluginHooks.add(i, settings[i]); } else { // Update settings if (!init && settings.hasOwnProperty(i)) { GridSettings.prototype[i] = settings[i]; } //launch extensions if (Handsontable.extension[i]) { priv.extensions[i] = new Handsontable.extension[i](instance, settings[i]); } } } } // Load data or create data map if (settings.data === void 0 && priv.settings.data === void 0) { var data = []; var row; for (r = 0, rlen = priv.settings.startRows; r < rlen; r++) { row = []; for (c = 0, clen = priv.settings.startCols; c < clen; c++) { row.push(null); } data.push(row); } instance.loadData(data); //data source created just now } else if (settings.data !== void 0) { instance.loadData(settings.data); //data source given as option } else if (settings.columns !== void 0) { datamap.createMap(); } // Init columns constructors configuration clen = instance.countCols(); //Clear cellSettings cache priv.cellSettings.length = 0; if (clen > 0) { var prop, proto, column; for (i = 0; i < clen; i++) { priv.columnSettings[i] = Handsontable.helper.columnFactory(GridSettings, priv.columnsSettingConflicts); // shortcut for prototype proto = priv.columnSettings[i].prototype; // Use settings provided by user if (GridSettings.prototype.columns) { column = GridSettings.prototype.columns[i]; expandType(column); Handsontable.helper.extend(proto, column); } } } if (typeof settings.fillHandle !== "undefined") { if (autofill.handle && settings.fillHandle === false) { autofill.disable(); } else if (!autofill.handle && settings.fillHandle !== false) { autofill.init(); } } if (!init) { instance.PluginHooks.run('afterUpdateSettings'); } grid.adjustRowsAndCols(); if (instance.view) { instance.forceFullRender = true; //used when data was changed selection.refreshBorders(null, true); } }; function expandType(obj) { if (obj.hasOwnProperty('type')) { //ignore obj.prototype.type var type , i; if (typeof obj.type === 'object') { type = obj.type; } else if (typeof obj.type === 'string') { type = Handsontable.cellTypes[obj.type]; if (type === void 0) { throw new Error('You declared cell type "' + obj.type + '" as a string that is not mapped to a known object. Cell type must be an object or a string mapped to an object in Handsontable.cellTypes'); } } for (i in type) { if (type.hasOwnProperty(i) && !obj.hasOwnProperty(i)) { obj[i] = type[i]; } } } } /** * Returns current settings object * @return {Object} */ this.getSettings = function () { return priv.settings; }; /** * Returns current settingsFromDOM object * @return {Object} */ this.getSettingsFromDOM = function () { return priv.settingsFromDOM; }; /** * Clears grid * @public */ this.clear = function () { selection.selectAll(); selection.empty(); }; /** * Return true if undo can be performed, false otherwise * @public */ this.isUndoAvailable = function () { return priv.undoRedo && priv.undoRedo.isUndoAvailable(); }; /** * Return true if redo can be performed, false otherwise * @public */ this.isRedoAvailable = function () { return priv.undoRedo && priv.undoRedo.isRedoAvailable(); }; /** * Undo last edit * @public */ this.undo = function () { priv.undoRedo && priv.undoRedo.undo(); }; /** * Redo edit (used to reverse an undo) * @public */ this.redo = function () { priv.undoRedo && priv.undoRedo.redo(); }; /** * Clears undo history * @public */ this.clearUndo = function () { priv.undoRedo && priv.undoRedo.clear(); }; /** * Inserts or removes rows and columns * @param {String} action See grid.alter for possible values * @param {Number} index * @param {Number} amount * @param {String} [source] Optional. Source of hook runner. * @param {Boolean} [keepEmptyRows] Optional. Flag for preventing deletion of empty rows. * @public */ this.alter = function (action, index, amount, source, keepEmptyRows) { grid.alter(action, index, amount, source, keepEmptyRows); }; /** * Returns <td> element corresponding to params row, col * @param {Number} row * @param {Number} col * @public * @return {Element} */ this.getCell = function (row, col) { return instance.view.getCellAtCoords({row: row, col: col}); }; /** * Returns property name associated with column number * @param {Number} col * @public * @return {String} */ this.colToProp = function (col) { return datamap.colToProp(col); }; /** * Returns column number associated with property name * @param {String} prop * @public * @return {Number} */ this.propToCol = function (prop) { return datamap.propToCol(prop); }; /** * Return value at `row`, `col` * @param {Number} row * @param {Number} col * @public * @return value (mixed data type) */ this.getDataAtCell = function (row, col) { return datamap.get(row, datamap.colToProp(col)); }; /** * Return value at `row`, `prop` * @param {Number} row * @param {String} prop * @public * @return value (mixed data type) */ this.getDataAtRowProp = function (row, prop) { return datamap.get(row, prop); }; /** * Return value at `col` * @param {Number} col * @public * @return value (mixed data type) */ this.getDataAtCol = function (col) { return [].concat.apply([], datamap.getRange({row: 0, col: col}, {row: priv.settings.data.length - 1, col: col})); }; /** * Return value at `prop` * @param {String} prop * @public * @return value (mixed data type) */ this.getDataAtProp = function (prop) { return [].concat.apply([], datamap.getRange({row: 0, col: datamap.propToCol(prop)}, {row: priv.settings.data.length - 1, col: datamap.propToCol(prop)})); }; /** * Return value at `row` * @param {Number} row * @public * @return value (mixed data type) */ this.getDataAtRow = function (row) { return priv.settings.data[row]; }; /** * Returns cell meta data object corresponding to params row, col * @param {Number} row * @param {Number} col * @public * @return {Object} */ this.getCellMeta = function (row, col) { var prop = datamap.colToProp(col) , cellProperties; row = translateRowIndex(row); col = translateColIndex(col); if ("undefined" === typeof priv.columnSettings[col]) { priv.columnSettings[col] = Handsontable.helper.columnFactory(GridSettings, priv.columnsSettingConflicts); } if (!priv.cellSettings[row]) { priv.cellSettings[row] = []; } if (!priv.cellSettings[row][col]) { priv.cellSettings[row][col] = new priv.columnSettings[col](); } cellProperties = priv.cellSettings[row][col]; //retrieve cellProperties from cache cellProperties.row = row; cellProperties.col = col; cellProperties.prop = prop; cellProperties.instance = instance; instance.PluginHooks.run('beforeGetCellMeta', row, col, cellProperties); expandType(cellProperties); //for `type` added in beforeGetCellMeta if (cellProperties.cells) { var settings = cellProperties.cells.call(cellProperties, row, col, prop); if (settings) { expandType(settings); //for `type` added in cells Handsontable.helper.extend(cellProperties, settings); } } instance.PluginHooks.run('afterGetCellMeta', row, col, cellProperties); return cellProperties; /** * If displayed rows order is different than the order of rows stored in memory (i.e. sorting is applied) * we need to translate logical (stored) row index to physical (displayed) index. * @param row - original row index * @returns {int} translated row index */ function translateRowIndex(row){ var getVars = {row: row}; instance.PluginHooks.execute('beforeGet', getVars); return getVars.row; } /** * If displayed columns order is different than the order of columns stored in memory (i.e. column were moved using manualColumnMove plugin) * we need to translate logical (stored) column index to physical (displayed) index. * @param col - original column index * @returns {int} - translated column index */ function translateColIndex(col){ return Handsontable.PluginHooks.execute(instance, 'modifyCol', col); // warning: this must be done after datamap.colToProp } }; /** * Validates all cells using their validator functions and calls callback when finished. Does not render the view * @param callback */ this.validateCells = function (callback) { var waitingForValidator = new ValidatorsQueue(); waitingForValidator.onQueueEmpty = callback; var i = instance.countRows() - 1; while (i >= 0) { var j = instance.countCols() - 1; while (j >= 0) { waitingForValidator.addValidatorToQueue(); instance.validateCell(instance.getDataAtCell(i, j), instance.getCellMeta(i, j), function () { waitingForValidator.removeValidatorFormQueue(); }, 'validateCells'); j--; } i--; } waitingForValidator.checkIfQueueIsEmpty(); }; /** * Return array of row headers (if they are enabled). If param `row` given, return header at given row as string * @param {Number} row (Optional) * @return {Array|String} */ this.getRowHeader = function (row) { if (row === void 0) { var out = []; for (var i = 0, ilen = instance.countRows(); i < ilen; i++) { out.push(instance.getRowHeader(i)); } return out; } else if (Object.prototype.toString.call(priv.settings.rowHeaders) === '[object Array]' && priv.settings.rowHeaders[row] !== void 0) { return priv.settings.rowHeaders[row]; } else if (typeof priv.settings.rowHeaders === 'function') { return priv.settings.rowHeaders(row); } else if (priv.settings.rowHeaders && typeof priv.settings.rowHeaders !== 'string' && typeof priv.settings.rowHeaders !== 'number') { return row + 1; } else { return priv.settings.rowHeaders; } }; /** * Return array of column headers (if they are enabled). If param `col` given, return header at given column as string * @param {Number} col (Optional) * @return {Array|String} */ this.getColHeader = function (col) { if (col === void 0) { var out = []; for (var i = 0, ilen = instance.countCols(); i < ilen; i++) { out.push(instance.getColHeader(i)); } return out; } else { col = Handsontable.PluginHooks.execute(instance, 'modifyCol', col); if (priv.settings.columns && priv.settings.columns[col] && priv.settings.columns[col].title) { return priv.settings.columns[col].title; } else if (Object.prototype.toString.call(priv.settings.colHeaders) === '[object Array]' && priv.settings.colHeaders[col] !== void 0) { return priv.settings.colHeaders[col]; } else if (typeof priv.settings.colHeaders === 'function') { return priv.settings.colHeaders(col); } else if (priv.settings.colHeaders && typeof priv.settings.colHeaders !== 'string' && typeof priv.settings.colHeaders !== 'number') { return Handsontable.helper.spreadsheetColumnLabel(col); } else { return priv.settings.colHeaders; } } }; /** * Return column width from settings (no guessing). Private use intended * @param {Number} col * @return {Number} */ this._getColWidthFromSettings = function (col) { if (priv.settings.columns && priv.settings.columns[col] && priv.settings.columns[col].width) { return priv.settings.columns[col].width; } else if (Object.prototype.toString.call(priv.settings.colWidths) === '[object Array]' && priv.settings.colWidths[col] !== void 0) { return priv.settings.colWidths[col]; } }; /** * Return column width * @param {Number} col * @return {Number} */ this.getColWidth = function (col) { col = Handsontable.PluginHooks.execute(instance, 'modifyCol', col); var response = { width: instance._getColWidthFromSettings(col) }; if (!response.width) { response.width = 50; } instance.PluginHooks.run('afterGetColWidth', col, response); return response.width; }; /** * Return total number of rows in grid * @return {Number} */ this.countRows = function () { return priv.settings.data.length; }; /** * Return total number of columns in grid * @return {Number} */ this.countCols = function () { if (priv.dataType === 'object' || priv.dataType === 'function') { if (priv.settings.columns && priv.settings.columns.length) { return priv.settings.columns.length; } else { return priv.colToProp.length; } } else if (priv.dataType === 'array') { if (priv.settings.columns && priv.settings.columns.length) { return priv.settings.columns.length; } else if (priv.settings.data && priv.settings.data[0] && priv.settings.data[0].length) { return priv.settings.data[0].length; } else { return 0; } } }; /** * Return index of first visible row * @return {Number} */ this.rowOffset = function () { return instance.view.wt.getSetting('offsetRow'); }; /** * Return index of first visible column * @return {Number} */ this.colOffset = function () { return instance.view.wt.getSetting('offsetColumn'); }; /** * Return number of visible rows. Returns -1 if table is not visible * @return {Number} */ this.countVisibleRows = function () { return instance.view.wt.drawn ? instance.view.wt.wtTable.rowStrategy.countVisible() : -1; }; /** * Return number of visible columns. Returns -1 if table is not visible * @return {Number} */ this.countVisibleCols = function () { return instance.view.wt.drawn ? instance.view.wt.wtTable.columnStrategy.countVisible() : -1; }; /** * Return number of empty rows * @return {Boolean} ending If true, will only count empty rows at the end of the data source */ this.countEmptyRows = function (ending) { var i = instance.countRows() - 1 , empty = 0; while (i >= 0) { datamap.get(i, 0); if (instance.isEmptyRow(datamap.getVars.row)) { empty++; } else if (ending) { break; } i--; } return empty; }; /** * Return number of empty columns * @return {Boolean} ending If true, will only count empty columns at the end of the data source row */ this.countEmptyCols = function (ending) { if (instance.countRows() < 1) { return 0; } var i = instance.countCols() - 1 , empty = 0; while (i >= 0) { if (instance.isEmptyCol(i)) { empty++; } else if (ending) { break; } i--; } return empty; }; /** * Return true if the row at the given index is empty, false otherwise * @param {Number} r Row index * @return {Boolean} */ this.isEmptyRow = function (r) { if (priv.settings.isEmptyRow) { return priv.settings.isEmptyRow.call(instance, r); } var val; for (var c = 0, clen = instance.countCols(); c < clen; c++) { val = instance.getDataAtCell(r, c); if (val !== '' && val !== null && typeof val !== 'undefined') { return false; } } return true; }; /** * Return true if the column at the given index is empty, false otherwise * @param {Number} c Column index * @return {Boolean} */ this.isEmptyCol = function (c) { if (priv.settings.isEmptyCol) { return priv.settings.isEmptyCol.call(instance, c); } var val; for (var r = 0, rlen = instance.countRows(); r < rlen; r++) { val = instance.getDataAtCell(r, c); if (val !== '' && val !== null && typeof val !== 'undefined') { return false; } } return true; }; /** * Selects cell on grid. Optionally selects range to another cell * @param {Number} row * @param {Number} col * @param {Number} [endRow] * @param {Number} [endCol] * @param {Boolean} [scrollToCell=true] If true, viewport will be scrolled to the selection * @public * @return {Boolean} */ this.selectCell = function (row, col, endRow, endCol, scrollToCell) { if (typeof row !== 'number' || row < 0 || row >= instance.countRows()) { return false; } if (typeof col !== 'number' || col < 0 || col >= instance.countCols()) { return false; } if (typeof endRow !== "undefined") { if (typeof endRow !== 'number' || endRow < 0 || endRow >= instance.countRows()) { return false; } if (typeof endCol !== 'number' || endCol < 0 || endCol >= instance.countCols()) { return false; } } priv.selStart.coords({row: row, col: col}); if (document.activeElement && document.activeElement !== document.documentElement && document.activeElement !== document.body) { document.activeElement.blur(); //needed or otherwise prepare won't focus the cell. selectionSpec tests this (should move focus to selected cell) } instance.listen(); if (typeof endRow === "undefined") { selection.setRangeEnd({row: row, col: col}, scrollToCell); } else { selection.setRangeEnd({row: endRow, col: endCol}, scrollToCell); } instance.selection.finish(); return true; }; this.selectCellByProp = function (row, prop, endRow, endProp, scrollToCell) { arguments[1] = datamap.propToCol(arguments[1]); if (typeof arguments[3] !== "undefined") { arguments[3] = datamap.propToCol(arguments[3]); } return instance.selectCell.apply(instance, arguments); }; /** * Deselects current sell selection on grid * @public */ this.deselectCell = function () { selection.deselect(); }; /** * Remove grid from DOM * @public */ this.destroy = function () { instance.clearTimeouts(); if (instance.view) { //in case HT is destroyed before initialization has finished instance.view.wt.destroy(); } instance.rootElement.empty(); instance.rootElement.removeData('handsontable'); instance.rootElement.off('.handsontable'); $(window).off('.' + instance.guid); $document.off('.' + instance.guid); $body.off('.' + instance.guid); instance.copyPaste.removeCallback(priv.onCut); instance.copyPaste.removeCallback(priv.onPaste); instance.PluginHooks.run('afterDestroy'); }; /** * Return Handsontable instance * @public * @return {Object} */ this.getInstance = function () { return instance.rootElement.data("handsontable"); }; (function () { // Create new instance of plugin hooks instance.PluginHooks = new Handsontable.PluginHookClass(); // Upgrade methods to call of global PluginHooks instance var _run = instance.PluginHooks.run , _exe = instance.PluginHooks.execute; instance.PluginHooks.run = function (key, p1, p2, p3, p4, p5) { _run.call(this, instance, key, p1, p2, p3, p4, p5); Handsontable.PluginHooks.run(instance, key, p1, p2, p3, p4, p5); }; instance.PluginHooks.execute = function (key, p1, p2, p3, p4, p5) { var globalHandlerResult = Handsontable.PluginHooks.execute(instance, key, p1, p2, p3, p4, p5); var localHandlerResult = _exe.call(this, instance, key, globalHandlerResult, p2, p3, p4, p5); return typeof localHandlerResult == 'undefined' ? globalHandlerResult : localHandlerResult; }; // Map old API with new methods instance.addHook = function () { instance.PluginHooks.add.apply(instance.PluginHooks, arguments); }; instance.addHookOnce = function () { instance.PluginHooks.once.apply(instance.PluginHooks, arguments); }; instance.removeHook = function () { instance.PluginHooks.remove.apply(instance.PluginHooks, arguments); }; instance.runHooks = function () { instance.PluginHooks.run.apply(instance.PluginHooks, arguments); }; instance.runHooksAndReturn = function () { return instance.PluginHooks.execute.apply(instance.PluginHooks, arguments); }; })(); this.timeouts = {}; /** * Sets timeout. Purpose of this method is to clear all known timeouts when `destroy` method is called * @public */ this.registerTimeout = function (key, handle, ms) { clearTimeout(this.timeouts[key]); this.timeouts[key] = setTimeout(handle, ms || 0); }; /** * Clears all known timeouts * @public */ this.clearTimeouts = function () { for (var key in this.timeouts) { if (this.timeouts.hasOwnProperty(key)) { clearTimeout(this.timeouts[key]); } } }; /** * Handsontable version */ this.version = '0.9.13'; //inserted by grunt from package.json }; var DefaultSettings = function () { }; DefaultSettings.prototype = { data: void 0, width: void 0, height: void 0, startRows: 5, startCols: 5, minRows: 0, minCols: 0, maxRows: Infinity, maxCols: Infinity, minSpareRows: 0, minSpareCols: 0, multiSelect: true, fillHandle: true, fixedRowsTop: 0, fixedColumnsLeft: 0, undo: true, outsideClickDeselects: true, enterBeginsEditing: true, enterMoves: {row: 1, col: 0}, tabMoves: {row: 0, col: 1}, autoWrapRow: false, autoWrapCol: false, copyRowsLimit: 1000, copyColsLimit: 1000, pasteMode: 'overwrite', currentRowClassName: void 0, currentColClassName: void 0, stretchH: 'hybrid', isEmptyRow: void 0, isEmptyCol: void 0, observeDOMVisibility: true, allowInvalid: true, invalidCellClassName: 'htInvalid', fragmentSelection: false, readOnly: false }; $.fn.handsontable = function (action) { var i , ilen , args , output , userSettings , $this = this.first() // Use only first element from list , instance = $this.data('handsontable'); // Init case if (typeof action !== 'string') { userSettings = action || {}; if (instance) { instance.updateSettings(userSettings); } else { instance = new Handsontable.Core($this, userSettings); $this.data('handsontable', instance); instance.init(); } return $this; } // Action case else { args = []; if (arguments.length > 1) { for (i = 1, ilen = arguments.length; i < ilen; i++) { args.push(arguments[i]); } } if (instance) { if (typeof instance[action] !== 'undefined') { output = instance[action].apply(instance, args); } else { throw new Error('Handsontable do not provide action: ' + action); } } return output; } }; /** * Handsontable TableView constructor * @param {Object} instance */ Handsontable.TableView = function (instance) { var that = this , $window = $(window) , $documentElement = $(document.documentElement); this.instance = instance; this.settings = instance.getSettings(); this.settingsFromDOM = instance.getSettingsFromDOM(); instance.rootElement.data('originalStyle', instance.rootElement[0].getAttribute('style')); //needed to retrieve original style in jsFiddle link generator in HT examples. may be removed in future versions // in IE7 getAttribute('style') returns an object instead of a string, but we only support IE8+ instance.rootElement.addClass('handsontable'); var table = document.createElement('TABLE'); table.className = 'htCore'; this.THEAD = document.createElement('THEAD'); table.appendChild(this.THEAD); this.TBODY = document.createElement('TBODY'); table.appendChild(this.TBODY); instance.$table = $(table); instance.rootElement.prepend(instance.$table); instance.rootElement.on('mousedown.handsontable', function (event) { if (!that.isTextSelectionAllowed(event.target)) { event.preventDefault(); //disable text selection in Chrome clearTextSelection(); } }); $documentElement.on('keyup.' + instance.guid, function (event) { if (instance.selection.isInProgress() && !event.shiftKey) { instance.selection.finish(); } }); var isMouseDown , dragInterval; $documentElement.on('mouseup.' + instance.guid, function (event) { if (instance.selection.isInProgress() && event.which === 1) { //is left mouse button instance.selection.finish(); } isMouseDown = false; clearInterval(dragInterval); dragInterval = null; if (instance.autofill.handle && instance.autofill.handle.isDragged) { if (instance.autofill.handle.isDragged > 1) { instance.autofill.apply(); } instance.autofill.handle.isDragged = 0; } if (Handsontable.helper.isOutsideInput(document.activeElement)) { instance.unlisten(); } }); $documentElement.on('mousedown.' + instance.guid, function (event) { var next = event.target; if (next !== that.wt.wtTable.spreader) { //immediate click on "spreader" means click on the right side of vertical scrollbar while (next !== document.documentElement) { //X-HANDSONTABLE is the tag name in Web Components version of HOT. Removal of this breaks cell selection if (next === null) { return; //click on something that was a row but now is detached (possibly because your click triggered a rerender) } if (next === instance.rootElement[0] || next.nodeName === 'X-HANDSONTABLE' || next.id === 'context-menu-layer' || $(next).is('.context-menu-list') || $(next).is('.typeahead li')) { return; //click inside container } next = next.parentNode; } } if (that.settings.outsideClickDeselects) { instance.deselectCell(); } else { instance.destroyEditor(); } }); instance.rootElement.on('mousedown.handsontable', '.dragdealer', function (event) { instance.destroyEditor(); }); instance.$table.on('selectstart', function (event) { if (that.settings.fragmentSelection) { return; } //https://github.com/warpech/jquery-handsontable/issues/160 //selectstart is IE only event. Prevent text from being selected when performing drag down in IE8 event.preventDefault(); }); instance.$table.on('mouseenter', function () { if (dragInterval) { //if dragInterval was set (that means mouse was really outside of table, not over an element that is outside of <table> in DOM clearInterval(dragInterval); dragInterval = null; } }); instance.$table.on('mouseleave', function (event) { if (!(isMouseDown || (instance.autofill.handle && instance.autofill.handle.isDragged))) { return; } var tolerance = 1 //this is needed because width() and height() contains stuff like cell borders , offset = that.wt.wtDom.offset(table) , offsetTop = offset.top + tolerance , offsetLeft = offset.left + tolerance , width = that.containerWidth - that.wt.getSetting('scrollbarWidth') - 2 * tolerance , height = that.containerHeight - that.wt.getSetting('scrollbarHeight') - 2 * tolerance , method , row = 0 , col = 0 , dragFn; if (event.pageY < offsetTop) { //top edge crossed row = -1; method = 'scrollVertical'; } else if (event.pageY >= offsetTop + height) { //bottom edge crossed row = 1; method = 'scrollVertical'; } else if (event.pageX < offsetLeft) { //left edge crossed col = -1; method = 'scrollHorizontal'; } else if (event.pageX >= offsetLeft + width) { //right edge crossed col = 1; method = 'scrollHorizontal'; } if (method) { dragFn = function () { if (isMouseDown || (instance.autofill.handle && instance.autofill.handle.isDragged)) { //instance.selection.transformEnd(row, col); that.wt[method](row + col).draw(); } }; dragFn(); dragInterval = setInterval(dragFn, 100); } }); var clearTextSelection = function () { //http://stackoverflow.com/questions/3169786/clear-text-selection-with-javascript if (window.getSelection) { if (window.getSelection().empty) { // Chrome window.getSelection().empty(); } else if (window.getSelection().removeAllRanges) { // Firefox window.getSelection().removeAllRanges(); } } else if (document.selection) { // IE? document.selection.empty(); } }; var walkontableConfig = { table: table, stretchH: this.settings.stretchH, data: instance.getDataAtCell, totalRows: instance.countRows, totalColumns: instance.countCols, scrollbarModelV: this.settings.scrollbarModelV, scrollbarModelH: this.settings.scrollbarModelH, offsetRow: 0, offsetColumn: 0, width: this.getWidth(), height: this.getHeight(), fixedColumnsLeft: function () { return that.settings.fixedColumnsLeft; }, fixedRowsTop: function () { return that.settings.fixedRowsTop; }, rowHeaders: function () { return that.settings.rowHeaders ? [function (index, TH) { that.appendRowHeader(index, TH); }] : [] }, columnHeaders: function () { return that.settings.colHeaders ? [function (index, TH) { that.appendColHeader(index, TH); }] : [] }, columnWidth: instance.getColWidth, cellRenderer: function (row, column, TD) { that.applyCellTypeMethod('renderer', TD, row, column); }, selections: { current: { className: 'current', border: { width: 2, color: '#5292F7', style: 'solid', cornerVisible: function () { return that.settings.fillHandle && !that.isCellEdited() && !instance.selection.isMultiple() } } }, area: { className: 'area', border: { width: 1, color: '#89AFF9', style: 'solid', cornerVisible: function () { return that.settings.fillHandle && !that.isCellEdited() && instance.selection.isMultiple() } } }, highlight: { highlightRowClassName: that.settings.currentRowClassName, highlightColumnClassName: that.settings.currentColClassName }, fill: { className: 'fill', border: { width: 1, color: 'red', style: 'solid' } } }, hideBorderOnMouseDownOver: function () { return that.settings.fragmentSelection; }, onCellMouseDown: function (event, coords, TD) { instance.listen(); isMouseDown = true; var coordsObj = {row: coords[0], col: coords[1]}; if (event.button === 2 && instance.selection.inInSelection(coordsObj)) { //right mouse button //do nothing } else if (event.shiftKey) { instance.selection.setRangeEnd(coordsObj); } else { instance.selection.setRangeStart(coordsObj); } if (that.settings.afterOnCellMouseDown) { that.settings.afterOnCellMouseDown.call(instance, event, coords, TD); } }, /*onCellMouseOut: function (/*event, coords, TD* /) { if (isMouseDown && that.settings.fragmentSelection === 'single') { clearTextSelection(); //otherwise text selection blinks during multiple cells selection } },*/ onCellMouseOver: function (event, coords/*, TD*/) { var coordsObj = {row: coords[0], col: coords[1]}; if (isMouseDown) { /*if (that.settings.fragmentSelection === 'single') { clearTextSelection(); //otherwise text selection blinks during multiple cells selection }*/ instance.selection.setRangeEnd(coordsObj); } else if (instance.autofill.handle && instance.autofill.handle.isDragged) { instance.autofill.handle.isDragged++; instance.autofill.showBorder(coords); } }, onCellCornerMouseDown: function (event) { instance.autofill.handle.isDragged = 1; event.preventDefault(); }, onCellCornerDblClick: function () { instance.autofill.selectAdjacent(); }, beforeDraw: function (force) { that.beforeRender(force); }, onDraw: function(force){ that.onDraw(force); } }; instance.PluginHooks.run('beforeInitWalkontable', walkontableConfig); this.wt = new Walkontable(walkontableConfig); $window.on('resize.' + instance.guid, function () { instance.registerTimeout('resizeTimeout', function () { instance.parseSettingsFromDOM(); var newWidth = that.getWidth(); var newHeight = that.getHeight(); if (walkontableConfig.width !== newWidth || walkontableConfig.height !== newHeight) { instance.forceFullRender = true; that.render(); walkontableConfig.width = newWidth; walkontableConfig.height = newHeight; } }, 60); }); $(that.wt.wtTable.spreader).on('mousedown.handsontable, contextmenu.handsontable', function (event) { if (event.target === that.wt.wtTable.spreader && event.which === 3) { //right mouse button exactly on spreader means right clickon the right hand side of vertical scrollbar event.stopPropagation(); } }); $documentElement.on('click.' + instance.guid, function () { if (that.settings.observeDOMVisibility) { if (that.wt.drawInterrupted) { that.instance.forceFullRender = true; that.render(); } } }); }; Handsontable.TableView.prototype.isTextSelectionAllowed = function (el) { if (el.nodeName === 'TEXTAREA') { return (true); } if (this.settings.fragmentSelection && this.wt.wtDom.isChildOf(el, this.TBODY)) { return (true); } return false; }; Handsontable.TableView.prototype.isCellEdited = function () { return document.activeElement !== document.body; }; Handsontable.TableView.prototype.getWidth = function () { var val = this.settings.width !== void 0 ? this.settings.width : this.settingsFromDOM.width; return typeof val === 'function' ? val() : val; }; Handsontable.TableView.prototype.getHeight = function () { var val = this.settings.height !== void 0 ? this.settings.height : this.settingsFromDOM.height; return typeof val === 'function' ? val() : val; }; Handsontable.TableView.prototype.beforeRender = function (force) { if (force) { this.instance.PluginHooks.run('beforeRender'); this.wt.update('width', this.getWidth()); this.wt.update('height', this.getHeight()); } }; Handsontable.TableView.prototype.onDraw = function(force){ if (force) { this.instance.PluginHooks.run('afterRender'); } }; Handsontable.TableView.prototype.render = function () { this.wt.draw(!this.instance.forceFullRender); this.instance.forceFullRender = false; this.instance.rootElement.triggerHandler('render.handsontable'); }; Handsontable.TableView.prototype.applyCellTypeMethod = function (methodName, td, row, col) { var prop = this.instance.colToProp(col) , cellProperties = this.instance.getCellMeta(row, col) , method = Handsontable.helper.getCellMethod(methodName, cellProperties[methodName]); //methodName is 'renderer' or 'editor' return method(this.instance, td, row, col, prop, this.instance.getDataAtRowProp(row, prop), cellProperties); }; /** * Returns td object given coordinates */ Handsontable.TableView.prototype.getCellAtCoords = function (coords) { var td = this.wt.wtTable.getCell([coords.row, coords.col]); if (td < 0) { //there was an exit code (cell is out of bounds) return null; } else { return td; } }; /** * Scroll viewport to selection * @param coords */ Handsontable.TableView.prototype.scrollViewport = function (coords) { this.wt.scrollViewport([coords.row, coords.col]); }; /** * Append row header to a TH element * @param row * @param TH */ Handsontable.TableView.prototype.appendRowHeader = function (row, TH) { if (row > -1) { this.wt.wtDom.fastInnerHTML(TH, this.instance.getRowHeader(row)); } else { this.wt.wtDom.empty(TH); } }; /** * Append column header to a TH element * @param col * @param TH */ Handsontable.TableView.prototype.appendColHeader = function (col, TH) { var DIV = document.createElement('DIV') , SPAN = document.createElement('SPAN'); DIV.className = 'relative'; SPAN.className = 'colHeader'; this.wt.wtDom.fastInnerHTML(SPAN, this.instance.getColHeader(col)); DIV.appendChild(SPAN); while (TH.firstChild) { TH.removeChild(TH.firstChild); //empty TH node } TH.appendChild(DIV); this.instance.PluginHooks.run('afterGetColHeader', col, TH); }; /** * Given a element's left position relative to the viewport, returns maximum element width until the right edge of the viewport (before scrollbar) * @param {Number} left * @return {Number} */ Handsontable.TableView.prototype.maximumVisibleElementWidth = function (left) { var rootWidth = this.wt.wtViewport.getWorkspaceWidth(); return rootWidth - left; }; /** * Given a element's top position relative to the viewport, returns maximum element height until the bottom edge of the viewport (before scrollbar) * @param {Number} top * @return {Number} */ Handsontable.TableView.prototype.maximumVisibleElementHeight = function (top) { var rootHeight = this.wt.wtViewport.getWorkspaceHeight(); return rootHeight - top; }; /** * Returns true if keyCode represents a printable character * @param {Number} keyCode * @return {Boolean} */ Handsontable.helper.isPrintableChar = function (keyCode) { return ((keyCode == 32) || //space (keyCode >= 48 && keyCode <= 57) || //0-9 (keyCode >= 96 && keyCode <= 111) || //numpad (keyCode >= 186 && keyCode <= 192) || //;=,-./` (keyCode >= 219 && keyCode <= 222) || //[]{}\|"' keyCode >= 226 || //special chars (229 for Asian chars) (keyCode >= 65 && keyCode <= 90)); //a-z }; /** * Converts a value to string * @param value * @return {String} */ Handsontable.helper.stringify = function (value) { switch (typeof value) { case 'string': case 'number': return value + ''; break; case 'object': if (value === null) { return ''; } else { return value.toString(); } break; case 'undefined': return ''; break; default: return value.toString(); } }; /** * Generates spreadsheet-like column names: A, B, C, ..., Z, AA, AB, etc * @param index * @returns {String} */ Handsontable.helper.spreadsheetColumnLabel = function (index) { var dividend = index + 1; var columnLabel = ''; var modulo; while (dividend > 0) { modulo = (dividend - 1) % 26; columnLabel = String.fromCharCode(65 + modulo) + columnLabel; dividend = parseInt((dividend - modulo) / 26, 10); } return columnLabel; }; /** * Checks if value of n is a numeric one * http://jsperf.com/isnan-vs-isnumeric/4 * @param n * @returns {boolean} */ Handsontable.helper.isNumeric = function (n) { var t = typeof n; return t == 'number' ? !isNaN(n) && isFinite(n) : t == 'string' ? !n.length ? false : n.length == 1 ? /\d/.test(n) : /^\s*[+-]?\s*(?:(?:\d+(?:\.\d+)?(?:e[+-]?\d+)?)|(?:0x[a-f\d]+))\s*$/i.test(n) : t == 'object' ? !!n && typeof n.valueOf() == "number" && !(n instanceof Date) : false; }; /** * Checks if child is a descendant of given parent node * http://stackoverflow.com/questions/2234979/how-to-check-in-javascript-if-one-element-is-a-child-of-another * @param parent * @param child * @returns {boolean} */ Handsontable.helper.isDescendant = function (parent, child) { var node = child.parentNode; while (node != null) { if (node == parent) { return true; } node = node.parentNode; } return false; }; /** * Generates a random hex string. Used as namespace for Handsontable instance events. * @return {String} - 16 character random string: "92b1bfc74ec4" */ Handsontable.helper.randomString = function () { function s4() { return Math.floor((1 + Math.random()) * 0x10000) .toString(16) .substring(1); } return s4() + s4() + s4() + s4(); }; /** * Inherit without without calling parent constructor, and setting `Child.prototype.constructor` to `Child` instead of `Parent`. * Creates temporary dummy function to call it as constructor. * Described in ticket: https://github.com/warpech/jquery-handsontable/pull/516 * @param {Object} Child child class * @param {Object} Parent parent class * @return {Object} extended Child */ Handsontable.helper.inherit = function (Child, Parent) { function Bridge() { } Bridge.prototype = Parent.prototype; Child.prototype = new Bridge(); Child.prototype.constructor = Child; return Child; }; /** * Perform shallow extend of a target object with extension's own properties * @param {Object} target An object that will receive the new properties * @param {Object} extension An object containing additional properties to merge into the target */ Handsontable.helper.extend = function (target, extension) { for (var i in extension) { if (extension.hasOwnProperty(i)) { target[i] = extension[i]; } } }; /** * Factory for columns constructors. * @param {Object} GridSettings * @param {Array} conflictList * @return {Object} ColumnSettings */ Handsontable.helper.columnFactory = function (GridSettings, conflictList) { var i = 0, len = conflictList.length, ColumnSettings = function () { }; // Inherit prototype from grid settings ColumnSettings.prototype = new GridSettings(); // Clear conflict settings for (; i < len; i++) { ColumnSettings.prototype[conflictList[i]] = void 0; } return ColumnSettings; }; Handsontable.helper.translateRowsToColumns = function (input) { var i , ilen , j , jlen , output = [] , olen = 0; for (i = 0, ilen = input.length; i < ilen; i++) { for (j = 0, jlen = input[i].length; j < jlen; j++) { if (j == olen) { output.push([]); olen++; } output[j].push(input[i][j]) } } return output; }; Handsontable.helper.to2dArray = function (arr) { var i = 0 , ilen = arr.length; while (i < ilen) { arr[i] = [arr[i]]; i++; } }; Handsontable.helper.extendArray = function (arr, extension) { var i = 0 , ilen = extension.length; while (i < ilen) { arr.push(extension[i]); i++; } }; /** * Returns cell renderer or editor function directly or through lookup map */ Handsontable.helper.getCellMethod = function (methodName, methodFunction) { if (typeof methodFunction === 'string') { var result = Handsontable.cellLookup[methodName][methodFunction]; if (result === void 0) { throw new Error('You declared cell ' + methodName + ' "' + methodFunction + '" as a string that is not mapped to a known function. Cell ' + methodName + ' must be a function or a string mapped to a function in Handsontable.cellLookup.' + methodName + ' lookup object'); } return result; } else { return methodFunction; } }; /** * Determines if the given DOM element is an input field placed outside of HOT. * Notice: By 'input' we mean input, textarea and select nodes * @param element - DOM element * @returns {boolean} */ Handsontable.helper.isOutsideInput = function (element) { var inputs = ['INPUT', 'SELECT', 'TEXTAREA']; return inputs.indexOf(element.nodeName) > -1 && element.className.indexOf('handsontableInput') == -1; }; /** * Handsontable UndoRedo class */ Handsontable.UndoRedo = function (instance) { var that = this; this.instance = instance; this.clear(); Handsontable.PluginHooks.add("afterChange", function (changes, origin) { if (origin !== 'undo' && origin !== 'redo') { that.add(changes, origin); } }); }; /** * Undo operation from current revision */ Handsontable.UndoRedo.prototype.undo = function () { var i, ilen; if (this.isUndoAvailable()) { var setData = $.extend(true, [], this.data[this.rev]); for (i = 0, ilen = setData.length; i < ilen; i++) { setData[i].splice(3, 1); } this.instance.setDataAtRowProp(setData, null, null, 'undo'); this.rev--; } }; /** * Redo operation from current revision */ Handsontable.UndoRedo.prototype.redo = function () { var i, ilen; if (this.isRedoAvailable()) { this.rev++; var setData = $.extend(true, [], this.data[this.rev]); for (i = 0, ilen = setData.length; i < ilen; i++) { setData[i].splice(2, 1); } this.instance.setDataAtRowProp(setData, null, null, 'redo'); } }; /** * Returns true if undo point is available * @return {Boolean} */ Handsontable.UndoRedo.prototype.isUndoAvailable = function () { return (this.rev >= 0); }; /** * Returns true if redo point is available * @return {Boolean} */ Handsontable.UndoRedo.prototype.isRedoAvailable = function () { return (this.rev < this.data.length - 1); }; /** * Add new history poins * @param changes */ Handsontable.UndoRedo.prototype.add = function (changes, source) { this.rev++; this.data.splice(this.rev); //if we are in point abcdef(g)hijk in history, remove everything after (g) this.data.push(changes); }; /** * Clears undo history */ Handsontable.UndoRedo.prototype.clear = function () { this.data = []; this.rev = -1; }; Handsontable.SelectionPoint = function () { this._row = null; //private use intended this._col = null; }; Handsontable.SelectionPoint.prototype.exists = function () { return (this._row !== null); }; Handsontable.SelectionPoint.prototype.row = function (val) { if (val !== void 0) { this._row = val; } return this._row; }; Handsontable.SelectionPoint.prototype.col = function (val) { if (val !== void 0) { this._col = val; } return this._col; }; Handsontable.SelectionPoint.prototype.coords = function (coords) { if (coords !== void 0) { this._row = coords.row; this._col = coords.col; } return { row: this._row, col: this._col } }; Handsontable.SelectionPoint.prototype.arr = function (arr) { if (arr !== void 0) { this._row = arr[0]; this._col = arr[1]; } return [this._row, this._col] }; /** * Default text renderer * @param {Object} instance Handsontable instance * @param {Element} TD Table cell where to render * @param {Number} row * @param {Number} col * @param {String|Number} prop Row object property name * @param value Value to render (remember to escape unsafe HTML before inserting to DOM!) * @param {Object} cellProperties Cell properites (shared by cell renderer and editor) */ Handsontable.TextRenderer = function (instance, TD, row, col, prop, value, cellProperties) { var escaped = Handsontable.helper.stringify(value); instance.view.wt.wtDom.fastInnerText(TD, escaped); //this is faster than innerHTML. See: https://github.com/warpech/jquery-handsontable/wiki/JavaScript-&-DOM-performance-tips if (cellProperties.readOnly) { instance.view.wt.wtDom.addClass(TD, 'htDimmed'); } if (cellProperties.valid === false && cellProperties.invalidCellClassName) { instance.view.wt.wtDom.addClass(TD, cellProperties.invalidCellClassName); } }; var clonableTEXT = document.createElement('DIV'); clonableTEXT.className = 'htAutocomplete'; var clonableARROW = document.createElement('DIV'); clonableARROW.className = 'htAutocompleteArrow'; clonableARROW.appendChild(document.createTextNode('\u25BC')); //this is faster than innerHTML. See: https://github.com/warpech/jquery-handsontable/wiki/JavaScript-&-DOM-performance-tips /** * Autocomplete renderer * @param {Object} instance Handsontable instance * @param {Element} TD Table cell where to render * @param {Number} row * @param {Number} col * @param {String|Number} prop Row object property name * @param value Value to render (remember to escape unsafe HTML before inserting to DOM!) * @param {Object} cellProperties Cell properites (shared by cell renderer and editor) */ Handsontable.AutocompleteRenderer = function (instance, TD, row, col, prop, value, cellProperties) { var TEXT = clonableTEXT.cloneNode(false); //this is faster than createElement var ARROW = clonableARROW.cloneNode(true); //this is faster than createElement if (!instance.acArrowListener) { //not very elegant but easy and fast instance.acArrowListener = function () { instance.view.wt.getSetting('onCellDblClick'); }; instance.rootElement.on('mouseup', '.htAutocompleteArrow', instance.acArrowListener); //this way we don't bind event listener to each arrow. We rely on propagation instead } Handsontable.TextRenderer(instance, TEXT, row, col, prop, value, cellProperties); if (!TEXT.firstChild) { //http://jsperf.com/empty-node-if-needed //otherwise empty fields appear borderless in demo/renderers.html (IE) TEXT.appendChild(document.createTextNode('\u00A0')); //\u00A0 equals &nbsp; for a text node //this is faster than innerHTML. See: https://github.com/warpech/jquery-handsontable/wiki/JavaScript-&-DOM-performance-tips } TEXT.appendChild(ARROW); instance.view.wt.wtDom.empty(TD); //TODO identify under what circumstances this line can be removed TD.appendChild(TEXT); }; var clonableINPUT = document.createElement('INPUT'); clonableINPUT.className = 'htCheckboxRendererInput'; clonableINPUT.type = 'checkbox'; clonableINPUT.setAttribute('autocomplete', 'off'); /** * Checkbox renderer * @param {Object} instance Handsontable instance * @param {Element} TD Table cell where to render * @param {Number} row * @param {Number} col * @param {String|Number} prop Row object property name * @param value Value to render (remember to escape unsafe HTML before inserting to DOM!) * @param {Object} cellProperties Cell properites (shared by cell renderer and editor) */ Handsontable.CheckboxRenderer = function (instance, TD, row, col, prop, value, cellProperties) { if (typeof cellProperties.checkedTemplate === "undefined") { cellProperties.checkedTemplate = true; } if (typeof cellProperties.uncheckedTemplate === "undefined") { cellProperties.uncheckedTemplate = false; } instance.view.wt.wtDom.empty(TD); //TODO identify under what circumstances this line can be removed var INPUT = clonableINPUT.cloneNode(false); //this is faster than createElement if (value === cellProperties.checkedTemplate || value === Handsontable.helper.stringify(cellProperties.checkedTemplate)) { INPUT.checked = true; TD.appendChild(INPUT); } else if (value === cellProperties.uncheckedTemplate || value === Handsontable.helper.stringify(cellProperties.uncheckedTemplate)) { TD.appendChild(INPUT); } else if (value === null) { //default value INPUT.className += ' noValue'; TD.appendChild(INPUT); } else { instance.view.wt.wtDom.fastInnerText(TD, '#bad value#'); //this is faster than innerHTML. See: https://github.com/warpech/jquery-handsontable/wiki/JavaScript-&-DOM-performance-tips } var $input = $(INPUT); if (cellProperties.readOnly) { $input.on('click', function (event) { event.preventDefault(); }); } else { $input.on('mousedown', function (event) { event.stopPropagation(); //otherwise can confuse cell mousedown handler }); $input.on('mouseup', function (event) { event.stopPropagation(); //otherwise can confuse cell dblclick handler }); $input.on('change', function(){ if (this.checked) { instance.setDataAtRowProp(row, prop, cellProperties.checkedTemplate); } else { instance.setDataAtRowProp(row, prop, cellProperties.uncheckedTemplate); } }); } if(!instance.CheckboxRenderer || !instance.CheckboxRenderer.beforeKeyDownHookBound){ instance.CheckboxRenderer = { beforeKeyDownHookBound : true }; instance.addHook('beforeKeyDown', function(event){ if(event.keyCode == 32){ event.stopImmediatePropagation(); event.preventDefault(); var selection = instance.getSelected(); var cell, checkbox, cellProperties; var selStart = { row: Math.min(selection[0], selection[2]), col: Math.min(selection[1], selection[3]) }; var selEnd = { row: Math.max(selection[0], selection[2]), col: Math.max(selection[1], selection[3]) }; for(var row = selStart.row; row <= selEnd.row; row++ ){ for(var col = selEnd.col; col <= selEnd.col; col++){ cell = instance.getCell(row, col); cellProperties = instance.getCellMeta(row, col); checkbox = cell.querySelectorAll('input[type=checkbox]'); if(checkbox.length > 0 && !cellProperties.readOnly){ for(var i = 0, len = checkbox.length; i < len; i++){ checkbox[i].checked = !checkbox[i].checked; $(checkbox[i]).trigger('change'); } } } } } }); } return TD; }; /** * Numeric cell renderer * @param {Object} instance Handsontable instance * @param {Element} TD Table cell where to render * @param {Number} row * @param {Number} col * @param {String|Number} prop Row object property name * @param value Value to render (remember to escape unsafe HTML before inserting to DOM!) * @param {Object} cellProperties Cell properites (shared by cell renderer and editor) */ Handsontable.NumericRenderer = function (instance, TD, row, col, prop, value, cellProperties) { if (Handsontable.helper.isNumeric(value)) { if (typeof cellProperties.language !== 'undefined') { numeral.language(cellProperties.language) } value = numeral(value).format(cellProperties.format || '0'); //docs: http://numeraljs.com/ instance.view.wt.wtDom.addClass(TD, 'htNumeric'); } Handsontable.TextRenderer(instance, TD, row, col, prop, value, cellProperties); }; function HandsontableTextEditorClass(instance) { this.instance = instance; this.createElements(); this.bindEvents(); } HandsontableTextEditorClass.prototype.createElements = function () { this.STATE_VIRGIN = 'STATE_VIRGIN'; //before editing this.STATE_EDITING = 'STATE_EDITING'; this.STATE_WAITING = 'STATE_WAITING'; //waiting for async validation this.STATE_FINISHED = 'STATE_FINISHED'; this.state = this.STATE_VIRGIN; this.waitingEvent = null; this.wtDom = new WalkontableDom(); this.TEXTAREA = document.createElement('TEXTAREA'); this.TEXTAREA.className = 'handsontableInput'; this.textareaStyle = this.TEXTAREA.style; this.textareaStyle.width = 0; this.textareaStyle.height = 0; this.$textarea = $(this.TEXTAREA); this.TEXTAREA_PARENT = document.createElement('DIV'); this.TEXTAREA_PARENT.className = 'handsontableInputHolder'; this.textareaParentStyle = this.TEXTAREA_PARENT.style; this.textareaParentStyle.top = 0; this.textareaParentStyle.left = 0; this.textareaParentStyle.display = 'none'; this.$body = $(document.body); this.TEXTAREA_PARENT.appendChild(this.TEXTAREA); this.instance.rootElement[0].appendChild(this.TEXTAREA_PARENT); var that = this; Handsontable.PluginHooks.add('afterRender', function () { that.instance.registerTimeout('refresh_editor_dimensions', function () { that.refreshDimensions(); }, 0); }); }; HandsontableTextEditorClass.prototype.bindEvents = function () { var that = this; this.$textarea.off('.editor').on('keydown.editor', function (event) { if(that.state === that.STATE_WAITING) { event.stopImmediatePropagation(); } else { that.waitingEvent = null; } if (that.state !== that.STATE_EDITING) { return; } var ctrlDown = (event.ctrlKey || event.metaKey) && !event.altKey; //catch CTRL but not right ALT (which in some systems triggers ALT+CTRL) if (event.keyCode === 17 || event.keyCode === 224 || event.keyCode === 91 || event.keyCode === 93) { //when CTRL or its equivalent is pressed and cell is edited, don't prepare selectable text in textarea event.stopImmediatePropagation(); return; } switch (event.keyCode) { case 38: /* arrow up */ that.finishEditing(false); break; case 40: /* arrow down */ that.finishEditing(false); break; case 9: /* tab */ that.finishEditing(false); event.preventDefault(); break; case 39: /* arrow right */ if (that.getCaretPosition(that.TEXTAREA) === that.TEXTAREA.value.length) { that.finishEditing(false); } else { event.stopImmediatePropagation(); } break; case 37: /* arrow left */ if (that.getCaretPosition(that.TEXTAREA) === 0) { that.finishEditing(false); } else { event.stopImmediatePropagation(); } break; case 27: /* ESC */ that.instance.destroyEditor(true); event.stopImmediatePropagation(); break; case 13: /* return/enter */ var selected = that.instance.getSelected(); var isMultipleSelection = !(selected[0] === selected[2] && selected[1] === selected[3]); if ((event.ctrlKey && !isMultipleSelection) || event.altKey) { //if ctrl+enter or alt+enter, add new line that.TEXTAREA.value = that.TEXTAREA.value + '\n'; that.TEXTAREA.focus(); event.stopImmediatePropagation(); } else { that.finishEditing(false, ctrlDown); } event.preventDefault(); //don't add newline to field break; default: event.stopImmediatePropagation(); //backspace, delete, home, end, CTRL+A, CTRL+C, CTRL+V, CTRL+X should only work locally when cell is edited (not in table context) break; } if (that.state !== that.STATE_FINISHED && !event.isImmediatePropagationStopped()) { that.waitingEvent = event; event.stopImmediatePropagation(); event.preventDefault(); } }); }; HandsontableTextEditorClass.prototype.bindTemporaryEvents = function (td, row, col, prop, value, cellProperties) { var that = this; this.state = this.STATE_VIRGIN; function onDblClick() { that.TEXTAREA.value = that.originalValue; that.instance.destroyEditor(); that.beginEditing(row, col, prop, true); } this.instance.view.wt.update('onCellDblClick', onDblClick); this.TD = td; this.row = row; this.col = col; this.prop = prop; this.originalValue = value; this.cellProperties = cellProperties; this.beforeKeyDownHook = function beforeKeyDownHook (event) { if (that.state !== that.STATE_VIRGIN) { return; } var ctrlDown = (event.ctrlKey || event.metaKey) && !event.altKey; //catch CTRL but not right ALT (which in some systems triggers ALT+CTRL) if (Handsontable.helper.isPrintableChar(event.keyCode)) { //here we are whitelisting all possible printable chars that can open the editor. //in future, if there are some problems to find out if a char is printable, it would be better to invert this //check (blacklist of non-printable chars should be shorter than whitelist of printable chars) if (!ctrlDown) { //disregard CTRL-key shortcuts that.beginEditing(row, col, prop); event.stopImmediatePropagation(); } } else if (event.keyCode === 113) { //f2 that.beginEditing(row, col, prop, true); //show edit field event.stopImmediatePropagation(); event.preventDefault(); //prevent Opera from opening Go to Page dialog } else if (event.keyCode === 13 && that.instance.getSettings().enterBeginsEditing) { //enter var selected = that.instance.getSelected(); var isMultipleSelection = !(selected[0] === selected[2] && selected[1] === selected[3]); if ((ctrlDown && !isMultipleSelection) || event.altKey) { //if ctrl+enter or alt+enter, add new line that.beginEditing(row, col, prop, true, '\n'); //show edit field } else { that.beginEditing(row, col, prop, true); //show edit field } event.preventDefault(); //prevent new line at the end of textarea event.stopImmediatePropagation(); } else if ([8, 9, 33, 34, 35, 36, 37, 38, 39, 40, 46].indexOf(event.keyCode) == -1){ // other non printable character that.instance.addHookOnce('beforeKeyDown', beforeKeyDownHook); } }; that.instance.addHookOnce('beforeKeyDown', this.beforeKeyDownHook); }; HandsontableTextEditorClass.prototype.unbindTemporaryEvents = function () { this.instance.removeHook('beforeKeyDown', this.beforeKeyDownHook); this.instance.view.wt.update('onCellDblClick', null); }; /** * Returns caret position in edit proxy * @author http://stackoverflow.com/questions/263743/how-to-get-caret-position-in-textarea * @return {Number} */ HandsontableTextEditorClass.prototype.getCaretPosition = function (el) { if (el.selectionStart) { return el.selectionStart; } else if (document.selection) { //IE8 el.focus(); var r = document.selection.createRange(); if (r == null) { return 0; } var re = el.createTextRange(), rc = re.duplicate(); re.moveToBookmark(r.getBookmark()); rc.setEndPoint('EndToStart', re); return rc.text.length; } return 0; }; /** * Sets caret position in edit proxy * @author http://blog.vishalon.net/index.php/javascript-getting-and-setting-caret-position-in-textarea/ * @param {Element} el * @param {Number} pos */ HandsontableTextEditorClass.prototype.setCaretPosition = function (el, pos) { if (el.setSelectionRange) { el.focus(); el.setSelectionRange(pos, pos); } else if (el.createTextRange) { //IE8 var range = el.createTextRange(); range.collapse(true); range.moveEnd('character', pos); range.moveStart('character', pos); range.select(); } }; HandsontableTextEditorClass.prototype.beginEditing = function (row, col, prop, useOriginalValue, suffix) { if (this.state !== this.STATE_VIRGIN) { return; } this.state = this.STATE_EDITING; this.row = row; this.col = col; this.prop = prop; this.$textarea.on('cut.editor', function (event) { event.stopPropagation(); }); this.$textarea.on('paste.editor', function (event) { event.stopPropagation(); }); if (useOriginalValue) { this.TEXTAREA.value = Handsontable.helper.stringify(this.originalValue) + (suffix || ''); } else { this.TEXTAREA.value = ''; } this.refreshDimensions(); //need it instantly, to prevent https://github.com/warpech/jquery-handsontable/issues/348 this.TEXTAREA.focus(); this.setCaretPosition(this.TEXTAREA, this.TEXTAREA.value.length); var coords = {row: row, col: col}; this.instance.view.scrollViewport(coords); this.instance.view.render(); }; HandsontableTextEditorClass.prototype.refreshDimensions = function () { if (this.state !== this.STATE_EDITING) { return; } ///start prepare textarea position this.TD = this.instance.getCell(this.row, this.col); var $td = $(this.TD); //because old td may have been scrolled out with scrollViewport var currentOffset = this.wtDom.offset(this.TD); var containerOffset = this.wtDom.offset(this.instance.rootElement[0]); var scrollTop = this.instance.rootElement.scrollTop(); var scrollLeft = this.instance.rootElement.scrollLeft(); var editTop = currentOffset.top - containerOffset.top + scrollTop - 1; var editLeft = currentOffset.left - containerOffset.left + scrollLeft - 1; var settings = this.instance.getSettings(); var rowHeadersCount = settings.rowHeaders === false ? 0 : 1; var colHeadersCount = settings.colHeaders === false ? 0 : 1; if (editTop < 0) { editTop = 0; } if (editLeft < 0) { editLeft = 0; } if (rowHeadersCount > 0 && parseInt($td.css('border-top-width'), 10) > 0) { editTop += 1; } if (colHeadersCount > 0 && parseInt($td.css('border-left-width'), 10) > 0) { editLeft += 1; } if ($.browser.msie && parseInt($.browser.version, 10) <= 7) { editTop -= 1; } this.textareaParentStyle.top = editTop + 'px'; this.textareaParentStyle.left = editLeft + 'px'; ///end prepare textarea position var width = $td.width() , maxWidth = this.instance.view.maximumVisibleElementWidth(editLeft) - 10 //10 is TEXTAREAs border and padding , height = $td.outerHeight() - 4 , maxHeight = this.instance.view.maximumVisibleElementHeight(editTop) - 5; //10 is TEXTAREAs border and padding if (parseInt($td.css('border-top-width'), 10) > 0) { height -= 1; } if (parseInt($td.css('border-left-width'), 10) > 0) { if (rowHeadersCount > 0) { width -= 1; } } //in future may change to pure JS http://stackoverflow.com/questions/454202/creating-a-textarea-with-auto-resize this.$textarea.autoResize({ minHeight: Math.min(height, maxHeight), maxHeight: maxHeight, //TEXTAREA should never be wider than visible part of the viewport (should not cover the scrollbar) minWidth: Math.min(width, maxWidth), maxWidth: maxWidth, //TEXTAREA should never be wider than visible part of the viewport (should not cover the scrollbar) animate: false, extraSpace: 0 }); this.textareaParentStyle.display = 'block'; }; HandsontableTextEditorClass.prototype.saveValue = function (val, ctrlDown) { if (ctrlDown) { //if ctrl+enter and multiple cells selected, behave like Excel (finish editing and apply to all cells) var sel = this.instance.getSelected(); this.instance.populateFromArray(sel[0], sel[1], val, sel[2], sel[3], 'edit'); } else { this.instance.populateFromArray(this.row, this.col, val, null, null, 'edit'); } }; HandsontableTextEditorClass.prototype.finishEditing = function (isCancelled, ctrlDown) { var hasValidator = false; if (this.state == this.STATE_WAITING || this.state == this.STATE_FINISHED) { return; } if (this.state == this.STATE_EDITING) { var val; if (isCancelled) { val = [ [this.originalValue] ]; } else { val = [ [$.trim(this.TEXTAREA.value)] ]; } hasValidator = this.instance.getCellMeta(this.row, this.col).validator; if (hasValidator) { this.state = this.STATE_WAITING; var that = this; this.instance.addHookOnce('afterValidate', function (result) { that.state = that.STATE_FINISHED; that.discardEditor(result); }); } this.saveValue(val, ctrlDown); } if (!hasValidator) { this.state = this.STATE_FINISHED; this.discardEditor(); } }; HandsontableTextEditorClass.prototype.discardEditor = function (result) { if (this.state !== this.STATE_FINISHED) { return; } if (result === false && this.cellProperties.allowInvalid !== true) { //validator was defined and failed this.state = this.STATE_EDITING; if (this.instance.view.wt.wtDom.isVisible(this.TEXTAREA)) { this.TEXTAREA.focus(); this.setCaretPosition(this.TEXTAREA, this.TEXTAREA.value.length); } } else { this.state = this.STATE_FINISHED; if (document.activeElement === this.TEXTAREA) { this.instance.listen(); //don't refocus the table if user focused some cell outside of HT on purpose } this.unbindTemporaryEvents(); this.textareaParentStyle.display = 'none'; if (this.waitingEvent) { //this is needed so when you finish editing with Enter key, the default Enter behavior (move selection down) will work after async validation var ev = $.Event(this.waitingEvent.type); ev.keyCode = this.waitingEvent.keyCode; this.waitingEvent = null; $(document.activeElement).trigger(ev); } } }; /** * Default text editor * @param {Object} instance Handsontable instance * @param {Element} td Table cell where to render * @param {Number} row * @param {Number} col * @param {String|Number} prop Row object property name * @param value Original value (remember to escape unsafe HTML before inserting to DOM!) * @param {Object} cellProperties Cell properites (shared by cell renderer and editor) */ Handsontable.TextEditor = function (instance, td, row, col, prop, value, cellProperties) { if (!instance.textEditor) { instance.textEditor = new HandsontableTextEditorClass(instance); } if (instance.textEditor.state === instance.textEditor.STATE_VIRGIN || instance.textEditor.state === instance.textEditor.STATE_FINISHED) { instance.textEditor.bindTemporaryEvents(td, row, col, prop, value, cellProperties); } return function (isCancelled) { instance.textEditor.finishEditing(isCancelled); } }; function HandsontableAutocompleteEditorClass(instance) { this.instance = instance; this.createElements(); this.bindEvents(); this.emptyStringLabel = '\u00A0\u00A0\u00A0'; //3 non-breaking spaces } Handsontable.helper.inherit(HandsontableAutocompleteEditorClass, HandsontableTextEditorClass); /** * @see HandsontableTextEditorClass.prototype.createElements */ HandsontableAutocompleteEditorClass.prototype.createElements = function () { HandsontableTextEditorClass.prototype.createElements.call(this); this.$textarea.typeahead(); this.typeahead = this.$textarea.data('typeahead'); this.typeahead._render = this.typeahead.render; this.typeahead.minLength = 0; this.typeahead.lookup = function () { var items; this.query = this.$element.val(); items = $.isFunction(this.source) ? this.source(this.query, $.proxy(this.process, this)) : this.source; return items ? this.process(items) : this; }; this.typeahead.matcher = function () { return true; }; var _process = this.typeahead.process; var that = this; this.typeahead.process = function (items) { var cloned = false; for (var i = 0, ilen = items.length; i < ilen; i++) { if (items[i] === '') { //this is needed because because of issue #254 //empty string ('') is a falsy value and breaks the loop in bootstrap-typeahead.js method `sorter` //best solution would be to change line: `while (item = items.shift()) {` // to: `while ((item = items.shift()) !== void 0) {` if (!cloned) { //need to clone items before applying emptyStringLabel //(otherwise validateChanges fails for empty string) items = $.extend([], items); cloned = true; } items[i] = that.emptyStringLabel; } } return _process.call(this, items); }; }; /** * @see HandsontableTextEditorClass.prototype.bindEvents */ HandsontableAutocompleteEditorClass.prototype.bindEvents = function () { var that = this; this.$textarea.off('keydown').off('keyup').off('keypress'); //unlisten this.$textarea.off('.acEditor').on('keydown.acEditor', function (event) { switch (event.keyCode) { case 38: /* arrow up */ that.typeahead.prev(); event.stopImmediatePropagation(); //stops TextEditor and core onKeyDown handler break; case 40: /* arrow down */ that.typeahead.next(); event.stopImmediatePropagation(); //stops TextEditor and core onKeyDown handler break; case 13: /* enter */ event.preventDefault(); break; } }); this.$textarea.on('keyup.acEditor', function (event) { if (Handsontable.helper.isPrintableChar(event.keyCode) || event.keyCode === 113 || event.keyCode === 13 || event.keyCode === 8 || event.keyCode === 46) { that.typeahead.lookup(); } }); HandsontableTextEditorClass.prototype.bindEvents.call(this); }; /** * @see HandsontableTextEditorClass.prototype.bindTemporaryEvents */ HandsontableAutocompleteEditorClass.prototype.bindTemporaryEvents = function (td, row, col, prop, value, cellProperties) { var that = this , i , j; this.typeahead.select = function () { var output = this.hide(); //need to hide it before destroyEditor, because destroyEditor checks if menu is expanded var active = this.$menu[0].querySelector('.active'); var val = active.getAttribute('data-value'); if (val === that.emptyStringLabel) { val = ''; } if (typeof cellProperties.onSelect === 'function') { cellProperties.onSelect(row, col, prop, val, that.instance.view.wt.wtDom.index(active)); } else { that.TEXTAREA.value = val; } that.finishEditing(); return output; }; this.typeahead.render = function (items) { that.typeahead._render.call(this, items); if (!cellProperties.strict) { var li = this.$menu[0].querySelector('.active'); if (li) { that.instance.view.wt.wtDom.removeClass(li, 'active') } } return this; }; /* overwrite typeahead options and methods (matcher, sorter, highlighter, updater, etc) if provided in cellProperties */ for (i in cellProperties) { // if (cellProperties.hasOwnProperty(i)) { if (i === 'options') { for (j in cellProperties.options) { // if (cellProperties.options.hasOwnProperty(j)) { this.typeahead.options[j] = cellProperties.options[j]; // } } } else { this.typeahead[i] = cellProperties[i]; } // } } HandsontableTextEditorClass.prototype.bindTemporaryEvents.call(this, td, row, col, prop, value, cellProperties); function onDblClick() { that.beginEditing(row, col, prop, true); that.instance.registerTimeout('IE9_align_fix', function () { //otherwise is misaligned in IE9 that.typeahead.lookup(); }, 1); } this.instance.view.wt.update('onCellDblClick', onDblClick); }; /** * @see HandsontableTextEditorClass.prototype.finishEditing */ HandsontableAutocompleteEditorClass.prototype.finishEditing = function (isCancelled, ctrlDown) { if (!isCancelled) { if (this.isMenuExpanded()) { if(this.typeahead.$menu[0].querySelector('.active')){ this.typeahead.select(); this.state = this.STATE_FINISHED; } else if (this.cellProperties.strict) { this.state = this.STATE_FINISHED; } } } HandsontableTextEditorClass.prototype.finishEditing.call(this, isCancelled, ctrlDown); }; HandsontableAutocompleteEditorClass.prototype.isMenuExpanded = function () { if (this.instance.view.wt.wtDom.isVisible(this.typeahead.$menu[0])) { return this.typeahead; } else { return false; } }; /** * Autocomplete editor * @param {Object} instance Handsontable instance * @param {Element} td Table cell where to render * @param {Number} row * @param {Number} col * @param {String|Number} prop Row object property name * @param value Original value (remember to escape unsafe HTML before inserting to DOM!) * @param {Object} cellProperties Cell properites (shared by cell renderer and editor) */ Handsontable.AutocompleteEditor = function (instance, td, row, col, prop, value, cellProperties) { if (!instance.autocompleteEditor) { instance.autocompleteEditor = new HandsontableAutocompleteEditorClass(instance); } instance.autocompleteEditor.bindTemporaryEvents(td, row, col, prop, value, cellProperties); return function () { var isCancelled = true; instance.autocompleteEditor.finishEditing(isCancelled); } }; function toggleCheckboxCell(instance, row, prop, cellProperties) { if (Handsontable.helper.stringify(instance.getDataAtRowProp(row, prop)) === Handsontable.helper.stringify(cellProperties.checkedTemplate)) { instance.setDataAtRowProp(row, prop, cellProperties.uncheckedTemplate); } else { instance.setDataAtRowProp(row, prop, cellProperties.checkedTemplate); } } /** * Checkbox editor * @param {Object} instance Handsontable instance * @param {Element} td Table cell where to render * @param {Number} row * @param {Number} col * @param {String|Number} prop Row object property name * @param value Original value (remember to escape unsafe HTML before inserting to DOM!) * @param {Object} cellProperties Cell properites (shared by cell renderer and editor) */ Handsontable.CheckboxEditor = function (instance, td, row, col, prop, value, cellProperties) { if (typeof cellProperties === "undefined") { cellProperties = {}; } if (typeof cellProperties.checkedTemplate === "undefined") { cellProperties.checkedTemplate = true; } if (typeof cellProperties.uncheckedTemplate === "undefined") { cellProperties.uncheckedTemplate = false; } instance.$table.on("keydown.editor", function (event) { var ctrlDown = (event.ctrlKey || event.metaKey) && !event.altKey; //catch CTRL but not right ALT (which in some systems triggers ALT+CTRL) if (!ctrlDown && Handsontable.helper.isPrintableChar(event.keyCode)) { toggleCheckboxCell(instance, row, prop, cellProperties); event.stopImmediatePropagation(); //stops core onKeyDown handler event.preventDefault(); //some keys have special behavior, eg. space bar scrolls screen down } }); instance.view.wt.update('onCellDblClick', function () { toggleCheckboxCell(instance, row, prop, cellProperties); }); return function () { instance.$table.off(".editor"); instance.view.wt.update('onCellDblClick', null); } }; function HandsontableDateEditorClass(instance) { if (!$.datepicker) { throw new Error("jQuery UI Datepicker dependency not found. Did you forget to include jquery-ui.custom.js or its substitute?"); } this.isCellEdited = false; this.instance = instance; this.createElements(); this.bindEvents(); } Handsontable.helper.inherit(HandsontableDateEditorClass, HandsontableTextEditorClass); /** * @see HandsontableTextEditorClass.prototype.createElements */ HandsontableDateEditorClass.prototype.createElements = function () { HandsontableTextEditorClass.prototype.createElements.call(this); this.datePicker = document.createElement('DIV'); this.datePickerStyle = this.datePicker.style; this.datePickerStyle.position = 'absolute'; this.datePickerStyle.top = 0; this.datePickerStyle.left = 0; this.datePickerStyle.zIndex = 99; document.body.appendChild(this.datePicker); this.$datePicker = $(this.datePicker); var that = this; var defaultOptions = { dateFormat: "yy-mm-dd", showButtonPanel: true, changeMonth: true, changeYear: true, altField: this.$textarea, onSelect: function () { that.finishEditing(false); } }; this.$datePicker.datepicker(defaultOptions); this.hideDatepicker(); }; /** * @see HandsontableTextEditorClass.prototype.beginEditing */ HandsontableDateEditorClass.prototype.beginEditing = function (row, col, prop, useOriginalValue, suffix) { HandsontableTextEditorClass.prototype.beginEditing.call(this, row, col, prop, useOriginalValue, suffix); this.showDatepicker(); }; /** * @see HandsontableTextEditorClass.prototype.finishEditing */ HandsontableDateEditorClass.prototype.finishEditing = function (isCancelled, ctrlDown) { this.hideDatepicker(); HandsontableTextEditorClass.prototype.finishEditing.call(this, isCancelled, ctrlDown); }; HandsontableDateEditorClass.prototype.showDatepicker = function () { var $td = $(this.instance.dateEditor.TD); var offset = $td.offset(); this.datePickerStyle.top = (offset.top + $td.height()) + 'px'; this.datePickerStyle.left = offset.left + 'px'; var dateOptions = { defaultDate: this.originalValue || void 0 }; $.extend(dateOptions, this.cellProperties); this.$datePicker.datepicker("option", dateOptions); if (this.originalValue) { this.$datePicker.datepicker("setDate", this.originalValue); } this.datePickerStyle.display = 'block'; }; HandsontableDateEditorClass.prototype.hideDatepicker = function () { this.datePickerStyle.display = 'none'; }; /** * Date editor (uses jQuery UI Datepicker) * @param {Object} instance Handsontable instance * @param {Element} td Table cell where to render * @param {Number} row * @param {Number} col * @param {String|Number} prop Row object property name * @param value Original value (remember to escape unsafe HTML before inserting to DOM!) * @param {Object} cellProperties Cell properites (shared by cell renderer and editor) */ Handsontable.DateEditor = function (instance, td, row, col, prop, value, cellProperties) { if (!instance.dateEditor) { instance.dateEditor = new HandsontableDateEditorClass(instance); } instance.dateEditor.bindTemporaryEvents(td, row, col, prop, value, cellProperties); return function (isCancelled) { instance.dateEditor.finishEditing(isCancelled); } }; /** * This is inception. Using Handsontable as Handsontable editor */ function HandsontableHandsontableEditorClass(instance) { this.instance = instance; this.createElements(); this.bindEvents(); } Handsontable.helper.inherit(HandsontableHandsontableEditorClass, HandsontableTextEditorClass); HandsontableHandsontableEditorClass.prototype.createElements = function () { HandsontableTextEditorClass.prototype.createElements.call(this); var DIV = document.createElement('DIV'); DIV.className = 'handsontableEditor'; this.TEXTAREA_PARENT.appendChild(DIV); this.$htContainer = $(DIV); }; HandsontableHandsontableEditorClass.prototype.bindTemporaryEvents = function (td, row, col, prop, value, cellProperties) { var parent = this; var options = { colHeaders: true, cells: function () { return { readOnly: true } }, fillHandle: false, width: 2000, //width: 'auto', afterOnCellMouseDown: function () { var sel = this.getSelected(); parent.TEXTAREA.value = this.getDataAtCell(sel[0], sel[1]); parent.instance.destroyEditor(); }, beforeOnKeyDown: function (event) { switch (event.keyCode) { case 27: //esc parent.instance.destroyEditor(true); break; case 13: //enter var sel = this.getSelected(); parent.TEXTAREA.value = this.getDataAtCell(sel[0], sel[1]); parent.instance.destroyEditor(); break; } } }; if (cellProperties.handsontable) { options = $.extend(options, cellProperties.handsontable); } this.$htContainer.handsontable(options); HandsontableTextEditorClass.prototype.bindTemporaryEvents.call(this, td, row, col, prop, value, cellProperties); }; HandsontableHandsontableEditorClass.prototype.beginEditing = function (row, col, prop, useOriginalValue, suffix) { var onBeginEditing = this.instance.getSettings().onBeginEditing; if (onBeginEditing && onBeginEditing() === false) { return; } HandsontableTextEditorClass.prototype.beginEditing.call(this, row, col, prop, useOriginalValue, suffix); this.$htContainer.handsontable('render'); this.$htContainer.handsontable('selectCell', 0, 0); }; HandsontableHandsontableEditorClass.prototype.finishEditing = function (isCancelled, ctrlDown) { if (this.$htContainer.handsontable('isListening')) { //if focus is still in the HOT editor this.instance.listen(); //return the focus to the parent HOT instance } this.$htContainer.handsontable('destroy'); HandsontableTextEditorClass.prototype.finishEditing.call(this, isCancelled, ctrlDown); }; /** * Handsontable editor * @param {Object} instance Handsontable instance * @param {Element} td Table cell where to render * @param {Number} row * @param {Number} col * @param {String|Number} prop Row object property name * @param value Original value (remember to escape unsafe HTML before inserting to DOM!) * @param {Object} cellProperties Cell properites (shared by cell renderer and editor) */ Handsontable.HandsontableEditor = function (instance, td, row, col, prop, value, cellProperties) { if (!instance.handsontableEditor) { instance.handsontableEditor = new HandsontableHandsontableEditorClass(instance); } instance.handsontableEditor.bindTemporaryEvents(td, row, col, prop, value, cellProperties); instance.registerEditor = instance.handsontableEditor; return function (isCancelled) { instance.handsontableEditor.finishEditing(isCancelled); } }; /** * Numeric cell validator * @param {*} value - Value of edited cell * @param {*} calback - Callback called with validation result */ Handsontable.NumericValidator = function (value, callback) { callback(/^-?\d*\.?\d*$/.test(value)); } /** * Function responsible for validation of autocomplete value * @param {*} value - Value of edited cell * @param {*} calback - Callback called with validation result */ var process = function (value, callback) { var originalVal = value; var lowercaseVal = typeof originalVal === 'string' ? originalVal.toLowerCase() : null; return function (source) { var found = false; for (var s = 0, slen = source.length; s < slen; s++) { if (originalVal === source[s]) { found = true; //perfect match break; } else if (lowercaseVal === source[s].toLowerCase()) { // changes[i][3] = source[s]; //good match, fix the case << TODO? found = true; break; } } callback(found); } }; /** * Autocomplete cell validator * @param {*} value - Value of edited cell * @param {*} calback - Callback called with validation result */ Handsontable.AutocompleteValidator = function (value, callback) { if (this.strict && this.source) { $.isFunction(this.source) ? this.source(value, process(value, callback)) : process(value, callback)(this.source); } else { callback(true); } } /** * Cell type is just a shortcut for setting bunch of cellProperties (used in getCellMeta) */ Handsontable.AutocompleteCell = { editor: Handsontable.AutocompleteEditor, renderer: Handsontable.AutocompleteRenderer, validator: Handsontable.AutocompleteValidator }; Handsontable.CheckboxCell = { editor: Handsontable.CheckboxEditor, renderer: Handsontable.CheckboxRenderer }; Handsontable.TextCell = { editor: Handsontable.TextEditor, renderer: Handsontable.TextRenderer }; Handsontable.NumericCell = { editor: Handsontable.TextEditor, renderer: Handsontable.NumericRenderer, validator: Handsontable.NumericValidator, dataType: 'number' }; Handsontable.DateCell = { editor: Handsontable.DateEditor, renderer: Handsontable.AutocompleteRenderer //displays small gray arrow on right side of the cell }; Handsontable.HandsontableCell = { editor: Handsontable.HandsontableEditor, renderer: Handsontable.AutocompleteRenderer //displays small gray arrow on right side of the cell }; //here setup the friendly aliases that are used by cellProperties.type Handsontable.cellTypes = { text: Handsontable.TextCell, date: Handsontable.DateCell, numeric: Handsontable.NumericCell, checkbox: Handsontable.CheckboxCell, autocomplete: Handsontable.AutocompleteCell, handsontable: Handsontable.HandsontableCell }; //here setup the friendly aliases that are used by cellProperties.renderer and cellProperties.editor Handsontable.cellLookup = { renderer: { text: Handsontable.TextRenderer, numeric: Handsontable.NumericRenderer, checkbox: Handsontable.CheckboxRenderer, autocomplete: Handsontable.AutocompleteRenderer }, editor: { text: Handsontable.TextEditor, date: Handsontable.DateEditor, checkbox: Handsontable.CheckboxEditor, autocomplete: Handsontable.AutocompleteEditor, handsontable: Handsontable.HandsontableEditor }, validator: { numeric: Handsontable.NumericValidator, autocomplete: Handsontable.AutocompleteValidator } }; Handsontable.PluginHookClass = (function () { var Hooks = function () { return { // Hooks beforeInitWalkontable: [], beforeInit: [], beforeRender: [], beforeChange: [], beforeValidate: [], beforeGet: [], beforeSet: [], beforeGetCellMeta: [], beforeAutofill: [], beforeKeyDown: [], afterInit : [], afterLoadData : [], afterUpdateSettings: [], afterRender : [], afterChange : [], afterValidate: [], afterGetCellMeta: [], afterGetColHeader: [], afterGetColWidth: [], afterDestroy: [], afterRemoveRow: [], afterCreateRow: [], afterRemoveCol: [], afterCreateCol: [], afterColumnResize: [], afterColumnMove: [], afterDeselect: [], afterSelection: [], afterSelectionByProp: [], afterSelectionEnd: [], afterSelectionEndByProp: [], afterCopyLimit: [], // Modifiers modifyCol: [] } }; var legacy = { onBeforeChange: "beforeChange", onChange: "afterChange", onCreateRow: "afterCreateRow", onCreateCol: "afterCreateCol", onSelection: "afterSelection", onCopyLimit: "afterCopyLimit", onSelectionEnd: "afterSelectionEnd", onSelectionByProp: "afterSelectionByProp", onSelectionEndByProp: "afterSelectionEndByProp" }; function PluginHookClass() { this.hooks = { once: Hooks(), persistent: Hooks() }; this.legacy = legacy; } var addHook = function (type) { return function (key, fn) { // provide support for old versions of HOT if (key in legacy) { key = legacy[key]; } if (typeof this.hooks[type][key] === "undefined") { this.hooks[type][key] = []; } if (fn instanceof Array) { for (var i = 0, len = fn.length; i < len; i++) { this.hooks[type][key].push(fn[i]); } } else { this.hooks[type][key].push(fn); } return this; }; }; PluginHookClass.prototype.add = addHook('persistent'); PluginHookClass.prototype.once = addHook('once'); PluginHookClass.prototype.remove = function (key, fn) { var status = false , hookTypes = ['persistent', 'once'] , type, x, lenx, i, leni; // provide support for old versions of HOT if (key in legacy) { key = legacy[key]; } for (x = 0, lenx = hookTypes.length; x < lenx; x++) { type = hookTypes[x]; if (typeof this.hooks[type][key] !== 'undefined') { for (i = 0, leni = this.hooks[type][key].length; i < leni; i++) { if (this.hooks[type][key][i] == fn) { this.hooks[type][key].splice(i, 1); status = true; break; } } } } return status; }; PluginHookClass.prototype.run = function (instance, key, p1, p2, p3, p4, p5) { var hookTypes = ['persistent', 'once'] , type, x, lenx, i, leni; // provide support for old versions of HOT if (key in legacy) { key = legacy[key]; } //performance considerations - http://jsperf.com/call-vs-apply-for-a-plugin-architecture for (x = 0, lenx = hookTypes.length; x < lenx; x++) { type = hookTypes[x]; if (typeof this.hooks[type][key] !== 'undefined') { for (i = 0, leni = this.hooks[type][key].length; i < leni; i++) { this.hooks[type][key][i].call(instance, p1, p2, p3, p4, p5); if (type === 'once') { this.hooks[type][key].splice(i, 1); leni--; i--; } } } } }; PluginHookClass.prototype.execute = function (instance, key, p1, p2, p3, p4, p5) { var hookTypes = ['persistent', 'once'] , type, x, lenx, i, leni, res; // provide support for old versions of HOT if (key in legacy) { key = legacy[key]; } //performance considerations - http://jsperf.com/call-vs-apply-for-a-plugin-architecture for (x = 0, lenx = hookTypes.length; x < lenx; x++) { type = hookTypes[x]; if (typeof this.hooks[type][key] !== 'undefined') { for (i = 0, leni = this.hooks[type][key].length; i < leni; i++) { res = this.hooks[type][key][i].call(instance, p1, p2, p3, p4, p5); if (res !== void 0) { p1 = res; } if (type === 'once') { this.hooks[type][key].splice(i, 1); leni--; i--; } } } } return p1; }; return PluginHookClass; })(); Handsontable.PluginHooks = new Handsontable.PluginHookClass(); (function(Handsontable){ function HandsontableAutoColumnSize() { var plugin = this , sampleCount = 5; //number of samples to take of each value length this.beforeInit = function () { var instance = this; instance.autoColumnWidths = []; if(instance.getSettings().autoColumnSize !== false){ if(!instance.autoColumnSizeTmp){ instance.autoColumnSizeTmp = { thead: null, theadTh: null, theadStyle: null, tbody: null, tbodyTd: null, noRenderer: null, noRendererTd: null, renderer: null, rendererTd: null, container: null, containerStyle: null }; } instance.addHook('beforeRender', htAutoColumnSize.determineColumnsWidth); instance.addHook('afterGetColWidth', htAutoColumnSize.getColWidth); instance.addHook('afterDestroy', htAutoColumnSize.afterDestroy); instance.determineColumnWidth = plugin.determineColumnWidth; } else { instance.removeHook('beforeRender', htAutoColumnSize.determineColumnsWidth); instance.removeHook('afterGetColWidth', htAutoColumnSize.getColWidth); instance.removeHook('afterDestroy', htAutoColumnSize.afterDestroy); delete instance.determineColumnWidth; plugin.afterDestroy.call(instance); } }; this.determineColumnWidth = function (col) { var instance = this , tmp = instance.autoColumnSizeTmp , d; if (!tmp.container) { createTmpContainer.call(tmp, instance); instance.rootElement[0].parentNode.appendChild(tmp.container); } tmp.container.className = instance.rootElement[0].className + ' hidden'; var cls = instance.$table[0].className; tmp.thead.className = cls; tmp.tbody.className = cls; var rows = instance.countRows(); var samples = {}; var maxLen = 0; for (var r = 0; r < rows; r++) { var value = Handsontable.helper.stringify(instance.getDataAtCell(r, col)); var len = value.length; if (len > maxLen) { maxLen = len; } if (!samples[len]) { samples[len] = { needed: sampleCount, strings: [] }; } if (samples[len].needed) { samples[len].strings.push(value); samples[len].needed--; } } var settings = instance.getSettings(); if (settings.colHeaders) { instance.view.appendColHeader(col, tmp.theadTh); //TH innerHTML } var txt = ''; for (var i in samples) { if (samples.hasOwnProperty(i)) { for (var j = 0, jlen = samples[i].strings.length; j < jlen; j++) { txt += samples[i].strings[j] + '<br>'; } } } tmp.tbodyTd.innerHTML = txt; //TD innerHTML instance.view.wt.wtDom.empty(tmp.rendererTd); instance.view.wt.wtDom.empty(tmp.noRendererTd); tmp.containerStyle.display = 'block'; var width = instance.view.wt.wtDom.outerWidth(tmp.container); var cellProperties = instance.getCellMeta(0, col); if (cellProperties.renderer) { var str = instance.getDataAtCell(0, col); tmp.noRendererTd.appendChild(document.createTextNode(str)); var renderer = Handsontable.helper.getCellMethod('renderer', cellProperties.renderer); renderer(instance, tmp.rendererTd, 0, col, instance.colToProp(col), str, cellProperties); width += instance.view.wt.wtDom.outerWidth(tmp.renderer) - instance.view.wt.wtDom.outerWidth(tmp.noRenderer); //add renderer overhead to the calculated width } var maxWidth = instance.view.wt.wtViewport.getViewportWidth() - 2; //2 is some overhead for cell border if (width > maxWidth) { width = maxWidth; } tmp.containerStyle.display = 'none'; return width; }; this.determineColumnsWidth = function () { var instance = this; var settings = this.getSettings(); if (settings.autoColumnSize || !settings.colWidths) { var cols = this.countCols(); for (var c = 0; c < cols; c++) { if (!instance._getColWidthFromSettings(c)) { this.autoColumnWidths[c] = plugin.determineColumnWidth.call(instance, c); } } } }; this.getColWidth = function (col, response) { if (this.autoColumnWidths[col] && this.autoColumnWidths[col] > response.width) { response.width = this.autoColumnWidths[col]; } }; this.afterDestroy = function () { var instance = this; if (instance.autoColumnSizeTmp && instance.autoColumnSizeTmp.container && instance.autoColumnSizeTmp.container.parentNode) { instance.autoColumnSizeTmp.container.parentNode.removeChild(instance.autoColumnSizeTmp.container); } }; function createTmpContainer(instance) { var d = document , tmp = this; tmp.thead = d.createElement('table'); tmp.thead.appendChild(d.createElement('thead')).appendChild(d.createElement('tr')).appendChild(d.createElement('th')); tmp.theadTh = tmp.thead.getElementsByTagName('th')[0]; tmp.theadStyle = tmp.thead.style; tmp.theadStyle.tableLayout = 'auto'; tmp.theadStyle.width = 'auto'; tmp.tbody = tmp.thead.cloneNode(false); tmp.tbody.appendChild(d.createElement('tbody')).appendChild(d.createElement('tr')).appendChild(d.createElement('td')); tmp.tbodyTd = tmp.tbody.getElementsByTagName('td')[0]; tmp.noRenderer = tmp.tbody.cloneNode(true); tmp.noRendererTd = tmp.noRenderer.getElementsByTagName('td')[0]; tmp.renderer = tmp.tbody.cloneNode(true); tmp.rendererTd = tmp.renderer.getElementsByTagName('td')[0]; tmp.container = d.createElement('div'); tmp.container.className = instance.rootElement[0].className + ' hidden'; tmp.containerStyle = tmp.container.style; tmp.container.appendChild(tmp.thead); tmp.container.appendChild(tmp.tbody); tmp.container.appendChild(tmp.noRenderer); tmp.container.appendChild(tmp.renderer); }; } var htAutoColumnSize = new HandsontableAutoColumnSize(); Handsontable.PluginHooks.add('beforeInit', htAutoColumnSize.beforeInit); Handsontable.PluginHooks.add('afterUpdateSettings', htAutoColumnSize.beforeInit); })(Handsontable); /** * This plugin sorts the view by a column (but does not sort the data source!) * @constructor */ function HandsontableColumnSorting() { var plugin = this; var sortingEnabled; this.init = function (source) { var instance = this; var sortingSettings = instance.getSettings().columnSorting; var sortingColumn, sortingOrder; sortingEnabled = !!(sortingSettings); if (sortingEnabled) { instance.sortIndex = []; var loadedSortingState = loadSortingState.call(instance); if (typeof loadedSortingState != 'undefined') { sortingColumn = loadedSortingState.sortColumn; sortingOrder = loadedSortingState.sortOrder; } else { sortingColumn = sortingSettings.column; sortingOrder = sortingSettings.sortOrder; } plugin.sortByColumn.call(instance, sortingColumn, sortingOrder); instance.sort = function(){ var args = Array.prototype.slice.call(arguments); return plugin.sortByColumn.apply(instance, args) } if (source == 'afterInit') { bindColumnSortingAfterClick.call(instance); instance.addHook('afterCreateRow', plugin.afterCreateRow); instance.addHook('afterRemoveRow', plugin.afterRemoveRow); } } else { delete instance.sort; } }; this.setSortingColumn = function (col, order) { var instance = this; if (typeof col == 'undefined') { delete instance.sortColumn; delete instance.sortOrder; return; } else if (instance.sortColumn === col && typeof order == 'undefined') { instance.sortOrder = !instance.sortOrder; } else { instance.sortOrder = typeof order != 'undefined' ? order : true; } instance.sortColumn = col; }; this.sortByColumn = function (col, order) { var instance = this; plugin.setSortingColumn.call(instance, col, order); instance.PluginHooks.run('beforeColumnSort', instance.sortColumn, instance.sortOrder); plugin.sort.call(instance); instance.render(); saveSortingState.call(instance); instance.PluginHooks.run('afterColumnSort', instance.sortColumn, instance.sortOrder); }; var saveSortingState = function () { var instance = this; var sortingState = {}; if (typeof instance.sortColumn != 'undefined') { sortingState.sortColumn = instance.sortColumn; } if (typeof instance.sortOrder != 'undefined') { sortingState.sortOrder = instance.sortOrder; } if (sortingState.hasOwnProperty('sortColumn') || sortingState.hasOwnProperty('sortOrder')) { instance.PluginHooks.run('persistentStateSave', 'columnSorting', sortingState); } }; var loadSortingState = function () { var instance = this; var storedState = {}; instance.PluginHooks.run('persistentStateLoad', 'columnSorting', storedState); return storedState.value; }; var bindColumnSortingAfterClick = function () { var instance = this; instance.rootElement.on('click.handsontable', '.columnSorting', function (e) { if (instance.view.wt.wtDom.hasClass(e.target, 'columnSorting')) { var col = getColumn(e.target); plugin.sortByColumn.call(instance, col); } }); function countRowHeaders() { var THs = instance.view.TBODY.querySelector('tr').querySelectorAll('th'); return THs.length; } function getColumn(target) { var TH = instance.view.wt.wtDom.closest(target, 'TH'); return instance.view.wt.wtDom.index(TH) - countRowHeaders(); } }; function defaultSort(sortOrder) { return function (a, b) { if (a[1] === b[1]) { return 0; } if (a[1] === null) { return 1; } if (b[1] === null) { return -1; } if (a[1] < b[1]) return sortOrder ? -1 : 1; if (a[1] > b[1]) return sortOrder ? 1 : -1; return 0; } } function dateSort(sortOrder) { return function (a, b) { if (a[1] === b[1]) { return 0; } if (a[1] === null) { return 1; } if (b[1] === null) { return -1; } var aDate = new Date(a[1]); var bDate = new Date(b[1]); if (aDate < bDate) return sortOrder ? -1 : 1; if (aDate > bDate) return sortOrder ? 1 : -1; return 0; } } this.sort = function () { var instance = this; if (typeof instance.sortOrder == 'undefined') { return; } sortingEnabled = false; //this is required by translateRow plugin hook instance.sortIndex.length = 0; var colOffset = this.colOffset(); for (var i = 0, ilen = this.countRows() - instance.getSettings()['minSpareRows']; i < ilen; i++) { this.sortIndex.push([i, instance.getDataAtCell(i, this.sortColumn + colOffset)]); } var colMeta = instance.getCellMeta(0, instance.sortColumn); var sortFunction; switch (colMeta.type) { case 'date': sortFunction = dateSort; break; default: sortFunction = defaultSort; } this.sortIndex.sort(sortFunction(instance.sortOrder)); //Append spareRows for(var i = this.sortIndex.length; i < instance.countRows(); i++){ this.sortIndex.push([i, instance.getDataAtCell(i, this.sortColumn + colOffset)]); } sortingEnabled = true; //this is required by translateRow plugin hook }; this.translateRow = function (row) { if (sortingEnabled && this.sortIndex && this.sortIndex.length) { return this.sortIndex[row][0]; } return row; }; this.onBeforeGetSet = function (getVars) { var instance = this; getVars.row = plugin.translateRow.call(instance, getVars.row); }; this.untranslateRow = function (row) { if (sortingEnabled && this.sortIndex && this.sortIndex.length) { for (var i = 0; i < this.sortIndex.length; i++) { if (this.sortIndex[i][0] == row) { return i; } } } }; this.getColHeader = function (col, TH) { if (this.getSettings().columnSorting) { this.view.wt.wtDom.addClass(TH.querySelector('.colHeader'), 'columnSorting'); } }; function isSorted(instance){ return typeof instance.sortColumn != 'undefined'; } this.afterCreateRow = function(index, amount){ var instance = this; if(!isSorted(instance)){ return; } instance.sortIndex.splice(index, 0, [index, instance.getData()[index][this.sortColumn + instance.colOffset()]]); for(var i = 0; i < instance.sortIndex.length; i++){ if(i == index) continue; if (instance.sortIndex[i][0] >= index){ instance.sortIndex[i][0] += 1; } } saveSortingState.call(instance); }; this.afterRemoveRow = function(index, amount){ var instance = this; if(!isSorted(instance)){ return; } instance.sortIndex.splice(index, amount); for(var i = 0; i < instance.sortIndex.length; i++){ if (instance.sortIndex[i][0] > index){ instance.sortIndex[i][0] -= amount; } } saveSortingState.call(instance); }; this.afterChangeSort = function (changes/*, source*/) { var instance = this; var sortColumnChanged = false; var selection = {}; if (!changes) { return; } for (var i = 0; i < changes.length; i++) { if (changes[i][1] == instance.sortColumn) { sortColumnChanged = true; selection.row = plugin.translateRow.call(instance, changes[i][0]); selection.col = changes[i][1]; break; } } if (sortColumnChanged) { setTimeout(function () { plugin.sort.call(instance); instance.render(); instance.selectCell(plugin.untranslateRow.call(instance, selection.row), selection.col); }, 0); } }; } var htSortColumn = new HandsontableColumnSorting(); Handsontable.PluginHooks.add('afterInit', function () { htSortColumn.init.call(this, 'afterInit') }); Handsontable.PluginHooks.add('afterUpdateSettings', function () { htSortColumn.init.call(this, 'afterUpdateSettings') }); Handsontable.PluginHooks.add('beforeGet', htSortColumn.onBeforeGetSet); Handsontable.PluginHooks.add('beforeSet', htSortColumn.onBeforeGetSet); Handsontable.PluginHooks.add('afterGetColHeader', htSortColumn.getColHeader); (function(Handsontable){ function init(){ var instance = this; var pluginEnabled = !!(instance.getSettings().contextMenu); if(pluginEnabled){ createContextMenu.call(instance); } else { destroyContextMenu.call(instance); } } function createContextMenu() { var instance = this , selectorId = instance.rootElement[0].id , allItems = { "row_above": {name: "Insert row above", disabled: isDisabled}, "row_below": {name: "Insert row below", disabled: isDisabled}, "hsep1": "---------", "col_left": {name: "Insert column on the left", disabled: isDisabled}, "col_right": {name: "Insert column on the right", disabled: isDisabled}, "hsep2": "---------", "remove_row": {name: "Remove row", disabled: isDisabled}, "remove_col": {name: "Remove column", disabled: isDisabled}, "hsep3": "---------", "undo": {name: "Undo", disabled: function () { return !instance.isUndoAvailable(); }}, "redo": {name: "Redo", disabled: function () { return !instance.isRedoAvailable(); }} } , defaultOptions = { selector : "#" + selectorId + ' table, #' + selectorId + ' div', trigger : 'right', callback : onContextClick } , options = {} , i , ilen , settings = instance.getSettings(); function onContextClick(key) { var corners = instance.getSelected(); //[selection start row, selection start col, selection end row, selection end col] if (!corners) { return; //needed when there are 2 grids on a page } /** * `selection` variable contains normalized selection coordinates. * selection.start - top left corner of selection area * selection.end - bottom right corner of selection area */ var selection = { start: new Handsontable.SelectionPoint(), end: new Handsontable.SelectionPoint() }; selection.start.row(Math.min(corners[0], corners[2])); selection.start.col(Math.min(corners[1], corners[3])); selection.end.row(Math.max(corners[0], corners[2])); selection.end.col(Math.max(corners[1], corners[3])); switch (key) { case "row_above": instance.alter("insert_row", selection.start.row()); break; case "row_below": instance.alter("insert_row", selection.end.row() + 1); break; case "col_left": instance.alter("insert_col", selection.start.col()); break; case "col_right": instance.alter("insert_col", selection.end.col() + 1); break; case "remove_row": instance.alter(key, selection.start.row(), (selection.end.row() - selection.start.row()) + 1); break; case "remove_col": instance.alter(key, selection.start.col(), (selection.end.col() - selection.start.col()) + 1); break; case "undo": instance.undo(); break; case "redo": instance.redo(); break; } } function isDisabled(key) { //TODO rewrite /*if (instance.blockedCols.main.find('th.htRowHeader.active').length && (key === "remove_col" || key === "col_left" || key === "col_right")) { return true; } else if (instance.blockedRows.main.find('th.htColHeader.active').length && (key === "remove_row" || key === "row_above" || key === "row_below")) { return true; } else*/ if (instance.countRows() >= instance.getSettings().maxRows && (key === "row_above" || key === "row_below")) { return true; } else if (instance.countCols() >= instance.getSettings().maxCols && (key === "col_left" || key === "col_right")) { return true; } else { return false; } } if (settings.contextMenu === true) { //contextMenu is true options.items = allItems; } else if (Object.prototype.toString.apply(settings.contextMenu) === '[object Array]') { //contextMenu is an array options.items = {}; for (i = 0, ilen = settings.contextMenu.length; i < ilen; i++) { var key = settings.contextMenu[i]; if (typeof allItems[key] === 'undefined') { throw new Error('Context menu key "' + key + '" is not recognised'); } options.items[key] = allItems[key]; } } else if (Object.prototype.toString.apply(settings.contextMenu) === '[object Object]') { //contextMenu is an options object as defined in http://medialize.github.com/jQuery-contextMenu/docs.html options = settings.contextMenu; if (options.items) { for (i in options.items) { if (options.items.hasOwnProperty(i) && allItems[i]) { if (typeof options.items[i] === 'string') { options.items[i] = allItems[i]; } else { options.items[i] = $.extend(true, allItems[i], options.items[i]); } } } } else { options.items = allItems; } if (options.callback) { var handsontableCallback = defaultOptions.callback; var customCallback = options.callback; options.callback = function (key, options) { handsontableCallback(key, options); customCallback(key, options); } } } if (!selectorId) { throw new Error("Handsontable container must have an id"); } $.contextMenu($.extend(true, defaultOptions, options)); } function destroyContextMenu() { var id = this.rootElement[0].id; $.contextMenu('destroy', "#" + id + ' table, #' + id + ' div'); } Handsontable.PluginHooks.add('afterInit', init); Handsontable.PluginHooks.add('afterUpdateSettings', init); Handsontable.PluginHooks.add('afterDestroy', destroyContextMenu); })(Handsontable); /** * This plugin adds support for legacy features, deprecated APIs, etc. */ /** * Support for old autocomplete syntax * For old syntax, see: https://github.com/warpech/jquery-handsontable/blob/8c9e701d090ea4620fe08b6a1a048672fadf6c7e/README.md#defining-autocomplete */ Handsontable.PluginHooks.add('beforeGetCellMeta', function (row, col, cellProperties) { var settings = this.getSettings(), data = this.getData(), i, ilen, a; //isWritable - deprecated since 0.8.0 cellProperties.isWritable = !cellProperties.readOnly; //autocomplete - deprecated since 0.7.1 (see CHANGELOG.md) if (settings.autoComplete) { for (i = 0, ilen = settings.autoComplete.length; i < ilen; i++) { if (settings.autoComplete[i].match(row, col, data)) { if (typeof cellProperties.type === 'undefined') { cellProperties.type = Handsontable.AutocompleteCell; } else { if (typeof cellProperties.type.renderer === 'undefined') { cellProperties.type.renderer = Handsontable.AutocompleteCell.renderer; } if (typeof cellProperties.type.editor === 'undefined') { cellProperties.type.editor = Handsontable.AutocompleteCell.editor; } } for (a in settings.autoComplete[i]) { if (settings.autoComplete[i].hasOwnProperty(a) && a !== 'match' && typeof cellProperties[i] === 'undefined') { if (a === 'source') { cellProperties[a] = settings.autoComplete[i][a](row, col); } else { cellProperties[a] = settings.autoComplete[i][a]; } } } break; } } } }); function HandsontableManualColumnMove() { var instance , pressed , startCol , endCol , startX , startOffset; var ghost = document.createElement('DIV') , ghostStyle = ghost.style; ghost.className = 'ghost'; ghostStyle.position = 'absolute'; ghostStyle.top = '25px'; ghostStyle.left = 0; ghostStyle.width = '10px'; ghostStyle.height = '10px'; ghostStyle.backgroundColor = '#CCC'; ghostStyle.opacity = 0.7; var saveManualColumnPositions = function () { var instance = this; instance.PluginHooks.run('persistentStateSave', 'manualColumnPositions', instance.manualColumnPositions); }; var loadManualColumnPositions = function () { var instance = this; var storedState = {}; instance.PluginHooks.run('persistentStateLoad', 'manualColumnPositions', storedState); return storedState.value; }; var bindMoveColEvents = function () { var instance = this; $(document).on('mousemove.' + instance.guid, function (e) { if (pressed) { ghostStyle.left = startOffset + e.pageX - startX + 6 + 'px'; if (ghostStyle.display === 'none') { ghostStyle.display = 'block'; } } }); $(document).on('mouseup.' + instance.guid, function () { if (pressed) { if (startCol < endCol) { endCol--; } if (instance.getSettings().rowHeaders) { startCol--; endCol--; } instance.manualColumnPositions.splice(endCol, 0, instance.manualColumnPositions.splice(startCol, 1)[0]); $('.manualColumnMover.active').removeClass('active'); pressed = false; instance.forceFullRender = true; instance.view.render(); //updates all ghostStyle.display = 'none'; saveManualColumnPositions.call(instance); instance.PluginHooks.run('afterColumnMove', startCol, endCol); } }); this.rootElement.on('mousedown.' + instance.guid, '.manualColumnMover', function (e) { var mover = e.currentTarget; var TH = instance.view.wt.wtDom.closest(mover, 'TH'); startCol = instance.view.wt.wtDom.index(TH) + instance.colOffset(); pressed = true; startX = e.pageX; var TABLE = instance.$table[0]; TABLE.parentNode.appendChild(ghost); ghostStyle.width = instance.view.wt.wtDom.outerWidth(TH) + 'px'; ghostStyle.height = instance.view.wt.wtDom.outerHeight(TABLE) + 'px'; startOffset = parseInt(instance.view.wt.wtDom.offset(TH).left - instance.view.wt.wtDom.offset(TABLE).left, 10); ghostStyle.left = startOffset + 6 + 'px'; }); this.rootElement.on('mouseenter.' + instance.guid, 'td, th', function () { if (pressed) { var active = instance.view.THEAD.querySelector('.manualColumnMover.active'); if (active) { instance.view.wt.wtDom.removeClass(active, 'active'); } endCol = instance.view.wt.wtDom.index(this) + instance.colOffset(); var THs = instance.view.THEAD.querySelectorAll('th'); var mover = THs[endCol].querySelector('.manualColumnMover'); instance.view.wt.wtDom.addClass(mover, 'active'); } }); instance.addHook('afterDestroy', unbindMoveColEvents); }; var unbindMoveColEvents = function(){ var instance = this; $(document).off('mouseup.' + instance.guid); $(document).off('mousemove.' + instance.guid); instance.rootElement.off('mousedown.' + instance.guid); instance.rootElement.off('mouseenter.' + instance.guid); } this.beforeInit = function () { this.manualColumnPositions = []; }; this.init = function (source) { var instance = this; var manualColMoveEnabled = !!(this.getSettings().manualColumnMove); if (manualColMoveEnabled) { var initialManualColumnPositions = this.getSettings().manualColumnMove; var loadedManualColumnPositions = loadManualColumnPositions.call(instance); if (typeof loadedManualColumnPositions != 'undefined') { this.manualColumnPositions = loadedManualColumnPositions; } else if (initialManualColumnPositions instanceof Array) { this.manualColumnPositions = initialManualColumnPositions; } else { this.manualColumnPositions = []; } instance.forceFullRender = true; if (source == 'afterInit') { bindMoveColEvents.call(this); if (this.manualColumnPositions.length > 0) { this.forceFullRender = true; this.render(); } } } else { unbindMoveColEvents.call(this); this.manualColumnPositions = []; } }; this.modifyCol = function (col) { //TODO test performance: http://jsperf.com/object-wrapper-vs-primitive/2 if (this.getSettings().manualColumnMove) { if (typeof this.manualColumnPositions[col] === 'undefined') { this.manualColumnPositions[col] = col; } return this.manualColumnPositions[col]; } return col; }; this.getColHeader = function (col, TH) { if (this.getSettings().manualColumnMove) { var DIV = document.createElement('DIV'); DIV.className = 'manualColumnMover'; TH.firstChild.appendChild(DIV); } }; } var htManualColumnMove = new HandsontableManualColumnMove(); Handsontable.PluginHooks.add('beforeInit', htManualColumnMove.beforeInit); Handsontable.PluginHooks.add('afterInit', function () { htManualColumnMove.init.call(this, 'afterInit') }); Handsontable.PluginHooks.add('afterUpdateSettings', function () { htManualColumnMove.init.call(this, 'afterUpdateSettings') }); Handsontable.PluginHooks.add('afterGetColHeader', htManualColumnMove.getColHeader); Handsontable.PluginHooks.add('modifyCol', htManualColumnMove.modifyCol); function HandsontableManualColumnResize() { var pressed , currentTH , currentCol , currentWidth , instance , newSize , startX , startWidth , startOffset , resizer = document.createElement('DIV') , handle = document.createElement('DIV') , line = document.createElement('DIV') , lineStyle = line.style; resizer.className = 'manualColumnResizer'; handle.className = 'manualColumnResizerHandle'; resizer.appendChild(handle); line.className = 'manualColumnResizerLine'; resizer.appendChild(line); var $document = $(document); $document.mousemove(function (e) { if (pressed) { currentWidth = startWidth + (e.pageX - startX); newSize = setManualSize(currentCol, currentWidth); //save col width resizer.style.left = startOffset + currentWidth + 'px'; } }); $document.mouseup(function () { if (pressed) { instance.view.wt.wtDom.removeClass(resizer, 'active'); pressed = false; if(newSize != startWidth){ instance.forceFullRender = true; instance.view.render(); //updates all saveManualColumnWidths.call(instance); instance.PluginHooks.run('afterColumnResize', currentCol, newSize); } refreshResizerPosition.call(instance, currentTH); } }); var saveManualColumnWidths = function () { var instance = this; instance.PluginHooks.run('persistentStateSave', 'manualColumnWidths', instance.manualColumnWidths); }; var loadManualColumnWidths = function () { var instance = this; var storedState = {}; instance.PluginHooks.run('persistentStateLoad', 'manualColumnWidths', storedState); return storedState.value; }; function refreshResizerPosition(TH) { instance = this; currentTH = TH; var col = this.view.wt.wtTable.getCoords(TH)[1]; //getCoords returns array [row, col] if (col >= 0) { //if not row header currentCol = col; var rootOffset = this.view.wt.wtDom.offset(this.rootElement[0]).left; var thOffset = this.view.wt.wtDom.offset(TH).left; startOffset = (thOffset - rootOffset) - 6; var thStyle = this.view.wt.wtDom.getComputedStyle(TH); resizer.style.left = startOffset + parseInt(this.view.wt.wtDom.outerWidth(TH), 10) + 'px'; this.rootElement[0].appendChild(resizer); } } function getColumnWidth(TH) { var instance = this; var thOffset = instance.view.wt.wtDom.offset(TH).left - instance.view.wt.wtDom.offset(TH).left; var rootOffset = instance.view.wt.wtDom.offset(instance.rootElement[0]).left; var col = instance.view.wt.wtTable.getCoords(TH)[1]; //getCoords returns array [row, col] var thWidth = instance.getColWidth(col); var maxWidth = instance.view.maximumVisibleElementWidth(thOffset - rootOffset); return Math.min(thWidth, maxWidth); } function refreshLinePosition() { var instance = this; var thBorderWidth = 2 * parseInt(this.view.wt.wtDom.getComputedStyle(currentTH).borderWidth, 10); startWidth = parseInt(this.view.wt.wtDom.outerWidth(currentTH), 10); instance.view.wt.wtDom.addClass(resizer, 'active'); lineStyle.height = instance.view.wt.wtDom.outerHeight(instance.$table[0]) + 'px'; pressed = instance; } var bindManualColumnWidthEvents = function () { var instance = this; var dblclick = 0; var autoresizeTimeout = null; this.rootElement.on('mouseenter.handsontable', 'th', function (e) { if (!pressed) { refreshResizerPosition.call(instance, e.currentTarget); } }); this.rootElement.on('mousedown.handsontable', '.manualColumnResizer', function () { if (autoresizeTimeout == null) { autoresizeTimeout = setTimeout(function () { if (dblclick >= 2) { newSize = instance.determineColumnWidth.call(instance, currentCol); setManualSize(currentCol, newSize); instance.forceFullRender = true; instance.view.render(); //updates all instance.PluginHooks.run('afterColumnResize', currentCol, newSize); } dblclick = 0; autoresizeTimeout = null; }, 500); } dblclick++; }); this.rootElement.on('mousedown.handsontable', '.manualColumnResizer', function (e) { startX = e.pageX; refreshLinePosition.call(instance); newSize = startWidth; }); }; this.beforeInit = function () { this.manualColumnWidths = []; }; this.init = function (source) { var instance = this; var manualColumnWidthEnabled = !!(this.getSettings().manualColumnResize); if (manualColumnWidthEnabled) { var initialColumnWidths = this.getSettings().manualColumnResize; var loadedManualColumnWidths = loadManualColumnWidths.call(instance); if (typeof loadedManualColumnWidths != 'undefined') { this.manualColumnWidths = loadedManualColumnWidths; } else if (initialColumnWidths instanceof Array) { this.manualColumnWidths = initialColumnWidths; } else { this.manualColumnWidths = []; } if (source == 'afterInit') { bindManualColumnWidthEvents.call(this); instance.forceFullRender = true; instance.render(); } } }; var setManualSize = function (col, width) { width = Math.max(width, 20); /** * We need to run col through modifyCol hook, in case the order of displayed columns is different than the order * in data source. For instance, this order can be modified by manualColumnMove plugin. */ col = instance.PluginHooks.execute('modifyCol', col); instance.manualColumnWidths[col] = width; return width; }; this.getColWidth = function (col, response) { if (this.getSettings().manualColumnResize && this.manualColumnWidths[col]) { response.width = this.manualColumnWidths[col]; } }; } var htManualColumnResize = new HandsontableManualColumnResize(); Handsontable.PluginHooks.add('beforeInit', htManualColumnResize.beforeInit); Handsontable.PluginHooks.add('afterInit', function () { htManualColumnResize.init.call(this, 'afterInit') }); Handsontable.PluginHooks.add('afterUpdateSettings', function () { htManualColumnResize.init.call(this, 'afterUpdateSettings') }); Handsontable.PluginHooks.add('afterGetColWidth', htManualColumnResize.getColWidth); (function HandsontableObserveChanges() { Handsontable.PluginHooks.add('afterLoadData', init); Handsontable.PluginHooks.add('afterUpdateSettings', init); function init() { var instance = this; var pluginEnabled = instance.getSettings().observeChanges; if (!instance.observer && pluginEnabled) { createObserver.call(instance); bindEvents.call(instance); } else if (!pluginEnabled){ destroy.call(instance); } } function createObserver(){ var instance = this; instance.observeChangesActive = true; instance.pauseObservingChanges = function(){ instance.observeChangesActive = false; }; instance.resumeObservingChanges = function(){ instance.observeChangesActive = true; }; instance.observer = jsonpatch.observe(instance.getData(), function (patches) { if(instance.observeChangesActive){ runHookForOperation.call(instance, patches); instance.render(); } instance.runHooks('afterChangesObserved'); }); } function runHookForOperation(rawPatches){ var instance = this; var patches = cleanPatches(rawPatches); for(var i = 0, len = patches.length; i < len; i++){ var patch = patches[i]; var parsedPath = parsePath(patch.path); switch(patch.op){ case 'add': if(isNaN(parsedPath.col)){ instance.runHooks('afterCreateRow', parsedPath.row); } else { instance.runHooks('afterCreateCol', parsedPath.col); } break; case 'remove': if(isNaN(parsedPath.col)){ instance.runHooks('afterRemoveRow', parsedPath.row, 1); } else { instance.runHooks('afterRemoveCol', parsedPath.col, 1); } break; case 'replace': instance.runHooks('afterChange', [parsedPath.row, parsedPath.col, null, patch.value], 'external'); break; } } function cleanPatches(rawPatches){ var patches; patches = removeLengthRelatedPatches(rawPatches); patches = removeMultipleAddOrRemoveColPatches(patches); return patches; } /** * Removing or adding column will produce one patch for each table row. * This function leaves only one patch for each column add/remove operation */ function removeMultipleAddOrRemoveColPatches(rawPatches){ var newOrRemovedColumns = []; return rawPatches.filter(function(patch){ var parsedPath = parsePath(patch.path); if(['add', 'remove'].indexOf(patch.op) != -1 && !isNaN(parsedPath.col)){ if(newOrRemovedColumns.indexOf(parsedPath.col) != -1){ return false; } else { newOrRemovedColumns.push(parsedPath.col); } } return true; }); } /** * If observeChanges uses native Object.observe method, then it produces patches for length property. * This function removes them. */ function removeLengthRelatedPatches(rawPatches){ return rawPatches.filter(function(patch){ return !/[/]length/ig.test(patch.path); }) } function parsePath(path){ var match = path.match(/^\/(\d)\/?(\d)?$/); return { row: parseInt(match[1], 10), col: parseInt(match[2], 10) } } } function destroy(){ var instance = this; if (instance.observer){ destroyObserver.call(instance); unbindEvents.call(instance); } } function destroyObserver(){ var instance = this; jsonpatch.unobserve(instance.getData(), instance.observer); delete instance.observeChangesActive; delete instance.pauseObservingChanges; delete instance.resumeObservingChanges; } function bindEvents(){ var instance = this; instance.addHook('afterDestroy', destroy); instance.addHook('afterCreateRow', afterTableAlter); instance.addHook('afterRemoveRow', afterTableAlter); instance.addHook('afterCreateCol', afterTableAlter); instance.addHook('afterRemoveCol', afterTableAlter); instance.addHook('afterChange', function(changes, source){ if(source != 'loadData'){ afterTableAlter.call(this); } }); } function unbindEvents(){ var instance = this; instance.removeHook('afterDestroy', destroy); instance.removeHook('afterCreateRow', afterTableAlter); instance.removeHook('afterRemoveRow', afterTableAlter); instance.removeHook('afterCreateCol', afterTableAlter); instance.removeHook('afterRemoveCol', afterTableAlter); instance.removeHook('afterChange', afterTableAlter); } function afterTableAlter(){ var instance = this; instance.pauseObservingChanges(); instance.addHookOnce('afterChangesObserved', function(){ instance.resumeObservingChanges(); }); } })(); /* * * Plugin enables saving table state * * */ function Storage(prefix) { var savedKeys; var saveSavedKeys = function () { window.localStorage[prefix + '__' + 'persistentStateKeys'] = JSON.stringify(savedKeys); }; var loadSavedKeys = function () { var keysJSON = window.localStorage[prefix + '__' + 'persistentStateKeys']; var keys = typeof keysJSON == 'string' ? JSON.parse(keysJSON) : void 0; savedKeys = keys ? keys : []; }; var clearSavedKeys = function () { savedKeys = []; saveSavedKeys(); }; loadSavedKeys(); this.saveValue = function (key, value) { window.localStorage[prefix + '_' + key] = JSON.stringify(value); if (savedKeys.indexOf(key) == -1) { savedKeys.push(key); saveSavedKeys(); } }; this.loadValue = function (key, defaultValue) { key = typeof key != 'undefined' ? key : defaultValue; var value = window.localStorage[prefix + '_' + key]; return typeof value == "undefined" ? void 0 : JSON.parse(value); }; this.reset = function (key) { window.localStorage.removeItem(prefix + '_' + key); }; this.resetAll = function () { for (var index = 0; index < savedKeys.length; index++) { window.localStorage.removeItem(prefix + '_' + savedKeys[index]); } clearSavedKeys(); }; } (function (StorageClass) { function HandsontablePersistentState() { var plugin = this; this.init = function () { var instance = this, pluginSettings = instance.getSettings()['persistentState']; plugin.enabled = !!(pluginSettings); if (!plugin.enabled) { removeHooks.call(instance); return; } if (!instance.storage) { instance.storage = new StorageClass(instance.rootElement[0].id); } instance.resetState = plugin.resetValue; addHooks.call(instance); }; this.saveValue = function (key, value) { var instance = this; instance.storage.saveValue(key, value); }; this.loadValue = function (key, saveTo) { var instance = this; saveTo.value = instance.storage.loadValue(key); }; this.resetValue = function (key) { var instance = this; if (typeof key != 'undefined') { instance.storage.reset(key); } else { instance.storage.resetAll(); } }; var hooks = { 'persistentStateSave': plugin.saveValue, 'persistentStateLoad': plugin.loadValue, 'persistentStateReset': plugin.resetValue }; function addHooks() { var instance = this; for (var hookName in hooks) { if (hooks.hasOwnProperty(hookName) && !hookExists.call(instance, hookName)) { instance.PluginHooks.add(hookName, hooks[hookName]); } } } function removeHooks() { var instance = this; for (var hookName in hooks) { if (hooks.hasOwnProperty(hookName) && hookExists.call(instance, hookName)) { instance.PluginHooks.remove(hookName, hooks[hookName]); } } } function hookExists(hookName) { var instance = this; return instance.PluginHooks.hooks['persistent'].hasOwnProperty(hookName); } } var htPersistentState = new HandsontablePersistentState(); Handsontable.PluginHooks.add('beforeInit', htPersistentState.init); Handsontable.PluginHooks.add('afterUpdateSettings', htPersistentState.init); })(Storage); /* * jQuery.fn.autoResize 1.1+ * -- * https://github.com/warpech/jQuery.fn.autoResize * * This fork differs from others in a way that it autoresizes textarea in 2-dimensions (horizontally and vertically). * It was originally forked from alexbardas's repo but maybe should be merged with dpashkevich's repo in future. * * originally forked from: * https://github.com/jamespadolsey/jQuery.fn.autoResize * which is now located here: * https://github.com/alexbardas/jQuery.fn.autoResize * though the mostly maintained for is here: * https://github.com/dpashkevich/jQuery.fn.autoResize/network * * -- * This program is free software. It comes without any warranty, to * the extent permitted by applicable law. You can redistribute it * and/or modify it under the terms of the Do What The Fuck You Want * To Public License, Version 2, as published by Sam Hocevar. See * http://sam.zoy.org/wtfpl/COPYING for more details. */ (function($){ autoResize.defaults = { onResize: function(){}, animate: { duration: 200, complete: function(){} }, extraSpace: 50, minHeight: 'original', maxHeight: 500, minWidth: 'original', maxWidth: 500 }; autoResize.cloneCSSProperties = [ 'lineHeight', 'textDecoration', 'letterSpacing', 'fontSize', 'fontFamily', 'fontStyle', 'fontWeight', 'textTransform', 'textAlign', 'direction', 'wordSpacing', 'fontSizeAdjust', 'padding' ]; autoResize.cloneCSSValues = { position: 'absolute', top: -9999, left: -9999, opacity: 0, overflow: 'hidden', overflowX: 'hidden', overflowY: 'hidden', border: '1px solid black', padding: '0.49em' //this must be about the width of caps W character }; autoResize.resizableFilterSelector = 'textarea,input:not(input[type]),input[type=text],input[type=password]'; autoResize.AutoResizer = AutoResizer; $.fn.autoResize = autoResize; function autoResize(config) { this.filter(autoResize.resizableFilterSelector).each(function(){ new AutoResizer( $(this), config ); }); return this; } function AutoResizer(el, config) { if(this.clones) return; this.config = $.extend({}, autoResize.defaults, config); this.el = el; this.nodeName = el[0].nodeName.toLowerCase(); this.previousScrollTop = null; if (config.maxWidth === 'original') config.maxWidth = el.width(); if (config.minWidth === 'original') config.minWidth = el.width(); if (config.maxHeight === 'original') config.maxHeight = el.height(); if (config.minHeight === 'original') config.minHeight = el.height(); if (this.nodeName === 'textarea') { el.css({ resize: 'none', overflowY: 'none' }); } el.data('AutoResizer', this); this.createClone(); this.injectClone(); this.bind(); } AutoResizer.prototype = { bind: function() { var check = $.proxy(function(){ this.check(); return true; }, this); this.unbind(); this.el .bind('keyup.autoResize', check) //.bind('keydown.autoResize', check) .bind('change.autoResize', check); this.check(null, true); }, unbind: function() { this.el.unbind('.autoResize'); }, createClone: function() { var el = this.el, self = this, config = this.config; this.clones = $(); if (config.minHeight !== 'original' || config.maxHeight !== 'original') { this.hClone = el.clone().height('auto'); this.clones = this.clones.add(this.hClone); } if (config.minWidth !== 'original' || config.maxWidth !== 'original') { this.wClone = $('<div/>').width('auto').css({ whiteSpace: 'nowrap', 'float': 'left' }); this.clones = this.clones.add(this.wClone); } $.each(autoResize.cloneCSSProperties, function(i, p){ self.clones.css(p, el.css(p)); }); this.clones .removeAttr('name') .removeAttr('id') .attr('tabIndex', -1) .css(autoResize.cloneCSSValues) .css('overflowY', 'scroll'); }, check: function(e, immediate) { var config = this.config, wClone = this.wClone, hClone = this.hClone, el = this.el, value = el.val(); if (wClone) { wClone.text(value); // Calculate new width + whether to change var cloneWidth = wClone.outerWidth(), newWidth = (cloneWidth + config.extraSpace) >= config.minWidth ? cloneWidth + config.extraSpace : config.minWidth, currentWidth = el.width(); newWidth = Math.min(newWidth, config.maxWidth); if ( (newWidth < currentWidth && newWidth >= config.minWidth) || (newWidth >= config.minWidth && newWidth <= config.maxWidth) ) { config.onResize.call(el); el.scrollLeft(0); config.animate && !immediate ? el.stop(1,1).animate({ width: newWidth }, config.animate) : el.width(newWidth); } } if (hClone) { if (newWidth) { hClone.width(newWidth); } hClone.height(0).val(value).scrollTop(10000); var scrollTop = hClone[0].scrollTop + config.extraSpace; // Don't do anything if scrollTop hasen't changed: if (this.previousScrollTop === scrollTop) { return; } this.previousScrollTop = scrollTop; if (scrollTop >= config.maxHeight) { scrollTop = config.maxHeight; } if (scrollTop < config.minHeight) { scrollTop = config.minHeight; } if(scrollTop == config.maxHeight && newWidth == config.maxWidth) { el.css('overflowY', 'scroll'); } else { el.css('overflowY', 'hidden'); } config.onResize.call(el); // Either animate or directly apply height: config.animate && !immediate ? el.stop(1,1).animate({ height: scrollTop }, config.animate) : el.height(scrollTop); } }, destroy: function() { this.unbind(); this.el.removeData('AutoResizer'); this.clones.remove(); delete this.el; delete this.hClone; delete this.wClone; delete this.clones; }, injectClone: function() { ( autoResize.cloneContainer || (autoResize.cloneContainer = $('<arclones/>').appendTo('body')) ).empty().append(this.clones); //this should be refactored so that a node is never cloned more than once } }; })(jQuery); /** * SheetClip - Spreadsheet Clipboard Parser * version 0.2 * * This tiny library transforms JavaScript arrays to strings that are pasteable by LibreOffice, OpenOffice, * Google Docs and Microsoft Excel. * * Copyright 2012, Marcin Warpechowski * Licensed under the MIT license. * http://github.com/warpech/sheetclip/ */ /*jslint white: true*/ (function (global) { "use strict"; function countQuotes(str) { return str.split('"').length - 1; } global.SheetClip = { parse: function (str) { var r, rlen, rows, arr = [], a = 0, c, clen, multiline, last; rows = str.split('\n'); if (rows.length > 1 && rows[rows.length - 1] === '') { rows.pop(); } for (r = 0, rlen = rows.length; r < rlen; r += 1) { rows[r] = rows[r].split('\t'); for (c = 0, clen = rows[r].length; c < clen; c += 1) { if (!arr[a]) { arr[a] = []; } if (multiline && c === 0) { last = arr[a].length - 1; arr[a][last] = arr[a][last] + '\n' + rows[r][0]; if (multiline && (countQuotes(rows[r][0]) & 1)) { //& 1 is a bitwise way of performing mod 2 multiline = false; arr[a][last] = arr[a][last].substring(0, arr[a][last].length - 1).replace(/""/g, '"'); } } else { if (c === clen - 1 && rows[r][c].indexOf('"') === 0) { arr[a].push(rows[r][c].substring(1).replace(/""/g, '"')); multiline = true; } else { arr[a].push(rows[r][c].replace(/""/g, '"')); multiline = false; } } } if (!multiline) { a += 1; } } return arr; }, stringify: function (arr) { var r, rlen, c, clen, str = '', val; for (r = 0, rlen = arr.length; r < rlen; r += 1) { for (c = 0, clen = arr[r].length; c < clen; c += 1) { if (c > 0) { str += '\t'; } val = arr[r][c]; if (typeof val === 'string') { if (val.indexOf('\n') > -1) { str += '"' + val.replace(/"/g, '""') + '"'; } else { str += val; } } else if (val === null || val === void 0) { //void 0 resolves to undefined str += ''; } else { str += val; } } str += '\n'; } return str; } }; }(window)); /** * CopyPaste.js * Creates a textarea that stays hidden on the page and gets focused when user presses CTRL while not having a form input focused * In future we may implement a better driver when better APIs are available * @constructor */ var CopyPaste = (function () { var instance; return { getInstance: function () { if (!instance) { instance = new CopyPasteClass(); } return instance; } }; })(); function CopyPasteClass() { var that = this , style , parent; this.copyCallbacks = []; this.cutCallbacks = []; this.pasteCallbacks = []; var listenerElement = document.documentElement; parent = document.body; if (document.getElementById('CopyPasteDiv')) { this.elDiv = document.getElementById('CopyPasteDiv'); this.elTextarea = this.elDiv.firstChild; } else { this.elDiv = document.createElement('DIV'); this.elDiv.id = 'CopyPasteDiv'; style = this.elDiv.style; style.position = 'fixed'; style.top = 0; style.left = 0; parent.appendChild(this.elDiv); this.elTextarea = document.createElement('TEXTAREA'); this.elTextarea.className = 'copyPaste'; style = this.elTextarea.style; style.width = '1px'; style.height = '1px'; this.elDiv.appendChild(this.elTextarea); if (typeof style.opacity !== 'undefined') { style.opacity = 0; } else { /*@cc_on @if (@_jscript) if(typeof style.filter === 'string') { style.filter = 'alpha(opacity=0)'; } @end @*/ } } this._bindEvent(listenerElement, 'keydown', function (event) { var isCtrlDown = false; if (event.metaKey) { //mac isCtrlDown = true; } else if (event.ctrlKey && navigator.userAgent.indexOf('Mac') === -1) { //pc isCtrlDown = true; } if (isCtrlDown) { if (document.activeElement !== that.elTextarea && (that.getSelectionText() != '' || ['INPUT', 'SELECT', 'TEXTAREA'].indexOf(document.activeElement.nodeName) != -1)) { return; //this is needed by fragmentSelection in Handsontable. Ignore copypaste.js behavior if fragment of cell text is selected } that.selectNodeText(that.elTextarea); setTimeout(function () { that.selectNodeText(that.elTextarea); }, 0); } /* 67 = c * 86 = v * 88 = x */ if (isCtrlDown && (event.keyCode === 67 || event.keyCode === 86 || event.keyCode === 88)) { // that.selectNodeText(that.elTextarea); if (event.keyCode === 88) { //works in all browsers, incl. Opera < 12.12 setTimeout(function () { that.triggerCut(event); }, 0); } else if (event.keyCode === 86) { setTimeout(function () { that.triggerPaste(event); }, 0); } } }); } //http://jsperf.com/textara-selection //http://stackoverflow.com/questions/1502385/how-can-i-make-this-code-work-in-ie CopyPasteClass.prototype.selectNodeText = function (el) { el.select(); }; //http://stackoverflow.com/questions/5379120/get-the-highlighted-selected-text CopyPasteClass.prototype.getSelectionText = function () { var text = ""; if (window.getSelection) { text = window.getSelection().toString(); } else if (document.selection && document.selection.type != "Control") { text = document.selection.createRange().text; } return text; }; CopyPasteClass.prototype.copyable = function (str) { if (typeof str !== 'string' && str.toString === void 0) { throw new Error('copyable requires string parameter'); } this.elTextarea.value = str; }; /*CopyPasteClass.prototype.onCopy = function (fn) { this.copyCallbacks.push(fn); };*/ CopyPasteClass.prototype.onCut = function (fn) { this.cutCallbacks.push(fn); }; CopyPasteClass.prototype.onPaste = function (fn) { this.pasteCallbacks.push(fn); }; CopyPasteClass.prototype.removeCallback = function (fn) { var i, ilen; for (i = 0, ilen = this.copyCallbacks.length; i < ilen; i++) { if (this.copyCallbacks[i] === fn) { this.copyCallbacks.splice(i, 1); return true; } } for (i = 0, ilen = this.cutCallbacks.length; i < ilen; i++) { if (this.cutCallbacks[i] === fn) { this.cutCallbacks.splice(i, 1); return true; } } for (i = 0, ilen = this.pasteCallbacks.length; i < ilen; i++) { if (this.pasteCallbacks[i] === fn) { this.pasteCallbacks.splice(i, 1); return true; } } return false; }; CopyPasteClass.prototype.triggerCut = function (event) { var that = this; if (that.cutCallbacks) { setTimeout(function () { for (var i = 0, ilen = that.cutCallbacks.length; i < ilen; i++) { that.cutCallbacks[i](event); } }, 50); } }; CopyPasteClass.prototype.triggerPaste = function (event, str) { var that = this; if (that.pasteCallbacks) { setTimeout(function () { var val = (str || that.elTextarea.value).replace(/\n$/, ''); //remove trailing newline for (var i = 0, ilen = that.pasteCallbacks.length; i < ilen; i++) { that.pasteCallbacks[i](val, event); } }, 50); } }; //old version used this: // - http://net.tutsplus.com/tutorials/javascript-ajax/javascript-from-null-cross-browser-event-binding/ // - http://stackoverflow.com/questions/4643249/cross-browser-event-object-normalization //but that cannot work with jQuery.trigger CopyPasteClass.prototype._bindEvent = (function () { if (window.jQuery) { //if jQuery exists, use jQuery event (for compatibility with $.trigger and $.triggerHandler, which can only trigger jQuery events - and we use that in tests) return function (elem, type, cb) { $(elem).on(type + '.copypaste', cb); }; } else { return function (elem, type, cb) { elem.addEventListener(type, cb, false); //sorry, IE8 will only work with jQuery }; } })(); var jsonpatch; (function (jsonpatch) { var objOps = { add: function (obj, key) { obj[key] = this.value; return true; }, remove: function (obj, key) { delete obj[key]; return true; }, replace: function (obj, key) { obj[key] = this.value; return true; }, move: function (obj, key, tree) { var temp = { op: "_get", path: this.from }; apply(tree, [ temp ]); apply(tree, [ { op: "remove", path: this.from } ]); apply(tree, [ { op: "add", path: this.path, value: temp.value } ]); return true; }, copy: function (obj, key, tree) { var temp = { op: "_get", path: this.from }; apply(tree, [ temp ]); apply(tree, [ { op: "add", path: this.path, value: temp.value } ]); return true; }, test: function (obj, key) { return (JSON.stringify(obj[key]) === JSON.stringify(this.value)); }, _get: function (obj, key) { this.value = obj[key]; } }; var arrOps = { add: function (arr, i) { arr.splice(i, 0, this.value); }, remove: function (arr, i) { arr.splice(i, 1); }, replace: function (arr, i) { arr[i] = this.value; }, move: objOps.move, copy: objOps.copy, test: objOps.test, _get: objOps._get }; var observeOps = { 'new': function (patches, path) { //single quotes needed because 'new' is a keyword in IE8 var patch = { op: "add", path: path + "/" + this.name, value: this.object[this.name] }; patches.push(patch); }, deleted: function (patches, path) { var patch = { op: "remove", path: path + "/" + this.name }; patches.push(patch); }, updated: function (patches, path) { var patch = { op: "replace", path: path + "/" + this.name, value: this.object[this.name] }; patches.push(patch); } }; // ES6 symbols are not here yet. Used to calculate the json pointer to each object function markPaths(observer, node) { for(var key in node) { if(node.hasOwnProperty(key)) { var kid = node[key]; if(kid instanceof Object) { Object.unobserve(kid, observer); kid.____Path = node.____Path + "/" + key; markPaths(observer, kid); } } } } // Detach poor mans ES6 symbols function clearPaths(observer, node) { delete node.____Path; Object.observe(node, observer); for(var key in node) { if(node.hasOwnProperty(key)) { var kid = node[key]; if(kid instanceof Object) { clearPaths(observer, kid); } } } } var beforeDict = []; //var callbacks = []; this has no purpose jsonpatch.intervals; function unobserve(root, observer) { if(Object.observe) { Object.unobserve(root, observer); markPaths(observer, root); } else { clearTimeout(observer.next); observer.unbindWindowEvents(); } } jsonpatch.unobserve = unobserve; function observe(obj, callback) { var patches = []; var root = obj; if(Object.observe) { var observer = function (arr) { if(!root.___Path) { Object.unobserve(root, observer); root.____Path = ""; markPaths(observer, root); var a = 0, alen = arr.length; while(a < alen) { if(arr[a].name != "____Path") { observeOps[arr[a].type].call(arr[a], patches, arr[a].object.____Path); } a++; } clearPaths(observer, root); } if(callback) { callback(patches); } observer.patches = patches; patches = []; }; } else { observer = { }; var mirror; for(var i = 0, ilen = beforeDict.length; i < ilen; i++) { if(beforeDict[i].obj === obj) { mirror = beforeDict[i]; break; } } if(!mirror) { mirror = { obj: obj }; beforeDict.push(mirror); } mirror.value = JSON.parse(JSON.stringify(obj))// Faster than ES5 clone - http://jsperf.com/deep-cloning-of-objects/5 ; if(callback) { //callbacks.push(callback); this has no purpose observer.callback = callback; observer.next = null; this.intervals = this.intervals || [ 100, 1000, 10000, 60000 ]; observer.currentInterval = 0; if(typeof window !== 'undefined') { //not Node bindWindowEvents(observer); } observer.next = setTimeout(function(){ slowCheck(observer); }, this.intervals[observer.currentInterval++]); } } observer.patches = patches; observer.object = obj; return _observe(observer, obj, patches); } jsonpatch.observe = observe; /// Listen to changes on an object tree, accumulate patches function _observe(observer, obj, patches) { if(Object.observe) { Object.observe(obj, observer); for(var key in obj) { if(obj.hasOwnProperty(key)) { var v = obj[key]; if(v && typeof (v) === "object") { _observe(observer, v, patches)//path+key); ; } } } } return observer; } function dirtyCheck (observer) { generate(observer); } function fastCheck (observer) { clearTimeout(observer.next); observer.next = setTimeout(function () { dirtyCheck(observer); observer.currentInterval = 0; observer.next = setTimeout(function(){ slowCheck(observer); }, jsonpatch.intervals[observer.currentInterval++]); }, 0); } function slowCheck (observer) { dirtyCheck(observer); if(observer.currentInterval == jsonpatch.intervals.length) { observer.currentInterval = jsonpatch.intervals.length - 1; } observer.next = setTimeout(function(){ slowCheck(observer); }, jsonpatch.intervals[observer.currentInterval++]); } function bindWindowEvents(observer){ var fastCheckObserver = function(){ fastCheck(observer); }; if(window.addEventListener) { //standards window.addEventListener('mousedown', fastCheckObserver); window.addEventListener('mouseup', fastCheckObserver); window.addEventListener('keydown', fastCheckObserver); observer.unbindWindowEvents = function(){ window.removeEventListener('mousedown', fastCheckObserver); window.removeEventListener('mouseup', fastCheckObserver); window.removeEventListener('keydown', fastCheckObserver); }; } else { //IE8 window.attachEvent('onmousedown', fastCheckObserver); window.attachEvent('onmouseup', fastCheckObserver); window.attachEvent('onkeydown', fastCheckObserver); observer.unbindWindowEvents = function(){ window.detachEvent('mousedown', fastCheckObserver); window.detachEvent('mouseup', fastCheckObserver); window.detachEvent('keydown', fastCheckObserver); }; } } function generate(observer) { if(Object.observe) { Object.deliverChangeRecords(observer); } else { var mirror; for(var i = 0, ilen = beforeDict.length; i < ilen; i++) { if(beforeDict[i].obj === observer.object) { mirror = beforeDict[i]; break; } } _generate(mirror.value, observer.object, observer.patches, ""); } var temp = observer.patches; if(temp.length > 0) { observer.patches = []; if(observer.callback) { observer.callback(temp); } } return temp; } jsonpatch.generate = generate; var _objectKeys; if(Object.keys) { //standards _objectKeys = Object.keys; } else { //IE8 shim _objectKeys = function (obj) { var keys = []; for(var o in obj) { if(obj.hasOwnProperty(o)) { keys.push(o); } } return keys; }; } // Dirty check if obj is different from mirror, generate patches and update mirror function _generate(mirror, obj, patches, path) { var newKeys = _objectKeys(obj); var oldKeys = _objectKeys(mirror); var changed = false; var deleted = false; for(var t = 0; t < oldKeys.length; t++) { var key = oldKeys[t]; var oldVal = mirror[key]; if(obj.hasOwnProperty(key)) { var newVal = obj[key]; if(oldVal instanceof Object) { _generate(oldVal, newVal, patches, path + "/" + key); } else { if(oldVal != newVal) { changed = true; patches.push({ op: "replace", path: path + "/" + key, value: newVal }); mirror[key] = newVal; } } } else { patches.push({ op: "remove", path: path + "/" + key }); deleted = true// property has been deleted ; } } if(!deleted && newKeys.length == oldKeys.length) { return; } for(var t = 0; t < newKeys.length; t++) { var key = newKeys[t]; if(!mirror.hasOwnProperty(key)) { patches.push({ op: "add", path: path + "/" + key, value: obj[key] }); } } } var _isArray; if(Array.isArray) { //standards; http://jsperf.com/isarray-shim/4 _isArray = Array.isArray; } else { //IE8 shim _isArray = function (obj) { return obj.push && typeof obj.length === 'number'; }; } /// Apply a json-patch operation on an object tree function apply(tree, patches, listen) { var result = false, p = 0, plen = patches.length, patch; while(p < plen) { patch = patches[p]; // Find the object var keys = patch.path.split('/'); var obj = tree; var t = 1;//skip empty element - http://jsperf.com/to-shift-or-not-to-shift var len = keys.length; while(true) { if(_isArray(obj)) { var index = parseInt(keys[t], 10); t++; if(t >= len) { result = arrOps[patch.op].call(patch, obj, index, tree)// Apply patch ; break; } obj = obj[index]; } else { var key = keys[t]; if(key.indexOf('~') != -1) { key = key.replace('~1', '/').replace('~0', '~'); }// escape chars t++; if(t >= len) { result = objOps[patch.op].call(patch, obj, key, tree)// Apply patch ; break; } obj = obj[key]; } } p++; } return result; } jsonpatch.apply = apply; })(jsonpatch || (jsonpatch = {})); if(typeof exports !== "undefined") { exports.apply = jsonpatch.apply; exports.observe = jsonpatch.observe; exports.unobserve = jsonpatch.unobserve; exports.generate = jsonpatch.generate; } function WalkontableBorder(instance, settings) { var style; //reference to instance this.instance = instance; this.settings = settings; this.wtDom = this.instance.wtDom; this.main = document.createElement("div"); style = this.main.style; style.position = 'absolute'; style.top = 0; style.left = 0; // style.visibility = 'hidden'; for (var i = 0; i < 5; i++) { var DIV = document.createElement('DIV'); DIV.className = 'wtBorder ' + (settings.className || ''); style = DIV.style; style.backgroundColor = settings.border.color; style.height = settings.border.width + 'px'; style.width = settings.border.width + 'px'; this.main.appendChild(DIV); } this.top = this.main.childNodes[0]; this.left = this.main.childNodes[1]; this.bottom = this.main.childNodes[2]; this.right = this.main.childNodes[3]; /*$(this.top).on(sss, function(event) { event.preventDefault(); event.stopImmediatePropagation(); $(this).hide(); }); $(this.left).on(sss, function(event) { event.preventDefault(); event.stopImmediatePropagation(); $(this).hide(); }); $(this.bottom).on(sss, function(event) { event.preventDefault(); event.stopImmediatePropagation(); $(this).hide(); }); $(this.right).on(sss, function(event) { event.preventDefault(); event.stopImmediatePropagation(); $(this).hide(); });*/ this.topStyle = this.top.style; this.leftStyle = this.left.style; this.bottomStyle = this.bottom.style; this.rightStyle = this.right.style; this.corner = this.main.childNodes[4]; this.corner.className += ' corner'; this.cornerStyle = this.corner.style; this.cornerStyle.width = '5px'; this.cornerStyle.height = '5px'; this.cornerStyle.border = '2px solid #FFF'; this.disappear(); if (!instance.wtTable.bordersHolder) { instance.wtTable.bordersHolder = document.createElement('div'); instance.wtTable.bordersHolder.className = 'htBorders'; instance.wtTable.hider.appendChild(instance.wtTable.bordersHolder); } instance.wtTable.bordersHolder.appendChild(this.main); var down = false; var $body = $(document.body); $body.on('mousedown.walkontable.' + instance.guid, function () { down = true; }); $body.on('mouseup.walkontable.' + instance.guid, function () { down = false }); $(this.main.childNodes).on('mouseenter', function (event) { if (!down || !instance.getSetting('hideBorderOnMouseDownOver')) { return; } event.preventDefault(); event.stopImmediatePropagation(); var bounds = this.getBoundingClientRect(); var $this = $(this); $this.hide(); var isOutside = function (event) { if (event.clientY < Math.floor(bounds.top)) { return true; } if (event.clientY > Math.ceil(bounds.top + bounds.height)) { return true; } if (event.clientX < Math.floor(bounds.left)) { return true; } if (event.clientX > Math.ceil(bounds.left + bounds.width)) { return true; } }; $body.on('mousemove.border.' + instance.guid, function (event) { if (isOutside(event)) { $body.off('mousemove.border.' + instance.guid); $this.show(); } }); }); } /** * Show border around one or many cells * @param {Array} corners */ WalkontableBorder.prototype.appear = function (corners) { var isMultiple, fromTD, toTD, fromOffset, toOffset, containerOffset, top, minTop, left, minLeft, height, width; if (this.disabled) { return; } var instance = this.instance , fromRow , fromColumn , toRow , toColumn , hideTop = false , hideLeft = false , hideBottom = false , hideRight = false , i , ilen , s; if (!instance.wtTable.isRowInViewport(corners[0])) { hideTop = true; } if (!instance.wtTable.isRowInViewport(corners[2])) { hideBottom = true; } ilen = instance.wtTable.rowStrategy.countVisible(); for (i = 0; i < ilen; i++) { s = instance.wtTable.rowFilter.visibleToSource(i); if (s >= corners[0] && s <= corners[2]) { fromRow = s; break; } } for (i = ilen - 1; i >= 0; i--) { s = instance.wtTable.rowFilter.visibleToSource(i); if (s >= corners[0] && s <= corners[2]) { toRow = s; break; } } if (hideTop && hideBottom) { hideLeft = true; hideRight = true; } else { if (!instance.wtTable.isColumnInViewport(corners[1])) { hideLeft = true; } if (!instance.wtTable.isColumnInViewport(corners[3])) { hideRight = true; } ilen = instance.wtTable.columnStrategy.countVisible(); for (i = 0; i < ilen; i++) { s = instance.wtTable.columnFilter.visibleToSource(i); if (s >= corners[1] && s <= corners[3]) { fromColumn = s; break; } } for (i = ilen - 1; i >= 0; i--) { s = instance.wtTable.columnFilter.visibleToSource(i); if (s >= corners[1] && s <= corners[3]) { toColumn = s; break; } } } if (fromRow !== void 0 && fromColumn !== void 0) { isMultiple = (fromRow !== toRow || fromColumn !== toColumn); fromTD = instance.wtTable.getCell([fromRow, fromColumn]); toTD = isMultiple ? instance.wtTable.getCell([toRow, toColumn]) : fromTD; fromOffset = this.wtDom.offset(fromTD); toOffset = isMultiple ? this.wtDom.offset(toTD) : fromOffset; containerOffset = this.wtDom.offset(instance.wtTable.TABLE); minTop = fromOffset.top; height = toOffset.top + this.wtDom.outerHeight(toTD) - minTop; minLeft = fromOffset.left; width = toOffset.left + this.wtDom.outerWidth(toTD) - minLeft; top = minTop - containerOffset.top - 1; left = minLeft - containerOffset.left - 1; var style = this.wtDom.getComputedStyle(fromTD); if (parseInt(style['borderTopWidth'], 10) > 0) { top += 1; height -= 1; } if (parseInt(style['borderLeftWidth'], 10) > 0) { left += 1; width -= 1; } } else { this.disappear(); return; } if (hideTop) { this.topStyle.display = 'none'; } else { this.topStyle.top = top + 'px'; this.topStyle.left = left + 'px'; this.topStyle.width = width + 'px'; this.topStyle.display = 'block'; } if (hideLeft) { this.leftStyle.display = 'none'; } else { this.leftStyle.top = top + 'px'; this.leftStyle.left = left + 'px'; this.leftStyle.height = height + 'px'; this.leftStyle.display = 'block'; } var delta = Math.floor(this.settings.border.width / 2); if (hideBottom) { this.bottomStyle.display = 'none'; } else { this.bottomStyle.top = top + height - delta + 'px'; this.bottomStyle.left = left + 'px'; this.bottomStyle.width = width + 'px'; this.bottomStyle.display = 'block'; } if (hideRight) { this.rightStyle.display = 'none'; } else { this.rightStyle.top = top + 'px'; this.rightStyle.left = left + width - delta + 'px'; this.rightStyle.height = height + 1 + 'px'; this.rightStyle.display = 'block'; } if (hideBottom || hideRight || !this.hasSetting(this.settings.border.cornerVisible)) { this.cornerStyle.display = 'none'; } else { this.cornerStyle.top = top + height - 4 + 'px'; this.cornerStyle.left = left + width - 4 + 'px'; this.cornerStyle.display = 'block'; } }; /** * Hide border */ WalkontableBorder.prototype.disappear = function () { this.topStyle.display = 'none'; this.leftStyle.display = 'none'; this.bottomStyle.display = 'none'; this.rightStyle.display = 'none'; this.cornerStyle.display = 'none'; }; WalkontableBorder.prototype.hasSetting = function (setting) { if (typeof setting === 'function') { return setting(); } return !!setting; }; /** * WalkontableCellFilter * @constructor */ function WalkontableCellFilter() { this.offset = 0; this.total = 0; this.fixedCount = 0; } WalkontableCellFilter.prototype.source = function (n) { return n; }; WalkontableCellFilter.prototype.offsetted = function (n) { return n + this.offset; }; WalkontableCellFilter.prototype.unOffsetted = function (n) { return n - this.offset; }; WalkontableCellFilter.prototype.fixed = function (n) { if (n < this.fixedCount) { return n - this.offset; } else { return n; } }; WalkontableCellFilter.prototype.unFixed = function (n) { if (n < this.fixedCount) { return n + this.offset; } else { return n; } }; WalkontableCellFilter.prototype.visibleToSource = function (n) { return this.source(this.offsetted(this.fixed(n))); }; WalkontableCellFilter.prototype.sourceToVisible = function (n) { return this.source(this.unOffsetted(this.unFixed(n))); }; /** * WalkontableCellStrategy * @constructor */ function WalkontableCellStrategy() { } WalkontableCellStrategy.prototype.getSize = function (index) { return this.cellSizes[index]; }; WalkontableCellStrategy.prototype.getContainerSize = function (proposedSize) { return typeof this.containerSizeFn === 'function' ? this.containerSizeFn(proposedSize) : this.containerSizeFn; }; WalkontableCellStrategy.prototype.countVisible = function () { return this.cellCount; }; WalkontableCellStrategy.prototype.isLastIncomplete = function () { return this.remainingSize > 0; }; /** * WalkontableClassNameList * @constructor */ function WalkontableClassNameCache() { this.cache = []; } WalkontableClassNameCache.prototype.add = function (r, c, cls) { if (!this.cache[r]) { this.cache[r] = []; } if (!this.cache[r][c]) { this.cache[r][c] = []; } this.cache[r][c][cls] = true; }; WalkontableClassNameCache.prototype.test = function (r, c, cls) { return (this.cache[r] && this.cache[r][c] && this.cache[r][c][cls]); }; /** * WalkontableColumnFilter * @constructor */ function WalkontableColumnFilter() { this.countTH = 0; } WalkontableColumnFilter.prototype = new WalkontableCellFilter(); WalkontableColumnFilter.prototype.readSettings = function (instance) { this.offset = instance.wtSettings.settings.offsetColumn; this.total = instance.getSetting('totalColumns'); this.fixedCount = instance.getSetting('fixedColumnsLeft'); this.countTH = instance.getSetting('rowHeaders').length; }; WalkontableColumnFilter.prototype.offsettedTH = function (n) { return n - this.countTH; }; WalkontableColumnFilter.prototype.unOffsettedTH = function (n) { return n + this.countTH; }; WalkontableColumnFilter.prototype.visibleRowHeadedColumnToSourceColumn = function (n) { return this.visibleToSource(this.offsettedTH(n)); }; WalkontableColumnFilter.prototype.sourceColumnToVisibleRowHeadedColumn = function (n) { return this.unOffsettedTH(this.sourceToVisible(n)); }; /** * WalkontableColumnStrategy * @param containerSizeFn * @param sizeAtIndex * @param strategy - all, last, none * @constructor */ function WalkontableColumnStrategy(containerSizeFn, sizeAtIndex, strategy) { var size , i = 0; this.containerSizeFn = containerSizeFn; this.cellSizesSum = 0; this.cellSizes = []; this.cellStretch = []; this.cellCount = 0; this.remainingSize = 0; this.strategy = strategy; //step 1 - determine cells that fit containerSize and cache their widths while (true) { size = sizeAtIndex(i); if (size === void 0) { break; //total columns exceeded } if (this.cellSizesSum >= this.getContainerSize(this.cellSizesSum + size)) { break; //total width exceeded } this.cellSizes.push(size); this.cellSizesSum += size; this.cellCount++; i++; } var containerSize = this.getContainerSize(this.cellSizesSum); this.remainingSize = this.cellSizesSum - containerSize; //negative value means the last cell is fully visible and there is some space left for stretching //positive value means the last cell is not fully visible } WalkontableColumnStrategy.prototype = new WalkontableCellStrategy(); WalkontableColumnStrategy.prototype.getSize = function (index) { return this.cellSizes[index] + (this.cellStretch[index] || 0); }; WalkontableColumnStrategy.prototype.stretch = function () { //step 2 - apply stretching strategy var containerSize = this.getContainerSize(this.cellSizesSum) , i = 0; this.remainingSize = this.cellSizesSum - containerSize; this.cellStretch.length = 0; //clear previous stretch if (this.strategy === 'all') { if (this.remainingSize < 0) { var ratio = containerSize / this.cellSizesSum; var newSize; while (i < this.cellCount - 1) { //"i < this.cellCount - 1" is needed because last cellSize is adjusted after the loop newSize = Math.floor(ratio * this.cellSizes[i]); this.remainingSize += newSize - this.cellSizes[i]; this.cellStretch[i] = newSize - this.cellSizes[i]; i++; } this.cellStretch[this.cellCount - 1] = -this.remainingSize; this.remainingSize = 0; } } else if (this.strategy === 'last') { if (this.remainingSize < 0) { this.cellStretch[this.cellCount - 1] = -this.remainingSize; this.remainingSize = 0; } } }; function Walkontable(settings) { var that = this, originalHeaders = []; this.guid = 'wt_' + (window.Handsontable ? Handsontable.helper.randomString() : ''); //this is the namespace for global events //bootstrap from settings this.wtSettings = new WalkontableSettings(this, settings); this.wtDom = new WalkontableDom(); this.wtTable = new WalkontableTable(this); this.wtScroll = new WalkontableScroll(this); this.wtScrollbars = new WalkontableScrollbars(this); this.wtViewport = new WalkontableViewport(this); this.wtWheel = new WalkontableWheel(this); this.wtEvent = new WalkontableEvent(this); //find original headers if (this.wtTable.THEAD.childNodes.length && this.wtTable.THEAD.childNodes[0].childNodes.length) { for (var c = 0, clen = this.wtTable.THEAD.childNodes[0].childNodes.length; c < clen; c++) { originalHeaders.push(this.wtTable.THEAD.childNodes[0].childNodes[c].innerHTML); } if (!this.getSetting('columnHeaders').length) { this.update('columnHeaders', [function (column, TH) { that.wtDom.fastInnerText(TH, originalHeaders[column]); }]); } } //initialize selections this.selections = {}; var selectionsSettings = this.getSetting('selections'); if (selectionsSettings) { for (var i in selectionsSettings) { if (selectionsSettings.hasOwnProperty(i)) { this.selections[i] = new WalkontableSelection(this, selectionsSettings[i]); } } } this.drawn = false; this.drawInterrupted = false; } Walkontable.prototype.draw = function (selectionsOnly) { this.drawInterrupted = false; if (!selectionsOnly && !this.wtDom.isVisible(this.wtTable.TABLE)) { this.drawInterrupted = true; //draw interrupted because TABLE is not visible return; } this.getSetting('beforeDraw', !selectionsOnly); selectionsOnly = selectionsOnly && this.getSetting('offsetRow') === this.lastOffsetRow && this.getSetting('offsetColumn') === this.lastOffsetColumn; if (this.drawn) { //fix offsets that might have changed this.scrollVertical(0); this.scrollHorizontal(0); } this.lastOffsetRow = this.getSetting('offsetRow'); this.lastOffsetColumn = this.getSetting('offsetColumn'); this.wtTable.draw(selectionsOnly); this.getSetting('onDraw', !selectionsOnly); return this; }; Walkontable.prototype.update = function (settings, value) { return this.wtSettings.update(settings, value); }; Walkontable.prototype.scrollVertical = function (delta) { return this.wtScroll.scrollVertical(delta); }; Walkontable.prototype.scrollHorizontal = function (delta) { return this.wtScroll.scrollHorizontal(delta); }; Walkontable.prototype.scrollViewport = function (coords) { this.wtScroll.scrollViewport(coords); return this; }; Walkontable.prototype.getViewport = function () { return [ this.wtTable.rowFilter.visibleToSource(0), this.wtTable.columnFilter.visibleToSource(0), this.wtTable.getLastVisibleRow(), this.wtTable.getLastVisibleColumn() ]; }; Walkontable.prototype.getSetting = function (key, param1, param2, param3) { return this.wtSettings.getSetting(key, param1, param2, param3); }; Walkontable.prototype.hasSetting = function (key) { return this.wtSettings.has(key); }; Walkontable.prototype.destroy = function () { $(document.body).off('.' + this.guid); this.wtScrollbars.destroy(); clearTimeout(this.wheelTimeout); clearTimeout(this.dblClickTimeout); }; function WalkontableDom() { } //goes up the DOM tree (including given element) until it finds an element that matches the nodeName WalkontableDom.prototype.closest = function (elem, nodeNames, until) { while (elem != null && elem !== until) { if (elem.nodeType === 1 && nodeNames.indexOf(elem.nodeName) > -1) { return elem; } elem = elem.parentNode; } return null; }; //goes up the DOM tree and checks if element is child of another element WalkontableDom.prototype.isChildOf = function (child, parent) { var node = child.parentNode; while (node != null) { if (node == parent) { return true; } node = node.parentNode; } return false; }; /** * Counts index of element within its parent * WARNING: for performance reasons, assumes there are only element nodes (no text nodes). This is true for Walkotnable * Otherwise would need to check for nodeType or use previousElementSibling * @see http://jsperf.com/sibling-index/10 * @param {Element} elem * @return {Number} */ WalkontableDom.prototype.index = function (elem) { var i = 0; while (elem = elem.previousSibling) { ++i } return i; }; if (document.documentElement.classList) { // HTML5 classList API WalkontableDom.prototype.hasClass = function (ele, cls) { return ele.classList.contains(cls); }; WalkontableDom.prototype.addClass = function (ele, cls) { ele.classList.add(cls); }; WalkontableDom.prototype.removeClass = function (ele, cls) { ele.classList.remove(cls); }; } else { //http://snipplr.com/view/3561/addclass-removeclass-hasclass/ WalkontableDom.prototype.hasClass = function (ele, cls) { return ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)')); }; WalkontableDom.prototype.addClass = function (ele, cls) { if (!this.hasClass(ele, cls)) ele.className += " " + cls; }; WalkontableDom.prototype.removeClass = function (ele, cls) { if (this.hasClass(ele, cls)) { //is this really needed? var reg = new RegExp('(\\s|^)' + cls + '(\\s|$)'); ele.className = ele.className.replace(reg, ' ').replace(/^\s\s*/, '').replace(/\s\s*$/, ''); //last 2 replaces do right trim (see http://blog.stevenlevithan.com/archives/faster-trim-javascript) } }; } /*//http://net.tutsplus.com/tutorials/javascript-ajax/javascript-from-null-cross-browser-event-binding/ WalkontableDom.prototype.addEvent = (function () { var that = this; if (document.addEventListener) { return function (elem, type, cb) { if ((elem && !elem.length) || elem === window) { elem.addEventListener(type, cb, false); } else if (elem && elem.length) { var len = elem.length; for (var i = 0; i < len; i++) { that.addEvent(elem[i], type, cb); } } }; } else { return function (elem, type, cb) { if ((elem && !elem.length) || elem === window) { elem.attachEvent('on' + type, function () { //normalize //http://stackoverflow.com/questions/4643249/cross-browser-event-object-normalization var e = window['event']; e.target = e.srcElement; //e.offsetX = e.layerX; //e.offsetY = e.layerY; e.relatedTarget = e.relatedTarget || e.type == 'mouseover' ? e.fromElement : e.toElement; if (e.target.nodeType === 3) e.target = e.target.parentNode; //Safari bug return cb.call(elem, e) }); } else if (elem.length) { var len = elem.length; for (var i = 0; i < len; i++) { that.addEvent(elem[i], type, cb); } } }; } })(); WalkontableDom.prototype.triggerEvent = function (element, eventName, target) { var event; if (document.createEvent) { event = document.createEvent("MouseEvents"); event.initEvent(eventName, true, true); } else { event = document.createEventObject(); event.eventType = eventName; } event.eventName = eventName; event.target = target; if (document.createEvent) { target.dispatchEvent(event); } else { target.fireEvent("on" + event.eventType, event); } };*/ WalkontableDom.prototype.removeTextNodes = function (elem, parent) { if (elem.nodeType === 3) { parent.removeChild(elem); //bye text nodes! } else if (['TABLE', 'THEAD', 'TBODY', 'TFOOT', 'TR'].indexOf(elem.nodeName) > -1) { var childs = elem.childNodes; for (var i = childs.length - 1; i >= 0; i--) { this.removeTextNodes(childs[i], elem); } } }; /** * Remove childs function * WARNING - this doesn't unload events and data attached by jQuery * http://jsperf.com/jquery-html-vs-empty-vs-innerhtml/9 * http://jsperf.com/jquery-html-vs-empty-vs-innerhtml/11 - no siginificant improvement with Chrome remove() method * @param element * @returns {void} */ // WalkontableDom.prototype.empty = function (element) { var child; while (child = element.lastChild) { element.removeChild(child); } }; WalkontableDom.prototype.HTML_CHARACTERS = /(<(.*)>|&(.*);)/; /** * Insert content into element trying avoid innerHTML method. * @return {void} */ WalkontableDom.prototype.fastInnerHTML = function (element, content) { if (this.HTML_CHARACTERS.test(content)) { element.innerHTML = content; } else { this.fastInnerText(element, content); } }; /** * Insert text content into element * @return {void} */ if (document.createTextNode('test').textContent) { //STANDARDS WalkontableDom.prototype.fastInnerText = function (element, content) { var child = element.firstChild; if (child && child.nodeType === 3 && child.nextSibling === null) { //fast lane - replace existing text node //http://jsperf.com/replace-text-vs-reuse child.textContent = content; } else { //slow lane - empty element and insert a text node this.empty(element); element.appendChild(document.createTextNode(content)); } }; } else { //IE8 WalkontableDom.prototype.fastInnerText = function (element, content) { var child = element.firstChild; if (child && child.nodeType === 3 && child.nextSibling === null) { //fast lane - replace existing text node //http://jsperf.com/replace-text-vs-reuse child.data = content; } else { //slow lane - empty element and insert a text node this.empty(element); element.appendChild(document.createTextNode(content)); } }; } /** * Returns true if element is attached to the DOM and visible, false otherwise * @param elem * @returns {boolean} */ WalkontableDom.prototype.isVisible = function (elem) { //fast method try {//try/catch performance is not a problem here: http://jsperf.com/try-catch-performance-overhead/7 if (!elem.offsetParent) { return false; //fixes problem with UI Bootstrap <tabs> directive } } catch (e) { return false; //IE8 throws "Unspecified error" when offsetParent is not found - we catch it here } // if (elem.offsetWidth > 0 || (elem.parentNode && elem.parentNode.offsetWidth > 0)) { //IE10 was mistaken here if (elem.offsetWidth > 0) { return true; } //slow method var next = elem; while (next !== document.documentElement) { //until <html> reached if (next === null) { //parent detached from DOM return false; } else if (next.nodeType === 11) { return true; } else if (next.style.display === 'none') { return false; } next = next.parentNode; } return true; }; /** * Returns elements top and left offset relative to the document. In our usage case compatible with jQuery but 2x faster * @param {HTMLElement} elem * @return {Object} */ WalkontableDom.prototype.offset = function (elem) { if (this.hasCaptionProblem() && elem.firstChild && elem.firstChild.nodeName === 'CAPTION') { //fixes problem with Firefox ignoring <caption> in TABLE offset (see also WalkontableDom.prototype.outerHeight) //http://jsperf.com/offset-vs-getboundingclientrect/8 var box = elem.getBoundingClientRect(); return { top: box.top + (window.pageYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0), left: box.left + (window.pageXOffset || document.documentElement.scrollLeft) - (document.documentElement.clientLeft || 0) }; } var offsetLeft = elem.offsetLeft , offsetTop = elem.offsetTop , lastElem = elem; while (elem = elem.offsetParent) { if (elem === document.body) { //from my observation, document.body always has scrollLeft/scrollTop == 0 break; } offsetLeft += elem.offsetLeft; offsetTop += elem.offsetTop; lastElem = elem; } if (lastElem && lastElem.style.position === 'fixed') { //slow - http://jsperf.com/offset-vs-getboundingclientrect/6 //if(lastElem !== document.body) { //faster but does gives false positive in Firefox offsetLeft += window.pageXOffset || document.documentElement.scrollLeft; offsetTop += window.pageYOffset || document.documentElement.scrollTop; } return { left: offsetLeft, top: offsetTop }; }; WalkontableDom.prototype.getComputedStyle = function (elem) { return elem.currentStyle || document.defaultView.getComputedStyle(elem); }; WalkontableDom.prototype.outerWidth = function (elem) { return elem.offsetWidth; }; WalkontableDom.prototype.outerHeight = function (elem) { if (this.hasCaptionProblem() && elem.firstChild && elem.firstChild.nodeName === 'CAPTION') { //fixes problem with Firefox ignoring <caption> in TABLE.offsetHeight //jQuery (1.10.1) still has this unsolved //may be better to just switch to getBoundingClientRect //http://bililite.com/blog/2009/03/27/finding-the-size-of-a-table/ //http://lists.w3.org/Archives/Public/www-style/2009Oct/0089.html //http://bugs.jquery.com/ticket/2196 //http://lists.w3.org/Archives/Public/www-style/2009Oct/0140.html#start140 return elem.offsetHeight + elem.firstChild.offsetHeight; } else { return elem.offsetHeight; } }; (function () { var hasCaptionProblem; function detectCaptionProblem() { var TABLE = document.createElement('TABLE'); TABLE.style.borderSpacing = 0; TABLE.style.borderWidth = 0; TABLE.style.padding = 0; var TBODY = document.createElement('TBODY'); TABLE.appendChild(TBODY); TBODY.appendChild(document.createElement('TR')); TBODY.firstChild.appendChild(document.createElement('TD')); TBODY.firstChild.firstChild.innerHTML = '<tr><td>t<br>t</td></tr>'; var CAPTION = document.createElement('CAPTION'); CAPTION.innerHTML = 'c<br>c<br>c<br>c'; CAPTION.style.padding = 0; CAPTION.style.margin = 0; TABLE.insertBefore(CAPTION, TBODY); document.body.appendChild(TABLE); hasCaptionProblem = (TABLE.offsetHeight < 2 * TABLE.lastChild.offsetHeight); //boolean document.body.removeChild(TABLE); } WalkontableDom.prototype.hasCaptionProblem = function () { if (hasCaptionProblem === void 0) { detectCaptionProblem(); } return hasCaptionProblem; }; })(); function WalkontableEvent(instance) { var that = this; //reference to instance this.instance = instance; this.wtDom = this.instance.wtDom; var dblClickOrigin = [null, null, null, null]; this.instance.dblClickTimeout = null; var onMouseDown = function (event) { var cell = that.parentCell(event.target); if (cell.TD && cell.TD.nodeName === 'TD') { if (that.instance.hasSetting('onCellMouseDown')) { that.instance.getSetting('onCellMouseDown', event, cell.coords, cell.TD); } } else if (that.wtDom.hasClass(event.target, 'corner')) { that.instance.getSetting('onCellCornerMouseDown', event, event.target); } if (event.button !== 2) { //if not right mouse button if (cell.TD && cell.TD.nodeName === 'TD') { dblClickOrigin.shift(); dblClickOrigin.push(cell.TD); } else if (that.wtDom.hasClass(event.target, 'corner')) { dblClickOrigin.shift(); dblClickOrigin.push(event.target); } } }; var lastMouseOver; var onMouseOver = function (event) { if (that.instance.hasSetting('onCellMouseOver')) { var TABLE = that.instance.wtTable.TABLE; var TD = that.wtDom.closest(event.target, ['TD', 'TH'], TABLE); if (TD && TD !== lastMouseOver && that.wtDom.isChildOf(TD, TABLE)) { lastMouseOver = TD; if (TD.nodeName === 'TD') { that.instance.getSetting('onCellMouseOver', event, that.instance.wtTable.getCoords(TD), TD); } } } }; /* var lastMouseOut; var onMouseOut = function (event) { if (that.instance.hasSetting('onCellMouseOut')) { var TABLE = that.instance.wtTable.TABLE; var TD = that.wtDom.closest(event.target, ['TD', 'TH'], TABLE); if (TD && TD !== lastMouseOut && that.wtDom.isChildOf(TD, TABLE)) { lastMouseOut = TD; if (TD.nodeName === 'TD') { that.instance.getSetting('onCellMouseOut', event, that.instance.wtTable.getCoords(TD), TD); } } } };*/ var onMouseUp = function (event) { if (event.button !== 2) { //if not right mouse button var cell = that.parentCell(event.target); if (cell.TD && cell.TD.nodeName === 'TD') { dblClickOrigin.shift(); dblClickOrigin.push(cell.TD); } else { dblClickOrigin.shift(); dblClickOrigin.push(event.target); } if (dblClickOrigin[3] !== null && dblClickOrigin[3] === dblClickOrigin[2]) { if (that.instance.dblClickTimeout && dblClickOrigin[2] === dblClickOrigin[1] && dblClickOrigin[1] === dblClickOrigin[0]) { if (cell.TD) { that.instance.getSetting('onCellDblClick', event, cell.coords, cell.TD); } else if (that.wtDom.hasClass(event.target, 'corner')) { that.instance.getSetting('onCellCornerDblClick', event, cell.coords, cell.TD); } clearTimeout(that.instance.dblClickTimeout); that.instance.dblClickTimeout = null; } else { clearTimeout(that.instance.dblClickTimeout); that.instance.dblClickTimeout = setTimeout(function () { that.instance.dblClickTimeout = null; }, 500); } } } }; $(this.instance.wtTable.parent).on('mousedown', onMouseDown); $(this.instance.wtTable.TABLE).on('mouseover', onMouseOver); // $(this.instance.wtTable.TABLE).on('mouseout', onMouseOut); $(this.instance.wtTable.parent).on('mouseup', onMouseUp); } WalkontableEvent.prototype.parentCell = function (elem) { var cell = {}; var TABLE = this.instance.wtTable.TABLE; var TD = this.wtDom.closest(elem, ['TD', 'TH'], TABLE); if (TD && this.wtDom.isChildOf(TD, TABLE)) { cell.coords = this.instance.wtTable.getCoords(TD); cell.TD = TD; } else if (this.wtDom.hasClass(elem, 'wtBorder') && this.wtDom.hasClass(elem, 'current') && !this.wtDom.hasClass(elem, 'corner')) { cell.coords = this.instance.selections.current.selected[0]; cell.TD = this.instance.wtTable.getCell(cell.coords); } return cell; }; function walkontableRangesIntersect() { var from = arguments[0]; var to = arguments[1]; for (var i = 1, ilen = arguments.length / 2; i < ilen; i++) { if (from <= arguments[2 * i + 1] && to >= arguments[2 * i]) { return true; } } return false; } //http://stackoverflow.com/questions/3629183/why-doesnt-indexof-work-on-an-array-ie8 if (!Array.prototype.indexOf) { Array.prototype.indexOf = function (elt /*, from*/) { var len = this.length >>> 0; var from = Number(arguments[1]) || 0; from = (from < 0) ? Math.ceil(from) : Math.floor(from); if (from < 0) from += len; for (; from < len; from++) { if (from in this && this[from] === elt) return from; } return -1; }; } /** * http://notes.jetienne.com/2011/05/18/cancelRequestAnimFrame-for-paul-irish-requestAnimFrame.html */ window.requestAnimFrame = (function () { return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (/* function */ callback, /* DOMElement */ element) { return window.setTimeout(callback, 1000 / 60); }; })(); window.cancelRequestAnimFrame = (function () { return window.cancelAnimationFrame || window.webkitCancelRequestAnimationFrame || window.mozCancelRequestAnimationFrame || window.oCancelRequestAnimationFrame || window.msCancelRequestAnimationFrame || clearTimeout })(); //http://snipplr.com/view/13523/ //modified for speed //http://jsperf.com/getcomputedstyle-vs-style-vs-css/8 if (!window.getComputedStyle) { (function () { var elem; var styleObj = { getPropertyValue: function getPropertyValue(prop) { if (prop == 'float') prop = 'styleFloat'; return elem.currentStyle[prop.toUpperCase()] || null; } } window.getComputedStyle = function (el) { elem = el; return styleObj; } })(); } /** * WalkontableRowFilter * @constructor */ function WalkontableRowFilter() { } WalkontableRowFilter.prototype = new WalkontableCellFilter(); WalkontableRowFilter.prototype.readSettings = function (instance) { this.offset = instance.wtSettings.settings.offsetRow; this.total = instance.getSetting('totalRows'); this.fixedCount = instance.getSetting('fixedRowsTop'); }; /** * WalkontableRowStrategy * @param containerSizeFn * @param sizeAtIndex * @constructor */ function WalkontableRowStrategy(containerSizeFn, sizeAtIndex) { this.containerSizeFn = containerSizeFn; this.sizeAtIndex = sizeAtIndex; this.cellSizesSum = 0; this.cellSizes = []; this.cellCount = 0; this.remainingSize = -Infinity; } WalkontableRowStrategy.prototype = new WalkontableCellStrategy(); WalkontableRowStrategy.prototype.add = function (i, TD, reverse) { if (this.remainingSize < 0) { var size = this.sizeAtIndex(i, TD); if (size === void 0) { return; //total rows exceeded } var containerSize = this.getContainerSize(this.cellSizesSum + size); if (reverse) { this.cellSizes.unshift(size); } else { this.cellSizes.push(size); } this.cellSizesSum += size; this.cellCount++; this.remainingSize = this.cellSizesSum - containerSize; if (reverse && this.remainingSize > 0) { //something is outside of the screen, maybe even some full rows? while (this.cellCount > 0 && this.cellSizes[this.cellCount - 1] < this.remainingSize) { //this row is completely off screen! this.cellSizesSum -= this.cellSizes[this.cellCount - 1]; this.cellCount--; this.cellSizes.length = this.cellCount; //remove it from array } } } }; WalkontableRowStrategy.prototype.remove = function () { var size = this.cellSizes.pop(); this.cellSizesSum -= size; this.cellCount--; this.remainingSize += size; }; function WalkontableScroll(instance) { this.instance = instance; } WalkontableScroll.prototype.scrollVertical = function (delta) { if (!this.instance.drawn) { throw new Error('scrollVertical can only be called after table was drawn to DOM'); } var instance = this.instance , newOffset , offset = instance.getSetting('offsetRow') , fixedCount = instance.getSetting('fixedRowsTop') , total = instance.getSetting('totalRows') , maxSize = instance.wtViewport.getViewportHeight(); if (total > 0) { newOffset = this.scrollLogicVertical(delta, offset, total, fixedCount, maxSize, function (row) { if (row - offset < fixedCount && row - offset >= 0) { return instance.getSetting('rowHeight', row - offset); } else { return instance.getSetting('rowHeight', row); } }, function (isReverse) { instance.wtTable.verticalRenderReverse = isReverse; }); } else { newOffset = 0; } if (newOffset !== offset) { this.instance.wtScrollbars.vertical.scrollTo(newOffset); } return instance; }; WalkontableScroll.prototype.scrollHorizontal = function (delta) { if (!this.instance.drawn) { throw new Error('scrollHorizontal can only be called after table was drawn to DOM'); } var instance = this.instance , newOffset , offset = instance.getSetting('offsetColumn') , fixedCount = instance.getSetting('fixedColumnsLeft') , total = instance.getSetting('totalColumns') , maxSize = instance.wtViewport.getViewportWidth(); if (total > 0) { newOffset = this.scrollLogicHorizontal(delta, offset, total, fixedCount, maxSize, function (col) { if (col - offset < fixedCount && col - offset >= 0) { return instance.getSetting('columnWidth', col - offset); } else { return instance.getSetting('columnWidth', col); } }); } else { newOffset = 0; } if (newOffset !== offset) { this.instance.wtScrollbars.horizontal.scrollTo(newOffset); } return instance; }; WalkontableScroll.prototype.scrollLogicVertical = function (delta, offset, total, fixedCount, maxSize, cellSizeFn, setReverseRenderFn) { var newOffset = offset + delta; if (newOffset >= total - fixedCount) { newOffset = total - fixedCount - 1; setReverseRenderFn(true); } if (newOffset < 0) { newOffset = 0; } return newOffset; }; WalkontableScroll.prototype.scrollLogicHorizontal = function (delta, offset, total, fixedCount, maxSize, cellSizeFn) { var newOffset = offset + delta , sum = 0 , col; if (newOffset > fixedCount) { if (newOffset >= total - fixedCount) { newOffset = total - fixedCount - 1; } col = newOffset; while (sum < maxSize && col < total) { sum += cellSizeFn(col); col++; } if (sum < maxSize) { while (newOffset > 0) { //if sum still less than available width, we cannot scroll that far (must move offset to the left) sum += cellSizeFn(newOffset - 1); if (sum < maxSize) { newOffset--; } else { break; } } } } else if (newOffset < 0) { newOffset = 0; } return newOffset; }; /** * Scrolls viewport to a cell by minimum number of cells */ WalkontableScroll.prototype.scrollViewport = function (coords) { var offsetRow = this.instance.getSetting('offsetRow') , offsetColumn = this.instance.getSetting('offsetColumn') , lastVisibleRow = this.instance.wtTable.getLastVisibleRow() , totalRows = this.instance.getSetting('totalRows') , totalColumns = this.instance.getSetting('totalColumns') , fixedRowsTop = this.instance.getSetting('fixedRowsTop') , fixedColumnsLeft = this.instance.getSetting('fixedColumnsLeft'); if (coords[0] < 0 || coords[0] > totalRows - 1) { throw new Error('row ' + coords[0] + ' does not exist'); } else if (coords[1] < 0 || coords[1] > totalColumns - 1) { throw new Error('column ' + coords[1] + ' does not exist'); } if (coords[0] > lastVisibleRow) { // this.scrollVertical(coords[0] - lastVisibleRow + 1); this.scrollVertical(coords[0] - fixedRowsTop - offsetRow); this.instance.wtTable.verticalRenderReverse = true; } else if (coords[0] === lastVisibleRow && this.instance.wtTable.rowStrategy.isLastIncomplete()) { // this.scrollVertical(coords[0] - lastVisibleRow + 1); this.scrollVertical(coords[0] - fixedRowsTop - offsetRow); this.instance.wtTable.verticalRenderReverse = true; } else if (coords[0] - fixedRowsTop < offsetRow) { this.scrollVertical(coords[0] - fixedRowsTop - offsetRow); } else { this.scrollVertical(0); //Craig's issue: remove row from the last scroll page should scroll viewport a row up if needed } if (this.instance.wtTable.isColumnBeforeViewport(coords[1])) { //scroll left this.instance.wtScrollbars.horizontal.scrollTo(coords[1] - fixedColumnsLeft); } else if (this.instance.wtTable.isColumnAfterViewport(coords[1]) || (this.instance.wtTable.getLastVisibleColumn() === coords[1] && !this.instance.wtTable.isLastColumnFullyVisible())) { //scroll right var sum = 0; for (var i = 0; i < fixedColumnsLeft; i++) { sum += this.instance.getSetting('columnWidth', i); } var scrollTo = coords[1]; sum += this.instance.getSetting('columnWidth', scrollTo); var available = this.instance.wtViewport.getViewportWidth(); if (sum < available) { var next = this.instance.getSetting('columnWidth', scrollTo - 1); while (sum + next < available && scrollTo >= fixedColumnsLeft) { scrollTo--; sum += next; } } this.instance.wtScrollbars.horizontal.scrollTo(scrollTo - fixedColumnsLeft); } /*else { //no scroll }*/ return this.instance; }; function WalkontableScrollbar() { } WalkontableScrollbar.prototype.init = function () { var that = this; //reference to instance this.$table = $(this.instance.wtTable.TABLE); //create elements this.slider = document.createElement('DIV'); this.sliderStyle = this.slider.style; this.sliderStyle.position = 'absolute'; this.sliderStyle.top = '0'; this.sliderStyle.left = '0'; this.sliderStyle.display = 'none'; this.slider.className = 'dragdealer ' + this.type; this.handle = document.createElement('DIV'); this.handleStyle = this.handle.style; this.handle.className = 'handle'; this.slider.appendChild(this.handle); this.container = this.instance.wtTable.parent; this.container.appendChild(this.slider); var firstRun = true; this.dragTimeout = null; var dragDelta; var dragRender = function () { that.onScroll(dragDelta); }; this.dragdealer = new Dragdealer(this.slider, { vertical: (this.type === 'vertical'), horizontal: (this.type === 'horizontal'), slide: false, speed: 100, animationCallback: function (x, y) { if (firstRun) { firstRun = false; return; } that.skipRefresh = true; dragDelta = that.type === 'vertical' ? y : x; if (that.dragTimeout === null) { that.dragTimeout = setInterval(dragRender, 100); dragRender(); } }, callback: function (x, y) { that.skipRefresh = false; clearInterval(that.dragTimeout); that.dragTimeout = null; dragDelta = that.type === 'vertical' ? y : x; that.onScroll(dragDelta); } }); this.skipRefresh = false; }; WalkontableScrollbar.prototype.onScroll = function (delta) { if (this.instance.drawn) { this.readSettings(); if (this.total > this.visibleCount) { var newOffset = Math.round(this.handlePosition * this.total / this.sliderSize); if (delta === 1) { if (this.type === 'vertical') { this.instance.scrollVertical(Infinity).draw(); } else { this.instance.scrollHorizontal(Infinity).draw(); } } else if (newOffset !== this.offset) { //is new offset different than old offset if (this.type === 'vertical') { this.instance.scrollVertical(newOffset - this.offset).draw(); } else { this.instance.scrollHorizontal(newOffset - this.offset).draw(); } } else { this.refresh(); } } } }; /** * Returns what part of the scroller should the handle take * @param viewportCount {Number} number of visible rows or columns * @param totalCount {Number} total number of rows or columns * @return {Number} 0..1 */ WalkontableScrollbar.prototype.getHandleSizeRatio = function (viewportCount, totalCount) { if (!totalCount || viewportCount > totalCount || viewportCount == totalCount) { return 1; } return 1 / totalCount; }; WalkontableScrollbar.prototype.prepare = function () { if (this.skipRefresh) { return; } var ratio = this.getHandleSizeRatio(this.visibleCount, this.total); if (((ratio === 1 || isNaN(ratio)) && this.scrollMode === 'auto') || this.scrollMode === 'none') { //isNaN is needed because ratio equals NaN when totalRows/totalColumns equals 0 this.visible = false; } else { this.visible = true; } }; WalkontableScrollbar.prototype.refresh = function () { if (this.skipRefresh) { return; } else if (!this.visible) { this.sliderStyle.display = 'none'; return; } var ratio , sliderSize , handleSize , handlePosition , visibleCount = this.visibleCount , tableWidth = this.instance.wtViewport.getWorkspaceWidth() , tableHeight = this.instance.wtViewport.getWorkspaceHeight(); if (tableWidth === Infinity) { tableWidth = this.instance.wtViewport.getWorkspaceActualWidth(); } if (tableHeight === Infinity) { tableHeight = this.instance.wtViewport.getWorkspaceActualHeight(); } if (this.type === 'vertical') { if (this.instance.wtTable.rowStrategy.isLastIncomplete()) { visibleCount--; } sliderSize = tableHeight - 2; //2 is sliders border-width this.sliderStyle.top = this.instance.wtDom.offset(this.$table[0]).top - this.instance.wtDom.offset(this.container).top + 'px'; this.sliderStyle.left = tableWidth - 1 + 'px'; //1 is sliders border-width this.sliderStyle.height = Math.max(sliderSize, 0) + 'px'; } else { //horizontal sliderSize = tableWidth - 2; //2 is sliders border-width this.sliderStyle.left = this.instance.wtDom.offset(this.$table[0]).left - this.instance.wtDom.offset(this.container).left + 'px'; this.sliderStyle.top = tableHeight - 1 + 'px'; //1 is sliders border-width this.sliderStyle.width = Math.max(sliderSize, 0) + 'px'; } ratio = this.getHandleSizeRatio(visibleCount, this.total); handleSize = Math.round(sliderSize * ratio); if (handleSize < 10) { handleSize = 15; } handlePosition = Math.floor(sliderSize * (this.offset / this.total)); if (handleSize + handlePosition > sliderSize) { handlePosition = sliderSize - handleSize; } if (this.type === 'vertical') { this.handleStyle.height = handleSize + 'px'; this.handleStyle.top = handlePosition + 'px'; } else { //horizontal this.handleStyle.width = handleSize + 'px'; this.handleStyle.left = handlePosition + 'px'; } this.sliderStyle.display = 'block'; }; WalkontableScrollbar.prototype.destroy = function () { clearInterval(this.dragdealer.interval); }; /// var WalkontableVerticalScrollbar = function (instance) { this.instance = instance; this.type = 'vertical'; this.init(); }; WalkontableVerticalScrollbar.prototype = new WalkontableScrollbar(); WalkontableVerticalScrollbar.prototype.scrollTo = function (cell) { this.instance.update('offsetRow', cell); }; WalkontableVerticalScrollbar.prototype.readSettings = function () { this.scrollMode = this.instance.getSetting('scrollV'); this.offset = this.instance.getSetting('offsetRow'); this.total = this.instance.getSetting('totalRows'); this.visibleCount = this.instance.wtTable.rowStrategy.countVisible(); if(this.visibleCount > 1 && this.instance.wtTable.rowStrategy.isLastIncomplete()) { this.visibleCount--; } this.handlePosition = parseInt(this.handleStyle.top, 10); this.sliderSize = parseInt(this.sliderStyle.height, 10); this.fixedCount = this.instance.getSetting('fixedRowsTop'); }; /// var WalkontableHorizontalScrollbar = function (instance) { this.instance = instance; this.type = 'horizontal'; this.init(); }; WalkontableHorizontalScrollbar.prototype = new WalkontableScrollbar(); WalkontableHorizontalScrollbar.prototype.scrollTo = function (cell) { this.instance.update('offsetColumn', cell); }; WalkontableHorizontalScrollbar.prototype.readSettings = function () { this.scrollMode = this.instance.getSetting('scrollH'); this.offset = this.instance.getSetting('offsetColumn'); this.total = this.instance.getSetting('totalColumns'); this.visibleCount = this.instance.wtTable.columnStrategy.countVisible(); if(this.visibleCount > 1 && this.instance.wtTable.columnStrategy.isLastIncomplete()) { this.visibleCount--; } this.handlePosition = parseInt(this.handleStyle.left, 10); this.sliderSize = parseInt(this.sliderStyle.width, 10); this.fixedCount = this.instance.getSetting('fixedColumnsLeft'); }; WalkontableHorizontalScrollbar.prototype.getHandleSizeRatio = function (viewportCount, totalCount) { if (!totalCount || viewportCount > totalCount || viewportCount == totalCount) { return 1; } return viewportCount / totalCount; }; function WalkontableScrollbarNative() { this.lastWindowScrollPosition = NaN; } WalkontableScrollbarNative.prototype.init = function () { this.fixedContainer = this.instance.wtTable.TABLE.parentNode.parentNode.parentNode; this.fixed = this.instance.wtTable.TABLE.parentNode.parentNode; this.TABLE = this.instance.wtTable.TABLE; this.$scrollHandler = $(window); //in future remove jQuery from here var that = this; this.$scrollHandler.on('scroll.walkontable', function () { if (!that.instance.wtTable.parent.parentNode) { //Walkontable was detached from DOM, but this handler was not removed that.destroy(); return; } that.onScroll(); }); this.readSettings(); }; WalkontableScrollbarNative.prototype.onScroll = function () { this.readSettings(); if (this.windowScrollPosition === this.lastWindowScrollPosition) { return; } this.lastWindowScrollPosition = this.windowScrollPosition; var scrollDelta; var newOffset = 0; if (this.windowScrollPosition > this.tableParentOffset) { scrollDelta = this.windowScrollPosition - this.tableParentOffset; newOffset = Math.ceil(scrollDelta / 20, 10); newOffset = Math.min(newOffset, this.total) } this.instance.update('offsetRow', newOffset); this.instance.draw(); }; WalkontableScrollbarNative.prototype.prepare = function () { }; WalkontableScrollbarNative.prototype.availableSize = function () { var availableSize; //var last = this.getLastCell(); if (this.windowScrollPosition > this.tableParentOffset /*&& last > -1*/) { //last -1 means that viewport is scrolled behind the table if (this.instance.wtTable.getLastVisibleRow() === this.total - 1) { availableSize = this.instance.wtDom.outerHeight(this.TABLE); } else { availableSize = this.windowSize; } } else { availableSize = this.windowSize - (this.tableParentOffset - this.windowScrollPosition); } return availableSize; }; WalkontableScrollbarNative.prototype.refresh = function () { var last = this.getLastCell(); this.measureBefore = this.offset * this.cellSize; this.measureInside = this.getTableSize(); if (last === -1) { //last -1 means that viewport is scrolled behind the table this.measureAfter = 0; } else { this.measureAfter = (this.total - last - 1) * this.cellSize; } this.applyToDOM(); }; WalkontableScrollbarNative.prototype.destroy = function () { this.$scrollHandler.off('scroll.walkontable'); }; /// var WalkontableVerticalScrollbarNative = function (instance) { this.instance = instance; this.type = 'vertical'; this.cellSize = 20; this.init(); }; WalkontableVerticalScrollbarNative.prototype = new WalkontableScrollbarNative(); WalkontableVerticalScrollbarNative.prototype.getLastCell = function () { return this.instance.wtTable.getLastVisibleRow(); }; WalkontableVerticalScrollbarNative.prototype.getTableSize = function () { return this.instance.wtDom.outerHeight(this.TABLE); }; WalkontableVerticalScrollbarNative.prototype.applyToDOM = function () { if (this.windowScrollPosition > this.tableParentOffset /*&& last > -1*/) { //last -1 means that viewport is scrolled behind the table this.fixed.style.position = 'fixed'; this.fixed.style.top = '0'; this.fixed.style.left = this.tableParentOtherOffset; } else { this.fixed.style.position = 'relative'; } var debug = false; if (debug) { //this.fixedContainer.style.borderTop = this.measureBefore + 'px solid red'; //this.fixedContainer.style.borderBottom = (this.tableSize + this.measureAfter) + 'px solid blue'; } else { this.fixedContainer.style.paddingTop = this.measureBefore + 'px'; this.fixedContainer.style.paddingBottom = (this.measureInside + this.measureAfter) + 'px'; } }; WalkontableVerticalScrollbarNative.prototype.scrollTo = function (cell) { this.$scrollHandler.scrollTop(this.tableParentOffset + cell * this.cellSize); }; WalkontableVerticalScrollbarNative.prototype.readSettings = function () { var offset = this.instance.wtDom.offset(this.fixedContainer); this.tableParentOffset = offset.top; this.tableParentOtherOffset = offset.left; this.windowSize = this.$scrollHandler.height(); this.windowScrollPosition = this.$scrollHandler.scrollTop(); this.offset = this.instance.getSetting('offsetRow'); this.total = this.instance.getSetting('totalRows'); }; /// var WalkontableHorizontalScrollbarNative = function (instance) { this.instance = instance; this.type = 'horizontal'; this.cellSize = 50; this.init(); }; WalkontableHorizontalScrollbarNative.prototype = new WalkontableScrollbarNative(); WalkontableHorizontalScrollbarNative.prototype.getLastCell = function () { return this.instance.wtTable.getLastVisibleColumn(); }; WalkontableHorizontalScrollbarNative.prototype.getTableSize = function () { return this.instance.wtDom.outerWidth(this.TABLE); }; WalkontableHorizontalScrollbarNative.prototype.applyToDOM = function () { if (this.windowScrollPosition > this.tableParentOffset /*&& last > -1*/) { //last -1 means that viewport is scrolled behind the table this.fixed.style.position = 'fixed'; this.fixed.style.left = '0'; this.fixed.style.top = this.tableParentOtherOffset; } else { this.fixed.style.position = 'relative'; } var debug = false; if (debug) { //this.fixedContainer.style.borderLeft = this.measureBefore + 'px solid red'; //this.fixedContainer.style.borderBottom = (this.tableSize + this.measureAfter) + 'px solid blue'; } else { this.fixedContainer.style.paddingLeft = this.measureBefore + 'px'; this.fixedContainer.style.paddingRight = (this.measureInside + this.measureAfter) + 'px'; } }; WalkontableHorizontalScrollbarNative.prototype.scrollTo = function (cell) { this.$scrollHandler.scrollLeft(this.tableParentOffset + cell * this.cellSize); }; WalkontableHorizontalScrollbarNative.prototype.readSettings = function () { var offset = this.instance.wtDom.offset(this.fixedContainer); this.tableParentOffset = offset.left; this.tableParentOtherOffset = offset.top; this.windowSize = this.$scrollHandler.width(); this.windowScrollPosition = this.$scrollHandler.scrollLeft(); this.offset = this.instance.getSetting('offsetColumn'); this.total = this.instance.getSetting('totalColumns'); }; function WalkontableScrollbars(instance) { switch (instance.getSetting('scrollbarModelV')) { case 'dragdealer': this.vertical = new WalkontableVerticalScrollbar(instance); break; case 'native': this.vertical = new WalkontableVerticalScrollbarNative(instance); break; } switch (instance.getSetting('scrollbarModelH')) { case 'dragdealer': this.horizontal = new WalkontableHorizontalScrollbar(instance); break; case 'native': this.horizontal = new WalkontableHorizontalScrollbarNative(instance); break; } } WalkontableScrollbars.prototype.destroy = function () { this.vertical.destroy(); this.horizontal.destroy(); }; WalkontableScrollbars.prototype.refresh = function () { this.horizontal.readSettings(); this.vertical.readSettings(); this.horizontal.prepare(); this.vertical.prepare(); this.horizontal.refresh(); this.vertical.refresh(); }; function WalkontableSelection(instance, settings) { this.instance = instance; this.settings = settings; this.selected = []; if (settings.border) { this.border = new WalkontableBorder(instance, settings); } } WalkontableSelection.prototype.add = function (coords) { this.selected.push(coords); }; WalkontableSelection.prototype.clear = function () { this.selected.length = 0; //http://jsperf.com/clear-arrayxxx }; /** * Returns the top left (TL) and bottom right (BR) selection coordinates * @returns {Object} */ WalkontableSelection.prototype.getCorners = function () { var minRow , minColumn , maxRow , maxColumn , i , ilen = this.selected.length; if (ilen > 0) { minRow = maxRow = this.selected[0][0]; minColumn = maxColumn = this.selected[0][1]; if (ilen > 1) { for (i = 1; i < ilen; i++) { if (this.selected[i][0] < minRow) { minRow = this.selected[i][0]; } else if (this.selected[i][0] > maxRow) { maxRow = this.selected[i][0]; } if (this.selected[i][1] < minColumn) { minColumn = this.selected[i][1]; } else if (this.selected[i][1] > maxColumn) { maxColumn = this.selected[i][1]; } } } } return [minRow, minColumn, maxRow, maxColumn]; }; WalkontableSelection.prototype.draw = function () { var corners, r, c, source_r, source_c; var visibleRows = this.instance.wtTable.rowStrategy.countVisible() , visibleColumns = this.instance.wtTable.columnStrategy.countVisible(); if (this.selected.length) { corners = this.getCorners(); for (r = 0; r < visibleRows; r++) { for (c = 0; c < visibleColumns; c++) { source_r = this.instance.wtTable.rowFilter.visibleToSource(r); source_c = this.instance.wtTable.columnFilter.visibleToSource(c); if (source_r >= corners[0] && source_r <= corners[2] && source_c >= corners[1] && source_c <= corners[3]) { //selected cell this.instance.wtTable.currentCellCache.add(r, c, this.settings.className); } else if (source_r >= corners[0] && source_r <= corners[2]) { //selection is in this row this.instance.wtTable.currentCellCache.add(r, c, this.settings.highlightRowClassName); } else if (source_c >= corners[1] && source_c <= corners[3]) { //selection is in this column this.instance.wtTable.currentCellCache.add(r, c, this.settings.highlightColumnClassName); } } } this.border && this.border.appear(corners); //warning! border.appear modifies corners! } else { this.border && this.border.disappear(); } }; function WalkontableSettings(instance, settings) { var that = this; this.instance = instance; //default settings. void 0 means it is required, null means it can be empty this.defaults = { table: void 0, //presentation mode scrollH: 'auto', //values: scroll (always show scrollbar), auto (show scrollbar if table does not fit in the container), none (never show scrollbar) scrollV: 'auto', //values: see above scrollbarModelH: 'dragdealer', //values: dragdealer, native scrollbarModelV: 'dragdealer', //values: dragdealer, native stretchH: 'hybrid', //values: hybrid, all, last, none currentRowClassName: null, currentColumnClassName: null, //data source data: void 0, offsetRow: 0, offsetColumn: 0, fixedColumnsLeft: 0, fixedRowsTop: 0, rowHeaders: function () { return [] }, //this must be array of functions: [function (row, TH) {}] columnHeaders: function () { return [] }, //this must be array of functions: [function (column, TH) {}] totalRows: void 0, totalColumns: void 0, width: null, height: null, cellRenderer: function (row, column, TD) { var cellData = that.getSetting('data', row, column); that.instance.wtDom.fastInnerText(TD, cellData === void 0 || cellData === null ? '' : cellData); }, columnWidth: 50, selections: null, hideBorderOnMouseDownOver: false, //callbacks onCellMouseDown: null, onCellMouseOver: null, // onCellMouseOut: null, onCellDblClick: null, onCellCornerMouseDown: null, onCellCornerDblClick: null, beforeDraw: null, onDraw: null, //constants scrollbarWidth: 10, scrollbarHeight: 10 }; //reference to settings this.settings = {}; for (var i in this.defaults) { if (this.defaults.hasOwnProperty(i)) { if (settings[i] !== void 0) { this.settings[i] = settings[i]; } else if (this.defaults[i] === void 0) { throw new Error('A required setting "' + i + '" was not provided'); } else { this.settings[i] = this.defaults[i]; } } } } /** * generic methods */ WalkontableSettings.prototype.update = function (settings, value) { if (value === void 0) { //settings is object for (var i in settings) { if (settings.hasOwnProperty(i)) { this.settings[i] = settings[i]; } } } else { //if value is defined then settings is the key this.settings[settings] = value; } return this.instance; }; WalkontableSettings.prototype.getSetting = function (key, param1, param2, param3) { if (this[key]) { return this[key](param1, param2, param3); } else { return this._getSetting(key, param1, param2, param3); } }; WalkontableSettings.prototype._getSetting = function (key, param1, param2, param3) { if (typeof this.settings[key] === 'function') { return this.settings[key](param1, param2, param3); } else if (param1 !== void 0 && Object.prototype.toString.call(this.settings[key]) === '[object Array]') { return this.settings[key][param1]; } else { return this.settings[key]; } }; WalkontableSettings.prototype.has = function (key) { return !!this.settings[key] }; /** * specific methods */ WalkontableSettings.prototype.rowHeight = function (row) { var visible_r = this.instance.wtTable.rowFilter.sourceToVisible(row); var size = this.instance.wtTable.rowStrategy.getSize(visible_r); if (size !== void 0) { return size; } return 20; }; /*var FLAG_VISIBLE_HORIZONTAL = 0x1; // 000001 var FLAG_VISIBLE_VERTICAL = 0x2; // 000010 var FLAG_PARTIALLY_VISIBLE_HORIZONTAL = 0x4; // 000100 var FLAG_PARTIALLY_VISIBLE_VERTICAL = 0x8; // 001000 var FLAG_NOT_VISIBLE_HORIZONTAL = 0x10; // 010000 var FLAG_NOT_VISIBLE_VERTICAL = 0x20; // 100000*/ function WalkontableTable(instance) { //reference to instance this.instance = instance; this.TABLE = this.instance.getSetting('table'); this.wtDom = this.instance.wtDom; this.wtDom.removeTextNodes(this.TABLE); //wtSpreader var parent = this.TABLE.parentNode; if (!parent || parent.nodeType !== 1 || !this.wtDom.hasClass(parent, 'wtHolder')) { var spreader = document.createElement('DIV'); spreader.className = 'wtSpreader'; if (parent) { parent.insertBefore(spreader, this.TABLE); //if TABLE is detached (e.g. in Jasmine test), it has no parentNode so we cannot attach holder to it } spreader.appendChild(this.TABLE); } this.spreader = this.TABLE.parentNode; //wtHider parent = this.spreader.parentNode; if (!parent || parent.nodeType !== 1 || !this.wtDom.hasClass(parent, 'wtHolder')) { var hider = document.createElement('DIV'); hider.className = 'wtHider'; if (parent) { parent.insertBefore(hider, this.spreader); //if TABLE is detached (e.g. in Jasmine test), it has no parentNode so we cannot attach holder to it } hider.appendChild(this.spreader); } this.hider = this.spreader.parentNode; this.hiderStyle = this.hider.style; this.hiderStyle.position = 'relative'; //wtHolder parent = this.hider.parentNode; if (!parent || parent.nodeType !== 1 || !this.wtDom.hasClass(parent, 'wtHolder')) { var holder = document.createElement('DIV'); holder.style.position = 'relative'; holder.className = 'wtHolder'; if (parent) { parent.insertBefore(holder, this.hider); //if TABLE is detached (e.g. in Jasmine test), it has no parentNode so we cannot attach holder to it } holder.appendChild(this.hider); } this.parent = this.hider.parentNode; //bootstrap from settings this.TBODY = this.TABLE.getElementsByTagName('TBODY')[0]; if (!this.TBODY) { this.TBODY = document.createElement('TBODY'); this.TABLE.appendChild(this.TBODY); } this.THEAD = this.TABLE.getElementsByTagName('THEAD')[0]; if (!this.THEAD) { this.THEAD = document.createElement('THEAD'); this.TABLE.insertBefore(this.THEAD, this.TBODY); } this.COLGROUP = this.TABLE.getElementsByTagName('COLGROUP')[0]; if (!this.COLGROUP) { this.COLGROUP = document.createElement('COLGROUP'); this.TABLE.insertBefore(this.COLGROUP, this.THEAD); } if (this.instance.getSetting('columnHeaders').length) { if (!this.THEAD.childNodes.length) { var TR = document.createElement('TR'); this.THEAD.appendChild(TR); } } this.colgroupChildrenLength = this.COLGROUP.childNodes.length; this.theadChildrenLength = this.THEAD.firstChild ? this.THEAD.firstChild.childNodes.length : 0; this.tbodyChildrenLength = this.TBODY.childNodes.length; this.oldCellCache = new WalkontableClassNameCache(); this.currentCellCache = new WalkontableClassNameCache(); this.rowFilter = new WalkontableRowFilter(); this.columnFilter = new WalkontableColumnFilter(); this.verticalRenderReverse = false; } WalkontableTable.prototype.refreshHiderDimensions = function () { var height = this.instance.wtViewport.getWorkspaceHeight(); var width = this.instance.wtViewport.getWorkspaceWidth(); var spreaderStyle = this.spreader.style; if (height !== Infinity || width !== Infinity) { if (height === Infinity) { height = this.instance.wtViewport.getWorkspaceActualHeight(); } if (width === Infinity) { width = this.instance.wtViewport.getWorkspaceActualWidth(); } this.hiderStyle.overflow = 'hidden'; spreaderStyle.position = 'absolute'; spreaderStyle.top = '0'; spreaderStyle.left = '0'; if (this.instance.getSetting('scrollbarModelV') === 'dragdealer') { spreaderStyle.height = '4000px'; } if (this.instance.getSetting('scrollbarModelH') === 'dragdealer') { spreaderStyle.width = '4000px'; } if (height < 0) { //this happens with WalkontableScrollbarNative and causes "Invalid argument" error in IE8 height = 0; } this.hiderStyle.height = height + 'px'; this.hiderStyle.width = width + 'px'; } else { spreaderStyle.position = 'relative'; spreaderStyle.width = 'auto'; spreaderStyle.height = 'auto'; } }; WalkontableTable.prototype.refreshStretching = function () { var instance = this.instance , stretchH = instance.getSetting('stretchH') , totalRows = instance.getSetting('totalRows') , totalColumns = instance.getSetting('totalColumns') , offsetColumn = instance.getSetting('offsetColumn'); var containerWidthFn = function (cacheWidth) { return that.instance.wtViewport.getViewportWidth(cacheWidth); }; var that = this; var columnWidthFn = function (i) { var source_c = that.columnFilter.visibleToSource(i); if (source_c < totalColumns) { return instance.getSetting('columnWidth', source_c); } }; if (stretchH === 'hybrid') { if (offsetColumn > 0) { stretchH = 'last'; } else { stretchH = 'none'; } } var containerHeightFn = function (cacheHeight) { return that.instance.wtViewport.getViewportHeight(cacheHeight); }; var rowHeightFn = function (i, TD) { var source_r = that.rowFilter.visibleToSource(i); if (source_r < totalRows) { if (that.verticalRenderReverse && i === 0) { return that.wtDom.outerHeight(TD) - 1; } else { return that.wtDom.outerHeight(TD); } } }; this.columnStrategy = new WalkontableColumnStrategy(containerWidthFn, columnWidthFn, stretchH); this.rowStrategy = new WalkontableRowStrategy(containerHeightFn, rowHeightFn); }; WalkontableTable.prototype.adjustAvailableNodes = function () { var displayTds , rowHeaders = this.instance.getSetting('rowHeaders') , displayThs = rowHeaders.length , columnHeaders = this.instance.getSetting('columnHeaders') , TR , TD , c; //adjust COLGROUP while (this.colgroupChildrenLength < displayThs) { this.COLGROUP.appendChild(document.createElement('COL')); this.colgroupChildrenLength++; } this.refreshStretching(); displayTds = this.columnStrategy.cellCount; //adjust COLGROUP while (this.colgroupChildrenLength < displayTds + displayThs) { this.COLGROUP.appendChild(document.createElement('COL')); this.colgroupChildrenLength++; } while (this.colgroupChildrenLength > displayTds + displayThs) { this.COLGROUP.removeChild(this.COLGROUP.lastChild); this.colgroupChildrenLength--; } //adjust THEAD TR = this.THEAD.firstChild; if (columnHeaders.length) { if (!TR) { TR = document.createElement('TR'); this.THEAD.appendChild(TR); } this.theadChildrenLength = TR.childNodes.length; while (this.theadChildrenLength < displayTds + displayThs) { TR.appendChild(document.createElement('TH')); this.theadChildrenLength++; } while (this.theadChildrenLength > displayTds + displayThs) { TR.removeChild(TR.lastChild); this.theadChildrenLength--; } } else if (TR) { this.wtDom.empty(TR); } //draw COLGROUP for (c = 0; c < this.colgroupChildrenLength; c++) { if (c < displayThs) { this.wtDom.addClass(this.COLGROUP.childNodes[c], 'rowHeader'); } else { this.wtDom.removeClass(this.COLGROUP.childNodes[c], 'rowHeader'); } } //draw THEAD if (columnHeaders.length) { TR = this.THEAD.firstChild; if (displayThs) { TD = TR.firstChild; //actually it is TH but let's reuse single variable for (c = 0; c < displayThs; c++) { rowHeaders[c](-displayThs + c, TD); TD = TD.nextSibling; } } } for (c = 0; c < displayTds; c++) { if (columnHeaders.length) { columnHeaders[0](this.columnFilter.visibleToSource(c), TR.childNodes[displayThs + c]); } } }; WalkontableTable.prototype.adjustColumns = function (TR, desiredCount) { var count = TR.childNodes.length; while (count < desiredCount) { var TD = document.createElement('TD'); TR.appendChild(TD); count++; } while (count > desiredCount) { TR.removeChild(TR.lastChild); count--; } }; WalkontableTable.prototype.draw = function (selectionsOnly) { this.rowFilter.readSettings(this.instance); this.columnFilter.readSettings(this.instance); if (!selectionsOnly) { this.tableOffset = this.wtDom.offset(this.TABLE); this._doDraw(); } else { this.instance.wtScrollbars.refresh(); } this.refreshPositions(selectionsOnly); this.instance.drawn = true; return this; }; WalkontableTable.prototype._doDraw = function () { var r = 0 , source_r , c , source_c , offsetRow = this.instance.getSetting('offsetRow') , totalRows = this.instance.getSetting('totalRows') , totalColumns = this.instance.getSetting('totalColumns') , displayTds , rowHeaders = this.instance.getSetting('rowHeaders') , displayThs = rowHeaders.length , TR , TD , TH , adjusted = false , workspaceWidth , mustBeInViewport; if (this.verticalRenderReverse) { mustBeInViewport = offsetRow; } this.instance.wtViewport.resetSettings(); var noPartial = false; if (this.verticalRenderReverse) { if (offsetRow === totalRows - this.rowFilter.fixedCount - 1) { noPartial = true; } else { this.instance.update('offsetRow', offsetRow + 1); //if we are scrolling reverse this.rowFilter.readSettings(this.instance); } } //draw TBODY if (totalColumns > 0) { source_r = this.rowFilter.visibleToSource(r); var first = true; while (source_r < totalRows && source_r >= 0) { if (r >= this.tbodyChildrenLength || (this.verticalRenderReverse && r >= this.rowFilter.fixedCount)) { TR = document.createElement('TR'); for (c = 0; c < displayThs; c++) { TR.appendChild(document.createElement('TH')); } if (this.verticalRenderReverse && r >= this.rowFilter.fixedCount) { this.TBODY.insertBefore(TR, this.TBODY.childNodes[this.rowFilter.fixedCount] || this.TBODY.firstChild); } else { this.TBODY.appendChild(TR); } this.tbodyChildrenLength++; } else if (r === 0) { TR = this.TBODY.firstChild; } else { TR = TR.nextSibling; //http://jsperf.com/nextsibling-vs-indexed-childnodes } //TH TH = TR.firstChild; for (c = 0; c < displayThs; c++) { //If the number of row headers increased we need to replace TD with TH if (TH.nodeName == 'TD') { TD = TH; TH = document.createElement('TH'); TR.insertBefore(TH, TD); TR.removeChild(TD); } rowHeaders[c](source_r, TH); //actually TH TH = TH.nextSibling; //http://jsperf.com/nextsibling-vs-indexed-childnodes } if (first) { // if (r === 0) { first = false; this.adjustAvailableNodes(); adjusted = true; displayTds = this.columnStrategy.cellCount; //TD this.adjustColumns(TR, displayTds + displayThs); workspaceWidth = this.instance.wtViewport.getWorkspaceWidth(); this.columnStrategy.stretch(); for (c = 0; c < displayTds; c++) { this.COLGROUP.childNodes[c + displayThs].style.width = this.columnStrategy.getSize(c) + 'px'; } } else { //TD this.adjustColumns(TR, displayTds + displayThs); } for (c = 0; c < displayTds; c++) { source_c = this.columnFilter.visibleToSource(c); if (c === 0) { TD = TR.childNodes[this.columnFilter.sourceColumnToVisibleRowHeadedColumn(source_c)]; } else { TD = TD.nextSibling; //http://jsperf.com/nextsibling-vs-indexed-childnodes } //If the number of headers has been reduced, we need to replace excess TH with TD if (TD.nodeName == 'TH') { TH = TD; TD = document.createElement('TD'); TR.insertBefore(TD, TH); TR.removeChild(TH); } TD.className = ''; TD.removeAttribute('style'); this.instance.getSetting('cellRenderer', source_r, source_c, TD); } offsetRow = this.instance.getSetting('offsetRow'); //refresh the value //after last column is rendered, check if last cell is fully displayed if (this.verticalRenderReverse && noPartial) { if (-this.wtDom.outerHeight(TR.firstChild) < this.rowStrategy.remainingSize) { this.TBODY.removeChild(TR); this.instance.update('offsetRow', offsetRow + 1); this.tbodyChildrenLength--; this.rowFilter.readSettings(this.instance); break; } else { this.rowStrategy.add(r, TD, this.verticalRenderReverse); } } else { this.rowStrategy.add(r, TD, this.verticalRenderReverse); if (this.rowStrategy.isLastIncomplete()) { if (this.verticalRenderReverse && !this.isRowInViewport(mustBeInViewport)) { //we failed because one of the cells was by far too large. Recover by rendering from top this.verticalRenderReverse = false; this.instance.update('offsetRow', mustBeInViewport); this.draw(); return; } break; } } if (this.verticalRenderReverse && r >= this.rowFilter.fixedCount) { if (offsetRow === 0) { break; } this.instance.update('offsetRow', offsetRow - 1); this.rowFilter.readSettings(this.instance); } else { r++; } source_r = this.rowFilter.visibleToSource(r); } } if (!adjusted) { this.adjustAvailableNodes(); } r = this.rowStrategy.countVisible(); while (this.tbodyChildrenLength > r) { this.TBODY.removeChild(this.TBODY.lastChild); this.tbodyChildrenLength--; } this.instance.wtScrollbars.refresh(); if (workspaceWidth !== this.instance.wtViewport.getWorkspaceWidth()) { //workspace width changed though to shown/hidden vertical scrollbar. Let's reapply stretching this.columnStrategy.stretch(); for (c = 0; c < this.columnStrategy.cellCount; c++) { this.COLGROUP.childNodes[c + displayThs].style.width = this.columnStrategy.getSize(c) + 'px'; } } this.verticalRenderReverse = false; }; WalkontableTable.prototype.refreshPositions = function (selectionsOnly) { this.refreshHiderDimensions(); this.refreshSelections(selectionsOnly); }; WalkontableTable.prototype.refreshSelections = function (selectionsOnly) { var vr , r , vc , c , s , slen , classNames = [] , visibleRows = this.rowStrategy.countVisible() , visibleColumns = this.columnStrategy.countVisible(); this.oldCellCache = this.currentCellCache; this.currentCellCache = new WalkontableClassNameCache(); if (this.instance.selections) { for (r in this.instance.selections) { if (this.instance.selections.hasOwnProperty(r)) { this.instance.selections[r].draw(); if (this.instance.selections[r].settings.className) { classNames.push(this.instance.selections[r].settings.className); } if (this.instance.selections[r].settings.highlightRowClassName) { classNames.push(this.instance.selections[r].settings.highlightRowClassName); } if (this.instance.selections[r].settings.highlightColumnClassName) { classNames.push(this.instance.selections[r].settings.highlightColumnClassName); } } } } slen = classNames.length; for (vr = 0; vr < visibleRows; vr++) { for (vc = 0; vc < visibleColumns; vc++) { r = this.rowFilter.visibleToSource(vr); c = this.columnFilter.visibleToSource(vc); for (s = 0; s < slen; s++) { if (this.currentCellCache.test(vr, vc, classNames[s])) { this.wtDom.addClass(this.getCell([r, c]), classNames[s]); } else if (selectionsOnly && this.oldCellCache.test(vr, vc, classNames[s])) { this.wtDom.removeClass(this.getCell([r, c]), classNames[s]); } } } } }; /** * getCell * @param {Array} coords * @return {Object} HTMLElement on success or {Number} one of the exit codes on error: * -1 row before viewport * -2 row after viewport * -3 column before viewport * -4 column after viewport * */ WalkontableTable.prototype.getCell = function (coords) { if (this.isRowBeforeViewport(coords[0])) { return -1; //row before viewport } else if (this.isRowAfterViewport(coords[0])) { return -2; //row after viewport } else { if (this.isColumnBeforeViewport(coords[1])) { return -3; //column before viewport } else if (this.isColumnAfterViewport(coords[1])) { return -4; //column after viewport } else { return this.TBODY.childNodes[this.rowFilter.sourceToVisible(coords[0])].childNodes[this.columnFilter.sourceColumnToVisibleRowHeadedColumn(coords[1])]; } } }; WalkontableTable.prototype.getCoords = function (TD) { return [ this.rowFilter.visibleToSource(this.wtDom.index(TD.parentNode)), this.columnFilter.visibleRowHeadedColumnToSourceColumn(TD.cellIndex) ]; }; //returns -1 if no row is visible WalkontableTable.prototype.getLastVisibleRow = function () { return this.rowFilter.visibleToSource(this.rowStrategy.cellCount - 1); }; //returns -1 if no column is visible WalkontableTable.prototype.getLastVisibleColumn = function () { return this.columnFilter.visibleToSource(this.columnStrategy.cellCount - 1); }; WalkontableTable.prototype.isRowBeforeViewport = function (r) { return (this.rowFilter.sourceToVisible(r) < this.rowFilter.fixedCount && r >= this.rowFilter.fixedCount); }; WalkontableTable.prototype.isRowAfterViewport = function (r) { return (r > this.getLastVisibleRow()); }; WalkontableTable.prototype.isColumnBeforeViewport = function (c) { return (this.columnFilter.sourceToVisible(c) < this.columnFilter.fixedCount && c >= this.columnFilter.fixedCount); }; WalkontableTable.prototype.isColumnAfterViewport = function (c) { return (c > this.getLastVisibleColumn()); }; WalkontableTable.prototype.isRowInViewport = function (r) { return (!this.isRowBeforeViewport(r) && !this.isRowAfterViewport(r)); }; WalkontableTable.prototype.isColumnInViewport = function (c) { return (!this.isColumnBeforeViewport(c) && !this.isColumnAfterViewport(c)); }; WalkontableTable.prototype.isLastRowFullyVisible = function () { return (this.getLastVisibleRow() === this.instance.getSetting('totalRows') - 1 && !this.rowStrategy.isLastIncomplete()); }; WalkontableTable.prototype.isLastColumnFullyVisible = function () { return (this.getLastVisibleColumn() === this.instance.getSetting('totalColumns') - 1 && !this.columnStrategy.isLastIncomplete()); }; function WalkontableViewport(instance) { this.instance = instance; this.resetSettings(); } /*WalkontableViewport.prototype.isInSightVertical = function () { //is table outside viewport bottom edge if (tableTop > windowHeight + scrollTop) { return -1; } //is table outside viewport top edge else if (scrollTop > tableTop + tableFakeHeight) { return -2; } //table is in viewport but how much exactly? else { } };*/ //used by scrollbar WalkontableViewport.prototype.getWorkspaceHeight = function (proposedHeight) { var height = this.instance.getSetting('height'); if (height === Infinity || height === void 0 || height === null || height < 1) { if (this.instance.wtScrollbars.vertical instanceof WalkontableScrollbarNative) { height = this.instance.wtScrollbars.vertical.availableSize(); } else { height = Infinity; } } if (height !== Infinity) { if (proposedHeight >= height) { height -= this.instance.getSetting('scrollbarHeight'); } else if (this.instance.wtScrollbars.horizontal.visible) { height -= this.instance.getSetting('scrollbarHeight'); } } return height; }; WalkontableViewport.prototype.getWorkspaceWidth = function (proposedWidth) { var width = this.instance.getSetting('width'); if (width === Infinity || width === void 0 || width === null || width < 1) { if (this.instance.wtScrollbars.horizontal instanceof WalkontableScrollbarNative) { width = this.instance.wtScrollbars.horizontal.availableSize(); } else { width = Infinity; } } if (width !== Infinity) { if (proposedWidth >= width) { width -= this.instance.getSetting('scrollbarWidth'); } else if (this.instance.wtScrollbars.vertical.visible) { width -= this.instance.getSetting('scrollbarWidth'); } } return width; }; WalkontableViewport.prototype.getWorkspaceActualHeight = function () { return this.instance.wtDom.outerHeight(this.instance.wtTable.TABLE); }; WalkontableViewport.prototype.getWorkspaceActualWidth = function () { return this.instance.wtDom.outerWidth(this.instance.wtTable.TABLE) || this.instance.wtDom.outerWidth(this.instance.wtTable.TBODY) || this.instance.wtDom.outerWidth(this.instance.wtTable.THEAD); //IE8 reports 0 as <table> offsetWidth; }; WalkontableViewport.prototype.getViewportHeight = function (proposedHeight) { var containerHeight = this.getWorkspaceHeight(proposedHeight); if (containerHeight === Infinity) { return containerHeight; } if (isNaN(this.columnHeaderHeight)) { var cellOffset = this.instance.wtDom.offset(this.instance.wtTable.TBODY) , tableOffset = this.instance.wtTable.tableOffset; this.columnHeaderHeight = cellOffset.top - tableOffset.top; } if (this.columnHeaderHeight > 0) { return containerHeight - this.columnHeaderHeight; } else { return containerHeight; } }; WalkontableViewport.prototype.getViewportWidth = function (proposedWidth) { var containerWidth = this.getWorkspaceWidth(proposedWidth); if (containerWidth === Infinity) { return containerWidth; } if (isNaN(this.rowHeaderWidth)) { var TR = this.instance.wtTable.TBODY ? this.instance.wtTable.TBODY.firstChild : null; if (TR) { var TD = TR.firstChild; this.rowHeaderWidth = 0; while (TD && TD.nodeName === 'TH') { this.rowHeaderWidth += this.instance.wtDom.outerWidth(TD); TD = TD.nextSibling; } } } if (this.rowHeaderWidth > 0) { return containerWidth - this.rowHeaderWidth; } else { return containerWidth; } }; WalkontableViewport.prototype.resetSettings = function () { this.rowHeaderWidth = NaN; this.columnHeaderHeight = NaN; }; function WalkontableWheel(instance) { if (instance.getSetting('scrollbarModelV') === 'native' || instance.getSetting('scrollbarModelH') === 'native') { return; } //spreader === instance.wtTable.TABLE.parentNode $(instance.wtTable.spreader).on('mousewheel', function (event, delta, deltaX, deltaY) { if (!deltaX && !deltaY && delta) { //we are in IE8, see https://github.com/brandonaaron/jquery-mousewheel/issues/53 deltaY = delta; } if (!deltaX && !deltaY) { //this happens in IE8 test case return; } if (deltaY > 0 && instance.getSetting('offsetRow') === 0) { return; //attempt to scroll up when it's already showing first row } else if (deltaY < 0 && instance.wtTable.isLastRowFullyVisible()) { return; //attempt to scroll down when it's already showing last row } else if (deltaX < 0 && instance.getSetting('offsetColumn') === 0) { return; //attempt to scroll left when it's already showing first column } else if (deltaX > 0 && instance.wtTable.isLastColumnFullyVisible()) { return; //attempt to scroll right when it's already showing last column } //now we are sure we really want to scroll clearTimeout(instance.wheelTimeout); instance.wheelTimeout = setTimeout(function () { //timeout is needed because with fast-wheel scrolling mousewheel event comes dozen times per second if (deltaY) { //ceil is needed because jquery-mousewheel reports fractional mousewheel deltas on touchpad scroll //see http://stackoverflow.com/questions/5527601/normalizing-mousewheel-speed-across-browsers if (instance.wtScrollbars.vertical.visible) { // if we see scrollbar instance.scrollVertical(-Math.ceil(deltaY)).draw(); } } else if (deltaX) { if (instance.wtScrollbars.horizontal.visible) { // if we see scrollbar instance.scrollHorizontal(Math.ceil(deltaX)).draw(); } } }, 0); event.preventDefault(); }); } /** * Dragdealer JS v0.9.5 - patched by Walkontable at lines 66, 309-310, 339-340 * http://code.ovidiu.ch/dragdealer-js * * Copyright (c) 2010, Ovidiu Chereches * MIT License * http://legal.ovidiu.ch/licenses/MIT */ /* Cursor */ var Cursor = { x: 0, y: 0, init: function() { this.setEvent('mouse'); this.setEvent('touch'); }, setEvent: function(type) { var moveHandler = document['on' + type + 'move'] || function(){}; document['on' + type + 'move'] = function(e) { moveHandler(e); Cursor.refresh(e); } }, refresh: function(e) { if(!e) { e = window.event; } if(e.type == 'mousemove') { this.set(e); } else if(e.touches) { this.set(e.touches[0]); } }, set: function(e) { if(e.pageX || e.pageY) { this.x = e.pageX; this.y = e.pageY; } else if(e.clientX || e.clientY) { this.x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; this.y = e.clientY + document.body.scrollTop + document.documentElement.scrollTop; } } }; Cursor.init(); /* Position */ var Position = { get: function(obj) { var curtop = 0, curleft = 0; //Walkontable patch. Original (var curleft = curtop = 0;) created curtop in global scope if(obj.offsetParent) { do { curleft += obj.offsetLeft; curtop += obj.offsetTop; } while((obj = obj.offsetParent)); } return [curleft, curtop]; } }; /* Dragdealer */ var Dragdealer = function(wrapper, options) { if(typeof(wrapper) == 'string') { wrapper = document.getElementById(wrapper); } if(!wrapper) { return; } var handle = wrapper.getElementsByTagName('div')[0]; if(!handle || handle.className.search(/(^|\s)handle(\s|$)/) == -1) { return; } this.init(wrapper, handle, options || {}); this.setup(); }; Dragdealer.prototype = { init: function(wrapper, handle, options) { this.wrapper = wrapper; this.handle = handle; this.options = options; this.disabled = this.getOption('disabled', false); this.horizontal = this.getOption('horizontal', true); this.vertical = this.getOption('vertical', false); this.slide = this.getOption('slide', true); this.steps = this.getOption('steps', 0); this.snap = this.getOption('snap', false); this.loose = this.getOption('loose', false); this.speed = this.getOption('speed', 10) / 100; this.xPrecision = this.getOption('xPrecision', 0); this.yPrecision = this.getOption('yPrecision', 0); this.callback = options.callback || null; this.animationCallback = options.animationCallback || null; this.bounds = { left: options.left || 0, right: -(options.right || 0), top: options.top || 0, bottom: -(options.bottom || 0), x0: 0, x1: 0, xRange: 0, y0: 0, y1: 0, yRange: 0 }; this.value = { prev: [-1, -1], current: [options.x || 0, options.y || 0], target: [options.x || 0, options.y || 0] }; this.offset = { wrapper: [0, 0], mouse: [0, 0], prev: [-999999, -999999], current: [0, 0], target: [0, 0] }; this.change = [0, 0]; this.activity = false; this.dragging = false; this.tapping = false; }, getOption: function(name, defaultValue) { return this.options[name] !== undefined ? this.options[name] : defaultValue; }, setup: function() { this.setWrapperOffset(); this.setBoundsPadding(); this.setBounds(); this.setSteps(); this.addListeners(); }, setWrapperOffset: function() { this.offset.wrapper = Position.get(this.wrapper); }, setBoundsPadding: function() { if(!this.bounds.left && !this.bounds.right) { this.bounds.left = Position.get(this.handle)[0] - this.offset.wrapper[0]; this.bounds.right = -this.bounds.left; } if(!this.bounds.top && !this.bounds.bottom) { this.bounds.top = Position.get(this.handle)[1] - this.offset.wrapper[1]; this.bounds.bottom = -this.bounds.top; } }, setBounds: function() { this.bounds.x0 = this.bounds.left; this.bounds.x1 = this.wrapper.offsetWidth + this.bounds.right; this.bounds.xRange = (this.bounds.x1 - this.bounds.x0) - this.handle.offsetWidth; this.bounds.y0 = this.bounds.top; this.bounds.y1 = this.wrapper.offsetHeight + this.bounds.bottom; this.bounds.yRange = (this.bounds.y1 - this.bounds.y0) - this.handle.offsetHeight; this.bounds.xStep = 1 / (this.xPrecision || Math.max(this.wrapper.offsetWidth, this.handle.offsetWidth)); this.bounds.yStep = 1 / (this.yPrecision || Math.max(this.wrapper.offsetHeight, this.handle.offsetHeight)); }, setSteps: function() { if(this.steps > 1) { this.stepRatios = []; for(var i = 0; i <= this.steps - 1; i++) { this.stepRatios[i] = i / (this.steps - 1); } } }, addListeners: function() { var self = this; this.wrapper.onselectstart = function() { return false; } this.handle.onmousedown = this.handle.ontouchstart = function(e) { self.handleDownHandler(e); }; this.wrapper.onmousedown = this.wrapper.ontouchstart = function(e) { self.wrapperDownHandler(e); }; var mouseUpHandler = document.onmouseup || function(){}; document.onmouseup = function(e) { mouseUpHandler(e); self.documentUpHandler(e); }; var touchEndHandler = document.ontouchend || function(){}; document.ontouchend = function(e) { touchEndHandler(e); self.documentUpHandler(e); }; var resizeHandler = window.onresize || function(){}; window.onresize = function(e) { resizeHandler(e); self.documentResizeHandler(e); }; this.wrapper.onmousemove = function(e) { self.activity = true; } this.wrapper.onclick = function(e) { return !self.activity; } this.interval = setInterval(function(){ self.animate() }, 25); self.animate(false, true); }, handleDownHandler: function(e) { this.activity = false; Cursor.refresh(e); this.preventDefaults(e, true); this.startDrag(); }, wrapperDownHandler: function(e) { Cursor.refresh(e); this.preventDefaults(e, true); this.startTap(); }, documentUpHandler: function(e) { this.stopDrag(); this.stopTap(); }, documentResizeHandler: function(e) { this.setWrapperOffset(); this.setBounds(); this.update(); }, enable: function() { this.disabled = false; this.handle.className = this.handle.className.replace(/\s?disabled/g, ''); }, disable: function() { this.disabled = true; this.handle.className += ' disabled'; }, setStep: function(x, y, snap) { this.setValue( this.steps && x > 1 ? (x - 1) / (this.steps - 1) : 0, this.steps && y > 1 ? (y - 1) / (this.steps - 1) : 0, snap ); }, setValue: function(x, y, snap) { this.setTargetValue([x, y || 0]); if(snap) { this.groupCopy(this.value.current, this.value.target); } }, startTap: function(target) { if(this.disabled) { return; } this.tapping = true; this.setWrapperOffset(); this.setBounds(); if(target === undefined) { target = [ Cursor.x - this.offset.wrapper[0] - (this.handle.offsetWidth / 2), Cursor.y - this.offset.wrapper[1] - (this.handle.offsetHeight / 2) ]; } this.setTargetOffset(target); }, stopTap: function() { if(this.disabled || !this.tapping) { return; } this.tapping = false; this.setTargetValue(this.value.current); this.result(); }, startDrag: function() { if(this.disabled) { return; } this.setWrapperOffset(); this.setBounds(); this.offset.mouse = [ Cursor.x - Position.get(this.handle)[0], Cursor.y - Position.get(this.handle)[1] ]; this.dragging = true; }, stopDrag: function() { if(this.disabled || !this.dragging) { return; } this.dragging = false; var target = this.groupClone(this.value.current); if(this.slide) { var ratioChange = this.change; target[0] += ratioChange[0] * 4; target[1] += ratioChange[1] * 4; } this.setTargetValue(target); this.result(); }, feedback: function() { var value = this.value.current; if(this.snap && this.steps > 1) { value = this.getClosestSteps(value); } if(!this.groupCompare(value, this.value.prev)) { if(typeof(this.animationCallback) == 'function') { this.animationCallback(value[0], value[1]); } this.groupCopy(this.value.prev, value); } }, result: function() { if(typeof(this.callback) == 'function') { this.callback(this.value.target[0], this.value.target[1]); } }, animate: function(direct, first) { if(direct && !this.dragging) { return; } if(this.dragging) { var prevTarget = this.groupClone(this.value.target); var offset = [ Cursor.x - this.offset.wrapper[0] - this.offset.mouse[0], Cursor.y - this.offset.wrapper[1] - this.offset.mouse[1] ]; this.setTargetOffset(offset, this.loose); this.change = [ this.value.target[0] - prevTarget[0], this.value.target[1] - prevTarget[1] ]; } if(this.dragging || first) { this.groupCopy(this.value.current, this.value.target); } if(this.dragging || this.glide() || first) { this.update(); this.feedback(); } }, glide: function() { var diff = [ this.value.target[0] - this.value.current[0], this.value.target[1] - this.value.current[1] ]; if(!diff[0] && !diff[1]) { return false; } if(Math.abs(diff[0]) > this.bounds.xStep || Math.abs(diff[1]) > this.bounds.yStep) { this.value.current[0] += diff[0] * this.speed; this.value.current[1] += diff[1] * this.speed; } else { this.groupCopy(this.value.current, this.value.target); } return true; }, update: function() { if(!this.snap) { this.offset.current = this.getOffsetsByRatios(this.value.current); } else { this.offset.current = this.getOffsetsByRatios( this.getClosestSteps(this.value.current) ); } this.show(); }, show: function() { if(!this.groupCompare(this.offset.current, this.offset.prev)) { if(this.horizontal) { this.handle.style.left = String(this.offset.current[0]) + 'px'; } if(this.vertical) { this.handle.style.top = String(this.offset.current[1]) + 'px'; } this.groupCopy(this.offset.prev, this.offset.current); } }, setTargetValue: function(value, loose) { var target = loose ? this.getLooseValue(value) : this.getProperValue(value); this.groupCopy(this.value.target, target); this.offset.target = this.getOffsetsByRatios(target); }, setTargetOffset: function(offset, loose) { var value = this.getRatiosByOffsets(offset); var target = loose ? this.getLooseValue(value) : this.getProperValue(value); this.groupCopy(this.value.target, target); this.offset.target = this.getOffsetsByRatios(target); }, getLooseValue: function(value) { var proper = this.getProperValue(value); return [ proper[0] + ((value[0] - proper[0]) / 4), proper[1] + ((value[1] - proper[1]) / 4) ]; }, getProperValue: function(value) { var proper = this.groupClone(value); proper[0] = Math.max(proper[0], 0); proper[1] = Math.max(proper[1], 0); proper[0] = Math.min(proper[0], 1); proper[1] = Math.min(proper[1], 1); if((!this.dragging && !this.tapping) || this.snap) { if(this.steps > 1) { proper = this.getClosestSteps(proper); } } return proper; }, getRatiosByOffsets: function(group) { return [ this.getRatioByOffset(group[0], this.bounds.xRange, this.bounds.x0), this.getRatioByOffset(group[1], this.bounds.yRange, this.bounds.y0) ]; }, getRatioByOffset: function(offset, range, padding) { return range ? (offset - padding) / range : 0; }, getOffsetsByRatios: function(group) { return [ this.getOffsetByRatio(group[0], this.bounds.xRange, this.bounds.x0), this.getOffsetByRatio(group[1], this.bounds.yRange, this.bounds.y0) ]; }, getOffsetByRatio: function(ratio, range, padding) { return Math.round(ratio * range) + padding; }, getClosestSteps: function(group) { return [ this.getClosestStep(group[0]), this.getClosestStep(group[1]) ]; }, getClosestStep: function(value) { var k = 0; var min = 1; for(var i = 0; i <= this.steps - 1; i++) { if(Math.abs(this.stepRatios[i] - value) < min) { min = Math.abs(this.stepRatios[i] - value); k = i; } } return this.stepRatios[k]; }, groupCompare: function(a, b) { return a[0] == b[0] && a[1] == b[1]; }, groupCopy: function(a, b) { a[0] = b[0]; a[1] = b[1]; }, groupClone: function(a) { return [a[0], a[1]]; }, preventDefaults: function(e, selection) { if(!e) { e = window.event; } if(e.preventDefault) { e.preventDefault(); } e.returnValue = false; if(selection && document.selection) { document.selection.empty(); } }, cancelEvent: function(e) { if(!e) { e = window.event; } if(e.stopPropagation) { e.stopPropagation(); } e.cancelBubble = true; } }; /** * jQuery.browser shim that makes Walkontable working with jQuery 1.9+ */ if (!jQuery.browser) { (function () { var matched, browser; /* * Copyright 2011, John Resig * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license */ jQuery.uaMatch = function (ua) { ua = ua.toLowerCase(); var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || /(webkit)[ \/]([\w.]+)/.exec(ua) || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || /(msie) ([\w.]+)/.exec(ua) || ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || []; return { browser: match[ 1 ] || "", version: match[ 2 ] || "0" }; }; matched = jQuery.uaMatch(navigator.userAgent); browser = {}; if (matched.browser) { browser[ matched.browser ] = true; browser.version = matched.version; } // Chrome is Webkit, but Webkit is also Safari. if (browser.chrome) { browser.webkit = true; } else if (browser.webkit) { browser.safari = true; } jQuery.browser = browser; })(); } /*! Copyright (c) 2013 Brandon Aaron (http://brandonaaron.net) * Licensed under the MIT License (LICENSE.txt). * * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. * Thanks to: Seamus Leahy for adding deltaX and deltaY * * Version: 3.1.3 * * Requires: 1.2.2+ */ (function (factory) { if ( typeof define === 'function' && define.amd ) { // AMD. Register as an anonymous module. define(['jquery'], factory); } else if (typeof exports === 'object') { // Node/CommonJS style for Browserify module.exports = factory; } else { // Browser globals factory(jQuery); } }(function ($) { var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll']; var toBind = 'onwheel' in document || document.documentMode >= 9 ? ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll']; var lowestDelta, lowestDeltaXY; if ( $.event.fixHooks ) { for ( var i = toFix.length; i; ) { $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks; } } $.event.special.mousewheel = { setup: function() { if ( this.addEventListener ) { for ( var i = toBind.length; i; ) { this.addEventListener( toBind[--i], handler, false ); } } else { this.onmousewheel = handler; } }, teardown: function() { if ( this.removeEventListener ) { for ( var i = toBind.length; i; ) { this.removeEventListener( toBind[--i], handler, false ); } } else { this.onmousewheel = null; } } }; $.fn.extend({ mousewheel: function(fn) { return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel"); }, unmousewheel: function(fn) { return this.unbind("mousewheel", fn); } }); function handler(event) { var orgEvent = event || window.event, args = [].slice.call(arguments, 1), delta = 0, deltaX = 0, deltaY = 0, absDelta = 0, absDeltaXY = 0, fn; event = $.event.fix(orgEvent); event.type = "mousewheel"; // Old school scrollwheel delta if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta; } if ( orgEvent.detail ) { delta = orgEvent.detail * -1; } // New school wheel delta (wheel event) if ( orgEvent.deltaY ) { deltaY = orgEvent.deltaY * -1; delta = deltaY; } if ( orgEvent.deltaX ) { deltaX = orgEvent.deltaX; delta = deltaX * -1; } // Webkit if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY; } if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = orgEvent.wheelDeltaX * -1; } // Look for lowest delta to normalize the delta values absDelta = Math.abs(delta); if ( !lowestDelta || absDelta < lowestDelta ) { lowestDelta = absDelta; } absDeltaXY = Math.max(Math.abs(deltaY), Math.abs(deltaX)); if ( !lowestDeltaXY || absDeltaXY < lowestDeltaXY ) { lowestDeltaXY = absDeltaXY; } // Get a whole value for the deltas fn = delta > 0 ? 'floor' : 'ceil'; delta = Math[fn](delta / lowestDelta); deltaX = Math[fn](deltaX / lowestDeltaXY); deltaY = Math[fn](deltaY / lowestDeltaXY); // Add event and delta to the front of the arguments args.unshift(event, delta, deltaX, deltaY); return ($.event.dispatch || $.event.handle).apply(this, args); } })); /** * Array.filter() shim by Trevor Menagh (https://github.com/trevmex) with some modifications */ if (!Array.prototype.filter) { Array.prototype.filter = function (fun, thisp) { "use strict"; if (typeof this === "undefined" || this === null) { throw new TypeError(); } if (typeof fun !== "function") { throw new TypeError(); } thisp = thisp || this; if (isNodeList(thisp)) { thisp = convertNodeListToArray(thisp); } var len = thisp.length, res = [], i, val; for (i = 0; i < len; i += 1) { if (thisp.hasOwnProperty(i)) { val = thisp[i]; // in case fun mutates this if (fun.call(thisp, val, i, thisp)) { res.push(val); } } } return res; function isNodeList(object) { return /NodeList/i.test(object.item); } function convertNodeListToArray(nodeList) { var array = []; for (var i = 0, len = nodeList.length; i < len; i++){ array[i] = nodeList[i] } return array; } }; } })(jQuery, window, Handsontable); /* ============================================================= * bootstrap-typeahead.js v2.3.1 * http://twitter.github.com/bootstrap/javascript.html#typeahead * ============================================================= * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================ */ !function($){ "use strict"; // jshint ;_; /* TYPEAHEAD PUBLIC CLASS DEFINITION * ================================= */ var Typeahead = function (element, options) { this.$element = $(element) this.options = $.extend({}, $.fn.typeahead.defaults, options) this.matcher = this.options.matcher || this.matcher this.sorter = this.options.sorter || this.sorter this.highlighter = this.options.highlighter || this.highlighter this.updater = this.options.updater || this.updater this.source = this.options.source this.$menu = $(this.options.menu) this.shown = false this.listen() } Typeahead.prototype = { constructor: Typeahead , select: function () { var val = this.$menu.find('.active').attr('data-value') this.$element .val(this.updater(val)) .change() return this.hide() } , updater: function (item) { return item } , show: function () { var pos = $.extend({}, this.$element.position(), { height: this.$element[0].offsetHeight }) this.$menu .insertAfter(this.$element) .css({ top: pos.top + pos.height , left: pos.left }) .show() this.shown = true return this } , hide: function () { this.$menu.hide() this.shown = false return this } , lookup: function (event) { var items this.query = this.$element.val() if (!this.query || this.query.length < this.options.minLength) { return this.shown ? this.hide() : this } items = $.isFunction(this.source) ? this.source(this.query, $.proxy(this.process, this)) : this.source return items ? this.process(items) : this } , process: function (items) { var that = this items = $.grep(items, function (item) { return that.matcher(item) }) items = this.sorter(items) if (!items.length) { return this.shown ? this.hide() : this } return this.render(items.slice(0, this.options.items)).show() } , matcher: function (item) { return ~item.toLowerCase().indexOf(this.query.toLowerCase()) } , sorter: function (items) { var beginswith = [] , caseSensitive = [] , caseInsensitive = [] , item while (item = items.shift()) { if (!item.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item) else if (~item.indexOf(this.query)) caseSensitive.push(item) else caseInsensitive.push(item) } return beginswith.concat(caseSensitive, caseInsensitive) } , highlighter: function (item) { var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&') return item.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) { return '<strong>' + match + '</strong>' }) } , render: function (items) { var that = this items = $(items).map(function (i, item) { i = $(that.options.item).attr('data-value', item) i.find('a').html(that.highlighter(item)) return i[0] }) items.first().addClass('active') this.$menu.html(items) return this } , next: function (event) { var active = this.$menu.find('.active').removeClass('active') , next = active.next() if (!next.length) { next = $(this.$menu.find('li')[0]) } next.addClass('active') } , prev: function (event) { var active = this.$menu.find('.active').removeClass('active') , prev = active.prev() if (!prev.length) { prev = this.$menu.find('li').last() } prev.addClass('active') } , listen: function () { this.$element .on('focus', $.proxy(this.focus, this)) .on('blur', $.proxy(this.blur, this)) .on('keypress', $.proxy(this.keypress, this)) .on('keyup', $.proxy(this.keyup, this)) if (this.eventSupported('keydown')) { this.$element.on('keydown', $.proxy(this.keydown, this)) } this.$menu .on('click', $.proxy(this.click, this)) .on('mouseenter', 'li', $.proxy(this.mouseenter, this)) .on('mouseleave', 'li', $.proxy(this.mouseleave, this)) } , eventSupported: function(eventName) { var isSupported = eventName in this.$element if (!isSupported) { this.$element.setAttribute(eventName, 'return;') isSupported = typeof this.$element[eventName] === 'function' } return isSupported } , move: function (e) { if (!this.shown) return switch(e.keyCode) { case 9: // tab case 13: // enter case 27: // escape e.preventDefault() break case 38: // up arrow e.preventDefault() this.prev() break case 40: // down arrow e.preventDefault() this.next() break } e.stopPropagation() } , keydown: function (e) { this.suppressKeyPressRepeat = ~$.inArray(e.keyCode, [40,38,9,13,27]) this.move(e) } , keypress: function (e) { if (this.suppressKeyPressRepeat) return this.move(e) } , keyup: function (e) { switch(e.keyCode) { case 40: // down arrow case 38: // up arrow case 16: // shift case 17: // ctrl case 18: // alt break case 9: // tab case 13: // enter if (!this.shown) return this.select() break case 27: // escape if (!this.shown) return this.hide() break default: this.lookup() } e.stopPropagation() e.preventDefault() } , focus: function (e) { this.focused = true } , blur: function (e) { this.focused = false if (!this.mousedover && this.shown) this.hide() } , click: function (e) { e.stopPropagation() e.preventDefault() this.select() this.$element.focus() } , mouseenter: function (e) { this.mousedover = true this.$menu.find('.active').removeClass('active') $(e.currentTarget).addClass('active') } , mouseleave: function (e) { this.mousedover = false if (!this.focused && this.shown) this.hide() } } /* TYPEAHEAD PLUGIN DEFINITION * =========================== */ var old = $.fn.typeahead $.fn.typeahead = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('typeahead') , options = typeof option == 'object' && option if (!data) $this.data('typeahead', (data = new Typeahead(this, options))) if (typeof option == 'string') data[option]() }) } $.fn.typeahead.defaults = { source: [] , items: 8 , menu: '<ul class="typeahead dropdown-menu"></ul>' , item: '<li><a href="#"></a></li>' , minLength: 1 } $.fn.typeahead.Constructor = Typeahead /* TYPEAHEAD NO CONFLICT * =================== */ $.fn.typeahead.noConflict = function () { $.fn.typeahead = old return this } /* TYPEAHEAD DATA-API * ================== */ $(document).on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) { var $this = $(this) if ($this.data('typeahead')) return $this.typeahead($this.data()) }) }(window.jQuery); // numeral.js // version : 1.4.7 // author : Adam Draper // license : MIT // http://adamwdraper.github.com/Numeral-js/ (function () { /************************************ Constants ************************************/ var numeral, VERSION = '1.4.7', // internal storage for language config files languages = {}, currentLanguage = 'en', zeroFormat = null, // check for nodeJS hasModule = (typeof module !== 'undefined' && module.exports); /************************************ Constructors ************************************/ // Numeral prototype object function Numeral (number) { this._n = number; } /** * Implementation of toFixed() that treats floats more like decimals * * Fixes binary rounding issues (eg. (0.615).toFixed(2) === '0.61') that present * problems for accounting- and finance-related software. */ function toFixed (value, precision, optionals) { var power = Math.pow(10, precision), output; // Multiply up by precision, round accurately, then divide and use native toFixed(): output = (Math.round(value * power) / power).toFixed(precision); if (optionals) { var optionalsRegExp = new RegExp('0{1,' + optionals + '}$'); output = output.replace(optionalsRegExp, ''); } return output; } /************************************ Formatting ************************************/ // determine what type of formatting we need to do function formatNumeral (n, format) { var output; // figure out what kind of format we are dealing with if (format.indexOf('$') > -1) { // currency!!!!! output = formatCurrency(n, format); } else if (format.indexOf('%') > -1) { // percentage output = formatPercentage(n, format); } else if (format.indexOf(':') > -1) { // time output = formatTime(n, format); } else { // plain ol' numbers or bytes output = formatNumber(n, format); } // return string return output; } // revert to number function unformatNumeral (n, string) { if (string.indexOf(':') > -1) { n._n = unformatTime(string); } else { if (string === zeroFormat) { n._n = 0; } else { var stringOriginal = string; if (languages[currentLanguage].delimiters.decimal !== '.') { string = string.replace(/\./g,'').replace(languages[currentLanguage].delimiters.decimal, '.'); } // see if abbreviations are there so that we can multiply to the correct number var thousandRegExp = new RegExp(languages[currentLanguage].abbreviations.thousand + '(?:\\)|(\\' + languages[currentLanguage].currency.symbol + ')?(?:\\))?)?$'), millionRegExp = new RegExp(languages[currentLanguage].abbreviations.million + '(?:\\)|(\\' + languages[currentLanguage].currency.symbol + ')?(?:\\))?)?$'), billionRegExp = new RegExp(languages[currentLanguage].abbreviations.billion + '(?:\\)|(\\' + languages[currentLanguage].currency.symbol + ')?(?:\\))?)?$'), trillionRegExp = new RegExp(languages[currentLanguage].abbreviations.trillion + '(?:\\)|(\\' + languages[currentLanguage].currency.symbol + ')?(?:\\))?)?$'); // see if bytes are there so that we can multiply to the correct number var prefixes = ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], bytesMultiplier = false; for (var power = 0; power <= prefixes.length; power++) { bytesMultiplier = (string.indexOf(prefixes[power]) > -1) ? Math.pow(1024, power + 1) : false; if (bytesMultiplier) { break; } } // do some math to create our number n._n = ((bytesMultiplier) ? bytesMultiplier : 1) * ((stringOriginal.match(thousandRegExp)) ? Math.pow(10, 3) : 1) * ((stringOriginal.match(millionRegExp)) ? Math.pow(10, 6) : 1) * ((stringOriginal.match(billionRegExp)) ? Math.pow(10, 9) : 1) * ((stringOriginal.match(trillionRegExp)) ? Math.pow(10, 12) : 1) * ((string.indexOf('%') > -1) ? 0.01 : 1) * Number(((string.indexOf('(') > -1) ? '-' : '') + string.replace(/[^0-9\.-]+/g, '')); // round if we are talking about bytes n._n = (bytesMultiplier) ? Math.ceil(n._n) : n._n; } } return n._n; } function formatCurrency (n, format) { var prependSymbol = (format.indexOf('$') <= 1) ? true : false; // remove $ for the moment var space = ''; // check for space before or after currency if (format.indexOf(' $') > -1) { space = ' '; format = format.replace(' $', ''); } else if (format.indexOf('$ ') > -1) { space = ' '; format = format.replace('$ ', ''); } else { format = format.replace('$', ''); } // format the number var output = formatNumeral(n, format); // position the symbol if (prependSymbol) { if (output.indexOf('(') > -1 || output.indexOf('-') > -1) { output = output.split(''); output.splice(1, 0, languages[currentLanguage].currency.symbol + space); output = output.join(''); } else { output = languages[currentLanguage].currency.symbol + space + output; } } else { if (output.indexOf(')') > -1) { output = output.split(''); output.splice(-1, 0, space + languages[currentLanguage].currency.symbol); output = output.join(''); } else { output = output + space + languages[currentLanguage].currency.symbol; } } return output; } function formatPercentage (n, format) { var space = ''; // check for space before % if (format.indexOf(' %') > -1) { space = ' '; format = format.replace(' %', ''); } else { format = format.replace('%', ''); } n._n = n._n * 100; var output = formatNumeral(n, format); if (output.indexOf(')') > -1 ) { output = output.split(''); output.splice(-1, 0, space + '%'); output = output.join(''); } else { output = output + space + '%'; } return output; } function formatTime (n, format) { var hours = Math.floor(n._n/60/60), minutes = Math.floor((n._n - (hours * 60 * 60))/60), seconds = Math.round(n._n - (hours * 60 * 60) - (minutes * 60)); return hours + ':' + ((minutes < 10) ? '0' + minutes : minutes) + ':' + ((seconds < 10) ? '0' + seconds : seconds); } function unformatTime (string) { var timeArray = string.split(':'), seconds = 0; // turn hours and minutes into seconds and add them all up if (timeArray.length === 3) { // hours seconds = seconds + (Number(timeArray[0]) * 60 * 60); // minutes seconds = seconds + (Number(timeArray[1]) * 60); // seconds seconds = seconds + Number(timeArray[2]); } else if (timeArray.lenght === 2) { // minutes seconds = seconds + (Number(timeArray[0]) * 60); // seconds seconds = seconds + Number(timeArray[1]); } return Number(seconds); } function formatNumber (n, format) { var negP = false, optDec = false, abbr = '', bytes = '', ord = '', abs = Math.abs(n._n); // check if number is zero and a custom zero format has been set if (n._n === 0 && zeroFormat !== null) { return zeroFormat; } else { // see if we should use parentheses for negative number if (format.indexOf('(') > -1) { negP = true; format = format.slice(1, -1); } // see if abbreviation is wanted if (format.indexOf('a') > -1) { // check for space before abbreviation if (format.indexOf(' a') > -1) { abbr = ' '; format = format.replace(' a', ''); } else { format = format.replace('a', ''); } if (abs >= Math.pow(10, 12)) { // trillion abbr = abbr + languages[currentLanguage].abbreviations.trillion; n._n = n._n / Math.pow(10, 12); } else if (abs < Math.pow(10, 12) && abs >= Math.pow(10, 9)) { // billion abbr = abbr + languages[currentLanguage].abbreviations.billion; n._n = n._n / Math.pow(10, 9); } else if (abs < Math.pow(10, 9) && abs >= Math.pow(10, 6)) { // million abbr = abbr + languages[currentLanguage].abbreviations.million; n._n = n._n / Math.pow(10, 6); } else if (abs < Math.pow(10, 6) && abs >= Math.pow(10, 3)) { // thousand abbr = abbr + languages[currentLanguage].abbreviations.thousand; n._n = n._n / Math.pow(10, 3); } } // see if we are formatting bytes if (format.indexOf('b') > -1) { // check for space before if (format.indexOf(' b') > -1) { bytes = ' '; format = format.replace(' b', ''); } else { format = format.replace('b', ''); } var prefixes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], min, max; for (var power = 0; power <= prefixes.length; power++) { min = Math.pow(1024, power); max = Math.pow(1024, power+1); if (n._n >= min && n._n < max) { bytes = bytes + prefixes[power]; if (min > 0) { n._n = n._n / min; } break; } } } // see if ordinal is wanted if (format.indexOf('o') > -1) { // check for space before if (format.indexOf(' o') > -1) { ord = ' '; format = format.replace(' o', ''); } else { format = format.replace('o', ''); } ord = ord + languages[currentLanguage].ordinal(n._n); } if (format.indexOf('[.]') > -1) { optDec = true; format = format.replace('[.]', '.'); } var w = n._n.toString().split('.')[0], precision = format.split('.')[1], thousands = format.indexOf(','), d = '', neg = false; if (precision) { if (precision.indexOf('[') > -1) { precision = precision.replace(']', ''); precision = precision.split('['); d = toFixed(n._n, (precision[0].length + precision[1].length), precision[1].length); } else { d = toFixed(n._n, precision.length); } w = d.split('.')[0]; if (d.split('.')[1].length) { d = languages[currentLanguage].delimiters.decimal + d.split('.')[1]; } else { d = ''; } if (optDec && Number(d) === 0) { d = ''; } } else { w = toFixed(n._n, null); } // format number if (w.indexOf('-') > -1) { w = w.slice(1); neg = true; } if (thousands > -1) { w = w.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1' + languages[currentLanguage].delimiters.thousands); } if (format.indexOf('.') === 0) { w = ''; } return ((negP && neg) ? '(' : '') + ((!negP && neg) ? '-' : '') + w + d + ((ord) ? ord : '') + ((abbr) ? abbr : '') + ((bytes) ? bytes : '') + ((negP && neg) ? ')' : ''); } } /************************************ Top Level Functions ************************************/ numeral = function (input) { if (numeral.isNumeral(input)) { input = input.value(); } else if (!Number(input)) { input = 0; } return new Numeral(Number(input)); }; // version number numeral.version = VERSION; // compare numeral object numeral.isNumeral = function (obj) { return obj instanceof Numeral; }; // This function will load languages and then set the global language. If // no arguments are passed in, it will simply return the current global // language key. numeral.language = function (key, values) { if (!key) { return currentLanguage; } if (key && !values) { currentLanguage = key; } if (values || !languages[key]) { loadLanguage(key, values); } return numeral; }; numeral.language('en', { delimiters: { thousands: ',', decimal: '.' }, abbreviations: { thousand: 'k', million: 'm', billion: 'b', trillion: 't' }, ordinal: function (number) { var b = number % 10; return (~~ (number % 100 / 10) === 1) ? 'th' : (b === 1) ? 'st' : (b === 2) ? 'nd' : (b === 3) ? 'rd' : 'th'; }, currency: { symbol: '$' } }); numeral.zeroFormat = function (format) { if (typeof(format) === 'string') { zeroFormat = format; } else { zeroFormat = null; } }; /************************************ Helpers ************************************/ function loadLanguage(key, values) { languages[key] = values; } /************************************ Numeral Prototype ************************************/ numeral.fn = Numeral.prototype = { clone : function () { return numeral(this); }, format : function (inputString) { return formatNumeral(this, inputString ? inputString : numeral.defaultFormat); }, unformat : function (inputString) { return unformatNumeral(this, inputString ? inputString : numeral.defaultFormat); }, value : function () { return this._n; }, valueOf : function () { return this._n; }, set : function (value) { this._n = Number(value); return this; }, add : function (value) { this._n = this._n + Number(value); return this; }, subtract : function (value) { this._n = this._n - Number(value); return this; }, multiply : function (value) { this._n = this._n * Number(value); return this; }, divide : function (value) { this._n = this._n / Number(value); return this; }, difference : function (value) { var difference = this._n - Number(value); if (difference < 0) { difference = -difference; } return difference; } }; /************************************ Exposing Numeral ************************************/ // CommonJS module is defined if (hasModule) { module.exports = numeral; } /*global ender:false */ if (typeof ender === 'undefined') { // here, `this` means `window` in the browser, or `global` on the server // add `numeral` as a global object via a string identifier, // for Closure Compiler 'advanced' mode this['numeral'] = numeral; } /*global define:false */ if (typeof define === 'function' && define.amd) { define([], function () { return numeral; }); } }).call(this); /*! * jQuery contextMenu - Plugin for simple contextMenu handling * * Version: 1.6.5 * * Authors: Rodney Rehm, Addy Osmani (patches for FF) * Web: http://medialize.github.com/jQuery-contextMenu/ * * Licensed under * MIT License http://www.opensource.org/licenses/mit-license * GPL v3 http://opensource.org/licenses/GPL-3.0 * */ (function($, undefined){ // TODO: - // ARIA stuff: menuitem, menuitemcheckbox und menuitemradio // create <menu> structure if $.support[htmlCommand || htmlMenuitem] and !opt.disableNative // determine html5 compatibility $.support.htmlMenuitem = ('HTMLMenuItemElement' in window); $.support.htmlCommand = ('HTMLCommandElement' in window); $.support.eventSelectstart = ("onselectstart" in document.documentElement); /* // should the need arise, test for css user-select $.support.cssUserSelect = (function(){ var t = false, e = document.createElement('div'); $.each('Moz|Webkit|Khtml|O|ms|Icab|'.split('|'), function(i, prefix) { var propCC = prefix + (prefix ? 'U' : 'u') + 'serSelect', prop = (prefix ? ('-' + prefix.toLowerCase() + '-') : '') + 'user-select'; e.style.cssText = prop + ': text;'; if (e.style[propCC] == 'text') { t = true; return false; } return true; }); return t; })(); */ if (!$.ui || !$.ui.widget) { // duck punch $.cleanData like jQueryUI does to get that remove event // https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.widget.js#L16-24 var _cleanData = $.cleanData; $.cleanData = function( elems ) { for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { try { $( elem ).triggerHandler( "remove" ); // http://bugs.jquery.com/ticket/8235 } catch( e ) {} } _cleanData( elems ); }; } var // currently active contextMenu trigger $currentTrigger = null, // is contextMenu initialized with at least one menu? initialized = false, // window handle $win = $(window), // number of registered menus counter = 0, // mapping selector to namespace namespaces = {}, // mapping namespace to options menus = {}, // custom command type handlers types = {}, // default values defaults = { // selector of contextMenu trigger selector: null, // where to append the menu to appendTo: null, // method to trigger context menu ["right", "left", "hover"] trigger: "right", // hide menu when mouse leaves trigger / menu elements autoHide: false, // ms to wait before showing a hover-triggered context menu delay: 200, // flag denoting if a second trigger should simply move (true) or rebuild (false) an open menu // as long as the trigger happened on one of the trigger-element's child nodes reposition: true, // determine position to show menu at determinePosition: function($menu) { // position to the lower middle of the trigger element if ($.ui && $.ui.position) { // .position() is provided as a jQuery UI utility // (...and it won't work on hidden elements) $menu.css('display', 'block').position({ my: "center top", at: "center bottom", of: this, offset: "0 5", collision: "fit" }).css('display', 'none'); } else { // determine contextMenu position var offset = this.offset(); offset.top += this.outerHeight(); offset.left += this.outerWidth() / 2 - $menu.outerWidth() / 2; $menu.css(offset); } }, // position menu position: function(opt, x, y) { var $this = this, offset; // determine contextMenu position if (!x && !y) { opt.determinePosition.call(this, opt.$menu); return; } else if (x === "maintain" && y === "maintain") { // x and y must not be changed (after re-show on command click) offset = opt.$menu.position(); } else { // x and y are given (by mouse event) offset = {top: y, left: x}; } // correct offset if viewport demands it var bottom = $win.scrollTop() + $win.height(), right = $win.scrollLeft() + $win.width(), height = opt.$menu.height(), width = opt.$menu.width(); if (offset.top + height > bottom) { offset.top -= height; } if (offset.left + width > right) { offset.left -= width; } opt.$menu.css(offset); }, // position the sub-menu positionSubmenu: function($menu) { if ($.ui && $.ui.position) { // .position() is provided as a jQuery UI utility // (...and it won't work on hidden elements) $menu.css('display', 'block').position({ my: "left top", at: "right top", of: this, collision: "flipfit fit" }).css('display', ''); } else { // determine contextMenu position var offset = { top: 0, left: this.outerWidth() }; $menu.css(offset); } }, // offset to add to zIndex zIndex: 1, // show hide animation settings animation: { duration: 50, show: 'slideDown', hide: 'slideUp' }, // events events: { show: $.noop, hide: $.noop }, // default callback callback: null, // list of contextMenu items items: {} }, // mouse position for hover activation hoveract = { timer: null, pageX: null, pageY: null }, // determine zIndex zindex = function($t) { var zin = 0, $tt = $t; while (true) { zin = Math.max(zin, parseInt($tt.css('z-index'), 10) || 0); $tt = $tt.parent(); if (!$tt || !$tt.length || "html body".indexOf($tt.prop('nodeName').toLowerCase()) > -1 ) { break; } } return zin; }, // event handlers handle = { // abort anything abortevent: function(e){ e.preventDefault(); e.stopImmediatePropagation(); }, // contextmenu show dispatcher contextmenu: function(e) { var $this = $(this); // disable actual context-menu e.preventDefault(); e.stopImmediatePropagation(); // abort native-triggered events unless we're triggering on right click if (e.data.trigger != 'right' && e.originalEvent) { return; } // abort event if menu is visible for this trigger if ($this.hasClass('context-menu-active')) { return; } if (!$this.hasClass('context-menu-disabled')) { // theoretically need to fire a show event at <menu> // http://www.whatwg.org/specs/web-apps/current-work/multipage/interactive-elements.html#context-menus // var evt = jQuery.Event("show", { data: data, pageX: e.pageX, pageY: e.pageY, relatedTarget: this }); // e.data.$menu.trigger(evt); $currentTrigger = $this; if (e.data.build) { var built = e.data.build($currentTrigger, e); // abort if build() returned false if (built === false) { return; } // dynamically build menu on invocation e.data = $.extend(true, {}, defaults, e.data, built || {}); // abort if there are no items to display if (!e.data.items || $.isEmptyObject(e.data.items)) { // Note: jQuery captures and ignores errors from event handlers if (window.console) { (console.error || console.log)("No items specified to show in contextMenu"); } throw new Error('No Items sepcified'); } // backreference for custom command type creation e.data.$trigger = $currentTrigger; op.create(e.data); } // show menu op.show.call($this, e.data, e.pageX, e.pageY); } }, // contextMenu left-click trigger click: function(e) { e.preventDefault(); e.stopImmediatePropagation(); $(this).trigger($.Event("contextmenu", { data: e.data, pageX: e.pageX, pageY: e.pageY })); }, // contextMenu right-click trigger mousedown: function(e) { // register mouse down var $this = $(this); // hide any previous menus if ($currentTrigger && $currentTrigger.length && !$currentTrigger.is($this)) { $currentTrigger.data('contextMenu').$menu.trigger('contextmenu:hide'); } // activate on right click if (e.button == 2) { $currentTrigger = $this.data('contextMenuActive', true); } }, // contextMenu right-click trigger mouseup: function(e) { // show menu var $this = $(this); if ($this.data('contextMenuActive') && $currentTrigger && $currentTrigger.length && $currentTrigger.is($this) && !$this.hasClass('context-menu-disabled')) { e.preventDefault(); e.stopImmediatePropagation(); $currentTrigger = $this; $this.trigger($.Event("contextmenu", { data: e.data, pageX: e.pageX, pageY: e.pageY })); } $this.removeData('contextMenuActive'); }, // contextMenu hover trigger mouseenter: function(e) { var $this = $(this), $related = $(e.relatedTarget), $document = $(document); // abort if we're coming from a menu if ($related.is('.context-menu-list') || $related.closest('.context-menu-list').length) { return; } // abort if a menu is shown if ($currentTrigger && $currentTrigger.length) { return; } hoveract.pageX = e.pageX; hoveract.pageY = e.pageY; hoveract.data = e.data; $document.on('mousemove.contextMenuShow', handle.mousemove); hoveract.timer = setTimeout(function() { hoveract.timer = null; $document.off('mousemove.contextMenuShow'); $currentTrigger = $this; $this.trigger($.Event("contextmenu", { data: hoveract.data, pageX: hoveract.pageX, pageY: hoveract.pageY })); }, e.data.delay ); }, // contextMenu hover trigger mousemove: function(e) { hoveract.pageX = e.pageX; hoveract.pageY = e.pageY; }, // contextMenu hover trigger mouseleave: function(e) { // abort if we're leaving for a menu var $related = $(e.relatedTarget); if ($related.is('.context-menu-list') || $related.closest('.context-menu-list').length) { return; } try { clearTimeout(hoveract.timer); } catch(e) {} hoveract.timer = null; }, // click on layer to hide contextMenu layerClick: function(e) { var $this = $(this), root = $this.data('contextMenuRoot'), mouseup = false, button = e.button, x = e.pageX, y = e.pageY, target, offset, selectors; e.preventDefault(); e.stopImmediatePropagation(); setTimeout(function() { var $window, hideshow, possibleTarget; var triggerAction = ((root.trigger == 'left' && button === 0) || (root.trigger == 'right' && button === 2)); // find the element that would've been clicked, wasn't the layer in the way if (document.elementFromPoint) { root.$layer.hide(); target = document.elementFromPoint(x - $win.scrollLeft(), y - $win.scrollTop()); root.$layer.show(); } if (root.reposition && triggerAction) { if (document.elementFromPoint) { if (root.$trigger.is(target) || root.$trigger.has(target).length) { root.position.call(root.$trigger, root, x, y); return; } } else { offset = root.$trigger.offset(); $window = $(window); // while this looks kinda awful, it's the best way to avoid // unnecessarily calculating any positions offset.top += $window.scrollTop(); if (offset.top <= e.pageY) { offset.left += $window.scrollLeft(); if (offset.left <= e.pageX) { offset.bottom = offset.top + root.$trigger.outerHeight(); if (offset.bottom >= e.pageY) { offset.right = offset.left + root.$trigger.outerWidth(); if (offset.right >= e.pageX) { // reposition root.position.call(root.$trigger, root, x, y); return; } } } } } } if (target && triggerAction) { root.$trigger.one('contextmenu:hidden', function() { $(target).contextMenu({x: x, y: y}); }); } root.$menu.trigger('contextmenu:hide'); }, 50); }, // key handled :hover keyStop: function(e, opt) { if (!opt.isInput) { e.preventDefault(); } e.stopPropagation(); }, key: function(e) { var opt = $currentTrigger.data('contextMenu') || {}; switch (e.keyCode) { case 9: case 38: // up handle.keyStop(e, opt); // if keyCode is [38 (up)] or [9 (tab) with shift] if (opt.isInput) { if (e.keyCode == 9 && e.shiftKey) { e.preventDefault(); opt.$selected && opt.$selected.find('input, textarea, select').blur(); opt.$menu.trigger('prevcommand'); return; } else if (e.keyCode == 38 && opt.$selected.find('input, textarea, select').prop('type') == 'checkbox') { // checkboxes don't capture this key e.preventDefault(); return; } } else if (e.keyCode != 9 || e.shiftKey) { opt.$menu.trigger('prevcommand'); return; } // omitting break; // case 9: // tab - reached through omitted break; case 40: // down handle.keyStop(e, opt); if (opt.isInput) { if (e.keyCode == 9) { e.preventDefault(); opt.$selected && opt.$selected.find('input, textarea, select').blur(); opt.$menu.trigger('nextcommand'); return; } else if (e.keyCode == 40 && opt.$selected.find('input, textarea, select').prop('type') == 'checkbox') { // checkboxes don't capture this key e.preventDefault(); return; } } else { opt.$menu.trigger('nextcommand'); return; } break; case 37: // left handle.keyStop(e, opt); if (opt.isInput || !opt.$selected || !opt.$selected.length) { break; } if (!opt.$selected.parent().hasClass('context-menu-root')) { var $parent = opt.$selected.parent().parent(); opt.$selected.trigger('contextmenu:blur'); opt.$selected = $parent; return; } break; case 39: // right handle.keyStop(e, opt); if (opt.isInput || !opt.$selected || !opt.$selected.length) { break; } var itemdata = opt.$selected.data('contextMenu') || {}; if (itemdata.$menu && opt.$selected.hasClass('context-menu-submenu')) { opt.$selected = null; itemdata.$selected = null; itemdata.$menu.trigger('nextcommand'); return; } break; case 35: // end case 36: // home if (opt.$selected && opt.$selected.find('input, textarea, select').length) { return; } else { (opt.$selected && opt.$selected.parent() || opt.$menu) .children(':not(.disabled, .not-selectable)')[e.keyCode == 36 ? 'first' : 'last']() .trigger('contextmenu:focus'); e.preventDefault(); return; } break; case 13: // enter handle.keyStop(e, opt); if (opt.isInput) { if (opt.$selected && !opt.$selected.is('textarea, select')) { e.preventDefault(); return; } break; } opt.$selected && opt.$selected.trigger('mouseup'); return; case 32: // space case 33: // page up case 34: // page down // prevent browser from scrolling down while menu is visible handle.keyStop(e, opt); return; case 27: // esc handle.keyStop(e, opt); opt.$menu.trigger('contextmenu:hide'); return; default: // 0-9, a-z var k = (String.fromCharCode(e.keyCode)).toUpperCase(); if (opt.accesskeys[k]) { // according to the specs accesskeys must be invoked immediately opt.accesskeys[k].$node.trigger(opt.accesskeys[k].$menu ? 'contextmenu:focus' : 'mouseup' ); return; } break; } // pass event to selected item, // stop propagation to avoid endless recursion e.stopPropagation(); opt.$selected && opt.$selected.trigger(e); }, // select previous possible command in menu prevItem: function(e) { e.stopPropagation(); var opt = $(this).data('contextMenu') || {}; // obtain currently selected menu if (opt.$selected) { var $s = opt.$selected; opt = opt.$selected.parent().data('contextMenu') || {}; opt.$selected = $s; } var $children = opt.$menu.children(), $prev = !opt.$selected || !opt.$selected.prev().length ? $children.last() : opt.$selected.prev(), $round = $prev; // skip disabled while ($prev.hasClass('disabled') || $prev.hasClass('not-selectable')) { if ($prev.prev().length) { $prev = $prev.prev(); } else { $prev = $children.last(); } if ($prev.is($round)) { // break endless loop return; } } // leave current if (opt.$selected) { handle.itemMouseleave.call(opt.$selected.get(0), e); } // activate next handle.itemMouseenter.call($prev.get(0), e); // focus input var $input = $prev.find('input, textarea, select'); if ($input.length) { $input.focus(); } }, // select next possible command in menu nextItem: function(e) { e.stopPropagation(); var opt = $(this).data('contextMenu') || {}; // obtain currently selected menu if (opt.$selected) { var $s = opt.$selected; opt = opt.$selected.parent().data('contextMenu') || {}; opt.$selected = $s; } var $children = opt.$menu.children(), $next = !opt.$selected || !opt.$selected.next().length ? $children.first() : opt.$selected.next(), $round = $next; // skip disabled while ($next.hasClass('disabled') || $next.hasClass('not-selectable')) { if ($next.next().length) { $next = $next.next(); } else { $next = $children.first(); } if ($next.is($round)) { // break endless loop return; } } // leave current if (opt.$selected) { handle.itemMouseleave.call(opt.$selected.get(0), e); } // activate next handle.itemMouseenter.call($next.get(0), e); // focus input var $input = $next.find('input, textarea, select'); if ($input.length) { $input.focus(); } }, // flag that we're inside an input so the key handler can act accordingly focusInput: function(e) { var $this = $(this).closest('.context-menu-item'), data = $this.data(), opt = data.contextMenu, root = data.contextMenuRoot; root.$selected = opt.$selected = $this; root.isInput = opt.isInput = true; }, // flag that we're inside an input so the key handler can act accordingly blurInput: function(e) { var $this = $(this).closest('.context-menu-item'), data = $this.data(), opt = data.contextMenu, root = data.contextMenuRoot; root.isInput = opt.isInput = false; }, // :hover on menu menuMouseenter: function(e) { var root = $(this).data().contextMenuRoot; root.hovering = true; }, // :hover on menu menuMouseleave: function(e) { var root = $(this).data().contextMenuRoot; if (root.$layer && root.$layer.is(e.relatedTarget)) { root.hovering = false; } }, // :hover done manually so key handling is possible itemMouseenter: function(e) { var $this = $(this), data = $this.data(), opt = data.contextMenu, root = data.contextMenuRoot; root.hovering = true; // abort if we're re-entering if (e && root.$layer && root.$layer.is(e.relatedTarget)) { e.preventDefault(); e.stopImmediatePropagation(); } // make sure only one item is selected (opt.$menu ? opt : root).$menu .children('.hover').trigger('contextmenu:blur'); if ($this.hasClass('disabled') || $this.hasClass('not-selectable')) { opt.$selected = null; return; } $this.trigger('contextmenu:focus'); }, // :hover done manually so key handling is possible itemMouseleave: function(e) { var $this = $(this), data = $this.data(), opt = data.contextMenu, root = data.contextMenuRoot; if (root !== opt && root.$layer && root.$layer.is(e.relatedTarget)) { root.$selected && root.$selected.trigger('contextmenu:blur'); e.preventDefault(); e.stopImmediatePropagation(); root.$selected = opt.$selected = opt.$node; return; } $this.trigger('contextmenu:blur'); }, // contextMenu item click itemClick: function(e) { var $this = $(this), data = $this.data(), opt = data.contextMenu, root = data.contextMenuRoot, key = data.contextMenuKey, callback; // abort if the key is unknown or disabled or is a menu if (!opt.items[key] || $this.is('.disabled, .context-menu-submenu, .context-menu-separator, .not-selectable')) { return; } e.preventDefault(); e.stopImmediatePropagation(); if ($.isFunction(root.callbacks[key]) && Object.prototype.hasOwnProperty.call(root.callbacks, key)) { // item-specific callback callback = root.callbacks[key]; } else if ($.isFunction(root.callback)) { // default callback callback = root.callback; } else { // no callback, no action return; } // hide menu if callback doesn't stop that if (callback.call(root.$trigger, key, root) !== false) { root.$menu.trigger('contextmenu:hide'); } else if (root.$menu.parent().length) { op.update.call(root.$trigger, root); } }, // ignore click events on input elements inputClick: function(e) { e.stopImmediatePropagation(); }, // hide <menu> hideMenu: function(e, data) { var root = $(this).data('contextMenuRoot'); op.hide.call(root.$trigger, root, data && data.force); }, // focus <command> focusItem: function(e) { e.stopPropagation(); var $this = $(this), data = $this.data(), opt = data.contextMenu, root = data.contextMenuRoot; $this.addClass('hover') .siblings('.hover').trigger('contextmenu:blur'); // remember selected opt.$selected = root.$selected = $this; // position sub-menu - do after show so dumb $.ui.position can keep up if (opt.$node) { root.positionSubmenu.call(opt.$node, opt.$menu); } }, // blur <command> blurItem: function(e) { e.stopPropagation(); var $this = $(this), data = $this.data(), opt = data.contextMenu, root = data.contextMenuRoot; $this.removeClass('hover'); opt.$selected = null; } }, // operations op = { show: function(opt, x, y) { var $trigger = $(this), offset, css = {}; // hide any open menus $('#context-menu-layer').trigger('mousedown'); // backreference for callbacks opt.$trigger = $trigger; // show event if (opt.events.show.call($trigger, opt) === false) { $currentTrigger = null; return; } // create or update context menu op.update.call($trigger, opt); // position menu opt.position.call($trigger, opt, x, y); // make sure we're in front if (opt.zIndex) { css.zIndex = zindex($trigger) + opt.zIndex; } // add layer op.layer.call(opt.$menu, opt, css.zIndex); // adjust sub-menu zIndexes opt.$menu.find('ul').css('zIndex', css.zIndex + 1); // position and show context menu opt.$menu.css( css )[opt.animation.show](opt.animation.duration, function() { $trigger.trigger('contextmenu:visible'); }); // make options available and set state $trigger .data('contextMenu', opt) .addClass("context-menu-active"); // register key handler $(document).off('keydown.contextMenu').on('keydown.contextMenu', handle.key); // register autoHide handler if (opt.autoHide) { // mouse position handler $(document).on('mousemove.contextMenuAutoHide', function(e) { // need to capture the offset on mousemove, // since the page might've been scrolled since activation var pos = $trigger.offset(); pos.right = pos.left + $trigger.outerWidth(); pos.bottom = pos.top + $trigger.outerHeight(); if (opt.$layer && !opt.hovering && (!(e.pageX >= pos.left && e.pageX <= pos.right) || !(e.pageY >= pos.top && e.pageY <= pos.bottom))) { // if mouse in menu... opt.$menu.trigger('contextmenu:hide'); } }); } }, hide: function(opt, force) { var $trigger = $(this); if (!opt) { opt = $trigger.data('contextMenu') || {}; } // hide event if (!force && opt.events && opt.events.hide.call($trigger, opt) === false) { return; } // remove options and revert state $trigger .removeData('contextMenu') .removeClass("context-menu-active"); if (opt.$layer) { // keep layer for a bit so the contextmenu event can be aborted properly by opera setTimeout((function($layer) { return function(){ $layer.remove(); }; })(opt.$layer), 10); try { delete opt.$layer; } catch(e) { opt.$layer = null; } } // remove handle $currentTrigger = null; // remove selected opt.$menu.find('.hover').trigger('contextmenu:blur'); opt.$selected = null; // unregister key and mouse handlers //$(document).off('.contextMenuAutoHide keydown.contextMenu'); // http://bugs.jquery.com/ticket/10705 $(document).off('.contextMenuAutoHide').off('keydown.contextMenu'); // hide menu opt.$menu && opt.$menu[opt.animation.hide](opt.animation.duration, function (){ // tear down dynamically built menu after animation is completed. if (opt.build) { opt.$menu.remove(); $.each(opt, function(key, value) { switch (key) { case 'ns': case 'selector': case 'build': case 'trigger': return true; default: opt[key] = undefined; try { delete opt[key]; } catch (e) {} return true; } }); } setTimeout(function() { $trigger.trigger('contextmenu:hidden'); }, 10); }); }, create: function(opt, root) { if (root === undefined) { root = opt; } // create contextMenu opt.$menu = $('<ul class="context-menu-list"></ul>').addClass(opt.className || "").data({ 'contextMenu': opt, 'contextMenuRoot': root }); $.each(['callbacks', 'commands', 'inputs'], function(i,k){ opt[k] = {}; if (!root[k]) { root[k] = {}; } }); root.accesskeys || (root.accesskeys = {}); // create contextMenu items $.each(opt.items, function(key, item){ var $t = $('<li class="context-menu-item"></li>').addClass(item.className || ""), $label = null, $input = null; // iOS needs to see a click-event bound to an element to actually // have the TouchEvents infrastructure trigger the click event $t.on('click', $.noop); item.$node = $t.data({ 'contextMenu': opt, 'contextMenuRoot': root, 'contextMenuKey': key }); // register accesskey // NOTE: the accesskey attribute should be applicable to any element, but Safari5 and Chrome13 still can't do that if (item.accesskey) { var aks = splitAccesskey(item.accesskey); for (var i=0, ak; ak = aks[i]; i++) { if (!root.accesskeys[ak]) { root.accesskeys[ak] = item; item._name = item.name.replace(new RegExp('(' + ak + ')', 'i'), '<span class="context-menu-accesskey">$1</span>'); break; } } } if (typeof item == "string") { $t.addClass('context-menu-separator not-selectable'); } else if (item.type && types[item.type]) { // run custom type handler types[item.type].call($t, item, opt, root); // register commands $.each([opt, root], function(i,k){ k.commands[key] = item; if ($.isFunction(item.callback)) { k.callbacks[key] = item.callback; } }); } else { // add label for input if (item.type == 'html') { $t.addClass('context-menu-html not-selectable'); } else if (item.type) { $label = $('<label></label>').appendTo($t); $('<span></span>').html(item._name || item.name).appendTo($label); $t.addClass('context-menu-input'); opt.hasTypes = true; $.each([opt, root], function(i,k){ k.commands[key] = item; k.inputs[key] = item; }); } else if (item.items) { item.type = 'sub'; } switch (item.type) { case 'text': $input = $('<input type="text" value="1" name="" value="">') .attr('name', 'context-menu-input-' + key) .val(item.value || "") .appendTo($label); break; case 'textarea': $input = $('<textarea name=""></textarea>') .attr('name', 'context-menu-input-' + key) .val(item.value || "") .appendTo($label); if (item.height) { $input.height(item.height); } break; case 'checkbox': $input = $('<input type="checkbox" value="1" name="" value="">') .attr('name', 'context-menu-input-' + key) .val(item.value || "") .prop("checked", !!item.selected) .prependTo($label); break; case 'radio': $input = $('<input type="radio" value="1" name="" value="">') .attr('name', 'context-menu-input-' + item.radio) .val(item.value || "") .prop("checked", !!item.selected) .prependTo($label); break; case 'select': $input = $('<select name="">') .attr('name', 'context-menu-input-' + key) .appendTo($label); if (item.options) { $.each(item.options, function(value, text) { $('<option></option>').val(value).text(text).appendTo($input); }); $input.val(item.selected); } break; case 'sub': // FIXME: shouldn't this .html() be a .text()? $('<span></span>').html(item._name || item.name).appendTo($t); item.appendTo = item.$node; op.create(item, root); $t.data('contextMenu', item).addClass('context-menu-submenu'); item.callback = null; break; case 'html': $(item.html).appendTo($t); break; default: $.each([opt, root], function(i,k){ k.commands[key] = item; if ($.isFunction(item.callback)) { k.callbacks[key] = item.callback; } }); // FIXME: shouldn't this .html() be a .text()? $('<span></span>').html(item._name || item.name || "").appendTo($t); break; } // disable key listener in <input> if (item.type && item.type != 'sub' && item.type != 'html') { $input .on('focus', handle.focusInput) .on('blur', handle.blurInput); if (item.events) { $input.on(item.events, opt); } } // add icons if (item.icon) { $t.addClass("icon icon-" + item.icon); } } // cache contained elements item.$input = $input; item.$label = $label; // attach item to menu $t.appendTo(opt.$menu); // Disable text selection if (!opt.hasTypes && $.support.eventSelectstart) { // browsers support user-select: none, // IE has a special event for text-selection // browsers supporting neither will not be preventing text-selection $t.on('selectstart.disableTextSelect', handle.abortevent); } }); // attach contextMenu to <body> (to bypass any possible overflow:hidden issues on parents of the trigger element) if (!opt.$node) { opt.$menu.css('display', 'none').addClass('context-menu-root'); } opt.$menu.appendTo(opt.appendTo || document.body); }, resize: function($menu, nested) { // determine widths of submenus, as CSS won't grow them automatically // position:absolute within position:absolute; min-width:100; max-width:200; results in width: 100; // kinda sucks hard... // determine width of absolutely positioned element $menu.css({position: 'absolute', display: 'block'}); // don't apply yet, because that would break nested elements' widths // add a pixel to circumvent word-break issue in IE9 - #80 $menu.data('width', Math.ceil($menu.width()) + 1); // reset styles so they allow nested elements to grow/shrink naturally $menu.css({ position: 'static', minWidth: '0px', maxWidth: '100000px' }); // identify width of nested menus $menu.find('> li > ul').each(function() { op.resize($(this), true); }); // reset and apply changes in the end because nested // elements' widths wouldn't be calculatable otherwise if (!nested) { $menu.find('ul').andSelf().css({ position: '', display: '', minWidth: '', maxWidth: '' }).width(function() { return $(this).data('width'); }); } }, update: function(opt, root) { var $trigger = this; if (root === undefined) { root = opt; op.resize(opt.$menu); } // re-check disabled for each item opt.$menu.children().each(function(){ var $item = $(this), key = $item.data('contextMenuKey'), item = opt.items[key], disabled = ($.isFunction(item.disabled) && item.disabled.call($trigger, key, root)) || item.disabled === true; // dis- / enable item $item[disabled ? 'addClass' : 'removeClass']('disabled'); if (item.type) { // dis- / enable input elements $item.find('input, select, textarea').prop('disabled', disabled); // update input states switch (item.type) { case 'text': case 'textarea': item.$input.val(item.value || ""); break; case 'checkbox': case 'radio': item.$input.val(item.value || "").prop('checked', !!item.selected); break; case 'select': item.$input.val(item.selected || ""); break; } } if (item.$menu) { // update sub-menu op.update.call($trigger, item, root); } }); }, layer: function(opt, zIndex) { // add transparent layer for click area // filter and background for Internet Explorer, Issue #23 var $layer = opt.$layer = $('<div id="context-menu-layer" style="position:fixed; z-index:' + zIndex + '; top:0; left:0; opacity: 0; filter: alpha(opacity=0); background-color: #000;"></div>') .css({height: $win.height(), width: $win.width(), display: 'block'}) .data('contextMenuRoot', opt) .insertBefore(this) .on('contextmenu', handle.abortevent) .on('mousedown', handle.layerClick); // IE6 doesn't know position:fixed; if (!$.support.fixedPosition) { $layer.css({ 'position' : 'absolute', 'height' : $(document).height() }); } return $layer; } }; // split accesskey according to http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#assigned-access-key function splitAccesskey(val) { var t = val.split(/\s+/), keys = []; for (var i=0, k; k = t[i]; i++) { k = k[0].toUpperCase(); // first character only // theoretically non-accessible characters should be ignored, but different systems, different keyboard layouts, ... screw it. // a map to look up already used access keys would be nice keys.push(k); } return keys; } // handle contextMenu triggers $.fn.contextMenu = function(operation) { if (operation === undefined) { this.first().trigger('contextmenu'); } else if (operation.x && operation.y) { this.first().trigger($.Event("contextmenu", {pageX: operation.x, pageY: operation.y})); } else if (operation === "hide") { var $menu = this.data('contextMenu').$menu; $menu && $menu.trigger('contextmenu:hide'); } else if (operation === "destroy") { $.contextMenu("destroy", {context: this}); } else if ($.isPlainObject(operation)) { operation.context = this; $.contextMenu("create", operation); } else if (operation) { this.removeClass('context-menu-disabled'); } else if (!operation) { this.addClass('context-menu-disabled'); } return this; }; // manage contextMenu instances $.contextMenu = function(operation, options) { if (typeof operation != 'string') { options = operation; operation = 'create'; } if (typeof options == 'string') { options = {selector: options}; } else if (options === undefined) { options = {}; } // merge with default options var o = $.extend(true, {}, defaults, options || {}); var $document = $(document); var $context = $document; var _hasContext = false; if (!o.context || !o.context.length) { o.context = document; } else { // you never know what they throw at you... $context = $(o.context).first(); o.context = $context.get(0); _hasContext = o.context !== document; } switch (operation) { case 'create': // no selector no joy if (!o.selector) { throw new Error('No selector specified'); } // make sure internal classes are not bound to if (o.selector.match(/.context-menu-(list|item|input)($|\s)/)) { throw new Error('Cannot bind to selector "' + o.selector + '" as it contains a reserved className'); } if (!o.build && (!o.items || $.isEmptyObject(o.items))) { throw new Error('No Items sepcified'); } counter ++; o.ns = '.contextMenu' + counter; if (!_hasContext) { namespaces[o.selector] = o.ns; } menus[o.ns] = o; // default to right click if (!o.trigger) { o.trigger = 'right'; } if (!initialized) { // make sure item click is registered first $document .on({ 'contextmenu:hide.contextMenu': handle.hideMenu, 'prevcommand.contextMenu': handle.prevItem, 'nextcommand.contextMenu': handle.nextItem, 'contextmenu.contextMenu': handle.abortevent, 'mouseenter.contextMenu': handle.menuMouseenter, 'mouseleave.contextMenu': handle.menuMouseleave }, '.context-menu-list') .on('mouseup.contextMenu', '.context-menu-input', handle.inputClick) .on({ 'mouseup.contextMenu': handle.itemClick, 'contextmenu:focus.contextMenu': handle.focusItem, 'contextmenu:blur.contextMenu': handle.blurItem, 'contextmenu.contextMenu': handle.abortevent, 'mouseenter.contextMenu': handle.itemMouseenter, 'mouseleave.contextMenu': handle.itemMouseleave }, '.context-menu-item'); initialized = true; } // engage native contextmenu event $context .on('contextmenu' + o.ns, o.selector, o, handle.contextmenu); if (_hasContext) { // add remove hook, just in case $context.on('remove' + o.ns, function() { $(this).contextMenu("destroy"); }); } switch (o.trigger) { case 'hover': $context .on('mouseenter' + o.ns, o.selector, o, handle.mouseenter) .on('mouseleave' + o.ns, o.selector, o, handle.mouseleave); break; case 'left': $context.on('click' + o.ns, o.selector, o, handle.click); break; /* default: // http://www.quirksmode.org/dom/events/contextmenu.html $document .on('mousedown' + o.ns, o.selector, o, handle.mousedown) .on('mouseup' + o.ns, o.selector, o, handle.mouseup); break; */ } // create menu if (!o.build) { op.create(o); } break; case 'destroy': var $visibleMenu; if (_hasContext) { // get proper options var context = o.context; $.each(menus, function(ns, o) { if (o.context !== context) { return true; } $visibleMenu = $('.context-menu-list').filter(':visible'); if ($visibleMenu.length && $visibleMenu.data().contextMenuRoot.$trigger.is($(o.context).find(o.selector))) { $visibleMenu.trigger('contextmenu:hide', {force: true}); } try { if (menus[o.ns].$menu) { menus[o.ns].$menu.remove(); } delete menus[o.ns]; } catch(e) { menus[o.ns] = null; } $(o.context).off(o.ns); return true; }); } else if (!o.selector) { $document.off('.contextMenu .contextMenuAutoHide'); $.each(menus, function(ns, o) { $(o.context).off(o.ns); }); namespaces = {}; menus = {}; counter = 0; initialized = false; $('#context-menu-layer, .context-menu-list').remove(); } else if (namespaces[o.selector]) { $visibleMenu = $('.context-menu-list').filter(':visible'); if ($visibleMenu.length && $visibleMenu.data().contextMenuRoot.$trigger.is(o.selector)) { $visibleMenu.trigger('contextmenu:hide', {force: true}); } try { if (menus[namespaces[o.selector]].$menu) { menus[namespaces[o.selector]].$menu.remove(); } delete menus[namespaces[o.selector]]; } catch(e) { menus[namespaces[o.selector]] = null; } $document.off(namespaces[o.selector]); } break; case 'html5': // if <command> or <menuitem> are not handled by the browser, // or options was a bool true, // initialize $.contextMenu for them if ((!$.support.htmlCommand && !$.support.htmlMenuitem) || (typeof options == "boolean" && options)) { $('menu[type="context"]').each(function() { if (this.id) { $.contextMenu({ selector: '[contextmenu=' + this.id +']', items: $.contextMenu.fromMenu(this) }); } }).css('display', 'none'); } break; default: throw new Error('Unknown operation "' + operation + '"'); } return this; }; // import values into <input> commands $.contextMenu.setInputValues = function(opt, data) { if (data === undefined) { data = {}; } $.each(opt.inputs, function(key, item) { switch (item.type) { case 'text': case 'textarea': item.value = data[key] || ""; break; case 'checkbox': item.selected = data[key] ? true : false; break; case 'radio': item.selected = (data[item.radio] || "") == item.value ? true : false; break; case 'select': item.selected = data[key] || ""; break; } }); }; // export values from <input> commands $.contextMenu.getInputValues = function(opt, data) { if (data === undefined) { data = {}; } $.each(opt.inputs, function(key, item) { switch (item.type) { case 'text': case 'textarea': case 'select': data[key] = item.$input.val(); break; case 'checkbox': data[key] = item.$input.prop('checked'); break; case 'radio': if (item.$input.prop('checked')) { data[item.radio] = item.value; } break; } }); return data; }; // find <label for="xyz"> function inputLabel(node) { return (node.id && $('label[for="'+ node.id +'"]').val()) || node.name; } // convert <menu> to items object function menuChildren(items, $children, counter) { if (!counter) { counter = 0; } $children.each(function() { var $node = $(this), node = this, nodeName = this.nodeName.toLowerCase(), label, item; // extract <label><input> if (nodeName == 'label' && $node.find('input, textarea, select').length) { label = $node.text(); $node = $node.children().first(); node = $node.get(0); nodeName = node.nodeName.toLowerCase(); } /* * <menu> accepts flow-content as children. that means <embed>, <canvas> and such are valid menu items. * Not being the sadistic kind, $.contextMenu only accepts: * <command>, <menuitem>, <hr>, <span>, <p> <input [text, radio, checkbox]>, <textarea>, <select> and of course <menu>. * Everything else will be imported as an html node, which is not interfaced with contextMenu. */ // http://www.whatwg.org/specs/web-apps/current-work/multipage/commands.html#concept-command switch (nodeName) { // http://www.whatwg.org/specs/web-apps/current-work/multipage/interactive-elements.html#the-menu-element case 'menu': item = {name: $node.attr('label'), items: {}}; counter = menuChildren(item.items, $node.children(), counter); break; // http://www.whatwg.org/specs/web-apps/current-work/multipage/commands.html#using-the-a-element-to-define-a-command case 'a': // http://www.whatwg.org/specs/web-apps/current-work/multipage/commands.html#using-the-button-element-to-define-a-command case 'button': item = { name: $node.text(), disabled: !!$node.attr('disabled'), callback: (function(){ return function(){ $node.click(); }; })() }; break; // http://www.whatwg.org/specs/web-apps/current-work/multipage/commands.html#using-the-command-element-to-define-a-command case 'menuitem': case 'command': switch ($node.attr('type')) { case undefined: case 'command': case 'menuitem': item = { name: $node.attr('label'), disabled: !!$node.attr('disabled'), callback: (function(){ return function(){ $node.click(); }; })() }; break; case 'checkbox': item = { type: 'checkbox', disabled: !!$node.attr('disabled'), name: $node.attr('label'), selected: !!$node.attr('checked') }; break; case 'radio': item = { type: 'radio', disabled: !!$node.attr('disabled'), name: $node.attr('label'), radio: $node.attr('radiogroup'), value: $node.attr('id'), selected: !!$node.attr('checked') }; break; default: item = undefined; } break; case 'hr': item = '-------'; break; case 'input': switch ($node.attr('type')) { case 'text': item = { type: 'text', name: label || inputLabel(node), disabled: !!$node.attr('disabled'), value: $node.val() }; break; case 'checkbox': item = { type: 'checkbox', name: label || inputLabel(node), disabled: !!$node.attr('disabled'), selected: !!$node.attr('checked') }; break; case 'radio': item = { type: 'radio', name: label || inputLabel(node), disabled: !!$node.attr('disabled'), radio: !!$node.attr('name'), value: $node.val(), selected: !!$node.attr('checked') }; break; default: item = undefined; break; } break; case 'select': item = { type: 'select', name: label || inputLabel(node), disabled: !!$node.attr('disabled'), selected: $node.val(), options: {} }; $node.children().each(function(){ item.options[this.value] = $(this).text(); }); break; case 'textarea': item = { type: 'textarea', name: label || inputLabel(node), disabled: !!$node.attr('disabled'), value: $node.val() }; break; case 'label': break; default: item = {type: 'html', html: $node.clone(true)}; break; } if (item) { counter++; items['key' + counter] = item; } }); return counter; } // convert html5 menu $.contextMenu.fromMenu = function(element) { var $this = $(element), items = {}; menuChildren(items, $this.children()); return items; }; // make defaults accessible $.contextMenu.defaults = defaults; $.contextMenu.types = types; // export internal functions - undocumented, for hacking only! $.contextMenu.handle = handle; $.contextMenu.op = op; $.contextMenu.menus = menus; })(jQuery);
Olical/cdnjs
ajax/libs/handsontable/0.9.13/jquery.handsontable.full.js
JavaScript
mit
428,264
// Licensed to the Software Freedom Conservancy (SFC) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The SFC licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. /** * @fileoverview An example of starting multiple WebDriver clients that run * in parallel in separate control flows. */ var webdriver = require('..'), By = webdriver.By, until = webdriver.until; for (var i = 0; i < 3; i++) { (function(n) { var flow = new webdriver.promise.ControlFlow() .on('uncaughtException', function(e) { console.log('uncaughtException in flow %d: %s', n, e); }); var driver = new webdriver.Builder(). forBrowser('firefox'). setControlFlow(flow). // Comment out this line to see the difference. build(); // Position and resize window so it's easy to see them running together. driver.manage().window().setSize(600, 400); driver.manage().window().setPosition(300 * i, 400 * i); driver.get('http://www.google.com'); driver.findElement(By.name('q')).sendKeys('webdriver'); driver.findElement(By.name('btnG')).click(); driver.wait(until.titleIs('webdriver - Google Search'), 1000); driver.quit(); })(i); }
ggs134/snackmean
node_modules/gulp-protractor/node_modules/protractor/node_modules/selenium-webdriver/example/parallel_flows.js
JavaScript
mit
1,843
(function(){ /** * Implement and manage single loop for WebApp life cycle * Provide tweening API for both property animation and frame animation(canvas or css) * * using AMD (Asynchronous Module Definition) API with OzJS * see http://ozjs.org for details * * Copyright (C) 2010-2012, Dexter.Yy, MIT License * vim: et:ts=4:sw=4:sts=4 */ var _ = require('./lang'); var easing = require('./easing/base'); var window = this, ANIMATE_FRAME = "RequestAnimationFrame", LONG_AFTER = 4000000000000, animateFrame = window['webkit' + ANIMATE_FRAME] || window['moz' + ANIMATE_FRAME] || window['o' + ANIMATE_FRAME] || window['ms' + ANIMATE_FRAME], suid = 1, ruid = 1, fps_limit = 0, activeStages = [], renderlib = {}, stageLib = {}, _default_config = { fps: 0, easing: _.copy(easing.functions) }; function loop(timestamp){ for (var i = 0, stage, l = activeStages.length; i < l; i++) { stage = activeStages[i]; if (stage) { if (timestamp - stage.lastLoop >= fps_limit) { stage.lastLoop = timestamp; stage.renders.call(stage, timestamp); } } } } var mainloop = { config: function(opt){ _.config(this, opt, _default_config); if (opt.fps) { fps_limit = this.fps ? (1000/this.fps) : 0; } return this; }, run: function(name){ if (name) { var stage = stageLib[name]; if (!stage) { this.addStage(name); stage = stageLib[name]; } if (stage && !stage.state) { stage.state = 1; activeStages.push(stage); stage.renders.forEach(function(render){ var _delay = this.delays[render._rid]; if (_delay) { _delay[3] = +new Date(); _delay[0] = setTimeout(_delay[1], _delay[2]); } }, stage); } if (this.globalSignal) { return this; } } var self = this, frameFn = animateFrame, clearInterv = clearInterval, _loop = loop, timer, signal = ++suid; this.globalSignal = 1; function step(){ if (suid === signal) { var timestamp = +new Date(); _loop(timestamp); if (self.globalSignal) { if (frameFn) { frameFn(step); } } else { clearInterv(timer); } } } if (frameFn) { frameFn(step); } else { timer = setInterval(step, 15); } return this; }, pause: function(name){ if (name) { var n = activeStages.indexOf(stageLib[name]); if (n >= 0) { var stage = stageLib[name]; activeStages.splice(n, 1); stage.state = 0; stage.pauseTime = +new Date(); stage.renders.forEach(function(render){ var _delay = this.delays[render._rid]; if (_delay) { clearTimeout(_delay[0]); _delay[2] -= (this.pauseTime - _delay[3]); } }, stage); } } else { this.globalSignal = 0; } return this; }, complete: function(name){ var stage = stageLib[name]; if (stage && stage.state) { stage.renders.forEach(function(render){ var _delay = stage.delays[render._rid]; if (_delay) { clearTimeout(_delay[0]); _delay[1](); } render.call(stage, this); }, LONG_AFTER); return this.remove(name); } return this; }, remove: function(name, fn){ if (fn) { var stage = stageLib[name]; if (stage) { clearTimeout((stage.delays[fn._rid] || [])[0]); stage.renders.clear(fn); } } else { this.pause(name); delete stageLib[name]; } return this; }, info: function(name){ return stageLib[name]; }, isRunning: function(name){ return !!(stageLib[name] || {}).state; }, addStage: function(name, ctx){ if (name) { stageLib[name] = { name: name, ctx: ctx, state: 0, lastLoop: 0, pauseTime: 0, delays: {}, renders: _.fnQueue() }; } return this; }, addRender: function(name, fn, ctx){ if (!stageLib[name]) { this.addStage(name, ctx); } this._lastestRender = fn; stageLib[name].renders.push(fn); return this; }, getRender: function(renderId){ return renderlib[renderId] || this._lastestRender; }, addTween: function(name, current, end, duration, opt){ var self = this, start, _delays, rid = opt.renderId, easing = opt.easing, lastPause = 0, d = end - current; function render(timestamp){ if (lastPause !== this.pauseTime && start < this.pauseTime) { lastPause = this.pauseTime; start += +new Date() - lastPause; } var v, time = timestamp - start, p = time/duration; if (time <= 0) { return; } if (p < 1) { if (easing) { p = self.easing[easing](p, time, 0, 1, duration); } if (d < 0) { p = 1 - p; v = end + -1 * d * p; } else { v = current + d * p; } } if (time >= duration) { opt.step(end, duration); self.remove(name, render); if (opt.callback) { opt.callback(); } } else { opt.step(v, time); } } if (opt.delay) { if (!stageLib[name]) { this.addStage(name); } if (!rid) { rid = opt.renderId = '_oz_mainloop_' + ruid++; } _delays = stageLib[name].delays; var _timer = setTimeout(add_render, opt.delay); _delays[rid] = [_timer, add_render, opt.delay, +new Date()]; } else { add_render(); } if (rid) { render._rid = rid; renderlib[rid] = render; } function add_render(){ if (_delays) { delete _delays[rid]; } if (duration) { opt.step(current, 0); } else { opt.step(end, 0); if (opt.callback) { setTimeout(function(){ opt.callback(); }, 0); } return; } start = +new Date(); self.addRender(name, render); } return this; } }; mainloop.config(_default_config); module.exports = mainloop; })();
jemmy655/cdnjs
ajax/libs/mo/1.6.7/mainloop.js
JavaScript
mit
8,650
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "AM", "PM" ], "DAY": [ "domingo", "segunda-feira", "ter\u00e7a-feira", "quarta-feira", "quinta-feira", "sexta-feira", "s\u00e1bado" ], "MONTH": [ "janeiro", "fevereiro", "mar\u00e7o", "abril", "maio", "junho", "julho", "agosto", "setembro", "outubro", "novembro", "dezembro" ], "SHORTDAY": [ "dom", "seg", "ter", "qua", "qui", "sex", "s\u00e1b" ], "SHORTMONTH": [ "jan", "fev", "mar", "abr", "mai", "jun", "jul", "ago", "set", "out", "nov", "dez" ], "fullDate": "EEEE, d 'de' MMMM 'de' y", "longDate": "d 'de' MMMM 'de' y", "medium": "dd/MM/yyyy HH:mm:ss", "mediumDate": "dd/MM/yyyy", "mediumTime": "HH:mm:ss", "short": "dd/MM/yy HH:mm", "shortDate": "dd/MM/yy", "shortTime": "HH:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "R$", "DECIMAL_SEP": ",", "GROUP_SEP": ".", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "macFrac": 0, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "macFrac": 0, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "(\u00a4", "negSuf": ")", "posPre": "\u00a4", "posSuf": "" } ] }, "id": "pt-br", "pluralCat": function (n) { if (n == 1) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
jonathantneal/cdnjs
ajax/libs/angular-i18n/1.2.9/angular-locale_pt-br.js
JavaScript
mit
1,983
require 'memcache' module ActiveSupport module Cache # A cache store implementation which stores data in Memcached: # http://www.danga.com/memcached/ # # This is currently the most popular cache store for production websites. # # Special features: # - Clustering and load balancing. One can specify multiple memcached servers, # and MemCacheStore will load balance between all available servers. If a # server goes down, then MemCacheStore will ignore it until it goes back # online. # - Time-based expiry support. See #write and the +:expires_in+ option. # - Per-request in memory cache for all communication with the MemCache server(s). class MemCacheStore < Store module Response # :nodoc: STORED = "STORED\r\n" NOT_STORED = "NOT_STORED\r\n" EXISTS = "EXISTS\r\n" NOT_FOUND = "NOT_FOUND\r\n" DELETED = "DELETED\r\n" end def self.build_mem_cache(*addresses) addresses = addresses.flatten options = addresses.extract_options! addresses = ["localhost"] if addresses.empty? MemCache.new(addresses, options) end # Creates a new MemCacheStore object, with the given memcached server # addresses. Each address is either a host name, or a host-with-port string # in the form of "host_name:port". For example: # # ActiveSupport::Cache::MemCacheStore.new("localhost", "server-downstairs.localnetwork:8229") # # If no addresses are specified, then MemCacheStore will connect to # localhost port 11211 (the default memcached port). # # Instead of addresses one can pass in a MemCache-like object. For example: # # require 'memcached' # gem install memcached; uses C bindings to libmemcached # ActiveSupport::Cache::MemCacheStore.new(Memcached::Rails.new("localhost:11211")) def initialize(*addresses) if addresses.first.respond_to?(:get) @data = addresses.first else @data = self.class.build_mem_cache(*addresses) end extend Strategy::LocalCache end # Reads multiple keys from the cache. def read_multi(*keys) @data.get_multi keys end def read(key, options = nil) # :nodoc: super @data.get(key, raw?(options)) rescue MemCache::MemCacheError => e logger.error("MemCacheError (#{e}): #{e.message}") nil end # Writes a value to the cache. # # Possible options: # - +:unless_exist+ - set to true if you don't want to update the cache # if the key is already set. # - +:expires_in+ - the number of seconds that this value may stay in # the cache. See ActiveSupport::Cache::Store#write for an example. def write(key, value, options = nil) super method = options && options[:unless_exist] ? :add : :set # memcache-client will break the connection if you send it an integer # in raw mode, so we convert it to a string to be sure it continues working. value = value.to_s if raw?(options) response = @data.send(method, key, value, expires_in(options), raw?(options)) response == Response::STORED rescue MemCache::MemCacheError => e logger.error("MemCacheError (#{e}): #{e.message}") false end def delete(key, options = nil) # :nodoc: super response = @data.delete(key, expires_in(options)) response == Response::DELETED rescue MemCache::MemCacheError => e logger.error("MemCacheError (#{e}): #{e.message}") false end def exist?(key, options = nil) # :nodoc: # Doesn't call super, cause exist? in memcache is in fact a read # But who cares? Reading is very fast anyway # Local cache is checked first, if it doesn't know then memcache itself is read from !read(key, options).nil? end def increment(key, amount = 1) # :nodoc: log("incrementing", key, amount) response = @data.incr(key, amount) response == Response::NOT_FOUND ? nil : response rescue MemCache::MemCacheError nil end def decrement(key, amount = 1) # :nodoc: log("decrement", key, amount) response = @data.decr(key, amount) response == Response::NOT_FOUND ? nil : response rescue MemCache::MemCacheError nil end def delete_matched(matcher, options = nil) # :nodoc: # don't do any local caching at present, just pass # through and let the error happen super raise "Not supported by Memcache" end def clear @data.flush_all end def stats @data.stats end private def raw?(options) options && options[:raw] end end end end
tmtm/ruby-benchmark-suite
benchmarks/rails/substruct/vendor/rails/activesupport/lib/active_support/cache/mem_cache_store.rb
Ruby
mit
4,933
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.CycleDOM = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ "use strict"; var Rx = require("rx"); function makeRequestProxies(drivers) { var requestProxies = {}; for (var _name in drivers) { if (drivers.hasOwnProperty(_name)) { requestProxies[_name] = new Rx.ReplaySubject(1); } } return requestProxies; } function callDrivers(drivers, requestProxies) { var responses = {}; for (var _name2 in drivers) { if (drivers.hasOwnProperty(_name2)) { responses[_name2] = drivers[_name2](requestProxies[_name2], _name2); } } return responses; } function attachDisposeToRequests(requests, replicationSubscription) { Object.defineProperty(requests, "dispose", { enumerable: false, value: function value() { replicationSubscription.dispose(); } }); return requests; } function makeDisposeResponses(responses) { return function dispose() { for (var _name3 in responses) { if (responses.hasOwnProperty(_name3) && typeof responses[_name3].dispose === "function") { responses[_name3].dispose(); } } }; } function attachDisposeToResponses(responses) { Object.defineProperty(responses, "dispose", { enumerable: false, value: makeDisposeResponses(responses) }); return responses; } function logToConsoleError(err) { var target = err.stack || err; if (console && console.error) { console.error(target); } } function replicateMany(observables, subjects) { return Rx.Observable.create(function (observer) { var subscription = new Rx.CompositeDisposable(); setTimeout(function () { for (var _name4 in observables) { if (observables.hasOwnProperty(_name4) && subjects.hasOwnProperty(_name4) && !subjects[_name4].isDisposed) { subscription.add(observables[_name4].doOnError(logToConsoleError).subscribe(subjects[_name4].asObserver())); } } observer.onNext(subscription); }, 1); return function dispose() { subscription.dispose(); for (var x in subjects) { if (subjects.hasOwnProperty(x)) { subjects[x].dispose(); } } }; }); } function isObjectEmpty(obj) { for (var key in obj) { if (obj.hasOwnProperty(key)) { return false; } } return true; } function run(main, drivers) { if (typeof main !== "function") { throw new Error("First argument given to Cycle.run() must be the 'main' " + "function."); } if (typeof drivers !== "object" || drivers === null) { throw new Error("Second argument given to Cycle.run() must be an object " + "with driver functions as properties."); } if (isObjectEmpty(drivers)) { throw new Error("Second argument given to Cycle.run() must be an object " + "with at least one driver function declared as a property."); } var requestProxies = makeRequestProxies(drivers); var responses = callDrivers(drivers, requestProxies); var requests = main(responses); var subscription = replicateMany(requests, requestProxies).subscribe(); var requestsWithDispose = attachDisposeToRequests(requests, subscription); var responsesWithDispose = attachDisposeToResponses(responses); return [requestsWithDispose, responsesWithDispose]; } var Cycle = { /** * Takes an `main` function and circularly connects it to the given collection * of driver functions. * * The `main` function expects a collection of "driver response" Observables * as input, and should return a collection of "driver request" Observables. * A "collection of Observables" is a JavaScript object where * keys match the driver names registered by the `drivers` object, and values * are Observables or a collection of Observables. * * @param {Function} main a function that takes `responses` as input * and outputs a collection of `requests` Observables. * @param {Object} drivers an object where keys are driver names and values * are driver functions. * @return {Array} an array where the first object is the collection of driver * requests, and the second object is the collection of driver responses, that * can be used for debugging or testing. * @function run */ run: run, /** * A shortcut to the root object of * [RxJS](https://github.com/Reactive-Extensions/RxJS). * @name Rx */ Rx: Rx }; module.exports = Cycle; },{"rx":2}],2:[function(require,module,exports){ (function (process,global){ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. ;(function (undefined) { var objectTypes = { 'function': true, 'object': true }; var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports, freeSelf = objectTypes[typeof self] && self.Object && self, freeWindow = objectTypes[typeof window] && window && window.Object && window, freeModule = objectTypes[typeof module] && module && !module.nodeType && module, moduleExports = freeModule && freeModule.exports === freeExports && freeExports, freeGlobal = freeExports && freeModule && typeof global == 'object' && global && global.Object && global; var root = root = freeGlobal || ((freeWindow !== (this && this.window)) && freeWindow) || freeSelf || this; var Rx = { internals: {}, config: { Promise: root.Promise }, helpers: { } }; // Defaults var noop = Rx.helpers.noop = function () { }, identity = Rx.helpers.identity = function (x) { return x; }, defaultNow = Rx.helpers.defaultNow = Date.now, defaultComparer = Rx.helpers.defaultComparer = function (x, y) { return isEqual(x, y); }, defaultSubComparer = Rx.helpers.defaultSubComparer = function (x, y) { return x > y ? 1 : (x < y ? -1 : 0); }, defaultKeySerializer = Rx.helpers.defaultKeySerializer = function (x) { return x.toString(); }, defaultError = Rx.helpers.defaultError = function (err) { throw err; }, isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.subscribe !== 'function' && typeof p.then === 'function'; }, isFunction = Rx.helpers.isFunction = (function () { var isFn = function (value) { return typeof value == 'function' || false; } // fallback for older versions of Chrome and Safari if (isFn(/x/)) { isFn = function(value) { return typeof value == 'function' && toString.call(value) == '[object Function]'; }; } return isFn; }()); function cloneArray(arr) { for(var a = [], i = 0, len = arr.length; i < len; i++) { a.push(arr[i]); } return a;} var errorObj = {e: {}}; var tryCatchTarget; function tryCatcher() { try { return tryCatchTarget.apply(this, arguments); } catch (e) { errorObj.e = e; return errorObj; } } function tryCatch(fn) { if (!isFunction(fn)) { throw new TypeError('fn must be a function'); } tryCatchTarget = fn; return tryCatcher; } function thrower(e) { throw e; } Rx.config.longStackSupport = false; var hasStacks = false, stacks = tryCatch(function () { throw new Error(); })(); hasStacks = !!stacks.e && !!stacks.e.stack; // All code after this point will be filtered from stack traces reported by RxJS var rStartingLine = captureLine(), rFileName; var STACK_JUMP_SEPARATOR = 'From previous event:'; function makeStackTraceLong(error, observable) { // If possible, transform the error stack trace by removing Node and RxJS // cruft, then concatenating with the stack trace of `observable`. if (hasStacks && observable.stack && typeof error === 'object' && error !== null && error.stack && error.stack.indexOf(STACK_JUMP_SEPARATOR) === -1 ) { var stacks = []; for (var o = observable; !!o; o = o.source) { if (o.stack) { stacks.unshift(o.stack); } } stacks.unshift(error.stack); var concatedStacks = stacks.join('\n' + STACK_JUMP_SEPARATOR + '\n'); error.stack = filterStackString(concatedStacks); } } function filterStackString(stackString) { var lines = stackString.split('\n'), desiredLines = []; for (var i = 0, len = lines.length; i < len; i++) { var line = lines[i]; if (!isInternalFrame(line) && !isNodeFrame(line) && line) { desiredLines.push(line); } } return desiredLines.join('\n'); } function isInternalFrame(stackLine) { var fileNameAndLineNumber = getFileNameAndLineNumber(stackLine); if (!fileNameAndLineNumber) { return false; } var fileName = fileNameAndLineNumber[0], lineNumber = fileNameAndLineNumber[1]; return fileName === rFileName && lineNumber >= rStartingLine && lineNumber <= rEndingLine; } function isNodeFrame(stackLine) { return stackLine.indexOf('(module.js:') !== -1 || stackLine.indexOf('(node.js:') !== -1; } function captureLine() { if (!hasStacks) { return; } try { throw new Error(); } catch (e) { var lines = e.stack.split('\n'); var firstLine = lines[0].indexOf('@') > 0 ? lines[1] : lines[2]; var fileNameAndLineNumber = getFileNameAndLineNumber(firstLine); if (!fileNameAndLineNumber) { return; } rFileName = fileNameAndLineNumber[0]; return fileNameAndLineNumber[1]; } } function getFileNameAndLineNumber(stackLine) { // Named functions: 'at functionName (filename:lineNumber:columnNumber)' var attempt1 = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(stackLine); if (attempt1) { return [attempt1[1], Number(attempt1[2])]; } // Anonymous functions: 'at filename:lineNumber:columnNumber' var attempt2 = /at ([^ ]+):(\d+):(?:\d+)$/.exec(stackLine); if (attempt2) { return [attempt2[1], Number(attempt2[2])]; } // Firefox style: 'function@filename:lineNumber or @filename:lineNumber' var attempt3 = /.*@(.+):(\d+)$/.exec(stackLine); if (attempt3) { return [attempt3[1], Number(attempt3[2])]; } } var EmptyError = Rx.EmptyError = function() { this.message = 'Sequence contains no elements.'; this.name = 'EmptyError'; Error.call(this); }; EmptyError.prototype = Error.prototype; var ObjectDisposedError = Rx.ObjectDisposedError = function() { this.message = 'Object has been disposed'; this.name = 'ObjectDisposedError'; Error.call(this); }; ObjectDisposedError.prototype = Error.prototype; var ArgumentOutOfRangeError = Rx.ArgumentOutOfRangeError = function () { this.message = 'Argument out of range'; this.name = 'ArgumentOutOfRangeError'; Error.call(this); }; ArgumentOutOfRangeError.prototype = Error.prototype; var NotSupportedError = Rx.NotSupportedError = function (message) { this.message = message || 'This operation is not supported'; this.name = 'NotSupportedError'; Error.call(this); }; NotSupportedError.prototype = Error.prototype; var NotImplementedError = Rx.NotImplementedError = function (message) { this.message = message || 'This operation is not implemented'; this.name = 'NotImplementedError'; Error.call(this); }; NotImplementedError.prototype = Error.prototype; var notImplemented = Rx.helpers.notImplemented = function () { throw new NotImplementedError(); }; var notSupported = Rx.helpers.notSupported = function () { throw new NotSupportedError(); }; // Shim in iterator support var $iterator$ = (typeof Symbol === 'function' && Symbol.iterator) || '_es6shim_iterator_'; // Bug for mozilla version if (root.Set && typeof new root.Set()['@@iterator'] === 'function') { $iterator$ = '@@iterator'; } var doneEnumerator = Rx.doneEnumerator = { done: true, value: undefined }; var isIterable = Rx.helpers.isIterable = function (o) { return o[$iterator$] !== undefined; } var isArrayLike = Rx.helpers.isArrayLike = function (o) { return o && o.length !== undefined; } Rx.helpers.iterator = $iterator$; var bindCallback = Rx.internals.bindCallback = function (func, thisArg, argCount) { if (typeof thisArg === 'undefined') { return func; } switch(argCount) { case 0: return function() { return func.call(thisArg) }; case 1: return function(arg) { return func.call(thisArg, arg); } case 2: return function(value, index) { return func.call(thisArg, value, index); }; case 3: return function(value, index, collection) { return func.call(thisArg, value, index, collection); }; } return function() { return func.apply(thisArg, arguments); }; }; /** Used to determine if values are of the language type Object */ var dontEnums = ['toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor'], dontEnumsLength = dontEnums.length; /** `Object#toString` result shortcuts */ var argsClass = '[object Arguments]', arrayClass = '[object Array]', boolClass = '[object Boolean]', dateClass = '[object Date]', errorClass = '[object Error]', funcClass = '[object Function]', numberClass = '[object Number]', objectClass = '[object Object]', regexpClass = '[object RegExp]', stringClass = '[object String]'; var toString = Object.prototype.toString, hasOwnProperty = Object.prototype.hasOwnProperty, supportsArgsClass = toString.call(arguments) == argsClass, // For less <IE9 && FF<4 supportNodeClass, errorProto = Error.prototype, objectProto = Object.prototype, stringProto = String.prototype, propertyIsEnumerable = objectProto.propertyIsEnumerable; try { supportNodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + '')); } catch (e) { supportNodeClass = true; } var nonEnumProps = {}; nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true }; nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': true, 'toString': true, 'valueOf': true }; nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': true, 'toString': true }; nonEnumProps[objectClass] = { 'constructor': true }; var support = {}; (function () { var ctor = function() { this.x = 1; }, props = []; ctor.prototype = { 'valueOf': 1, 'y': 1 }; for (var key in new ctor) { props.push(key); } for (key in arguments) { } // Detect if `name` or `message` properties of `Error.prototype` are enumerable by default. support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name'); // Detect if `prototype` properties are enumerable by default. support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype'); // Detect if `arguments` object indexes are non-enumerable support.nonEnumArgs = key != 0; // Detect if properties shadowing those on `Object.prototype` are non-enumerable. support.nonEnumShadows = !/valueOf/.test(props); }(1)); var isObject = Rx.internals.isObject = function(value) { var type = typeof value; return value && (type == 'function' || type == 'object') || false; }; function keysIn(object) { var result = []; if (!isObject(object)) { return result; } if (support.nonEnumArgs && object.length && isArguments(object)) { object = slice.call(object); } var skipProto = support.enumPrototypes && typeof object == 'function', skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error); for (var key in object) { if (!(skipProto && key == 'prototype') && !(skipErrorProps && (key == 'message' || key == 'name'))) { result.push(key); } } if (support.nonEnumShadows && object !== objectProto) { var ctor = object.constructor, index = -1, length = dontEnumsLength; if (object === (ctor && ctor.prototype)) { var className = object === stringProto ? stringClass : object === errorProto ? errorClass : toString.call(object), nonEnum = nonEnumProps[className]; } while (++index < length) { key = dontEnums[index]; if (!(nonEnum && nonEnum[key]) && hasOwnProperty.call(object, key)) { result.push(key); } } } return result; } function internalFor(object, callback, keysFunc) { var index = -1, props = keysFunc(object), length = props.length; while (++index < length) { var key = props[index]; if (callback(object[key], key, object) === false) { break; } } return object; } function internalForIn(object, callback) { return internalFor(object, callback, keysIn); } function isNode(value) { // IE < 9 presents DOM nodes as `Object` objects except they have `toString` // methods that are `typeof` "string" and still can coerce nodes to strings return typeof value.toString != 'function' && typeof (value + '') == 'string'; } var isArguments = function(value) { return (value && typeof value == 'object') ? toString.call(value) == argsClass : false; } // fallback for browsers that can't detect `arguments` objects by [[Class]] if (!supportsArgsClass) { isArguments = function(value) { return (value && typeof value == 'object') ? hasOwnProperty.call(value, 'callee') : false; }; } var isEqual = Rx.internals.isEqual = function (x, y) { return deepEquals(x, y, [], []); }; /** @private * Used for deep comparison **/ function deepEquals(a, b, stackA, stackB) { // exit early for identical values if (a === b) { // treat `+0` vs. `-0` as not equal return a !== 0 || (1 / a == 1 / b); } var type = typeof a, otherType = typeof b; // exit early for unlike primitive values if (a === a && (a == null || b == null || (type != 'function' && type != 'object' && otherType != 'function' && otherType != 'object'))) { return false; } // compare [[Class]] names var className = toString.call(a), otherClass = toString.call(b); if (className == argsClass) { className = objectClass; } if (otherClass == argsClass) { otherClass = objectClass; } if (className != otherClass) { return false; } switch (className) { case boolClass: case dateClass: // coerce dates and booleans to numbers, dates to milliseconds and booleans // to `1` or `0` treating invalid dates coerced to `NaN` as not equal return +a == +b; case numberClass: // treat `NaN` vs. `NaN` as equal return (a != +a) ? b != +b : // but treat `-0` vs. `+0` as not equal (a == 0 ? (1 / a == 1 / b) : a == +b); case regexpClass: case stringClass: // coerce regexes to strings (http://es5.github.io/#x15.10.6.4) // treat string primitives and their corresponding object instances as equal return a == String(b); } var isArr = className == arrayClass; if (!isArr) { // exit for functions and DOM nodes if (className != objectClass || (!support.nodeClass && (isNode(a) || isNode(b)))) { return false; } // in older versions of Opera, `arguments` objects have `Array` constructors var ctorA = !support.argsObject && isArguments(a) ? Object : a.constructor, ctorB = !support.argsObject && isArguments(b) ? Object : b.constructor; // non `Object` object instances with different constructors are not equal if (ctorA != ctorB && !(hasOwnProperty.call(a, 'constructor') && hasOwnProperty.call(b, 'constructor')) && !(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) && ('constructor' in a && 'constructor' in b) ) { return false; } } // assume cyclic structures are equal // the algorithm for detecting cyclic structures is adapted from ES 5.1 // section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3) var initedStack = !stackA; stackA || (stackA = []); stackB || (stackB = []); var length = stackA.length; while (length--) { if (stackA[length] == a) { return stackB[length] == b; } } var size = 0; var result = true; // add `a` and `b` to the stack of traversed objects stackA.push(a); stackB.push(b); // recursively compare objects and arrays (susceptible to call stack limits) if (isArr) { // compare lengths to determine if a deep comparison is necessary length = a.length; size = b.length; result = size == length; if (result) { // deep compare the contents, ignoring non-numeric properties while (size--) { var index = length, value = b[size]; if (!(result = deepEquals(a[size], value, stackA, stackB))) { break; } } } } else { // deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys` // which, in this case, is more costly internalForIn(b, function(value, key, b) { if (hasOwnProperty.call(b, key)) { // count the number of properties. size++; // deep compare each property value. return (result = hasOwnProperty.call(a, key) && deepEquals(a[key], value, stackA, stackB)); } }); if (result) { // ensure both objects have the same number of properties internalForIn(a, function(value, key, a) { if (hasOwnProperty.call(a, key)) { // `size` will be `-1` if `a` has more properties than `b` return (result = --size > -1); } }); } } stackA.pop(); stackB.pop(); return result; } var hasProp = {}.hasOwnProperty, slice = Array.prototype.slice; var inherits = Rx.internals.inherits = function (child, parent) { function __() { this.constructor = child; } __.prototype = parent.prototype; child.prototype = new __(); }; var addProperties = Rx.internals.addProperties = function (obj) { for(var sources = [], i = 1, len = arguments.length; i < len; i++) { sources.push(arguments[i]); } for (var idx = 0, ln = sources.length; idx < ln; idx++) { var source = sources[idx]; for (var prop in source) { obj[prop] = source[prop]; } } }; // Rx Utils var addRef = Rx.internals.addRef = function (xs, r) { return new AnonymousObservable(function (observer) { return new CompositeDisposable(r.getDisposable(), xs.subscribe(observer)); }); }; function arrayInitialize(count, factory) { var a = new Array(count); for (var i = 0; i < count; i++) { a[i] = factory(); } return a; } // Collections function IndexedItem(id, value) { this.id = id; this.value = value; } IndexedItem.prototype.compareTo = function (other) { var c = this.value.compareTo(other.value); c === 0 && (c = this.id - other.id); return c; }; // Priority Queue for Scheduling var PriorityQueue = Rx.internals.PriorityQueue = function (capacity) { this.items = new Array(capacity); this.length = 0; }; var priorityProto = PriorityQueue.prototype; priorityProto.isHigherPriority = function (left, right) { return this.items[left].compareTo(this.items[right]) < 0; }; priorityProto.percolate = function (index) { if (index >= this.length || index < 0) { return; } var parent = index - 1 >> 1; if (parent < 0 || parent === index) { return; } if (this.isHigherPriority(index, parent)) { var temp = this.items[index]; this.items[index] = this.items[parent]; this.items[parent] = temp; this.percolate(parent); } }; priorityProto.heapify = function (index) { +index || (index = 0); if (index >= this.length || index < 0) { return; } var left = 2 * index + 1, right = 2 * index + 2, first = index; if (left < this.length && this.isHigherPriority(left, first)) { first = left; } if (right < this.length && this.isHigherPriority(right, first)) { first = right; } if (first !== index) { var temp = this.items[index]; this.items[index] = this.items[first]; this.items[first] = temp; this.heapify(first); } }; priorityProto.peek = function () { return this.items[0].value; }; priorityProto.removeAt = function (index) { this.items[index] = this.items[--this.length]; this.items[this.length] = undefined; this.heapify(); }; priorityProto.dequeue = function () { var result = this.peek(); this.removeAt(0); return result; }; priorityProto.enqueue = function (item) { var index = this.length++; this.items[index] = new IndexedItem(PriorityQueue.count++, item); this.percolate(index); }; priorityProto.remove = function (item) { for (var i = 0; i < this.length; i++) { if (this.items[i].value === item) { this.removeAt(i); return true; } } return false; }; PriorityQueue.count = 0; /** * Represents a group of disposable resources that are disposed together. * @constructor */ var CompositeDisposable = Rx.CompositeDisposable = function () { var args = [], i, len; if (Array.isArray(arguments[0])) { args = arguments[0]; len = args.length; } else { len = arguments.length; args = new Array(len); for(i = 0; i < len; i++) { args[i] = arguments[i]; } } for(i = 0; i < len; i++) { if (!isDisposable(args[i])) { throw new TypeError('Not a disposable'); } } this.disposables = args; this.isDisposed = false; this.length = args.length; }; var CompositeDisposablePrototype = CompositeDisposable.prototype; /** * Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed. * @param {Mixed} item Disposable to add. */ CompositeDisposablePrototype.add = function (item) { if (this.isDisposed) { item.dispose(); } else { this.disposables.push(item); this.length++; } }; /** * Removes and disposes the first occurrence of a disposable from the CompositeDisposable. * @param {Mixed} item Disposable to remove. * @returns {Boolean} true if found; false otherwise. */ CompositeDisposablePrototype.remove = function (item) { var shouldDispose = false; if (!this.isDisposed) { var idx = this.disposables.indexOf(item); if (idx !== -1) { shouldDispose = true; this.disposables.splice(idx, 1); this.length--; item.dispose(); } } return shouldDispose; }; /** * Disposes all disposables in the group and removes them from the group. */ CompositeDisposablePrototype.dispose = function () { if (!this.isDisposed) { this.isDisposed = true; var len = this.disposables.length, currentDisposables = new Array(len); for(var i = 0; i < len; i++) { currentDisposables[i] = this.disposables[i]; } this.disposables = []; this.length = 0; for (i = 0; i < len; i++) { currentDisposables[i].dispose(); } } }; /** * Provides a set of static methods for creating Disposables. * @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once. */ var Disposable = Rx.Disposable = function (action) { this.isDisposed = false; this.action = action || noop; }; /** Performs the task of cleaning up resources. */ Disposable.prototype.dispose = function () { if (!this.isDisposed) { this.action(); this.isDisposed = true; } }; /** * Creates a disposable object that invokes the specified action when disposed. * @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once. * @return {Disposable} The disposable object that runs the given action upon disposal. */ var disposableCreate = Disposable.create = function (action) { return new Disposable(action); }; /** * Gets the disposable that does nothing when disposed. */ var disposableEmpty = Disposable.empty = { dispose: noop }; /** * Validates whether the given object is a disposable * @param {Object} Object to test whether it has a dispose method * @returns {Boolean} true if a disposable object, else false. */ var isDisposable = Disposable.isDisposable = function (d) { return d && isFunction(d.dispose); }; var checkDisposed = Disposable.checkDisposed = function (disposable) { if (disposable.isDisposed) { throw new ObjectDisposedError(); } }; // Single assignment var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable = function () { this.isDisposed = false; this.current = null; }; SingleAssignmentDisposable.prototype.getDisposable = function () { return this.current; }; SingleAssignmentDisposable.prototype.setDisposable = function (value) { if (this.current) { throw new Error('Disposable has already been assigned'); } var shouldDispose = this.isDisposed; !shouldDispose && (this.current = value); shouldDispose && value && value.dispose(); }; SingleAssignmentDisposable.prototype.dispose = function () { if (!this.isDisposed) { this.isDisposed = true; var old = this.current; this.current = null; } old && old.dispose(); }; // Multiple assignment disposable var SerialDisposable = Rx.SerialDisposable = function () { this.isDisposed = false; this.current = null; }; SerialDisposable.prototype.getDisposable = function () { return this.current; }; SerialDisposable.prototype.setDisposable = function (value) { var shouldDispose = this.isDisposed; if (!shouldDispose) { var old = this.current; this.current = value; } old && old.dispose(); shouldDispose && value && value.dispose(); }; SerialDisposable.prototype.dispose = function () { if (!this.isDisposed) { this.isDisposed = true; var old = this.current; this.current = null; } old && old.dispose(); }; /** * Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed. */ var RefCountDisposable = Rx.RefCountDisposable = (function () { function InnerDisposable(disposable) { this.disposable = disposable; this.disposable.count++; this.isInnerDisposed = false; } InnerDisposable.prototype.dispose = function () { if (!this.disposable.isDisposed && !this.isInnerDisposed) { this.isInnerDisposed = true; this.disposable.count--; if (this.disposable.count === 0 && this.disposable.isPrimaryDisposed) { this.disposable.isDisposed = true; this.disposable.underlyingDisposable.dispose(); } } }; /** * Initializes a new instance of the RefCountDisposable with the specified disposable. * @constructor * @param {Disposable} disposable Underlying disposable. */ function RefCountDisposable(disposable) { this.underlyingDisposable = disposable; this.isDisposed = false; this.isPrimaryDisposed = false; this.count = 0; } /** * Disposes the underlying disposable only when all dependent disposables have been disposed */ RefCountDisposable.prototype.dispose = function () { if (!this.isDisposed && !this.isPrimaryDisposed) { this.isPrimaryDisposed = true; if (this.count === 0) { this.isDisposed = true; this.underlyingDisposable.dispose(); } } }; /** * Returns a dependent disposable that when disposed decreases the refcount on the underlying disposable. * @returns {Disposable} A dependent disposable contributing to the reference count that manages the underlying disposable's lifetime. */ RefCountDisposable.prototype.getDisposable = function () { return this.isDisposed ? disposableEmpty : new InnerDisposable(this); }; return RefCountDisposable; })(); function ScheduledDisposable(scheduler, disposable) { this.scheduler = scheduler; this.disposable = disposable; this.isDisposed = false; } function scheduleItem(s, self) { if (!self.isDisposed) { self.isDisposed = true; self.disposable.dispose(); } } ScheduledDisposable.prototype.dispose = function () { this.scheduler.scheduleWithState(this, scheduleItem); }; var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) { this.scheduler = scheduler; this.state = state; this.action = action; this.dueTime = dueTime; this.comparer = comparer || defaultSubComparer; this.disposable = new SingleAssignmentDisposable(); } ScheduledItem.prototype.invoke = function () { this.disposable.setDisposable(this.invokeCore()); }; ScheduledItem.prototype.compareTo = function (other) { return this.comparer(this.dueTime, other.dueTime); }; ScheduledItem.prototype.isCancelled = function () { return this.disposable.isDisposed; }; ScheduledItem.prototype.invokeCore = function () { return this.action(this.scheduler, this.state); }; /** Provides a set of static properties to access commonly used schedulers. */ var Scheduler = Rx.Scheduler = (function () { function Scheduler(now, schedule, scheduleRelative, scheduleAbsolute) { this.now = now; this._schedule = schedule; this._scheduleRelative = scheduleRelative; this._scheduleAbsolute = scheduleAbsolute; } /** Determines whether the given object is a scheduler */ Scheduler.isScheduler = function (s) { return s instanceof Scheduler; } function invokeAction(scheduler, action) { action(); return disposableEmpty; } var schedulerProto = Scheduler.prototype; /** * Schedules an action to be executed. * @param {Function} action Action to execute. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.schedule = function (action) { return this._schedule(action, invokeAction); }; /** * Schedules an action to be executed. * @param state State passed to the action to be executed. * @param {Function} action Action to be executed. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleWithState = function (state, action) { return this._schedule(state, action); }; /** * Schedules an action to be executed after the specified relative due time. * @param {Function} action Action to execute. * @param {Number} dueTime Relative time after which to execute the action. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleWithRelative = function (dueTime, action) { return this._scheduleRelative(action, dueTime, invokeAction); }; /** * Schedules an action to be executed after dueTime. * @param state State passed to the action to be executed. * @param {Function} action Action to be executed. * @param {Number} dueTime Relative time after which to execute the action. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleWithRelativeAndState = function (state, dueTime, action) { return this._scheduleRelative(state, dueTime, action); }; /** * Schedules an action to be executed at the specified absolute due time. * @param {Function} action Action to execute. * @param {Number} dueTime Absolute time at which to execute the action. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleWithAbsolute = function (dueTime, action) { return this._scheduleAbsolute(action, dueTime, invokeAction); }; /** * Schedules an action to be executed at dueTime. * @param {Mixed} state State passed to the action to be executed. * @param {Function} action Action to be executed. * @param {Number}dueTime Absolute time at which to execute the action. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleWithAbsoluteAndState = function (state, dueTime, action) { return this._scheduleAbsolute(state, dueTime, action); }; /** Gets the current time according to the local machine's system clock. */ Scheduler.now = defaultNow; /** * Normalizes the specified TimeSpan value to a positive value. * @param {Number} timeSpan The time span value to normalize. * @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0 */ Scheduler.normalize = function (timeSpan) { timeSpan < 0 && (timeSpan = 0); return timeSpan; }; return Scheduler; }()); var normalizeTime = Scheduler.normalize, isScheduler = Scheduler.isScheduler; (function (schedulerProto) { function invokeRecImmediate(scheduler, pair) { var state = pair[0], action = pair[1], group = new CompositeDisposable(); action(state, innerAction); return group; function innerAction(state2) { var isAdded = false, isDone = false; var d = scheduler.scheduleWithState(state2, scheduleWork); if (!isDone) { group.add(d); isAdded = true; } function scheduleWork(_, state3) { if (isAdded) { group.remove(d); } else { isDone = true; } action(state3, innerAction); return disposableEmpty; } } } function invokeRecDate(scheduler, pair, method) { var state = pair[0], action = pair[1], group = new CompositeDisposable(); action(state, innerAction); return group; function innerAction(state2, dueTime1) { var isAdded = false, isDone = false; var d = scheduler[method](state2, dueTime1, scheduleWork); if (!isDone) { group.add(d); isAdded = true; } function scheduleWork(_, state3) { if (isAdded) { group.remove(d); } else { isDone = true; } action(state3, innerAction); return disposableEmpty; } } } function invokeRecDateRelative(s, p) { return invokeRecDate(s, p, 'scheduleWithRelativeAndState'); } function invokeRecDateAbsolute(s, p) { return invokeRecDate(s, p, 'scheduleWithAbsoluteAndState'); } function scheduleInnerRecursive(action, self) { action(function(dt) { self(action, dt); }); } /** * Schedules an action to be executed recursively. * @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleRecursive = function (action) { return this.scheduleRecursiveWithState(action, scheduleInnerRecursive); }; /** * Schedules an action to be executed recursively. * @param {Mixed} state State passed to the action to be executed. * @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleRecursiveWithState = function (state, action) { return this.scheduleWithState([state, action], invokeRecImmediate); }; /** * Schedules an action to be executed recursively after a specified relative due time. * @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified relative time. * @param {Number}dueTime Relative time after which to execute the action for the first time. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleRecursiveWithRelative = function (dueTime, action) { return this.scheduleRecursiveWithRelativeAndState(action, dueTime, scheduleInnerRecursive); }; /** * Schedules an action to be executed recursively after a specified relative due time. * @param {Mixed} state State passed to the action to be executed. * @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state. * @param {Number}dueTime Relative time after which to execute the action for the first time. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleRecursiveWithRelativeAndState = function (state, dueTime, action) { return this._scheduleRelative([state, action], dueTime, invokeRecDateRelative); }; /** * Schedules an action to be executed recursively at a specified absolute due time. * @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified absolute time. * @param {Number}dueTime Absolute time at which to execute the action for the first time. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleRecursiveWithAbsolute = function (dueTime, action) { return this.scheduleRecursiveWithAbsoluteAndState(action, dueTime, scheduleInnerRecursive); }; /** * Schedules an action to be executed recursively at a specified absolute due time. * @param {Mixed} state State passed to the action to be executed. * @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state. * @param {Number}dueTime Absolute time at which to execute the action for the first time. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleRecursiveWithAbsoluteAndState = function (state, dueTime, action) { return this._scheduleAbsolute([state, action], dueTime, invokeRecDateAbsolute); }; }(Scheduler.prototype)); (function (schedulerProto) { /** * Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation. * @param {Number} period Period for running the work periodically. * @param {Function} action Action to be executed. * @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort). */ Scheduler.prototype.schedulePeriodic = function (period, action) { return this.schedulePeriodicWithState(null, period, action); }; /** * Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation. * @param {Mixed} state Initial state passed to the action upon the first iteration. * @param {Number} period Period for running the work periodically. * @param {Function} action Action to be executed, potentially updating the state. * @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort). */ Scheduler.prototype.schedulePeriodicWithState = function(state, period, action) { if (typeof root.setInterval === 'undefined') { throw new NotSupportedError(); } period = normalizeTime(period); var s = state, id = root.setInterval(function () { s = action(s); }, period); return disposableCreate(function () { root.clearInterval(id); }); }; }(Scheduler.prototype)); (function (schedulerProto) { /** * Returns a scheduler that wraps the original scheduler, adding exception handling for scheduled actions. * @param {Function} handler Handler that's run if an exception is caught. The exception will be rethrown if the handler returns false. * @returns {Scheduler} Wrapper around the original scheduler, enforcing exception handling. */ schedulerProto.catchError = schedulerProto['catch'] = function (handler) { return new CatchScheduler(this, handler); }; }(Scheduler.prototype)); var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () { function tick(command, recurse) { recurse(0, this._period); try { this._state = this._action(this._state); } catch (e) { this._cancel.dispose(); throw e; } } function SchedulePeriodicRecursive(scheduler, state, period, action) { this._scheduler = scheduler; this._state = state; this._period = period; this._action = action; } SchedulePeriodicRecursive.prototype.start = function () { var d = new SingleAssignmentDisposable(); this._cancel = d; d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this))); return d; }; return SchedulePeriodicRecursive; }()); /** Gets a scheduler that schedules work immediately on the current thread. */ var immediateScheduler = Scheduler.immediate = (function () { function scheduleNow(state, action) { return action(this, state); } return new Scheduler(defaultNow, scheduleNow, notSupported, notSupported); }()); /** * Gets a scheduler that schedules work as soon as possible on the current thread. */ var currentThreadScheduler = Scheduler.currentThread = (function () { var queue; function runTrampoline () { while (queue.length > 0) { var item = queue.shift(); !item.isCancelled() && item.invoke(); } } function scheduleNow(state, action) { var si = new ScheduledItem(this, state, action, this.now()); if (!queue) { queue = [si]; var result = tryCatch(runTrampoline)(); queue = null; if (result === errorObj) { return thrower(result.e); } } else { queue.push(si); } return si.disposable; } var currentScheduler = new Scheduler(defaultNow, scheduleNow, notSupported, notSupported); currentScheduler.scheduleRequired = function () { return !queue; }; return currentScheduler; }()); var scheduleMethod, clearMethod; var localTimer = (function () { var localSetTimeout, localClearTimeout = noop; if (!!root.setTimeout) { localSetTimeout = root.setTimeout; localClearTimeout = root.clearTimeout; } else if (!!root.WScript) { localSetTimeout = function (fn, time) { root.WScript.Sleep(time); fn(); }; } else { throw new NotSupportedError(); } return { setTimeout: localSetTimeout, clearTimeout: localClearTimeout }; }()); var localSetTimeout = localTimer.setTimeout, localClearTimeout = localTimer.clearTimeout; (function () { var nextHandle = 1, tasksByHandle = {}, currentlyRunning = false; clearMethod = function (handle) { delete tasksByHandle[handle]; }; function runTask(handle) { if (currentlyRunning) { localSetTimeout(function () { runTask(handle) }, 0); } else { var task = tasksByHandle[handle]; if (task) { currentlyRunning = true; var result = tryCatch(task)(); clearMethod(handle); currentlyRunning = false; if (result === errorObj) { return thrower(result.e); } } } } var reNative = RegExp('^' + String(toString) .replace(/[.*+?^${}()|[\]\\]/g, '\\$&') .replace(/toString| for [^\]]+/g, '.*?') + '$' ); var setImmediate = typeof (setImmediate = freeGlobal && moduleExports && freeGlobal.setImmediate) == 'function' && !reNative.test(setImmediate) && setImmediate; function postMessageSupported () { // Ensure not in a worker if (!root.postMessage || root.importScripts) { return false; } var isAsync = false, oldHandler = root.onmessage; // Test for async root.onmessage = function () { isAsync = true; }; root.postMessage('', '*'); root.onmessage = oldHandler; return isAsync; } // Use in order, setImmediate, nextTick, postMessage, MessageChannel, script readystatechanged, setTimeout if (isFunction(setImmediate)) { scheduleMethod = function (action) { var id = nextHandle++; tasksByHandle[id] = action; setImmediate(function () { runTask(id); }); return id; }; } else if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') { scheduleMethod = function (action) { var id = nextHandle++; tasksByHandle[id] = action; process.nextTick(function () { runTask(id); }); return id; }; } else if (postMessageSupported()) { var MSG_PREFIX = 'ms.rx.schedule' + Math.random(); function onGlobalPostMessage(event) { // Only if we're a match to avoid any other global events if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) { runTask(event.data.substring(MSG_PREFIX.length)); } } if (root.addEventListener) { root.addEventListener('message', onGlobalPostMessage, false); } else if (root.attachEvent) { root.attachEvent('onmessage', onGlobalPostMessage); } else { root.onmessage = onGlobalPostMessage; } scheduleMethod = function (action) { var id = nextHandle++; tasksByHandle[id] = action; root.postMessage(MSG_PREFIX + currentId, '*'); return id; }; } else if (!!root.MessageChannel) { var channel = new root.MessageChannel(); channel.port1.onmessage = function (e) { runTask(e.data); }; scheduleMethod = function (action) { var id = nextHandle++; tasksByHandle[id] = action; channel.port2.postMessage(id); return id; }; } else if ('document' in root && 'onreadystatechange' in root.document.createElement('script')) { scheduleMethod = function (action) { var scriptElement = root.document.createElement('script'); var id = nextHandle++; tasksByHandle[id] = action; scriptElement.onreadystatechange = function () { runTask(id); scriptElement.onreadystatechange = null; scriptElement.parentNode.removeChild(scriptElement); scriptElement = null; }; root.document.documentElement.appendChild(scriptElement); return id; }; } else { scheduleMethod = function (action) { var id = nextHandle++; tasksByHandle[id] = action; localSetTimeout(function () { runTask(id); }, 0); return id; }; } }()); /** * Gets a scheduler that schedules work via a timed callback based upon platform. */ var timeoutScheduler = Scheduler.timeout = Scheduler['default'] = (function () { function scheduleNow(state, action) { var scheduler = this, disposable = new SingleAssignmentDisposable(); var id = scheduleMethod(function () { !disposable.isDisposed && disposable.setDisposable(action(scheduler, state)); }); return new CompositeDisposable(disposable, disposableCreate(function () { clearMethod(id); })); } function scheduleRelative(state, dueTime, action) { var scheduler = this, dt = Scheduler.normalize(dueTime), disposable = new SingleAssignmentDisposable(); if (dt === 0) { return scheduler.scheduleWithState(state, action); } var id = localSetTimeout(function () { !disposable.isDisposed && disposable.setDisposable(action(scheduler, state)); }, dt); return new CompositeDisposable(disposable, disposableCreate(function () { localClearTimeout(id); })); } function scheduleAbsolute(state, dueTime, action) { return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action); } return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute); })(); var CatchScheduler = (function (__super__) { function scheduleNow(state, action) { return this._scheduler.scheduleWithState(state, this._wrap(action)); } function scheduleRelative(state, dueTime, action) { return this._scheduler.scheduleWithRelativeAndState(state, dueTime, this._wrap(action)); } function scheduleAbsolute(state, dueTime, action) { return this._scheduler.scheduleWithAbsoluteAndState(state, dueTime, this._wrap(action)); } inherits(CatchScheduler, __super__); function CatchScheduler(scheduler, handler) { this._scheduler = scheduler; this._handler = handler; this._recursiveOriginal = null; this._recursiveWrapper = null; __super__.call(this, this._scheduler.now.bind(this._scheduler), scheduleNow, scheduleRelative, scheduleAbsolute); } CatchScheduler.prototype._clone = function (scheduler) { return new CatchScheduler(scheduler, this._handler); }; CatchScheduler.prototype._wrap = function (action) { var parent = this; return function (self, state) { try { return action(parent._getRecursiveWrapper(self), state); } catch (e) { if (!parent._handler(e)) { throw e; } return disposableEmpty; } }; }; CatchScheduler.prototype._getRecursiveWrapper = function (scheduler) { if (this._recursiveOriginal !== scheduler) { this._recursiveOriginal = scheduler; var wrapper = this._clone(scheduler); wrapper._recursiveOriginal = scheduler; wrapper._recursiveWrapper = wrapper; this._recursiveWrapper = wrapper; } return this._recursiveWrapper; }; CatchScheduler.prototype.schedulePeriodicWithState = function (state, period, action) { var self = this, failed = false, d = new SingleAssignmentDisposable(); d.setDisposable(this._scheduler.schedulePeriodicWithState(state, period, function (state1) { if (failed) { return null; } try { return action(state1); } catch (e) { failed = true; if (!self._handler(e)) { throw e; } d.dispose(); return null; } })); return d; }; return CatchScheduler; }(Scheduler)); /** * Represents a notification to an observer. */ var Notification = Rx.Notification = (function () { function Notification(kind, value, exception, accept, acceptObservable, toString) { this.kind = kind; this.value = value; this.exception = exception; this._accept = accept; this._acceptObservable = acceptObservable; this.toString = toString; } /** * Invokes the delegate corresponding to the notification or the observer's method corresponding to the notification and returns the produced result. * * @memberOf Notification * @param {Any} observerOrOnNext Delegate to invoke for an OnNext notification or Observer to invoke the notification on.. * @param {Function} onError Delegate to invoke for an OnError notification. * @param {Function} onCompleted Delegate to invoke for an OnCompleted notification. * @returns {Any} Result produced by the observation. */ Notification.prototype.accept = function (observerOrOnNext, onError, onCompleted) { return observerOrOnNext && typeof observerOrOnNext === 'object' ? this._acceptObservable(observerOrOnNext) : this._accept(observerOrOnNext, onError, onCompleted); }; /** * Returns an observable sequence with a single notification. * * @memberOf Notifications * @param {Scheduler} [scheduler] Scheduler to send out the notification calls on. * @returns {Observable} The observable sequence that surfaces the behavior of the notification upon subscription. */ Notification.prototype.toObservable = function (scheduler) { var self = this; isScheduler(scheduler) || (scheduler = immediateScheduler); return new AnonymousObservable(function (observer) { return scheduler.scheduleWithState(self, function (_, notification) { notification._acceptObservable(observer); notification.kind === 'N' && observer.onCompleted(); }); }); }; return Notification; })(); /** * Creates an object that represents an OnNext notification to an observer. * @param {Any} value The value contained in the notification. * @returns {Notification} The OnNext notification containing the value. */ var notificationCreateOnNext = Notification.createOnNext = (function () { function _accept(onNext) { return onNext(this.value); } function _acceptObservable(observer) { return observer.onNext(this.value); } function toString() { return 'OnNext(' + this.value + ')'; } return function (value) { return new Notification('N', value, null, _accept, _acceptObservable, toString); }; }()); /** * Creates an object that represents an OnError notification to an observer. * @param {Any} error The exception contained in the notification. * @returns {Notification} The OnError notification containing the exception. */ var notificationCreateOnError = Notification.createOnError = (function () { function _accept (onNext, onError) { return onError(this.exception); } function _acceptObservable(observer) { return observer.onError(this.exception); } function toString () { return 'OnError(' + this.exception + ')'; } return function (e) { return new Notification('E', null, e, _accept, _acceptObservable, toString); }; }()); /** * Creates an object that represents an OnCompleted notification to an observer. * @returns {Notification} The OnCompleted notification. */ var notificationCreateOnCompleted = Notification.createOnCompleted = (function () { function _accept (onNext, onError, onCompleted) { return onCompleted(); } function _acceptObservable(observer) { return observer.onCompleted(); } function toString () { return 'OnCompleted()'; } return function () { return new Notification('C', null, null, _accept, _acceptObservable, toString); }; }()); /** * Supports push-style iteration over an observable sequence. */ var Observer = Rx.Observer = function () { }; /** * Creates a notification callback from an observer. * @returns The action that forwards its input notification to the underlying observer. */ Observer.prototype.toNotifier = function () { var observer = this; return function (n) { return n.accept(observer); }; }; /** * Hides the identity of an observer. * @returns An observer that hides the identity of the specified observer. */ Observer.prototype.asObserver = function () { var self = this; return new AnonymousObserver( function (x) { self.onNext(x); }, function (err) { self.onError(err); }, function () { self.onCompleted(); }); }; /** * Checks access to the observer for grammar violations. This includes checking for multiple OnError or OnCompleted calls, as well as reentrancy in any of the observer methods. * If a violation is detected, an Error is thrown from the offending observer method call. * @returns An observer that checks callbacks invocations against the observer grammar and, if the checks pass, forwards those to the specified observer. */ Observer.prototype.checked = function () { return new CheckedObserver(this); }; /** * Creates an observer from the specified OnNext, along with optional OnError, and OnCompleted actions. * @param {Function} [onNext] Observer's OnNext action implementation. * @param {Function} [onError] Observer's OnError action implementation. * @param {Function} [onCompleted] Observer's OnCompleted action implementation. * @returns {Observer} The observer object implemented using the given actions. */ var observerCreate = Observer.create = function (onNext, onError, onCompleted) { onNext || (onNext = noop); onError || (onError = defaultError); onCompleted || (onCompleted = noop); return new AnonymousObserver(onNext, onError, onCompleted); }; /** * Creates an observer from a notification callback. * * @static * @memberOf Observer * @param {Function} handler Action that handles a notification. * @returns The observer object that invokes the specified handler using a notification corresponding to each message it receives. */ Observer.fromNotifier = function (handler, thisArg) { var cb = bindCallback(handler, thisArg, 1); return new AnonymousObserver(function (x) { return cb(notificationCreateOnNext(x)); }, function (e) { return cb(notificationCreateOnError(e)); }, function () { return cb(notificationCreateOnCompleted()); }); }; /** * Schedules the invocation of observer methods on the given scheduler. * @param {Scheduler} scheduler Scheduler to schedule observer messages on. * @returns {Observer} Observer whose messages are scheduled on the given scheduler. */ Observer.prototype.notifyOn = function (scheduler) { return new ObserveOnObserver(scheduler, this); }; Observer.prototype.makeSafe = function(disposable) { return new AnonymousSafeObserver(this._onNext, this._onError, this._onCompleted, disposable); }; /** * Abstract base class for implementations of the Observer class. * This base class enforces the grammar of observers where OnError and OnCompleted are terminal messages. */ var AbstractObserver = Rx.internals.AbstractObserver = (function (__super__) { inherits(AbstractObserver, __super__); /** * Creates a new observer in a non-stopped state. */ function AbstractObserver() { this.isStopped = false; } // Must be implemented by other observers AbstractObserver.prototype.next = notImplemented; AbstractObserver.prototype.error = notImplemented; AbstractObserver.prototype.completed = notImplemented; /** * Notifies the observer of a new element in the sequence. * @param {Any} value Next element in the sequence. */ AbstractObserver.prototype.onNext = function (value) { !this.isStopped && this.next(value); }; /** * Notifies the observer that an exception has occurred. * @param {Any} error The error that has occurred. */ AbstractObserver.prototype.onError = function (error) { if (!this.isStopped) { this.isStopped = true; this.error(error); } }; /** * Notifies the observer of the end of the sequence. */ AbstractObserver.prototype.onCompleted = function () { if (!this.isStopped) { this.isStopped = true; this.completed(); } }; /** * Disposes the observer, causing it to transition to the stopped state. */ AbstractObserver.prototype.dispose = function () { this.isStopped = true; }; AbstractObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.error(e); return true; } return false; }; return AbstractObserver; }(Observer)); /** * Class to create an Observer instance from delegate-based implementations of the on* methods. */ var AnonymousObserver = Rx.AnonymousObserver = (function (__super__) { inherits(AnonymousObserver, __super__); /** * Creates an observer from the specified OnNext, OnError, and OnCompleted actions. * @param {Any} onNext Observer's OnNext action implementation. * @param {Any} onError Observer's OnError action implementation. * @param {Any} onCompleted Observer's OnCompleted action implementation. */ function AnonymousObserver(onNext, onError, onCompleted) { __super__.call(this); this._onNext = onNext; this._onError = onError; this._onCompleted = onCompleted; } /** * Calls the onNext action. * @param {Any} value Next element in the sequence. */ AnonymousObserver.prototype.next = function (value) { this._onNext(value); }; /** * Calls the onError action. * @param {Any} error The error that has occurred. */ AnonymousObserver.prototype.error = function (error) { this._onError(error); }; /** * Calls the onCompleted action. */ AnonymousObserver.prototype.completed = function () { this._onCompleted(); }; return AnonymousObserver; }(AbstractObserver)); var CheckedObserver = (function (__super__) { inherits(CheckedObserver, __super__); function CheckedObserver(observer) { __super__.call(this); this._observer = observer; this._state = 0; // 0 - idle, 1 - busy, 2 - done } var CheckedObserverPrototype = CheckedObserver.prototype; CheckedObserverPrototype.onNext = function (value) { this.checkAccess(); var res = tryCatch(this._observer.onNext).call(this._observer, value); this._state = 0; res === errorObj && thrower(res.e); }; CheckedObserverPrototype.onError = function (err) { this.checkAccess(); var res = tryCatch(this._observer.onError).call(this._observer, err); this._state = 2; res === errorObj && thrower(res.e); }; CheckedObserverPrototype.onCompleted = function () { this.checkAccess(); var res = tryCatch(this._observer.onCompleted).call(this._observer); this._state = 2; res === errorObj && thrower(res.e); }; CheckedObserverPrototype.checkAccess = function () { if (this._state === 1) { throw new Error('Re-entrancy detected'); } if (this._state === 2) { throw new Error('Observer completed'); } if (this._state === 0) { this._state = 1; } }; return CheckedObserver; }(Observer)); var ScheduledObserver = Rx.internals.ScheduledObserver = (function (__super__) { inherits(ScheduledObserver, __super__); function ScheduledObserver(scheduler, observer) { __super__.call(this); this.scheduler = scheduler; this.observer = observer; this.isAcquired = false; this.hasFaulted = false; this.queue = []; this.disposable = new SerialDisposable(); } ScheduledObserver.prototype.next = function (value) { var self = this; this.queue.push(function () { self.observer.onNext(value); }); }; ScheduledObserver.prototype.error = function (e) { var self = this; this.queue.push(function () { self.observer.onError(e); }); }; ScheduledObserver.prototype.completed = function () { var self = this; this.queue.push(function () { self.observer.onCompleted(); }); }; ScheduledObserver.prototype.ensureActive = function () { var isOwner = false; if (!this.hasFaulted && this.queue.length > 0) { isOwner = !this.isAcquired; this.isAcquired = true; } if (isOwner) { this.disposable.setDisposable(this.scheduler.scheduleRecursiveWithState(this, function (parent, self) { var work; if (parent.queue.length > 0) { work = parent.queue.shift(); } else { parent.isAcquired = false; return; } var res = tryCatch(work)(); if (res === errorObj) { parent.queue = []; parent.hasFaulted = true; return thrower(res.e); } self(parent); })); } }; ScheduledObserver.prototype.dispose = function () { __super__.prototype.dispose.call(this); this.disposable.dispose(); }; return ScheduledObserver; }(AbstractObserver)); var ObserveOnObserver = (function (__super__) { inherits(ObserveOnObserver, __super__); function ObserveOnObserver(scheduler, observer, cancel) { __super__.call(this, scheduler, observer); this._cancel = cancel; } ObserveOnObserver.prototype.next = function (value) { __super__.prototype.next.call(this, value); this.ensureActive(); }; ObserveOnObserver.prototype.error = function (e) { __super__.prototype.error.call(this, e); this.ensureActive(); }; ObserveOnObserver.prototype.completed = function () { __super__.prototype.completed.call(this); this.ensureActive(); }; ObserveOnObserver.prototype.dispose = function () { __super__.prototype.dispose.call(this); this._cancel && this._cancel.dispose(); this._cancel = null; }; return ObserveOnObserver; })(ScheduledObserver); var observableProto; /** * Represents a push-style collection. */ var Observable = Rx.Observable = (function () { function makeSubscribe(self, subscribe) { return function (o) { var oldOnError = o.onError; o.onError = function (e) { makeStackTraceLong(e, self); oldOnError.call(o, e); }; return subscribe.call(self, o); }; } function Observable(subscribe) { if (Rx.config.longStackSupport && hasStacks) { var e = tryCatch(thrower)(new Error()).e; this.stack = e.stack.substring(e.stack.indexOf('\n') + 1); this._subscribe = makeSubscribe(this, subscribe); } else { this._subscribe = subscribe; } } observableProto = Observable.prototype; /** * Determines whether the given object is an Observable * @param {Any} An object to determine whether it is an Observable * @returns {Boolean} true if an Observable, else false. */ Observable.isObservable = function (o) { return o && isFunction(o.subscribe); } /** * Subscribes an o to the observable sequence. * @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence. * @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence. * @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. * @returns {Diposable} A disposable handling the subscriptions and unsubscriptions. */ observableProto.subscribe = observableProto.forEach = function (oOrOnNext, onError, onCompleted) { return this._subscribe(typeof oOrOnNext === 'object' ? oOrOnNext : observerCreate(oOrOnNext, onError, onCompleted)); }; /** * Subscribes to the next value in the sequence with an optional "this" argument. * @param {Function} onNext The function to invoke on each element in the observable sequence. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Disposable} A disposable handling the subscriptions and unsubscriptions. */ observableProto.subscribeOnNext = function (onNext, thisArg) { return this._subscribe(observerCreate(typeof thisArg !== 'undefined' ? function(x) { onNext.call(thisArg, x); } : onNext)); }; /** * Subscribes to an exceptional condition in the sequence with an optional "this" argument. * @param {Function} onError The function to invoke upon exceptional termination of the observable sequence. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Disposable} A disposable handling the subscriptions and unsubscriptions. */ observableProto.subscribeOnError = function (onError, thisArg) { return this._subscribe(observerCreate(null, typeof thisArg !== 'undefined' ? function(e) { onError.call(thisArg, e); } : onError)); }; /** * Subscribes to the next value in the sequence with an optional "this" argument. * @param {Function} onCompleted The function to invoke upon graceful termination of the observable sequence. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Disposable} A disposable handling the subscriptions and unsubscriptions. */ observableProto.subscribeOnCompleted = function (onCompleted, thisArg) { return this._subscribe(observerCreate(null, null, typeof thisArg !== 'undefined' ? function() { onCompleted.call(thisArg); } : onCompleted)); }; return Observable; })(); var ObservableBase = Rx.ObservableBase = (function (__super__) { inherits(ObservableBase, __super__); function fixSubscriber(subscriber) { return subscriber && isFunction(subscriber.dispose) ? subscriber : isFunction(subscriber) ? disposableCreate(subscriber) : disposableEmpty; } function setDisposable(s, state) { var ado = state[0], self = state[1]; var sub = tryCatch(self.subscribeCore).call(self, ado); if (sub === errorObj) { if(!ado.fail(errorObj.e)) { return thrower(errorObj.e); } } ado.setDisposable(fixSubscriber(sub)); } function subscribe(observer) { var ado = new AutoDetachObserver(observer), state = [ado, this]; if (currentThreadScheduler.scheduleRequired()) { currentThreadScheduler.scheduleWithState(state, setDisposable); } else { setDisposable(null, state); } return ado; } function ObservableBase() { __super__.call(this, subscribe); } ObservableBase.prototype.subscribeCore = notImplemented; return ObservableBase; }(Observable)); var FlatMapObservable = (function(__super__){ inherits(FlatMapObservable, __super__); function FlatMapObservable(source, selector, resultSelector, thisArg) { this.resultSelector = Rx.helpers.isFunction(resultSelector) ? resultSelector : null; this.selector = Rx.internals.bindCallback(Rx.helpers.isFunction(selector) ? selector : function() { return selector; }, thisArg, 3); this.source = source; __super__.call(this); } FlatMapObservable.prototype.subscribeCore = function(o) { return this.source.subscribe(new InnerObserver(o, this.selector, this.resultSelector, this)); }; function InnerObserver(observer, selector, resultSelector, source) { this.i = 0; this.selector = selector; this.resultSelector = resultSelector; this.source = source; this.isStopped = false; this.o = observer; } InnerObserver.prototype._wrapResult = function(result, x, i) { return this.resultSelector ? result.map(function(y, i2) { return this.resultSelector(x, y, i, i2); }, this) : result; }; InnerObserver.prototype.onNext = function(x) { if (this.isStopped) return; var i = this.i++; var result = tryCatch(this.selector)(x, i, this.source); if (result === errorObj) { return this.o.onError(result.e); } Rx.helpers.isPromise(result) && (result = Rx.Observable.fromPromise(result)); (Rx.helpers.isArrayLike(result) || Rx.helpers.isIterable(result)) && (result = Rx.Observable.from(result)); this.o.onNext(this._wrapResult(result, x, i)); }; InnerObserver.prototype.onError = function(e) { if(!this.isStopped) { this.isStopped = true; this.o.onError(e); } }; InnerObserver.prototype.onCompleted = function() { if (!this.isStopped) {this.isStopped = true; this.o.onCompleted(); } }; return FlatMapObservable; }(ObservableBase)); var Enumerable = Rx.internals.Enumerable = function () { }; var ConcatEnumerableObservable = (function(__super__) { inherits(ConcatEnumerableObservable, __super__); function ConcatEnumerableObservable(sources) { this.sources = sources; __super__.call(this); } ConcatEnumerableObservable.prototype.subscribeCore = function (o) { var isDisposed, subscription = new SerialDisposable(); var cancelable = immediateScheduler.scheduleRecursiveWithState(this.sources[$iterator$](), function (e, self) { if (isDisposed) { return; } var currentItem = tryCatch(e.next).call(e); if (currentItem === errorObj) { return o.onError(currentItem.e); } if (currentItem.done) { return o.onCompleted(); } // Check if promise var currentValue = currentItem.value; isPromise(currentValue) && (currentValue = observableFromPromise(currentValue)); var d = new SingleAssignmentDisposable(); subscription.setDisposable(d); d.setDisposable(currentValue.subscribe(new InnerObserver(o, self, e))); }); return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { isDisposed = true; })); }; function InnerObserver(o, s, e) { this.o = o; this.s = s; this.e = e; this.isStopped = false; } InnerObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.o.onNext(x); } }; InnerObserver.prototype.onError = function (err) { if (!this.isStopped) { this.isStopped = true; this.o.onError(err); } }; InnerObserver.prototype.onCompleted = function () { if (!this.isStopped) { this.isStopped = true; this.s(this.e); } }; InnerObserver.prototype.dispose = function () { this.isStopped = true; }; InnerObserver.prototype.fail = function (err) { if (!this.isStopped) { this.isStopped = true; this.o.onError(err); return true; } return false; }; return ConcatEnumerableObservable; }(ObservableBase)); Enumerable.prototype.concat = function () { return new ConcatEnumerableObservable(this); }; var CatchErrorObservable = (function(__super__) { inherits(CatchErrorObservable, __super__); function CatchErrorObservable(sources) { this.sources = sources; __super__.call(this); } CatchErrorObservable.prototype.subscribeCore = function (o) { var e = this.sources[$iterator$](); var isDisposed, subscription = new SerialDisposable(); var cancelable = immediateScheduler.scheduleRecursiveWithState(null, function (lastException, self) { if (isDisposed) { return; } var currentItem = tryCatch(e.next).call(e); if (currentItem === errorObj) { return o.onError(currentItem.e); } if (currentItem.done) { return lastException !== null ? o.onError(lastException) : o.onCompleted(); } // Check if promise var currentValue = currentItem.value; isPromise(currentValue) && (currentValue = observableFromPromise(currentValue)); var d = new SingleAssignmentDisposable(); subscription.setDisposable(d); d.setDisposable(currentValue.subscribe( function(x) { o.onNext(x); }, self, function() { o.onCompleted(); })); }); return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { isDisposed = true; })); }; return CatchErrorObservable; }(ObservableBase)); Enumerable.prototype.catchError = function () { return new CatchErrorObservable(this); }; Enumerable.prototype.catchErrorWhen = function (notificationHandler) { var sources = this; return new AnonymousObservable(function (o) { var exceptions = new Subject(), notifier = new Subject(), handled = notificationHandler(exceptions), notificationDisposable = handled.subscribe(notifier); var e = sources[$iterator$](); var isDisposed, lastException, subscription = new SerialDisposable(); var cancelable = immediateScheduler.scheduleRecursive(function (self) { if (isDisposed) { return; } var currentItem = tryCatch(e.next).call(e); if (currentItem === errorObj) { return o.onError(currentItem.e); } if (currentItem.done) { if (lastException) { o.onError(lastException); } else { o.onCompleted(); } return; } // Check if promise var currentValue = currentItem.value; isPromise(currentValue) && (currentValue = observableFromPromise(currentValue)); var outer = new SingleAssignmentDisposable(); var inner = new SingleAssignmentDisposable(); subscription.setDisposable(new CompositeDisposable(inner, outer)); outer.setDisposable(currentValue.subscribe( function(x) { o.onNext(x); }, function (exn) { inner.setDisposable(notifier.subscribe(self, function(ex) { o.onError(ex); }, function() { o.onCompleted(); })); exceptions.onNext(exn); }, function() { o.onCompleted(); })); }); return new CompositeDisposable(notificationDisposable, subscription, cancelable, disposableCreate(function () { isDisposed = true; })); }); }; var RepeatEnumerable = (function (__super__) { inherits(RepeatEnumerable, __super__); function RepeatEnumerable(v, c) { this.v = v; this.c = c == null ? -1 : c; } RepeatEnumerable.prototype[$iterator$] = function () { return new RepeatEnumerator(this); }; function RepeatEnumerator(p) { this.v = p.v; this.l = p.c; } RepeatEnumerator.prototype.next = function () { if (this.l === 0) { return doneEnumerator; } if (this.l > 0) { this.l--; } return { done: false, value: this.v }; }; return RepeatEnumerable; }(Enumerable)); var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) { return new RepeatEnumerable(value, repeatCount); }; var OfEnumerable = (function(__super__) { inherits(OfEnumerable, __super__); function OfEnumerable(s, fn, thisArg) { this.s = s; this.fn = fn ? bindCallback(fn, thisArg, 3) : null; } OfEnumerable.prototype[$iterator$] = function () { return new OfEnumerator(this); }; function OfEnumerator(p) { this.i = -1; this.s = p.s; this.l = this.s.length; this.fn = p.fn; } OfEnumerator.prototype.next = function () { return ++this.i < this.l ? { done: false, value: !this.fn ? this.s[this.i] : this.fn(this.s[this.i], this.i, this.s) } : doneEnumerator; }; return OfEnumerable; }(Enumerable)); var enumerableOf = Enumerable.of = function (source, selector, thisArg) { return new OfEnumerable(source, selector, thisArg); }; /** * Wraps the source sequence in order to run its observer callbacks on the specified scheduler. * * This only invokes observer callbacks on a scheduler. In case the subscription and/or unsubscription actions have side-effects * that require to be run on a scheduler, use subscribeOn. * * @param {Scheduler} scheduler Scheduler to notify observers on. * @returns {Observable} The source sequence whose observations happen on the specified scheduler. */ observableProto.observeOn = function (scheduler) { var source = this; return new AnonymousObservable(function (observer) { return source.subscribe(new ObserveOnObserver(scheduler, observer)); }, source); }; /** * Wraps the source sequence in order to run its subscription and unsubscription logic on the specified scheduler. This operation is not commonly used; * see the remarks section for more information on the distinction between subscribeOn and observeOn. * This only performs the side-effects of subscription and unsubscription on the specified scheduler. In order to invoke observer * callbacks on a scheduler, use observeOn. * @param {Scheduler} scheduler Scheduler to perform subscription and unsubscription actions on. * @returns {Observable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler. */ observableProto.subscribeOn = function (scheduler) { var source = this; return new AnonymousObservable(function (observer) { var m = new SingleAssignmentDisposable(), d = new SerialDisposable(); d.setDisposable(m); m.setDisposable(scheduler.schedule(function () { d.setDisposable(new ScheduledDisposable(scheduler, source.subscribe(observer))); })); return d; }, source); }; var FromPromiseObservable = (function(__super__) { inherits(FromPromiseObservable, __super__); function FromPromiseObservable(p) { this.p = p; __super__.call(this); } FromPromiseObservable.prototype.subscribeCore = function(o) { this.p.then(function (data) { o.onNext(data); o.onCompleted(); }, function (err) { o.onError(err); }); return disposableEmpty; }; return FromPromiseObservable; }(ObservableBase)); /** * Converts a Promise to an Observable sequence * @param {Promise} An ES6 Compliant promise. * @returns {Observable} An Observable sequence which wraps the existing promise success and failure. */ var observableFromPromise = Observable.fromPromise = function (promise) { return new FromPromiseObservable(promise); }; /* * Converts an existing observable sequence to an ES6 Compatible Promise * @example * var promise = Rx.Observable.return(42).toPromise(RSVP.Promise); * * // With config * Rx.config.Promise = RSVP.Promise; * var promise = Rx.Observable.return(42).toPromise(); * @param {Function} [promiseCtor] The constructor of the promise. If not provided, it looks for it in Rx.config.Promise. * @returns {Promise} An ES6 compatible promise with the last value from the observable sequence. */ observableProto.toPromise = function (promiseCtor) { promiseCtor || (promiseCtor = Rx.config.Promise); if (!promiseCtor) { throw new NotSupportedError('Promise type not provided nor in Rx.config.Promise'); } var source = this; return new promiseCtor(function (resolve, reject) { // No cancellation can be done var value, hasValue = false; source.subscribe(function (v) { value = v; hasValue = true; }, reject, function () { hasValue && resolve(value); }); }); }; var ToArrayObservable = (function(__super__) { inherits(ToArrayObservable, __super__); function ToArrayObservable(source) { this.source = source; __super__.call(this); } ToArrayObservable.prototype.subscribeCore = function(o) { return this.source.subscribe(new InnerObserver(o)); }; function InnerObserver(o) { this.o = o; this.a = []; this.isStopped = false; } InnerObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.a.push(x); } }; InnerObserver.prototype.onError = function (e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); } }; InnerObserver.prototype.onCompleted = function () { if (!this.isStopped) { this.isStopped = true; this.o.onNext(this.a); this.o.onCompleted(); } }; InnerObserver.prototype.dispose = function () { this.isStopped = true; } InnerObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); return true; } return false; }; return ToArrayObservable; }(ObservableBase)); /** * Creates an array from an observable sequence. * @returns {Observable} An observable sequence containing a single element with a list containing all the elements of the source sequence. */ observableProto.toArray = function () { return new ToArrayObservable(this); }; /** * Creates an observable sequence from a specified subscribe method implementation. * @example * var res = Rx.Observable.create(function (observer) { return function () { } ); * var res = Rx.Observable.create(function (observer) { return Rx.Disposable.empty; } ); * var res = Rx.Observable.create(function (observer) { } ); * @param {Function} subscribe Implementation of the resulting observable sequence's subscribe method, returning a function that will be wrapped in a Disposable. * @returns {Observable} The observable sequence with the specified implementation for the Subscribe method. */ Observable.create = function (subscribe, parent) { return new AnonymousObservable(subscribe, parent); }; /** * Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes. * * @example * var res = Rx.Observable.defer(function () { return Rx.Observable.fromArray([1,2,3]); }); * @param {Function} observableFactory Observable factory function to invoke for each observer that subscribes to the resulting sequence or Promise. * @returns {Observable} An observable sequence whose observers trigger an invocation of the given observable factory function. */ var observableDefer = Observable.defer = function (observableFactory) { return new AnonymousObservable(function (observer) { var result; try { result = observableFactory(); } catch (e) { return observableThrow(e).subscribe(observer); } isPromise(result) && (result = observableFromPromise(result)); return result.subscribe(observer); }); }; var EmptyObservable = (function(__super__) { inherits(EmptyObservable, __super__); function EmptyObservable(scheduler) { this.scheduler = scheduler; __super__.call(this); } EmptyObservable.prototype.subscribeCore = function (observer) { var sink = new EmptySink(observer, this.scheduler); return sink.run(); }; function EmptySink(observer, scheduler) { this.observer = observer; this.scheduler = scheduler; } function scheduleItem(s, state) { state.onCompleted(); return disposableEmpty; } EmptySink.prototype.run = function () { return this.scheduler.scheduleWithState(this.observer, scheduleItem); }; return EmptyObservable; }(ObservableBase)); var EMPTY_OBSERVABLE = new EmptyObservable(immediateScheduler); /** * Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message. * * @example * var res = Rx.Observable.empty(); * var res = Rx.Observable.empty(Rx.Scheduler.timeout); * @param {Scheduler} [scheduler] Scheduler to send the termination call on. * @returns {Observable} An observable sequence with no elements. */ var observableEmpty = Observable.empty = function (scheduler) { isScheduler(scheduler) || (scheduler = immediateScheduler); return scheduler === immediateScheduler ? EMPTY_OBSERVABLE : new EmptyObservable(scheduler); }; var FromObservable = (function(__super__) { inherits(FromObservable, __super__); function FromObservable(iterable, mapper, scheduler) { this.iterable = iterable; this.mapper = mapper; this.scheduler = scheduler; __super__.call(this); } FromObservable.prototype.subscribeCore = function (o) { var sink = new FromSink(o, this); return sink.run(); }; return FromObservable; }(ObservableBase)); var FromSink = (function () { function FromSink(o, parent) { this.o = o; this.parent = parent; } FromSink.prototype.run = function () { var list = Object(this.parent.iterable), it = getIterable(list), o = this.o, mapper = this.parent.mapper; function loopRecursive(i, recurse) { var next = tryCatch(it.next).call(it); if (next === errorObj) { return o.onError(next.e); } if (next.done) { return o.onCompleted(); } var result = next.value; if (isFunction(mapper)) { result = tryCatch(mapper)(result, i); if (result === errorObj) { return o.onError(result.e); } } o.onNext(result); recurse(i + 1); } return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive); }; return FromSink; }()); var maxSafeInteger = Math.pow(2, 53) - 1; function StringIterable(s) { this._s = s; } StringIterable.prototype[$iterator$] = function () { return new StringIterator(this._s); }; function StringIterator(s) { this._s = s; this._l = s.length; this._i = 0; } StringIterator.prototype[$iterator$] = function () { return this; }; StringIterator.prototype.next = function () { return this._i < this._l ? { done: false, value: this._s.charAt(this._i++) } : doneEnumerator; }; function ArrayIterable(a) { this._a = a; } ArrayIterable.prototype[$iterator$] = function () { return new ArrayIterator(this._a); }; function ArrayIterator(a) { this._a = a; this._l = toLength(a); this._i = 0; } ArrayIterator.prototype[$iterator$] = function () { return this; }; ArrayIterator.prototype.next = function () { return this._i < this._l ? { done: false, value: this._a[this._i++] } : doneEnumerator; }; function numberIsFinite(value) { return typeof value === 'number' && root.isFinite(value); } function isNan(n) { return n !== n; } function getIterable(o) { var i = o[$iterator$], it; if (!i && typeof o === 'string') { it = new StringIterable(o); return it[$iterator$](); } if (!i && o.length !== undefined) { it = new ArrayIterable(o); return it[$iterator$](); } if (!i) { throw new TypeError('Object is not iterable'); } return o[$iterator$](); } function sign(value) { var number = +value; if (number === 0) { return number; } if (isNaN(number)) { return number; } return number < 0 ? -1 : 1; } function toLength(o) { var len = +o.length; if (isNaN(len)) { return 0; } if (len === 0 || !numberIsFinite(len)) { return len; } len = sign(len) * Math.floor(Math.abs(len)); if (len <= 0) { return 0; } if (len > maxSafeInteger) { return maxSafeInteger; } return len; } /** * This method creates a new Observable sequence from an array-like or iterable object. * @param {Any} arrayLike An array-like or iterable object to convert to an Observable sequence. * @param {Function} [mapFn] Map function to call on every element of the array. * @param {Any} [thisArg] The context to use calling the mapFn if provided. * @param {Scheduler} [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread. */ var observableFrom = Observable.from = function (iterable, mapFn, thisArg, scheduler) { if (iterable == null) { throw new Error('iterable cannot be null.') } if (mapFn && !isFunction(mapFn)) { throw new Error('mapFn when provided must be a function'); } if (mapFn) { var mapper = bindCallback(mapFn, thisArg, 2); } isScheduler(scheduler) || (scheduler = currentThreadScheduler); return new FromObservable(iterable, mapper, scheduler); } var FromArrayObservable = (function(__super__) { inherits(FromArrayObservable, __super__); function FromArrayObservable(args, scheduler) { this.args = args; this.scheduler = scheduler; __super__.call(this); } FromArrayObservable.prototype.subscribeCore = function (observer) { var sink = new FromArraySink(observer, this); return sink.run(); }; return FromArrayObservable; }(ObservableBase)); function FromArraySink(observer, parent) { this.observer = observer; this.parent = parent; } FromArraySink.prototype.run = function () { var observer = this.observer, args = this.parent.args, len = args.length; function loopRecursive(i, recurse) { if (i < len) { observer.onNext(args[i]); recurse(i + 1); } else { observer.onCompleted(); } } return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive); }; /** * Converts an array to an observable sequence, using an optional scheduler to enumerate the array. * @deprecated use Observable.from or Observable.of * @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on. * @returns {Observable} The observable sequence whose elements are pulled from the given enumerable sequence. */ var observableFromArray = Observable.fromArray = function (array, scheduler) { isScheduler(scheduler) || (scheduler = currentThreadScheduler); return new FromArrayObservable(array, scheduler) }; /** * Generates an observable sequence by running a state-driven loop producing the sequence's elements, using the specified scheduler to send out observer messages. * * @example * var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; }); * var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; }, Rx.Scheduler.timeout); * @param {Mixed} initialState Initial state. * @param {Function} condition Condition to terminate generation (upon returning false). * @param {Function} iterate Iteration step function. * @param {Function} resultSelector Selector function for results produced in the sequence. * @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not provided, defaults to Scheduler.currentThread. * @returns {Observable} The generated sequence. */ Observable.generate = function (initialState, condition, iterate, resultSelector, scheduler) { isScheduler(scheduler) || (scheduler = currentThreadScheduler); return new AnonymousObservable(function (o) { var first = true; return scheduler.scheduleRecursiveWithState(initialState, function (state, self) { var hasResult, result; try { if (first) { first = false; } else { state = iterate(state); } hasResult = condition(state); hasResult && (result = resultSelector(state)); } catch (e) { return o.onError(e); } if (hasResult) { o.onNext(result); self(state); } else { o.onCompleted(); } }); }); }; function observableOf (scheduler, array) { isScheduler(scheduler) || (scheduler = currentThreadScheduler); return new FromArrayObservable(array, scheduler); } /** * This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments. * @returns {Observable} The observable sequence whose elements are pulled from the given arguments. */ Observable.of = function () { var len = arguments.length, args = new Array(len); for(var i = 0; i < len; i++) { args[i] = arguments[i]; } return new FromArrayObservable(args, currentThreadScheduler); }; /** * This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments. * @param {Scheduler} scheduler A scheduler to use for scheduling the arguments. * @returns {Observable} The observable sequence whose elements are pulled from the given arguments. */ Observable.ofWithScheduler = function (scheduler) { var len = arguments.length, args = new Array(len - 1); for(var i = 1; i < len; i++) { args[i - 1] = arguments[i]; } return new FromArrayObservable(args, scheduler); }; /** * Creates an Observable sequence from changes to an array using Array.observe. * @param {Array} array An array to observe changes. * @returns {Observable} An observable sequence containing changes to an array from Array.observe. */ Observable.ofArrayChanges = function(array) { if (!Array.isArray(array)) { throw new TypeError('Array.observe only accepts arrays.'); } if (typeof Array.observe !== 'function' && typeof Array.unobserve !== 'function') { throw new TypeError('Array.observe is not supported on your platform') } return new AnonymousObservable(function(observer) { function observerFn(changes) { for(var i = 0, len = changes.length; i < len; i++) { observer.onNext(changes[i]); } } Array.observe(array, observerFn); return function () { Array.unobserve(array, observerFn); }; }); }; /** * Creates an Observable sequence from changes to an object using Object.observe. * @param {Object} obj An object to observe changes. * @returns {Observable} An observable sequence containing changes to an object from Object.observe. */ Observable.ofObjectChanges = function(obj) { if (obj == null) { throw new TypeError('object must not be null or undefined.'); } if (typeof Object.observe !== 'function' && typeof Object.unobserve !== 'function') { throw new TypeError('Object.observe is not supported on your platform') } return new AnonymousObservable(function(observer) { function observerFn(changes) { for(var i = 0, len = changes.length; i < len; i++) { observer.onNext(changes[i]); } } Object.observe(obj, observerFn); return function () { Object.unobserve(obj, observerFn); }; }); }; var NeverObservable = (function(__super__) { inherits(NeverObservable, __super__); function NeverObservable() { __super__.call(this); } NeverObservable.prototype.subscribeCore = function (observer) { return disposableEmpty; }; return NeverObservable; }(ObservableBase)); var NEVER_OBSERVABLE = new NeverObservable(); /** * Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins). * @returns {Observable} An observable sequence whose observers will never get called. */ var observableNever = Observable.never = function () { return NEVER_OBSERVABLE; }; var PairsObservable = (function(__super__) { inherits(PairsObservable, __super__); function PairsObservable(obj, scheduler) { this.obj = obj; this.keys = Object.keys(obj); this.scheduler = scheduler; __super__.call(this); } PairsObservable.prototype.subscribeCore = function (observer) { var sink = new PairsSink(observer, this); return sink.run(); }; return PairsObservable; }(ObservableBase)); function PairsSink(observer, parent) { this.observer = observer; this.parent = parent; } PairsSink.prototype.run = function () { var observer = this.observer, obj = this.parent.obj, keys = this.parent.keys, len = keys.length; function loopRecursive(i, recurse) { if (i < len) { var key = keys[i]; observer.onNext([key, obj[key]]); recurse(i + 1); } else { observer.onCompleted(); } } return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive); }; /** * Convert an object into an observable sequence of [key, value] pairs. * @param {Object} obj The object to inspect. * @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on. * @returns {Observable} An observable sequence of [key, value] pairs from the object. */ Observable.pairs = function (obj, scheduler) { scheduler || (scheduler = currentThreadScheduler); return new PairsObservable(obj, scheduler); }; var RangeObservable = (function(__super__) { inherits(RangeObservable, __super__); function RangeObservable(start, count, scheduler) { this.start = start; this.rangeCount = count; this.scheduler = scheduler; __super__.call(this); } RangeObservable.prototype.subscribeCore = function (observer) { var sink = new RangeSink(observer, this); return sink.run(); }; return RangeObservable; }(ObservableBase)); var RangeSink = (function () { function RangeSink(observer, parent) { this.observer = observer; this.parent = parent; } RangeSink.prototype.run = function () { var start = this.parent.start, count = this.parent.rangeCount, observer = this.observer; function loopRecursive(i, recurse) { if (i < count) { observer.onNext(start + i); recurse(i + 1); } else { observer.onCompleted(); } } return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive); }; return RangeSink; }()); /** * Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to send out observer messages. * @param {Number} start The value of the first integer in the sequence. * @param {Number} count The number of sequential integers to generate. * @param {Scheduler} [scheduler] Scheduler to run the generator loop on. If not specified, defaults to Scheduler.currentThread. * @returns {Observable} An observable sequence that contains a range of sequential integral numbers. */ Observable.range = function (start, count, scheduler) { isScheduler(scheduler) || (scheduler = currentThreadScheduler); return new RangeObservable(start, count, scheduler); }; var RepeatObservable = (function(__super__) { inherits(RepeatObservable, __super__); function RepeatObservable(value, repeatCount, scheduler) { this.value = value; this.repeatCount = repeatCount == null ? -1 : repeatCount; this.scheduler = scheduler; __super__.call(this); } RepeatObservable.prototype.subscribeCore = function (observer) { var sink = new RepeatSink(observer, this); return sink.run(); }; return RepeatObservable; }(ObservableBase)); function RepeatSink(observer, parent) { this.observer = observer; this.parent = parent; } RepeatSink.prototype.run = function () { var observer = this.observer, value = this.parent.value; function loopRecursive(i, recurse) { if (i === -1 || i > 0) { observer.onNext(value); i > 0 && i--; } if (i === 0) { return observer.onCompleted(); } recurse(i); } return this.parent.scheduler.scheduleRecursiveWithState(this.parent.repeatCount, loopRecursive); }; /** * Generates an observable sequence that repeats the given element the specified number of times, using the specified scheduler to send out observer messages. * @param {Mixed} value Element to repeat. * @param {Number} repeatCount [Optiona] Number of times to repeat the element. If not specified, repeats indefinitely. * @param {Scheduler} scheduler Scheduler to run the producer loop on. If not specified, defaults to Scheduler.immediate. * @returns {Observable} An observable sequence that repeats the given element the specified number of times. */ Observable.repeat = function (value, repeatCount, scheduler) { isScheduler(scheduler) || (scheduler = currentThreadScheduler); return new RepeatObservable(value, repeatCount, scheduler); }; var JustObservable = (function(__super__) { inherits(JustObservable, __super__); function JustObservable(value, scheduler) { this.value = value; this.scheduler = scheduler; __super__.call(this); } JustObservable.prototype.subscribeCore = function (observer) { var sink = new JustSink(observer, this.value, this.scheduler); return sink.run(); }; function JustSink(observer, value, scheduler) { this.observer = observer; this.value = value; this.scheduler = scheduler; } function scheduleItem(s, state) { var value = state[0], observer = state[1]; observer.onNext(value); observer.onCompleted(); return disposableEmpty; } JustSink.prototype.run = function () { var state = [this.value, this.observer]; return this.scheduler === immediateScheduler ? scheduleItem(null, state) : this.scheduler.scheduleWithState(state, scheduleItem); }; return JustObservable; }(ObservableBase)); /** * Returns an observable sequence that contains a single element, using the specified scheduler to send out observer messages. * There is an alias called 'just' or browsers <IE9. * @param {Mixed} value Single element in the resulting observable sequence. * @param {Scheduler} scheduler Scheduler to send the single element on. If not specified, defaults to Scheduler.immediate. * @returns {Observable} An observable sequence containing the single specified element. */ var observableReturn = Observable['return'] = Observable.just = function (value, scheduler) { isScheduler(scheduler) || (scheduler = immediateScheduler); return new JustObservable(value, scheduler); }; var ThrowObservable = (function(__super__) { inherits(ThrowObservable, __super__); function ThrowObservable(error, scheduler) { this.error = error; this.scheduler = scheduler; __super__.call(this); } ThrowObservable.prototype.subscribeCore = function (o) { var sink = new ThrowSink(o, this); return sink.run(); }; function ThrowSink(o, p) { this.o = o; this.p = p; } function scheduleItem(s, state) { var e = state[0], o = state[1]; o.onError(e); } ThrowSink.prototype.run = function () { return this.p.scheduler.scheduleWithState([this.p.error, this.o], scheduleItem); }; return ThrowObservable; }(ObservableBase)); /** * Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single onError message. * There is an alias to this method called 'throwError' for browsers <IE9. * @param {Mixed} error An object used for the sequence's termination. * @param {Scheduler} scheduler Scheduler to send the exceptional termination call on. If not specified, defaults to Scheduler.immediate. * @returns {Observable} The observable sequence that terminates exceptionally with the specified exception object. */ var observableThrow = Observable['throw'] = function (error, scheduler) { isScheduler(scheduler) || (scheduler = immediateScheduler); return new ThrowObservable(error, scheduler); }; /** * Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime. * @param {Function} resourceFactory Factory function to obtain a resource object. * @param {Function} observableFactory Factory function to obtain an observable sequence that depends on the obtained resource. * @returns {Observable} An observable sequence whose lifetime controls the lifetime of the dependent resource object. */ Observable.using = function (resourceFactory, observableFactory) { return new AnonymousObservable(function (o) { var disposable = disposableEmpty; var resource = tryCatch(resourceFactory)(); if (resource === errorObj) { return new CompositeDisposable(observableThrow(resource.e).subscribe(o), disposable); } resource && (disposable = resource); var source = tryCatch(observableFactory)(resource); if (source === errorObj) { return new CompositeDisposable(observableThrow(source.e).subscribe(o), disposable); } return new CompositeDisposable(source.subscribe(o), disposable); }); }; /** * Propagates the observable sequence or Promise that reacts first. * @param {Observable} rightSource Second observable sequence or Promise. * @returns {Observable} {Observable} An observable sequence that surfaces either of the given sequences, whichever reacted first. */ observableProto.amb = function (rightSource) { var leftSource = this; return new AnonymousObservable(function (observer) { var choice, leftChoice = 'L', rightChoice = 'R', leftSubscription = new SingleAssignmentDisposable(), rightSubscription = new SingleAssignmentDisposable(); isPromise(rightSource) && (rightSource = observableFromPromise(rightSource)); function choiceL() { if (!choice) { choice = leftChoice; rightSubscription.dispose(); } } function choiceR() { if (!choice) { choice = rightChoice; leftSubscription.dispose(); } } var leftSubscribe = observerCreate( function (left) { choiceL(); choice === leftChoice && observer.onNext(left); }, function (e) { choiceL(); choice === leftChoice && observer.onError(e); }, function () { choiceL(); choice === leftChoice && observer.onCompleted(); } ); var rightSubscribe = observerCreate( function (right) { choiceR(); choice === rightChoice && observer.onNext(right); }, function (e) { choiceR(); choice === rightChoice && observer.onError(e); }, function () { choiceR(); choice === rightChoice && observer.onCompleted(); } ); leftSubscription.setDisposable(leftSource.subscribe(leftSubscribe)); rightSubscription.setDisposable(rightSource.subscribe(rightSubscribe)); return new CompositeDisposable(leftSubscription, rightSubscription); }); }; function amb(p, c) { return p.amb(c); } /** * Propagates the observable sequence or Promise that reacts first. * @returns {Observable} An observable sequence that surfaces any of the given sequences, whichever reacted first. */ Observable.amb = function () { var acc = observableNever(), items; if (Array.isArray(arguments[0])) { items = arguments[0]; } else { var len = arguments.length; items = new Array(items); for(var i = 0; i < len; i++) { items[i] = arguments[i]; } } for (var i = 0, len = items.length; i < len; i++) { acc = amb(acc, items[i]); } return acc; }; var CatchObserver = (function(__super__) { inherits(CatchObserver, __super__); function CatchObserver(o, s, fn) { this._o = o; this._s = s; this._fn = fn; __super__.call(this); } CatchObserver.prototype.next = function (x) { this._o.onNext(x); }; CatchObserver.prototype.completed = function () { return this._o.onCompleted(); }; CatchObserver.prototype.error = function (e) { var result = tryCatch(this._fn)(e); if (result === errorObj) { return this._o.onError(result.e); } isPromise(result) && (result = observableFromPromise(result)); var d = new SingleAssignmentDisposable(); this._s.setDisposable(d); d.setDisposable(result.subscribe(this._o)); }; return CatchObserver; }(AbstractObserver)); function observableCatchHandler(source, handler) { return new AnonymousObservable(function (o) { var d1 = new SingleAssignmentDisposable(), subscription = new SerialDisposable(); subscription.setDisposable(d1); d1.setDisposable(source.subscribe(new CatchObserver(o, subscription, handler))); return subscription; }, source); } /** * Continues an observable sequence that is terminated by an exception with the next observable sequence. * @param {Mixed} handlerOrSecond Exception handler function that returns an observable sequence given the error that occurred in the first sequence, or a second observable sequence used to produce results when an error occurred in the first sequence. * @returns {Observable} An observable sequence containing the first sequence's elements, followed by the elements of the handler sequence in case an exception occurred. */ observableProto['catch'] = function (handlerOrSecond) { return isFunction(handlerOrSecond) ? observableCatchHandler(this, handlerOrSecond) : observableCatch([this, handlerOrSecond]); }; /** * Continues an observable sequence that is terminated by an exception with the next observable sequence. * @param {Array | Arguments} args Arguments or an array to use as the next sequence if an error occurs. * @returns {Observable} An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully. */ var observableCatch = Observable['catch'] = function () { var items; if (Array.isArray(arguments[0])) { items = arguments[0]; } else { var len = arguments.length; items = new Array(len); for(var i = 0; i < len; i++) { items[i] = arguments[i]; } } return enumerableOf(items).catchError(); }; /** * Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element. * This can be in the form of an argument list of observables or an array. * * @example * 1 - obs = observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; }); * 2 - obs = observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; }); * @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function. */ observableProto.combineLatest = function () { var len = arguments.length, args = new Array(len); for(var i = 0; i < len; i++) { args[i] = arguments[i]; } if (Array.isArray(args[0])) { args[0].unshift(this); } else { args.unshift(this); } return combineLatest.apply(this, args); }; function falseFactory() { return false; } function argumentsToArray() { var len = arguments.length, args = new Array(len); for(var i = 0; i < len; i++) { args[i] = arguments[i]; } return args; } /** * Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element. * * @example * 1 - obs = Rx.Observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; }); * 2 - obs = Rx.Observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; }); * @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function. */ var combineLatest = Observable.combineLatest = function () { var len = arguments.length, args = new Array(len); for(var i = 0; i < len; i++) { args[i] = arguments[i]; } var resultSelector = isFunction(args[len - 1]) ? args.pop() : argumentsToArray; Array.isArray(args[0]) && (args = args[0]); return new AnonymousObservable(function (o) { var n = args.length, hasValue = arrayInitialize(n, falseFactory), hasValueAll = false, isDone = arrayInitialize(n, falseFactory), values = new Array(n); function next(i) { hasValue[i] = true; if (hasValueAll || (hasValueAll = hasValue.every(identity))) { try { var res = resultSelector.apply(null, values); } catch (e) { return o.onError(e); } o.onNext(res); } else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) { o.onCompleted(); } } function done (i) { isDone[i] = true; isDone.every(identity) && o.onCompleted(); } var subscriptions = new Array(n); for (var idx = 0; idx < n; idx++) { (function (i) { var source = args[i], sad = new SingleAssignmentDisposable(); isPromise(source) && (source = observableFromPromise(source)); sad.setDisposable(source.subscribe(function (x) { values[i] = x; next(i); }, function(e) { o.onError(e); }, function () { done(i); } )); subscriptions[i] = sad; }(idx)); } return new CompositeDisposable(subscriptions); }, this); }; /** * Concatenates all the observable sequences. This takes in either an array or variable arguments to concatenate. * @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order. */ observableProto.concat = function () { for(var args = [], i = 0, len = arguments.length; i < len; i++) { args.push(arguments[i]); } args.unshift(this); return observableConcat.apply(null, args); }; var ConcatObservable = (function(__super__) { inherits(ConcatObservable, __super__); function ConcatObservable(sources) { this.sources = sources; __super__.call(this); } ConcatObservable.prototype.subscribeCore = function(o) { var sink = new ConcatSink(this.sources, o); return sink.run(); }; function ConcatSink(sources, o) { this.sources = sources; this.o = o; } ConcatSink.prototype.run = function () { var isDisposed, subscription = new SerialDisposable(), sources = this.sources, length = sources.length, o = this.o; var cancelable = immediateScheduler.scheduleRecursiveWithState(0, function (i, self) { if (isDisposed) { return; } if (i === length) { return o.onCompleted(); } // Check if promise var currentValue = sources[i]; isPromise(currentValue) && (currentValue = observableFromPromise(currentValue)); var d = new SingleAssignmentDisposable(); subscription.setDisposable(d); d.setDisposable(currentValue.subscribe( function (x) { o.onNext(x); }, function (e) { o.onError(e); }, function () { self(i + 1); } )); }); return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { isDisposed = true; })); }; return ConcatObservable; }(ObservableBase)); /** * Concatenates all the observable sequences. * @param {Array | Arguments} args Arguments or an array to concat to the observable sequence. * @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order. */ var observableConcat = Observable.concat = function () { var args; if (Array.isArray(arguments[0])) { args = arguments[0]; } else { args = new Array(arguments.length); for(var i = 0, len = arguments.length; i < len; i++) { args[i] = arguments[i]; } } return new ConcatObservable(args); }; /** * Concatenates an observable sequence of observable sequences. * @returns {Observable} An observable sequence that contains the elements of each observed inner sequence, in sequential order. */ observableProto.concatAll = function () { return this.merge(1); }; var MergeObservable = (function (__super__) { inherits(MergeObservable, __super__); function MergeObservable(source, maxConcurrent) { this.source = source; this.maxConcurrent = maxConcurrent; __super__.call(this); } MergeObservable.prototype.subscribeCore = function(observer) { var g = new CompositeDisposable(); g.add(this.source.subscribe(new MergeObserver(observer, this.maxConcurrent, g))); return g; }; return MergeObservable; }(ObservableBase)); var MergeObserver = (function () { function MergeObserver(o, max, g) { this.o = o; this.max = max; this.g = g; this.done = false; this.q = []; this.activeCount = 0; this.isStopped = false; } MergeObserver.prototype.handleSubscribe = function (xs) { var sad = new SingleAssignmentDisposable(); this.g.add(sad); isPromise(xs) && (xs = observableFromPromise(xs)); sad.setDisposable(xs.subscribe(new InnerObserver(this, sad))); }; MergeObserver.prototype.onNext = function (innerSource) { if (this.isStopped) { return; } if(this.activeCount < this.max) { this.activeCount++; this.handleSubscribe(innerSource); } else { this.q.push(innerSource); } }; MergeObserver.prototype.onError = function (e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); } }; MergeObserver.prototype.onCompleted = function () { if (!this.isStopped) { this.isStopped = true; this.done = true; this.activeCount === 0 && this.o.onCompleted(); } }; MergeObserver.prototype.dispose = function() { this.isStopped = true; }; MergeObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); return true; } return false; }; function InnerObserver(parent, sad) { this.parent = parent; this.sad = sad; this.isStopped = false; } InnerObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.parent.o.onNext(x); } }; InnerObserver.prototype.onError = function (e) { if (!this.isStopped) { this.isStopped = true; this.parent.o.onError(e); } }; InnerObserver.prototype.onCompleted = function () { if(!this.isStopped) { this.isStopped = true; var parent = this.parent; parent.g.remove(this.sad); if (parent.q.length > 0) { parent.handleSubscribe(parent.q.shift()); } else { parent.activeCount--; parent.done && parent.activeCount === 0 && parent.o.onCompleted(); } } }; InnerObserver.prototype.dispose = function() { this.isStopped = true; }; InnerObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.parent.o.onError(e); return true; } return false; }; return MergeObserver; }()); /** * Merges an observable sequence of observable sequences into an observable sequence, limiting the number of concurrent subscriptions to inner sequences. * Or merges two observable sequences into a single observable sequence. * * @example * 1 - merged = sources.merge(1); * 2 - merged = source.merge(otherSource); * @param {Mixed} [maxConcurrentOrOther] Maximum number of inner observable sequences being subscribed to concurrently or the second observable sequence. * @returns {Observable} The observable sequence that merges the elements of the inner sequences. */ observableProto.merge = function (maxConcurrentOrOther) { return typeof maxConcurrentOrOther !== 'number' ? observableMerge(this, maxConcurrentOrOther) : new MergeObservable(this, maxConcurrentOrOther); }; /** * Merges all the observable sequences into a single observable sequence. * The scheduler is optional and if not specified, the immediate scheduler is used. * @returns {Observable} The observable sequence that merges the elements of the observable sequences. */ var observableMerge = Observable.merge = function () { var scheduler, sources = [], i, len = arguments.length; if (!arguments[0]) { scheduler = immediateScheduler; for(i = 1; i < len; i++) { sources.push(arguments[i]); } } else if (isScheduler(arguments[0])) { scheduler = arguments[0]; for(i = 1; i < len; i++) { sources.push(arguments[i]); } } else { scheduler = immediateScheduler; for(i = 0; i < len; i++) { sources.push(arguments[i]); } } if (Array.isArray(sources[0])) { sources = sources[0]; } return observableOf(scheduler, sources).mergeAll(); }; var MergeAllObservable = (function (__super__) { inherits(MergeAllObservable, __super__); function MergeAllObservable(source) { this.source = source; __super__.call(this); } MergeAllObservable.prototype.subscribeCore = function (observer) { var g = new CompositeDisposable(), m = new SingleAssignmentDisposable(); g.add(m); m.setDisposable(this.source.subscribe(new MergeAllObserver(observer, g))); return g; }; function MergeAllObserver(o, g) { this.o = o; this.g = g; this.isStopped = false; this.done = false; } MergeAllObserver.prototype.onNext = function(innerSource) { if(this.isStopped) { return; } var sad = new SingleAssignmentDisposable(); this.g.add(sad); isPromise(innerSource) && (innerSource = observableFromPromise(innerSource)); sad.setDisposable(innerSource.subscribe(new InnerObserver(this, sad))); }; MergeAllObserver.prototype.onError = function (e) { if(!this.isStopped) { this.isStopped = true; this.o.onError(e); } }; MergeAllObserver.prototype.onCompleted = function () { if(!this.isStopped) { this.isStopped = true; this.done = true; this.g.length === 1 && this.o.onCompleted(); } }; MergeAllObserver.prototype.dispose = function() { this.isStopped = true; }; MergeAllObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); return true; } return false; }; function InnerObserver(parent, sad) { this.parent = parent; this.sad = sad; this.isStopped = false; } InnerObserver.prototype.onNext = function (x) { if (!this.isStopped) { this.parent.o.onNext(x); } }; InnerObserver.prototype.onError = function (e) { if(!this.isStopped) { this.isStopped = true; this.parent.o.onError(e); } }; InnerObserver.prototype.onCompleted = function () { if(!this.isStopped) { var parent = this.parent; this.isStopped = true; parent.g.remove(this.sad); parent.done && parent.g.length === 1 && parent.o.onCompleted(); } }; InnerObserver.prototype.dispose = function() { this.isStopped = true; }; InnerObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.parent.o.onError(e); return true; } return false; }; return MergeAllObservable; }(ObservableBase)); /** * Merges an observable sequence of observable sequences into an observable sequence. * @returns {Observable} The observable sequence that merges the elements of the inner sequences. */ observableProto.mergeAll = function () { return new MergeAllObservable(this); }; var CompositeError = Rx.CompositeError = function(errors) { this.name = "NotImplementedError"; this.innerErrors = errors; this.message = 'This contains multiple errors. Check the innerErrors'; Error.call(this); } CompositeError.prototype = Error.prototype; /** * Flattens an Observable that emits Observables into one Observable, in a way that allows an Observer to * receive all successfully emitted items from all of the source Observables without being interrupted by * an error notification from one of them. * * This behaves like Observable.prototype.mergeAll except that if any of the merged Observables notify of an * error via the Observer's onError, mergeDelayError will refrain from propagating that * error notification until all of the merged Observables have finished emitting items. * @param {Array | Arguments} args Arguments or an array to merge. * @returns {Observable} an Observable that emits all of the items emitted by the Observables emitted by the Observable */ Observable.mergeDelayError = function() { var args; if (Array.isArray(arguments[0])) { args = arguments[0]; } else { var len = arguments.length; args = new Array(len); for(var i = 0; i < len; i++) { args[i] = arguments[i]; } } var source = observableOf(null, args); return new AnonymousObservable(function (o) { var group = new CompositeDisposable(), m = new SingleAssignmentDisposable(), isStopped = false, errors = []; function setCompletion() { if (errors.length === 0) { o.onCompleted(); } else if (errors.length === 1) { o.onError(errors[0]); } else { o.onError(new CompositeError(errors)); } } group.add(m); m.setDisposable(source.subscribe( function (innerSource) { var innerSubscription = new SingleAssignmentDisposable(); group.add(innerSubscription); // Check for promises support isPromise(innerSource) && (innerSource = observableFromPromise(innerSource)); innerSubscription.setDisposable(innerSource.subscribe( function (x) { o.onNext(x); }, function (e) { errors.push(e); group.remove(innerSubscription); isStopped && group.length === 1 && setCompletion(); }, function () { group.remove(innerSubscription); isStopped && group.length === 1 && setCompletion(); })); }, function (e) { errors.push(e); isStopped = true; group.length === 1 && setCompletion(); }, function () { isStopped = true; group.length === 1 && setCompletion(); })); return group; }); }; /** * Continues an observable sequence that is terminated normally or by an exception with the next observable sequence. * @param {Observable} second Second observable sequence used to produce results after the first sequence terminates. * @returns {Observable} An observable sequence that concatenates the first and second sequence, even if the first sequence terminates exceptionally. */ observableProto.onErrorResumeNext = function (second) { if (!second) { throw new Error('Second observable is required'); } return onErrorResumeNext([this, second]); }; /** * Continues an observable sequence that is terminated normally or by an exception with the next observable sequence. * * @example * 1 - res = Rx.Observable.onErrorResumeNext(xs, ys, zs); * 1 - res = Rx.Observable.onErrorResumeNext([xs, ys, zs]); * @returns {Observable} An observable sequence that concatenates the source sequences, even if a sequence terminates exceptionally. */ var onErrorResumeNext = Observable.onErrorResumeNext = function () { var sources = []; if (Array.isArray(arguments[0])) { sources = arguments[0]; } else { for(var i = 0, len = arguments.length; i < len; i++) { sources.push(arguments[i]); } } return new AnonymousObservable(function (observer) { var pos = 0, subscription = new SerialDisposable(), cancelable = immediateScheduler.scheduleRecursive(function (self) { var current, d; if (pos < sources.length) { current = sources[pos++]; isPromise(current) && (current = observableFromPromise(current)); d = new SingleAssignmentDisposable(); subscription.setDisposable(d); d.setDisposable(current.subscribe(observer.onNext.bind(observer), self, self)); } else { observer.onCompleted(); } }); return new CompositeDisposable(subscription, cancelable); }); }; /** * Returns the values from the source observable sequence only after the other observable sequence produces a value. * @param {Observable | Promise} other The observable sequence or Promise that triggers propagation of elements of the source sequence. * @returns {Observable} An observable sequence containing the elements of the source sequence starting from the point the other sequence triggered propagation. */ observableProto.skipUntil = function (other) { var source = this; return new AnonymousObservable(function (o) { var isOpen = false; var disposables = new CompositeDisposable(source.subscribe(function (left) { isOpen && o.onNext(left); }, function (e) { o.onError(e); }, function () { isOpen && o.onCompleted(); })); isPromise(other) && (other = observableFromPromise(other)); var rightSubscription = new SingleAssignmentDisposable(); disposables.add(rightSubscription); rightSubscription.setDisposable(other.subscribe(function () { isOpen = true; rightSubscription.dispose(); }, function (e) { o.onError(e); }, function () { rightSubscription.dispose(); })); return disposables; }, source); }; var SwitchObservable = (function(__super__) { inherits(SwitchObservable, __super__); function SwitchObservable(source) { this.source = source; __super__.call(this); } SwitchObservable.prototype.subscribeCore = function (o) { var inner = new SerialDisposable(), s = this.source.subscribe(new SwitchObserver(o, inner)); return new CompositeDisposable(s, inner); }; function SwitchObserver(o, inner) { this.o = o; this.inner = inner; this.stopped = false; this.latest = 0; this.hasLatest = false; this.isStopped = false; } SwitchObserver.prototype.onNext = function (innerSource) { if (this.isStopped) { return; } var d = new SingleAssignmentDisposable(), id = ++this.latest; this.hasLatest = true; this.inner.setDisposable(d); isPromise(innerSource) && (innerSource = observableFromPromise(innerSource)); d.setDisposable(innerSource.subscribe(new InnerObserver(this, id))); }; SwitchObserver.prototype.onError = function (e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); } }; SwitchObserver.prototype.onCompleted = function () { if (!this.isStopped) { this.isStopped = true; this.stopped = true; !this.hasLatest && this.o.onCompleted(); } }; SwitchObserver.prototype.dispose = function () { this.isStopped = true; }; SwitchObserver.prototype.fail = function (e) { if(!this.isStopped) { this.isStopped = true; this.o.onError(e); return true; } return false; }; function InnerObserver(parent, id) { this.parent = parent; this.id = id; this.isStopped = false; } InnerObserver.prototype.onNext = function (x) { if (this.isStopped) { return; } this.parent.latest === this.id && this.parent.o.onNext(x); }; InnerObserver.prototype.onError = function (e) { if (!this.isStopped) { this.isStopped = true; this.parent.latest === this.id && this.parent.o.onError(e); } }; InnerObserver.prototype.onCompleted = function () { if (!this.isStopped) { this.isStopped = true; if (this.parent.latest === this.id) { this.parent.hasLatest = false; this.parent.isStopped && this.parent.o.onCompleted(); } } }; InnerObserver.prototype.dispose = function () { this.isStopped = true; } InnerObserver.prototype.fail = function (e) { if(!this.isStopped) { this.isStopped = true; this.parent.o.onError(e); return true; } return false; }; return SwitchObservable; }(ObservableBase)); /** * Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence. * @returns {Observable} The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received. */ observableProto['switch'] = observableProto.switchLatest = function () { return new SwitchObservable(this); }; var TakeUntilObservable = (function(__super__) { inherits(TakeUntilObservable, __super__); function TakeUntilObservable(source, other) { this.source = source; this.other = isPromise(other) ? observableFromPromise(other) : other; __super__.call(this); } TakeUntilObservable.prototype.subscribeCore = function(o) { return new CompositeDisposable( this.source.subscribe(o), this.other.subscribe(new InnerObserver(o)) ); }; function InnerObserver(o) { this.o = o; this.isStopped = false; } InnerObserver.prototype.onNext = function (x) { if (this.isStopped) { return; } this.o.onCompleted(); }; InnerObserver.prototype.onError = function (err) { if (!this.isStopped) { this.isStopped = true; this.o.onError(err); } }; InnerObserver.prototype.onCompleted = function () { !this.isStopped && (this.isStopped = true); }; InnerObserver.prototype.dispose = function() { this.isStopped = true; }; InnerObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); return true; } return false; }; return TakeUntilObservable; }(ObservableBase)); /** * Returns the values from the source observable sequence until the other observable sequence produces a value. * @param {Observable | Promise} other Observable sequence or Promise that terminates propagation of elements of the source sequence. * @returns {Observable} An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation. */ observableProto.takeUntil = function (other) { return new TakeUntilObservable(this, other); }; function falseFactory() { return false; } /** * Merges the specified observable sequences into one observable sequence by using the selector function only when the (first) source observable sequence produces an element. * @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function. */ observableProto.withLatestFrom = function () { var len = arguments.length, args = new Array(len) for(var i = 0; i < len; i++) { args[i] = arguments[i]; } var resultSelector = args.pop(), source = this; Array.isArray(args[0]) && (args = args[0]); return new AnonymousObservable(function (observer) { var n = args.length, hasValue = arrayInitialize(n, falseFactory), hasValueAll = false, values = new Array(n); var subscriptions = new Array(n + 1); for (var idx = 0; idx < n; idx++) { (function (i) { var other = args[i], sad = new SingleAssignmentDisposable(); isPromise(other) && (other = observableFromPromise(other)); sad.setDisposable(other.subscribe(function (x) { values[i] = x; hasValue[i] = true; hasValueAll = hasValue.every(identity); }, function (e) { observer.onError(e); }, noop)); subscriptions[i] = sad; }(idx)); } var sad = new SingleAssignmentDisposable(); sad.setDisposable(source.subscribe(function (x) { var allValues = [x].concat(values); if (!hasValueAll) { return; } var res = tryCatch(resultSelector).apply(null, allValues); if (res === errorObj) { return observer.onError(res.e); } observer.onNext(res); }, function (e) { observer.onError(e); }, function () { observer.onCompleted(); })); subscriptions[n] = sad; return new CompositeDisposable(subscriptions); }, this); }; function falseFactory() { return false; } function emptyArrayFactory() { return []; } function argumentsToArray() { var len = arguments.length, args = new Array(len); for(var i = 0; i < len; i++) { args[i] = arguments[i]; } return args; } /** * Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index. * The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the args. * @returns {Observable} An observable sequence containing the result of combining elements of the args using the specified result selector function. */ observableProto.zip = function () { if (arguments.length === 0) { throw new Error('invalid arguments'); } var len = arguments.length, args = new Array(len); for(var i = 0; i < len; i++) { args[i] = arguments[i]; } var resultSelector = isFunction(args[len - 1]) ? args.pop() : argumentsToArray; Array.isArray(args[0]) && (args = args[0]); var parent = this; args.unshift(parent); return new AnonymousObservable(function (o) { var n = args.length, queues = arrayInitialize(n, emptyArrayFactory), isDone = arrayInitialize(n, falseFactory); var subscriptions = new Array(n); for (var idx = 0; idx < n; idx++) { (function (i) { var source = args[i], sad = new SingleAssignmentDisposable(); isPromise(source) && (source = observableFromPromise(source)); sad.setDisposable(source.subscribe(function (x) { queues[i].push(x); if (queues.every(function (x) { return x.length > 0; })) { var queuedValues = queues.map(function (x) { return x.shift(); }), res = tryCatch(resultSelector).apply(parent, queuedValues); if (res === errorObj) { return o.onError(res.e); } o.onNext(res); } else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) { o.onCompleted(); } }, function (e) { o.onError(e); }, function () { isDone[i] = true; isDone.every(identity) && o.onCompleted(); })); subscriptions[i] = sad; })(idx); } return new CompositeDisposable(subscriptions); }, parent); }; /** * Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index. * @param arguments Observable sources. * @param {Function} resultSelector Function to invoke for each series of elements at corresponding indexes in the sources. * @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function. */ Observable.zip = function () { var len = arguments.length, args = new Array(len); for(var i = 0; i < len; i++) { args[i] = arguments[i]; } var first = args.shift(); return first.zip.apply(first, args); }; function falseFactory() { return false; } function emptyArrayFactory() { return []; } function argumentsToArray() { var len = arguments.length, args = new Array(len); for(var i = 0; i < len; i++) { args[i] = arguments[i]; } return args; } /** * Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index. * The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the args. * @returns {Observable} An observable sequence containing the result of combining elements of the args using the specified result selector function. */ observableProto.zipIterable = function () { if (arguments.length === 0) { throw new Error('invalid arguments'); } var len = arguments.length, args = new Array(len); for(var i = 0; i < len; i++) { args[i] = arguments[i]; } var resultSelector = isFunction(args[len - 1]) ? args.pop() : argumentsToArray; var parent = this; args.unshift(parent); return new AnonymousObservable(function (o) { var n = args.length, queues = arrayInitialize(n, emptyArrayFactory), isDone = arrayInitialize(n, falseFactory); var subscriptions = new Array(n); for (var idx = 0; idx < n; idx++) { (function (i) { var source = args[i], sad = new SingleAssignmentDisposable(); (isArrayLike(source) || isIterable(source)) && (source = observableFrom(source)); sad.setDisposable(source.subscribe(function (x) { queues[i].push(x); if (queues.every(function (x) { return x.length > 0; })) { var queuedValues = queues.map(function (x) { return x.shift(); }), res = tryCatch(resultSelector).apply(parent, queuedValues); if (res === errorObj) { return o.onError(res.e); } o.onNext(res); } else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) { o.onCompleted(); } }, function (e) { o.onError(e); }, function () { isDone[i] = true; isDone.every(identity) && o.onCompleted(); })); subscriptions[i] = sad; })(idx); } return new CompositeDisposable(subscriptions); }, parent); }; function asObservable(source) { return function subscribe(o) { return source.subscribe(o); }; } /** * Hides the identity of an observable sequence. * @returns {Observable} An observable sequence that hides the identity of the source sequence. */ observableProto.asObservable = function () { return new AnonymousObservable(asObservable(this), this); }; function toArray(x) { return x.toArray(); } function notEmpty(x) { return x.length > 0; } /** * Projects each element of an observable sequence into zero or more buffers which are produced based on element count information. * @param {Number} count Length of each buffer. * @param {Number} [skip] Number of elements to skip between creation of consecutive buffers. If not provided, defaults to the count. * @returns {Observable} An observable sequence of buffers. */ observableProto.bufferWithCount = function (count, skip) { typeof skip !== 'number' && (skip = count); return this.windowWithCount(count, skip) .flatMap(toArray) .filter(notEmpty); }; /** * Dematerializes the explicit notification values of an observable sequence as implicit notifications. * @returns {Observable} An observable sequence exhibiting the behavior corresponding to the source sequence's notification values. */ observableProto.dematerialize = function () { var source = this; return new AnonymousObservable(function (o) { return source.subscribe(function (x) { return x.accept(o); }, function(e) { o.onError(e); }, function () { o.onCompleted(); }); }, this); }; var DistinctUntilChangedObservable = (function(__super__) { inherits(DistinctUntilChangedObservable, __super__); function DistinctUntilChangedObservable(source, keyFn, comparer) { this.source = source; this.keyFn = keyFn; this.comparer = comparer; __super__.call(this); } DistinctUntilChangedObservable.prototype.subscribeCore = function (o) { return this.source.subscribe(new DistinctUntilChangedObserver(o, this.keyFn, this.comparer)); }; return DistinctUntilChangedObservable; }(ObservableBase)); var DistinctUntilChangedObserver = (function(__super__) { inherits(DistinctUntilChangedObserver, __super__); function DistinctUntilChangedObserver(o, keyFn, comparer) { this.o = o; this.keyFn = keyFn; this.comparer = comparer; this.hasCurrentKey = false; this.currentKey = null; __super__.call(this); } DistinctUntilChangedObserver.prototype.next = function (x) { var key = x, comparerEquals; if (isFunction(this.keyFn)) { key = tryCatch(this.keyFn)(x); if (key === errorObj) { return this.o.onError(key.e); } } if (this.hasCurrentKey) { comparerEquals = tryCatch(this.comparer)(this.currentKey, key); if (comparerEquals === errorObj) { return this.o.onError(comparerEquals.e); } } if (!this.hasCurrentKey || !comparerEquals) { this.hasCurrentKey = true; this.currentKey = key; this.o.onNext(x); } }; DistinctUntilChangedObserver.prototype.error = function(e) { this.o.onError(e); }; DistinctUntilChangedObserver.prototype.completed = function () { this.o.onCompleted(); }; return DistinctUntilChangedObserver; }(AbstractObserver)); /** * Returns an observable sequence that contains only distinct contiguous elements according to the keyFn and the comparer. * @param {Function} [keyFn] A function to compute the comparison key for each element. If not provided, it projects the value. * @param {Function} [comparer] Equality comparer for computed key values. If not provided, defaults to an equality comparer function. * @returns {Observable} An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence. */ observableProto.distinctUntilChanged = function (keyFn, comparer) { comparer || (comparer = defaultComparer); return new DistinctUntilChangedObservable(this, keyFn, comparer); }; var TapObservable = (function(__super__) { inherits(TapObservable,__super__); function TapObservable(source, observerOrOnNext, onError, onCompleted) { this.source = source; this._oN = observerOrOnNext; this._oE = onError; this._oC = onCompleted; __super__.call(this); } TapObservable.prototype.subscribeCore = function(o) { return this.source.subscribe(new InnerObserver(o, this)); }; function InnerObserver(o, p) { this.o = o; this.t = !p._oN || isFunction(p._oN) ? observerCreate(p._oN || noop, p._oE || noop, p._oC || noop) : p._oN; this.isStopped = false; } InnerObserver.prototype.onNext = function(x) { if (this.isStopped) { return; } var res = tryCatch(this.t.onNext).call(this.t, x); if (res === errorObj) { this.o.onError(res.e); } this.o.onNext(x); }; InnerObserver.prototype.onError = function(err) { if (!this.isStopped) { this.isStopped = true; var res = tryCatch(this.t.onError).call(this.t, err); if (res === errorObj) { return this.o.onError(res.e); } this.o.onError(err); } }; InnerObserver.prototype.onCompleted = function() { if (!this.isStopped) { this.isStopped = true; var res = tryCatch(this.t.onCompleted).call(this.t); if (res === errorObj) { return this.o.onError(res.e); } this.o.onCompleted(); } }; InnerObserver.prototype.dispose = function() { this.isStopped = true; }; InnerObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); return true; } return false; }; return TapObservable; }(ObservableBase)); /** * Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence. * This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline. * @param {Function | Observer} observerOrOnNext Action to invoke for each element in the observable sequence or an o. * @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function. * @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function. * @returns {Observable} The source sequence with the side-effecting behavior applied. */ observableProto['do'] = observableProto.tap = observableProto.doAction = function (observerOrOnNext, onError, onCompleted) { return new TapObservable(this, observerOrOnNext, onError, onCompleted); }; /** * Invokes an action for each element in the observable sequence. * This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline. * @param {Function} onNext Action to invoke for each element in the observable sequence. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} The source sequence with the side-effecting behavior applied. */ observableProto.doOnNext = observableProto.tapOnNext = function (onNext, thisArg) { return this.tap(typeof thisArg !== 'undefined' ? function (x) { onNext.call(thisArg, x); } : onNext); }; /** * Invokes an action upon exceptional termination of the observable sequence. * This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline. * @param {Function} onError Action to invoke upon exceptional termination of the observable sequence. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} The source sequence with the side-effecting behavior applied. */ observableProto.doOnError = observableProto.tapOnError = function (onError, thisArg) { return this.tap(noop, typeof thisArg !== 'undefined' ? function (e) { onError.call(thisArg, e); } : onError); }; /** * Invokes an action upon graceful termination of the observable sequence. * This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline. * @param {Function} onCompleted Action to invoke upon graceful termination of the observable sequence. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} The source sequence with the side-effecting behavior applied. */ observableProto.doOnCompleted = observableProto.tapOnCompleted = function (onCompleted, thisArg) { return this.tap(noop, null, typeof thisArg !== 'undefined' ? function () { onCompleted.call(thisArg); } : onCompleted); }; /** * Invokes a specified action after the source observable sequence terminates gracefully or exceptionally. * @param {Function} finallyAction Action to invoke after the source observable sequence terminates. * @returns {Observable} Source sequence with the action-invoking termination behavior applied. */ observableProto['finally'] = function (action) { var source = this; return new AnonymousObservable(function (observer) { var subscription = tryCatch(source.subscribe).call(source, observer); if (subscription === errorObj) { action(); return thrower(subscription.e); } return disposableCreate(function () { var r = tryCatch(subscription.dispose).call(subscription); action(); r === errorObj && thrower(r.e); }); }, this); }; var IgnoreElementsObservable = (function(__super__) { inherits(IgnoreElementsObservable, __super__); function IgnoreElementsObservable(source) { this.source = source; __super__.call(this); } IgnoreElementsObservable.prototype.subscribeCore = function (o) { return this.source.subscribe(new InnerObserver(o)); }; function InnerObserver(o) { this.o = o; this.isStopped = false; } InnerObserver.prototype.onNext = noop; InnerObserver.prototype.onError = function (err) { if(!this.isStopped) { this.isStopped = true; this.o.onError(err); } }; InnerObserver.prototype.onCompleted = function () { if(!this.isStopped) { this.isStopped = true; this.o.onCompleted(); } }; InnerObserver.prototype.dispose = function() { this.isStopped = true; }; InnerObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.observer.onError(e); return true; } return false; }; return IgnoreElementsObservable; }(ObservableBase)); /** * Ignores all elements in an observable sequence leaving only the termination messages. * @returns {Observable} An empty observable sequence that signals termination, successful or exceptional, of the source sequence. */ observableProto.ignoreElements = function () { return new IgnoreElementsObservable(this); }; /** * Materializes the implicit notifications of an observable sequence as explicit notification values. * @returns {Observable} An observable sequence containing the materialized notification values from the source sequence. */ observableProto.materialize = function () { var source = this; return new AnonymousObservable(function (observer) { return source.subscribe(function (value) { observer.onNext(notificationCreateOnNext(value)); }, function (e) { observer.onNext(notificationCreateOnError(e)); observer.onCompleted(); }, function () { observer.onNext(notificationCreateOnCompleted()); observer.onCompleted(); }); }, source); }; /** * Repeats the observable sequence a specified number of times. If the repeat count is not specified, the sequence repeats indefinitely. * @param {Number} [repeatCount] Number of times to repeat the sequence. If not provided, repeats the sequence indefinitely. * @returns {Observable} The observable sequence producing the elements of the given sequence repeatedly. */ observableProto.repeat = function (repeatCount) { return enumerableRepeat(this, repeatCount).concat(); }; /** * Repeats the source observable sequence the specified number of times or until it successfully terminates. If the retry count is not specified, it retries indefinitely. * Note if you encounter an error and want it to retry once, then you must use .retry(2); * * @example * var res = retried = retry.repeat(); * var res = retried = retry.repeat(2); * @param {Number} [retryCount] Number of times to retry the sequence. If not provided, retry the sequence indefinitely. * @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully. */ observableProto.retry = function (retryCount) { return enumerableRepeat(this, retryCount).catchError(); }; /** * Repeats the source observable sequence upon error each time the notifier emits or until it successfully terminates. * if the notifier completes, the observable sequence completes. * * @example * var timer = Observable.timer(500); * var source = observable.retryWhen(timer); * @param {Observable} [notifier] An observable that triggers the retries or completes the observable with onNext or onCompleted respectively. * @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully. */ observableProto.retryWhen = function (notifier) { return enumerableRepeat(this).catchErrorWhen(notifier); }; var ScanObservable = (function(__super__) { inherits(ScanObservable, __super__); function ScanObservable(source, accumulator, hasSeed, seed) { this.source = source; this.accumulator = accumulator; this.hasSeed = hasSeed; this.seed = seed; __super__.call(this); } ScanObservable.prototype.subscribeCore = function(o) { return this.source.subscribe(new InnerObserver(o,this)); }; return ScanObservable; }(ObservableBase)); function InnerObserver(o, parent) { this.o = o; this.accumulator = parent.accumulator; this.hasSeed = parent.hasSeed; this.seed = parent.seed; this.hasAccumulation = false; this.accumulation = null; this.hasValue = false; this.isStopped = false; } InnerObserver.prototype = { onNext: function (x) { if (this.isStopped) { return; } !this.hasValue && (this.hasValue = true); if (this.hasAccumulation) { this.accumulation = tryCatch(this.accumulator)(this.accumulation, x); } else { this.accumulation = this.hasSeed ? tryCatch(this.accumulator)(this.seed, x) : x; this.hasAccumulation = true; } if (this.accumulation === errorObj) { return this.o.onError(this.accumulation.e); } this.o.onNext(this.accumulation); }, onError: function (e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); } }, onCompleted: function () { if (!this.isStopped) { this.isStopped = true; !this.hasValue && this.hasSeed && this.o.onNext(this.seed); this.o.onCompleted(); } }, dispose: function() { this.isStopped = true; }, fail: function (e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); return true; } return false; } }; /** * Applies an accumulator function over an observable sequence and returns each intermediate result. The optional seed value is used as the initial accumulator value. * For aggregation behavior with no intermediate results, see Observable.aggregate. * @param {Mixed} [seed] The initial accumulator value. * @param {Function} accumulator An accumulator function to be invoked on each element. * @returns {Observable} An observable sequence containing the accumulated values. */ observableProto.scan = function () { var hasSeed = false, seed, accumulator = arguments[0]; if (arguments.length === 2) { hasSeed = true; seed = arguments[1]; } return new ScanObservable(this, accumulator, hasSeed, seed); }; /** * Bypasses a specified number of elements at the end of an observable sequence. * @description * This operator accumulates a queue with a length enough to store the first `count` elements. As more elements are * received, elements are taken from the front of the queue and produced on the result sequence. This causes elements to be delayed. * @param count Number of elements to bypass at the end of the source sequence. * @returns {Observable} An observable sequence containing the source sequence elements except for the bypassed ones at the end. */ observableProto.skipLast = function (count) { if (count < 0) { throw new ArgumentOutOfRangeError(); } var source = this; return new AnonymousObservable(function (o) { var q = []; return source.subscribe(function (x) { q.push(x); q.length > count && o.onNext(q.shift()); }, function (e) { o.onError(e); }, function () { o.onCompleted(); }); }, source); }; /** * Prepends a sequence of values to an observable sequence with an optional scheduler and an argument list of values to prepend. * @example * var res = source.startWith(1, 2, 3); * var res = source.startWith(Rx.Scheduler.timeout, 1, 2, 3); * @param {Arguments} args The specified values to prepend to the observable sequence * @returns {Observable} The source sequence prepended with the specified values. */ observableProto.startWith = function () { var values, scheduler, start = 0; if (!!arguments.length && isScheduler(arguments[0])) { scheduler = arguments[0]; start = 1; } else { scheduler = immediateScheduler; } for(var args = [], i = start, len = arguments.length; i < len; i++) { args.push(arguments[i]); } return enumerableOf([observableFromArray(args, scheduler), this]).concat(); }; /** * Returns a specified number of contiguous elements from the end of an observable sequence. * @description * This operator accumulates a buffer with a length enough to store elements count elements. Upon completion of * the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed. * @param {Number} count Number of elements to take from the end of the source sequence. * @returns {Observable} An observable sequence containing the specified number of elements from the end of the source sequence. */ observableProto.takeLast = function (count) { if (count < 0) { throw new ArgumentOutOfRangeError(); } var source = this; return new AnonymousObservable(function (o) { var q = []; return source.subscribe(function (x) { q.push(x); q.length > count && q.shift(); }, function (e) { o.onError(e); }, function () { while (q.length > 0) { o.onNext(q.shift()); } o.onCompleted(); }); }, source); }; /** * Returns an array with the specified number of contiguous elements from the end of an observable sequence. * * @description * This operator accumulates a buffer with a length enough to store count elements. Upon completion of the * source sequence, this buffer is produced on the result sequence. * @param {Number} count Number of elements to take from the end of the source sequence. * @returns {Observable} An observable sequence containing a single array with the specified number of elements from the end of the source sequence. */ observableProto.takeLastBuffer = function (count) { var source = this; return new AnonymousObservable(function (o) { var q = []; return source.subscribe(function (x) { q.push(x); q.length > count && q.shift(); }, function (e) { o.onError(e); }, function () { o.onNext(q); o.onCompleted(); }); }, source); }; /** * Projects each element of an observable sequence into zero or more windows which are produced based on element count information. * * var res = xs.windowWithCount(10); * var res = xs.windowWithCount(10, 1); * @param {Number} count Length of each window. * @param {Number} [skip] Number of elements to skip between creation of consecutive windows. If not specified, defaults to the count. * @returns {Observable} An observable sequence of windows. */ observableProto.windowWithCount = function (count, skip) { var source = this; +count || (count = 0); Math.abs(count) === Infinity && (count = 0); if (count <= 0) { throw new ArgumentOutOfRangeError(); } skip == null && (skip = count); +skip || (skip = 0); Math.abs(skip) === Infinity && (skip = 0); if (skip <= 0) { throw new ArgumentOutOfRangeError(); } return new AnonymousObservable(function (observer) { var m = new SingleAssignmentDisposable(), refCountDisposable = new RefCountDisposable(m), n = 0, q = []; function createWindow () { var s = new Subject(); q.push(s); observer.onNext(addRef(s, refCountDisposable)); } createWindow(); m.setDisposable(source.subscribe( function (x) { for (var i = 0, len = q.length; i < len; i++) { q[i].onNext(x); } var c = n - count + 1; c >= 0 && c % skip === 0 && q.shift().onCompleted(); ++n % skip === 0 && createWindow(); }, function (e) { while (q.length > 0) { q.shift().onError(e); } observer.onError(e); }, function () { while (q.length > 0) { q.shift().onCompleted(); } observer.onCompleted(); } )); return refCountDisposable; }, source); }; function concatMap(source, selector, thisArg) { var selectorFunc = bindCallback(selector, thisArg, 3); return source.map(function (x, i) { var result = selectorFunc(x, i, source); isPromise(result) && (result = observableFromPromise(result)); (isArrayLike(result) || isIterable(result)) && (result = observableFrom(result)); return result; }).concatAll(); } /** * One of the Following: * Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence. * * @example * var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); }); * Or: * Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence. * * var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; }); * Or: * Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence. * * var res = source.concatMap(Rx.Observable.fromArray([1,2,3])); * @param {Function} selector A transform function to apply to each element or an observable sequence to project each element from the * source sequence onto which could be either an observable or Promise. * @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence. * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element. */ observableProto.selectConcat = observableProto.concatMap = function (selector, resultSelector, thisArg) { if (isFunction(selector) && isFunction(resultSelector)) { return this.concatMap(function (x, i) { var selectorResult = selector(x, i); isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult)); (isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult)); return selectorResult.map(function (y, i2) { return resultSelector(x, y, i, i2); }); }); } return isFunction(selector) ? concatMap(this, selector, thisArg) : concatMap(this, function () { return selector; }); }; /** * Projects each notification of an observable sequence to an observable sequence and concats the resulting observable sequences into one observable sequence. * @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element. * @param {Function} onError A transform function to apply when an error occurs in the source sequence. * @param {Function} onCompleted A transform function to apply when the end of the source sequence is reached. * @param {Any} [thisArg] An optional "this" to use to invoke each transform. * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence. */ observableProto.concatMapObserver = observableProto.selectConcatObserver = function(onNext, onError, onCompleted, thisArg) { var source = this, onNextFunc = bindCallback(onNext, thisArg, 2), onErrorFunc = bindCallback(onError, thisArg, 1), onCompletedFunc = bindCallback(onCompleted, thisArg, 0); return new AnonymousObservable(function (observer) { var index = 0; return source.subscribe( function (x) { var result; try { result = onNextFunc(x, index++); } catch (e) { observer.onError(e); return; } isPromise(result) && (result = observableFromPromise(result)); observer.onNext(result); }, function (err) { var result; try { result = onErrorFunc(err); } catch (e) { observer.onError(e); return; } isPromise(result) && (result = observableFromPromise(result)); observer.onNext(result); observer.onCompleted(); }, function () { var result; try { result = onCompletedFunc(); } catch (e) { observer.onError(e); return; } isPromise(result) && (result = observableFromPromise(result)); observer.onNext(result); observer.onCompleted(); }); }, this).concatAll(); }; /** * Returns the elements of the specified sequence or the specified value in a singleton sequence if the sequence is empty. * * var res = obs = xs.defaultIfEmpty(); * 2 - obs = xs.defaultIfEmpty(false); * * @memberOf Observable# * @param defaultValue The value to return if the sequence is empty. If not provided, this defaults to null. * @returns {Observable} An observable sequence that contains the specified default value if the source is empty; otherwise, the elements of the source itself. */ observableProto.defaultIfEmpty = function (defaultValue) { var source = this; defaultValue === undefined && (defaultValue = null); return new AnonymousObservable(function (observer) { var found = false; return source.subscribe(function (x) { found = true; observer.onNext(x); }, function (e) { observer.onError(e); }, function () { !found && observer.onNext(defaultValue); observer.onCompleted(); }); }, source); }; // Swap out for Array.findIndex function arrayIndexOfComparer(array, item, comparer) { for (var i = 0, len = array.length; i < len; i++) { if (comparer(array[i], item)) { return i; } } return -1; } function HashSet(comparer) { this.comparer = comparer; this.set = []; } HashSet.prototype.push = function(value) { var retValue = arrayIndexOfComparer(this.set, value, this.comparer) === -1; retValue && this.set.push(value); return retValue; }; /** * Returns an observable sequence that contains only distinct elements according to the keySelector and the comparer. * Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large. * * @example * var res = obs = xs.distinct(); * 2 - obs = xs.distinct(function (x) { return x.id; }); * 2 - obs = xs.distinct(function (x) { return x.id; }, function (a,b) { return a === b; }); * @param {Function} [keySelector] A function to compute the comparison key for each element. * @param {Function} [comparer] Used to compare items in the collection. * @returns {Observable} An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence. */ observableProto.distinct = function (keySelector, comparer) { var source = this; comparer || (comparer = defaultComparer); return new AnonymousObservable(function (o) { var hashSet = new HashSet(comparer); return source.subscribe(function (x) { var key = x; if (keySelector) { try { key = keySelector(x); } catch (e) { o.onError(e); return; } } hashSet.push(key) && o.onNext(x); }, function (e) { o.onError(e); }, function () { o.onCompleted(); }); }, this); }; /** * Groups the elements of an observable sequence according to a specified key selector function and comparer and selects the resulting elements by using a specified function. * * @example * var res = observable.groupBy(function (x) { return x.id; }); * 2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }); * 3 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function (x) { return x.toString(); }); * @param {Function} keySelector A function to extract the key for each element. * @param {Function} [elementSelector] A function to map each source element to an element in an observable group. * @returns {Observable} A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value. */ observableProto.groupBy = function (keySelector, elementSelector) { return this.groupByUntil(keySelector, elementSelector, observableNever); }; /** * Groups the elements of an observable sequence according to a specified key selector function. * A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same * key value as a reclaimed group occurs, the group will be reborn with a new lifetime request. * * @example * var res = observable.groupByUntil(function (x) { return x.id; }, null, function () { return Rx.Observable.never(); }); * 2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function () { return Rx.Observable.never(); }); * 3 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function () { return Rx.Observable.never(); }, function (x) { return x.toString(); }); * @param {Function} keySelector A function to extract the key for each element. * @param {Function} durationSelector A function to signal the expiration of a group. * @returns {Observable} * A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value. * If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encoutered. * */ observableProto.groupByUntil = function (keySelector, elementSelector, durationSelector) { var source = this; return new AnonymousObservable(function (o) { var map = new Map(), groupDisposable = new CompositeDisposable(), refCountDisposable = new RefCountDisposable(groupDisposable), handleError = function (e) { return function (item) { item.onError(e); }; }; groupDisposable.add( source.subscribe(function (x) { var key = tryCatch(keySelector)(x); if (key === errorObj) { map.forEach(handleError(key.e)); return o.onError(key.e); } var fireNewMapEntry = false, writer = map.get(key); if (writer === undefined) { writer = new Subject(); map.set(key, writer); fireNewMapEntry = true; } if (fireNewMapEntry) { var group = new GroupedObservable(key, writer, refCountDisposable), durationGroup = new GroupedObservable(key, writer); var duration = tryCatch(durationSelector)(durationGroup); if (duration === errorObj) { map.forEach(handleError(duration.e)); return o.onError(duration.e); } o.onNext(group); var md = new SingleAssignmentDisposable(); groupDisposable.add(md); md.setDisposable(duration.take(1).subscribe( noop, function (e) { map.forEach(handleError(e)); o.onError(e); }, function () { if (map['delete'](key)) { writer.onCompleted(); } groupDisposable.remove(md); })); } var element = x; if (isFunction(elementSelector)) { element = tryCatch(elementSelector)(x); if (element === errorObj) { map.forEach(handleError(element.e)); return o.onError(element.e); } } writer.onNext(element); }, function (e) { map.forEach(handleError(e)); o.onError(e); }, function () { map.forEach(function (item) { item.onCompleted(); }); o.onCompleted(); })); return refCountDisposable; }, source); }; var MapObservable = (function (__super__) { inherits(MapObservable, __super__); function MapObservable(source, selector, thisArg) { this.source = source; this.selector = bindCallback(selector, thisArg, 3); __super__.call(this); } function innerMap(selector, self) { return function (x, i, o) { return selector.call(this, self.selector(x, i, o), i, o); } } MapObservable.prototype.internalMap = function (selector, thisArg) { return new MapObservable(this.source, innerMap(selector, this), thisArg); }; MapObservable.prototype.subscribeCore = function (o) { return this.source.subscribe(new InnerObserver(o, this.selector, this)); }; function InnerObserver(o, selector, source) { this.o = o; this.selector = selector; this.source = source; this.i = 0; this.isStopped = false; } InnerObserver.prototype.onNext = function(x) { if (this.isStopped) { return; } var result = tryCatch(this.selector)(x, this.i++, this.source); if (result === errorObj) { return this.o.onError(result.e); } this.o.onNext(result); }; InnerObserver.prototype.onError = function (e) { if(!this.isStopped) { this.isStopped = true; this.o.onError(e); } }; InnerObserver.prototype.onCompleted = function () { if(!this.isStopped) { this.isStopped = true; this.o.onCompleted(); } }; InnerObserver.prototype.dispose = function() { this.isStopped = true; }; InnerObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); return true; } return false; }; return MapObservable; }(ObservableBase)); /** * Projects each element of an observable sequence into a new form by incorporating the element's index. * @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source. */ observableProto.map = observableProto.select = function (selector, thisArg) { var selectorFn = typeof selector === 'function' ? selector : function () { return selector; }; return this instanceof MapObservable ? this.internalMap(selectorFn, thisArg) : new MapObservable(this, selectorFn, thisArg); }; function plucker(args, len) { return function mapper(x) { var currentProp = x; for (var i = 0; i < len; i++) { var p = currentProp[args[i]]; if (typeof p !== 'undefined') { currentProp = p; } else { return undefined; } } return currentProp; } } /** * Retrieves the value of a specified nested property from all elements in * the Observable sequence. * @param {Arguments} arguments The nested properties to pluck. * @returns {Observable} Returns a new Observable sequence of property values. */ observableProto.pluck = function () { var len = arguments.length, args = new Array(len); if (len === 0) { throw new Error('List of properties cannot be empty.'); } for(var i = 0; i < len; i++) { args[i] = arguments[i]; } return this.map(plucker(args, len)); }; observableProto.flatMap = observableProto.selectMany = function(selector, resultSelector, thisArg) { return new FlatMapObservable(this, selector, resultSelector, thisArg).mergeAll(); }; // //Rx.Observable.prototype.flatMapWithMaxConcurrent = function(limit, selector, resultSelector, thisArg) { // return new FlatMapObservable(this, selector, resultSelector, thisArg).merge(limit); //}; // /** * Projects each notification of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence. * @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element. * @param {Function} onError A transform function to apply when an error occurs in the source sequence. * @param {Function} onCompleted A transform function to apply when the end of the source sequence is reached. * @param {Any} [thisArg] An optional "this" to use to invoke each transform. * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence. */ observableProto.flatMapObserver = observableProto.selectManyObserver = function (onNext, onError, onCompleted, thisArg) { var source = this; return new AnonymousObservable(function (observer) { var index = 0; return source.subscribe( function (x) { var result; try { result = onNext.call(thisArg, x, index++); } catch (e) { observer.onError(e); return; } isPromise(result) && (result = observableFromPromise(result)); observer.onNext(result); }, function (err) { var result; try { result = onError.call(thisArg, err); } catch (e) { observer.onError(e); return; } isPromise(result) && (result = observableFromPromise(result)); observer.onNext(result); observer.onCompleted(); }, function () { var result; try { result = onCompleted.call(thisArg); } catch (e) { observer.onError(e); return; } isPromise(result) && (result = observableFromPromise(result)); observer.onNext(result); observer.onCompleted(); }); }, source).mergeAll(); }; Rx.Observable.prototype.flatMapLatest = function(selector, resultSelector, thisArg) { return new FlatMapObservable(this, selector, resultSelector, thisArg).switchLatest(); }; var SkipObservable = (function(__super__) { inherits(SkipObservable, __super__); function SkipObservable(source, count) { this.source = source; this.skipCount = count; __super__.call(this); } SkipObservable.prototype.subscribeCore = function (o) { return this.source.subscribe(new InnerObserver(o, this.skipCount)); }; function InnerObserver(o, c) { this.c = c; this.r = c; this.o = o; this.isStopped = false; } InnerObserver.prototype.onNext = function (x) { if (this.isStopped) { return; } if (this.r <= 0) { this.o.onNext(x); } else { this.r--; } }; InnerObserver.prototype.onError = function(e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); } }; InnerObserver.prototype.onCompleted = function() { if (!this.isStopped) { this.isStopped = true; this.o.onCompleted(); } }; InnerObserver.prototype.dispose = function() { this.isStopped = true; }; InnerObserver.prototype.fail = function(e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); return true; } return false; }; return SkipObservable; }(ObservableBase)); /** * Bypasses a specified number of elements in an observable sequence and then returns the remaining elements. * @param {Number} count The number of elements to skip before returning the remaining elements. * @returns {Observable} An observable sequence that contains the elements that occur after the specified index in the input sequence. */ observableProto.skip = function (count) { if (count < 0) { throw new ArgumentOutOfRangeError(); } return new SkipObservable(this, count); }; /** * Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements. * The element's index is used in the logic of the predicate function. * * var res = source.skipWhile(function (value) { return value < 10; }); * var res = source.skipWhile(function (value, index) { return value < 10 || index < 10; }); * @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate. */ observableProto.skipWhile = function (predicate, thisArg) { var source = this, callback = bindCallback(predicate, thisArg, 3); return new AnonymousObservable(function (o) { var i = 0, running = false; return source.subscribe(function (x) { if (!running) { try { running = !callback(x, i++, source); } catch (e) { o.onError(e); return; } } running && o.onNext(x); }, function (e) { o.onError(e); }, function () { o.onCompleted(); }); }, source); }; /** * Returns a specified number of contiguous elements from the start of an observable sequence, using the specified scheduler for the edge case of take(0). * * var res = source.take(5); * var res = source.take(0, Rx.Scheduler.timeout); * @param {Number} count The number of elements to return. * @param {Scheduler} [scheduler] Scheduler used to produce an OnCompleted message in case <paramref name="count count</paramref> is set to 0. * @returns {Observable} An observable sequence that contains the specified number of elements from the start of the input sequence. */ observableProto.take = function (count, scheduler) { if (count < 0) { throw new ArgumentOutOfRangeError(); } if (count === 0) { return observableEmpty(scheduler); } var source = this; return new AnonymousObservable(function (o) { var remaining = count; return source.subscribe(function (x) { if (remaining-- > 0) { o.onNext(x); remaining <= 0 && o.onCompleted(); } }, function (e) { o.onError(e); }, function () { o.onCompleted(); }); }, source); }; /** * Returns elements from an observable sequence as long as a specified condition is true. * The element's index is used in the logic of the predicate function. * @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes. */ observableProto.takeWhile = function (predicate, thisArg) { var source = this, callback = bindCallback(predicate, thisArg, 3); return new AnonymousObservable(function (o) { var i = 0, running = true; return source.subscribe(function (x) { if (running) { try { running = callback(x, i++, source); } catch (e) { o.onError(e); return; } if (running) { o.onNext(x); } else { o.onCompleted(); } } }, function (e) { o.onError(e); }, function () { o.onCompleted(); }); }, source); }; var FilterObservable = (function (__super__) { inherits(FilterObservable, __super__); function FilterObservable(source, predicate, thisArg) { this.source = source; this.predicate = bindCallback(predicate, thisArg, 3); __super__.call(this); } FilterObservable.prototype.subscribeCore = function (o) { return this.source.subscribe(new InnerObserver(o, this.predicate, this)); }; function innerPredicate(predicate, self) { return function(x, i, o) { return self.predicate(x, i, o) && predicate.call(this, x, i, o); } } FilterObservable.prototype.internalFilter = function(predicate, thisArg) { return new FilterObservable(this.source, innerPredicate(predicate, this), thisArg); }; function InnerObserver(o, predicate, source) { this.o = o; this.predicate = predicate; this.source = source; this.i = 0; this.isStopped = false; } InnerObserver.prototype.onNext = function(x) { if (this.isStopped) { return; } var shouldYield = tryCatch(this.predicate)(x, this.i++, this.source); if (shouldYield === errorObj) { return this.o.onError(shouldYield.e); } shouldYield && this.o.onNext(x); }; InnerObserver.prototype.onError = function (e) { if(!this.isStopped) { this.isStopped = true; this.o.onError(e); } }; InnerObserver.prototype.onCompleted = function () { if(!this.isStopped) { this.isStopped = true; this.o.onCompleted(); } }; InnerObserver.prototype.dispose = function() { this.isStopped = true; }; InnerObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); return true; } return false; }; return FilterObservable; }(ObservableBase)); /** * Filters the elements of an observable sequence based on a predicate by incorporating the element's index. * @param {Function} predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} An observable sequence that contains elements from the input sequence that satisfy the condition. */ observableProto.filter = observableProto.where = function (predicate, thisArg) { return this instanceof FilterObservable ? this.internalFilter(predicate, thisArg) : new FilterObservable(this, predicate, thisArg); }; function extremaBy(source, keySelector, comparer) { return new AnonymousObservable(function (o) { var hasValue = false, lastKey = null, list = []; return source.subscribe(function (x) { var comparison, key; try { key = keySelector(x); } catch (ex) { o.onError(ex); return; } comparison = 0; if (!hasValue) { hasValue = true; lastKey = key; } else { try { comparison = comparer(key, lastKey); } catch (ex1) { o.onError(ex1); return; } } if (comparison > 0) { lastKey = key; list = []; } if (comparison >= 0) { list.push(x); } }, function (e) { o.onError(e); }, function () { o.onNext(list); o.onCompleted(); }); }, source); } function firstOnly(x) { if (x.length === 0) { throw new EmptyError(); } return x[0]; } var ReduceObservable = (function(__super__) { inherits(ReduceObservable, __super__); function ReduceObservable(source, acc, hasSeed, seed) { this.source = source; this.acc = acc; this.hasSeed = hasSeed; this.seed = seed; __super__.call(this); } ReduceObservable.prototype.subscribeCore = function(observer) { return this.source.subscribe(new InnerObserver(observer,this)); }; function InnerObserver(o, parent) { this.o = o; this.acc = parent.acc; this.hasSeed = parent.hasSeed; this.seed = parent.seed; this.hasAccumulation = false; this.result = null; this.hasValue = false; this.isStopped = false; } InnerObserver.prototype.onNext = function (x) { if (this.isStopped) { return; } !this.hasValue && (this.hasValue = true); if (this.hasAccumulation) { this.result = tryCatch(this.acc)(this.result, x); } else { this.result = this.hasSeed ? tryCatch(this.acc)(this.seed, x) : x; this.hasAccumulation = true; } if (this.result === errorObj) { this.o.onError(this.result.e); } }; InnerObserver.prototype.onError = function (e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); } }; InnerObserver.prototype.onCompleted = function () { if (!this.isStopped) { this.isStopped = true; this.hasValue && this.o.onNext(this.result); !this.hasValue && this.hasSeed && this.o.onNext(this.seed); !this.hasValue && !this.hasSeed && this.o.onError(new EmptyError()); this.o.onCompleted(); } }; InnerObserver.prototype.dispose = function () { this.isStopped = true; }; InnerObserver.prototype.fail = function(e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); return true; } return false; }; return ReduceObservable; }(ObservableBase)); /** * Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value. * For aggregation behavior with incremental intermediate results, see Observable.scan. * @param {Function} accumulator An accumulator function to be invoked on each element. * @param {Any} [seed] The initial accumulator value. * @returns {Observable} An observable sequence containing a single element with the final accumulator value. */ observableProto.reduce = function (accumulator) { var hasSeed = false; if (arguments.length === 2) { hasSeed = true; var seed = arguments[1]; } return new ReduceObservable(this, accumulator, hasSeed, seed); }; var SomeObserver = (function (__super__) { inherits(SomeObserver, __super__); function SomeObserver(o, fn, s) { this._o = o; this._fn = fn; this._s = s; this._i = 0; __super__.call(this); } SomeObserver.prototype.next = function (x) { var result = tryCatch(this._fn)(x, this._i++, this._s); if (result === errorObj) { return this._o.onError(result.e); } if (Boolean(result)) { this._o.onNext(true); this._o.onCompleted(); } }; SomeObserver.prototype.error = function (e) { this._o.onError(e); }; SomeObserver.prototype.completed = function () { this._o.onNext(false); this._o.onCompleted(); }; return SomeObserver; }(AbstractObserver)); /** * Determines whether any element of an observable sequence satisfies a condition if present, else if any items are in the sequence. * @param {Function} [predicate] A function to test each element for a condition. * @returns {Observable} An observable sequence containing a single element determining whether any elements in the source sequence pass the test in the specified predicate if given, else if any items are in the sequence. */ observableProto.some = function (predicate, thisArg) { var source = this, fn = bindCallback(predicate, thisArg, 3); return new AnonymousObservable(function (o) { return source.subscribe(new SomeObserver(o, fn, source)); }); }; var IsEmptyObserver = (function(__super__) { inherits(IsEmptyObserver, __super__); function IsEmptyObserver(o) { this._o = o; __super__.call(this); } IsEmptyObserver.prototype.next = function () { this._o.onNext(false); this._o.onCompleted(); }; IsEmptyObserver.prototype.error = function (e) { this._o.onError(e); }; IsEmptyObserver.prototype.completed = function () { this._o.onNext(true); this._o.onCompleted(); }; return IsEmptyObserver; }(AbstractObserver)); /** * Determines whether an observable sequence is empty. * @returns {Observable} An observable sequence containing a single element determining whether the source sequence is empty. */ observableProto.isEmpty = function () { var source = this; return new AnonymousObservable(function (o) { return source.subscribe(new IsEmptyObserver(o)); }, source); }; var EveryObserver = (function (__super__) { inherits(EveryObserver, __super__); function EveryObserver(o, fn, s) { this._o = o; this._fn = fn; this._s = s; this._i = 0; __super__.call(this); } EveryObserver.prototype.next = function (x) { var result = tryCatch(this._fn)(x, this._i++, this._s); if (result === errorObj) { return this._o.onError(result.e); } if (!Boolean(result)) { this._o.onNext(false); this._o.onCompleted(); } }; EveryObserver.prototype.error = function (e) { this._o.onError(e); }; EveryObserver.prototype.completed = function () { this._o.onNext(true); this._o.onCompleted(); }; return EveryObserver; }(AbstractObserver)); /** * Determines whether all elements of an observable sequence satisfy a condition. * @param {Function} [predicate] A function to test each element for a condition. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} An observable sequence containing a single element determining whether all elements in the source sequence pass the test in the specified predicate. */ observableProto.every = function (predicate, thisArg) { var source = this, fn = bindCallback(predicate, thisArg, 3); return new AnonymousObservable(function (o) { return source.subscribe(new EveryObserver(o, fn, source)); }, this); }; /** * Determines whether an observable sequence includes a specified element with an optional equality comparer. * @param searchElement The value to locate in the source sequence. * @param {Number} [fromIndex] An equality comparer to compare elements. * @returns {Observable} An observable sequence containing a single element determining whether the source sequence includes an element that has the specified value from the given index. */ observableProto.includes = function (searchElement, fromIndex) { var source = this; function comparer(a, b) { return (a === 0 && b === 0) || (a === b || (isNaN(a) && isNaN(b))); } return new AnonymousObservable(function (o) { var i = 0, n = +fromIndex || 0; Math.abs(n) === Infinity && (n = 0); if (n < 0) { o.onNext(false); o.onCompleted(); return disposableEmpty; } return source.subscribe( function (x) { if (i++ >= n && comparer(x, searchElement)) { o.onNext(true); o.onCompleted(); } }, function (e) { o.onError(e); }, function () { o.onNext(false); o.onCompleted(); }); }, this); }; /** * @deprecated use #includes instead. */ observableProto.contains = function (searchElement, fromIndex) { //deprecate('contains', 'includes'); observableProto.includes(searchElement, fromIndex); }; /** * Returns an observable sequence containing a value that represents how many elements in the specified observable sequence satisfy a condition if provided, else the count of items. * @example * res = source.count(); * res = source.count(function (x) { return x > 3; }); * @param {Function} [predicate]A function to test each element for a condition. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} An observable sequence containing a single element with a number that represents how many elements in the input sequence satisfy the condition in the predicate function if provided, else the count of items in the sequence. */ observableProto.count = function (predicate, thisArg) { return predicate ? this.filter(predicate, thisArg).count() : this.reduce(function (count) { return count + 1; }, 0); }; /** * Returns the first index at which a given element can be found in the observable sequence, or -1 if it is not present. * @param {Any} searchElement Element to locate in the array. * @param {Number} [fromIndex] The index to start the search. If not specified, defaults to 0. * @returns {Observable} And observable sequence containing the first index at which a given element can be found in the observable sequence, or -1 if it is not present. */ observableProto.indexOf = function(searchElement, fromIndex) { var source = this; return new AnonymousObservable(function (o) { var i = 0, n = +fromIndex || 0; Math.abs(n) === Infinity && (n = 0); if (n < 0) { o.onNext(-1); o.onCompleted(); return disposableEmpty; } return source.subscribe( function (x) { if (i >= n && x === searchElement) { o.onNext(i); o.onCompleted(); } i++; }, function (e) { o.onError(e); }, function () { o.onNext(-1); o.onCompleted(); }); }, source); }; /** * Computes the sum of a sequence of values that are obtained by invoking an optional transform function on each element of the input sequence, else if not specified computes the sum on each item in the sequence. * @param {Function} [selector] A transform function to apply to each element. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} An observable sequence containing a single element with the sum of the values in the source sequence. */ observableProto.sum = function (keySelector, thisArg) { return keySelector && isFunction(keySelector) ? this.map(keySelector, thisArg).sum() : this.reduce(function (prev, curr) { return prev + curr; }, 0); }; /** * Returns the elements in an observable sequence with the minimum key value according to the specified comparer. * @example * var res = source.minBy(function (x) { return x.value; }); * var res = source.minBy(function (x) { return x.value; }, function (x, y) { return x - y; }); * @param {Function} keySelector Key selector function. * @param {Function} [comparer] Comparer used to compare key values. * @returns {Observable} An observable sequence containing a list of zero or more elements that have a minimum key value. */ observableProto.minBy = function (keySelector, comparer) { comparer || (comparer = defaultSubComparer); return extremaBy(this, keySelector, function (x, y) { return comparer(x, y) * -1; }); }; /** * Returns the minimum element in an observable sequence according to the optional comparer else a default greater than less than check. * @example * var res = source.min(); * var res = source.min(function (x, y) { return x.value - y.value; }); * @param {Function} [comparer] Comparer used to compare elements. * @returns {Observable} An observable sequence containing a single element with the minimum element in the source sequence. */ observableProto.min = function (comparer) { return this.minBy(identity, comparer).map(function (x) { return firstOnly(x); }); }; /** * Returns the elements in an observable sequence with the maximum key value according to the specified comparer. * @example * var res = source.maxBy(function (x) { return x.value; }); * var res = source.maxBy(function (x) { return x.value; }, function (x, y) { return x - y;; }); * @param {Function} keySelector Key selector function. * @param {Function} [comparer] Comparer used to compare key values. * @returns {Observable} An observable sequence containing a list of zero or more elements that have a maximum key value. */ observableProto.maxBy = function (keySelector, comparer) { comparer || (comparer = defaultSubComparer); return extremaBy(this, keySelector, comparer); }; /** * Returns the maximum value in an observable sequence according to the specified comparer. * @example * var res = source.max(); * var res = source.max(function (x, y) { return x.value - y.value; }); * @param {Function} [comparer] Comparer used to compare elements. * @returns {Observable} An observable sequence containing a single element with the maximum element in the source sequence. */ observableProto.max = function (comparer) { return this.maxBy(identity, comparer).map(function (x) { return firstOnly(x); }); }; var AverageObserver = (function(__super__) { inherits(AverageObserver, __super__); function AverageObserver(o, fn, s) { this._o = o; this._fn = fn; this._s = s; this._c = 0; this._t = 0; __super__.call(this); } AverageObserver.prototype.next = function (x) { if(this._fn) { var r = tryCatch(this._fn)(x, this._c++, this._s); if (r === errorObj) { return this._o.onError(r.e); } this._t += r; } else { this._c++; this._t += x; } }; AverageObserver.prototype.error = function (e) { this._o.onError(e); }; AverageObserver.prototype.completed = function () { if (this._c === 0) { return this._o.onError(new EmptyError()); } this._o.onNext(this._t / this._c); this._o.onCompleted(); }; return AverageObserver; }(AbstractObserver)); /** * Computes the average of an observable sequence of values that are in the sequence or obtained by invoking a transform function on each element of the input sequence if present. * @param {Function} [selector] A transform function to apply to each element. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} An observable sequence containing a single element with the average of the sequence of values. */ observableProto.average = function (keySelector, thisArg) { var source = this, fn; if (isFunction(keySelector)) { fn = bindCallback(keySelector, thisArg, 3); } return new AnonymousObservable(function (o) { return source.subscribe(new AverageObserver(o, fn, source)); }, source); }; /** * Determines whether two sequences are equal by comparing the elements pairwise using a specified equality comparer. * * @example * var res = res = source.sequenceEqual([1,2,3]); * var res = res = source.sequenceEqual([{ value: 42 }], function (x, y) { return x.value === y.value; }); * 3 - res = source.sequenceEqual(Rx.Observable.returnValue(42)); * 4 - res = source.sequenceEqual(Rx.Observable.returnValue({ value: 42 }), function (x, y) { return x.value === y.value; }); * @param {Observable} second Second observable sequence or array to compare. * @param {Function} [comparer] Comparer used to compare elements of both sequences. * @returns {Observable} An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the specified equality comparer. */ observableProto.sequenceEqual = function (second, comparer) { var first = this; comparer || (comparer = defaultComparer); return new AnonymousObservable(function (o) { var donel = false, doner = false, ql = [], qr = []; var subscription1 = first.subscribe(function (x) { var equal, v; if (qr.length > 0) { v = qr.shift(); try { equal = comparer(v, x); } catch (e) { o.onError(e); return; } if (!equal) { o.onNext(false); o.onCompleted(); } } else if (doner) { o.onNext(false); o.onCompleted(); } else { ql.push(x); } }, function(e) { o.onError(e); }, function () { donel = true; if (ql.length === 0) { if (qr.length > 0) { o.onNext(false); o.onCompleted(); } else if (doner) { o.onNext(true); o.onCompleted(); } } }); (isArrayLike(second) || isIterable(second)) && (second = observableFrom(second)); isPromise(second) && (second = observableFromPromise(second)); var subscription2 = second.subscribe(function (x) { var equal; if (ql.length > 0) { var v = ql.shift(); try { equal = comparer(v, x); } catch (exception) { o.onError(exception); return; } if (!equal) { o.onNext(false); o.onCompleted(); } } else if (donel) { o.onNext(false); o.onCompleted(); } else { qr.push(x); } }, function(e) { o.onError(e); }, function () { doner = true; if (qr.length === 0) { if (ql.length > 0) { o.onNext(false); o.onCompleted(); } else if (donel) { o.onNext(true); o.onCompleted(); } } }); return new CompositeDisposable(subscription1, subscription2); }, first); }; /** * Returns the element at a specified index in a sequence or default value if not found. * @param {Number} index The zero-based index of the element to retrieve. * @param {Any} [defaultValue] The default value to use if elementAt does not find a value. * @returns {Observable} An observable sequence that produces the element at the specified position in the source sequence. */ observableProto.elementAt = function (index, defaultValue) { if (index < 0) { throw new ArgumentOutOfRangeError(); } var source = this; return new AnonymousObservable(function (o) { var i = index; return source.subscribe( function (x) { if (i-- === 0) { o.onNext(x); o.onCompleted(); } }, function (e) { o.onError(e); }, function () { if (defaultValue === undefined) { o.onError(new ArgumentOutOfRangeError()); } else { o.onNext(defaultValue); o.onCompleted(); } }); }, source); }; /** * Returns the only element of an observable sequence that satisfies the condition in the optional predicate, and reports an exception if there is not exactly one element in the observable sequence. * @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence. * @param {Any} [thisArg] Object to use as `this` when executing the predicate. * @returns {Observable} Sequence containing the single element in the observable sequence that satisfies the condition in the predicate. */ observableProto.single = function (predicate, thisArg) { if (isFunction(predicate)) { return this.filter(predicate, thisArg).single(); } var source = this; return new AnonymousObservable(function (o) { var value, seenValue = false; return source.subscribe(function (x) { if (seenValue) { o.onError(new Error('Sequence contains more than one element')); } else { value = x; seenValue = true; } }, function (e) { o.onError(e); }, function () { o.onNext(value); o.onCompleted(); }); }, source); }; var FirstObserver = (function(__super__) { inherits(FirstObserver, __super__); function FirstObserver(o, obj, s) { this._o = o; this._obj = obj; this._s = s; this._i = 0; __super__.call(this); } FirstObserver.prototype.next = function (x) { if (this._obj.predicate) { var res = tryCatch(this._obj.predicate)(x, this._i++, this._s); if (res === errorObj) { return this._o.onError(res.e); } if (Boolean(res)) { this._o.onNext(x); this._o.onCompleted(); } } else if (!this._obj.predicate) { this._o.onNext(x); this._o.onCompleted(); } }; FirstObserver.prototype.error = function (e) { this._o.onError(e); }; FirstObserver.prototype.completed = function () { if (this._obj.defaultValue === undefined) { this._o.onError(new EmptyError()); } else { this._o.onNext(this._obj.defaultValue); this._o.onCompleted(); } }; return FirstObserver; }(AbstractObserver)); /** * Returns the first element of an observable sequence that satisfies the condition in the predicate if present else the first item in the sequence. * @returns {Observable} Sequence containing the first element in the observable sequence that satisfies the condition in the predicate if provided, else the first item in the sequence. */ observableProto.first = function () { var obj = {}, source = this; if (typeof arguments[0] === 'object') { obj = arguments[0]; } else { obj = { predicate: arguments[0], thisArg: arguments[1], defaultValue: arguments[2] }; } if (isFunction (obj.predicate)) { var fn = obj.predicate; obj.predicate = bindCallback(fn, obj.thisArg, 3); } return new AnonymousObservable(function (o) { return source.subscribe(new FirstObserver(o, obj, source)); }, source); }; /** * Returns the last element of an observable sequence that satisfies the condition in the predicate if specified, else the last element. * @returns {Observable} Sequence containing the last element in the observable sequence that satisfies the condition in the predicate. */ observableProto.last = function () { var obj = {}, source = this; if (typeof arguments[0] === 'object') { obj = arguments[0]; } else { obj = { predicate: arguments[0], thisArg: arguments[1], defaultValue: arguments[2] }; } if (isFunction (obj.predicate)) { var fn = obj.predicate; obj.predicate = bindCallback(fn, obj.thisArg, 3); } return new AnonymousObservable(function (o) { var value, seenValue = false, i = 0; return source.subscribe( function (x) { if (obj.predicate) { var res = tryCatch(obj.predicate)(x, i++, source); if (res === errorObj) { return o.onError(res.e); } if (res) { seenValue = true; value = x; } } else if (!obj.predicate) { seenValue = true; value = x; } }, function (e) { o.onError(e); }, function () { if (seenValue) { o.onNext(value); o.onCompleted(); } else if (obj.defaultValue === undefined) { o.onError(new EmptyError()); } else { o.onNext(obj.defaultValue); o.onCompleted(); } }); }, source); }; function findValue (source, predicate, thisArg, yieldIndex) { var callback = bindCallback(predicate, thisArg, 3); return new AnonymousObservable(function (o) { var i = 0; return source.subscribe(function (x) { var shouldRun; try { shouldRun = callback(x, i, source); } catch (e) { o.onError(e); return; } if (shouldRun) { o.onNext(yieldIndex ? i : x); o.onCompleted(); } else { i++; } }, function (e) { o.onError(e); }, function () { o.onNext(yieldIndex ? -1 : undefined); o.onCompleted(); }); }, source); } /** * Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire Observable sequence. * @param {Function} predicate The predicate that defines the conditions of the element to search for. * @param {Any} [thisArg] Object to use as `this` when executing the predicate. * @returns {Observable} An Observable sequence with the first element that matches the conditions defined by the specified predicate, if found; otherwise, undefined. */ observableProto.find = function (predicate, thisArg) { return findValue(this, predicate, thisArg, false); }; /** * Searches for an element that matches the conditions defined by the specified predicate, and returns * an Observable sequence with the zero-based index of the first occurrence within the entire Observable sequence. * @param {Function} predicate The predicate that defines the conditions of the element to search for. * @param {Any} [thisArg] Object to use as `this` when executing the predicate. * @returns {Observable} An Observable sequence with the zero-based index of the first occurrence of an element that matches the conditions defined by match, if found; otherwise, –1. */ observableProto.findIndex = function (predicate, thisArg) { return findValue(this, predicate, thisArg, true); }; /** * Converts the observable sequence to a Set if it exists. * @returns {Observable} An observable sequence with a single value of a Set containing the values from the observable sequence. */ observableProto.toSet = function () { if (typeof root.Set === 'undefined') { throw new TypeError(); } var source = this; return new AnonymousObservable(function (o) { var s = new root.Set(); return source.subscribe( function (x) { s.add(x); }, function (e) { o.onError(e); }, function () { o.onNext(s); o.onCompleted(); }); }, source); }; /** * Converts the observable sequence to a Map if it exists. * @param {Function} keySelector A function which produces the key for the Map. * @param {Function} [elementSelector] An optional function which produces the element for the Map. If not present, defaults to the value from the observable sequence. * @returns {Observable} An observable sequence with a single value of a Map containing the values from the observable sequence. */ observableProto.toMap = function (keySelector, elementSelector) { if (typeof root.Map === 'undefined') { throw new TypeError(); } var source = this; return new AnonymousObservable(function (o) { var m = new root.Map(); return source.subscribe( function (x) { var key; try { key = keySelector(x); } catch (e) { o.onError(e); return; } var element = x; if (elementSelector) { try { element = elementSelector(x); } catch (e) { o.onError(e); return; } } m.set(key, element); }, function (e) { o.onError(e); }, function () { o.onNext(m); o.onCompleted(); }); }, source); }; Observable.wrap = function (fn) { createObservable.__generatorFunction__ = fn; return createObservable; function createObservable() { return Observable.spawn.call(this, fn.apply(this, arguments)); } }; var spawn = Observable.spawn = function () { var gen = arguments[0], self = this, args = []; for (var i = 1, len = arguments.length; i < len; i++) { args.push(arguments[i]); } return new AnonymousObservable(function (o) { var g = new CompositeDisposable(); if (isFunction(gen)) { gen = gen.apply(self, args); } if (!gen || !isFunction(gen.next)) { o.onNext(gen); return o.onCompleted(); } processGenerator(); function processGenerator(res) { var ret = tryCatch(gen.next).call(gen, res); if (ret === errorObj) { return o.onError(ret.e); } next(ret); } function onError(err) { var ret = tryCatch(gen.next).call(gen, err); if (ret === errorObj) { return o.onError(ret.e); } next(ret); } function next(ret) { if (ret.done) { o.onNext(ret.value); o.onCompleted(); return; } var value = toObservable.call(self, ret.value); if (Observable.isObservable(value)) { g.add(value.subscribe(processGenerator, onError)); } else { onError(new TypeError('type not supported')); } } return g; }); } function toObservable(obj) { if (!obj) { return obj; } if (Observable.isObservable(obj)) { return obj; } if (isPromise(obj)) { return Observable.fromPromise(obj); } if (isGeneratorFunction(obj) || isGenerator(obj)) { return spawn.call(this, obj); } if (isFunction(obj)) { return thunkToObservable.call(this, obj); } if (isArrayLike(obj) || isIterable(obj)) { return arrayToObservable.call(this, obj); } if (isObject(obj)) {return objectToObservable.call(this, obj);} return obj; } function arrayToObservable (obj) { return Observable.from(obj) .flatMap(toObservable) .toArray(); } function objectToObservable (obj) { var results = new obj.constructor(), keys = Object.keys(obj), observables = []; for (var i = 0, len = keys.length; i < len; i++) { var key = keys[i]; var observable = toObservable.call(this, obj[key]); if(observable && Observable.isObservable(observable)) { defer(observable, key); } else { results[key] = obj[key]; } } return Observable.forkJoin.apply(Observable, observables).map(function() { return results; }); function defer (observable, key) { results[key] = undefined; observables.push(observable.map(function (next) { results[key] = next; })); } } function thunkToObservable(fn) { var self = this; return new AnonymousObservable(function (o) { fn.call(self, function () { var err = arguments[0], res = arguments[1]; if (err) { return o.onError(err); } if (arguments.length > 2) { var args = []; for (var i = 1, len = arguments.length; i < len; i++) { args.push(arguments[i]); } res = args; } o.onNext(res); o.onCompleted(); }); }); } function isGenerator(obj) { return isFunction (obj.next) && isFunction (obj.throw); } function isGeneratorFunction(obj) { var ctor = obj.constructor; if (!ctor) { return false; } if (ctor.name === 'GeneratorFunction' || ctor.displayName === 'GeneratorFunction') { return true; } return isGenerator(ctor.prototype); } /** * Invokes the specified function asynchronously on the specified scheduler, surfacing the result through an observable sequence. * * @example * var res = Rx.Observable.start(function () { console.log('hello'); }); * var res = Rx.Observable.start(function () { console.log('hello'); }, Rx.Scheduler.timeout); * var res = Rx.Observable.start(function () { this.log('hello'); }, Rx.Scheduler.timeout, console); * * @param {Function} func Function to run asynchronously. * @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout. * @param [context] The context for the func parameter to be executed. If not specified, defaults to undefined. * @returns {Observable} An observable sequence exposing the function's result value, or an exception. * * Remarks * * The function is called immediately, not during the subscription of the resulting sequence. * * Multiple subscriptions to the resulting sequence can observe the function's result. */ Observable.start = function (func, context, scheduler) { return observableToAsync(func, context, scheduler)(); }; /** * Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler. * @param {Function} function Function to convert to an asynchronous function. * @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout. * @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined. * @returns {Function} Asynchronous function. */ var observableToAsync = Observable.toAsync = function (func, context, scheduler) { isScheduler(scheduler) || (scheduler = timeoutScheduler); return function () { var args = arguments, subject = new AsyncSubject(); scheduler.schedule(function () { var result; try { result = func.apply(context, args); } catch (e) { subject.onError(e); return; } subject.onNext(result); subject.onCompleted(); }); return subject.asObservable(); }; }; function createCbObservable(fn, ctx, selector, args) { var o = new AsyncSubject(); args.push(createCbHandler(o, ctx, selector)); fn.apply(ctx, args); return o.asObservable(); } function createCbHandler(o, ctx, selector) { return function handler () { var len = arguments.length, results = new Array(len); for(var i = 0; i < len; i++) { results[i] = arguments[i]; } if (isFunction(selector)) { results = tryCatch(selector).apply(ctx, results); if (results === errorObj) { return o.onError(results.e); } o.onNext(results); } else { if (results.length <= 1) { o.onNext(results[0]); } else { o.onNext(results); } } o.onCompleted(); }; } /** * Converts a callback function to an observable sequence. * * @param {Function} fn Function with a callback as the last parameter to convert to an Observable sequence. * @param {Mixed} [ctx] The context for the func parameter to be executed. If not specified, defaults to undefined. * @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next. * @returns {Function} A function, when executed with the required parameters minus the callback, produces an Observable sequence with a single value of the arguments to the callback as an array. */ Observable.fromCallback = function (fn, ctx, selector) { return function () { typeof ctx === 'undefined' && (ctx = this); var len = arguments.length, args = new Array(len) for(var i = 0; i < len; i++) { args[i] = arguments[i]; } return createCbObservable(fn, ctx, selector, args); }; }; function createNodeObservable(fn, ctx, selector, args) { var o = new AsyncSubject(); args.push(createNodeHandler(o, ctx, selector)); fn.apply(ctx, args); return o.asObservable(); } function createNodeHandler(o, ctx, selector) { return function handler () { var err = arguments[0]; if (err) { return o.onError(err); } var len = arguments.length, results = []; for(var i = 1; i < len; i++) { results[i - 1] = arguments[i]; } if (isFunction(selector)) { var results = tryCatch(selector).apply(ctx, results); if (results === errorObj) { return o.onError(results.e); } o.onNext(results); } else { if (results.length <= 1) { o.onNext(results[0]); } else { o.onNext(results); } } o.onCompleted(); }; } /** * Converts a Node.js callback style function to an observable sequence. This must be in function (err, ...) format. * @param {Function} fn The function to call * @param {Mixed} [ctx] The context for the func parameter to be executed. If not specified, defaults to undefined. * @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next. * @returns {Function} An async function which when applied, returns an observable sequence with the callback arguments as an array. */ Observable.fromNodeCallback = function (fn, ctx, selector) { return function () { typeof ctx === 'undefined' && (ctx = this); var len = arguments.length, args = new Array(len); for(var i = 0; i < len; i++) { args[i] = arguments[i]; } return createNodeObservable(fn, ctx, selector, args); }; }; function ListenDisposable(e, n, fn) { this._e = e; this._n = n; this._fn = fn; this._e.addEventListener(this._n, this._fn, false); this.isDisposed = false; } ListenDisposable.prototype.dispose = function () { if (!this.isDisposed) { this._e.removeEventListener(this._n, this._fn, false); this.isDisposed = true; } }; function createEventListener (el, eventName, handler) { var disposables = new CompositeDisposable(); // Asume NodeList or HTMLCollection var elemToString = Object.prototype.toString.call(el); if (elemToString === '[object NodeList]' || elemToString === '[object HTMLCollection]') { for (var i = 0, len = el.length; i < len; i++) { disposables.add(createEventListener(el.item(i), eventName, handler)); } } else if (el) { disposables.add(new ListenDisposable(el, eventName, handler)); } return disposables; } /** * Configuration option to determine whether to use native events only */ Rx.config.useNativeEvents = false; function eventHandler(o, selector) { return function handler () { var results = arguments[0]; if (isFunction(selector)) { results = tryCatch(selector).apply(null, arguments); if (results === errorObj) { return o.onError(results.e); } } o.onNext(results); }; } /** * Creates an observable sequence by adding an event listener to the matching DOMElement or each item in the NodeList. * @param {Object} element The DOMElement or NodeList to attach a listener. * @param {String} eventName The event name to attach the observable sequence. * @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next. * @returns {Observable} An observable sequence of events from the specified element and the specified event. */ Observable.fromEvent = function (element, eventName, selector) { // Node.js specific if (element.addListener) { return fromEventPattern( function (h) { element.addListener(eventName, h); }, function (h) { element.removeListener(eventName, h); }, selector); } // Use only if non-native events are allowed if (!Rx.config.useNativeEvents) { // Handles jq, Angular.js, Zepto, Marionette, Ember.js if (typeof element.on === 'function' && typeof element.off === 'function') { return fromEventPattern( function (h) { element.on(eventName, h); }, function (h) { element.off(eventName, h); }, selector); } } return new AnonymousObservable(function (o) { return createEventListener( element, eventName, eventHandler(o, selector)); }).publish().refCount(); }; /** * Creates an observable sequence from an event emitter via an addHandler/removeHandler pair. * @param {Function} addHandler The function to add a handler to the emitter. * @param {Function} [removeHandler] The optional function to remove a handler from an emitter. * @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next. * @param {Scheduler} [scheduler] A scheduler used to schedule the remove handler. * @returns {Observable} An observable sequence which wraps an event from an event emitter */ var fromEventPattern = Observable.fromEventPattern = function (addHandler, removeHandler, selector, scheduler) { isScheduler(scheduler) || (scheduler = immediateScheduler); return new AnonymousObservable(function (o) { function innerHandler () { var result = arguments[0]; if (isFunction(selector)) { result = tryCatch(selector).apply(null, arguments); if (result === errorObj) { return o.onError(result.e); } } o.onNext(result); } var returnValue = addHandler(innerHandler); return disposableCreate(function () { isFunction(removeHandler) && removeHandler(innerHandler, returnValue); }); }).publish().refCount(); }; /** * Invokes the asynchronous function, surfacing the result through an observable sequence. * @param {Function} functionAsync Asynchronous function which returns a Promise to run. * @returns {Observable} An observable sequence exposing the function's result value, or an exception. */ Observable.startAsync = function (functionAsync) { var promise; try { promise = functionAsync(); } catch (e) { return observableThrow(e); } return observableFromPromise(promise); } var PausableObservable = (function (__super__) { inherits(PausableObservable, __super__); function subscribe(observer) { var conn = this.source.publish(), subscription = conn.subscribe(observer), connection = disposableEmpty; var pausable = this.pauser.distinctUntilChanged().subscribe(function (b) { if (b) { connection = conn.connect(); } else { connection.dispose(); connection = disposableEmpty; } }); return new CompositeDisposable(subscription, connection, pausable); } function PausableObservable(source, pauser) { this.source = source; this.controller = new Subject(); if (pauser && pauser.subscribe) { this.pauser = this.controller.merge(pauser); } else { this.pauser = this.controller; } __super__.call(this, subscribe, source); } PausableObservable.prototype.pause = function () { this.controller.onNext(false); }; PausableObservable.prototype.resume = function () { this.controller.onNext(true); }; return PausableObservable; }(Observable)); /** * Pauses the underlying observable sequence based upon the observable sequence which yields true/false. * @example * var pauser = new Rx.Subject(); * var source = Rx.Observable.interval(100).pausable(pauser); * @param {Observable} pauser The observable sequence used to pause the underlying sequence. * @returns {Observable} The observable sequence which is paused based upon the pauser. */ observableProto.pausable = function (pauser) { return new PausableObservable(this, pauser); }; function combineLatestSource(source, subject, resultSelector) { return new AnonymousObservable(function (o) { var hasValue = [false, false], hasValueAll = false, isDone = false, values = new Array(2), err; function next(x, i) { values[i] = x; hasValue[i] = true; if (hasValueAll || (hasValueAll = hasValue.every(identity))) { if (err) { return o.onError(err); } var res = tryCatch(resultSelector).apply(null, values); if (res === errorObj) { return o.onError(res.e); } o.onNext(res); } isDone && values[1] && o.onCompleted(); } return new CompositeDisposable( source.subscribe( function (x) { next(x, 0); }, function (e) { if (values[1]) { o.onError(e); } else { err = e; } }, function () { isDone = true; values[1] && o.onCompleted(); }), subject.subscribe( function (x) { next(x, 1); }, function (e) { o.onError(e); }, function () { isDone = true; next(true, 1); }) ); }, source); } var PausableBufferedObservable = (function (__super__) { inherits(PausableBufferedObservable, __super__); function subscribe(o) { var q = [], previousShouldFire; function drainQueue() { while (q.length > 0) { o.onNext(q.shift()); } } var subscription = combineLatestSource( this.source, this.pauser.startWith(false).distinctUntilChanged(), function (data, shouldFire) { return { data: data, shouldFire: shouldFire }; }) .subscribe( function (results) { if (previousShouldFire !== undefined && results.shouldFire != previousShouldFire) { previousShouldFire = results.shouldFire; // change in shouldFire if (results.shouldFire) { drainQueue(); } } else { previousShouldFire = results.shouldFire; // new data if (results.shouldFire) { o.onNext(results.data); } else { q.push(results.data); } } }, function (err) { drainQueue(); o.onError(err); }, function () { drainQueue(); o.onCompleted(); } ); return subscription; } function PausableBufferedObservable(source, pauser) { this.source = source; this.controller = new Subject(); if (pauser && pauser.subscribe) { this.pauser = this.controller.merge(pauser); } else { this.pauser = this.controller; } __super__.call(this, subscribe, source); } PausableBufferedObservable.prototype.pause = function () { this.controller.onNext(false); }; PausableBufferedObservable.prototype.resume = function () { this.controller.onNext(true); }; return PausableBufferedObservable; }(Observable)); /** * Pauses the underlying observable sequence based upon the observable sequence which yields true/false, * and yields the values that were buffered while paused. * @example * var pauser = new Rx.Subject(); * var source = Rx.Observable.interval(100).pausableBuffered(pauser); * @param {Observable} pauser The observable sequence used to pause the underlying sequence. * @returns {Observable} The observable sequence which is paused based upon the pauser. */ observableProto.pausableBuffered = function (subject) { return new PausableBufferedObservable(this, subject); }; var ControlledObservable = (function (__super__) { inherits(ControlledObservable, __super__); function subscribe (observer) { return this.source.subscribe(observer); } function ControlledObservable (source, enableQueue, scheduler) { __super__.call(this, subscribe, source); this.subject = new ControlledSubject(enableQueue, scheduler); this.source = source.multicast(this.subject).refCount(); } ControlledObservable.prototype.request = function (numberOfItems) { return this.subject.request(numberOfItems == null ? -1 : numberOfItems); }; return ControlledObservable; }(Observable)); var ControlledSubject = (function (__super__) { function subscribe (observer) { return this.subject.subscribe(observer); } inherits(ControlledSubject, __super__); function ControlledSubject(enableQueue, scheduler) { enableQueue == null && (enableQueue = true); __super__.call(this, subscribe); this.subject = new Subject(); this.enableQueue = enableQueue; this.queue = enableQueue ? [] : null; this.requestedCount = 0; this.requestedDisposable = null; this.error = null; this.hasFailed = false; this.hasCompleted = false; this.scheduler = scheduler || currentThreadScheduler; } addProperties(ControlledSubject.prototype, Observer, { onCompleted: function () { this.hasCompleted = true; if (!this.enableQueue || this.queue.length === 0) { this.subject.onCompleted(); this.disposeCurrentRequest() } else { this.queue.push(Notification.createOnCompleted()); } }, onError: function (error) { this.hasFailed = true; this.error = error; if (!this.enableQueue || this.queue.length === 0) { this.subject.onError(error); this.disposeCurrentRequest() } else { this.queue.push(Notification.createOnError(error)); } }, onNext: function (value) { if (this.requestedCount <= 0) { this.enableQueue && this.queue.push(Notification.createOnNext(value)); } else { (this.requestedCount-- === 0) && this.disposeCurrentRequest(); this.subject.onNext(value); } }, _processRequest: function (numberOfItems) { if (this.enableQueue) { while (this.queue.length > 0 && (numberOfItems > 0 || this.queue[0].kind !== 'N')) { var first = this.queue.shift(); first.accept(this.subject); if (first.kind === 'N') { numberOfItems--; } else { this.disposeCurrentRequest(); this.queue = []; } } } return numberOfItems; }, request: function (number) { this.disposeCurrentRequest(); var self = this; this.requestedDisposable = this.scheduler.scheduleWithState(number, function(s, i) { var remaining = self._processRequest(i); var stopped = self.hasCompleted || self.hasFailed if (!stopped && remaining > 0) { self.requestedCount = remaining; return disposableCreate(function () { self.requestedCount = 0; }); // Scheduled item is still in progress. Return a new // disposable to allow the request to be interrupted // via dispose. } }); return this.requestedDisposable; }, disposeCurrentRequest: function () { if (this.requestedDisposable) { this.requestedDisposable.dispose(); this.requestedDisposable = null; } } }); return ControlledSubject; }(Observable)); /** * Attaches a controller to the observable sequence with the ability to queue. * @example * var source = Rx.Observable.interval(100).controlled(); * source.request(3); // Reads 3 values * @param {bool} enableQueue truthy value to determine if values should be queued pending the next request * @param {Scheduler} scheduler determines how the requests will be scheduled * @returns {Observable} The observable sequence which only propagates values on request. */ observableProto.controlled = function (enableQueue, scheduler) { if (enableQueue && isScheduler(enableQueue)) { scheduler = enableQueue; enableQueue = true; } if (enableQueue == null) { enableQueue = true; } return new ControlledObservable(this, enableQueue, scheduler); }; var StopAndWaitObservable = (function (__super__) { function subscribe (observer) { this.subscription = this.source.subscribe(new StopAndWaitObserver(observer, this, this.subscription)); var self = this; timeoutScheduler.schedule(function () { self.source.request(1); }); return this.subscription; } inherits(StopAndWaitObservable, __super__); function StopAndWaitObservable (source) { __super__.call(this, subscribe, source); this.source = source; } var StopAndWaitObserver = (function (__sub__) { inherits(StopAndWaitObserver, __sub__); function StopAndWaitObserver (observer, observable, cancel) { __sub__.call(this); this.observer = observer; this.observable = observable; this.cancel = cancel; } var stopAndWaitObserverProto = StopAndWaitObserver.prototype; stopAndWaitObserverProto.completed = function () { this.observer.onCompleted(); this.dispose(); }; stopAndWaitObserverProto.error = function (error) { this.observer.onError(error); this.dispose(); } stopAndWaitObserverProto.next = function (value) { this.observer.onNext(value); var self = this; timeoutScheduler.schedule(function () { self.observable.source.request(1); }); }; stopAndWaitObserverProto.dispose = function () { this.observer = null; if (this.cancel) { this.cancel.dispose(); this.cancel = null; } __sub__.prototype.dispose.call(this); }; return StopAndWaitObserver; }(AbstractObserver)); return StopAndWaitObservable; }(Observable)); /** * Attaches a stop and wait observable to the current observable. * @returns {Observable} A stop and wait observable. */ ControlledObservable.prototype.stopAndWait = function () { return new StopAndWaitObservable(this); }; var WindowedObservable = (function (__super__) { function subscribe (observer) { this.subscription = this.source.subscribe(new WindowedObserver(observer, this, this.subscription)); var self = this; timeoutScheduler.schedule(function () { self.source.request(self.windowSize); }); return this.subscription; } inherits(WindowedObservable, __super__); function WindowedObservable(source, windowSize) { __super__.call(this, subscribe, source); this.source = source; this.windowSize = windowSize; } var WindowedObserver = (function (__sub__) { inherits(WindowedObserver, __sub__); function WindowedObserver(observer, observable, cancel) { this.observer = observer; this.observable = observable; this.cancel = cancel; this.received = 0; } var windowedObserverPrototype = WindowedObserver.prototype; windowedObserverPrototype.completed = function () { this.observer.onCompleted(); this.dispose(); }; windowedObserverPrototype.error = function (error) { this.observer.onError(error); this.dispose(); }; windowedObserverPrototype.next = function (value) { this.observer.onNext(value); this.received = ++this.received % this.observable.windowSize; if (this.received === 0) { var self = this; timeoutScheduler.schedule(function () { self.observable.source.request(self.observable.windowSize); }); } }; windowedObserverPrototype.dispose = function () { this.observer = null; if (this.cancel) { this.cancel.dispose(); this.cancel = null; } __sub__.prototype.dispose.call(this); }; return WindowedObserver; }(AbstractObserver)); return WindowedObservable; }(Observable)); /** * Creates a sliding windowed observable based upon the window size. * @param {Number} windowSize The number of items in the window * @returns {Observable} A windowed observable based upon the window size. */ ControlledObservable.prototype.windowed = function (windowSize) { return new WindowedObservable(this, windowSize); }; /** * Pipes the existing Observable sequence into a Node.js Stream. * @param {Stream} dest The destination Node.js stream. * @returns {Stream} The destination stream. */ observableProto.pipe = function (dest) { var source = this.pausableBuffered(); function onDrain() { source.resume(); } dest.addListener('drain', onDrain); source.subscribe( function (x) { !dest.write(String(x)) && source.pause(); }, function (err) { dest.emit('error', err); }, function () { // Hack check because STDIO is not closable !dest._isStdio && dest.end(); dest.removeListener('drain', onDrain); }); source.resume(); return dest; }; /** * Multicasts the source sequence notifications through an instantiated subject into all uses of the sequence within a selector function. Each * subscription to the resulting sequence causes a separate multicast invocation, exposing the sequence resulting from the selector function's * invocation. For specializations with fixed subject types, see Publish, PublishLast, and Replay. * * @example * 1 - res = source.multicast(observable); * 2 - res = source.multicast(function () { return new Subject(); }, function (x) { return x; }); * * @param {Function|Subject} subjectOrSubjectSelector * Factory function to create an intermediate subject through which the source sequence's elements will be multicast to the selector function. * Or: * Subject to push source elements into. * * @param {Function} [selector] Optional selector function which can use the multicasted source sequence subject to the policies enforced by the created subject. Specified only if <paramref name="subjectOrSubjectSelector" is a factory function. * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function. */ observableProto.multicast = function (subjectOrSubjectSelector, selector) { var source = this; return typeof subjectOrSubjectSelector === 'function' ? new AnonymousObservable(function (observer) { var connectable = source.multicast(subjectOrSubjectSelector()); return new CompositeDisposable(selector(connectable).subscribe(observer), connectable.connect()); }, source) : new ConnectableObservable(source, subjectOrSubjectSelector); }; /** * Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence. * This operator is a specialization of Multicast using a regular Subject. * * @example * var resres = source.publish(); * var res = source.publish(function (x) { return x; }); * * @param {Function} [selector] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all notifications of the source from the time of the subscription on. * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function. */ observableProto.publish = function (selector) { return selector && isFunction(selector) ? this.multicast(function () { return new Subject(); }, selector) : this.multicast(new Subject()); }; /** * Returns an observable sequence that shares a single subscription to the underlying sequence. * This operator is a specialization of publish which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed. * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence. */ observableProto.share = function () { return this.publish().refCount(); }; /** * Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence containing only the last notification. * This operator is a specialization of Multicast using a AsyncSubject. * * @example * var res = source.publishLast(); * var res = source.publishLast(function (x) { return x; }); * * @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will only receive the last notification of the source. * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function. */ observableProto.publishLast = function (selector) { return selector && isFunction(selector) ? this.multicast(function () { return new AsyncSubject(); }, selector) : this.multicast(new AsyncSubject()); }; /** * Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence and starts with initialValue. * This operator is a specialization of Multicast using a BehaviorSubject. * * @example * var res = source.publishValue(42); * var res = source.publishValue(function (x) { return x.select(function (y) { return y * y; }) }, 42); * * @param {Function} [selector] Optional selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive immediately receive the initial value, followed by all notifications of the source from the time of the subscription on. * @param {Mixed} initialValue Initial value received by observers upon subscription. * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function. */ observableProto.publishValue = function (initialValueOrSelector, initialValue) { return arguments.length === 2 ? this.multicast(function () { return new BehaviorSubject(initialValue); }, initialValueOrSelector) : this.multicast(new BehaviorSubject(initialValueOrSelector)); }; /** * Returns an observable sequence that shares a single subscription to the underlying sequence and starts with an initialValue. * This operator is a specialization of publishValue which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed. * @param {Mixed} initialValue Initial value received by observers upon subscription. * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence. */ observableProto.shareValue = function (initialValue) { return this.publishValue(initialValue).refCount(); }; /** * Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer. * This operator is a specialization of Multicast using a ReplaySubject. * * @example * var res = source.replay(null, 3); * var res = source.replay(null, 3, 500); * var res = source.replay(null, 3, 500, scheduler); * var res = source.replay(function (x) { return x.take(6).repeat(); }, 3, 500, scheduler); * * @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy. * @param bufferSize [Optional] Maximum element count of the replay buffer. * @param windowSize [Optional] Maximum time length of the replay buffer. * @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on. * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function. */ observableProto.replay = function (selector, bufferSize, windowSize, scheduler) { return selector && isFunction(selector) ? this.multicast(function () { return new ReplaySubject(bufferSize, windowSize, scheduler); }, selector) : this.multicast(new ReplaySubject(bufferSize, windowSize, scheduler)); }; /** * Returns an observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer. * This operator is a specialization of replay which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed. * * @example * var res = source.shareReplay(3); * var res = source.shareReplay(3, 500); * var res = source.shareReplay(3, 500, scheduler); * * @param bufferSize [Optional] Maximum element count of the replay buffer. * @param window [Optional] Maximum time length of the replay buffer. * @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on. * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence. */ observableProto.shareReplay = function (bufferSize, windowSize, scheduler) { return this.replay(null, bufferSize, windowSize, scheduler).refCount(); }; var InnerSubscription = function (subject, observer) { this.subject = subject; this.observer = observer; }; InnerSubscription.prototype.dispose = function () { if (!this.subject.isDisposed && this.observer !== null) { var idx = this.subject.observers.indexOf(this.observer); this.subject.observers.splice(idx, 1); this.observer = null; } }; /** * Represents a value that changes over time. * Observers can subscribe to the subject to receive the last (or initial) value and all subsequent notifications. */ var BehaviorSubject = Rx.BehaviorSubject = (function (__super__) { function subscribe(observer) { checkDisposed(this); if (!this.isStopped) { this.observers.push(observer); observer.onNext(this.value); return new InnerSubscription(this, observer); } if (this.hasError) { observer.onError(this.error); } else { observer.onCompleted(); } return disposableEmpty; } inherits(BehaviorSubject, __super__); /** * Initializes a new instance of the BehaviorSubject class which creates a subject that caches its last value and starts with the specified value. * @param {Mixed} value Initial value sent to observers when no other value has been received by the subject yet. */ function BehaviorSubject(value) { __super__.call(this, subscribe); this.value = value, this.observers = [], this.isDisposed = false, this.isStopped = false, this.hasError = false; } addProperties(BehaviorSubject.prototype, Observer, { /** * Gets the current value or throws an exception. * Value is frozen after onCompleted is called. * After onError is called always throws the specified exception. * An exception is always thrown after dispose is called. * @returns {Mixed} The initial value passed to the constructor until onNext is called; after which, the last value passed to onNext. */ getValue: function () { checkDisposed(this); if (this.hasError) { throw this.error; } return this.value; }, /** * Indicates whether the subject has observers subscribed to it. * @returns {Boolean} Indicates whether the subject has observers subscribed to it. */ hasObservers: function () { return this.observers.length > 0; }, /** * Notifies all subscribed observers about the end of the sequence. */ onCompleted: function () { checkDisposed(this); if (this.isStopped) { return; } this.isStopped = true; for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) { os[i].onCompleted(); } this.observers.length = 0; }, /** * Notifies all subscribed observers about the exception. * @param {Mixed} error The exception to send to all observers. */ onError: function (error) { checkDisposed(this); if (this.isStopped) { return; } this.isStopped = true; this.hasError = true; this.error = error; for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) { os[i].onError(error); } this.observers.length = 0; }, /** * Notifies all subscribed observers about the arrival of the specified element in the sequence. * @param {Mixed} value The value to send to all observers. */ onNext: function (value) { checkDisposed(this); if (this.isStopped) { return; } this.value = value; for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) { os[i].onNext(value); } }, /** * Unsubscribe all observers and release resources. */ dispose: function () { this.isDisposed = true; this.observers = null; this.value = null; this.exception = null; } }); return BehaviorSubject; }(Observable)); /** * Represents an object that is both an observable sequence as well as an observer. * Each notification is broadcasted to all subscribed and future observers, subject to buffer trimming policies. */ var ReplaySubject = Rx.ReplaySubject = (function (__super__) { var maxSafeInteger = Math.pow(2, 53) - 1; function createRemovableDisposable(subject, observer) { return disposableCreate(function () { observer.dispose(); !subject.isDisposed && subject.observers.splice(subject.observers.indexOf(observer), 1); }); } function subscribe(observer) { var so = new ScheduledObserver(this.scheduler, observer), subscription = createRemovableDisposable(this, so); checkDisposed(this); this._trim(this.scheduler.now()); this.observers.push(so); for (var i = 0, len = this.q.length; i < len; i++) { so.onNext(this.q[i].value); } if (this.hasError) { so.onError(this.error); } else if (this.isStopped) { so.onCompleted(); } so.ensureActive(); return subscription; } inherits(ReplaySubject, __super__); /** * Initializes a new instance of the ReplaySubject class with the specified buffer size, window size and scheduler. * @param {Number} [bufferSize] Maximum element count of the replay buffer. * @param {Number} [windowSize] Maximum time length of the replay buffer. * @param {Scheduler} [scheduler] Scheduler the observers are invoked on. */ function ReplaySubject(bufferSize, windowSize, scheduler) { this.bufferSize = bufferSize == null ? maxSafeInteger : bufferSize; this.windowSize = windowSize == null ? maxSafeInteger : windowSize; this.scheduler = scheduler || currentThreadScheduler; this.q = []; this.observers = []; this.isStopped = false; this.isDisposed = false; this.hasError = false; this.error = null; __super__.call(this, subscribe); } addProperties(ReplaySubject.prototype, Observer.prototype, { /** * Indicates whether the subject has observers subscribed to it. * @returns {Boolean} Indicates whether the subject has observers subscribed to it. */ hasObservers: function () { return this.observers.length > 0; }, _trim: function (now) { while (this.q.length > this.bufferSize) { this.q.shift(); } while (this.q.length > 0 && (now - this.q[0].interval) > this.windowSize) { this.q.shift(); } }, /** * Notifies all subscribed observers about the arrival of the specified element in the sequence. * @param {Mixed} value The value to send to all observers. */ onNext: function (value) { checkDisposed(this); if (this.isStopped) { return; } var now = this.scheduler.now(); this.q.push({ interval: now, value: value }); this._trim(now); for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) { var observer = os[i]; observer.onNext(value); observer.ensureActive(); } }, /** * Notifies all subscribed observers about the exception. * @param {Mixed} error The exception to send to all observers. */ onError: function (error) { checkDisposed(this); if (this.isStopped) { return; } this.isStopped = true; this.error = error; this.hasError = true; var now = this.scheduler.now(); this._trim(now); for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) { var observer = os[i]; observer.onError(error); observer.ensureActive(); } this.observers.length = 0; }, /** * Notifies all subscribed observers about the end of the sequence. */ onCompleted: function () { checkDisposed(this); if (this.isStopped) { return; } this.isStopped = true; var now = this.scheduler.now(); this._trim(now); for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) { var observer = os[i]; observer.onCompleted(); observer.ensureActive(); } this.observers.length = 0; }, /** * Unsubscribe all observers and release resources. */ dispose: function () { this.isDisposed = true; this.observers = null; } }); return ReplaySubject; }(Observable)); var ConnectableObservable = Rx.ConnectableObservable = (function (__super__) { inherits(ConnectableObservable, __super__); function ConnectableObservable(source, subject) { var hasSubscription = false, subscription, sourceObservable = source.asObservable(); this.connect = function () { if (!hasSubscription) { hasSubscription = true; subscription = new CompositeDisposable(sourceObservable.subscribe(subject), disposableCreate(function () { hasSubscription = false; })); } return subscription; }; __super__.call(this, function (o) { return subject.subscribe(o); }); } ConnectableObservable.prototype.refCount = function () { var connectableSubscription, count = 0, source = this; return new AnonymousObservable(function (observer) { var shouldConnect = ++count === 1, subscription = source.subscribe(observer); shouldConnect && (connectableSubscription = source.connect()); return function () { subscription.dispose(); --count === 0 && connectableSubscription.dispose(); }; }); }; return ConnectableObservable; }(Observable)); /** * Returns an observable sequence that shares a single subscription to the underlying sequence. This observable sequence * can be resubscribed to, even if all prior subscriptions have ended. (unlike `.publish().refCount()`) * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source. */ observableProto.singleInstance = function() { var source = this, hasObservable = false, observable; function getObservable() { if (!hasObservable) { hasObservable = true; observable = source.finally(function() { hasObservable = false; }).publish().refCount(); } return observable; }; return new AnonymousObservable(function(o) { return getObservable().subscribe(o); }); }; /** * Correlates the elements of two sequences based on overlapping durations. * * @param {Observable} right The right observable sequence to join elements for. * @param {Function} leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap. * @param {Function} rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap. * @param {Function} resultSelector A function invoked to compute a result element for any two overlapping elements of the left and right observable sequences. The parameters passed to the function correspond with the elements from the left and right source sequences for which overlap occurs. * @returns {Observable} An observable sequence that contains result elements computed from source elements that have an overlapping duration. */ observableProto.join = function (right, leftDurationSelector, rightDurationSelector, resultSelector) { var left = this; return new AnonymousObservable(function (o) { var group = new CompositeDisposable(); var leftDone = false, rightDone = false; var leftId = 0, rightId = 0; var leftMap = new Map(), rightMap = new Map(); var handleError = function (e) { o.onError(e); }; group.add(left.subscribe( function (value) { var id = leftId++, md = new SingleAssignmentDisposable(); leftMap.set(id, value); group.add(md); var duration = tryCatch(leftDurationSelector)(value); if (duration === errorObj) { return o.onError(duration.e); } md.setDisposable(duration.take(1).subscribe( noop, handleError, function () { leftMap['delete'](id) && leftMap.size === 0 && leftDone && o.onCompleted(); group.remove(md); })); rightMap.forEach(function (v) { var result = tryCatch(resultSelector)(value, v); if (result === errorObj) { return o.onError(result.e); } o.onNext(result); }); }, handleError, function () { leftDone = true; (rightDone || leftMap.size === 0) && o.onCompleted(); }) ); group.add(right.subscribe( function (value) { var id = rightId++, md = new SingleAssignmentDisposable(); rightMap.set(id, value); group.add(md); var duration = tryCatch(rightDurationSelector)(value); if (duration === errorObj) { return o.onError(duration.e); } md.setDisposable(duration.take(1).subscribe( noop, handleError, function () { rightMap['delete'](id) && rightMap.size === 0 && rightDone && o.onCompleted(); group.remove(md); })); leftMap.forEach(function (v) { var result = tryCatch(resultSelector)(v, value); if (result === errorObj) { return o.onError(result.e); } o.onNext(result); }); }, handleError, function () { rightDone = true; (leftDone || rightMap.size === 0) && o.onCompleted(); }) ); return group; }, left); }; /** * Correlates the elements of two sequences based on overlapping durations, and groups the results. * * @param {Observable} right The right observable sequence to join elements for. * @param {Function} leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap. * @param {Function} rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap. * @param {Function} resultSelector A function invoked to compute a result element for any element of the left sequence with overlapping elements from the right observable sequence. The first parameter passed to the function is an element of the left sequence. The second parameter passed to the function is an observable sequence with elements from the right sequence that overlap with the left sequence's element. * @returns {Observable} An observable sequence that contains result elements computed from source elements that have an overlapping duration. */ observableProto.groupJoin = function (right, leftDurationSelector, rightDurationSelector, resultSelector) { var left = this; return new AnonymousObservable(function (o) { var group = new CompositeDisposable(); var r = new RefCountDisposable(group); var leftMap = new Map(), rightMap = new Map(); var leftId = 0, rightId = 0; var handleError = function (e) { return function (v) { v.onError(e); }; }; function handleError(e) { }; group.add(left.subscribe( function (value) { var s = new Subject(); var id = leftId++; leftMap.set(id, s); var result = tryCatch(resultSelector)(value, addRef(s, r)); if (result === errorObj) { leftMap.forEach(handleError(result.e)); return o.onError(result.e); } o.onNext(result); rightMap.forEach(function (v) { s.onNext(v); }); var md = new SingleAssignmentDisposable(); group.add(md); var duration = tryCatch(leftDurationSelector)(value); if (duration === errorObj) { leftMap.forEach(handleError(duration.e)); return o.onError(duration.e); } md.setDisposable(duration.take(1).subscribe( noop, function (e) { leftMap.forEach(handleError(e)); o.onError(e); }, function () { leftMap['delete'](id) && s.onCompleted(); group.remove(md); })); }, function (e) { leftMap.forEach(handleError(e)); o.onError(e); }, function () { o.onCompleted(); }) ); group.add(right.subscribe( function (value) { var id = rightId++; rightMap.set(id, value); var md = new SingleAssignmentDisposable(); group.add(md); var duration = tryCatch(rightDurationSelector)(value); if (duration === errorObj) { leftMap.forEach(handleError(duration.e)); return o.onError(duration.e); } md.setDisposable(duration.take(1).subscribe( noop, function (e) { leftMap.forEach(handleError(e)); o.onError(e); }, function () { rightMap['delete'](id); group.remove(md); })); leftMap.forEach(function (v) { v.onNext(value); }); }, function (e) { leftMap.forEach(handleError(e)); o.onError(e); }) ); return r; }, left); }; function toArray(x) { return x.toArray(); } /** * Projects each element of an observable sequence into zero or more buffers. * @param {Mixed} bufferOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows). * @param {Function} [bufferClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored. * @returns {Observable} An observable sequence of windows. */ observableProto.buffer = function () { return this.window.apply(this, arguments) .flatMap(toArray); }; /** * Projects each element of an observable sequence into zero or more windows. * * @param {Mixed} windowOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows). * @param {Function} [windowClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored. * @returns {Observable} An observable sequence of windows. */ observableProto.window = function (windowOpeningsOrClosingSelector, windowClosingSelector) { if (arguments.length === 1 && typeof arguments[0] !== 'function') { return observableWindowWithBoundaries.call(this, windowOpeningsOrClosingSelector); } return typeof windowOpeningsOrClosingSelector === 'function' ? observableWindowWithClosingSelector.call(this, windowOpeningsOrClosingSelector) : observableWindowWithOpenings.call(this, windowOpeningsOrClosingSelector, windowClosingSelector); }; function observableWindowWithOpenings(windowOpenings, windowClosingSelector) { return windowOpenings.groupJoin(this, windowClosingSelector, observableEmpty, function (_, win) { return win; }); } function observableWindowWithBoundaries(windowBoundaries) { var source = this; return new AnonymousObservable(function (observer) { var win = new Subject(), d = new CompositeDisposable(), r = new RefCountDisposable(d); observer.onNext(addRef(win, r)); d.add(source.subscribe(function (x) { win.onNext(x); }, function (err) { win.onError(err); observer.onError(err); }, function () { win.onCompleted(); observer.onCompleted(); })); isPromise(windowBoundaries) && (windowBoundaries = observableFromPromise(windowBoundaries)); d.add(windowBoundaries.subscribe(function (w) { win.onCompleted(); win = new Subject(); observer.onNext(addRef(win, r)); }, function (err) { win.onError(err); observer.onError(err); }, function () { win.onCompleted(); observer.onCompleted(); })); return r; }, source); } function observableWindowWithClosingSelector(windowClosingSelector) { var source = this; return new AnonymousObservable(function (observer) { var m = new SerialDisposable(), d = new CompositeDisposable(m), r = new RefCountDisposable(d), win = new Subject(); observer.onNext(addRef(win, r)); d.add(source.subscribe(function (x) { win.onNext(x); }, function (err) { win.onError(err); observer.onError(err); }, function () { win.onCompleted(); observer.onCompleted(); })); function createWindowClose () { var windowClose; try { windowClose = windowClosingSelector(); } catch (e) { observer.onError(e); return; } isPromise(windowClose) && (windowClose = observableFromPromise(windowClose)); var m1 = new SingleAssignmentDisposable(); m.setDisposable(m1); m1.setDisposable(windowClose.take(1).subscribe(noop, function (err) { win.onError(err); observer.onError(err); }, function () { win.onCompleted(); win = new Subject(); observer.onNext(addRef(win, r)); createWindowClose(); })); } createWindowClose(); return r; }, source); } /** * Returns a new observable that triggers on the second and subsequent triggerings of the input observable. * The Nth triggering of the input observable passes the arguments from the N-1th and Nth triggering as a pair. * The argument passed to the N-1th triggering is held in hidden internal state until the Nth triggering occurs. * @returns {Observable} An observable that triggers on successive pairs of observations from the input observable as an array. */ observableProto.pairwise = function () { var source = this; return new AnonymousObservable(function (observer) { var previous, hasPrevious = false; return source.subscribe( function (x) { if (hasPrevious) { observer.onNext([previous, x]); } else { hasPrevious = true; } previous = x; }, observer.onError.bind(observer), observer.onCompleted.bind(observer)); }, source); }; /** * Returns two observables which partition the observations of the source by the given function. * The first will trigger observations for those values for which the predicate returns true. * The second will trigger observations for those values where the predicate returns false. * The predicate is executed once for each subscribed observer. * Both also propagate all error observations arising from the source and each completes * when the source completes. * @param {Function} predicate * The function to determine which output Observable will trigger a particular observation. * @returns {Array} * An array of observables. The first triggers when the predicate returns true, * and the second triggers when the predicate returns false. */ observableProto.partition = function(predicate, thisArg) { return [ this.filter(predicate, thisArg), this.filter(function (x, i, o) { return !predicate.call(thisArg, x, i, o); }) ]; }; var WhileEnumerable = (function(__super__) { inherits(WhileEnumerable, __super__); function WhileEnumerable(c, s) { this.c = c; this.s = s; } WhileEnumerable.prototype[$iterator$] = function () { var self = this; return { next: function () { return self.c() ? { done: false, value: self.s } : { done: true, value: void 0 }; } }; }; return WhileEnumerable; }(Enumerable)); function enumerableWhile(condition, source) { return new WhileEnumerable(condition, source); } /** * Returns an observable sequence that is the result of invoking the selector on the source sequence, without sharing subscriptions. * This operator allows for a fluent style of writing queries that use the same sequence multiple times. * * @param {Function} selector Selector function which can use the source sequence as many times as needed, without sharing subscriptions to the source sequence. * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function. */ observableProto.letBind = observableProto['let'] = function (func) { return func(this); }; /** * Determines whether an observable collection contains values. * * @example * 1 - res = Rx.Observable.if(condition, obs1); * 2 - res = Rx.Observable.if(condition, obs1, obs2); * 3 - res = Rx.Observable.if(condition, obs1, scheduler); * @param {Function} condition The condition which determines if the thenSource or elseSource will be run. * @param {Observable} thenSource The observable sequence or Promise that will be run if the condition function returns true. * @param {Observable} [elseSource] The observable sequence or Promise that will be run if the condition function returns false. If this is not provided, it defaults to Rx.Observabe.Empty with the specified scheduler. * @returns {Observable} An observable sequence which is either the thenSource or elseSource. */ Observable['if'] = function (condition, thenSource, elseSourceOrScheduler) { return observableDefer(function () { elseSourceOrScheduler || (elseSourceOrScheduler = observableEmpty()); isPromise(thenSource) && (thenSource = observableFromPromise(thenSource)); isPromise(elseSourceOrScheduler) && (elseSourceOrScheduler = observableFromPromise(elseSourceOrScheduler)); // Assume a scheduler for empty only typeof elseSourceOrScheduler.now === 'function' && (elseSourceOrScheduler = observableEmpty(elseSourceOrScheduler)); return condition() ? thenSource : elseSourceOrScheduler; }); }; /** * Concatenates the observable sequences obtained by running the specified result selector for each element in source. * There is an alias for this method called 'forIn' for browsers <IE9 * @param {Array} sources An array of values to turn into an observable sequence. * @param {Function} resultSelector A function to apply to each item in the sources array to turn it into an observable sequence. * @returns {Observable} An observable sequence from the concatenated observable sequences. */ Observable['for'] = Observable.forIn = function (sources, resultSelector, thisArg) { return enumerableOf(sources, resultSelector, thisArg).concat(); }; /** * Repeats source as long as condition holds emulating a while loop. * There is an alias for this method called 'whileDo' for browsers <IE9 * * @param {Function} condition The condition which determines if the source will be repeated. * @param {Observable} source The observable sequence that will be run if the condition function returns true. * @returns {Observable} An observable sequence which is repeated as long as the condition holds. */ var observableWhileDo = Observable['while'] = Observable.whileDo = function (condition, source) { isPromise(source) && (source = observableFromPromise(source)); return enumerableWhile(condition, source).concat(); }; /** * Repeats source as long as condition holds emulating a do while loop. * * @param {Function} condition The condition which determines if the source will be repeated. * @param {Observable} source The observable sequence that will be run if the condition function returns true. * @returns {Observable} An observable sequence which is repeated as long as the condition holds. */ observableProto.doWhile = function (condition) { return observableConcat([this, observableWhileDo(condition, this)]); }; /** * Uses selector to determine which source in sources to use. * @param {Function} selector The function which extracts the value for to test in a case statement. * @param {Array} sources A object which has keys which correspond to the case statement labels. * @param {Observable} [elseSource] The observable sequence or Promise that will be run if the sources are not matched. If this is not provided, it defaults to Rx.Observabe.empty with the specified scheduler. * * @returns {Observable} An observable sequence which is determined by a case statement. */ Observable['case'] = function (selector, sources, defaultSourceOrScheduler) { return observableDefer(function () { isPromise(defaultSourceOrScheduler) && (defaultSourceOrScheduler = observableFromPromise(defaultSourceOrScheduler)); defaultSourceOrScheduler || (defaultSourceOrScheduler = observableEmpty()); isScheduler(defaultSourceOrScheduler) && (defaultSourceOrScheduler = observableEmpty(defaultSourceOrScheduler)); var result = sources[selector()]; isPromise(result) && (result = observableFromPromise(result)); return result || defaultSourceOrScheduler; }); }; /** * Expands an observable sequence by recursively invoking selector. * * @param {Function} selector Selector function to invoke for each produced element, resulting in another sequence to which the selector will be invoked recursively again. * @param {Scheduler} [scheduler] Scheduler on which to perform the expansion. If not provided, this defaults to the current thread scheduler. * @returns {Observable} An observable sequence containing all the elements produced by the recursive expansion. */ observableProto.expand = function (selector, scheduler) { isScheduler(scheduler) || (scheduler = immediateScheduler); var source = this; return new AnonymousObservable(function (observer) { var q = [], m = new SerialDisposable(), d = new CompositeDisposable(m), activeCount = 0, isAcquired = false; var ensureActive = function () { var isOwner = false; if (q.length > 0) { isOwner = !isAcquired; isAcquired = true; } if (isOwner) { m.setDisposable(scheduler.scheduleRecursive(function (self) { var work; if (q.length > 0) { work = q.shift(); } else { isAcquired = false; return; } var m1 = new SingleAssignmentDisposable(); d.add(m1); m1.setDisposable(work.subscribe(function (x) { observer.onNext(x); var result = null; try { result = selector(x); } catch (e) { observer.onError(e); } q.push(result); activeCount++; ensureActive(); }, observer.onError.bind(observer), function () { d.remove(m1); activeCount--; if (activeCount === 0) { observer.onCompleted(); } })); self(); })); } }; q.push(source); activeCount++; ensureActive(); return d; }, this); }; /** * Runs all observable sequences in parallel and collect their last elements. * * @example * 1 - res = Rx.Observable.forkJoin([obs1, obs2]); * 1 - res = Rx.Observable.forkJoin(obs1, obs2, ...); * @returns {Observable} An observable sequence with an array collecting the last elements of all the input sequences. */ Observable.forkJoin = function () { var allSources = []; if (Array.isArray(arguments[0])) { allSources = arguments[0]; } else { for(var i = 0, len = arguments.length; i < len; i++) { allSources.push(arguments[i]); } } return new AnonymousObservable(function (subscriber) { var count = allSources.length; if (count === 0) { subscriber.onCompleted(); return disposableEmpty; } var group = new CompositeDisposable(), finished = false, hasResults = new Array(count), hasCompleted = new Array(count), results = new Array(count); for (var idx = 0; idx < count; idx++) { (function (i) { var source = allSources[i]; isPromise(source) && (source = observableFromPromise(source)); group.add( source.subscribe( function (value) { if (!finished) { hasResults[i] = true; results[i] = value; } }, function (e) { finished = true; subscriber.onError(e); group.dispose(); }, function () { if (!finished) { if (!hasResults[i]) { subscriber.onCompleted(); return; } hasCompleted[i] = true; for (var ix = 0; ix < count; ix++) { if (!hasCompleted[ix]) { return; } } finished = true; subscriber.onNext(results); subscriber.onCompleted(); } })); })(idx); } return group; }); }; /** * Runs two observable sequences in parallel and combines their last elemenets. * * @param {Observable} second Second observable sequence. * @param {Function} resultSelector Result selector function to invoke with the last elements of both sequences. * @returns {Observable} An observable sequence with the result of calling the selector function with the last elements of both input sequences. */ observableProto.forkJoin = function (second, resultSelector) { var first = this; return new AnonymousObservable(function (observer) { var leftStopped = false, rightStopped = false, hasLeft = false, hasRight = false, lastLeft, lastRight, leftSubscription = new SingleAssignmentDisposable(), rightSubscription = new SingleAssignmentDisposable(); isPromise(second) && (second = observableFromPromise(second)); leftSubscription.setDisposable( first.subscribe(function (left) { hasLeft = true; lastLeft = left; }, function (err) { rightSubscription.dispose(); observer.onError(err); }, function () { leftStopped = true; if (rightStopped) { if (!hasLeft) { observer.onCompleted(); } else if (!hasRight) { observer.onCompleted(); } else { var result; try { result = resultSelector(lastLeft, lastRight); } catch (e) { observer.onError(e); return; } observer.onNext(result); observer.onCompleted(); } } }) ); rightSubscription.setDisposable( second.subscribe(function (right) { hasRight = true; lastRight = right; }, function (err) { leftSubscription.dispose(); observer.onError(err); }, function () { rightStopped = true; if (leftStopped) { if (!hasLeft) { observer.onCompleted(); } else if (!hasRight) { observer.onCompleted(); } else { var result; try { result = resultSelector(lastLeft, lastRight); } catch (e) { observer.onError(e); return; } observer.onNext(result); observer.onCompleted(); } } }) ); return new CompositeDisposable(leftSubscription, rightSubscription); }, first); }; /** * Comonadic bind operator. * @param {Function} selector A transform function to apply to each element. * @param {Object} scheduler Scheduler used to execute the operation. If not specified, defaults to the ImmediateScheduler. * @returns {Observable} An observable sequence which results from the comonadic bind operation. */ observableProto.manySelect = observableProto.extend = function (selector, scheduler) { isScheduler(scheduler) || (scheduler = immediateScheduler); var source = this; return observableDefer(function () { var chain; return source .map(function (x) { var curr = new ChainObservable(x); chain && chain.onNext(x); chain = curr; return curr; }) .tap( noop, function (e) { chain && chain.onError(e); }, function () { chain && chain.onCompleted(); } ) .observeOn(scheduler) .map(selector); }, source); }; var ChainObservable = (function (__super__) { function subscribe (observer) { var self = this, g = new CompositeDisposable(); g.add(currentThreadScheduler.schedule(function () { observer.onNext(self.head); g.add(self.tail.mergeAll().subscribe(observer)); })); return g; } inherits(ChainObservable, __super__); function ChainObservable(head) { __super__.call(this, subscribe); this.head = head; this.tail = new AsyncSubject(); } addProperties(ChainObservable.prototype, Observer, { onCompleted: function () { this.onNext(Observable.empty()); }, onError: function (e) { this.onNext(Observable['throw'](e)); }, onNext: function (v) { this.tail.onNext(v); this.tail.onCompleted(); } }); return ChainObservable; }(Observable)); var Map = root.Map || (function () { function Map() { this.size = 0; this._values = []; this._keys = []; } Map.prototype['delete'] = function (key) { var i = this._keys.indexOf(key); if (i === -1) { return false } this._values.splice(i, 1); this._keys.splice(i, 1); this.size--; return true; }; Map.prototype.get = function (key) { var i = this._keys.indexOf(key); return i === -1 ? undefined : this._values[i]; }; Map.prototype.set = function (key, value) { var i = this._keys.indexOf(key); if (i === -1) { this._keys.push(key); this._values.push(value); this.size++; } else { this._values[i] = value; } return this; }; Map.prototype.forEach = function (cb, thisArg) { for (var i = 0; i < this.size; i++) { cb.call(thisArg, this._values[i], this._keys[i]); } }; return Map; }()); /** * @constructor * Represents a join pattern over observable sequences. */ function Pattern(patterns) { this.patterns = patterns; } /** * Creates a pattern that matches the current plan matches and when the specified observable sequences has an available value. * @param other Observable sequence to match in addition to the current pattern. * @return {Pattern} Pattern object that matches when all observable sequences in the pattern have an available value. */ Pattern.prototype.and = function (other) { return new Pattern(this.patterns.concat(other)); }; /** * Matches when all observable sequences in the pattern (specified using a chain of and operators) have an available value and projects the values. * @param {Function} selector Selector that will be invoked with available values from the source sequences, in the same order of the sequences in the pattern. * @return {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator. */ Pattern.prototype.thenDo = function (selector) { return new Plan(this, selector); }; function Plan(expression, selector) { this.expression = expression; this.selector = selector; } Plan.prototype.activate = function (externalSubscriptions, observer, deactivate) { var self = this; var joinObservers = []; for (var i = 0, len = this.expression.patterns.length; i < len; i++) { joinObservers.push(planCreateObserver(externalSubscriptions, this.expression.patterns[i], observer.onError.bind(observer))); } var activePlan = new ActivePlan(joinObservers, function () { var result; try { result = self.selector.apply(self, arguments); } catch (e) { observer.onError(e); return; } observer.onNext(result); }, function () { for (var j = 0, jlen = joinObservers.length; j < jlen; j++) { joinObservers[j].removeActivePlan(activePlan); } deactivate(activePlan); }); for (i = 0, len = joinObservers.length; i < len; i++) { joinObservers[i].addActivePlan(activePlan); } return activePlan; }; function planCreateObserver(externalSubscriptions, observable, onError) { var entry = externalSubscriptions.get(observable); if (!entry) { var observer = new JoinObserver(observable, onError); externalSubscriptions.set(observable, observer); return observer; } return entry; } function ActivePlan(joinObserverArray, onNext, onCompleted) { this.joinObserverArray = joinObserverArray; this.onNext = onNext; this.onCompleted = onCompleted; this.joinObservers = new Map(); for (var i = 0, len = this.joinObserverArray.length; i < len; i++) { var joinObserver = this.joinObserverArray[i]; this.joinObservers.set(joinObserver, joinObserver); } } ActivePlan.prototype.dequeue = function () { this.joinObservers.forEach(function (v) { v.queue.shift(); }); }; ActivePlan.prototype.match = function () { var i, len, hasValues = true; for (i = 0, len = this.joinObserverArray.length; i < len; i++) { if (this.joinObserverArray[i].queue.length === 0) { hasValues = false; break; } } if (hasValues) { var firstValues = [], isCompleted = false; for (i = 0, len = this.joinObserverArray.length; i < len; i++) { firstValues.push(this.joinObserverArray[i].queue[0]); this.joinObserverArray[i].queue[0].kind === 'C' && (isCompleted = true); } if (isCompleted) { this.onCompleted(); } else { this.dequeue(); var values = []; for (i = 0, len = firstValues.length; i < firstValues.length; i++) { values.push(firstValues[i].value); } this.onNext.apply(this, values); } } }; var JoinObserver = (function (__super__) { inherits(JoinObserver, __super__); function JoinObserver(source, onError) { __super__.call(this); this.source = source; this.onError = onError; this.queue = []; this.activePlans = []; this.subscription = new SingleAssignmentDisposable(); this.isDisposed = false; } var JoinObserverPrototype = JoinObserver.prototype; JoinObserverPrototype.next = function (notification) { if (!this.isDisposed) { if (notification.kind === 'E') { return this.onError(notification.exception); } this.queue.push(notification); var activePlans = this.activePlans.slice(0); for (var i = 0, len = activePlans.length; i < len; i++) { activePlans[i].match(); } } }; JoinObserverPrototype.error = noop; JoinObserverPrototype.completed = noop; JoinObserverPrototype.addActivePlan = function (activePlan) { this.activePlans.push(activePlan); }; JoinObserverPrototype.subscribe = function () { this.subscription.setDisposable(this.source.materialize().subscribe(this)); }; JoinObserverPrototype.removeActivePlan = function (activePlan) { this.activePlans.splice(this.activePlans.indexOf(activePlan), 1); this.activePlans.length === 0 && this.dispose(); }; JoinObserverPrototype.dispose = function () { __super__.prototype.dispose.call(this); if (!this.isDisposed) { this.isDisposed = true; this.subscription.dispose(); } }; return JoinObserver; } (AbstractObserver)); /** * Creates a pattern that matches when both observable sequences have an available value. * * @param right Observable sequence to match with the current sequence. * @return {Pattern} Pattern object that matches when both observable sequences have an available value. */ observableProto.and = function (right) { return new Pattern([this, right]); }; /** * Matches when the observable sequence has an available value and projects the value. * * @param {Function} selector Selector that will be invoked for values in the source sequence. * @returns {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator. */ observableProto.thenDo = function (selector) { return new Pattern([this]).thenDo(selector); }; /** * Joins together the results from several patterns. * * @param plans A series of plans (specified as an Array of as a series of arguments) created by use of the Then operator on patterns. * @returns {Observable} Observable sequence with the results form matching several patterns. */ Observable.when = function () { var len = arguments.length, plans; if (Array.isArray(arguments[0])) { plans = arguments[0]; } else { plans = new Array(len); for(var i = 0; i < len; i++) { plans[i] = arguments[i]; } } return new AnonymousObservable(function (o) { var activePlans = [], externalSubscriptions = new Map(); var outObserver = observerCreate( function (x) { o.onNext(x); }, function (err) { externalSubscriptions.forEach(function (v) { v.onError(err); }); o.onError(err); }, function (x) { o.onCompleted(); } ); try { for (var i = 0, len = plans.length; i < len; i++) { activePlans.push(plans[i].activate(externalSubscriptions, outObserver, function (activePlan) { var idx = activePlans.indexOf(activePlan); activePlans.splice(idx, 1); activePlans.length === 0 && o.onCompleted(); })); } } catch (e) { observableThrow(e).subscribe(o); } var group = new CompositeDisposable(); externalSubscriptions.forEach(function (joinObserver) { joinObserver.subscribe(); group.add(joinObserver); }); return group; }); }; function observableTimerDate(dueTime, scheduler) { return new AnonymousObservable(function (observer) { return scheduler.scheduleWithAbsolute(dueTime, function () { observer.onNext(0); observer.onCompleted(); }); }); } function observableTimerDateAndPeriod(dueTime, period, scheduler) { return new AnonymousObservable(function (observer) { var d = dueTime, p = normalizeTime(period); return scheduler.scheduleRecursiveWithAbsoluteAndState(0, d, function (count, self) { if (p > 0) { var now = scheduler.now(); d = d + p; d <= now && (d = now + p); } observer.onNext(count); self(count + 1, d); }); }); } function observableTimerTimeSpan(dueTime, scheduler) { return new AnonymousObservable(function (observer) { return scheduler.scheduleWithRelative(normalizeTime(dueTime), function () { observer.onNext(0); observer.onCompleted(); }); }); } function observableTimerTimeSpanAndPeriod(dueTime, period, scheduler) { return dueTime === period ? new AnonymousObservable(function (observer) { return scheduler.schedulePeriodicWithState(0, period, function (count) { observer.onNext(count); return count + 1; }); }) : observableDefer(function () { return observableTimerDateAndPeriod(scheduler.now() + dueTime, period, scheduler); }); } /** * Returns an observable sequence that produces a value after each period. * * @example * 1 - res = Rx.Observable.interval(1000); * 2 - res = Rx.Observable.interval(1000, Rx.Scheduler.timeout); * * @param {Number} period Period for producing the values in the resulting sequence (specified as an integer denoting milliseconds). * @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, Rx.Scheduler.timeout is used. * @returns {Observable} An observable sequence that produces a value after each period. */ var observableinterval = Observable.interval = function (period, scheduler) { return observableTimerTimeSpanAndPeriod(period, period, isScheduler(scheduler) ? scheduler : timeoutScheduler); }; /** * Returns an observable sequence that produces a value after dueTime has elapsed and then after each period. * @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) at which to produce the first value. * @param {Mixed} [periodOrScheduler] Period to produce subsequent values (specified as an integer denoting milliseconds), or the scheduler to run the timer on. If not specified, the resulting timer is not recurring. * @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, the timeout scheduler is used. * @returns {Observable} An observable sequence that produces a value after due time has elapsed and then each period. */ var observableTimer = Observable.timer = function (dueTime, periodOrScheduler, scheduler) { var period; isScheduler(scheduler) || (scheduler = timeoutScheduler); if (periodOrScheduler != null && typeof periodOrScheduler === 'number') { period = periodOrScheduler; } else if (isScheduler(periodOrScheduler)) { scheduler = periodOrScheduler; } if (dueTime instanceof Date && period === undefined) { return observableTimerDate(dueTime.getTime(), scheduler); } if (dueTime instanceof Date && period !== undefined) { return observableTimerDateAndPeriod(dueTime.getTime(), periodOrScheduler, scheduler); } return period === undefined ? observableTimerTimeSpan(dueTime, scheduler) : observableTimerTimeSpanAndPeriod(dueTime, period, scheduler); }; function observableDelayTimeSpan(source, dueTime, scheduler) { return new AnonymousObservable(function (observer) { var active = false, cancelable = new SerialDisposable(), exception = null, q = [], running = false, subscription; subscription = source.materialize().timestamp(scheduler).subscribe(function (notification) { var d, shouldRun; if (notification.value.kind === 'E') { q = []; q.push(notification); exception = notification.value.exception; shouldRun = !running; } else { q.push({ value: notification.value, timestamp: notification.timestamp + dueTime }); shouldRun = !active; active = true; } if (shouldRun) { if (exception !== null) { observer.onError(exception); } else { d = new SingleAssignmentDisposable(); cancelable.setDisposable(d); d.setDisposable(scheduler.scheduleRecursiveWithRelative(dueTime, function (self) { var e, recurseDueTime, result, shouldRecurse; if (exception !== null) { return; } running = true; do { result = null; if (q.length > 0 && q[0].timestamp - scheduler.now() <= 0) { result = q.shift().value; } if (result !== null) { result.accept(observer); } } while (result !== null); shouldRecurse = false; recurseDueTime = 0; if (q.length > 0) { shouldRecurse = true; recurseDueTime = Math.max(0, q[0].timestamp - scheduler.now()); } else { active = false; } e = exception; running = false; if (e !== null) { observer.onError(e); } else if (shouldRecurse) { self(recurseDueTime); } })); } } }); return new CompositeDisposable(subscription, cancelable); }, source); } function observableDelayDate(source, dueTime, scheduler) { return observableDefer(function () { return observableDelayTimeSpan(source, dueTime - scheduler.now(), scheduler); }); } /** * Time shifts the observable sequence by dueTime. The relative time intervals between the values are preserved. * * @example * 1 - res = Rx.Observable.delay(new Date()); * 2 - res = Rx.Observable.delay(new Date(), Rx.Scheduler.timeout); * * 3 - res = Rx.Observable.delay(5000); * 4 - res = Rx.Observable.delay(5000, 1000, Rx.Scheduler.timeout); * @memberOf Observable# * @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) by which to shift the observable sequence. * @param {Scheduler} [scheduler] Scheduler to run the delay timers on. If not specified, the timeout scheduler is used. * @returns {Observable} Time-shifted sequence. */ observableProto.delay = function (dueTime, scheduler) { isScheduler(scheduler) || (scheduler = timeoutScheduler); return dueTime instanceof Date ? observableDelayDate(this, dueTime.getTime(), scheduler) : observableDelayTimeSpan(this, dueTime, scheduler); }; /** * Ignores values from an observable sequence which are followed by another value before dueTime. * @param {Number} dueTime Duration of the debounce period for each value (specified as an integer denoting milliseconds). * @param {Scheduler} [scheduler] Scheduler to run the debounce timers on. If not specified, the timeout scheduler is used. * @returns {Observable} The debounced sequence. */ observableProto.debounce = function (dueTime, scheduler) { isScheduler(scheduler) || (scheduler = timeoutScheduler); var source = this; return new AnonymousObservable(function (observer) { var cancelable = new SerialDisposable(), hasvalue = false, value, id = 0; var subscription = source.subscribe( function (x) { hasvalue = true; value = x; id++; var currentId = id, d = new SingleAssignmentDisposable(); cancelable.setDisposable(d); d.setDisposable(scheduler.scheduleWithRelative(dueTime, function () { hasvalue && id === currentId && observer.onNext(value); hasvalue = false; })); }, function (e) { cancelable.dispose(); observer.onError(e); hasvalue = false; id++; }, function () { cancelable.dispose(); hasvalue && observer.onNext(value); observer.onCompleted(); hasvalue = false; id++; }); return new CompositeDisposable(subscription, cancelable); }, this); }; /** * @deprecated use #debounce or #throttleWithTimeout instead. */ observableProto.throttle = function(dueTime, scheduler) { //deprecate('throttle', 'debounce or throttleWithTimeout'); return this.debounce(dueTime, scheduler); }; /** * Projects each element of an observable sequence into zero or more windows which are produced based on timing information. * @param {Number} timeSpan Length of each window (specified as an integer denoting milliseconds). * @param {Mixed} [timeShiftOrScheduler] Interval between creation of consecutive windows (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent windows. * @param {Scheduler} [scheduler] Scheduler to run windowing timers on. If not specified, the timeout scheduler is used. * @returns {Observable} An observable sequence of windows. */ observableProto.windowWithTime = function (timeSpan, timeShiftOrScheduler, scheduler) { var source = this, timeShift; timeShiftOrScheduler == null && (timeShift = timeSpan); isScheduler(scheduler) || (scheduler = timeoutScheduler); if (typeof timeShiftOrScheduler === 'number') { timeShift = timeShiftOrScheduler; } else if (isScheduler(timeShiftOrScheduler)) { timeShift = timeSpan; scheduler = timeShiftOrScheduler; } return new AnonymousObservable(function (observer) { var groupDisposable, nextShift = timeShift, nextSpan = timeSpan, q = [], refCountDisposable, timerD = new SerialDisposable(), totalTime = 0; groupDisposable = new CompositeDisposable(timerD), refCountDisposable = new RefCountDisposable(groupDisposable); function createTimer () { var m = new SingleAssignmentDisposable(), isSpan = false, isShift = false; timerD.setDisposable(m); if (nextSpan === nextShift) { isSpan = true; isShift = true; } else if (nextSpan < nextShift) { isSpan = true; } else { isShift = true; } var newTotalTime = isSpan ? nextSpan : nextShift, ts = newTotalTime - totalTime; totalTime = newTotalTime; if (isSpan) { nextSpan += timeShift; } if (isShift) { nextShift += timeShift; } m.setDisposable(scheduler.scheduleWithRelative(ts, function () { if (isShift) { var s = new Subject(); q.push(s); observer.onNext(addRef(s, refCountDisposable)); } isSpan && q.shift().onCompleted(); createTimer(); })); }; q.push(new Subject()); observer.onNext(addRef(q[0], refCountDisposable)); createTimer(); groupDisposable.add(source.subscribe( function (x) { for (var i = 0, len = q.length; i < len; i++) { q[i].onNext(x); } }, function (e) { for (var i = 0, len = q.length; i < len; i++) { q[i].onError(e); } observer.onError(e); }, function () { for (var i = 0, len = q.length; i < len; i++) { q[i].onCompleted(); } observer.onCompleted(); } )); return refCountDisposable; }, source); }; /** * Projects each element of an observable sequence into a window that is completed when either it's full or a given amount of time has elapsed. * @param {Number} timeSpan Maximum time length of a window. * @param {Number} count Maximum element count of a window. * @param {Scheduler} [scheduler] Scheduler to run windowing timers on. If not specified, the timeout scheduler is used. * @returns {Observable} An observable sequence of windows. */ observableProto.windowWithTimeOrCount = function (timeSpan, count, scheduler) { var source = this; isScheduler(scheduler) || (scheduler = timeoutScheduler); return new AnonymousObservable(function (observer) { var timerD = new SerialDisposable(), groupDisposable = new CompositeDisposable(timerD), refCountDisposable = new RefCountDisposable(groupDisposable), n = 0, windowId = 0, s = new Subject(); function createTimer(id) { var m = new SingleAssignmentDisposable(); timerD.setDisposable(m); m.setDisposable(scheduler.scheduleWithRelative(timeSpan, function () { if (id !== windowId) { return; } n = 0; var newId = ++windowId; s.onCompleted(); s = new Subject(); observer.onNext(addRef(s, refCountDisposable)); createTimer(newId); })); } observer.onNext(addRef(s, refCountDisposable)); createTimer(0); groupDisposable.add(source.subscribe( function (x) { var newId = 0, newWindow = false; s.onNext(x); if (++n === count) { newWindow = true; n = 0; newId = ++windowId; s.onCompleted(); s = new Subject(); observer.onNext(addRef(s, refCountDisposable)); } newWindow && createTimer(newId); }, function (e) { s.onError(e); observer.onError(e); }, function () { s.onCompleted(); observer.onCompleted(); } )); return refCountDisposable; }, source); }; function toArray(x) { return x.toArray(); } /** * Projects each element of an observable sequence into zero or more buffers which are produced based on timing information. * @param {Number} timeSpan Length of each buffer (specified as an integer denoting milliseconds). * @param {Mixed} [timeShiftOrScheduler] Interval between creation of consecutive buffers (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent buffers. * @param {Scheduler} [scheduler] Scheduler to run buffer timers on. If not specified, the timeout scheduler is used. * @returns {Observable} An observable sequence of buffers. */ observableProto.bufferWithTime = function (timeSpan, timeShiftOrScheduler, scheduler) { return this.windowWithTime(timeSpan, timeShiftOrScheduler, scheduler).flatMap(toArray); }; function toArray(x) { return x.toArray(); } /** * Projects each element of an observable sequence into a buffer that is completed when either it's full or a given amount of time has elapsed. * @param {Number} timeSpan Maximum time length of a buffer. * @param {Number} count Maximum element count of a buffer. * @param {Scheduler} [scheduler] Scheduler to run bufferin timers on. If not specified, the timeout scheduler is used. * @returns {Observable} An observable sequence of buffers. */ observableProto.bufferWithTimeOrCount = function (timeSpan, count, scheduler) { return this.windowWithTimeOrCount(timeSpan, count, scheduler).flatMap(toArray); }; /** * Records the time interval between consecutive values in an observable sequence. * * @example * 1 - res = source.timeInterval(); * 2 - res = source.timeInterval(Rx.Scheduler.timeout); * * @param [scheduler] Scheduler used to compute time intervals. If not specified, the timeout scheduler is used. * @returns {Observable} An observable sequence with time interval information on values. */ observableProto.timeInterval = function (scheduler) { var source = this; isScheduler(scheduler) || (scheduler = timeoutScheduler); return observableDefer(function () { var last = scheduler.now(); return source.map(function (x) { var now = scheduler.now(), span = now - last; last = now; return { value: x, interval: span }; }); }); }; /** * Records the timestamp for each value in an observable sequence. * * @example * 1 - res = source.timestamp(); // produces { value: x, timestamp: ts } * 2 - res = source.timestamp(Rx.Scheduler.default); * * @param {Scheduler} [scheduler] Scheduler used to compute timestamps. If not specified, the default scheduler is used. * @returns {Observable} An observable sequence with timestamp information on values. */ observableProto.timestamp = function (scheduler) { isScheduler(scheduler) || (scheduler = timeoutScheduler); return this.map(function (x) { return { value: x, timestamp: scheduler.now() }; }); }; function sampleObservable(source, sampler) { return new AnonymousObservable(function (o) { var atEnd = false, value, hasValue = false; function sampleSubscribe() { if (hasValue) { hasValue = false; o.onNext(value); } atEnd && o.onCompleted(); } var sourceSubscription = new SingleAssignmentDisposable(); sourceSubscription.setDisposable(source.subscribe( function (newValue) { hasValue = true; value = newValue; }, function (e) { o.onError(e); }, function () { atEnd = true; sourceSubscription.dispose(); } )); return new CompositeDisposable( sourceSubscription, sampler.subscribe(sampleSubscribe, function (e) { o.onError(e); }, sampleSubscribe) ); }, source); } /** * Samples the observable sequence at each interval. * * @example * 1 - res = source.sample(sampleObservable); // Sampler tick sequence * 2 - res = source.sample(5000); // 5 seconds * 2 - res = source.sample(5000, Rx.Scheduler.timeout); // 5 seconds * * @param {Mixed} intervalOrSampler Interval at which to sample (specified as an integer denoting milliseconds) or Sampler Observable. * @param {Scheduler} [scheduler] Scheduler to run the sampling timer on. If not specified, the timeout scheduler is used. * @returns {Observable} Sampled observable sequence. */ observableProto.sample = observableProto.throttleLatest = function (intervalOrSampler, scheduler) { isScheduler(scheduler) || (scheduler = timeoutScheduler); return typeof intervalOrSampler === 'number' ? sampleObservable(this, observableinterval(intervalOrSampler, scheduler)) : sampleObservable(this, intervalOrSampler); }; /** * Returns the source observable sequence or the other observable sequence if dueTime elapses. * @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) when a timeout occurs. * @param {Observable} [other] Sequence to return in case of a timeout. If not specified, a timeout error throwing sequence will be used. * @param {Scheduler} [scheduler] Scheduler to run the timeout timers on. If not specified, the timeout scheduler is used. * @returns {Observable} The source sequence switching to the other sequence in case of a timeout. */ observableProto.timeout = function (dueTime, other, scheduler) { (other == null || typeof other === 'string') && (other = observableThrow(new Error(other || 'Timeout'))); isScheduler(scheduler) || (scheduler = timeoutScheduler); var source = this, schedulerMethod = dueTime instanceof Date ? 'scheduleWithAbsolute' : 'scheduleWithRelative'; return new AnonymousObservable(function (observer) { var id = 0, original = new SingleAssignmentDisposable(), subscription = new SerialDisposable(), switched = false, timer = new SerialDisposable(); subscription.setDisposable(original); function createTimer() { var myId = id; timer.setDisposable(scheduler[schedulerMethod](dueTime, function () { if (id === myId) { isPromise(other) && (other = observableFromPromise(other)); subscription.setDisposable(other.subscribe(observer)); } })); } createTimer(); original.setDisposable(source.subscribe(function (x) { if (!switched) { id++; observer.onNext(x); createTimer(); } }, function (e) { if (!switched) { id++; observer.onError(e); } }, function () { if (!switched) { id++; observer.onCompleted(); } })); return new CompositeDisposable(subscription, timer); }, source); }; /** * Generates an observable sequence by iterating a state from an initial state until the condition fails. * * @example * res = source.generateWithAbsoluteTime(0, * function (x) { return return true; }, * function (x) { return x + 1; }, * function (x) { return x; }, * function (x) { return new Date(); } * }); * * @param {Mixed} initialState Initial state. * @param {Function} condition Condition to terminate generation (upon returning false). * @param {Function} iterate Iteration step function. * @param {Function} resultSelector Selector function for results produced in the sequence. * @param {Function} timeSelector Time selector function to control the speed of values being produced each iteration, returning Date values. * @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used. * @returns {Observable} The generated sequence. */ Observable.generateWithAbsoluteTime = function (initialState, condition, iterate, resultSelector, timeSelector, scheduler) { isScheduler(scheduler) || (scheduler = timeoutScheduler); return new AnonymousObservable(function (observer) { var first = true, hasResult = false; return scheduler.scheduleRecursiveWithAbsoluteAndState(initialState, scheduler.now(), function (state, self) { hasResult && observer.onNext(state); try { if (first) { first = false; } else { state = iterate(state); } hasResult = condition(state); if (hasResult) { var result = resultSelector(state); var time = timeSelector(state); } } catch (e) { observer.onError(e); return; } if (hasResult) { self(result, time); } else { observer.onCompleted(); } }); }); }; /** * Generates an observable sequence by iterating a state from an initial state until the condition fails. * * @example * res = source.generateWithRelativeTime(0, * function (x) { return return true; }, * function (x) { return x + 1; }, * function (x) { return x; }, * function (x) { return 500; } * ); * * @param {Mixed} initialState Initial state. * @param {Function} condition Condition to terminate generation (upon returning false). * @param {Function} iterate Iteration step function. * @param {Function} resultSelector Selector function for results produced in the sequence. * @param {Function} timeSelector Time selector function to control the speed of values being produced each iteration, returning integer values denoting milliseconds. * @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used. * @returns {Observable} The generated sequence. */ Observable.generateWithRelativeTime = function (initialState, condition, iterate, resultSelector, timeSelector, scheduler) { isScheduler(scheduler) || (scheduler = timeoutScheduler); return new AnonymousObservable(function (observer) { var first = true, hasResult = false; return scheduler.scheduleRecursiveWithRelativeAndState(initialState, 0, function (state, self) { hasResult && observer.onNext(state); try { if (first) { first = false; } else { state = iterate(state); } hasResult = condition(state); if (hasResult) { var result = resultSelector(state); var time = timeSelector(state); } } catch (e) { observer.onError(e); return; } if (hasResult) { self(result, time); } else { observer.onCompleted(); } }); }); }; /** * Time shifts the observable sequence by delaying the subscription with the specified relative time duration, using the specified scheduler to run timers. * * @example * 1 - res = source.delaySubscription(5000); // 5s * 2 - res = source.delaySubscription(5000, Rx.Scheduler.default); // 5 seconds * * @param {Number} dueTime Relative or absolute time shift of the subscription. * @param {Scheduler} [scheduler] Scheduler to run the subscription delay timer on. If not specified, the timeout scheduler is used. * @returns {Observable} Time-shifted sequence. */ observableProto.delaySubscription = function (dueTime, scheduler) { var scheduleMethod = dueTime instanceof Date ? 'scheduleWithAbsolute' : 'scheduleWithRelative'; var source = this; isScheduler(scheduler) || (scheduler = timeoutScheduler); return new AnonymousObservable(function (o) { var d = new SerialDisposable(); d.setDisposable(scheduler[scheduleMethod](dueTime, function() { d.setDisposable(source.subscribe(o)); })); return d; }, this); }; /** * Time shifts the observable sequence based on a subscription delay and a delay selector function for each element. * * @example * 1 - res = source.delayWithSelector(function (x) { return Rx.Scheduler.timer(5000); }); // with selector only * 1 - res = source.delayWithSelector(Rx.Observable.timer(2000), function (x) { return Rx.Observable.timer(x); }); // with delay and selector * * @param {Observable} [subscriptionDelay] Sequence indicating the delay for the subscription to the source. * @param {Function} delayDurationSelector Selector function to retrieve a sequence indicating the delay for each given element. * @returns {Observable} Time-shifted sequence. */ observableProto.delayWithSelector = function (subscriptionDelay, delayDurationSelector) { var source = this, subDelay, selector; if (isFunction(subscriptionDelay)) { selector = subscriptionDelay; } else { subDelay = subscriptionDelay; selector = delayDurationSelector; } return new AnonymousObservable(function (observer) { var delays = new CompositeDisposable(), atEnd = false, subscription = new SerialDisposable(); function start() { subscription.setDisposable(source.subscribe( function (x) { var delay = tryCatch(selector)(x); if (delay === errorObj) { return observer.onError(delay.e); } var d = new SingleAssignmentDisposable(); delays.add(d); d.setDisposable(delay.subscribe( function () { observer.onNext(x); delays.remove(d); done(); }, function (e) { observer.onError(e); }, function () { observer.onNext(x); delays.remove(d); done(); } )) }, function (e) { observer.onError(e); }, function () { atEnd = true; subscription.dispose(); done(); } )) } function done () { atEnd && delays.length === 0 && observer.onCompleted(); } if (!subDelay) { start(); } else { subscription.setDisposable(subDelay.subscribe(start, function (e) { observer.onError(e); }, start)); } return new CompositeDisposable(subscription, delays); }, this); }; /** * Returns the source observable sequence, switching to the other observable sequence if a timeout is signaled. * @param {Observable} [firstTimeout] Observable sequence that represents the timeout for the first element. If not provided, this defaults to Observable.never(). * @param {Function} timeoutDurationSelector Selector to retrieve an observable sequence that represents the timeout between the current element and the next element. * @param {Observable} [other] Sequence to return in case of a timeout. If not provided, this is set to Observable.throwException(). * @returns {Observable} The source sequence switching to the other sequence in case of a timeout. */ observableProto.timeoutWithSelector = function (firstTimeout, timeoutdurationSelector, other) { if (arguments.length === 1) { timeoutdurationSelector = firstTimeout; firstTimeout = observableNever(); } other || (other = observableThrow(new Error('Timeout'))); var source = this; return new AnonymousObservable(function (observer) { var subscription = new SerialDisposable(), timer = new SerialDisposable(), original = new SingleAssignmentDisposable(); subscription.setDisposable(original); var id = 0, switched = false; function setTimer(timeout) { var myId = id; function timerWins () { return id === myId; } var d = new SingleAssignmentDisposable(); timer.setDisposable(d); d.setDisposable(timeout.subscribe(function () { timerWins() && subscription.setDisposable(other.subscribe(observer)); d.dispose(); }, function (e) { timerWins() && observer.onError(e); }, function () { timerWins() && subscription.setDisposable(other.subscribe(observer)); })); }; setTimer(firstTimeout); function observerWins() { var res = !switched; if (res) { id++; } return res; } original.setDisposable(source.subscribe(function (x) { if (observerWins()) { observer.onNext(x); var timeout; try { timeout = timeoutdurationSelector(x); } catch (e) { observer.onError(e); return; } setTimer(isPromise(timeout) ? observableFromPromise(timeout) : timeout); } }, function (e) { observerWins() && observer.onError(e); }, function () { observerWins() && observer.onCompleted(); })); return new CompositeDisposable(subscription, timer); }, source); }; /** * Ignores values from an observable sequence which are followed by another value within a computed throttle duration. * @param {Function} durationSelector Selector function to retrieve a sequence indicating the throttle duration for each given element. * @returns {Observable} The debounced sequence. */ observableProto.debounceWithSelector = function (durationSelector) { var source = this; return new AnonymousObservable(function (o) { var value, hasValue = false, cancelable = new SerialDisposable(), id = 0; var subscription = source.subscribe( function (x) { var throttle = tryCatch(durationSelector)(x); if (throttle === errorObj) { return o.onError(throttle.e); } isPromise(throttle) && (throttle = observableFromPromise(throttle)); hasValue = true; value = x; id++; var currentid = id, d = new SingleAssignmentDisposable(); cancelable.setDisposable(d); d.setDisposable(throttle.subscribe( function () { hasValue && id === currentid && o.onNext(value); hasValue = false; d.dispose(); }, function (e) { o.onError(e); }, function () { hasValue && id === currentid && o.onNext(value); hasValue = false; d.dispose(); } )); }, function (e) { cancelable.dispose(); o.onError(e); hasValue = false; id++; }, function () { cancelable.dispose(); hasValue && o.onNext(value); o.onCompleted(); hasValue = false; id++; } ); return new CompositeDisposable(subscription, cancelable); }, source); }; /** * Skips elements for the specified duration from the end of the observable source sequence, using the specified scheduler to run timers. * * 1 - res = source.skipLastWithTime(5000); * 2 - res = source.skipLastWithTime(5000, scheduler); * * @description * This operator accumulates a queue with a length enough to store elements received during the initial duration window. * As more elements are received, elements older than the specified duration are taken from the queue and produced on the * result sequence. This causes elements to be delayed with duration. * @param {Number} duration Duration for skipping elements from the end of the sequence. * @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout * @returns {Observable} An observable sequence with the elements skipped during the specified duration from the end of the source sequence. */ observableProto.skipLastWithTime = function (duration, scheduler) { isScheduler(scheduler) || (scheduler = timeoutScheduler); var source = this; return new AnonymousObservable(function (o) { var q = []; return source.subscribe(function (x) { var now = scheduler.now(); q.push({ interval: now, value: x }); while (q.length > 0 && now - q[0].interval >= duration) { o.onNext(q.shift().value); } }, function (e) { o.onError(e); }, function () { var now = scheduler.now(); while (q.length > 0 && now - q[0].interval >= duration) { o.onNext(q.shift().value); } o.onCompleted(); }); }, source); }; /** * Returns elements within the specified duration from the end of the observable source sequence, using the specified schedulers to run timers and to drain the collected elements. * @description * This operator accumulates a queue with a length enough to store elements received during the initial duration window. * As more elements are received, elements older than the specified duration are taken from the queue and produced on the * result sequence. This causes elements to be delayed with duration. * @param {Number} duration Duration for taking elements from the end of the sequence. * @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout. * @returns {Observable} An observable sequence with the elements taken during the specified duration from the end of the source sequence. */ observableProto.takeLastWithTime = function (duration, scheduler) { var source = this; isScheduler(scheduler) || (scheduler = timeoutScheduler); return new AnonymousObservable(function (o) { var q = []; return source.subscribe(function (x) { var now = scheduler.now(); q.push({ interval: now, value: x }); while (q.length > 0 && now - q[0].interval >= duration) { q.shift(); } }, function (e) { o.onError(e); }, function () { var now = scheduler.now(); while (q.length > 0) { var next = q.shift(); if (now - next.interval <= duration) { o.onNext(next.value); } } o.onCompleted(); }); }, source); }; /** * Returns an array with the elements within the specified duration from the end of the observable source sequence, using the specified scheduler to run timers. * @description * This operator accumulates a queue with a length enough to store elements received during the initial duration window. * As more elements are received, elements older than the specified duration are taken from the queue and produced on the * result sequence. This causes elements to be delayed with duration. * @param {Number} duration Duration for taking elements from the end of the sequence. * @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout. * @returns {Observable} An observable sequence containing a single array with the elements taken during the specified duration from the end of the source sequence. */ observableProto.takeLastBufferWithTime = function (duration, scheduler) { var source = this; isScheduler(scheduler) || (scheduler = timeoutScheduler); return new AnonymousObservable(function (o) { var q = []; return source.subscribe(function (x) { var now = scheduler.now(); q.push({ interval: now, value: x }); while (q.length > 0 && now - q[0].interval >= duration) { q.shift(); } }, function (e) { o.onError(e); }, function () { var now = scheduler.now(), res = []; while (q.length > 0) { var next = q.shift(); now - next.interval <= duration && res.push(next.value); } o.onNext(res); o.onCompleted(); }); }, source); }; /** * Takes elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers. * * @example * 1 - res = source.takeWithTime(5000, [optional scheduler]); * @description * This operator accumulates a queue with a length enough to store elements received during the initial duration window. * As more elements are received, elements older than the specified duration are taken from the queue and produced on the * result sequence. This causes elements to be delayed with duration. * @param {Number} duration Duration for taking elements from the start of the sequence. * @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout. * @returns {Observable} An observable sequence with the elements taken during the specified duration from the start of the source sequence. */ observableProto.takeWithTime = function (duration, scheduler) { var source = this; isScheduler(scheduler) || (scheduler = timeoutScheduler); return new AnonymousObservable(function (o) { return new CompositeDisposable(scheduler.scheduleWithRelative(duration, function () { o.onCompleted(); }), source.subscribe(o)); }, source); }; /** * Skips elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers. * * @example * 1 - res = source.skipWithTime(5000, [optional scheduler]); * * @description * Specifying a zero value for duration doesn't guarantee no elements will be dropped from the start of the source sequence. * This is a side-effect of the asynchrony introduced by the scheduler, where the action that causes callbacks from the source sequence to be forwarded * may not execute immediately, despite the zero due time. * * Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the duration. * @param {Number} duration Duration for skipping elements from the start of the sequence. * @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout. * @returns {Observable} An observable sequence with the elements skipped during the specified duration from the start of the source sequence. */ observableProto.skipWithTime = function (duration, scheduler) { var source = this; isScheduler(scheduler) || (scheduler = timeoutScheduler); return new AnonymousObservable(function (observer) { var open = false; return new CompositeDisposable( scheduler.scheduleWithRelative(duration, function () { open = true; }), source.subscribe(function (x) { open && observer.onNext(x); }, observer.onError.bind(observer), observer.onCompleted.bind(observer))); }, source); }; /** * Skips elements from the observable source sequence until the specified start time, using the specified scheduler to run timers. * Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the start time. * * @examples * 1 - res = source.skipUntilWithTime(new Date(), [scheduler]); * 2 - res = source.skipUntilWithTime(5000, [scheduler]); * @param {Date|Number} startTime Time to start taking elements from the source sequence. If this value is less than or equal to Date(), no elements will be skipped. * @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout. * @returns {Observable} An observable sequence with the elements skipped until the specified start time. */ observableProto.skipUntilWithTime = function (startTime, scheduler) { isScheduler(scheduler) || (scheduler = timeoutScheduler); var source = this, schedulerMethod = startTime instanceof Date ? 'scheduleWithAbsolute' : 'scheduleWithRelative'; return new AnonymousObservable(function (o) { var open = false; return new CompositeDisposable( scheduler[schedulerMethod](startTime, function () { open = true; }), source.subscribe( function (x) { open && o.onNext(x); }, function (e) { o.onError(e); }, function () { o.onCompleted(); })); }, source); }; /** * Takes elements for the specified duration until the specified end time, using the specified scheduler to run timers. * @param {Number | Date} endTime Time to stop taking elements from the source sequence. If this value is less than or equal to new Date(), the result stream will complete immediately. * @param {Scheduler} [scheduler] Scheduler to run the timer on. * @returns {Observable} An observable sequence with the elements taken until the specified end time. */ observableProto.takeUntilWithTime = function (endTime, scheduler) { isScheduler(scheduler) || (scheduler = timeoutScheduler); var source = this, schedulerMethod = endTime instanceof Date ? 'scheduleWithAbsolute' : 'scheduleWithRelative'; return new AnonymousObservable(function (o) { return new CompositeDisposable( scheduler[schedulerMethod](endTime, function () { o.onCompleted(); }), source.subscribe(o)); }, source); }; /** * Returns an Observable that emits only the first item emitted by the source Observable during sequential time windows of a specified duration. * @param {Number} windowDuration time to wait before emitting another item after emitting the last item * @param {Scheduler} [scheduler] the Scheduler to use internally to manage the timers that handle timeout for each item. If not provided, defaults to Scheduler.timeout. * @returns {Observable} An Observable that performs the throttle operation. */ observableProto.throttleFirst = function (windowDuration, scheduler) { isScheduler(scheduler) || (scheduler = timeoutScheduler); var duration = +windowDuration || 0; if (duration <= 0) { throw new RangeError('windowDuration cannot be less or equal zero.'); } var source = this; return new AnonymousObservable(function (o) { var lastOnNext = 0; return source.subscribe( function (x) { var now = scheduler.now(); if (lastOnNext === 0 || now - lastOnNext >= duration) { lastOnNext = now; o.onNext(x); } },function (e) { o.onError(e); }, function () { o.onCompleted(); } ); }, source); }; /** * Executes a transducer to transform the observable sequence * @param {Transducer} transducer A transducer to execute * @returns {Observable} An Observable sequence containing the results from the transducer. */ observableProto.transduce = function(transducer) { var source = this; function transformForObserver(o) { return { '@@transducer/init': function() { return o; }, '@@transducer/step': function(obs, input) { return obs.onNext(input); }, '@@transducer/result': function(obs) { return obs.onCompleted(); } }; } return new AnonymousObservable(function(o) { var xform = transducer(transformForObserver(o)); return source.subscribe( function(v) { var res = tryCatch(xform['@@transducer/step']).call(xform, o, v); if (res === errorObj) { o.onError(res.e); } }, function (e) { o.onError(e); }, function() { xform['@@transducer/result'](o); } ); }, source); }; /** * Performs a exclusive waiting for the first to finish before subscribing to another observable. * Observables that come in between subscriptions will be dropped on the floor. * @returns {Observable} A exclusive observable with only the results that happen when subscribed. */ observableProto.switchFirst = function () { var sources = this; return new AnonymousObservable(function (o) { var hasCurrent = false, isStopped = false, m = new SingleAssignmentDisposable(), g = new CompositeDisposable(); g.add(m); m.setDisposable(sources.subscribe( function (innerSource) { if (!hasCurrent) { hasCurrent = true; isPromise(innerSource) && (innerSource = observableFromPromise(innerSource)); var innerSubscription = new SingleAssignmentDisposable(); g.add(innerSubscription); innerSubscription.setDisposable(innerSource.subscribe( function (x) { o.onNext(x); }, function (e) { o.onError(e); }, function () { g.remove(innerSubscription); hasCurrent = false; isStopped && g.length === 1 && o.onCompleted(); })); } }, function (e) { o.onError(e); }, function () { isStopped = true; !hasCurrent && g.length === 1 && o.onCompleted(); })); return g; }, this); }; observableProto.flatMapFirst = observableProto.selectManyFirst = function(selector, resultSelector, thisArg) { return new FlatMapObservable(this, selector, resultSelector, thisArg).switchFirst(); }; Rx.Observable.prototype.flatMapWithMaxConcurrent = function(limit, selector, resultSelector, thisArg) { return new FlatMapObservable(this, selector, resultSelector, thisArg).merge(limit); }; /** Provides a set of extension methods for virtual time scheduling. */ var VirtualTimeScheduler = Rx.VirtualTimeScheduler = (function (__super__) { function localNow() { return this.toDateTimeOffset(this.clock); } function scheduleNow(state, action) { return this.scheduleAbsoluteWithState(state, this.clock, action); } function scheduleRelative(state, dueTime, action) { return this.scheduleRelativeWithState(state, this.toRelative(dueTime), action); } function scheduleAbsolute(state, dueTime, action) { return this.scheduleRelativeWithState(state, this.toRelative(dueTime - this.now()), action); } function invokeAction(scheduler, action) { action(); return disposableEmpty; } inherits(VirtualTimeScheduler, __super__); /** * Creates a new virtual time scheduler with the specified initial clock value and absolute time comparer. * * @constructor * @param {Number} initialClock Initial value for the clock. * @param {Function} comparer Comparer to determine causality of events based on absolute time. */ function VirtualTimeScheduler(initialClock, comparer) { this.clock = initialClock; this.comparer = comparer; this.isEnabled = false; this.queue = new PriorityQueue(1024); __super__.call(this, localNow, scheduleNow, scheduleRelative, scheduleAbsolute); } var VirtualTimeSchedulerPrototype = VirtualTimeScheduler.prototype; /** * Adds a relative time value to an absolute time value. * @param {Number} absolute Absolute virtual time value. * @param {Number} relative Relative virtual time value to add. * @return {Number} Resulting absolute virtual time sum value. */ VirtualTimeSchedulerPrototype.add = notImplemented; /** * Converts an absolute time to a number * @param {Any} The absolute time. * @returns {Number} The absolute time in ms */ VirtualTimeSchedulerPrototype.toDateTimeOffset = notImplemented; /** * Converts the TimeSpan value to a relative virtual time value. * @param {Number} timeSpan TimeSpan value to convert. * @return {Number} Corresponding relative virtual time value. */ VirtualTimeSchedulerPrototype.toRelative = notImplemented; /** * Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be emulated using recursive scheduling. * @param {Mixed} state Initial state passed to the action upon the first iteration. * @param {Number} period Period for running the work periodically. * @param {Function} action Action to be executed, potentially updating the state. * @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort). */ VirtualTimeSchedulerPrototype.schedulePeriodicWithState = function (state, period, action) { var s = new SchedulePeriodicRecursive(this, state, period, action); return s.start(); }; /** * Schedules an action to be executed after dueTime. * @param {Mixed} state State passed to the action to be executed. * @param {Number} dueTime Relative time after which to execute the action. * @param {Function} action Action to be executed. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ VirtualTimeSchedulerPrototype.scheduleRelativeWithState = function (state, dueTime, action) { var runAt = this.add(this.clock, dueTime); return this.scheduleAbsoluteWithState(state, runAt, action); }; /** * Schedules an action to be executed at dueTime. * @param {Number} dueTime Relative time after which to execute the action. * @param {Function} action Action to be executed. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ VirtualTimeSchedulerPrototype.scheduleRelative = function (dueTime, action) { return this.scheduleRelativeWithState(action, dueTime, invokeAction); }; /** * Starts the virtual time scheduler. */ VirtualTimeSchedulerPrototype.start = function () { if (!this.isEnabled) { this.isEnabled = true; do { var next = this.getNext(); if (next !== null) { this.comparer(next.dueTime, this.clock) > 0 && (this.clock = next.dueTime); next.invoke(); } else { this.isEnabled = false; } } while (this.isEnabled); } }; /** * Stops the virtual time scheduler. */ VirtualTimeSchedulerPrototype.stop = function () { this.isEnabled = false; }; /** * Advances the scheduler's clock to the specified time, running all work till that point. * @param {Number} time Absolute time to advance the scheduler's clock to. */ VirtualTimeSchedulerPrototype.advanceTo = function (time) { var dueToClock = this.comparer(this.clock, time); if (this.comparer(this.clock, time) > 0) { throw new ArgumentOutOfRangeError(); } if (dueToClock === 0) { return; } if (!this.isEnabled) { this.isEnabled = true; do { var next = this.getNext(); if (next !== null && this.comparer(next.dueTime, time) <= 0) { this.comparer(next.dueTime, this.clock) > 0 && (this.clock = next.dueTime); next.invoke(); } else { this.isEnabled = false; } } while (this.isEnabled); this.clock = time; } }; /** * Advances the scheduler's clock by the specified relative time, running all work scheduled for that timespan. * @param {Number} time Relative time to advance the scheduler's clock by. */ VirtualTimeSchedulerPrototype.advanceBy = function (time) { var dt = this.add(this.clock, time), dueToClock = this.comparer(this.clock, dt); if (dueToClock > 0) { throw new ArgumentOutOfRangeError(); } if (dueToClock === 0) { return; } this.advanceTo(dt); }; /** * Advances the scheduler's clock by the specified relative time. * @param {Number} time Relative time to advance the scheduler's clock by. */ VirtualTimeSchedulerPrototype.sleep = function (time) { var dt = this.add(this.clock, time); if (this.comparer(this.clock, dt) >= 0) { throw new ArgumentOutOfRangeError(); } this.clock = dt; }; /** * Gets the next scheduled item to be executed. * @returns {ScheduledItem} The next scheduled item. */ VirtualTimeSchedulerPrototype.getNext = function () { while (this.queue.length > 0) { var next = this.queue.peek(); if (next.isCancelled()) { this.queue.dequeue(); } else { return next; } } return null; }; /** * Schedules an action to be executed at dueTime. * @param {Scheduler} scheduler Scheduler to execute the action on. * @param {Number} dueTime Absolute time at which to execute the action. * @param {Function} action Action to be executed. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ VirtualTimeSchedulerPrototype.scheduleAbsolute = function (dueTime, action) { return this.scheduleAbsoluteWithState(action, dueTime, invokeAction); }; /** * Schedules an action to be executed at dueTime. * @param {Mixed} state State passed to the action to be executed. * @param {Number} dueTime Absolute time at which to execute the action. * @param {Function} action Action to be executed. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ VirtualTimeSchedulerPrototype.scheduleAbsoluteWithState = function (state, dueTime, action) { var self = this; function run(scheduler, state1) { self.queue.remove(si); return action(scheduler, state1); } var si = new ScheduledItem(this, state, run, dueTime, this.comparer); this.queue.enqueue(si); return si.disposable; }; return VirtualTimeScheduler; }(Scheduler)); /** Provides a virtual time scheduler that uses Date for absolute time and number for relative time. */ Rx.HistoricalScheduler = (function (__super__) { inherits(HistoricalScheduler, __super__); /** * Creates a new historical scheduler with the specified initial clock value. * @constructor * @param {Number} initialClock Initial value for the clock. * @param {Function} comparer Comparer to determine causality of events based on absolute time. */ function HistoricalScheduler(initialClock, comparer) { var clock = initialClock == null ? 0 : initialClock; var cmp = comparer || defaultSubComparer; __super__.call(this, clock, cmp); } var HistoricalSchedulerProto = HistoricalScheduler.prototype; /** * Adds a relative time value to an absolute time value. * @param {Number} absolute Absolute virtual time value. * @param {Number} relative Relative virtual time value to add. * @return {Number} Resulting absolute virtual time sum value. */ HistoricalSchedulerProto.add = function (absolute, relative) { return absolute + relative; }; HistoricalSchedulerProto.toDateTimeOffset = function (absolute) { return new Date(absolute).getTime(); }; /** * Converts the TimeSpan value to a relative virtual time value. * @memberOf HistoricalScheduler * @param {Number} timeSpan TimeSpan value to convert. * @return {Number} Corresponding relative virtual time value. */ HistoricalSchedulerProto.toRelative = function (timeSpan) { return timeSpan; }; return HistoricalScheduler; }(Rx.VirtualTimeScheduler)); var AnonymousObservable = Rx.AnonymousObservable = (function (__super__) { inherits(AnonymousObservable, __super__); // Fix subscriber to check for undefined or function returned to decorate as Disposable function fixSubscriber(subscriber) { return subscriber && isFunction(subscriber.dispose) ? subscriber : isFunction(subscriber) ? disposableCreate(subscriber) : disposableEmpty; } function setDisposable(s, state) { var ado = state[0], self = state[1]; var sub = tryCatch(self.__subscribe).call(self, ado); if (sub === errorObj) { if(!ado.fail(errorObj.e)) { return thrower(errorObj.e); } } ado.setDisposable(fixSubscriber(sub)); } function innerSubscribe(observer) { var ado = new AutoDetachObserver(observer), state = [ado, this]; if (currentThreadScheduler.scheduleRequired()) { currentThreadScheduler.scheduleWithState(state, setDisposable); } else { setDisposable(null, state); } return ado; } function AnonymousObservable(subscribe, parent) { this.source = parent; this.__subscribe = subscribe; __super__.call(this, innerSubscribe); } return AnonymousObservable; }(Observable)); var AutoDetachObserver = (function (__super__) { inherits(AutoDetachObserver, __super__); function AutoDetachObserver(observer) { __super__.call(this); this.observer = observer; this.m = new SingleAssignmentDisposable(); } var AutoDetachObserverPrototype = AutoDetachObserver.prototype; AutoDetachObserverPrototype.next = function (value) { var result = tryCatch(this.observer.onNext).call(this.observer, value); if (result === errorObj) { this.dispose(); thrower(result.e); } }; AutoDetachObserverPrototype.error = function (err) { var result = tryCatch(this.observer.onError).call(this.observer, err); this.dispose(); result === errorObj && thrower(result.e); }; AutoDetachObserverPrototype.completed = function () { var result = tryCatch(this.observer.onCompleted).call(this.observer); this.dispose(); result === errorObj && thrower(result.e); }; AutoDetachObserverPrototype.setDisposable = function (value) { this.m.setDisposable(value); }; AutoDetachObserverPrototype.getDisposable = function () { return this.m.getDisposable(); }; AutoDetachObserverPrototype.dispose = function () { __super__.prototype.dispose.call(this); this.m.dispose(); }; return AutoDetachObserver; }(AbstractObserver)); var GroupedObservable = (function (__super__) { inherits(GroupedObservable, __super__); function subscribe(observer) { return this.underlyingObservable.subscribe(observer); } function GroupedObservable(key, underlyingObservable, mergedDisposable) { __super__.call(this, subscribe); this.key = key; this.underlyingObservable = !mergedDisposable ? underlyingObservable : new AnonymousObservable(function (observer) { return new CompositeDisposable(mergedDisposable.getDisposable(), underlyingObservable.subscribe(observer)); }); } return GroupedObservable; }(Observable)); /** * Represents an object that is both an observable sequence as well as an observer. * Each notification is broadcasted to all subscribed observers. */ var Subject = Rx.Subject = (function (__super__) { function subscribe(observer) { checkDisposed(this); if (!this.isStopped) { this.observers.push(observer); return new InnerSubscription(this, observer); } if (this.hasError) { observer.onError(this.error); return disposableEmpty; } observer.onCompleted(); return disposableEmpty; } inherits(Subject, __super__); /** * Creates a subject. */ function Subject() { __super__.call(this, subscribe); this.isDisposed = false, this.isStopped = false, this.observers = []; this.hasError = false; } addProperties(Subject.prototype, Observer.prototype, { /** * Indicates whether the subject has observers subscribed to it. * @returns {Boolean} Indicates whether the subject has observers subscribed to it. */ hasObservers: function () { return this.observers.length > 0; }, /** * Notifies all subscribed observers about the end of the sequence. */ onCompleted: function () { checkDisposed(this); if (!this.isStopped) { this.isStopped = true; for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) { os[i].onCompleted(); } this.observers.length = 0; } }, /** * Notifies all subscribed observers about the exception. * @param {Mixed} error The exception to send to all observers. */ onError: function (error) { checkDisposed(this); if (!this.isStopped) { this.isStopped = true; this.error = error; this.hasError = true; for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) { os[i].onError(error); } this.observers.length = 0; } }, /** * Notifies all subscribed observers about the arrival of the specified element in the sequence. * @param {Mixed} value The value to send to all observers. */ onNext: function (value) { checkDisposed(this); if (!this.isStopped) { for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) { os[i].onNext(value); } } }, /** * Unsubscribe all observers and release resources. */ dispose: function () { this.isDisposed = true; this.observers = null; } }); /** * Creates a subject from the specified observer and observable. * @param {Observer} observer The observer used to send messages to the subject. * @param {Observable} observable The observable used to subscribe to messages sent from the subject. * @returns {Subject} Subject implemented using the given observer and observable. */ Subject.create = function (observer, observable) { return new AnonymousSubject(observer, observable); }; return Subject; }(Observable)); /** * Represents the result of an asynchronous operation. * The last value before the OnCompleted notification, or the error received through OnError, is sent to all subscribed observers. */ var AsyncSubject = Rx.AsyncSubject = (function (__super__) { function subscribe(observer) { checkDisposed(this); if (!this.isStopped) { this.observers.push(observer); return new InnerSubscription(this, observer); } if (this.hasError) { observer.onError(this.error); } else if (this.hasValue) { observer.onNext(this.value); observer.onCompleted(); } else { observer.onCompleted(); } return disposableEmpty; } inherits(AsyncSubject, __super__); /** * Creates a subject that can only receive one value and that value is cached for all future observations. * @constructor */ function AsyncSubject() { __super__.call(this, subscribe); this.isDisposed = false; this.isStopped = false; this.hasValue = false; this.observers = []; this.hasError = false; } addProperties(AsyncSubject.prototype, Observer, { /** * Indicates whether the subject has observers subscribed to it. * @returns {Boolean} Indicates whether the subject has observers subscribed to it. */ hasObservers: function () { checkDisposed(this); return this.observers.length > 0; }, /** * Notifies all subscribed observers about the end of the sequence, also causing the last received value to be sent out (if any). */ onCompleted: function () { var i, len; checkDisposed(this); if (!this.isStopped) { this.isStopped = true; var os = cloneArray(this.observers), len = os.length; if (this.hasValue) { for (i = 0; i < len; i++) { var o = os[i]; o.onNext(this.value); o.onCompleted(); } } else { for (i = 0; i < len; i++) { os[i].onCompleted(); } } this.observers.length = 0; } }, /** * Notifies all subscribed observers about the error. * @param {Mixed} error The Error to send to all observers. */ onError: function (error) { checkDisposed(this); if (!this.isStopped) { this.isStopped = true; this.hasError = true; this.error = error; for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) { os[i].onError(error); } this.observers.length = 0; } }, /** * Sends a value to the subject. The last value received before successful termination will be sent to all subscribed and future observers. * @param {Mixed} value The value to store in the subject. */ onNext: function (value) { checkDisposed(this); if (this.isStopped) { return; } this.value = value; this.hasValue = true; }, /** * Unsubscribe all observers and release resources. */ dispose: function () { this.isDisposed = true; this.observers = null; this.exception = null; this.value = null; } }); return AsyncSubject; }(Observable)); var AnonymousSubject = Rx.AnonymousSubject = (function (__super__) { inherits(AnonymousSubject, __super__); function subscribe(observer) { return this.observable.subscribe(observer); } function AnonymousSubject(observer, observable) { this.observer = observer; this.observable = observable; __super__.call(this, subscribe); } addProperties(AnonymousSubject.prototype, Observer.prototype, { onCompleted: function () { this.observer.onCompleted(); }, onError: function (error) { this.observer.onError(error); }, onNext: function (value) { this.observer.onNext(value); } }); return AnonymousSubject; }(Observable)); /** * Used to pause and resume streams. */ Rx.Pauser = (function (__super__) { inherits(Pauser, __super__); function Pauser() { __super__.call(this); } /** * Pauses the underlying sequence. */ Pauser.prototype.pause = function () { this.onNext(false); }; /** * Resumes the underlying sequence. */ Pauser.prototype.resume = function () { this.onNext(true); }; return Pauser; }(Subject)); if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { root.Rx = Rx; define(function() { return Rx; }); } else if (freeExports && freeModule) { // in Node.js or RingoJS if (moduleExports) { (freeModule.exports = Rx).Rx = Rx; } else { freeExports.Rx = Rx; } } else { // in a browser or Rhino root.Rx = Rx; } // All code before this point will be filtered from stack traces. var rEndingLine = captureLine(); }.call(this)); }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"_process":5}],3:[function(require,module,exports){ /*! * Cross-Browser Split 1.1.1 * Copyright 2007-2012 Steven Levithan <stevenlevithan.com> * Available under the MIT License * ECMAScript compliant, uniform cross-browser split method */ /** * Splits a string into an array of strings using a regex or string separator. Matches of the * separator are not included in the result array. However, if `separator` is a regex that contains * capturing groups, backreferences are spliced into the result each time `separator` is matched. * Fixes browser bugs compared to the native `String.prototype.split` and can be used reliably * cross-browser. * @param {String} str String to split. * @param {RegExp|String} separator Regex or string to use for separating the string. * @param {Number} [limit] Maximum number of items to include in the result array. * @returns {Array} Array of substrings. * @example * * // Basic use * split('a b c d', ' '); * // -> ['a', 'b', 'c', 'd'] * * // With limit * split('a b c d', ' ', 2); * // -> ['a', 'b'] * * // Backreferences in result array * split('..word1 word2..', /([a-z]+)(\d+)/i); * // -> ['..', 'word', '1', ' ', 'word', '2', '..'] */ module.exports = (function split(undef) { var nativeSplit = String.prototype.split, compliantExecNpcg = /()??/.exec("")[1] === undef, // NPCG: nonparticipating capturing group self; self = function(str, separator, limit) { // If `separator` is not a regex, use `nativeSplit` if (Object.prototype.toString.call(separator) !== "[object RegExp]") { return nativeSplit.call(str, separator, limit); } var output = [], flags = (separator.ignoreCase ? "i" : "") + (separator.multiline ? "m" : "") + (separator.extended ? "x" : "") + // Proposed for ES6 (separator.sticky ? "y" : ""), // Firefox 3+ lastLastIndex = 0, // Make `global` and avoid `lastIndex` issues by working with a copy separator = new RegExp(separator.source, flags + "g"), separator2, match, lastIndex, lastLength; str += ""; // Type-convert if (!compliantExecNpcg) { // Doesn't need flags gy, but they don't hurt separator2 = new RegExp("^" + separator.source + "$(?!\\s)", flags); } /* Values for `limit`, per the spec: * If undefined: 4294967295 // Math.pow(2, 32) - 1 * If 0, Infinity, or NaN: 0 * If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296; * If negative number: 4294967296 - Math.floor(Math.abs(limit)) * If other: Type-convert, then use the above rules */ limit = limit === undef ? -1 >>> 0 : // Math.pow(2, 32) - 1 limit >>> 0; // ToUint32(limit) while (match = separator.exec(str)) { // `separator.lastIndex` is not reliable cross-browser lastIndex = match.index + match[0].length; if (lastIndex > lastLastIndex) { output.push(str.slice(lastLastIndex, match.index)); // Fix browsers whose `exec` methods don't consistently return `undefined` for // nonparticipating capturing groups if (!compliantExecNpcg && match.length > 1) { match[0].replace(separator2, function() { for (var i = 1; i < arguments.length - 2; i++) { if (arguments[i] === undef) { match[i] = undef; } } }); } if (match.length > 1 && match.index < str.length) { Array.prototype.push.apply(output, match.slice(1)); } lastLength = match[0].length; lastLastIndex = lastIndex; if (output.length >= limit) { break; } } if (separator.lastIndex === match.index) { separator.lastIndex++; // Avoid an infinite loop } } if (lastLastIndex === str.length) { if (lastLength || !separator.test("")) { output.push(""); } } else { output.push(str.slice(lastLastIndex)); } return output.length > limit ? output.slice(0, limit) : output; }; return self; })(); },{}],4:[function(require,module,exports){ },{}],5:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; var queue = []; var draining = false; var currentQueue; var queueIndex = -1; function cleanUpNextTick() { draining = false; if (currentQueue.length) { queue = currentQueue.concat(queue); } else { queueIndex = -1; } if (queue.length) { drainQueue(); } } function drainQueue() { if (draining) { return; } var timeout = setTimeout(cleanUpNextTick); draining = true; var len = queue.length; while(len) { currentQueue = queue; queue = []; while (++queueIndex < len) { currentQueue[queueIndex].run(); } queueIndex = -1; len = queue.length; } currentQueue = null; draining = false; clearTimeout(timeout); } process.nextTick = function (fun) { var args = new Array(arguments.length - 1); if (arguments.length > 1) { for (var i = 1; i < arguments.length; i++) { args[i - 1] = arguments[i]; } } queue.push(new Item(fun, args)); if (queue.length === 1 && !draining) { setTimeout(drainQueue, 0); } }; // v8 likes predictible objects function Item(fun, array) { this.fun = fun; this.array = array; } Item.prototype.run = function () { this.fun.apply(null, this.array); }; process.title = 'browser'; process.browser = true; process.env = {}; process.argv = []; process.version = ''; // empty string to avoid regexp issues process.versions = {}; function noop() {} process.on = noop; process.addListener = noop; process.once = noop; process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; process.binding = function (name) { throw new Error('process.binding is not supported'); }; // TODO(shtylman) process.cwd = function () { return '/' }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; process.umask = function() { return 0; }; },{}],6:[function(require,module,exports){ 'use strict'; module.exports = require('./is-implemented')() ? Map : require('./polyfill'); },{"./is-implemented":7,"./polyfill":60}],7:[function(require,module,exports){ 'use strict'; module.exports = function () { var map, iterator, result; if (typeof Map !== 'function') return false; try { // WebKit doesn't support arguments and crashes map = new Map([['raz', 'one'], ['dwa', 'two'], ['trzy', 'three']]); } catch (e) { return false; } if (map.size !== 3) return false; if (typeof map.clear !== 'function') return false; if (typeof map.delete !== 'function') return false; if (typeof map.entries !== 'function') return false; if (typeof map.forEach !== 'function') return false; if (typeof map.get !== 'function') return false; if (typeof map.has !== 'function') return false; if (typeof map.keys !== 'function') return false; if (typeof map.set !== 'function') return false; if (typeof map.values !== 'function') return false; iterator = map.entries(); result = iterator.next(); if (result.done !== false) return false; if (!result.value) return false; if (result.value[0] !== 'raz') return false; if (result.value[1] !== 'one') return false; return true; }; },{}],8:[function(require,module,exports){ // Exports true if environment provides native `Map` implementation, // whatever that is. 'use strict'; module.exports = (function () { if (typeof Map === 'undefined') return false; return (Object.prototype.toString.call(Map.prototype) === '[object Map]'); }()); },{}],9:[function(require,module,exports){ 'use strict'; module.exports = require('es5-ext/object/primitive-set')('key', 'value', 'key+value'); },{"es5-ext/object/primitive-set":34}],10:[function(require,module,exports){ 'use strict'; var setPrototypeOf = require('es5-ext/object/set-prototype-of') , d = require('d') , Iterator = require('es6-iterator') , toStringTagSymbol = require('es6-symbol').toStringTag , kinds = require('./iterator-kinds') , defineProperties = Object.defineProperties , unBind = Iterator.prototype._unBind , MapIterator; MapIterator = module.exports = function (map, kind) { if (!(this instanceof MapIterator)) return new MapIterator(map, kind); Iterator.call(this, map.__mapKeysData__, map); if (!kind || !kinds[kind]) kind = 'key+value'; defineProperties(this, { __kind__: d('', kind), __values__: d('w', map.__mapValuesData__) }); }; if (setPrototypeOf) setPrototypeOf(MapIterator, Iterator); MapIterator.prototype = Object.create(Iterator.prototype, { constructor: d(MapIterator), _resolve: d(function (i) { if (this.__kind__ === 'value') return this.__values__[i]; if (this.__kind__ === 'key') return this.__list__[i]; return [this.__list__[i], this.__values__[i]]; }), _unBind: d(function () { this.__values__ = null; unBind.call(this); }), toString: d(function () { return '[object Map Iterator]'; }) }); Object.defineProperty(MapIterator.prototype, toStringTagSymbol, d('c', 'Map Iterator')); },{"./iterator-kinds":9,"d":12,"es5-ext/object/set-prototype-of":35,"es6-iterator":47,"es6-symbol":56}],11:[function(require,module,exports){ 'use strict'; var copy = require('es5-ext/object/copy') , map = require('es5-ext/object/map') , callable = require('es5-ext/object/valid-callable') , validValue = require('es5-ext/object/valid-value') , bind = Function.prototype.bind, defineProperty = Object.defineProperty , hasOwnProperty = Object.prototype.hasOwnProperty , define; define = function (name, desc, bindTo) { var value = validValue(desc) && callable(desc.value), dgs; dgs = copy(desc); delete dgs.writable; delete dgs.value; dgs.get = function () { if (hasOwnProperty.call(this, name)) return value; desc.value = bind.call(value, (bindTo == null) ? this : this[bindTo]); defineProperty(this, name, desc); return this[name]; }; return dgs; }; module.exports = function (props/*, bindTo*/) { var bindTo = arguments[1]; return map(props, function (desc, name) { return define(name, desc, bindTo); }); }; },{"es5-ext/object/copy":24,"es5-ext/object/map":32,"es5-ext/object/valid-callable":38,"es5-ext/object/valid-value":39}],12:[function(require,module,exports){ 'use strict'; var assign = require('es5-ext/object/assign') , normalizeOpts = require('es5-ext/object/normalize-options') , isCallable = require('es5-ext/object/is-callable') , contains = require('es5-ext/string/#/contains') , d; d = module.exports = function (dscr, value/*, options*/) { var c, e, w, options, desc; if ((arguments.length < 2) || (typeof dscr !== 'string')) { options = value; value = dscr; dscr = null; } else { options = arguments[2]; } if (dscr == null) { c = w = true; e = false; } else { c = contains.call(dscr, 'c'); e = contains.call(dscr, 'e'); w = contains.call(dscr, 'w'); } desc = { value: value, configurable: c, enumerable: e, writable: w }; return !options ? desc : assign(normalizeOpts(options), desc); }; d.gs = function (dscr, get, set/*, options*/) { var c, e, options, desc; if (typeof dscr !== 'string') { options = set; set = get; get = dscr; dscr = null; } else { options = arguments[3]; } if (get == null) { get = undefined; } else if (!isCallable(get)) { options = get; get = set = undefined; } else if (set == null) { set = undefined; } else if (!isCallable(set)) { options = set; set = undefined; } if (dscr == null) { c = true; e = false; } else { c = contains.call(dscr, 'c'); e = contains.call(dscr, 'e'); } desc = { get: get, set: set, configurable: c, enumerable: e }; return !options ? desc : assign(normalizeOpts(options), desc); }; },{"es5-ext/object/assign":21,"es5-ext/object/is-callable":27,"es5-ext/object/normalize-options":33,"es5-ext/string/#/contains":40}],13:[function(require,module,exports){ // Inspired by Google Closure: // http://closure-library.googlecode.com/svn/docs/ // closure_goog_array_array.js.html#goog.array.clear 'use strict'; var value = require('../../object/valid-value'); module.exports = function () { value(this).length = 0; return this; }; },{"../../object/valid-value":39}],14:[function(require,module,exports){ 'use strict'; var toPosInt = require('../../number/to-pos-integer') , value = require('../../object/valid-value') , indexOf = Array.prototype.indexOf , hasOwnProperty = Object.prototype.hasOwnProperty , abs = Math.abs, floor = Math.floor; module.exports = function (searchElement/*, fromIndex*/) { var i, l, fromIndex, val; if (searchElement === searchElement) { //jslint: ignore return indexOf.apply(this, arguments); } l = toPosInt(value(this).length); fromIndex = arguments[1]; if (isNaN(fromIndex)) fromIndex = 0; else if (fromIndex >= 0) fromIndex = floor(fromIndex); else fromIndex = toPosInt(this.length) - floor(abs(fromIndex)); for (i = fromIndex; i < l; ++i) { if (hasOwnProperty.call(this, i)) { val = this[i]; if (val !== val) return i; //jslint: ignore } } return -1; }; },{"../../number/to-pos-integer":19,"../../object/valid-value":39}],15:[function(require,module,exports){ 'use strict'; module.exports = require('./is-implemented')() ? Math.sign : require('./shim'); },{"./is-implemented":16,"./shim":17}],16:[function(require,module,exports){ 'use strict'; module.exports = function () { var sign = Math.sign; if (typeof sign !== 'function') return false; return ((sign(10) === 1) && (sign(-20) === -1)); }; },{}],17:[function(require,module,exports){ 'use strict'; module.exports = function (value) { value = Number(value); if (isNaN(value) || (value === 0)) return value; return (value > 0) ? 1 : -1; }; },{}],18:[function(require,module,exports){ 'use strict'; var sign = require('../math/sign') , abs = Math.abs, floor = Math.floor; module.exports = function (value) { if (isNaN(value)) return 0; value = Number(value); if ((value === 0) || !isFinite(value)) return value; return sign(value) * floor(abs(value)); }; },{"../math/sign":15}],19:[function(require,module,exports){ 'use strict'; var toInteger = require('./to-integer') , max = Math.max; module.exports = function (value) { return max(0, toInteger(value)); }; },{"./to-integer":18}],20:[function(require,module,exports){ // Internal method, used by iteration functions. // Calls a function for each key-value pair found in object // Optionally takes compareFn to iterate object in specific order 'use strict'; var isCallable = require('./is-callable') , callable = require('./valid-callable') , value = require('./valid-value') , call = Function.prototype.call, keys = Object.keys , propertyIsEnumerable = Object.prototype.propertyIsEnumerable; module.exports = function (method, defVal) { return function (obj, cb/*, thisArg, compareFn*/) { var list, thisArg = arguments[2], compareFn = arguments[3]; obj = Object(value(obj)); callable(cb); list = keys(obj); if (compareFn) { list.sort(isCallable(compareFn) ? compareFn.bind(obj) : undefined); } return list[method](function (key, index) { if (!propertyIsEnumerable.call(obj, key)) return defVal; return call.call(cb, thisArg, obj[key], key, obj, index); }); }; }; },{"./is-callable":27,"./valid-callable":38,"./valid-value":39}],21:[function(require,module,exports){ 'use strict'; module.exports = require('./is-implemented')() ? Object.assign : require('./shim'); },{"./is-implemented":22,"./shim":23}],22:[function(require,module,exports){ 'use strict'; module.exports = function () { var assign = Object.assign, obj; if (typeof assign !== 'function') return false; obj = { foo: 'raz' }; assign(obj, { bar: 'dwa' }, { trzy: 'trzy' }); return (obj.foo + obj.bar + obj.trzy) === 'razdwatrzy'; }; },{}],23:[function(require,module,exports){ 'use strict'; var keys = require('../keys') , value = require('../valid-value') , max = Math.max; module.exports = function (dest, src/*, …srcn*/) { var error, i, l = max(arguments.length, 2), assign; dest = Object(value(dest)); assign = function (key) { try { dest[key] = src[key]; } catch (e) { if (!error) error = e; } }; for (i = 1; i < l; ++i) { src = arguments[i]; keys(src).forEach(assign); } if (error !== undefined) throw error; return dest; }; },{"../keys":29,"../valid-value":39}],24:[function(require,module,exports){ 'use strict'; var assign = require('./assign') , value = require('./valid-value'); module.exports = function (obj) { var copy = Object(value(obj)); if (copy !== obj) return copy; return assign({}, obj); }; },{"./assign":21,"./valid-value":39}],25:[function(require,module,exports){ // Workaround for http://code.google.com/p/v8/issues/detail?id=2804 'use strict'; var create = Object.create, shim; if (!require('./set-prototype-of/is-implemented')()) { shim = require('./set-prototype-of/shim'); } module.exports = (function () { var nullObject, props, desc; if (!shim) return create; if (shim.level !== 1) return create; nullObject = {}; props = {}; desc = { configurable: false, enumerable: false, writable: true, value: undefined }; Object.getOwnPropertyNames(Object.prototype).forEach(function (name) { if (name === '__proto__') { props[name] = { configurable: true, enumerable: false, writable: true, value: undefined }; return; } props[name] = desc; }); Object.defineProperties(nullObject, props); Object.defineProperty(shim, 'nullPolyfill', { configurable: false, enumerable: false, writable: false, value: nullObject }); return function (prototype, props) { return create((prototype === null) ? nullObject : prototype, props); }; }()); },{"./set-prototype-of/is-implemented":36,"./set-prototype-of/shim":37}],26:[function(require,module,exports){ 'use strict'; module.exports = require('./_iterate')('forEach'); },{"./_iterate":20}],27:[function(require,module,exports){ // Deprecated 'use strict'; module.exports = function (obj) { return typeof obj === 'function'; }; },{}],28:[function(require,module,exports){ 'use strict'; var map = { function: true, object: true }; module.exports = function (x) { return ((x != null) && map[typeof x]) || false; }; },{}],29:[function(require,module,exports){ 'use strict'; module.exports = require('./is-implemented')() ? Object.keys : require('./shim'); },{"./is-implemented":30,"./shim":31}],30:[function(require,module,exports){ 'use strict'; module.exports = function () { try { Object.keys('primitive'); return true; } catch (e) { return false; } }; },{}],31:[function(require,module,exports){ 'use strict'; var keys = Object.keys; module.exports = function (object) { return keys(object == null ? object : Object(object)); }; },{}],32:[function(require,module,exports){ 'use strict'; var callable = require('./valid-callable') , forEach = require('./for-each') , call = Function.prototype.call; module.exports = function (obj, cb/*, thisArg*/) { var o = {}, thisArg = arguments[2]; callable(cb); forEach(obj, function (value, key, obj, index) { o[key] = call.call(cb, thisArg, value, key, obj, index); }); return o; }; },{"./for-each":26,"./valid-callable":38}],33:[function(require,module,exports){ 'use strict'; var forEach = Array.prototype.forEach, create = Object.create; var process = function (src, obj) { var key; for (key in src) obj[key] = src[key]; }; module.exports = function (options/*, …options*/) { var result = create(null); forEach.call(arguments, function (options) { if (options == null) return; process(Object(options), result); }); return result; }; },{}],34:[function(require,module,exports){ 'use strict'; var forEach = Array.prototype.forEach, create = Object.create; module.exports = function (arg/*, …args*/) { var set = create(null); forEach.call(arguments, function (name) { set[name] = true; }); return set; }; },{}],35:[function(require,module,exports){ 'use strict'; module.exports = require('./is-implemented')() ? Object.setPrototypeOf : require('./shim'); },{"./is-implemented":36,"./shim":37}],36:[function(require,module,exports){ 'use strict'; var create = Object.create, getPrototypeOf = Object.getPrototypeOf , x = {}; module.exports = function (/*customCreate*/) { var setPrototypeOf = Object.setPrototypeOf , customCreate = arguments[0] || create; if (typeof setPrototypeOf !== 'function') return false; return getPrototypeOf(setPrototypeOf(customCreate(null), x)) === x; }; },{}],37:[function(require,module,exports){ // Big thanks to @WebReflection for sorting this out // https://gist.github.com/WebReflection/5593554 'use strict'; var isObject = require('../is-object') , value = require('../valid-value') , isPrototypeOf = Object.prototype.isPrototypeOf , defineProperty = Object.defineProperty , nullDesc = { configurable: true, enumerable: false, writable: true, value: undefined } , validate; validate = function (obj, prototype) { value(obj); if ((prototype === null) || isObject(prototype)) return obj; throw new TypeError('Prototype must be null or an object'); }; module.exports = (function (status) { var fn, set; if (!status) return null; if (status.level === 2) { if (status.set) { set = status.set; fn = function (obj, prototype) { set.call(validate(obj, prototype), prototype); return obj; }; } else { fn = function (obj, prototype) { validate(obj, prototype).__proto__ = prototype; return obj; }; } } else { fn = function self(obj, prototype) { var isNullBase; validate(obj, prototype); isNullBase = isPrototypeOf.call(self.nullPolyfill, obj); if (isNullBase) delete self.nullPolyfill.__proto__; if (prototype === null) prototype = self.nullPolyfill; obj.__proto__ = prototype; if (isNullBase) defineProperty(self.nullPolyfill, '__proto__', nullDesc); return obj; }; } return Object.defineProperty(fn, 'level', { configurable: false, enumerable: false, writable: false, value: status.level }); }((function () { var x = Object.create(null), y = {}, set , desc = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__'); if (desc) { try { set = desc.set; // Opera crashes at this point set.call(x, y); } catch (ignore) { } if (Object.getPrototypeOf(x) === y) return { set: set, level: 2 }; } x.__proto__ = y; if (Object.getPrototypeOf(x) === y) return { level: 2 }; x = {}; x.__proto__ = y; if (Object.getPrototypeOf(x) === y) return { level: 1 }; return false; }()))); require('../create'); },{"../create":25,"../is-object":28,"../valid-value":39}],38:[function(require,module,exports){ 'use strict'; module.exports = function (fn) { if (typeof fn !== 'function') throw new TypeError(fn + " is not a function"); return fn; }; },{}],39:[function(require,module,exports){ 'use strict'; module.exports = function (value) { if (value == null) throw new TypeError("Cannot use null or undefined"); return value; }; },{}],40:[function(require,module,exports){ 'use strict'; module.exports = require('./is-implemented')() ? String.prototype.contains : require('./shim'); },{"./is-implemented":41,"./shim":42}],41:[function(require,module,exports){ 'use strict'; var str = 'razdwatrzy'; module.exports = function () { if (typeof str.contains !== 'function') return false; return ((str.contains('dwa') === true) && (str.contains('foo') === false)); }; },{}],42:[function(require,module,exports){ 'use strict'; var indexOf = String.prototype.indexOf; module.exports = function (searchString/*, position*/) { return indexOf.call(this, searchString, arguments[1]) > -1; }; },{}],43:[function(require,module,exports){ 'use strict'; var toString = Object.prototype.toString , id = toString.call(''); module.exports = function (x) { return (typeof x === 'string') || (x && (typeof x === 'object') && ((x instanceof String) || (toString.call(x) === id))) || false; }; },{}],44:[function(require,module,exports){ 'use strict'; var setPrototypeOf = require('es5-ext/object/set-prototype-of') , contains = require('es5-ext/string/#/contains') , d = require('d') , Iterator = require('./') , defineProperty = Object.defineProperty , ArrayIterator; ArrayIterator = module.exports = function (arr, kind) { if (!(this instanceof ArrayIterator)) return new ArrayIterator(arr, kind); Iterator.call(this, arr); if (!kind) kind = 'value'; else if (contains.call(kind, 'key+value')) kind = 'key+value'; else if (contains.call(kind, 'key')) kind = 'key'; else kind = 'value'; defineProperty(this, '__kind__', d('', kind)); }; if (setPrototypeOf) setPrototypeOf(ArrayIterator, Iterator); ArrayIterator.prototype = Object.create(Iterator.prototype, { constructor: d(ArrayIterator), _resolve: d(function (i) { if (this.__kind__ === 'value') return this.__list__[i]; if (this.__kind__ === 'key+value') return [i, this.__list__[i]]; return i; }), toString: d(function () { return '[object Array Iterator]'; }) }); },{"./":47,"d":12,"es5-ext/object/set-prototype-of":35,"es5-ext/string/#/contains":40}],45:[function(require,module,exports){ 'use strict'; var callable = require('es5-ext/object/valid-callable') , isString = require('es5-ext/string/is-string') , get = require('./get') , isArray = Array.isArray, call = Function.prototype.call; module.exports = function (iterable, cb/*, thisArg*/) { var mode, thisArg = arguments[2], result, doBreak, broken, i, l, char, code; if (isArray(iterable)) mode = 'array'; else if (isString(iterable)) mode = 'string'; else iterable = get(iterable); callable(cb); doBreak = function () { broken = true; }; if (mode === 'array') { iterable.some(function (value) { call.call(cb, thisArg, value, doBreak); if (broken) return true; }); return; } if (mode === 'string') { l = iterable.length; for (i = 0; i < l; ++i) { char = iterable[i]; if ((i + 1) < l) { code = char.charCodeAt(0); if ((code >= 0xD800) && (code <= 0xDBFF)) char += iterable[++i]; } call.call(cb, thisArg, char, doBreak); if (broken) break; } return; } result = iterable.next(); while (!result.done) { call.call(cb, thisArg, result.value, doBreak); if (broken) return; result = iterable.next(); } }; },{"./get":46,"es5-ext/object/valid-callable":38,"es5-ext/string/is-string":43}],46:[function(require,module,exports){ 'use strict'; var isString = require('es5-ext/string/is-string') , ArrayIterator = require('./array') , StringIterator = require('./string') , iterable = require('./valid-iterable') , iteratorSymbol = require('es6-symbol').iterator; module.exports = function (obj) { if (typeof iterable(obj)[iteratorSymbol] === 'function') return obj[iteratorSymbol](); if (isString(obj)) return new StringIterator(obj); return new ArrayIterator(obj); }; },{"./array":44,"./string":54,"./valid-iterable":55,"es5-ext/string/is-string":43,"es6-symbol":49}],47:[function(require,module,exports){ 'use strict'; var clear = require('es5-ext/array/#/clear') , assign = require('es5-ext/object/assign') , callable = require('es5-ext/object/valid-callable') , value = require('es5-ext/object/valid-value') , d = require('d') , autoBind = require('d/auto-bind') , Symbol = require('es6-symbol') , defineProperty = Object.defineProperty , defineProperties = Object.defineProperties , Iterator; module.exports = Iterator = function (list, context) { if (!(this instanceof Iterator)) return new Iterator(list, context); defineProperties(this, { __list__: d('w', value(list)), __context__: d('w', context), __nextIndex__: d('w', 0) }); if (!context) return; callable(context.on); context.on('_add', this._onAdd); context.on('_delete', this._onDelete); context.on('_clear', this._onClear); }; defineProperties(Iterator.prototype, assign({ constructor: d(Iterator), _next: d(function () { var i; if (!this.__list__) return; if (this.__redo__) { i = this.__redo__.shift(); if (i !== undefined) return i; } if (this.__nextIndex__ < this.__list__.length) return this.__nextIndex__++; this._unBind(); }), next: d(function () { return this._createResult(this._next()); }), _createResult: d(function (i) { if (i === undefined) return { done: true, value: undefined }; return { done: false, value: this._resolve(i) }; }), _resolve: d(function (i) { return this.__list__[i]; }), _unBind: d(function () { this.__list__ = null; delete this.__redo__; if (!this.__context__) return; this.__context__.off('_add', this._onAdd); this.__context__.off('_delete', this._onDelete); this.__context__.off('_clear', this._onClear); this.__context__ = null; }), toString: d(function () { return '[object Iterator]'; }) }, autoBind({ _onAdd: d(function (index) { if (index >= this.__nextIndex__) return; ++this.__nextIndex__; if (!this.__redo__) { defineProperty(this, '__redo__', d('c', [index])); return; } this.__redo__.forEach(function (redo, i) { if (redo >= index) this.__redo__[i] = ++redo; }, this); this.__redo__.push(index); }), _onDelete: d(function (index) { var i; if (index >= this.__nextIndex__) return; --this.__nextIndex__; if (!this.__redo__) return; i = this.__redo__.indexOf(index); if (i !== -1) this.__redo__.splice(i, 1); this.__redo__.forEach(function (redo, i) { if (redo > index) this.__redo__[i] = --redo; }, this); }), _onClear: d(function () { if (this.__redo__) clear.call(this.__redo__); this.__nextIndex__ = 0; }) }))); defineProperty(Iterator.prototype, Symbol.iterator, d(function () { return this; })); defineProperty(Iterator.prototype, Symbol.toStringTag, d('', 'Iterator')); },{"d":12,"d/auto-bind":11,"es5-ext/array/#/clear":13,"es5-ext/object/assign":21,"es5-ext/object/valid-callable":38,"es5-ext/object/valid-value":39,"es6-symbol":49}],48:[function(require,module,exports){ 'use strict'; var isString = require('es5-ext/string/is-string') , iteratorSymbol = require('es6-symbol').iterator , isArray = Array.isArray; module.exports = function (value) { if (value == null) return false; if (isArray(value)) return true; if (isString(value)) return true; return (typeof value[iteratorSymbol] === 'function'); }; },{"es5-ext/string/is-string":43,"es6-symbol":49}],49:[function(require,module,exports){ 'use strict'; module.exports = require('./is-implemented')() ? Symbol : require('./polyfill'); },{"./is-implemented":50,"./polyfill":52}],50:[function(require,module,exports){ 'use strict'; module.exports = function () { var symbol; if (typeof Symbol !== 'function') return false; symbol = Symbol('test symbol'); try { String(symbol); } catch (e) { return false; } if (typeof Symbol.iterator === 'symbol') return true; // Return 'true' for polyfills if (typeof Symbol.isConcatSpreadable !== 'object') return false; if (typeof Symbol.iterator !== 'object') return false; if (typeof Symbol.toPrimitive !== 'object') return false; if (typeof Symbol.toStringTag !== 'object') return false; if (typeof Symbol.unscopables !== 'object') return false; return true; }; },{}],51:[function(require,module,exports){ 'use strict'; module.exports = function (x) { return (x && ((typeof x === 'symbol') || (x['@@toStringTag'] === 'Symbol'))) || false; }; },{}],52:[function(require,module,exports){ 'use strict'; var d = require('d') , validateSymbol = require('./validate-symbol') , create = Object.create, defineProperties = Object.defineProperties , defineProperty = Object.defineProperty, objPrototype = Object.prototype , Symbol, HiddenSymbol, globalSymbols = create(null); var generateName = (function () { var created = create(null); return function (desc) { var postfix = 0, name; while (created[desc + (postfix || '')]) ++postfix; desc += (postfix || ''); created[desc] = true; name = '@@' + desc; defineProperty(objPrototype, name, d.gs(null, function (value) { defineProperty(this, name, d(value)); })); return name; }; }()); HiddenSymbol = function Symbol(description) { if (this instanceof HiddenSymbol) throw new TypeError('TypeError: Symbol is not a constructor'); return Symbol(description); }; module.exports = Symbol = function Symbol(description) { var symbol; if (this instanceof Symbol) throw new TypeError('TypeError: Symbol is not a constructor'); symbol = create(HiddenSymbol.prototype); description = (description === undefined ? '' : String(description)); return defineProperties(symbol, { __description__: d('', description), __name__: d('', generateName(description)) }); }; defineProperties(Symbol, { for: d(function (key) { if (globalSymbols[key]) return globalSymbols[key]; return (globalSymbols[key] = Symbol(String(key))); }), keyFor: d(function (s) { var key; validateSymbol(s); for (key in globalSymbols) if (globalSymbols[key] === s) return key; }), hasInstance: d('', Symbol('hasInstance')), isConcatSpreadable: d('', Symbol('isConcatSpreadable')), iterator: d('', Symbol('iterator')), match: d('', Symbol('match')), replace: d('', Symbol('replace')), search: d('', Symbol('search')), species: d('', Symbol('species')), split: d('', Symbol('split')), toPrimitive: d('', Symbol('toPrimitive')), toStringTag: d('', Symbol('toStringTag')), unscopables: d('', Symbol('unscopables')) }); defineProperties(HiddenSymbol.prototype, { constructor: d(Symbol), toString: d('', function () { return this.__name__; }) }); defineProperties(Symbol.prototype, { toString: d(function () { return 'Symbol (' + validateSymbol(this).__description__ + ')'; }), valueOf: d(function () { return validateSymbol(this); }) }); defineProperty(Symbol.prototype, Symbol.toPrimitive, d('', function () { return validateSymbol(this); })); defineProperty(Symbol.prototype, Symbol.toStringTag, d('c', 'Symbol')); defineProperty(HiddenSymbol.prototype, Symbol.toPrimitive, d('c', Symbol.prototype[Symbol.toPrimitive])); defineProperty(HiddenSymbol.prototype, Symbol.toStringTag, d('c', Symbol.prototype[Symbol.toStringTag])); },{"./validate-symbol":53,"d":12}],53:[function(require,module,exports){ 'use strict'; var isSymbol = require('./is-symbol'); module.exports = function (value) { if (!isSymbol(value)) throw new TypeError(value + " is not a symbol"); return value; }; },{"./is-symbol":51}],54:[function(require,module,exports){ // Thanks @mathiasbynens // http://mathiasbynens.be/notes/javascript-unicode#iterating-over-symbols 'use strict'; var setPrototypeOf = require('es5-ext/object/set-prototype-of') , d = require('d') , Iterator = require('./') , defineProperty = Object.defineProperty , StringIterator; StringIterator = module.exports = function (str) { if (!(this instanceof StringIterator)) return new StringIterator(str); str = String(str); Iterator.call(this, str); defineProperty(this, '__length__', d('', str.length)); }; if (setPrototypeOf) setPrototypeOf(StringIterator, Iterator); StringIterator.prototype = Object.create(Iterator.prototype, { constructor: d(StringIterator), _next: d(function () { if (!this.__list__) return; if (this.__nextIndex__ < this.__length__) return this.__nextIndex__++; this._unBind(); }), _resolve: d(function (i) { var char = this.__list__[i], code; if (this.__nextIndex__ === this.__length__) return char; code = char.charCodeAt(0); if ((code >= 0xD800) && (code <= 0xDBFF)) return char + this.__list__[this.__nextIndex__++]; return char; }), toString: d(function () { return '[object String Iterator]'; }) }); },{"./":47,"d":12,"es5-ext/object/set-prototype-of":35}],55:[function(require,module,exports){ 'use strict'; var isIterable = require('./is-iterable'); module.exports = function (value) { if (!isIterable(value)) throw new TypeError(value + " is not iterable"); return value; }; },{"./is-iterable":48}],56:[function(require,module,exports){ arguments[4][49][0].apply(exports,arguments) },{"./is-implemented":57,"./polyfill":58,"dup":49}],57:[function(require,module,exports){ 'use strict'; module.exports = function () { var symbol; if (typeof Symbol !== 'function') return false; symbol = Symbol('test symbol'); try { String(symbol); } catch (e) { return false; } if (typeof Symbol.iterator === 'symbol') return true; // Return 'true' for polyfills if (typeof Symbol.isConcatSpreadable !== 'object') return false; if (typeof Symbol.isRegExp !== 'object') return false; if (typeof Symbol.iterator !== 'object') return false; if (typeof Symbol.toPrimitive !== 'object') return false; if (typeof Symbol.toStringTag !== 'object') return false; if (typeof Symbol.unscopables !== 'object') return false; return true; }; },{}],58:[function(require,module,exports){ 'use strict'; var d = require('d') , create = Object.create, defineProperties = Object.defineProperties , generateName, Symbol; generateName = (function () { var created = create(null); return function (desc) { var postfix = 0; while (created[desc + (postfix || '')]) ++postfix; desc += (postfix || ''); created[desc] = true; return '@@' + desc; }; }()); module.exports = Symbol = function (description) { var symbol; if (this instanceof Symbol) { throw new TypeError('TypeError: Symbol is not a constructor'); } symbol = create(Symbol.prototype); description = (description === undefined ? '' : String(description)); return defineProperties(symbol, { __description__: d('', description), __name__: d('', generateName(description)) }); }; Object.defineProperties(Symbol, { create: d('', Symbol('create')), hasInstance: d('', Symbol('hasInstance')), isConcatSpreadable: d('', Symbol('isConcatSpreadable')), isRegExp: d('', Symbol('isRegExp')), iterator: d('', Symbol('iterator')), toPrimitive: d('', Symbol('toPrimitive')), toStringTag: d('', Symbol('toStringTag')), unscopables: d('', Symbol('unscopables')) }); defineProperties(Symbol.prototype, { properToString: d(function () { return 'Symbol (' + this.__description__ + ')'; }), toString: d('', function () { return this.__name__; }) }); Object.defineProperty(Symbol.prototype, Symbol.toPrimitive, d('', function (hint) { throw new TypeError("Conversion of symbol objects is not allowed"); })); Object.defineProperty(Symbol.prototype, Symbol.toStringTag, d('c', 'Symbol')); },{"d":12}],59:[function(require,module,exports){ 'use strict'; var d = require('d') , callable = require('es5-ext/object/valid-callable') , apply = Function.prototype.apply, call = Function.prototype.call , create = Object.create, defineProperty = Object.defineProperty , defineProperties = Object.defineProperties , hasOwnProperty = Object.prototype.hasOwnProperty , descriptor = { configurable: true, enumerable: false, writable: true } , on, once, off, emit, methods, descriptors, base; on = function (type, listener) { var data; callable(listener); if (!hasOwnProperty.call(this, '__ee__')) { data = descriptor.value = create(null); defineProperty(this, '__ee__', descriptor); descriptor.value = null; } else { data = this.__ee__; } if (!data[type]) data[type] = listener; else if (typeof data[type] === 'object') data[type].push(listener); else data[type] = [data[type], listener]; return this; }; once = function (type, listener) { var once, self; callable(listener); self = this; on.call(this, type, once = function () { off.call(self, type, once); apply.call(listener, this, arguments); }); once.__eeOnceListener__ = listener; return this; }; off = function (type, listener) { var data, listeners, candidate, i; callable(listener); if (!hasOwnProperty.call(this, '__ee__')) return this; data = this.__ee__; if (!data[type]) return this; listeners = data[type]; if (typeof listeners === 'object') { for (i = 0; (candidate = listeners[i]); ++i) { if ((candidate === listener) || (candidate.__eeOnceListener__ === listener)) { if (listeners.length === 2) data[type] = listeners[i ? 0 : 1]; else listeners.splice(i, 1); } } } else { if ((listeners === listener) || (listeners.__eeOnceListener__ === listener)) { delete data[type]; } } return this; }; emit = function (type) { var i, l, listener, listeners, args; if (!hasOwnProperty.call(this, '__ee__')) return; listeners = this.__ee__[type]; if (!listeners) return; if (typeof listeners === 'object') { l = arguments.length; args = new Array(l - 1); for (i = 1; i < l; ++i) args[i - 1] = arguments[i]; listeners = listeners.slice(); for (i = 0; (listener = listeners[i]); ++i) { apply.call(listener, this, args); } } else { switch (arguments.length) { case 1: call.call(listeners, this); break; case 2: call.call(listeners, this, arguments[1]); break; case 3: call.call(listeners, this, arguments[1], arguments[2]); break; default: l = arguments.length; args = new Array(l - 1); for (i = 1; i < l; ++i) { args[i - 1] = arguments[i]; } apply.call(listeners, this, args); } } }; methods = { on: on, once: once, off: off, emit: emit }; descriptors = { on: d(on), once: d(once), off: d(off), emit: d(emit) }; base = defineProperties({}, descriptors); module.exports = exports = function (o) { return (o == null) ? create(base) : defineProperties(Object(o), descriptors); }; exports.methods = methods; },{"d":12,"es5-ext/object/valid-callable":38}],60:[function(require,module,exports){ 'use strict'; var clear = require('es5-ext/array/#/clear') , eIndexOf = require('es5-ext/array/#/e-index-of') , setPrototypeOf = require('es5-ext/object/set-prototype-of') , callable = require('es5-ext/object/valid-callable') , validValue = require('es5-ext/object/valid-value') , d = require('d') , ee = require('event-emitter') , Symbol = require('es6-symbol') , iterator = require('es6-iterator/valid-iterable') , forOf = require('es6-iterator/for-of') , Iterator = require('./lib/iterator') , isNative = require('./is-native-implemented') , call = Function.prototype.call, defineProperties = Object.defineProperties , MapPoly; module.exports = MapPoly = function (/*iterable*/) { var iterable = arguments[0], keys, values; if (!(this instanceof MapPoly)) return new MapPoly(iterable); if (this.__mapKeysData__ !== undefined) { throw new TypeError(this + " cannot be reinitialized"); } if (iterable != null) iterator(iterable); defineProperties(this, { __mapKeysData__: d('c', keys = []), __mapValuesData__: d('c', values = []) }); if (!iterable) return; forOf(iterable, function (value) { var key = validValue(value)[0]; value = value[1]; if (eIndexOf.call(keys, key) !== -1) return; keys.push(key); values.push(value); }, this); }; if (isNative) { if (setPrototypeOf) setPrototypeOf(MapPoly, Map); MapPoly.prototype = Object.create(Map.prototype, { constructor: d(MapPoly) }); } ee(defineProperties(MapPoly.prototype, { clear: d(function () { if (!this.__mapKeysData__.length) return; clear.call(this.__mapKeysData__); clear.call(this.__mapValuesData__); this.emit('_clear'); }), delete: d(function (key) { var index = eIndexOf.call(this.__mapKeysData__, key); if (index === -1) return false; this.__mapKeysData__.splice(index, 1); this.__mapValuesData__.splice(index, 1); this.emit('_delete', index, key); return true; }), entries: d(function () { return new Iterator(this, 'key+value'); }), forEach: d(function (cb/*, thisArg*/) { var thisArg = arguments[1], iterator, result; callable(cb); iterator = this.entries(); result = iterator._next(); while (result !== undefined) { call.call(cb, thisArg, this.__mapValuesData__[result], this.__mapKeysData__[result], this); result = iterator._next(); } }), get: d(function (key) { var index = eIndexOf.call(this.__mapKeysData__, key); if (index === -1) return; return this.__mapValuesData__[index]; }), has: d(function (key) { return (eIndexOf.call(this.__mapKeysData__, key) !== -1); }), keys: d(function () { return new Iterator(this, 'key'); }), set: d(function (key, value) { var index = eIndexOf.call(this.__mapKeysData__, key), emit; if (index === -1) { index = this.__mapKeysData__.push(key) - 1; emit = true; } this.__mapValuesData__[index] = value; if (emit) this.emit('_add', index, key); return this; }), size: d.gs(function () { return this.__mapKeysData__.length; }), values: d(function () { return new Iterator(this, 'value'); }), toString: d(function () { return '[object Map]'; }) })); Object.defineProperty(MapPoly.prototype, Symbol.iterator, d(function () { return this.entries(); })); Object.defineProperty(MapPoly.prototype, Symbol.toStringTag, d('c', 'Map')); },{"./is-native-implemented":8,"./lib/iterator":10,"d":12,"es5-ext/array/#/clear":13,"es5-ext/array/#/e-index-of":14,"es5-ext/object/set-prototype-of":35,"es5-ext/object/valid-callable":38,"es5-ext/object/valid-value":39,"es6-iterator/for-of":45,"es6-iterator/valid-iterable":55,"es6-symbol":56,"event-emitter":59}],61:[function(require,module,exports){ 'use strict'; var OneVersionConstraint = require('individual/one-version'); var MY_VERSION = '7'; OneVersionConstraint('ev-store', MY_VERSION); var hashKey = '__EV_STORE_KEY@' + MY_VERSION; module.exports = EvStore; function EvStore(elem) { var hash = elem[hashKey]; if (!hash) { hash = elem[hashKey] = {}; } return hash; } },{"individual/one-version":64}],62:[function(require,module,exports){ (function (global){ var topLevel = typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : {} var minDoc = require('min-document'); if (typeof document !== 'undefined') { module.exports = document; } else { var doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4']; if (!doccy) { doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc; } module.exports = doccy; } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"min-document":4}],63:[function(require,module,exports){ (function (global){ 'use strict'; /*global window, global*/ var root = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : {}; module.exports = Individual; function Individual(key, value) { if (key in root) { return root[key]; } root[key] = value; return value; } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],64:[function(require,module,exports){ 'use strict'; var Individual = require('./index.js'); module.exports = OneVersion; function OneVersion(moduleName, version, defaultValue) { var key = '__INDIVIDUAL_ONE_VERSION_' + moduleName; var enforceKey = key + '_ENFORCE_SINGLETON'; var versionValue = Individual(enforceKey, version); if (versionValue !== version) { throw new Error('Can only have one copy of ' + moduleName + '.\n' + 'You already have version ' + versionValue + ' installed.\n' + 'This means you cannot install version ' + version); } return Individual(key, defaultValue); } },{"./index.js":63}],65:[function(require,module,exports){ "use strict"; module.exports = function isObject(x) { return typeof x === "object" && x !== null; }; },{}],66:[function(require,module,exports){ 'use strict'; var proto = Element.prototype; var vendor = proto.matches || proto.matchesSelector || proto.webkitMatchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector; module.exports = match; /** * Match `el` to `selector`. * * @param {Element} el * @param {String} selector * @return {Boolean} * @api public */ function match(el, selector) { if (vendor) return vendor.call(el, selector); var nodes = el.parentNode.querySelectorAll(selector); for (var i = 0; i < nodes.length; i++) { if (nodes[i] == el) return true; } return false; } },{}],67:[function(require,module,exports){ /** * index.js * * A client-side DOM to vdom parser based on DOMParser API */ 'use strict'; var VNode = require('virtual-dom/vnode/vnode'); var VText = require('virtual-dom/vnode/vtext'); var domParser = new DOMParser(); var propertyMap = require('./property-map'); var namespaceMap = require('./namespace-map'); var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml'; module.exports = parser; /** * DOM/html string to vdom parser * * @param Mixed el DOM element or html string * @param String attr Attribute name that contains vdom key * @return Object VNode or VText */ function parser(el, attr) { // empty input fallback to empty text node if (!el) { return createNode(document.createTextNode('')); } if (typeof el === 'string') { var doc = domParser.parseFromString(el, 'text/html'); // most tags default to body if (doc.body.firstChild) { el = doc.body.firstChild; // some tags, like script and style, default to head } else if (doc.head.firstChild && (doc.head.firstChild.tagName !== 'TITLE' || doc.title)) { el = doc.head.firstChild; // special case for html comment, cdata, doctype } else if (doc.firstChild && doc.firstChild.tagName !== 'HTML') { el = doc.firstChild; // other element, such as whitespace, or html/body/head tag, fallback to empty text node } else { el = document.createTextNode(''); } } if (typeof el !== 'object' || !el || !el.nodeType) { throw new Error('invalid dom node', el); } return createNode(el, attr); } /** * Create vdom from dom node * * @param Object el DOM element * @param String attr Attribute name that contains vdom key * @return Object VNode or VText */ function createNode(el, attr) { // html comment is not currently supported by virtual-dom if (el.nodeType === 3) { return createVirtualTextNode(el); // cdata or doctype is not currently supported by virtual-dom } else if (el.nodeType === 1 || el.nodeType === 9) { return createVirtualDomNode(el, attr); } // default to empty text node return new VText(''); } /** * Create vtext from dom node * * @param Object el Text node * @return Object VText */ function createVirtualTextNode(el) { return new VText(el.nodeValue); } /** * Create vnode from dom node * * @param Object el DOM element * @param String attr Attribute name that contains vdom key * @return Object VNode */ function createVirtualDomNode(el, attr) { var ns = el.namespaceURI !== HTML_NAMESPACE ? el.namespaceURI : null; var key = attr && el.getAttribute(attr) ? el.getAttribute(attr) : null; return new VNode( el.tagName , createProperties(el) , createChildren(el, attr) , key , ns ); } /** * Recursively create vdom * * @param Object el Parent element * @param String attr Attribute name that contains vdom key * @return Array Child vnode or vtext */ function createChildren(el, attr) { var children = []; for (var i = 0; i < el.childNodes.length; i++) { children.push(createNode(el.childNodes[i], attr)); }; return children; } /** * Create properties from dom node * * @param Object el DOM element * @return Object Node properties and attributes */ function createProperties(el) { var properties = {}; if (!el.hasAttributes()) { return properties; } var ns; if (el.namespaceURI && el.namespaceURI !== HTML_NAMESPACE) { ns = el.namespaceURI; } var attr; for (var i = 0; i < el.attributes.length; i++) { if (ns) { attr = createPropertyNS(el.attributes[i]); } else { attr = createProperty(el.attributes[i]); } // special case, namespaced attribute, use properties.foobar if (attr.ns) { properties[attr.name] = { namespace: attr.ns , value: attr.value }; // special case, use properties.attributes.foobar } else if (attr.isAttr) { // init attributes object only when necessary if (!properties.attributes) { properties.attributes = {} } properties.attributes[attr.name] = attr.value; // default case, use properties.foobar } else { properties[attr.name] = attr.value; } }; return properties; } /** * Create property from dom attribute * * @param Object attr DOM attribute * @return Object Normalized attribute */ function createProperty(attr) { var name, value, isAttr; // using a map to find the correct case of property name if (propertyMap[attr.name]) { name = propertyMap[attr.name]; } else { name = attr.name; } // special cases for style attribute, we default to properties.style if (name === 'style') { var style = {}; attr.value.split(';').forEach(function (s) { var pos = s.indexOf(':'); if (pos < 0) { return; } style[s.substr(0, pos).trim()] = s.substr(pos + 1).trim(); }); value = style; // special cases for data attribute, we default to properties.attributes.data } else if (name.indexOf('data-') === 0) { value = attr.value; isAttr = true; } else { value = attr.value; } return { name: name , value: value , isAttr: isAttr || false }; } /** * Create namespaced property from dom attribute * * @param Object attr DOM attribute * @return Object Normalized attribute */ function createPropertyNS(attr) { var name, value; return { name: attr.name , value: attr.value , ns: namespaceMap[attr.name] || '' }; } },{"./namespace-map":68,"./property-map":69,"virtual-dom/vnode/vnode":104,"virtual-dom/vnode/vtext":106}],68:[function(require,module,exports){ /** * namespace-map.js * * Necessary to map svg attributes back to their namespace */ 'use strict'; // extracted from https://github.com/Matt-Esch/virtual-dom/blob/master/virtual-hyperscript/svg-attribute-namespace.js var DEFAULT_NAMESPACE = null; var EV_NAMESPACE = 'http://www.w3.org/2001/xml-events'; var XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink'; var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace'; var namespaces = { 'about': DEFAULT_NAMESPACE , 'accent-height': DEFAULT_NAMESPACE , 'accumulate': DEFAULT_NAMESPACE , 'additive': DEFAULT_NAMESPACE , 'alignment-baseline': DEFAULT_NAMESPACE , 'alphabetic': DEFAULT_NAMESPACE , 'amplitude': DEFAULT_NAMESPACE , 'arabic-form': DEFAULT_NAMESPACE , 'ascent': DEFAULT_NAMESPACE , 'attributeName': DEFAULT_NAMESPACE , 'attributeType': DEFAULT_NAMESPACE , 'azimuth': DEFAULT_NAMESPACE , 'bandwidth': DEFAULT_NAMESPACE , 'baseFrequency': DEFAULT_NAMESPACE , 'baseProfile': DEFAULT_NAMESPACE , 'baseline-shift': DEFAULT_NAMESPACE , 'bbox': DEFAULT_NAMESPACE , 'begin': DEFAULT_NAMESPACE , 'bias': DEFAULT_NAMESPACE , 'by': DEFAULT_NAMESPACE , 'calcMode': DEFAULT_NAMESPACE , 'cap-height': DEFAULT_NAMESPACE , 'class': DEFAULT_NAMESPACE , 'clip': DEFAULT_NAMESPACE , 'clip-path': DEFAULT_NAMESPACE , 'clip-rule': DEFAULT_NAMESPACE , 'clipPathUnits': DEFAULT_NAMESPACE , 'color': DEFAULT_NAMESPACE , 'color-interpolation': DEFAULT_NAMESPACE , 'color-interpolation-filters': DEFAULT_NAMESPACE , 'color-profile': DEFAULT_NAMESPACE , 'color-rendering': DEFAULT_NAMESPACE , 'content': DEFAULT_NAMESPACE , 'contentScriptType': DEFAULT_NAMESPACE , 'contentStyleType': DEFAULT_NAMESPACE , 'cursor': DEFAULT_NAMESPACE , 'cx': DEFAULT_NAMESPACE , 'cy': DEFAULT_NAMESPACE , 'd': DEFAULT_NAMESPACE , 'datatype': DEFAULT_NAMESPACE , 'defaultAction': DEFAULT_NAMESPACE , 'descent': DEFAULT_NAMESPACE , 'diffuseConstant': DEFAULT_NAMESPACE , 'direction': DEFAULT_NAMESPACE , 'display': DEFAULT_NAMESPACE , 'divisor': DEFAULT_NAMESPACE , 'dominant-baseline': DEFAULT_NAMESPACE , 'dur': DEFAULT_NAMESPACE , 'dx': DEFAULT_NAMESPACE , 'dy': DEFAULT_NAMESPACE , 'edgeMode': DEFAULT_NAMESPACE , 'editable': DEFAULT_NAMESPACE , 'elevation': DEFAULT_NAMESPACE , 'enable-background': DEFAULT_NAMESPACE , 'end': DEFAULT_NAMESPACE , 'ev:event': EV_NAMESPACE , 'event': DEFAULT_NAMESPACE , 'exponent': DEFAULT_NAMESPACE , 'externalResourcesRequired': DEFAULT_NAMESPACE , 'fill': DEFAULT_NAMESPACE , 'fill-opacity': DEFAULT_NAMESPACE , 'fill-rule': DEFAULT_NAMESPACE , 'filter': DEFAULT_NAMESPACE , 'filterRes': DEFAULT_NAMESPACE , 'filterUnits': DEFAULT_NAMESPACE , 'flood-color': DEFAULT_NAMESPACE , 'flood-opacity': DEFAULT_NAMESPACE , 'focusHighlight': DEFAULT_NAMESPACE , 'focusable': DEFAULT_NAMESPACE , 'font-family': DEFAULT_NAMESPACE , 'font-size': DEFAULT_NAMESPACE , 'font-size-adjust': DEFAULT_NAMESPACE , 'font-stretch': DEFAULT_NAMESPACE , 'font-style': DEFAULT_NAMESPACE , 'font-variant': DEFAULT_NAMESPACE , 'font-weight': DEFAULT_NAMESPACE , 'format': DEFAULT_NAMESPACE , 'from': DEFAULT_NAMESPACE , 'fx': DEFAULT_NAMESPACE , 'fy': DEFAULT_NAMESPACE , 'g1': DEFAULT_NAMESPACE , 'g2': DEFAULT_NAMESPACE , 'glyph-name': DEFAULT_NAMESPACE , 'glyph-orientation-horizontal': DEFAULT_NAMESPACE , 'glyph-orientation-vertical': DEFAULT_NAMESPACE , 'glyphRef': DEFAULT_NAMESPACE , 'gradientTransform': DEFAULT_NAMESPACE , 'gradientUnits': DEFAULT_NAMESPACE , 'handler': DEFAULT_NAMESPACE , 'hanging': DEFAULT_NAMESPACE , 'height': DEFAULT_NAMESPACE , 'horiz-adv-x': DEFAULT_NAMESPACE , 'horiz-origin-x': DEFAULT_NAMESPACE , 'horiz-origin-y': DEFAULT_NAMESPACE , 'id': DEFAULT_NAMESPACE , 'ideographic': DEFAULT_NAMESPACE , 'image-rendering': DEFAULT_NAMESPACE , 'in': DEFAULT_NAMESPACE , 'in2': DEFAULT_NAMESPACE , 'initialVisibility': DEFAULT_NAMESPACE , 'intercept': DEFAULT_NAMESPACE , 'k': DEFAULT_NAMESPACE , 'k1': DEFAULT_NAMESPACE , 'k2': DEFAULT_NAMESPACE , 'k3': DEFAULT_NAMESPACE , 'k4': DEFAULT_NAMESPACE , 'kernelMatrix': DEFAULT_NAMESPACE , 'kernelUnitLength': DEFAULT_NAMESPACE , 'kerning': DEFAULT_NAMESPACE , 'keyPoints': DEFAULT_NAMESPACE , 'keySplines': DEFAULT_NAMESPACE , 'keyTimes': DEFAULT_NAMESPACE , 'lang': DEFAULT_NAMESPACE , 'lengthAdjust': DEFAULT_NAMESPACE , 'letter-spacing': DEFAULT_NAMESPACE , 'lighting-color': DEFAULT_NAMESPACE , 'limitingConeAngle': DEFAULT_NAMESPACE , 'local': DEFAULT_NAMESPACE , 'marker-end': DEFAULT_NAMESPACE , 'marker-mid': DEFAULT_NAMESPACE , 'marker-start': DEFAULT_NAMESPACE , 'markerHeight': DEFAULT_NAMESPACE , 'markerUnits': DEFAULT_NAMESPACE , 'markerWidth': DEFAULT_NAMESPACE , 'mask': DEFAULT_NAMESPACE , 'maskContentUnits': DEFAULT_NAMESPACE , 'maskUnits': DEFAULT_NAMESPACE , 'mathematical': DEFAULT_NAMESPACE , 'max': DEFAULT_NAMESPACE , 'media': DEFAULT_NAMESPACE , 'mediaCharacterEncoding': DEFAULT_NAMESPACE , 'mediaContentEncodings': DEFAULT_NAMESPACE , 'mediaSize': DEFAULT_NAMESPACE , 'mediaTime': DEFAULT_NAMESPACE , 'method': DEFAULT_NAMESPACE , 'min': DEFAULT_NAMESPACE , 'mode': DEFAULT_NAMESPACE , 'name': DEFAULT_NAMESPACE , 'nav-down': DEFAULT_NAMESPACE , 'nav-down-left': DEFAULT_NAMESPACE , 'nav-down-right': DEFAULT_NAMESPACE , 'nav-left': DEFAULT_NAMESPACE , 'nav-next': DEFAULT_NAMESPACE , 'nav-prev': DEFAULT_NAMESPACE , 'nav-right': DEFAULT_NAMESPACE , 'nav-up': DEFAULT_NAMESPACE , 'nav-up-left': DEFAULT_NAMESPACE , 'nav-up-right': DEFAULT_NAMESPACE , 'numOctaves': DEFAULT_NAMESPACE , 'observer': DEFAULT_NAMESPACE , 'offset': DEFAULT_NAMESPACE , 'opacity': DEFAULT_NAMESPACE , 'operator': DEFAULT_NAMESPACE , 'order': DEFAULT_NAMESPACE , 'orient': DEFAULT_NAMESPACE , 'orientation': DEFAULT_NAMESPACE , 'origin': DEFAULT_NAMESPACE , 'overflow': DEFAULT_NAMESPACE , 'overlay': DEFAULT_NAMESPACE , 'overline-position': DEFAULT_NAMESPACE , 'overline-thickness': DEFAULT_NAMESPACE , 'panose-1': DEFAULT_NAMESPACE , 'path': DEFAULT_NAMESPACE , 'pathLength': DEFAULT_NAMESPACE , 'patternContentUnits': DEFAULT_NAMESPACE , 'patternTransform': DEFAULT_NAMESPACE , 'patternUnits': DEFAULT_NAMESPACE , 'phase': DEFAULT_NAMESPACE , 'playbackOrder': DEFAULT_NAMESPACE , 'pointer-events': DEFAULT_NAMESPACE , 'points': DEFAULT_NAMESPACE , 'pointsAtX': DEFAULT_NAMESPACE , 'pointsAtY': DEFAULT_NAMESPACE , 'pointsAtZ': DEFAULT_NAMESPACE , 'preserveAlpha': DEFAULT_NAMESPACE , 'preserveAspectRatio': DEFAULT_NAMESPACE , 'primitiveUnits': DEFAULT_NAMESPACE , 'propagate': DEFAULT_NAMESPACE , 'property': DEFAULT_NAMESPACE , 'r': DEFAULT_NAMESPACE , 'radius': DEFAULT_NAMESPACE , 'refX': DEFAULT_NAMESPACE , 'refY': DEFAULT_NAMESPACE , 'rel': DEFAULT_NAMESPACE , 'rendering-intent': DEFAULT_NAMESPACE , 'repeatCount': DEFAULT_NAMESPACE , 'repeatDur': DEFAULT_NAMESPACE , 'requiredExtensions': DEFAULT_NAMESPACE , 'requiredFeatures': DEFAULT_NAMESPACE , 'requiredFonts': DEFAULT_NAMESPACE , 'requiredFormats': DEFAULT_NAMESPACE , 'resource': DEFAULT_NAMESPACE , 'restart': DEFAULT_NAMESPACE , 'result': DEFAULT_NAMESPACE , 'rev': DEFAULT_NAMESPACE , 'role': DEFAULT_NAMESPACE , 'rotate': DEFAULT_NAMESPACE , 'rx': DEFAULT_NAMESPACE , 'ry': DEFAULT_NAMESPACE , 'scale': DEFAULT_NAMESPACE , 'seed': DEFAULT_NAMESPACE , 'shape-rendering': DEFAULT_NAMESPACE , 'slope': DEFAULT_NAMESPACE , 'snapshotTime': DEFAULT_NAMESPACE , 'spacing': DEFAULT_NAMESPACE , 'specularConstant': DEFAULT_NAMESPACE , 'specularExponent': DEFAULT_NAMESPACE , 'spreadMethod': DEFAULT_NAMESPACE , 'startOffset': DEFAULT_NAMESPACE , 'stdDeviation': DEFAULT_NAMESPACE , 'stemh': DEFAULT_NAMESPACE , 'stemv': DEFAULT_NAMESPACE , 'stitchTiles': DEFAULT_NAMESPACE , 'stop-color': DEFAULT_NAMESPACE , 'stop-opacity': DEFAULT_NAMESPACE , 'strikethrough-position': DEFAULT_NAMESPACE , 'strikethrough-thickness': DEFAULT_NAMESPACE , 'string': DEFAULT_NAMESPACE , 'stroke': DEFAULT_NAMESPACE , 'stroke-dasharray': DEFAULT_NAMESPACE , 'stroke-dashoffset': DEFAULT_NAMESPACE , 'stroke-linecap': DEFAULT_NAMESPACE , 'stroke-linejoin': DEFAULT_NAMESPACE , 'stroke-miterlimit': DEFAULT_NAMESPACE , 'stroke-opacity': DEFAULT_NAMESPACE , 'stroke-width': DEFAULT_NAMESPACE , 'surfaceScale': DEFAULT_NAMESPACE , 'syncBehavior': DEFAULT_NAMESPACE , 'syncBehaviorDefault': DEFAULT_NAMESPACE , 'syncMaster': DEFAULT_NAMESPACE , 'syncTolerance': DEFAULT_NAMESPACE , 'syncToleranceDefault': DEFAULT_NAMESPACE , 'systemLanguage': DEFAULT_NAMESPACE , 'tableValues': DEFAULT_NAMESPACE , 'target': DEFAULT_NAMESPACE , 'targetX': DEFAULT_NAMESPACE , 'targetY': DEFAULT_NAMESPACE , 'text-anchor': DEFAULT_NAMESPACE , 'text-decoration': DEFAULT_NAMESPACE , 'text-rendering': DEFAULT_NAMESPACE , 'textLength': DEFAULT_NAMESPACE , 'timelineBegin': DEFAULT_NAMESPACE , 'title': DEFAULT_NAMESPACE , 'to': DEFAULT_NAMESPACE , 'transform': DEFAULT_NAMESPACE , 'transformBehavior': DEFAULT_NAMESPACE , 'type': DEFAULT_NAMESPACE , 'typeof': DEFAULT_NAMESPACE , 'u1': DEFAULT_NAMESPACE , 'u2': DEFAULT_NAMESPACE , 'underline-position': DEFAULT_NAMESPACE , 'underline-thickness': DEFAULT_NAMESPACE , 'unicode': DEFAULT_NAMESPACE , 'unicode-bidi': DEFAULT_NAMESPACE , 'unicode-range': DEFAULT_NAMESPACE , 'units-per-em': DEFAULT_NAMESPACE , 'v-alphabetic': DEFAULT_NAMESPACE , 'v-hanging': DEFAULT_NAMESPACE , 'v-ideographic': DEFAULT_NAMESPACE , 'v-mathematical': DEFAULT_NAMESPACE , 'values': DEFAULT_NAMESPACE , 'version': DEFAULT_NAMESPACE , 'vert-adv-y': DEFAULT_NAMESPACE , 'vert-origin-x': DEFAULT_NAMESPACE , 'vert-origin-y': DEFAULT_NAMESPACE , 'viewBox': DEFAULT_NAMESPACE , 'viewTarget': DEFAULT_NAMESPACE , 'visibility': DEFAULT_NAMESPACE , 'width': DEFAULT_NAMESPACE , 'widths': DEFAULT_NAMESPACE , 'word-spacing': DEFAULT_NAMESPACE , 'writing-mode': DEFAULT_NAMESPACE , 'x': DEFAULT_NAMESPACE , 'x-height': DEFAULT_NAMESPACE , 'x1': DEFAULT_NAMESPACE , 'x2': DEFAULT_NAMESPACE , 'xChannelSelector': DEFAULT_NAMESPACE , 'xlink:actuate': XLINK_NAMESPACE , 'xlink:arcrole': XLINK_NAMESPACE , 'xlink:href': XLINK_NAMESPACE , 'xlink:role': XLINK_NAMESPACE , 'xlink:show': XLINK_NAMESPACE , 'xlink:title': XLINK_NAMESPACE , 'xlink:type': XLINK_NAMESPACE , 'xml:base': XML_NAMESPACE , 'xml:id': XML_NAMESPACE , 'xml:lang': XML_NAMESPACE , 'xml:space': XML_NAMESPACE , 'y': DEFAULT_NAMESPACE , 'y1': DEFAULT_NAMESPACE , 'y2': DEFAULT_NAMESPACE , 'yChannelSelector': DEFAULT_NAMESPACE , 'z': DEFAULT_NAMESPACE , 'zoomAndPan': DEFAULT_NAMESPACE }; module.exports = namespaces; },{}],69:[function(require,module,exports){ /** * property-map.js * * Necessary to map dom attributes back to vdom properties */ 'use strict'; // invert of https://www.npmjs.com/package/html-attributes var properties = { 'abbr': 'abbr' , 'accept': 'accept' , 'accept-charset': 'acceptCharset' , 'accesskey': 'accessKey' , 'action': 'action' , 'allowfullscreen': 'allowFullScreen' , 'allowtransparency': 'allowTransparency' , 'alt': 'alt' , 'async': 'async' , 'autocomplete': 'autoComplete' , 'autofocus': 'autoFocus' , 'autoplay': 'autoPlay' , 'cellpadding': 'cellPadding' , 'cellspacing': 'cellSpacing' , 'challenge': 'challenge' , 'charset': 'charset' , 'checked': 'checked' , 'cite': 'cite' , 'class': 'className' , 'cols': 'cols' , 'colspan': 'colSpan' , 'command': 'command' , 'content': 'content' , 'contenteditable': 'contentEditable' , 'contextmenu': 'contextMenu' , 'controls': 'controls' , 'coords': 'coords' , 'crossorigin': 'crossOrigin' , 'data': 'data' , 'datetime': 'dateTime' , 'default': 'default' , 'defer': 'defer' , 'dir': 'dir' , 'disabled': 'disabled' , 'download': 'download' , 'draggable': 'draggable' , 'dropzone': 'dropzone' , 'enctype': 'encType' , 'for': 'htmlFor' , 'form': 'form' , 'formaction': 'formAction' , 'formenctype': 'formEncType' , 'formmethod': 'formMethod' , 'formnovalidate': 'formNoValidate' , 'formtarget': 'formTarget' , 'frameBorder': 'frameBorder' , 'headers': 'headers' , 'height': 'height' , 'hidden': 'hidden' , 'high': 'high' , 'href': 'href' , 'hreflang': 'hrefLang' , 'http-equiv': 'httpEquiv' , 'icon': 'icon' , 'id': 'id' , 'inputmode': 'inputMode' , 'ismap': 'isMap' , 'itemid': 'itemId' , 'itemprop': 'itemProp' , 'itemref': 'itemRef' , 'itemscope': 'itemScope' , 'itemtype': 'itemType' , 'kind': 'kind' , 'label': 'label' , 'lang': 'lang' , 'list': 'list' , 'loop': 'loop' , 'manifest': 'manifest' , 'max': 'max' , 'maxlength': 'maxLength' , 'media': 'media' , 'mediagroup': 'mediaGroup' , 'method': 'method' , 'min': 'min' , 'minlength': 'minLength' , 'multiple': 'multiple' , 'muted': 'muted' , 'name': 'name' , 'novalidate': 'noValidate' , 'open': 'open' , 'optimum': 'optimum' , 'pattern': 'pattern' , 'ping': 'ping' , 'placeholder': 'placeholder' , 'poster': 'poster' , 'preload': 'preload' , 'radiogroup': 'radioGroup' , 'readonly': 'readOnly' , 'rel': 'rel' , 'required': 'required' , 'role': 'role' , 'rows': 'rows' , 'rowspan': 'rowSpan' , 'sandbox': 'sandbox' , 'scope': 'scope' , 'scoped': 'scoped' , 'scrolling': 'scrolling' , 'seamless': 'seamless' , 'selected': 'selected' , 'shape': 'shape' , 'size': 'size' , 'sizes': 'sizes' , 'sortable': 'sortable' , 'span': 'span' , 'spellcheck': 'spellCheck' , 'src': 'src' , 'srcdoc': 'srcDoc' , 'srcset': 'srcSet' , 'start': 'start' , 'step': 'step' , 'style': 'style' , 'tabindex': 'tabIndex' , 'target': 'target' , 'title': 'title' , 'translate': 'translate' , 'type': 'type' , 'typemustmatch': 'typeMustMatch' , 'usemap': 'useMap' , 'value': 'value' , 'width': 'width' , 'wmode': 'wmode' , 'wrap': 'wrap' }; module.exports = properties; },{}],70:[function(require,module,exports){ var escape = require('escape-html'); var propConfig = require('./property-config'); var types = propConfig.attributeTypes; var properties = propConfig.properties; var attributeNames = propConfig.attributeNames; var prefixAttribute = memoizeString(function (name) { return escape(name) + '="'; }); module.exports = createAttribute; /** * Create attribute string. * * @param {String} name The name of the property or attribute * @param {*} value The value * @param {Boolean} [isAttribute] Denotes whether `name` is an attribute. * @return {?String} Attribute string || null if not a valid property or custom attribute. */ function createAttribute(name, value, isAttribute) { if (properties.hasOwnProperty(name)) { if (shouldSkip(name, value)) return ''; name = (attributeNames[name] || name).toLowerCase(); var attrType = properties[name]; // for BOOLEAN `value` only has to be truthy // for OVERLOADED_BOOLEAN `value` has to be === true if ((attrType === types.BOOLEAN) || (attrType === types.OVERLOADED_BOOLEAN && value === true)) { return escape(name); } return prefixAttribute(name) + escape(value) + '"'; } else if (isAttribute) { if (value == null) return ''; return prefixAttribute(name) + escape(value) + '"'; } // return null if `name` is neither a valid property nor an attribute return null; } /** * Should skip false boolean attributes. */ function shouldSkip(name, value) { var attrType = properties[name]; return value == null || (attrType === types.BOOLEAN && !value) || (attrType === types.OVERLOADED_BOOLEAN && value === false); } /** * Memoizes the return value of a function that accepts one string argument. * * @param {function} callback * @return {function} */ function memoizeString(callback) { var cache = {}; return function(string) { if (cache.hasOwnProperty(string)) { return cache[string]; } else { return cache[string] = callback.call(this, string); } }; } },{"./property-config":80,"escape-html":72}],71:[function(require,module,exports){ var escape = require('escape-html'); var extend = require('xtend'); var isVNode = require('virtual-dom/vnode/is-vnode'); var isVText = require('virtual-dom/vnode/is-vtext'); var isThunk = require('virtual-dom/vnode/is-thunk'); var isWidget = require('virtual-dom/vnode/is-widget'); var softHook = require('virtual-dom/virtual-hyperscript/hooks/soft-set-hook'); var attrHook = require('virtual-dom/virtual-hyperscript/hooks/attribute-hook'); var paramCase = require('param-case'); var createAttribute = require('./create-attribute'); var voidElements = require('./void-elements'); module.exports = toHTML; function toHTML(node, parent) { if (!node) return ''; if (isThunk(node)) { node = node.render(); } if (isWidget(node) && node.render) { node = node.render(); } if (isVNode(node)) { return openTag(node) + tagContent(node) + closeTag(node); } else if (isVText(node)) { if (parent && parent.tagName.toLowerCase() === 'script') return String(node.text); return escape(String(node.text)); } return ''; } function openTag(node) { var props = node.properties; var ret = '<' + node.tagName.toLowerCase(); for (var name in props) { var value = props[name]; if (value == null) continue; if (name == 'attributes') { value = extend({}, value); for (var attrProp in value) { ret += ' ' + createAttribute(attrProp, value[attrProp], true); } continue; } if (name == 'style') { var css = ''; value = extend({}, value); for (var styleProp in value) { css += paramCase(styleProp) + ': ' + value[styleProp] + '; '; } value = css.trim(); } if (value instanceof softHook || value instanceof attrHook) { ret += ' ' + createAttribute(name, value.value, true); continue; } var attr = createAttribute(name, value); if (attr) ret += ' ' + attr; } return ret + '>'; } function tagContent(node) { var innerHTML = node.properties.innerHTML; if (innerHTML != null) return innerHTML; else { var ret = ''; if (node.children && node.children.length) { for (var i = 0, l = node.children.length; i<l; i++) { var child = node.children[i]; ret += toHTML(child, node); } } return ret; } } function closeTag(node) { var tag = node.tagName.toLowerCase(); return voidElements[tag] ? '' : '</' + tag + '>'; } },{"./create-attribute":70,"./void-elements":81,"escape-html":72,"param-case":78,"virtual-dom/virtual-hyperscript/hooks/attribute-hook":90,"virtual-dom/virtual-hyperscript/hooks/soft-set-hook":92,"virtual-dom/vnode/is-thunk":98,"virtual-dom/vnode/is-vnode":100,"virtual-dom/vnode/is-vtext":101,"virtual-dom/vnode/is-widget":102,"xtend":79}],72:[function(require,module,exports){ /*! * escape-html * Copyright(c) 2012-2013 TJ Holowaychuk * MIT Licensed */ /** * Module exports. * @public */ module.exports = escapeHtml; /** * Escape special characters in the given string of html. * * @param {string} str The string to escape for inserting into HTML * @return {string} * @public */ function escapeHtml(html) { return String(html) .replace(/&/g, '&amp;') .replace(/"/g, '&quot;') .replace(/'/g, '&#39;') .replace(/</g, '&lt;') .replace(/>/g, '&gt;'); } },{}],73:[function(require,module,exports){ /** * Special language-specific overrides. * * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt * * @type {Object} */ var LANGUAGES = { tr: { regexp: /\u0130|\u0049|\u0049\u0307/g, map: { '\u0130': '\u0069', '\u0049': '\u0131', '\u0049\u0307': '\u0069' } }, az: { regexp: /[\u0130]/g, map: { '\u0130': '\u0069', '\u0049': '\u0131', '\u0049\u0307': '\u0069' } }, lt: { regexp: /[\u0049\u004A\u012E\u00CC\u00CD\u0128]/g, map: { '\u0049': '\u0069\u0307', '\u004A': '\u006A\u0307', '\u012E': '\u012F\u0307', '\u00CC': '\u0069\u0307\u0300', '\u00CD': '\u0069\u0307\u0301', '\u0128': '\u0069\u0307\u0303' } } } /** * Lowercase a string. * * @param {String} str * @return {String} */ module.exports = function (str, locale) { var lang = LANGUAGES[locale] str = str == null ? '' : String(str) if (lang) { str = str.replace(lang.regexp, function (m) { return lang.map[m] }) } return str.toLowerCase() } },{}],74:[function(require,module,exports){ var lowerCase = require('lower-case') var NON_WORD_REGEXP = require('./vendor/non-word-regexp') var CAMEL_CASE_REGEXP = require('./vendor/camel-case-regexp') var TRAILING_DIGIT_REGEXP = require('./vendor/trailing-digit-regexp') /** * Sentence case a string. * * @param {String} str * @param {String} locale * @param {String} replacement * @return {String} */ module.exports = function (str, locale, replacement) { if (str == null) { return '' } replacement = replacement || ' ' function replace (match, index, string) { if (index === 0 || index === (string.length - match.length)) { return '' } return replacement } str = String(str) // Support camel case ("camelCase" -> "camel Case"). .replace(CAMEL_CASE_REGEXP, '$1 $2') // Support digit groups ("test2012" -> "test 2012"). .replace(TRAILING_DIGIT_REGEXP, '$1 $2') // Remove all non-word characters and replace with a single space. .replace(NON_WORD_REGEXP, replace) // Lower case the entire string. return lowerCase(str, locale) } },{"./vendor/camel-case-regexp":75,"./vendor/non-word-regexp":76,"./vendor/trailing-digit-regexp":77,"lower-case":73}],75:[function(require,module,exports){ module.exports = /([\u0061-\u007A\u00B5\u00DF-\u00F6\u00F8-\u00FF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02AF\u0371\u0373\u0377\u037B-\u037D\u0390\u03AC-\u03CE\u03D0\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0561-\u0587\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E01\u1E03\u1E05\u1E07\u1E09\u1E0B\u1E0D\u1E0F\u1E11\u1E13\u1E15\u1E17\u1E19\u1E1B\u1E1D\u1E1F\u1E21\u1E23\u1E25\u1E27\u1E29\u1E2B\u1E2D\u1E2F\u1E31\u1E33\u1E35\u1E37\u1E39\u1E3B\u1E3D\u1E3F\u1E41\u1E43\u1E45\u1E47\u1E49\u1E4B\u1E4D\u1E4F\u1E51\u1E53\u1E55\u1E57\u1E59\u1E5B\u1E5D\u1E5F\u1E61\u1E63\u1E65\u1E67\u1E69\u1E6B\u1E6D\u1E6F\u1E71\u1E73\u1E75\u1E77\u1E79\u1E7B\u1E7D\u1E7F\u1E81\u1E83\u1E85\u1E87\u1E89\u1E8B\u1E8D\u1E8F\u1E91\u1E93\u1E95-\u1E9D\u1E9F\u1EA1\u1EA3\u1EA5\u1EA7\u1EA9\u1EAB\u1EAD\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\u1EB9\u1EBB\u1EBD\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7\u1EC9\u1ECB\u1ECD\u1ECF\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3\u1EE5\u1EE7\u1EE9\u1EEB\u1EED\u1EEF\u1EF1\u1EF3\u1EF5\u1EF7\u1EF9\u1EFB\u1EFD\u1EFF-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB0-\u1FB4\u1FB6\u1FB7\u1FBE\u1FC2-\u1FC4\u1FC6\u1FC7\u1FD0-\u1FD3\u1FD6\u1FD7\u1FE0-\u1FE7\u1FF2-\u1FF4\u1FF6\u1FF7\u210A\u210E\u210F\u2113\u212F\u2134\u2139\u213C\u213D\u2146-\u2149\u214E\u2184\u2C30-\u2C5E\u2C61\u2C65\u2C66\u2C68\u2C6A\u2C6C\u2C71\u2C73\u2C74\u2C76-\u2C7B\u2C81\u2C83\u2C85\u2C87\u2C89\u2C8B\u2C8D\u2C8F\u2C91\u2C93\u2C95\u2C97\u2C99\u2C9B\u2C9D\u2C9F\u2CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3\u2CE4\u2CEC\u2CEE\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F\uA771-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA793\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7FA\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A])([\u0041-\u005A\u00C0-\u00D6\u00D8-\u00DE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D\u0181\u0182\u0184\u0186\u0187\u0189-\u018B\u018E-\u0191\u0193\u0194\u0196-\u0198\u019C\u019D\u019F\u01A0\u01A2\u01A4\u01A6\u01A7\u01A9\u01AC\u01AE\u01AF\u01B1-\u01B3\u01B5\u01B7\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A\u023B\u023D\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u0386\u0388-\u038A\u038C\u038E\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0531-\u0556\u10A0-\u10C5\u10C7\u10CD\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E\u213F\u2145\u2183\u2C00-\u2C2E\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA\uFF21-\uFF3A\u0030-\u0039\u00B2\u00B3\u00B9\u00BC-\u00BE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D66-\u0D75\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19])/g },{}],76:[function(require,module,exports){ module.exports = /[^\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC\u0030-\u0039\u00B2\u00B3\u00B9\u00BC-\u00BE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D66-\u0D75\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19]+/g },{}],77:[function(require,module,exports){ module.exports = /([\u0030-\u0039\u00B2\u00B3\u00B9\u00BC-\u00BE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D66-\u0D75\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19])([^\u0030-\u0039\u00B2\u00B3\u00B9\u00BC-\u00BE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D66-\u0D75\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19])/g },{}],78:[function(require,module,exports){ var sentenceCase = require('sentence-case'); /** * Param case a string. * * @param {String} string * @param {String} [locale] * @return {String} */ module.exports = function (string, locale) { return sentenceCase(string, locale, '-'); }; },{"sentence-case":74}],79:[function(require,module,exports){ module.exports = extend function extend() { var target = {} for (var i = 0; i < arguments.length; i++) { var source = arguments[i] for (var key in source) { if (source.hasOwnProperty(key)) { target[key] = source[key] } } } return target } },{}],80:[function(require,module,exports){ /** * Attribute types. */ var types = { BOOLEAN: 1, OVERLOADED_BOOLEAN: 2 }; /** * Properties. * * Taken from https://github.com/facebook/react/blob/847357e42e5267b04dd6e297219eaa125ab2f9f4/src/browser/ui/dom/HTMLDOMPropertyConfig.js * */ var properties = { /** * Standard Properties */ accept: true, acceptCharset: true, accessKey: true, action: true, allowFullScreen: types.BOOLEAN, allowTransparency: true, alt: true, async: types.BOOLEAN, autocomplete: true, autofocus: types.BOOLEAN, autoplay: types.BOOLEAN, cellPadding: true, cellSpacing: true, charset: true, checked: types.BOOLEAN, classID: true, className: true, cols: true, colSpan: true, content: true, contentEditable: true, contextMenu: true, controls: types.BOOLEAN, coords: true, crossOrigin: true, data: true, // For `<object />` acts as `src`. dateTime: true, defer: types.BOOLEAN, dir: true, disabled: types.BOOLEAN, download: types.OVERLOADED_BOOLEAN, draggable: true, enctype: true, form: true, formAction: true, formEncType: true, formMethod: true, formNoValidate: types.BOOLEAN, formTarget: true, frameBorder: true, headers: true, height: true, hidden: types.BOOLEAN, href: true, hreflang: true, htmlFor: true, httpEquiv: true, icon: true, id: true, label: true, lang: true, list: true, loop: types.BOOLEAN, manifest: true, marginHeight: true, marginWidth: true, max: true, maxLength: true, media: true, mediaGroup: true, method: true, min: true, multiple: types.BOOLEAN, muted: types.BOOLEAN, name: true, noValidate: types.BOOLEAN, open: true, pattern: true, placeholder: true, poster: true, preload: true, radiogroup: true, readOnly: types.BOOLEAN, rel: true, required: types.BOOLEAN, role: true, rows: true, rowSpan: true, sandbox: true, scope: true, scrolling: true, seamless: types.BOOLEAN, selected: types.BOOLEAN, shape: true, size: true, sizes: true, span: true, spellcheck: true, src: true, srcdoc: true, srcset: true, start: true, step: true, style: true, tabIndex: true, target: true, title: true, type: true, useMap: true, value: true, width: true, wmode: true, /** * Non-standard Properties */ // autoCapitalize and autoCorrect are supported in Mobile Safari for // keyboard hints. autocapitalize: true, autocorrect: true, // itemProp, itemScope, itemType are for Microdata support. See // http://schema.org/docs/gs.html itemProp: true, itemScope: types.BOOLEAN, itemType: true, // property is supported for OpenGraph in meta tags. property: true }; /** * Properties to attributes mapping. * * The ones not here are simply converted to lower case. */ var attributeNames = { acceptCharset: 'accept-charset', className: 'class', htmlFor: 'for', httpEquiv: 'http-equiv' }; /** * Exports. */ module.exports = { attributeTypes: types, properties: properties, attributeNames: attributeNames }; },{}],81:[function(require,module,exports){ /** * Void elements. * * https://github.com/facebook/react/blob/v0.12.0/src/browser/ui/ReactDOMComponent.js#L99 */ module.exports = { 'area': true, 'base': true, 'br': true, 'col': true, 'embed': true, 'hr': true, 'img': true, 'input': true, 'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true, 'track': true, 'wbr': true }; },{}],82:[function(require,module,exports){ var diff = require("./vtree/diff.js") module.exports = diff },{"./vtree/diff.js":108}],83:[function(require,module,exports){ var patch = require("./vdom/patch.js") module.exports = patch },{"./vdom/patch.js":88}],84:[function(require,module,exports){ var isObject = require("is-object") var isHook = require("../vnode/is-vhook.js") module.exports = applyProperties function applyProperties(node, props, previous) { for (var propName in props) { var propValue = props[propName] if (propValue === undefined) { removeProperty(node, propName, propValue, previous); } else if (isHook(propValue)) { removeProperty(node, propName, propValue, previous) if (propValue.hook) { propValue.hook(node, propName, previous ? previous[propName] : undefined) } } else { if (isObject(propValue)) { patchObject(node, props, previous, propName, propValue); } else { node[propName] = propValue } } } } function removeProperty(node, propName, propValue, previous) { if (previous) { var previousValue = previous[propName] if (!isHook(previousValue)) { if (propName === "attributes") { for (var attrName in previousValue) { node.removeAttribute(attrName) } } else if (propName === "style") { for (var i in previousValue) { node.style[i] = "" } } else if (typeof previousValue === "string") { node[propName] = "" } else { node[propName] = null } } else if (previousValue.unhook) { previousValue.unhook(node, propName, propValue) } } } function patchObject(node, props, previous, propName, propValue) { var previousValue = previous ? previous[propName] : undefined // Set attributes if (propName === "attributes") { for (var attrName in propValue) { var attrValue = propValue[attrName] if (attrValue === undefined) { node.removeAttribute(attrName) } else { node.setAttribute(attrName, attrValue) } } return } if(previousValue && isObject(previousValue) && getPrototype(previousValue) !== getPrototype(propValue)) { node[propName] = propValue return } if (!isObject(node[propName])) { node[propName] = {} } var replacer = propName === "style" ? "" : undefined for (var k in propValue) { var value = propValue[k] node[propName][k] = (value === undefined) ? replacer : value } } function getPrototype(value) { if (Object.getPrototypeOf) { return Object.getPrototypeOf(value) } else if (value.__proto__) { return value.__proto__ } else if (value.constructor) { return value.constructor.prototype } } },{"../vnode/is-vhook.js":99,"is-object":65}],85:[function(require,module,exports){ var document = require("global/document") var applyProperties = require("./apply-properties") var isVNode = require("../vnode/is-vnode.js") var isVText = require("../vnode/is-vtext.js") var isWidget = require("../vnode/is-widget.js") var handleThunk = require("../vnode/handle-thunk.js") module.exports = createElement function createElement(vnode, opts) { var doc = opts ? opts.document || document : document var warn = opts ? opts.warn : null vnode = handleThunk(vnode).a if (isWidget(vnode)) { return vnode.init() } else if (isVText(vnode)) { return doc.createTextNode(vnode.text) } else if (!isVNode(vnode)) { if (warn) { warn("Item is not a valid virtual dom node", vnode) } return null } var node = (vnode.namespace === null) ? doc.createElement(vnode.tagName) : doc.createElementNS(vnode.namespace, vnode.tagName) var props = vnode.properties applyProperties(node, props) var children = vnode.children for (var i = 0; i < children.length; i++) { var childNode = createElement(children[i], opts) if (childNode) { node.appendChild(childNode) } } return node } },{"../vnode/handle-thunk.js":97,"../vnode/is-vnode.js":100,"../vnode/is-vtext.js":101,"../vnode/is-widget.js":102,"./apply-properties":84,"global/document":62}],86:[function(require,module,exports){ // Maps a virtual DOM tree onto a real DOM tree in an efficient manner. // We don't want to read all of the DOM nodes in the tree so we use // the in-order tree indexing to eliminate recursion down certain branches. // We only recurse into a DOM node if we know that it contains a child of // interest. var noChild = {} module.exports = domIndex function domIndex(rootNode, tree, indices, nodes) { if (!indices || indices.length === 0) { return {} } else { indices.sort(ascending) return recurse(rootNode, tree, indices, nodes, 0) } } function recurse(rootNode, tree, indices, nodes, rootIndex) { nodes = nodes || {} if (rootNode) { if (indexInRange(indices, rootIndex, rootIndex)) { nodes[rootIndex] = rootNode } var vChildren = tree.children if (vChildren) { var childNodes = rootNode.childNodes for (var i = 0; i < tree.children.length; i++) { rootIndex += 1 var vChild = vChildren[i] || noChild var nextIndex = rootIndex + (vChild.count || 0) // skip recursion down the tree if there are no nodes down here if (indexInRange(indices, rootIndex, nextIndex)) { recurse(childNodes[i], vChild, indices, nodes, rootIndex) } rootIndex = nextIndex } } } return nodes } // Binary search for an index in the interval [left, right] function indexInRange(indices, left, right) { if (indices.length === 0) { return false } var minIndex = 0 var maxIndex = indices.length - 1 var currentIndex var currentItem while (minIndex <= maxIndex) { currentIndex = ((maxIndex + minIndex) / 2) >> 0 currentItem = indices[currentIndex] if (minIndex === maxIndex) { return currentItem >= left && currentItem <= right } else if (currentItem < left) { minIndex = currentIndex + 1 } else if (currentItem > right) { maxIndex = currentIndex - 1 } else { return true } } return false; } function ascending(a, b) { return a > b ? 1 : -1 } },{}],87:[function(require,module,exports){ var applyProperties = require("./apply-properties") var isWidget = require("../vnode/is-widget.js") var VPatch = require("../vnode/vpatch.js") var updateWidget = require("./update-widget") module.exports = applyPatch function applyPatch(vpatch, domNode, renderOptions) { var type = vpatch.type var vNode = vpatch.vNode var patch = vpatch.patch switch (type) { case VPatch.REMOVE: return removeNode(domNode, vNode) case VPatch.INSERT: return insertNode(domNode, patch, renderOptions) case VPatch.VTEXT: return stringPatch(domNode, vNode, patch, renderOptions) case VPatch.WIDGET: return widgetPatch(domNode, vNode, patch, renderOptions) case VPatch.VNODE: return vNodePatch(domNode, vNode, patch, renderOptions) case VPatch.ORDER: reorderChildren(domNode, patch) return domNode case VPatch.PROPS: applyProperties(domNode, patch, vNode.properties) return domNode case VPatch.THUNK: return replaceRoot(domNode, renderOptions.patch(domNode, patch, renderOptions)) default: return domNode } } function removeNode(domNode, vNode) { var parentNode = domNode.parentNode if (parentNode) { parentNode.removeChild(domNode) } destroyWidget(domNode, vNode); return null } function insertNode(parentNode, vNode, renderOptions) { var newNode = renderOptions.render(vNode, renderOptions) if (parentNode) { parentNode.appendChild(newNode) } return parentNode } function stringPatch(domNode, leftVNode, vText, renderOptions) { var newNode if (domNode.nodeType === 3) { domNode.replaceData(0, domNode.length, vText.text) newNode = domNode } else { var parentNode = domNode.parentNode newNode = renderOptions.render(vText, renderOptions) if (parentNode && newNode !== domNode) { parentNode.replaceChild(newNode, domNode) } } return newNode } function widgetPatch(domNode, leftVNode, widget, renderOptions) { var updating = updateWidget(leftVNode, widget) var newNode if (updating) { newNode = widget.update(leftVNode, domNode) || domNode } else { newNode = renderOptions.render(widget, renderOptions) } var parentNode = domNode.parentNode if (parentNode && newNode !== domNode) { parentNode.replaceChild(newNode, domNode) } if (!updating) { destroyWidget(domNode, leftVNode) } return newNode } function vNodePatch(domNode, leftVNode, vNode, renderOptions) { var parentNode = domNode.parentNode var newNode = renderOptions.render(vNode, renderOptions) if (parentNode && newNode !== domNode) { parentNode.replaceChild(newNode, domNode) } return newNode } function destroyWidget(domNode, w) { if (typeof w.destroy === "function" && isWidget(w)) { w.destroy(domNode) } } function reorderChildren(domNode, moves) { var childNodes = domNode.childNodes var keyMap = {} var node var remove var insert for (var i = 0; i < moves.removes.length; i++) { remove = moves.removes[i] node = childNodes[remove.from] if (remove.key) { keyMap[remove.key] = node } domNode.removeChild(node) } var length = childNodes.length for (var j = 0; j < moves.inserts.length; j++) { insert = moves.inserts[j] node = keyMap[insert.key] // this is the weirdest bug i've ever seen in webkit domNode.insertBefore(node, insert.to >= length++ ? null : childNodes[insert.to]) } } function replaceRoot(oldRoot, newRoot) { if (oldRoot && newRoot && oldRoot !== newRoot && oldRoot.parentNode) { oldRoot.parentNode.replaceChild(newRoot, oldRoot) } return newRoot; } },{"../vnode/is-widget.js":102,"../vnode/vpatch.js":105,"./apply-properties":84,"./update-widget":89}],88:[function(require,module,exports){ var document = require("global/document") var isArray = require("x-is-array") var render = require("./create-element") var domIndex = require("./dom-index") var patchOp = require("./patch-op") module.exports = patch function patch(rootNode, patches, renderOptions) { renderOptions = renderOptions || {} renderOptions.patch = renderOptions.patch && renderOptions.patch !== patch ? renderOptions.patch : patchRecursive renderOptions.render = renderOptions.render || render return renderOptions.patch(rootNode, patches, renderOptions) } function patchRecursive(rootNode, patches, renderOptions) { var indices = patchIndices(patches) if (indices.length === 0) { return rootNode } var index = domIndex(rootNode, patches.a, indices) var ownerDocument = rootNode.ownerDocument if (!renderOptions.document && ownerDocument !== document) { renderOptions.document = ownerDocument } for (var i = 0; i < indices.length; i++) { var nodeIndex = indices[i] rootNode = applyPatch(rootNode, index[nodeIndex], patches[nodeIndex], renderOptions) } return rootNode } function applyPatch(rootNode, domNode, patchList, renderOptions) { if (!domNode) { return rootNode } var newNode if (isArray(patchList)) { for (var i = 0; i < patchList.length; i++) { newNode = patchOp(patchList[i], domNode, renderOptions) if (domNode === rootNode) { rootNode = newNode } } } else { newNode = patchOp(patchList, domNode, renderOptions) if (domNode === rootNode) { rootNode = newNode } } return rootNode } function patchIndices(patches) { var indices = [] for (var key in patches) { if (key !== "a") { indices.push(Number(key)) } } return indices } },{"./create-element":85,"./dom-index":86,"./patch-op":87,"global/document":62,"x-is-array":109}],89:[function(require,module,exports){ var isWidget = require("../vnode/is-widget.js") module.exports = updateWidget function updateWidget(a, b) { if (isWidget(a) && isWidget(b)) { if ("name" in a && "name" in b) { return a.id === b.id } else { return a.init === b.init } } return false } },{"../vnode/is-widget.js":102}],90:[function(require,module,exports){ 'use strict'; module.exports = AttributeHook; function AttributeHook(namespace, value) { if (!(this instanceof AttributeHook)) { return new AttributeHook(namespace, value); } this.namespace = namespace; this.value = value; } AttributeHook.prototype.hook = function (node, prop, prev) { if (prev && prev.type === 'AttributeHook' && prev.value === this.value && prev.namespace === this.namespace) { return; } node.setAttributeNS(this.namespace, prop, this.value); }; AttributeHook.prototype.unhook = function (node, prop, next) { if (next && next.type === 'AttributeHook' && next.namespace === this.namespace) { return; } var colonPosition = prop.indexOf(':'); var localName = colonPosition > -1 ? prop.substr(colonPosition + 1) : prop; node.removeAttributeNS(this.namespace, localName); }; AttributeHook.prototype.type = 'AttributeHook'; },{}],91:[function(require,module,exports){ 'use strict'; var EvStore = require('ev-store'); module.exports = EvHook; function EvHook(value) { if (!(this instanceof EvHook)) { return new EvHook(value); } this.value = value; } EvHook.prototype.hook = function (node, propertyName) { var es = EvStore(node); var propName = propertyName.substr(3); es[propName] = this.value; }; EvHook.prototype.unhook = function(node, propertyName) { var es = EvStore(node); var propName = propertyName.substr(3); es[propName] = undefined; }; },{"ev-store":61}],92:[function(require,module,exports){ 'use strict'; module.exports = SoftSetHook; function SoftSetHook(value) { if (!(this instanceof SoftSetHook)) { return new SoftSetHook(value); } this.value = value; } SoftSetHook.prototype.hook = function (node, propertyName) { if (node[propertyName] !== this.value) { node[propertyName] = this.value; } }; },{}],93:[function(require,module,exports){ 'use strict'; var isArray = require('x-is-array'); var VNode = require('../vnode/vnode.js'); var VText = require('../vnode/vtext.js'); var isVNode = require('../vnode/is-vnode'); var isVText = require('../vnode/is-vtext'); var isWidget = require('../vnode/is-widget'); var isHook = require('../vnode/is-vhook'); var isVThunk = require('../vnode/is-thunk'); var parseTag = require('./parse-tag.js'); var softSetHook = require('./hooks/soft-set-hook.js'); var evHook = require('./hooks/ev-hook.js'); module.exports = h; function h(tagName, properties, children) { var childNodes = []; var tag, props, key, namespace; if (!children && isChildren(properties)) { children = properties; props = {}; } props = props || properties || {}; tag = parseTag(tagName, props); // support keys if (props.hasOwnProperty('key')) { key = props.key; props.key = undefined; } // support namespace if (props.hasOwnProperty('namespace')) { namespace = props.namespace; props.namespace = undefined; } // fix cursor bug if (tag === 'INPUT' && !namespace && props.hasOwnProperty('value') && props.value !== undefined && !isHook(props.value) ) { props.value = softSetHook(props.value); } transformProperties(props); if (children !== undefined && children !== null) { addChild(children, childNodes, tag, props); } return new VNode(tag, props, childNodes, key, namespace); } function addChild(c, childNodes, tag, props) { if (typeof c === 'string') { childNodes.push(new VText(c)); } else if (typeof c === 'number') { childNodes.push(new VText(String(c))); } else if (isChild(c)) { childNodes.push(c); } else if (isArray(c)) { for (var i = 0; i < c.length; i++) { addChild(c[i], childNodes, tag, props); } } else if (c === null || c === undefined) { return; } else { throw UnexpectedVirtualElement({ foreignObject: c, parentVnode: { tagName: tag, properties: props } }); } } function transformProperties(props) { for (var propName in props) { if (props.hasOwnProperty(propName)) { var value = props[propName]; if (isHook(value)) { continue; } if (propName.substr(0, 3) === 'ev-') { // add ev-foo support props[propName] = evHook(value); } } } } function isChild(x) { return isVNode(x) || isVText(x) || isWidget(x) || isVThunk(x); } function isChildren(x) { return typeof x === 'string' || isArray(x) || isChild(x); } function UnexpectedVirtualElement(data) { var err = new Error(); err.type = 'virtual-hyperscript.unexpected.virtual-element'; err.message = 'Unexpected virtual child passed to h().\n' + 'Expected a VNode / Vthunk / VWidget / string but:\n' + 'got:\n' + errorString(data.foreignObject) + '.\n' + 'The parent vnode is:\n' + errorString(data.parentVnode) '\n' + 'Suggested fix: change your `h(..., [ ... ])` callsite.'; err.foreignObject = data.foreignObject; err.parentVnode = data.parentVnode; return err; } function errorString(obj) { try { return JSON.stringify(obj, null, ' '); } catch (e) { return String(obj); } } },{"../vnode/is-thunk":98,"../vnode/is-vhook":99,"../vnode/is-vnode":100,"../vnode/is-vtext":101,"../vnode/is-widget":102,"../vnode/vnode.js":104,"../vnode/vtext.js":106,"./hooks/ev-hook.js":91,"./hooks/soft-set-hook.js":92,"./parse-tag.js":94,"x-is-array":109}],94:[function(require,module,exports){ 'use strict'; var split = require('browser-split'); var classIdSplit = /([\.#]?[a-zA-Z0-9\u007F-\uFFFF_:-]+)/; var notClassId = /^\.|#/; module.exports = parseTag; function parseTag(tag, props) { if (!tag) { return 'DIV'; } var noId = !(props.hasOwnProperty('id')); var tagParts = split(tag, classIdSplit); var tagName = null; if (notClassId.test(tagParts[1])) { tagName = 'DIV'; } var classes, part, type, i; for (i = 0; i < tagParts.length; i++) { part = tagParts[i]; if (!part) { continue; } type = part.charAt(0); if (!tagName) { tagName = part; } else if (type === '.') { classes = classes || []; classes.push(part.substring(1, part.length)); } else if (type === '#' && noId) { props.id = part.substring(1, part.length); } } if (classes) { if (props.className) { classes.push(props.className); } props.className = classes.join(' '); } return props.namespace ? tagName : tagName.toUpperCase(); } },{"browser-split":3}],95:[function(require,module,exports){ 'use strict'; var DEFAULT_NAMESPACE = null; var EV_NAMESPACE = 'http://www.w3.org/2001/xml-events'; var XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink'; var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace'; // http://www.w3.org/TR/SVGTiny12/attributeTable.html // http://www.w3.org/TR/SVG/attindex.html var SVG_PROPERTIES = { 'about': DEFAULT_NAMESPACE, 'accent-height': DEFAULT_NAMESPACE, 'accumulate': DEFAULT_NAMESPACE, 'additive': DEFAULT_NAMESPACE, 'alignment-baseline': DEFAULT_NAMESPACE, 'alphabetic': DEFAULT_NAMESPACE, 'amplitude': DEFAULT_NAMESPACE, 'arabic-form': DEFAULT_NAMESPACE, 'ascent': DEFAULT_NAMESPACE, 'attributeName': DEFAULT_NAMESPACE, 'attributeType': DEFAULT_NAMESPACE, 'azimuth': DEFAULT_NAMESPACE, 'bandwidth': DEFAULT_NAMESPACE, 'baseFrequency': DEFAULT_NAMESPACE, 'baseProfile': DEFAULT_NAMESPACE, 'baseline-shift': DEFAULT_NAMESPACE, 'bbox': DEFAULT_NAMESPACE, 'begin': DEFAULT_NAMESPACE, 'bias': DEFAULT_NAMESPACE, 'by': DEFAULT_NAMESPACE, 'calcMode': DEFAULT_NAMESPACE, 'cap-height': DEFAULT_NAMESPACE, 'class': DEFAULT_NAMESPACE, 'clip': DEFAULT_NAMESPACE, 'clip-path': DEFAULT_NAMESPACE, 'clip-rule': DEFAULT_NAMESPACE, 'clipPathUnits': DEFAULT_NAMESPACE, 'color': DEFAULT_NAMESPACE, 'color-interpolation': DEFAULT_NAMESPACE, 'color-interpolation-filters': DEFAULT_NAMESPACE, 'color-profile': DEFAULT_NAMESPACE, 'color-rendering': DEFAULT_NAMESPACE, 'content': DEFAULT_NAMESPACE, 'contentScriptType': DEFAULT_NAMESPACE, 'contentStyleType': DEFAULT_NAMESPACE, 'cursor': DEFAULT_NAMESPACE, 'cx': DEFAULT_NAMESPACE, 'cy': DEFAULT_NAMESPACE, 'd': DEFAULT_NAMESPACE, 'datatype': DEFAULT_NAMESPACE, 'defaultAction': DEFAULT_NAMESPACE, 'descent': DEFAULT_NAMESPACE, 'diffuseConstant': DEFAULT_NAMESPACE, 'direction': DEFAULT_NAMESPACE, 'display': DEFAULT_NAMESPACE, 'divisor': DEFAULT_NAMESPACE, 'dominant-baseline': DEFAULT_NAMESPACE, 'dur': DEFAULT_NAMESPACE, 'dx': DEFAULT_NAMESPACE, 'dy': DEFAULT_NAMESPACE, 'edgeMode': DEFAULT_NAMESPACE, 'editable': DEFAULT_NAMESPACE, 'elevation': DEFAULT_NAMESPACE, 'enable-background': DEFAULT_NAMESPACE, 'end': DEFAULT_NAMESPACE, 'ev:event': EV_NAMESPACE, 'event': DEFAULT_NAMESPACE, 'exponent': DEFAULT_NAMESPACE, 'externalResourcesRequired': DEFAULT_NAMESPACE, 'fill': DEFAULT_NAMESPACE, 'fill-opacity': DEFAULT_NAMESPACE, 'fill-rule': DEFAULT_NAMESPACE, 'filter': DEFAULT_NAMESPACE, 'filterRes': DEFAULT_NAMESPACE, 'filterUnits': DEFAULT_NAMESPACE, 'flood-color': DEFAULT_NAMESPACE, 'flood-opacity': DEFAULT_NAMESPACE, 'focusHighlight': DEFAULT_NAMESPACE, 'focusable': DEFAULT_NAMESPACE, 'font-family': DEFAULT_NAMESPACE, 'font-size': DEFAULT_NAMESPACE, 'font-size-adjust': DEFAULT_NAMESPACE, 'font-stretch': DEFAULT_NAMESPACE, 'font-style': DEFAULT_NAMESPACE, 'font-variant': DEFAULT_NAMESPACE, 'font-weight': DEFAULT_NAMESPACE, 'format': DEFAULT_NAMESPACE, 'from': DEFAULT_NAMESPACE, 'fx': DEFAULT_NAMESPACE, 'fy': DEFAULT_NAMESPACE, 'g1': DEFAULT_NAMESPACE, 'g2': DEFAULT_NAMESPACE, 'glyph-name': DEFAULT_NAMESPACE, 'glyph-orientation-horizontal': DEFAULT_NAMESPACE, 'glyph-orientation-vertical': DEFAULT_NAMESPACE, 'glyphRef': DEFAULT_NAMESPACE, 'gradientTransform': DEFAULT_NAMESPACE, 'gradientUnits': DEFAULT_NAMESPACE, 'handler': DEFAULT_NAMESPACE, 'hanging': DEFAULT_NAMESPACE, 'height': DEFAULT_NAMESPACE, 'horiz-adv-x': DEFAULT_NAMESPACE, 'horiz-origin-x': DEFAULT_NAMESPACE, 'horiz-origin-y': DEFAULT_NAMESPACE, 'id': DEFAULT_NAMESPACE, 'ideographic': DEFAULT_NAMESPACE, 'image-rendering': DEFAULT_NAMESPACE, 'in': DEFAULT_NAMESPACE, 'in2': DEFAULT_NAMESPACE, 'initialVisibility': DEFAULT_NAMESPACE, 'intercept': DEFAULT_NAMESPACE, 'k': DEFAULT_NAMESPACE, 'k1': DEFAULT_NAMESPACE, 'k2': DEFAULT_NAMESPACE, 'k3': DEFAULT_NAMESPACE, 'k4': DEFAULT_NAMESPACE, 'kernelMatrix': DEFAULT_NAMESPACE, 'kernelUnitLength': DEFAULT_NAMESPACE, 'kerning': DEFAULT_NAMESPACE, 'keyPoints': DEFAULT_NAMESPACE, 'keySplines': DEFAULT_NAMESPACE, 'keyTimes': DEFAULT_NAMESPACE, 'lang': DEFAULT_NAMESPACE, 'lengthAdjust': DEFAULT_NAMESPACE, 'letter-spacing': DEFAULT_NAMESPACE, 'lighting-color': DEFAULT_NAMESPACE, 'limitingConeAngle': DEFAULT_NAMESPACE, 'local': DEFAULT_NAMESPACE, 'marker-end': DEFAULT_NAMESPACE, 'marker-mid': DEFAULT_NAMESPACE, 'marker-start': DEFAULT_NAMESPACE, 'markerHeight': DEFAULT_NAMESPACE, 'markerUnits': DEFAULT_NAMESPACE, 'markerWidth': DEFAULT_NAMESPACE, 'mask': DEFAULT_NAMESPACE, 'maskContentUnits': DEFAULT_NAMESPACE, 'maskUnits': DEFAULT_NAMESPACE, 'mathematical': DEFAULT_NAMESPACE, 'max': DEFAULT_NAMESPACE, 'media': DEFAULT_NAMESPACE, 'mediaCharacterEncoding': DEFAULT_NAMESPACE, 'mediaContentEncodings': DEFAULT_NAMESPACE, 'mediaSize': DEFAULT_NAMESPACE, 'mediaTime': DEFAULT_NAMESPACE, 'method': DEFAULT_NAMESPACE, 'min': DEFAULT_NAMESPACE, 'mode': DEFAULT_NAMESPACE, 'name': DEFAULT_NAMESPACE, 'nav-down': DEFAULT_NAMESPACE, 'nav-down-left': DEFAULT_NAMESPACE, 'nav-down-right': DEFAULT_NAMESPACE, 'nav-left': DEFAULT_NAMESPACE, 'nav-next': DEFAULT_NAMESPACE, 'nav-prev': DEFAULT_NAMESPACE, 'nav-right': DEFAULT_NAMESPACE, 'nav-up': DEFAULT_NAMESPACE, 'nav-up-left': DEFAULT_NAMESPACE, 'nav-up-right': DEFAULT_NAMESPACE, 'numOctaves': DEFAULT_NAMESPACE, 'observer': DEFAULT_NAMESPACE, 'offset': DEFAULT_NAMESPACE, 'opacity': DEFAULT_NAMESPACE, 'operator': DEFAULT_NAMESPACE, 'order': DEFAULT_NAMESPACE, 'orient': DEFAULT_NAMESPACE, 'orientation': DEFAULT_NAMESPACE, 'origin': DEFAULT_NAMESPACE, 'overflow': DEFAULT_NAMESPACE, 'overlay': DEFAULT_NAMESPACE, 'overline-position': DEFAULT_NAMESPACE, 'overline-thickness': DEFAULT_NAMESPACE, 'panose-1': DEFAULT_NAMESPACE, 'path': DEFAULT_NAMESPACE, 'pathLength': DEFAULT_NAMESPACE, 'patternContentUnits': DEFAULT_NAMESPACE, 'patternTransform': DEFAULT_NAMESPACE, 'patternUnits': DEFAULT_NAMESPACE, 'phase': DEFAULT_NAMESPACE, 'playbackOrder': DEFAULT_NAMESPACE, 'pointer-events': DEFAULT_NAMESPACE, 'points': DEFAULT_NAMESPACE, 'pointsAtX': DEFAULT_NAMESPACE, 'pointsAtY': DEFAULT_NAMESPACE, 'pointsAtZ': DEFAULT_NAMESPACE, 'preserveAlpha': DEFAULT_NAMESPACE, 'preserveAspectRatio': DEFAULT_NAMESPACE, 'primitiveUnits': DEFAULT_NAMESPACE, 'propagate': DEFAULT_NAMESPACE, 'property': DEFAULT_NAMESPACE, 'r': DEFAULT_NAMESPACE, 'radius': DEFAULT_NAMESPACE, 'refX': DEFAULT_NAMESPACE, 'refY': DEFAULT_NAMESPACE, 'rel': DEFAULT_NAMESPACE, 'rendering-intent': DEFAULT_NAMESPACE, 'repeatCount': DEFAULT_NAMESPACE, 'repeatDur': DEFAULT_NAMESPACE, 'requiredExtensions': DEFAULT_NAMESPACE, 'requiredFeatures': DEFAULT_NAMESPACE, 'requiredFonts': DEFAULT_NAMESPACE, 'requiredFormats': DEFAULT_NAMESPACE, 'resource': DEFAULT_NAMESPACE, 'restart': DEFAULT_NAMESPACE, 'result': DEFAULT_NAMESPACE, 'rev': DEFAULT_NAMESPACE, 'role': DEFAULT_NAMESPACE, 'rotate': DEFAULT_NAMESPACE, 'rx': DEFAULT_NAMESPACE, 'ry': DEFAULT_NAMESPACE, 'scale': DEFAULT_NAMESPACE, 'seed': DEFAULT_NAMESPACE, 'shape-rendering': DEFAULT_NAMESPACE, 'slope': DEFAULT_NAMESPACE, 'snapshotTime': DEFAULT_NAMESPACE, 'spacing': DEFAULT_NAMESPACE, 'specularConstant': DEFAULT_NAMESPACE, 'specularExponent': DEFAULT_NAMESPACE, 'spreadMethod': DEFAULT_NAMESPACE, 'startOffset': DEFAULT_NAMESPACE, 'stdDeviation': DEFAULT_NAMESPACE, 'stemh': DEFAULT_NAMESPACE, 'stemv': DEFAULT_NAMESPACE, 'stitchTiles': DEFAULT_NAMESPACE, 'stop-color': DEFAULT_NAMESPACE, 'stop-opacity': DEFAULT_NAMESPACE, 'strikethrough-position': DEFAULT_NAMESPACE, 'strikethrough-thickness': DEFAULT_NAMESPACE, 'string': DEFAULT_NAMESPACE, 'stroke': DEFAULT_NAMESPACE, 'stroke-dasharray': DEFAULT_NAMESPACE, 'stroke-dashoffset': DEFAULT_NAMESPACE, 'stroke-linecap': DEFAULT_NAMESPACE, 'stroke-linejoin': DEFAULT_NAMESPACE, 'stroke-miterlimit': DEFAULT_NAMESPACE, 'stroke-opacity': DEFAULT_NAMESPACE, 'stroke-width': DEFAULT_NAMESPACE, 'surfaceScale': DEFAULT_NAMESPACE, 'syncBehavior': DEFAULT_NAMESPACE, 'syncBehaviorDefault': DEFAULT_NAMESPACE, 'syncMaster': DEFAULT_NAMESPACE, 'syncTolerance': DEFAULT_NAMESPACE, 'syncToleranceDefault': DEFAULT_NAMESPACE, 'systemLanguage': DEFAULT_NAMESPACE, 'tableValues': DEFAULT_NAMESPACE, 'target': DEFAULT_NAMESPACE, 'targetX': DEFAULT_NAMESPACE, 'targetY': DEFAULT_NAMESPACE, 'text-anchor': DEFAULT_NAMESPACE, 'text-decoration': DEFAULT_NAMESPACE, 'text-rendering': DEFAULT_NAMESPACE, 'textLength': DEFAULT_NAMESPACE, 'timelineBegin': DEFAULT_NAMESPACE, 'title': DEFAULT_NAMESPACE, 'to': DEFAULT_NAMESPACE, 'transform': DEFAULT_NAMESPACE, 'transformBehavior': DEFAULT_NAMESPACE, 'type': DEFAULT_NAMESPACE, 'typeof': DEFAULT_NAMESPACE, 'u1': DEFAULT_NAMESPACE, 'u2': DEFAULT_NAMESPACE, 'underline-position': DEFAULT_NAMESPACE, 'underline-thickness': DEFAULT_NAMESPACE, 'unicode': DEFAULT_NAMESPACE, 'unicode-bidi': DEFAULT_NAMESPACE, 'unicode-range': DEFAULT_NAMESPACE, 'units-per-em': DEFAULT_NAMESPACE, 'v-alphabetic': DEFAULT_NAMESPACE, 'v-hanging': DEFAULT_NAMESPACE, 'v-ideographic': DEFAULT_NAMESPACE, 'v-mathematical': DEFAULT_NAMESPACE, 'values': DEFAULT_NAMESPACE, 'version': DEFAULT_NAMESPACE, 'vert-adv-y': DEFAULT_NAMESPACE, 'vert-origin-x': DEFAULT_NAMESPACE, 'vert-origin-y': DEFAULT_NAMESPACE, 'viewBox': DEFAULT_NAMESPACE, 'viewTarget': DEFAULT_NAMESPACE, 'visibility': DEFAULT_NAMESPACE, 'width': DEFAULT_NAMESPACE, 'widths': DEFAULT_NAMESPACE, 'word-spacing': DEFAULT_NAMESPACE, 'writing-mode': DEFAULT_NAMESPACE, 'x': DEFAULT_NAMESPACE, 'x-height': DEFAULT_NAMESPACE, 'x1': DEFAULT_NAMESPACE, 'x2': DEFAULT_NAMESPACE, 'xChannelSelector': DEFAULT_NAMESPACE, 'xlink:actuate': XLINK_NAMESPACE, 'xlink:arcrole': XLINK_NAMESPACE, 'xlink:href': XLINK_NAMESPACE, 'xlink:role': XLINK_NAMESPACE, 'xlink:show': XLINK_NAMESPACE, 'xlink:title': XLINK_NAMESPACE, 'xlink:type': XLINK_NAMESPACE, 'xml:base': XML_NAMESPACE, 'xml:id': XML_NAMESPACE, 'xml:lang': XML_NAMESPACE, 'xml:space': XML_NAMESPACE, 'y': DEFAULT_NAMESPACE, 'y1': DEFAULT_NAMESPACE, 'y2': DEFAULT_NAMESPACE, 'yChannelSelector': DEFAULT_NAMESPACE, 'z': DEFAULT_NAMESPACE, 'zoomAndPan': DEFAULT_NAMESPACE }; module.exports = SVGAttributeNamespace; function SVGAttributeNamespace(value) { if (SVG_PROPERTIES.hasOwnProperty(value)) { return SVG_PROPERTIES[value]; } } },{}],96:[function(require,module,exports){ 'use strict'; var isArray = require('x-is-array'); var h = require('./index.js'); var SVGAttributeNamespace = require('./svg-attribute-namespace'); var attributeHook = require('./hooks/attribute-hook'); var SVG_NAMESPACE = 'http://www.w3.org/2000/svg'; module.exports = svg; function svg(tagName, properties, children) { if (!children && isChildren(properties)) { children = properties; properties = {}; } properties = properties || {}; // set namespace for svg properties.namespace = SVG_NAMESPACE; var attributes = properties.attributes || (properties.attributes = {}); for (var key in properties) { if (!properties.hasOwnProperty(key)) { continue; } var namespace = SVGAttributeNamespace(key); if (namespace === undefined) { // not a svg attribute continue; } var value = properties[key]; if (typeof value !== 'string' && typeof value !== 'number' && typeof value !== 'boolean' ) { continue; } if (namespace !== null) { // namespaced attribute properties[key] = attributeHook(namespace, value); continue; } attributes[key] = value properties[key] = undefined } return h(tagName, properties, children); } function isChildren(x) { return typeof x === 'string' || isArray(x); } },{"./hooks/attribute-hook":90,"./index.js":93,"./svg-attribute-namespace":95,"x-is-array":109}],97:[function(require,module,exports){ var isVNode = require("./is-vnode") var isVText = require("./is-vtext") var isWidget = require("./is-widget") var isThunk = require("./is-thunk") module.exports = handleThunk function handleThunk(a, b) { var renderedA = a var renderedB = b if (isThunk(b)) { renderedB = renderThunk(b, a) } if (isThunk(a)) { renderedA = renderThunk(a, null) } return { a: renderedA, b: renderedB } } function renderThunk(thunk, previous) { var renderedThunk = thunk.vnode if (!renderedThunk) { renderedThunk = thunk.vnode = thunk.render(previous) } if (!(isVNode(renderedThunk) || isVText(renderedThunk) || isWidget(renderedThunk))) { throw new Error("thunk did not return a valid node"); } return renderedThunk } },{"./is-thunk":98,"./is-vnode":100,"./is-vtext":101,"./is-widget":102}],98:[function(require,module,exports){ module.exports = isThunk function isThunk(t) { return t && t.type === "Thunk" } },{}],99:[function(require,module,exports){ module.exports = isHook function isHook(hook) { return hook && (typeof hook.hook === "function" && !hook.hasOwnProperty("hook") || typeof hook.unhook === "function" && !hook.hasOwnProperty("unhook")) } },{}],100:[function(require,module,exports){ var version = require("./version") module.exports = isVirtualNode function isVirtualNode(x) { return x && x.type === "VirtualNode" && x.version === version } },{"./version":103}],101:[function(require,module,exports){ var version = require("./version") module.exports = isVirtualText function isVirtualText(x) { return x && x.type === "VirtualText" && x.version === version } },{"./version":103}],102:[function(require,module,exports){ module.exports = isWidget function isWidget(w) { return w && w.type === "Widget" } },{}],103:[function(require,module,exports){ module.exports = "2" },{}],104:[function(require,module,exports){ var version = require("./version") var isVNode = require("./is-vnode") var isWidget = require("./is-widget") var isThunk = require("./is-thunk") var isVHook = require("./is-vhook") module.exports = VirtualNode var noProperties = {} var noChildren = [] function VirtualNode(tagName, properties, children, key, namespace) { this.tagName = tagName this.properties = properties || noProperties this.children = children || noChildren this.key = key != null ? String(key) : undefined this.namespace = (typeof namespace === "string") ? namespace : null var count = (children && children.length) || 0 var descendants = 0 var hasWidgets = false var hasThunks = false var descendantHooks = false var hooks for (var propName in properties) { if (properties.hasOwnProperty(propName)) { var property = properties[propName] if (isVHook(property) && property.unhook) { if (!hooks) { hooks = {} } hooks[propName] = property } } } for (var i = 0; i < count; i++) { var child = children[i] if (isVNode(child)) { descendants += child.count || 0 if (!hasWidgets && child.hasWidgets) { hasWidgets = true } if (!hasThunks && child.hasThunks) { hasThunks = true } if (!descendantHooks && (child.hooks || child.descendantHooks)) { descendantHooks = true } } else if (!hasWidgets && isWidget(child)) { if (typeof child.destroy === "function") { hasWidgets = true } } else if (!hasThunks && isThunk(child)) { hasThunks = true; } } this.count = count + descendants this.hasWidgets = hasWidgets this.hasThunks = hasThunks this.hooks = hooks this.descendantHooks = descendantHooks } VirtualNode.prototype.version = version VirtualNode.prototype.type = "VirtualNode" },{"./is-thunk":98,"./is-vhook":99,"./is-vnode":100,"./is-widget":102,"./version":103}],105:[function(require,module,exports){ var version = require("./version") VirtualPatch.NONE = 0 VirtualPatch.VTEXT = 1 VirtualPatch.VNODE = 2 VirtualPatch.WIDGET = 3 VirtualPatch.PROPS = 4 VirtualPatch.ORDER = 5 VirtualPatch.INSERT = 6 VirtualPatch.REMOVE = 7 VirtualPatch.THUNK = 8 module.exports = VirtualPatch function VirtualPatch(type, vNode, patch) { this.type = Number(type) this.vNode = vNode this.patch = patch } VirtualPatch.prototype.version = version VirtualPatch.prototype.type = "VirtualPatch" },{"./version":103}],106:[function(require,module,exports){ var version = require("./version") module.exports = VirtualText function VirtualText(text) { this.text = String(text) } VirtualText.prototype.version = version VirtualText.prototype.type = "VirtualText" },{"./version":103}],107:[function(require,module,exports){ var isObject = require("is-object") var isHook = require("../vnode/is-vhook") module.exports = diffProps function diffProps(a, b) { var diff for (var aKey in a) { if (!(aKey in b)) { diff = diff || {} diff[aKey] = undefined } var aValue = a[aKey] var bValue = b[aKey] if (aValue === bValue) { continue } else if (isObject(aValue) && isObject(bValue)) { if (getPrototype(bValue) !== getPrototype(aValue)) { diff = diff || {} diff[aKey] = bValue } else if (isHook(bValue)) { diff = diff || {} diff[aKey] = bValue } else { var objectDiff = diffProps(aValue, bValue) if (objectDiff) { diff = diff || {} diff[aKey] = objectDiff } } } else { diff = diff || {} diff[aKey] = bValue } } for (var bKey in b) { if (!(bKey in a)) { diff = diff || {} diff[bKey] = b[bKey] } } return diff } function getPrototype(value) { if (Object.getPrototypeOf) { return Object.getPrototypeOf(value) } else if (value.__proto__) { return value.__proto__ } else if (value.constructor) { return value.constructor.prototype } } },{"../vnode/is-vhook":99,"is-object":65}],108:[function(require,module,exports){ var isArray = require("x-is-array") var VPatch = require("../vnode/vpatch") var isVNode = require("../vnode/is-vnode") var isVText = require("../vnode/is-vtext") var isWidget = require("../vnode/is-widget") var isThunk = require("../vnode/is-thunk") var handleThunk = require("../vnode/handle-thunk") var diffProps = require("./diff-props") module.exports = diff function diff(a, b) { var patch = { a: a } walk(a, b, patch, 0) return patch } function walk(a, b, patch, index) { if (a === b) { return } var apply = patch[index] var applyClear = false if (isThunk(a) || isThunk(b)) { thunks(a, b, patch, index) } else if (b == null) { // If a is a widget we will add a remove patch for it // Otherwise any child widgets/hooks must be destroyed. // This prevents adding two remove patches for a widget. if (!isWidget(a)) { clearState(a, patch, index) apply = patch[index] } apply = appendPatch(apply, new VPatch(VPatch.REMOVE, a, b)) } else if (isVNode(b)) { if (isVNode(a)) { if (a.tagName === b.tagName && a.namespace === b.namespace && a.key === b.key) { var propsPatch = diffProps(a.properties, b.properties) if (propsPatch) { apply = appendPatch(apply, new VPatch(VPatch.PROPS, a, propsPatch)) } apply = diffChildren(a, b, patch, apply, index) } else { apply = appendPatch(apply, new VPatch(VPatch.VNODE, a, b)) applyClear = true } } else { apply = appendPatch(apply, new VPatch(VPatch.VNODE, a, b)) applyClear = true } } else if (isVText(b)) { if (!isVText(a)) { apply = appendPatch(apply, new VPatch(VPatch.VTEXT, a, b)) applyClear = true } else if (a.text !== b.text) { apply = appendPatch(apply, new VPatch(VPatch.VTEXT, a, b)) } } else if (isWidget(b)) { if (!isWidget(a)) { applyClear = true } apply = appendPatch(apply, new VPatch(VPatch.WIDGET, a, b)) } if (apply) { patch[index] = apply } if (applyClear) { clearState(a, patch, index) } } function diffChildren(a, b, patch, apply, index) { var aChildren = a.children var orderedSet = reorder(aChildren, b.children) var bChildren = orderedSet.children var aLen = aChildren.length var bLen = bChildren.length var len = aLen > bLen ? aLen : bLen for (var i = 0; i < len; i++) { var leftNode = aChildren[i] var rightNode = bChildren[i] index += 1 if (!leftNode) { if (rightNode) { // Excess nodes in b need to be added apply = appendPatch(apply, new VPatch(VPatch.INSERT, null, rightNode)) } } else { walk(leftNode, rightNode, patch, index) } if (isVNode(leftNode) && leftNode.count) { index += leftNode.count } } if (orderedSet.moves) { // Reorder nodes last apply = appendPatch(apply, new VPatch( VPatch.ORDER, a, orderedSet.moves )) } return apply } function clearState(vNode, patch, index) { // TODO: Make this a single walk, not two unhook(vNode, patch, index) destroyWidgets(vNode, patch, index) } // Patch records for all destroyed widgets must be added because we need // a DOM node reference for the destroy function function destroyWidgets(vNode, patch, index) { if (isWidget(vNode)) { if (typeof vNode.destroy === "function") { patch[index] = appendPatch( patch[index], new VPatch(VPatch.REMOVE, vNode, null) ) } } else if (isVNode(vNode) && (vNode.hasWidgets || vNode.hasThunks)) { var children = vNode.children var len = children.length for (var i = 0; i < len; i++) { var child = children[i] index += 1 destroyWidgets(child, patch, index) if (isVNode(child) && child.count) { index += child.count } } } else if (isThunk(vNode)) { thunks(vNode, null, patch, index) } } // Create a sub-patch for thunks function thunks(a, b, patch, index) { var nodes = handleThunk(a, b) var thunkPatch = diff(nodes.a, nodes.b) if (hasPatches(thunkPatch)) { patch[index] = new VPatch(VPatch.THUNK, null, thunkPatch) } } function hasPatches(patch) { for (var index in patch) { if (index !== "a") { return true } } return false } // Execute hooks when two nodes are identical function unhook(vNode, patch, index) { if (isVNode(vNode)) { if (vNode.hooks) { patch[index] = appendPatch( patch[index], new VPatch( VPatch.PROPS, vNode, undefinedKeys(vNode.hooks) ) ) } if (vNode.descendantHooks || vNode.hasThunks) { var children = vNode.children var len = children.length for (var i = 0; i < len; i++) { var child = children[i] index += 1 unhook(child, patch, index) if (isVNode(child) && child.count) { index += child.count } } } } else if (isThunk(vNode)) { thunks(vNode, null, patch, index) } } function undefinedKeys(obj) { var result = {} for (var key in obj) { result[key] = undefined } return result } // List diff, naive left to right reordering function reorder(aChildren, bChildren) { // O(M) time, O(M) memory var bChildIndex = keyIndex(bChildren) var bKeys = bChildIndex.keys var bFree = bChildIndex.free if (bFree.length === bChildren.length) { return { children: bChildren, moves: null } } // O(N) time, O(N) memory var aChildIndex = keyIndex(aChildren) var aKeys = aChildIndex.keys var aFree = aChildIndex.free if (aFree.length === aChildren.length) { return { children: bChildren, moves: null } } // O(MAX(N, M)) memory var newChildren = [] var freeIndex = 0 var freeCount = bFree.length var deletedItems = 0 // Iterate through a and match a node in b // O(N) time, for (var i = 0 ; i < aChildren.length; i++) { var aItem = aChildren[i] var itemIndex if (aItem.key) { if (bKeys.hasOwnProperty(aItem.key)) { // Match up the old keys itemIndex = bKeys[aItem.key] newChildren.push(bChildren[itemIndex]) } else { // Remove old keyed items itemIndex = i - deletedItems++ newChildren.push(null) } } else { // Match the item in a with the next free item in b if (freeIndex < freeCount) { itemIndex = bFree[freeIndex++] newChildren.push(bChildren[itemIndex]) } else { // There are no free items in b to match with // the free items in a, so the extra free nodes // are deleted. itemIndex = i - deletedItems++ newChildren.push(null) } } } var lastFreeIndex = freeIndex >= bFree.length ? bChildren.length : bFree[freeIndex] // Iterate through b and append any new keys // O(M) time for (var j = 0; j < bChildren.length; j++) { var newItem = bChildren[j] if (newItem.key) { if (!aKeys.hasOwnProperty(newItem.key)) { // Add any new keyed items // We are adding new items to the end and then sorting them // in place. In future we should insert new items in place. newChildren.push(newItem) } } else if (j >= lastFreeIndex) { // Add any leftover non-keyed items newChildren.push(newItem) } } var simulate = newChildren.slice() var simulateIndex = 0 var removes = [] var inserts = [] var simulateItem for (var k = 0; k < bChildren.length;) { var wantedItem = bChildren[k] simulateItem = simulate[simulateIndex] // remove items while (simulateItem === null && simulate.length) { removes.push(remove(simulate, simulateIndex, null)) simulateItem = simulate[simulateIndex] } if (!simulateItem || simulateItem.key !== wantedItem.key) { // if we need a key in this position... if (wantedItem.key) { if (simulateItem && simulateItem.key) { // if an insert doesn't put this key in place, it needs to move if (bKeys[simulateItem.key] !== k + 1) { removes.push(remove(simulate, simulateIndex, simulateItem.key)) simulateItem = simulate[simulateIndex] // if the remove didn't put the wanted item in place, we need to insert it if (!simulateItem || simulateItem.key !== wantedItem.key) { inserts.push({key: wantedItem.key, to: k}) } // items are matching, so skip ahead else { simulateIndex++ } } else { inserts.push({key: wantedItem.key, to: k}) } } else { inserts.push({key: wantedItem.key, to: k}) } k++ } // a key in simulate has no matching wanted key, remove it else if (simulateItem && simulateItem.key) { removes.push(remove(simulate, simulateIndex, simulateItem.key)) } } else { simulateIndex++ k++ } } // remove all the remaining nodes from simulate while(simulateIndex < simulate.length) { simulateItem = simulate[simulateIndex] removes.push(remove(simulate, simulateIndex, simulateItem && simulateItem.key)) } // If the only moves we have are deletes then we can just // let the delete patch remove these items. if (removes.length === deletedItems && !inserts.length) { return { children: newChildren, moves: null } } return { children: newChildren, moves: { removes: removes, inserts: inserts } } } function remove(arr, index, key) { arr.splice(index, 1) return { from: index, key: key } } function keyIndex(children) { var keys = {} var free = [] var length = children.length for (var i = 0; i < length; i++) { var child = children[i] if (child.key) { keys[child.key] = i } else { free.push(i) } } return { keys: keys, // A hash of key name to index free: free // An array of unkeyed item indices } } function appendPatch(apply, patch) { if (apply) { if (isArray(apply)) { apply.push(patch) } else { apply = [apply, patch] } return apply } else { return patch } } },{"../vnode/handle-thunk":97,"../vnode/is-thunk":98,"../vnode/is-vnode":100,"../vnode/is-vtext":101,"../vnode/is-widget":102,"../vnode/vpatch":105,"./diff-props":107,"x-is-array":109}],109:[function(require,module,exports){ var nativeIsArray = Array.isArray var toString = Object.prototype.toString module.exports = nativeIsArray || isArray function isArray(obj) { return toString.call(obj) === "[object Array]" } },{}],110:[function(require,module,exports){ "use strict"; function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var _require = require("@cycle/core"); var Rx = _require.Rx; var ALL_PROPS = "*"; var PROPS_DRIVER_NAME = "props"; var EVENTS_SINK_NAME = "events"; function makeDispatchFunction(element, eventName) { return function dispatchCustomEvent(evData) { //console.log(`%cdispatchCustomEvent ` + eventName, // `background-color: #CCCCFF; color: black`); var event = undefined; try { event = new Event(eventName); } catch (err) { event = document.createEvent("Event"); event.initEvent(eventName, true, true); } event.detail = evData; element.dispatchEvent(event); }; } function subscribeDispatchers(element) { var customEvents = element.cycleCustomElementMetadata.customEvents; var disposables = new Rx.CompositeDisposable(); for (var _name in customEvents) { if (customEvents.hasOwnProperty(_name) && typeof customEvents[_name].subscribe === "function") { var disposable = customEvents[_name].subscribe(makeDispatchFunction(element, _name)); disposables.add(disposable); } } return disposables; } function subscribeDispatchersWhenRootChanges(metadata) { return metadata.rootElem$.distinctUntilChanged(Rx.helpers.identity, function (x, y) { return x && y && x.isEqualNode && x.isEqualNode(y); }).subscribe(function resubscribeDispatchers(rootElem) { if (metadata.eventDispatchingSubscription) { metadata.eventDispatchingSubscription.dispose(); } metadata.eventDispatchingSubscription = subscribeDispatchers(rootElem); }); } function subscribeEventDispatchingSink(element, widget) { element.cycleCustomElementMetadata.eventDispatchingSubscription = subscribeDispatchers(element); widget.disposables.add(element.cycleCustomElementMetadata.eventDispatchingSubscription); widget.disposables.add(subscribeDispatchersWhenRootChanges(element.cycleCustomElementMetadata)); } function makePropertiesDriver() { var propertiesDriver = {}; var defaultComparer = Rx.helpers.defaultComparer; Object.defineProperty(propertiesDriver, "type", { enumerable: false, value: "PropertiesDriver" }); Object.defineProperty(propertiesDriver, "get", { enumerable: false, value: function get(streamKey) { var comparer = arguments.length <= 1 || arguments[1] === undefined ? defaultComparer : arguments[1]; if (typeof streamKey === "undefined") { throw new Error("Custom element driver `props.get()` expects an " + "argument in the getter."); } if (typeof this[streamKey] === "undefined") { this[streamKey] = new Rx.ReplaySubject(1); } return this[streamKey].distinctUntilChanged(Rx.helpers.identity, comparer); } }); Object.defineProperty(propertiesDriver, "getAll", { enumerable: false, value: function getAll() { return this.get(ALL_PROPS); } }); return propertiesDriver; } function createContainerElement(tagName, vtreeProperties) { var element = document.createElement("div"); element.id = vtreeProperties.id || ""; element.className = vtreeProperties.className || ""; element.className += " cycleCustomElement-" + tagName.toUpperCase(); element.className = element.className.trim(); element.cycleCustomElementMetadata = { propertiesDriver: null, rootElem$: null, customEvents: null, eventDispatchingSubscription: false }; return element; } function throwIfVTreeHasPropertyChildren(vtree) { if (typeof vtree.properties.children !== "undefined") { throw new Error("Custom element should not have property `children`. " + "It is reserved for children elements nested into this custom element."); } } function makeCustomElementInput(domOutput, propertiesDriver, domDriverName) { var _ref; return (_ref = {}, _defineProperty(_ref, domDriverName, domOutput), _defineProperty(_ref, PROPS_DRIVER_NAME, propertiesDriver), _ref); } function makeConstructor() { return function customElementConstructor(vtree, CERegistry, driverName) { //console.log(`%cnew (constructor) custom element ` + vtree.tagName, // `color: #880088`) throwIfVTreeHasPropertyChildren(vtree); this.type = "Widget"; this.properties = vtree.properties; this.properties.children = vtree.children; this.key = vtree.key; this.isCustomElementWidget = true; this.customElementsRegistry = CERegistry; this.driverName = driverName; this.firstRootElem$ = new Rx.ReplaySubject(1); this.disposables = new Rx.CompositeDisposable(); }; } function validateDefFnOutput(defFnOutput, domDriverName, tagName) { if (typeof defFnOutput !== "object") { throw new Error("Custom element definition function for `" + tagName + "` " + " should output an object."); } if (typeof defFnOutput[domDriverName] === "undefined") { throw new Error("Custom element definition function for '" + tagName + "' " + ("should output an object containing `" + domDriverName + "`.")); } if (typeof defFnOutput[domDriverName].subscribe !== "function") { throw new Error("Custom element definition function for `" + tagName + "` " + "should output an object containing an Observable of VTree, named " + ("`" + domDriverName + "`.")); } for (var _name2 in defFnOutput) { if (defFnOutput.hasOwnProperty(_name2) && _name2 !== domDriverName && _name2 !== EVENTS_SINK_NAME) { throw new Error("Unknown `" + _name2 + "` found on custom element " + ("`" + tagName + "`s definition function's output.")); } } } function makeInit(tagName, definitionFn) { var _require2 = require("./render-dom"); var makeDOMDriverWithRegistry = _require2.makeDOMDriverWithRegistry; return function initCustomElement() { //console.log(`%cInit() custom element ` + tagName, `color: #880088`) var widget = this; var driverName = widget.driverName; var registry = widget.customElementsRegistry; var element = createContainerElement(tagName, widget.properties); var proxyVTree$ = new Rx.ReplaySubject(1); var domDriver = makeDOMDriverWithRegistry(element, registry); var propertiesDriver = makePropertiesDriver(); var domResponse = domDriver(proxyVTree$, driverName); var rootElem$ = domResponse.get(":root"); rootElem$.subscribe(function (rootElem) { // This is expected to happen before initCustomElement() returns `element` element = rootElem; }); var defFnInput = makeCustomElementInput(domResponse, propertiesDriver, driverName); var requests = definitionFn(defFnInput); validateDefFnOutput(requests, driverName, tagName); widget.disposables.add(requests[driverName].subscribe(proxyVTree$.asObserver())); widget.disposables.add(rootElem$.subscribe(widget.firstRootElem$.asObserver())); element.cycleCustomElementMetadata = { propertiesDriver: propertiesDriver, rootElem$: rootElem$, customEvents: requests.events, eventDispatchingSubscription: false }; subscribeEventDispatchingSink(element, widget); widget.disposables.add(widget.firstRootElem$); widget.disposables.add(proxyVTree$); widget.disposables.add(domResponse); widget.update(null, element); return element; }; } function validatePropertiesDriverInMetadata(element, fnName) { if (!element) { throw new Error("Missing DOM element when calling `" + fnName + "` on " + "custom element Widget."); } if (!element.cycleCustomElementMetadata) { throw new Error("Missing custom element metadata on DOM element when " + ("calling `" + fnName + "` on custom element Widget.")); } var metadata = element.cycleCustomElementMetadata; if (metadata.propertiesDriver.type !== "PropertiesDriver") { throw new Error("Custom element metadata's propertiesDriver type is " + ("invalid: `" + metadata.propertiesDriver.type + "`.")); } } function updateCustomElement(previous, element) { if (previous) { this.disposables = previous.disposables; this.firstRootElem$.onNext(0); this.firstRootElem$.onCompleted(); } validatePropertiesDriverInMetadata(element, "update()"); //console.log(`%cupdate() ${element.className}`, `color: #880088`) var propsDriver = element.cycleCustomElementMetadata.propertiesDriver; if (propsDriver.hasOwnProperty(ALL_PROPS)) { propsDriver[ALL_PROPS].onNext(this.properties); } for (var prop in propsDriver) { if (propsDriver.hasOwnProperty(prop) && this.properties.hasOwnProperty(prop)) { propsDriver[prop].onNext(this.properties[prop]); } } } function destroyCustomElement(element) { //console.log(`%cdestroy() custom el ${element.className}`, `color: #808`) // Dispose propertiesDriver var propsDriver = element.cycleCustomElementMetadata.propertiesDriver; for (var prop in propsDriver) { if (propsDriver.hasOwnProperty(prop)) { this.disposables.add(propsDriver[prop]); } } if (element.cycleCustomElementMetadata.eventDispatchingSubscription) { // This subscription has to be disposed. // Because disposing subscribeDispatchersWhenRootChanges only // is not enough. this.disposables.add(element.cycleCustomElementMetadata.eventDispatchingSubscription); } this.disposables.dispose(); } function makeWidgetClass(tagName, definitionFn) { if (typeof definitionFn !== "function") { throw new Error("A custom element definition given to the DOM driver " + "should be a function."); } var WidgetClass = makeConstructor(); WidgetClass.definitionFn = definitionFn; // needed by renderAsHTML WidgetClass.prototype.init = makeInit(tagName, definitionFn); WidgetClass.prototype.update = updateCustomElement; WidgetClass.prototype.destroy = destroyCustomElement; return WidgetClass; } module.exports = { makeDispatchFunction: makeDispatchFunction, subscribeDispatchers: subscribeDispatchers, subscribeDispatchersWhenRootChanges: subscribeDispatchersWhenRootChanges, makePropertiesDriver: makePropertiesDriver, createContainerElement: createContainerElement, throwIfVTreeHasPropertyChildren: throwIfVTreeHasPropertyChildren, makeConstructor: makeConstructor, makeInit: makeInit, updateCustomElement: updateCustomElement, destroyCustomElement: destroyCustomElement, ALL_PROPS: ALL_PROPS, makeCustomElementInput: makeCustomElementInput, makeWidgetClass: makeWidgetClass }; },{"./render-dom":113,"@cycle/core":1}],111:[function(require,module,exports){ "use strict"; var _require = require("./custom-element-widget"); var makeWidgetClass = _require.makeWidgetClass; var Map = Map || require("es6-map"); // eslint-disable-line no-native-reassign function replaceCustomElementsWithSomething(vtree, registry, toSomethingFn) { // Silently ignore corner cases if (!vtree) { return vtree; } var tagName = (vtree.tagName || "").toUpperCase(); // Replace vtree itself if (tagName && registry.has(tagName)) { var WidgetClass = registry.get(tagName); return toSomethingFn(vtree, WidgetClass); } // Or replace children recursively if (Array.isArray(vtree.children)) { for (var i = vtree.children.length - 1; i >= 0; i--) { vtree.children[i] = replaceCustomElementsWithSomething(vtree.children[i], registry, toSomethingFn); } } return vtree; } function makeCustomElementsRegistry(definitions) { var registry = new Map(); for (var tagName in definitions) { if (definitions.hasOwnProperty(tagName)) { registry.set(tagName.toUpperCase(), makeWidgetClass(tagName, definitions[tagName])); } } return registry; } module.exports = { replaceCustomElementsWithSomething: replaceCustomElementsWithSomething, makeCustomElementsRegistry: makeCustomElementsRegistry }; },{"./custom-element-widget":110,"es6-map":6}],112:[function(require,module,exports){ "use strict"; var svg = require("virtual-dom/virtual-hyperscript/svg"); var _require = require("./render-dom"); var makeDOMDriver = _require.makeDOMDriver; var _require2 = require("./render-html"); var makeHTMLDriver = _require2.makeHTMLDriver; var h = require("./virtual-hyperscript"); var CycleDOM = { /** * A factory for the DOM driver function. Takes a `container` to define the * target on the existing DOM which this driver will operate on. All custom * elements which this driver can detect should be given as the second * parameter. The output of this driver is a collection of Observables queried * with: `domDriverOutput.select(selector).events(eventType)` returns an * Observable of events of `eventType` happening on the element determined by * `selector`. Just `domDriverOutput.select(selector).observable` returns * an Observable of the DOM element matched by the given selector. Also, * `domDriverOutput.select(':root').observable` returns an Observable of * DOM element corresponding to the root (or container) of the app on the DOM. * * @param {(String|HTMLElement)} container the DOM selector for the element * (or the element itself) to contain the rendering of the VTrees. * @param {Object} customElements a collection of custom element definitions. * The key of each property should be the tag name of the custom element, and * the value should be a function defining the implementation of the custom * element. This function follows the same contract as the top-most `main` * function: input are driver responses, output are requests to drivers. * @return {Function} the DOM driver function. The function expects an * Observable of VTree as input, and outputs the response object for this * driver, containing functions `select()` and `dispose()` that can be used * for debugging and testing. * @function makeDOMDriver */ makeDOMDriver: makeDOMDriver, /** * A factory for the HTML driver function. Takes the registry object of all * custom elements as the only parameter. The HTML driver function will use * the custom element registry to detect custom element on the VTree and apply * their implementations. * * @param {Object} customElements a collection of custom element definitions. * The key of each property should be the tag name of the custom element, and * the value should be a function defining the implementation of the custom * element. This function follows the same contract as the top-most `main` * function: input are driver responses, output are requests to drivers. * @return {Function} the HTML driver function. The function expects an * Observable of Virtual DOM elements as input, and outputs an Observable of * strings as the HTML renderization of the virtual DOM elements. * @function makeHTMLDriver */ makeHTMLDriver: makeHTMLDriver, /** * A shortcut to [virtual-hyperscript]( * https://github.com/Matt-Esch/virtual-dom/tree/master/virtual-hyperscript). * This is a helper for creating VTrees in Views. * @name h */ h: h, /** * An adapter around virtual-hyperscript `h()` to allow JSX to be used easily * with Babel. Place the [Babel configuration comment]( * http://babeljs.io/docs/advanced/transformers/other/react/) `@jsx hJSX` at * the top of the ES6 file, make sure you import `hJSX` with * `import {hJSX} from '@cycle/dom'`, and then you can use JSX to create * VTrees. * @name hJSX */ hJSX: function hJSX(tag, attrs) { for (var _len = arguments.length, children = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { children[_key - 2] = arguments[_key]; } return h(tag, attrs, children); }, /** * A shortcut to the svg hyperscript function. * @name svg */ svg: svg }; module.exports = CycleDOM; },{"./render-dom":113,"./render-html":114,"./virtual-hyperscript":116,"virtual-dom/virtual-hyperscript/svg":96}],113:[function(require,module,exports){ "use strict"; var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; })(); var _require = require("@cycle/core"); var Rx = _require.Rx; var VDOM = { h: require("./virtual-hyperscript"), diff: require("virtual-dom/diff"), patch: require("virtual-dom/patch"), parse: typeof window !== "undefined" ? require("vdom-parser") : function () {} }; var _require2 = require("./custom-elements"); var replaceCustomElementsWithSomething = _require2.replaceCustomElementsWithSomething; var makeCustomElementsRegistry = _require2.makeCustomElementsRegistry; var _require3 = require("./transposition"); var transposeVTree = _require3.transposeVTree; var matchesSelector = undefined; // Try-catch to prevent unnecessary import of DOM-specifics in Node.js env: try { matchesSelector = require("matches-selector"); } catch (err) { matchesSelector = function () {}; } function isElement(obj) { return typeof HTMLElement === "object" ? obj instanceof HTMLElement || obj instanceof DocumentFragment : //DOM2 obj && typeof obj === "object" && obj !== null && (obj.nodeType === 1 || obj.nodeType === 11) && typeof obj.nodeName === "string"; } function fixRootElem$(rawRootElem$, domContainer) { // Create rootElem stream and automatic className correction var originalClasses = (domContainer.className || "").trim().split(/\s+/); var originalId = domContainer.id; //console.log('%coriginalClasses: ' + originalClasses, 'color: lightgray') return rawRootElem$.map(function fixRootElemClassNameAndId(rootElem) { var previousClasses = rootElem.className.trim().split(/\s+/); var missingClasses = originalClasses.filter(function (clss) { return previousClasses.indexOf(clss) < 0; }); var classes = previousClasses.length > 0 ? previousClasses.concat(missingClasses) : missingClasses; //console.log('%cfixRootElemClassName(), missingClasses: ' + // missingClasses, 'color: lightgray') rootElem.className = classes.join(" ").trim(); if (originalId) { rootElem.id = originalId; } //console.log('%c result: ' + rootElem.className, 'color: lightgray') //console.log('%cEmit rootElem$ ' + rootElem.tagName + '.' + // rootElem.className, 'color: #009988') return rootElem; }); } function isVTreeCustomElement(vtree) { return vtree.type === "Widget" && vtree.isCustomElementWidget; } function makeReplaceCustomElementsWithWidgets(CERegistry, driverName) { return function replaceCustomElementsWithWidgets(vtree) { return replaceCustomElementsWithSomething(vtree, CERegistry, function (_vtree, WidgetClass) { return new WidgetClass(_vtree, CERegistry, driverName); }); }; } function getArrayOfAllWidgetFirstRootElem$(vtree) { if (vtree.type === "Widget" && vtree.firstRootElem$) { return [vtree.firstRootElem$]; } // Or replace children recursively var array = []; if (Array.isArray(vtree.children)) { for (var i = vtree.children.length - 1; i >= 0; i--) { array = array.concat(getArrayOfAllWidgetFirstRootElem$(vtree.children[i])); } } return array; } function checkRootVTreeNotCustomElement(vtree) { if (isVTreeCustomElement(vtree)) { throw new Error("Illegal to use a Cycle custom element as the root of " + "a View."); } } function isRootForCustomElement(rootElem) { return !!rootElem.cycleCustomElementMetadata; } function wrapTopLevelVTree(vtree, rootElem) { if (isRootForCustomElement(rootElem)) { return vtree; } var _vtree$properties$id = vtree.properties.id; var vtreeId = _vtree$properties$id === undefined ? "" : _vtree$properties$id; var _vtree$properties$className = vtree.properties.className; var vtreeClass = _vtree$properties$className === undefined ? "" : _vtree$properties$className; var sameId = vtreeId === rootElem.id; var sameClass = vtreeClass === rootElem.className; var sameTagName = vtree.tagName.toUpperCase() === rootElem.tagName; if (sameId && sameClass && sameTagName) { return vtree; } var attrs = {}; if (rootElem.id) { attrs.id = rootElem.id; } if (rootElem.className) { attrs.className = rootElem.className; } return VDOM.h(rootElem.tagName, attrs, [vtree]); } function makeDiffAndPatchToElement$(rootElem) { return function diffAndPatchToElement$(_ref) { var _ref2 = _slicedToArray(_ref, 2); var oldVTree = _ref2[0]; var newVTree = _ref2[1]; if (typeof newVTree === "undefined") { return Rx.Observable.empty(); } //let isCustomElement = isRootForCustomElement(rootElem) //let k = isCustomElement ? ' is custom element ' : ' is top level' var prevVTree = wrapTopLevelVTree(oldVTree, rootElem); var nextVTree = wrapTopLevelVTree(newVTree, rootElem); var waitForChildrenStreams = getArrayOfAllWidgetFirstRootElem$(nextVTree); var rootElemAfterChildrenFirstRootElem$ = Rx.Observable.combineLatest(waitForChildrenStreams, function () { //console.log('%crawRootElem$ emits. (1)' + k, 'color: #008800') return rootElem; }); var cycleCustomElementMetadata = rootElem.cycleCustomElementMetadata; //console.log('%cVDOM diff and patch START' + k, 'color: #636300') /* eslint-disable */ rootElem = VDOM.patch(rootElem, VDOM.diff(prevVTree, nextVTree)); /* eslint-enable */ //console.log('%cVDOM diff and patch END' + k, 'color: #636300') if (cycleCustomElementMetadata) { rootElem.cycleCustomElementMetadata = cycleCustomElementMetadata; } if (waitForChildrenStreams.length === 0) { //console.log('%crawRootElem$ emits. (2)' + k, 'color: #008800') return Rx.Observable.just(rootElem); } //console.log('%crawRootElem$ waiting children.' + k, 'color: #008800') return rootElemAfterChildrenFirstRootElem$; }; } function renderRawRootElem$(vtree$, domContainer, _ref3) { var CERegistry = _ref3.CERegistry; var driverName = _ref3.driverName; var diffAndPatchToElement$ = makeDiffAndPatchToElement$(domContainer); return vtree$.flatMapLatest(transposeVTree).startWith(VDOM.parse(domContainer)).map(makeReplaceCustomElementsWithWidgets(CERegistry, driverName)).doOnNext(checkRootVTreeNotCustomElement).pairwise().flatMap(diffAndPatchToElement$); } function makeRootElemToEvent$(selector, eventName) { return function rootElemToEvent$(rootElem) { if (!rootElem) { return Rx.Observable.empty(); } var targetElements = matchesSelector(rootElem, selector) ? rootElem : rootElem.querySelectorAll(selector); return Rx.Observable.fromEvent(targetElements, eventName); }; } function makeResponseGetter(rootElem$) { return function get(selector, eventName) { if (console && console.log) { console.log("WARNING: the DOM Driver's get(selector, eventType) is " + "deprecated. Use select(selector).events(eventType) instead."); } if (typeof selector !== "string") { throw new Error("DOM driver's get() expects first argument to be a " + "string as a CSS selector"); } if (selector.trim() === ":root") { return rootElem$; } if (typeof eventName !== "string") { throw new Error("DOM driver's get() expects second argument to be a " + "string representing the event type to listen for."); } return rootElem$.flatMapLatest(makeRootElemToEvent$(selector, eventName)).share(); }; } function makeEventsSelector(element$) { return function events(eventName) { if (typeof eventName !== "string") { throw new Error("DOM driver's get() expects second argument to be a " + "string representing the event type to listen for."); } return element$.flatMapLatest(function (element) { if (!element) { return Rx.Observable.empty(); } return Rx.Observable.fromEvent(element, eventName); }).share(); }; } function makeElementSelector(rootElem$) { return function select(selector) { if (typeof selector !== "string") { throw new Error("DOM driver's select() expects first argument to be a " + "string as a CSS selector"); } var element$ = selector.trim() === ":root" ? rootElem$ : rootElem$.map(function (rootElem) { if (matchesSelector(rootElem, selector)) { return rootElem; } else { return rootElem.querySelectorAll(selector); } }); return { observable: element$, events: makeEventsSelector(element$) }; }; } function validateDOMDriverInput(vtree$) { if (!vtree$ || typeof vtree$.subscribe !== "function") { throw new Error("The DOM driver function expects as input an " + "Observable of virtual DOM elements"); } } function makeDOMDriverWithRegistry(container, CERegistry) { return function domDriver(vtree$, driverName) { validateDOMDriverInput(vtree$); var rawRootElem$ = renderRawRootElem$(vtree$, container, { CERegistry: CERegistry, driverName: driverName }); if (!isRootForCustomElement(container)) { rawRootElem$ = rawRootElem$.startWith(container); } var rootElem$ = fixRootElem$(rawRootElem$, container).replay(null, 1); var disposable = rootElem$.connect(); return { get: makeResponseGetter(rootElem$), select: makeElementSelector(rootElem$), dispose: disposable.dispose.bind(disposable) }; }; } function makeDOMDriver(container) { var customElementDefinitions = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; // Find and prepare the container var domContainer = typeof container === "string" ? document.querySelector(container) : container; // Check pre-conditions if (typeof container === "string" && domContainer === null) { throw new Error("Cannot render into unknown element `" + container + "`"); } else if (!isElement(domContainer)) { throw new Error("Given container is not a DOM element neither a selector " + "string."); } var registry = makeCustomElementsRegistry(customElementDefinitions); return makeDOMDriverWithRegistry(domContainer, registry); } module.exports = { isElement: isElement, fixRootElem$: fixRootElem$, isVTreeCustomElement: isVTreeCustomElement, makeReplaceCustomElementsWithWidgets: makeReplaceCustomElementsWithWidgets, getArrayOfAllWidgetFirstRootElem$: getArrayOfAllWidgetFirstRootElem$, isRootForCustomElement: isRootForCustomElement, wrapTopLevelVTree: wrapTopLevelVTree, checkRootVTreeNotCustomElement: checkRootVTreeNotCustomElement, makeDiffAndPatchToElement$: makeDiffAndPatchToElement$, renderRawRootElem$: renderRawRootElem$, makeResponseGetter: makeResponseGetter, validateDOMDriverInput: validateDOMDriverInput, makeDOMDriverWithRegistry: makeDOMDriverWithRegistry, makeDOMDriver: makeDOMDriver }; },{"./custom-elements":111,"./transposition":115,"./virtual-hyperscript":116,"@cycle/core":1,"matches-selector":66,"vdom-parser":67,"virtual-dom/diff":82,"virtual-dom/patch":83}],114:[function(require,module,exports){ "use strict"; var _require = require("@cycle/core"); var Rx = _require.Rx; var toHTML = require("vdom-to-html"); var _require2 = require("./custom-elements"); var replaceCustomElementsWithSomething = _require2.replaceCustomElementsWithSomething; var makeCustomElementsRegistry = _require2.makeCustomElementsRegistry; var _require3 = require("./custom-element-widget"); var makeCustomElementInput = _require3.makeCustomElementInput; var ALL_PROPS = _require3.ALL_PROPS; var _require4 = require("./transposition"); var transposeVTree = _require4.transposeVTree; function makePropertiesDriverFromVTree(vtree) { return { get: function get(propertyName) { if (propertyName === ALL_PROPS) { return Rx.Observable.just(vtree.properties); } else { return Rx.Observable.just(vtree.properties[propertyName]); } } }; } function makeReplaceCustomElementsWithVTree$(CERegistry, driverName) { return function replaceCustomElementsWithVTree$(vtree) { return replaceCustomElementsWithSomething(vtree, CERegistry, function toVTree$(_vtree, WidgetClass) { var interactions = { get: function get() { return Rx.Observable.empty(); } }; var props = makePropertiesDriverFromVTree(_vtree); var input = makeCustomElementInput(interactions, props); var output = WidgetClass.definitionFn(input); var vtree$ = output[driverName].last(); /*eslint-disable no-use-before-define */ return convertCustomElementsToVTree(vtree$, CERegistry, driverName); /*eslint-enable no-use-before-define */ }); }; } function convertCustomElementsToVTree(vtree$, CERegistry, driverName) { return vtree$.map(makeReplaceCustomElementsWithVTree$(CERegistry, driverName)).flatMap(transposeVTree); } function makeResponseGetter() { return function get(selector) { if (console && console.log) { console.log("WARNING: HTML Driver's get(selector) is deprecated."); } if (selector === ":root") { return this; } else { return Rx.Observable.empty(); } }; } function makeHTMLDriver() { var customElementDefinitions = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; var registry = makeCustomElementsRegistry(customElementDefinitions); return function htmlDriver(vtree$, driverName) { var vtreeLast$ = vtree$.last(); var output$ = convertCustomElementsToVTree(vtreeLast$, registry, driverName).map(function (vtree) { return toHTML(vtree); }); output$.get = makeResponseGetter(); return output$; }; } module.exports = { makePropertiesDriverFromVTree: makePropertiesDriverFromVTree, makeReplaceCustomElementsWithVTree$: makeReplaceCustomElementsWithVTree$, convertCustomElementsToVTree: convertCustomElementsToVTree, makeHTMLDriver: makeHTMLDriver }; },{"./custom-element-widget":110,"./custom-elements":111,"./transposition":115,"@cycle/core":1,"vdom-to-html":71}],115:[function(require,module,exports){ "use strict"; var _require = require("@cycle/core"); var Rx = _require.Rx; var VirtualNode = require("virtual-dom/vnode/vnode"); /** * Converts a tree of VirtualNode|Observable<VirtualNode> into * Observable<VirtualNode>. */ function transposeVTree(vtree) { if (typeof vtree.subscribe === "function") { return vtree.flatMap(transposeVTree); } else if (vtree.type === "VirtualText") { return Rx.Observable.just(vtree); } else if (vtree.type === "VirtualNode" && Array.isArray(vtree.children) && vtree.children.length > 0) { return Rx.Observable.combineLatest(vtree.children.map(transposeVTree), function () { for (var _len = arguments.length, arr = Array(_len), _key = 0; _key < _len; _key++) { arr[_key] = arguments[_key]; } return new VirtualNode(vtree.tagName, vtree.properties, arr, vtree.key, vtree.namespace); }); } else if (vtree.type === "VirtualNode" || vtree.type === "Widget") { return Rx.Observable.just(vtree); } else { throw new Error("Unhandled case in transposeVTree()"); } } module.exports = { transposeVTree: transposeVTree }; },{"@cycle/core":1,"virtual-dom/vnode/vnode":104}],116:[function(require,module,exports){ /* eslint-disable */ 'use strict'; var isArray = require('x-is-array'); var VNode = require('virtual-dom/vnode/vnode.js'); var VText = require('virtual-dom/vnode/vtext.js'); var isVNode = require('virtual-dom/vnode/is-vnode'); var isVText = require('virtual-dom/vnode/is-vtext'); var isWidget = require('virtual-dom/vnode/is-widget'); var isHook = require('virtual-dom/vnode/is-vhook'); var isVThunk = require('virtual-dom/vnode/is-thunk'); var parseTag = require('virtual-dom/virtual-hyperscript/parse-tag.js'); var softSetHook = require('virtual-dom/virtual-hyperscript/hooks/soft-set-hook.js'); var evHook = require('virtual-dom/virtual-hyperscript/hooks/ev-hook.js'); module.exports = h; function h(tagName, properties, children) { var childNodes = []; var tag, props, key, namespace; if (!children && isChildren(properties)) { children = properties; props = {}; } props = props || properties || {}; tag = parseTag(tagName, props); // support keys if (props.hasOwnProperty('key')) { key = props.key; props.key = undefined; } // support namespace if (props.hasOwnProperty('namespace')) { namespace = props.namespace; props.namespace = undefined; } // fix cursor bug if (tag === 'INPUT' && !namespace && props.hasOwnProperty('value') && props.value !== undefined && !isHook(props.value)) { props.value = softSetHook(props.value); } transformProperties(props); if (children !== undefined && children !== null) { addChild(children, childNodes, tag, props); } return new VNode(tag, props, childNodes, key, namespace); } function addChild(c, childNodes, tag, props) { if (typeof c === 'string') { childNodes.push(new VText(c)); } else if (typeof c === 'number') { childNodes.push(new VText(String(c))); } else if (isChild(c)) { childNodes.push(c); } else if (isArray(c)) { for (var i = 0; i < c.length; i++) { addChild(c[i], childNodes, tag, props); } } else if (c === null || c === undefined) { return; } else { throw UnexpectedVirtualElement({ foreignObject: c, parentVnode: { tagName: tag, properties: props } }); } } function transformProperties(props) { for (var propName in props) { if (props.hasOwnProperty(propName)) { var value = props[propName]; if (isHook(value)) { continue; } if (propName.substr(0, 3) === 'ev-') { // add ev-foo support props[propName] = evHook(value); } } } } // START Cycle.js-specific code >>>>>>>> function isObservable(x) { return x && typeof x.subscribe === 'function'; } function isChild(x) { return isVNode(x) || isVText(x) || isObservable(x) || isWidget(x) || isVThunk(x); } // END Cycle.js-specific code <<<<<<<<<< function isChildren(x) { return typeof x === 'string' || isArray(x) || isChild(x); } function UnexpectedVirtualElement(data) { var err = new Error(); err.type = 'virtual-hyperscript.unexpected.virtual-element'; err.message = 'Unexpected virtual child passed to h().\n' + 'Expected a VNode / Vthunk / VWidget / string but:\n' + 'got:\n' + errorString(data.foreignObject) + '.\n' + 'The parent vnode is:\n' + errorString(data.parentVnode); '\n' + 'Suggested fix: change your `h(..., [ ... ])` callsite.'; err.foreignObject = data.foreignObject; err.parentVnode = data.parentVnode; return err; } function errorString(obj) { try { return JSON.stringify(obj, null, ' '); } catch (e) { return String(obj); } } /* eslint-enable */ },{"virtual-dom/virtual-hyperscript/hooks/ev-hook.js":91,"virtual-dom/virtual-hyperscript/hooks/soft-set-hook.js":92,"virtual-dom/virtual-hyperscript/parse-tag.js":94,"virtual-dom/vnode/is-thunk":98,"virtual-dom/vnode/is-vhook":99,"virtual-dom/vnode/is-vnode":100,"virtual-dom/vnode/is-vtext":101,"virtual-dom/vnode/is-widget":102,"virtual-dom/vnode/vnode.js":104,"virtual-dom/vnode/vtext.js":106,"x-is-array":109}]},{},[112])(112) });
aashish24/cdnjs
ajax/libs/cyclejs-dom/5.1.1/cycle-dom.js
JavaScript
mit
570,874
"use strict";angular.module("com.2fdevs.videogular",["ngSanitize"]).run(["$templateCache",function(a){a.put("vg-templates/vg-media-video","<video></video>"),a.put("vg-templates/vg-media-audio","<audio></audio>"),Function.prototype.bind||(Function.prototype.bind=function(a){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var b=Array.prototype.slice.call(arguments,1),c=this,d=function(){},e=function(){return c.apply(this instanceof d?this:a,b.concat(Array.prototype.slice.call(arguments)))};return d.prototype=this.prototype,e.prototype=new d,e})}]),angular.module("com.2fdevs.videogular").constant("VG_STATES",{PLAY:"play",PAUSE:"pause",STOP:"stop"}).constant("VG_VOLUME_KEY","videogularVolume"),angular.module("com.2fdevs.videogular").controller("vgController",["$scope","$window","vgConfigLoader","vgFullscreen","VG_UTILS","VG_STATES","VG_VOLUME_KEY",function(a,b,c,d,e,f,g){var h=null,i=!1,j=!1;this.videogularElement=null,this.clearMedia=function(){this.mediaElement[0].src=""},this.onCanPlay=function(b){this.isBuffering=!1,a.$apply(a.vgCanPlay({$event:b}))},this.onVideoReady=function(){this.isReady=!0,this.autoPlay=a.vgAutoPlay,this.playsInline=a.vgPlaysInline,this.cuePoints=a.vgCuePoints,this.currentState=f.STOP,j=!0,e.supportsLocalStorage()&&this.setVolume(parseFloat(b.localStorage.getItem(g)||"1")),a.vgConfig?c.loadConfig(a.vgConfig).then(this.onLoadConfig.bind(this)):a.vgPlayerReady({$API:this})},this.onLoadConfig=function(b){this.config=b,a.vgTheme=this.config.theme,a.vgAutoPlay=this.config.autoPlay,a.vgPlaysInline=this.config.playsInline,a.vgCuePoints=this.config.cuePoints,a.vgPlayerReady({$API:this})},this.onLoadMetaData=function(a){this.isBuffering=!1,this.onUpdateTime(a)},this.onUpdateTime=function(b){this.currentTime=1e3*b.target.currentTime,b.target.duration!=1/0?(this.totalTime=1e3*b.target.duration,this.timeLeft=1e3*(b.target.duration-b.target.currentTime),this.isLive=!1):this.isLive=!0,this.cuePoints&&this.checkCuePoints(b.target.currentTime),a.vgUpdateTime({$currentTime:b.target.currentTime,$duration:b.target.duration}),a.$apply()},this.checkCuePoints=function(a){for(var b in this.cuePoints)for(var c=0,d=this.cuePoints[b].length;d>c;c++){var e=this.cuePoints[b][c];e.timeLapse.end||(e.timeLapse.end=e.timeLapse.start+1),a<e.timeLapse.end&&(e.$$isCompleted=!1),a>e.timeLapse.start?(e.$$isDirty=!0,a<e.timeLapse.end&&e.onUpdate&&e.onUpdate(a,e.timeLapse,e.params),a>=e.timeLapse.end&&e.onComplete&&!e.$$isCompleted&&(e.$$isCompleted=!0,e.onComplete(a,e.timeLapse,e.params))):(e.onLeave&&e.$$isDirty&&e.onLeave(a,e.timeLapse,e.params),e.$$isDirty=!1)}},this.onPlay=function(){this.setState(f.PLAY),a.$apply()},this.onPause=function(){this.setState(0==this.mediaElement[0].currentTime?f.STOP:f.PAUSE),a.$apply()},this.onVolumeChange=function(){this.volume=this.mediaElement[0].volume,a.$apply()},this.onPlaybackChange=function(){this.playback=this.mediaElement[0].playbackRate,a.$apply()},this.seekTime=function(a,b){var c;b?(c=a*this.mediaElement[0].duration/100,this.mediaElement[0].currentTime=c):(c=a,this.mediaElement[0].currentTime=c),this.currentTime=1e3*c},this.playPause=function(){this.mediaElement[0].paused?this.play():this.pause()},this.setState=function(b){return b&&b!=this.currentState&&(a.vgUpdateState({$state:b}),this.currentState=b),this.currentState},this.play=function(){this.mediaElement[0].play(),this.setState(f.PLAY)},this.pause=function(){this.mediaElement[0].pause(),this.setState(f.PAUSE)},this.stop=function(){this.mediaElement[0].pause(),this.mediaElement[0].currentTime=0,this.currentTime=0,this.setState(f.STOP)},this.toggleFullScreen=function(){!d.isAvailable||a.vgPlaysInline?(this.isFullScreen?(this.videogularElement.removeClass("fullscreen"),this.videogularElement.css("z-index","auto")):(this.videogularElement.addClass("fullscreen"),this.videogularElement.css("z-index",e.getZIndex())),this.isFullScreen=!this.isFullScreen):this.isFullScreen?e.isMobileDevice()||d.exit():e.isMobileDevice()?e.isiOSDevice()?j?this.enterElementInFullScreen(this.mediaElement[0]):(i=!0,this.play()):this.enterElementInFullScreen(this.mediaElement[0]):this.enterElementInFullScreen(this.videogularElement[0])},this.enterElementInFullScreen=function(a){d.request(a)},this.changeSource=function(b){a.vgChangeSource({$source:b})},this.setVolume=function(c){a.vgUpdateVolume({$volume:c}),this.mediaElement[0].volume=c,this.volume=c,e.supportsLocalStorage()&&b.localStorage.setItem(g,c.toString())},this.setPlayback=function(b){a.vgUpdatePlayback({$playBack:b}),this.mediaElement[0].playbackRate=b,this.playback=b},this.updateTheme=function(a){var b,c,d=document.getElementsByTagName("link");if(h)for(b=0,c=d.length;c>b;b++)if(d[b].outerHTML.indexOf(h)>=0){d[b].parentNode.removeChild(d[b]);break}if(a){var e=angular.element(document).find("head"),f=!1;for(b=0,c=d.length;c>b&&!(f=d[b].outerHTML.indexOf(a)>=0);b++);f||e.append("<link rel='stylesheet' href='"+a+"'>"),h=a}},this.onStartBuffering=function(b){this.isBuffering=!0,a.$apply()},this.onStartPlaying=function(b){this.isBuffering=!1,a.$apply()},this.onComplete=function(b){a.vgComplete(),this.setState(f.STOP),this.isCompleted=!0,a.$apply()},this.onVideoError=function(b){a.vgError({$event:b})},this.addListeners=function(){this.mediaElement[0].addEventListener("canplay",this.onCanPlay.bind(this),!1),this.mediaElement[0].addEventListener("loadedmetadata",this.onLoadMetaData.bind(this),!1),this.mediaElement[0].addEventListener("waiting",this.onStartBuffering.bind(this),!1),this.mediaElement[0].addEventListener("ended",this.onComplete.bind(this),!1),this.mediaElement[0].addEventListener("playing",this.onStartPlaying.bind(this),!1),this.mediaElement[0].addEventListener("play",this.onPlay.bind(this),!1),this.mediaElement[0].addEventListener("pause",this.onPause.bind(this),!1),this.mediaElement[0].addEventListener("volumechange",this.onVolumeChange.bind(this),!1),this.mediaElement[0].addEventListener("playbackchange",this.onPlaybackChange.bind(this),!1),this.mediaElement[0].addEventListener("timeupdate",this.onUpdateTime.bind(this),!1),this.mediaElement[0].addEventListener("error",this.onVideoError.bind(this),!1)},this.init=function(){this.isReady=!1,this.isCompleted=!1,this.currentTime=0,this.totalTime=0,this.timeLeft=0,this.isLive=!1,this.isFullScreen=!1,this.isConfig=void 0!=a.vgConfig,d.isAvailable&&(this.isFullScreen=d.isFullScreen()),this.updateTheme(a.vgTheme),this.addBindings(),d.isAvailable&&document.addEventListener(d.onchange,this.onFullScreenChange.bind(this))},this.onUpdateTheme=function(a){this.updateTheme(a)},this.onUpdateAutoPlay=function(a){a&&!this.autoPlay&&(this.autoPlay=a,this.play(this))},this.onUpdatePlaysInline=function(a){this.playsInline=a},this.onUpdateCuePoints=function(a){this.cuePoints=a,this.checkCuePoints(this.currentTime)},this.addBindings=function(){a.$watch("vgTheme",this.onUpdateTheme.bind(this)),a.$watch("vgAutoPlay",this.onUpdateAutoPlay.bind(this)),a.$watch("vgPlaysInline",this.onUpdatePlaysInline.bind(this)),a.$watch("vgCuePoints",this.onUpdateCuePoints.bind(this))},this.onFullScreenChange=function(b){this.isFullScreen=d.isFullScreen(),a.$apply()},a.$on("$destroy",this.clearMedia.bind(this)),a.$on("$routeChangeStart",this.clearMedia.bind(this)),this.init()}]),angular.module("com.2fdevs.videogular").directive("vgLoop",[function(){return{restrict:"A",require:"^videogular",link:{pre:function(a,b,c,d){var e;a.setLoop=function(a){a?d.mediaElement.attr("loop",a):d.mediaElement.removeAttr("loop")},d.isConfig?a.$watch(function(){return d.config},function(){d.config&&a.setLoop(d.config.loop)}):a.$watch(c.vgLoop,function(b,c){e&&b==c||!b?a.setLoop():(e=b,a.setLoop(e))})}}}}]),angular.module("com.2fdevs.videogular").directive("vgMedia",["$timeout","VG_UTILS","VG_STATES",function(a,b,c){return{restrict:"E",require:"^videogular",templateUrl:function(a,b){var c=b.vgType||"video";return b.vgTemplate||"vg-templates/vg-media-"+c},scope:{vgSrc:"=?",vgType:"=?"},link:function(d,e,f,g){var h;f.vgType&&"video"!==f.vgType?f.vgType="audio":f.vgType="video",d.onChangeSource=function(a,b){h&&a==b||!a||(h=a,g.currentState!==c.PLAY&&(g.currentState=c.STOP),g.sources=h,d.changeSource())},d.changeSource=function(){var c="";if(g.mediaElement[0].canPlayType){for(var d=0,e=h.length;e>d;d++)if(c=g.mediaElement[0].canPlayType(h[d].type),"maybe"==c||"probably"==c){g.mediaElement.attr("src",h[d].src),g.mediaElement.attr("type",h[d].type),g.changeSource(h[d]);break}}else g.mediaElement.attr("src",h[0].src),g.mediaElement.attr("type",h[0].type),g.changeSource(h[0]);g.mediaElement[0].load(),a(function(){g.autoPlay&&!b.isMobileDevice()&&g.play()}),""==c&&g.onVideoError()},g.mediaElement=e.find(f.vgType),g.sources=d.vgSrc,g.addListeners(),g.onVideoReady(),d.$watch("vgSrc",d.onChangeSource),g.isConfig&&d.$watch(function(){return g.config},function(){g.config&&(d.vgSrc=g.config.sources)})}}}]),angular.module("com.2fdevs.videogular").directive("vgNativeControls",[function(){return{restrict:"A",require:"^videogular",link:{pre:function(a,b,c,d){var e;a.setControls=function(a){a?d.mediaElement.attr("controls",a):d.mediaElement.removeAttr("controls")},d.isConfig?a.$watch(function(){return d.config},function(){d.config&&a.setControls(d.config.controls)}):a.$watch(c.vgNativeControls,function(b,c){e&&b==c||!b?a.setControls():(e=b,a.setControls(e))})}}}}]),angular.module("com.2fdevs.videogular").directive("vgPreload",[function(){return{restrict:"A",require:"^videogular",link:{pre:function(a,b,c,d){var e;a.setPreload=function(a){a?d.mediaElement.attr("preload",a):d.mediaElement.removeAttr("preload")},d.isConfig?a.$watch(function(){return d.config},function(){d.config&&a.setPreload(d.config.preload)}):a.$watch(c.vgPreload,function(b,c){e&&b==c||!b?a.setPreload():(e=b,a.setPreload(e))})}}}}]),angular.module("com.2fdevs.videogular").directive("vgTracks",[function(){return{restrict:"A",require:"^videogular",link:{pre:function(a,b,c,d){var e,f,g,h;a.changeSource=function(){var a=d.mediaElement.children();for(g=0,h=a.length;h>g;g++)a[g].remove&&a[g].remove();if(e)for(g=0,h=e.length;h>g;g++){f="",f+="<track ";for(var b in e[g])f+=b+'="'+e[g][b]+'" ';f+="></track>",d.mediaElement.append(f)}},a.setTracks=function(b){e=b,d.tracks=b,a.changeSource()},d.isConfig?a.$watch(function(){return d.config},function(){d.config&&a.setTracks(d.config.tracks)}):a.$watch(c.vgTracks,function(b,c){e&&b==c||a.setTracks(b)})}}}}]),angular.module("com.2fdevs.videogular").directive("videogular",[function(){return{restrict:"EA",scope:{vgTheme:"=?",vgAutoPlay:"=?",vgPlaysInline:"=?",vgCuePoints:"=?",vgConfig:"@",vgCanPlay:"&",vgComplete:"&",vgUpdateVolume:"&",vgUpdatePlayback:"&",vgUpdateTime:"&",vgUpdateState:"&",vgPlayerReady:"&",vgChangeSource:"&",vgError:"&"},controller:"vgController",controllerAs:"API",link:{pre:function(a,b,c,d){d.videogularElement=angular.element(b)}}}}]),angular.module("com.2fdevs.videogular").service("vgConfigLoader",["$http","$q","$sce",function(a,b,c){this.loadConfig=function(d){var e=b.defer();return a({method:"GET",url:d}).then(function(a){for(var b=a.data,d=0,f=b.sources.length;f>d;d++)b.sources[d].src=c.trustAsResourceUrl(b.sources[d].src);e.resolve(b)},function(){e.reject()}),e.promise}}]),angular.module("com.2fdevs.videogular").service("vgFullscreen",["VG_UTILS",function(a){function b(){return null!=document[c.element]}var c=null,d={w3:{enabled:"fullscreenEnabled",element:"fullscreenElement",request:"requestFullscreen",exit:"exitFullscreen",onchange:"fullscreenchange",onerror:"fullscreenerror"},newWebkit:{enabled:"webkitFullscreenEnabled",element:"webkitFullscreenElement",request:"webkitRequestFullscreen",exit:"webkitExitFullscreen",onchange:"webkitfullscreenchange",onerror:"webkitfullscreenerror"},oldWebkit:{enabled:"webkitIsFullScreen",element:"webkitCurrentFullScreenElement",request:"webkitRequestFullScreen",exit:"webkitCancelFullScreen",onchange:"webkitfullscreenchange",onerror:"webkitfullscreenerror"},moz:{enabled:"mozFullScreen",element:"mozFullScreenElement",request:"mozRequestFullScreen",exit:"mozCancelFullScreen",onchange:"mozfullscreenchange",onerror:"mozfullscreenerror"},ios:{enabled:"webkitFullscreenEnabled",element:"webkitFullscreenElement",request:"webkitEnterFullscreen",exit:"webkitExitFullscreen",onchange:"webkitfullscreenchange",onerror:"webkitfullscreenerror"},ms:{enabled:"msFullscreenEnabled",element:"msFullscreenElement",request:"msRequestFullscreen",exit:"msExitFullscreen",onchange:"MSFullscreenChange",onerror:"MSFullscreenError"}};for(var e in d)if(d[e].enabled in document){c=d[e];break}a.isiOSDevice()&&(c=d.ios),this.isAvailable=null!=c,c&&(this.onchange=c.onchange,this.onerror=c.onerror,this.isFullScreen=b,this.exit=function(){document[c.exit]()},this.request=function(a){a[c.request]()})}]),angular.module("com.2fdevs.videogular").service("VG_UTILS",["$window",function(a){this.fixEventOffset=function(a){var b=navigator.userAgent.match(/Firefox\/(\d+)/i);if(b&&Number.parseInt(b.pop())<39){var c=a.currentTarget.currentStyle||window.getComputedStyle(a.target,null),d=parseInt(c.borderLeftWidth,10),e=parseInt(c.borderTopWidth,10),f=a.currentTarget.getBoundingClientRect(),g=a.clientX-d-f.left,h=a.clientY-e-f.top;a.offsetX=g,a.offsetY=h}return a},this.getZIndex=function(){for(var a=1,b=document.getElementsByTagName("*"),c=0,d=b.length;d>c;c++)b[c].style.zIndex&&parseInt(b[c].style.zIndex)>a&&(a=parseInt(b[c].style.zIndex)+1);return a},this.isMobileDevice=function(){return"undefined"!=typeof window.orientation||-1!==navigator.userAgent.indexOf("IEMobile")},this.isiOSDevice=function(){return navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPod/i)||navigator.userAgent.match(/iPad/i)},this.supportsLocalStorage=function(){try{return"localStorage"in a&&null!==a.localStorage}catch(b){return!1}}}]);
quba/cdnjs
ajax/libs/videogular/1.2.3/videogular.min.js
JavaScript
mit
13,860
/** * @license Videogular v0.6.0 http://videogular.com * Two Fucking Developers http://twofuckingdevelopers.com * License: MIT */ "use strict";angular.module("com.2fdevs.videogular",["ngSanitize"]).constant("VG_STATES",{PLAY:"play",PAUSE:"pause",STOP:"stop"}).service("VG_UTILS",function(){this.fixEventOffset=function(a){if(navigator.userAgent.match(/Firefox/i)){var b=a.currentTarget.currentStyle||window.getComputedStyle(a.target,null),c=parseInt(b.borderLeftWidth,10),d=parseInt(b.borderTopWidth,10),e=a.currentTarget.getBoundingClientRect(),f=a.clientX-c-e.left,g=a.clientY-d-e.top;a.offsetX=f,a.offsetY=g}return a},this.getZIndex=function(){var a=1;return angular.element("*").filter(function(){return"auto"!==angular.element(this).css("zIndex")}).each(function(){var b=parseInt(angular.element(this).css("zIndex"));b>a&&(a=b+1)}),a},this.secondsToDate=function(a){var b=new Date;return b.setTime(1e3*a),b},this.isMobileDevice=function(){return"undefined"!=typeof window.orientation||-1!==navigator.userAgent.indexOf("IEMobile")},this.isiOSDevice=function(){return navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPod/i)||navigator.userAgent.match(/iPad/i)}}).run(["$window","VG_UTILS",function(a,b){var c,d={w3:{enabled:"fullscreenEnabled",element:"fullscreenElement",request:"requestFullscreen",exit:"exitFullscreen",onchange:"fullscreenchange",onerror:"fullscreenerror"},newWebkit:{enabled:"webkitFullscreenEnabled",element:"webkitFullscreenElement",request:"webkitRequestFullscreen",exit:"webkitExitFullscreen",onchange:"webkitfullscreenchange",onerror:"webkitfullscreenerror"},oldWebkit:{enabled:"webkitIsFullScreen",element:"webkitCurrentFullScreenElement",request:"webkitRequestFullScreen",exit:"webkitCancelFullScreen",onchange:"webkitfullscreenchange",onerror:"webkitfullscreenerror"},moz:{enabled:"mozFullScreen",element:"mozFullScreenElement",request:"mozRequestFullScreen",exit:"mozCancelFullScreen",onchange:"mozfullscreenchange",onerror:"mozfullscreenerror"},ios:{enabled:"webkitFullscreenEnabled",element:"webkitFullscreenElement",request:"webkitEnterFullscreen",exit:"webkitExitFullscreen",onchange:"webkitfullscreenchange",onerror:"webkitfullscreenerror"},ms:{enabled:"msFullscreenEnabled",element:"msFullscreenElement",request:"msRequestFullscreen",exit:"msExitFullscreen",onchange:"msfullscreenchange",onerror:"msfullscreenerror"}};for(var e in d)if(d[e].enabled in document){c=d[e],c.isFullScreen=function(){return null!=document[this.element]};break}b.isiOSDevice()&&(c=d.ios,c.isFullScreen=function(){return null!=document[this.element]}),angular.element(a)[0].fullScreenAPI=c}]).directive("videogular",["$window","VG_STATES","VG_UTILS",function(a,b,c){return{restrict:"E",scope:{theme:"=vgTheme",autoPlay:"=vgAutoplay",vgComplete:"&",vgUpdateVolume:"&",vgUpdateTime:"&",vgUpdateState:"&",vgPlayerReady:"&",vgChangeSource:"&"},controller:["$scope","$timeout",function(d,e){var f=null,g=!1,h=!1,i=d.vgComplete(),j=d.vgUpdateVolume(),k=d.vgUpdateTime(),l=d.vgUpdateState(),m=d.vgPlayerReady(),n=d.vgChangeSource();this.videogularElement=null,this.onMobileVideoReady=function(a,b){this.onVideoReady(a,b,!0)},this.onVideoReady=function(a,f,g){d.API.isReady=!0,d.API.currentState=b.STOP,g||d.$apply(),h=!0,d.vgPlayerReady()&&(m=d.vgPlayerReady())(d.API),(d.autoPlay&&!c.isMobileDevice()||d.API.currentState===b.PLAY)&&e(function(){d.API.play()})},this.onUpdateTime=function(a){d.API.currentTime=c.secondsToDate(a.target.currentTime),d.API.totalTime=c.secondsToDate(a.target.duration),d.API.timeLeft=c.secondsToDate(a.target.duration-a.target.currentTime),d.vgUpdateTime()&&(k=d.vgUpdateTime())(a.target.currentTime,a.target.duration),d.$apply()},this.$on=function(){d.$on.apply(d,arguments)},this.seekTime=function(a,b){var e;b?(e=a*d.API.mediaElement[0].duration/100,d.API.mediaElement[0].currentTime=e):(e=a,d.API.mediaElement[0].currentTime=e),d.API.currentTime=c.secondsToDate(e)},this.playPause=function(){d.API.mediaElement[0].paused?this.play():this.pause()},this.setState=function(a){return a&&a!=d.API.currentState&&(d.vgUpdateState()&&(l=d.vgUpdateState())(a),d.API.currentState=a),d.API.currentState},this.play=function(){d.API.mediaElement[0].play(),this.setState(b.PLAY)},this.pause=function(){d.API.mediaElement[0].pause(),this.setState(b.PAUSE)},this.stop=function(){d.API.mediaElement[0].pause(),d.API.mediaElement[0].currentTime=0,this.setState(b.STOP)},this.toggleFullScreen=function(){angular.element(a)[0].fullScreenAPI?angular.element(a)[0].fullScreenAPI.isFullScreen()?c.isMobileDevice()||document[angular.element(a)[0].fullScreenAPI.exit]():c.isMobileDevice()?c.isiOSDevice()?h?this.enterElementInFullScreen(d.API.mediaElement[0]):(g=!0,this.play()):this.enterElementInFullScreen(d.API.mediaElement[0]):this.enterElementInFullScreen(d.API.videogularElement[0]):(d.API.isFullScreen?(d.API.videogularElement.removeClass("fullscreen"),d.API.videogularElement.css("z-index",0)):(d.API.videogularElement.addClass("fullscreen"),d.API.videogularElement.css("z-index",c.getZIndex())),d.API.isFullScreen=!d.API.isFullScreen)},this.enterElementInFullScreen=function(b){b[angular.element(a)[0].fullScreenAPI.request]()},this.changeSource=function(a){d.vgChangeSource()&&(n=d.vgChangeSource())(a)},this.setVolume=function(a){d.vgUpdateVolume()&&(j=d.vgUpdateVolume())(a),d.API.mediaElement[0].volume=a,d.API.volume=a},this.updateTheme=function(a){if(f)for(var b=document.getElementsByTagName("link"),c=0,d=b.length;d>c;c++)b[c].outerHTML.indexOf(f)>=0&&b[c].parentNode.removeChild(b[c]);if(a){var e=angular.element(document).find("head");e.append("<link rel='stylesheet' href='"+a+"'>"),f=a}},this.onStartBuffering=function(){d.API.isBuffering=!0},this.onStartPlaying=function(a){a.target.width++,a.target.width--,d.API.isBuffering=!1},this.onComplete=function(){d.vgComplete()&&(i=d.vgComplete())(),d.API.setState(b.STOP),d.API.isCompleted=!0,d.$apply()},d.API=this,d.init=function(){d.API.isReady=!1,d.API.isCompleted=!1,d.API.currentTime=0,d.API.totalTime=0,d.API.timeLeft=0,d.API.updateTheme(d.theme),d.addBindings(),angular.element(a)[0].fullScreenAPI&&document.addEventListener(angular.element(a)[0].fullScreenAPI.onchange,d.onFullScreenChange)},d.addBindings=function(){d.$watch("theme",function(a,b){a!=b&&d.API.updateTheme(a)}),d.$watch("autoPlay",function(a,b){a!=b&&a&&d.API.play()})},d.onFullScreenChange=function(){d.API.isFullScreen=angular.element(a)[0].fullScreenAPI.isFullScreen(),d.$apply()},d.init()}],link:{pre:function(a,b,c,d){d.videogularElement=angular.element(b)}}}}]).directive("vgVideo",["$compile","VG_UTILS",function(a,b){return{restrict:"E",require:"^videogular",scope:{vgSrc:"=",vgLoop:"=",vgPreload:"=",vgNativeControls:"=",vgTracks:"="},link:function(c,d,e,f){var g='<video vg-source="vgSrc" ';g+="></video>",f.mediaElement=angular.element(g);var h=a(f.mediaElement)(c);f.mediaElement[0].addEventListener("loadedmetadata",f.onVideoReady,!1),f.mediaElement[0].addEventListener("waiting",f.onStartBuffering,!1),f.mediaElement[0].addEventListener("ended",f.onComplete,!1),f.mediaElement[0].addEventListener("playing",f.onStartPlaying,!1),f.mediaElement[0].addEventListener("timeupdate",f.onUpdateTime,!1),d.append(h),b.isMobileDevice()&&(f.mediaElement[0].removeEventListener("loadedmetadata",f.onVideoReady,!1),f.onMobileVideoReady())}}}]).directive("vgAudio",["$compile","VG_UTILS",function(a,b){return{restrict:"E",require:"^videogular",scope:{vgSrc:"=",vgLoop:"=",vgPreload:"=",vgNativeControls:"=",vgTracks:"="},link:function(c,d,e,f){var g='<audio vg-source="vgSrc" ';g+="></audio>",f.mediaElement=angular.element(g);var h=a(f.mediaElement)(c);f.mediaElement[0].addEventListener("loadedmetadata",f.onVideoReady,!1),f.mediaElement[0].addEventListener("waiting",f.onStartBuffering,!1),f.mediaElement[0].addEventListener("ended",f.onComplete,!1),f.mediaElement[0].addEventListener("playing",f.onStartPlaying,!1),f.mediaElement[0].addEventListener("timeupdate",f.onUpdateTime,!1),d.append(h),b.isMobileDevice()&&(f.mediaElement[0].removeEventListener("loadedmetadata",f.onVideoReady,!1),f.onMobileVideoReady())}}}]).directive("vgSource",[function(){return{restrict:"A",link:{pre:function(a,b,c){function d(){if(f="",b[0].canPlayType){for(var a=0,c=e.length;c>a;a++)if(f=b[0].canPlayType(e[a].type),"maybe"==f||"probably"==f){b.attr("src",e[a].src),b.attr("type",e[a].type);break}}else b.attr("src",e[0].src),b.attr("type",e[0].type)}var e,f;a.$watch(c.vgSource,function(a,b){e&&a==b||!a||(e=a,d())})}}}}]).directive("vgTracks",[function(){return{restrict:"A",require:"^videogular",link:{pre:function(a,b,c,d){function e(){var a=d.mediaElement.children();for(h=0,i=a.length;i>h;h++)a[h].remove();for(h=0,i=f.length;i>h;h++){g="",g+="<track ";for(var b in f[h])g+=b+'="'+f[h][b]+'" ';g+="></track>",d.mediaElement.append(g,f[h].src)}}var f,g,h,i;a.$watch(c.vgTracks,function(a,b){f&&a==b||(f=a,d.tracks=f,e())})}}}}]).directive("vgLoop",[function(){return{restrict:"A",require:"^videogular",link:{pre:function(a,b,c,d){var e;a.$watch(c.vgLoop,function(a,b){e&&a==b||!a?d.mediaElement.removeAttr("loop"):(e=a,d.mediaElement.attr("loop",e))})}}}}]).directive("vgPreload",[function(){return{restrict:"A",require:"^videogular",link:{pre:function(a,b,c,d){var e;a.$watch(c.vgPreload,function(a,b){e&&a==b||!a?d.mediaElement.removeAttr("preload"):(e=a,d.mediaElement.attr("preload",e))})}}}}]).directive("vgNativeControls",[function(){return{restrict:"A",require:"^videogular",link:{pre:function(a,b,c,d){var e;a.$watch(c.vgNativeControls,function(a,b){e&&a==b||!a?d.mediaElement.removeAttr("controls"):(e=a,d.mediaElement.attr("controls",""))})}}}}]);
dada0423/cdnjs
ajax/libs/videogular/0.6.0/videogular.min.js
JavaScript
mit
9,631
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation; /** * ParameterBag is a container for key/value pairs. * * @author Fabien Potencier <fabien@symfony.com> * * @api */ class ParameterBag { protected $parameters; /** * Constructor. * * @param array $parameters An array of parameters * * @api */ public function __construct(array $parameters = array()) { $this->parameters = $parameters; } /** * Returns the parameters. * * @return array An array of parameters * * @api */ public function all() { return $this->parameters; } /** * Returns the parameter keys. * * @return array An array of parameter keys * * @api */ public function keys() { return array_keys($this->parameters); } /** * Replaces the current parameters by a new set. * * @param array $parameters An array of parameters * * @api */ public function replace(array $parameters = array()) { $this->parameters = $parameters; } /** * Adds parameters. * * @param array $parameters An array of parameters * * @api */ public function add(array $parameters = array()) { $this->parameters = array_replace($this->parameters, $parameters); } /** * Returns a parameter by name. * * @param string $path The key * @param mixed $default The default value if the parameter key does not exist * @param boolean $deep If true, a path like foo[bar] will find deeper items * * @api */ public function get($path, $default = null, $deep = false) { if (!$deep || false === $pos = strpos($path, '[')) { return array_key_exists($path, $this->parameters) ? $this->parameters[$path] : $default; } $root = substr($path, 0, $pos); if (!array_key_exists($root, $this->parameters)) { return $default; } $value = $this->parameters[$root]; $currentKey = null; for ($i=$pos,$c=strlen($path); $i<$c; $i++) { $char = $path[$i]; if ('[' === $char) { if (null !== $currentKey) { throw new \InvalidArgumentException(sprintf('Malformed path. Unexpected "[" at position %d.', $i)); } $currentKey = ''; } elseif (']' === $char) { if (null === $currentKey) { throw new \InvalidArgumentException(sprintf('Malformed path. Unexpected "]" at position %d.', $i)); } if (!is_array($value) || !array_key_exists($currentKey, $value)) { return $default; } $value = $value[$currentKey]; $currentKey = null; } else { if (null === $currentKey) { throw new \InvalidArgumentException(sprintf('Malformed path. Unexpected "%s" at position %d.', $char, $i)); } $currentKey .= $char; } } if (null !== $currentKey) { throw new \InvalidArgumentException(sprintf('Malformed path. Path must end with "]".')); } return $value; } /** * Sets a parameter by name. * * @param string $key The key * @param mixed $value The value * * @api */ public function set($key, $value) { $this->parameters[$key] = $value; } /** * Returns true if the parameter is defined. * * @param string $key The key * * @return Boolean true if the parameter exists, false otherwise * * @api */ public function has($key) { return array_key_exists($key, $this->parameters); } /** * Removes a parameter. * * @param string $key The key * * @api */ public function remove($key) { unset($this->parameters[$key]); } /** * Returns the alphabetic characters of the parameter value. * * @param string $key The parameter key * @param mixed $default The default value if the parameter key does not exist * @param boolean $deep If true, a path like foo[bar] will find deeper items * * @return string The filtered value * * @api */ public function getAlpha($key, $default = '', $deep = false) { return preg_replace('/[^[:alpha:]]/', '', $this->get($key, $default, $deep)); } /** * Returns the alphabetic characters and digits of the parameter value. * * @param string $key The parameter key * @param mixed $default The default value if the parameter key does not exist * @param boolean $deep If true, a path like foo[bar] will find deeper items * * @return string The filtered value * * @api */ public function getAlnum($key, $default = '', $deep = false) { return preg_replace('/[^[:alnum:]]/', '', $this->get($key, $default, $deep)); } /** * Returns the digits of the parameter value. * * @param string $key The parameter key * @param mixed $default The default value if the parameter key does not exist * @param boolean $deep If true, a path like foo[bar] will find deeper items * * @return string The filtered value * * @api */ public function getDigits($key, $default = '', $deep = false) { return preg_replace('/[^[:digit:]]/', '', $this->get($key, $default, $deep)); } /** * Returns the parameter value converted to integer. * * @param string $key The parameter key * @param mixed $default The default value if the parameter key does not exist * @param boolean $deep If true, a path like foo[bar] will find deeper items * * @return string The filtered value * * @api */ public function getInt($key, $default = 0, $deep = false) { return (int) $this->get($key, $default, $deep); } }
jechnd/BlogProject
vendor/symfony/src/Symfony/Component/HttpFoundation/ParameterBag.php
PHP
mit
6,405
module Sass::Script::Value # A SassScript object representing a boolean (true or false) value. class Bool < Base # The true value in SassScript. # # This is assigned before new is overridden below so that we use the default implementation. TRUE = new(true) # The false value in SassScript. # # This is assigned before new is overridden below so that we use the default implementation. FALSE = new(false) # We override object creation so that users of the core API # will not need to know that booleans are specific constants. # # @param value A ruby value that will be tested for truthiness. # @return [Bool] TRUE if value is truthy, FALSE if value is falsey def self.new(value) value ? TRUE : FALSE end # The Ruby value of the boolean. # # @return [Boolean] attr_reader :value alias_method :to_bool, :value # @return [String] "true" or "false" def to_s(opts = {}) @value.to_s end alias_method :to_sass, :to_s end end
ralzate/TestGit
vendor/bundle/ruby/2.1.0/gems/sass-3.4.19/lib/sass/script/value/bool.rb
Ruby
mit
1,037
/* Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ if(!dojo._hasResource["dojo._base.query"]){ dojo._hasResource["dojo._base.query"]=true; var startDojoMappings=function(_1){ _1.query=function(_2,_3,_4){ _4=_4||_1.NodeList; if(!_2){ return new _4(); } if(_2.constructor==_4){ return _2; } if(!_1.isString(_2)){ return new _4(_2); } if(_1.isString(_3)){ _3=_1.byId(_3); if(!_3){ return new _4(); } } return _1.Sizzle(_2,_3,new _4()); }; _1._filterQueryResult=function(_5,_6){ return _1.Sizzle.filter(_6,_5); }; }; var defineSizzle=function(ns){ var _7=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|[^[\]]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g,_8=0,_9=Object.prototype.toString; var _a=function(_b,_c,_d,_e){ _d=_d||[]; _c=_c||document; if(_c.nodeType!==1&&_c.nodeType!==9){ return []; } if(!_b||typeof _b!=="string"){ return _d; } var _f=[],m,set,_10,_11,_12,_13,_14=true; _7.lastIndex=0; while((m=_7.exec(_b))!==null){ _f.push(m[1]); if(m[2]){ _13=RegExp.rightContext; break; } } if(_f.length>1&&_15.match.POS.exec(_b)){ if(_f.length===2&&_15.relative[_f[0]]){ var _16="",_17; while((_17=_15.match.POS.exec(_b))){ _16+=_17[0]; _b=_b.replace(_15.match.POS,""); } set=_a.filter(_16,_a(_b,_c)); }else{ set=_15.relative[_f[0]]?[_c]:_a(_f.shift(),_c); while(_f.length){ var _18=[]; _b=_f.shift(); if(_15.relative[_b]){ _b+=_f.shift(); } for(var i=0,l=set.length;i<l;i++){ _a(_b,set[i],_18); } set=_18; } } }else{ var ret=_e?{expr:_f.pop(),set:_19(_e)}:_a.find(_f.pop(),_f.length===1&&_c.parentNode?_c.parentNode:_c); set=_a.filter(ret.expr,ret.set); if(_f.length>0){ _10=_19(set); }else{ _14=false; } while(_f.length){ var cur=_f.pop(),pop=cur; if(!_15.relative[cur]){ cur=""; }else{ pop=_f.pop(); } if(pop==null){ pop=_c; } _15.relative[cur](_10,pop); } } if(!_10){ _10=set; } if(!_10){ throw "Syntax error, unrecognized expression: "+(cur||_b); } if(_9.call(_10)==="[object Array]"){ if(!_14){ _d.push.apply(_d,_10); }else{ if(_c.nodeType===1){ for(var i=0;_10[i]!=null;i++){ if(_10[i]&&(_10[i]===true||_10[i].nodeType===1&&_1a(_c,_10[i]))){ _d.push(set[i]); } } }else{ for(var i=0;_10[i]!=null;i++){ if(_10[i]&&_10[i].nodeType===1){ _d.push(set[i]); } } } } }else{ _19(_10,_d); } if(_13){ _a(_13,_c,_d,_e); } return _d; }; _a.matches=function(_1b,set){ return _a(_1b,null,null,set); }; _a.find=function(_1c,_1d){ var set,_1e; if(!_1c){ return []; } for(var i=0,l=_15.order.length;i<l;i++){ var _1f=_15.order[i],_1e; if((_1e=_15.match[_1f].exec(_1c))){ var _20=RegExp.leftContext; if(_20.substr(_20.length-1)!=="\\"){ _1e[1]=(_1e[1]||"").replace(/\\/g,""); set=_15.find[_1f](_1e,_1d); if(set!=null){ _1c=_1c.replace(_15.match[_1f],""); break; } } } } if(!set){ set=_1d.getElementsByTagName("*"); } return {set:set,expr:_1c}; }; _a.filter=function(_21,set,_22,not){ var old=_21,_23=[],_24=set,_25,_26; while(_21&&set.length){ for(var _27 in _15.filter){ if((_25=_15.match[_27].exec(_21))!=null){ var _28=_15.filter[_27],_29=null,_2a=0,_2b,_2c; _26=false; if(_24==_23){ _23=[]; } if(_15.preFilter[_27]){ _25=_15.preFilter[_27](_25,_24,_22,_23,not); if(!_25){ _26=_2b=true; }else{ if(_25[0]===true){ _29=[]; var _2d=null,_2e; for(var i=0;(_2e=_24[i])!==undefined;i++){ if(_2e&&_2d!==_2e){ _29.push(_2e); _2d=_2e; } } } } } if(_25){ for(var i=0;(_2c=_24[i])!==undefined;i++){ if(_2c){ if(_29&&_2c!=_29[_2a]){ _2a++; } _2b=_28(_2c,_25,_2a,_29); var _2f=not^!!_2b; if(_22&&_2b!=null){ if(_2f){ _26=true; }else{ _24[i]=false; } }else{ if(_2f){ _23.push(_2c); _26=true; } } } } } if(_2b!==undefined){ if(!_22){ _24=_23; } _21=_21.replace(_15.match[_27],""); if(!_26){ return []; } break; } } } _21=_21.replace(/\s*,\s*/,""); if(_21==old){ if(_26==null){ throw "Syntax error, unrecognized expression: "+_21; }else{ break; } } old=_21; } return _24; }; var _15=_a.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u0128-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u0128-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u0128-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[((?:[\w\u0128-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\]/,TAG:/^((?:[\w\u0128-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child\(?(even|odd|[\dn+-]*)\)?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)\(?(\d*)\)?(?:[^-]|$)/,PSEUDO:/:((?:[\w\u0128-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},relative:{"+":function(_30,_31){ for(var i=0,l=_30.length;i<l;i++){ var _32=_30[i]; if(_32){ var cur=_32.previousSibling; while(cur&&cur.nodeType!==1){ cur=cur.previousSibling; } _30[i]=typeof _31==="string"?cur||false:cur===_31; } } if(typeof _31==="string"){ _a.filter(_31,_30,true); } },">":function(_33,_34){ if(typeof _34==="string"&&!/\W/.test(_34)){ _34=_34.toUpperCase(); for(var i=0,l=_33.length;i<l;i++){ var _35=_33[i]; if(_35){ var _36=_35.parentNode; _33[i]=_36.nodeName===_34?_36:false; } } }else{ for(var i=0,l=_33.length;i<l;i++){ var _35=_33[i]; if(_35){ _33[i]=typeof _34==="string"?_35.parentNode:_35.parentNode===_34; } } if(typeof _34==="string"){ _a.filter(_34,_33,true); } } },"":function(_37,_38){ var _39="done"+(_8++),_3a=_3b; if(!_38.match(/\W/)){ var _3c=_38=_38.toUpperCase(); _3a=_3d; } _3a("parentNode",_38,_39,_37,_3c); },"~":function(_3e,_3f){ var _40="done"+(_8++),_41=_3b; if(typeof _3f==="string"&&!_3f.match(/\W/)){ var _42=_3f=_3f.toUpperCase(); _41=_3d; } _41("previousSibling",_3f,_40,_3e,_42); }},find:{ID:function(_43,_44){ if(_44.getElementById){ var m=_44.getElementById(_43[1]); return m?[m]:[]; } },NAME:function(_45,_46){ return _46.getElementsByName?_46.getElementsByName(_45[1]):null; },TAG:function(_47,_48){ return _48.getElementsByTagName(_47[1]); }},preFilter:{CLASS:function(_49,_4a,_4b,_4c,not){ _49=" "+_49[1].replace(/\\/g,"")+" "; for(var i=0;_4a[i];i++){ if(not^(" "+_4a[i].className+" ").indexOf(_49)>=0){ if(!_4b){ _4c.push(_4a[i]); } }else{ if(_4b){ _4a[i]=false; } } } return false; },ID:function(_4d){ return _4d[1]; },TAG:function(_4e){ return _4e[1].toUpperCase(); },CHILD:function(_4f){ if(_4f[1]=="nth"){ var _50=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(_4f[2]=="even"&&"2n"||_4f[2]=="odd"&&"2n+1"||!/\D/.test(_4f[2])&&"0n+"+_4f[2]||_4f[2]); _4f[2]=(_50[1]+(_50[2]||1))-0; _4f[3]=_50[3]-0; } _4f[0]="done"+(_8++); return _4f; },ATTR:function(_51){ var _52=_51[1]; if(_15.attrMap[_52]){ _51[1]=_15.attrMap[_52]; } if(_51[2]==="~="){ _51[4]=" "+_51[4]+" "; } return _51; },PSEUDO:function(_53,_54,_55,_56,not){ if(_53[1]==="not"){ if(_53[3].match(_7).length>1){ _53[3]=_a(_53[3],null,null,_54); }else{ var ret=_a.filter(_53[3],_54,_55,true^not); if(!_55){ _56.push.apply(_56,ret); } return false; } } return _53; },POS:function(_57){ _57.unshift(true); return _57; }},filters:{enabled:function(_58){ return _58.disabled===false&&_58.type!=="hidden"; },disabled:function(_59){ return _59.disabled===true; },checked:function(_5a){ return _5a.checked===true; },selected:function(_5b){ _5b.parentNode.selectedIndex; return _5b.selected===true; },parent:function(_5c){ return !!_5c.firstChild; },empty:function(_5d){ return !_5d.firstChild; },has:function(_5e,i,_5f){ return !!_a(_5f[3],_5e).length; },header:function(_60){ return /h\d/i.test(_60.nodeName); },text:function(_61){ return "text"===_61.type; },radio:function(_62){ return "radio"===_62.type; },checkbox:function(_63){ return "checkbox"===_63.type; },file:function(_64){ return "file"===_64.type; },password:function(_65){ return "password"===_65.type; },submit:function(_66){ return "submit"===_66.type; },image:function(_67){ return "image"===_67.type; },reset:function(_68){ return "reset"===_68.type; },button:function(_69){ return "button"===_69.type||_69.nodeName.toUpperCase()==="BUTTON"; },input:function(_6a){ return /input|select|textarea|button/i.test(_6a.nodeName); }},setFilters:{first:function(_6b,i){ return i===0; },last:function(_6c,i,_6d,_6e){ return i===_6e.length-1; },even:function(_6f,i){ return i%2===0; },odd:function(_70,i){ return i%2===1; },lt:function(_71,i,_72){ return i<_72[3]-0; },gt:function(_73,i,_74){ return i>_74[3]-0; },nth:function(_75,i,_76){ return _76[3]-0==i; },eq:function(_77,i,_78){ return _78[3]-0==i; }},filter:{CHILD:function(_79,_7a){ var _7b=_7a[1],_7c=_79.parentNode; var _7d=_7a[0]; if(_7c&&!_7c[_7d]){ var _7e=1; for(var _7f=_7c.firstChild;_7f;_7f=_7f.nextSibling){ if(_7f.nodeType==1){ _7f.nodeIndex=_7e++; } } _7c[_7d]=_7e-1; } if(_7b=="first"){ return _79.nodeIndex==1; }else{ if(_7b=="last"){ return _79.nodeIndex==_7c[_7d]; }else{ if(_7b=="only"){ return _7c[_7d]==1; }else{ if(_7b=="nth"){ var add=false,_80=_7a[2],_81=_7a[3]; if(_80==1&&_81==0){ return true; } if(_80==0){ if(_79.nodeIndex==_81){ add=true; } }else{ if((_79.nodeIndex-_81)%_80==0&&(_79.nodeIndex-_81)/_80>=0){ add=true; } } return add; } } } } },PSEUDO:function(_82,_83,i,_84){ var _85=_83[1],_86=_15.filters[_85]; if(_86){ return _86(_82,i,_83,_84); }else{ if(_85==="contains"){ return (_82.textContent||_82.innerText||"").indexOf(_83[3])>=0; }else{ if(_85==="not"){ var not=_83[3]; for(var i=0,l=not.length;i<l;i++){ if(not[i]===_82){ return false; } } return true; } } } },ID:function(_87,_88){ return _87.nodeType===1&&_87.getAttribute("id")===_88; },TAG:function(_89,_8a){ return (_8a==="*"&&_89.nodeType===1)||_89.nodeName===_8a; },CLASS:function(_8b,_8c){ return _8c.test(_8b.className); },ATTR:function(_8d,_8e){ var _8f=_8d[_8e[1]]||_8d.getAttribute(_8e[1]),_90=_8f+"",_91=_8e[2],_92=_8e[4]; return _8f==null?false:_91==="="?_90===_92:_91==="*="?_90.indexOf(_92)>=0:_91==="~="?(" "+_90+" ").indexOf(_92)>=0:!_8e[4]?_8f:_91==="!="?_90!=_92:_91==="^="?_90.indexOf(_92)===0:_91==="$="?_90.substr(_90.length-_92.length)===_92:_91==="|="?_90===_92||_90.substr(0,_92.length+1)===_92+"-":false; },POS:function(_93,_94,i,_95){ var _96=_94[2],_97=_15.setFilters[_96]; if(_97){ return _97(_93,i,_94,_95); } }}}; for(var _98 in _15.match){ _15.match[_98]=RegExp(_15.match[_98].source+/(?![^\[]*\])(?![^\(]*\))/.source); } var _19=function(_99,_9a){ _99=Array.prototype.slice.call(_99); if(_9a){ _9a.push.apply(_9a,_99); return _9a; } return _99; }; try{ Array.prototype.slice.call(document.documentElement.childNodes); } catch(e){ _19=function(_9b,_9c){ var ret=_9c||[]; if(_9.call(_9b)==="[object Array]"){ Array.prototype.push.apply(ret,_9b); }else{ if(typeof _9b.length==="number"){ for(var i=0,l=_9b.length;i<l;i++){ ret.push(_9b[i]); } }else{ for(var i=0;_9b[i];i++){ ret.push(_9b[i]); } } } return ret; }; } (function(){ var _9d=document.createElement("form"),id="script"+(new Date).getTime(); _9d.innerHTML="<input name='"+id+"'/>"; var _9e=document.documentElement; _9e.insertBefore(_9d,_9e.firstChild); if(!!document.getElementById(id)){ _15.find.ID=function(_9f,_a0){ if(_a0.getElementById){ var m=_a0.getElementById(_9f[1]); return m?m.id===_9f[1]||m.getAttributeNode&&m.getAttributeNode("id").nodeValue===_9f[1]?[m]:undefined:[]; } }; _15.filter.ID=function(_a1,_a2){ var _a3=_a1.getAttributeNode&&_a1.getAttributeNode("id"); return _a1.nodeType===1&&_a3&&_a3.nodeValue===_a2; }; } _9e.removeChild(_9d); })(); (function(){ var div=document.createElement("div"); div.appendChild(document.createComment("")); if(div.getElementsByTagName("*").length>0){ _15.find.TAG=function(_a4,_a5){ var _a6=_a5.getElementsByTagName(_a4[1]); if(_a4[1]==="*"){ var tmp=[]; for(var i=0;_a6[i];i++){ if(_a6[i].nodeType===1){ tmp.push(_a6[i]); } } _a6=tmp; } return _a6; }; } })(); if(document.querySelectorAll){ (function(){ var _a7=_a; _a=function(_a8,_a9,_aa,_ab){ _a9=_a9||document; if(!_ab&&_a9.nodeType===9){ try{ return _19(_a9.querySelectorAll(_a8),_aa); } catch(e){ } } return _a7(_a8,_a9,_aa,_ab); }; _a.find=_a7.find; _a.filter=_a7.filter; _a.selectors=_a7.selectors; _a.matches=_a7.matches; })(); } if(document.documentElement.getElementsByClassName){ _15.order.splice(1,0,"CLASS"); _15.find.CLASS=function(_ac,_ad){ return _ad.getElementsByClassName(_ac[1]); }; } function _3d(dir,cur,_ae,_af,_b0){ for(var i=0,l=_af.length;i<l;i++){ var _b1=_af[i]; if(_b1){ _b1=_b1[dir]; var _b2=false; while(_b1&&_b1.nodeType){ var _b3=_b1[_ae]; if(_b3){ _b2=_af[_b3]; break; } if(_b1.nodeType===1){ _b1[_ae]=i; } if(_b1.nodeName===cur){ _b2=_b1; break; } _b1=_b1[dir]; } _af[i]=_b2; } } }; function _3b(dir,cur,_b4,_b5,_b6){ for(var i=0,l=_b5.length;i<l;i++){ var _b7=_b5[i]; if(_b7){ _b7=_b7[dir]; var _b8=false; while(_b7&&_b7.nodeType){ if(_b7[_b4]){ _b8=_b5[_b7[_b4]]; break; } if(_b7.nodeType===1){ _b7[_b4]=i; if(typeof cur!=="string"){ if(_b7===cur){ _b8=true; break; } }else{ if(_a.filter(cur,[_b7]).length>0){ _b8=_b7; break; } } } _b7=_b7[dir]; } _b5[i]=_b8; } } }; var _1a=document.compareDocumentPosition?function(a,b){ return a.compareDocumentPosition(b)&16; }:function(a,b){ return a!==b&&(a.contains?a.contains(b):true); }; ns.Sizzle=_a; }; if(this["dojo"]){ var defined=0; if(!defined){ dojo.provide("dojo._base.query"); dojo.require("dojo._base.NodeList"); defineSizzle(dojo); } }else{ defineSizzle(window); } }
JimBobSquarePants/cdnjs
ajax/libs/dojo/1.6.2/_base/query-sizzle.js
JavaScript
mit
13,016
/* Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ if(!dojo._hasResource["dojo.colors"]){ dojo._hasResource["dojo.colors"]=true; dojo.provide("dojo.colors"); (function(){ var _1=function(m1,m2,h){ if(h<0){ ++h; } if(h>1){ --h; } var h6=6*h; if(h6<1){ return m1+(m2-m1)*h6; } if(2*h<1){ return m2; } if(3*h<2){ return m1+(m2-m1)*(2/3-h)*6; } return m1; }; dojo.colorFromRgb=function(_2,_3){ var m=_2.toLowerCase().match(/^(rgba?|hsla?)\(([\s\.\-,%0-9]+)\)/); if(m){ var c=m[2].split(/\s*,\s*/),l=c.length,t=m[1],a; if((t=="rgb"&&l==3)||(t=="rgba"&&l==4)){ var r=c[0]; if(r.charAt(r.length-1)=="%"){ a=dojo.map(c,function(x){ return parseFloat(x)*2.56; }); if(l==4){ a[3]=c[3]; } return dojo.colorFromArray(a,_3); } return dojo.colorFromArray(c,_3); } if((t=="hsl"&&l==3)||(t=="hsla"&&l==4)){ var H=((parseFloat(c[0])%360)+360)%360/360,S=parseFloat(c[1])/100,L=parseFloat(c[2])/100,m2=L<=0.5?L*(S+1):L+S-L*S,m1=2*L-m2; a=[_1(m1,m2,H+1/3)*256,_1(m1,m2,H)*256,_1(m1,m2,H-1/3)*256,1]; if(l==4){ a[3]=c[3]; } return dojo.colorFromArray(a,_3); } } return null; }; var _4=function(c,_5,_6){ c=Number(c); return isNaN(c)?_6:c<_5?_5:c>_6?_6:c; }; dojo.Color.prototype.sanitize=function(){ var t=this; t.r=Math.round(_4(t.r,0,255)); t.g=Math.round(_4(t.g,0,255)); t.b=Math.round(_4(t.b,0,255)); t.a=_4(t.a,0,1); return this; }; })(); dojo.colors.makeGrey=function(g,a){ return dojo.colorFromArray([g,g,g,a]); }; dojo.mixin(dojo.Color.named,{aliceblue:[240,248,255],antiquewhite:[250,235,215],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],blanchedalmond:[255,235,205],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],oldlace:[253,245,230],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],thistle:[216,191,216],tomato:[255,99,71],transparent:[0,0,0,0],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],whitesmoke:[245,245,245],yellowgreen:[154,205,50]}); }
melvinsembrano/cdnjs
ajax/libs/dojo/1.5.4/colors.js
JavaScript
mit
4,694
/* Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ if(typeof window!="undefined"){ dojo.isBrowser=true; dojo._name="browser"; (function(){ var d=dojo; if(document&&document.getElementsByTagName){ var _1=document.getElementsByTagName("script"); var _2=/dojo(\.xd)?\.js(\W|$)/i; for(var i=0;i<_1.length;i++){ var _3=_1[i].getAttribute("src"); if(!_3){ continue; } var m=_3.match(_2); if(m){ if(!d.config.baseUrl){ d.config.baseUrl=_3.substring(0,m.index); } var _4=(_1[i].getAttribute("djConfig")||_1[i].getAttribute("data-dojo-config")); if(_4){ var _5=eval("({ "+_4+" })"); for(var x in _5){ dojo.config[x]=_5[x]; } } break; } } } d.baseUrl=d.config.baseUrl; var n=navigator; var _6=n.userAgent,_7=n.appVersion,tv=parseFloat(_7); if(_6.indexOf("Opera")>=0){ d.isOpera=tv; } if(_6.indexOf("AdobeAIR")>=0){ d.isAIR=1; } d.isKhtml=(_7.indexOf("Konqueror")>=0)?tv:0; d.isWebKit=parseFloat(_6.split("WebKit/")[1])||undefined; d.isChrome=parseFloat(_6.split("Chrome/")[1])||undefined; d.isMac=_7.indexOf("Macintosh")>=0; var _8=Math.max(_7.indexOf("WebKit"),_7.indexOf("Safari"),0); if(_8&&!dojo.isChrome){ d.isSafari=parseFloat(_7.split("Version/")[1]); if(!d.isSafari||parseFloat(_7.substr(_8+7))<=419.3){ d.isSafari=2; } } if(_6.indexOf("Gecko")>=0&&!d.isKhtml&&!d.isWebKit){ d.isMozilla=d.isMoz=tv; } if(d.isMoz){ d.isFF=parseFloat(_6.split("Firefox/")[1]||_6.split("Minefield/")[1])||undefined; } if(document.all&&!d.isOpera){ d.isIE=parseFloat(_7.split("MSIE ")[1])||undefined; var _9=document.documentMode; if(_9&&_9!=5&&Math.floor(d.isIE)!=_9){ d.isIE=_9; } } if(dojo.isIE&&window.location.protocol==="file:"){ dojo.config.ieForceActiveXXhr=true; } d.isQuirks=document.compatMode=="BackCompat"; d.locale=dojo.config.locale||(d.isIE?n.userLanguage:n.language).toLowerCase(); d._XMLHTTP_PROGIDS=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"]; d._xhrObj=function(){ var _a,_b; if(!dojo.isIE||!dojo.config.ieForceActiveXXhr){ try{ _a=new XMLHttpRequest(); } catch(e){ } } if(!_a){ for(var i=0;i<3;++i){ var _c=d._XMLHTTP_PROGIDS[i]; try{ _a=new ActiveXObject(_c); } catch(e){ _b=e; } if(_a){ d._XMLHTTP_PROGIDS=[_c]; break; } } } if(!_a){ throw new Error("XMLHTTP not available: "+_b); } return _a; }; d._isDocumentOk=function(_d){ var _e=_d.status||0,lp=location.protocol; return (_e>=200&&_e<300)||_e==304||_e==1223||(!_e&&(lp=="file:"||lp=="chrome:"||lp=="chrome-extension:"||lp=="app:")); }; var _f=window.location+""; var _10=document.getElementsByTagName("base"); var _11=(_10&&_10.length>0); d._getText=function(uri,_12){ var _13=d._xhrObj(); if(!_11&&dojo._Url){ uri=(new dojo._Url(_f,uri)).toString(); } if(d.config.cacheBust){ uri+=""; uri+=(uri.indexOf("?")==-1?"?":"&")+String(d.config.cacheBust).replace(/\W+/g,""); } _13.open("GET",uri,false); try{ _13.send(null); if(!d._isDocumentOk(_13)){ var err=Error("Unable to load "+uri+" status:"+_13.status); err.status=_13.status; err.responseText=_13.responseText; throw err; } } catch(e){ if(_12){ return null; } throw e; } return _13.responseText; }; var _14=window; var _15=function(_16,fp){ var _17=_14.attachEvent||_14.addEventListener; _16=_14.attachEvent?_16:_16.substring(2); _17(_16,function(){ fp.apply(_14,arguments); },false); }; d._windowUnloaders=[]; d.windowUnloaded=function(){ var mll=d._windowUnloaders; while(mll.length){ (mll.pop())(); } d=null; }; var _18=0; d.addOnWindowUnload=function(obj,_19){ d._onto(d._windowUnloaders,obj,_19); if(!_18){ _18=1; _15("onunload",d.windowUnloaded); } }; var _1a=0; d.addOnUnload=function(obj,_1b){ d._onto(d._unloaders,obj,_1b); if(!_1a){ _1a=1; _15("onbeforeunload",dojo.unloaded); } }; })(); dojo._initFired=false; dojo._loadInit=function(e){ if(dojo._scrollIntervalId){ clearInterval(dojo._scrollIntervalId); dojo._scrollIntervalId=0; } if(!dojo._initFired){ dojo._initFired=true; if(!dojo.config.afterOnLoad&&window.detachEvent){ window.detachEvent("onload",dojo._loadInit); } if(dojo._inFlightCount==0){ dojo._modulesLoaded(); } } }; if(!dojo.config.afterOnLoad){ if(document.addEventListener){ document.addEventListener("DOMContentLoaded",dojo._loadInit,false); window.addEventListener("load",dojo._loadInit,false); }else{ if(window.attachEvent){ window.attachEvent("onload",dojo._loadInit); if(!dojo.config.skipIeDomLoaded&&self===self.top){ dojo._scrollIntervalId=setInterval(function(){ try{ if(document.body){ document.documentElement.doScroll("left"); dojo._loadInit(); } } catch(e){ } },30); } } } } if(dojo.isIE){ try{ (function(){ document.namespaces.add("v","urn:schemas-microsoft-com:vml"); var _1c=["*","group","roundrect","oval","shape","rect","imagedata","path","textpath","text"],i=0,l=1,s=document.createStyleSheet(); if(dojo.isIE>=8){ i=1; l=_1c.length; } for(;i<l;++i){ s.addRule("v\\:"+_1c[i],"behavior:url(#default#VML); display:inline-block"); } })(); } catch(e){ } } } (function(){ var mp=dojo.config["modulePaths"]; if(mp){ for(var _1d in mp){ dojo.registerModulePath(_1d,mp[_1d]); } } })(); if(dojo.config.isDebug){ dojo.require("dojo._firebug.firebug"); } if(dojo.config.debugAtAllCosts){ dojo.require("dojo._base._loader.loader_debug"); dojo.require("dojo.i18n"); }
francescoagati/cdnjs
ajax/libs/dojo/1.6.3/_base/_loader/hostenv_browser.js
JavaScript
mit
5,271
/* Copyright (c) 2004-2013, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ if(!dojo._hasResource["dojo.io.script"]){ dojo._hasResource["dojo.io.script"]=true; dojo.provide("dojo.io.script"); (function(){ var _1=dojo.isIE?"onreadystatechange":"load",_2=/complete|loaded/; dojo.io.script={get:function(_3){ var _4=this._makeScriptDeferred(_3); var _5=_4.ioArgs; dojo._ioAddQueryToUrl(_5); dojo._ioNotifyStart(_4); if(this._canAttach(_5)){ var _6=this.attach(_5.id,_5.url,_3.frameDoc); if(!_5.jsonp&&!_5.args.checkString){ var _7=dojo.connect(_6,_1,function(_8){ if(_8.type=="load"||_2.test(_6.readyState)){ dojo.disconnect(_7); _5.scriptLoaded=_8; } }); } } dojo._ioWatch(_4,this._validCheck,this._ioCheck,this._resHandle); return _4; },attach:function(id,_9,_a){ var _b=(_a||dojo.doc); var _c=_b.createElement("script"); _c.type="text/javascript"; _c.src=_9; _c.id=id; _c.charset="utf-8"; return _b.getElementsByTagName("head")[0].appendChild(_c); },remove:function(id,_d){ dojo.destroy(dojo.byId(id,_d)); if(this["jsonp_"+id]){ delete this["jsonp_"+id]; } },_makeScriptDeferred:function(_e){ var _f=dojo._ioSetArgs(_e,this._deferredCancel,this._deferredOk,this._deferredError); var _10=_f.ioArgs; _10.id=dojo._scopeName+"IoScript"+(this._counter++); _10.canDelete=false; _10.jsonp=_e.callbackParamName||_e.jsonp; if(_10.jsonp){ _10.query=_10.query||""; if(_10.query.length>0){ _10.query+="&"; } _10.query+=_10.jsonp+"="+(_e.frameDoc?"parent.":"")+dojo._scopeName+".io.script.jsonp_"+_10.id+"._jsonpCallback"; _10.frameDoc=_e.frameDoc; _10.canDelete=true; _f._jsonpCallback=this._jsonpCallback; this["jsonp_"+_10.id]=_f; } return _f; },_deferredCancel:function(dfd){ dfd.canceled=true; if(dfd.ioArgs.canDelete){ dojo.io.script._addDeadScript(dfd.ioArgs); } },_deferredOk:function(dfd){ var _11=dfd.ioArgs; if(_11.canDelete){ dojo.io.script._addDeadScript(_11); } return _11.json||_11.scriptLoaded||_11; },_deferredError:function(_12,dfd){ if(dfd.ioArgs.canDelete){ if(_12.dojoType=="timeout"){ dojo.io.script.remove(dfd.ioArgs.id,dfd.ioArgs.frameDoc); }else{ dojo.io.script._addDeadScript(dfd.ioArgs); } } return _12; },_deadScripts:[],_counter:1,_addDeadScript:function(_13){ dojo.io.script._deadScripts.push({id:_13.id,frameDoc:_13.frameDoc}); _13.frameDoc=null; },_validCheck:function(dfd){ var _14=dojo.io.script; var _15=_14._deadScripts; if(_15&&_15.length>0){ for(var i=0;i<_15.length;i++){ _14.remove(_15[i].id,_15[i].frameDoc); _15[i].frameDoc=null; } dojo.io.script._deadScripts=[]; } return true; },_ioCheck:function(dfd){ var _16=dfd.ioArgs; if(_16.json||(_16.scriptLoaded&&!_16.args.checkString)){ return true; } var _17=_16.args.checkString; if(_17&&eval("typeof("+_17+") != 'undefined'")){ return true; } return false; },_resHandle:function(dfd){ if(dojo.io.script._ioCheck(dfd)){ dfd.callback(dfd); }else{ dfd.errback(new Error("inconceivable dojo.io.script._resHandle error")); } },_canAttach:function(_18){ return true; },_jsonpCallback:function(_19){ this.ioArgs.json=_19; }}; })(); }
qrohlf/cdnjs
ajax/libs/dojo/1.4.5/io/script.js
JavaScript
mit
3,125
/* Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ if(!dojo._hasResource["dojo.date.locale"]){ dojo._hasResource["dojo.date.locale"]=true; dojo.provide("dojo.date.locale"); dojo.require("dojo.date"); dojo.require("dojo.cldr.supplemental"); dojo.require("dojo.regexp"); dojo.require("dojo.string"); dojo.require("dojo.i18n"); dojo.requireLocalization("dojo.cldr","gregorian",null,"ROOT,ar,ca,cs,da,de,el,en,en-au,en-ca,en-gb,es,fi,fr,he,hu,it,ja,ko,nb,nl,pl,pt,pt-pt,ru,sk,sl,sv,th,tr,zh,zh-tw"); (function(){ function _1(_2,_3,_4,_5){ return _5.replace(/([a-z])\1*/ig,function(_6){ var s,_7,c=_6.charAt(0),l=_6.length,_8=["abbr","wide","narrow"]; switch(c){ case "G": s=_3[(l<4)?"eraAbbr":"eraNames"][_2.getFullYear()<0?0:1]; break; case "y": s=_2.getFullYear(); switch(l){ case 1: break; case 2: if(!_4.fullYear){ s=String(s); s=s.substr(s.length-2); break; } default: _7=true; } break; case "Q": case "q": s=Math.ceil((_2.getMonth()+1)/3); _7=true; break; case "M": var m=_2.getMonth(); if(l<3){ s=m+1; _7=true; }else{ var _9=["months","format",_8[l-3]].join("-"); s=_3[_9][m]; } break; case "w": var _a=0; s=dojo.date.locale._getWeekOfYear(_2,_a); _7=true; break; case "d": s=_2.getDate(); _7=true; break; case "D": s=dojo.date.locale._getDayOfYear(_2); _7=true; break; case "E": var d=_2.getDay(); if(l<3){ s=d+1; _7=true; }else{ var _b=["days","format",_8[l-3]].join("-"); s=_3[_b][d]; } break; case "a": var _c=(_2.getHours()<12)?"am":"pm"; s=_4[_c]||_3["dayPeriods-format-wide-"+_c]; break; case "h": case "H": case "K": case "k": var h=_2.getHours(); switch(c){ case "h": s=(h%12)||12; break; case "H": s=h; break; case "K": s=(h%12); break; case "k": s=h||24; break; } _7=true; break; case "m": s=_2.getMinutes(); _7=true; break; case "s": s=_2.getSeconds(); _7=true; break; case "S": s=Math.round(_2.getMilliseconds()*Math.pow(10,l-3)); _7=true; break; case "v": case "z": s=dojo.date.locale._getZone(_2,true,_4); if(s){ break; } l=4; case "Z": var _d=dojo.date.locale._getZone(_2,false,_4); var tz=[(_d<=0?"+":"-"),dojo.string.pad(Math.floor(Math.abs(_d)/60),2),dojo.string.pad(Math.abs(_d)%60,2)]; if(l==4){ tz.splice(0,0,"GMT"); tz.splice(3,0,":"); } s=tz.join(""); break; default: throw new Error("dojo.date.locale.format: invalid pattern char: "+_5); } if(_7){ s=dojo.string.pad(s,l); } return s; }); }; dojo.date.locale._getZone=function(_e,_f,_10){ if(_f){ return dojo.date.getTimezoneName(_e); }else{ return _e.getTimezoneOffset(); } }; dojo.date.locale.format=function(_11,_12){ _12=_12||{}; var _13=dojo.i18n.normalizeLocale(_12.locale),_14=_12.formatLength||"short",_15=dojo.date.locale._getGregorianBundle(_13),str=[],_16=dojo.hitch(this,_1,_11,_15,_12); if(_12.selector=="year"){ return _17(_15["dateFormatItem-yyyy"]||"yyyy",_16); } var _18; if(_12.selector!="date"){ _18=_12.timePattern||_15["timeFormat-"+_14]; if(_18){ str.push(_17(_18,_16)); } } if(_12.selector!="time"){ _18=_12.datePattern||_15["dateFormat-"+_14]; if(_18){ str.push(_17(_18,_16)); } } return str.length==1?str[0]:_15["dateTimeFormat-"+_14].replace(/\{(\d+)\}/g,function(_19,key){ return str[key]; }); }; dojo.date.locale.regexp=function(_1a){ return dojo.date.locale._parseInfo(_1a).regexp; }; dojo.date.locale._parseInfo=function(_1b){ _1b=_1b||{}; var _1c=dojo.i18n.normalizeLocale(_1b.locale),_1d=dojo.date.locale._getGregorianBundle(_1c),_1e=_1b.formatLength||"short",_1f=_1b.datePattern||_1d["dateFormat-"+_1e],_20=_1b.timePattern||_1d["timeFormat-"+_1e],_21; if(_1b.selector=="date"){ _21=_1f; }else{ if(_1b.selector=="time"){ _21=_20; }else{ _21=_1d["dateTimeFormat-"+_1e].replace(/\{(\d+)\}/g,function(_22,key){ return [_20,_1f][key]; }); } } var _23=[],re=_17(_21,dojo.hitch(this,_24,_23,_1d,_1b)); return {regexp:re,tokens:_23,bundle:_1d}; }; dojo.date.locale.parse=function(_25,_26){ var _27=/[\u200E\u200F\u202A\u202E]/g,_28=dojo.date.locale._parseInfo(_26),_29=_28.tokens,_2a=_28.bundle,re=new RegExp("^"+_28.regexp.replace(_27,"")+"$",_28.strict?"":"i"),_2b=re.exec(_25&&_25.replace(_27,"")); if(!_2b){ return null; } var _2c=["abbr","wide","narrow"],_2d=[1970,0,1,0,0,0,0],_2e="",_2f=dojo.every(_2b,function(v,i){ if(!i){ return true; } var _30=_29[i-1]; var l=_30.length; switch(_30.charAt(0)){ case "y": if(l!=2&&_26.strict){ _2d[0]=v; }else{ if(v<100){ v=Number(v); var _31=""+new Date().getFullYear(),_32=_31.substring(0,2)*100,_33=Math.min(Number(_31.substring(2,4))+20,99),num=(v<_33)?_32+v:_32-100+v; _2d[0]=num; }else{ if(_26.strict){ return false; } _2d[0]=v; } } break; case "M": if(l>2){ var _34=_2a["months-format-"+_2c[l-3]].concat(); if(!_26.strict){ v=v.replace(".","").toLowerCase(); _34=dojo.map(_34,function(s){ return s.replace(".","").toLowerCase(); }); } v=dojo.indexOf(_34,v); if(v==-1){ return false; } }else{ v--; } _2d[1]=v; break; case "E": case "e": var _35=_2a["days-format-"+_2c[l-3]].concat(); if(!_26.strict){ v=v.toLowerCase(); _35=dojo.map(_35,function(d){ return d.toLowerCase(); }); } v=dojo.indexOf(_35,v); if(v==-1){ return false; } break; case "D": _2d[1]=0; case "d": _2d[2]=v; break; case "a": var am=_26.am||_2a["dayPeriods-format-wide-am"],pm=_26.pm||_2a["dayPeriods-format-wide-pm"]; if(!_26.strict){ var _36=/\./g; v=v.replace(_36,"").toLowerCase(); am=am.replace(_36,"").toLowerCase(); pm=pm.replace(_36,"").toLowerCase(); } if(_26.strict&&v!=am&&v!=pm){ return false; } _2e=(v==pm)?"p":(v==am)?"a":""; break; case "K": if(v==24){ v=0; } case "h": case "H": case "k": if(v>23){ return false; } _2d[3]=v; break; case "m": _2d[4]=v; break; case "s": _2d[5]=v; break; case "S": _2d[6]=v; } return true; }); var _37=+_2d[3]; if(_2e==="p"&&_37<12){ _2d[3]=_37+12; }else{ if(_2e==="a"&&_37==12){ _2d[3]=0; } } var _38=new Date(_2d[0],_2d[1],_2d[2],_2d[3],_2d[4],_2d[5],_2d[6]); if(_26.strict){ _38.setFullYear(_2d[0]); } var _39=_29.join(""),_3a=_39.indexOf("d")!=-1,_3b=_39.indexOf("M")!=-1; if(!_2f||(_3b&&_38.getMonth()>_2d[1])||(_3a&&_38.getDate()>_2d[2])){ return null; } if((_3b&&_38.getMonth()<_2d[1])||(_3a&&_38.getDate()<_2d[2])){ _38=dojo.date.add(_38,"hour",1); } return _38; }; function _17(_3c,_3d,_3e,_3f){ var _40=function(x){ return x; }; _3d=_3d||_40; _3e=_3e||_40; _3f=_3f||_40; var _41=_3c.match(/(''|[^'])+/g),_42=_3c.charAt(0)=="'"; dojo.forEach(_41,function(_43,i){ if(!_43){ _41[i]=""; }else{ _41[i]=(_42?_3e:_3d)(_43.replace(/''/g,"'")); _42=!_42; } }); return _3f(_41.join("")); }; function _24(_44,_45,_46,_47){ _47=dojo.regexp.escapeString(_47); if(!_46.strict){ _47=_47.replace(" a"," ?a"); } return _47.replace(/([a-z])\1*/ig,function(_48){ var s,c=_48.charAt(0),l=_48.length,p2="",p3=""; if(_46.strict){ if(l>1){ p2="0"+"{"+(l-1)+"}"; } if(l>2){ p3="0"+"{"+(l-2)+"}"; } }else{ p2="0?"; p3="0{0,2}"; } switch(c){ case "y": s="\\d{2,4}"; break; case "M": s=(l>2)?"\\S+?":p2+"[1-9]|1[0-2]"; break; case "D": s=p2+"[1-9]|"+p3+"[1-9][0-9]|[12][0-9][0-9]|3[0-5][0-9]|36[0-6]"; break; case "d": s="3[01]|[12]\\d|"+p2+"[1-9]"; break; case "w": s=p2+"[1-9]|[1-4][0-9]|5[0-3]"; break; case "E": s="\\S+"; break; case "h": s=p2+"[1-9]|1[0-2]"; break; case "k": s=p2+"\\d|1[01]"; break; case "H": s=p2+"\\d|1\\d|2[0-3]"; break; case "K": s=p2+"[1-9]|1\\d|2[0-4]"; break; case "m": case "s": s="[0-5]\\d"; break; case "S": s="\\d{"+l+"}"; break; case "a": var am=_46.am||_45["dayPeriods-format-wide-am"],pm=_46.pm||_45["dayPeriods-format-wide-pm"]; if(_46.strict){ s=am+"|"+pm; }else{ s=am+"|"+pm; if(am!=am.toLowerCase()){ s+="|"+am.toLowerCase(); } if(pm!=pm.toLowerCase()){ s+="|"+pm.toLowerCase(); } if(s.indexOf(".")!=-1){ s+="|"+s.replace(/\./g,""); } } s=s.replace(/\./g,"\\."); break; default: s=".*"; } if(_44){ _44.push(_48); } return "("+s+")"; }).replace(/[\xa0 ]/g,"[\\s\\xa0]"); }; })(); (function(){ var _49=[]; dojo.date.locale.addCustomFormats=function(_4a,_4b){ _49.push({pkg:_4a,name:_4b}); }; dojo.date.locale._getGregorianBundle=function(_4c){ var _4d={}; dojo.forEach(_49,function(_4e){ var _4f=dojo.i18n.getLocalization(_4e.pkg,_4e.name,_4c); _4d=dojo.mixin(_4d,_4f); },this); return _4d; }; })(); dojo.date.locale.addCustomFormats("dojo.cldr","gregorian"); dojo.date.locale.getNames=function(_50,_51,_52,_53){ var _54,_55=dojo.date.locale._getGregorianBundle(_53),_56=[_50,_52,_51]; if(_52=="standAlone"){ var key=_56.join("-"); _54=_55[key]; if(_54[0]==1){ _54=undefined; } } _56[1]="format"; return (_54||_55[_56.join("-")]).concat(); }; dojo.date.locale.isWeekend=function(_57,_58){ var _59=dojo.cldr.supplemental.getWeekend(_58),day=(_57||new Date()).getDay(); if(_59.end<_59.start){ _59.end+=7; if(day<_59.start){ day+=7; } } return day>=_59.start&&day<=_59.end; }; dojo.date.locale._getDayOfYear=function(_5a){ return dojo.date.difference(new Date(_5a.getFullYear(),0,1,_5a.getHours()),_5a)+1; }; dojo.date.locale._getWeekOfYear=function(_5b,_5c){ if(arguments.length==1){ _5c=0; } var _5d=new Date(_5b.getFullYear(),0,1).getDay(),adj=(_5d-_5c+7)%7,_5e=Math.floor((dojo.date.locale._getDayOfYear(_5b)+adj-1)/7); if(_5d==_5c){ _5e++; } return _5e; }; }
chriszarate/cdnjs
ajax/libs/dojo/1.5.4/date/locale.js
JavaScript
mit
9,096
/* Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ if(!dojo._hasResource["dojo.fx.easing"]){ dojo._hasResource["dojo.fx.easing"]=true; dojo.provide("dojo.fx.easing"); dojo.getObject("fx.easing",true,dojo); dojo.fx.easing={linear:function(n){ return n; },quadIn:function(n){ return Math.pow(n,2); },quadOut:function(n){ return n*(n-2)*-1; },quadInOut:function(n){ n=n*2; if(n<1){ return Math.pow(n,2)/2; } return -1*((--n)*(n-2)-1)/2; },cubicIn:function(n){ return Math.pow(n,3); },cubicOut:function(n){ return Math.pow(n-1,3)+1; },cubicInOut:function(n){ n=n*2; if(n<1){ return Math.pow(n,3)/2; } n-=2; return (Math.pow(n,3)+2)/2; },quartIn:function(n){ return Math.pow(n,4); },quartOut:function(n){ return -1*(Math.pow(n-1,4)-1); },quartInOut:function(n){ n=n*2; if(n<1){ return Math.pow(n,4)/2; } n-=2; return -1/2*(Math.pow(n,4)-2); },quintIn:function(n){ return Math.pow(n,5); },quintOut:function(n){ return Math.pow(n-1,5)+1; },quintInOut:function(n){ n=n*2; if(n<1){ return Math.pow(n,5)/2; } n-=2; return (Math.pow(n,5)+2)/2; },sineIn:function(n){ return -1*Math.cos(n*(Math.PI/2))+1; },sineOut:function(n){ return Math.sin(n*(Math.PI/2)); },sineInOut:function(n){ return -1*(Math.cos(Math.PI*n)-1)/2; },expoIn:function(n){ return (n==0)?0:Math.pow(2,10*(n-1)); },expoOut:function(n){ return (n==1)?1:(-1*Math.pow(2,-10*n)+1); },expoInOut:function(n){ if(n==0){ return 0; } if(n==1){ return 1; } n=n*2; if(n<1){ return Math.pow(2,10*(n-1))/2; } --n; return (-1*Math.pow(2,-10*n)+2)/2; },circIn:function(n){ return -1*(Math.sqrt(1-Math.pow(n,2))-1); },circOut:function(n){ n=n-1; return Math.sqrt(1-Math.pow(n,2)); },circInOut:function(n){ n=n*2; if(n<1){ return -1/2*(Math.sqrt(1-Math.pow(n,2))-1); } n-=2; return 1/2*(Math.sqrt(1-Math.pow(n,2))+1); },backIn:function(n){ var s=1.70158; return Math.pow(n,2)*((s+1)*n-s); },backOut:function(n){ n=n-1; var s=1.70158; return Math.pow(n,2)*((s+1)*n+s)+1; },backInOut:function(n){ var s=1.70158*1.525; n=n*2; if(n<1){ return (Math.pow(n,2)*((s+1)*n-s))/2; } n-=2; return (Math.pow(n,2)*((s+1)*n+s)+2)/2; },elasticIn:function(n){ if(n==0||n==1){ return n; } var p=0.3; var s=p/4; n=n-1; return -1*Math.pow(2,10*n)*Math.sin((n-s)*(2*Math.PI)/p); },elasticOut:function(n){ if(n==0||n==1){ return n; } var p=0.3; var s=p/4; return Math.pow(2,-10*n)*Math.sin((n-s)*(2*Math.PI)/p)+1; },elasticInOut:function(n){ if(n==0){ return 0; } n=n*2; if(n==2){ return 1; } var p=0.3*1.5; var s=p/4; if(n<1){ n-=1; return -0.5*(Math.pow(2,10*n)*Math.sin((n-s)*(2*Math.PI)/p)); } n-=1; return 0.5*(Math.pow(2,-10*n)*Math.sin((n-s)*(2*Math.PI)/p))+1; },bounceIn:function(n){ return (1-dojo.fx.easing.bounceOut(1-n)); },bounceOut:function(n){ var s=7.5625; var p=2.75; var l; if(n<(1/p)){ l=s*Math.pow(n,2); }else{ if(n<(2/p)){ n-=(1.5/p); l=s*Math.pow(n,2)+0.75; }else{ if(n<(2.5/p)){ n-=(2.25/p); l=s*Math.pow(n,2)+0.9375; }else{ n-=(2.625/p); l=s*Math.pow(n,2)+0.984375; } } } return l; },bounceInOut:function(n){ if(n<0.5){ return dojo.fx.easing.bounceIn(n*2)/2; } return (dojo.fx.easing.bounceOut(n*2-1)/2)+0.5; }}; }
yogeshsaroya/cdnjs
ajax/libs/dojo/1.6.3/fx/easing.js
JavaScript
mit
3,202
/* * jPlayer Plugin for jQuery JavaScript Library * http://www.jplayer.org * * Copyright (c) 2009 - 2013 Happyworm Ltd * Licensed under the MIT license. * http://opensource.org/licenses/MIT * * Author: Mark J Panaghiston * Version: 2.4.0 * Date: 5th June 2013 */ (function(b,f){"function"===typeof define&&define.amd?define(["jquery"],f):b.jQuery?f(b.jQuery):f(b.Zepto)})(this,function(b,f){b.fn.jPlayer=function(a){var c="string"===typeof a,d=Array.prototype.slice.call(arguments,1),e=this;a=!c&&d.length?b.extend.apply(null,[!0,a].concat(d)):a;if(c&&"_"===a.charAt(0))return e;c?this.each(function(){var c=b(this).data("jPlayer"),h=c&&b.isFunction(c[a])?c[a].apply(c,d):c;if(h!==c&&h!==f)return e=h,!1}):this.each(function(){var c=b(this).data("jPlayer");c?c.option(a|| {}):b(this).data("jPlayer",new b.jPlayer(a,this))});return e};b.jPlayer=function(a,c){if(arguments.length){this.element=b(c);this.options=b.extend(!0,{},this.options,a);var d=this;this.element.bind("remove.jPlayer",function(){d.destroy()});this._init()}};"function"!==typeof b.fn.stop&&(b.fn.stop=function(){});b.jPlayer.emulateMethods="load play pause";b.jPlayer.emulateStatus="src readyState networkState currentTime duration paused ended playbackRate";b.jPlayer.emulateOptions="muted volume";b.jPlayer.reservedEvent= "ready flashreset resize repeat error warning";b.jPlayer.event={};b.each("ready flashreset resize repeat click error warning loadstart progress suspend abort emptied stalled play pause loadedmetadata loadeddata waiting playing canplay canplaythrough seeking seeked timeupdate ended ratechange durationchange volumechange".split(" "),function(){b.jPlayer.event[this]="jPlayer_"+this});b.jPlayer.htmlEvent="loadstart abort emptied stalled loadedmetadata loadeddata canplay canplaythrough ratechange".split(" "); b.jPlayer.pause=function(){b.each(b.jPlayer.prototype.instances,function(a,c){c.data("jPlayer").status.srcSet&&c.jPlayer("pause")})};b.jPlayer.timeFormat={showHour:!1,showMin:!0,showSec:!0,padHour:!1,padMin:!0,padSec:!0,sepHour:":",sepMin:":",sepSec:""};var l=function(){this.init()};l.prototype={init:function(){this.options={timeFormat:b.jPlayer.timeFormat}},time:function(a){var c=new Date(1E3*(a&&"number"===typeof a?a:0)),b=c.getUTCHours();a=this.options.timeFormat.showHour?c.getUTCMinutes():c.getUTCMinutes()+ 60*b;c=this.options.timeFormat.showMin?c.getUTCSeconds():c.getUTCSeconds()+60*a;b=this.options.timeFormat.padHour&&10>b?"0"+b:b;a=this.options.timeFormat.padMin&&10>a?"0"+a:a;c=this.options.timeFormat.padSec&&10>c?"0"+c:c;b=""+(this.options.timeFormat.showHour?b+this.options.timeFormat.sepHour:"");b+=this.options.timeFormat.showMin?a+this.options.timeFormat.sepMin:"";return b+=this.options.timeFormat.showSec?c+this.options.timeFormat.sepSec:""}};var m=new l;b.jPlayer.convertTime=function(a){return m.time(a)}; b.jPlayer.uaBrowser=function(a){a=a.toLowerCase();var b=/(opera)(?:.*version)?[ \/]([\w.]+)/,d=/(msie) ([\w.]+)/,e=/(mozilla)(?:.*? rv:([\w.]+))?/;a=/(webkit)[ \/]([\w.]+)/.exec(a)||b.exec(a)||d.exec(a)||0>a.indexOf("compatible")&&e.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}};b.jPlayer.uaPlatform=function(a){var b=a.toLowerCase(),d=/(android)/,e=/(mobile)/;a=/(ipad|iphone|ipod|android|blackberry|playbook|windows ce|webos)/.exec(b)||[];b=/(ipad|playbook)/.exec(b)||!e.exec(b)&&d.exec(b)|| [];a[1]&&(a[1]=a[1].replace(/\s/g,"_"));return{platform:a[1]||"",tablet:b[1]||""}};b.jPlayer.browser={};b.jPlayer.platform={};var j=b.jPlayer.uaBrowser(navigator.userAgent);j.browser&&(b.jPlayer.browser[j.browser]=!0,b.jPlayer.browser.version=j.version);j=b.jPlayer.uaPlatform(navigator.userAgent);j.platform&&(b.jPlayer.platform[j.platform]=!0,b.jPlayer.platform.mobile=!j.tablet,b.jPlayer.platform.tablet=!!j.tablet);b.jPlayer.getDocMode=function(){var a;b.jPlayer.browser.msie&&(document.documentMode? a=document.documentMode:(a=5,document.compatMode&&"CSS1Compat"===document.compatMode&&(a=7)));return a};b.jPlayer.browser.documentMode=b.jPlayer.getDocMode();b.jPlayer.nativeFeatures={init:function(){var a=document,b=a.createElement("video"),d={w3c:"fullscreenEnabled fullscreenElement requestFullscreen exitFullscreen fullscreenchange fullscreenerror".split(" "),moz:"mozFullScreenEnabled mozFullScreenElement mozRequestFullScreen mozCancelFullScreen mozfullscreenchange mozfullscreenerror".split(" "), webkit:" webkitCurrentFullScreenElement webkitRequestFullScreen webkitCancelFullScreen webkitfullscreenchange ".split(" "),webkitVideo:"webkitSupportsFullscreen webkitDisplayingFullscreen webkitEnterFullscreen webkitExitFullscreen ".split(" ")},e=["w3c","moz","webkit","webkitVideo"],g,h;this.fullscreen=b={support:{w3c:!!a[d.w3c[0]],moz:!!a[d.moz[0]],webkit:"function"===typeof a[d.webkit[3]],webkitVideo:"function"===typeof b[d.webkitVideo[2]]},used:{}};g=0;for(h=e.length;g<h;g++){var f=e[g];if(b.support[f]){b.spec= f;b.used[f]=!0;break}}if(b.spec){var k=d[b.spec];b.api={fullscreenEnabled:!0,fullscreenElement:function(b){b=b?b:a;return b[k[1]]},requestFullscreen:function(a){return a[k[2]]()},exitFullscreen:function(b){b=b?b:a;return b[k[3]]()}};b.event={fullscreenchange:k[4],fullscreenerror:k[5]}}else b.api={fullscreenEnabled:!1,fullscreenElement:function(){return null},requestFullscreen:function(){},exitFullscreen:function(){}},b.event={}}};b.jPlayer.nativeFeatures.init();b.jPlayer.focus=null;b.jPlayer.keyIgnoreElementNames= "INPUT TEXTAREA";var n=function(a){var c=b.jPlayer.focus,d;c&&(b.each(b.jPlayer.keyIgnoreElementNames.split(/\s+/g),function(b,c){if(a.target.nodeName.toUpperCase()===c.toUpperCase())return d=!0,!1}),d||b.each(c.options.keyBindings,function(d,g){if(g&&a.which===g.key&&b.isFunction(g.fn))return a.preventDefault(),g.fn(c),!1}))};b.jPlayer.keys=function(a){b(document.documentElement).unbind("keydown.jPlayer");a&&b(document.documentElement).bind("keydown.jPlayer",n)};b.jPlayer.keys(!0);b.jPlayer.prototype= {count:0,version:{script:"2.4.0",needFlash:"2.4.0",flash:"unknown"},options:{swfPath:"js",solution:"html, flash",supplied:"mp3",preload:"metadata",volume:0.8,muted:!1,wmode:"opaque",backgroundColor:"#000000",cssSelectorAncestor:"#jp_container_1",cssSelector:{videoPlay:".jp-video-play",play:".jp-play",pause:".jp-pause",stop:".jp-stop",seekBar:".jp-seek-bar",playBar:".jp-play-bar",mute:".jp-mute",unmute:".jp-unmute",volumeBar:".jp-volume-bar",volumeBarValue:".jp-volume-bar-value",volumeMax:".jp-volume-max", currentTime:".jp-current-time",duration:".jp-duration",fullScreen:".jp-full-screen",restoreScreen:".jp-restore-screen",repeat:".jp-repeat",repeatOff:".jp-repeat-off",gui:".jp-gui",noSolution:".jp-no-solution"},smoothPlayBar:!1,fullScreen:!1,fullWindow:!1,autohide:{restored:!1,full:!0,fadeIn:200,fadeOut:600,hold:1E3},loop:!1,repeat:function(a){a.jPlayer.options.loop?b(this).unbind(".jPlayerRepeat").bind(b.jPlayer.event.ended+".jPlayer.jPlayerRepeat",function(){b(this).jPlayer("play")}):b(this).unbind(".jPlayerRepeat")}, nativeVideoControls:{},noFullWindow:{msie:/msie [0-6]\./,ipad:/ipad.*?os [0-4]\./,iphone:/iphone/,ipod:/ipod/,android_pad:/android [0-3]\.(?!.*?mobile)/,android_phone:/android.*?mobile/,blackberry:/blackberry/,windows_ce:/windows ce/,iemobile:/iemobile/,webos:/webos/},noVolume:{ipad:/ipad/,iphone:/iphone/,ipod:/ipod/,android_pad:/android(?!.*?mobile)/,android_phone:/android.*?mobile/,blackberry:/blackberry/,windows_ce:/windows ce/,iemobile:/iemobile/,webos:/webos/,playbook:/playbook/},timeFormat:{}, keyEnabled:!1,audioFullScreen:!1,keyBindings:{play:{key:32,fn:function(a){a.status.paused?a.play():a.pause()}},fullScreen:{key:13,fn:function(a){(a.status.video||a.options.audioFullScreen)&&a._setOption("fullScreen",!a.options.fullScreen)}},muted:{key:8,fn:function(a){a._muted(!a.options.muted)}},volumeUp:{key:38,fn:function(a){a.volume(a.options.volume+0.1)}},volumeDown:{key:40,fn:function(a){a.volume(a.options.volume-0.1)}}},verticalVolume:!1,idPrefix:"jp",noConflict:"jQuery",emulateHtml:!1,errorAlerts:!1, warningAlerts:!1},optionsAudio:{size:{width:"0px",height:"0px",cssClass:""},sizeFull:{width:"0px",height:"0px",cssClass:""}},optionsVideo:{size:{width:"480px",height:"270px",cssClass:"jp-video-270p"},sizeFull:{width:"100%",height:"100%",cssClass:"jp-video-full"}},instances:{},status:{src:"",media:{},paused:!0,format:{},formatType:"",waitForPlay:!0,waitForLoad:!0,srcSet:!1,video:!1,seekPercent:0,currentPercentRelative:0,currentPercentAbsolute:0,currentTime:0,duration:0,videoWidth:0,videoHeight:0,readyState:0, networkState:0,playbackRate:1,ended:0},internal:{ready:!1},solution:{html:!0,flash:!0},format:{mp3:{codec:'audio/mpeg; codecs="mp3"',flashCanPlay:!0,media:"audio"},m4a:{codec:'audio/mp4; codecs="mp4a.40.2"',flashCanPlay:!0,media:"audio"},oga:{codec:'audio/ogg; codecs="vorbis"',flashCanPlay:!1,media:"audio"},wav:{codec:'audio/wav; codecs="1"',flashCanPlay:!1,media:"audio"},webma:{codec:'audio/webm; codecs="vorbis"',flashCanPlay:!1,media:"audio"},fla:{codec:"audio/x-flv",flashCanPlay:!0,media:"audio"}, rtmpa:{codec:'audio/rtmp; codecs="rtmp"',flashCanPlay:!0,media:"audio"},m4v:{codec:'video/mp4; codecs="avc1.42E01E, mp4a.40.2"',flashCanPlay:!0,media:"video"},ogv:{codec:'video/ogg; codecs="theora, vorbis"',flashCanPlay:!1,media:"video"},webmv:{codec:'video/webm; codecs="vorbis, vp8"',flashCanPlay:!1,media:"video"},flv:{codec:"video/x-flv",flashCanPlay:!0,media:"video"},rtmpv:{codec:'video/rtmp; codecs="rtmp"',flashCanPlay:!0,media:"video"}},_init:function(){var a=this;this.element.empty();this.status= b.extend({},this.status);this.internal=b.extend({},this.internal);this.options.timeFormat=b.extend({},b.jPlayer.timeFormat,this.options.timeFormat);this.internal.cmdsIgnored=b.jPlayer.platform.ipad||b.jPlayer.platform.iphone||b.jPlayer.platform.ipod;this.internal.domNode=this.element.get(0);this.options.keyEnabled&&!b.jPlayer.focus&&(b.jPlayer.focus=this);this.formats=[];this.solutions=[];this.require={};this.htmlElement={};this.html={};this.html.audio={};this.html.video={};this.flash={};this.css= {};this.css.cs={};this.css.jq={};this.ancestorJq=[];this.options.volume=this._limitValue(this.options.volume,0,1);b.each(this.options.supplied.toLowerCase().split(","),function(c,d){var e=d.replace(/^\s+|\s+$/g,"");if(a.format[e]){var f=!1;b.each(a.formats,function(a,b){if(e===b)return f=!0,!1});f||a.formats.push(e)}});b.each(this.options.solution.toLowerCase().split(","),function(c,d){var e=d.replace(/^\s+|\s+$/g,"");if(a.solution[e]){var f=!1;b.each(a.solutions,function(a,b){if(e===b)return f=!0, !1});f||a.solutions.push(e)}});this.internal.instance="jp_"+this.count;this.instances[this.internal.instance]=this.element;this.element.attr("id")||this.element.attr("id",this.options.idPrefix+"_jplayer_"+this.count);this.internal.self=b.extend({},{id:this.element.attr("id"),jq:this.element});this.internal.audio=b.extend({},{id:this.options.idPrefix+"_audio_"+this.count,jq:f});this.internal.video=b.extend({},{id:this.options.idPrefix+"_video_"+this.count,jq:f});this.internal.flash=b.extend({},{id:this.options.idPrefix+ "_flash_"+this.count,jq:f,swf:this.options.swfPath+(".swf"!==this.options.swfPath.toLowerCase().slice(-4)?(this.options.swfPath&&"/"!==this.options.swfPath.slice(-1)?"/":"")+"Jplayer.swf":"")});this.internal.poster=b.extend({},{id:this.options.idPrefix+"_poster_"+this.count,jq:f});b.each(b.jPlayer.event,function(b,c){a.options[b]!==f&&(a.element.bind(c+".jPlayer",a.options[b]),a.options[b]=f)});this.require.audio=!1;this.require.video=!1;b.each(this.formats,function(b,c){a.require[a.format[c].media]= !0});this.options=this.require.video?b.extend(!0,{},this.optionsVideo,this.options):b.extend(!0,{},this.optionsAudio,this.options);this._setSize();this.status.nativeVideoControls=this._uaBlocklist(this.options.nativeVideoControls);this.status.noFullWindow=this._uaBlocklist(this.options.noFullWindow);this.status.noVolume=this._uaBlocklist(this.options.noVolume);b.jPlayer.nativeFeatures.fullscreen.api.fullscreenEnabled&&this._fullscreenAddEventListeners();this._restrictNativeVideoControls();this.htmlElement.poster= document.createElement("img");this.htmlElement.poster.id=this.internal.poster.id;this.htmlElement.poster.onload=function(){(!a.status.video||a.status.waitForPlay)&&a.internal.poster.jq.show()};this.element.append(this.htmlElement.poster);this.internal.poster.jq=b("#"+this.internal.poster.id);this.internal.poster.jq.css({width:this.status.width,height:this.status.height});this.internal.poster.jq.hide();this.internal.poster.jq.bind("click.jPlayer",function(){a._trigger(b.jPlayer.event.click)});this.html.audio.available= !1;this.require.audio&&(this.htmlElement.audio=document.createElement("audio"),this.htmlElement.audio.id=this.internal.audio.id,this.html.audio.available=!!this.htmlElement.audio.canPlayType&&this._testCanPlayType(this.htmlElement.audio));this.html.video.available=!1;this.require.video&&(this.htmlElement.video=document.createElement("video"),this.htmlElement.video.id=this.internal.video.id,this.html.video.available=!!this.htmlElement.video.canPlayType&&this._testCanPlayType(this.htmlElement.video)); this.flash.available=this._checkForFlash(10.1);this.html.canPlay={};this.flash.canPlay={};b.each(this.formats,function(b,c){a.html.canPlay[c]=a.html[a.format[c].media].available&&""!==a.htmlElement[a.format[c].media].canPlayType(a.format[c].codec);a.flash.canPlay[c]=a.format[c].flashCanPlay&&a.flash.available});this.html.desired=!1;this.flash.desired=!1;b.each(this.solutions,function(c,d){if(0===c)a[d].desired=!0;else{var e=!1,f=!1;b.each(a.formats,function(b,c){a[a.solutions[0]].canPlay[c]&&("video"=== a.format[c].media?f=!0:e=!0)});a[d].desired=a.require.audio&&!e||a.require.video&&!f}});this.html.support={};this.flash.support={};b.each(this.formats,function(b,c){a.html.support[c]=a.html.canPlay[c]&&a.html.desired;a.flash.support[c]=a.flash.canPlay[c]&&a.flash.desired});this.html.used=!1;this.flash.used=!1;b.each(this.solutions,function(c,d){b.each(a.formats,function(b,c){if(a[d].support[c])return a[d].used=!0,!1})});this._resetActive();this._resetGate();this._cssSelectorAncestor(this.options.cssSelectorAncestor); !this.html.used&&!this.flash.used?(this._error({type:b.jPlayer.error.NO_SOLUTION,context:"{solution:'"+this.options.solution+"', supplied:'"+this.options.supplied+"'}",message:b.jPlayer.errorMsg.NO_SOLUTION,hint:b.jPlayer.errorHint.NO_SOLUTION}),this.css.jq.noSolution.length&&this.css.jq.noSolution.show()):this.css.jq.noSolution.length&&this.css.jq.noSolution.hide();if(this.flash.used){var c,d="jQuery="+encodeURI(this.options.noConflict)+"&id="+encodeURI(this.internal.self.id)+"&vol="+this.options.volume+ "&muted="+this.options.muted;if(b.jPlayer.browser.msie&&(9>Number(b.jPlayer.browser.version)||9>b.jPlayer.browser.documentMode)){d=['<param name="movie" value="'+this.internal.flash.swf+'" />','<param name="FlashVars" value="'+d+'" />','<param name="allowScriptAccess" value="always" />','<param name="bgcolor" value="'+this.options.backgroundColor+'" />','<param name="wmode" value="'+this.options.wmode+'" />'];c=document.createElement('<object id="'+this.internal.flash.id+'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="0" height="0" tabindex="-1"></object>'); for(var e=0;e<d.length;e++)c.appendChild(document.createElement(d[e]))}else e=function(a,b,c){var d=document.createElement("param");d.setAttribute("name",b);d.setAttribute("value",c);a.appendChild(d)},c=document.createElement("object"),c.setAttribute("id",this.internal.flash.id),c.setAttribute("name",this.internal.flash.id),c.setAttribute("data",this.internal.flash.swf),c.setAttribute("type","application/x-shockwave-flash"),c.setAttribute("width","1"),c.setAttribute("height","1"),c.setAttribute("tabindex", "-1"),e(c,"flashvars",d),e(c,"allowscriptaccess","always"),e(c,"bgcolor",this.options.backgroundColor),e(c,"wmode",this.options.wmode);this.element.append(c);this.internal.flash.jq=b(c)}this.html.used&&(this.html.audio.available&&(this._addHtmlEventListeners(this.htmlElement.audio,this.html.audio),this.element.append(this.htmlElement.audio),this.internal.audio.jq=b("#"+this.internal.audio.id)),this.html.video.available&&(this._addHtmlEventListeners(this.htmlElement.video,this.html.video),this.element.append(this.htmlElement.video), this.internal.video.jq=b("#"+this.internal.video.id),this.status.nativeVideoControls?this.internal.video.jq.css({width:this.status.width,height:this.status.height}):this.internal.video.jq.css({width:"0px",height:"0px"}),this.internal.video.jq.bind("click.jPlayer",function(){a._trigger(b.jPlayer.event.click)})));this.options.emulateHtml&&this._emulateHtmlBridge();this.html.used&&!this.flash.used&&setTimeout(function(){a.internal.ready=!0;a.version.flash="n/a";a._trigger(b.jPlayer.event.repeat);a._trigger(b.jPlayer.event.ready)}, 100);this._updateNativeVideoControls();this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide();b.jPlayer.prototype.count++},destroy:function(){this.clearMedia();this._removeUiClass();this.css.jq.currentTime.length&&this.css.jq.currentTime.text("");this.css.jq.duration.length&&this.css.jq.duration.text("");b.each(this.css.jq,function(a,b){b.length&&b.unbind(".jPlayer")});this.internal.poster.jq.unbind(".jPlayer");this.internal.video.jq&&this.internal.video.jq.unbind(".jPlayer");this._fullscreenRemoveEventListeners(); this===b.jPlayer.focus&&(b.jPlayer.focus=null);this.options.emulateHtml&&this._destroyHtmlBridge();this.element.removeData("jPlayer");this.element.unbind(".jPlayer");this.element.empty();delete this.instances[this.internal.instance]},enable:function(){},disable:function(){},_testCanPlayType:function(a){try{return a.canPlayType(this.format.mp3.codec),!0}catch(b){return!1}},_uaBlocklist:function(a){var c=navigator.userAgent.toLowerCase(),d=!1;b.each(a,function(a,b){if(b&&b.test(c))return d=!0,!1}); return d},_restrictNativeVideoControls:function(){this.require.audio&&this.status.nativeVideoControls&&(this.status.nativeVideoControls=!1,this.status.noFullWindow=!0)},_updateNativeVideoControls:function(){this.html.video.available&&this.html.used&&(this.htmlElement.video.controls=this.status.nativeVideoControls,this._updateAutohide(),this.status.nativeVideoControls&&this.require.video?(this.internal.poster.jq.hide(),this.internal.video.jq.css({width:this.status.width,height:this.status.height})): this.status.waitForPlay&&this.status.video&&(this.internal.poster.jq.show(),this.internal.video.jq.css({width:"0px",height:"0px"})))},_addHtmlEventListeners:function(a,c){var d=this;a.preload=this.options.preload;a.muted=this.options.muted;a.volume=this.options.volume;a.addEventListener("progress",function(){c.gate&&(d.internal.cmdsIgnored&&0<this.readyState&&(d.internal.cmdsIgnored=!1),d._getHtmlStatus(a),d._updateInterface(),d._trigger(b.jPlayer.event.progress))},!1);a.addEventListener("timeupdate", function(){c.gate&&(d._getHtmlStatus(a),d._updateInterface(),d._trigger(b.jPlayer.event.timeupdate))},!1);a.addEventListener("durationchange",function(){c.gate&&(d._getHtmlStatus(a),d._updateInterface(),d._trigger(b.jPlayer.event.durationchange))},!1);a.addEventListener("play",function(){c.gate&&(d._updateButtons(!0),d._html_checkWaitForPlay(),d._trigger(b.jPlayer.event.play))},!1);a.addEventListener("playing",function(){c.gate&&(d._updateButtons(!0),d._seeked(),d._trigger(b.jPlayer.event.playing))}, !1);a.addEventListener("pause",function(){c.gate&&(d._updateButtons(!1),d._trigger(b.jPlayer.event.pause))},!1);a.addEventListener("waiting",function(){c.gate&&(d._seeking(),d._trigger(b.jPlayer.event.waiting))},!1);a.addEventListener("seeking",function(){c.gate&&(d._seeking(),d._trigger(b.jPlayer.event.seeking))},!1);a.addEventListener("seeked",function(){c.gate&&(d._seeked(),d._trigger(b.jPlayer.event.seeked))},!1);a.addEventListener("volumechange",function(){c.gate&&(d.options.volume=a.volume, d.options.muted=a.muted,d._updateMute(),d._updateVolume(),d._trigger(b.jPlayer.event.volumechange))},!1);a.addEventListener("suspend",function(){c.gate&&(d._seeked(),d._trigger(b.jPlayer.event.suspend))},!1);a.addEventListener("ended",function(){c.gate&&(b.jPlayer.browser.webkit||(d.htmlElement.media.currentTime=0),d.htmlElement.media.pause(),d._updateButtons(!1),d._getHtmlStatus(a,!0),d._updateInterface(),d._trigger(b.jPlayer.event.ended))},!1);a.addEventListener("error",function(){c.gate&&(d._updateButtons(!1), d._seeked(),d.status.srcSet&&(clearTimeout(d.internal.htmlDlyCmdId),d.status.waitForLoad=!0,d.status.waitForPlay=!0,d.status.video&&!d.status.nativeVideoControls&&d.internal.video.jq.css({width:"0px",height:"0px"}),d._validString(d.status.media.poster)&&!d.status.nativeVideoControls&&d.internal.poster.jq.show(),d.css.jq.videoPlay.length&&d.css.jq.videoPlay.show(),d._error({type:b.jPlayer.error.URL,context:d.status.src,message:b.jPlayer.errorMsg.URL,hint:b.jPlayer.errorHint.URL})))},!1);b.each(b.jPlayer.htmlEvent, function(e,g){a.addEventListener(this,function(){c.gate&&d._trigger(b.jPlayer.event[g])},!1)})},_getHtmlStatus:function(a,b){var d=0,e=0,g=0,f=0;isFinite(a.duration)&&(this.status.duration=a.duration);d=a.currentTime;e=0<this.status.duration?100*d/this.status.duration:0;"object"===typeof a.seekable&&0<a.seekable.length?(g=0<this.status.duration?100*a.seekable.end(a.seekable.length-1)/this.status.duration:100,f=0<this.status.duration?100*a.currentTime/a.seekable.end(a.seekable.length-1):0):(g=100, f=e);b&&(e=f=d=0);this.status.seekPercent=g;this.status.currentPercentRelative=f;this.status.currentPercentAbsolute=e;this.status.currentTime=d;this.status.videoWidth=a.videoWidth;this.status.videoHeight=a.videoHeight;this.status.readyState=a.readyState;this.status.networkState=a.networkState;this.status.playbackRate=a.playbackRate;this.status.ended=a.ended},_resetStatus:function(){this.status=b.extend({},this.status,b.jPlayer.prototype.status)},_trigger:function(a,c,d){a=b.Event(a);a.jPlayer={}; a.jPlayer.version=b.extend({},this.version);a.jPlayer.options=b.extend(!0,{},this.options);a.jPlayer.status=b.extend(!0,{},this.status);a.jPlayer.html=b.extend(!0,{},this.html);a.jPlayer.flash=b.extend(!0,{},this.flash);c&&(a.jPlayer.error=b.extend({},c));d&&(a.jPlayer.warning=b.extend({},d));this.element.trigger(a)},jPlayerFlashEvent:function(a,c){if(a===b.jPlayer.event.ready)if(this.internal.ready){if(this.flash.gate){if(this.status.srcSet){var d=this.status.currentTime,e=this.status.paused;this.setMedia(this.status.media); 0<d&&(e?this.pause(d):this.play(d))}this._trigger(b.jPlayer.event.flashreset)}}else this.internal.ready=!0,this.internal.flash.jq.css({width:"0px",height:"0px"}),this.version.flash=c.version,this.version.needFlash!==this.version.flash&&this._error({type:b.jPlayer.error.VERSION,context:this.version.flash,message:b.jPlayer.errorMsg.VERSION+this.version.flash,hint:b.jPlayer.errorHint.VERSION}),this._trigger(b.jPlayer.event.repeat),this._trigger(a);if(this.flash.gate)switch(a){case b.jPlayer.event.progress:this._getFlashStatus(c); this._updateInterface();this._trigger(a);break;case b.jPlayer.event.timeupdate:this._getFlashStatus(c);this._updateInterface();this._trigger(a);break;case b.jPlayer.event.play:this._seeked();this._updateButtons(!0);this._trigger(a);break;case b.jPlayer.event.pause:this._updateButtons(!1);this._trigger(a);break;case b.jPlayer.event.ended:this._updateButtons(!1);this._trigger(a);break;case b.jPlayer.event.click:this._trigger(a);break;case b.jPlayer.event.error:this.status.waitForLoad=!0;this.status.waitForPlay= !0;this.status.video&&this.internal.flash.jq.css({width:"0px",height:"0px"});this._validString(this.status.media.poster)&&this.internal.poster.jq.show();this.css.jq.videoPlay.length&&this.status.video&&this.css.jq.videoPlay.show();this.status.video?this._flash_setVideo(this.status.media):this._flash_setAudio(this.status.media);this._updateButtons(!1);this._error({type:b.jPlayer.error.URL,context:c.src,message:b.jPlayer.errorMsg.URL,hint:b.jPlayer.errorHint.URL});break;case b.jPlayer.event.seeking:this._seeking(); this._trigger(a);break;case b.jPlayer.event.seeked:this._seeked();this._trigger(a);break;case b.jPlayer.event.ready:break;default:this._trigger(a)}return!1},_getFlashStatus:function(a){this.status.seekPercent=a.seekPercent;this.status.currentPercentRelative=a.currentPercentRelative;this.status.currentPercentAbsolute=a.currentPercentAbsolute;this.status.currentTime=a.currentTime;this.status.duration=a.duration;this.status.videoWidth=a.videoWidth;this.status.videoHeight=a.videoHeight;this.status.readyState= 4;this.status.networkState=0;this.status.playbackRate=1;this.status.ended=!1},_updateButtons:function(a){a===f?a=!this.status.paused:this.status.paused=!a;this.css.jq.play.length&&this.css.jq.pause.length&&(a?(this.css.jq.play.hide(),this.css.jq.pause.show()):(this.css.jq.play.show(),this.css.jq.pause.hide()));this.css.jq.restoreScreen.length&&this.css.jq.fullScreen.length&&(this.status.noFullWindow?(this.css.jq.fullScreen.hide(),this.css.jq.restoreScreen.hide()):this.options.fullWindow?(this.css.jq.fullScreen.hide(), this.css.jq.restoreScreen.show()):(this.css.jq.fullScreen.show(),this.css.jq.restoreScreen.hide()));this.css.jq.repeat.length&&this.css.jq.repeatOff.length&&(this.options.loop?(this.css.jq.repeat.hide(),this.css.jq.repeatOff.show()):(this.css.jq.repeat.show(),this.css.jq.repeatOff.hide()))},_updateInterface:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.width(this.status.seekPercent+"%");this.css.jq.playBar.length&&(this.options.smoothPlayBar?this.css.jq.playBar.stop().animate({width:this.status.currentPercentAbsolute+ "%"},250,"linear"):this.css.jq.playBar.width(this.status.currentPercentRelative+"%"));this.css.jq.currentTime.length&&this.css.jq.currentTime.text(this._convertTime(this.status.currentTime));this.css.jq.duration.length&&this.css.jq.duration.text(this._convertTime(this.status.duration))},_convertTime:l.prototype.time,_seeking:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.addClass("jp-seeking-bg")},_seeked:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.removeClass("jp-seeking-bg")}, _resetGate:function(){this.html.audio.gate=!1;this.html.video.gate=!1;this.flash.gate=!1},_resetActive:function(){this.html.active=!1;this.flash.active=!1},setMedia:function(a){var c=this,d=!1,e=this.status.media.poster!==a.poster;this._resetMedia();this._resetGate();this._resetActive();b.each(this.formats,function(e,f){var j="video"===c.format[f].media;b.each(c.solutions,function(b,e){if(c[e].support[f]&&c._validString(a[f])){var g="html"===e;j?(g?(c.html.video.gate=!0,c._html_setVideo(a),c.html.active= !0):(c.flash.gate=!0,c._flash_setVideo(a),c.flash.active=!0),c.css.jq.videoPlay.length&&c.css.jq.videoPlay.show(),c.status.video=!0):(g?(c.html.audio.gate=!0,c._html_setAudio(a),c.html.active=!0):(c.flash.gate=!0,c._flash_setAudio(a),c.flash.active=!0),c.css.jq.videoPlay.length&&c.css.jq.videoPlay.hide(),c.status.video=!1);d=!0;return!1}});if(d)return!1});if(d){if((!this.status.nativeVideoControls||!this.html.video.gate)&&this._validString(a.poster))e?this.htmlElement.poster.src=a.poster:this.internal.poster.jq.show(); this.status.srcSet=!0;this.status.media=b.extend({},a);this._updateButtons(!1);this._updateInterface()}else this._error({type:b.jPlayer.error.NO_SUPPORT,context:"{supplied:'"+this.options.supplied+"'}",message:b.jPlayer.errorMsg.NO_SUPPORT,hint:b.jPlayer.errorHint.NO_SUPPORT})},_resetMedia:function(){this._resetStatus();this._updateButtons(!1);this._updateInterface();this._seeked();this.internal.poster.jq.hide();clearTimeout(this.internal.htmlDlyCmdId);this.html.active?this._html_resetMedia():this.flash.active&& this._flash_resetMedia()},clearMedia:function(){this._resetMedia();this.html.active?this._html_clearMedia():this.flash.active&&this._flash_clearMedia();this._resetGate();this._resetActive()},load:function(){this.status.srcSet?this.html.active?this._html_load():this.flash.active&&this._flash_load():this._urlNotSetError("load")},focus:function(){this.options.keyEnabled&&(b.jPlayer.focus=this)},play:function(a){a="number"===typeof a?a:NaN;this.status.srcSet?(this.focus(),this.html.active?this._html_play(a): this.flash.active&&this._flash_play(a)):this._urlNotSetError("play")},videoPlay:function(){this.play()},pause:function(a){a="number"===typeof a?a:NaN;this.status.srcSet?this.html.active?this._html_pause(a):this.flash.active&&this._flash_pause(a):this._urlNotSetError("pause")},pauseOthers:function(){var a=this;b.each(this.instances,function(b,d){a.element!==d&&d.data("jPlayer").status.srcSet&&d.jPlayer("pause")})},stop:function(){this.status.srcSet?this.html.active?this._html_pause(0):this.flash.active&& this._flash_pause(0):this._urlNotSetError("stop")},playHead:function(a){a=this._limitValue(a,0,100);this.status.srcSet?this.html.active?this._html_playHead(a):this.flash.active&&this._flash_playHead(a):this._urlNotSetError("playHead")},_muted:function(a){this.options.muted=a;this.html.used&&this._html_mute(a);this.flash.used&&this._flash_mute(a);!this.html.video.gate&&!this.html.audio.gate&&(this._updateMute(a),this._updateVolume(this.options.volume),this._trigger(b.jPlayer.event.volumechange))}, mute:function(a){a=a===f?!0:!!a;this._muted(a)},unmute:function(a){a=a===f?!0:!!a;this._muted(!a)},_updateMute:function(a){a===f&&(a=this.options.muted);this.css.jq.mute.length&&this.css.jq.unmute.length&&(this.status.noVolume?(this.css.jq.mute.hide(),this.css.jq.unmute.hide()):a?(this.css.jq.mute.hide(),this.css.jq.unmute.show()):(this.css.jq.mute.show(),this.css.jq.unmute.hide()))},volume:function(a){a=this._limitValue(a,0,1);this.options.volume=a;this.html.used&&this._html_volume(a);this.flash.used&& this._flash_volume(a);!this.html.video.gate&&!this.html.audio.gate&&(this._updateVolume(a),this._trigger(b.jPlayer.event.volumechange))},volumeBar:function(a){if(this.css.jq.volumeBar.length){var c=b(a.currentTarget),d=c.offset(),e=a.pageX-d.left,g=c.width();a=c.height()-a.pageY+d.top;c=c.height();this.options.verticalVolume?this.volume(a/c):this.volume(e/g)}this.options.muted&&this._muted(!1)},volumeBarValue:function(){},_updateVolume:function(a){a===f&&(a=this.options.volume);a=this.options.muted? 0:a;this.status.noVolume?(this.css.jq.volumeBar.length&&this.css.jq.volumeBar.hide(),this.css.jq.volumeBarValue.length&&this.css.jq.volumeBarValue.hide(),this.css.jq.volumeMax.length&&this.css.jq.volumeMax.hide()):(this.css.jq.volumeBar.length&&this.css.jq.volumeBar.show(),this.css.jq.volumeBarValue.length&&(this.css.jq.volumeBarValue.show(),this.css.jq.volumeBarValue[this.options.verticalVolume?"height":"width"](100*a+"%")),this.css.jq.volumeMax.length&&this.css.jq.volumeMax.show())},volumeMax:function(){this.volume(1); this.options.muted&&this._muted(!1)},_cssSelectorAncestor:function(a){var c=this;this.options.cssSelectorAncestor=a;this._removeUiClass();this.ancestorJq=a?b(a):[];a&&1!==this.ancestorJq.length&&this._warning({type:b.jPlayer.warning.CSS_SELECTOR_COUNT,context:a,message:b.jPlayer.warningMsg.CSS_SELECTOR_COUNT+this.ancestorJq.length+" found for cssSelectorAncestor.",hint:b.jPlayer.warningHint.CSS_SELECTOR_COUNT});this._addUiClass();b.each(this.options.cssSelector,function(a,b){c._cssSelector(a,b)}); this._updateInterface();this._updateButtons();this._updateAutohide();this._updateVolume();this._updateMute()},_cssSelector:function(a,c){var d=this;"string"===typeof c?b.jPlayer.prototype.options.cssSelector[a]?(this.css.jq[a]&&this.css.jq[a].length&&this.css.jq[a].unbind(".jPlayer"),this.options.cssSelector[a]=c,this.css.cs[a]=this.options.cssSelectorAncestor+" "+c,this.css.jq[a]=c?b(this.css.cs[a]):[],this.css.jq[a].length&&this.css.jq[a].bind("click.jPlayer",function(c){c.preventDefault();d[a](c); b(this).blur()}),c&&1!==this.css.jq[a].length&&this._warning({type:b.jPlayer.warning.CSS_SELECTOR_COUNT,context:this.css.cs[a],message:b.jPlayer.warningMsg.CSS_SELECTOR_COUNT+this.css.jq[a].length+" found for "+a+" method.",hint:b.jPlayer.warningHint.CSS_SELECTOR_COUNT})):this._warning({type:b.jPlayer.warning.CSS_SELECTOR_METHOD,context:a,message:b.jPlayer.warningMsg.CSS_SELECTOR_METHOD,hint:b.jPlayer.warningHint.CSS_SELECTOR_METHOD}):this._warning({type:b.jPlayer.warning.CSS_SELECTOR_STRING,context:c, message:b.jPlayer.warningMsg.CSS_SELECTOR_STRING,hint:b.jPlayer.warningHint.CSS_SELECTOR_STRING})},seekBar:function(a){if(this.css.jq.seekBar.length){var c=b(a.currentTarget),d=c.offset();a=a.pageX-d.left;c=c.width();this.playHead(100*a/c)}},playBar:function(){},repeat:function(){this._loop(!0)},repeatOff:function(){this._loop(!1)},_loop:function(a){this.options.loop!==a&&(this.options.loop=a,this._updateButtons(),this._trigger(b.jPlayer.event.repeat))},currentTime:function(){},duration:function(){}, gui:function(){},noSolution:function(){},option:function(a,c){var d=a;if(0===arguments.length)return b.extend(!0,{},this.options);if("string"===typeof a){var e=a.split(".");if(c===f){for(var d=b.extend(!0,{},this.options),g=0;g<e.length;g++)if(d[e[g]]!==f)d=d[e[g]];else return this._warning({type:b.jPlayer.warning.OPTION_KEY,context:a,message:b.jPlayer.warningMsg.OPTION_KEY,hint:b.jPlayer.warningHint.OPTION_KEY}),f;return d}for(var g=d={},h=0;h<e.length;h++)h<e.length-1?(g[e[h]]={},g=g[e[h]]):g[e[h]]= c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(a,b){c._setOption(a,b)});return this},_setOption:function(a,c){var d=this;switch(a){case "volume":this.volume(c);break;case "muted":this._muted(c);break;case "cssSelectorAncestor":this._cssSelectorAncestor(c);break;case "cssSelector":b.each(c,function(a,b){d._cssSelector(a,b)});break;case "fullScreen":if(this.options[a]!==c){var e=b.jPlayer.nativeFeatures.fullscreen.used.webkitVideo;if(!e||e&&!this.status.waitForPlay)e|| (this.options[a]=c),c?this._requestFullscreen():this._exitFullscreen(),e||this._setOption("fullWindow",c)}break;case "fullWindow":this.options[a]!==c&&(this._removeUiClass(),this.options[a]=c,this._refreshSize());break;case "size":!this.options.fullWindow&&this.options[a].cssClass!==c.cssClass&&this._removeUiClass();this.options[a]=b.extend({},this.options[a],c);this._refreshSize();break;case "sizeFull":this.options.fullWindow&&this.options[a].cssClass!==c.cssClass&&this._removeUiClass();this.options[a]= b.extend({},this.options[a],c);this._refreshSize();break;case "autohide":this.options[a]=b.extend({},this.options[a],c);this._updateAutohide();break;case "loop":this._loop(c);break;case "nativeVideoControls":this.options[a]=b.extend({},this.options[a],c);this.status.nativeVideoControls=this._uaBlocklist(this.options.nativeVideoControls);this._restrictNativeVideoControls();this._updateNativeVideoControls();break;case "noFullWindow":this.options[a]=b.extend({},this.options[a],c);this.status.nativeVideoControls= this._uaBlocklist(this.options.nativeVideoControls);this.status.noFullWindow=this._uaBlocklist(this.options.noFullWindow);this._restrictNativeVideoControls();this._updateButtons();break;case "noVolume":this.options[a]=b.extend({},this.options[a],c);this.status.noVolume=this._uaBlocklist(this.options.noVolume);this._updateVolume();this._updateMute();break;case "emulateHtml":this.options[a]!==c&&((this.options[a]=c)?this._emulateHtmlBridge():this._destroyHtmlBridge());break;case "timeFormat":this.options[a]= b.extend({},this.options[a],c);break;case "keyEnabled":this.options[a]=c;!c&&this===b.jPlayer.focus&&(b.jPlayer.focus=null);break;case "keyBindings":this.options[a]=b.extend(!0,{},this.options[a],c);break;case "audioFullScreen":this.options[a]=c}return this},_refreshSize:function(){this._setSize();this._addUiClass();this._updateSize();this._updateButtons();this._updateAutohide();this._trigger(b.jPlayer.event.resize)},_setSize:function(){this.options.fullWindow?(this.status.width=this.options.sizeFull.width, this.status.height=this.options.sizeFull.height,this.status.cssClass=this.options.sizeFull.cssClass):(this.status.width=this.options.size.width,this.status.height=this.options.size.height,this.status.cssClass=this.options.size.cssClass);this.element.css({width:this.status.width,height:this.status.height})},_addUiClass:function(){this.ancestorJq.length&&this.ancestorJq.addClass(this.status.cssClass)},_removeUiClass:function(){this.ancestorJq.length&&this.ancestorJq.removeClass(this.status.cssClass)}, _updateSize:function(){this.internal.poster.jq.css({width:this.status.width,height:this.status.height});!this.status.waitForPlay&&this.html.active&&this.status.video||this.html.video.available&&this.html.used&&this.status.nativeVideoControls?this.internal.video.jq.css({width:this.status.width,height:this.status.height}):!this.status.waitForPlay&&(this.flash.active&&this.status.video)&&this.internal.flash.jq.css({width:this.status.width,height:this.status.height})},_updateAutohide:function(){var a= this,b=function(){a.css.jq.gui.fadeIn(a.options.autohide.fadeIn,function(){clearTimeout(a.internal.autohideId);a.internal.autohideId=setTimeout(function(){a.css.jq.gui.fadeOut(a.options.autohide.fadeOut)},a.options.autohide.hold)})};this.css.jq.gui.length&&(this.css.jq.gui.stop(!0,!0),clearTimeout(this.internal.autohideId),this.element.unbind(".jPlayerAutohide"),this.css.jq.gui.unbind(".jPlayerAutohide"),this.status.nativeVideoControls?this.css.jq.gui.hide():this.options.fullWindow&&this.options.autohide.full|| !this.options.fullWindow&&this.options.autohide.restored?(this.element.bind("mousemove.jPlayer.jPlayerAutohide",b),this.css.jq.gui.bind("mousemove.jPlayer.jPlayerAutohide",b),this.css.jq.gui.hide()):this.css.jq.gui.show())},fullScreen:function(){this._setOption("fullScreen",!0)},restoreScreen:function(){this._setOption("fullScreen",!1)},_fullscreenAddEventListeners:function(){var a=this,c=b.jPlayer.nativeFeatures.fullscreen;c.api.fullscreenEnabled&&c.event.fullscreenchange&&("function"!==typeof this.internal.fullscreenchangeHandler&& (this.internal.fullscreenchangeHandler=function(){a._fullscreenchange()}),document.addEventListener(c.event.fullscreenchange,this.internal.fullscreenchangeHandler,!1))},_fullscreenRemoveEventListeners:function(){var a=b.jPlayer.nativeFeatures.fullscreen;this.internal.fullscreenchangeHandler&&document.addEventListener(a.event.fullscreenchange,this.internal.fullscreenchangeHandler,!1)},_fullscreenchange:function(){this.options.fullScreen&&!b.jPlayer.nativeFeatures.fullscreen.api.fullscreenElement()&& this._setOption("fullScreen",!1)},_requestFullscreen:function(){var a=this.ancestorJq.length?this.ancestorJq[0]:this.element[0],c=b.jPlayer.nativeFeatures.fullscreen;c.used.webkitVideo&&(a=this.htmlElement.video);c.api.fullscreenEnabled&&c.api.requestFullscreen(a)},_exitFullscreen:function(){var a=b.jPlayer.nativeFeatures.fullscreen,c;a.used.webkitVideo&&(c=this.htmlElement.video);a.api.fullscreenEnabled&&a.api.exitFullscreen(c)},_html_initMedia:function(a){var c=b(this.htmlElement.media).empty(); b.each(a.track||[],function(a,b){var g=document.createElement("track");g.setAttribute("kind",b.kind?b.kind:"");g.setAttribute("src",b.src?b.src:"");g.setAttribute("srclang",b.srclang?b.srclang:"");g.setAttribute("label",b.label?b.label:"");b.def&&g.setAttribute("default",b.def);c.append(g)});this.htmlElement.media.src=this.status.src;"none"!==this.options.preload&&this._html_load();this._trigger(b.jPlayer.event.timeupdate)},_html_setFormat:function(a){var c=this;b.each(this.formats,function(b,e){if(c.html.support[e]&& a[e])return c.status.src=a[e],c.status.format[e]=!0,c.status.formatType=e,!1})},_html_setAudio:function(a){this._html_setFormat(a);this.htmlElement.media=this.htmlElement.audio;this._html_initMedia(a)},_html_setVideo:function(a){this._html_setFormat(a);this.status.nativeVideoControls&&(this.htmlElement.video.poster=this._validString(a.poster)?a.poster:"");this.htmlElement.media=this.htmlElement.video;this._html_initMedia(a)},_html_resetMedia:function(){this.htmlElement.media&&(this.htmlElement.media.id=== this.internal.video.id&&!this.status.nativeVideoControls&&this.internal.video.jq.css({width:"0px",height:"0px"}),this.htmlElement.media.pause())},_html_clearMedia:function(){this.htmlElement.media&&(this.htmlElement.media.src="about:blank",this.htmlElement.media.load())},_html_load:function(){this.status.waitForLoad&&(this.status.waitForLoad=!1,this.htmlElement.media.load());clearTimeout(this.internal.htmlDlyCmdId)},_html_play:function(a){var b=this,d=this.htmlElement.media;this._html_load();if(isNaN(a))d.play(); else{this.internal.cmdsIgnored&&d.play();try{if(!d.seekable||"object"===typeof d.seekable&&0<d.seekable.length)d.currentTime=a,d.play();else throw 1;}catch(e){this.internal.htmlDlyCmdId=setTimeout(function(){b.play(a)},250);return}}this._html_checkWaitForPlay()},_html_pause:function(a){var b=this,d=this.htmlElement.media;0<a?this._html_load():clearTimeout(this.internal.htmlDlyCmdId);d.pause();if(!isNaN(a))try{if(!d.seekable||"object"===typeof d.seekable&&0<d.seekable.length)d.currentTime=a;else throw 1; }catch(e){this.internal.htmlDlyCmdId=setTimeout(function(){b.pause(a)},250);return}0<a&&this._html_checkWaitForPlay()},_html_playHead:function(a){var b=this,d=this.htmlElement.media;this._html_load();try{if("object"===typeof d.seekable&&0<d.seekable.length)d.currentTime=a*d.seekable.end(d.seekable.length-1)/100;else if(0<d.duration&&!isNaN(d.duration))d.currentTime=a*d.duration/100;else throw"e";}catch(e){this.internal.htmlDlyCmdId=setTimeout(function(){b.playHead(a)},250);return}this.status.waitForLoad|| this._html_checkWaitForPlay()},_html_checkWaitForPlay:function(){this.status.waitForPlay&&(this.status.waitForPlay=!1,this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide(),this.status.video&&(this.internal.poster.jq.hide(),this.internal.video.jq.css({width:this.status.width,height:this.status.height})))},_html_volume:function(a){this.html.audio.available&&(this.htmlElement.audio.volume=a);this.html.video.available&&(this.htmlElement.video.volume=a)},_html_mute:function(a){this.html.audio.available&& (this.htmlElement.audio.muted=a);this.html.video.available&&(this.htmlElement.video.muted=a)},_flash_setAudio:function(a){var c=this;try{b.each(this.formats,function(b,d){if(c.flash.support[d]&&a[d]){switch(d){case "m4a":case "fla":c._getMovie().fl_setAudio_m4a(a[d]);break;case "mp3":c._getMovie().fl_setAudio_mp3(a[d]);break;case "rtmpa":c._getMovie().fl_setAudio_rtmp(a[d])}c.status.src=a[d];c.status.format[d]=!0;c.status.formatType=d;return!1}}),"auto"===this.options.preload&&(this._flash_load(), this.status.waitForLoad=!1)}catch(d){this._flashError(d)}},_flash_setVideo:function(a){var c=this;try{b.each(this.formats,function(b,d){if(c.flash.support[d]&&a[d]){switch(d){case "m4v":case "flv":c._getMovie().fl_setVideo_m4v(a[d]);break;case "rtmpv":c._getMovie().fl_setVideo_rtmp(a[d])}c.status.src=a[d];c.status.format[d]=!0;c.status.formatType=d;return!1}}),"auto"===this.options.preload&&(this._flash_load(),this.status.waitForLoad=!1)}catch(d){this._flashError(d)}},_flash_resetMedia:function(){this.internal.flash.jq.css({width:"0px", height:"0px"});this._flash_pause(NaN)},_flash_clearMedia:function(){try{this._getMovie().fl_clearMedia()}catch(a){this._flashError(a)}},_flash_load:function(){try{this._getMovie().fl_load()}catch(a){this._flashError(a)}this.status.waitForLoad=!1},_flash_play:function(a){try{this._getMovie().fl_play(a)}catch(b){this._flashError(b)}this.status.waitForLoad=!1;this._flash_checkWaitForPlay()},_flash_pause:function(a){try{this._getMovie().fl_pause(a)}catch(b){this._flashError(b)}0<a&&(this.status.waitForLoad= !1,this._flash_checkWaitForPlay())},_flash_playHead:function(a){try{this._getMovie().fl_play_head(a)}catch(b){this._flashError(b)}this.status.waitForLoad||this._flash_checkWaitForPlay()},_flash_checkWaitForPlay:function(){this.status.waitForPlay&&(this.status.waitForPlay=!1,this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide(),this.status.video&&(this.internal.poster.jq.hide(),this.internal.flash.jq.css({width:this.status.width,height:this.status.height})))},_flash_volume:function(a){try{this._getMovie().fl_volume(a)}catch(b){this._flashError(b)}}, _flash_mute:function(a){try{this._getMovie().fl_mute(a)}catch(b){this._flashError(b)}},_getMovie:function(){return document[this.internal.flash.id]},_getFlashPluginVersion:function(){var a=0,b;if(window.ActiveXObject)try{if(b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")){var d=b.GetVariable("$version");d&&(d=d.split(" ")[1].split(","),a=parseInt(d[0],10)+"."+parseInt(d[1],10))}}catch(e){}else navigator.plugins&&0<navigator.mimeTypes.length&&(b=navigator.plugins["Shockwave Flash"])&&(a=navigator.plugins["Shockwave Flash"].description.replace(/.*\s(\d+\.\d+).*/, "$1"));return 1*a},_checkForFlash:function(a){var b=!1;this._getFlashPluginVersion()>=a&&(b=!0);return b},_validString:function(a){return a&&"string"===typeof a},_limitValue:function(a,b,d){return a<b?b:a>d?d:a},_urlNotSetError:function(a){this._error({type:b.jPlayer.error.URL_NOT_SET,context:a,message:b.jPlayer.errorMsg.URL_NOT_SET,hint:b.jPlayer.errorHint.URL_NOT_SET})},_flashError:function(a){var c;c=this.internal.ready?"FLASH_DISABLED":"FLASH";this._error({type:b.jPlayer.error[c],context:this.internal.flash.swf, message:b.jPlayer.errorMsg[c]+a.message,hint:b.jPlayer.errorHint[c]});this.internal.flash.jq.css({width:"1px",height:"1px"})},_error:function(a){this._trigger(b.jPlayer.event.error,a);this.options.errorAlerts&&this._alert("Error!"+(a.message?"\n\n"+a.message:"")+(a.hint?"\n\n"+a.hint:"")+"\n\nContext: "+a.context)},_warning:function(a){this._trigger(b.jPlayer.event.warning,f,a);this.options.warningAlerts&&this._alert("Warning!"+(a.message?"\n\n"+a.message:"")+(a.hint?"\n\n"+a.hint:"")+"\n\nContext: "+ a.context)},_alert:function(a){alert("jPlayer "+this.version.script+" : id='"+this.internal.self.id+"' : "+a)},_emulateHtmlBridge:function(){var a=this;b.each(b.jPlayer.emulateMethods.split(/\s+/g),function(b,d){a.internal.domNode[d]=function(b){a[d](b)}});b.each(b.jPlayer.event,function(c,d){var e=!0;b.each(b.jPlayer.reservedEvent.split(/\s+/g),function(a,b){if(b===c)return e=!1});e&&a.element.bind(d+".jPlayer.jPlayerHtml",function(){a._emulateHtmlUpdate();var b=document.createEvent("Event");b.initEvent(c, !1,!0);a.internal.domNode.dispatchEvent(b)})})},_emulateHtmlUpdate:function(){var a=this;b.each(b.jPlayer.emulateStatus.split(/\s+/g),function(b,d){a.internal.domNode[d]=a.status[d]});b.each(b.jPlayer.emulateOptions.split(/\s+/g),function(b,d){a.internal.domNode[d]=a.options[d]})},_destroyHtmlBridge:function(){var a=this;this.element.unbind(".jPlayerHtml");b.each((b.jPlayer.emulateMethods+" "+b.jPlayer.emulateStatus+" "+b.jPlayer.emulateOptions).split(/\s+/g),function(b,d){delete a.internal.domNode[d]})}}; b.jPlayer.error={FLASH:"e_flash",FLASH_DISABLED:"e_flash_disabled",NO_SOLUTION:"e_no_solution",NO_SUPPORT:"e_no_support",URL:"e_url",URL_NOT_SET:"e_url_not_set",VERSION:"e_version"};b.jPlayer.errorMsg={FLASH:"jPlayer's Flash fallback is not configured correctly, or a command was issued before the jPlayer Ready event. Details: ",FLASH_DISABLED:"jPlayer's Flash fallback has been disabled by the browser due to the CSS rules you have used. Details: ",NO_SOLUTION:"No solution can be found by jPlayer in this browser. Neither HTML nor Flash can be used.", NO_SUPPORT:"It is not possible to play any media format provided in setMedia() on this browser using your current options.",URL:"Media URL could not be loaded.",URL_NOT_SET:"Attempt to issue media playback commands, while no media url is set.",VERSION:"jPlayer "+b.jPlayer.prototype.version.script+" needs Jplayer.swf version "+b.jPlayer.prototype.version.needFlash+" but found "};b.jPlayer.errorHint={FLASH:"Check your swfPath option and that Jplayer.swf is there.",FLASH_DISABLED:"Check that you have not display:none; the jPlayer entity or any ancestor.", NO_SOLUTION:"Review the jPlayer options: support and supplied.",NO_SUPPORT:"Video or audio formats defined in the supplied option are missing.",URL:"Check media URL is valid.",URL_NOT_SET:"Use setMedia() to set the media URL.",VERSION:"Update jPlayer files."};b.jPlayer.warning={CSS_SELECTOR_COUNT:"e_css_selector_count",CSS_SELECTOR_METHOD:"e_css_selector_method",CSS_SELECTOR_STRING:"e_css_selector_string",OPTION_KEY:"e_option_key"};b.jPlayer.warningMsg={CSS_SELECTOR_COUNT:"The number of css selectors found did not equal one: ", CSS_SELECTOR_METHOD:"The methodName given in jPlayer('cssSelector') is not a valid jPlayer method.",CSS_SELECTOR_STRING:"The methodCssSelector given in jPlayer('cssSelector') is not a String or is empty.",OPTION_KEY:"The option requested in jPlayer('option') is undefined."};b.jPlayer.warningHint={CSS_SELECTOR_COUNT:"Check your css selector and the ancestor.",CSS_SELECTOR_METHOD:"Check your method name.",CSS_SELECTOR_STRING:"Check your css selector is a string.",OPTION_KEY:"Check your option name."}});
sh4hin/cdnjs
ajax/libs/jplayer/2.4.0/jquery.jplayer.min.js
JavaScript
mit
48,815
<?php return [ /* |-------------------------------------------------------------------------- | Default Session Driver |-------------------------------------------------------------------------- | | This option controls the default session "driver" that will be used on | requests. By default, we will use the lightweight native driver but | you may specify any of the other wonderful drivers provided here. | | Supported: "file", "cookie", "database", "apc", | "memcached", "redis", "array" | */ 'driver' => env('SESSION_DRIVER', 'file'), /* |-------------------------------------------------------------------------- | Session Lifetime |-------------------------------------------------------------------------- | | Here you may specify the number of minutes that you wish the session | to be allowed to remain idle before it expires. If you want them | to immediately expire on the browser closing, set that option. | */ 'lifetime' => 120, 'expire_on_close' => false, /* |-------------------------------------------------------------------------- | Session Encryption |-------------------------------------------------------------------------- | | This option allows you to easily specify that all of your session data | should be encrypted before it is stored. All encryption will be run | automatically by Laravel and you can use the Session like normal. | */ 'encrypt' => false, /* |-------------------------------------------------------------------------- | Session File Location |-------------------------------------------------------------------------- | | When using the native session driver, we need a location where session | files may be stored. A default has been set for you but a different | location may be specified. This is only needed for file sessions. | */ 'files' => storage_path('framework/sessions'), /* |-------------------------------------------------------------------------- | Session Database Connection |-------------------------------------------------------------------------- | | When using the "database" or "redis" session drivers, you may specify a | connection that should be used to manage these sessions. This should | correspond to a connection in your database configuration options. | */ 'connection' => null, /* |-------------------------------------------------------------------------- | Session Database Table |-------------------------------------------------------------------------- | | When using the "database" session driver, you may specify the table we | should use to manage the sessions. Of course, a sensible default is | provided for you; however, you are free to change this as needed. | */ 'table' => 'sessions', /* |-------------------------------------------------------------------------- | Session Sweeping Lottery |-------------------------------------------------------------------------- | | Some session drivers must manually sweep their storage location to get | rid of old sessions from storage. Here are the chances that it will | happen on a given request. By default, the odds are 2 out of 100. | */ 'lottery' => [2, 100], /* |-------------------------------------------------------------------------- | Session Cookie Name |-------------------------------------------------------------------------- | | Here you may change the name of the cookie used to identify a session | instance by ID. The name specified here will get used every time a | new session cookie is created by the framework for every driver. | */ 'cookie' => 'laravel_session', /* |-------------------------------------------------------------------------- | Session Cookie Path |-------------------------------------------------------------------------- | | The session cookie path determines the path for which the cookie will | be regarded as available. Typically, this will be the root path of | your application but you are free to change this when necessary. | */ 'path' => '/', /* |-------------------------------------------------------------------------- | Session Cookie Domain |-------------------------------------------------------------------------- | | Here you may change the domain of the cookie used to identify a session | in your application. This will determine which domains the cookie is | available to in your application. A sensible default has been set. | */ 'domain' => null, /* |-------------------------------------------------------------------------- | HTTPS Only Cookies |-------------------------------------------------------------------------- | | By setting this option to true, session cookies will only be sent back | to the server if the browser has a HTTPS connection. This will keep | the cookie from being sent to you if it can not be done securely. | */ 'secure' => false, ];
mroedel/laravel-boilerplate
config/session.php
PHP
mit
5,301
YUI.add("autocomplete-filters",function(d){var c=d.Array,e=d.Object,a=d.Text.WordBreak,b=d.mix(d.namespace("AutoCompleteFilters"),{charMatch:function(i,h,f){if(!i){return h;}var g=c.unique((f?i:i.toLowerCase()).split(""));return c.filter(h,function(j){j=j.text;if(!f){j=j.toLowerCase();}return c.every(g,function(k){return j.indexOf(k)!==-1;});});},charMatchCase:function(g,f){return b.charMatch(g,f,true);},phraseMatch:function(h,g,f){if(!h){return g;}if(!f){h=h.toLowerCase();}return c.filter(g,function(i){return(f?i.text:i.text.toLowerCase()).indexOf(h)!==-1;});},phraseMatchCase:function(g,f){return b.phraseMatch(g,f,true);},startsWith:function(h,g,f){if(!h){return g;}if(!f){h=h.toLowerCase();}return c.filter(g,function(i){return(f?i.text:i.text.toLowerCase()).indexOf(h)===0;});},startsWithCase:function(g,f){return b.startsWith(g,f,true);},subWordMatch:function(i,g,f){if(!i){return g;}var h=a.getUniqueWords(i,{ignoreCase:!f});return c.filter(g,function(j){var k=f?j.text:j.text.toLowerCase();return c.every(h,function(l){return k.indexOf(l)!==-1;});});},subWordMatchCase:function(g,f){return b.subWordMatch(g,f,true);},wordMatch:function(j,h,f){if(!j){return h;}var g={ignoreCase:!f},i=a.getUniqueWords(j,g);return c.filter(h,function(k){var l=c.hash(a.getUniqueWords(k.text,g));return c.every(i,function(m){return e.owns(l,m);});});},wordMatchCase:function(g,f){return b.wordMatch(g,f,true);}});},"@VERSION@",{requires:["array-extras","text-wordbreak"]});
pzp1997/cdnjs
ajax/libs/yui/3.5.0/autocomplete-filters/autocomplete-filters-min.js
JavaScript
mit
1,468
/* AngularJS v1.2.12 (c) 2010-2014 Google, Inc. http://angularjs.org License: MIT */ (function(p,h,q){'use strict';function E(a){var e=[];s(e,h.noop).chars(a);return e.join("")}function k(a){var e={};a=a.split(",");var d;for(d=0;d<a.length;d++)e[a[d]]=!0;return e}function F(a,e){function d(a,b,d,g){b=h.lowercase(b);if(t[b])for(;f.last()&&u[f.last()];)c("",f.last());v[b]&&f.last()==b&&c("",b);(g=w[b]||!!g)||f.push(b);var l={};d.replace(G,function(a,b,e,c,d){l[b]=r(e||c||d||"")});e.start&&e.start(b,l,g)}function c(a,b){var c=0,d;if(b=h.lowercase(b))for(c=f.length-1;0<=c&&f[c]!=b;c--); if(0<=c){for(d=f.length-1;d>=c;d--)e.end&&e.end(f[d]);f.length=c}}var b,g,f=[],l=a;for(f.last=function(){return f[f.length-1]};a;){g=!0;if(f.last()&&x[f.last()])a=a.replace(RegExp("(.*)<\\s*\\/\\s*"+f.last()+"[^>]*>","i"),function(b,a){a=a.replace(H,"$1").replace(I,"$1");e.chars&&e.chars(r(a));return""}),c("",f.last());else{if(0===a.indexOf("\x3c!--"))b=a.indexOf("--",4),0<=b&&a.lastIndexOf("--\x3e",b)===b&&(e.comment&&e.comment(a.substring(4,b)),a=a.substring(b+3),g=!1);else if(y.test(a)){if(b=a.match(y))a= a.replace(b[0],""),g=!1}else if(J.test(a)){if(b=a.match(z))a=a.substring(b[0].length),b[0].replace(z,c),g=!1}else K.test(a)&&(b=a.match(A))&&(a=a.substring(b[0].length),b[0].replace(A,d),g=!1);g&&(b=a.indexOf("<"),g=0>b?a:a.substring(0,b),a=0>b?"":a.substring(b),e.chars&&e.chars(r(g)))}if(a==l)throw L("badparse",a);l=a}c()}function r(a){if(!a)return"";var e=M.exec(a);a=e[1];var d=e[3];if(e=e[2])n.innerHTML=e.replace(/</g,"&lt;"),e="textContent"in n?n.textContent:n.innerText;return a+e+d}function B(a){return a.replace(/&/g, "&amp;").replace(N,function(a){return"&#"+a.charCodeAt(0)+";"}).replace(/</g,"&lt;").replace(/>/g,"&gt;")}function s(a,e){var d=!1,c=h.bind(a,a.push);return{start:function(a,g,f){a=h.lowercase(a);!d&&x[a]&&(d=a);d||!0!==C[a]||(c("<"),c(a),h.forEach(g,function(d,f){var g=h.lowercase(f),k="img"===a&&"src"===g||"background"===g;!0!==O[g]||!0===D[g]&&!e(d,k)||(c(" "),c(f),c('="'),c(B(d)),c('"'))}),c(f?"/>":">"))},end:function(a){a=h.lowercase(a);d||!0!==C[a]||(c("</"),c(a),c(">"));a==d&&(d=!1)},chars:function(a){d|| c(B(a))}}}var L=h.$$minErr("$sanitize"),A=/^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/,z=/^<\s*\/\s*([\w:-]+)[^>]*>/,G=/([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,K=/^</,J=/^<\s*\//,H=/\x3c!--(.*?)--\x3e/g,y=/<!DOCTYPE([^>]*?)>/i,I=/<!\[CDATA\[(.*?)]]\x3e/g,N=/([^\#-~| |!])/g,w=k("area,br,col,hr,img,wbr");p=k("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr");q=k("rp,rt");var v=h.extend({},q,p),t=h.extend({},p,k("address,article,aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,script,section,table,ul")), u=h.extend({},q,k("a,abbr,acronym,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,samp,small,span,strike,strong,sub,sup,time,tt,u,var")),x=k("script,style"),C=h.extend({},w,t,u,v),D=k("background,cite,href,longdesc,src,usemap"),O=h.extend({},D,k("abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,scope,scrolling,shape,size,span,start,summary,target,title,type,valign,value,vspace,width")), n=document.createElement("pre"),M=/^(\s*)([\s\S]*?)(\s*)$/;h.module("ngSanitize",[]).provider("$sanitize",function(){this.$get=["$$sanitizeUri",function(a){return function(e){var d=[];F(e,s(d,function(c,b){return!/^unsafe/.test(a(c,b))}));return d.join("")}}]});h.module("ngSanitize").filter("linky",["$sanitize",function(a){var e=/((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>]/,d=/^mailto:/;return function(c,b){function g(a){a&&m.push(E(a))}function f(a,c){m.push("<a ");h.isDefined(b)&& (m.push('target="'),m.push(b),m.push('" '));m.push('href="');m.push(a);m.push('">');g(c);m.push("</a>")}if(!c)return c;for(var l,k=c,m=[],n,p;l=k.match(e);)n=l[0],l[2]==l[3]&&(n="mailto:"+n),p=l.index,g(k.substr(0,p)),f(n,l[0].replace(d,"")),k=k.substring(p+l[0].length);g(k);return a(m.join(""))}}])})(window,window.angular); //# sourceMappingURL=angular-sanitize.min.js.map
bio2rdf/bio2rdf-mobile
www/lib/version/1.0.0-beta.1-actinium/js/angular/angular-sanitize.min.js
JavaScript
mit
4,295
// Named EC curves // Requires ec.js, jsbn.js, and jsbn2.js var BigInteger = require('jsbn').BigInteger var ECCurveFp = require('./ec.js').ECCurveFp // ---------------- // X9ECParameters // constructor function X9ECParameters(curve,g,n,h) { this.curve = curve; this.g = g; this.n = n; this.h = h; } function x9getCurve() { return this.curve; } function x9getG() { return this.g; } function x9getN() { return this.n; } function x9getH() { return this.h; } X9ECParameters.prototype.getCurve = x9getCurve; X9ECParameters.prototype.getG = x9getG; X9ECParameters.prototype.getN = x9getN; X9ECParameters.prototype.getH = x9getH; // ---------------- // SECNamedCurves function fromHex(s) { return new BigInteger(s, 16); } function secp128r1() { // p = 2^128 - 2^97 - 1 var p = fromHex("FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF"); var a = fromHex("FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC"); var b = fromHex("E87579C11079F43DD824993C2CEE5ED3"); //byte[] S = Hex.decode("000E0D4D696E6768756151750CC03A4473D03679"); var n = fromHex("FFFFFFFE0000000075A30D1B9038A115"); var h = BigInteger.ONE; var curve = new ECCurveFp(p, a, b); var G = curve.decodePointHex("04" + "161FF7528B899B2D0C28607CA52C5B86" + "CF5AC8395BAFEB13C02DA292DDED7A83"); return new X9ECParameters(curve, G, n, h); } function secp160k1() { // p = 2^160 - 2^32 - 2^14 - 2^12 - 2^9 - 2^8 - 2^7 - 2^3 - 2^2 - 1 var p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73"); var a = BigInteger.ZERO; var b = fromHex("7"); //byte[] S = null; var n = fromHex("0100000000000000000001B8FA16DFAB9ACA16B6B3"); var h = BigInteger.ONE; var curve = new ECCurveFp(p, a, b); var G = curve.decodePointHex("04" + "3B4C382CE37AA192A4019E763036F4F5DD4D7EBB" + "938CF935318FDCED6BC28286531733C3F03C4FEE"); return new X9ECParameters(curve, G, n, h); } function secp160r1() { // p = 2^160 - 2^31 - 1 var p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF"); var a = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC"); var b = fromHex("1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45"); //byte[] S = Hex.decode("1053CDE42C14D696E67687561517533BF3F83345"); var n = fromHex("0100000000000000000001F4C8F927AED3CA752257"); var h = BigInteger.ONE; var curve = new ECCurveFp(p, a, b); var G = curve.decodePointHex("04" + "4A96B5688EF573284664698968C38BB913CBFC82" + "23A628553168947D59DCC912042351377AC5FB32"); return new X9ECParameters(curve, G, n, h); } function secp192k1() { // p = 2^192 - 2^32 - 2^12 - 2^8 - 2^7 - 2^6 - 2^3 - 1 var p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37"); var a = BigInteger.ZERO; var b = fromHex("3"); //byte[] S = null; var n = fromHex("FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D"); var h = BigInteger.ONE; var curve = new ECCurveFp(p, a, b); var G = curve.decodePointHex("04" + "DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D" + "9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D"); return new X9ECParameters(curve, G, n, h); } function secp192r1() { // p = 2^192 - 2^64 - 1 var p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF"); var a = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC"); var b = fromHex("64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1"); //byte[] S = Hex.decode("3045AE6FC8422F64ED579528D38120EAE12196D5"); var n = fromHex("FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831"); var h = BigInteger.ONE; var curve = new ECCurveFp(p, a, b); var G = curve.decodePointHex("04" + "188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012" + "07192B95FFC8DA78631011ED6B24CDD573F977A11E794811"); return new X9ECParameters(curve, G, n, h); } function secp224r1() { // p = 2^224 - 2^96 + 1 var p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001"); var a = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE"); var b = fromHex("B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4"); //byte[] S = Hex.decode("BD71344799D5C7FCDC45B59FA3B9AB8F6A948BC5"); var n = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D"); var h = BigInteger.ONE; var curve = new ECCurveFp(p, a, b); var G = curve.decodePointHex("04" + "B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21" + "BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34"); return new X9ECParameters(curve, G, n, h); } function secp256r1() { // p = 2^224 (2^32 - 1) + 2^192 + 2^96 - 1 var p = fromHex("FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF"); var a = fromHex("FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC"); var b = fromHex("5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B"); //byte[] S = Hex.decode("C49D360886E704936A6678E1139D26B7819F7E90"); var n = fromHex("FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551"); var h = BigInteger.ONE; var curve = new ECCurveFp(p, a, b); var G = curve.decodePointHex("04" + "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296" + "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5"); return new X9ECParameters(curve, G, n, h); } // TODO: make this into a proper hashtable function getSECCurveByName(name) { if(name == "secp128r1") return secp128r1(); if(name == "secp160k1") return secp160k1(); if(name == "secp160r1") return secp160r1(); if(name == "secp192k1") return secp192k1(); if(name == "secp192r1") return secp192r1(); if(name == "secp224r1") return secp224r1(); if(name == "secp256r1") return secp256r1(); return null; } module.exports = { "secp128r1":secp128r1, "secp160k1":secp160k1, "secp160r1":secp160r1, "secp192k1":secp192k1, "secp192r1":secp192r1, "secp224r1":secp224r1, "secp256r1":secp256r1 }
marka2g/loc
loc_frontend/node_modules/watchify/node_modules/chokidar/node_modules/fsevents/node_modules/ecc-jsbn/lib/sec.js
JavaScript
mit
6,100
.firebug { margin: 0; background:#fff; font-family: Lucida Grande, Tahoma, sans-serif; font-size: 11px; overflow: hidden; border: 1px solid black; position: relative; } .firebug a { text-decoration: none; } .firebug a:hover { text-decoration: underline; } .firebug a:visited{ color:#0000FF; } .firebug #firebugToolbar { height: 18px; line-height:18px; border-top: 1px solid ThreeDHighlight; border-bottom: 1px solid ThreeDShadow; padding: 2px 6px; background:#f0f0f0; } .firebug #firebugLog, .firebug #objectLog { overflow: auto; position: absolute; left: 0; width: 100%; } #objectLog{ overflow:scroll; height:258px; } .firebug #firebugCommandLine { position: absolute; bottom: 0; left: 0; width: 100%; height: 18px; border: none; border-top: 1px solid ThreeDShadow; } .firebug .logRow { position: relative; border-bottom: 1px solid #D7D7D7; padding: 2px 4px 1px 6px; background-color: #FFFFFF; } .firebug .logRow-command { font-family: Monaco, monospace; color: blue; } .firebug .objectBox-null { padding: 0 2px; border: 1px solid #666666; background-color: #888888; color: #FFFFFF; } .firebug .objectBox-string { font-family: Monaco, monospace; color: red; white-space: pre; } .firebug .objectBox-number { color: #000088; } .firebug .objectBox-function { font-family: Monaco, monospace; color: DarkGreen; } .firebug .objectBox-object { color: DarkGreen; font-weight: bold; } .firebug .logRow-info, .firebug .logRow-error, .firebug .logRow-warning { background: #00FFFF no-repeat 2px 2px; padding-left: 20px; padding-bottom: 3px; } .firebug .logRow-info { background: #FFF url(infoIcon.png) no-repeat 2px 2px; padding-left: 20px; padding-bottom: 3px; } .firebug .logRow-warning { background: #00FFFF url(warningIcon.png) no-repeat 2px 2px; padding-left: 20px; padding-bottom: 3px; } .firebug .logRow-error { background: LightYellow url(errorIcon.png) no-repeat 2px 2px; padding-left: 20px; padding-bottom: 3px; } .firebug .errorMessage { vertical-align: top; color: #FF0000; } .firebug .objectBox-sourceLink { position: absolute; right: 4px; top: 2px; padding-left: 8px; font-family: Lucida Grande, sans-serif; font-weight: bold; color: #0000FF; } .firebug .logRow-group { background: #EEEEEE; border-bottom: none; } .firebug .logGroup { background: #EEEEEE; } .firebug .logGroupBox { margin-left: 24px; border-top: 1px solid #D7D7D7; border-left: 1px solid #D7D7D7; } .firebug .selectorTag, .firebug .selectorId, .firebug .selectorClass { font-family: Monaco, monospace; font-weight: normal; } .firebug .selectorTag { color: #0000FF; } .firebug .selectorId { color: DarkBlue; } .firebug .selectorClass { color: red; } .firebug .objectBox-element { font-family: Monaco, monospace; color: #000088; } .firebug .nodeChildren { margin-left: 16px; } .firebug .nodeTag { color: blue; } .firebug .nodeValue { color: #FF0000; font-weight: normal; } .firebug .nodeText, .firebug .nodeComment { margin: 0 2px; vertical-align: top; } .firebug .nodeText { color: #333333; } .firebug .nodeComment { color: DarkGreen; } .firebug .propertyNameCell { vertical-align: top; } .firebug .propertyName { font-weight: bold; } #firebugToolbar ul.tabs{ margin:0 !important; padding:0; } #firebugToolbar ul.tabs li{ list-style:none; background:transparent url(tab_lft_norm.png) no-repeat left; line-height:18px; float:left; margin-left:5px; } #firebugToolbar ul.tabs li.right{ float:right; margin-right:5px; margin-left:0; } #firebugToolbar ul.tabs li.gap{ margin-left:20px; } #firebugToolbar .tabs a{ text-decoration:none; background:transparent url(tab_rgt_norm.png) no-repeat right; line-height:18px; padding:3px 9px 4px 0px; margin-left:9px; color:#333333; } #firebugToolbar .tabs li:hover{ background:transparent url(tab_lft_over.png) no-repeat left; } #firebugToolbar .tabs a:hover{ text-decoration:none; background:transparent url(tab_rgt_over.png) no-repeat right; color:#FFFFFF; }
WilliamRen/cdnjs
ajax/libs/dojo/1.9.2/_firebug/firebug.css
CSS
mit
3,983
/** * @author dforrer / https://github.com/dforrer * Developed as part of a project at University of Applied Sciences and Arts Northwestern Switzerland (www.fhnw.ch) */ Sidebar.History = function ( editor ) { var signals = editor.signals; var config = editor.config; var history = editor.history; var container = new UI.Panel(); container.add( new UI.Text( 'HISTORY' ) ); // var persistent = new UI.THREE.Boolean( config.getKey( 'settings/history' ), 'persistent' ); persistent.setPosition( 'absolute' ).setRight( '8px' ); persistent.onChange( function () { var value = this.getValue(); config.setKey( 'settings/history', value ); if ( value ) { alert( 'The history will be preserved across sessions.\nThis can have an impact on performance when working with textures.' ); var lastUndoCmd = history.undos[ history.undos.length - 1 ]; var lastUndoId = ( lastUndoCmd !== undefined ) ? lastUndoCmd.id : 0; editor.history.enableSerialization( lastUndoId ); } else { signals.historyChanged.dispatch(); } } ); container.add( persistent ); container.add( new UI.Break(), new UI.Break() ); var ignoreObjectSelectedSignal = false; var outliner = new UI.Outliner( editor ); outliner.onChange( function () { ignoreObjectSelectedSignal = true; editor.history.goToState( parseInt( outliner.getValue() ) ); ignoreObjectSelectedSignal = false; } ); container.add( outliner ); // var refreshUI = function () { var options = []; var enumerator = 1; function buildOption( object ) { var option = document.createElement( 'div' ); option.value = object.id; return option; } ( function addObjects( objects ) { for ( var i = 0, l = objects.length; i < l; i ++ ) { var object = objects[ i ]; var option = buildOption( object ); option.innerHTML = '&nbsp;' + object.name; options.push( option ); } } )( history.undos ); ( function addObjects( objects, pad ) { for ( var i = objects.length - 1; i >= 0; i -- ) { var object = objects[ i ]; var option = buildOption( object ); option.innerHTML = '&nbsp;' + object.name; option.style.opacity = 0.3; options.push( option ); } } )( history.redos, '&nbsp;' ); outliner.setOptions( options ); }; refreshUI(); // events signals.editorCleared.add( refreshUI ); signals.historyChanged.add( refreshUI ); signals.historyChanged.add( function ( cmd ) { outliner.setValue( cmd !== undefined ? cmd.id : null ); } ); return container; };
amakaroff82/three.js
editor/js/Sidebar.History.js
JavaScript
mit
2,542
import XCTest import Nimble class TestNull : NSNull {} class BeAKindOfTest: XCTestCase { func testPositiveMatch() { expect(TestNull()).to(beAKindOf(NSNull)) expect(NSObject()).to(beAKindOf(NSObject)) expect(NSNumber(integer:1)).toNot(beAKindOf(NSDate)) } func testFailureMessages() { failsWithErrorMessageForNil("expected to not be a kind of NSNull, got <nil>") { expect(nil as NSNull?).toNot(beAKindOf(NSNull)) } failsWithErrorMessageForNil("expected to be a kind of NSString, got <nil>") { expect(nil as NSString?).to(beAKindOf(NSString)) } failsWithErrorMessage("expected to be a kind of NSString, got <__NSCFNumber instance>") { expect(NSNumber(integer:1)).to(beAKindOf(NSString)) } failsWithErrorMessage("expected to not be a kind of NSNumber, got <__NSCFNumber instance>") { expect(NSNumber(integer:1)).toNot(beAKindOf(NSNumber)) } } func testSwiftTypesFailureMessages() { enum TestEnum { case One, Two } failsWithErrorMessage("beAKindOf only works on Objective-C types since the Swift compiler" + " will automatically type check Swift-only types. This expectation is redundant.") { expect(1).to(beAKindOf(Int)) } failsWithErrorMessage("beAKindOf only works on Objective-C types since the Swift compiler" + " will automatically type check Swift-only types. This expectation is redundant.") { expect("test").to(beAKindOf(String)) } failsWithErrorMessage("beAKindOf only works on Objective-C types since the Swift compiler" + " will automatically type check Swift-only types. This expectation is redundant.") { expect(TestEnum.One).to(beAKindOf(TestEnum)) } } }
BlackcombSoftware/ObjectMapper
Carthage/Checkouts/Nimble/NimbleTests/Matchers/BeAKindOfTest.swift
Swift
mit
1,882
/*! wavesurfer.js 1.0.44 * https://github.com/katspaugh/wavesurfer.js * @license CC-BY-3.0 */!function(a,b){"function"==typeof define&&define.amd?define(["wavesurfer"],b):a.WaveSurfer.Timeline=b(a.WaveSurfer)}(this,function(a){"use strict";return a.Timeline={init:function(a){this.params=a;var b=this.wavesurfer=a.wavesurfer;if(!this.wavesurfer)throw Error("No WaveSurfer intance provided");var c=this.drawer=this.wavesurfer.drawer;if(this.container="string"==typeof a.container?document.querySelector(a.container):a.container,!this.container)throw Error("No container for WaveSurfer timeline");this.width=c.width,this.height=this.params.height||20,this.notchPercentHeight=this.params.notchPercentHeight||90,this.primaryColor=this.params.primaryColor||"#000",this.secondaryColor=this.params.secondaryColor||"#c0c0c0",this.primaryFontColor=this.params.primaryFontColor||"#000",this.secondaryFontColor=this.params.secondaryFontColor||"#000",this.fontFamily=this.params.fontFamily||"Arial",this.fontSize=this.params.fontSize||10,this.createWrapper(),this.createCanvas(),this.render(),b.drawer.wrapper.onscroll=this.updateScroll.bind(this),b.on("redraw",this.render.bind(this)),b.on("destroy",this.destroy.bind(this))},destroy:function(){this.unAll(),this.wrapper&&this.wrapper.parentNode&&(this.wrapper.parentNode.removeChild(this.wrapper),this.wrapper=null)},createWrapper:function(){var a=this.container.querySelector("timeline");a&&this.container.removeChild(a);var b=this.wavesurfer.params;this.wrapper=this.container.appendChild(document.createElement("timeline")),this.drawer.style(this.wrapper,{display:"block",position:"relative",userSelect:"none",webkitUserSelect:"none",height:this.height+"px"}),(b.fillParent||b.scrollParent)&&this.drawer.style(this.wrapper,{width:"100%",overflowX:"hidden",overflowY:"hidden"});var c=this;this.wrapper.addEventListener("click",function(a){a.preventDefault();var b="offsetX"in a?a.offsetX:a.layerX;c.fireEvent("click",b/c.wrapper.scrollWidth||0)})},createCanvas:function(){var a=this.canvas=this.wrapper.appendChild(document.createElement("canvas"));this.timeCc=a.getContext("2d"),this.wavesurfer.drawer.style(a,{position:"absolute",zIndex:4})},render:function(){this.updateCanvasStyle(),this.drawTimeCanvas()},updateCanvasStyle:function(){var a=this.drawer.wrapper.scrollWidth;this.canvas.width=a*this.wavesurfer.params.pixelRatio,this.canvas.height=this.height*this.wavesurfer.params.pixelRatio,this.canvas.style.width=a+"px",this.canvas.style.height=this.height+"px"},drawTimeCanvas:function(){var a=this.wavesurfer.backend,b=this.wavesurfer.params,c=a.getDuration();if(b.fillParent&&!b.scrollParent)var d=this.drawer.getWidth();else d=this.drawer.wrapper.scrollWidth*b.pixelRatio;var e=d/c;if(c>0){var f=0,g=0,h=parseInt(c,10)+1,i=function(a){if(a/60>1){var b=parseInt(a/60),a=parseInt(a%60);return a=10>a?"0"+a:a,""+b+":"+a}return a};if(1*e>=25)var j=1,k=10,l=5;else if(5*e>=25)var j=5,k=6,l=2;else if(15*e>=25)var j=15,k=4,l=2;else var j=60,k=4,l=2;for(var m=this.height-4,n=this.height*(this.notchPercentHeight/100)-4,o=this.fontSize*b.pixelRatio,p=0;h/j>p;p++)p%k==0?(this.timeCc.fillStyle=this.primaryColor,this.timeCc.fillRect(f,0,1,m),this.timeCc.font=o+"px "+this.fontFamily,this.timeCc.fillStyle=this.primaryFontColor,this.timeCc.fillText(i(g),f+5,m)):p%l==0?(this.timeCc.fillStyle=this.secondaryColor,this.timeCc.fillRect(f,0,1,m),this.timeCc.font=o+"px "+this.fontFamily,this.timeCc.fillStyle=this.secondaryFontColor,this.timeCc.fillText(i(g),f+5,m)):(this.timeCc.fillStyle=this.secondaryColor,this.timeCc.fillRect(f,0,1,n)),g+=j,f+=e*j}},updateScroll:function(){this.wrapper.scrollLeft=this.drawer.wrapper.scrollLeft}},a.util.extend(a.Timeline,a.Observer),a.Timeline});
pvnr0082t/cdnjs
ajax/libs/wavesurfer.js/1.0.44/plugin/wavesurfer.timeline.min.js
JavaScript
mit
3,726
/*! * # Semantic UI 2.2.9 - Progress * http://github.com/semantic-org/semantic-ui/ * * * Released under the MIT license * http://opensource.org/licenses/MIT * */ ;(function ($, window, document, undefined) { "use strict"; window = (typeof window != 'undefined' && window.Math == Math) ? window : (typeof self != 'undefined' && self.Math == Math) ? self : Function('return this')() ; var global = (typeof window != 'undefined' && window.Math == Math) ? window : (typeof self != 'undefined' && self.Math == Math) ? self : Function('return this')() ; $.fn.progress = function(parameters) { var $allModules = $(this), moduleSelector = $allModules.selector || '', time = new Date().getTime(), performance = [], query = arguments[0], methodInvoked = (typeof query == 'string'), queryArguments = [].slice.call(arguments, 1), returnedValue ; $allModules .each(function() { var settings = ( $.isPlainObject(parameters) ) ? $.extend(true, {}, $.fn.progress.settings, parameters) : $.extend({}, $.fn.progress.settings), className = settings.className, metadata = settings.metadata, namespace = settings.namespace, selector = settings.selector, error = settings.error, eventNamespace = '.' + namespace, moduleNamespace = 'module-' + namespace, $module = $(this), $bar = $(this).find(selector.bar), $progress = $(this).find(selector.progress), $label = $(this).find(selector.label), element = this, instance = $module.data(moduleNamespace), animating = false, transitionEnd, module ; module = { initialize: function() { module.debug('Initializing progress bar', settings); module.set.duration(); module.set.transitionEvent(); module.read.metadata(); module.read.settings(); module.instantiate(); }, instantiate: function() { module.verbose('Storing instance of progress', module); instance = module; $module .data(moduleNamespace, module) ; }, destroy: function() { module.verbose('Destroying previous progress for', $module); clearInterval(instance.interval); module.remove.state(); $module.removeData(moduleNamespace); instance = undefined; }, reset: function() { module.remove.nextValue(); module.update.progress(0); }, complete: function() { if(module.percent === undefined || module.percent < 100) { module.remove.progressPoll(); module.set.percent(100); } }, read: { metadata: function() { var data = { percent : $module.data(metadata.percent), total : $module.data(metadata.total), value : $module.data(metadata.value) } ; if(data.percent) { module.debug('Current percent value set from metadata', data.percent); module.set.percent(data.percent); } if(data.total) { module.debug('Total value set from metadata', data.total); module.set.total(data.total); } if(data.value) { module.debug('Current value set from metadata', data.value); module.set.value(data.value); module.set.progress(data.value); } }, settings: function() { if(settings.total !== false) { module.debug('Current total set in settings', settings.total); module.set.total(settings.total); } if(settings.value !== false) { module.debug('Current value set in settings', settings.value); module.set.value(settings.value); module.set.progress(module.value); } if(settings.percent !== false) { module.debug('Current percent set in settings', settings.percent); module.set.percent(settings.percent); } } }, bind: { transitionEnd: function(callback) { var transitionEnd = module.get.transitionEnd() ; $bar .one(transitionEnd + eventNamespace, function(event) { clearTimeout(module.failSafeTimer); callback.call(this, event); }) ; module.failSafeTimer = setTimeout(function() { $bar.triggerHandler(transitionEnd); }, settings.duration + settings.failSafeDelay); module.verbose('Adding fail safe timer', module.timer); } }, increment: function(incrementValue) { var maxValue, startValue, newValue ; if( module.has.total() ) { startValue = module.get.value(); incrementValue = incrementValue || 1; newValue = startValue + incrementValue; } else { startValue = module.get.percent(); incrementValue = incrementValue || module.get.randomValue(); newValue = startValue + incrementValue; maxValue = 100; module.debug('Incrementing percentage by', startValue, newValue); } newValue = module.get.normalizedValue(newValue); module.set.progress(newValue); }, decrement: function(decrementValue) { var total = module.get.total(), startValue, newValue ; if(total) { startValue = module.get.value(); decrementValue = decrementValue || 1; newValue = startValue - decrementValue; module.debug('Decrementing value by', decrementValue, startValue); } else { startValue = module.get.percent(); decrementValue = decrementValue || module.get.randomValue(); newValue = startValue - decrementValue; module.debug('Decrementing percentage by', decrementValue, startValue); } newValue = module.get.normalizedValue(newValue); module.set.progress(newValue); }, has: { progressPoll: function() { return module.progressPoll; }, total: function() { return (module.get.total() !== false); } }, get: { text: function(templateText) { var value = module.value || 0, total = module.total || 0, percent = (animating) ? module.get.displayPercent() : module.percent || 0, left = (module.total > 0) ? (total - value) : (100 - percent) ; templateText = templateText || ''; templateText = templateText .replace('{value}', value) .replace('{total}', total) .replace('{left}', left) .replace('{percent}', percent) ; module.verbose('Adding variables to progress bar text', templateText); return templateText; }, normalizedValue: function(value) { if(value < 0) { module.debug('Value cannot decrement below 0'); return 0; } if(module.has.total()) { if(value > module.total) { module.debug('Value cannot increment above total', module.total); return module.total; } } else if(value > 100 ) { module.debug('Value cannot increment above 100 percent'); return 100; } return value; }, updateInterval: function() { if(settings.updateInterval == 'auto') { return settings.duration; } return settings.updateInterval; }, randomValue: function() { module.debug('Generating random increment percentage'); return Math.floor((Math.random() * settings.random.max) + settings.random.min); }, numericValue: function(value) { return (typeof value === 'string') ? (value.replace(/[^\d.]/g, '') !== '') ? +(value.replace(/[^\d.]/g, '')) : false : value ; }, transitionEnd: function() { var element = document.createElement('element'), transitions = { 'transition' :'transitionend', 'OTransition' :'oTransitionEnd', 'MozTransition' :'transitionend', 'WebkitTransition' :'webkitTransitionEnd' }, transition ; for(transition in transitions){ if( element.style[transition] !== undefined ){ return transitions[transition]; } } }, // gets current displayed percentage (if animating values this is the intermediary value) displayPercent: function() { var barWidth = $bar.width(), totalWidth = $module.width(), minDisplay = parseInt($bar.css('min-width'), 10), displayPercent = (barWidth > minDisplay) ? (barWidth / totalWidth * 100) : module.percent ; return (settings.precision > 0) ? Math.round(displayPercent * (10 * settings.precision)) / (10 * settings.precision) : Math.round(displayPercent) ; }, percent: function() { return module.percent || 0; }, value: function() { return module.nextValue || module.value || 0; }, total: function() { return module.total || false; } }, create: { progressPoll: function() { module.progressPoll = setTimeout(function() { module.update.toNextValue(); module.remove.progressPoll(); }, module.get.updateInterval()); }, }, is: { complete: function() { return module.is.success() || module.is.warning() || module.is.error(); }, success: function() { return $module.hasClass(className.success); }, warning: function() { return $module.hasClass(className.warning); }, error: function() { return $module.hasClass(className.error); }, active: function() { return $module.hasClass(className.active); }, visible: function() { return $module.is(':visible'); } }, remove: { progressPoll: function() { module.verbose('Removing progress poll timer'); if(module.progressPoll) { clearTimeout(module.progressPoll); delete module.progressPoll; } }, nextValue: function() { module.verbose('Removing progress value stored for next update'); delete module.nextValue; }, state: function() { module.verbose('Removing stored state'); delete module.total; delete module.percent; delete module.value; }, active: function() { module.verbose('Removing active state'); $module.removeClass(className.active); }, success: function() { module.verbose('Removing success state'); $module.removeClass(className.success); }, warning: function() { module.verbose('Removing warning state'); $module.removeClass(className.warning); }, error: function() { module.verbose('Removing error state'); $module.removeClass(className.error); } }, set: { barWidth: function(value) { if(value > 100) { module.error(error.tooHigh, value); } else if (value < 0) { module.error(error.tooLow, value); } else { $bar .css('width', value + '%') ; $module .attr('data-percent', parseInt(value, 10)) ; } }, duration: function(duration) { duration = duration || settings.duration; duration = (typeof duration == 'number') ? duration + 'ms' : duration ; module.verbose('Setting progress bar transition duration', duration); $bar .css({ 'transition-duration': duration }) ; }, percent: function(percent) { percent = (typeof percent == 'string') ? +(percent.replace('%', '')) : percent ; // round display percentage percent = (settings.precision > 0) ? Math.round(percent * (10 * settings.precision)) / (10 * settings.precision) : Math.round(percent) ; module.percent = percent; if( !module.has.total() ) { module.value = (settings.precision > 0) ? Math.round( (percent / 100) * module.total * (10 * settings.precision)) / (10 * settings.precision) : Math.round( (percent / 100) * module.total * 10) / 10 ; if(settings.limitValues) { module.value = (module.value > 100) ? 100 : (module.value < 0) ? 0 : module.value ; } } module.set.barWidth(percent); module.set.labelInterval(); module.set.labels(); settings.onChange.call(element, percent, module.value, module.total); }, labelInterval: function() { var animationCallback = function() { module.verbose('Bar finished animating, removing continuous label updates'); clearInterval(module.interval); animating = false; module.set.labels(); } ; clearInterval(module.interval); module.bind.transitionEnd(animationCallback); animating = true; module.interval = setInterval(function() { var isInDOM = $.contains(document.documentElement, element) ; if(!isInDOM) { clearInterval(module.interval); animating = false; } module.set.labels(); }, settings.framerate); }, labels: function() { module.verbose('Setting both bar progress and outer label text'); module.set.barLabel(); module.set.state(); }, label: function(text) { text = text || ''; if(text) { text = module.get.text(text); module.verbose('Setting label to text', text); $label.text(text); } }, state: function(percent) { percent = (percent !== undefined) ? percent : module.percent ; if(percent === 100) { if(settings.autoSuccess && !(module.is.warning() || module.is.error() || module.is.success())) { module.set.success(); module.debug('Automatically triggering success at 100%'); } else { module.verbose('Reached 100% removing active state'); module.remove.active(); module.remove.progressPoll(); } } else if(percent > 0) { module.verbose('Adjusting active progress bar label', percent); module.set.active(); } else { module.remove.active(); module.set.label(settings.text.active); } }, barLabel: function(text) { if(text !== undefined) { $progress.text( module.get.text(text) ); } else if(settings.label == 'ratio' && module.total) { module.verbose('Adding ratio to bar label'); $progress.text( module.get.text(settings.text.ratio) ); } else if(settings.label == 'percent') { module.verbose('Adding percentage to bar label'); $progress.text( module.get.text(settings.text.percent) ); } }, active: function(text) { text = text || settings.text.active; module.debug('Setting active state'); if(settings.showActivity && !module.is.active() ) { $module.addClass(className.active); } module.remove.warning(); module.remove.error(); module.remove.success(); text = settings.onLabelUpdate('active', text, module.value, module.total); if(text) { module.set.label(text); } module.bind.transitionEnd(function() { settings.onActive.call(element, module.value, module.total); }); }, success : function(text) { text = text || settings.text.success || settings.text.active; module.debug('Setting success state'); $module.addClass(className.success); module.remove.active(); module.remove.warning(); module.remove.error(); module.complete(); if(settings.text.success) { text = settings.onLabelUpdate('success', text, module.value, module.total); module.set.label(text); } else { text = settings.onLabelUpdate('active', text, module.value, module.total); module.set.label(text); } module.bind.transitionEnd(function() { settings.onSuccess.call(element, module.total); }); }, warning : function(text) { text = text || settings.text.warning; module.debug('Setting warning state'); $module.addClass(className.warning); module.remove.active(); module.remove.success(); module.remove.error(); module.complete(); text = settings.onLabelUpdate('warning', text, module.value, module.total); if(text) { module.set.label(text); } module.bind.transitionEnd(function() { settings.onWarning.call(element, module.value, module.total); }); }, error : function(text) { text = text || settings.text.error; module.debug('Setting error state'); $module.addClass(className.error); module.remove.active(); module.remove.success(); module.remove.warning(); module.complete(); text = settings.onLabelUpdate('error', text, module.value, module.total); if(text) { module.set.label(text); } module.bind.transitionEnd(function() { settings.onError.call(element, module.value, module.total); }); }, transitionEvent: function() { transitionEnd = module.get.transitionEnd(); }, total: function(totalValue) { module.total = totalValue; }, value: function(value) { module.value = value; }, progress: function(value) { if(!module.has.progressPoll()) { module.debug('First update in progress update interval, immediately updating', value); module.update.progress(value); module.create.progressPoll(); } else { module.debug('Updated within interval, setting next update to use new value', value); module.set.nextValue(value); } }, nextValue: function(value) { module.nextValue = value; } }, update: { toNextValue: function() { var nextValue = module.nextValue ; if(nextValue) { module.debug('Update interval complete using last updated value', nextValue); module.update.progress(nextValue); module.remove.nextValue(); } }, progress: function(value) { var percentComplete ; value = module.get.numericValue(value); if(value === false) { module.error(error.nonNumeric, value); } value = module.get.normalizedValue(value); if( module.has.total() ) { module.set.value(value); percentComplete = (value / module.total) * 100; module.debug('Calculating percent complete from total', percentComplete); module.set.percent( percentComplete ); } else { percentComplete = value; module.debug('Setting value to exact percentage value', percentComplete); module.set.percent( percentComplete ); } } }, setting: function(name, value) { module.debug('Changing setting', name, value); if( $.isPlainObject(name) ) { $.extend(true, settings, name); } else if(value !== undefined) { if($.isPlainObject(settings[name])) { $.extend(true, settings[name], value); } else { settings[name] = value; } } else { return settings[name]; } }, internal: function(name, value) { if( $.isPlainObject(name) ) { $.extend(true, module, name); } else if(value !== undefined) { module[name] = value; } else { return module[name]; } }, debug: function() { if(!settings.silent && settings.debug) { if(settings.performance) { module.performance.log(arguments); } else { module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':'); module.debug.apply(console, arguments); } } }, verbose: function() { if(!settings.silent && settings.verbose && settings.debug) { if(settings.performance) { module.performance.log(arguments); } else { module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':'); module.verbose.apply(console, arguments); } } }, error: function() { if(!settings.silent) { module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); module.error.apply(console, arguments); } }, performance: { log: function(message) { var currentTime, executionTime, previousTime ; if(settings.performance) { currentTime = new Date().getTime(); previousTime = time || currentTime; executionTime = currentTime - previousTime; time = currentTime; performance.push({ 'Name' : message[0], 'Arguments' : [].slice.call(message, 1) || '', 'Element' : element, 'Execution Time' : executionTime }); } clearTimeout(module.performance.timer); module.performance.timer = setTimeout(module.performance.display, 500); }, display: function() { var title = settings.name + ':', totalTime = 0 ; time = false; clearTimeout(module.performance.timer); $.each(performance, function(index, data) { totalTime += data['Execution Time']; }); title += ' ' + totalTime + 'ms'; if(moduleSelector) { title += ' \'' + moduleSelector + '\''; } if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) { console.groupCollapsed(title); if(console.table) { console.table(performance); } else { $.each(performance, function(index, data) { console.log(data['Name'] + ': ' + data['Execution Time']+'ms'); }); } console.groupEnd(); } performance = []; } }, invoke: function(query, passedArguments, context) { var object = instance, maxDepth, found, response ; passedArguments = passedArguments || queryArguments; context = element || context; if(typeof query == 'string' && object !== undefined) { query = query.split(/[\. ]/); maxDepth = query.length - 1; $.each(query, function(depth, value) { var camelCaseValue = (depth != maxDepth) ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1) : query ; if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) { object = object[camelCaseValue]; } else if( object[camelCaseValue] !== undefined ) { found = object[camelCaseValue]; return false; } else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) { object = object[value]; } else if( object[value] !== undefined ) { found = object[value]; return false; } else { module.error(error.method, query); return false; } }); } if ( $.isFunction( found ) ) { response = found.apply(context, passedArguments); } else if(found !== undefined) { response = found; } if($.isArray(returnedValue)) { returnedValue.push(response); } else if(returnedValue !== undefined) { returnedValue = [returnedValue, response]; } else if(response !== undefined) { returnedValue = response; } return found; } }; if(methodInvoked) { if(instance === undefined) { module.initialize(); } module.invoke(query); } else { if(instance !== undefined) { instance.invoke('destroy'); } module.initialize(); } }) ; return (returnedValue !== undefined) ? returnedValue : this ; }; $.fn.progress.settings = { name : 'Progress', namespace : 'progress', silent : false, debug : false, verbose : false, performance : true, random : { min : 2, max : 5 }, duration : 300, updateInterval : 'auto', autoSuccess : true, showActivity : true, limitValues : true, label : 'percent', precision : 0, framerate : (1000 / 30), /// 30 fps percent : false, total : false, value : false, // delay in ms for fail safe animation callback failSafeDelay : 100, onLabelUpdate : function(state, text, value, total){ return text; }, onChange : function(percent, value, total){}, onSuccess : function(total){}, onActive : function(value, total){}, onError : function(value, total){}, onWarning : function(value, total){}, error : { method : 'The method you called is not defined.', nonNumeric : 'Progress value is non numeric', tooHigh : 'Value specified is above 100%', tooLow : 'Value specified is below 0%' }, regExp: { variable: /\{\$*[A-z0-9]+\}/g }, metadata: { percent : 'percent', total : 'total', value : 'value' }, selector : { bar : '> .bar', label : '> .label', progress : '.bar > .progress' }, text : { active : false, error : false, success : false, warning : false, percent : '{percent}%', ratio : '{value} of {total}' }, className : { active : 'active', error : 'error', success : 'success', warning : 'warning' } }; })( jQuery, window, document );
seogi1004/cdnjs
ajax/libs/semantic-ui/2.2.9/components/progress.js
JavaScript
mit
30,273
/* Copyright 2015 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package cache import ( "fmt" "sync" "time" "k8s.io/client-go/pkg/runtime" utilruntime "k8s.io/client-go/pkg/util/runtime" "k8s.io/client-go/pkg/util/wait" "github.com/golang/glog" ) // if you use this, there is one behavior change compared to a standard Informer. // When you receive a notification, the cache will be AT LEAST as fresh as the // notification, but it MAY be more fresh. You should NOT depend on the contents // of the cache exactly matching the notification you've received in handler // functions. If there was a create, followed by a delete, the cache may NOT // have your item. This has advantages over the broadcaster since it allows us // to share a common cache across many controllers. Extending the broadcaster // would have required us keep duplicate caches for each watch. type SharedInformer interface { // events to a single handler are delivered sequentially, but there is no coordination between different handlers // You may NOT add a handler *after* the SharedInformer is running. That will result in an error being returned. // TODO we should try to remove this restriction eventually. AddEventHandler(handler ResourceEventHandler) error GetStore() Store // GetController gives back a synthetic interface that "votes" to start the informer GetController() ControllerInterface Run(stopCh <-chan struct{}) HasSynced() bool LastSyncResourceVersion() string } type SharedIndexInformer interface { SharedInformer // AddIndexers add indexers to the informer before it starts. AddIndexers(indexers Indexers) error GetIndexer() Indexer } // NewSharedInformer creates a new instance for the listwatcher. // TODO: create a cache/factory of these at a higher level for the list all, watch all of a given resource that can // be shared amongst all consumers. func NewSharedInformer(lw ListerWatcher, objType runtime.Object, resyncPeriod time.Duration) SharedInformer { return NewSharedIndexInformer(lw, objType, resyncPeriod, Indexers{}) } // NewSharedIndexInformer creates a new instance for the listwatcher. // TODO: create a cache/factory of these at a higher level for the list all, watch all of a given resource that can // be shared amongst all consumers. func NewSharedIndexInformer(lw ListerWatcher, objType runtime.Object, resyncPeriod time.Duration, indexers Indexers) SharedIndexInformer { sharedIndexInformer := &sharedIndexInformer{ processor: &sharedProcessor{}, indexer: NewIndexer(DeletionHandlingMetaNamespaceKeyFunc, indexers), listerWatcher: lw, objectType: objType, fullResyncPeriod: resyncPeriod, cacheMutationDetector: NewCacheMutationDetector(fmt.Sprintf("%T", objType)), } return sharedIndexInformer } // InformerSynced is a function that can be used to determine if an informer has synced. This is useful for determining if caches have synced. type InformerSynced func() bool // syncedPollPeriod controls how often you look at the status of your sync funcs const syncedPollPeriod = 100 * time.Millisecond // WaitForCacheSync waits for caches to populate. It returns true if it was successful, false // if the contoller should shutdown func WaitForCacheSync(stopCh <-chan struct{}, cacheSyncs ...InformerSynced) bool { err := wait.PollUntil(syncedPollPeriod, func() (bool, error) { for _, syncFunc := range cacheSyncs { if !syncFunc() { return false, nil } } return true, nil }, stopCh) if err != nil { glog.V(2).Infof("stop requested") return false } glog.V(4).Infof("caches populated") return true } type sharedIndexInformer struct { indexer Indexer controller *Controller processor *sharedProcessor cacheMutationDetector CacheMutationDetector // This block is tracked to handle late initialization of the controller listerWatcher ListerWatcher objectType runtime.Object fullResyncPeriod time.Duration started bool startedLock sync.Mutex // blockDeltas gives a way to stop all event distribution so that a late event handler // can safely join the shared informer. blockDeltas sync.Mutex // stopCh is the channel used to stop the main Run process. We have to track it so that // late joiners can have a proper stop stopCh <-chan struct{} } // dummyController hides the fact that a SharedInformer is different from a dedicated one // where a caller can `Run`. The run method is disonnected in this case, because higher // level logic will decide when to start the SharedInformer and related controller. // Because returning information back is always asynchronous, the legacy callers shouldn't // notice any change in behavior. type dummyController struct { informer *sharedIndexInformer } func (v *dummyController) Run(stopCh <-chan struct{}) { } func (v *dummyController) HasSynced() bool { return v.informer.HasSynced() } type updateNotification struct { oldObj interface{} newObj interface{} } type addNotification struct { newObj interface{} } type deleteNotification struct { oldObj interface{} } func (s *sharedIndexInformer) Run(stopCh <-chan struct{}) { defer utilruntime.HandleCrash() fifo := NewDeltaFIFO(MetaNamespaceKeyFunc, nil, s.indexer) cfg := &Config{ Queue: fifo, ListerWatcher: s.listerWatcher, ObjectType: s.objectType, FullResyncPeriod: s.fullResyncPeriod, RetryOnError: false, Process: s.HandleDeltas, } func() { s.startedLock.Lock() defer s.startedLock.Unlock() s.controller = New(cfg) s.started = true }() s.stopCh = stopCh s.cacheMutationDetector.Run(stopCh) s.processor.run(stopCh) s.controller.Run(stopCh) } func (s *sharedIndexInformer) isStarted() bool { s.startedLock.Lock() defer s.startedLock.Unlock() return s.started } func (s *sharedIndexInformer) HasSynced() bool { s.startedLock.Lock() defer s.startedLock.Unlock() if s.controller == nil { return false } return s.controller.HasSynced() } func (s *sharedIndexInformer) LastSyncResourceVersion() string { s.startedLock.Lock() defer s.startedLock.Unlock() if s.controller == nil || s.controller.reflector == nil { return "" } return s.controller.reflector.LastSyncResourceVersion() } func (s *sharedIndexInformer) GetStore() Store { return s.indexer } func (s *sharedIndexInformer) GetIndexer() Indexer { return s.indexer } func (s *sharedIndexInformer) AddIndexers(indexers Indexers) error { s.startedLock.Lock() defer s.startedLock.Unlock() if s.started { return fmt.Errorf("informer has already started") } return s.indexer.AddIndexers(indexers) } func (s *sharedIndexInformer) GetController() ControllerInterface { return &dummyController{informer: s} } func (s *sharedIndexInformer) AddEventHandler(handler ResourceEventHandler) error { s.startedLock.Lock() defer s.startedLock.Unlock() if !s.started { listener := newProcessListener(handler) s.processor.listeners = append(s.processor.listeners, listener) return nil } // in order to safely join, we have to // 1. stop sending add/update/delete notifications // 2. do a list against the store // 3. send synthetic "Add" events to the new handler // 4. unblock s.blockDeltas.Lock() defer s.blockDeltas.Unlock() listener := newProcessListener(handler) s.processor.listeners = append(s.processor.listeners, listener) go listener.run(s.stopCh) go listener.pop(s.stopCh) items := s.indexer.List() for i := range items { listener.add(addNotification{newObj: items[i]}) } return nil } func (s *sharedIndexInformer) HandleDeltas(obj interface{}) error { s.blockDeltas.Lock() defer s.blockDeltas.Unlock() // from oldest to newest for _, d := range obj.(Deltas) { switch d.Type { case Sync, Added, Updated: s.cacheMutationDetector.AddObject(d.Object) if old, exists, err := s.indexer.Get(d.Object); err == nil && exists { if err := s.indexer.Update(d.Object); err != nil { return err } s.processor.distribute(updateNotification{oldObj: old, newObj: d.Object}) } else { if err := s.indexer.Add(d.Object); err != nil { return err } s.processor.distribute(addNotification{newObj: d.Object}) } case Deleted: if err := s.indexer.Delete(d.Object); err != nil { return err } s.processor.distribute(deleteNotification{oldObj: d.Object}) } } return nil } type sharedProcessor struct { listeners []*processorListener } func (p *sharedProcessor) distribute(obj interface{}) { for _, listener := range p.listeners { listener.add(obj) } } func (p *sharedProcessor) run(stopCh <-chan struct{}) { for _, listener := range p.listeners { go listener.run(stopCh) go listener.pop(stopCh) } } type processorListener struct { // lock/cond protects access to 'pendingNotifications'. lock sync.RWMutex cond sync.Cond // pendingNotifications is an unbounded slice that holds all notifications not yet distributed // there is one per listener, but a failing/stalled listener will have infinite pendingNotifications // added until we OOM. // TODO This is no worse that before, since reflectors were backed by unbounded DeltaFIFOs, but // we should try to do something better pendingNotifications []interface{} nextCh chan interface{} handler ResourceEventHandler } func newProcessListener(handler ResourceEventHandler) *processorListener { ret := &processorListener{ pendingNotifications: []interface{}{}, nextCh: make(chan interface{}), handler: handler, } ret.cond.L = &ret.lock return ret } func (p *processorListener) add(notification interface{}) { p.lock.Lock() defer p.lock.Unlock() p.pendingNotifications = append(p.pendingNotifications, notification) p.cond.Broadcast() } func (p *processorListener) pop(stopCh <-chan struct{}) { defer utilruntime.HandleCrash() for { blockingGet := func() (interface{}, bool) { p.lock.Lock() defer p.lock.Unlock() for len(p.pendingNotifications) == 0 { // check if we're shutdown select { case <-stopCh: return nil, true default: } p.cond.Wait() } nt := p.pendingNotifications[0] p.pendingNotifications = p.pendingNotifications[1:] return nt, false } notification, stopped := blockingGet() if stopped { return } select { case <-stopCh: return case p.nextCh <- notification: } } } func (p *processorListener) run(stopCh <-chan struct{}) { defer utilruntime.HandleCrash() for { var next interface{} select { case <-stopCh: func() { p.lock.Lock() defer p.lock.Unlock() p.cond.Broadcast() }() return case next = <-p.nextCh: } switch notification := next.(type) { case updateNotification: p.handler.OnUpdate(notification.oldObj, notification.newObj) case addNotification: p.handler.OnAdd(notification.newObj) case deleteNotification: p.handler.OnDelete(notification.oldObj) default: utilruntime.HandleError(fmt.Errorf("unrecognized notification: %#v", next)) } } }
yyekhlef/traefik
vendor/k8s.io/client-go/tools/cache/shared_informer.go
GO
mit
11,556
'use strict';/*! * This is a `i18n` language object. * * Romanian * * @author * Jalios (Twitter: @Jalios) * Sascha Greuel (Twitter: @SoftCreatR) * * @see core/i18n.js */ (function (exports) { if (exports.ro === undefined) { exports.ro = { "mejs.plural-form": 5, "mejs.download-file": "Descarcă fişierul", // "mejs.install-flash": "You are using a browser that does not have Flash player enabled or installed. Please turn on your Flash player plugin or download the latest version from https://get.adobe.com/flashplayer/", "mejs.fullscreen": "Ecran complet", "mejs.play": "Redare", "mejs.pause": "Pauză", "mejs.time-slider": "Cursor timp", "mejs.time-help-text": "Utilizează tastele săgeată Stânga/Dreapta pentru a avansa o secundă şi săgeţile Sus/Jos pentru a avansa zece secunde.", //"mejs.live-broadcast" : "Live Broadcast", "mejs.volume-help-text": "Utilizează tastele de săgeată Sus/Jos pentru a creşte/micşora volumul", "mejs.unmute": "Cu sunet", "mejs.mute": "Fără sunet", "mejs.volume-slider": "Cursor volum", "mejs.video-player": "Player video", "mejs.audio-player": "Player audio", "mejs.captions-subtitles": "Legende/Subtitrări", // "mejs.captions-chapters": "Chapters", "mejs.none": "Niciunul" // "mejs.afrikaans": "Afrikaans", // "mejs.albanian": "Albanian", // "mejs.arabic": "Arabic", // "mejs.belarusian": "Belarusian", // "mejs.bulgarian": "Bulgarian", // "mejs.catalan": "Catalan", // "mejs.chinese": "Chinese", // "mejs.chinese-simplified": "Chinese (Simplified)", // "mejs.chinese-traditional": "Chinese (Traditional)", // "mejs.croatian": "Croatian", // "mejs.czech": "Czech", // "mejs.danish": "Danish", // "mejs.dutch": "Dutch", // "mejs.english": "English", // "mejs.estonian": "Estonian", // "mejs.filipino": "Filipino", // "mejs.finnish": "Finnish", // "mejs.french": "French", // "mejs.galician": "Galician", // "mejs.german": "German", // "mejs.greek": "Greek", // "mejs.haitian-creole": "Haitian Creole", // "mejs.hebrew": "Hebrew", // "mejs.hindi": "Hindi", // "mejs.hungarian": "Hungarian", // "mejs.icelandic": "Icelandic", // "mejs.indonesian": "Indonesian", // "mejs.irish": "Irish", // "mejs.italian": "Italian", // "mejs.japanese": "Japanese", // "mejs.korean": "Korean", // "mejs.latvian": "Latvian", // "mejs.lithuanian": "Lithuanian", // "mejs.macedonian": "Macedonian", // "mejs.malay": "Malay", // "mejs.maltese": "Maltese", // "mejs.norwegian": "Norwegian", // "mejs.persian": "Persian", // "mejs.polish": "Polish", // "mejs.portuguese": "Portuguese", // "mejs.romanian": "Romanian", // "mejs.russian": "Russian", // "mejs.serbian": "Serbian", // "mejs.slovak": "Slovak", // "mejs.slovenian": "Slovenian", // "mejs.spanish": "Spanish", // "mejs.swahili": "Swahili", // "mejs.swedish": "Swedish", // "mejs.tagalog": "Tagalog", // "mejs.thai": "Thai", // "mejs.turkish": "Turkish", // "mejs.ukrainian": "Ukrainian", // "mejs.vietnamese": "Vietnamese", // "mejs.welsh": "Welsh", // "mejs.yiddish": "Yiddish" }; } })(mejs.i18n);
BenjaminVanRyseghem/cdnjs
ajax/libs/mediaelement/4.1.2/lang/ro.js
JavaScript
mit
3,247
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. ;(function (undefined) { var objectTypes = { 'boolean': false, 'function': true, 'object': true, 'number': false, 'string': false, 'undefined': false }; var root = (objectTypes[typeof window] && window) || this, freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports, freeModule = objectTypes[typeof module] && module && !module.nodeType && module, moduleExports = freeModule && freeModule.exports === freeExports && freeExports, freeGlobal = objectTypes[typeof global] && global; if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { root = freeGlobal; } var Rx = { internals: {}, config: { Promise: root.Promise }, helpers: { } }; // Defaults var noop = Rx.helpers.noop = function () { }, notDefined = Rx.helpers.notDefined = function (x) { return typeof x === 'undefined'; }, identity = Rx.helpers.identity = function (x) { return x; }, pluck = Rx.helpers.pluck = function (property) { return function (x) { return x[property]; }; }, just = Rx.helpers.just = function (value) { return function () { return value; }; }, defaultNow = Rx.helpers.defaultNow = (function () { return !!Date.now ? Date.now : function () { return +new Date; }; }()), defaultComparer = Rx.helpers.defaultComparer = function (x, y) { return isEqual(x, y); }, defaultSubComparer = Rx.helpers.defaultSubComparer = function (x, y) { return x > y ? 1 : (x < y ? -1 : 0); }, defaultKeySerializer = Rx.helpers.defaultKeySerializer = function (x) { return x.toString(); }, defaultError = Rx.helpers.defaultError = function (err) { throw err; }, isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.then === 'function'; }, asArray = Rx.helpers.asArray = function () { return Array.prototype.slice.call(arguments); }, not = Rx.helpers.not = function (a) { return !a; }, isFunction = Rx.helpers.isFunction = (function () { var isFn = function (value) { return typeof value == 'function' || false; } // fallback for older versions of Chrome and Safari if (isFn(/x/)) { isFn = function(value) { return typeof value == 'function' && toString.call(value) == '[object Function]'; }; } return isFn; }()); function cloneArray(arr) { var len = arr.length, a = new Array(len); for(var i = 0; i < len; i++) { a[i] = arr[i]; } return a; } Rx.config.longStackSupport = false; var hasStacks = false; try { throw new Error(); } catch (e) { hasStacks = !!e.stack; } // All code after this point will be filtered from stack traces reported by RxJS var rStartingLine = captureLine(), rFileName; var STACK_JUMP_SEPARATOR = "From previous event:"; function makeStackTraceLong(error, observable) { // If possible, transform the error stack trace by removing Node and RxJS // cruft, then concatenating with the stack trace of `observable`. if (hasStacks && observable.stack && typeof error === "object" && error !== null && error.stack && error.stack.indexOf(STACK_JUMP_SEPARATOR) === -1 ) { var stacks = []; for (var o = observable; !!o; o = o.source) { if (o.stack) { stacks.unshift(o.stack); } } stacks.unshift(error.stack); var concatedStacks = stacks.join("\n" + STACK_JUMP_SEPARATOR + "\n"); error.stack = filterStackString(concatedStacks); } } function filterStackString(stackString) { var lines = stackString.split("\n"), desiredLines = []; for (var i = 0, len = lines.length; i < len; i++) { var line = lines[i]; if (!isInternalFrame(line) && !isNodeFrame(line) && line) { desiredLines.push(line); } } return desiredLines.join("\n"); } function isInternalFrame(stackLine) { var fileNameAndLineNumber = getFileNameAndLineNumber(stackLine); if (!fileNameAndLineNumber) { return false; } var fileName = fileNameAndLineNumber[0], lineNumber = fileNameAndLineNumber[1]; return fileName === rFileName && lineNumber >= rStartingLine && lineNumber <= rEndingLine; } function isNodeFrame(stackLine) { return stackLine.indexOf("(module.js:") !== -1 || stackLine.indexOf("(node.js:") !== -1; } function captureLine() { if (!hasStacks) { return; } try { throw new Error(); } catch (e) { var lines = e.stack.split("\n"); var firstLine = lines[0].indexOf("@") > 0 ? lines[1] : lines[2]; var fileNameAndLineNumber = getFileNameAndLineNumber(firstLine); if (!fileNameAndLineNumber) { return; } rFileName = fileNameAndLineNumber[0]; return fileNameAndLineNumber[1]; } } function getFileNameAndLineNumber(stackLine) { // Named functions: "at functionName (filename:lineNumber:columnNumber)" var attempt1 = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(stackLine); if (attempt1) { return [attempt1[1], Number(attempt1[2])]; } // Anonymous functions: "at filename:lineNumber:columnNumber" var attempt2 = /at ([^ ]+):(\d+):(?:\d+)$/.exec(stackLine); if (attempt2) { return [attempt2[1], Number(attempt2[2])]; } // Firefox style: "function@filename:lineNumber or @filename:lineNumber" var attempt3 = /.*@(.+):(\d+)$/.exec(stackLine); if (attempt3) { return [attempt3[1], Number(attempt3[2])]; } } var EmptyError = Rx.EmptyError = function() { this.message = 'Sequence contains no elements.'; Error.call(this); }; EmptyError.prototype = Error.prototype; var ObjectDisposedError = Rx.ObjectDisposedError = function() { this.message = 'Object has been disposed'; Error.call(this); }; ObjectDisposedError.prototype = Error.prototype; var ArgumentOutOfRangeError = Rx.ArgumentOutOfRangeError = function () { this.message = 'Argument out of range'; Error.call(this); }; ArgumentOutOfRangeError.prototype = Error.prototype; var NotSupportedError = Rx.NotSupportedError = function (message) { this.message = message || 'This operation is not supported'; Error.call(this); }; NotSupportedError.prototype = Error.prototype; var NotImplementedError = Rx.NotImplementedError = function (message) { this.message = message || 'This operation is not implemented'; Error.call(this); }; NotImplementedError.prototype = Error.prototype; var notImplemented = Rx.helpers.notImplemented = function () { throw new NotImplementedError(); }; var notSupported = Rx.helpers.notSupported = function () { throw new NotSupportedError(); }; // Shim in iterator support var $iterator$ = (typeof Symbol === 'function' && Symbol.iterator) || '_es6shim_iterator_'; // Bug for mozilla version if (root.Set && typeof new root.Set()['@@iterator'] === 'function') { $iterator$ = '@@iterator'; } var doneEnumerator = Rx.doneEnumerator = { done: true, value: undefined }; var isIterable = Rx.helpers.isIterable = function (o) { return o[$iterator$] !== undefined; } var isArrayLike = Rx.helpers.isArrayLike = function (o) { return o && o.length !== undefined; } Rx.helpers.iterator = $iterator$; var bindCallback = Rx.internals.bindCallback = function (func, thisArg, argCount) { if (typeof thisArg === 'undefined') { return func; } switch(argCount) { case 0: return function() { return func.call(thisArg) }; case 1: return function(arg) { return func.call(thisArg, arg); } case 2: return function(value, index) { return func.call(thisArg, value, index); }; case 3: return function(value, index, collection) { return func.call(thisArg, value, index, collection); }; } return function() { return func.apply(thisArg, arguments); }; }; /** Used to determine if values are of the language type Object */ var dontEnums = ['toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor'], dontEnumsLength = dontEnums.length; /** `Object#toString` result shortcuts */ var argsClass = '[object Arguments]', arrayClass = '[object Array]', boolClass = '[object Boolean]', dateClass = '[object Date]', errorClass = '[object Error]', funcClass = '[object Function]', numberClass = '[object Number]', objectClass = '[object Object]', regexpClass = '[object RegExp]', stringClass = '[object String]'; var toString = Object.prototype.toString, hasOwnProperty = Object.prototype.hasOwnProperty, supportsArgsClass = toString.call(arguments) == argsClass, // For less <IE9 && FF<4 supportNodeClass, errorProto = Error.prototype, objectProto = Object.prototype, stringProto = String.prototype, propertyIsEnumerable = objectProto.propertyIsEnumerable; try { supportNodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + '')); } catch (e) { supportNodeClass = true; } var nonEnumProps = {}; nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true }; nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': true, 'toString': true, 'valueOf': true }; nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': true, 'toString': true }; nonEnumProps[objectClass] = { 'constructor': true }; var support = {}; (function () { var ctor = function() { this.x = 1; }, props = []; ctor.prototype = { 'valueOf': 1, 'y': 1 }; for (var key in new ctor) { props.push(key); } for (key in arguments) { } // Detect if `name` or `message` properties of `Error.prototype` are enumerable by default. support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name'); // Detect if `prototype` properties are enumerable by default. support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype'); // Detect if `arguments` object indexes are non-enumerable support.nonEnumArgs = key != 0; // Detect if properties shadowing those on `Object.prototype` are non-enumerable. support.nonEnumShadows = !/valueOf/.test(props); }(1)); var isObject = Rx.internals.isObject = function(value) { var type = typeof value; return value && (type == 'function' || type == 'object') || false; }; function keysIn(object) { var result = []; if (!isObject(object)) { return result; } if (support.nonEnumArgs && object.length && isArguments(object)) { object = slice.call(object); } var skipProto = support.enumPrototypes && typeof object == 'function', skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error); for (var key in object) { if (!(skipProto && key == 'prototype') && !(skipErrorProps && (key == 'message' || key == 'name'))) { result.push(key); } } if (support.nonEnumShadows && object !== objectProto) { var ctor = object.constructor, index = -1, length = dontEnumsLength; if (object === (ctor && ctor.prototype)) { var className = object === stringProto ? stringClass : object === errorProto ? errorClass : toString.call(object), nonEnum = nonEnumProps[className]; } while (++index < length) { key = dontEnums[index]; if (!(nonEnum && nonEnum[key]) && hasOwnProperty.call(object, key)) { result.push(key); } } } return result; } function internalFor(object, callback, keysFunc) { var index = -1, props = keysFunc(object), length = props.length; while (++index < length) { var key = props[index]; if (callback(object[key], key, object) === false) { break; } } return object; } function internalForIn(object, callback) { return internalFor(object, callback, keysIn); } function isNode(value) { // IE < 9 presents DOM nodes as `Object` objects except they have `toString` // methods that are `typeof` "string" and still can coerce nodes to strings return typeof value.toString != 'function' && typeof (value + '') == 'string'; } var isArguments = function(value) { return (value && typeof value == 'object') ? toString.call(value) == argsClass : false; } // fallback for browsers that can't detect `arguments` objects by [[Class]] if (!supportsArgsClass) { isArguments = function(value) { return (value && typeof value == 'object') ? hasOwnProperty.call(value, 'callee') : false; }; } var isEqual = Rx.internals.isEqual = function (x, y) { return deepEquals(x, y, [], []); }; /** @private * Used for deep comparison **/ function deepEquals(a, b, stackA, stackB) { // exit early for identical values if (a === b) { // treat `+0` vs. `-0` as not equal return a !== 0 || (1 / a == 1 / b); } var type = typeof a, otherType = typeof b; // exit early for unlike primitive values if (a === a && (a == null || b == null || (type != 'function' && type != 'object' && otherType != 'function' && otherType != 'object'))) { return false; } // compare [[Class]] names var className = toString.call(a), otherClass = toString.call(b); if (className == argsClass) { className = objectClass; } if (otherClass == argsClass) { otherClass = objectClass; } if (className != otherClass) { return false; } switch (className) { case boolClass: case dateClass: // coerce dates and booleans to numbers, dates to milliseconds and booleans // to `1` or `0` treating invalid dates coerced to `NaN` as not equal return +a == +b; case numberClass: // treat `NaN` vs. `NaN` as equal return (a != +a) ? b != +b : // but treat `-0` vs. `+0` as not equal (a == 0 ? (1 / a == 1 / b) : a == +b); case regexpClass: case stringClass: // coerce regexes to strings (http://es5.github.io/#x15.10.6.4) // treat string primitives and their corresponding object instances as equal return a == String(b); } var isArr = className == arrayClass; if (!isArr) { // exit for functions and DOM nodes if (className != objectClass || (!support.nodeClass && (isNode(a) || isNode(b)))) { return false; } // in older versions of Opera, `arguments` objects have `Array` constructors var ctorA = !support.argsObject && isArguments(a) ? Object : a.constructor, ctorB = !support.argsObject && isArguments(b) ? Object : b.constructor; // non `Object` object instances with different constructors are not equal if (ctorA != ctorB && !(hasOwnProperty.call(a, 'constructor') && hasOwnProperty.call(b, 'constructor')) && !(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) && ('constructor' in a && 'constructor' in b) ) { return false; } } // assume cyclic structures are equal // the algorithm for detecting cyclic structures is adapted from ES 5.1 // section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3) var initedStack = !stackA; stackA || (stackA = []); stackB || (stackB = []); var length = stackA.length; while (length--) { if (stackA[length] == a) { return stackB[length] == b; } } var size = 0; var result = true; // add `a` and `b` to the stack of traversed objects stackA.push(a); stackB.push(b); // recursively compare objects and arrays (susceptible to call stack limits) if (isArr) { // compare lengths to determine if a deep comparison is necessary length = a.length; size = b.length; result = size == length; if (result) { // deep compare the contents, ignoring non-numeric properties while (size--) { var index = length, value = b[size]; if (!(result = deepEquals(a[size], value, stackA, stackB))) { break; } } } } else { // deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys` // which, in this case, is more costly internalForIn(b, function(value, key, b) { if (hasOwnProperty.call(b, key)) { // count the number of properties. size++; // deep compare each property value. return (result = hasOwnProperty.call(a, key) && deepEquals(a[key], value, stackA, stackB)); } }); if (result) { // ensure both objects have the same number of properties internalForIn(a, function(value, key, a) { if (hasOwnProperty.call(a, key)) { // `size` will be `-1` if `a` has more properties than `b` return (result = --size > -1); } }); } } stackA.pop(); stackB.pop(); return result; } var hasProp = {}.hasOwnProperty, slice = Array.prototype.slice; var inherits = this.inherits = Rx.internals.inherits = function (child, parent) { function __() { this.constructor = child; } __.prototype = parent.prototype; child.prototype = new __(); }; var addProperties = Rx.internals.addProperties = function (obj) { for(var sources = [], i = 1, len = arguments.length; i < len; i++) { sources.push(arguments[i]); } for (var idx = 0, ln = sources.length; idx < ln; idx++) { var source = sources[idx]; for (var prop in source) { obj[prop] = source[prop]; } } }; // Rx Utils var addRef = Rx.internals.addRef = function (xs, r) { return new AnonymousObservable(function (observer) { return new CompositeDisposable(r.getDisposable(), xs.subscribe(observer)); }); }; function arrayInitialize(count, factory) { var a = new Array(count); for (var i = 0; i < count; i++) { a[i] = factory(); } return a; } var errorObj = {e: {}}; var tryCatchTarget; function tryCatcher() { try { return tryCatchTarget.apply(this, arguments); } catch (e) { errorObj.e = e; return errorObj; } } function tryCatch(fn) { if (!isFunction(fn)) { throw new TypeError('fn must be a function'); } tryCatchTarget = fn; return tryCatcher; } function thrower(e) { throw e; } // Utilities if (!Function.prototype.bind) { Function.prototype.bind = function (that) { var target = this, args = slice.call(arguments, 1); var bound = function () { if (this instanceof bound) { function F() { } F.prototype = target.prototype; var self = new F(); var result = target.apply(self, args.concat(slice.call(arguments))); if (Object(result) === result) { return result; } return self; } else { return target.apply(that, args.concat(slice.call(arguments))); } }; return bound; }; } if (!Array.prototype.forEach) { Array.prototype.forEach = function (callback, thisArg) { var T, k; if (this == null) { throw new TypeError(" this is null or not defined"); } var O = Object(this); var len = O.length >>> 0; if (typeof callback !== "function") { throw new TypeError(callback + " is not a function"); } if (arguments.length > 1) { T = thisArg; } k = 0; while (k < len) { var kValue; if (k in O) { kValue = O[k]; callback.call(T, kValue, k, O); } k++; } }; } var boxedString = Object("a"), splitString = boxedString[0] != "a" || !(0 in boxedString); if (!Array.prototype.every) { Array.prototype.every = function every(fun /*, thisp */) { var object = Object(this), self = splitString && {}.toString.call(this) == stringClass ? this.split("") : object, length = self.length >>> 0, thisp = arguments[1]; if ({}.toString.call(fun) != funcClass) { throw new TypeError(fun + " is not a function"); } for (var i = 0; i < length; i++) { if (i in self && !fun.call(thisp, self[i], i, object)) { return false; } } return true; }; } if (!Array.prototype.map) { Array.prototype.map = function map(fun /*, thisp*/) { var object = Object(this), self = splitString && {}.toString.call(this) == stringClass ? this.split("") : object, length = self.length >>> 0, result = Array(length), thisp = arguments[1]; if ({}.toString.call(fun) != funcClass) { throw new TypeError(fun + " is not a function"); } for (var i = 0; i < length; i++) { if (i in self) { result[i] = fun.call(thisp, self[i], i, object); } } return result; }; } if (!Array.prototype.filter) { Array.prototype.filter = function (predicate) { var results = [], item, t = new Object(this); for (var i = 0, len = t.length >>> 0; i < len; i++) { item = t[i]; if (i in t && predicate.call(arguments[1], item, i, t)) { results.push(item); } } return results; }; } if (!Array.isArray) { Array.isArray = function (arg) { return {}.toString.call(arg) == arrayClass; }; } if (!Array.prototype.indexOf) { Array.prototype.indexOf = function indexOf(searchElement) { var t = Object(this); var len = t.length >>> 0; if (len === 0) { return -1; } var n = 0; if (arguments.length > 1) { n = Number(arguments[1]); if (n !== n) { n = 0; } else if (n !== 0 && n != Infinity && n !== -Infinity) { n = (n > 0 || -1) * Math.floor(Math.abs(n)); } } if (n >= len) { return -1; } var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0); for (; k < len; k++) { if (k in t && t[k] === searchElement) { return k; } } return -1; }; } // Fix for Tessel if (!Object.prototype.propertyIsEnumerable) { Object.prototype.propertyIsEnumerable = function (key) { for (var k in this) { if (k === key) { return true; } } return false; }; } if (!Object.keys) { Object.keys = (function() { 'use strict'; var hasOwnProperty = Object.prototype.hasOwnProperty, hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString'); return function(obj) { if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) { throw new TypeError('Object.keys called on non-object'); } var result = [], prop, i; for (prop in obj) { if (hasOwnProperty.call(obj, prop)) { result.push(prop); } } if (hasDontEnumBug) { for (i = 0; i < dontEnumsLength; i++) { if (hasOwnProperty.call(obj, dontEnums[i])) { result.push(dontEnums[i]); } } } return result; }; }()); } // Collections function IndexedItem(id, value) { this.id = id; this.value = value; } IndexedItem.prototype.compareTo = function (other) { var c = this.value.compareTo(other.value); c === 0 && (c = this.id - other.id); return c; }; // Priority Queue for Scheduling var PriorityQueue = Rx.internals.PriorityQueue = function (capacity) { this.items = new Array(capacity); this.length = 0; }; var priorityProto = PriorityQueue.prototype; priorityProto.isHigherPriority = function (left, right) { return this.items[left].compareTo(this.items[right]) < 0; }; priorityProto.percolate = function (index) { if (index >= this.length || index < 0) { return; } var parent = index - 1 >> 1; if (parent < 0 || parent === index) { return; } if (this.isHigherPriority(index, parent)) { var temp = this.items[index]; this.items[index] = this.items[parent]; this.items[parent] = temp; this.percolate(parent); } }; priorityProto.heapify = function (index) { +index || (index = 0); if (index >= this.length || index < 0) { return; } var left = 2 * index + 1, right = 2 * index + 2, first = index; if (left < this.length && this.isHigherPriority(left, first)) { first = left; } if (right < this.length && this.isHigherPriority(right, first)) { first = right; } if (first !== index) { var temp = this.items[index]; this.items[index] = this.items[first]; this.items[first] = temp; this.heapify(first); } }; priorityProto.peek = function () { return this.items[0].value; }; priorityProto.removeAt = function (index) { this.items[index] = this.items[--this.length]; this.items[this.length] = undefined; this.heapify(); }; priorityProto.dequeue = function () { var result = this.peek(); this.removeAt(0); return result; }; priorityProto.enqueue = function (item) { var index = this.length++; this.items[index] = new IndexedItem(PriorityQueue.count++, item); this.percolate(index); }; priorityProto.remove = function (item) { for (var i = 0; i < this.length; i++) { if (this.items[i].value === item) { this.removeAt(i); return true; } } return false; }; PriorityQueue.count = 0; /** * Represents a group of disposable resources that are disposed together. * @constructor */ var CompositeDisposable = Rx.CompositeDisposable = function () { var args = [], i, len; if (Array.isArray(arguments[0])) { args = arguments[0]; len = args.length; } else { len = arguments.length; args = new Array(len); for(i = 0; i < len; i++) { args[i] = arguments[i]; } } for(i = 0; i < len; i++) { if (!isDisposable(args[i])) { throw new TypeError('Not a disposable'); } } this.disposables = args; this.isDisposed = false; this.length = args.length; }; var CompositeDisposablePrototype = CompositeDisposable.prototype; /** * Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed. * @param {Mixed} item Disposable to add. */ CompositeDisposablePrototype.add = function (item) { if (this.isDisposed) { item.dispose(); } else { this.disposables.push(item); this.length++; } }; /** * Removes and disposes the first occurrence of a disposable from the CompositeDisposable. * @param {Mixed} item Disposable to remove. * @returns {Boolean} true if found; false otherwise. */ CompositeDisposablePrototype.remove = function (item) { var shouldDispose = false; if (!this.isDisposed) { var idx = this.disposables.indexOf(item); if (idx !== -1) { shouldDispose = true; this.disposables.splice(idx, 1); this.length--; item.dispose(); } } return shouldDispose; }; /** * Disposes all disposables in the group and removes them from the group. */ CompositeDisposablePrototype.dispose = function () { if (!this.isDisposed) { this.isDisposed = true; var len = this.disposables.length, currentDisposables = new Array(len); for(var i = 0; i < len; i++) { currentDisposables[i] = this.disposables[i]; } this.disposables = []; this.length = 0; for (i = 0; i < len; i++) { currentDisposables[i].dispose(); } } }; /** * Provides a set of static methods for creating Disposables. * @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once. */ var Disposable = Rx.Disposable = function (action) { this.isDisposed = false; this.action = action || noop; }; /** Performs the task of cleaning up resources. */ Disposable.prototype.dispose = function () { if (!this.isDisposed) { this.action(); this.isDisposed = true; } }; /** * Creates a disposable object that invokes the specified action when disposed. * @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once. * @return {Disposable} The disposable object that runs the given action upon disposal. */ var disposableCreate = Disposable.create = function (action) { return new Disposable(action); }; /** * Gets the disposable that does nothing when disposed. */ var disposableEmpty = Disposable.empty = { dispose: noop }; /** * Validates whether the given object is a disposable * @param {Object} Object to test whether it has a dispose method * @returns {Boolean} true if a disposable object, else false. */ var isDisposable = Disposable.isDisposable = function (d) { return d && isFunction(d.dispose); }; var checkDisposed = Disposable.checkDisposed = function (disposable) { if (disposable.isDisposed) { throw new ObjectDisposedError(); } }; // Single assignment var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable = function () { this.isDisposed = false; this.current = null; }; SingleAssignmentDisposable.prototype.getDisposable = function () { return this.current; }; SingleAssignmentDisposable.prototype.setDisposable = function (value) { if (this.current) { throw new Error('Disposable has already been assigned'); } var shouldDispose = this.isDisposed; !shouldDispose && (this.current = value); shouldDispose && value && value.dispose(); }; SingleAssignmentDisposable.prototype.dispose = function () { if (!this.isDisposed) { this.isDisposed = true; var old = this.current; this.current = null; } old && old.dispose(); }; // Multiple assignment disposable var SerialDisposable = Rx.SerialDisposable = function () { this.isDisposed = false; this.current = null; }; SerialDisposable.prototype.getDisposable = function () { return this.current; }; SerialDisposable.prototype.setDisposable = function (value) { var shouldDispose = this.isDisposed; if (!shouldDispose) { var old = this.current; this.current = value; } old && old.dispose(); shouldDispose && value && value.dispose(); }; SerialDisposable.prototype.dispose = function () { if (!this.isDisposed) { this.isDisposed = true; var old = this.current; this.current = null; } old && old.dispose(); }; /** * Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed. */ var RefCountDisposable = Rx.RefCountDisposable = (function () { function InnerDisposable(disposable) { this.disposable = disposable; this.disposable.count++; this.isInnerDisposed = false; } InnerDisposable.prototype.dispose = function () { if (!this.disposable.isDisposed && !this.isInnerDisposed) { this.isInnerDisposed = true; this.disposable.count--; if (this.disposable.count === 0 && this.disposable.isPrimaryDisposed) { this.disposable.isDisposed = true; this.disposable.underlyingDisposable.dispose(); } } }; /** * Initializes a new instance of the RefCountDisposable with the specified disposable. * @constructor * @param {Disposable} disposable Underlying disposable. */ function RefCountDisposable(disposable) { this.underlyingDisposable = disposable; this.isDisposed = false; this.isPrimaryDisposed = false; this.count = 0; } /** * Disposes the underlying disposable only when all dependent disposables have been disposed */ RefCountDisposable.prototype.dispose = function () { if (!this.isDisposed && !this.isPrimaryDisposed) { this.isPrimaryDisposed = true; if (this.count === 0) { this.isDisposed = true; this.underlyingDisposable.dispose(); } } }; /** * Returns a dependent disposable that when disposed decreases the refcount on the underlying disposable. * @returns {Disposable} A dependent disposable contributing to the reference count that manages the underlying disposable's lifetime. */ RefCountDisposable.prototype.getDisposable = function () { return this.isDisposed ? disposableEmpty : new InnerDisposable(this); }; return RefCountDisposable; })(); function ScheduledDisposable(scheduler, disposable) { this.scheduler = scheduler; this.disposable = disposable; this.isDisposed = false; } function scheduleItem(s, self) { if (!self.isDisposed) { self.isDisposed = true; self.disposable.dispose(); } } ScheduledDisposable.prototype.dispose = function () { this.scheduler.scheduleWithState(this, scheduleItem); }; var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) { this.scheduler = scheduler; this.state = state; this.action = action; this.dueTime = dueTime; this.comparer = comparer || defaultSubComparer; this.disposable = new SingleAssignmentDisposable(); } ScheduledItem.prototype.invoke = function () { this.disposable.setDisposable(this.invokeCore()); }; ScheduledItem.prototype.compareTo = function (other) { return this.comparer(this.dueTime, other.dueTime); }; ScheduledItem.prototype.isCancelled = function () { return this.disposable.isDisposed; }; ScheduledItem.prototype.invokeCore = function () { return this.action(this.scheduler, this.state); }; /** Provides a set of static properties to access commonly used schedulers. */ var Scheduler = Rx.Scheduler = (function () { function Scheduler(now, schedule, scheduleRelative, scheduleAbsolute) { this.now = now; this._schedule = schedule; this._scheduleRelative = scheduleRelative; this._scheduleAbsolute = scheduleAbsolute; } /** Determines whether the given object is a scheduler */ Scheduler.isScheduler = function (s) { return s instanceof Scheduler; } function invokeAction(scheduler, action) { action(); return disposableEmpty; } var schedulerProto = Scheduler.prototype; /** * Schedules an action to be executed. * @param {Function} action Action to execute. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.schedule = function (action) { return this._schedule(action, invokeAction); }; /** * Schedules an action to be executed. * @param state State passed to the action to be executed. * @param {Function} action Action to be executed. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleWithState = function (state, action) { return this._schedule(state, action); }; /** * Schedules an action to be executed after the specified relative due time. * @param {Function} action Action to execute. * @param {Number} dueTime Relative time after which to execute the action. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleWithRelative = function (dueTime, action) { return this._scheduleRelative(action, dueTime, invokeAction); }; /** * Schedules an action to be executed after dueTime. * @param state State passed to the action to be executed. * @param {Function} action Action to be executed. * @param {Number} dueTime Relative time after which to execute the action. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleWithRelativeAndState = function (state, dueTime, action) { return this._scheduleRelative(state, dueTime, action); }; /** * Schedules an action to be executed at the specified absolute due time. * @param {Function} action Action to execute. * @param {Number} dueTime Absolute time at which to execute the action. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleWithAbsolute = function (dueTime, action) { return this._scheduleAbsolute(action, dueTime, invokeAction); }; /** * Schedules an action to be executed at dueTime. * @param {Mixed} state State passed to the action to be executed. * @param {Function} action Action to be executed. * @param {Number}dueTime Absolute time at which to execute the action. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleWithAbsoluteAndState = function (state, dueTime, action) { return this._scheduleAbsolute(state, dueTime, action); }; /** Gets the current time according to the local machine's system clock. */ Scheduler.now = defaultNow; /** * Normalizes the specified TimeSpan value to a positive value. * @param {Number} timeSpan The time span value to normalize. * @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0 */ Scheduler.normalize = function (timeSpan) { timeSpan < 0 && (timeSpan = 0); return timeSpan; }; return Scheduler; }()); var normalizeTime = Scheduler.normalize, isScheduler = Scheduler.isScheduler; (function (schedulerProto) { function invokeRecImmediate(scheduler, pair) { var state = pair[0], action = pair[1], group = new CompositeDisposable(); function recursiveAction(state1) { action(state1, function (state2) { var isAdded = false, isDone = false, d = scheduler.scheduleWithState(state2, function (scheduler1, state3) { if (isAdded) { group.remove(d); } else { isDone = true; } recursiveAction(state3); return disposableEmpty; }); if (!isDone) { group.add(d); isAdded = true; } }); } recursiveAction(state); return group; } function invokeRecDate(scheduler, pair, method) { var state = pair[0], action = pair[1], group = new CompositeDisposable(); function recursiveAction(state1) { action(state1, function (state2, dueTime1) { var isAdded = false, isDone = false, d = scheduler[method](state2, dueTime1, function (scheduler1, state3) { if (isAdded) { group.remove(d); } else { isDone = true; } recursiveAction(state3); return disposableEmpty; }); if (!isDone) { group.add(d); isAdded = true; } }); }; recursiveAction(state); return group; } function scheduleInnerRecursive(action, self) { action(function(dt) { self(action, dt); }); } /** * Schedules an action to be executed recursively. * @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleRecursive = function (action) { return this.scheduleRecursiveWithState(action, function (_action, self) { _action(function () { self(_action); }); }); }; /** * Schedules an action to be executed recursively. * @param {Mixed} state State passed to the action to be executed. * @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleRecursiveWithState = function (state, action) { return this.scheduleWithState([state, action], invokeRecImmediate); }; /** * Schedules an action to be executed recursively after a specified relative due time. * @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified relative time. * @param {Number}dueTime Relative time after which to execute the action for the first time. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleRecursiveWithRelative = function (dueTime, action) { return this.scheduleRecursiveWithRelativeAndState(action, dueTime, scheduleInnerRecursive); }; /** * Schedules an action to be executed recursively after a specified relative due time. * @param {Mixed} state State passed to the action to be executed. * @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state. * @param {Number}dueTime Relative time after which to execute the action for the first time. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleRecursiveWithRelativeAndState = function (state, dueTime, action) { return this._scheduleRelative([state, action], dueTime, function (s, p) { return invokeRecDate(s, p, 'scheduleWithRelativeAndState'); }); }; /** * Schedules an action to be executed recursively at a specified absolute due time. * @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified absolute time. * @param {Number}dueTime Absolute time at which to execute the action for the first time. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleRecursiveWithAbsolute = function (dueTime, action) { return this.scheduleRecursiveWithAbsoluteAndState(action, dueTime, scheduleInnerRecursive); }; /** * Schedules an action to be executed recursively at a specified absolute due time. * @param {Mixed} state State passed to the action to be executed. * @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state. * @param {Number}dueTime Absolute time at which to execute the action for the first time. * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). */ schedulerProto.scheduleRecursiveWithAbsoluteAndState = function (state, dueTime, action) { return this._scheduleAbsolute([state, action], dueTime, function (s, p) { return invokeRecDate(s, p, 'scheduleWithAbsoluteAndState'); }); }; }(Scheduler.prototype)); (function (schedulerProto) { /** * Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation. * @param {Number} period Period for running the work periodically. * @param {Function} action Action to be executed. * @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort). */ Scheduler.prototype.schedulePeriodic = function (period, action) { return this.schedulePeriodicWithState(null, period, action); }; /** * Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation. * @param {Mixed} state Initial state passed to the action upon the first iteration. * @param {Number} period Period for running the work periodically. * @param {Function} action Action to be executed, potentially updating the state. * @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort). */ Scheduler.prototype.schedulePeriodicWithState = function(state, period, action) { if (typeof root.setInterval === 'undefined') { throw new NotSupportedError(); } period = normalizeTime(period); var s = state, id = root.setInterval(function () { s = action(s); }, period); return disposableCreate(function () { root.clearInterval(id); }); }; }(Scheduler.prototype)); (function (schedulerProto) { /** * Returns a scheduler that wraps the original scheduler, adding exception handling for scheduled actions. * @param {Function} handler Handler that's run if an exception is caught. The exception will be rethrown if the handler returns false. * @returns {Scheduler} Wrapper around the original scheduler, enforcing exception handling. */ schedulerProto.catchError = schedulerProto['catch'] = function (handler) { return new CatchScheduler(this, handler); }; }(Scheduler.prototype)); var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () { function tick(command, recurse) { recurse(0, this._period); try { this._state = this._action(this._state); } catch (e) { this._cancel.dispose(); throw e; } } function SchedulePeriodicRecursive(scheduler, state, period, action) { this._scheduler = scheduler; this._state = state; this._period = period; this._action = action; } SchedulePeriodicRecursive.prototype.start = function () { var d = new SingleAssignmentDisposable(); this._cancel = d; d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this))); return d; }; return SchedulePeriodicRecursive; }()); /** Gets a scheduler that schedules work immediately on the current thread. */ var immediateScheduler = Scheduler.immediate = (function () { function scheduleNow(state, action) { return action(this, state); } return new Scheduler(defaultNow, scheduleNow, notSupported, notSupported); }()); /** * Gets a scheduler that schedules work as soon as possible on the current thread. */ var currentThreadScheduler = Scheduler.currentThread = (function () { var queue; function runTrampoline () { while (queue.length > 0) { var item = queue.dequeue(); !item.isCancelled() && item.invoke(); } } function scheduleNow(state, action) { var si = new ScheduledItem(this, state, action, this.now()); if (!queue) { queue = new PriorityQueue(4); queue.enqueue(si); var result = tryCatch(runTrampoline)(); queue = null; if (result === errorObj) { return thrower(result.e); } } else { queue.enqueue(si); } return si.disposable; } var currentScheduler = new Scheduler(defaultNow, scheduleNow, notSupported, notSupported); currentScheduler.scheduleRequired = function () { return !queue; }; return currentScheduler; }()); var scheduleMethod, clearMethod; var localTimer = (function () { var localSetTimeout, localClearTimeout = noop; if (!!root.setTimeout) { localSetTimeout = root.setTimeout; localClearTimeout = root.clearTimeout; } else if (!!root.WScript) { localSetTimeout = function (fn, time) { root.WScript.Sleep(time); fn(); }; } else { throw new NotSupportedError(); } return { setTimeout: localSetTimeout, clearTimeout: localClearTimeout }; }()); var localSetTimeout = localTimer.setTimeout, localClearTimeout = localTimer.clearTimeout; (function () { var nextHandle = 1, tasksByHandle = {}, currentlyRunning = false; clearMethod = function (handle) { delete tasksByHandle[handle]; }; function runTask(handle) { if (currentlyRunning) { localSetTimeout(function () { runTask(handle) }, 0); } else { var task = tasksByHandle[handle]; if (task) { currentlyRunning = true; var result = tryCatch(task)(); clearMethod(handle); currentlyRunning = false; if (result === errorObj) { return thrower(result.e); } } } } var reNative = RegExp('^' + String(toString) .replace(/[.*+?^${}()|[\]\\]/g, '\\$&') .replace(/toString| for [^\]]+/g, '.*?') + '$' ); var setImmediate = typeof (setImmediate = freeGlobal && moduleExports && freeGlobal.setImmediate) == 'function' && !reNative.test(setImmediate) && setImmediate; function postMessageSupported () { // Ensure not in a worker if (!root.postMessage || root.importScripts) { return false; } var isAsync = false, oldHandler = root.onmessage; // Test for async root.onmessage = function () { isAsync = true; }; root.postMessage('', '*'); root.onmessage = oldHandler; return isAsync; } // Use in order, setImmediate, nextTick, postMessage, MessageChannel, script readystatechanged, setTimeout if (isFunction(setImmediate)) { scheduleMethod = function (action) { var id = nextHandle++; tasksByHandle[id] = action; setImmediate(function () { runTask(id); }); return id; }; } else if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') { scheduleMethod = function (action) { var id = nextHandle++; tasksByHandle[id] = action; process.nextTick(function () { runTask(id); }); return id; }; } else if (postMessageSupported()) { var MSG_PREFIX = 'ms.rx.schedule' + Math.random(); function onGlobalPostMessage(event) { // Only if we're a match to avoid any other global events if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) { runTask(event.data.substring(MSG_PREFIX.length)); } } if (root.addEventListener) { root.addEventListener('message', onGlobalPostMessage, false); } else if (root.attachEvent) { root.attachEvent('onmessage', onGlobalPostMessage); } else { root.onmessage = onGlobalPostMessage; } scheduleMethod = function (action) { var id = nextHandle++; tasksByHandle[id] = action; root.postMessage(MSG_PREFIX + currentId, '*'); return id; }; } else if (!!root.MessageChannel) { var channel = new root.MessageChannel(); channel.port1.onmessage = function (e) { runTask(e.data); }; scheduleMethod = function (action) { var id = nextHandle++; tasksByHandle[id] = action; channel.port2.postMessage(id); return id; }; } else if ('document' in root && 'onreadystatechange' in root.document.createElement('script')) { scheduleMethod = function (action) { var scriptElement = root.document.createElement('script'); var id = nextHandle++; tasksByHandle[id] = action; scriptElement.onreadystatechange = function () { runTask(id); scriptElement.onreadystatechange = null; scriptElement.parentNode.removeChild(scriptElement); scriptElement = null; }; root.document.documentElement.appendChild(scriptElement); return id; }; } else { scheduleMethod = function (action) { var id = nextHandle++; tasksByHandle[id] = action; localSetTimeout(function () { runTask(id); }, 0); return id; }; } }()); /** * Gets a scheduler that schedules work via a timed callback based upon platform. */ var timeoutScheduler = Scheduler.timeout = Scheduler['default'] = (function () { function scheduleNow(state, action) { var scheduler = this, disposable = new SingleAssignmentDisposable(); var id = scheduleMethod(function () { !disposable.isDisposed && disposable.setDisposable(action(scheduler, state)); }); return new CompositeDisposable(disposable, disposableCreate(function () { clearMethod(id); })); } function scheduleRelative(state, dueTime, action) { var scheduler = this, dt = Scheduler.normalize(dueTime), disposable = new SingleAssignmentDisposable(); if (dt === 0) { return scheduler.scheduleWithState(state, action); } var id = localSetTimeout(function () { !disposable.isDisposed && disposable.setDisposable(action(scheduler, state)); }, dt); return new CompositeDisposable(disposable, disposableCreate(function () { localClearTimeout(id); })); } function scheduleAbsolute(state, dueTime, action) { return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action); } return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute); })(); var CatchScheduler = (function (__super__) { function scheduleNow(state, action) { return this._scheduler.scheduleWithState(state, this._wrap(action)); } function scheduleRelative(state, dueTime, action) { return this._scheduler.scheduleWithRelativeAndState(state, dueTime, this._wrap(action)); } function scheduleAbsolute(state, dueTime, action) { return this._scheduler.scheduleWithAbsoluteAndState(state, dueTime, this._wrap(action)); } inherits(CatchScheduler, __super__); function CatchScheduler(scheduler, handler) { this._scheduler = scheduler; this._handler = handler; this._recursiveOriginal = null; this._recursiveWrapper = null; __super__.call(this, this._scheduler.now.bind(this._scheduler), scheduleNow, scheduleRelative, scheduleAbsolute); } CatchScheduler.prototype._clone = function (scheduler) { return new CatchScheduler(scheduler, this._handler); }; CatchScheduler.prototype._wrap = function (action) { var parent = this; return function (self, state) { try { return action(parent._getRecursiveWrapper(self), state); } catch (e) { if (!parent._handler(e)) { throw e; } return disposableEmpty; } }; }; CatchScheduler.prototype._getRecursiveWrapper = function (scheduler) { if (this._recursiveOriginal !== scheduler) { this._recursiveOriginal = scheduler; var wrapper = this._clone(scheduler); wrapper._recursiveOriginal = scheduler; wrapper._recursiveWrapper = wrapper; this._recursiveWrapper = wrapper; } return this._recursiveWrapper; }; CatchScheduler.prototype.schedulePeriodicWithState = function (state, period, action) { var self = this, failed = false, d = new SingleAssignmentDisposable(); d.setDisposable(this._scheduler.schedulePeriodicWithState(state, period, function (state1) { if (failed) { return null; } try { return action(state1); } catch (e) { failed = true; if (!self._handler(e)) { throw e; } d.dispose(); return null; } })); return d; }; return CatchScheduler; }(Scheduler)); /** * Represents a notification to an observer. */ var Notification = Rx.Notification = (function () { function Notification(kind, value, exception, accept, acceptObservable, toString) { this.kind = kind; this.value = value; this.exception = exception; this._accept = accept; this._acceptObservable = acceptObservable; this.toString = toString; } /** * Invokes the delegate corresponding to the notification or the observer's method corresponding to the notification and returns the produced result. * * @memberOf Notification * @param {Any} observerOrOnNext Delegate to invoke for an OnNext notification or Observer to invoke the notification on.. * @param {Function} onError Delegate to invoke for an OnError notification. * @param {Function} onCompleted Delegate to invoke for an OnCompleted notification. * @returns {Any} Result produced by the observation. */ Notification.prototype.accept = function (observerOrOnNext, onError, onCompleted) { return observerOrOnNext && typeof observerOrOnNext === 'object' ? this._acceptObservable(observerOrOnNext) : this._accept(observerOrOnNext, onError, onCompleted); }; /** * Returns an observable sequence with a single notification. * * @memberOf Notifications * @param {Scheduler} [scheduler] Scheduler to send out the notification calls on. * @returns {Observable} The observable sequence that surfaces the behavior of the notification upon subscription. */ Notification.prototype.toObservable = function (scheduler) { var self = this; isScheduler(scheduler) || (scheduler = immediateScheduler); return new AnonymousObservable(function (observer) { return scheduler.scheduleWithState(self, function (_, notification) { notification._acceptObservable(observer); notification.kind === 'N' && observer.onCompleted(); }); }); }; return Notification; })(); /** * Creates an object that represents an OnNext notification to an observer. * @param {Any} value The value contained in the notification. * @returns {Notification} The OnNext notification containing the value. */ var notificationCreateOnNext = Notification.createOnNext = (function () { function _accept(onNext) { return onNext(this.value); } function _acceptObservable(observer) { return observer.onNext(this.value); } function toString() { return 'OnNext(' + this.value + ')'; } return function (value) { return new Notification('N', value, null, _accept, _acceptObservable, toString); }; }()); /** * Creates an object that represents an OnError notification to an observer. * @param {Any} error The exception contained in the notification. * @returns {Notification} The OnError notification containing the exception. */ var notificationCreateOnError = Notification.createOnError = (function () { function _accept (onNext, onError) { return onError(this.exception); } function _acceptObservable(observer) { return observer.onError(this.exception); } function toString () { return 'OnError(' + this.exception + ')'; } return function (e) { return new Notification('E', null, e, _accept, _acceptObservable, toString); }; }()); /** * Creates an object that represents an OnCompleted notification to an observer. * @returns {Notification} The OnCompleted notification. */ var notificationCreateOnCompleted = Notification.createOnCompleted = (function () { function _accept (onNext, onError, onCompleted) { return onCompleted(); } function _acceptObservable(observer) { return observer.onCompleted(); } function toString () { return 'OnCompleted()'; } return function () { return new Notification('C', null, null, _accept, _acceptObservable, toString); }; }()); var Enumerator = Rx.internals.Enumerator = function (next) { this._next = next; }; Enumerator.prototype.next = function () { return this._next(); }; Enumerator.prototype[$iterator$] = function () { return this; } var Enumerable = Rx.internals.Enumerable = function (iterator) { this._iterator = iterator; }; Enumerable.prototype[$iterator$] = function () { return this._iterator(); }; Enumerable.prototype.concat = function () { var sources = this; return new AnonymousObservable(function (o) { var e = sources[$iterator$](); var isDisposed, subscription = new SerialDisposable(); var cancelable = immediateScheduler.scheduleRecursive(function (self) { if (isDisposed) { return; } try { var currentItem = e.next(); } catch (ex) { return o.onError(ex); } if (currentItem.done) { return o.onCompleted(); } // Check if promise var currentValue = currentItem.value; isPromise(currentValue) && (currentValue = observableFromPromise(currentValue)); var d = new SingleAssignmentDisposable(); subscription.setDisposable(d); d.setDisposable(currentValue.subscribe( function(x) { o.onNext(x); }, function(err) { o.onError(err); }, self) ); }); return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { isDisposed = true; })); }); }; Enumerable.prototype.catchError = function () { var sources = this; return new AnonymousObservable(function (o) { var e = sources[$iterator$](); var isDisposed, subscription = new SerialDisposable(); var cancelable = immediateScheduler.scheduleRecursiveWithState(null, function (lastException, self) { if (isDisposed) { return; } try { var currentItem = e.next(); } catch (ex) { return observer.onError(ex); } if (currentItem.done) { if (lastException !== null) { o.onError(lastException); } else { o.onCompleted(); } return; } // Check if promise var currentValue = currentItem.value; isPromise(currentValue) && (currentValue = observableFromPromise(currentValue)); var d = new SingleAssignmentDisposable(); subscription.setDisposable(d); d.setDisposable(currentValue.subscribe( function(x) { o.onNext(x); }, self, function() { o.onCompleted(); })); }); return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { isDisposed = true; })); }); }; Enumerable.prototype.catchErrorWhen = function (notificationHandler) { var sources = this; return new AnonymousObservable(function (o) { var exceptions = new Subject(), notifier = new Subject(), handled = notificationHandler(exceptions), notificationDisposable = handled.subscribe(notifier); var e = sources[$iterator$](); var isDisposed, lastException, subscription = new SerialDisposable(); var cancelable = immediateScheduler.scheduleRecursive(function (self) { if (isDisposed) { return; } try { var currentItem = e.next(); } catch (ex) { return o.onError(ex); } if (currentItem.done) { if (lastException) { o.onError(lastException); } else { o.onCompleted(); } return; } // Check if promise var currentValue = currentItem.value; isPromise(currentValue) && (currentValue = observableFromPromise(currentValue)); var outer = new SingleAssignmentDisposable(); var inner = new SingleAssignmentDisposable(); subscription.setDisposable(new CompositeDisposable(inner, outer)); outer.setDisposable(currentValue.subscribe( function(x) { o.onNext(x); }, function (exn) { inner.setDisposable(notifier.subscribe(self, function(ex) { o.onError(ex); }, function() { o.onCompleted(); })); exceptions.onNext(exn); }, function() { o.onCompleted(); })); }); return new CompositeDisposable(notificationDisposable, subscription, cancelable, disposableCreate(function () { isDisposed = true; })); }); }; var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) { if (repeatCount == null) { repeatCount = -1; } return new Enumerable(function () { var left = repeatCount; return new Enumerator(function () { if (left === 0) { return doneEnumerator; } if (left > 0) { left--; } return { done: false, value: value }; }); }); }; var enumerableOf = Enumerable.of = function (source, selector, thisArg) { if (selector) { var selectorFn = bindCallback(selector, thisArg, 3); } return new Enumerable(function () { var index = -1; return new Enumerator( function () { return ++index < source.length ? { done: false, value: !selector ? source[index] : selectorFn(source[index], index, source) } : doneEnumerator; }); }); }; /** * Supports push-style iteration over an observable sequence. */ var Observer = Rx.Observer = function () { }; /** * Creates a notification callback from an observer. * @returns The action that forwards its input notification to the underlying observer. */ Observer.prototype.toNotifier = function () { var observer = this; return function (n) { return n.accept(observer); }; }; /** * Hides the identity of an observer. * @returns An observer that hides the identity of the specified observer. */ Observer.prototype.asObserver = function () { return new AnonymousObserver(this.onNext.bind(this), this.onError.bind(this), this.onCompleted.bind(this)); }; /** * Checks access to the observer for grammar violations. This includes checking for multiple OnError or OnCompleted calls, as well as reentrancy in any of the observer methods. * If a violation is detected, an Error is thrown from the offending observer method call. * @returns An observer that checks callbacks invocations against the observer grammar and, if the checks pass, forwards those to the specified observer. */ Observer.prototype.checked = function () { return new CheckedObserver(this); }; /** * Creates an observer from the specified OnNext, along with optional OnError, and OnCompleted actions. * @param {Function} [onNext] Observer's OnNext action implementation. * @param {Function} [onError] Observer's OnError action implementation. * @param {Function} [onCompleted] Observer's OnCompleted action implementation. * @returns {Observer} The observer object implemented using the given actions. */ var observerCreate = Observer.create = function (onNext, onError, onCompleted) { onNext || (onNext = noop); onError || (onError = defaultError); onCompleted || (onCompleted = noop); return new AnonymousObserver(onNext, onError, onCompleted); }; /** * Creates an observer from a notification callback. * * @static * @memberOf Observer * @param {Function} handler Action that handles a notification. * @returns The observer object that invokes the specified handler using a notification corresponding to each message it receives. */ Observer.fromNotifier = function (handler, thisArg) { return new AnonymousObserver(function (x) { return handler.call(thisArg, notificationCreateOnNext(x)); }, function (e) { return handler.call(thisArg, notificationCreateOnError(e)); }, function () { return handler.call(thisArg, notificationCreateOnCompleted()); }); }; /** * Schedules the invocation of observer methods on the given scheduler. * @param {Scheduler} scheduler Scheduler to schedule observer messages on. * @returns {Observer} Observer whose messages are scheduled on the given scheduler. */ Observer.prototype.notifyOn = function (scheduler) { return new ObserveOnObserver(scheduler, this); }; Observer.prototype.makeSafe = function(disposable) { return new AnonymousSafeObserver(this._onNext, this._onError, this._onCompleted, disposable); }; /** * Abstract base class for implementations of the Observer class. * This base class enforces the grammar of observers where OnError and OnCompleted are terminal messages. */ var AbstractObserver = Rx.internals.AbstractObserver = (function (__super__) { inherits(AbstractObserver, __super__); /** * Creates a new observer in a non-stopped state. */ function AbstractObserver() { this.isStopped = false; __super__.call(this); } // Must be implemented by other observers AbstractObserver.prototype.next = notImplemented; AbstractObserver.prototype.error = notImplemented; AbstractObserver.prototype.completed = notImplemented; /** * Notifies the observer of a new element in the sequence. * @param {Any} value Next element in the sequence. */ AbstractObserver.prototype.onNext = function (value) { if (!this.isStopped) { this.next(value); } }; /** * Notifies the observer that an exception has occurred. * @param {Any} error The error that has occurred. */ AbstractObserver.prototype.onError = function (error) { if (!this.isStopped) { this.isStopped = true; this.error(error); } }; /** * Notifies the observer of the end of the sequence. */ AbstractObserver.prototype.onCompleted = function () { if (!this.isStopped) { this.isStopped = true; this.completed(); } }; /** * Disposes the observer, causing it to transition to the stopped state. */ AbstractObserver.prototype.dispose = function () { this.isStopped = true; }; AbstractObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.error(e); return true; } return false; }; return AbstractObserver; }(Observer)); /** * Class to create an Observer instance from delegate-based implementations of the on* methods. */ var AnonymousObserver = Rx.AnonymousObserver = (function (__super__) { inherits(AnonymousObserver, __super__); /** * Creates an observer from the specified OnNext, OnError, and OnCompleted actions. * @param {Any} onNext Observer's OnNext action implementation. * @param {Any} onError Observer's OnError action implementation. * @param {Any} onCompleted Observer's OnCompleted action implementation. */ function AnonymousObserver(onNext, onError, onCompleted) { __super__.call(this); this._onNext = onNext; this._onError = onError; this._onCompleted = onCompleted; } /** * Calls the onNext action. * @param {Any} value Next element in the sequence. */ AnonymousObserver.prototype.next = function (value) { this._onNext(value); }; /** * Calls the onError action. * @param {Any} error The error that has occurred. */ AnonymousObserver.prototype.error = function (error) { this._onError(error); }; /** * Calls the onCompleted action. */ AnonymousObserver.prototype.completed = function () { this._onCompleted(); }; return AnonymousObserver; }(AbstractObserver)); var CheckedObserver = (function (__super__) { inherits(CheckedObserver, __super__); function CheckedObserver(observer) { __super__.call(this); this._observer = observer; this._state = 0; // 0 - idle, 1 - busy, 2 - done } var CheckedObserverPrototype = CheckedObserver.prototype; CheckedObserverPrototype.onNext = function (value) { this.checkAccess(); var res = tryCatch(this._observer.onNext).call(this._observer, value); this._state = 0; res === errorObj && thrower(res.e); }; CheckedObserverPrototype.onError = function (err) { this.checkAccess(); var res = tryCatch(this._observer.onError).call(this._observer, err); this._state = 2; res === errorObj && thrower(res.e); }; CheckedObserverPrototype.onCompleted = function () { this.checkAccess(); var res = tryCatch(this._observer.onCompleted).call(this._observer); this._state = 2; res === errorObj && thrower(res.e); }; CheckedObserverPrototype.checkAccess = function () { if (this._state === 1) { throw new Error('Re-entrancy detected'); } if (this._state === 2) { throw new Error('Observer completed'); } if (this._state === 0) { this._state = 1; } }; return CheckedObserver; }(Observer)); var ScheduledObserver = Rx.internals.ScheduledObserver = (function (__super__) { inherits(ScheduledObserver, __super__); function ScheduledObserver(scheduler, observer) { __super__.call(this); this.scheduler = scheduler; this.observer = observer; this.isAcquired = false; this.hasFaulted = false; this.queue = []; this.disposable = new SerialDisposable(); } ScheduledObserver.prototype.next = function (value) { var self = this; this.queue.push(function () { self.observer.onNext(value); }); }; ScheduledObserver.prototype.error = function (e) { var self = this; this.queue.push(function () { self.observer.onError(e); }); }; ScheduledObserver.prototype.completed = function () { var self = this; this.queue.push(function () { self.observer.onCompleted(); }); }; ScheduledObserver.prototype.ensureActive = function () { var isOwner = false, parent = this; if (!this.hasFaulted && this.queue.length > 0) { isOwner = !this.isAcquired; this.isAcquired = true; } if (isOwner) { this.disposable.setDisposable(this.scheduler.scheduleRecursive(function (self) { var work; if (parent.queue.length > 0) { work = parent.queue.shift(); } else { parent.isAcquired = false; return; } try { work(); } catch (ex) { parent.queue = []; parent.hasFaulted = true; throw ex; } self(); })); } }; ScheduledObserver.prototype.dispose = function () { __super__.prototype.dispose.call(this); this.disposable.dispose(); }; return ScheduledObserver; }(AbstractObserver)); var ObserveOnObserver = (function (__super__) { inherits(ObserveOnObserver, __super__); function ObserveOnObserver(scheduler, observer, cancel) { __super__.call(this, scheduler, observer); this._cancel = cancel; } ObserveOnObserver.prototype.next = function (value) { __super__.prototype.next.call(this, value); this.ensureActive(); }; ObserveOnObserver.prototype.error = function (e) { __super__.prototype.error.call(this, e); this.ensureActive(); }; ObserveOnObserver.prototype.completed = function () { __super__.prototype.completed.call(this); this.ensureActive(); }; ObserveOnObserver.prototype.dispose = function () { __super__.prototype.dispose.call(this); this._cancel && this._cancel.dispose(); this._cancel = null; }; return ObserveOnObserver; })(ScheduledObserver); var observableProto; /** * Represents a push-style collection. */ var Observable = Rx.Observable = (function () { function Observable(subscribe) { if (Rx.config.longStackSupport && hasStacks) { try { throw new Error(); } catch (e) { this.stack = e.stack.substring(e.stack.indexOf("\n") + 1); } var self = this; this._subscribe = function (observer) { var oldOnError = observer.onError.bind(observer); observer.onError = function (err) { makeStackTraceLong(err, self); oldOnError(err); }; return subscribe.call(self, observer); }; } else { this._subscribe = subscribe; } } observableProto = Observable.prototype; /** * Subscribes an observer to the observable sequence. * @param {Mixed} [observerOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence. * @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence. * @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. * @returns {Diposable} A disposable handling the subscriptions and unsubscriptions. */ observableProto.subscribe = observableProto.forEach = function (observerOrOnNext, onError, onCompleted) { return this._subscribe(typeof observerOrOnNext === 'object' ? observerOrOnNext : observerCreate(observerOrOnNext, onError, onCompleted)); }; /** * Subscribes to the next value in the sequence with an optional "this" argument. * @param {Function} onNext The function to invoke on each element in the observable sequence. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Disposable} A disposable handling the subscriptions and unsubscriptions. */ observableProto.subscribeOnNext = function (onNext, thisArg) { return this._subscribe(observerCreate(typeof thisArg !== 'undefined' ? function(x) { onNext.call(thisArg, x); } : onNext)); }; /** * Subscribes to an exceptional condition in the sequence with an optional "this" argument. * @param {Function} onError The function to invoke upon exceptional termination of the observable sequence. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Disposable} A disposable handling the subscriptions and unsubscriptions. */ observableProto.subscribeOnError = function (onError, thisArg) { return this._subscribe(observerCreate(null, typeof thisArg !== 'undefined' ? function(e) { onError.call(thisArg, e); } : onError)); }; /** * Subscribes to the next value in the sequence with an optional "this" argument. * @param {Function} onCompleted The function to invoke upon graceful termination of the observable sequence. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Disposable} A disposable handling the subscriptions and unsubscriptions. */ observableProto.subscribeOnCompleted = function (onCompleted, thisArg) { return this._subscribe(observerCreate(null, null, typeof thisArg !== 'undefined' ? function() { onCompleted.call(thisArg); } : onCompleted)); }; return Observable; })(); var ObservableBase = Rx.ObservableBase = (function (__super__) { inherits(ObservableBase, __super__); function fixSubscriber(subscriber) { return subscriber && isFunction(subscriber.dispose) ? subscriber : isFunction(subscriber) ? disposableCreate(subscriber) : disposableEmpty; } function setDisposable(s, state) { var ado = state[0], self = state[1]; var sub = tryCatch(self.subscribeCore).call(self, ado); if (sub === errorObj) { if(!ado.fail(errorObj.e)) { return thrower(errorObj.e); } } ado.setDisposable(fixSubscriber(sub)); } function subscribe(observer) { var ado = new AutoDetachObserver(observer), state = [ado, this]; if (currentThreadScheduler.scheduleRequired()) { currentThreadScheduler.scheduleWithState(state, setDisposable); } else { setDisposable(null, state); } return ado; } function ObservableBase() { __super__.call(this, subscribe); } ObservableBase.prototype.subscribeCore = notImplemented; return ObservableBase; }(Observable)); /** * Wraps the source sequence in order to run its observer callbacks on the specified scheduler. * * This only invokes observer callbacks on a scheduler. In case the subscription and/or unsubscription actions have side-effects * that require to be run on a scheduler, use subscribeOn. * * @param {Scheduler} scheduler Scheduler to notify observers on. * @returns {Observable} The source sequence whose observations happen on the specified scheduler. */ observableProto.observeOn = function (scheduler) { var source = this; return new AnonymousObservable(function (observer) { return source.subscribe(new ObserveOnObserver(scheduler, observer)); }, source); }; /** * Wraps the source sequence in order to run its subscription and unsubscription logic on the specified scheduler. This operation is not commonly used; * see the remarks section for more information on the distinction between subscribeOn and observeOn. * This only performs the side-effects of subscription and unsubscription on the specified scheduler. In order to invoke observer * callbacks on a scheduler, use observeOn. * @param {Scheduler} scheduler Scheduler to perform subscription and unsubscription actions on. * @returns {Observable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler. */ observableProto.subscribeOn = function (scheduler) { var source = this; return new AnonymousObservable(function (observer) { var m = new SingleAssignmentDisposable(), d = new SerialDisposable(); d.setDisposable(m); m.setDisposable(scheduler.schedule(function () { d.setDisposable(new ScheduledDisposable(scheduler, source.subscribe(observer))); })); return d; }, source); }; /** * Converts a Promise to an Observable sequence * @param {Promise} An ES6 Compliant promise. * @returns {Observable} An Observable sequence which wraps the existing promise success and failure. */ var observableFromPromise = Observable.fromPromise = function (promise) { return observableDefer(function () { var subject = new Rx.AsyncSubject(); promise.then( function (value) { subject.onNext(value); subject.onCompleted(); }, subject.onError.bind(subject)); return subject; }); }; /* * Converts an existing observable sequence to an ES6 Compatible Promise * @example * var promise = Rx.Observable.return(42).toPromise(RSVP.Promise); * * // With config * Rx.config.Promise = RSVP.Promise; * var promise = Rx.Observable.return(42).toPromise(); * @param {Function} [promiseCtor] The constructor of the promise. If not provided, it looks for it in Rx.config.Promise. * @returns {Promise} An ES6 compatible promise with the last value from the observable sequence. */ observableProto.toPromise = function (promiseCtor) { promiseCtor || (promiseCtor = Rx.config.Promise); if (!promiseCtor) { throw new NotSupportedError('Promise type not provided nor in Rx.config.Promise'); } var source = this; return new promiseCtor(function (resolve, reject) { // No cancellation can be done var value, hasValue = false; source.subscribe(function (v) { value = v; hasValue = true; }, reject, function () { hasValue && resolve(value); }); }); }; var ToArrayObservable = (function(__super__) { inherits(ToArrayObservable, __super__); function ToArrayObservable(source) { this.source = source; __super__.call(this); } ToArrayObservable.prototype.subscribeCore = function(observer) { return this.source.subscribe(new ToArrayObserver(observer)); }; return ToArrayObservable; }(ObservableBase)); function ToArrayObserver(observer) { this.observer = observer; this.a = []; this.isStopped = false; } ToArrayObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.a.push(x); } }; ToArrayObserver.prototype.onError = function (e) { if (!this.isStopped) { this.isStopped = true; this.observer.onError(e); } }; ToArrayObserver.prototype.onCompleted = function () { if (!this.isStopped) { this.isStopped = true; this.observer.onNext(this.a); this.observer.onCompleted(); } }; ToArrayObserver.prototype.dispose = function () { this.isStopped = true; } ToArrayObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.observer.onError(e); return true; } return false; }; /** * Creates an array from an observable sequence. * @returns {Observable} An observable sequence containing a single element with a list containing all the elements of the source sequence. */ observableProto.toArray = function () { return new ToArrayObservable(this); }; /** * Creates an observable sequence from a specified subscribe method implementation. * @example * var res = Rx.Observable.create(function (observer) { return function () { } ); * var res = Rx.Observable.create(function (observer) { return Rx.Disposable.empty; } ); * var res = Rx.Observable.create(function (observer) { } ); * @param {Function} subscribe Implementation of the resulting observable sequence's subscribe method, returning a function that will be wrapped in a Disposable. * @returns {Observable} The observable sequence with the specified implementation for the Subscribe method. */ Observable.create = Observable.createWithDisposable = function (subscribe, parent) { return new AnonymousObservable(subscribe, parent); }; /** * Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes. * * @example * var res = Rx.Observable.defer(function () { return Rx.Observable.fromArray([1,2,3]); }); * @param {Function} observableFactory Observable factory function to invoke for each observer that subscribes to the resulting sequence or Promise. * @returns {Observable} An observable sequence whose observers trigger an invocation of the given observable factory function. */ var observableDefer = Observable.defer = function (observableFactory) { return new AnonymousObservable(function (observer) { var result; try { result = observableFactory(); } catch (e) { return observableThrow(e).subscribe(observer); } isPromise(result) && (result = observableFromPromise(result)); return result.subscribe(observer); }); }; var EmptyObservable = (function(__super__) { inherits(EmptyObservable, __super__); function EmptyObservable(scheduler) { this.scheduler = scheduler; __super__.call(this); } EmptyObservable.prototype.subscribeCore = function (observer) { var sink = new EmptySink(observer, this); return sink.run(); }; function EmptySink(observer, parent) { this.observer = observer; this.parent = parent; } function scheduleItem(s, state) { state.onCompleted(); } EmptySink.prototype.run = function () { return this.parent.scheduler.scheduleWithState(this.observer, scheduleItem); }; return EmptyObservable; }(ObservableBase)); /** * Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message. * * @example * var res = Rx.Observable.empty(); * var res = Rx.Observable.empty(Rx.Scheduler.timeout); * @param {Scheduler} [scheduler] Scheduler to send the termination call on. * @returns {Observable} An observable sequence with no elements. */ var observableEmpty = Observable.empty = function (scheduler) { isScheduler(scheduler) || (scheduler = immediateScheduler); return new EmptyObservable(scheduler); }; var FromObservable = (function(__super__) { inherits(FromObservable, __super__); function FromObservable(iterable, mapper, scheduler) { this.iterable = iterable; this.mapper = mapper; this.scheduler = scheduler; __super__.call(this); } FromObservable.prototype.subscribeCore = function (observer) { var sink = new FromSink(observer, this); return sink.run(); }; return FromObservable; }(ObservableBase)); var FromSink = (function () { function FromSink(observer, parent) { this.observer = observer; this.parent = parent; } FromSink.prototype.run = function () { var list = Object(this.parent.iterable), it = getIterable(list), observer = this.observer, mapper = this.parent.mapper; function loopRecursive(i, recurse) { try { var next = it.next(); } catch (e) { return observer.onError(e); } if (next.done) { return observer.onCompleted(); } var result = next.value; if (mapper) { try { result = mapper(result, i); } catch (e) { return observer.onError(e); } } observer.onNext(result); recurse(i + 1); } return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive); }; return FromSink; }()); var maxSafeInteger = Math.pow(2, 53) - 1; function StringIterable(str) { this._s = s; } StringIterable.prototype[$iterator$] = function () { return new StringIterator(this._s); }; function StringIterator(str) { this._s = s; this._l = s.length; this._i = 0; } StringIterator.prototype[$iterator$] = function () { return this; }; StringIterator.prototype.next = function () { return this._i < this._l ? { done: false, value: this._s.charAt(this._i++) } : doneEnumerator; }; function ArrayIterable(a) { this._a = a; } ArrayIterable.prototype[$iterator$] = function () { return new ArrayIterator(this._a); }; function ArrayIterator(a) { this._a = a; this._l = toLength(a); this._i = 0; } ArrayIterator.prototype[$iterator$] = function () { return this; }; ArrayIterator.prototype.next = function () { return this._i < this._l ? { done: false, value: this._a[this._i++] } : doneEnumerator; }; function numberIsFinite(value) { return typeof value === 'number' && root.isFinite(value); } function isNan(n) { return n !== n; } function getIterable(o) { var i = o[$iterator$], it; if (!i && typeof o === 'string') { it = new StringIterable(o); return it[$iterator$](); } if (!i && o.length !== undefined) { it = new ArrayIterable(o); return it[$iterator$](); } if (!i) { throw new TypeError('Object is not iterable'); } return o[$iterator$](); } function sign(value) { var number = +value; if (number === 0) { return number; } if (isNaN(number)) { return number; } return number < 0 ? -1 : 1; } function toLength(o) { var len = +o.length; if (isNaN(len)) { return 0; } if (len === 0 || !numberIsFinite(len)) { return len; } len = sign(len) * Math.floor(Math.abs(len)); if (len <= 0) { return 0; } if (len > maxSafeInteger) { return maxSafeInteger; } return len; } /** * This method creates a new Observable sequence from an array-like or iterable object. * @param {Any} arrayLike An array-like or iterable object to convert to an Observable sequence. * @param {Function} [mapFn] Map function to call on every element of the array. * @param {Any} [thisArg] The context to use calling the mapFn if provided. * @param {Scheduler} [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread. */ var observableFrom = Observable.from = function (iterable, mapFn, thisArg, scheduler) { if (iterable == null) { throw new Error('iterable cannot be null.') } if (mapFn && !isFunction(mapFn)) { throw new Error('mapFn when provided must be a function'); } if (mapFn) { var mapper = bindCallback(mapFn, thisArg, 2); } isScheduler(scheduler) || (scheduler = currentThreadScheduler); return new FromObservable(iterable, mapper, scheduler); } var FromArrayObservable = (function(__super__) { inherits(FromArrayObservable, __super__); function FromArrayObservable(args, scheduler) { this.args = args; this.scheduler = scheduler; __super__.call(this); } FromArrayObservable.prototype.subscribeCore = function (observer) { var sink = new FromArraySink(observer, this); return sink.run(); }; return FromArrayObservable; }(ObservableBase)); function FromArraySink(observer, parent) { this.observer = observer; this.parent = parent; } FromArraySink.prototype.run = function () { var observer = this.observer, args = this.parent.args, len = args.length; function loopRecursive(i, recurse) { if (i < len) { observer.onNext(args[i]); recurse(i + 1); } else { observer.onCompleted(); } } return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive); }; /** * Converts an array to an observable sequence, using an optional scheduler to enumerate the array. * @deprecated use Observable.from or Observable.of * @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on. * @returns {Observable} The observable sequence whose elements are pulled from the given enumerable sequence. */ var observableFromArray = Observable.fromArray = function (array, scheduler) { isScheduler(scheduler) || (scheduler = currentThreadScheduler); return new FromArrayObservable(array, scheduler) }; /** * Generates an observable sequence by running a state-driven loop producing the sequence's elements, using the specified scheduler to send out observer messages. * * @example * var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; }); * var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; }, Rx.Scheduler.timeout); * @param {Mixed} initialState Initial state. * @param {Function} condition Condition to terminate generation (upon returning false). * @param {Function} iterate Iteration step function. * @param {Function} resultSelector Selector function for results produced in the sequence. * @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not provided, defaults to Scheduler.currentThread. * @returns {Observable} The generated sequence. */ Observable.generate = function (initialState, condition, iterate, resultSelector, scheduler) { isScheduler(scheduler) || (scheduler = currentThreadScheduler); return new AnonymousObservable(function (o) { var first = true; return scheduler.scheduleRecursiveWithState(initialState, function (state, self) { var hasResult, result; try { if (first) { first = false; } else { state = iterate(state); } hasResult = condition(state); hasResult && (result = resultSelector(state)); } catch (e) { return o.onError(e); } if (hasResult) { o.onNext(result); self(state); } else { o.onCompleted(); } }); }); }; var NeverObservable = (function(__super__) { inherits(NeverObservable, __super__); function NeverObservable() { __super__.call(this); } NeverObservable.prototype.subscribeCore = function (observer) { return disposableEmpty; }; return NeverObservable; }(ObservableBase)); /** * Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins). * @returns {Observable} An observable sequence whose observers will never get called. */ var observableNever = Observable.never = function () { return new NeverObservable(); }; function observableOf (scheduler, array) { isScheduler(scheduler) || (scheduler = currentThreadScheduler); return new FromArrayObservable(array, scheduler); } /** * This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments. * @returns {Observable} The observable sequence whose elements are pulled from the given arguments. */ Observable.of = function () { var len = arguments.length, args = new Array(len); for(var i = 0; i < len; i++) { args[i] = arguments[i]; } return new FromArrayObservable(args, currentThreadScheduler); }; /** * This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments. * @param {Scheduler} scheduler A scheduler to use for scheduling the arguments. * @returns {Observable} The observable sequence whose elements are pulled from the given arguments. */ Observable.ofWithScheduler = function (scheduler) { var len = arguments.length, args = new Array(len - 1); for(var i = 1; i < len; i++) { args[i - 1] = arguments[i]; } return new FromArrayObservable(args, scheduler); }; var PairsObservable = (function(__super__) { inherits(PairsObservable, __super__); function PairsObservable(obj, scheduler) { this.obj = obj; this.keys = Object.keys(obj); this.scheduler = scheduler; __super__.call(this); } PairsObservable.prototype.subscribeCore = function (observer) { var sink = new PairsSink(observer, this); return sink.run(); }; return PairsObservable; }(ObservableBase)); function PairsSink(observer, parent) { this.observer = observer; this.parent = parent; } PairsSink.prototype.run = function () { var observer = this.observer, obj = this.parent.obj, keys = this.parent.keys, len = keys.length; function loopRecursive(i, recurse) { if (i < len) { var key = keys[i]; observer.onNext([key, obj[key]]); recurse(i + 1); } else { observer.onCompleted(); } } return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive); }; /** * Convert an object into an observable sequence of [key, value] pairs. * @param {Object} obj The object to inspect. * @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on. * @returns {Observable} An observable sequence of [key, value] pairs from the object. */ Observable.pairs = function (obj, scheduler) { scheduler || (scheduler = currentThreadScheduler); return new PairsObservable(obj, scheduler); }; var RangeObservable = (function(__super__) { inherits(RangeObservable, __super__); function RangeObservable(start, count, scheduler) { this.start = start; this.count = count; this.scheduler = scheduler; __super__.call(this); } RangeObservable.prototype.subscribeCore = function (observer) { var sink = new RangeSink(observer, this); return sink.run(); }; return RangeObservable; }(ObservableBase)); var RangeSink = (function () { function RangeSink(observer, parent) { this.observer = observer; this.parent = parent; } RangeSink.prototype.run = function () { var start = this.parent.start, count = this.parent.count, observer = this.observer; function loopRecursive(i, recurse) { if (i < count) { observer.onNext(start + i); recurse(i + 1); } else { observer.onCompleted(); } } return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive); }; return RangeSink; }()); /** * Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to send out observer messages. * @param {Number} start The value of the first integer in the sequence. * @param {Number} count The number of sequential integers to generate. * @param {Scheduler} [scheduler] Scheduler to run the generator loop on. If not specified, defaults to Scheduler.currentThread. * @returns {Observable} An observable sequence that contains a range of sequential integral numbers. */ Observable.range = function (start, count, scheduler) { isScheduler(scheduler) || (scheduler = currentThreadScheduler); return new RangeObservable(start, count, scheduler); }; var RepeatObservable = (function(__super__) { inherits(RepeatObservable, __super__); function RepeatObservable(value, repeatCount, scheduler) { this.value = value; this.repeatCount = repeatCount == null ? -1 : repeatCount; this.scheduler = scheduler; __super__.call(this); } RepeatObservable.prototype.subscribeCore = function (observer) { var sink = new RepeatSink(observer, this); return sink.run(); }; return RepeatObservable; }(ObservableBase)); function RepeatSink(observer, parent) { this.observer = observer; this.parent = parent; } RepeatSink.prototype.run = function () { var observer = this.observer, value = this.parent.value; function loopRecursive(i, recurse) { if (i === -1 || i > 0) { observer.onNext(value); i > 0 && i--; } if (i === 0) { return observer.onCompleted(); } recurse(i); } return this.parent.scheduler.scheduleRecursiveWithState(this.parent.repeatCount, loopRecursive); }; /** * Generates an observable sequence that repeats the given element the specified number of times, using the specified scheduler to send out observer messages. * @param {Mixed} value Element to repeat. * @param {Number} repeatCount [Optiona] Number of times to repeat the element. If not specified, repeats indefinitely. * @param {Scheduler} scheduler Scheduler to run the producer loop on. If not specified, defaults to Scheduler.immediate. * @returns {Observable} An observable sequence that repeats the given element the specified number of times. */ Observable.repeat = function (value, repeatCount, scheduler) { isScheduler(scheduler) || (scheduler = currentThreadScheduler); return new RepeatObservable(value, repeatCount, scheduler); }; var JustObservable = (function(__super__) { inherits(JustObservable, __super__); function JustObservable(value, scheduler) { this.value = value; this.scheduler = scheduler; __super__.call(this); } JustObservable.prototype.subscribeCore = function (observer) { var sink = new JustSink(observer, this); return sink.run(); }; function JustSink(observer, parent) { this.observer = observer; this.parent = parent; } function scheduleItem(s, state) { var value = state[0], observer = state[1]; observer.onNext(value); observer.onCompleted(); } JustSink.prototype.run = function () { return this.parent.scheduler.scheduleWithState([this.parent.value, this.observer], scheduleItem); }; return JustObservable; }(ObservableBase)); /** * Returns an observable sequence that contains a single element, using the specified scheduler to send out observer messages. * There is an alias called 'just' or browsers <IE9. * @param {Mixed} value Single element in the resulting observable sequence. * @param {Scheduler} scheduler Scheduler to send the single element on. If not specified, defaults to Scheduler.immediate. * @returns {Observable} An observable sequence containing the single specified element. */ var observableReturn = Observable['return'] = Observable.just = Observable.returnValue = function (value, scheduler) { isScheduler(scheduler) || (scheduler = immediateScheduler); return new JustObservable(value, scheduler); }; var ThrowObservable = (function(__super__) { inherits(ThrowObservable, __super__); function ThrowObservable(error, scheduler) { this.error = error; this.scheduler = scheduler; __super__.call(this); } ThrowObservable.prototype.subscribeCore = function (observer) { var sink = new ThrowSink(observer, this); return sink.run(); }; function ThrowSink(observer, parent) { this.observer = observer; this.parent = parent; } function scheduleItem(s, state) { var error = state[0], observer = state[1]; observer.onError(error); } ThrowSink.prototype.run = function () { return this.parent.scheduler.scheduleWithState([this.parent.error, this.observer], scheduleItem); }; return ThrowObservable; }(ObservableBase)); /** * Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single onError message. * There is an alias to this method called 'throwError' for browsers <IE9. * @param {Mixed} error An object used for the sequence's termination. * @param {Scheduler} scheduler Scheduler to send the exceptional termination call on. If not specified, defaults to Scheduler.immediate. * @returns {Observable} The observable sequence that terminates exceptionally with the specified exception object. */ var observableThrow = Observable['throw'] = Observable.throwError = Observable.throwException = function (error, scheduler) { isScheduler(scheduler) || (scheduler = immediateScheduler); return new ThrowObservable(error, scheduler); }; /** * Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime. * @param {Function} resourceFactory Factory function to obtain a resource object. * @param {Function} observableFactory Factory function to obtain an observable sequence that depends on the obtained resource. * @returns {Observable} An observable sequence whose lifetime controls the lifetime of the dependent resource object. */ Observable.using = function (resourceFactory, observableFactory) { return new AnonymousObservable(function (observer) { var disposable = disposableEmpty, resource, source; try { resource = resourceFactory(); resource && (disposable = resource); source = observableFactory(resource); } catch (exception) { return new CompositeDisposable(observableThrow(exception).subscribe(observer), disposable); } return new CompositeDisposable(source.subscribe(observer), disposable); }); }; /** * Propagates the observable sequence or Promise that reacts first. * @param {Observable} rightSource Second observable sequence or Promise. * @returns {Observable} {Observable} An observable sequence that surfaces either of the given sequences, whichever reacted first. */ observableProto.amb = function (rightSource) { var leftSource = this; return new AnonymousObservable(function (observer) { var choice, leftChoice = 'L', rightChoice = 'R', leftSubscription = new SingleAssignmentDisposable(), rightSubscription = new SingleAssignmentDisposable(); isPromise(rightSource) && (rightSource = observableFromPromise(rightSource)); function choiceL() { if (!choice) { choice = leftChoice; rightSubscription.dispose(); } } function choiceR() { if (!choice) { choice = rightChoice; leftSubscription.dispose(); } } leftSubscription.setDisposable(leftSource.subscribe(function (left) { choiceL(); if (choice === leftChoice) { observer.onNext(left); } }, function (err) { choiceL(); if (choice === leftChoice) { observer.onError(err); } }, function () { choiceL(); if (choice === leftChoice) { observer.onCompleted(); } })); rightSubscription.setDisposable(rightSource.subscribe(function (right) { choiceR(); if (choice === rightChoice) { observer.onNext(right); } }, function (err) { choiceR(); if (choice === rightChoice) { observer.onError(err); } }, function () { choiceR(); if (choice === rightChoice) { observer.onCompleted(); } })); return new CompositeDisposable(leftSubscription, rightSubscription); }); }; /** * Propagates the observable sequence or Promise that reacts first. * * @example * var = Rx.Observable.amb(xs, ys, zs); * @returns {Observable} An observable sequence that surfaces any of the given sequences, whichever reacted first. */ Observable.amb = function () { var acc = observableNever(), items = []; if (Array.isArray(arguments[0])) { items = arguments[0]; } else { for(var i = 0, len = arguments.length; i < len; i++) { items.push(arguments[i]); } } function func(previous, current) { return previous.amb(current); } for (var i = 0, len = items.length; i < len; i++) { acc = func(acc, items[i]); } return acc; }; function observableCatchHandler(source, handler) { return new AnonymousObservable(function (o) { var d1 = new SingleAssignmentDisposable(), subscription = new SerialDisposable(); subscription.setDisposable(d1); d1.setDisposable(source.subscribe(function (x) { o.onNext(x); }, function (e) { try { var result = handler(e); } catch (ex) { return o.onError(ex); } isPromise(result) && (result = observableFromPromise(result)); var d = new SingleAssignmentDisposable(); subscription.setDisposable(d); d.setDisposable(result.subscribe(o)); }, function (x) { o.onCompleted(x); })); return subscription; }, source); } /** * Continues an observable sequence that is terminated by an exception with the next observable sequence. * @example * 1 - xs.catchException(ys) * 2 - xs.catchException(function (ex) { return ys(ex); }) * @param {Mixed} handlerOrSecond Exception handler function that returns an observable sequence given the error that occurred in the first sequence, or a second observable sequence used to produce results when an error occurred in the first sequence. * @returns {Observable} An observable sequence containing the first sequence's elements, followed by the elements of the handler sequence in case an exception occurred. */ observableProto['catch'] = observableProto.catchError = observableProto.catchException = function (handlerOrSecond) { return typeof handlerOrSecond === 'function' ? observableCatchHandler(this, handlerOrSecond) : observableCatch([this, handlerOrSecond]); }; /** * Continues an observable sequence that is terminated by an exception with the next observable sequence. * @param {Array | Arguments} args Arguments or an array to use as the next sequence if an error occurs. * @returns {Observable} An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully. */ var observableCatch = Observable.catchError = Observable['catch'] = Observable.catchException = function () { var items = []; if (Array.isArray(arguments[0])) { items = arguments[0]; } else { for(var i = 0, len = arguments.length; i < len; i++) { items.push(arguments[i]); } } return enumerableOf(items).catchError(); }; /** * Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element. * This can be in the form of an argument list of observables or an array. * * @example * 1 - obs = observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; }); * 2 - obs = observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; }); * @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function. */ observableProto.combineLatest = function () { var len = arguments.length, args = new Array(len); for(var i = 0; i < len; i++) { args[i] = arguments[i]; } if (Array.isArray(args[0])) { args[0].unshift(this); } else { args.unshift(this); } return combineLatest.apply(this, args); }; /** * Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element. * * @example * 1 - obs = Rx.Observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; }); * 2 - obs = Rx.Observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; }); * @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function. */ var combineLatest = Observable.combineLatest = function () { var len = arguments.length, args = new Array(len); for(var i = 0; i < len; i++) { args[i] = arguments[i]; } var resultSelector = args.pop(); Array.isArray(args[0]) && (args = args[0]); return new AnonymousObservable(function (o) { var n = args.length, falseFactory = function () { return false; }, hasValue = arrayInitialize(n, falseFactory), hasValueAll = false, isDone = arrayInitialize(n, falseFactory), values = new Array(n); function next(i) { hasValue[i] = true; if (hasValueAll || (hasValueAll = hasValue.every(identity))) { try { var res = resultSelector.apply(null, values); } catch (e) { return o.onError(e); } o.onNext(res); } else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) { o.onCompleted(); } } function done (i) { isDone[i] = true; isDone.every(identity) && o.onCompleted(); } var subscriptions = new Array(n); for (var idx = 0; idx < n; idx++) { (function (i) { var source = args[i], sad = new SingleAssignmentDisposable(); isPromise(source) && (source = observableFromPromise(source)); sad.setDisposable(source.subscribe(function (x) { values[i] = x; next(i); }, function(e) { o.onError(e); }, function () { done(i); } )); subscriptions[i] = sad; }(idx)); } return new CompositeDisposable(subscriptions); }, this); }; /** * Concatenates all the observable sequences. This takes in either an array or variable arguments to concatenate. * @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order. */ observableProto.concat = function () { for(var args = [], i = 0, len = arguments.length; i < len; i++) { args.push(arguments[i]); } args.unshift(this); return observableConcat.apply(null, args); }; /** * Concatenates all the observable sequences. * @param {Array | Arguments} args Arguments or an array to concat to the observable sequence. * @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order. */ var observableConcat = Observable.concat = function () { var args; if (Array.isArray(arguments[0])) { args = arguments[0]; } else { args = new Array(arguments.length); for(var i = 0, len = arguments.length; i < len; i++) { args[i] = arguments[i]; } } return enumerableOf(args).concat(); }; /** * Concatenates an observable sequence of observable sequences. * @returns {Observable} An observable sequence that contains the elements of each observed inner sequence, in sequential order. */ observableProto.concatAll = observableProto.concatObservable = function () { return this.merge(1); }; var MergeObservable = (function (__super__) { inherits(MergeObservable, __super__); function MergeObservable(source, maxConcurrent) { this.source = source; this.maxConcurrent = maxConcurrent; __super__.call(this); } MergeObservable.prototype.subscribeCore = function(observer) { var g = new CompositeDisposable(); g.add(this.source.subscribe(new MergeObserver(observer, this.maxConcurrent, g))); return g; }; return MergeObservable; }(ObservableBase)); var MergeObserver = (function () { function MergeObserver(o, max, g) { this.o = o; this.max = max; this.g = g; this.done = false; this.q = []; this.activeCount = 0; this.isStopped = false; } MergeObserver.prototype.handleSubscribe = function (xs) { var sad = new SingleAssignmentDisposable(); this.g.add(sad); isPromise(xs) && (xs = observableFromPromise(xs)); sad.setDisposable(xs.subscribe(new InnerObserver(this, sad))); }; MergeObserver.prototype.onNext = function (innerSource) { if (this.isStopped) { return; } if(this.activeCount < this.max) { this.activeCount++; this.handleSubscribe(innerSource); } else { this.q.push(innerSource); } }; MergeObserver.prototype.onError = function (e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); } }; MergeObserver.prototype.onCompleted = function () { if (!this.isStopped) { this.isStopped = true; this.done = true; this.activeCount === 0 && this.o.onCompleted(); } }; MergeObserver.prototype.dispose = function() { this.isStopped = true; }; MergeObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); return true; } return false; }; function InnerObserver(parent, sad) { this.parent = parent; this.sad = sad; this.isStopped = false; } InnerObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.parent.o.onNext(x); } }; InnerObserver.prototype.onError = function (e) { if (!this.isStopped) { this.isStopped = true; this.parent.o.onError(e); } }; InnerObserver.prototype.onCompleted = function () { if(!this.isStopped) { this.isStopped = true; var parent = this.parent; parent.g.remove(this.sad); if (parent.q.length > 0) { parent.handleSubscribe(parent.q.shift()); } else { parent.activeCount--; parent.done && parent.activeCount === 0 && parent.o.onCompleted(); } } }; InnerObserver.prototype.dispose = function() { this.isStopped = true; }; InnerObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.parent.o.onError(e); return true; } return false; }; return MergeObserver; }()); /** * Merges an observable sequence of observable sequences into an observable sequence, limiting the number of concurrent subscriptions to inner sequences. * Or merges two observable sequences into a single observable sequence. * * @example * 1 - merged = sources.merge(1); * 2 - merged = source.merge(otherSource); * @param {Mixed} [maxConcurrentOrOther] Maximum number of inner observable sequences being subscribed to concurrently or the second observable sequence. * @returns {Observable} The observable sequence that merges the elements of the inner sequences. */ observableProto.merge = function (maxConcurrentOrOther) { return typeof maxConcurrentOrOther !== 'number' ? observableMerge(this, maxConcurrentOrOther) : new MergeObservable(this, maxConcurrentOrOther); }; /** * Merges all the observable sequences into a single observable sequence. * The scheduler is optional and if not specified, the immediate scheduler is used. * @returns {Observable} The observable sequence that merges the elements of the observable sequences. */ var observableMerge = Observable.merge = function () { var scheduler, sources = [], i, len = arguments.length; if (!arguments[0]) { scheduler = immediateScheduler; for(i = 1; i < len; i++) { sources.push(arguments[i]); } } else if (isScheduler(arguments[0])) { scheduler = arguments[0]; for(i = 1; i < len; i++) { sources.push(arguments[i]); } } else { scheduler = immediateScheduler; for(i = 0; i < len; i++) { sources.push(arguments[i]); } } if (Array.isArray(sources[0])) { sources = sources[0]; } return observableOf(scheduler, sources).mergeAll(); }; var MergeAllObservable = (function (__super__) { inherits(MergeAllObservable, __super__); function MergeAllObservable(source) { this.source = source; __super__.call(this); } MergeAllObservable.prototype.subscribeCore = function (observer) { var g = new CompositeDisposable(), m = new SingleAssignmentDisposable(); g.add(m); m.setDisposable(this.source.subscribe(new MergeAllObserver(observer, g))); return g; }; return MergeAllObservable; }(ObservableBase)); var MergeAllObserver = (function() { function MergeAllObserver(o, g) { this.o = o; this.g = g; this.isStopped = false; this.done = false; } MergeAllObserver.prototype.onNext = function(innerSource) { if(this.isStopped) { return; } var sad = new SingleAssignmentDisposable(); this.g.add(sad); isPromise(innerSource) && (innerSource = observableFromPromise(innerSource)); sad.setDisposable(innerSource.subscribe(new InnerObserver(this, this.g, sad))); }; MergeAllObserver.prototype.onError = function (e) { if(!this.isStopped) { this.isStopped = true; this.o.onError(e); } }; MergeAllObserver.prototype.onCompleted = function () { if(!this.isStopped) { this.isStopped = true; this.done = true; this.g.length === 1 && this.o.onCompleted(); } }; MergeAllObserver.prototype.dispose = function() { this.isStopped = true; }; MergeAllObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.o.onError(e); return true; } return false; }; function InnerObserver(parent, g, sad) { this.parent = parent; this.g = g; this.sad = sad; this.isStopped = false; } InnerObserver.prototype.onNext = function (x) { if (!this.isStopped) { this.parent.o.onNext(x); } }; InnerObserver.prototype.onError = function (e) { if(!this.isStopped) { this.isStopped = true; this.parent.o.onError(e); } }; InnerObserver.prototype.onCompleted = function () { if(!this.isStopped) { var parent = this.parent; this.isStopped = true; parent.g.remove(this.sad); parent.done && parent.g.length === 1 && parent.o.onCompleted(); } }; InnerObserver.prototype.dispose = function() { this.isStopped = true; }; InnerObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.parent.o.onError(e); return true; } return false; }; return MergeAllObserver; }()); /** * Merges an observable sequence of observable sequences into an observable sequence. * @returns {Observable} The observable sequence that merges the elements of the inner sequences. */ observableProto.mergeAll = observableProto.mergeObservable = function () { return new MergeAllObservable(this); }; var CompositeError = Rx.CompositeError = function(errors) { this.name = "NotImplementedError"; this.innerErrors = errors; this.message = 'This contains multiple errors. Check the innerErrors'; Error.call(this); } CompositeError.prototype = Error.prototype; /** * Flattens an Observable that emits Observables into one Observable, in a way that allows an Observer to * receive all successfully emitted items from all of the source Observables without being interrupted by * an error notification from one of them. * * This behaves like Observable.prototype.mergeAll except that if any of the merged Observables notify of an * error via the Observer's onError, mergeDelayError will refrain from propagating that * error notification until all of the merged Observables have finished emitting items. * @param {Array | Arguments} args Arguments or an array to merge. * @returns {Observable} an Observable that emits all of the items emitted by the Observables emitted by the Observable */ Observable.mergeDelayError = function() { var args; if (Array.isArray(arguments[0])) { args = arguments[0]; } else { var len = arguments.length; args = new Array(len); for(var i = 0; i < len; i++) { args[i] = arguments[i]; } } var source = observableOf(null, args); return new AnonymousObservable(function (o) { var group = new CompositeDisposable(), m = new SingleAssignmentDisposable(), isStopped = false, errors = []; function setCompletion() { if (errors.length === 0) { o.onCompleted(); } else if (errors.length === 1) { o.onError(errors[0]); } else { o.onError(new CompositeError(errors)); } } group.add(m); m.setDisposable(source.subscribe( function (innerSource) { var innerSubscription = new SingleAssignmentDisposable(); group.add(innerSubscription); // Check for promises support isPromise(innerSource) && (innerSource = observableFromPromise(innerSource)); innerSubscription.setDisposable(innerSource.subscribe( function (x) { o.onNext(x); }, function (e) { errors.push(e); group.remove(innerSubscription); isStopped && group.length === 1 && setCompletion(); }, function () { group.remove(innerSubscription); isStopped && group.length === 1 && setCompletion(); })); }, function (e) { errors.push(e); isStopped = true; group.length === 1 && setCompletion(); }, function () { isStopped = true; group.length === 1 && setCompletion(); })); return group; }); }; /** * Continues an observable sequence that is terminated normally or by an exception with the next observable sequence. * @param {Observable} second Second observable sequence used to produce results after the first sequence terminates. * @returns {Observable} An observable sequence that concatenates the first and second sequence, even if the first sequence terminates exceptionally. */ observableProto.onErrorResumeNext = function (second) { if (!second) { throw new Error('Second observable is required'); } return onErrorResumeNext([this, second]); }; /** * Continues an observable sequence that is terminated normally or by an exception with the next observable sequence. * * @example * 1 - res = Rx.Observable.onErrorResumeNext(xs, ys, zs); * 1 - res = Rx.Observable.onErrorResumeNext([xs, ys, zs]); * @returns {Observable} An observable sequence that concatenates the source sequences, even if a sequence terminates exceptionally. */ var onErrorResumeNext = Observable.onErrorResumeNext = function () { var sources = []; if (Array.isArray(arguments[0])) { sources = arguments[0]; } else { for(var i = 0, len = arguments.length; i < len; i++) { sources.push(arguments[i]); } } return new AnonymousObservable(function (observer) { var pos = 0, subscription = new SerialDisposable(), cancelable = immediateScheduler.scheduleRecursive(function (self) { var current, d; if (pos < sources.length) { current = sources[pos++]; isPromise(current) && (current = observableFromPromise(current)); d = new SingleAssignmentDisposable(); subscription.setDisposable(d); d.setDisposable(current.subscribe(observer.onNext.bind(observer), self, self)); } else { observer.onCompleted(); } }); return new CompositeDisposable(subscription, cancelable); }); }; /** * Returns the values from the source observable sequence only after the other observable sequence produces a value. * @param {Observable | Promise} other The observable sequence or Promise that triggers propagation of elements of the source sequence. * @returns {Observable} An observable sequence containing the elements of the source sequence starting from the point the other sequence triggered propagation. */ observableProto.skipUntil = function (other) { var source = this; return new AnonymousObservable(function (o) { var isOpen = false; var disposables = new CompositeDisposable(source.subscribe(function (left) { isOpen && o.onNext(left); }, function (e) { o.onError(e); }, function () { isOpen && o.onCompleted(); })); isPromise(other) && (other = observableFromPromise(other)); var rightSubscription = new SingleAssignmentDisposable(); disposables.add(rightSubscription); rightSubscription.setDisposable(other.subscribe(function () { isOpen = true; rightSubscription.dispose(); }, function (e) { o.onError(e); }, function () { rightSubscription.dispose(); })); return disposables; }, source); }; /** * Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence. * @returns {Observable} The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received. */ observableProto['switch'] = observableProto.switchLatest = function () { var sources = this; return new AnonymousObservable(function (observer) { var hasLatest = false, innerSubscription = new SerialDisposable(), isStopped = false, latest = 0, subscription = sources.subscribe( function (innerSource) { var d = new SingleAssignmentDisposable(), id = ++latest; hasLatest = true; innerSubscription.setDisposable(d); // Check if Promise or Observable isPromise(innerSource) && (innerSource = observableFromPromise(innerSource)); d.setDisposable(innerSource.subscribe( function (x) { latest === id && observer.onNext(x); }, function (e) { latest === id && observer.onError(e); }, function () { if (latest === id) { hasLatest = false; isStopped && observer.onCompleted(); } })); }, function (e) { observer.onError(e); }, function () { isStopped = true; !hasLatest && observer.onCompleted(); }); return new CompositeDisposable(subscription, innerSubscription); }, sources); }; /** * Returns the values from the source observable sequence until the other observable sequence produces a value. * @param {Observable | Promise} other Observable sequence or Promise that terminates propagation of elements of the source sequence. * @returns {Observable} An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation. */ observableProto.takeUntil = function (other) { var source = this; return new AnonymousObservable(function (o) { isPromise(other) && (other = observableFromPromise(other)); return new CompositeDisposable( source.subscribe(o), other.subscribe(function () { o.onCompleted(); }, function (e) { o.onError(e); }, noop) ); }, source); }; /** * Merges the specified observable sequences into one observable sequence by using the selector function only when the (first) source observable sequence produces an element. * * @example * 1 - obs = obs1.withLatestFrom(obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; }); * 2 - obs = obs1.withLatestFrom([obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; }); * @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function. */ observableProto.withLatestFrom = function () { var len = arguments.length, args = new Array(len) for(var i = 0; i < len; i++) { args[i] = arguments[i]; } var resultSelector = args.pop(), source = this; if (typeof source === 'undefined') { throw new Error('Source observable not found for withLatestFrom().'); } if (typeof resultSelector !== 'function') { throw new Error('withLatestFrom() expects a resultSelector function.'); } if (Array.isArray(args[0])) { args = args[0]; } return new AnonymousObservable(function (observer) { var falseFactory = function () { return false; }, n = args.length, hasValue = arrayInitialize(n, falseFactory), hasValueAll = false, values = new Array(n); var subscriptions = new Array(n + 1); for (var idx = 0; idx < n; idx++) { (function (i) { var other = args[i], sad = new SingleAssignmentDisposable(); isPromise(other) && (other = observableFromPromise(other)); sad.setDisposable(other.subscribe(function (x) { values[i] = x; hasValue[i] = true; hasValueAll = hasValue.every(identity); }, observer.onError.bind(observer), function () {})); subscriptions[i] = sad; }(idx)); } var sad = new SingleAssignmentDisposable(); sad.setDisposable(source.subscribe(function (x) { var res; var allValues = [x].concat(values); if (!hasValueAll) return; try { res = resultSelector.apply(null, allValues); } catch (ex) { observer.onError(ex); return; } observer.onNext(res); }, observer.onError.bind(observer), function () { observer.onCompleted(); })); subscriptions[n] = sad; return new CompositeDisposable(subscriptions); }, this); }; function zipArray(second, resultSelector) { var first = this; return new AnonymousObservable(function (observer) { var index = 0, len = second.length; return first.subscribe(function (left) { if (index < len) { var right = second[index++], result; try { result = resultSelector(left, right); } catch (e) { return observer.onError(e); } observer.onNext(result); } else { observer.onCompleted(); } }, function (e) { observer.onError(e); }, function () { observer.onCompleted(); }); }, first); } function falseFactory() { return false; } function emptyArrayFactory() { return []; } /** * Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index. * The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the args. * * @example * 1 - res = obs1.zip(obs2, fn); * 1 - res = x1.zip([1,2,3], fn); * @returns {Observable} An observable sequence containing the result of combining elements of the args using the specified result selector function. */ observableProto.zip = function () { if (Array.isArray(arguments[0])) { return zipArray.apply(this, arguments); } var len = arguments.length, args = new Array(len); for(var i = 0; i < len; i++) { args[i] = arguments[i]; } var parent = this, resultSelector = args.pop(); args.unshift(parent); return new AnonymousObservable(function (observer) { var n = args.length, queues = arrayInitialize(n, emptyArrayFactory), isDone = arrayInitialize(n, falseFactory); function next(i) { var res, queuedValues; if (queues.every(function (x) { return x.length > 0; })) { try { queuedValues = queues.map(function (x) { return x.shift(); }); res = resultSelector.apply(parent, queuedValues); } catch (ex) { observer.onError(ex); return; } observer.onNext(res); } else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) { observer.onCompleted(); } }; function done(i) { isDone[i] = true; if (isDone.every(function (x) { return x; })) { observer.onCompleted(); } } var subscriptions = new Array(n); for (var idx = 0; idx < n; idx++) { (function (i) { var source = args[i], sad = new SingleAssignmentDisposable(); isPromise(source) && (source = observableFromPromise(source)); sad.setDisposable(source.subscribe(function (x) { queues[i].push(x); next(i); }, function (e) { observer.onError(e); }, function () { done(i); })); subscriptions[i] = sad; })(idx); } return new CompositeDisposable(subscriptions); }, parent); }; /** * Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index. * @param arguments Observable sources. * @param {Function} resultSelector Function to invoke for each series of elements at corresponding indexes in the sources. * @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function. */ Observable.zip = function () { var len = arguments.length, args = new Array(len); for(var i = 0; i < len; i++) { args[i] = arguments[i]; } var first = args.shift(); return first.zip.apply(first, args); }; /** * Merges the specified observable sequences into one observable sequence by emitting a list with the elements of the observable sequences at corresponding indexes. * @param arguments Observable sources. * @returns {Observable} An observable sequence containing lists of elements at corresponding indexes. */ Observable.zipArray = function () { var sources; if (Array.isArray(arguments[0])) { sources = arguments[0]; } else { var len = arguments.length; sources = new Array(len); for(var i = 0; i < len; i++) { sources[i] = arguments[i]; } } return new AnonymousObservable(function (observer) { var n = sources.length, queues = arrayInitialize(n, function () { return []; }), isDone = arrayInitialize(n, function () { return false; }); function next(i) { if (queues.every(function (x) { return x.length > 0; })) { var res = queues.map(function (x) { return x.shift(); }); observer.onNext(res); } else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) { observer.onCompleted(); return; } }; function done(i) { isDone[i] = true; if (isDone.every(identity)) { observer.onCompleted(); return; } } var subscriptions = new Array(n); for (var idx = 0; idx < n; idx++) { (function (i) { subscriptions[i] = new SingleAssignmentDisposable(); subscriptions[i].setDisposable(sources[i].subscribe(function (x) { queues[i].push(x); next(i); }, function (e) { observer.onError(e); }, function () { done(i); })); })(idx); } return new CompositeDisposable(subscriptions); }); }; /** * Hides the identity of an observable sequence. * @returns {Observable} An observable sequence that hides the identity of the source sequence. */ observableProto.asObservable = function () { var source = this; return new AnonymousObservable(function (o) { return source.subscribe(o); }, this); }; /** * Projects each element of an observable sequence into zero or more buffers which are produced based on element count information. * * @example * var res = xs.bufferWithCount(10); * var res = xs.bufferWithCount(10, 1); * @param {Number} count Length of each buffer. * @param {Number} [skip] Number of elements to skip between creation of consecutive buffers. If not provided, defaults to the count. * @returns {Observable} An observable sequence of buffers. */ observableProto.bufferWithCount = function (count, skip) { if (typeof skip !== 'number') { skip = count; } return this.windowWithCount(count, skip).selectMany(function (x) { return x.toArray(); }).where(function (x) { return x.length > 0; }); }; /** * Dematerializes the explicit notification values of an observable sequence as implicit notifications. * @returns {Observable} An observable sequence exhibiting the behavior corresponding to the source sequence's notification values. */ observableProto.dematerialize = function () { var source = this; return new AnonymousObservable(function (o) { return source.subscribe(function (x) { return x.accept(o); }, function(e) { o.onError(e); }, function () { o.onCompleted(); }); }, this); }; /** * Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer. * * var obs = observable.distinctUntilChanged(); * var obs = observable.distinctUntilChanged(function (x) { return x.id; }); * var obs = observable.distinctUntilChanged(function (x) { return x.id; }, function (x, y) { return x === y; }); * * @param {Function} [keySelector] A function to compute the comparison key for each element. If not provided, it projects the value. * @param {Function} [comparer] Equality comparer for computed key values. If not provided, defaults to an equality comparer function. * @returns {Observable} An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence. */ observableProto.distinctUntilChanged = function (keySelector, comparer) { var source = this; comparer || (comparer = defaultComparer); return new AnonymousObservable(function (o) { var hasCurrentKey = false, currentKey; return source.subscribe(function (value) { var key = value; if (keySelector) { try { key = keySelector(value); } catch (e) { o.onError(e); return; } } if (hasCurrentKey) { try { var comparerEquals = comparer(currentKey, key); } catch (e) { o.onError(e); return; } } if (!hasCurrentKey || !comparerEquals) { hasCurrentKey = true; currentKey = key; o.onNext(value); } }, function (e) { o.onError(e); }, function () { o.onCompleted(); }); }, this); }; /** * Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence. * This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline. * @param {Function | Observer} observerOrOnNext Action to invoke for each element in the observable sequence or an observer. * @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function. * @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function. * @returns {Observable} The source sequence with the side-effecting behavior applied. */ observableProto['do'] = observableProto.tap = observableProto.doAction = function (observerOrOnNext, onError, onCompleted) { var source = this; return new AnonymousObservable(function (observer) { var tapObserver = !observerOrOnNext || isFunction(observerOrOnNext) ? observerCreate(observerOrOnNext || noop, onError || noop, onCompleted || noop) : observerOrOnNext; return source.subscribe(function (x) { try { tapObserver.onNext(x); } catch (e) { observer.onError(e); } observer.onNext(x); }, function (err) { try { tapObserver.onError(err); } catch (e) { observer.onError(e); } observer.onError(err); }, function () { try { tapObserver.onCompleted(); } catch (e) { observer.onError(e); } observer.onCompleted(); }); }, this); }; /** * Invokes an action for each element in the observable sequence. * This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline. * @param {Function} onNext Action to invoke for each element in the observable sequence. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} The source sequence with the side-effecting behavior applied. */ observableProto.doOnNext = observableProto.tapOnNext = function (onNext, thisArg) { return this.tap(typeof thisArg !== 'undefined' ? function (x) { onNext.call(thisArg, x); } : onNext); }; /** * Invokes an action upon exceptional termination of the observable sequence. * This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline. * @param {Function} onError Action to invoke upon exceptional termination of the observable sequence. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} The source sequence with the side-effecting behavior applied. */ observableProto.doOnError = observableProto.tapOnError = function (onError, thisArg) { return this.tap(noop, typeof thisArg !== 'undefined' ? function (e) { onError.call(thisArg, e); } : onError); }; /** * Invokes an action upon graceful termination of the observable sequence. * This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline. * @param {Function} onCompleted Action to invoke upon graceful termination of the observable sequence. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} The source sequence with the side-effecting behavior applied. */ observableProto.doOnCompleted = observableProto.tapOnCompleted = function (onCompleted, thisArg) { return this.tap(noop, null, typeof thisArg !== 'undefined' ? function () { onCompleted.call(thisArg); } : onCompleted); }; /** * Invokes a specified action after the source observable sequence terminates gracefully or exceptionally. * @param {Function} finallyAction Action to invoke after the source observable sequence terminates. * @returns {Observable} Source sequence with the action-invoking termination behavior applied. */ observableProto['finally'] = observableProto.ensure = function (action) { var source = this; return new AnonymousObservable(function (observer) { var subscription; try { subscription = source.subscribe(observer); } catch (e) { action(); throw e; } return disposableCreate(function () { try { subscription.dispose(); } catch (e) { throw e; } finally { action(); } }); }, this); }; /** * @deprecated use #finally or #ensure instead. */ observableProto.finallyAction = function (action) { //deprecate('finallyAction', 'finally or ensure'); return this.ensure(action); }; /** * Ignores all elements in an observable sequence leaving only the termination messages. * @returns {Observable} An empty observable sequence that signals termination, successful or exceptional, of the source sequence. */ observableProto.ignoreElements = function () { var source = this; return new AnonymousObservable(function (o) { return source.subscribe(noop, function (e) { o.onError(e); }, function () { o.onCompleted(); }); }, source); }; /** * Materializes the implicit notifications of an observable sequence as explicit notification values. * @returns {Observable} An observable sequence containing the materialized notification values from the source sequence. */ observableProto.materialize = function () { var source = this; return new AnonymousObservable(function (observer) { return source.subscribe(function (value) { observer.onNext(notificationCreateOnNext(value)); }, function (e) { observer.onNext(notificationCreateOnError(e)); observer.onCompleted(); }, function () { observer.onNext(notificationCreateOnCompleted()); observer.onCompleted(); }); }, source); }; /** * Repeats the observable sequence a specified number of times. If the repeat count is not specified, the sequence repeats indefinitely. * @param {Number} [repeatCount] Number of times to repeat the sequence. If not provided, repeats the sequence indefinitely. * @returns {Observable} The observable sequence producing the elements of the given sequence repeatedly. */ observableProto.repeat = function (repeatCount) { return enumerableRepeat(this, repeatCount).concat(); }; /** * Repeats the source observable sequence the specified number of times or until it successfully terminates. If the retry count is not specified, it retries indefinitely. * Note if you encounter an error and want it to retry once, then you must use .retry(2); * * @example * var res = retried = retry.repeat(); * var res = retried = retry.repeat(2); * @param {Number} [retryCount] Number of times to retry the sequence. If not provided, retry the sequence indefinitely. * @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully. */ observableProto.retry = function (retryCount) { return enumerableRepeat(this, retryCount).catchError(); }; /** * Repeats the source observable sequence upon error each time the notifier emits or until it successfully terminates. * if the notifier completes, the observable sequence completes. * * @example * var timer = Observable.timer(500); * var source = observable.retryWhen(timer); * @param {Observable} [notifier] An observable that triggers the retries or completes the observable with onNext or onCompleted respectively. * @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully. */ observableProto.retryWhen = function (notifier) { return enumerableRepeat(this).catchErrorWhen(notifier); }; /** * Applies an accumulator function over an observable sequence and returns each intermediate result. The optional seed value is used as the initial accumulator value. * For aggregation behavior with no intermediate results, see Observable.aggregate. * @example * var res = source.scan(function (acc, x) { return acc + x; }); * var res = source.scan(0, function (acc, x) { return acc + x; }); * @param {Mixed} [seed] The initial accumulator value. * @param {Function} accumulator An accumulator function to be invoked on each element. * @returns {Observable} An observable sequence containing the accumulated values. */ observableProto.scan = function () { var hasSeed = false, seed, accumulator, source = this; if (arguments.length === 2) { hasSeed = true; seed = arguments[0]; accumulator = arguments[1]; } else { accumulator = arguments[0]; } return new AnonymousObservable(function (o) { var hasAccumulation, accumulation, hasValue; return source.subscribe ( function (x) { !hasValue && (hasValue = true); try { if (hasAccumulation) { accumulation = accumulator(accumulation, x); } else { accumulation = hasSeed ? accumulator(seed, x) : x; hasAccumulation = true; } } catch (e) { o.onError(e); return; } o.onNext(accumulation); }, function (e) { o.onError(e); }, function () { !hasValue && hasSeed && o.onNext(seed); o.onCompleted(); } ); }, source); }; /** * Bypasses a specified number of elements at the end of an observable sequence. * @description * This operator accumulates a queue with a length enough to store the first `count` elements. As more elements are * received, elements are taken from the front of the queue and produced on the result sequence. This causes elements to be delayed. * @param count Number of elements to bypass at the end of the source sequence. * @returns {Observable} An observable sequence containing the source sequence elements except for the bypassed ones at the end. */ observableProto.skipLast = function (count) { if (count < 0) { throw new ArgumentOutOfRangeError(); } var source = this; return new AnonymousObservable(function (o) { var q = []; return source.subscribe(function (x) { q.push(x); q.length > count && o.onNext(q.shift()); }, function (e) { o.onError(e); }, function () { o.onCompleted(); }); }, source); }; /** * Prepends a sequence of values to an observable sequence with an optional scheduler and an argument list of values to prepend. * @example * var res = source.startWith(1, 2, 3); * var res = source.startWith(Rx.Scheduler.timeout, 1, 2, 3); * @param {Arguments} args The specified values to prepend to the observable sequence * @returns {Observable} The source sequence prepended with the specified values. */ observableProto.startWith = function () { var values, scheduler, start = 0; if (!!arguments.length && isScheduler(arguments[0])) { scheduler = arguments[0]; start = 1; } else { scheduler = immediateScheduler; } for(var args = [], i = start, len = arguments.length; i < len; i++) { args.push(arguments[i]); } return enumerableOf([observableFromArray(args, scheduler), this]).concat(); }; /** * Returns a specified number of contiguous elements from the end of an observable sequence. * @description * This operator accumulates a buffer with a length enough to store elements count elements. Upon completion of * the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed. * @param {Number} count Number of elements to take from the end of the source sequence. * @returns {Observable} An observable sequence containing the specified number of elements from the end of the source sequence. */ observableProto.takeLast = function (count) { if (count < 0) { throw new ArgumentOutOfRangeError(); } var source = this; return new AnonymousObservable(function (o) { var q = []; return source.subscribe(function (x) { q.push(x); q.length > count && q.shift(); }, function (e) { o.onError(e); }, function () { while (q.length > 0) { o.onNext(q.shift()); } o.onCompleted(); }); }, source); }; /** * Returns an array with the specified number of contiguous elements from the end of an observable sequence. * * @description * This operator accumulates a buffer with a length enough to store count elements. Upon completion of the * source sequence, this buffer is produced on the result sequence. * @param {Number} count Number of elements to take from the end of the source sequence. * @returns {Observable} An observable sequence containing a single array with the specified number of elements from the end of the source sequence. */ observableProto.takeLastBuffer = function (count) { var source = this; return new AnonymousObservable(function (o) { var q = []; return source.subscribe(function (x) { q.push(x); q.length > count && q.shift(); }, function (e) { o.onError(e); }, function () { o.onNext(q); o.onCompleted(); }); }, source); }; /** * Projects each element of an observable sequence into zero or more windows which are produced based on element count information. * * var res = xs.windowWithCount(10); * var res = xs.windowWithCount(10, 1); * @param {Number} count Length of each window. * @param {Number} [skip] Number of elements to skip between creation of consecutive windows. If not specified, defaults to the count. * @returns {Observable} An observable sequence of windows. */ observableProto.windowWithCount = function (count, skip) { var source = this; +count || (count = 0); Math.abs(count) === Infinity && (count = 0); if (count <= 0) { throw new ArgumentOutOfRangeError(); } skip == null && (skip = count); +skip || (skip = 0); Math.abs(skip) === Infinity && (skip = 0); if (skip <= 0) { throw new ArgumentOutOfRangeError(); } return new AnonymousObservable(function (observer) { var m = new SingleAssignmentDisposable(), refCountDisposable = new RefCountDisposable(m), n = 0, q = []; function createWindow () { var s = new Subject(); q.push(s); observer.onNext(addRef(s, refCountDisposable)); } createWindow(); m.setDisposable(source.subscribe( function (x) { for (var i = 0, len = q.length; i < len; i++) { q[i].onNext(x); } var c = n - count + 1; c >= 0 && c % skip === 0 && q.shift().onCompleted(); ++n % skip === 0 && createWindow(); }, function (e) { while (q.length > 0) { q.shift().onError(e); } observer.onError(e); }, function () { while (q.length > 0) { q.shift().onCompleted(); } observer.onCompleted(); } )); return refCountDisposable; }, source); }; function concatMap(source, selector, thisArg) { var selectorFunc = bindCallback(selector, thisArg, 3); return source.map(function (x, i) { var result = selectorFunc(x, i, source); isPromise(result) && (result = observableFromPromise(result)); (isArrayLike(result) || isIterable(result)) && (result = observableFrom(result)); return result; }).concatAll(); } /** * One of the Following: * Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence. * * @example * var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); }); * Or: * Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence. * * var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; }); * Or: * Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence. * * var res = source.concatMap(Rx.Observable.fromArray([1,2,3])); * @param {Function} selector A transform function to apply to each element or an observable sequence to project each element from the * source sequence onto which could be either an observable or Promise. * @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence. * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element. */ observableProto.selectConcat = observableProto.concatMap = function (selector, resultSelector, thisArg) { if (isFunction(selector) && isFunction(resultSelector)) { return this.concatMap(function (x, i) { var selectorResult = selector(x, i); isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult)); (isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult)); return selectorResult.map(function (y, i2) { return resultSelector(x, y, i, i2); }); }); } return isFunction(selector) ? concatMap(this, selector, thisArg) : concatMap(this, function () { return selector; }); }; /** * Projects each notification of an observable sequence to an observable sequence and concats the resulting observable sequences into one observable sequence. * @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element. * @param {Function} onError A transform function to apply when an error occurs in the source sequence. * @param {Function} onCompleted A transform function to apply when the end of the source sequence is reached. * @param {Any} [thisArg] An optional "this" to use to invoke each transform. * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence. */ observableProto.concatMapObserver = observableProto.selectConcatObserver = function(onNext, onError, onCompleted, thisArg) { var source = this, onNextFunc = bindCallback(onNext, thisArg, 2), onErrorFunc = bindCallback(onError, thisArg, 1), onCompletedFunc = bindCallback(onCompleted, thisArg, 0); return new AnonymousObservable(function (observer) { var index = 0; return source.subscribe( function (x) { var result; try { result = onNextFunc(x, index++); } catch (e) { observer.onError(e); return; } isPromise(result) && (result = observableFromPromise(result)); observer.onNext(result); }, function (err) { var result; try { result = onErrorFunc(err); } catch (e) { observer.onError(e); return; } isPromise(result) && (result = observableFromPromise(result)); observer.onNext(result); observer.onCompleted(); }, function () { var result; try { result = onCompletedFunc(); } catch (e) { observer.onError(e); return; } isPromise(result) && (result = observableFromPromise(result)); observer.onNext(result); observer.onCompleted(); }); }, this).concatAll(); }; /** * Returns the elements of the specified sequence or the specified value in a singleton sequence if the sequence is empty. * * var res = obs = xs.defaultIfEmpty(); * 2 - obs = xs.defaultIfEmpty(false); * * @memberOf Observable# * @param defaultValue The value to return if the sequence is empty. If not provided, this defaults to null. * @returns {Observable} An observable sequence that contains the specified default value if the source is empty; otherwise, the elements of the source itself. */ observableProto.defaultIfEmpty = function (defaultValue) { var source = this; defaultValue === undefined && (defaultValue = null); return new AnonymousObservable(function (observer) { var found = false; return source.subscribe(function (x) { found = true; observer.onNext(x); }, function (e) { observer.onError(e); }, function () { !found && observer.onNext(defaultValue); observer.onCompleted(); }); }, source); }; // Swap out for Array.findIndex function arrayIndexOfComparer(array, item, comparer) { for (var i = 0, len = array.length; i < len; i++) { if (comparer(array[i], item)) { return i; } } return -1; } function HashSet(comparer) { this.comparer = comparer; this.set = []; } HashSet.prototype.push = function(value) { var retValue = arrayIndexOfComparer(this.set, value, this.comparer) === -1; retValue && this.set.push(value); return retValue; }; /** * Returns an observable sequence that contains only distinct elements according to the keySelector and the comparer. * Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large. * * @example * var res = obs = xs.distinct(); * 2 - obs = xs.distinct(function (x) { return x.id; }); * 2 - obs = xs.distinct(function (x) { return x.id; }, function (a,b) { return a === b; }); * @param {Function} [keySelector] A function to compute the comparison key for each element. * @param {Function} [comparer] Used to compare items in the collection. * @returns {Observable} An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence. */ observableProto.distinct = function (keySelector, comparer) { var source = this; comparer || (comparer = defaultComparer); return new AnonymousObservable(function (o) { var hashSet = new HashSet(comparer); return source.subscribe(function (x) { var key = x; if (keySelector) { try { key = keySelector(x); } catch (e) { o.onError(e); return; } } hashSet.push(key) && o.onNext(x); }, function (e) { o.onError(e); }, function () { o.onCompleted(); }); }, this); }; var MapObservable = (function (__super__) { inherits(MapObservable, __super__); function MapObservable(source, selector, thisArg) { this.source = source; this.selector = bindCallback(selector, thisArg, 3); __super__.call(this); } MapObservable.prototype.internalMap = function (selector, thisArg) { var self = this; return new MapObservable(this.source, function (x, i, o) { return selector.call(this, self.selector(x, i, o), i, o); }, thisArg) }; MapObservable.prototype.subscribeCore = function (observer) { return this.source.subscribe(new MapObserver(observer, this.selector, this)); }; return MapObservable; }(ObservableBase)); function MapObserver(observer, selector, source) { this.observer = observer; this.selector = selector; this.source = source; this.i = 0; this.isStopped = false; } MapObserver.prototype.onNext = function(x) { if (this.isStopped) { return; } var result = tryCatch(this.selector).call(this, x, this.i++, this.source); if (result === errorObj) { return this.observer.onError(result.e); } this.observer.onNext(result); }; MapObserver.prototype.onError = function (e) { if(!this.isStopped) { this.isStopped = true; this.observer.onError(e); } }; MapObserver.prototype.onCompleted = function () { if(!this.isStopped) { this.isStopped = true; this.observer.onCompleted(); } }; MapObserver.prototype.dispose = function() { this.isStopped = true; }; MapObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.observer.onError(e); return true; } return false; }; /** * Projects each element of an observable sequence into a new form by incorporating the element's index. * @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source. */ observableProto.map = observableProto.select = function (selector, thisArg) { var selectorFn = typeof selector === 'function' ? selector : function () { return selector; }; return this instanceof MapObservable ? this.internalMap(selectorFn, thisArg) : new MapObservable(this, selectorFn, thisArg); }; /** * Retrieves the value of a specified nested property from all elements in * the Observable sequence. * @param {Arguments} arguments The nested properties to pluck. * @returns {Observable} Returns a new Observable sequence of property values. */ observableProto.pluck = function () { var args = arguments, len = arguments.length; if (len === 0) { throw new Error('List of properties cannot be empty.'); } return this.map(function (x) { var currentProp = x; for (var i = 0; i < len; i++) { var p = currentProp[args[i]]; if (typeof p !== 'undefined') { currentProp = p; } else { return undefined; } } return currentProp; }); }; function flatMap(source, selector, thisArg) { var selectorFunc = bindCallback(selector, thisArg, 3); return source.map(function (x, i) { var result = selectorFunc(x, i, source); isPromise(result) && (result = observableFromPromise(result)); (isArrayLike(result) || isIterable(result)) && (result = observableFrom(result)); return result; }).mergeAll(); } /** * One of the Following: * Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence. * * @example * var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); }); * Or: * Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence. * * var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; }); * Or: * Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence. * * var res = source.selectMany(Rx.Observable.fromArray([1,2,3])); * @param {Function} selector A transform function to apply to each element or an observable sequence to project each element from the source sequence onto which could be either an observable or Promise. * @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element. */ observableProto.selectMany = observableProto.flatMap = function (selector, resultSelector, thisArg) { if (isFunction(selector) && isFunction(resultSelector)) { return this.flatMap(function (x, i) { var selectorResult = selector(x, i); isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult)); (isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult)); return selectorResult.map(function (y, i2) { return resultSelector(x, y, i, i2); }); }, thisArg); } return isFunction(selector) ? flatMap(this, selector, thisArg) : flatMap(this, function () { return selector; }); }; /** * Projects each notification of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence. * @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element. * @param {Function} onError A transform function to apply when an error occurs in the source sequence. * @param {Function} onCompleted A transform function to apply when the end of the source sequence is reached. * @param {Any} [thisArg] An optional "this" to use to invoke each transform. * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence. */ observableProto.flatMapObserver = observableProto.selectManyObserver = function (onNext, onError, onCompleted, thisArg) { var source = this; return new AnonymousObservable(function (observer) { var index = 0; return source.subscribe( function (x) { var result; try { result = onNext.call(thisArg, x, index++); } catch (e) { observer.onError(e); return; } isPromise(result) && (result = observableFromPromise(result)); observer.onNext(result); }, function (err) { var result; try { result = onError.call(thisArg, err); } catch (e) { observer.onError(e); return; } isPromise(result) && (result = observableFromPromise(result)); observer.onNext(result); observer.onCompleted(); }, function () { var result; try { result = onCompleted.call(thisArg); } catch (e) { observer.onError(e); return; } isPromise(result) && (result = observableFromPromise(result)); observer.onNext(result); observer.onCompleted(); }); }, source).mergeAll(); }; /** * Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then * transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence. * @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences * and that at any point in time produces the elements of the most recent inner observable sequence that has been received. */ observableProto.selectSwitch = observableProto.flatMapLatest = observableProto.switchMap = function (selector, thisArg) { return this.select(selector, thisArg).switchLatest(); }; /** * Bypasses a specified number of elements in an observable sequence and then returns the remaining elements. * @param {Number} count The number of elements to skip before returning the remaining elements. * @returns {Observable} An observable sequence that contains the elements that occur after the specified index in the input sequence. */ observableProto.skip = function (count) { if (count < 0) { throw new ArgumentOutOfRangeError(); } var source = this; return new AnonymousObservable(function (o) { var remaining = count; return source.subscribe(function (x) { if (remaining <= 0) { o.onNext(x); } else { remaining--; } }, function (e) { o.onError(e); }, function () { o.onCompleted(); }); }, source); }; /** * Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements. * The element's index is used in the logic of the predicate function. * * var res = source.skipWhile(function (value) { return value < 10; }); * var res = source.skipWhile(function (value, index) { return value < 10 || index < 10; }); * @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate. */ observableProto.skipWhile = function (predicate, thisArg) { var source = this, callback = bindCallback(predicate, thisArg, 3); return new AnonymousObservable(function (o) { var i = 0, running = false; return source.subscribe(function (x) { if (!running) { try { running = !callback(x, i++, source); } catch (e) { o.onError(e); return; } } running && o.onNext(x); }, function (e) { o.onError(e); }, function () { o.onCompleted(); }); }, source); }; /** * Returns a specified number of contiguous elements from the start of an observable sequence, using the specified scheduler for the edge case of take(0). * * var res = source.take(5); * var res = source.take(0, Rx.Scheduler.timeout); * @param {Number} count The number of elements to return. * @param {Scheduler} [scheduler] Scheduler used to produce an OnCompleted message in case <paramref name="count count</paramref> is set to 0. * @returns {Observable} An observable sequence that contains the specified number of elements from the start of the input sequence. */ observableProto.take = function (count, scheduler) { if (count < 0) { throw new ArgumentOutOfRangeError(); } if (count === 0) { return observableEmpty(scheduler); } var source = this; return new AnonymousObservable(function (o) { var remaining = count; return source.subscribe(function (x) { if (remaining-- > 0) { o.onNext(x); remaining === 0 && o.onCompleted(); } }, function (e) { o.onError(e); }, function () { o.onCompleted(); }); }, source); }; /** * Returns elements from an observable sequence as long as a specified condition is true. * The element's index is used in the logic of the predicate function. * @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes. */ observableProto.takeWhile = function (predicate, thisArg) { var source = this, callback = bindCallback(predicate, thisArg, 3); return new AnonymousObservable(function (o) { var i = 0, running = true; return source.subscribe(function (x) { if (running) { try { running = callback(x, i++, source); } catch (e) { o.onError(e); return; } if (running) { o.onNext(x); } else { o.onCompleted(); } } }, function (e) { o.onError(e); }, function () { o.onCompleted(); }); }, source); }; var FilterObservable = (function (__super__) { inherits(FilterObservable, __super__); function FilterObservable(source, predicate, thisArg) { this.source = source; this.predicate = bindCallback(predicate, thisArg, 3); __super__.call(this); } FilterObservable.prototype.subscribeCore = function (observer) { return this.source.subscribe(new FilterObserver(observer, this.predicate, this)); }; FilterObservable.prototype.internalFilter = function(predicate, thisArg) { var self = this; return new FilterObservable(this.source, function(x, i, o) { return self.predicate(x, i, o) && predicate.call(this, x, i, o); }, thisArg); }; return FilterObservable; }(ObservableBase)); function FilterObserver(observer, predicate, source) { this.observer = observer; this.predicate = predicate; this.source = source; this.i = 0; this.isStopped = false; } FilterObserver.prototype.onNext = function(x) { if (this.isStopped) { return; } var shouldYield = tryCatch(this.predicate).call(this, x, this.i++, this.source); if (shouldYield === errorObj) { return this.observer.onError(shouldYield.e); } shouldYield && this.observer.onNext(x); }; FilterObserver.prototype.onError = function (e) { if(!this.isStopped) { this.isStopped = true; this.observer.onError(e); } }; FilterObserver.prototype.onCompleted = function () { if(!this.isStopped) { this.isStopped = true; this.observer.onCompleted(); } }; FilterObserver.prototype.dispose = function() { this.isStopped = true; }; FilterObserver.prototype.fail = function (e) { if (!this.isStopped) { this.isStopped = true; this.observer.onError(e); return true; } return false; }; /** * Filters the elements of an observable sequence based on a predicate by incorporating the element's index. * @param {Function} predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element. * @param {Any} [thisArg] Object to use as this when executing callback. * @returns {Observable} An observable sequence that contains elements from the input sequence that satisfy the condition. */ observableProto.filter = observableProto.where = function (predicate, thisArg) { return this instanceof FilterObservable ? this.internalFilter(predicate, thisArg) : new FilterObservable(this, predicate, thisArg); }; /** * Executes a transducer to transform the observable sequence * @param {Transducer} transducer A transducer to execute * @returns {Observable} An Observable sequence containing the results from the transducer. */ observableProto.transduce = function(transducer) { var source = this; function transformForObserver(o) { return { '@@transducer/init': function() { return o; }, '@@transducer/step': function(obs, input) { return obs.onNext(input); }, '@@transducer/result': function(obs) { return obs.onCompleted(); } }; } return new AnonymousObservable(function(o) { var xform = transducer(transformForObserver(o)); return source.subscribe( function(v) { try { xform['@@transducer/step'](o, v); } catch (e) { o.onError(e); } }, function (e) { o.onError(e); }, function() { xform['@@transducer/result'](o); } ); }, source); }; var AnonymousObservable = Rx.AnonymousObservable = (function (__super__) { inherits(AnonymousObservable, __super__); // Fix subscriber to check for undefined or function returned to decorate as Disposable function fixSubscriber(subscriber) { return subscriber && isFunction(subscriber.dispose) ? subscriber : isFunction(subscriber) ? disposableCreate(subscriber) : disposableEmpty; } function setDisposable(s, state) { var ado = state[0], subscribe = state[1]; var sub = tryCatch(subscribe)(ado); if (sub === errorObj) { if(!ado.fail(errorObj.e)) { return thrower(errorObj.e); } } ado.setDisposable(fixSubscriber(sub)); } function AnonymousObservable(subscribe, parent) { this.source = parent; function s(observer) { var ado = new AutoDetachObserver(observer), state = [ado, subscribe]; if (currentThreadScheduler.scheduleRequired()) { currentThreadScheduler.scheduleWithState(state, setDisposable); } else { setDisposable(null, state); } return ado; } __super__.call(this, s); } return AnonymousObservable; }(Observable)); var AutoDetachObserver = (function (__super__) { inherits(AutoDetachObserver, __super__); function AutoDetachObserver(observer) { __super__.call(this); this.observer = observer; this.m = new SingleAssignmentDisposable(); } var AutoDetachObserverPrototype = AutoDetachObserver.prototype; AutoDetachObserverPrototype.next = function (value) { var result = tryCatch(this.observer.onNext).call(this.observer, value); if (result === errorObj) { this.dispose(); thrower(result.e); } }; AutoDetachObserverPrototype.error = function (err) { var result = tryCatch(this.observer.onError).call(this.observer, err); this.dispose(); result === errorObj && thrower(result.e); }; AutoDetachObserverPrototype.completed = function () { var result = tryCatch(this.observer.onCompleted).call(this.observer); this.dispose(); result === errorObj && thrower(result.e); }; AutoDetachObserverPrototype.setDisposable = function (value) { this.m.setDisposable(value); }; AutoDetachObserverPrototype.getDisposable = function () { return this.m.getDisposable(); }; AutoDetachObserverPrototype.dispose = function () { __super__.prototype.dispose.call(this); this.m.dispose(); }; return AutoDetachObserver; }(AbstractObserver)); var InnerSubscription = function (subject, observer) { this.subject = subject; this.observer = observer; }; InnerSubscription.prototype.dispose = function () { if (!this.subject.isDisposed && this.observer !== null) { var idx = this.subject.observers.indexOf(this.observer); this.subject.observers.splice(idx, 1); this.observer = null; } }; /** * Represents an object that is both an observable sequence as well as an observer. * Each notification is broadcasted to all subscribed observers. */ var Subject = Rx.Subject = (function (__super__) { function subscribe(observer) { checkDisposed(this); if (!this.isStopped) { this.observers.push(observer); return new InnerSubscription(this, observer); } if (this.hasError) { observer.onError(this.error); return disposableEmpty; } observer.onCompleted(); return disposableEmpty; } inherits(Subject, __super__); /** * Creates a subject. */ function Subject() { __super__.call(this, subscribe); this.isDisposed = false, this.isStopped = false, this.observers = []; this.hasError = false; } addProperties(Subject.prototype, Observer.prototype, { /** * Indicates whether the subject has observers subscribed to it. * @returns {Boolean} Indicates whether the subject has observers subscribed to it. */ hasObservers: function () { return this.observers.length > 0; }, /** * Notifies all subscribed observers about the end of the sequence. */ onCompleted: function () { checkDisposed(this); if (!this.isStopped) { this.isStopped = true; for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) { os[i].onCompleted(); } this.observers.length = 0; } }, /** * Notifies all subscribed observers about the exception. * @param {Mixed} error The exception to send to all observers. */ onError: function (error) { checkDisposed(this); if (!this.isStopped) { this.isStopped = true; this.error = error; this.hasError = true; for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) { os[i].onError(error); } this.observers.length = 0; } }, /** * Notifies all subscribed observers about the arrival of the specified element in the sequence. * @param {Mixed} value The value to send to all observers. */ onNext: function (value) { checkDisposed(this); if (!this.isStopped) { for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) { os[i].onNext(value); } } }, /** * Unsubscribe all observers and release resources. */ dispose: function () { this.isDisposed = true; this.observers = null; } }); /** * Creates a subject from the specified observer and observable. * @param {Observer} observer The observer used to send messages to the subject. * @param {Observable} observable The observable used to subscribe to messages sent from the subject. * @returns {Subject} Subject implemented using the given observer and observable. */ Subject.create = function (observer, observable) { return new AnonymousSubject(observer, observable); }; return Subject; }(Observable)); /** * Represents the result of an asynchronous operation. * The last value before the OnCompleted notification, or the error received through OnError, is sent to all subscribed observers. */ var AsyncSubject = Rx.AsyncSubject = (function (__super__) { function subscribe(observer) { checkDisposed(this); if (!this.isStopped) { this.observers.push(observer); return new InnerSubscription(this, observer); } if (this.hasError) { observer.onError(this.error); } else if (this.hasValue) { observer.onNext(this.value); observer.onCompleted(); } else { observer.onCompleted(); } return disposableEmpty; } inherits(AsyncSubject, __super__); /** * Creates a subject that can only receive one value and that value is cached for all future observations. * @constructor */ function AsyncSubject() { __super__.call(this, subscribe); this.isDisposed = false; this.isStopped = false; this.hasValue = false; this.observers = []; this.hasError = false; } addProperties(AsyncSubject.prototype, Observer, { /** * Indicates whether the subject has observers subscribed to it. * @returns {Boolean} Indicates whether the subject has observers subscribed to it. */ hasObservers: function () { checkDisposed(this); return this.observers.length > 0; }, /** * Notifies all subscribed observers about the end of the sequence, also causing the last received value to be sent out (if any). */ onCompleted: function () { var i, len; checkDisposed(this); if (!this.isStopped) { this.isStopped = true; var os = cloneArray(this.observers), len = os.length; if (this.hasValue) { for (i = 0; i < len; i++) { var o = os[i]; o.onNext(this.value); o.onCompleted(); } } else { for (i = 0; i < len; i++) { os[i].onCompleted(); } } this.observers.length = 0; } }, /** * Notifies all subscribed observers about the error. * @param {Mixed} error The Error to send to all observers. */ onError: function (error) { checkDisposed(this); if (!this.isStopped) { this.isStopped = true; this.hasError = true; this.error = error; for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) { os[i].onError(error); } this.observers.length = 0; } }, /** * Sends a value to the subject. The last value received before successful termination will be sent to all subscribed and future observers. * @param {Mixed} value The value to store in the subject. */ onNext: function (value) { checkDisposed(this); if (this.isStopped) { return; } this.value = value; this.hasValue = true; }, /** * Unsubscribe all observers and release resources. */ dispose: function () { this.isDisposed = true; this.observers = null; this.exception = null; this.value = null; } }); return AsyncSubject; }(Observable)); var AnonymousSubject = Rx.AnonymousSubject = (function (__super__) { inherits(AnonymousSubject, __super__); function subscribe(observer) { return this.observable.subscribe(observer); } function AnonymousSubject(observer, observable) { this.observer = observer; this.observable = observable; __super__.call(this, subscribe); } addProperties(AnonymousSubject.prototype, Observer.prototype, { onCompleted: function () { this.observer.onCompleted(); }, onError: function (error) { this.observer.onError(error); }, onNext: function (value) { this.observer.onNext(value); } }); return AnonymousSubject; }(Observable)); if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { root.Rx = Rx; define(function() { return Rx; }); } else if (freeExports && freeModule) { // in Node.js or RingoJS if (moduleExports) { (freeModule.exports = Rx).Rx = Rx; } else { freeExports.Rx = Rx; } } else { // in a browser or Rhino root.Rx = Rx; } // All code before this point will be filtered from stack traces. var rEndingLine = captureLine(); }.call(this));
karna41317/personal_blog
node_modules/bower/node_modules/inquirer/node_modules/rx/dist/rx.compat.js
JavaScript
mit
198,153
// Underscore.js // (c) 2009 Jeremy Ashkenas, DocumentCloud Inc. // Underscore is freely distributable under the terms of the MIT license. // Portions of Underscore are inspired by or borrowed from Prototype.js, // Oliver Steele's Functional, and John Resig's Micro-Templating. // For all details and documentation: // http://documentcloud.github.com/underscore/ (function() { /*------------------------- Baseline setup ---------------------------------*/ // Are we running in CommonJS or in the browser? var commonJS = (typeof window === 'undefined' && typeof exports !== 'undefined'); // Save the previous value of the "_" variable. var previousUnderscore = commonJS ? null : window._; // Keep the identity function around for default iterators. var identity = function(value) { return value; }; // Create a safe reference to the Underscore object for the functions below. var _ = {}; // Export the Underscore object for CommonJS, assign it globally otherwise. commonJS ? _ = exports : window._ = _; // Current version. _.VERSION = '0.3.1'; /*------------------------ Collection Functions: ---------------------------*/ // The cornerstone, an each implementation. // Handles objects implementing forEach, each, arrays, and raw objects. _.each = function(obj, iterator, context) { var index = 0; try { if (obj.forEach) { obj.forEach(iterator, context); } else if (obj.length) { for (var i=0, l = obj.length; i<l; i++) iterator.call(context, obj[i], i, obj); } else if (obj.each) { obj.each(function(value) { iterator.call(context, value, index++, obj); }); } else { for (var key in obj) if (Object.prototype.hasOwnProperty.call(obj, key)) { iterator.call(context, obj[key], key, obj); } } } catch(e) { if (e != '__break__') throw e; } return obj; }; // Return the results of applying the iterator to each element. Use JavaScript // 1.6's version of map, if possible. _.map = function(obj, iterator, context) { if (obj && obj.map) return obj.map(iterator, context); var results = []; _.each(obj, function(value, index, list) { results.push(iterator.call(context, value, index, list)); }); return results; }; // Reduce builds up a single result from a list of values. Also known as // inject, or foldl. _.reduce = function(obj, memo, iterator, context) { _.each(obj, function(value, index, list) { memo = iterator.call(context, memo, value, index, list); }); return memo; }; // Return the first value which passes a truth test. _.detect = function(obj, iterator, context) { var result; _.each(obj, function(value, index, list) { if (iterator.call(context, value, index, list)) { result = value; throw '__break__'; } }); return result; }; // Return all the elements that pass a truth test. Use JavaScript 1.6's // filter(), if it exists. _.select = function(obj, iterator, context) { if (obj.filter) return obj.filter(iterator, context); var results = []; _.each(obj, function(value, index, list) { iterator.call(context, value, index, list) && results.push(value); }); return results; }; // Return all the elements for which a truth test fails. _.reject = function(obj, iterator, context) { var results = []; _.each(obj, function(value, index, list) { !iterator.call(context, value, index, list) && results.push(value); }); return results; }; // Determine whether all of the elements match a truth test. Delegate to // JavaScript 1.6's every(), if it is present. _.all = function(obj, iterator, context) { iterator = iterator || identity; if (obj.every) return obj.every(iterator, context); var result = true; _.each(obj, function(value, index, list) { if (!(result = result && iterator.call(context, value, index, list))) throw '__break__'; }); return result; }; // Determine if at least one element in the object matches a truth test. Use // JavaScript 1.6's some(), if it exists. _.any = function(obj, iterator, context) { iterator = iterator || identity; if (obj.some) return obj.some(iterator, context); var result = false; _.each(obj, function(value, index, list) { if (result = iterator.call(context, value, index, list)) throw '__break__'; }); return result; }; // Determine if a given value is included in the array or object, // based on '==='. _.include = function(obj, target) { if (_.isArray(obj)) return _.indexOf(obj, target) != -1; var found = false; _.each(obj, function(value) { if (found = value === target) { throw '__break__'; } }); return found; }; // Invoke a method with arguments on every item in a collection. _.invoke = function(obj, method) { var args = _.toArray(arguments).slice(2); return _.map(obj, function(value) { return (method ? value[method] : value).apply(value, args); }); }; // Convenience version of a common use case of map: fetching a property. _.pluck = function(obj, key) { return _.map(obj, function(value){ return value[key]; }); }; // Return the maximum item or (item-based computation). _.max = function(obj, iterator, context) { if (!iterator && _.isArray(obj)) return Math.max.apply(Math, obj); var result = {computed : -Infinity}; _.each(obj, function(value, index, list) { var computed = iterator ? iterator.call(context, value, index, list) : value; computed >= result.computed && (result = {value : value, computed : computed}); }); return result.value; }; // Return the minimum element (or element-based computation). _.min = function(obj, iterator, context) { if (!iterator && _.isArray(obj)) return Math.min.apply(Math, obj); var result = {computed : Infinity}; _.each(obj, function(value, index, list) { var computed = iterator ? iterator.call(context, value, index, list) : value; computed < result.computed && (result = {value : value, computed : computed}); }); return result.value; }; // Sort the object's values by a criteria produced by an iterator. _.sortBy = function(obj, iterator, context) { return _.pluck(_.map(obj, function(value, index, list) { return { value : value, criteria : iterator.call(context, value, index, list) }; }).sort(function(left, right) { var a = left.criteria, b = right.criteria; return a < b ? -1 : a > b ? 1 : 0; }), 'value'); }; // Use a comparator function to figure out at what index an object should // be inserted so as to maintain order. Uses binary search. _.sortedIndex = function(array, obj, iterator) { iterator = iterator || identity; var low = 0, high = array.length; while (low < high) { var mid = (low + high) >> 1; iterator(array[mid]) < iterator(obj) ? low = mid + 1 : high = mid; } return low; }; // Convert anything iterable into a real, live array. _.toArray = function(iterable) { if (!iterable) return []; if (_.isArray(iterable)) return iterable; return _.map(iterable, function(val){ return val; }); }; // Return the number of elements in an object. _.size = function(obj) { return _.toArray(obj).length; }; /*-------------------------- Array Functions: ------------------------------*/ // Get the first element of an array. _.first = function(array) { return array[0]; }; // Get the last element of an array. _.last = function(array) { return array[array.length - 1]; }; // Trim out all falsy values from an array. _.compact = function(array) { return _.select(array, function(value){ return !!value; }); }; // Return a completely flattened version of an array. _.flatten = function(array) { return _.reduce(array, [], function(memo, value) { if (_.isArray(value)) return memo.concat(_.flatten(value)); memo.push(value); return memo; }); }; // Return a version of the array that does not contain the specified value(s). _.without = function(array) { var values = array.slice.call(arguments, 0); return _.select(array, function(value){ return !_.include(values, value); }); }; // Produce a duplicate-free version of the array. If the array has already // been sorted, you have the option of using a faster algorithm. _.uniq = function(array, isSorted) { return _.reduce(array, [], function(memo, el, i) { if (0 == i || (isSorted ? _.last(memo) != el : !_.include(memo, el))) memo.push(el); return memo; }); }; // Produce an array that contains every item shared between all the // passed-in arrays. _.intersect = function(array) { var rest = _.toArray(arguments).slice(1); return _.select(_.uniq(array), function(item) { return _.all(rest, function(other) { return _.indexOf(other, item) >= 0; }); }); }; // Zip together multiple lists into a single array -- elements that share // an index go together. _.zip = function() { var args = _.toArray(arguments); var length = _.max(_.pluck(args, 'length')); var results = new Array(length); for (var i=0; i<length; i++) results[i] = _.pluck(args, String(i)); return results; }; // If the browser doesn't supply us with indexOf (I'm looking at you, MSIE), // we need this function. Return the position of the first occurence of an // item in an array, or -1 if the item is not included in the array. _.indexOf = function(array, item) { if (array.indexOf) return array.indexOf(item); for (i=0, l=array.length; i<l; i++) if (array[i] === item) return i; return -1; }; // Provide JavaScript 1.6's lastIndexOf, delegating to the native function, // if possible. _.lastIndexOf = function(array, item) { if (array.lastIndexOf) return array.lastIndexOf(item); var i = array.length; while (i--) if (array[i] === item) return i; return -1; }; /* ----------------------- Function Functions: -----------------------------*/ // Create a function bound to a given object (assigning 'this', and arguments, // optionally). Binding with arguments is also known as 'curry'. _.bind = function(func, context) { if (!context) return func; var args = _.toArray(arguments).slice(2); return function() { var a = args.concat(_.toArray(arguments)); return func.apply(context, a); }; }; // Bind all of an object's methods to that object. Useful for ensuring that // all callbacks defined on an object belong to it. _.bindAll = function() { var args = _.toArray(arguments); var context = args.pop(); _.each(args, function(methodName) { context[methodName] = _.bind(context[methodName], context); }); }; // Delays a function for the given number of milliseconds, and then calls // it with the arguments supplied. _.delay = function(func, wait) { var args = _.toArray(arguments).slice(2); return setTimeout(function(){ return func.apply(func, args); }, wait); }; // Defers a function, scheduling it to run after the current call stack has // cleared. _.defer = function(func) { return _.delay.apply(_, [func, 1].concat(_.toArray(arguments).slice(1))); }; // 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 function() { var args = [func].concat(_.toArray(arguments)); return wrapper.apply(wrapper, args); }; }; // 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 funcs = _.toArray(arguments); return function() { for (var i=funcs.length-1; i >= 0; i--) { arguments = [funcs[i].apply(this, arguments)]; } return arguments[0]; }; }; /* ------------------------- Object Functions: ---------------------------- */ // Retrieve the names of an object's properties. _.keys = function(obj) { return _.map(obj, function(value, key){ return key; }); }; // Retrieve the values of an object's properties. _.values = function(obj) { return _.map(obj, identity); }; // Extend a given object with all of the properties in a source object. _.extend = function(destination, source) { for (var property in source) destination[property] = source[property]; return destination; }; // Create a (shallow-cloned) duplicate of an object. _.clone = function(obj) { return _.extend({}, obj); }; // Perform a deep comparison to check if two objects are equal. _.isEqual = function(a, b) { // Check object identity. if (a === b) return true; // Different types? var atype = typeof(a), btype = typeof(b); if (atype != btype) return false; // Basic equality test (watch out for coercions). if (a == b) return true; // One of them implements an isEqual()? if (a.isEqual) return a.isEqual(b); // If a is not an object by this point, we can't handle it. if (atype !== 'object') return false; // Nothing else worked, deep compare the contents. var aKeys = _.keys(a), bKeys = _.keys(b); // Different object sizes? if (aKeys.length != bKeys.length) return false; // Recursive comparison of contents. for (var key in a) if (!_.isEqual(a[key], b[key])) return false; return true; }; // Is a given value a DOM element? _.isElement = function(obj) { return !!(obj && obj.nodeType == 1); }; // Is a given value a real Array? _.isArray = function(obj) { return Object.prototype.toString.call(obj) == '[object Array]'; }; // Is a given value a Function? _.isFunction = function(obj) { return Object.prototype.toString.call(obj) == '[object Function]'; }; // Is a given variable undefined? _.isUndefined = function(obj) { return typeof obj == 'undefined'; }; /* -------------------------- Utility Functions: -------------------------- */ // Run Underscore.js in noConflict mode, returning the '_' variable to its // previous owner. Returns a reference to the Underscore object. _.noConflict = function() { if (!commonJS) window._ = previousUnderscore; return this; }; // Generate a unique integer id (unique within the entire client session). // Useful for temporary DOM ids. _.uniqueId = function(prefix) { var id = this._idCounter = (this._idCounter || 0) + 1; return prefix ? prefix + id : id; }; // JavaScript templating a-la ERB, pilfered from John Resig's // "Secrets of the JavaScript Ninja", page 83. _.template = function(str, data) { var fn = new Function('obj', 'var p=[],print=function(){p.push.apply(p,arguments);};' + 'with(obj){p.push(\'' + str .replace(/[\r\t\n]/g, " ") .split("<%").join("\t") .replace(/((^|%>)[^\t]*)'/g, "$1\r") .replace(/\t=(.*?)%>/g, "',$1,'") .split("\t").join("');") .split("%>").join("p.push('") .split("\r").join("\\'") + "');}return p.join('');"); return data ? fn(data) : fn; }; /*------------------------------- Aliases ----------------------------------*/ _.forEach = _.each; _.inject = _.reduce; _.filter = _.select; _.every = _.all; _.some = _.any; })();
senekis/cdnjs
ajax/libs/underscore.js/0.3.1/underscore.js
JavaScript
mit
15,766
/** * Restfull Resources service for AngularJS apps * @version v1.0.1 - 2013-06-25 * @link https://github.com/mgonto/restangular * @author Martin Gontovnikas <martin@gonto.com.ar> * @license MIT License, http://www.opensource.org/licenses/MIT */ (function(){ var module = angular.module('restangular', []); module.provider('Restangular', function() { // Configuration var Configurer = {}; Configurer.init = function(object, config) { /** * Those are HTTP safe methods for which there is no need to pass any data with the request. */ var safeMethods= ["get", "head", "options", "trace"]; config.isSafe = function(operation) { return _.contains(safeMethods, operation.toLowerCase()); } /** * This is the BaseURL to be used with Restangular */ config.baseUrl = _.isUndefined(config.baseUrl) ? "" : config.baseUrl; object.setBaseUrl = function(newBaseUrl) { config.baseUrl = newBaseUrl; } /** * Sets the extra fields to keep from the parents */ config.extraFields = config.extraFields || []; object.setExtraFields = function(newExtraFields) { config.extraFields = newExtraFields; } /** * Some default $http parameter to be used in EVERY call **/ config.defaultHttpFields = config.defaultHttpFields || {}; object.setDefaultHttpFields = function(values) { config.defaultHttpFields = values; } config.withHttpDefaults = function(obj) { return _.defaults(obj, config.defaultHttpFields); } config.defaultRequestParams = config.defaultRequestParams || {}; object.setDefaultRequestParams = function(values) { config.defaultRequestParams = values; } config.defaultHeaders = config.defaultHeaders || {}; object.setDefaultHeaders = function(headers) { config.defaultHeaders = headers; } /** * Method overriders will set which methods are sent via POST with an X-HTTP-Method-Override **/ config.methodOverriders = config.methodOverriders || []; object.setMethodOverriders = function(values) { var overriders = _.extend([], values); if (config.isOverridenMethod('delete', overriders)) { overriders.push("remove"); } config.methodOverriders = overriders; } config.isOverridenMethod = function(method, values) { var search = values || config.methodOverriders; return !_.isUndefined(_.find(search, function(one) { return one.toLowerCase() === method.toLowerCase(); })); } /** * Sets the URL creator type. For now, only Path is created. In the future we'll have queryParams **/ config.urlCreator = config.urlCreator || "path"; object.setUrlCreator = function(name) { if (!_.has(config.urlCreatorFactory, name)) { throw new Error("URL Path selected isn't valid"); } config.urlCreator = name; } /** * You can set the restangular fields here. The 3 required fields for Restangular are: * * id: Id of the element * route: name of the route of this element * parentResource: the reference to the parent resource * * All of this fields except for id, are handled (and created) by Restangular. By default, * the field values will be id, route and parentResource respectively */ config.restangularFields = config.restangularFields || { id: "id", route: "route", parentResource: "parentResource", restangularCollection: "restangularCollection" } object.setRestangularFields = function(resFields) { config.restangularFields = _.extend(config.restangularFields, resFields); } config.setIdToElem = function(elem, id) { var properties = config.restangularFields.id.split('.'); var idValue = elem; _.each(_.initial(properties), function(prop) { idValue[prop] = {}; idValue = idValue[prop]; }); idValue[_.last(properties)] = id; } config.getIdFromElem = function(elem) { var properties = config.restangularFields.id.split('.'); var idValue = angular.copy(elem); _.each(properties, function(prop) { idValue = idValue[prop]; }); return idValue; } /** * Sets the Response parser. This is used in case your response isn't directly the data. * For example if you have a response like {meta: {'meta'}, data: {name: 'Gonto'}} * you can extract this data which is the one that needs wrapping * * The ResponseExtractor is a function that receives the response and the method executed. */ config.responseExtractor = config.responseExtractor || function(response) { return response; } object.setResponseExtractor = function(extractor) { config.responseExtractor = extractor; } object.setResponseInterceptor = object.setResponseExtractor; /** * Request interceptor is called before sending an object to the server. */ config.fullRequestInterceptor = config.fullRequestInterceptor || function(element, operation, path, url, headers, params) { return { element: element, headers: headers, params: params }; } object.setRequestInterceptor = function(interceptor) { config.fullRequestInterceptor = function(elem, operation, path, url, headers, params) { return { headers: headers, params: params, element: interceptor(elem, operation, path, url) } }; } object.setFullRequestInterceptor = function(interceptor) { config.fullRequestInterceptor = interceptor; } config.errorInterceptor = config.errorInterceptor || function() {}; object.setErrorInterceptor = function(interceptor) { config.errorInterceptor = interceptor; } /** * This method is called after an element has been "Restangularized". * * It receives the element, a boolean indicating if it's an element or a collection * and the name of the model * */ config.onElemRestangularized = config.onElemRestangularized || function(elem) { return elem; } object.setOnElemRestangularized = function(post) { config.onElemRestangularized = post; } /** * Depracated. Don't use this!! */ object.setListTypeIsArray = function(val) { }; /** * This lets you set a suffix to every request. * * For example, if your api requires that for JSon requests you do /users/123.json, you can set that * in here. * * * By default, the suffix is null */ config.suffix = _.isUndefined(config.suffix) ? null : config.suffix; object.setRequestSuffix = function(newSuffix) { config.suffix = newSuffix; } /** * Add element transformers for certain routes. */ config.transformers = config.transformers || {}; object.addElementTransformer = function(type, secondArg, thirdArg) { var isCollection = null; var transformer = null; if (arguments.length === 2) { transformer = secondArg; } else { transformer = thirdArg; isCollection = secondArg; } var typeTransformers = config.transformers[type]; if (!typeTransformers) { typeTransformers = config.transformers[type] = []; } typeTransformers.push(function(coll, elem) { if (_.isNull(isCollection) || (coll == isCollection)) { return transformer(elem); } return elem; }); } config.transformElem = function(elem, isCollection, route, Restangular) { var typeTransformers = config.transformers[route]; var changedElem = elem; if (typeTransformers) { _.each(typeTransformers, function(transformer) { changedElem = transformer(isCollection, changedElem); }); } return config.onElemRestangularized(changedElem, isCollection, route, Restangular); } config.fullResponse = _.isUndefined(config.fullResponse) ? false : config.fullResponse; object.setFullResponse = function(full) { config.fullResponse = full; } //Internal values and functions config.urlCreatorFactory = {}; /** * Base URL Creator. Base prototype for everything related to it **/ var BaseCreator = function() { }; BaseCreator.prototype.setConfig = function(config) { this.config = config; } BaseCreator.prototype.parentsArray = function(current) { var parents = []; while(!_.isUndefined(current)) { parents.push(current); current = current[this.config.restangularFields.parentResource]; } return parents.reverse(); } function RestangularResource($http, url, configurer) { var resource = {}; _.each(_.keys(configurer), function(key) { var value = configurer[key]; // We don't want the ? if no params are there if (_.isEmpty(value.params)) { delete value.params; } if (config.isSafe(value.method)) { resource[key] = function() { return $http(_.extend(value, { url: url })); } } else { resource[key] = function(data) { return $http(_.extend(value, { url: url, data: data })); } } }); return resource; } BaseCreator.prototype.resource = function(current, $http, callHeaders, callParams, what) { var params = _.defaults(callParams || {}, this.config.defaultRequestParams); var headers = _.defaults(callHeaders || {}, this.config.defaultHeaders); var url = this.base(current); url += what ? ("/" + what): ''; url += (this.config.suffix || ''); return RestangularResource($http, url, { getList: this.config.withHttpDefaults({method: 'GET', params: params, headers: headers || {}}), get: this.config.withHttpDefaults({method: 'GET', params: params, headers: headers || {}}), put: this.config.withHttpDefaults({method: 'PUT', params: params, headers: headers || {}}), post: this.config.withHttpDefaults({method: 'POST', params: params, headers: headers || {}}), remove: this.config.withHttpDefaults({method: 'DELETE', params: params, headers: headers || {}}), head: this.config.withHttpDefaults({method: 'HEAD', params: params, headers: headers || {}}), trace: this.config.withHttpDefaults({method: 'TRACE', params: params, headers: headers || {}}), options: this.config.withHttpDefaults({method: 'OPTIONS', params: params, headers: headers || {}}), patch: this.config.withHttpDefaults({method: 'PATCH', params: params, headers: headers || {}}) }); } /** * This is the Path URL creator. It uses Path to show Hierarchy in the Rest API. * This means that if you have an Account that then has a set of Buildings, a URL to a building * would be /accounts/123/buildings/456 **/ var Path = function() { }; Path.prototype = new BaseCreator(); Path.prototype.base = function(current) { var __this = this; return this.config.baseUrl + _.reduce(this.parentsArray(current), function(acum, elem) { var currUrl = acum + "/" + elem[__this.config.restangularFields.route]; if (!elem[__this.config.restangularFields.restangularCollection]) { var elemId = __this.config.getIdFromElem(elem); if (elemId) { currUrl += "/" + elemId; } } return currUrl; }, ''); } Path.prototype.fetchUrl = function(current, what) { var baseUrl = this.base(current); if (what) { baseUrl += "/" + what; } return baseUrl; } config.urlCreatorFactory.path = Path; } var globalConfiguration = {}; Configurer.init(this, globalConfiguration); this.$get = ['$http', '$q', function($http, $q) { function createServiceForConfiguration(config) { var service = {}; var urlHandler = new config.urlCreatorFactory[config.urlCreator](); urlHandler.setConfig(config); function restangularizeBase(parent, elem, route) { elem[config.restangularFields.route] = route; elem.getRestangularUrl = _.bind(urlHandler.fetchUrl, urlHandler, elem); elem.addRestangularMethod = _.bind(addRestangularMethodFunction, elem); // RequestLess connection elem.one = _.bind(one, elem, elem); elem.all = _.bind(all, elem, elem); if (parent) { var restangularFieldsForParent = _.union( _.values( _.pick(config.restangularFields, ['id', 'route', 'parentResource']) ), config.extraFields ); elem[config.restangularFields.parentResource]= _.pick(parent, restangularFieldsForParent); } return elem; } function one(parent, route, id) { var elem = {}; config.setIdToElem(elem, id); return restangularizeElem(parent, elem , route); } function all(parent, route) { return restangularizeCollection(parent, {} , route, true); } // Promises function restangularizePromise(promise, isCollection) { promise.call = _.bind(promiseCall, promise); promise.get = _.bind(promiseGet, promise); promise[config.restangularFields.restangularCollection] = isCollection; if (isCollection) { promise.push = _.bind(promiseCall, promise, "push"); } return promise; } function promiseCall(method) { var deferred = $q.defer(); var callArgs = arguments; this.then(function(val) { var params = Array.prototype.slice.call(callArgs, 1); var func = val[method]; func.apply(val, params); deferred.resolve(val); }); return restangularizePromise(deferred.promise, this[config.restangularFields.restangularCollection]); } function promiseGet(what) { var deferred = $q.defer(); this.then(function(val) { deferred.resolve(val[what]); }); return restangularizePromise(deferred.promise, this[config.restangularFields.restangularCollection]); } function resolvePromise(deferred, response, data) { if (config.fullResponse) { return deferred.resolve(_.extend(response, { data: data })); } else { deferred.resolve(data); } } // Elements function stripRestangular(elem) { return _.omit(elem, _.values(_.omit(config.restangularFields, 'id'))); } function addCustomOperation(elem) { elem.customOperation = _.bind(customFunction, elem); _.each(["put", "post", "get", "delete"], function(oper) { _.each(["do", "custom"], function(alias) { var callOperation = oper === 'delete' ? 'remove' : oper; var name = alias + oper.toUpperCase(); elem[name] = _.bind(customFunction, elem, callOperation); }); }); elem.customGETLIST = _.bind(fetchFunction, elem); elem.doGETLIST = elem.customGETLIST; } function copyRestangularizedElement(fromElement) { var copiedElement = angular.copy(fromElement); return restangularizeElem(copiedElement[config.restangularFields.parentResource], copiedElement, copiedElement[config.restangularFields.route]); } function restangularizeElem(parent, elem, route) { var localElem = restangularizeBase(parent, elem, route); localElem[config.restangularFields.restangularCollection] = false; localElem.get = _.bind(getFunction, localElem); localElem.getList = _.bind(fetchFunction, localElem); localElem.put = _.bind(putFunction, localElem); localElem.post = _.bind(postFunction, localElem); localElem.remove = _.bind(deleteFunction, localElem); localElem.head = _.bind(headFunction, localElem); localElem.trace = _.bind(traceFunction, localElem); localElem.options = _.bind(optionsFunction, localElem); localElem.patch = _.bind(patchFunction, localElem); addCustomOperation(localElem); return config.transformElem(localElem, false, route, service); } function restangularizeCollection(parent, elem, route) { var localElem = restangularizeBase(parent, elem, route); localElem[config.restangularFields.restangularCollection] = true; localElem.post = _.bind(postFunction, localElem, null); localElem.head = _.bind(headFunction, localElem); localElem.trace = _.bind(traceFunction, localElem); localElem.putElement = _.bind(putElementFunction, localElem); localElem.options = _.bind(optionsFunction, localElem); localElem.patch = _.bind(patchFunction, localElem); localElem.getList = _.bind(fetchFunction, localElem, null); addCustomOperation(localElem); return config.transformElem(localElem, true, route, service); } function putElementFunction(idx, params, headers) { var __this = this; var elemToPut = this[idx]; var deferred = $q.defer(); elemToPut.put(params, headers).then(function(serverElem) { var newArray = copyRestangularizedElement(__this); newArray[idx] = serverElem; deferred.resolve(newArray); }, function(response) { deferred.reject(response); }); return restangularizePromise(deferred.promise, true) } function fetchFunction(what, reqParams, headers) { var __this = this; var deferred = $q.defer(); var operation = 'getList'; var url = urlHandler.fetchUrl(this, what); var whatFetched = what || __this[config.restangularFields.route]; var request = config.fullRequestInterceptor(null, operation, whatFetched, url, headers || {}, reqParams || {}); urlHandler.resource(this, $http, request.headers, request.params, what).getList().then(function(response) { var resData = response.data; var data = config.responseExtractor(resData, operation, whatFetched, url); var processedData = _.map(data, function(elem) { if (!__this[config.restangularFields.restangularCollection]) { return restangularizeElem(__this, elem, what); } else { return restangularizeElem(__this[config.restangularFields.parentResource], elem, __this[config.restangularFields.route]); } }); processedData = _.extend(data, processedData); if (!__this[config.restangularFields.restangularCollection]) { resolvePromise(deferred, response, restangularizeCollection(__this, processedData, what)); } else { resolvePromise(deferred, response, restangularizeCollection(null, processedData, __this[config.restangularFields.route])); } }, function error(response) { config.errorInterceptor(response); deferred.reject(response); }); return restangularizePromise(deferred.promise, true); } function elemFunction(operation, what, params, obj, headers) { var __this = this; var deferred = $q.defer(); var resParams = params || {}; var resObj = obj || this; var route = what || this[config.restangularFields.route]; var fetchUrl = urlHandler.fetchUrl(this, what); var callObj = obj || stripRestangular(this); request = config.fullRequestInterceptor(callObj, operation, route, fetchUrl, headers || {}, resParams || {}); var okCallback = function(response) { var resData = response.data; var elem = config.responseExtractor(resData, operation, route, fetchUrl) || resObj; if (operation === "post" && !__this[config.restangularFields.restangularCollection]) { resolvePromise(deferred, response, restangularizeElem(__this, elem, what)); } else { resolvePromise(deferred, response, restangularizeElem(__this[config.restangularFields.parentResource], elem, __this[config.restangularFields.route])); } }; var errorCallback = function(response) { config.errorInterceptor(response); deferred.reject(response); }; // Overring HTTP Method var callOperation = operation; var callHeaders = _.extend({}, request.headers); var isOverrideOperation = config.isOverridenMethod(operation); if (isOverrideOperation) { callOperation = 'post'; callHeaders = _.extend(callHeaders, {'X-HTTP-Method-Override': operation}); } if (config.isSafe(operation)) { if (isOverrideOperation) { urlHandler.resource(this, $http, callHeaders, request.params, what)[callOperation]({}).then(okCallback, errorCallback); } else { urlHandler.resource(this, $http, callHeaders, request.params, what)[callOperation]().then(okCallback, errorCallback); } } else { urlHandler.resource(this, $http, callHeaders, request.params, what)[callOperation](request.element).then(okCallback, errorCallback); } return restangularizePromise(deferred.promise); } function getFunction(params, headers) { return _.bind(elemFunction, this)("get", undefined, params, undefined, headers); } function deleteFunction(params, headers) { return _.bind(elemFunction, this)("remove", undefined, params, undefined, headers); } function putFunction(params, headers) { return _.bind(elemFunction, this)("put", undefined, params, undefined, headers); } function postFunction(what, elem, params, headers) { return _.bind(elemFunction, this)("post", what, params, elem, headers); } function headFunction(params, headers) { return _.bind(elemFunction, this)("head", undefined, params, undefined, headers); } function traceFunction(params, headers) { return _.bind(elemFunction, this)("trace", undefined, params, undefined, headers); } function optionsFunction(params, headers) { return _.bind(elemFunction, this)("options", undefined, params, undefined, headers); } function patchFunction(params, headers) { return _.bind(elemFunction, this)("patch", undefined, params, undefined, headers); } function customFunction(operation, path, params, headers, elem) { return _.bind(elemFunction, this)(operation, path, params, elem, headers); } function addRestangularMethodFunction(name, operation, path, defaultParams, defaultHeaders, defaultElem) { var bindedFunction; if (operation === 'getList') { bindedFunction = _.bind(fetchFunction, this, path); } else { bindedFunction = _.bind(customFunction, this, operation, path); } this[name] = function(params, headers, elem) { var callParams = _.defaults({ params: params, headers: headers, elem: elem }, { params: defaultParams, headers: defaultHeaders, elem: defaultElem }); return bindedFunction(callParams.params, callParams.headers, callParams.elem); } } function withConfigurationFunction(configurer) { var newConfig = angular.copy(globalConfiguration); Configurer.init(newConfig, newConfig); configurer(newConfig); return createServiceForConfiguration(newConfig); } service.copy = _.bind(copyRestangularizedElement, service); service.withConfig = _.bind(withConfigurationFunction, service); service.one = _.bind(one, service, null); service.all = _.bind(all, service, null); service.restangularizeElement = _.bind(restangularizeElem, service); service.restangularizeCollection = _.bind(restangularizeCollection, service); return service; } return createServiceForConfiguration(globalConfiguration); }]; } ); })();
Assalaam/cdnjs
ajax/libs/restangular/1.0.1/restangular.js
JavaScript
mit
31,503
// Trianglify. Made by (and copyright) @qrohlf, licensed under the GPLv3. // Needs d3.js // // JSHint stuff: /* global module, require, jsdom:true, d3:true, document:true, XMLSerializer:true, btoa:true*/ function Trianglify(options) { if (typeof options === 'undefined') { options = {}; } function defaults(opt, def) { return (typeof opt !== 'undefined') ? opt : def; } // defaults this.options = { cellsize: defaults(options.cellsize, 150), // zero not valid here bleed: defaults(options.cellsize, 150), cellpadding: defaults(options.cellpadding, 0.1*options.cellsize || 15), noiseIntensity: defaults(options.noiseIntensity, 0.3), x_gradient: defaults(options.x_gradient, Trianglify.randomColor()), format: defaults(options.format, "svg"), fillOpacity: defaults(options.fillOpacity, 1), strokeOpacity: defaults(options.strokeOpacity, 1) }; this.options.y_gradient = options.y_gradient || this.options.x_gradient.map(function(c){return d3.rgb(c).brighter(0.5);}); } //nodejs stuff if (typeof module !== 'undefined' && module.exports) { d3 = require("d3"); jsdom = require("jsdom"); document = new (jsdom.level(1, "core").Document)(); XMLSerializer = require("xmldom").XMLSerializer; btoa = require('btoa'); module.exports = Trianglify; } Trianglify.randomColor = function() { var keys = Object.keys(Trianglify.colorbrewer); var palette = Trianglify.colorbrewer[keys[Math.floor(Math.random()*keys.length)]]; keys = Object.keys(palette); var colors = palette[keys[Math.floor(Math.random()*keys.length)]]; return colors; }; Trianglify.prototype.generate = function(width, height) { return new Trianglify.Pattern(this.options, width, height); }; Trianglify.Pattern = function(options, width, height) { this.options = options; this.width = width; this.height = height; this.polys = this.generatePolygons(); this.svg = this.generateSVG(); var s = new XMLSerializer(); this.svgString = s.serializeToString(this.svg); this.base64 = btoa(this.svgString); this.dataUri = 'data:image/svg+xml;base64,' + this.base64; this.dataUrl = 'url('+this.dataUri+')'; }; Trianglify.Pattern.prototype.append = function() { document.body.appendChild(this.svg); }; Trianglify.Pattern.gradient_2d = function (x_gradient, y_gradient, width, height) { return function(x, y) { var color_x = d3.scale.linear() .range(x_gradient) .domain(d3.range(0, width, width/x_gradient.length)); //[-bleed, width+bleed] var color_y = d3.scale.linear() .range(y_gradient) .domain(d3.range(0, height, height/y_gradient.length)); //[-bleed, width+bleed] return d3.interpolateRgb(color_x(x), color_y(y))(0.5); }; }; Trianglify.Pattern.prototype.generatePolygons = function () { var options = this.options; var cellsX = Math.ceil((this.width+options.bleed*2)/options.cellsize); var cellsY = Math.ceil((this.height+options.bleed*2)/options.cellsize); var vertices = d3.range(cellsX*cellsY).map(function(d) { // figure out which cell we are in var col = d % cellsX; var row = Math.floor(d / cellsX); var x = Math.round(-options.bleed + col*options.cellsize + Math.random() * (options.cellsize - options.cellpadding*2) + options.cellpadding); var y = Math.round(-options.bleed + row*options.cellsize + Math.random() * (options.cellsize - options.cellpadding*2) + options.cellpadding); // return [x*cellsize, y*cellsize]; return [x, y]; // Populate the actual background with points }); return d3.geom.delaunay(vertices); }; Trianglify.Pattern.prototype.generateSVG = function () { var options = this.options; var color = Trianglify.Pattern.gradient_2d(options.x_gradient, options.y_gradient, this.width, this.height); var elem = document.createElementNS("http://www.w3.org/2000/svg", "svg"); var svg = d3.select(elem); svg.attr("width", this.width); svg.attr("height", this.height); svg.attr('xmlns', 'http://www.w3.org/2000/svg'); var group = svg.append("g"); if (options.noiseIntensity > 0.01) { var filter = svg.append("filter").attr("id", "noise"); filter.append('feTurbulence') .attr('type', 'fractalNoise') .attr('in', 'fillPaint') .attr('fill', '#F00') .attr('baseFrequency', 0.7) .attr('numOctaves', '10') .attr('stitchTiles', 'stitch'); var transfer = filter.append('feComponentTransfer'); transfer.append('feFuncR') .attr('type', 'linear') .attr('slope', '2') .attr('intercept', '-.5'); transfer.append('feFuncG') .attr('type', 'linear') .attr('slope', '2') .attr('intercept', '-.5'); transfer.append('feFuncB') .attr('type', 'linear') .attr('slope', '2') .attr('intercept', '-.5'); filter.append('feColorMatrix') .attr('type', 'matrix') .attr('values', "0.3333 0.3333 0.3333 0 0 \n 0.3333 0.3333 0.3333 0 0 \n 0.3333 0.3333 0.3333 0 0 \n 0 0 0 1 0"); svg.append("rect") .attr("opacity", options.noiseIntensity) .attr('width', '100%') .attr('height', '100%') .attr("filter", "url(#noise)"); } this.polys.forEach(function(d) { var x = (d[0][0] + d[1][0] + d[2][0])/3; var y = (d[0][1] + d[1][1] + d[2][1])/3; var c = color(x, y); group.append("path").attr("d", "M" + d.join("L") + "Z").attr({ fill: c, stroke: c }).attr('fill-opacity', options.fillOpacity).attr('stroke-opacity', options.strokeOpacity); }); return svg.node(); }; Trianglify.Pattern.prototype.append = function() { document.body.appendChild(this.svg); }; //colorbrewer palettes from http://bl.ocks.org/mbostock/5577023 Trianglify.colorbrewer = {YlGn: { 3: ["#f7fcb9","#addd8e","#31a354"], 4: ["#ffffcc","#c2e699","#78c679","#238443"], 5: ["#ffffcc","#c2e699","#78c679","#31a354","#006837"], 6: ["#ffffcc","#d9f0a3","#addd8e","#78c679","#31a354","#006837"], 7: ["#ffffcc","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"], 8: ["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"], 9: ["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"] },YlGnBu: { 3: ["#edf8b1","#7fcdbb","#2c7fb8"], 4: ["#ffffcc","#a1dab4","#41b6c4","#225ea8"], 5: ["#ffffcc","#a1dab4","#41b6c4","#2c7fb8","#253494"], 6: ["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#2c7fb8","#253494"], 7: ["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"], 8: ["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"], 9: ["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"] },GnBu: { 3: ["#e0f3db","#a8ddb5","#43a2ca"], 4: ["#f0f9e8","#bae4bc","#7bccc4","#2b8cbe"], 5: ["#f0f9e8","#bae4bc","#7bccc4","#43a2ca","#0868ac"], 6: ["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#43a2ca","#0868ac"], 7: ["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"], 8: ["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"], 9: ["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"] },BuGn: { 3: ["#e5f5f9","#99d8c9","#2ca25f"], 4: ["#edf8fb","#b2e2e2","#66c2a4","#238b45"], 5: ["#edf8fb","#b2e2e2","#66c2a4","#2ca25f","#006d2c"], 6: ["#edf8fb","#ccece6","#99d8c9","#66c2a4","#2ca25f","#006d2c"], 7: ["#edf8fb","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"], 8: ["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"], 9: ["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"] },PuBuGn: { 3: ["#ece2f0","#a6bddb","#1c9099"], 4: ["#f6eff7","#bdc9e1","#67a9cf","#02818a"], 5: ["#f6eff7","#bdc9e1","#67a9cf","#1c9099","#016c59"], 6: ["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#1c9099","#016c59"], 7: ["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"], 8: ["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"], 9: ["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"] },PuBu: { 3: ["#ece7f2","#a6bddb","#2b8cbe"], 4: ["#f1eef6","#bdc9e1","#74a9cf","#0570b0"], 5: ["#f1eef6","#bdc9e1","#74a9cf","#2b8cbe","#045a8d"], 6: ["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#2b8cbe","#045a8d"], 7: ["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"], 8: ["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"], 9: ["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"] },BuPu: { 3: ["#e0ecf4","#9ebcda","#8856a7"], 4: ["#edf8fb","#b3cde3","#8c96c6","#88419d"], 5: ["#edf8fb","#b3cde3","#8c96c6","#8856a7","#810f7c"], 6: ["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8856a7","#810f7c"], 7: ["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"], 8: ["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"], 9: ["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"] },RdPu: { 3: ["#fde0dd","#fa9fb5","#c51b8a"], 4: ["#feebe2","#fbb4b9","#f768a1","#ae017e"], 5: ["#feebe2","#fbb4b9","#f768a1","#c51b8a","#7a0177"], 6: ["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#c51b8a","#7a0177"], 7: ["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"], 8: ["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"], 9: ["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"] },PuRd: { 3: ["#e7e1ef","#c994c7","#dd1c77"], 4: ["#f1eef6","#d7b5d8","#df65b0","#ce1256"], 5: ["#f1eef6","#d7b5d8","#df65b0","#dd1c77","#980043"], 6: ["#f1eef6","#d4b9da","#c994c7","#df65b0","#dd1c77","#980043"], 7: ["#f1eef6","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"], 8: ["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"], 9: ["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"] },OrRd: { 3: ["#fee8c8","#fdbb84","#e34a33"], 4: ["#fef0d9","#fdcc8a","#fc8d59","#d7301f"], 5: ["#fef0d9","#fdcc8a","#fc8d59","#e34a33","#b30000"], 6: ["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#e34a33","#b30000"], 7: ["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"], 8: ["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"], 9: ["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"] },YlOrRd: { 3: ["#ffeda0","#feb24c","#f03b20"], 4: ["#ffffb2","#fecc5c","#fd8d3c","#e31a1c"], 5: ["#ffffb2","#fecc5c","#fd8d3c","#f03b20","#bd0026"], 6: ["#ffffb2","#fed976","#feb24c","#fd8d3c","#f03b20","#bd0026"], 7: ["#ffffb2","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"], 8: ["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"], 9: ["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"] },YlOrBr: { 3: ["#fff7bc","#fec44f","#d95f0e"], 4: ["#ffffd4","#fed98e","#fe9929","#cc4c02"], 5: ["#ffffd4","#fed98e","#fe9929","#d95f0e","#993404"], 6: ["#ffffd4","#fee391","#fec44f","#fe9929","#d95f0e","#993404"], 7: ["#ffffd4","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"], 8: ["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"], 9: ["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"] },Purples: { 3: ["#efedf5","#bcbddc","#756bb1"], 4: ["#f2f0f7","#cbc9e2","#9e9ac8","#6a51a3"], 5: ["#f2f0f7","#cbc9e2","#9e9ac8","#756bb1","#54278f"], 6: ["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#756bb1","#54278f"], 7: ["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"], 8: ["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"], 9: ["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"] },Blues: { 3: ["#deebf7","#9ecae1","#3182bd"], 4: ["#eff3ff","#bdd7e7","#6baed6","#2171b5"], 5: ["#eff3ff","#bdd7e7","#6baed6","#3182bd","#08519c"], 6: ["#eff3ff","#c6dbef","#9ecae1","#6baed6","#3182bd","#08519c"], 7: ["#eff3ff","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"], 8: ["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"], 9: ["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"] },Greens: { 3: ["#e5f5e0","#a1d99b","#31a354"], 4: ["#edf8e9","#bae4b3","#74c476","#238b45"], 5: ["#edf8e9","#bae4b3","#74c476","#31a354","#006d2c"], 6: ["#edf8e9","#c7e9c0","#a1d99b","#74c476","#31a354","#006d2c"], 7: ["#edf8e9","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"], 8: ["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"], 9: ["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"] },Oranges: { 3: ["#fee6ce","#fdae6b","#e6550d"], 4: ["#feedde","#fdbe85","#fd8d3c","#d94701"], 5: ["#feedde","#fdbe85","#fd8d3c","#e6550d","#a63603"], 6: ["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#e6550d","#a63603"], 7: ["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"], 8: ["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"], 9: ["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"] },Reds: { 3: ["#fee0d2","#fc9272","#de2d26"], 4: ["#fee5d9","#fcae91","#fb6a4a","#cb181d"], 5: ["#fee5d9","#fcae91","#fb6a4a","#de2d26","#a50f15"], 6: ["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#de2d26","#a50f15"], 7: ["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"], 8: ["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"], 9: ["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"] },Greys: { 3: ["#f0f0f0","#bdbdbd","#636363"], 4: ["#f7f7f7","#cccccc","#969696","#525252"], 5: ["#f7f7f7","#cccccc","#969696","#636363","#252525"], 6: ["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#636363","#252525"], 7: ["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"], 8: ["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"], 9: ["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"] },PuOr: { 3: ["#f1a340","#f7f7f7","#998ec3"], 4: ["#e66101","#fdb863","#b2abd2","#5e3c99"], 5: ["#e66101","#fdb863","#f7f7f7","#b2abd2","#5e3c99"], 6: ["#b35806","#f1a340","#fee0b6","#d8daeb","#998ec3","#542788"], 7: ["#b35806","#f1a340","#fee0b6","#f7f7f7","#d8daeb","#998ec3","#542788"], 8: ["#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788"], 9: ["#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788"], 10: ["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"], 11: ["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"] },BrBG: { 3: ["#d8b365","#f5f5f5","#5ab4ac"], 4: ["#a6611a","#dfc27d","#80cdc1","#018571"], 5: ["#a6611a","#dfc27d","#f5f5f5","#80cdc1","#018571"], 6: ["#8c510a","#d8b365","#f6e8c3","#c7eae5","#5ab4ac","#01665e"], 7: ["#8c510a","#d8b365","#f6e8c3","#f5f5f5","#c7eae5","#5ab4ac","#01665e"], 8: ["#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e"], 9: ["#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e"], 10: ["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"], 11: ["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"] },PRGn: { 3: ["#af8dc3","#f7f7f7","#7fbf7b"], 4: ["#7b3294","#c2a5cf","#a6dba0","#008837"], 5: ["#7b3294","#c2a5cf","#f7f7f7","#a6dba0","#008837"], 6: ["#762a83","#af8dc3","#e7d4e8","#d9f0d3","#7fbf7b","#1b7837"], 7: ["#762a83","#af8dc3","#e7d4e8","#f7f7f7","#d9f0d3","#7fbf7b","#1b7837"], 8: ["#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837"], 9: ["#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837"], 10: ["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"], 11: ["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"] },PiYG: { 3: ["#e9a3c9","#f7f7f7","#a1d76a"], 4: ["#d01c8b","#f1b6da","#b8e186","#4dac26"], 5: ["#d01c8b","#f1b6da","#f7f7f7","#b8e186","#4dac26"], 6: ["#c51b7d","#e9a3c9","#fde0ef","#e6f5d0","#a1d76a","#4d9221"], 7: ["#c51b7d","#e9a3c9","#fde0ef","#f7f7f7","#e6f5d0","#a1d76a","#4d9221"], 8: ["#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221"], 9: ["#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221"], 10: ["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"], 11: ["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"] },RdBu: { 3: ["#ef8a62","#f7f7f7","#67a9cf"], 4: ["#ca0020","#f4a582","#92c5de","#0571b0"], 5: ["#ca0020","#f4a582","#f7f7f7","#92c5de","#0571b0"], 6: ["#b2182b","#ef8a62","#fddbc7","#d1e5f0","#67a9cf","#2166ac"], 7: ["#b2182b","#ef8a62","#fddbc7","#f7f7f7","#d1e5f0","#67a9cf","#2166ac"], 8: ["#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac"], 9: ["#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac"], 10: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"], 11: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"] },RdGy: { 3: ["#ef8a62","#ffffff","#999999"], 4: ["#ca0020","#f4a582","#bababa","#404040"], 5: ["#ca0020","#f4a582","#ffffff","#bababa","#404040"], 6: ["#b2182b","#ef8a62","#fddbc7","#e0e0e0","#999999","#4d4d4d"], 7: ["#b2182b","#ef8a62","#fddbc7","#ffffff","#e0e0e0","#999999","#4d4d4d"], 8: ["#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d"], 9: ["#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d"], 10: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"], 11: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"] },RdYlBu: { 3: ["#fc8d59","#ffffbf","#91bfdb"], 4: ["#d7191c","#fdae61","#abd9e9","#2c7bb6"], 5: ["#d7191c","#fdae61","#ffffbf","#abd9e9","#2c7bb6"], 6: ["#d73027","#fc8d59","#fee090","#e0f3f8","#91bfdb","#4575b4"], 7: ["#d73027","#fc8d59","#fee090","#ffffbf","#e0f3f8","#91bfdb","#4575b4"], 8: ["#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4"], 9: ["#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4"], 10: ["#a50026","#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"], 11: ["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"] },Spectral: { 3: ["#fc8d59","#ffffbf","#99d594"], 4: ["#d7191c","#fdae61","#abdda4","#2b83ba"], 5: ["#d7191c","#fdae61","#ffffbf","#abdda4","#2b83ba"], 6: ["#d53e4f","#fc8d59","#fee08b","#e6f598","#99d594","#3288bd"], 7: ["#d53e4f","#fc8d59","#fee08b","#ffffbf","#e6f598","#99d594","#3288bd"], 8: ["#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd"], 9: ["#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd"], 10: ["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"], 11: ["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"] },RdYlGn: { 3: ["#fc8d59","#ffffbf","#91cf60"], 4: ["#d7191c","#fdae61","#a6d96a","#1a9641"], 5: ["#d7191c","#fdae61","#ffffbf","#a6d96a","#1a9641"], 6: ["#d73027","#fc8d59","#fee08b","#d9ef8b","#91cf60","#1a9850"], 7: ["#d73027","#fc8d59","#fee08b","#ffffbf","#d9ef8b","#91cf60","#1a9850"], 8: ["#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850"], 9: ["#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850"], 10: ["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"], 11: ["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"] }}; // I've left out the non-continuous colorbrewer scales here because they don't really look that nice as mesh // palettes, but if you want to try them out you can grab them from http://bl.ocks.org/mbostock/5577023
LorenzoBoccaccia/cdnjs
ajax/libs/trianglify/0.1.4/trianglify.js
JavaScript
mit
21,034
var baseSetData = require('./_baseSetData'), createBaseWrapper = require('./_createBaseWrapper'), createCurryWrapper = require('./_createCurryWrapper'), createHybridWrapper = require('./_createHybridWrapper'), createPartialWrapper = require('./_createPartialWrapper'), getData = require('./_getData'), mergeData = require('./_mergeData'), setData = require('./_setData'), toInteger = require('./toInteger'); /** Used as the `TypeError` message for "Functions" methods. */ var FUNC_ERROR_TEXT = 'Expected a function'; /** Used to compose bitmasks for wrapper metadata. */ var BIND_FLAG = 1, BIND_KEY_FLAG = 2, CURRY_FLAG = 8, CURRY_RIGHT_FLAG = 16, PARTIAL_FLAG = 32, PARTIAL_RIGHT_FLAG = 64; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeMax = Math.max; /** * Creates a function that either curries or invokes `func` with optional * `this` binding and partially applied arguments. * * @private * @param {Function|string} func The function or method name to wrap. * @param {number} bitmask The bitmask of wrapper flags. * The bitmask may be composed of the following flags: * 1 - `_.bind` * 2 - `_.bindKey` * 4 - `_.curry` or `_.curryRight` of a bound function * 8 - `_.curry` * 16 - `_.curryRight` * 32 - `_.partial` * 64 - `_.partialRight` * 128 - `_.rearg` * 256 - `_.ary` * @param {*} [thisArg] The `this` binding of `func`. * @param {Array} [partials] The arguments to be partially applied. * @param {Array} [holders] The `partials` placeholder indexes. * @param {Array} [argPos] The argument positions of the new function. * @param {number} [ary] The arity cap of `func`. * @param {number} [arity] The arity of `func`. * @returns {Function} Returns the new wrapped function. */ function createWrapper(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { var isBindKey = bitmask & BIND_KEY_FLAG; if (!isBindKey && typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } var length = partials ? partials.length : 0; if (!length) { bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG); partials = holders = undefined; } ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); arity = arity === undefined ? arity : toInteger(arity); length -= holders ? holders.length : 0; if (bitmask & PARTIAL_RIGHT_FLAG) { var partialsRight = partials, holdersRight = holders; partials = holders = undefined; } var data = isBindKey ? undefined : getData(func); var newData = [ func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity ]; if (data) { mergeData(newData, data); } func = newData[0]; bitmask = newData[1]; thisArg = newData[2]; partials = newData[3]; holders = newData[4]; arity = newData[9] = newData[9] == null ? (isBindKey ? 0 : func.length) : nativeMax(newData[9] - length, 0); if (!arity && bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG)) { bitmask &= ~(CURRY_FLAG | CURRY_RIGHT_FLAG); } if (!bitmask || bitmask == BIND_FLAG) { var result = createBaseWrapper(func, bitmask, thisArg); } else if (bitmask == CURRY_FLAG || bitmask == CURRY_RIGHT_FLAG) { result = createCurryWrapper(func, bitmask, arity); } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !holders.length) { result = createPartialWrapper(func, bitmask, thisArg, partials); } else { result = createHybridWrapper.apply(undefined, newData); } var setter = data ? baseSetData : setData; return setter(result, newData); } module.exports = createWrapper;
impromptuartist/impromptuartist.github.io
node_modules/nock/node_modules/lodash/_createWrapper.js
JavaScript
mit
3,701
/* * /MathJax/extensions/MathML/content-mathml.js * * Copyright (c) 2009-2015 The MathJax Consortium * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ MathJax.Extension["MathML/content-mathml"]=(function(d){var c=d.Browser.isMSIE;if(c){try{document.namespaces.add("m","http://www.w3.org/1998/Math/MathML")}catch(e){}}var b=d.CombineConfig("MathML.content-mathml",{collapsePlusMinus:true,cistyles:{vector:"bold-italic",matrix:"bold-upright"},symbols:{gamma:"\u03B3"}});var a={version:"2.4",settings:b,transformElements:function(h){for(var g=0,f=h.length;g<f;g++){var j=a.transformElement(h[g]);h[g].parentNode.replaceChild(j,h[g])}},transformElement:function(h){var i=a.cloneNode(h);for(var g=0,f=h.childNodes.length;g<f;g++){a.applyTransform(i,h.childNodes[g],0)}return i},getTextContent:function(f){return f.text!==undefined?f.text:f.innerText!==undefined?f.innerText:f.textContent},setTextContent:function(h,j){for(var g=0,f=h.childNodes.length;g<f;g++){if(h.childNodes[g].nodeType===3){h.removeChild(h.childNodes[g]);g--;f--}}h.appendChild(document.createTextNode(j))},cloneNode:function(j,g){var m,h,f;if(j.nodeType===1){m=a.createElement(j.nodeName);for(h=0,f=j.attributes.length;h<f;h++){m.setAttribute(j.attributes[h].nodeName,j.attributes[h].nodeValue)}if(g){for(h=0,f=j.childNodes.length;h<f;h++){var k=a.cloneNode(j.childNodes[h],true);m.appendChild(k)}}}else{if(j.nodeType===3){m=document.createTextNode(j.nodeValue)}}return m},createElement:function(f){var g=(c?document.createElement("m:"+f):document.createElementNS("http://www.w3.org/1998/Math/MathML",f));g.isMathJax=true;return g},getChildren:function(i){var h=[];for(var g=0,f=i.childNodes.length;g<f;g++){if(i.childNodes[g].nodeType===1){h.push(i.childNodes[g])}}return h},classifyChildren:function(m){var k=[],g=[],o=[];for(var i=0,f=m.childNodes.length;i<f;i++){if(m.childNodes[i].nodeType===1){var n=m.childNodes[i],h=n.nodeName;if(h==="bvar"){g.push(n)}else{if(h==="condition"||h==="degree"||h==="momentabout"||h==="logbase"||h==="lowlimit"||h==="uplimit"||(h==="interval"&&k.length<2)||h==="domainofapplication"){o.push(n)}else{k.push(n)}}}}return{args:k,bvars:g,qualifiers:o}},appendToken:function(f,g,i){var h=a.createElement(g);h.appendChild(document.createTextNode(i));f.appendChild(h);return h},applyTransform:function(g,k,f){if(!k){var m=a.createElement("merror");a.appendToken(m,"mtext","Missing child node");g.appendChild(m);return}if(k.nodeType===1){if(a.tokens[k.nodeName]){a.tokens[k.nodeName](g,k,f)}else{if(k.childNodes.length===0){a.appendToken(g,"mi",k.nodeName)}else{var n=a.cloneNode(k);g.appendChild(n);for(var i=0,h=k.childNodes.length;i<h;i++){a.applyTransform(n,k.childNodes[i],f)}}}}else{if(k.nodeType===3){g.appendChild(a.cloneNode(k))}}},createmfenced:function(i,h,m){var k=a.createElement("mfenced");k.setAttribute("open",h);k.setAttribute("close",m);for(var g=0,f=i.length;g<f;g++){a.applyTransform(k,i[g],0)}return k},transforms:{identifier:function(f){return function(h,i,g){a.appendToken(h,"mi",f)}},set:function(g,h){var f=a.transforms.bind("",",","|");return function(j,n){var o=a.classifyChildren(n);var m=o.args,l=o.bvars,p=o.qualifiers;if(l.length){var i=o.args[0];m=m.slice(1);var k=a.createElement("mfenced");k.setAttribute("open",g);k.setAttribute("close",h);f(k,n,i,m,l,p,0);j.appendChild(k)}else{j.appendChild(a.createmfenced(m,g,h))}}},token:function(f){return function(g,m){if(m.childNodes.length===1&&m.childNodes[0].nodeType===3){a.appendToken(g,f,a.getTextContent(m))}else{var i=a.createElement("mrow");for(var k=0,h=m.childNodes.length;k<h;k++){if(m.childNodes[k].nodeType===3){a.appendToken(g,f,a.getTextContent(m.childNodes[k]))}else{a.applyTransform(i,m.childNodes[k],0)}}if(i.childNodes.length){g.appendChild(i)}}}},binary:function(f,g){return function(n,j,l,p,i,m,h){var o=a.createElement("mrow");var k=g<h||(g==h&&f==="-");if(k){a.appendToken(o,"mo","(")}if(p.length>1){a.applyTransform(o,p[0],g)}a.appendToken(o,"mo",f);if(p.length>0){var q=p[(p.length===1)?0:1];a.applyTransform(o,q,g)}if(k){a.appendToken(o,"mo",")")}n.appendChild(o)}},infix:function(f,g){return function(r,k,o,t,i,p,h){var s=a.createElement("mrow");var n=h>g;if(n){a.appendToken(s,"mo","(")}for(var q=0,m=t.length;q<m;q++){if(q>0){a.appendToken(s,"mo",f)}a.applyTransform(s,t[q],g)}if(n){a.appendToken(s,"mo",")")}r.appendChild(s)}},iteration:function(f,g){return function(q,y,C,l,h,u,m){var t=a.createElement("mrow");var x=a.createElement("mo");a.setTextContent(x,f);var o=a.createElement("munderover");o.appendChild(x);var k=a.createElement("mrow");var A,w,v,B,n,s,z,r;for(A=0,v=u.length;A<v;A++){if(u[A].nodeName==="lowlimit"||u[A].nodeName==="condition"||u[A].nodeName==="domainofapplication"){if(u[A].nodeName==="lowlimit"){for(w=0,B=h.length;w<B;w++){s=h[w];n=a.getChildren(s);if(n.length){a.applyTransform(k,n[0],0)}}if(h.length){a.appendToken(k,"mo",g)}}n=a.getChildren(u[A]);for(w=0;w<n.length;w++){a.applyTransform(k,n[w],0)}}else{n=a.getChildren(u[A]);if(u[A].nodeName==="interval"&&n.length===2){for(w=0,B=h.length;w<B;w++){s=h[w];n=a.getChildren(s);if(n.length){a.applyTransform(k,n[0],0)}}if(h.length){a.appendToken(k,"mo","=")}a.applyTransform(k,a.getChildren(u[A])[0],0)}}}o.appendChild(k);var p=a.createElement("mrow");for(A=0,v=u.length;A<v;A++){if(u[A].nodeName==="uplimit"||u[A].nodeName==="interval"){n=a.getChildren(u[A]);for(w=0,z=n.length;w<z;w++){a.applyTransform(p,n[w],0)}}}o.appendChild(p);t.appendChild(o);for(A=0,r=l.length;A<r;A++){a.applyTransform(t,l[A],m)}q.appendChild(t)}},bind:function(g,f,h){return function(w,o,r,z,m,s,k){var y=a.createElement("mrow");var n,v,u,q,p,B;if(g){a.appendToken(y,"mo",g)}for(u=0,q=m.length;u<q;u++){var t=m[u];if(u>0){a.appendToken(y,"mo",",")}n=a.getChildren(t);if(n.length){a.applyTransform(y,n[0],0)}}var x=a.createElement("mrow");var A=false;for(v=0,p=s.length;v<p;v++){if(s[v].nodeName==="condition"){A=true;n=a.getChildren(s[v]);for(u=0,B=n.length;u<B;u++){a.applyTransform(x,n[u],0)}}}if(A){a.appendToken(y,"mo",h)}y.appendChild(x);for(v=0,p=s.length;v<p;v++){if(s[v].nodeName!="condition"){a.appendToken(y,"mo","\u2208");n=a.getChildren(s[v]);for(u=0,B=n.length;u<B;u++){a.applyTransform(y,n[u],0)}}}if(z.length&&(m.length||n.length)){a.appendToken(y,"mo",f)}for(v=0,q=z.length;v<q;v++){a.applyTransform(y,z[v],0)}w.appendChild(y)}},fn:function(f){return function(i,m,h,l,k,n,g){var j=a.createElement("mrow");if(h.childNodes.length){a.applyTransform(j,h,1)}else{a.appendToken(j,"mi",f)}a.appendToken(j,"mo","\u2061");j.appendChild(a.createmfenced(l,"(",")"));i.appendChild(j)}},minmax:function(f){return function(q,j,m,s,h,o,g){var r=a.createElement("mrow");a.appendToken(r,"mi",f);var n=a.createElement("mrow");a.appendToken(n,"mo","{");for(var p=0,k=s.length;p<k;p++){if(p>0){a.appendToken(n,"mo",",")}a.applyTransform(n,s[p],0)}if(o.length){a.appendToken(n,"mo","|");for(p=0,k=o.length;p<k;p++){a.applyTransform(n,o[p],0)}}a.appendToken(n,"mo","}");r.appendChild(n);q.appendChild(r)}}}};a.tokens={ci:function(g,i,f){if(i.childNodes.length===1&&i.childNodes[0].nodeType===3){var h=a.appendToken(g,"mi",a.getTextContent(i));var j=i.getAttribute("type");if(j in a.settings.cistyles){h.setAttribute("mathvariant",a.settings.cistyles[j])}}else{a.transforms.token("mi")(g,i,f)}},cs:a.transforms.token("ms"),csymbol:function(g,h,f){var i=h.getAttribute("cd");if(i&&a.contentDictionaries[i]){a.contentDictionaries[i](g,h,f)}else{if(a.settings.symbols[name]){a.appendToken(g,"mi",a.settings.symbols[name])}else{a.tokens.ci(g,h)}}},fn:function(g,h,f){a.applyTransform(g,a.getChildren(h)[0],f)},naturalnumbers:a.transforms.identifier("\u2115"),integers:a.transforms.identifier("\u2124"),reals:a.transforms.identifier("\u211D"),rationals:a.transforms.identifier("\u211A"),complexes:a.transforms.identifier("\u2102"),primes:a.transforms.identifier("\u2119"),exponentiale:a.transforms.identifier("e"),imaginaryi:a.transforms.identifier("i"),notanumber:a.transforms.identifier("NaN"),eulergamma:a.transforms.identifier("\u03B3"),gamma:a.transforms.identifier("\u0263"),pi:a.transforms.identifier("\u03C0"),infinity:a.transforms.identifier("\u221E"),emptyset:a.transforms.identifier("\u2205"),"true":a.transforms.identifier("true"),"false":a.transforms.identifier("false"),set:a.transforms.set("{","}"),list:a.transforms.set("(",")"),interval:function(g,i,f){var k=i.getAttribute("closure");var h,j;switch(k){case"open":h="(";j=")";break;case"open-closed":h="(";j="]";break;case"closed-open":h="[";j=")";break;case"closed":default:h="[";j="]"}g.appendChild(a.createmfenced(a.getChildren(i),h,j))},apply:function(m,j,f){var i=a.classifyChildren(j);var k=i.args[0];var n=i.args.slice(1),h=i.bvars,l=i.qualifiers;if(k){var g=k.nodeName;g=(g==="csymbol")?a.getTextContent(k).toLowerCase():g;if(a.applyTokens[g]){a.applyTokens[g](m,j,k,n,h,l,f)}else{a.transforms.fn(g)(m,j,k,n,h,l,f)}}else{m.appendChild(a.createElement("mrow"))}},cn:function(m,h,f){var p=h.getAttribute("type");var g=h.getAttribute("base");if(p||g){if(g){p="based-integer"}switch(p){case"integer":case"real":case"double":case"constant":a.transforms.token("mn")(m,h);break;case"hexdouble":a.appendToken(m,"mn","0x"+a.getTextContent(h));break;default:var q=a.createElement("apply");var n=a.createElement("mrow");var o=a.createElement(p);q.appendChild(o);if(g){a.appendToken(q,"mn",g)}for(var k=0,i=h.childNodes.length;k<i;k++){if(h.childNodes[k].nodeType===3){a.appendToken(n,"cn",a.getTextContent(h.childNodes[k]))}else{if(h.childNodes[k].nodeName==="sep"){q.appendChild(n);n=a.createElement("mrow")}else{n.appendChild(a.cloneNode(h.childNodes[k],true))}}}q.appendChild(n);a.applyTransform(m,q,0)}}else{a.transforms.token("mn")(m,h)}},vector:function(o,h,f){var p=a.createElement("mrow");a.appendToken(p,"mo","(");var m=a.createElement("mtable");var g=a.getChildren(h);for(var n=0,j=g.length;n<j;n++){var k=a.createElement("mtr");var q=a.createElement("mtd");a.applyTransform(q,g[n],0);k.appendChild(q);m.appendChild(k)}p.appendChild(m);a.appendToken(p,"mo",")");o.appendChild(p)},piecewise:function(g,k,f){var j=a.createElement("mrow");a.appendToken(j,"mo","{");var o=a.createElement("mtable");j.appendChild(o);var n=a.getChildren(k);for(var m=0,h=n.length;m<h;m++){a.applyTransform(o,n[m],0)}g.appendChild(j)},piece:function(h,m,g){var f=a.createElement("mtr");var o=a.getChildren(m);for(var n=0,j=o.length;n<j;n++){var k=a.createElement("mtd");f.appendChild(k);a.applyTransform(k,o[n],0);if(n===0){k=a.createElement("mtd");a.appendToken(k,"mtext","\u00A0if\u00A0");f.appendChild(k)}}h.appendChild(f)},otherwise:function(h,j,g){var f=a.createElement("mtr");var k=a.getChildren(j);if(k.length){var i=a.createElement("mtd");f.appendChild(i);a.applyTransform(i,k[0],0);i=a.createElement("mtd");i.setAttribute("columnspan","2");a.appendToken(i,"mtext","\u00A0otherwise");f.appendChild(i)}h.appendChild(f)},matrix:function(q,j,f){var h=a.classifyChildren(j);var t=h.args,g=h.bvars,n=h.qualifiers;if(g.length||n.length){var r=a.createElement("mrow");a.appendToken(r,"mo","[");var s=a.createElement("msub");a.appendToken(s,"mi","m");var m=a.createElement("mrow");for(var p=0,k=g.length;p<k;p++){if(p!=0){a.appendToken(m,"mo",",")}a.applyTransform(m,g[p].childNodes[0],0)}s.appendChild(m);r.appendChild(s);var u=a.cloneNode(s,true);a.appendToken(r,"mo","|");r.appendChild(u);a.appendToken(r,"mo","=");for(p=0,k=t.length;p<k;p++){if(p!=0){a.appendToken(r,"mo",",")}a.applyTransform(r,t[p],0)}a.appendToken(r,"mo",";");for(p=0,k=n.length;p<k;p++){if(p!=0){a.appendToken(r,"mo",",")}a.applyTransform(r,n[p],0)}a.appendToken(r,"mo","]");q.appendChild(r)}else{var v=a.createElement("mfenced");var o=a.createElement("mtable");for(p=0,k=t.length;p<k;p++){a.applyTransform(o,t[p],0)}v.appendChild(o);q.appendChild(v)}},matrixrow:function(h,m,g){var f=a.createElement("mtr");var o=a.getChildren(m);for(var n=0,j=o.length;n<j;n++){var k=a.createElement("mtd");a.applyTransform(k,o[n],0);f.appendChild(k)}h.appendChild(f)},condition:function(g,k,f){var j=a.createElement("mrow");var n=a.getChildren(k);for(var m=0,h=n.length;m<h;m++){a.applyTransform(j,n[m],0)}g.appendChild(j)},lambda:function(t,k,f){var o=a.createElement("lambda");var h=a.classifyChildren(k);var w=h.args,g=h.bvars,q=h.qualifiers;var s,n,m;if(g.length){a.applyTokens.lambda(t,k,o,w,g,q,f)}else{var u=a.createElement("mrow");for(s=0,n=w.length;s<n;s++){a.applyTransform(u,w[s],0)}if(q.length){var v=a.createElement("msub");a.appendToken(v,"mo","|");var p=a.createElement("mrow");for(s=0,m=q.length;s<m;s++){h=a.getChildren(q[s]);for(var r=0,x=h.length;r<x;r++){a.applyTransform(p,h[r],0)}}v.appendChild(p);u.appendChild(v)}t.appendChild(u)}},ident:function(g,h,f){a.appendToken(g,"mi","id")},domainofapplication:function(g,h,f){var i=a.createElement("merror");a.appendToken(i,"mtext","unexpected domainofapplication");g.appendChild(i)},share:function(g,i,f){var h=a.createElement("mi");h.setAttribute("href",i.getAttribute("href"));a.setTextContent(h,"Share "+i.getAttribute("href"));g.appendChild(h)},cerror:function(g,j,f){var n=a.createElement("merror");var m=a.getChildren(j);for(var k=0,h=m.length;k<h;k++){a.applyTransform(n,m[k],0)}g.appendChild(n)},semantics:function(g,k,f){var j=a.createElement("mrow");var n=a.getChildren(k);if(n.length){var o=n[0];for(var m=0,h=n.length;m<h;m++){if(n[m].nodeName==="annotation-xml"&&n[m].getAttribute("encoding")==="MathML-Presentation"){o=n[m];break}}a.applyTransform(j,o,0)}g.appendChild(j)},"annotation-xml":function(g,k,f){var j=a.createElement("mrow");var n=a.getChildren(k);for(var m=0,h=n.length;m<h;m++){a.applyTransform(j,n[m],0)}g.appendChild(j)}};a.tokens.reln=a.tokens.bind=a.tokens.apply;a.contentDictionaries={setname1:function(g,i,f){var j={C:"\u2102",N:"\u2115",P:"\u2119",Q:"\u211A",R:"\u211D",Z:"\u2124"};var h=a.getTextContent(i);a.appendToken(g,"mi",j[h])},aritherror:function(g,i,f){var h=a.getTextContent(i);a.appendToken(g,"mi",h+":")}};a.applyTokens={rem:a.transforms.binary("mod",3),divide:a.transforms.binary("/",3),remainder:a.transforms.binary("mod",3),implies:a.transforms.binary("\u21D2",3),factorof:a.transforms.binary("|",3),"in":a.transforms.binary("\u2208",3),notin:a.transforms.binary("\u2209",3),notsubset:a.transforms.binary("\u2288",2),notprsubset:a.transforms.binary("\u2284",2),setdiff:a.transforms.binary("\u2216",2),eq:a.transforms.infix("=",1),compose:a.transforms.infix("\u2218",0),left_compose:a.transforms.infix("\u2218",1),xor:a.transforms.infix("xor",3),neq:a.transforms.infix("\u2260",1),gt:a.transforms.infix(">",1),lt:a.transforms.infix("<",1),geq:a.transforms.infix("\u2265",1),leq:a.transforms.infix("\u2264",1),equivalent:a.transforms.infix("\u2261",1),approx:a.transforms.infix("\u2248",1),subset:a.transforms.infix("\u2286",2),prsubset:a.transforms.infix("\u2282",2),cartesianproduct:a.transforms.infix("\u00D7",2),cartesian_product:a.transforms.infix("\u00D7",2),vectorproduct:a.transforms.infix("\u00D7",2),scalarproduct:a.transforms.infix(".",2),outerproduct:a.transforms.infix("\u2297",2),sum:a.transforms.iteration("\u2211","="),product:a.transforms.iteration("\u220F","="),forall:a.transforms.bind("\u2200",".",","),exists:a.transforms.bind("\u2203",".",","),lambda:a.transforms.bind("\u03BB",".",","),limit:a.transforms.iteration("lim","\u2192"),sdev:a.transforms.fn("\u03c3"),determinant:a.transforms.fn("det"),max:a.transforms.minmax("max"),min:a.transforms.minmax("min"),real:a.transforms.fn("\u211b"),imaginary:a.transforms.fn("\u2111"),set:a.transforms.set("{","}"),list:a.transforms.set("(",")"),exp:function(h,k,g,j,i,m,f){var l=a.createElement("msup");a.appendToken(l,"mi","e");a.applyTransform(l,j[0],0);h.appendChild(l)},union:function(h,k,g,j,i,l,f){if(i.length){a.transforms.iteration("\u22C3","=")(h,k,g,j,i,l,f)}else{a.transforms.infix("\u222A",2)(h,k,g,j,i,l,f)}},intersect:function(q,i,n,s,g,o,f){if(g.length){a.transforms.iteration("\u22C2","=")(q,i,n,s,g,o,f)}else{var r=a.createElement("mrow");var m=f>2;if(m){a.appendToken(r,"mo","(")}for(var p=0,k=s.length;p<k;p++){var t=false;if(p>0){a.appendToken(r,"mo","\u2229");if(s[p].nodeName==="apply"){var h=a.getChildren(s[p])[0];t=h.nodeName==="union"}}if(t){a.appendToken(r,"mo","(")}a.applyTransform(r,s[p],2);if(t){a.appendToken(r,"mo",")")}}if(m){a.appendToken(r,"mo",")")}q.appendChild(r)}},floor:function(h,l,g,k,j,m,f){var i=a.createElement("mrow");a.appendToken(i,"mo","\u230a");a.applyTransform(i,k[0],0);a.appendToken(i,"mo","\u230b");h.appendChild(i)},conjugate:function(h,l,g,k,j,m,f){var i=a.createElement("mover");a.applyTransform(i,k[0],0);a.appendToken(i,"mo","\u00af");h.appendChild(i)},abs:function(h,l,g,k,j,m,f){var i=a.createElement("mrow");a.appendToken(i,"mo","|");a.applyTransform(i,k[0],0);a.appendToken(i,"mo","|");h.appendChild(i)},and:function(h,k,g,j,i,l,f){if(i.length||l.length){a.transforms.iteration("\u22c0","=")(h,k,g,j,i,l,4)}else{a.transforms.infix("\u2227",2)(h,k,g,j,i,l,f)}},or:function(h,k,g,j,i,l,f){if(i.length||l.length){a.transforms.iteration("\u22c1","=")(h,k,g,j,i,l,4)}else{a.transforms.infix("\u2228",2)(h,k,g,j,i,l,f)}},xor:function(h,k,g,j,i,l,f){if(i.length||l.length){a.transforms.iteration("xor","=")(h,k,g,j,i,l,4)}else{a.transforms.infix("xor",2)(h,k,g,j,i,l,f)}},card:function(h,l,g,k,j,m,f){var i=a.createElement("mrow");a.appendToken(i,"mo","|");a.applyTransform(i,k[0],0);a.appendToken(i,"mo","|");h.appendChild(i)},mean:function(h,l,g,k,j,m,f){if(k.length===1){var i=a.createElement("mover");a.applyTransform(i,k[0],0);a.appendToken(i,"mo","\u00af");h.appendChild(i)}else{h.appendChild(a.createmfenced(k,"\u27e8","\u27e9"))}},moment:function(s,k,o,w,g,p,f){var n,v,h,r,q,m;for(r=0,m=p.length;r<m;r++){if(p[r].nodeName==="degree"){n=p[r]}else{if(p[r].nodeName==="momentabout"){v=p[r]}}}var t=a.createElement("mrow");a.appendToken(t,"mo","\u27e8");var y=a.createElement("mrow");if(w.length>1){y.appendChild(a.createmfenced(w,"(",")"))}else{a.applyTransform(y,w[0],0)}if(n){var x=a.createElement("msup");x.appendChild(y);h=a.getChildren(n);for(q=0,m=h.length;q<m;q++){a.applyTransform(x,h[q],0)}t.appendChild(x)}else{t.appendChild(y)}a.appendToken(t,"mo","\u27e9");if(v){var u=a.createElement("msub");u.appendChild(t);h=a.getChildren(v);for(q=0,m=h.length;q<m;q++){a.applyTransform(u,h[q],0)}s.appendChild(u)}else{s.appendChild(t)}},variance:function(k,h,i,m,g,j,f){var l=a.createElement("mrow");var n=a.createElement("msup");a.appendToken(n,"mo","\u03c3");a.appendToken(n,"mn","2");l.appendChild(n);a.appendToken(l,"mo","\u2061");l.appendChild(a.createmfenced(m,"(",")"));k.appendChild(l)},grad:function(h,l,g,k,j,m,f){var i=a.createElement("mrow");a.appendToken(i,"mo","\u2207");a.appendToken(i,"mo","\u2061");i.appendChild(a.createmfenced(k,"(",")"));h.appendChild(i)},laplacian:function(k,h,i,m,g,j,f){var l=a.createElement("mrow");var n=a.createElement("msup");a.appendToken(n,"mo","\u2207");a.appendToken(n,"mn","2");l.appendChild(n);a.appendToken(l,"mo","\u2061");l.appendChild(a.createmfenced(m,"(",")"));k.appendChild(l)},curl:function(l,h,j,n,g,k,f){var m=a.createElement("mrow");a.appendToken(m,"mo","\u2207");a.appendToken(m,"mo","\u00d7");var i=n[0].nodeName==="apply";if(i){m.appendChild(a.createmfenced(n,"(",")"))}else{a.applyTransform(m,n[0],f)}l.appendChild(m)},divergence:function(l,h,j,n,g,k,f){var m=a.createElement("mrow");a.appendToken(m,"mo","\u2207");a.appendToken(m,"mo","\u22c5");var i=n[0].nodeName==="apply";if(i){m.appendChild(a.createmfenced(n,"(",")"))}else{a.applyTransform(m,n[0],f)}l.appendChild(m)},not:function(l,h,j,n,g,k,f){var m=a.createElement("mrow");a.appendToken(m,"mo","\u00ac");var i=n[0].nodeName==="apply"||n[0].nodeName==="bind";if(i){a.appendToken(m,"mo","(")}a.applyTransform(m,n[0],f);if(i){a.appendToken(m,"mo",")")}l.appendChild(m)},divide:function(h,k,g,j,i,l,f){var m=a.createElement("mfrac");a.applyTransform(m,j[0],0);a.applyTransform(m,j[1],0);h.appendChild(m)},tendsto:function(l,i,j,m,h,k,f){var n;if(j.nodeName==="tendsto"){n=j.getAttribute("type")}else{n=a.getTextContent(m[0]);m=m.slice(1)}var g=(n==="above")?"\u2198":(n==="below")?"\u2197":"\u2192";a.transforms.binary(g,2)(l,i,j,m,h,k,f)},minus:function(m,i,k,o,g,l,f){var h=o.length===1?5:2;var n=a.createElement("mrow");var j=h<f;if(j){a.appendToken(n,"mo","(")}if(o.length===1){a.appendToken(n,"mo","-");a.applyTransform(n,o[0],h)}else{a.applyTransform(n,o[0],h);a.appendToken(n,"mo","-");var p;if(o[1].nodeName==="apply"){var q=a.getChildren(o[1])[0];p=q.nodeName==="plus"||q.nodeName==="minus"}if(p){a.appendToken(n,"mo","(")}a.applyTransform(n,o[1],h);if(p){a.appendToken(n,"mo",")")}}if(j){a.appendToken(n,"mo",")")}m.appendChild(n)},"complex-cartesian":function(h,l,g,k,j,m,f){var i=a.createElement("mrow");a.applyTransform(i,k[0],0);a.appendToken(i,"mo","+");a.applyTransform(i,k[1],0);a.appendToken(i,"mo","\u2062");a.appendToken(i,"mi","i");h.appendChild(i)},"complex-polar":function(k,h,i,m,g,j,f){var l=a.createElement("mrow");a.applyTransform(l,m[0],0);a.appendToken(l,"mo","\u2062");var o=a.createElement("msup");a.appendToken(o,"mi","e");var n=a.createElement("mrow");a.applyTransform(n,m[1],0);a.appendToken(n,"mo","\u2062");a.appendToken(n,"mi","i");o.appendChild(n);l.appendChild(o);k.appendChild(l)},integer:function(h,k,g,j,i,l,f){a.applyTransform(h,j[0],0)},"based-integer":function(h,k,g,j,i,l,f){var m=a.createElement("msub");a.applyTransform(m,j[1],0);a.applyTransform(m,j[0],0);h.appendChild(m)},rational:function(h,k,g,j,i,l,f){var m=a.createElement("mfrac");a.applyTransform(m,j[0],0);a.applyTransform(m,j[1],0);h.appendChild(m)},times:function(p,h,m,r,g,n,f){var q=a.createElement("mrow");var k=f>3;if(k){a.appendToken(q,"mo","(")}for(var o=0,i=r.length;o<i;o++){if(o>0){a.appendToken(q,"mo",(r[o].nodeName==="cn")?"\u00D7":"\u2062")}a.applyTransform(q,r[o],3)}if(k){a.appendToken(q,"mo",")")}p.appendChild(q)},plus:function(s,k,p,u,g,q,f){var t=a.createElement("mrow");var o=f>2;if(o){a.appendToken(t,"mo","(")}for(var r=0,m=u.length;r<m;r++){var v=u[r];var h=a.getChildren(v);if(r>0){var i;if(a.settings.collapsePlusMinus){if(v.nodeName==="cn"&&!(h.length)&&(i=Number(a.getTextContent(v)))<0){a.appendToken(t,"mo","\u2212");a.appendToken(t,"mn",-i)}else{if(v.nodeName==="apply"&&h.length===2&&h[0].nodeName==="minus"){a.appendToken(t,"mo","\u2212");a.applyTransform(t,h[1],2)}else{if(v.nodeName==="apply"&&h.length>2&&h[0].nodeName==="times"&&h[1].nodeName==="cn"&&(i=Number(a.getTextContent(h[1]))<0)){a.appendToken(t,"mo","\u2212");a.getTextContent(h[1])=-i;a.applyTransform(t,v,2)}else{a.appendToken(t,"mo","+");a.applyTransform(t,v,2)}}}}else{a.appendToken(t,"mo","+");a.applyTransform(t,v,2)}}else{a.applyTransform(t,v,2)}}if(o){a.appendToken(t,"mo",")")}s.appendChild(t)},transpose:function(h,k,g,j,i,m,f){var l=a.createElement("msup");a.applyTransform(l,j[0],f);a.appendToken(l,"mi","T");h.appendChild(l)},power:function(h,k,g,j,i,m,f){var l=a.createElement("msup");a.applyTransform(l,j[0],3);a.applyTransform(l,j[1],f);h.appendChild(l)},selector:function(p,h,k,s,g,n,f){var r=a.createElement("msub");var q=s?s[0]:a.createElement("mrow");a.applyTransform(r,q,0);var m=a.createElement("mrow");for(var o=1,j=s.length;o<j;o++){if(o!=1){a.appendToken(m,"mo",",")}a.applyTransform(m,s[o],0)}r.appendChild(m);p.appendChild(r)},log:function(k,h,i,o,g,j,f){var m=a.createElement("mrow");var l=a.createElement("mi");a.setTextContent(l,"log");if(j.length&&j[0].nodeName==="logbase"){var n=a.createElement("msub");n.appendChild(l);a.applyTransform(n,a.getChildren(j[0])[0],0);m.appendChild(n)}else{m.appendChild(l)}a.applyTransform(m,o[0],7);k.appendChild(m)},"int":function(p,y,B,m,g,t,n){var s=a.createElement("mrow");var x=a.createElement("mo");a.setTextContent(x,"\u222B");var q=a.createElement("msubsup");q.appendChild(x);var k=a.createElement("mrow");var o,A,w,v,u,z;for(A=0,u=t.length;A<u;A++){if(t[A].nodeName==="lowlimit"||t[A].nodeName==="condition"||t[A].nodeName==="domainofapplication"){o=a.getChildren(t[A]);for(w=0,z=o.length;w<z;w++){a.applyTransform(k,o[w],0)}}else{o=a.getChildren(t[A]);if(t[A].nodeName==="interval"&&o.length===2){a.applyTransform(k,o[0],0)}}}q.appendChild(k);var h=a.createElement("mrow");for(A=0,u=t.length;A<u;A++){if(t[A].nodeName==="uplimit"){o=a.getChildren(t[A]);for(w=0,z=o.length;w<z;w++){a.applyTransform(h,o[w],0)}break}else{if(t[A].nodeName==="interval"){o=a.getChildren(t[A]);a.applyTransform(h,o[o.length-1],0);break}}}q.appendChild(h);s.appendChild(q);for(A=0,v=m.length;A<v;A++){a.applyTransform(s,m[A],0)}for(A=0,v=g.length;A<v;A++){var r=g[A];o=a.getChildren(r);if(o.length){var f=a.createElement("mrow");a.appendToken(f,"mi","d");a.applyTransform(f,o[0],0);s.appendChild(f)}}p.appendChild(s)},inverse:function(k,h,i,l,g,j,f){var o=a.createElement("msup");var m=(l.length)?l[0]:a.createElement("mrow");a.applyTransform(o,m,f);var n=a.createElement("mfenced");a.appendToken(n,"mn","-1");o.appendChild(n);k.appendChild(o)},quotient:function(h,l,g,k,j,m,f){var i=a.createElement("mrow");a.appendToken(i,"mo","\u230A");if(k.length){a.applyTransform(i,k[0],0);a.appendToken(i,"mo","/");if(k.length>1){a.applyTransform(i,k[1],0)}}a.appendToken(i,"mo","\u230B");h.appendChild(i)},factorial:function(h,l,g,k,j,m,f){var i=a.createElement("mrow");a.applyTransform(i,k[0],4);a.appendToken(i,"mo","!");h.appendChild(i)},root:function(p,j,m,q,h,n,f){var g;if(m.nodeName==="root"&&(n.length===0||(n[0].nodeName==="degree"&&a.getTextContent(n[0])==="2"))){g=a.createElement("msqrt");for(var o=0,k=q.length;o<k;o++){a.applyTransform(g,q[o],0)}}else{g=a.createElement("mroot");a.applyTransform(g,q[0],0);var r=(m.nodeName==="root")?n[0].childNodes[0]:q[1];a.applyTransform(g,r,0)}p.appendChild(g)},diff:function(p,y,B,g,f,t,m){if(f.length){var v;var q=a.createElement("mfrac");var x=a.createElement("mrow");var z=a.createElement("mrow");q.appendChild(x);q.appendChild(z);var r,k,o,s;var A=a.createElement("mi");a.setTextContent(A,"d");var n=a.getChildren(f[0]);for(var w=0,u=n.length;w<u;w++){if(n[w].nodeName==="degree"){var h=a.getChildren(n[w])[0];if(a.getTextContent(h)!="1"){k=h;o=a.createElement("msup");o.appendChild(A);A=o;a.applyTransform(A,k,0)}}else{r=n[w]}}x.appendChild(A);if(g.length){switch(g[0].nodeName){case"apply":case"bind":case"reln":s=a.createElement("mrow");s.appendChild(q);a.applyTransform(s,g[0],3);v=s;break;default:a.applyTransform(x,g[0],0);v=q}}a.appendToken(z,"mi","d");if(k){var i=a.createElement("msup");a.applyTransform(i,r,0);a.applyTransform(i,k,0);z.appendChild(i)}else{a.applyTransform(z,r,0)}p.appendChild(v)}else{o=a.createElement("msup");s=a.createElement("mrow");o.appendChild(s);a.applyTransform(s,g[0],0);a.appendToken(o,"mo","\u2032");p.appendChild(o)}},partialdiff:function(t,I,N,g,f,D,o){var q,B,A;var v=a.createElement("mfrac");var H=a.createElement("mrow");var M=a.createElement("mrow");v.appendChild(H);v.appendChild(M);var L,m,p;if(f.length===0&&g.length===2&&g[0].nodeName==="list"){if(g[1].nodeName==="lambda"){m=a.getChildren(g[0]).length;if(m!=1){q=a.createElement("msup");a.appendToken(q,"mo","\u2202");a.appendToken(q,"mn",m);H.appendChild(q)}else{a.appendToken(H,"mo","\u2202")}p=a.getChildren(g[1]);L=p[p.length-1];var h=[];var r=a.getChildren(g[1]);var z=a.getChildren(g[0]);for(var K=0,F=r.length;K<F;K++){if(r[K].nodeName==="bvar"){h.push(a.getChildren(r[K])[0])}}var y=null;m=0;function u(O,l){a.appendToken(M,"mo","\u2202");var j=h[O];if(l>1){var i=a.createElement("msup");a.applyTransform(i,j,0);a.appendToken(i,"mn",l);M.appendChild(i)}else{a.applyTransform(M,j,0)}}for(K=0,F=z.length;K<F;K++){var C=Number(a.getTextContent(z[K]))-1;if(y!==null&&C!=y){u(y,m);m=0}y=C;m+=1}if(y){u(y,m)}}else{A=a.createElement("mrow");B=a.createElement("msub");a.appendToken(B,"mi","D");var w=a.getChildren(g[0]);B.appendChild(a.createmfenced(w,"",""));A.appendChild(B);a.applyTransform(A,g[1],0);t.appendChild(A);return}}else{q=a.createElement("msup");H.appendChild(q);a.appendToken(q,"mo","\u2202");var s=a.createElement("mrow");q.appendChild(s);var J;if(D.length&&D[0].nodeName==="degree"&&a.getChildren(D[0]).length){J=a.getChildren(D[0])[0];a.applyTransform(s,J,0)}else{m=0;var x=false;for(K=0,F=f.length;K<F;K++){p=a.getChildren(f[K]);if(p.length===2){for(var G=0;G<2;G++){if(p[G].nodeName==="degree"){if(/^\s*\d+\s*$/.test(a.getTextContent(p[G]))){m+=Number(a.getTextContent(p[G]))}else{if(x){a.appendToken(s,"mo","+")}x=true;a.applyTransform(s,a.getChildren(p[G])[0],0)}}}}else{m++}}if(m>0){if(x){a.appendToken(s,"mo","+")}a.appendToken(s,"mn",m)}}if(g.length){L=g[0]}for(K=0,F=f.length;K<F;K++){a.appendToken(M,"mo","\u2202");p=a.getChildren(f[K]);if(p.length===2){for(G=0;G<2;G++){if(p[G].nodeName==="degree"){var k=a.createElement("msup");a.applyTransform(k,p[1-G],0);var E=a.getChildren(p[G])[0];a.applyTransform(k,E,0);M.appendChild(k)}}}else{if(p.length===1){a.applyTransform(M,p[0],0)}}}}if(L){switch(L.nodeName){case"apply":case"bind":case"reln":A=a.createElement("mrow");A.appendChild(v);a.applyTransform(A,L,3);outNode=A;break;default:a.applyTransform(H,L,0);outNode=v}}else{outNode=v}t.appendChild(outNode)}};a.applyTokens.size=a.applyTokens.card;return a})(MathJax.Hub);MathJax.Hub.Register.StartupHook("MathML Jax Ready",function(){var b=MathJax.InputJax.MathML;var a=MathJax.Extension["MathML/content-mathml"];b.DOMfilterHooks.Add(function(c){c.math=a.transformElement(c.math)});MathJax.Hub.Startup.signal.Post("MathML/content-mathml Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/MathML/content-mathml.js");
ripple0328/cdnjs
ajax/libs/mathjax/2.5.1/extensions/MathML/content-mathml.js
JavaScript
mit
29,902
/* Flot plugin for computing bottoms for filled line and bar charts. The case: you've got two series that you want to fill the area between. In Flot terms, you need to use one as the fill bottom of the other. You can specify the bottom of each data point as the third coordinate manually, or you can use this plugin to compute it for you. In order to name the other series, you need to give it an id, like this var dataset = [ { data: [ ... ], id: "foo" } , // use default bottom { data: [ ... ], fillBetween: "foo" }, // use first dataset as bottom ]; $.plot($("#placeholder"), dataset, { line: { show: true, fill: true }}); As a convenience, if the id given is a number that doesn't appear as an id in the series, it is interpreted as the index in the array instead (so fillBetween: 0 can also mean the first series). Internally, the plugin modifies the datapoints in each series. For line series, extra data points might be inserted through interpolation. Note that at points where the bottom line is not defined (due to a null point or start/end of line), the current line will show a gap too. The algorithm comes from the jquery.flot.stack.js plugin, possibly some code could be shared. */ (function ($) { var options = { series: { fillBetween: null } // or number }; function init(plot) { function findBottomSeries(s, allseries) { var i; for (i = 0; i < allseries.length; ++i) { if (allseries[i].id == s.fillBetween) return allseries[i]; } if (typeof s.fillBetween == "number") { i = s.fillBetween; if (i < 0 || i >= allseries.length) return null; return allseries[i]; } return null; } function computeFillBottoms(plot, s, datapoints) { if (s.fillBetween == null) return; var other = findBottomSeries(s, plot.getData()); if (!other) return; var ps = datapoints.pointsize, points = datapoints.points, otherps = other.datapoints.pointsize, otherpoints = other.datapoints.points, newpoints = [], px, py, intery, qx, qy, bottom, withlines = s.lines.show, withbottom = ps > 2 && datapoints.format[2].y, withsteps = withlines && s.lines.steps, fromgap = true, i = 0, j = 0, l; while (true) { if (i >= points.length) break; l = newpoints.length; if (points[i] == null) { // copy gaps for (m = 0; m < ps; ++m) newpoints.push(points[i + m]); i += ps; } else if (j >= otherpoints.length) { // for lines, we can't use the rest of the points if (!withlines) { for (m = 0; m < ps; ++m) newpoints.push(points[i + m]); } i += ps; } else if (otherpoints[j] == null) { // oops, got a gap for (m = 0; m < ps; ++m) newpoints.push(null); fromgap = true; j += otherps; } else { // cases where we actually got two points px = points[i]; py = points[i + 1]; qx = otherpoints[j]; qy = otherpoints[j + 1]; bottom = 0; if (px == qx) { for (m = 0; m < ps; ++m) newpoints.push(points[i + m]); //newpoints[l + 1] += qy; bottom = qy; i += ps; j += otherps; } else if (px > qx) { // we got past point below, might need to // insert interpolated extra point if (withlines && i > 0 && points[i - ps] != null) { intery = py + (points[i - ps + 1] - py) * (qx - px) / (points[i - ps] - px); newpoints.push(qx); newpoints.push(intery) for (m = 2; m < ps; ++m) newpoints.push(points[i + m]); bottom = qy; } j += otherps; } else { // px < qx if (fromgap && withlines) { // if we come from a gap, we just skip this point i += ps; continue; } for (m = 0; m < ps; ++m) newpoints.push(points[i + m]); // we might be able to interpolate a point below, // this can give us a better y if (withlines && j > 0 && otherpoints[j - otherps] != null) bottom = qy + (otherpoints[j - otherps + 1] - qy) * (px - qx) / (otherpoints[j - otherps] - qx); //newpoints[l + 1] += bottom; i += ps; } fromgap = false; if (l != newpoints.length && withbottom) newpoints[l + 2] = bottom; } // maintain the line steps invariant if (withsteps && l != newpoints.length && l > 0 && newpoints[l] != null && newpoints[l] != newpoints[l - ps] && newpoints[l + 1] != newpoints[l - ps + 1]) { for (m = 0; m < ps; ++m) newpoints[l + ps + m] = newpoints[l + m]; newpoints[l + 1] = newpoints[l - ps + 1]; } } datapoints.points = newpoints; } plot.hooks.processDatapoints.push(computeFillBottoms); } $.plot.plugins.push({ init: init, options: options, name: 'fillbetween', version: '1.0' }); })(jQuery);
askehansen/cdnjs
ajax/libs/flot/0.7.0/jquery.flot.fillbetween.js
JavaScript
mit
6,771
/* Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license */ CKEDITOR.plugins.setLang("specialchar","af",{euro:"Euroteken",lsquo:"Linker enkelkwotasie",rsquo:"Regter enkelkwotasie",ldquo:"Linker dubbelkwotasie",rdquo:"Regter dubbelkwotasie",ndash:"Kortkoppelteken",mdash:"Langkoppelteken",iexcl:"Omgekeerdeuitroepteken",cent:"Centteken",pound:"Pondteken",curren:"Geldeenheidteken",yen:"Yenteken",brvbar:"Gebreekte balk",sect:"Afdeelingsteken",uml:"Deelteken",copy:"Kopieregteken",ordf:"Vroulikekenteken",laquo:"Linkgeoorienteerde aanhaalingsteken",not:"Verbodeteken", reg:"Regestrasieteken",macr:"Lengteteken",deg:"Gradeteken",sup2:"Kwadraatteken",sup3:"Kubiekteken",acute:"Akuutaksentteken",micro:"Mikroteken",para:"Pilcrow sign",middot:"Middle dot",cedil:"Cedilla",sup1:"Superscript one",ordm:"Masculine ordinal indicator",raquo:"Right-pointing double angle quotation mark",frac14:"Vulgar fraction one quarter",frac12:"Vulgar fraction one half",frac34:"Vulgar fraction three quarters",iquest:"Inverted question mark",Agrave:"Latin capital letter A with grave accent", Aacute:"Latin capital letter A with acute accent",Acirc:"Latin capital letter A with circumflex",Atilde:"Latin capital letter A with tilde",Auml:"Latin capital letter A with diaeresis",Aring:"Latin capital letter A with ring above",AElig:"Latin Capital letter Æ",Ccedil:"Latin capital letter C with cedilla",Egrave:"Latin capital letter E with grave accent",Eacute:"Latin capital letter E with acute accent",Ecirc:"Latin capital letter E with circumflex",Euml:"Latin capital letter E with diaeresis",Igrave:"Latin capital letter I with grave accent", Iacute:"Latin capital letter I with acute accent",Icirc:"Latin capital letter I with circumflex",Iuml:"Latin capital letter I with diaeresis",ETH:"Latin capital letter Eth",Ntilde:"Latin capital letter N with tilde",Ograve:"Latin capital letter O with grave accent",Oacute:"Latin capital letter O with acute accent",Ocirc:"Latin capital letter O with circumflex",Otilde:"Latin capital letter O with tilde",Ouml:"Latin capital letter O with diaeresis",times:"Multiplication sign",Oslash:"Latin capital letter O with stroke", Ugrave:"Latin capital letter U with grave accent",Uacute:"Latin capital letter U with acute accent",Ucirc:"Latin capital letter U with circumflex",Uuml:"Latin capital letter U with diaeresis",Yacute:"Latin capital letter Y with acute accent",THORN:"Latin capital letter Thorn",szlig:"Latin small letter sharp s",agrave:"Latin small letter a with grave accent",aacute:"Latin small letter a with acute accent",acirc:"Latin small letter a with circumflex",atilde:"Latin small letter a with tilde",auml:"Latin small letter a with diaeresis", aring:"Latin small letter a with ring above",aelig:"Latin small letter æ",ccedil:"Latin small letter c with cedilla",egrave:"Latin small letter e with grave accent",eacute:"Latin small letter e with acute accent",ecirc:"Latin small letter e with circumflex",euml:"Latin small letter e with diaeresis",igrave:"Latin small letter i with grave accent",iacute:"Latin small letter i with acute accent",icirc:"Latin small letter i with circumflex",iuml:"Latin small letter i with diaeresis",eth:"Latin small letter eth", ntilde:"Latin small letter n with tilde",ograve:"Latin small letter o with grave accent",oacute:"Latin small letter o with acute accent",ocirc:"Latin small letter o with circumflex",otilde:"Latin small letter o with tilde",ouml:"Latin small letter o with diaeresis",divide:"Division sign",oslash:"Latin small letter o with stroke",ugrave:"Latin small letter u with grave accent",uacute:"Latin small letter u with acute accent",ucirc:"Latin small letter u with circumflex",uuml:"Latin small letter u with diaeresis", yacute:"Latin small letter y with acute accent",thorn:"Latin small letter thorn",yuml:"Latin small letter y with diaeresis",OElig:"Latin capital ligature OE",oelig:"Latin small ligature oe",372:"Latin capital letter W with circumflex",374:"Latin capital letter Y with circumflex",373:"Latin small letter w with circumflex",375:"Latin small letter y with circumflex",sbquo:"Single low-9 quotation mark",8219:"Single high-reversed-9 quotation mark",bdquo:"Double low-9 quotation mark",hellip:"Horizontal ellipsis", trade:"Trade mark sign",9658:"Black right-pointing pointer",bull:"Bullet",rarr:"Rightwards arrow",rArr:"Rightwards double arrow",hArr:"Left right double arrow",diams:"Black diamond suit",asymp:"Almost equal to"});
SenjougaharaSama/project
public/plugins/ckeditor/plugins/specialchar/dialogs/lang/af.js
JavaScript
mit
4,529
/* * misc.c * * This is a collection of several routines from gzip-1.0.3 * adapted for Linux. * * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 * * Modified for ARM Linux by Russell King * * Nicolas Pitre <nico@visuaide.com> 1999/04/14 : * For this code to run directly from Flash, all constant variables must * be marked with 'const' and all other variables initialized at run-time * only. This way all non constant variables will end up in the bss segment, * which should point to addresses in RAM and cleared to 0 on start. * This allows for a much quicker boot time. */ unsigned int __machine_arch_type; #include <linux/compiler.h> /* for inline */ #include <linux/types.h> #include <linux/linkage.h> static void putstr(const char *ptr); extern void error(char *x); #include CONFIG_UNCOMPRESS_INCLUDE #ifdef CONFIG_DEBUG_ICEDCC #if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K) || defined(CONFIG_CPU_V7) static void icedcc_putc(int ch) { int status, i = 0x4000000; do { if (--i < 0) return; asm volatile ("mrc p14, 0, %0, c0, c1, 0" : "=r" (status)); } while (status & (1 << 29)); asm("mcr p14, 0, %0, c0, c5, 0" : : "r" (ch)); } #elif defined(CONFIG_CPU_XSCALE) static void icedcc_putc(int ch) { int status, i = 0x4000000; do { if (--i < 0) return; asm volatile ("mrc p14, 0, %0, c14, c0, 0" : "=r" (status)); } while (status & (1 << 28)); asm("mcr p14, 0, %0, c8, c0, 0" : : "r" (ch)); } #else static void icedcc_putc(int ch) { int status, i = 0x4000000; do { if (--i < 0) return; asm volatile ("mrc p14, 0, %0, c0, c0, 0" : "=r" (status)); } while (status & 2); asm("mcr p14, 0, %0, c1, c0, 0" : : "r" (ch)); } #endif #define putc(ch) icedcc_putc(ch) #endif static void putstr(const char *ptr) { char c; while ((c = *ptr++) != '\0') { if (c == '\n') putc('\r'); putc(c); } flush(); } /* * gzip declarations */ extern char input_data[]; extern char input_data_end[]; unsigned char *output_data; unsigned long free_mem_ptr; unsigned long free_mem_end_ptr; #ifndef arch_error #define arch_error(x) #endif void error(char *x) { arch_error(x); putstr("\n\n"); putstr(x); putstr("\n\n -- System halted"); while(1); /* Halt */ } asmlinkage void __div0(void) { error("Attempting division by 0!"); } unsigned long __stack_chk_guard; void __stack_chk_guard_setup(void) { __stack_chk_guard = 0x000a0dff; } void __stack_chk_fail(void) { error("stack-protector: Kernel stack is corrupted\n"); } extern int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x)); void decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p, unsigned long free_mem_ptr_end_p, int arch_id) { int ret; __stack_chk_guard_setup(); output_data = (unsigned char *)output_start; free_mem_ptr = free_mem_ptr_p; free_mem_end_ptr = free_mem_ptr_end_p; __machine_arch_type = arch_id; arch_decomp_setup(); putstr("Uncompressing Linux..."); ret = do_decompress(input_data, input_data_end - input_data, output_data, error); if (ret) error("decompressor returned an error"); else putstr(" done, booting the kernel.\n"); }
publicloudapp/csrutil
linux-4.3/arch/arm/boot/compressed/misc.c
C
mit
3,185
/*! jQuery UI - v1.11.4 - 2015-03-11 * http://jqueryui.com * Includes: core.js, widget.js, mouse.js, position.js, accordion.js, autocomplete.js, button.js, datepicker.js, dialog.js, draggable.js, droppable.js, effect.js, effect-blind.js, effect-bounce.js, effect-clip.js, effect-drop.js, effect-explode.js, effect-fade.js, effect-fold.js, effect-highlight.js, effect-puff.js, effect-pulsate.js, effect-scale.js, effect-shake.js, effect-size.js, effect-slide.js, effect-transfer.js, menu.js, progressbar.js, resizable.js, selectable.js, selectmenu.js, slider.js, sortable.js, spinner.js, tabs.js, tooltip.js * Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */ (function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){function t(t,s){var n,a,o,r=t.nodeName.toLowerCase();return"area"===r?(n=t.parentNode,a=n.name,t.href&&a&&"map"===n.nodeName.toLowerCase()?(o=e("img[usemap='#"+a+"']")[0],!!o&&i(o)):!1):(/^(input|select|textarea|button|object)$/.test(r)?!t.disabled:"a"===r?t.href||s:s)&&i(t)}function i(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}function s(e){for(var t,i;e.length&&e[0]!==document;){if(t=e.css("position"),("absolute"===t||"relative"===t||"fixed"===t)&&(i=parseInt(e.css("zIndex"),10),!isNaN(i)&&0!==i))return i;e=e.parent()}return 0}function n(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},e.extend(this._defaults,this.regional[""]),this.regional.en=e.extend(!0,{},this.regional[""]),this.regional["en-US"]=e.extend(!0,{},this.regional.en),this.dpDiv=a(e("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function a(t){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return t.delegate(i,"mouseout",function(){e(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).removeClass("ui-datepicker-next-hover")}).delegate(i,"mouseover",o)}function o(){e.datepicker._isDisabledDatepicker(v.inline?v.dpDiv.parent()[0]:v.input[0])||(e(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),e(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).addClass("ui-datepicker-next-hover"))}function r(t,i){e.extend(t,i);for(var s in i)null==i[s]&&(t[s]=i[s]);return t}function h(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}e.ui=e.ui||{},e.extend(e.ui,{version:"1.11.4",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({scrollParent:function(t){var i=this.css("position"),s="absolute"===i,n=t?/(auto|scroll|hidden)/:/(auto|scroll)/,a=this.parents().filter(function(){var t=e(this);return s&&"static"===t.css("position")?!1:n.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==i&&a.length?a:e(this[0].ownerDocument||document)},uniqueId:function(){var e=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++e)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,s){return!!e.data(t,s[3])},focusable:function(i){return t(i,!isNaN(e.attr(i,"tabindex")))},tabbable:function(i){var s=e.attr(i,"tabindex"),n=isNaN(s);return(n||s>=0)&&t(i,!n)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(t,i){function s(t,i,s,a){return e.each(n,function(){i-=parseFloat(e.css(t,"padding"+this))||0,s&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),a&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],a=i.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+i]=function(t){return void 0===t?o["inner"+i].call(this):this.each(function(){e(this).css(a,s(this,t)+"px")})},e.fn["outer"+i]=function(t,n){return"number"!=typeof t?o["outer"+i].call(this,t):this.each(function(){e(this).css(a,s(this,t,!0,n)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.fn.extend({focus:function(t){return function(i,s){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),s&&s.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),disableSelection:function(){var e="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.bind(e+".ui-disableSelection",function(e){e.preventDefault()})}}(),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(t){if(void 0!==t)return this.css("zIndex",t);if(this.length)for(var i,s,n=e(this[0]);n.length&&n[0]!==document;){if(i=n.css("position"),("absolute"===i||"relative"===i||"fixed"===i)&&(s=parseInt(n.css("zIndex"),10),!isNaN(s)&&0!==s))return s;n=n.parent()}return 0}}),e.ui.plugin={add:function(t,i,s){var n,a=e.ui[t].prototype;for(n in s)a.plugins[n]=a.plugins[n]||[],a.plugins[n].push([i,s[n]])},call:function(e,t,i,s){var n,a=e.plugins[t];if(a&&(s||e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType))for(n=0;a.length>n;n++)e.options[a[n][0]]&&a[n][1].apply(e.element,i)}};var l=0,u=Array.prototype.slice;e.cleanData=function(t){return function(i){var s,n,a;for(a=0;null!=(n=i[a]);a++)try{s=e._data(n,"events"),s&&s.remove&&e(n).triggerHandler("remove")}catch(o){}t(i)}}(e.cleanData),e.widget=function(t,i,s){var n,a,o,r,h={},l=t.split(".")[0];return t=t.split(".")[1],n=l+"-"+t,s||(s=i,i=e.Widget),e.expr[":"][n.toLowerCase()]=function(t){return!!e.data(t,n)},e[l]=e[l]||{},a=e[l][t],o=e[l][t]=function(e,t){return this._createWidget?(arguments.length&&this._createWidget(e,t),void 0):new o(e,t)},e.extend(o,a,{version:s.version,_proto:e.extend({},s),_childConstructors:[]}),r=new i,r.options=e.widget.extend({},r.options),e.each(s,function(t,s){return e.isFunction(s)?(h[t]=function(){var e=function(){return i.prototype[t].apply(this,arguments)},n=function(e){return i.prototype[t].apply(this,e)};return function(){var t,i=this._super,a=this._superApply;return this._super=e,this._superApply=n,t=s.apply(this,arguments),this._super=i,this._superApply=a,t}}(),void 0):(h[t]=s,void 0)}),o.prototype=e.widget.extend(r,{widgetEventPrefix:a?r.widgetEventPrefix||t:t},h,{constructor:o,namespace:l,widgetName:t,widgetFullName:n}),a?(e.each(a._childConstructors,function(t,i){var s=i.prototype;e.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete a._childConstructors):i._childConstructors.push(o),e.widget.bridge(t,o),o},e.widget.extend=function(t){for(var i,s,n=u.call(arguments,1),a=0,o=n.length;o>a;a++)for(i in n[a])s=n[a][i],n[a].hasOwnProperty(i)&&void 0!==s&&(t[i]=e.isPlainObject(s)?e.isPlainObject(t[i])?e.widget.extend({},t[i],s):e.widget.extend({},s):s);return t},e.widget.bridge=function(t,i){var s=i.prototype.widgetFullName||t;e.fn[t]=function(n){var a="string"==typeof n,o=u.call(arguments,1),r=this;return a?this.each(function(){var i,a=e.data(this,s);return"instance"===n?(r=a,!1):a?e.isFunction(a[n])&&"_"!==n.charAt(0)?(i=a[n].apply(a,o),i!==a&&void 0!==i?(r=i&&i.jquery?r.pushStack(i.get()):i,!1):void 0):e.error("no such method '"+n+"' for "+t+" widget instance"):e.error("cannot call methods on "+t+" prior to initialization; "+"attempted to call method '"+n+"'")}):(o.length&&(n=e.widget.extend.apply(null,[n].concat(o))),this.each(function(){var t=e.data(this,s);t?(t.option(n||{}),t._init&&t._init()):e.data(this,s,new i(n,this))})),r}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,i){i=e(i||this.defaultElement||this)[0],this.element=e(i),this.uuid=l++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=e(),this.hoverable=e(),this.focusable=e(),i!==this&&(e.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===i&&this.destroy()}}),this.document=e(i.style?i.ownerDocument:i.document||i),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(t,i){var s,n,a,o=t;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof t)if(o={},s=t.split("."),t=s.shift(),s.length){for(n=o[t]=e.widget.extend({},this.options[t]),a=0;s.length-1>a;a++)n[s[a]]=n[s[a]]||{},n=n[s[a]];if(t=s.pop(),1===arguments.length)return void 0===n[t]?null:n[t];n[t]=i}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];o[t]=i}return this._setOptions(o),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled",!!t),t&&(this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"))),this},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_on:function(t,i,s){var n,a=this;"boolean"!=typeof t&&(s=i,i=t,t=!1),s?(i=n=e(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),e.each(s,function(s,o){function r(){return t||a.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof o?a[o]:o).apply(a,arguments):void 0}"string"!=typeof o&&(r.guid=o.guid=o.guid||r.guid||e.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+a.eventNamespace,u=h[2];u?n.delegate(u,l,r):i.bind(l,r)})},_off:function(t,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.unbind(i).undelegate(i),this.bindings=e(this.bindings.not(t).get()),this.focusable=e(this.focusable.not(t).get()),this.hoverable=e(this.hoverable.not(t).get())},_delay:function(e,t){function i(){return("string"==typeof e?s[e]:e).apply(s,arguments)}var s=this;return setTimeout(i,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,i,s){var n,a,o=this.options[t];if(s=s||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],a=i.originalEvent)for(n in a)n in i||(i[n]=a[n]);return this.element.trigger(i,s),!(e.isFunction(o)&&o.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(s,n,a){"string"==typeof n&&(n={effect:n});var o,r=n?n===!0||"number"==typeof n?i:n.effect||i:t;n=n||{},"number"==typeof n&&(n={duration:n}),o=!e.isEmptyObject(n),n.complete=a,n.delay&&s.delay(n.delay),o&&e.effects&&e.effects.effect[r]?s[t](n):r!==t&&s[r]?s[r](n.duration,n.easing,a):s.queue(function(i){e(this)[t](),a&&a.call(s[0]),i()})}}),e.widget;var d=!1;e(document).mouseup(function(){d=!1}),e.widget("ui.mouse",{version:"1.11.4",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(i){return!0===e.data(i.target,t.widgetName+".preventClickEvent")?(e.removeData(i.target,t.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(!d){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var i=this,s=1===t.which,n="string"==typeof this.options.cancel&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;return s&&!n&&this._mouseCapture(t)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(t)!==!1,!this._mouseStarted)?(t.preventDefault(),!0):(!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return i._mouseMove(e)},this._mouseUpDelegate=function(e){return i._mouseUp(e)},this.document.bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),d=!0,!0)):!0}},_mouseMove:function(t){if(this._mouseMoved){if(e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button)return this._mouseUp(t);if(!t.which)return this._mouseUp(t)}return(t.which||t.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),d=!1,!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),function(){function t(e,t,i){return[parseFloat(e[0])*(p.test(e[0])?t/100:1),parseFloat(e[1])*(p.test(e[1])?i/100:1)]}function i(t,i){return parseInt(e.css(t,i),10)||0}function s(t){var i=t[0];return 9===i.nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:e.isWindow(i)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()}}e.ui=e.ui||{};var n,a,o=Math.max,r=Math.abs,h=Math.round,l=/left|center|right/,u=/top|center|bottom/,d=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,p=/%$/,f=e.fn.position;e.position={scrollbarWidth:function(){if(void 0!==n)return n;var t,i,s=e("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),a=s.children()[0];return e("body").append(s),t=a.offsetWidth,s.css("overflow","scroll"),i=a.offsetWidth,t===i&&(i=s[0].clientWidth),s.remove(),n=t-i},getScrollInfo:function(t){var i=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),s=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),n="scroll"===i||"auto"===i&&t.width<t.element[0].scrollWidth,a="scroll"===s||"auto"===s&&t.height<t.element[0].scrollHeight;return{width:a?e.position.scrollbarWidth():0,height:n?e.position.scrollbarWidth():0}},getWithinInfo:function(t){var i=e(t||window),s=e.isWindow(i[0]),n=!!i[0]&&9===i[0].nodeType;return{element:i,isWindow:s,isDocument:n,offset:i.offset()||{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:s||n?i.width():i.outerWidth(),height:s||n?i.height():i.outerHeight()}}},e.fn.position=function(n){if(!n||!n.of)return f.apply(this,arguments);n=e.extend({},n);var p,m,g,v,y,b,_=e(n.of),x=e.position.getWithinInfo(n.within),w=e.position.getScrollInfo(x),k=(n.collision||"flip").split(" "),T={};return b=s(_),_[0].preventDefault&&(n.at="left top"),m=b.width,g=b.height,v=b.offset,y=e.extend({},v),e.each(["my","at"],function(){var e,t,i=(n[this]||"").split(" ");1===i.length&&(i=l.test(i[0])?i.concat(["center"]):u.test(i[0])?["center"].concat(i):["center","center"]),i[0]=l.test(i[0])?i[0]:"center",i[1]=u.test(i[1])?i[1]:"center",e=d.exec(i[0]),t=d.exec(i[1]),T[this]=[e?e[0]:0,t?t[0]:0],n[this]=[c.exec(i[0])[0],c.exec(i[1])[0]]}),1===k.length&&(k[1]=k[0]),"right"===n.at[0]?y.left+=m:"center"===n.at[0]&&(y.left+=m/2),"bottom"===n.at[1]?y.top+=g:"center"===n.at[1]&&(y.top+=g/2),p=t(T.at,m,g),y.left+=p[0],y.top+=p[1],this.each(function(){var s,l,u=e(this),d=u.outerWidth(),c=u.outerHeight(),f=i(this,"marginLeft"),b=i(this,"marginTop"),D=d+f+i(this,"marginRight")+w.width,S=c+b+i(this,"marginBottom")+w.height,M=e.extend({},y),C=t(T.my,u.outerWidth(),u.outerHeight());"right"===n.my[0]?M.left-=d:"center"===n.my[0]&&(M.left-=d/2),"bottom"===n.my[1]?M.top-=c:"center"===n.my[1]&&(M.top-=c/2),M.left+=C[0],M.top+=C[1],a||(M.left=h(M.left),M.top=h(M.top)),s={marginLeft:f,marginTop:b},e.each(["left","top"],function(t,i){e.ui.position[k[t]]&&e.ui.position[k[t]][i](M,{targetWidth:m,targetHeight:g,elemWidth:d,elemHeight:c,collisionPosition:s,collisionWidth:D,collisionHeight:S,offset:[p[0]+C[0],p[1]+C[1]],my:n.my,at:n.at,within:x,elem:u})}),n.using&&(l=function(e){var t=v.left-M.left,i=t+m-d,s=v.top-M.top,a=s+g-c,h={target:{element:_,left:v.left,top:v.top,width:m,height:g},element:{element:u,left:M.left,top:M.top,width:d,height:c},horizontal:0>i?"left":t>0?"right":"center",vertical:0>a?"top":s>0?"bottom":"middle"};d>m&&m>r(t+i)&&(h.horizontal="center"),c>g&&g>r(s+a)&&(h.vertical="middle"),h.important=o(r(t),r(i))>o(r(s),r(a))?"horizontal":"vertical",n.using.call(this,e,h)}),u.offset(e.extend(M,{using:l}))})},e.ui.position={fit:{left:function(e,t){var i,s=t.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=e.left-t.collisionPosition.marginLeft,h=n-r,l=r+t.collisionWidth-a-n;t.collisionWidth>a?h>0&&0>=l?(i=e.left+h+t.collisionWidth-a-n,e.left+=h-i):e.left=l>0&&0>=h?n:h>l?n+a-t.collisionWidth:n:h>0?e.left+=h:l>0?e.left-=l:e.left=o(e.left-r,e.left)},top:function(e,t){var i,s=t.within,n=s.isWindow?s.scrollTop:s.offset.top,a=t.within.height,r=e.top-t.collisionPosition.marginTop,h=n-r,l=r+t.collisionHeight-a-n;t.collisionHeight>a?h>0&&0>=l?(i=e.top+h+t.collisionHeight-a-n,e.top+=h-i):e.top=l>0&&0>=h?n:h>l?n+a-t.collisionHeight:n:h>0?e.top+=h:l>0?e.top-=l:e.top=o(e.top-r,e.top)}},flip:{left:function(e,t){var i,s,n=t.within,a=n.offset.left+n.scrollLeft,o=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=e.left-t.collisionPosition.marginLeft,u=l-h,d=l+t.collisionWidth-o-h,c="left"===t.my[0]?-t.elemWidth:"right"===t.my[0]?t.elemWidth:0,p="left"===t.at[0]?t.targetWidth:"right"===t.at[0]?-t.targetWidth:0,f=-2*t.offset[0];0>u?(i=e.left+c+p+f+t.collisionWidth-o-a,(0>i||r(u)>i)&&(e.left+=c+p+f)):d>0&&(s=e.left-t.collisionPosition.marginLeft+c+p+f-h,(s>0||d>r(s))&&(e.left+=c+p+f))},top:function(e,t){var i,s,n=t.within,a=n.offset.top+n.scrollTop,o=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=e.top-t.collisionPosition.marginTop,u=l-h,d=l+t.collisionHeight-o-h,c="top"===t.my[1],p=c?-t.elemHeight:"bottom"===t.my[1]?t.elemHeight:0,f="top"===t.at[1]?t.targetHeight:"bottom"===t.at[1]?-t.targetHeight:0,m=-2*t.offset[1];0>u?(s=e.top+p+f+m+t.collisionHeight-o-a,(0>s||r(u)>s)&&(e.top+=p+f+m)):d>0&&(i=e.top-t.collisionPosition.marginTop+p+f+m-h,(i>0||d>r(i))&&(e.top+=p+f+m))}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}},function(){var t,i,s,n,o,r=document.getElementsByTagName("body")[0],h=document.createElement("div");t=document.createElement(r?"div":"body"),s={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},r&&e.extend(s,{position:"absolute",left:"-1000px",top:"-1000px"});for(o in s)t.style[o]=s[o];t.appendChild(h),i=r||document.documentElement,i.insertBefore(t,i.firstChild),h.style.cssText="position: absolute; left: 10.7432222px;",n=e(h).offset().left,a=n>10&&11>n,t.innerHTML="",i.removeChild(t)}()}(),e.ui.position,e.widget("ui.accordion",{version:"1.11.4",options:{active:0,animate:{},collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var t=this.options;this.prevShow=this.prevHide=e(),this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist"),t.collapsible||t.active!==!1&&null!=t.active||(t.active=0),this._processPanels(),0>t.active&&(t.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():e()}},_createIcons:function(){var t=this.options.icons;t&&(e("<span>").addClass("ui-accordion-header-icon ui-icon "+t.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(t.header).addClass(t.activeHeader),this.headers.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var e;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").removeUniqueId(),this._destroyIcons(),e=this.headers.next().removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").css("display","").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&e.css("height","")},_setOption:function(e,t){return"active"===e?(this._activate(t),void 0):("event"===e&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(t)),this._super(e,t),"collapsible"!==e||t||this.options.active!==!1||this._activate(0),"icons"===e&&(this._destroyIcons(),t&&this._createIcons()),"disabled"===e&&(this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!t)),void 0)},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var i=e.ui.keyCode,s=this.headers.length,n=this.headers.index(t.target),a=!1;switch(t.keyCode){case i.RIGHT:case i.DOWN:a=this.headers[(n+1)%s];break;case i.LEFT:case i.UP:a=this.headers[(n-1+s)%s];break;case i.SPACE:case i.ENTER:this._eventHandler(t);break;case i.HOME:a=this.headers[0];break;case i.END:a=this.headers[s-1]}a&&(e(t.target).attr("tabIndex",-1),e(a).attr("tabIndex",0),a.focus(),t.preventDefault())}},_panelKeyDown:function(t){t.keyCode===e.ui.keyCode.UP&&t.ctrlKey&&e(t.currentTarget).prev().focus()},refresh:function(){var t=this.options;this._processPanels(),t.active===!1&&t.collapsible===!0||!this.headers.length?(t.active=!1,this.active=e()):t.active===!1?this._activate(0):this.active.length&&!e.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=e()):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var e=this.headers,t=this.panels;this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-state-default ui-corner-all"),this.panels=this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide(),t&&(this._off(e.not(this.headers)),this._off(t.not(this.panels)))},_refresh:function(){var t,i=this.options,s=i.heightStyle,n=this.element.parent();this.active=this._findActive(i.active).addClass("ui-accordion-header-active ui-state-active ui-corner-top").removeClass("ui-corner-all"),this.active.next().addClass("ui-accordion-content-active").show(),this.headers.attr("role","tab").each(function(){var t=e(this),i=t.uniqueId().attr("id"),s=t.next(),n=s.uniqueId().attr("id");t.attr("aria-controls",n),s.attr("aria-labelledby",i)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(i.event),"fill"===s?(t=n.height(),this.element.siblings(":visible").each(function(){var i=e(this),s=i.css("position");"absolute"!==s&&"fixed"!==s&&(t-=i.outerHeight(!0))}),this.headers.each(function(){t-=e(this).outerHeight(!0)}),this.headers.next().each(function(){e(this).height(Math.max(0,t-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===s&&(t=0,this.headers.next().each(function(){t=Math.max(t,e(this).css("height","").height())}).height(t))},_activate:function(t){var i=this._findActive(t)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):e()},_setupEvents:function(t){var i={keydown:"_keydown"};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var i=this.options,s=this.active,n=e(t.currentTarget),a=n[0]===s[0],o=a&&i.collapsible,r=o?e():n.next(),h=s.next(),l={oldHeader:s,oldPanel:h,newHeader:o?e():n,newPanel:r};t.preventDefault(),a&&!i.collapsible||this._trigger("beforeActivate",t,l)===!1||(i.active=o?!1:this.headers.index(n),this.active=a?e():n,this._toggle(l),s.removeClass("ui-accordion-header-active ui-state-active"),i.icons&&s.children(".ui-accordion-header-icon").removeClass(i.icons.activeHeader).addClass(i.icons.header),a||(n.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),i.icons&&n.children(".ui-accordion-header-icon").removeClass(i.icons.header).addClass(i.icons.activeHeader),n.next().addClass("ui-accordion-content-active")))},_toggle:function(t){var i=t.newPanel,s=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=s,this.options.animate?this._animate(i,s,t):(s.hide(),i.show(),this._toggleComplete(t)),s.attr({"aria-hidden":"true"}),s.prev().attr({"aria-selected":"false","aria-expanded":"false"}),i.length&&s.length?s.prev().attr({tabIndex:-1,"aria-expanded":"false"}):i.length&&this.headers.filter(function(){return 0===parseInt(e(this).attr("tabIndex"),10)}).attr("tabIndex",-1),i.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(e,t,i){var s,n,a,o=this,r=0,h=e.css("box-sizing"),l=e.length&&(!t.length||e.index()<t.index()),u=this.options.animate||{},d=l&&u.down||u,c=function(){o._toggleComplete(i)};return"number"==typeof d&&(a=d),"string"==typeof d&&(n=d),n=n||d.easing||u.easing,a=a||d.duration||u.duration,t.length?e.length?(s=e.show().outerHeight(),t.animate(this.hideProps,{duration:a,easing:n,step:function(e,t){t.now=Math.round(e)}}),e.hide().animate(this.showProps,{duration:a,easing:n,complete:c,step:function(e,i){i.now=Math.round(e),"height"!==i.prop?"content-box"===h&&(r+=i.now):"content"!==o.options.heightStyle&&(i.now=Math.round(s-t.outerHeight()-r),r=0)}}),void 0):t.animate(this.hideProps,a,n,c):e.animate(this.showProps,a,n,c)},_toggleComplete:function(e){var t=e.oldPanel;t.removeClass("ui-accordion-content-active").prev().removeClass("ui-corner-top").addClass("ui-corner-all"),t.length&&(t.parent()[0].className=t.parent()[0].className),this._trigger("activate",null,e)}}),e.widget("ui.menu",{version:"1.11.4",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},items:"> *",menus:"ul",position:{my:"left-1 top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item":function(e){e.preventDefault()},"click .ui-menu-item":function(t){var i=e(t.target);!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(t),t.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(t):!this.element.is(":focus")&&e(this.document[0].activeElement).closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(t){if(!this.previousFilter){var i=e(t.currentTarget); i.siblings(".ui-state-active").removeClass("ui-state-active"),this.focus(t,i)}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(e,t){var i=this.active||this.element.find(this.options.items).eq(0);t||this.focus(e,i)},blur:function(t){this._delay(function(){e.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(e){this._closeOnDocumentClick(e)&&this.collapseAll(e),this.mouseHandled=!1}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-menu-icons ui-front").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show(),this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").removeUniqueId().removeClass("ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var t=e(this);t.data("ui-menu-submenu-carat")&&t.remove()}),this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(t){var i,s,n,a,o=!0;switch(t.keyCode){case e.ui.keyCode.PAGE_UP:this.previousPage(t);break;case e.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case e.ui.keyCode.HOME:this._move("first","first",t);break;case e.ui.keyCode.END:this._move("last","last",t);break;case e.ui.keyCode.UP:this.previous(t);break;case e.ui.keyCode.DOWN:this.next(t);break;case e.ui.keyCode.LEFT:this.collapse(t);break;case e.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case e.ui.keyCode.ENTER:case e.ui.keyCode.SPACE:this._activate(t);break;case e.ui.keyCode.ESCAPE:this.collapse(t);break;default:o=!1,s=this.previousFilter||"",n=String.fromCharCode(t.keyCode),a=!1,clearTimeout(this.filterTimer),n===s?a=!0:n=s+n,i=this._filterMenuItems(n),i=a&&-1!==i.index(this.active.next())?this.active.nextAll(".ui-menu-item"):i,i.length||(n=String.fromCharCode(t.keyCode),i=this._filterMenuItems(n)),i.length?(this.focus(t,i),this.previousFilter=n,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}o&&t.preventDefault()},_activate:function(e){this.active.is(".ui-state-disabled")||(this.active.is("[aria-haspopup='true']")?this.expand(e):this.select(e))},refresh:function(){var t,i,s=this,n=this.options.icons.submenu,a=this.element.find(this.options.menus);this.element.toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length),a.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-front").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=e(this),i=t.parent(),s=e("<span>").addClass("ui-menu-icon ui-icon "+n).data("ui-menu-submenu-carat",!0);i.attr("aria-haspopup","true").prepend(s),t.attr("aria-labelledby",i.attr("id"))}),t=a.add(this.element),i=t.find(this.options.items),i.not(".ui-menu-item").each(function(){var t=e(this);s._isDivider(t)&&t.addClass("ui-widget-content ui-menu-divider")}),i.not(".ui-menu-item, .ui-menu-divider").addClass("ui-menu-item").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),i.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!e.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(e,t){"icons"===e&&this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(t.submenu),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},focus:function(e,t){var i,s;this.blur(e,e&&"focus"===e.type),this._scrollIntoView(t),this.active=t.first(),s=this.active.addClass("ui-state-focus").removeClass("ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),this.active.parent().closest(".ui-menu-item").addClass("ui-state-active"),e&&"keydown"===e.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=t.children(".ui-menu"),i.length&&e&&/^mouse/.test(e.type)&&this._startOpening(i),this.activeMenu=t.parent(),this._trigger("focus",e,{item:t})},_scrollIntoView:function(t){var i,s,n,a,o,r;this._hasScroll()&&(i=parseFloat(e.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(e.css(this.activeMenu[0],"paddingTop"))||0,n=t.offset().top-this.activeMenu.offset().top-i-s,a=this.activeMenu.scrollTop(),o=this.activeMenu.height(),r=t.outerHeight(),0>n?this.activeMenu.scrollTop(a+n):n+r>o&&this.activeMenu.scrollTop(a+n-o+r))},blur:function(e,t){t||clearTimeout(this.timer),this.active&&(this.active.removeClass("ui-state-focus"),this.active=null,this._trigger("blur",e,{item:this.active}))},_startOpening:function(e){clearTimeout(this.timer),"true"===e.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(e)},this.delay))},_open:function(t){var i=e.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(t.parents(".ui-menu")).hide().attr("aria-hidden","true"),t.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(t,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:e(t&&t.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(t),this.activeMenu=s},this.delay)},_close:function(e){e||(e=this.active?this.active.parent():this.element),e.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find(".ui-state-active").not(".ui-state-focus").removeClass("ui-state-active")},_closeOnDocumentClick:function(t){return!e(t.target).closest(".ui-menu").length},_isDivider:function(e){return!/[^\-\u2014\u2013\s]/.test(e.text())},collapse:function(e){var t=this.active&&this.active.parent().closest(".ui-menu-item",this.element);t&&t.length&&(this._close(),this.focus(e,t))},expand:function(e){var t=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();t&&t.length&&(this._open(t.parent()),this._delay(function(){this.focus(e,t)}))},next:function(e){this._move("next","first",e)},previous:function(e){this._move("prev","last",e)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(e,t,i){var s;this.active&&(s="first"===e||"last"===e?this.active["first"===e?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[e+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.find(this.options.items)[t]()),this.focus(i,s)},nextPage:function(t){var i,s,n;return this.active?(this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=e(this),0>i.offset().top-s-n}),this.focus(t,i)):this.focus(t,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())),void 0):(this.next(t),void 0)},previousPage:function(t){var i,s,n;return this.active?(this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=e(this),i.offset().top-s+n>0}),this.focus(t,i)):this.focus(t,this.activeMenu.find(this.options.items).first())),void 0):(this.next(t),void 0)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(t){this.active=this.active||e(t.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(t,!0),this._trigger("select",t,i)},_filterMenuItems:function(t){var i=t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),s=RegExp("^"+i,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return s.test(e.trim(e(this).text()))})}}),e.widget("ui.autocomplete",{version:"1.11.4",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var t,i,s,n=this.element[0].nodeName.toLowerCase(),a="textarea"===n,o="input"===n;this.isMultiLine=a?!0:o?!1:this.element.prop("isContentEditable"),this.valueMethod=this.element[a||o?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(n){if(this.element.prop("readOnly"))return t=!0,s=!0,i=!0,void 0;t=!1,s=!1,i=!1;var a=e.ui.keyCode;switch(n.keyCode){case a.PAGE_UP:t=!0,this._move("previousPage",n);break;case a.PAGE_DOWN:t=!0,this._move("nextPage",n);break;case a.UP:t=!0,this._keyEvent("previous",n);break;case a.DOWN:t=!0,this._keyEvent("next",n);break;case a.ENTER:this.menu.active&&(t=!0,n.preventDefault(),this.menu.select(n));break;case a.TAB:this.menu.active&&this.menu.select(n);break;case a.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(n),n.preventDefault());break;default:i=!0,this._searchTimeout(n)}},keypress:function(s){if(t)return t=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault(),void 0;if(!i){var n=e.ui.keyCode;switch(s.keyCode){case n.PAGE_UP:this._move("previousPage",s);break;case n.PAGE_DOWN:this._move("nextPage",s);break;case n.UP:this._keyEvent("previous",s);break;case n.DOWN:this._keyEvent("next",s)}}},input:function(e){return s?(s=!1,e.preventDefault(),void 0):(this._searchTimeout(e),void 0)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,void 0):(clearTimeout(this.searching),this.close(e),this._change(e),void 0)}}),this._initSource(),this.menu=e("<ul>").addClass("ui-autocomplete ui-front").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur});var i=this.menu.element[0];e(t.target).closest(".ui-menu-item").length||this._delay(function(){var t=this;this.document.one("mousedown",function(s){s.target===t.element[0]||s.target===i||e.contains(i,s.target)||t.close()})})},menufocus:function(t,i){var s,n;return this.isNewMenu&&(this.isNewMenu=!1,t.originalEvent&&/^mouse/.test(t.originalEvent.type))?(this.menu.blur(),this.document.one("mousemove",function(){e(t.target).trigger(t.originalEvent)}),void 0):(n=i.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",t,{item:n})&&t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(n.value),s=i.item.attr("aria-label")||n.value,s&&e.trim(s).length&&(this.liveRegion.children().hide(),e("<div>").text(s).appendTo(this.liveRegion)),void 0)},menuselect:function(e,t){var i=t.item.data("ui-autocomplete-item"),s=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s,this.selectedItem=i})),!1!==this._trigger("select",e,{item:i})&&this._value(i.value),this.term=this._value(),this.close(e),this.selectedItem=i}}),this.liveRegion=e("<span>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(e,t){this._super(e,t),"source"===e&&this._initSource(),"appendTo"===e&&this.menu.element.appendTo(this._appendTo()),"disabled"===e&&t&&this.xhr&&this.xhr.abort()},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t&&t[0]||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_initSource:function(){var t,i,s=this;e.isArray(this.options.source)?(t=this.options.source,this.source=function(i,s){s(e.ui.autocomplete.filter(t,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(t,n){s.xhr&&s.xhr.abort(),s.xhr=e.ajax({url:i,data:t,dataType:"json",success:function(e){n(e)},error:function(){n([])}})}):this.source=this.options.source},_searchTimeout:function(e){clearTimeout(this.searching),this.searching=this._delay(function(){var t=this.term===this._value(),i=this.menu.element.is(":visible"),s=e.altKey||e.ctrlKey||e.metaKey||e.shiftKey;(!t||t&&!i&&!s)&&(this.selectedItem=null,this.search(null,e))},this.options.delay)},search:function(e,t){return e=null!=e?e:this._value(),this.term=this._value(),e.length<this.options.minLength?this.close(t):this._trigger("search",t)!==!1?this._search(e):void 0},_search:function(e){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:e},this._response())},_response:function(){var t=++this.requestIndex;return e.proxy(function(e){t===this.requestIndex&&this.__response(e),this.pending--,this.pending||this.element.removeClass("ui-autocomplete-loading")},this)},__response:function(e){e&&(e=this._normalize(e)),this._trigger("response",null,{content:e}),!this.options.disabled&&e&&e.length&&!this.cancelSearch?(this._suggest(e),this._trigger("open")):this._close()},close:function(e){this.cancelSearch=!0,this._close(e)},_close:function(e){this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",e))},_change:function(e){this.previous!==this._value()&&this._trigger("change",e,{item:this.selectedItem})},_normalize:function(t){return t.length&&t[0].label&&t[0].value?t:e.map(t,function(t){return"string"==typeof t?{label:t,value:t}:e.extend({},t,{label:t.label||t.value,value:t.value||t.label})})},_suggest:function(t){var i=this.menu.element.empty();this._renderMenu(i,t),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.position(e.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next()},_resizeMenu:function(){var e=this.menu.element;e.outerWidth(Math.max(e.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(t,i){var s=this;e.each(i,function(e,i){s._renderItemData(t,i)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-autocomplete-item",t)},_renderItem:function(t,i){return e("<li>").text(i.label).appendTo(t)},_move:function(e,t){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(e)||this.menu.isLastItem()&&/^next/.test(e)?(this.isMultiLine||this._value(this.term),this.menu.blur(),void 0):(this.menu[e](t),void 0):(this.search(null,t),void 0)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(e,t){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(e,t),t.preventDefault())}}),e.extend(e.ui.autocomplete,{escapeRegex:function(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,i){var s=RegExp(e.ui.autocomplete.escapeRegex(i),"i");return e.grep(t,function(e){return s.test(e.label||e.value||e)})}}),e.widget("ui.autocomplete",e.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(e){return e+(e>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(t){var i;this._superApply(arguments),this.options.disabled||this.cancelSearch||(i=t&&t.length?this.options.messages.results(t.length):this.options.messages.noResults,this.liveRegion.children().hide(),e("<div>").text(i).appendTo(this.liveRegion))}}),e.ui.autocomplete;var c,p="ui-button ui-widget ui-state-default ui-corner-all",f="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",m=function(){var t=e(this);setTimeout(function(){t.find(":ui-button").button("refresh")},1)},g=function(t){var i=t.name,s=t.form,n=e([]);return i&&(i=i.replace(/'/g,"\\'"),n=s?e(s).find("[name='"+i+"'][type=radio]"):e("[name='"+i+"'][type=radio]",t.ownerDocument).filter(function(){return!this.form})),n};e.widget("ui.button",{version:"1.11.4",defaultElement:"<button>",options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset"+this.eventNamespace).bind("reset"+this.eventNamespace,m),"boolean"!=typeof this.options.disabled?this.options.disabled=!!this.element.prop("disabled"):this.element.prop("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var t=this,i=this.options,s="checkbox"===this.type||"radio"===this.type,n=s?"":"ui-state-active";null===i.label&&(i.label="input"===this.type?this.buttonElement.val():this.buttonElement.html()),this._hoverable(this.buttonElement),this.buttonElement.addClass(p).attr("role","button").bind("mouseenter"+this.eventNamespace,function(){i.disabled||this===c&&e(this).addClass("ui-state-active")}).bind("mouseleave"+this.eventNamespace,function(){i.disabled||e(this).removeClass(n)}).bind("click"+this.eventNamespace,function(e){i.disabled&&(e.preventDefault(),e.stopImmediatePropagation())}),this._on({focus:function(){this.buttonElement.addClass("ui-state-focus")},blur:function(){this.buttonElement.removeClass("ui-state-focus")}}),s&&this.element.bind("change"+this.eventNamespace,function(){t.refresh()}),"checkbox"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){return i.disabled?!1:void 0}):"radio"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){if(i.disabled)return!1;e(this).addClass("ui-state-active"),t.buttonElement.attr("aria-pressed","true");var s=t.element[0];g(s).not(s).map(function(){return e(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown"+this.eventNamespace,function(){return i.disabled?!1:(e(this).addClass("ui-state-active"),c=this,t.document.one("mouseup",function(){c=null}),void 0)}).bind("mouseup"+this.eventNamespace,function(){return i.disabled?!1:(e(this).removeClass("ui-state-active"),void 0)}).bind("keydown"+this.eventNamespace,function(t){return i.disabled?!1:((t.keyCode===e.ui.keyCode.SPACE||t.keyCode===e.ui.keyCode.ENTER)&&e(this).addClass("ui-state-active"),void 0)}).bind("keyup"+this.eventNamespace+" blur"+this.eventNamespace,function(){e(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(t){t.keyCode===e.ui.keyCode.SPACE&&e(this).click()})),this._setOption("disabled",i.disabled),this._resetButton()},_determineButtonType:function(){var e,t,i;this.type=this.element.is("[type=checkbox]")?"checkbox":this.element.is("[type=radio]")?"radio":this.element.is("input")?"input":"button","checkbox"===this.type||"radio"===this.type?(e=this.element.parents().last(),t="label[for='"+this.element.attr("id")+"']",this.buttonElement=e.find(t),this.buttonElement.length||(e=e.length?e.siblings():this.element.siblings(),this.buttonElement=e.filter(t),this.buttonElement.length||(this.buttonElement=e.find(t))),this.element.addClass("ui-helper-hidden-accessible"),i=this.element.is(":checked"),i&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.prop("aria-pressed",i)):this.buttonElement=this.element},widget:function(){return this.buttonElement},_destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(p+" ui-state-active "+f).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title")},_setOption:function(e,t){return this._super(e,t),"disabled"===e?(this.widget().toggleClass("ui-state-disabled",!!t),this.element.prop("disabled",!!t),t&&("checkbox"===this.type||"radio"===this.type?this.buttonElement.removeClass("ui-state-focus"):this.buttonElement.removeClass("ui-state-focus ui-state-active")),void 0):(this._resetButton(),void 0)},refresh:function(){var t=this.element.is("input, button")?this.element.is(":disabled"):this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOption("disabled",t),"radio"===this.type?g(this.element[0]).each(function(){e(this).is(":checked")?e(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):e(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):"checkbox"===this.type&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if("input"===this.type)return this.options.label&&this.element.val(this.options.label),void 0;var t=this.buttonElement.removeClass(f),i=e("<span></span>",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(t.empty()).text(),s=this.options.icons,n=s.primary&&s.secondary,a=[];s.primary||s.secondary?(this.options.text&&a.push("ui-button-text-icon"+(n?"s":s.primary?"-primary":"-secondary")),s.primary&&t.prepend("<span class='ui-button-icon-primary ui-icon "+s.primary+"'></span>"),s.secondary&&t.append("<span class='ui-button-icon-secondary ui-icon "+s.secondary+"'></span>"),this.options.text||(a.push(n?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||t.attr("title",e.trim(i)))):a.push("ui-button-text-only"),t.addClass(a.join(" "))}}),e.widget("ui.buttonset",{version:"1.11.4",options:{items:"button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(e,t){"disabled"===e&&this.buttons.button("option",e,t),this._super(e,t)},refresh:function(){var t="rtl"===this.element.css("direction"),i=this.element.find(this.options.items),s=i.filter(":ui-button");i.not(":ui-button").button(),s.button("refresh"),this.buttons=i.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(t?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(t?"ui-corner-left":"ui-corner-right").end().end()},_destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy")}}),e.ui.button,e.extend(e.ui,{datepicker:{version:"1.11.4"}});var v;e.extend(n.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(e){return r(this._defaults,e||{}),this},_attachDatepicker:function(t,i){var s,n,a;s=t.nodeName.toLowerCase(),n="div"===s||"span"===s,t.id||(this.uuid+=1,t.id="dp"+this.uuid),a=this._newInst(e(t),n),a.settings=e.extend({},i||{}),"input"===s?this._connectDatepicker(t,a):n&&this._inlineDatepicker(t,a)},_newInst:function(t,i){var s=t[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:s,input:t,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?a(e("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(t,i){var s=e(t);i.append=e([]),i.trigger=e([]),s.hasClass(this.markerClassName)||(this._attachments(s,i),s.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(i),e.data(t,"datepicker",i),i.settings.disabled&&this._disableDatepicker(t))},_attachments:function(t,i){var s,n,a,o=this._get(i,"appendText"),r=this._get(i,"isRTL");i.append&&i.append.remove(),o&&(i.append=e("<span class='"+this._appendClass+"'>"+o+"</span>"),t[r?"before":"after"](i.append)),t.unbind("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),s=this._get(i,"showOn"),("focus"===s||"both"===s)&&t.focus(this._showDatepicker),("button"===s||"both"===s)&&(n=this._get(i,"buttonText"),a=this._get(i,"buttonImage"),i.trigger=e(this._get(i,"buttonImageOnly")?e("<img/>").addClass(this._triggerClass).attr({src:a,alt:n,title:n}):e("<button type='button'></button>").addClass(this._triggerClass).html(a?e("<img/>").attr({src:a,alt:n,title:n}):n)),t[r?"before":"after"](i.trigger),i.trigger.click(function(){return e.datepicker._datepickerShowing&&e.datepicker._lastInput===t[0]?e.datepicker._hideDatepicker():e.datepicker._datepickerShowing&&e.datepicker._lastInput!==t[0]?(e.datepicker._hideDatepicker(),e.datepicker._showDatepicker(t[0])):e.datepicker._showDatepicker(t[0]),!1}))},_autoSize:function(e){if(this._get(e,"autoSize")&&!e.inline){var t,i,s,n,a=new Date(2009,11,20),o=this._get(e,"dateFormat");o.match(/[DM]/)&&(t=function(e){for(i=0,s=0,n=0;e.length>n;n++)e[n].length>i&&(i=e[n].length,s=n);return s},a.setMonth(t(this._get(e,o.match(/MM/)?"monthNames":"monthNamesShort"))),a.setDate(t(this._get(e,o.match(/DD/)?"dayNames":"dayNamesShort"))+20-a.getDay())),e.input.attr("size",this._formatDate(e,a).length)}},_inlineDatepicker:function(t,i){var s=e(t);s.hasClass(this.markerClassName)||(s.addClass(this.markerClassName).append(i.dpDiv),e.data(t,"datepicker",i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(t),i.dpDiv.css("display","block"))},_dialogDatepicker:function(t,i,s,n,a){var o,h,l,u,d,c=this._dialogInst;return c||(this.uuid+=1,o="dp"+this.uuid,this._dialogInput=e("<input type='text' id='"+o+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.keydown(this._doKeyDown),e("body").append(this._dialogInput),c=this._dialogInst=this._newInst(this._dialogInput,!1),c.settings={},e.data(this._dialogInput[0],"datepicker",c)),r(c.settings,n||{}),i=i&&i.constructor===Date?this._formatDate(c,i):i,this._dialogInput.val(i),this._pos=a?a.length?a:[a.pageX,a.pageY]:null,this._pos||(h=document.documentElement.clientWidth,l=document.documentElement.clientHeight,u=document.documentElement.scrollLeft||document.body.scrollLeft,d=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[h/2-100+u,l/2-150+d]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),c.settings.onSelect=s,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),e.blockUI&&e.blockUI(this.dpDiv),e.data(this._dialogInput[0],"datepicker",c),this},_destroyDatepicker:function(t){var i,s=e(t),n=e.data(t,"datepicker");s.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),e.removeData(t,"datepicker"),"input"===i?(n.append.remove(),n.trigger.remove(),s.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"===i||"span"===i)&&s.removeClass(this.markerClassName).empty(),v===n&&(v=null))},_enableDatepicker:function(t){var i,s,n=e(t),a=e.data(t,"datepicker");n.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),"input"===i?(t.disabled=!1,a.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().removeClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}))},_disableDatepicker:function(t){var i,s,n=e(t),a=e.data(t,"datepicker");n.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),"input"===i?(t.disabled=!0,a.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().addClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}),this._disabledInputs[this._disabledInputs.length]=t)},_isDisabledDatepicker:function(e){if(!e)return!1;for(var t=0;this._disabledInputs.length>t;t++)if(this._disabledInputs[t]===e)return!0;return!1},_getInst:function(t){try{return e.data(t,"datepicker")}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(t,i,s){var n,a,o,h,l=this._getInst(t);return 2===arguments.length&&"string"==typeof i?"defaults"===i?e.extend({},e.datepicker._defaults):l?"all"===i?e.extend({},l.settings):this._get(l,i):null:(n=i||{},"string"==typeof i&&(n={},n[i]=s),l&&(this._curInst===l&&this._hideDatepicker(),a=this._getDateDatepicker(t,!0),o=this._getMinMaxDate(l,"min"),h=this._getMinMaxDate(l,"max"),r(l.settings,n),null!==o&&void 0!==n.dateFormat&&void 0===n.minDate&&(l.settings.minDate=this._formatDate(l,o)),null!==h&&void 0!==n.dateFormat&&void 0===n.maxDate&&(l.settings.maxDate=this._formatDate(l,h)),"disabled"in n&&(n.disabled?this._disableDatepicker(t):this._enableDatepicker(t)),this._attachments(e(t),l),this._autoSize(l),this._setDate(l,a),this._updateAlternate(l),this._updateDatepicker(l)),void 0)},_changeDatepicker:function(e,t,i){this._optionDatepicker(e,t,i)},_refreshDatepicker:function(e){var t=this._getInst(e);t&&this._updateDatepicker(t)},_setDateDatepicker:function(e,t){var i=this._getInst(e);i&&(this._setDate(i,t),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(e,t){var i=this._getInst(e);return i&&!i.inline&&this._setDateFromField(i,t),i?this._getDate(i):null},_doKeyDown:function(t){var i,s,n,a=e.datepicker._getInst(t.target),o=!0,r=a.dpDiv.is(".ui-datepicker-rtl");if(a._keyEvent=!0,e.datepicker._datepickerShowing)switch(t.keyCode){case 9:e.datepicker._hideDatepicker(),o=!1;break;case 13:return n=e("td."+e.datepicker._dayOverClass+":not(."+e.datepicker._currentClass+")",a.dpDiv),n[0]&&e.datepicker._selectDay(t.target,a.selectedMonth,a.selectedYear,n[0]),i=e.datepicker._get(a,"onSelect"),i?(s=e.datepicker._formatDate(a),i.apply(a.input?a.input[0]:null,[s,a])):e.datepicker._hideDatepicker(),!1;case 27:e.datepicker._hideDatepicker();break;case 33:e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(a,"stepBigMonths"):-e.datepicker._get(a,"stepMonths"),"M");break;case 34:e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(a,"stepBigMonths"):+e.datepicker._get(a,"stepMonths"),"M");break;case 35:(t.ctrlKey||t.metaKey)&&e.datepicker._clearDate(t.target),o=t.ctrlKey||t.metaKey;break;case 36:(t.ctrlKey||t.metaKey)&&e.datepicker._gotoToday(t.target),o=t.ctrlKey||t.metaKey;break;case 37:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,r?1:-1,"D"),o=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(a,"stepBigMonths"):-e.datepicker._get(a,"stepMonths"),"M");break;case 38:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,-7,"D"),o=t.ctrlKey||t.metaKey;break;case 39:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,r?-1:1,"D"),o=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(a,"stepBigMonths"):+e.datepicker._get(a,"stepMonths"),"M");break;case 40:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,7,"D"),o=t.ctrlKey||t.metaKey;break;default:o=!1}else 36===t.keyCode&&t.ctrlKey?e.datepicker._showDatepicker(this):o=!1;o&&(t.preventDefault(),t.stopPropagation())},_doKeyPress:function(t){var i,s,n=e.datepicker._getInst(t.target); return e.datepicker._get(n,"constrainInput")?(i=e.datepicker._possibleChars(e.datepicker._get(n,"dateFormat")),s=String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),t.ctrlKey||t.metaKey||" ">s||!i||i.indexOf(s)>-1):void 0},_doKeyUp:function(t){var i,s=e.datepicker._getInst(t.target);if(s.input.val()!==s.lastVal)try{i=e.datepicker.parseDate(e.datepicker._get(s,"dateFormat"),s.input?s.input.val():null,e.datepicker._getFormatConfig(s)),i&&(e.datepicker._setDateFromField(s),e.datepicker._updateAlternate(s),e.datepicker._updateDatepicker(s))}catch(n){}return!0},_showDatepicker:function(t){if(t=t.target||t,"input"!==t.nodeName.toLowerCase()&&(t=e("input",t.parentNode)[0]),!e.datepicker._isDisabledDatepicker(t)&&e.datepicker._lastInput!==t){var i,n,a,o,h,l,u;i=e.datepicker._getInst(t),e.datepicker._curInst&&e.datepicker._curInst!==i&&(e.datepicker._curInst.dpDiv.stop(!0,!0),i&&e.datepicker._datepickerShowing&&e.datepicker._hideDatepicker(e.datepicker._curInst.input[0])),n=e.datepicker._get(i,"beforeShow"),a=n?n.apply(t,[t,i]):{},a!==!1&&(r(i.settings,a),i.lastVal=null,e.datepicker._lastInput=t,e.datepicker._setDateFromField(i),e.datepicker._inDialog&&(t.value=""),e.datepicker._pos||(e.datepicker._pos=e.datepicker._findPos(t),e.datepicker._pos[1]+=t.offsetHeight),o=!1,e(t).parents().each(function(){return o|="fixed"===e(this).css("position"),!o}),h={left:e.datepicker._pos[0],top:e.datepicker._pos[1]},e.datepicker._pos=null,i.dpDiv.empty(),i.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),e.datepicker._updateDatepicker(i),h=e.datepicker._checkOffset(i,h,o),i.dpDiv.css({position:e.datepicker._inDialog&&e.blockUI?"static":o?"fixed":"absolute",display:"none",left:h.left+"px",top:h.top+"px"}),i.inline||(l=e.datepicker._get(i,"showAnim"),u=e.datepicker._get(i,"duration"),i.dpDiv.css("z-index",s(e(t))+1),e.datepicker._datepickerShowing=!0,e.effects&&e.effects.effect[l]?i.dpDiv.show(l,e.datepicker._get(i,"showOptions"),u):i.dpDiv[l||"show"](l?u:null),e.datepicker._shouldFocusInput(i)&&i.input.focus(),e.datepicker._curInst=i))}},_updateDatepicker:function(t){this.maxRows=4,v=t,t.dpDiv.empty().append(this._generateHTML(t)),this._attachHandlers(t);var i,s=this._getNumberOfMonths(t),n=s[1],a=17,r=t.dpDiv.find("."+this._dayOverClass+" a");r.length>0&&o.apply(r.get(0)),t.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),n>1&&t.dpDiv.addClass("ui-datepicker-multi-"+n).css("width",a*n+"em"),t.dpDiv[(1!==s[0]||1!==s[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),t.dpDiv[(this._get(t,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),t===e.datepicker._curInst&&e.datepicker._datepickerShowing&&e.datepicker._shouldFocusInput(t)&&t.input.focus(),t.yearshtml&&(i=t.yearshtml,setTimeout(function(){i===t.yearshtml&&t.yearshtml&&t.dpDiv.find("select.ui-datepicker-year:first").replaceWith(t.yearshtml),i=t.yearshtml=null},0))},_shouldFocusInput:function(e){return e.input&&e.input.is(":visible")&&!e.input.is(":disabled")&&!e.input.is(":focus")},_checkOffset:function(t,i,s){var n=t.dpDiv.outerWidth(),a=t.dpDiv.outerHeight(),o=t.input?t.input.outerWidth():0,r=t.input?t.input.outerHeight():0,h=document.documentElement.clientWidth+(s?0:e(document).scrollLeft()),l=document.documentElement.clientHeight+(s?0:e(document).scrollTop());return i.left-=this._get(t,"isRTL")?n-o:0,i.left-=s&&i.left===t.input.offset().left?e(document).scrollLeft():0,i.top-=s&&i.top===t.input.offset().top+r?e(document).scrollTop():0,i.left-=Math.min(i.left,i.left+n>h&&h>n?Math.abs(i.left+n-h):0),i.top-=Math.min(i.top,i.top+a>l&&l>a?Math.abs(a+r):0),i},_findPos:function(t){for(var i,s=this._getInst(t),n=this._get(s,"isRTL");t&&("hidden"===t.type||1!==t.nodeType||e.expr.filters.hidden(t));)t=t[n?"previousSibling":"nextSibling"];return i=e(t).offset(),[i.left,i.top]},_hideDatepicker:function(t){var i,s,n,a,o=this._curInst;!o||t&&o!==e.data(t,"datepicker")||this._datepickerShowing&&(i=this._get(o,"showAnim"),s=this._get(o,"duration"),n=function(){e.datepicker._tidyDialog(o)},e.effects&&(e.effects.effect[i]||e.effects[i])?o.dpDiv.hide(i,e.datepicker._get(o,"showOptions"),s,n):o.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?s:null,n),i||n(),this._datepickerShowing=!1,a=this._get(o,"onClose"),a&&a.apply(o.input?o.input[0]:null,[o.input?o.input.val():"",o]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),e.blockUI&&(e.unblockUI(),e("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(e){e.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(t){if(e.datepicker._curInst){var i=e(t.target),s=e.datepicker._getInst(i[0]);(i[0].id!==e.datepicker._mainDivId&&0===i.parents("#"+e.datepicker._mainDivId).length&&!i.hasClass(e.datepicker.markerClassName)&&!i.closest("."+e.datepicker._triggerClass).length&&e.datepicker._datepickerShowing&&(!e.datepicker._inDialog||!e.blockUI)||i.hasClass(e.datepicker.markerClassName)&&e.datepicker._curInst!==s)&&e.datepicker._hideDatepicker()}},_adjustDate:function(t,i,s){var n=e(t),a=this._getInst(n[0]);this._isDisabledDatepicker(n[0])||(this._adjustInstDate(a,i+("M"===s?this._get(a,"showCurrentAtPos"):0),s),this._updateDatepicker(a))},_gotoToday:function(t){var i,s=e(t),n=this._getInst(s[0]);this._get(n,"gotoCurrent")&&n.currentDay?(n.selectedDay=n.currentDay,n.drawMonth=n.selectedMonth=n.currentMonth,n.drawYear=n.selectedYear=n.currentYear):(i=new Date,n.selectedDay=i.getDate(),n.drawMonth=n.selectedMonth=i.getMonth(),n.drawYear=n.selectedYear=i.getFullYear()),this._notifyChange(n),this._adjustDate(s)},_selectMonthYear:function(t,i,s){var n=e(t),a=this._getInst(n[0]);a["selected"+("M"===s?"Month":"Year")]=a["draw"+("M"===s?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(a),this._adjustDate(n)},_selectDay:function(t,i,s,n){var a,o=e(t);e(n).hasClass(this._unselectableClass)||this._isDisabledDatepicker(o[0])||(a=this._getInst(o[0]),a.selectedDay=a.currentDay=e("a",n).html(),a.selectedMonth=a.currentMonth=i,a.selectedYear=a.currentYear=s,this._selectDate(t,this._formatDate(a,a.currentDay,a.currentMonth,a.currentYear)))},_clearDate:function(t){var i=e(t);this._selectDate(i,"")},_selectDate:function(t,i){var s,n=e(t),a=this._getInst(n[0]);i=null!=i?i:this._formatDate(a),a.input&&a.input.val(i),this._updateAlternate(a),s=this._get(a,"onSelect"),s?s.apply(a.input?a.input[0]:null,[i,a]):a.input&&a.input.trigger("change"),a.inline?this._updateDatepicker(a):(this._hideDatepicker(),this._lastInput=a.input[0],"object"!=typeof a.input[0]&&a.input.focus(),this._lastInput=null)},_updateAlternate:function(t){var i,s,n,a=this._get(t,"altField");a&&(i=this._get(t,"altFormat")||this._get(t,"dateFormat"),s=this._getDate(t),n=this.formatDate(i,s,this._getFormatConfig(t)),e(a).each(function(){e(this).val(n)}))},noWeekends:function(e){var t=e.getDay();return[t>0&&6>t,""]},iso8601Week:function(e){var t,i=new Date(e.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),t=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((t-i)/864e5)/7)+1},parseDate:function(t,i,s){if(null==t||null==i)throw"Invalid arguments";if(i="object"==typeof i?""+i:i+"",""===i)return null;var n,a,o,r,h=0,l=(s?s.shortYearCutoff:null)||this._defaults.shortYearCutoff,u="string"!=typeof l?l:(new Date).getFullYear()%100+parseInt(l,10),d=(s?s.dayNamesShort:null)||this._defaults.dayNamesShort,c=(s?s.dayNames:null)||this._defaults.dayNames,p=(s?s.monthNamesShort:null)||this._defaults.monthNamesShort,f=(s?s.monthNames:null)||this._defaults.monthNames,m=-1,g=-1,v=-1,y=-1,b=!1,_=function(e){var i=t.length>n+1&&t.charAt(n+1)===e;return i&&n++,i},x=function(e){var t=_(e),s="@"===e?14:"!"===e?20:"y"===e&&t?4:"o"===e?3:2,n="y"===e?s:1,a=RegExp("^\\d{"+n+","+s+"}"),o=i.substring(h).match(a);if(!o)throw"Missing number at position "+h;return h+=o[0].length,parseInt(o[0],10)},w=function(t,s,n){var a=-1,o=e.map(_(t)?n:s,function(e,t){return[[t,e]]}).sort(function(e,t){return-(e[1].length-t[1].length)});if(e.each(o,function(e,t){var s=t[1];return i.substr(h,s.length).toLowerCase()===s.toLowerCase()?(a=t[0],h+=s.length,!1):void 0}),-1!==a)return a+1;throw"Unknown name at position "+h},k=function(){if(i.charAt(h)!==t.charAt(n))throw"Unexpected literal at position "+h;h++};for(n=0;t.length>n;n++)if(b)"'"!==t.charAt(n)||_("'")?k():b=!1;else switch(t.charAt(n)){case"d":v=x("d");break;case"D":w("D",d,c);break;case"o":y=x("o");break;case"m":g=x("m");break;case"M":g=w("M",p,f);break;case"y":m=x("y");break;case"@":r=new Date(x("@")),m=r.getFullYear(),g=r.getMonth()+1,v=r.getDate();break;case"!":r=new Date((x("!")-this._ticksTo1970)/1e4),m=r.getFullYear(),g=r.getMonth()+1,v=r.getDate();break;case"'":_("'")?k():b=!0;break;default:k()}if(i.length>h&&(o=i.substr(h),!/^\s+/.test(o)))throw"Extra/unparsed characters found in date: "+o;if(-1===m?m=(new Date).getFullYear():100>m&&(m+=(new Date).getFullYear()-(new Date).getFullYear()%100+(u>=m?0:-100)),y>-1)for(g=1,v=y;;){if(a=this._getDaysInMonth(m,g-1),a>=v)break;g++,v-=a}if(r=this._daylightSavingAdjust(new Date(m,g-1,v)),r.getFullYear()!==m||r.getMonth()+1!==g||r.getDate()!==v)throw"Invalid date";return r},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:1e7*60*60*24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(e,t,i){if(!t)return"";var s,n=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,a=(i?i.dayNames:null)||this._defaults.dayNames,o=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,r=(i?i.monthNames:null)||this._defaults.monthNames,h=function(t){var i=e.length>s+1&&e.charAt(s+1)===t;return i&&s++,i},l=function(e,t,i){var s=""+t;if(h(e))for(;i>s.length;)s="0"+s;return s},u=function(e,t,i,s){return h(e)?s[t]:i[t]},d="",c=!1;if(t)for(s=0;e.length>s;s++)if(c)"'"!==e.charAt(s)||h("'")?d+=e.charAt(s):c=!1;else switch(e.charAt(s)){case"d":d+=l("d",t.getDate(),2);break;case"D":d+=u("D",t.getDay(),n,a);break;case"o":d+=l("o",Math.round((new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-new Date(t.getFullYear(),0,0).getTime())/864e5),3);break;case"m":d+=l("m",t.getMonth()+1,2);break;case"M":d+=u("M",t.getMonth(),o,r);break;case"y":d+=h("y")?t.getFullYear():(10>t.getYear()%100?"0":"")+t.getYear()%100;break;case"@":d+=t.getTime();break;case"!":d+=1e4*t.getTime()+this._ticksTo1970;break;case"'":h("'")?d+="'":c=!0;break;default:d+=e.charAt(s)}return d},_possibleChars:function(e){var t,i="",s=!1,n=function(i){var s=e.length>t+1&&e.charAt(t+1)===i;return s&&t++,s};for(t=0;e.length>t;t++)if(s)"'"!==e.charAt(t)||n("'")?i+=e.charAt(t):s=!1;else switch(e.charAt(t)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":n("'")?i+="'":s=!0;break;default:i+=e.charAt(t)}return i},_get:function(e,t){return void 0!==e.settings[t]?e.settings[t]:this._defaults[t]},_setDateFromField:function(e,t){if(e.input.val()!==e.lastVal){var i=this._get(e,"dateFormat"),s=e.lastVal=e.input?e.input.val():null,n=this._getDefaultDate(e),a=n,o=this._getFormatConfig(e);try{a=this.parseDate(i,s,o)||n}catch(r){s=t?"":s}e.selectedDay=a.getDate(),e.drawMonth=e.selectedMonth=a.getMonth(),e.drawYear=e.selectedYear=a.getFullYear(),e.currentDay=s?a.getDate():0,e.currentMonth=s?a.getMonth():0,e.currentYear=s?a.getFullYear():0,this._adjustInstDate(e)}},_getDefaultDate:function(e){return this._restrictMinMax(e,this._determineDate(e,this._get(e,"defaultDate"),new Date))},_determineDate:function(t,i,s){var n=function(e){var t=new Date;return t.setDate(t.getDate()+e),t},a=function(i){try{return e.datepicker.parseDate(e.datepicker._get(t,"dateFormat"),i,e.datepicker._getFormatConfig(t))}catch(s){}for(var n=(i.toLowerCase().match(/^c/)?e.datepicker._getDate(t):null)||new Date,a=n.getFullYear(),o=n.getMonth(),r=n.getDate(),h=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,l=h.exec(i);l;){switch(l[2]||"d"){case"d":case"D":r+=parseInt(l[1],10);break;case"w":case"W":r+=7*parseInt(l[1],10);break;case"m":case"M":o+=parseInt(l[1],10),r=Math.min(r,e.datepicker._getDaysInMonth(a,o));break;case"y":case"Y":a+=parseInt(l[1],10),r=Math.min(r,e.datepicker._getDaysInMonth(a,o))}l=h.exec(i)}return new Date(a,o,r)},o=null==i||""===i?s:"string"==typeof i?a(i):"number"==typeof i?isNaN(i)?s:n(i):new Date(i.getTime());return o=o&&"Invalid Date"==""+o?s:o,o&&(o.setHours(0),o.setMinutes(0),o.setSeconds(0),o.setMilliseconds(0)),this._daylightSavingAdjust(o)},_daylightSavingAdjust:function(e){return e?(e.setHours(e.getHours()>12?e.getHours()+2:0),e):null},_setDate:function(e,t,i){var s=!t,n=e.selectedMonth,a=e.selectedYear,o=this._restrictMinMax(e,this._determineDate(e,t,new Date));e.selectedDay=e.currentDay=o.getDate(),e.drawMonth=e.selectedMonth=e.currentMonth=o.getMonth(),e.drawYear=e.selectedYear=e.currentYear=o.getFullYear(),n===e.selectedMonth&&a===e.selectedYear||i||this._notifyChange(e),this._adjustInstDate(e),e.input&&e.input.val(s?"":this._formatDate(e))},_getDate:function(e){var t=!e.currentYear||e.input&&""===e.input.val()?null:this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return t},_attachHandlers:function(t){var i=this._get(t,"stepMonths"),s="#"+t.id.replace(/\\\\/g,"\\");t.dpDiv.find("[data-handler]").map(function(){var t={prev:function(){e.datepicker._adjustDate(s,-i,"M")},next:function(){e.datepicker._adjustDate(s,+i,"M")},hide:function(){e.datepicker._hideDatepicker()},today:function(){e.datepicker._gotoToday(s)},selectDay:function(){return e.datepicker._selectDay(s,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return e.datepicker._selectMonthYear(s,this,"M"),!1},selectYear:function(){return e.datepicker._selectMonthYear(s,this,"Y"),!1}};e(this).bind(this.getAttribute("data-event"),t[this.getAttribute("data-handler")])})},_generateHTML:function(e){var t,i,s,n,a,o,r,h,l,u,d,c,p,f,m,g,v,y,b,_,x,w,k,T,D,S,M,C,N,A,P,I,H,z,F,E,O,j,W,L=new Date,R=this._daylightSavingAdjust(new Date(L.getFullYear(),L.getMonth(),L.getDate())),Y=this._get(e,"isRTL"),B=this._get(e,"showButtonPanel"),J=this._get(e,"hideIfNoPrevNext"),q=this._get(e,"navigationAsDateFormat"),K=this._getNumberOfMonths(e),V=this._get(e,"showCurrentAtPos"),U=this._get(e,"stepMonths"),Q=1!==K[0]||1!==K[1],G=this._daylightSavingAdjust(e.currentDay?new Date(e.currentYear,e.currentMonth,e.currentDay):new Date(9999,9,9)),X=this._getMinMaxDate(e,"min"),$=this._getMinMaxDate(e,"max"),Z=e.drawMonth-V,et=e.drawYear;if(0>Z&&(Z+=12,et--),$)for(t=this._daylightSavingAdjust(new Date($.getFullYear(),$.getMonth()-K[0]*K[1]+1,$.getDate())),t=X&&X>t?X:t;this._daylightSavingAdjust(new Date(et,Z,1))>t;)Z--,0>Z&&(Z=11,et--);for(e.drawMonth=Z,e.drawYear=et,i=this._get(e,"prevText"),i=q?this.formatDate(i,this._daylightSavingAdjust(new Date(et,Z-U,1)),this._getFormatConfig(e)):i,s=this._canAdjustMonth(e,-1,et,Z)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>":J?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>",n=this._get(e,"nextText"),n=q?this.formatDate(n,this._daylightSavingAdjust(new Date(et,Z+U,1)),this._getFormatConfig(e)):n,a=this._canAdjustMonth(e,1,et,Z)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>":J?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>",o=this._get(e,"currentText"),r=this._get(e,"gotoCurrent")&&e.currentDay?G:R,o=q?this.formatDate(o,r,this._getFormatConfig(e)):o,h=e.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(e,"closeText")+"</button>",l=B?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(Y?h:"")+(this._isInRange(e,r)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+o+"</button>":"")+(Y?"":h)+"</div>":"",u=parseInt(this._get(e,"firstDay"),10),u=isNaN(u)?0:u,d=this._get(e,"showWeek"),c=this._get(e,"dayNames"),p=this._get(e,"dayNamesMin"),f=this._get(e,"monthNames"),m=this._get(e,"monthNamesShort"),g=this._get(e,"beforeShowDay"),v=this._get(e,"showOtherMonths"),y=this._get(e,"selectOtherMonths"),b=this._getDefaultDate(e),_="",w=0;K[0]>w;w++){for(k="",this.maxRows=4,T=0;K[1]>T;T++){if(D=this._daylightSavingAdjust(new Date(et,Z,e.selectedDay)),S=" ui-corner-all",M="",Q){if(M+="<div class='ui-datepicker-group",K[1]>1)switch(T){case 0:M+=" ui-datepicker-group-first",S=" ui-corner-"+(Y?"right":"left");break;case K[1]-1:M+=" ui-datepicker-group-last",S=" ui-corner-"+(Y?"left":"right");break;default:M+=" ui-datepicker-group-middle",S=""}M+="'>"}for(M+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+S+"'>"+(/all|left/.test(S)&&0===w?Y?a:s:"")+(/all|right/.test(S)&&0===w?Y?s:a:"")+this._generateMonthYearHeader(e,Z,et,X,$,w>0||T>0,f,m)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>",C=d?"<th class='ui-datepicker-week-col'>"+this._get(e,"weekHeader")+"</th>":"",x=0;7>x;x++)N=(x+u)%7,C+="<th scope='col'"+((x+u+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+c[N]+"'>"+p[N]+"</span></th>";for(M+=C+"</tr></thead><tbody>",A=this._getDaysInMonth(et,Z),et===e.selectedYear&&Z===e.selectedMonth&&(e.selectedDay=Math.min(e.selectedDay,A)),P=(this._getFirstDayOfMonth(et,Z)-u+7)%7,I=Math.ceil((P+A)/7),H=Q?this.maxRows>I?this.maxRows:I:I,this.maxRows=H,z=this._daylightSavingAdjust(new Date(et,Z,1-P)),F=0;H>F;F++){for(M+="<tr>",E=d?"<td class='ui-datepicker-week-col'>"+this._get(e,"calculateWeek")(z)+"</td>":"",x=0;7>x;x++)O=g?g.apply(e.input?e.input[0]:null,[z]):[!0,""],j=z.getMonth()!==Z,W=j&&!y||!O[0]||X&&X>z||$&&z>$,E+="<td class='"+((x+u+6)%7>=5?" ui-datepicker-week-end":"")+(j?" ui-datepicker-other-month":"")+(z.getTime()===D.getTime()&&Z===e.selectedMonth&&e._keyEvent||b.getTime()===z.getTime()&&b.getTime()===D.getTime()?" "+this._dayOverClass:"")+(W?" "+this._unselectableClass+" ui-state-disabled":"")+(j&&!v?"":" "+O[1]+(z.getTime()===G.getTime()?" "+this._currentClass:"")+(z.getTime()===R.getTime()?" ui-datepicker-today":""))+"'"+(j&&!v||!O[2]?"":" title='"+O[2].replace(/'/g,"&#39;")+"'")+(W?"":" data-handler='selectDay' data-event='click' data-month='"+z.getMonth()+"' data-year='"+z.getFullYear()+"'")+">"+(j&&!v?"&#xa0;":W?"<span class='ui-state-default'>"+z.getDate()+"</span>":"<a class='ui-state-default"+(z.getTime()===R.getTime()?" ui-state-highlight":"")+(z.getTime()===G.getTime()?" ui-state-active":"")+(j?" ui-priority-secondary":"")+"' href='#'>"+z.getDate()+"</a>")+"</td>",z.setDate(z.getDate()+1),z=this._daylightSavingAdjust(z);M+=E+"</tr>"}Z++,Z>11&&(Z=0,et++),M+="</tbody></table>"+(Q?"</div>"+(K[0]>0&&T===K[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),k+=M}_+=k}return _+=l,e._keyEvent=!1,_},_generateMonthYearHeader:function(e,t,i,s,n,a,o,r){var h,l,u,d,c,p,f,m,g=this._get(e,"changeMonth"),v=this._get(e,"changeYear"),y=this._get(e,"showMonthAfterYear"),b="<div class='ui-datepicker-title'>",_="";if(a||!g)_+="<span class='ui-datepicker-month'>"+o[t]+"</span>";else{for(h=s&&s.getFullYear()===i,l=n&&n.getFullYear()===i,_+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",u=0;12>u;u++)(!h||u>=s.getMonth())&&(!l||n.getMonth()>=u)&&(_+="<option value='"+u+"'"+(u===t?" selected='selected'":"")+">"+r[u]+"</option>");_+="</select>"}if(y||(b+=_+(!a&&g&&v?"":"&#xa0;")),!e.yearshtml)if(e.yearshtml="",a||!v)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(d=this._get(e,"yearRange").split(":"),c=(new Date).getFullYear(),p=function(e){var t=e.match(/c[+\-].*/)?i+parseInt(e.substring(1),10):e.match(/[+\-].*/)?c+parseInt(e,10):parseInt(e,10);return isNaN(t)?c:t},f=p(d[0]),m=Math.max(f,p(d[1]||"")),f=s?Math.max(f,s.getFullYear()):f,m=n?Math.min(m,n.getFullYear()):m,e.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";m>=f;f++)e.yearshtml+="<option value='"+f+"'"+(f===i?" selected='selected'":"")+">"+f+"</option>";e.yearshtml+="</select>",b+=e.yearshtml,e.yearshtml=null}return b+=this._get(e,"yearSuffix"),y&&(b+=(!a&&g&&v?"":"&#xa0;")+_),b+="</div>"},_adjustInstDate:function(e,t,i){var s=e.drawYear+("Y"===i?t:0),n=e.drawMonth+("M"===i?t:0),a=Math.min(e.selectedDay,this._getDaysInMonth(s,n))+("D"===i?t:0),o=this._restrictMinMax(e,this._daylightSavingAdjust(new Date(s,n,a)));e.selectedDay=o.getDate(),e.drawMonth=e.selectedMonth=o.getMonth(),e.drawYear=e.selectedYear=o.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(e)},_restrictMinMax:function(e,t){var i=this._getMinMaxDate(e,"min"),s=this._getMinMaxDate(e,"max"),n=i&&i>t?i:t;return s&&n>s?s:n},_notifyChange:function(e){var t=this._get(e,"onChangeMonthYear");t&&t.apply(e.input?e.input[0]:null,[e.selectedYear,e.selectedMonth+1,e])},_getNumberOfMonths:function(e){var t=this._get(e,"numberOfMonths");return null==t?[1,1]:"number"==typeof t?[1,t]:t},_getMinMaxDate:function(e,t){return this._determineDate(e,this._get(e,t+"Date"),null)},_getDaysInMonth:function(e,t){return 32-this._daylightSavingAdjust(new Date(e,t,32)).getDate()},_getFirstDayOfMonth:function(e,t){return new Date(e,t,1).getDay()},_canAdjustMonth:function(e,t,i,s){var n=this._getNumberOfMonths(e),a=this._daylightSavingAdjust(new Date(i,s+(0>t?t:n[0]*n[1]),1));return 0>t&&a.setDate(this._getDaysInMonth(a.getFullYear(),a.getMonth())),this._isInRange(e,a)},_isInRange:function(e,t){var i,s,n=this._getMinMaxDate(e,"min"),a=this._getMinMaxDate(e,"max"),o=null,r=null,h=this._get(e,"yearRange");return h&&(i=h.split(":"),s=(new Date).getFullYear(),o=parseInt(i[0],10),r=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(o+=s),i[1].match(/[+\-].*/)&&(r+=s)),(!n||t.getTime()>=n.getTime())&&(!a||t.getTime()<=a.getTime())&&(!o||t.getFullYear()>=o)&&(!r||r>=t.getFullYear())},_getFormatConfig:function(e){var t=this._get(e,"shortYearCutoff");return t="string"!=typeof t?t:(new Date).getFullYear()%100+parseInt(t,10),{shortYearCutoff:t,dayNamesShort:this._get(e,"dayNamesShort"),dayNames:this._get(e,"dayNames"),monthNamesShort:this._get(e,"monthNamesShort"),monthNames:this._get(e,"monthNames")}},_formatDate:function(e,t,i,s){t||(e.currentDay=e.selectedDay,e.currentMonth=e.selectedMonth,e.currentYear=e.selectedYear);var n=t?"object"==typeof t?t:this._daylightSavingAdjust(new Date(s,i,t)):this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return this.formatDate(this._get(e,"dateFormat"),n,this._getFormatConfig(e))}}),e.fn.datepicker=function(t){if(!this.length)return this;e.datepicker.initialized||(e(document).mousedown(e.datepicker._checkExternalClick),e.datepicker.initialized=!0),0===e("#"+e.datepicker._mainDivId).length&&e("body").append(e.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof t||"isDisabled"!==t&&"getDate"!==t&&"widget"!==t?"option"===t&&2===arguments.length&&"string"==typeof arguments[1]?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof t?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this].concat(i)):e.datepicker._attachDatepicker(this,t)}):e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i))},e.datepicker=new n,e.datepicker.initialized=!1,e.datepicker.uuid=(new Date).getTime(),e.datepicker.version="1.11.4",e.datepicker,e.widget("ui.draggable",e.ui.mouse,{version:"1.11.4",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._setHandleClassName(),this._mouseInit()},_setOption:function(e,t){this._super(e,t),"handle"===e&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._removeHandleClassName(),this._mouseDestroy(),void 0)},_mouseCapture:function(t){var i=this.options;return this._blurActiveElement(t),this.helper||i.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(this._blockFrames(i.iframeFix===!0?"iframe":i.iframeFix),!0):!1)},_blockFrames:function(t){this.iframeBlocks=this.document.find(t).map(function(){var t=e(this);return e("<div>").css("position","absolute").appendTo(t.parent()).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(t){var i=this.document[0];if(this.handleElement.is(t.target))try{i.activeElement&&"body"!==i.activeElement.nodeName.toLowerCase()&&e(i.activeElement).blur()}catch(s){}},_mouseStart:function(t){var i=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===e(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(t),this.originalPosition=this.position=this._generatePosition(t,!1),this.originalPageX=t.pageX,this.originalPageY=t.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._normalizeRightBottom(),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_refreshOffsets:function(e){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:e.pageX-this.offset.left,top:e.pageY-this.offset.top}},_mouseDrag:function(t,i){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",t,s)===!1)return this._mouseUp({}),!1;this.position=s.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var i=this,s=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(s=e.ui.ddmanager.drop(this,t)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",t)!==!1&&i._clear()}):this._trigger("stop",t)!==!1&&this._clear(),!1},_mouseUp:function(t){return this._unblockFrames(),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),this.handleElement.is(t.target)&&this.element.focus(),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){return this.options.handle?!!e(t.target).closest(this.element.find(this.options.handle)).length:!0},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this.handleElement.addClass("ui-draggable-handle")},_removeHandleClassName:function(){this.handleElement.removeClass("ui-draggable-handle")},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper),n=s?e(i.helper.apply(this.element[0],[t])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s&&n[0]===this.element[0]&&this._setPositionRelative(),n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_isRootNode:function(e){return/(html|body)/i.test(e.tagName)||e===this.document[0]},_getParentOffset:function(){var t=this.offsetParent.offset(),i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var e=this.element.position(),t=this._isRootNode(this.scrollParent[0]);return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+(t?0:this.scrollParent.scrollTop()),left:e.left-(parseInt(this.helper.css("left"),10)||0)+(t?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,s,n=this.options,a=this.document[0];return this.relativeContainer=null,n.containment?"window"===n.containment?(this.containment=[e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft()+e(window).width()-this.helperProportions.width-this.margins.left,e(window).scrollTop()+(e(window).height()||a.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===n.containment?(this.containment=[0,0,e(a).width()-this.helperProportions.width-this.margins.left,(e(a).height()||a.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):n.containment.constructor===Array?(this.containment=n.containment,void 0):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=e(n.containment),s=i[0],s&&(t=/(scroll|auto)/.test(i.css("overflow")),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(t?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=i),void 0):(this.containment=null,void 0) },_convertPositionTo:function(e,t){t||(t=this.position);var i="absolute"===e?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:t.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*i,left:t.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*i}},_generatePosition:function(e,t){var i,s,n,a,o=this.options,r=this._isRootNode(this.scrollParent[0]),h=e.pageX,l=e.pageY;return r&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),t&&(this.containment&&(this.relativeContainer?(s=this.relativeContainer.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,e.pageX-this.offset.click.left<i[0]&&(h=i[0]+this.offset.click.left),e.pageY-this.offset.click.top<i[1]&&(l=i[1]+this.offset.click.top),e.pageX-this.offset.click.left>i[2]&&(h=i[2]+this.offset.click.left),e.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),o.grid&&(n=o.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY,l=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-o.grid[1]:n+o.grid[1]:n,a=o.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX,h=i?a-this.offset.click.left>=i[0]||a-this.offset.click.left>i[2]?a:a-this.offset.click.left>=i[0]?a-o.grid[0]:a+o.grid[0]:a),"y"===o.axis&&(h=this.originalPageX),"x"===o.axis&&(l=this.originalPageY)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:r?0:this.offset.scroll.top),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:r?0:this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_normalizeRightBottom:function(){"y"!==this.options.axis&&"auto"!==this.helper.css("right")&&(this.helper.width(this.helper.width()),this.helper.css("right","auto")),"x"!==this.options.axis&&"auto"!==this.helper.css("bottom")&&(this.helper.height(this.helper.height()),this.helper.css("bottom","auto"))},_trigger:function(t,i,s){return s=s||this._uiHash(),e.ui.plugin.call(this,t,[i,s,this],!0),/^(drag|start|stop)/.test(t)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),e.Widget.prototype._trigger.call(this,t,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,i,s){var n=e.extend({},i,{item:s.element});s.sortables=[],e(s.options.connectToSortable).each(function(){var i=e(this).sortable("instance");i&&!i.options.disabled&&(s.sortables.push(i),i.refreshPositions(),i._trigger("activate",t,n))})},stop:function(t,i,s){var n=e.extend({},i,{item:s.element});s.cancelHelperRemoval=!1,e.each(s.sortables,function(){var e=this;e.isOver?(e.isOver=0,s.cancelHelperRemoval=!0,e.cancelHelperRemoval=!1,e._storedCSS={position:e.placeholder.css("position"),top:e.placeholder.css("top"),left:e.placeholder.css("left")},e._mouseStop(t),e.options.helper=e.options._helper):(e.cancelHelperRemoval=!0,e._trigger("deactivate",t,n))})},drag:function(t,i,s){e.each(s.sortables,function(){var n=!1,a=this;a.positionAbs=s.positionAbs,a.helperProportions=s.helperProportions,a.offset.click=s.offset.click,a._intersectsWith(a.containerCache)&&(n=!0,e.each(s.sortables,function(){return this.positionAbs=s.positionAbs,this.helperProportions=s.helperProportions,this.offset.click=s.offset.click,this!==a&&this._intersectsWith(this.containerCache)&&e.contains(a.element[0],this.element[0])&&(n=!1),n})),n?(a.isOver||(a.isOver=1,s._parent=i.helper.parent(),a.currentItem=i.helper.appendTo(a.element).data("ui-sortable-item",!0),a.options._helper=a.options.helper,a.options.helper=function(){return i.helper[0]},t.target=a.currentItem[0],a._mouseCapture(t,!0),a._mouseStart(t,!0,!0),a.offset.click.top=s.offset.click.top,a.offset.click.left=s.offset.click.left,a.offset.parent.left-=s.offset.parent.left-a.offset.parent.left,a.offset.parent.top-=s.offset.parent.top-a.offset.parent.top,s._trigger("toSortable",t),s.dropped=a.element,e.each(s.sortables,function(){this.refreshPositions()}),s.currentItem=s.element,a.fromOutside=s),a.currentItem&&(a._mouseDrag(t),i.position=a.position)):a.isOver&&(a.isOver=0,a.cancelHelperRemoval=!0,a.options._revert=a.options.revert,a.options.revert=!1,a._trigger("out",t,a._uiHash(a)),a._mouseStop(t,!0),a.options.revert=a.options._revert,a.options.helper=a.options._helper,a.placeholder&&a.placeholder.remove(),i.helper.appendTo(s._parent),s._refreshOffsets(t),i.position=s._generatePosition(t,!0),s._trigger("fromSortable",t),s.dropped=!1,e.each(s.sortables,function(){this.refreshPositions()}))})}}),e.ui.plugin.add("draggable","cursor",{start:function(t,i,s){var n=e("body"),a=s.options;n.css("cursor")&&(a._cursor=n.css("cursor")),n.css("cursor",a.cursor)},stop:function(t,i,s){var n=s.options;n._cursor&&e("body").css("cursor",n._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,i,s){var n=e(i.helper),a=s.options;n.css("opacity")&&(a._opacity=n.css("opacity")),n.css("opacity",a.opacity)},stop:function(t,i,s){var n=s.options;n._opacity&&e(i.helper).css("opacity",n._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(e,t,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(t,i,s){var n=s.options,a=!1,o=s.scrollParentNotHidden[0],r=s.document[0];o!==r&&"HTML"!==o.tagName?(n.axis&&"x"===n.axis||(s.overflowOffset.top+o.offsetHeight-t.pageY<n.scrollSensitivity?o.scrollTop=a=o.scrollTop+n.scrollSpeed:t.pageY-s.overflowOffset.top<n.scrollSensitivity&&(o.scrollTop=a=o.scrollTop-n.scrollSpeed)),n.axis&&"y"===n.axis||(s.overflowOffset.left+o.offsetWidth-t.pageX<n.scrollSensitivity?o.scrollLeft=a=o.scrollLeft+n.scrollSpeed:t.pageX-s.overflowOffset.left<n.scrollSensitivity&&(o.scrollLeft=a=o.scrollLeft-n.scrollSpeed))):(n.axis&&"x"===n.axis||(t.pageY-e(r).scrollTop()<n.scrollSensitivity?a=e(r).scrollTop(e(r).scrollTop()-n.scrollSpeed):e(window).height()-(t.pageY-e(r).scrollTop())<n.scrollSensitivity&&(a=e(r).scrollTop(e(r).scrollTop()+n.scrollSpeed))),n.axis&&"y"===n.axis||(t.pageX-e(r).scrollLeft()<n.scrollSensitivity?a=e(r).scrollLeft(e(r).scrollLeft()-n.scrollSpeed):e(window).width()-(t.pageX-e(r).scrollLeft())<n.scrollSensitivity&&(a=e(r).scrollLeft(e(r).scrollLeft()+n.scrollSpeed)))),a!==!1&&e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(s,t)}}),e.ui.plugin.add("draggable","snap",{start:function(t,i,s){var n=s.options;s.snapElements=[],e(n.snap.constructor!==String?n.snap.items||":data(ui-draggable)":n.snap).each(function(){var t=e(this),i=t.offset();this!==s.element[0]&&s.snapElements.push({item:this,width:t.outerWidth(),height:t.outerHeight(),top:i.top,left:i.left})})},drag:function(t,i,s){var n,a,o,r,h,l,u,d,c,p,f=s.options,m=f.snapTolerance,g=i.offset.left,v=g+s.helperProportions.width,y=i.offset.top,b=y+s.helperProportions.height;for(c=s.snapElements.length-1;c>=0;c--)h=s.snapElements[c].left-s.margins.left,l=h+s.snapElements[c].width,u=s.snapElements[c].top-s.margins.top,d=u+s.snapElements[c].height,h-m>v||g>l+m||u-m>b||y>d+m||!e.contains(s.snapElements[c].item.ownerDocument,s.snapElements[c].item)?(s.snapElements[c].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,t,e.extend(s._uiHash(),{snapItem:s.snapElements[c].item})),s.snapElements[c].snapping=!1):("inner"!==f.snapMode&&(n=m>=Math.abs(u-b),a=m>=Math.abs(d-y),o=m>=Math.abs(h-v),r=m>=Math.abs(l-g),n&&(i.position.top=s._convertPositionTo("relative",{top:u-s.helperProportions.height,left:0}).top),a&&(i.position.top=s._convertPositionTo("relative",{top:d,left:0}).top),o&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h-s.helperProportions.width}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l}).left)),p=n||a||o||r,"outer"!==f.snapMode&&(n=m>=Math.abs(u-y),a=m>=Math.abs(d-b),o=m>=Math.abs(h-g),r=m>=Math.abs(l-v),n&&(i.position.top=s._convertPositionTo("relative",{top:u,left:0}).top),a&&(i.position.top=s._convertPositionTo("relative",{top:d-s.helperProportions.height,left:0}).top),o&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left)),!s.snapElements[c].snapping&&(n||a||o||r||p)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,t,e.extend(s._uiHash(),{snapItem:s.snapElements[c].item})),s.snapElements[c].snapping=n||a||o||r||p)}}),e.ui.plugin.add("draggable","stack",{start:function(t,i,s){var n,a=s.options,o=e.makeArray(e(a.stack)).sort(function(t,i){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(i).css("zIndex"),10)||0)});o.length&&(n=parseInt(e(o[0]).css("zIndex"),10)||0,e(o).each(function(t){e(this).css("zIndex",n+t)}),this.css("zIndex",n+o.length))}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,i,s){var n=e(i.helper),a=s.options;n.css("zIndex")&&(a._zIndex=n.css("zIndex")),n.css("zIndex",a.zIndex)},stop:function(t,i,s){var n=s.options;n._zIndex&&e(i.helper).css("zIndex",n._zIndex)}}),e.ui.draggable,e.widget("ui.resizable",e.ui.mouse,{version:"1.11.4",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(e){return parseInt(e,10)||0},_isNumber:function(e){return!isNaN(parseInt(e,10))},_hasScroll:function(t,i){if("hidden"===e(t).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return t[s]>0?!0:(t[s]=1,n=t[s]>0,t[s]=0,n)},_create:function(){var t,i,s,n,a,o=this,r=this.options;if(this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!r.aspectRatio,aspectRatio:r.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:r.helper||r.ghost||r.animate?r.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(e("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=r.handles||(e(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=e(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),t=this.handles.split(","),this.handles={},i=0;t.length>i;i++)s=e.trim(t[i]),a="ui-resizable-"+s,n=e("<div class='ui-resizable-handle "+a+"'></div>"),n.css({zIndex:r.zIndex}),"se"===s&&n.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[s]=".ui-resizable-"+s,this.element.append(n);this._renderAxis=function(t){var i,s,n,a;t=t||this.element;for(i in this.handles)this.handles[i].constructor===String?this.handles[i]=this.element.children(this.handles[i]).first().show():(this.handles[i].jquery||this.handles[i].nodeType)&&(this.handles[i]=e(this.handles[i]),this._on(this.handles[i],{mousedown:o._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(s=e(this.handles[i],this.element),a=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),t.css(n,a),this._proportionallyResize()),this._handles=this._handles.add(this.handles[i])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.mouseover(function(){o.resizing||(this.className&&(n=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),o.axis=n&&n[1]?n[1]:"se")}),r.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").mouseenter(function(){r.disabled||(e(this).removeClass("ui-resizable-autohide"),o._handles.show())}).mouseleave(function(){r.disabled||o.resizing||(e(this).addClass("ui-resizable-autohide"),o._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var t,i=function(t){e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),t=this.element,this.originalElement.css({position:t.css("position"),width:t.outerWidth(),height:t.outerHeight(),top:t.css("top"),left:t.css("left")}).insertAfter(t),t.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_mouseCapture:function(t){var i,s,n=!1;for(i in this.handles)s=e(this.handles[i])[0],(s===t.target||e.contains(s,t.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(t){var i,s,n,a=this.options,o=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),a.containment&&(i+=e(a.containment).scrollLeft()||0,s+=e(a.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:o.width(),height:o.height()},this.originalSize=this._helper?{width:o.outerWidth(),height:o.outerHeight()}:{width:o.width(),height:o.height()},this.sizeDiff={width:o.outerWidth()-o.width(),height:o.outerHeight()-o.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio="number"==typeof a.aspectRatio?a.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=e(".ui-resizable-"+this.axis).css("cursor"),e("body").css("cursor","auto"===n?this.axis+"-resize":n),o.addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(t){var i,s,n=this.originalMousePosition,a=this.axis,o=t.pageX-n.left||0,r=t.pageY-n.top||0,h=this._change[a];return this._updatePrevProperties(),h?(i=h.apply(this,[t,o,r]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(i=this._updateRatio(i,t)),i=this._respectSize(i,t),this._updateCache(i),this._propagate("resize",t),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),e.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",t,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(t){this.resizing=!1;var i,s,n,a,o,r,h,l=this.options,u=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:u.sizeDiff.height,a=s?0:u.sizeDiff.width,o={width:u.helper.width()-a,height:u.helper.height()-n},r=parseInt(u.element.css("left"),10)+(u.position.left-u.originalPosition.left)||null,h=parseInt(u.element.css("top"),10)+(u.position.top-u.originalPosition.top)||null,l.animate||this.element.css(e.extend(o,{top:h,left:r})),u.helper.height(u.size.height),u.helper.width(u.size.width),this._helper&&!l.animate&&this._proportionallyResize()),e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var e={};return this.position.top!==this.prevPosition.top&&(e.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(e.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(e.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(e.height=this.size.height+"px"),this.helper.css(e),e},_updateVirtualBoundaries:function(e){var t,i,s,n,a,o=this.options;a={minWidth:this._isNumber(o.minWidth)?o.minWidth:0,maxWidth:this._isNumber(o.maxWidth)?o.maxWidth:1/0,minHeight:this._isNumber(o.minHeight)?o.minHeight:0,maxHeight:this._isNumber(o.maxHeight)?o.maxHeight:1/0},(this._aspectRatio||e)&&(t=a.minHeight*this.aspectRatio,s=a.minWidth/this.aspectRatio,i=a.maxHeight*this.aspectRatio,n=a.maxWidth/this.aspectRatio,t>a.minWidth&&(a.minWidth=t),s>a.minHeight&&(a.minHeight=s),a.maxWidth>i&&(a.maxWidth=i),a.maxHeight>n&&(a.maxHeight=n)),this._vBoundaries=a},_updateCache:function(e){this.offset=this.helper.offset(),this._isNumber(e.left)&&(this.position.left=e.left),this._isNumber(e.top)&&(this.position.top=e.top),this._isNumber(e.height)&&(this.size.height=e.height),this._isNumber(e.width)&&(this.size.width=e.width)},_updateRatio:function(e){var t=this.position,i=this.size,s=this.axis;return this._isNumber(e.height)?e.width=e.height*this.aspectRatio:this._isNumber(e.width)&&(e.height=e.width/this.aspectRatio),"sw"===s&&(e.left=t.left+(i.width-e.width),e.top=null),"nw"===s&&(e.top=t.top+(i.height-e.height),e.left=t.left+(i.width-e.width)),e},_respectSize:function(e){var t=this._vBoundaries,i=this.axis,s=this._isNumber(e.width)&&t.maxWidth&&t.maxWidth<e.width,n=this._isNumber(e.height)&&t.maxHeight&&t.maxHeight<e.height,a=this._isNumber(e.width)&&t.minWidth&&t.minWidth>e.width,o=this._isNumber(e.height)&&t.minHeight&&t.minHeight>e.height,r=this.originalPosition.left+this.originalSize.width,h=this.position.top+this.size.height,l=/sw|nw|w/.test(i),u=/nw|ne|n/.test(i);return a&&(e.width=t.minWidth),o&&(e.height=t.minHeight),s&&(e.width=t.maxWidth),n&&(e.height=t.maxHeight),a&&l&&(e.left=r-t.minWidth),s&&l&&(e.left=r-t.maxWidth),o&&u&&(e.top=h-t.minHeight),n&&u&&(e.top=h-t.maxHeight),e.width||e.height||e.left||!e.top?e.width||e.height||e.top||!e.left||(e.left=null):e.top=null,e},_getPaddingPlusBorderDimensions:function(e){for(var t=0,i=[],s=[e.css("borderTopWidth"),e.css("borderRightWidth"),e.css("borderBottomWidth"),e.css("borderLeftWidth")],n=[e.css("paddingTop"),e.css("paddingRight"),e.css("paddingBottom"),e.css("paddingLeft")];4>t;t++)i[t]=parseInt(s[t],10)||0,i[t]+=parseInt(n[t],10)||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var e,t=0,i=this.helper||this.element;this._proportionallyResizeElements.length>t;t++)e=this._proportionallyResizeElements[t],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(e)),e.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var t=this.element,i=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||e("<div style='overflow:hidden;'></div>"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(e,t){return{width:this.originalSize.width+t}},w:function(e,t){var i=this.originalSize,s=this.originalPosition;return{left:s.left+t,width:i.width-t}},n:function(e,t,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(e,t,i){return{height:this.originalSize.height+i}},se:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},sw:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,i,s]))},ne:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},nw:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,i,s]))}},_propagate:function(t,i){e.ui.plugin.call(this,t,[i,this.ui()]),"resize"!==t&&this._trigger(t,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),e.ui.plugin.add("resizable","animate",{stop:function(t){var i=e(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,a=n.length&&/textarea/i.test(n[0].nodeName),o=a&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=a?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-o},l=parseInt(i.element.css("left"),10)+(i.position.left-i.originalPosition.left)||null,u=parseInt(i.element.css("top"),10)+(i.position.top-i.originalPosition.top)||null;i.element.animate(e.extend(h,u&&l?{top:u,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseInt(i.element.css("width"),10),height:parseInt(i.element.css("height"),10),top:parseInt(i.element.css("top"),10),left:parseInt(i.element.css("left"),10)};n&&n.length&&e(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",t)}})}}),e.ui.plugin.add("resizable","containment",{start:function(){var t,i,s,n,a,o,r,h=e(this).resizable("instance"),l=h.options,u=h.element,d=l.containment,c=d instanceof e?d.get(0):/parent/.test(d)?u.parent().get(0):d;c&&(h.containerElement=e(c),/document/.test(d)||d===document?(h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}):(t=e(c),i=[],e(["Top","Right","Left","Bottom"]).each(function(e,s){i[e]=h._num(t.css("padding"+s))}),h.containerOffset=t.offset(),h.containerPosition=t.position(),h.containerSize={height:t.innerHeight()-i[3],width:t.innerWidth()-i[1]},s=h.containerOffset,n=h.containerSize.height,a=h.containerSize.width,o=h._hasScroll(c,"left")?c.scrollWidth:a,r=h._hasScroll(c)?c.scrollHeight:n,h.parentData={element:c,left:s.left,top:s.top,width:o,height:r}))},resize:function(t){var i,s,n,a,o=e(this).resizable("instance"),r=o.options,h=o.containerOffset,l=o.position,u=o._aspectRatio||t.shiftKey,d={top:0,left:0},c=o.containerElement,p=!0;c[0]!==document&&/static/.test(c.css("position"))&&(d=h),l.left<(o._helper?h.left:0)&&(o.size.width=o.size.width+(o._helper?o.position.left-h.left:o.position.left-d.left),u&&(o.size.height=o.size.width/o.aspectRatio,p=!1),o.position.left=r.helper?h.left:0),l.top<(o._helper?h.top:0)&&(o.size.height=o.size.height+(o._helper?o.position.top-h.top:o.position.top),u&&(o.size.width=o.size.height*o.aspectRatio,p=!1),o.position.top=o._helper?h.top:0),n=o.containerElement.get(0)===o.element.parent().get(0),a=/relative|absolute/.test(o.containerElement.css("position")),n&&a?(o.offset.left=o.parentData.left+o.position.left,o.offset.top=o.parentData.top+o.position.top):(o.offset.left=o.element.offset().left,o.offset.top=o.element.offset().top),i=Math.abs(o.sizeDiff.width+(o._helper?o.offset.left-d.left:o.offset.left-h.left)),s=Math.abs(o.sizeDiff.height+(o._helper?o.offset.top-d.top:o.offset.top-h.top)),i+o.size.width>=o.parentData.width&&(o.size.width=o.parentData.width-i,u&&(o.size.height=o.size.width/o.aspectRatio,p=!1)),s+o.size.height>=o.parentData.height&&(o.size.height=o.parentData.height-s,u&&(o.size.width=o.size.height*o.aspectRatio,p=!1)),p||(o.position.left=o.prevPosition.left,o.position.top=o.prevPosition.top,o.size.width=o.prevSize.width,o.size.height=o.prevSize.height)},stop:function(){var t=e(this).resizable("instance"),i=t.options,s=t.containerOffset,n=t.containerPosition,a=t.containerElement,o=e(t.helper),r=o.offset(),h=o.outerWidth()-t.sizeDiff.width,l=o.outerHeight()-t.sizeDiff.height;t._helper&&!i.animate&&/relative/.test(a.css("position"))&&e(this).css({left:r.left-n.left-s.left,width:h,height:l}),t._helper&&!i.animate&&/static/.test(a.css("position"))&&e(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),e.ui.plugin.add("resizable","alsoResize",{start:function(){var t=e(this).resizable("instance"),i=t.options;e(i.alsoResize).each(function(){var t=e(this);t.data("ui-resizable-alsoresize",{width:parseInt(t.width(),10),height:parseInt(t.height(),10),left:parseInt(t.css("left"),10),top:parseInt(t.css("top"),10)})})},resize:function(t,i){var s=e(this).resizable("instance"),n=s.options,a=s.originalSize,o=s.originalPosition,r={height:s.size.height-a.height||0,width:s.size.width-a.width||0,top:s.position.top-o.top||0,left:s.position.left-o.left||0};e(n.alsoResize).each(function(){var t=e(this),s=e(this).data("ui-resizable-alsoresize"),n={},a=t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(a,function(e,t){var i=(s[t]||0)+(r[t]||0);i&&i>=0&&(n[t]=i||null)}),t.css(n)})},stop:function(){e(this).removeData("resizable-alsoresize")}}),e.ui.plugin.add("resizable","ghost",{start:function(){var t=e(this).resizable("instance"),i=t.options,s=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:s.height,width:s.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof i.ghost?i.ghost:""),t.ghost.appendTo(t.helper)},resize:function(){var t=e(this).resizable("instance");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=e(this).resizable("instance");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),e.ui.plugin.add("resizable","grid",{resize:function(){var t,i=e(this).resizable("instance"),s=i.options,n=i.size,a=i.originalSize,o=i.originalPosition,r=i.axis,h="number"==typeof s.grid?[s.grid,s.grid]:s.grid,l=h[0]||1,u=h[1]||1,d=Math.round((n.width-a.width)/l)*l,c=Math.round((n.height-a.height)/u)*u,p=a.width+d,f=a.height+c,m=s.maxWidth&&p>s.maxWidth,g=s.maxHeight&&f>s.maxHeight,v=s.minWidth&&s.minWidth>p,y=s.minHeight&&s.minHeight>f;s.grid=h,v&&(p+=l),y&&(f+=u),m&&(p-=l),g&&(f-=u),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=o.top-c):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=o.left-d):((0>=f-u||0>=p-l)&&(t=i._getPaddingPlusBorderDimensions(this)),f-u>0?(i.size.height=f,i.position.top=o.top-c):(f=u-t.height,i.size.height=f,i.position.top=o.top+a.height-f),p-l>0?(i.size.width=p,i.position.left=o.left-d):(p=l-t.width,i.size.width=p,i.position.left=o.left+a.width-p))}}),e.ui.resizable,e.widget("ui.dialog",{version:"1.11.4",options:{appendTo:"body",autoOpen:!0,buttons:[],closeOnEscape:!0,closeText:"Close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(t){var i=e(this).css(t).offset().top;0>i&&e(this).css("top",t.top-i)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),this.options.title=this.options.title||this.originalTitle,this._createWrapper(),this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(this.uiDialog),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&e.fn.draggable&&this._makeDraggable(),this.options.resizable&&e.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var t=this.options.appendTo;return t&&(t.jquery||t.nodeType)?e(t):this.document.find(t||"body").eq(0)},_destroy:function(){var e,t=this.originalPosition;this._untrackInstance(),this._destroyOverlay(),this.element.removeUniqueId().removeClass("ui-dialog-content ui-widget-content").css(this.originalCss).detach(),this.uiDialog.stop(!0,!0).remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),e=t.parent.children().eq(t.index),e.length&&e[0]!==this.element[0]?e.before(this.element):t.parent.append(this.element)},widget:function(){return this.uiDialog},disable:e.noop,enable:e.noop,close:function(t){var i,s=this;if(this._isOpen&&this._trigger("beforeClose",t)!==!1){if(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),!this.opener.filter(":focusable").focus().length)try{i=this.document[0].activeElement,i&&"body"!==i.nodeName.toLowerCase()&&e(i).blur()}catch(n){}this._hide(this.uiDialog,this.options.hide,function(){s._trigger("close",t)})}},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(t,i){var s=!1,n=this.uiDialog.siblings(".ui-front:visible").map(function(){return+e(this).css("z-index")}).get(),a=Math.max.apply(null,n);return a>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",a+1),s=!0),s&&!i&&this._trigger("focus",t),s},open:function(){var t=this;return this._isOpen?(this._moveToTop()&&this._focusTabbable(),void 0):(this._isOpen=!0,this.opener=e(this.document[0].activeElement),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function(){t._focusTabbable(),t._trigger("focus")}),this._makeFocusTarget(),this._trigger("open"),void 0)},_focusTabbable:function(){var e=this._focusedElement;e||(e=this.element.find("[autofocus]")),e.length||(e=this.element.find(":tabbable")),e.length||(e=this.uiDialogButtonPane.find(":tabbable")),e.length||(e=this.uiDialogTitlebarClose.filter(":tabbable")),e.length||(e=this.uiDialog),e.eq(0).focus()},_keepFocus:function(t){function i(){var t=this.document[0].activeElement,i=this.uiDialog[0]===t||e.contains(this.uiDialog[0],t);i||this._focusTabbable()}t.preventDefault(),i.call(this),this._delay(i)},_createWrapper:function(){this.uiDialog=e("<div>").addClass("ui-dialog ui-widget ui-widget-content ui-corner-all ui-front "+this.options.dialogClass).hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._on(this.uiDialog,{keydown:function(t){if(this.options.closeOnEscape&&!t.isDefaultPrevented()&&t.keyCode&&t.keyCode===e.ui.keyCode.ESCAPE)return t.preventDefault(),this.close(t),void 0; if(t.keyCode===e.ui.keyCode.TAB&&!t.isDefaultPrevented()){var i=this.uiDialog.find(":tabbable"),s=i.filter(":first"),n=i.filter(":last");t.target!==n[0]&&t.target!==this.uiDialog[0]||t.shiftKey?t.target!==s[0]&&t.target!==this.uiDialog[0]||!t.shiftKey||(this._delay(function(){n.focus()}),t.preventDefault()):(this._delay(function(){s.focus()}),t.preventDefault())}},mousedown:function(e){this._moveToTop(e)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var t;this.uiDialogTitlebar=e("<div>").addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(this.uiDialog),this._on(this.uiDialogTitlebar,{mousedown:function(t){e(t.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.focus()}}),this.uiDialogTitlebarClose=e("<button type='button'></button>").button({label:this.options.closeText,icons:{primary:"ui-icon-closethick"},text:!1}).addClass("ui-dialog-titlebar-close").appendTo(this.uiDialogTitlebar),this._on(this.uiDialogTitlebarClose,{click:function(e){e.preventDefault(),this.close(e)}}),t=e("<span>").uniqueId().addClass("ui-dialog-title").prependTo(this.uiDialogTitlebar),this._title(t),this.uiDialog.attr({"aria-labelledby":t.attr("id")})},_title:function(e){this.options.title||e.html("&#160;"),e.text(this.options.title)},_createButtonPane:function(){this.uiDialogButtonPane=e("<div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),this.uiButtonSet=e("<div>").addClass("ui-dialog-buttonset").appendTo(this.uiDialogButtonPane),this._createButtons()},_createButtons:function(){var t=this,i=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),e.isEmptyObject(i)||e.isArray(i)&&!i.length?(this.uiDialog.removeClass("ui-dialog-buttons"),void 0):(e.each(i,function(i,s){var n,a;s=e.isFunction(s)?{click:s,text:i}:s,s=e.extend({type:"button"},s),n=s.click,s.click=function(){n.apply(t.element[0],arguments)},a={icons:s.icons,text:s.showText},delete s.icons,delete s.showText,e("<button></button>",s).button(a).appendTo(t.uiButtonSet)}),this.uiDialog.addClass("ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog),void 0)},_makeDraggable:function(){function t(e){return{position:e.position,offset:e.offset}}var i=this,s=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(s,n){e(this).addClass("ui-dialog-dragging"),i._blockFrames(),i._trigger("dragStart",s,t(n))},drag:function(e,s){i._trigger("drag",e,t(s))},stop:function(n,a){var o=a.offset.left-i.document.scrollLeft(),r=a.offset.top-i.document.scrollTop();s.position={my:"left top",at:"left"+(o>=0?"+":"")+o+" "+"top"+(r>=0?"+":"")+r,of:i.window},e(this).removeClass("ui-dialog-dragging"),i._unblockFrames(),i._trigger("dragStop",n,t(a))}})},_makeResizable:function(){function t(e){return{originalPosition:e.originalPosition,originalSize:e.originalSize,position:e.position,size:e.size}}var i=this,s=this.options,n=s.resizable,a=this.uiDialog.css("position"),o="string"==typeof n?n:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:s.maxWidth,maxHeight:s.maxHeight,minWidth:s.minWidth,minHeight:this._minHeight(),handles:o,start:function(s,n){e(this).addClass("ui-dialog-resizing"),i._blockFrames(),i._trigger("resizeStart",s,t(n))},resize:function(e,s){i._trigger("resize",e,t(s))},stop:function(n,a){var o=i.uiDialog.offset(),r=o.left-i.document.scrollLeft(),h=o.top-i.document.scrollTop();s.height=i.uiDialog.height(),s.width=i.uiDialog.width(),s.position={my:"left top",at:"left"+(r>=0?"+":"")+r+" "+"top"+(h>=0?"+":"")+h,of:i.window},e(this).removeClass("ui-dialog-resizing"),i._unblockFrames(),i._trigger("resizeStop",n,t(a))}}).css("position",a)},_trackFocus:function(){this._on(this.widget(),{focusin:function(t){this._makeFocusTarget(),this._focusedElement=e(t.target)}})},_makeFocusTarget:function(){this._untrackInstance(),this._trackingInstances().unshift(this)},_untrackInstance:function(){var t=this._trackingInstances(),i=e.inArray(this,t);-1!==i&&t.splice(i,1)},_trackingInstances:function(){var e=this.document.data("ui-dialog-instances");return e||(e=[],this.document.data("ui-dialog-instances",e)),e},_minHeight:function(){var e=this.options;return"auto"===e.height?e.minHeight:Math.min(e.minHeight,e.height)},_position:function(){var e=this.uiDialog.is(":visible");e||this.uiDialog.show(),this.uiDialog.position(this.options.position),e||this.uiDialog.hide()},_setOptions:function(t){var i=this,s=!1,n={};e.each(t,function(e,t){i._setOption(e,t),e in i.sizeRelatedOptions&&(s=!0),e in i.resizableRelatedOptions&&(n[e]=t)}),s&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",n)},_setOption:function(e,t){var i,s,n=this.uiDialog;"dialogClass"===e&&n.removeClass(this.options.dialogClass).addClass(t),"disabled"!==e&&(this._super(e,t),"appendTo"===e&&this.uiDialog.appendTo(this._appendTo()),"buttons"===e&&this._createButtons(),"closeText"===e&&this.uiDialogTitlebarClose.button({label:""+t}),"draggable"===e&&(i=n.is(":data(ui-draggable)"),i&&!t&&n.draggable("destroy"),!i&&t&&this._makeDraggable()),"position"===e&&this._position(),"resizable"===e&&(s=n.is(":data(ui-resizable)"),s&&!t&&n.resizable("destroy"),s&&"string"==typeof t&&n.resizable("option","handles",t),s||t===!1||this._makeResizable()),"title"===e&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var e,t,i,s=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),s.minWidth>s.width&&(s.width=s.minWidth),e=this.uiDialog.css({height:"auto",width:s.width}).outerHeight(),t=Math.max(0,s.minHeight-e),i="number"==typeof s.maxHeight?Math.max(0,s.maxHeight-e):"none","auto"===s.height?this.element.css({minHeight:t,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,s.height-e)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var t=e(this);return e("<div>").css({position:"absolute",width:t.outerWidth(),height:t.outerHeight()}).appendTo(t.parent()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(t){return e(t.target).closest(".ui-dialog").length?!0:!!e(t.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var t=!0;this._delay(function(){t=!1}),this.document.data("ui-dialog-overlays")||this._on(this.document,{focusin:function(e){t||this._allowInteraction(e)||(e.preventDefault(),this._trackingInstances()[0]._focusTabbable())}}),this.overlay=e("<div>").addClass("ui-widget-overlay ui-front").appendTo(this._appendTo()),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1)}},_destroyOverlay:function(){if(this.options.modal&&this.overlay){var e=this.document.data("ui-dialog-overlays")-1;e?this.document.data("ui-dialog-overlays",e):this.document.unbind("focusin").removeData("ui-dialog-overlays"),this.overlay.remove(),this.overlay=null}}}),e.widget("ui.droppable",{version:"1.11.4",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t,i=this.options,s=i.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(s)?s:function(e){return e.is(s)},this.proportions=function(){return arguments.length?(t=arguments[0],void 0):t?t:t={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}},this._addToManager(i.scope),i.addClasses&&this.element.addClass("ui-droppable")},_addToManager:function(t){e.ui.ddmanager.droppables[t]=e.ui.ddmanager.droppables[t]||[],e.ui.ddmanager.droppables[t].push(this)},_splice:function(e){for(var t=0;e.length>t;t++)e[t]===this&&e.splice(t,1)},_destroy:function(){var t=e.ui.ddmanager.droppables[this.options.scope];this._splice(t),this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,i){if("accept"===t)this.accept=e.isFunction(i)?i:function(e){return e.is(i)};else if("scope"===t){var s=e.ui.ddmanager.droppables[this.options.scope];this._splice(s),this._addToManager(i)}this._super(t,i)},_activate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),i&&this._trigger("activate",t,this.ui(i))},_deactivate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),i&&this._trigger("deactivate",t,this.ui(i))},_over:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(i)))},_out:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(i)))},_drop:function(t,i){var s=i||e.ui.ddmanager.current,n=!1;return s&&(s.currentItem||s.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var i=e(this).droppable("instance");return i.options.greedy&&!i.options.disabled&&i.options.scope===s.options.scope&&i.accept.call(i.element[0],s.currentItem||s.element)&&e.ui.intersect(s,e.extend(i,{offset:i.element.offset()}),i.options.tolerance,t)?(n=!0,!1):void 0}),n?!1:this.accept.call(this.element[0],s.currentItem||s.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(s)),this.element):!1):!1},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(){function e(e,t,i){return e>=t&&t+i>e}return function(t,i,s,n){if(!i.offset)return!1;var a=(t.positionAbs||t.position.absolute).left+t.margins.left,o=(t.positionAbs||t.position.absolute).top+t.margins.top,r=a+t.helperProportions.width,h=o+t.helperProportions.height,l=i.offset.left,u=i.offset.top,d=l+i.proportions().width,c=u+i.proportions().height;switch(s){case"fit":return a>=l&&d>=r&&o>=u&&c>=h;case"intersect":return a+t.helperProportions.width/2>l&&d>r-t.helperProportions.width/2&&o+t.helperProportions.height/2>u&&c>h-t.helperProportions.height/2;case"pointer":return e(n.pageY,u,i.proportions().height)&&e(n.pageX,l,i.proportions().width);case"touch":return(o>=u&&c>=o||h>=u&&c>=h||u>o&&h>c)&&(a>=l&&d>=a||r>=l&&d>=r||l>a&&r>d);default:return!1}}}(),e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,i){var s,n,a=e.ui.ddmanager.droppables[t.options.scope]||[],o=i?i.type:null,r=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(s=0;a.length>s;s++)if(!(a[s].options.disabled||t&&!a[s].accept.call(a[s].element[0],t.currentItem||t.element))){for(n=0;r.length>n;n++)if(r[n]===a[s].element[0]){a[s].proportions().height=0;continue e}a[s].visible="none"!==a[s].element.css("display"),a[s].visible&&("mousedown"===o&&a[s]._activate.call(a[s],i),a[s].offset=a[s].element.offset(),a[s].proportions({width:a[s].element[0].offsetWidth,height:a[s].element[0].offsetHeight}))}},drop:function(t,i){var s=!1;return e.each((e.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance,i)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(t,i){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)})},drag:function(t,i){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,i),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,n,a,o=e.ui.intersect(t,this,this.options.tolerance,i),r=!o&&this.isover?"isout":o&&!this.isover?"isover":null;r&&(this.options.greedy&&(n=this.options.scope,a=this.element.parents(":data(ui-droppable)").filter(function(){return e(this).droppable("instance").options.scope===n}),a.length&&(s=e(a[0]).droppable("instance"),s.greedyChild="isover"===r)),s&&"isover"===r&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,i),s&&"isout"===r&&(s.isout=!1,s.isover=!0,s._over.call(s,i)))}})},dragStop:function(t,i){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)}},e.ui.droppable;var y="ui-effects-",b=e;e.effects={effect:{}},function(e,t){function i(e,t,i){var s=d[t.type]||{};return null==e?i||!t.def?null:t.def:(e=s.floor?~~e:parseFloat(e),isNaN(e)?t.def:s.mod?(e+s.mod)%s.mod:0>e?0:e>s.max?s.max:e)}function s(i){var s=l(),n=s._rgba=[];return i=i.toLowerCase(),f(h,function(e,a){var o,r=a.re.exec(i),h=r&&a.parse(r),l=a.space||"rgba";return h?(o=s[l](h),s[u[l].cache]=o[u[l].cache],n=s._rgba=o._rgba,!1):t}),n.length?("0,0,0,0"===n.join()&&e.extend(n,a.transparent),s):a[i]}function n(e,t,i){return i=(i+1)%1,1>6*i?e+6*(t-e)*i:1>2*i?t:2>3*i?e+6*(t-e)*(2/3-i):e}var a,o="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",r=/^([\-+])=\s*(\d+\.?\d*)/,h=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[2.55*e[1],2.55*e[2],2.55*e[3],e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],l=e.Color=function(t,i,s,n){return new e.Color.fn.parse(t,i,s,n)},u={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},d={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},c=l.support={},p=e("<p>")[0],f=e.each;p.style.cssText="background-color:rgba(1,1,1,.5)",c.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(u,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),l.fn=e.extend(l.prototype,{parse:function(n,o,r,h){if(n===t)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=e(n).css(o),o=t);var d=this,c=e.type(n),p=this._rgba=[];return o!==t&&(n=[n,o,r,h],c="array"),"string"===c?this.parse(s(n)||a._default):"array"===c?(f(u.rgba.props,function(e,t){p[t.idx]=i(n[t.idx],t)}),this):"object"===c?(n instanceof l?f(u,function(e,t){n[t.cache]&&(d[t.cache]=n[t.cache].slice())}):f(u,function(t,s){var a=s.cache;f(s.props,function(e,t){if(!d[a]&&s.to){if("alpha"===e||null==n[e])return;d[a]=s.to(d._rgba)}d[a][t.idx]=i(n[e],t,!0)}),d[a]&&0>e.inArray(null,d[a].slice(0,3))&&(d[a][3]=1,s.from&&(d._rgba=s.from(d[a])))}),this):t},is:function(e){var i=l(e),s=!0,n=this;return f(u,function(e,a){var o,r=i[a.cache];return r&&(o=n[a.cache]||a.to&&a.to(n._rgba)||[],f(a.props,function(e,i){return null!=r[i.idx]?s=r[i.idx]===o[i.idx]:t})),s}),s},_space:function(){var e=[],t=this;return f(u,function(i,s){t[s.cache]&&e.push(i)}),e.pop()},transition:function(e,t){var s=l(e),n=s._space(),a=u[n],o=0===this.alpha()?l("transparent"):this,r=o[a.cache]||a.to(o._rgba),h=r.slice();return s=s[a.cache],f(a.props,function(e,n){var a=n.idx,o=r[a],l=s[a],u=d[n.type]||{};null!==l&&(null===o?h[a]=l:(u.mod&&(l-o>u.mod/2?o+=u.mod:o-l>u.mod/2&&(o-=u.mod)),h[a]=i((l-o)*t+o,n)))}),this[n](h)},blend:function(t){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),n=l(t)._rgba;return l(e.map(i,function(e,t){return(1-s)*n[t]+s*e}))},toRgbaString:function(){var t="rgba(",i=e.map(this._rgba,function(e,t){return null==e?t>2?1:0:e});return 1===i[3]&&(i.pop(),t="rgb("),t+i.join()+")"},toHslaString:function(){var t="hsla(",i=e.map(this.hsla(),function(e,t){return null==e&&(e=t>2?1:0),t&&3>t&&(e=Math.round(100*e)+"%"),e});return 1===i[3]&&(i.pop(),t="hsl("),t+i.join()+")"},toHexString:function(t){var i=this._rgba.slice(),s=i.pop();return t&&i.push(~~(255*s)),"#"+e.map(i,function(e){return e=(e||0).toString(16),1===e.length?"0"+e:e}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,u.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t,i,s=e[0]/255,n=e[1]/255,a=e[2]/255,o=e[3],r=Math.max(s,n,a),h=Math.min(s,n,a),l=r-h,u=r+h,d=.5*u;return t=h===r?0:s===r?60*(n-a)/l+360:n===r?60*(a-s)/l+120:60*(s-n)/l+240,i=0===l?0:.5>=d?l/u:l/(2-u),[Math.round(t)%360,i,d,null==o?1:o]},u.hsla.from=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/360,i=e[1],s=e[2],a=e[3],o=.5>=s?s*(1+i):s+i-s*i,r=2*s-o;return[Math.round(255*n(r,o,t+1/3)),Math.round(255*n(r,o,t)),Math.round(255*n(r,o,t-1/3)),a]},f(u,function(s,n){var a=n.props,o=n.cache,h=n.to,u=n.from;l.fn[s]=function(s){if(h&&!this[o]&&(this[o]=h(this._rgba)),s===t)return this[o].slice();var n,r=e.type(s),d="array"===r||"object"===r?s:arguments,c=this[o].slice();return f(a,function(e,t){var s=d["object"===r?e:t.idx];null==s&&(s=c[t.idx]),c[t.idx]=i(s,t)}),u?(n=l(u(c)),n[o]=c,n):l(c)},f(a,function(t,i){l.fn[t]||(l.fn[t]=function(n){var a,o=e.type(n),h="alpha"===t?this._hsla?"hsla":"rgba":s,l=this[h](),u=l[i.idx];return"undefined"===o?u:("function"===o&&(n=n.call(this,u),o=e.type(n)),null==n&&i.empty?this:("string"===o&&(a=r.exec(n),a&&(n=u+parseFloat(a[2])*("+"===a[1]?1:-1))),l[i.idx]=n,this[h](l)))})})}),l.hook=function(t){var i=t.split(" ");f(i,function(t,i){e.cssHooks[i]={set:function(t,n){var a,o,r="";if("transparent"!==n&&("string"!==e.type(n)||(a=s(n)))){if(n=l(a||n),!c.rgba&&1!==n._rgba[3]){for(o="backgroundColor"===i?t.parentNode:t;(""===r||"transparent"===r)&&o&&o.style;)try{r=e.css(o,"backgroundColor"),o=o.parentNode}catch(h){}n=n.blend(r&&"transparent"!==r?r:"_default")}n=n.toRgbaString()}try{t.style[i]=n}catch(h){}}},e.fx.step[i]=function(t){t.colorInit||(t.start=l(t.elem,i),t.end=l(t.end),t.colorInit=!0),e.cssHooks[i].set(t.elem,t.start.transition(t.end,t.pos))}})},l.hook(o),e.cssHooks.borderColor={expand:function(e){var t={};return f(["Top","Right","Bottom","Left"],function(i,s){t["border"+s+"Color"]=e}),t}},a=e.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(b),function(){function t(t){var i,s,n=t.ownerDocument.defaultView?t.ownerDocument.defaultView.getComputedStyle(t,null):t.currentStyle,a={};if(n&&n.length&&n[0]&&n[n[0]])for(s=n.length;s--;)i=n[s],"string"==typeof n[i]&&(a[e.camelCase(i)]=n[i]);else for(i in n)"string"==typeof n[i]&&(a[i]=n[i]);return a}function i(t,i){var s,a,o={};for(s in i)a=i[s],t[s]!==a&&(n[s]||(e.fx.step[s]||!isNaN(parseFloat(a)))&&(o[s]=a));return o}var s=["add","remove","toggle"],n={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};e.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(t,i){e.fx.step[i]=function(e){("none"!==e.end&&!e.setAttr||1===e.pos&&!e.setAttr)&&(b.style(e.elem,i,e.end),e.setAttr=!0)}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e.effects.animateClass=function(n,a,o,r){var h=e.speed(a,o,r);return this.queue(function(){var a,o=e(this),r=o.attr("class")||"",l=h.children?o.find("*").addBack():o;l=l.map(function(){var i=e(this);return{el:i,start:t(this)}}),a=function(){e.each(s,function(e,t){n[t]&&o[t+"Class"](n[t])})},a(),l=l.map(function(){return this.end=t(this.el[0]),this.diff=i(this.start,this.end),this}),o.attr("class",r),l=l.map(function(){var t=this,i=e.Deferred(),s=e.extend({},h,{queue:!1,complete:function(){i.resolve(t)}});return this.el.animate(this.diff,s),i.promise()}),e.when.apply(e,l.get()).done(function(){a(),e.each(arguments,function(){var t=this.el;e.each(this.diff,function(e){t.css(e,"")})}),h.complete.call(o[0])})})},e.fn.extend({addClass:function(t){return function(i,s,n,a){return s?e.effects.animateClass.call(this,{add:i},s,n,a):t.apply(this,arguments)}}(e.fn.addClass),removeClass:function(t){return function(i,s,n,a){return arguments.length>1?e.effects.animateClass.call(this,{remove:i},s,n,a):t.apply(this,arguments)}}(e.fn.removeClass),toggleClass:function(t){return function(i,s,n,a,o){return"boolean"==typeof s||void 0===s?n?e.effects.animateClass.call(this,s?{add:i}:{remove:i},n,a,o):t.apply(this,arguments):e.effects.animateClass.call(this,{toggle:i},s,n,a)}}(e.fn.toggleClass),switchClass:function(t,i,s,n,a){return e.effects.animateClass.call(this,{add:i,remove:t},s,n,a)}})}(),function(){function t(t,i,s,n){return e.isPlainObject(t)&&(i=t,t=t.effect),t={effect:t},null==i&&(i={}),e.isFunction(i)&&(n=i,s=null,i={}),("number"==typeof i||e.fx.speeds[i])&&(n=s,s=i,i={}),e.isFunction(s)&&(n=s,s=null),i&&e.extend(t,i),s=s||i.duration,t.duration=e.fx.off?0:"number"==typeof s?s:s in e.fx.speeds?e.fx.speeds[s]:e.fx.speeds._default,t.complete=n||i.complete,t}function i(t){return!t||"number"==typeof t||e.fx.speeds[t]?!0:"string"!=typeof t||e.effects.effect[t]?e.isFunction(t)?!0:"object"!=typeof t||t.effect?!1:!0:!0}e.extend(e.effects,{version:"1.11.4",save:function(e,t){for(var i=0;t.length>i;i++)null!==t[i]&&e.data(y+t[i],e[0].style[t[i]])},restore:function(e,t){var i,s;for(s=0;t.length>s;s++)null!==t[s]&&(i=e.data(y+t[s]),void 0===i&&(i=""),e.css(t[s],i))},setMode:function(e,t){return"toggle"===t&&(t=e.is(":hidden")?"show":"hide"),t},getBaseline:function(e,t){var i,s;switch(e[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=e[0]/t.height}switch(e[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=e[1]/t.width}return{x:s,y:i}},createWrapper:function(t){if(t.parent().is(".ui-effects-wrapper"))return t.parent();var i={width:t.outerWidth(!0),height:t.outerHeight(!0),"float":t.css("float")},s=e("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),n={width:t.width(),height:t.height()},a=document.activeElement;try{a.id}catch(o){a=document.body}return t.wrap(s),(t[0]===a||e.contains(t[0],a))&&e(a).focus(),s=t.parent(),"static"===t.css("position")?(s.css({position:"relative"}),t.css({position:"relative"})):(e.extend(i,{position:t.css("position"),zIndex:t.css("z-index")}),e.each(["top","left","bottom","right"],function(e,s){i[s]=t.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),t.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),t.css(n),s.css(i).show()},removeWrapper:function(t){var i=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),(t[0]===i||e.contains(t[0],i))&&e(i).focus()),t},setTransition:function(t,i,s,n){return n=n||{},e.each(i,function(e,i){var a=t.cssUnit(i);a[0]>0&&(n[i]=a[0]*s+a[1])}),n}}),e.fn.extend({effect:function(){function i(t){function i(){e.isFunction(a)&&a.call(n[0]),e.isFunction(t)&&t()}var n=e(this),a=s.complete,r=s.mode;(n.is(":hidden")?"hide"===r:"show"===r)?(n[r](),i()):o.call(n[0],s,i)}var s=t.apply(this,arguments),n=s.mode,a=s.queue,o=e.effects.effect[s.effect];return e.fx.off||!o?n?this[n](s.duration,s.complete):this.each(function(){s.complete&&s.complete.call(this)}):a===!1?this.each(i):this.queue(a||"fx",i)},show:function(e){return function(s){if(i(s))return e.apply(this,arguments);var n=t.apply(this,arguments);return n.mode="show",this.effect.call(this,n)}}(e.fn.show),hide:function(e){return function(s){if(i(s))return e.apply(this,arguments);var n=t.apply(this,arguments);return n.mode="hide",this.effect.call(this,n)}}(e.fn.hide),toggle:function(e){return function(s){if(i(s)||"boolean"==typeof s)return e.apply(this,arguments);var n=t.apply(this,arguments);return n.mode="toggle",this.effect.call(this,n)}}(e.fn.toggle),cssUnit:function(t){var i=this.css(t),s=[];return e.each(["em","px","%","pt"],function(e,t){i.indexOf(t)>0&&(s=[parseFloat(i),t])}),s}})}(),function(){var t={};e.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,i){t[i]=function(t){return Math.pow(t,e+2)}}),e.extend(t,{Sine:function(e){return 1-Math.cos(e*Math.PI/2)},Circ:function(e){return 1-Math.sqrt(1-e*e)},Elastic:function(e){return 0===e||1===e?e:-Math.pow(2,8*(e-1))*Math.sin((80*(e-1)-7.5)*Math.PI/15)},Back:function(e){return e*e*(3*e-2)},Bounce:function(e){for(var t,i=4;((t=Math.pow(2,--i))-1)/11>e;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*t-2)/22-e,2)}}),e.each(t,function(t,i){e.easing["easeIn"+t]=i,e.easing["easeOut"+t]=function(e){return 1-i(1-e)},e.easing["easeInOut"+t]=function(e){return.5>e?i(2*e)/2:1-i(-2*e+2)/2}})}(),e.effects,e.effects.effect.blind=function(t,i){var s,n,a,o=e(this),r=/up|down|vertical/,h=/up|left|vertical|horizontal/,l=["position","top","bottom","left","right","height","width"],u=e.effects.setMode(o,t.mode||"hide"),d=t.direction||"up",c=r.test(d),p=c?"height":"width",f=c?"top":"left",m=h.test(d),g={},v="show"===u;o.parent().is(".ui-effects-wrapper")?e.effects.save(o.parent(),l):e.effects.save(o,l),o.show(),s=e.effects.createWrapper(o).css({overflow:"hidden"}),n=s[p](),a=parseFloat(s.css(f))||0,g[p]=v?n:0,m||(o.css(c?"bottom":"right",0).css(c?"top":"left","auto").css({position:"absolute"}),g[f]=v?a:n+a),v&&(s.css(p,0),m||s.css(f,a+n)),s.animate(g,{duration:t.duration,easing:t.easing,queue:!1,complete:function(){"hide"===u&&o.hide(),e.effects.restore(o,l),e.effects.removeWrapper(o),i()}})},e.effects.effect.bounce=function(t,i){var s,n,a,o=e(this),r=["position","top","bottom","left","right","height","width"],h=e.effects.setMode(o,t.mode||"effect"),l="hide"===h,u="show"===h,d=t.direction||"up",c=t.distance,p=t.times||5,f=2*p+(u||l?1:0),m=t.duration/f,g=t.easing,v="up"===d||"down"===d?"top":"left",y="up"===d||"left"===d,b=o.queue(),_=b.length;for((u||l)&&r.push("opacity"),e.effects.save(o,r),o.show(),e.effects.createWrapper(o),c||(c=o["top"===v?"outerHeight":"outerWidth"]()/3),u&&(a={opacity:1},a[v]=0,o.css("opacity",0).css(v,y?2*-c:2*c).animate(a,m,g)),l&&(c/=Math.pow(2,p-1)),a={},a[v]=0,s=0;p>s;s++)n={},n[v]=(y?"-=":"+=")+c,o.animate(n,m,g).animate(a,m,g),c=l?2*c:c/2;l&&(n={opacity:0},n[v]=(y?"-=":"+=")+c,o.animate(n,m,g)),o.queue(function(){l&&o.hide(),e.effects.restore(o,r),e.effects.removeWrapper(o),i()}),_>1&&b.splice.apply(b,[1,0].concat(b.splice(_,f+1))),o.dequeue()},e.effects.effect.clip=function(t,i){var s,n,a,o=e(this),r=["position","top","bottom","left","right","height","width"],h=e.effects.setMode(o,t.mode||"hide"),l="show"===h,u=t.direction||"vertical",d="vertical"===u,c=d?"height":"width",p=d?"top":"left",f={};e.effects.save(o,r),o.show(),s=e.effects.createWrapper(o).css({overflow:"hidden"}),n="IMG"===o[0].tagName?s:o,a=n[c](),l&&(n.css(c,0),n.css(p,a/2)),f[c]=l?a:0,f[p]=l?0:a/2,n.animate(f,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){l||o.hide(),e.effects.restore(o,r),e.effects.removeWrapper(o),i()}})},e.effects.effect.drop=function(t,i){var s,n=e(this),a=["position","top","bottom","left","right","opacity","height","width"],o=e.effects.setMode(n,t.mode||"hide"),r="show"===o,h=t.direction||"left",l="up"===h||"down"===h?"top":"left",u="up"===h||"left"===h?"pos":"neg",d={opacity:r?1:0};e.effects.save(n,a),n.show(),e.effects.createWrapper(n),s=t.distance||n["top"===l?"outerHeight":"outerWidth"](!0)/2,r&&n.css("opacity",0).css(l,"pos"===u?-s:s),d[l]=(r?"pos"===u?"+=":"-=":"pos"===u?"-=":"+=")+s,n.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===o&&n.hide(),e.effects.restore(n,a),e.effects.removeWrapper(n),i()}})},e.effects.effect.explode=function(t,i){function s(){b.push(this),b.length===d*c&&n()}function n(){p.css({visibility:"visible"}),e(b).remove(),m||p.hide(),i()}var a,o,r,h,l,u,d=t.pieces?Math.round(Math.sqrt(t.pieces)):3,c=d,p=e(this),f=e.effects.setMode(p,t.mode||"hide"),m="show"===f,g=p.show().css("visibility","hidden").offset(),v=Math.ceil(p.outerWidth()/c),y=Math.ceil(p.outerHeight()/d),b=[];for(a=0;d>a;a++)for(h=g.top+a*y,u=a-(d-1)/2,o=0;c>o;o++)r=g.left+o*v,l=o-(c-1)/2,p.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-o*v,top:-a*y}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:v,height:y,left:r+(m?l*v:0),top:h+(m?u*y:0),opacity:m?0:1}).animate({left:r+(m?0:l*v),top:h+(m?0:u*y),opacity:m?1:0},t.duration||500,t.easing,s)},e.effects.effect.fade=function(t,i){var s=e(this),n=e.effects.setMode(s,t.mode||"toggle");s.animate({opacity:n},{queue:!1,duration:t.duration,easing:t.easing,complete:i})},e.effects.effect.fold=function(t,i){var s,n,a=e(this),o=["position","top","bottom","left","right","height","width"],r=e.effects.setMode(a,t.mode||"hide"),h="show"===r,l="hide"===r,u=t.size||15,d=/([0-9]+)%/.exec(u),c=!!t.horizFirst,p=h!==c,f=p?["width","height"]:["height","width"],m=t.duration/2,g={},v={};e.effects.save(a,o),a.show(),s=e.effects.createWrapper(a).css({overflow:"hidden"}),n=p?[s.width(),s.height()]:[s.height(),s.width()],d&&(u=parseInt(d[1],10)/100*n[l?0:1]),h&&s.css(c?{height:0,width:u}:{height:u,width:0}),g[f[0]]=h?n[0]:u,v[f[1]]=h?n[1]:0,s.animate(g,m,t.easing).animate(v,m,t.easing,function(){l&&a.hide(),e.effects.restore(a,o),e.effects.removeWrapper(a),i()})},e.effects.effect.highlight=function(t,i){var s=e(this),n=["backgroundImage","backgroundColor","opacity"],a=e.effects.setMode(s,t.mode||"show"),o={backgroundColor:s.css("backgroundColor")};"hide"===a&&(o.opacity=0),e.effects.save(s,n),s.show().css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(o,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===a&&s.hide(),e.effects.restore(s,n),i()}})},e.effects.effect.size=function(t,i){var s,n,a,o=e(this),r=["position","top","bottom","left","right","width","height","overflow","opacity"],h=["position","top","bottom","left","right","overflow","opacity"],l=["width","height","overflow"],u=["fontSize"],d=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],c=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=e.effects.setMode(o,t.mode||"effect"),f=t.restore||"effect"!==p,m=t.scale||"both",g=t.origin||["middle","center"],v=o.css("position"),y=f?r:h,b={height:0,width:0,outerHeight:0,outerWidth:0};"show"===p&&o.show(),s={height:o.height(),width:o.width(),outerHeight:o.outerHeight(),outerWidth:o.outerWidth()},"toggle"===t.mode&&"show"===p?(o.from=t.to||b,o.to=t.from||s):(o.from=t.from||("show"===p?b:s),o.to=t.to||("hide"===p?b:s)),a={from:{y:o.from.height/s.height,x:o.from.width/s.width},to:{y:o.to.height/s.height,x:o.to.width/s.width}},("box"===m||"both"===m)&&(a.from.y!==a.to.y&&(y=y.concat(d),o.from=e.effects.setTransition(o,d,a.from.y,o.from),o.to=e.effects.setTransition(o,d,a.to.y,o.to)),a.from.x!==a.to.x&&(y=y.concat(c),o.from=e.effects.setTransition(o,c,a.from.x,o.from),o.to=e.effects.setTransition(o,c,a.to.x,o.to))),("content"===m||"both"===m)&&a.from.y!==a.to.y&&(y=y.concat(u).concat(l),o.from=e.effects.setTransition(o,u,a.from.y,o.from),o.to=e.effects.setTransition(o,u,a.to.y,o.to)),e.effects.save(o,y),o.show(),e.effects.createWrapper(o),o.css("overflow","hidden").css(o.from),g&&(n=e.effects.getBaseline(g,s),o.from.top=(s.outerHeight-o.outerHeight())*n.y,o.from.left=(s.outerWidth-o.outerWidth())*n.x,o.to.top=(s.outerHeight-o.to.outerHeight)*n.y,o.to.left=(s.outerWidth-o.to.outerWidth)*n.x),o.css(o.from),("content"===m||"both"===m)&&(d=d.concat(["marginTop","marginBottom"]).concat(u),c=c.concat(["marginLeft","marginRight"]),l=r.concat(d).concat(c),o.find("*[width]").each(function(){var i=e(this),s={height:i.height(),width:i.width(),outerHeight:i.outerHeight(),outerWidth:i.outerWidth()}; f&&e.effects.save(i,l),i.from={height:s.height*a.from.y,width:s.width*a.from.x,outerHeight:s.outerHeight*a.from.y,outerWidth:s.outerWidth*a.from.x},i.to={height:s.height*a.to.y,width:s.width*a.to.x,outerHeight:s.height*a.to.y,outerWidth:s.width*a.to.x},a.from.y!==a.to.y&&(i.from=e.effects.setTransition(i,d,a.from.y,i.from),i.to=e.effects.setTransition(i,d,a.to.y,i.to)),a.from.x!==a.to.x&&(i.from=e.effects.setTransition(i,c,a.from.x,i.from),i.to=e.effects.setTransition(i,c,a.to.x,i.to)),i.css(i.from),i.animate(i.to,t.duration,t.easing,function(){f&&e.effects.restore(i,l)})})),o.animate(o.to,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){0===o.to.opacity&&o.css("opacity",o.from.opacity),"hide"===p&&o.hide(),e.effects.restore(o,y),f||("static"===v?o.css({position:"relative",top:o.to.top,left:o.to.left}):e.each(["top","left"],function(e,t){o.css(t,function(t,i){var s=parseInt(i,10),n=e?o.to.left:o.to.top;return"auto"===i?n+"px":s+n+"px"})})),e.effects.removeWrapper(o),i()}})},e.effects.effect.scale=function(t,i){var s=e(this),n=e.extend(!0,{},t),a=e.effects.setMode(s,t.mode||"effect"),o=parseInt(t.percent,10)||(0===parseInt(t.percent,10)?0:"hide"===a?0:100),r=t.direction||"both",h=t.origin,l={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()},u={y:"horizontal"!==r?o/100:1,x:"vertical"!==r?o/100:1};n.effect="size",n.queue=!1,n.complete=i,"effect"!==a&&(n.origin=h||["middle","center"],n.restore=!0),n.from=t.from||("show"===a?{height:0,width:0,outerHeight:0,outerWidth:0}:l),n.to={height:l.height*u.y,width:l.width*u.x,outerHeight:l.outerHeight*u.y,outerWidth:l.outerWidth*u.x},n.fade&&("show"===a&&(n.from.opacity=0,n.to.opacity=1),"hide"===a&&(n.from.opacity=1,n.to.opacity=0)),s.effect(n)},e.effects.effect.puff=function(t,i){var s=e(this),n=e.effects.setMode(s,t.mode||"hide"),a="hide"===n,o=parseInt(t.percent,10)||150,r=o/100,h={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()};e.extend(t,{effect:"scale",queue:!1,fade:!0,mode:n,complete:i,percent:a?o:100,from:a?h:{height:h.height*r,width:h.width*r,outerHeight:h.outerHeight*r,outerWidth:h.outerWidth*r}}),s.effect(t)},e.effects.effect.pulsate=function(t,i){var s,n=e(this),a=e.effects.setMode(n,t.mode||"show"),o="show"===a,r="hide"===a,h=o||"hide"===a,l=2*(t.times||5)+(h?1:0),u=t.duration/l,d=0,c=n.queue(),p=c.length;for((o||!n.is(":visible"))&&(n.css("opacity",0).show(),d=1),s=1;l>s;s++)n.animate({opacity:d},u,t.easing),d=1-d;n.animate({opacity:d},u,t.easing),n.queue(function(){r&&n.hide(),i()}),p>1&&c.splice.apply(c,[1,0].concat(c.splice(p,l+1))),n.dequeue()},e.effects.effect.shake=function(t,i){var s,n=e(this),a=["position","top","bottom","left","right","height","width"],o=e.effects.setMode(n,t.mode||"effect"),r=t.direction||"left",h=t.distance||20,l=t.times||3,u=2*l+1,d=Math.round(t.duration/u),c="up"===r||"down"===r?"top":"left",p="up"===r||"left"===r,f={},m={},g={},v=n.queue(),y=v.length;for(e.effects.save(n,a),n.show(),e.effects.createWrapper(n),f[c]=(p?"-=":"+=")+h,m[c]=(p?"+=":"-=")+2*h,g[c]=(p?"-=":"+=")+2*h,n.animate(f,d,t.easing),s=1;l>s;s++)n.animate(m,d,t.easing).animate(g,d,t.easing);n.animate(m,d,t.easing).animate(f,d/2,t.easing).queue(function(){"hide"===o&&n.hide(),e.effects.restore(n,a),e.effects.removeWrapper(n),i()}),y>1&&v.splice.apply(v,[1,0].concat(v.splice(y,u+1))),n.dequeue()},e.effects.effect.slide=function(t,i){var s,n=e(this),a=["position","top","bottom","left","right","width","height"],o=e.effects.setMode(n,t.mode||"show"),r="show"===o,h=t.direction||"left",l="up"===h||"down"===h?"top":"left",u="up"===h||"left"===h,d={};e.effects.save(n,a),n.show(),s=t.distance||n["top"===l?"outerHeight":"outerWidth"](!0),e.effects.createWrapper(n).css({overflow:"hidden"}),r&&n.css(l,u?isNaN(s)?"-"+s:-s:s),d[l]=(r?u?"+=":"-=":u?"-=":"+=")+s,n.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===o&&n.hide(),e.effects.restore(n,a),e.effects.removeWrapper(n),i()}})},e.effects.effect.transfer=function(t,i){var s=e(this),n=e(t.to),a="fixed"===n.css("position"),o=e("body"),r=a?o.scrollTop():0,h=a?o.scrollLeft():0,l=n.offset(),u={top:l.top-r,left:l.left-h,height:n.innerHeight(),width:n.innerWidth()},d=s.offset(),c=e("<div class='ui-effects-transfer'></div>").appendTo(document.body).addClass(t.className).css({top:d.top-r,left:d.left-h,height:s.innerHeight(),width:s.innerWidth(),position:a?"fixed":"absolute"}).animate(u,t.duration,t.easing,function(){c.remove(),i()})},e.widget("ui.progressbar",{version:"1.11.4",options:{max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min}),this.valueDiv=e("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),this._refreshValue()},_destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove()},value:function(e){return void 0===e?this.options.value:(this.options.value=this._constrainedValue(e),this._refreshValue(),void 0)},_constrainedValue:function(e){return void 0===e&&(e=this.options.value),this.indeterminate=e===!1,"number"!=typeof e&&(e=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,e))},_setOptions:function(e){var t=e.value;delete e.value,this._super(e),this.options.value=this._constrainedValue(t),this._refreshValue()},_setOption:function(e,t){"max"===e&&(t=Math.max(this.min,t)),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var t=this.options.value,i=this._percentage();this.valueDiv.toggle(this.indeterminate||t>this.min).toggleClass("ui-corner-right",t===this.options.max).width(i.toFixed(0)+"%"),this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=e("<div class='ui-progressbar-overlay'></div>").appendTo(this.valueDiv))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":t}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==t&&(this.oldValue=t,this._trigger("change")),t===this.options.max&&this._trigger("complete")}}),e.widget("ui.selectable",e.ui.mouse,{version:"1.11.4",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var t,i=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){t=e(i.options.filter,i.element[0]),t.addClass("ui-selectee"),t.each(function(){var t=e(this),i=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:i.left,top:i.top,right:i.left+t.outerWidth(),bottom:i.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=t.addClass("ui-selectee"),this._mouseInit(),this.helper=e("<div class='ui-selectable-helper'></div>")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(t){var i=this,s=this.options;this.opos=[t.pageX,t.pageY],this.options.disabled||(this.selectees=e(s.filter,this.element[0]),this._trigger("start",t),e(s.appendTo).append(this.helper),this.helper.css({left:t.pageX,top:t.pageY,width:0,height:0}),s.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var s=e.data(this,"selectable-item");s.startselected=!0,t.metaKey||t.ctrlKey||(s.$element.removeClass("ui-selected"),s.selected=!1,s.$element.addClass("ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",t,{unselecting:s.element}))}),e(t.target).parents().addBack().each(function(){var s,n=e.data(this,"selectable-item");return n?(s=!t.metaKey&&!t.ctrlKey||!n.$element.hasClass("ui-selected"),n.$element.removeClass(s?"ui-unselecting":"ui-selected").addClass(s?"ui-selecting":"ui-unselecting"),n.unselecting=!s,n.selecting=s,n.selected=s,s?i._trigger("selecting",t,{selecting:n.element}):i._trigger("unselecting",t,{unselecting:n.element}),!1):void 0}))},_mouseDrag:function(t){if(this.dragged=!0,!this.options.disabled){var i,s=this,n=this.options,a=this.opos[0],o=this.opos[1],r=t.pageX,h=t.pageY;return a>r&&(i=r,r=a,a=i),o>h&&(i=h,h=o,o=i),this.helper.css({left:a,top:o,width:r-a,height:h-o}),this.selectees.each(function(){var i=e.data(this,"selectable-item"),l=!1;i&&i.element!==s.element[0]&&("touch"===n.tolerance?l=!(i.left>r||a>i.right||i.top>h||o>i.bottom):"fit"===n.tolerance&&(l=i.left>a&&r>i.right&&i.top>o&&h>i.bottom),l?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,s._trigger("selecting",t,{selecting:i.element}))):(i.selecting&&((t.metaKey||t.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",t,{unselecting:i.element}))),i.selected&&(t.metaKey||t.ctrlKey||i.startselected||(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",t,{unselecting:i.element})))))}),!1}},_mouseStop:function(t){var i=this;return this.dragged=!1,e(".ui-unselecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",t,{unselected:s.element})}),e(".ui-selecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-selecting").addClass("ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",t,{selected:s.element})}),this._trigger("stop",t),this.helper.remove(),!1}}),e.widget("ui.selectmenu",{version:"1.11.4",defaultElement:"<select>",options:{appendTo:null,disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:null,change:null,close:null,focus:null,open:null,select:null},_create:function(){var e=this.element.uniqueId().attr("id");this.ids={element:e,button:e+"-button",menu:e+"-menu"},this._drawButton(),this._drawMenu(),this.options.disabled&&this.disable()},_drawButton:function(){var t=this;this.label=e("label[for='"+this.ids.element+"']").attr("for",this.ids.button),this._on(this.label,{click:function(e){this.button.focus(),e.preventDefault()}}),this.element.hide(),this.button=e("<span>",{"class":"ui-selectmenu-button ui-widget ui-state-default ui-corner-all",tabindex:this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true"}).insertAfter(this.element),e("<span>",{"class":"ui-icon "+this.options.icons.button}).prependTo(this.button),this.buttonText=e("<span>",{"class":"ui-selectmenu-text"}).appendTo(this.button),this._setText(this.buttonText,this.element.find("option:selected").text()),this._resizeButton(),this._on(this.button,this._buttonEvents),this.button.one("focusin",function(){t.menuItems||t._refreshMenu()}),this._hoverable(this.button),this._focusable(this.button)},_drawMenu:function(){var t=this;this.menu=e("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=e("<div>",{"class":"ui-selectmenu-menu ui-front"}).append(this.menu).appendTo(this._appendTo()),this.menuInstance=this.menu.menu({role:"listbox",select:function(e,i){e.preventDefault(),t._setSelection(),t._select(i.item.data("ui-selectmenu-item"),e)},focus:function(e,i){var s=i.item.data("ui-selectmenu-item");null!=t.focusIndex&&s.index!==t.focusIndex&&(t._trigger("focus",e,{item:s}),t.isOpen||t._select(s,e)),t.focusIndex=s.index,t.button.attr("aria-activedescendant",t.menuItems.eq(s.index).attr("id"))}}).menu("instance"),this.menu.addClass("ui-corner-bottom").removeClass("ui-corner-all"),this.menuInstance._off(this.menu,"mouseleave"),this.menuInstance._closeOnDocumentClick=function(){return!1},this.menuInstance._isDivider=function(){return!1}},refresh:function(){this._refreshMenu(),this._setText(this.buttonText,this._getSelectedItem().text()),this.options.width||this._resizeButton()},_refreshMenu:function(){this.menu.empty();var e,t=this.element.find("option");t.length&&(this._parseOptions(t),this._renderMenu(this.menu,this.items),this.menuInstance.refresh(),this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup"),e=this._getSelectedItem(),this.menuInstance.focus(null,e),this._setAria(e.data("ui-selectmenu-item")),this._setOption("disabled",this.element.prop("disabled")))},open:function(e){this.options.disabled||(this.menuItems?(this.menu.find(".ui-state-focus").removeClass("ui-state-focus"),this.menuInstance.focus(null,this._getSelectedItem())):this._refreshMenu(),this.isOpen=!0,this._toggleAttr(),this._resizeMenu(),this._position(),this._on(this.document,this._documentClick),this._trigger("open",e))},_position:function(){this.menuWrap.position(e.extend({of:this.button},this.options.position))},close:function(e){this.isOpen&&(this.isOpen=!1,this._toggleAttr(),this.range=null,this._off(this.document),this._trigger("close",e))},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderMenu:function(t,i){var s=this,n="";e.each(i,function(i,a){a.optgroup!==n&&(e("<li>",{"class":"ui-selectmenu-optgroup ui-menu-divider"+(a.element.parent("optgroup").prop("disabled")?" ui-state-disabled":""),text:a.optgroup}).appendTo(t),n=a.optgroup),s._renderItemData(t,a)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-selectmenu-item",t)},_renderItem:function(t,i){var s=e("<li>");return i.disabled&&s.addClass("ui-state-disabled"),this._setText(s,i.label),s.appendTo(t)},_setText:function(e,t){t?e.text(t):e.html("&#160;")},_move:function(e,t){var i,s,n=".ui-menu-item";this.isOpen?i=this.menuItems.eq(this.focusIndex):(i=this.menuItems.eq(this.element[0].selectedIndex),n+=":not(.ui-state-disabled)"),s="first"===e||"last"===e?i["first"===e?"prevAll":"nextAll"](n).eq(-1):i[e+"All"](n).eq(0),s.length&&this.menuInstance.focus(t,s)},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex)},_toggle:function(e){this[this.isOpen?"close":"open"](e)},_setSelection:function(){var e;this.range&&(window.getSelection?(e=window.getSelection(),e.removeAllRanges(),e.addRange(this.range)):this.range.select(),this.button.focus())},_documentClick:{mousedown:function(t){this.isOpen&&(e(t.target).closest(".ui-selectmenu-menu, #"+this.ids.button).length||this.close(t))}},_buttonEvents:{mousedown:function(){var e;window.getSelection?(e=window.getSelection(),e.rangeCount&&(this.range=e.getRangeAt(0))):this.range=document.selection.createRange()},click:function(e){this._setSelection(),this._toggle(e)},keydown:function(t){var i=!0;switch(t.keyCode){case e.ui.keyCode.TAB:case e.ui.keyCode.ESCAPE:this.close(t),i=!1;break;case e.ui.keyCode.ENTER:this.isOpen&&this._selectFocusedItem(t);break;case e.ui.keyCode.UP:t.altKey?this._toggle(t):this._move("prev",t);break;case e.ui.keyCode.DOWN:t.altKey?this._toggle(t):this._move("next",t);break;case e.ui.keyCode.SPACE:this.isOpen?this._selectFocusedItem(t):this._toggle(t);break;case e.ui.keyCode.LEFT:this._move("prev",t);break;case e.ui.keyCode.RIGHT:this._move("next",t);break;case e.ui.keyCode.HOME:case e.ui.keyCode.PAGE_UP:this._move("first",t);break;case e.ui.keyCode.END:case e.ui.keyCode.PAGE_DOWN:this._move("last",t);break;default:this.menu.trigger(t),i=!1}i&&t.preventDefault()}},_selectFocusedItem:function(e){var t=this.menuItems.eq(this.focusIndex);t.hasClass("ui-state-disabled")||this._select(t.data("ui-selectmenu-item"),e)},_select:function(e,t){var i=this.element[0].selectedIndex;this.element[0].selectedIndex=e.index,this._setText(this.buttonText,e.label),this._setAria(e),this._trigger("select",t,{item:e}),e.index!==i&&this._trigger("change",t,{item:e}),this.close(t)},_setAria:function(e){var t=this.menuItems.eq(e.index).attr("id");this.button.attr({"aria-labelledby":t,"aria-activedescendant":t}),this.menu.attr("aria-activedescendant",t)},_setOption:function(e,t){"icons"===e&&this.button.find("span.ui-icon").removeClass(this.options.icons.button).addClass(t.button),this._super(e,t),"appendTo"===e&&this.menuWrap.appendTo(this._appendTo()),"disabled"===e&&(this.menuInstance.option("disabled",t),this.button.toggleClass("ui-state-disabled",t).attr("aria-disabled",t),this.element.prop("disabled",t),t?(this.button.attr("tabindex",-1),this.close()):this.button.attr("tabindex",0)),"width"===e&&this._resizeButton()},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t&&t[0]||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_toggleAttr:function(){this.button.toggleClass("ui-corner-top",this.isOpen).toggleClass("ui-corner-all",!this.isOpen).attr("aria-expanded",this.isOpen),this.menuWrap.toggleClass("ui-selectmenu-open",this.isOpen),this.menu.attr("aria-hidden",!this.isOpen)},_resizeButton:function(){var e=this.options.width;e||(e=this.element.show().outerWidth(),this.element.hide()),this.button.outerWidth(e)},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()+1))},_getCreateOptions:function(){return{disabled:this.element.prop("disabled")}},_parseOptions:function(t){var i=[];t.each(function(t,s){var n=e(s),a=n.parent("optgroup");i.push({element:n,index:t,value:n.val(),label:n.text(),optgroup:a.attr("label")||"",disabled:a.prop("disabled")||n.prop("disabled")})}),this.items=i},_destroy:function(){this.menuWrap.remove(),this.button.remove(),this.element.show(),this.element.removeUniqueId(),this.label.attr("for",this.ids.element)}}),e.widget("ui.slider",e.ui.mouse,{version:"1.11.4",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"),this._refresh(),this._setOption("disabled",this.options.disabled),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var t,i,s=this.options,n=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),a="<span class='ui-slider-handle ui-state-default ui-corner-all' tabindex='0'></span>",o=[];for(i=s.values&&s.values.length||1,n.length>i&&(n.slice(i).remove(),n=n.slice(0,i)),t=n.length;i>t;t++)o.push(a);this.handles=n.add(e(o.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.each(function(t){e(this).data("ui-slider-handle-index",t)})},_createRange:function(){var t=this.options,i="";t.range?(t.range===!0&&(t.values?t.values.length&&2!==t.values.length?t.values=[t.values[0],t.values[0]]:e.isArray(t.values)&&(t.values=t.values.slice(0)):t.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({left:"",bottom:""}):(this.range=e("<div></div>").appendTo(this.element),i="ui-slider-range ui-widget-header ui-corner-all"),this.range.addClass(i+("min"===t.range||"max"===t.range?" ui-slider-range-"+t.range:""))):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-widget ui-widget-content ui-corner-all"),this._mouseDestroy()},_mouseCapture:function(t){var i,s,n,a,o,r,h,l,u=this,d=this.options;return d.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:t.pageX,y:t.pageY},s=this._normValueFromMouse(i),n=this._valueMax()-this._valueMin()+1,this.handles.each(function(t){var i=Math.abs(s-u.values(t));(n>i||n===i&&(t===u._lastChangedValue||u.values(t)===d.min))&&(n=i,a=e(this),o=t)}),r=this._start(t,o),r===!1?!1:(this._mouseSliding=!0,this._handleIndex=o,a.addClass("ui-state-active").focus(),h=a.offset(),l=!e(t.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:t.pageX-h.left-a.width()/2,top:t.pageY-h.top-a.height()/2-(parseInt(a.css("borderTopWidth"),10)||0)-(parseInt(a.css("borderBottomWidth"),10)||0)+(parseInt(a.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(t,o,s),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(e){var t={x:e.pageX,y:e.pageY},i=this._normValueFromMouse(t);return this._slide(e,this._handleIndex,i),!1},_mouseStop:function(e){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(e,this._handleIndex),this._change(e,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(e){var t,i,s,n,a;return"horizontal"===this.orientation?(t=this.elementSize.width,i=e.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(t=this.elementSize.height,i=e.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),s=i/t,s>1&&(s=1),0>s&&(s=0),"vertical"===this.orientation&&(s=1-s),n=this._valueMax()-this._valueMin(),a=this._valueMin()+s*n,this._trimAlignValue(a)},_start:function(e,t){var i={handle:this.handles[t],value:this.value()};return this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("start",e,i)},_slide:function(e,t,i){var s,n,a;this.options.values&&this.options.values.length?(s=this.values(t?0:1),2===this.options.values.length&&this.options.range===!0&&(0===t&&i>s||1===t&&s>i)&&(i=s),i!==this.values(t)&&(n=this.values(),n[t]=i,a=this._trigger("slide",e,{handle:this.handles[t],value:i,values:n}),s=this.values(t?0:1),a!==!1&&this.values(t,i))):i!==this.value()&&(a=this._trigger("slide",e,{handle:this.handles[t],value:i}),a!==!1&&this.value(i))},_stop:function(e,t){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("stop",e,i)},_change:function(e,t){if(!this._keySliding&&!this._mouseSliding){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._lastChangedValue=t,this._trigger("change",e,i)}},value:function(e){return arguments.length?(this.options.value=this._trimAlignValue(e),this._refreshValue(),this._change(null,0),void 0):this._value()},values:function(t,i){var s,n,a;if(arguments.length>1)return this.options.values[t]=this._trimAlignValue(i),this._refreshValue(),this._change(null,t),void 0;if(!arguments.length)return this._values();if(!e.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(t):this.value();for(s=this.options.values,n=arguments[0],a=0;s.length>a;a+=1)s[a]=this._trimAlignValue(n[a]),this._change(null,a);this._refreshValue()},_setOption:function(t,i){var s,n=0;switch("range"===t&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),e.isArray(this.options.values)&&(n=this.options.values.length),"disabled"===t&&this.element.toggleClass("ui-state-disabled",!!i),this._super(t,i),t){case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue(),this.handles.css("horizontal"===i?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),s=0;n>s;s+=1)this._change(null,s);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_value:function(){var e=this.options.value;return e=this._trimAlignValue(e)},_values:function(e){var t,i,s;if(arguments.length)return t=this.options.values[e],t=this._trimAlignValue(t);if(this.options.values&&this.options.values.length){for(i=this.options.values.slice(),s=0;i.length>s;s+=1)i[s]=this._trimAlignValue(i[s]);return i}return[]},_trimAlignValue:function(e){if(this._valueMin()>=e)return this._valueMin();if(e>=this._valueMax())return this._valueMax();var t=this.options.step>0?this.options.step:1,i=(e-this._valueMin())%t,s=e-i;return 2*Math.abs(i)>=t&&(s+=i>0?t:-t),parseFloat(s.toFixed(5))},_calculateNewMax:function(){var e=this.options.max,t=this._valueMin(),i=this.options.step,s=Math.floor(+(e-t).toFixed(this._precision())/i)*i;e=s+t,this.max=parseFloat(e.toFixed(this._precision()))},_precision:function(){var e=this._precisionOf(this.options.step);return null!==this.options.min&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=""+e,i=t.indexOf(".");return-1===i?0:t.length-i-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshValue:function(){var t,i,s,n,a,o=this.options.range,r=this.options,h=this,l=this._animateOff?!1:r.animate,u={};this.options.values&&this.options.values.length?this.handles.each(function(s){i=100*((h.values(s)-h._valueMin())/(h._valueMax()-h._valueMin())),u["horizontal"===h.orientation?"left":"bottom"]=i+"%",e(this).stop(1,1)[l?"animate":"css"](u,r.animate),h.options.range===!0&&("horizontal"===h.orientation?(0===s&&h.range.stop(1,1)[l?"animate":"css"]({left:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({width:i-t+"%"},{queue:!1,duration:r.animate})):(0===s&&h.range.stop(1,1)[l?"animate":"css"]({bottom:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({height:i-t+"%"},{queue:!1,duration:r.animate}))),t=i}):(s=this.value(),n=this._valueMin(),a=this._valueMax(),i=a!==n?100*((s-n)/(a-n)):0,u["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[l?"animate":"css"](u,r.animate),"min"===o&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:i+"%"},r.animate),"max"===o&&"horizontal"===this.orientation&&this.range[l?"animate":"css"]({width:100-i+"%"},{queue:!1,duration:r.animate}),"min"===o&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:i+"%"},r.animate),"max"===o&&"vertical"===this.orientation&&this.range[l?"animate":"css"]({height:100-i+"%"},{queue:!1,duration:r.animate}))},_handleEvents:{keydown:function(t){var i,s,n,a,o=e(t.target).data("ui-slider-handle-index");switch(t.keyCode){case e.ui.keyCode.HOME:case e.ui.keyCode.END:case e.ui.keyCode.PAGE_UP:case e.ui.keyCode.PAGE_DOWN:case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(t.preventDefault(),!this._keySliding&&(this._keySliding=!0,e(t.target).addClass("ui-state-active"),i=this._start(t,o),i===!1))return}switch(a=this.options.step,s=n=this.options.values&&this.options.values.length?this.values(o):this.value(),t.keyCode){case e.ui.keyCode.HOME:n=this._valueMin();break;case e.ui.keyCode.END:n=this._valueMax();break;case e.ui.keyCode.PAGE_UP:n=this._trimAlignValue(s+(this._valueMax()-this._valueMin())/this.numPages);break;case e.ui.keyCode.PAGE_DOWN:n=this._trimAlignValue(s-(this._valueMax()-this._valueMin())/this.numPages);break;case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:if(s===this._valueMax())return;n=this._trimAlignValue(s+a);break;case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(s===this._valueMin())return;n=this._trimAlignValue(s-a)}this._slide(t,o,n)},keyup:function(t){var i=e(t.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(t,i),this._change(t,i),e(t.target).removeClass("ui-state-active"))}}}),e.widget("ui.sortable",e.ui.mouse,{version:"1.11.4",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(e,t,i){return e>=t&&t+i>e},_isFloating:function(e){return/left|right/.test(e.css("float"))||/inline|table-cell/.test(e.css("display"))},_create:function(){this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(e,t){this._super(e,t),"handle"===e&&this._setHandleClassName()},_setHandleClassName:function(){this.element.find(".ui-sortable-handle").removeClass("ui-sortable-handle"),e.each(this.items,function(){(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item).addClass("ui-sortable-handle")})},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").find(".ui-sortable-handle").removeClass("ui-sortable-handle"),this._mouseDestroy();for(var e=this.items.length-1;e>=0;e--)this.items[e].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(t,i){var s=null,n=!1,a=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(t),e(t.target).parents().each(function(){return e.data(this,a.widgetName+"-item")===a?(s=e(this),!1):void 0}),e.data(t.target,a.widgetName+"-item")===a&&(s=e(t.target)),s?!this.options.handle||i||(e(this.options.handle,s).find("*").addBack().each(function(){this===t.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(t,i,s){var n,a,o=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),o.containment&&this._setContainment(),o.cursor&&"auto"!==o.cursor&&(a=this.document.find("body"),this.storedCursor=a.css("cursor"),a.css("cursor",o.cursor),this.storedStylesheet=e("<style>*{ cursor: "+o.cursor+" !important; }</style>").appendTo(a)),o.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",o.opacity)),o.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",o.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",t,this._uiHash(this)); return e.ui.ddmanager&&(e.ui.ddmanager.current=this),e.ui.ddmanager&&!o.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){var i,s,n,a,o=this.options,r=!1;for(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<o.scrollSensitivity?this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop+o.scrollSpeed:t.pageY-this.overflowOffset.top<o.scrollSensitivity&&(this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop-o.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<o.scrollSensitivity?this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft+o.scrollSpeed:t.pageX-this.overflowOffset.left<o.scrollSensitivity&&(this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft-o.scrollSpeed)):(t.pageY-this.document.scrollTop()<o.scrollSensitivity?r=this.document.scrollTop(this.document.scrollTop()-o.scrollSpeed):this.window.height()-(t.pageY-this.document.scrollTop())<o.scrollSensitivity&&(r=this.document.scrollTop(this.document.scrollTop()+o.scrollSpeed)),t.pageX-this.document.scrollLeft()<o.scrollSensitivity?r=this.document.scrollLeft(this.document.scrollLeft()-o.scrollSpeed):this.window.width()-(t.pageX-this.document.scrollLeft())<o.scrollSensitivity&&(r=this.document.scrollLeft(this.document.scrollLeft()+o.scrollSpeed))),r!==!1&&e.ui.ddmanager&&!o.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),i=this.items.length-1;i>=0;i--)if(s=this.items[i],n=s.item[0],a=this._intersectsWithPointer(s),a&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===a?"next":"prev"]()[0]!==n&&!e.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!e.contains(this.element[0],n):!0)){if(this.direction=1===a?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(t,s),this._trigger("change",t,this._uiHash());break}return this._contactContainers(t),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,i){if(t){if(e.ui.ddmanager&&!this.options.dropBehaviour&&e.ui.ddmanager.drop(this,t),this.options.revert){var s=this,n=this.placeholder.offset(),a=this.options.axis,o={};a&&"x"!==a||(o.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),a&&"y"!==a||(o.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,e(this.helper).animate(o,parseInt(this.options.revert,10)||500,function(){s._clear(t)})}else this._clear(t,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var t=this.containers.length-1;t>=0;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),e.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?e(this.domPosition.prev).after(this.currentItem):e(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(t){var i=this._getItemsAsjQuery(t&&t.connected),s=[];return t=t||{},e(i).each(function(){var i=(e(t.item||this).attr(t.attribute||"id")||"").match(t.expression||/(.+)[\-=_](.+)/);i&&s.push((t.key||i[1]+"[]")+"="+(t.key&&t.expression?i[1]:i[2]))}),!s.length&&t.key&&s.push(t.key+"="),s.join("&")},toArray:function(t){var i=this._getItemsAsjQuery(t&&t.connected),s=[];return t=t||{},i.each(function(){s.push(e(t.item||this).attr(t.attribute||"id")||"")}),s},_intersectsWith:function(e){var t=this.positionAbs.left,i=t+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,a=e.left,o=a+e.width,r=e.top,h=r+e.height,l=this.offset.click.top,u=this.offset.click.left,d="x"===this.options.axis||s+l>r&&h>s+l,c="y"===this.options.axis||t+u>a&&o>t+u,p=d&&c;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>e[this.floating?"width":"height"]?p:t+this.helperProportions.width/2>a&&o>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&h>n-this.helperProportions.height/2},_intersectsWithPointer:function(e){var t="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top,e.height),i="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left,e.width),s=t&&i,n=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return s?this.floating?a&&"right"===a||"down"===n?2:1:n&&("down"===n?2:1):!1},_intersectsWithSides:function(e){var t=this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top+e.height/2,e.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left+e.width/2,e.width),s=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return this.floating&&n?"right"===n&&i||"left"===n&&!i:s&&("down"===s&&t||"up"===s&&!t)},_getDragVerticalDirection:function(){var e=this.positionAbs.top-this.lastPositionAbs.top;return 0!==e&&(e>0?"down":"up")},_getDragHorizontalDirection:function(){var e=this.positionAbs.left-this.lastPositionAbs.left;return 0!==e&&(e>0?"right":"left")},refresh:function(e){return this._refreshItems(e),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var e=this.options;return e.connectWith.constructor===String?[e.connectWith]:e.connectWith},_getItemsAsjQuery:function(t){function i(){r.push(this)}var s,n,a,o,r=[],h=[],l=this._connectWith();if(l&&t)for(s=l.length-1;s>=0;s--)for(a=e(l[s],this.document[0]),n=a.length-1;n>=0;n--)o=e.data(a[n],this.widgetFullName),o&&o!==this&&!o.options.disabled&&h.push([e.isFunction(o.options.items)?o.options.items.call(o.element):e(o.options.items,o.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),o]);for(h.push([e.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):e(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),s=h.length-1;s>=0;s--)h[s][0].each(i);return e(r)},_removeCurrentsFromItems:function(){var t=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=e.grep(this.items,function(e){for(var i=0;t.length>i;i++)if(t[i]===e.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var i,s,n,a,o,r,h,l,u=this.items,d=[[e.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):e(this.options.items,this.element),this]],c=this._connectWith();if(c&&this.ready)for(i=c.length-1;i>=0;i--)for(n=e(c[i],this.document[0]),s=n.length-1;s>=0;s--)a=e.data(n[s],this.widgetFullName),a&&a!==this&&!a.options.disabled&&(d.push([e.isFunction(a.options.items)?a.options.items.call(a.element[0],t,{item:this.currentItem}):e(a.options.items,a.element),a]),this.containers.push(a));for(i=d.length-1;i>=0;i--)for(o=d[i][1],r=d[i][0],s=0,l=r.length;l>s;s++)h=e(r[s]),h.data(this.widgetName+"-item",o),u.push({item:h,instance:o,width:0,height:0,left:0,top:0})},refreshPositions:function(t){this.floating=this.items.length?"x"===this.options.axis||this._isFloating(this.items[0].item):!1,this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,n,a;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?e(this.options.toleranceElement,s.item):s.item,t||(s.width=n.outerWidth(),s.height=n.outerHeight()),a=n.offset(),s.left=a.left,s.top=a.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)a=this.containers[i].element.offset(),this.containers[i].containerCache.left=a.left,this.containers[i].containerCache.top=a.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(t){t=t||this;var i,s=t.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=t.currentItem[0].nodeName.toLowerCase(),n=e("<"+s+">",t.document[0]).addClass(i||t.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tbody"===s?t._createTrPlaceholder(t.currentItem.find("tr").eq(0),e("<tr>",t.document[0]).appendTo(n)):"tr"===s?t._createTrPlaceholder(t.currentItem,n):"img"===s&&n.attr("src",t.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(e,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(t.currentItem.innerHeight()-parseInt(t.currentItem.css("paddingTop")||0,10)-parseInt(t.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(t.currentItem.innerWidth()-parseInt(t.currentItem.css("paddingLeft")||0,10)-parseInt(t.currentItem.css("paddingRight")||0,10)))}}),t.placeholder=e(s.placeholder.element.call(t.element,t.currentItem)),t.currentItem.after(t.placeholder),s.placeholder.update(t,t.placeholder)},_createTrPlaceholder:function(t,i){var s=this;t.children().each(function(){e("<td>&#160;</td>",s.document[0]).attr("colspan",e(this).attr("colspan")||1).appendTo(i)})},_contactContainers:function(t){var i,s,n,a,o,r,h,l,u,d,c=null,p=null;for(i=this.containers.length-1;i>=0;i--)if(!e.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(c&&e.contains(this.containers[i].element[0],c.element[0]))continue;c=this.containers[i],p=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",t,this._uiHash(this)),this.containers[i].containerCache.over=0);if(c)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(n=1e4,a=null,u=c.floating||this._isFloating(this.currentItem),o=u?"left":"top",r=u?"width":"height",d=u?"clientX":"clientY",s=this.items.length-1;s>=0;s--)e.contains(this.containers[p].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(h=this.items[s].item.offset()[o],l=!1,t[d]-h>this.items[s][r]/2&&(l=!0),n>Math.abs(t[d]-h)&&(n=Math.abs(t[d]-h),a=this.items[s],this.direction=l?"up":"down"));if(!a&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p])return this.currentContainer.containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash()),this.currentContainer.containerCache.over=1),void 0;a?this._rearrange(t,a,null,!0):this._rearrange(t,null,this.containers[p].element,!0),this._trigger("change",t,this._uiHash()),this.containers[p]._trigger("change",t,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1}},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||e("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.currentItem.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===n.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===n.containment?this.document.width():this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(t=e(n.containment)[0],i=e(n.containment).offset(),s="hidden"!==e(t).css("overflow"),this.containment=[i.left+(parseInt(e(t).css("borderLeftWidth"),10)||0)+(parseInt(e(t).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(e(t).css("borderTopWidth"),10)||0)+(parseInt(e(t).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(e(t).css("borderLeftWidth"),10)||0)-(parseInt(e(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(e(t).css("borderTopWidth"),10)||0)-(parseInt(e(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(t,i){i||(i=this.position);var s="absolute"===t?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,a=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():a?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():a?0:n.scrollLeft())*s}},_generatePosition:function(t){var i,s,n=this.options,a=t.pageX,o=t.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(t.pageX-this.offset.click.left<this.containment[0]&&(a=this.containment[0]+this.offset.click.left),t.pageY-this.offset.click.top<this.containment[1]&&(o=this.containment[1]+this.offset.click.top),t.pageX-this.offset.click.left>this.containment[2]&&(a=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(o=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((o-this.originalPageY)/n.grid[1])*n.grid[1],o=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((a-this.originalPageX)/n.grid[0])*n.grid[0],a=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:r.scrollTop()),left:a-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:r.scrollLeft())}},_rearrange:function(e,t,i,s){i?i[0].appendChild(this.placeholder[0]):t.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?t.item[0]:t.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(e,t){function i(e,t,i){return function(s){i._trigger(e,s,t._uiHash(t))}}this.reverting=!1;var s,n=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(s in this._storedCSS)("auto"===this._storedCSS[s]||"static"===this._storedCSS[s])&&(this._storedCSS[s]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!t&&n.push(function(e){this._trigger("receive",e,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||t||n.push(function(e){this._trigger("update",e,this._uiHash())}),this!==this.currentContainer&&(t||(n.push(function(e){this._trigger("remove",e,this._uiHash())}),n.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;s>=0;s--)t||n.push(i("deactivate",this,this.containers[s])),this.containers[s].containerCache.over&&(n.push(i("out",this,this.containers[s])),this.containers[s].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,t||this._trigger("beforeStop",e,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!t){for(s=0;n.length>s;s++)n[s].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){e.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(t){var i=t||this;return{helper:i.helper,placeholder:i.placeholder||e([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:t?t.element:null}}}),e.widget("ui.spinner",{version:"1.11.4",defaultElement:"<input>",widgetEventPrefix:"spin",options:{culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),""!==this.value()&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var t={},i=this.element;return e.each(["min","max","step"],function(e,s){var n=i.attr(s);void 0!==n&&n.length&&(t[s]=n)}),t},_events:{keydown:function(e){this._start(e)&&this._keydown(e)&&e.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,void 0):(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",e),void 0)},mousewheel:function(e,t){if(t){if(!this.spinning&&!this._start(e))return!1;this._spin((t>0?1:-1)*this.options.step,e),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(e)},100),e.preventDefault()}},"mousedown .ui-spinner-button":function(t){function i(){var e=this.element[0]===this.document[0].activeElement;e||(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s}))}var s;s=this.element[0]===this.document[0].activeElement?this.previous:this.element.val(),t.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),this._start(t)!==!1&&this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(t){return e(t.currentTarget).hasClass("ui-state-active")?this._start(t)===!1?!1:(this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t),void 0):void 0},"mouseleave .ui-spinner-button":"_stop"},_draw:function(){var e=this.uiSpinner=this.element.addClass("ui-spinner-input").attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml());this.element.attr("role","spinbutton"),this.buttons=e.find(".ui-spinner-button").attr("tabIndex",-1).button().removeClass("ui-corner-all"),this.buttons.height()>Math.ceil(.5*e.height())&&e.height()>0&&e.height(e.height()),this.options.disabled&&this.disable()},_keydown:function(t){var i=this.options,s=e.ui.keyCode;switch(t.keyCode){case s.UP:return this._repeat(null,1,t),!0;case s.DOWN:return this._repeat(null,-1,t),!0;case s.PAGE_UP:return this._repeat(null,i.page,t),!0;case s.PAGE_DOWN:return this._repeat(null,-i.page,t),!0}return!1},_uiSpinnerHtml:function(){return"<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>"},_buttonHtml:function(){return"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'><span class='ui-icon "+this.options.icons.up+"'>&#9650;</span>"+"</a>"+"<a class='ui-spinner-button ui-spinner-down ui-corner-br'>"+"<span class='ui-icon "+this.options.icons.down+"'>&#9660;</span>"+"</a>"},_start:function(e){return this.spinning||this._trigger("start",e)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(e,t,i){e=e||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,t,i)},e),this._spin(t*this.options.step,i)},_spin:function(e,t){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+e*this._increment(this.counter)),this.spinning&&this._trigger("spin",t,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(t){var i=this.options.incremental;return i?e.isFunction(i)?i(t):Math.floor(t*t*t/5e4-t*t/500+17*t/200+1):1},_precision:function(){var e=this._precisionOf(this.options.step);return null!==this.options.min&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=""+e,i=t.indexOf(".");return-1===i?0:t.length-i-1},_adjustValue:function(e){var t,i,s=this.options;return t=null!==s.min?s.min:0,i=e-t,i=Math.round(i/s.step)*s.step,e=t+i,e=parseFloat(e.toFixed(this._precision())),null!==s.max&&e>s.max?s.max:null!==s.min&&s.min>e?s.min:e},_stop:function(e){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",e))},_setOption:function(e,t){if("culture"===e||"numberFormat"===e){var i=this._parse(this.element.val());return this.options[e]=t,this.element.val(this._format(i)),void 0}("max"===e||"min"===e||"step"===e)&&"string"==typeof t&&(t=this._parse(t)),"icons"===e&&(this.buttons.first().find(".ui-icon").removeClass(this.options.icons.up).addClass(t.up),this.buttons.last().find(".ui-icon").removeClass(this.options.icons.down).addClass(t.down)),this._super(e,t),"disabled"===e&&(this.widget().toggleClass("ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable"))},_setOptions:h(function(e){this._super(e)}),_parse:function(e){return"string"==typeof e&&""!==e&&(e=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(e,10,this.options.culture):+e),""===e||isNaN(e)?null:e},_format:function(e){return""===e?"":window.Globalize&&this.options.numberFormat?Globalize.format(e,this.options.numberFormat,this.options.culture):e},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},isValid:function(){var e=this.value();return null===e?!1:e===this._adjustValue(e)},_value:function(e,t){var i;""!==e&&(i=this._parse(e),null!==i&&(t||(i=this._adjustValue(i)),e=this._format(i))),this.element.val(e),this._refresh()},_destroy:function(){this.element.removeClass("ui-spinner-input").prop("disabled",!1).removeAttr("autocomplete").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:h(function(e){this._stepUp(e)}),_stepUp:function(e){this._start()&&(this._spin((e||1)*this.options.step),this._stop())},stepDown:h(function(e){this._stepDown(e)}),_stepDown:function(e){this._start()&&(this._spin((e||1)*-this.options.step),this._stop())},pageUp:h(function(e){this._stepUp((e||1)*this.options.page)}),pageDown:h(function(e){this._stepDown((e||1)*this.options.page)}),value:function(e){return arguments.length?(h(this._value).call(this,e),void 0):this._parse(this.element.val())},widget:function(){return this.uiSpinner}}),e.widget("ui.tabs",{version:"1.11.4",delay:300,options:{active:null,collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:function(){var e=/#.*$/;return function(t){var i,s;t=t.cloneNode(!1),i=t.href.replace(e,""),s=location.href.replace(e,"");try{i=decodeURIComponent(i)}catch(n){}try{s=decodeURIComponent(s)}catch(n){}return t.hash.length>1&&i===s}}(),_create:function(){var t=this,i=this.options;this.running=!1,this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",i.collapsible),this._processTabs(),i.active=this._initialActive(),e.isArray(i.disabled)&&(i.disabled=e.unique(i.disabled.concat(e.map(this.tabs.filter(".ui-state-disabled"),function(e){return t.tabs.index(e)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(i.active):e(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var t=this.options.active,i=this.options.collapsible,s=location.hash.substring(1);return null===t&&(s&&this.tabs.each(function(i,n){return e(n).attr("aria-controls")===s?(t=i,!1):void 0}),null===t&&(t=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===t||-1===t)&&(t=this.tabs.length?0:!1)),t!==!1&&(t=this.tabs.index(this.tabs.eq(t)),-1===t&&(t=i?!1:0)),!i&&t===!1&&this.anchors.length&&(t=0),t},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):e()}},_tabKeydown:function(t){var i=e(this.document[0].activeElement).closest("li"),s=this.tabs.index(i),n=!0;if(!this._handlePageNav(t)){switch(t.keyCode){case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:s++;break;case e.ui.keyCode.UP:case e.ui.keyCode.LEFT:n=!1,s--;break;case e.ui.keyCode.END:s=this.anchors.length-1;break;case e.ui.keyCode.HOME:s=0;break;case e.ui.keyCode.SPACE:return t.preventDefault(),clearTimeout(this.activating),this._activate(s),void 0;case e.ui.keyCode.ENTER:return t.preventDefault(),clearTimeout(this.activating),this._activate(s===this.options.active?!1:s),void 0;default:return}t.preventDefault(),clearTimeout(this.activating),s=this._focusNextTab(s,n),t.ctrlKey||t.metaKey||(i.attr("aria-selected","false"),this.tabs.eq(s).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",s)},this.delay))}},_panelKeydown:function(t){this._handlePageNav(t)||t.ctrlKey&&t.keyCode===e.ui.keyCode.UP&&(t.preventDefault(),this.active.focus())},_handlePageNav:function(t){return t.altKey&&t.keyCode===e.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):t.altKey&&t.keyCode===e.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(t,i){function s(){return t>n&&(t=0),0>t&&(t=n),t}for(var n=this.tabs.length-1;-1!==e.inArray(s(),this.options.disabled);)t=i?t+1:t-1;return t},_focusNextTab:function(e,t){return e=this._findNextTab(e,t),this.tabs.eq(e).focus(),e},_setOption:function(e,t){return"active"===e?(this._activate(t),void 0):"disabled"===e?(this._setupDisabled(t),void 0):(this._super(e,t),"collapsible"===e&&(this.element.toggleClass("ui-tabs-collapsible",t),t||this.options.active!==!1||this._activate(0)),"event"===e&&this._setupEvents(t),"heightStyle"===e&&this._setupHeightStyle(t),void 0)},_sanitizeSelector:function(e){return e?e.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var t=this.options,i=this.tablist.children(":has(a[href])");t.disabled=e.map(i.filter(".ui-state-disabled"),function(e){return i.index(e)}),this._processTabs(),t.active!==!1&&this.anchors.length?this.active.length&&!e.contains(this.tablist[0],this.active[0])?this.tabs.length===t.disabled.length?(t.active=!1,this.active=e()):this._activate(this._findNextTab(Math.max(0,t.active-1),!1)):t.active=this.tabs.index(this.active):(t.active=!1,this.active=e()),this._refresh()},_refresh:function(){this._setupDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.addClass("ui-tabs-active ui-state-active").attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var t=this,i=this.tabs,s=this.anchors,n=this.panels; this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist").delegate("> li","mousedown"+this.eventNamespace,function(t){e(this).is(".ui-state-disabled")&&t.preventDefault()}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function(){e(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",tabIndex:-1}),this.anchors=this.tabs.map(function(){return e("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1}),this.panels=e(),this.anchors.each(function(i,s){var n,a,o,r=e(s).uniqueId().attr("id"),h=e(s).closest("li"),l=h.attr("aria-controls");t._isLocal(s)?(n=s.hash,o=n.substring(1),a=t.element.find(t._sanitizeSelector(n))):(o=h.attr("aria-controls")||e({}).uniqueId()[0].id,n="#"+o,a=t.element.find(n),a.length||(a=t._createPanel(o),a.insertAfter(t.panels[i-1]||t.tablist)),a.attr("aria-live","polite")),a.length&&(t.panels=t.panels.add(a)),l&&h.data("ui-tabs-aria-controls",l),h.attr({"aria-controls":o,"aria-labelledby":r}),a.attr("aria-labelledby",r)}),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel"),i&&(this._off(i.not(this.tabs)),this._off(s.not(this.anchors)),this._off(n.not(this.panels)))},_getList:function(){return this.tablist||this.element.find("ol,ul").eq(0)},_createPanel:function(t){return e("<div>").attr("id",t).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)},_setupDisabled:function(t){e.isArray(t)&&(t.length?t.length===this.anchors.length&&(t=!0):t=!1);for(var i,s=0;i=this.tabs[s];s++)t===!0||-1!==e.inArray(s,t)?e(i).addClass("ui-state-disabled").attr("aria-disabled","true"):e(i).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=t},_setupEvents:function(t){var i={};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(e){e.preventDefault()}}),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(t){var i,s=this.element.parent();"fill"===t?(i=s.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var t=e(this),s=t.css("position");"absolute"!==s&&"fixed"!==s&&(i-=t.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=e(this).outerHeight(!0)}),this.panels.each(function(){e(this).height(Math.max(0,i-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===t&&(i=0,this.panels.each(function(){i=Math.max(i,e(this).height("").height())}).height(i))},_eventHandler:function(t){var i=this.options,s=this.active,n=e(t.currentTarget),a=n.closest("li"),o=a[0]===s[0],r=o&&i.collapsible,h=r?e():this._getPanelForTab(a),l=s.length?this._getPanelForTab(s):e(),u={oldTab:s,oldPanel:l,newTab:r?e():a,newPanel:h};t.preventDefault(),a.hasClass("ui-state-disabled")||a.hasClass("ui-tabs-loading")||this.running||o&&!i.collapsible||this._trigger("beforeActivate",t,u)===!1||(i.active=r?!1:this.tabs.index(a),this.active=o?e():a,this.xhr&&this.xhr.abort(),l.length||h.length||e.error("jQuery UI Tabs: Mismatching fragment identifier."),h.length&&this.load(this.tabs.index(a),t),this._toggle(t,u))},_toggle:function(t,i){function s(){a.running=!1,a._trigger("activate",t,i)}function n(){i.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),o.length&&a.options.show?a._show(o,a.options.show,s):(o.show(),s())}var a=this,o=i.newPanel,r=i.oldPanel;this.running=!0,r.length&&this.options.hide?this._hide(r,this.options.hide,function(){i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),n()}):(i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),r.hide(),n()),r.attr("aria-hidden","true"),i.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),o.length&&r.length?i.oldTab.attr("tabIndex",-1):o.length&&this.tabs.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),o.attr("aria-hidden","false"),i.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(t){var i,s=this._findActive(t);s[0]!==this.active[0]&&(s.length||(s=this.active),i=s.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return t===!1?e():this.tabs.eq(t)},_getIndex:function(e){return"string"==typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+e+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible"),this.tablist.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeAttr("role"),this.anchors.removeClass("ui-tabs-anchor").removeAttr("role").removeAttr("tabIndex").removeUniqueId(),this.tablist.unbind(this.eventNamespace),this.tabs.add(this.panels).each(function(){e.data(this,"ui-tabs-destroy")?e(this).remove():e(this).removeClass("ui-state-default ui-state-active ui-state-disabled ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel").removeAttr("tabIndex").removeAttr("aria-live").removeAttr("aria-busy").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-expanded").removeAttr("role")}),this.tabs.each(function(){var t=e(this),i=t.data("ui-tabs-aria-controls");i?t.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):t.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(t){var i=this.options.disabled;i!==!1&&(void 0===t?i=!1:(t=this._getIndex(t),i=e.isArray(i)?e.map(i,function(e){return e!==t?e:null}):e.map(this.tabs,function(e,i){return i!==t?i:null})),this._setupDisabled(i))},disable:function(t){var i=this.options.disabled;if(i!==!0){if(void 0===t)i=!0;else{if(t=this._getIndex(t),-1!==e.inArray(t,i))return;i=e.isArray(i)?e.merge([t],i).sort():[t]}this._setupDisabled(i)}},load:function(t,i){t=this._getIndex(t);var s=this,n=this.tabs.eq(t),a=n.find(".ui-tabs-anchor"),o=this._getPanelForTab(n),r={tab:n,panel:o},h=function(e,t){"abort"===t&&s.panels.stop(!1,!0),n.removeClass("ui-tabs-loading"),o.removeAttr("aria-busy"),e===s.xhr&&delete s.xhr};this._isLocal(a[0])||(this.xhr=e.ajax(this._ajaxSettings(a,i,r)),this.xhr&&"canceled"!==this.xhr.statusText&&(n.addClass("ui-tabs-loading"),o.attr("aria-busy","true"),this.xhr.done(function(e,t,n){setTimeout(function(){o.html(e),s._trigger("load",i,r),h(n,t)},1)}).fail(function(e,t){setTimeout(function(){h(e,t)},1)})))},_ajaxSettings:function(t,i,s){var n=this;return{url:t.attr("href"),beforeSend:function(t,a){return n._trigger("beforeLoad",i,e.extend({jqXHR:t,ajaxSettings:a},s))}}},_getPanelForTab:function(t){var i=e(t).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}}),e.widget("ui.tooltip",{version:"1.11.4",options:{content:function(){var t=e(this).attr("title")||"";return e("<a>").text(t).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,tooltipClass:null,track:!1,close:null,open:null},_addDescribedBy:function(t,i){var s=(t.attr("aria-describedby")||"").split(/\s+/);s.push(i),t.data("ui-tooltip-id",i).attr("aria-describedby",e.trim(s.join(" ")))},_removeDescribedBy:function(t){var i=t.data("ui-tooltip-id"),s=(t.attr("aria-describedby")||"").split(/\s+/),n=e.inArray(i,s);-1!==n&&s.splice(n,1),t.removeData("ui-tooltip-id"),s=e.trim(s.join(" ")),s?t.attr("aria-describedby",s):t.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.options.disabled&&this._disable(),this.liveRegion=e("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body)},_setOption:function(t,i){var s=this;return"disabled"===t?(this[i?"_disable":"_enable"](),this.options[t]=i,void 0):(this._super(t,i),"content"===t&&e.each(this.tooltips,function(e,t){s._updateContent(t.element)}),void 0)},_disable:function(){var t=this;e.each(this.tooltips,function(i,s){var n=e.Event("blur");n.target=n.currentTarget=s.element[0],t.close(n,!0)}),this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.is("[title]")&&t.data("ui-tooltip-title",t.attr("title")).removeAttr("title")})},_enable:function(){this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.data("ui-tooltip-title")&&t.attr("title",t.data("ui-tooltip-title"))})},open:function(t){var i=this,s=e(t?t.target:this.element).closest(this.options.items);s.length&&!s.data("ui-tooltip-id")&&(s.attr("title")&&s.data("ui-tooltip-title",s.attr("title")),s.data("ui-tooltip-open",!0),t&&"mouseover"===t.type&&s.parents().each(function(){var t,s=e(this);s.data("ui-tooltip-open")&&(t=e.Event("blur"),t.target=t.currentTarget=this,i.close(t,!0)),s.attr("title")&&(s.uniqueId(),i.parents[this.id]={element:this,title:s.attr("title")},s.attr("title",""))}),this._registerCloseHandlers(t,s),this._updateContent(s,t))},_updateContent:function(e,t){var i,s=this.options.content,n=this,a=t?t.type:null;return"string"==typeof s?this._open(t,e,s):(i=s.call(e[0],function(i){n._delay(function(){e.data("ui-tooltip-open")&&(t&&(t.type=a),this._open(t,e,i))})}),i&&this._open(t,e,i),void 0)},_open:function(t,i,s){function n(e){l.of=e,o.is(":hidden")||o.position(l)}var a,o,r,h,l=e.extend({},this.options.position);if(s){if(a=this._find(i))return a.tooltip.find(".ui-tooltip-content").html(s),void 0;i.is("[title]")&&(t&&"mouseover"===t.type?i.attr("title",""):i.removeAttr("title")),a=this._tooltip(i),o=a.tooltip,this._addDescribedBy(i,o.attr("id")),o.find(".ui-tooltip-content").html(s),this.liveRegion.children().hide(),s.clone?(h=s.clone(),h.removeAttr("id").find("[id]").removeAttr("id")):h=s,e("<div>").html(h).appendTo(this.liveRegion),this.options.track&&t&&/^mouse/.test(t.type)?(this._on(this.document,{mousemove:n}),n(t)):o.position(e.extend({of:i},this.options.position)),o.hide(),this._show(o,this.options.show),this.options.show&&this.options.show.delay&&(r=this.delayedShow=setInterval(function(){o.is(":visible")&&(n(l.of),clearInterval(r))},e.fx.interval)),this._trigger("open",t,{tooltip:o})}},_registerCloseHandlers:function(t,i){var s={keyup:function(t){if(t.keyCode===e.ui.keyCode.ESCAPE){var s=e.Event(t);s.currentTarget=i[0],this.close(s,!0)}}};i[0]!==this.element[0]&&(s.remove=function(){this._removeTooltip(this._find(i).tooltip)}),t&&"mouseover"!==t.type||(s.mouseleave="close"),t&&"focusin"!==t.type||(s.focusout="close"),this._on(!0,i,s)},close:function(t){var i,s=this,n=e(t?t.currentTarget:this.element),a=this._find(n);return a?(i=a.tooltip,a.closing||(clearInterval(this.delayedShow),n.data("ui-tooltip-title")&&!n.attr("title")&&n.attr("title",n.data("ui-tooltip-title")),this._removeDescribedBy(n),a.hiding=!0,i.stop(!0),this._hide(i,this.options.hide,function(){s._removeTooltip(e(this))}),n.removeData("ui-tooltip-open"),this._off(n,"mouseleave focusout keyup"),n[0]!==this.element[0]&&this._off(n,"remove"),this._off(this.document,"mousemove"),t&&"mouseleave"===t.type&&e.each(this.parents,function(t,i){e(i.element).attr("title",i.title),delete s.parents[t]}),a.closing=!0,this._trigger("close",t,{tooltip:i}),a.hiding||(a.closing=!1)),void 0):(n.removeData("ui-tooltip-open"),void 0)},_tooltip:function(t){var i=e("<div>").attr("role","tooltip").addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||"")),s=i.uniqueId().attr("id");return e("<div>").addClass("ui-tooltip-content").appendTo(i),i.appendTo(this.document[0].body),this.tooltips[s]={element:t,tooltip:i}},_find:function(e){var t=e.data("ui-tooltip-id");return t?this.tooltips[t]:null},_removeTooltip:function(e){e.remove(),delete this.tooltips[e.attr("id")]},_destroy:function(){var t=this;e.each(this.tooltips,function(i,s){var n=e.Event("blur"),a=s.element;n.target=n.currentTarget=a[0],t.close(n,!0),e("#"+i).remove(),a.data("ui-tooltip-title")&&(a.attr("title")||a.attr("title",a.data("ui-tooltip-title")),a.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}})});
paleozogt/cdnjs
ajax/libs/jqueryui/1.11.4/jquery-ui.min.js
JavaScript
mit
240,427
.yui3-skin-sam .yui3-scrollview { -webkit-tap-highlight-color: rgba(255,255,255,0); } .yui3-skin-sam .yui3-scrollview{ background-color: white; } /* For IE 6/7 - needs a background color (above) to pick up events, and zoom, to fill the UL */ .yui3-skin-sam .yui3-scrollview-vert .yui3-scrollview-content .yui3-scrollview-item { *zoom:1; } /* For IE7 - needs zoom, otherwise clipped content is not rendered */ .yui3-skin-sam .yui3-scrollview-vert .yui3-scrollview-content .yui3-scrollview-list { *zoom:1; list-style:none; /*need these since reset is not required*/ padding:0; /*need these since reset is not required*/ margin:0; /*need these since reset is not required*/ } .yui3-skin-sam .yui3-scrollview-vert .yui3-scrollview-content { /*border:1px solid #303030; If the ScrollView needs a border add it here */ border-top:0; background-color:white; font-family: HelveticaNeue,arial,helvetica,clean,sans-serif; color:black; } .yui3-skin-sam .yui3-scrollview-vert .yui3-scrollview-content .yui3-scrollview-item { border-bottom: 1px solid #303030; padding: 15px 20px 16px; font-size: 100%; font-weight: bold; background-color:white; cursor:pointer; }
platanus/cdnjs
ajax/libs/yui/3.9.0/scrollview-list/assets/skins/sam/scrollview-list-skin.css
CSS
mit
1,203
/* Horizontal Slider */ /* Use thumbUrl /build/slider-base/assets/skins/sam-dark/thumb-x.png */ .yui3-skin-night .yui3-slider-x .yui3-slider-rail, .yui3-skin-night .yui3-slider-x .yui3-slider-rail-cap-left, .yui3-skin-night .yui3-slider-x .yui3-slider-rail-cap-right { background-image: url(rail-x.png); background-repeat: repeat-x; /* alternate: rail-x-lines.png */ } .yui3-skin-night .yui3-slider-x .yui3-slider-rail { height: 26px; } .yui3-skin-night .yui3-slider-x .yui3-slider-thumb { height: 26px; width: 21px; } .yui3-skin-night .yui3-slider-x .yui3-slider-rail-cap-left { background-position: 0 -20px; height: 20px; left: -2px; width: 5px; } .yui3-skin-night .yui3-slider-x .yui3-slider-rail-cap-right { background-position: 0 -40px; height: 20px; right: -2px; width: 5px; } .yui3-skin-night .yui3-slider-x .yui3-slider-thumb-image { left: 0; top: -10px; } .yui3-skin-night .yui3-slider-x .yui3-slider-thumb-shadow { left: 0; opacity: 0.15; filter: alpha(opacity=15); top: -50px; } /* Vertical Slider */ /* Use thumbUrl /build/slider-base/assets/skins/sam-dark/thumb-y.png */ .yui3-skin-night .yui3-slider-y .yui3-slider-rail, .yui3-skin-night .yui3-slider-y .yui3-slider-rail-cap-top, .yui3-skin-night .yui3-slider-y .yui3-slider-rail-cap-bottom { background-image: url(rail-y.png); background-repeat: repeat-y; /* alternate: rail-y-lines.png */ } .yui3-skin-night .yui3-slider-y .yui3-slider-rail { width: 26px; } .yui3-skin-night .yui3-slider-y .yui3-slider-thumb { width: 26px; height: 15px; } .yui3-skin-night .yui3-slider-y .yui3-slider-rail-cap-top { background-position: -20px 0; width: 20px; top: -2px; height: 5px; } .yui3-skin-night .yui3-slider-y .yui3-slider-rail-cap-bottom { background-position: -40px 0; width: 20px; bottom: -2px; height: 5px; } .yui3-skin-night .yui3-slider-y .yui3-slider-thumb-image { left: -10px; top: 0; } .yui3-skin-night .yui3-slider-y .yui3-slider-thumb-shadow { left: -50px; opacity: 0.15; filter: alpha(opacity=15); top: 0; }
saitheexplorer/cdnjs
ajax/libs/yui/3.7.3/slider-base/assets/skins/night/slider-skin.css
CSS
mit
2,148
/* Horizontal Slider */ /* Use thumbUrl /build/slider-base/assets/skins/sam-dark/thumb-x.png */ .yui3-skin-night .yui3-slider-x .yui3-slider-rail, .yui3-skin-night .yui3-slider-x .yui3-slider-rail-cap-left, .yui3-skin-night .yui3-slider-x .yui3-slider-rail-cap-right { background-image: url(rail-x.png); background-repeat: repeat-x; /* alternate: rail-x-lines.png */ } .yui3-skin-night .yui3-slider-x .yui3-slider-rail { height: 26px; } .yui3-skin-night .yui3-slider-x .yui3-slider-thumb { height: 26px; width: 21px; } .yui3-skin-night .yui3-slider-x .yui3-slider-rail-cap-left { background-position: 0 -20px; height: 20px; left: -2px; width: 5px; } .yui3-skin-night .yui3-slider-x .yui3-slider-rail-cap-right { background-position: 0 -40px; height: 20px; right: -2px; width: 5px; } .yui3-skin-night .yui3-slider-x .yui3-slider-thumb-image { left: 0; top: -10px; } .yui3-skin-night .yui3-slider-x .yui3-slider-thumb-shadow { left: 0; opacity: 0.15; filter: alpha(opacity=15); top: -50px; } /* Vertical Slider */ /* Use thumbUrl /build/slider-base/assets/skins/sam-dark/thumb-y.png */ .yui3-skin-night .yui3-slider-y .yui3-slider-rail, .yui3-skin-night .yui3-slider-y .yui3-slider-rail-cap-top, .yui3-skin-night .yui3-slider-y .yui3-slider-rail-cap-bottom { background-image: url(rail-y.png); background-repeat: repeat-y; /* alternate: rail-y-lines.png */ } .yui3-skin-night .yui3-slider-y .yui3-slider-rail { width: 26px; } .yui3-skin-night .yui3-slider-y .yui3-slider-thumb { width: 26px; height: 15px; } .yui3-skin-night .yui3-slider-y .yui3-slider-rail-cap-top { background-position: -20px 0; width: 20px; top: -2px; height: 5px; } .yui3-skin-night .yui3-slider-y .yui3-slider-rail-cap-bottom { background-position: -40px 0; width: 20px; bottom: -2px; height: 5px; } .yui3-skin-night .yui3-slider-y .yui3-slider-thumb-image { left: -10px; top: 0; } .yui3-skin-night .yui3-slider-y .yui3-slider-thumb-shadow { left: -50px; opacity: 0.15; filter: alpha(opacity=15); top: 0; }
urish/cdnjs
ajax/libs/yui/3.9.0/slider-base/assets/skins/night/slider-skin.css
CSS
mit
2,148
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "a.m.", "p.m." ], "DAY": [ "domingo", "lunes", "martes", "mi\u00e9rcoles", "jueves", "viernes", "s\u00e1bado" ], "MONTH": [ "enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre" ], "SHORTDAY": [ "dom", "lun", "mar", "mi\u00e9", "jue", "vie", "s\u00e1b" ], "SHORTMONTH": [ "ene", "feb", "mar", "abr", "may", "jun", "jul", "ago", "sep", "oct", "nov", "dic" ], "fullDate": "EEEE, d 'de' MMMM 'de' y", "longDate": "d 'de' MMMM 'de' y", "medium": "dd/MM/yyyy HH:mm:ss", "mediumDate": "dd/MM/yyyy", "mediumTime": "HH:mm:ss", "short": "dd/MM/yy HH:mm", "shortDate": "dd/MM/yy", "shortTime": "HH:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "\u20ac", "DECIMAL_SEP": ",", "GROUP_SEP": ".", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "macFrac": 0, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "macFrac": 0, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-", "negSuf": "\u00a0\u00a4", "posPre": "", "posSuf": "\u00a0\u00a4" } ] }, "id": "es", "pluralCat": function (n) { if (n == 1) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
KOLANICH/cdnjs
ajax/libs/angular-i18n/1.2.7/angular-locale_es.js
JavaScript
mit
1,973
/*! * FormValidation (http://formvalidation.io) * The best jQuery plugin to validate form fields. Support Bootstrap, Foundation, Pure, SemanticUI, UIKit frameworks * * @version v0.6.0, built on 2015-01-06 2:20:11 PM * @author https://twitter.com/nghuuphuoc * @copyright (c) 2013 - 2015 Nguyen Huu Phuoc * @license http://formvalidation.io/license/ */ /** * This class supports validating UIKit form (http://getuikit.com/) */ (function($) { FormValidation.Framework.UIKit = function(element, options) { options = $.extend(true, { button: { selector: '[type="submit"]', // The class for disabled button // http://getuikit.com/docs/button.html disabled: 'disabled' }, control: { valid: 'uk-form-success', invalid: 'uk-form-danger' }, err: { // http://getuikit.com/docs/text.html#text-styles clazz: 'uk-text-danger', parent: '^.*(uk-form-controls|uk-width-[\\d+]-[\\d+]).*$' }, // UIKit doesn't support feedback icon icon: { valid: null, invalid: null, validating: null, feedback: 'fv-control-feedback' }, row: { // http://getuikit.com/docs/form.html selector: '.uk-form-row', valid: 'fv-has-success', invalid: 'fv-has-error', feedback: 'fv-has-feedback' } }, options); FormValidation.Base.apply(this, [element, options]); }; FormValidation.Framework.UIKit.prototype = $.extend({}, FormValidation.Base.prototype, { /** * Specific framework might need to adjust the icon position * * @param {jQuery} $field The field element * @param {jQuery} $icon The icon element */ _fixIcon: function($field, $icon) { var ns = this._namespace, type = $field.attr('type'), field = $field.attr('data-' + ns + '-field'), row = this.options.fields[field].row || this.options.row.selector, $parent = $field.closest(row); if ('checkbox' === type || 'radio' === type) { var $fieldParent = $field.parent(); if ($fieldParent.is('label')) { $icon.insertAfter($fieldParent); } } if ($parent.find('label').length === 0) { $icon.addClass('fv-icon-no-label'); } }, /** * Create a tooltip or popover * It will be shown when focusing on the field * * @param {jQuery} $field The field element * @param {String} message The message * @param {String} type Can be 'tooltip' or 'popover' */ _createTooltip: function($field, message, type) { var $icon = $field.data('fv.icon'); if ($icon) { // Remove the tooltip if it's already exists if ($icon.data('tooltip')) { $icon.data('tooltip').off(); $icon.removeData('tooltip'); } $icon .attr('title', message) .css({ 'cursor': 'pointer' }); new $.UIkit.tooltip($icon); // UIKit auto set the 'tooltip' data for the element // so I can retrieve the tooltip later via $icon.data('tooltip') } }, /** * Destroy the tooltip or popover * * @param {jQuery} $field The field element * @param {String} type Can be 'tooltip' or 'popover' */ _destroyTooltip: function($field, type) { var $icon = $field.data('fv.icon'); if ($icon) { var tooltip = $icon.data('tooltip'); if (tooltip) { tooltip.hide(); tooltip.off(); $icon.off('focus mouseenter') .removeData('tooltip'); } $icon.css({ 'cursor': '' }); } }, /** * Hide a tooltip or popover * * @param {jQuery} $field The field element * @param {String} type Can be 'tooltip' or 'popover' */ _hideTooltip: function($field, type) { var $icon = $field.data('fv.icon'); if ($icon) { var tooltip = $icon.data('tooltip'); if (tooltip) { tooltip.hide(); } $icon.css({ 'cursor': '' }); } }, /** * Show a tooltip or popover * * @param {jQuery} $field The field element * @param {String} type Can be 'tooltip' or 'popover' */ _showTooltip: function($field, type) { var $icon = $field.data('fv.icon'); if ($icon) { $icon.css({ 'cursor': 'pointer' }); var tooltip = $icon.data('tooltip'); if (tooltip) { tooltip.show(); } } } }); }(jQuery));
paleozogt/cdnjs
ajax/libs/formvalidation/0.6.0/js/framework/uikit.js
JavaScript
mit
5,556
/** * ag-grid - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v4.2.1 * @link http://www.ag-grid.com/ * @license MIT */ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var __param = (this && this.__param) || function (paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } }; var eventService_1 = require("./eventService"); var constants_1 = require("./constants"); var componentUtil_1 = require("./components/componentUtil"); var gridApi_1 = require("./gridApi"); var context_1 = require("./context/context"); var columnController_1 = require("./columnController/columnController"); var events_1 = require("./events"); var utils_1 = require("./utils"); var DEFAULT_ROW_HEIGHT = 25; var DEFAULT_VIEWPORT_ROW_MODEL_PAGE_SIZE = 5; var DEFAULT_VIEWPORT_ROW_MODEL_BUFFER_SIZE = 5; function isTrue(value) { return value === true || value === 'true'; } function positiveNumberOrZero(value, defaultValue) { if (value > 0) { return value; } else { // zero gets returned if number is missing or the wrong type return defaultValue; } } var GridOptionsWrapper = (function () { function GridOptionsWrapper() { } GridOptionsWrapper.prototype.agWire = function (gridApi, columnApi) { this.headerHeight = this.gridOptions.headerHeight; this.gridOptions.api = gridApi; this.gridOptions.columnApi = columnApi; this.checkForDeprecated(); }; GridOptionsWrapper.prototype.init = function () { this.eventService.addGlobalListener(this.globalEventHandler.bind(this)); if (this.isGroupSelectsChildren() && this.isSuppressParentsInRowNodes()) { console.warn('ag-Grid: groupSelectsChildren does not work wth suppressParentsInRowNodes, this selection method needs the part in rowNode to work'); } if (this.isGroupSelectsChildren() && !this.isRowSelectionMulti()) { console.warn('ag-Grid: rowSelectionMulti must be true for groupSelectsChildren to make sense'); } }; GridOptionsWrapper.prototype.isEnterprise = function () { return this.enterprise; }; GridOptionsWrapper.prototype.isRowSelection = function () { return this.gridOptions.rowSelection === "single" || this.gridOptions.rowSelection === "multiple"; }; GridOptionsWrapper.prototype.isRowDeselection = function () { return isTrue(this.gridOptions.rowDeselection); }; GridOptionsWrapper.prototype.isRowSelectionMulti = function () { return this.gridOptions.rowSelection === 'multiple'; }; GridOptionsWrapper.prototype.getContext = function () { return this.gridOptions.context; }; GridOptionsWrapper.prototype.isRowModelPagination = function () { return this.gridOptions.rowModelType === constants_1.Constants.ROW_MODEL_TYPE_PAGINATION; }; GridOptionsWrapper.prototype.isRowModelVirtual = function () { return this.gridOptions.rowModelType === constants_1.Constants.ROW_MODEL_TYPE_VIRTUAL; }; GridOptionsWrapper.prototype.isRowModelViewport = function () { return this.gridOptions.rowModelType === constants_1.Constants.ROW_MODEL_TYPE_VIEWPORT; }; GridOptionsWrapper.prototype.isRowModelDefault = function () { return !(this.isRowModelPagination() || this.isRowModelVirtual() || this.isRowModelViewport()); }; GridOptionsWrapper.prototype.isShowToolPanel = function () { return isTrue(this.gridOptions.showToolPanel); }; GridOptionsWrapper.prototype.isToolPanelSuppressGroups = function () { return isTrue(this.gridOptions.toolPanelSuppressGroups); }; GridOptionsWrapper.prototype.isToolPanelSuppressValues = function () { return isTrue(this.gridOptions.toolPanelSuppressValues); }; GridOptionsWrapper.prototype.isEnableCellChangeFlash = function () { return isTrue(this.gridOptions.enableCellChangeFlash); }; GridOptionsWrapper.prototype.isGroupSelectsChildren = function () { return isTrue(this.gridOptions.groupSelectsChildren); }; GridOptionsWrapper.prototype.isGroupIncludeFooter = function () { return isTrue(this.gridOptions.groupIncludeFooter); }; GridOptionsWrapper.prototype.isGroupSuppressBlankHeader = function () { return isTrue(this.gridOptions.groupSuppressBlankHeader); }; GridOptionsWrapper.prototype.isSuppressRowClickSelection = function () { return isTrue(this.gridOptions.suppressRowClickSelection); }; GridOptionsWrapper.prototype.isSuppressCellSelection = function () { return isTrue(this.gridOptions.suppressCellSelection); }; GridOptionsWrapper.prototype.isSuppressMultiSort = function () { return isTrue(this.gridOptions.suppressMultiSort); }; GridOptionsWrapper.prototype.isGroupSuppressAutoColumn = function () { return isTrue(this.gridOptions.groupSuppressAutoColumn); }; GridOptionsWrapper.prototype.isSuppressDragLeaveHidesColumns = function () { return isTrue(this.gridOptions.suppressDragLeaveHidesColumns); }; GridOptionsWrapper.prototype.isForPrint = function () { return isTrue(this.gridOptions.forPrint); }; GridOptionsWrapper.prototype.isSuppressHorizontalScroll = function () { return isTrue(this.gridOptions.suppressHorizontalScroll); }; GridOptionsWrapper.prototype.isSuppressLoadingOverlay = function () { return isTrue(this.gridOptions.suppressLoadingOverlay); }; GridOptionsWrapper.prototype.isSuppressNoRowsOverlay = function () { return isTrue(this.gridOptions.suppressNoRowsOverlay); }; GridOptionsWrapper.prototype.isSuppressFieldDotNotation = function () { return isTrue(this.gridOptions.suppressFieldDotNotation); }; GridOptionsWrapper.prototype.getFloatingTopRowData = function () { return this.gridOptions.floatingTopRowData; }; GridOptionsWrapper.prototype.getFloatingBottomRowData = function () { return this.gridOptions.floatingBottomRowData; }; GridOptionsWrapper.prototype.isUnSortIcon = function () { return isTrue(this.gridOptions.unSortIcon); }; GridOptionsWrapper.prototype.isSuppressMenuHide = function () { return isTrue(this.gridOptions.suppressMenuHide); }; GridOptionsWrapper.prototype.getRowStyle = function () { return this.gridOptions.rowStyle; }; GridOptionsWrapper.prototype.getRowClass = function () { return this.gridOptions.rowClass; }; GridOptionsWrapper.prototype.getRowStyleFunc = function () { return this.gridOptions.getRowStyle; }; GridOptionsWrapper.prototype.getRowClassFunc = function () { return this.gridOptions.getRowClass; }; GridOptionsWrapper.prototype.getBusinessKeyForNodeFunc = function () { return this.gridOptions.getBusinessKeyForNode; }; GridOptionsWrapper.prototype.getHeaderCellRenderer = function () { return this.gridOptions.headerCellRenderer; }; GridOptionsWrapper.prototype.getApi = function () { return this.gridOptions.api; }; GridOptionsWrapper.prototype.getColumnApi = function () { return this.gridOptions.columnApi; }; GridOptionsWrapper.prototype.isEnableColResize = function () { return isTrue(this.gridOptions.enableColResize); }; GridOptionsWrapper.prototype.isSingleClickEdit = function () { return isTrue(this.gridOptions.singleClickEdit); }; GridOptionsWrapper.prototype.getGroupDefaultExpanded = function () { return this.gridOptions.groupDefaultExpanded; }; GridOptionsWrapper.prototype.getRowData = function () { return this.gridOptions.rowData; }; GridOptionsWrapper.prototype.isGroupUseEntireRow = function () { return isTrue(this.gridOptions.groupUseEntireRow); }; GridOptionsWrapper.prototype.getGroupColumnDef = function () { return this.gridOptions.groupColumnDef; }; GridOptionsWrapper.prototype.isGroupSuppressRow = function () { return isTrue(this.gridOptions.groupSuppressRow); }; GridOptionsWrapper.prototype.getRowGroupPanelShow = function () { return this.gridOptions.rowGroupPanelShow; }; GridOptionsWrapper.prototype.isAngularCompileRows = function () { return isTrue(this.gridOptions.angularCompileRows); }; GridOptionsWrapper.prototype.isAngularCompileFilters = function () { return isTrue(this.gridOptions.angularCompileFilters); }; GridOptionsWrapper.prototype.isAngularCompileHeaders = function () { return isTrue(this.gridOptions.angularCompileHeaders); }; GridOptionsWrapper.prototype.isDebug = function () { return isTrue(this.gridOptions.debug); }; GridOptionsWrapper.prototype.getColumnDefs = function () { return this.gridOptions.columnDefs; }; GridOptionsWrapper.prototype.getDatasource = function () { return this.gridOptions.datasource; }; GridOptionsWrapper.prototype.getViewportDatasource = function () { return this.gridOptions.viewportDatasource; }; GridOptionsWrapper.prototype.isEnableSorting = function () { return isTrue(this.gridOptions.enableSorting) || isTrue(this.gridOptions.enableServerSideSorting); }; GridOptionsWrapper.prototype.isEnableCellExpressions = function () { return isTrue(this.gridOptions.enableCellExpressions); }; GridOptionsWrapper.prototype.isSuppressMiddleClickScrolls = function () { return isTrue(this.gridOptions.suppressMiddleClickScrolls); }; GridOptionsWrapper.prototype.isSuppressPreventDefaultOnMouseWheel = function () { return isTrue(this.gridOptions.suppressPreventDefaultOnMouseWheel); }; GridOptionsWrapper.prototype.isEnableServerSideSorting = function () { return isTrue(this.gridOptions.enableServerSideSorting); }; GridOptionsWrapper.prototype.isSuppressContextMenu = function () { return isTrue(this.gridOptions.suppressContextMenu); }; GridOptionsWrapper.prototype.isEnableFilter = function () { return isTrue(this.gridOptions.enableFilter) || isTrue(this.gridOptions.enableServerSideFilter); }; GridOptionsWrapper.prototype.isEnableServerSideFilter = function () { return this.gridOptions.enableServerSideFilter; }; GridOptionsWrapper.prototype.isSuppressScrollLag = function () { return isTrue(this.gridOptions.suppressScrollLag); }; GridOptionsWrapper.prototype.isSuppressMovableColumns = function () { return isTrue(this.gridOptions.suppressMovableColumns); }; GridOptionsWrapper.prototype.isSuppressColumnMoveAnimation = function () { return isTrue(this.gridOptions.suppressColumnMoveAnimation); }; GridOptionsWrapper.prototype.isSuppressMenuColumnPanel = function () { return isTrue(this.gridOptions.suppressMenuColumnPanel); }; GridOptionsWrapper.prototype.isSuppressMenuFilterPanel = function () { return isTrue(this.gridOptions.suppressMenuFilterPanel); }; GridOptionsWrapper.prototype.isSuppressMenuMainPanel = function () { return isTrue(this.gridOptions.suppressMenuMainPanel); }; GridOptionsWrapper.prototype.isEnableRangeSelection = function () { return isTrue(this.gridOptions.enableRangeSelection); }; GridOptionsWrapper.prototype.isRememberGroupStateWhenNewData = function () { return isTrue(this.gridOptions.rememberGroupStateWhenNewData); }; GridOptionsWrapper.prototype.getIcons = function () { return this.gridOptions.icons; }; GridOptionsWrapper.prototype.getIsScrollLag = function () { return this.gridOptions.isScrollLag; }; GridOptionsWrapper.prototype.getSortingOrder = function () { return this.gridOptions.sortingOrder; }; GridOptionsWrapper.prototype.getSlaveGrids = function () { return this.gridOptions.slaveGrids; }; GridOptionsWrapper.prototype.getGroupRowRenderer = function () { return this.gridOptions.groupRowRenderer; }; GridOptionsWrapper.prototype.getGroupRowRendererParams = function () { return this.gridOptions.groupRowRendererParams; }; GridOptionsWrapper.prototype.getGroupRowInnerRenderer = function () { return this.gridOptions.groupRowInnerRenderer; }; GridOptionsWrapper.prototype.getOverlayLoadingTemplate = function () { return this.gridOptions.overlayLoadingTemplate; }; GridOptionsWrapper.prototype.getOverlayNoRowsTemplate = function () { return this.gridOptions.overlayNoRowsTemplate; }; GridOptionsWrapper.prototype.getCheckboxSelection = function () { return this.gridOptions.checkboxSelection; }; GridOptionsWrapper.prototype.isSuppressAutoSize = function () { return isTrue(this.gridOptions.suppressAutoSize); }; GridOptionsWrapper.prototype.isSuppressParentsInRowNodes = function () { return isTrue(this.gridOptions.suppressParentsInRowNodes); }; GridOptionsWrapper.prototype.isEnableStatusBar = function () { return isTrue(this.gridOptions.enableStatusBar); }; GridOptionsWrapper.prototype.getHeaderCellTemplate = function () { return this.gridOptions.headerCellTemplate; }; GridOptionsWrapper.prototype.getHeaderCellTemplateFunc = function () { return this.gridOptions.getHeaderCellTemplate; }; GridOptionsWrapper.prototype.getNodeChildDetailsFunc = function () { return this.gridOptions.getNodeChildDetails; }; GridOptionsWrapper.prototype.getContextMenuItemsFunc = function () { return this.gridOptions.getContextMenuItems; }; GridOptionsWrapper.prototype.getMainMenuItemsFunc = function () { return this.gridOptions.getMainMenuItems; }; GridOptionsWrapper.prototype.getProcessCellForClipboardFunc = function () { return this.gridOptions.processCellForClipboard; }; GridOptionsWrapper.prototype.getViewportRowModelPageSize = function () { return positiveNumberOrZero(this.gridOptions.viewportRowModelPageSize, DEFAULT_VIEWPORT_ROW_MODEL_PAGE_SIZE); }; GridOptionsWrapper.prototype.getViewportRowModelBufferSize = function () { return positiveNumberOrZero(this.gridOptions.viewportRowModelBufferSize, DEFAULT_VIEWPORT_ROW_MODEL_BUFFER_SIZE); }; // public getCellRenderers(): {[key: string]: {new(): ICellRenderer} | ICellRendererFunc} { return this.gridOptions.cellRenderers; } // public getCellEditors(): {[key: string]: {new(): ICellEditor}} { return this.gridOptions.cellEditors; } GridOptionsWrapper.prototype.executeProcessRowPostCreateFunc = function (params) { if (this.gridOptions.processRowPostCreate) { this.gridOptions.processRowPostCreate(params); } }; // properties GridOptionsWrapper.prototype.getHeaderHeight = function () { if (typeof this.headerHeight === 'number') { return this.headerHeight; } else { return 25; } }; GridOptionsWrapper.prototype.setHeaderHeight = function (headerHeight) { this.headerHeight = headerHeight; this.eventService.dispatchEvent(events_1.Events.EVENT_HEADER_HEIGHT_CHANGED); }; GridOptionsWrapper.prototype.isExternalFilterPresent = function () { if (typeof this.gridOptions.isExternalFilterPresent === 'function') { return this.gridOptions.isExternalFilterPresent(); } else { return false; } }; GridOptionsWrapper.prototype.doesExternalFilterPass = function (node) { if (typeof this.gridOptions.doesExternalFilterPass === 'function') { return this.gridOptions.doesExternalFilterPass(node); } else { return false; } }; GridOptionsWrapper.prototype.getMinColWidth = function () { if (this.gridOptions.minColWidth > GridOptionsWrapper.MIN_COL_WIDTH) { return this.gridOptions.minColWidth; } else { return GridOptionsWrapper.MIN_COL_WIDTH; } }; GridOptionsWrapper.prototype.getMaxColWidth = function () { if (this.gridOptions.maxColWidth > GridOptionsWrapper.MIN_COL_WIDTH) { return this.gridOptions.maxColWidth; } else { return null; } }; GridOptionsWrapper.prototype.getColWidth = function () { if (typeof this.gridOptions.colWidth !== 'number' || this.gridOptions.colWidth < GridOptionsWrapper.MIN_COL_WIDTH) { return 200; } else { return this.gridOptions.colWidth; } }; GridOptionsWrapper.prototype.getRowBuffer = function () { if (typeof this.gridOptions.rowBuffer === 'number') { if (this.gridOptions.rowBuffer < 0) { console.warn('ag-Grid: rowBuffer should not be negative'); } return this.gridOptions.rowBuffer; } else { return constants_1.Constants.ROW_BUFFER_SIZE; } }; GridOptionsWrapper.prototype.checkForDeprecated = function () { // casting to generic object, so typescript compiles even though // we are looking for attributes that don't exist var options = this.gridOptions; if (options.suppressUnSort) { console.warn('ag-grid: as of v1.12.4 suppressUnSort is not used. Please use sortOrder instead.'); } if (options.suppressDescSort) { console.warn('ag-grid: as of v1.12.4 suppressDescSort is not used. Please use sortOrder instead.'); } if (options.groupAggFields) { console.warn('ag-grid: as of v3 groupAggFields is not used. Please add appropriate agg fields to your columns.'); } if (options.groupHidePivotColumns) { console.warn('ag-grid: as of v3 groupHidePivotColumns is not used as pivot columns are now called rowGroup columns. Please refer to the documentation'); } if (options.groupKeys) { console.warn('ag-grid: as of v3 groupKeys is not used. You need to set rowGroupIndex on the columns to group. Please refer to the documentation'); } if (options.ready || options.onReady) { console.warn('ag-grid: as of v3.3 ready event is now called gridReady, so the callback should be onGridReady'); } if (typeof options.groupDefaultExpanded === 'boolean') { console.warn('ag-grid: groupDefaultExpanded can no longer be boolean. for groupDefaultExpanded=true, use groupDefaultExpanded=9999 instead, to expand all the groups'); } if (options.onRowDeselected || options.rowDeselected) { console.warn('ag-grid: since version 3.4 event rowDeselected no longer exists, please check the docs'); } if (options.rowsAlreadyGrouped) { console.warn('ag-grid: since version 3.4 rowsAlreadyGrouped no longer exists, please use getNodeChildDetails() instead'); } if (options.groupAggFunction) { console.warn('ag-grid: since version 4.2.0 groupAggFunction no longer exists, please check documentation on how to do custom aggregations, aggFunc on the colDef can now be a function'); } }; GridOptionsWrapper.prototype.getLocaleTextFunc = function () { if (this.gridOptions.localeTextFunc) { return this.gridOptions.localeTextFunc; } var that = this; return function (key, defaultValue) { var localeText = that.gridOptions.localeText; if (localeText && localeText[key]) { return localeText[key]; } else { return defaultValue; } }; }; // responsible for calling the onXXX functions on gridOptions GridOptionsWrapper.prototype.globalEventHandler = function (eventName, event) { var callbackMethodName = componentUtil_1.ComponentUtil.getCallbackForEvent(eventName); if (typeof this.gridOptions[callbackMethodName] === 'function') { this.gridOptions[callbackMethodName](event); } }; // we don't allow dynamic row height for virtual paging GridOptionsWrapper.prototype.getRowHeightAsNumber = function () { var rowHeight = this.gridOptions.rowHeight; if (utils_1.Utils.missing(rowHeight)) { return DEFAULT_ROW_HEIGHT; } else if (typeof this.gridOptions.rowHeight === 'number') { return this.gridOptions.rowHeight; } else { console.warn('ag-Grid row height must be a number if not using standard row model'); return DEFAULT_ROW_HEIGHT; } }; GridOptionsWrapper.prototype.getRowHeightForNode = function (rowNode) { if (typeof this.gridOptions.rowHeight === 'number') { return this.gridOptions.rowHeight; } else if (typeof this.gridOptions.getRowHeight === 'function') { var params = { node: rowNode, data: rowNode.data, api: this.gridOptions.api, context: this.gridOptions.context }; return this.gridOptions.getRowHeight(params); } else { return DEFAULT_ROW_HEIGHT; } }; GridOptionsWrapper.MIN_COL_WIDTH = 10; __decorate([ context_1.Autowired('gridOptions'), __metadata('design:type', Object) ], GridOptionsWrapper.prototype, "gridOptions", void 0); __decorate([ context_1.Autowired('columnController'), __metadata('design:type', columnController_1.ColumnController) ], GridOptionsWrapper.prototype, "columnController", void 0); __decorate([ context_1.Autowired('eventService'), __metadata('design:type', eventService_1.EventService) ], GridOptionsWrapper.prototype, "eventService", void 0); __decorate([ context_1.Autowired('enterprise'), __metadata('design:type', Boolean) ], GridOptionsWrapper.prototype, "enterprise", void 0); __decorate([ __param(0, context_1.Qualifier('gridApi')), __param(1, context_1.Qualifier('columnApi')), __metadata('design:type', Function), __metadata('design:paramtypes', [gridApi_1.GridApi, columnController_1.ColumnApi]), __metadata('design:returntype', void 0) ], GridOptionsWrapper.prototype, "agWire", null); __decorate([ context_1.PostConstruct, __metadata('design:type', Function), __metadata('design:paramtypes', []), __metadata('design:returntype', void 0) ], GridOptionsWrapper.prototype, "init", null); GridOptionsWrapper = __decorate([ context_1.Bean('gridOptionsWrapper'), __metadata('design:paramtypes', []) ], GridOptionsWrapper); return GridOptionsWrapper; })(); exports.GridOptionsWrapper = GridOptionsWrapper;
redmunds/cdnjs
ajax/libs/ag-grid/4.2.2/lib/gridOptionsWrapper.js
JavaScript
mit
22,813
"use strict"; exports.__esModule = true; exports.transformFileSync = exports.transformFile = exports.transformFromAst = exports.transform = exports.analyse = exports.Pipeline = exports.Plugin = exports.OptionManager = exports.traverse = exports.types = exports.messages = exports.util = exports.version = exports.template = exports.buildExternalHelpers = exports.options = exports.File = undefined; var _node = require("./node"); Object.defineProperty(exports, "File", { enumerable: true, get: function get() { return _node.File; } }); Object.defineProperty(exports, "options", { enumerable: true, get: function get() { return _node.options; } }); Object.defineProperty(exports, "buildExternalHelpers", { enumerable: true, get: function get() { return _node.buildExternalHelpers; } }); Object.defineProperty(exports, "template", { enumerable: true, get: function get() { return _node.template; } }); Object.defineProperty(exports, "version", { enumerable: true, get: function get() { return _node.version; } }); Object.defineProperty(exports, "util", { enumerable: true, get: function get() { return _node.util; } }); Object.defineProperty(exports, "messages", { enumerable: true, get: function get() { return _node.messages; } }); Object.defineProperty(exports, "types", { enumerable: true, get: function get() { return _node.types; } }); Object.defineProperty(exports, "traverse", { enumerable: true, get: function get() { return _node.traverse; } }); Object.defineProperty(exports, "OptionManager", { enumerable: true, get: function get() { return _node.OptionManager; } }); Object.defineProperty(exports, "Plugin", { enumerable: true, get: function get() { return _node.Plugin; } }); Object.defineProperty(exports, "Pipeline", { enumerable: true, get: function get() { return _node.Pipeline; } }); Object.defineProperty(exports, "analyse", { enumerable: true, get: function get() { return _node.analyse; } }); Object.defineProperty(exports, "transform", { enumerable: true, get: function get() { return _node.transform; } }); Object.defineProperty(exports, "transformFromAst", { enumerable: true, get: function get() { return _node.transformFromAst; } }); Object.defineProperty(exports, "transformFile", { enumerable: true, get: function get() { return _node.transformFile; } }); Object.defineProperty(exports, "transformFileSync", { enumerable: true, get: function get() { return _node.transformFileSync; } }); exports.run = run; exports.load = load; function run(code) { var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; return new Function((0, _node.transform)(code, opts).code)(); } function load(url, callback) { var opts = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; var hold = arguments[3]; opts.filename = opts.filename || url; var xhr = global.ActiveXObject ? new global.ActiveXObject("Microsoft.XMLHTTP") : new global.XMLHttpRequest(); xhr.open("GET", url, true); if ("overrideMimeType" in xhr) xhr.overrideMimeType("text/plain"); xhr.onreadystatechange = function () { if (xhr.readyState !== 4) return; var status = xhr.status; if (status === 0 || status === 200) { var param = [xhr.responseText, opts]; if (!hold) run(param); if (callback) callback(param); } else { throw new Error("Could not load " + url); } }; xhr.send(null); } function runScripts() { var scripts = []; var types = ["text/ecmascript-6", "text/6to5", "text/babel", "module"]; var index = 0; /** * Transform and execute script. Ensures correct load order. */ function exec() { var param = scripts[index]; if (param instanceof Array) { run(param, index); index++; exec(); } } /** * Load, transform, and execute all scripts. */ function run(script, i) { var opts = {}; if (script.src) { load(script.src, function (param) { scripts[i] = param; exec(); }, opts, true); } else { opts.filename = "embedded"; scripts[i] = [script.innerHTML, opts]; } } // Collect scripts with Babel `types`. var _scripts = global.document.getElementsByTagName("script"); for (var i = 0; i < _scripts.length; ++i) { var _script = _scripts[i]; if (types.indexOf(_script.type) >= 0) scripts.push(_script); } for (var _i = 0; _i < scripts.length; _i++) { run(scripts[_i], _i); } exec(); } /** * Register load event to transform and execute scripts. */ if (global.addEventListener) { global.addEventListener("DOMContentLoaded", runScripts, false); } else if (global.attachEvent) { global.attachEvent("onload", runScripts); }
Winfore/ReactNativePro
node_modules/babel-core/lib/api/browser.js
JavaScript
mit
4,849
/* crypto/rand/rand_win.c */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ /* ==================================================================== * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #include "cryptlib.h" #include <openssl/rand.h> #include "rand_lcl.h" #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) #include <windows.h> #ifndef _WIN32_WINNT # define _WIN32_WINNT 0x0400 #endif #include <wincrypt.h> #include <tlhelp32.h> /* Limit the time spent walking through the heap, processes, threads and modules to a maximum of 1000 miliseconds each, unless CryptoGenRandom failed */ #define MAXDELAY 1000 /* Intel hardware RNG CSP -- available from * http://developer.intel.com/design/security/rng/redist_license.htm */ #define PROV_INTEL_SEC 22 #define INTEL_DEF_PROV L"Intel Hardware Cryptographic Service Provider" static void readtimer(void); static void readscreen(void); /* It appears like CURSORINFO, PCURSORINFO and LPCURSORINFO are only defined when WINVER is 0x0500 and up, which currently only happens on Win2000. Unfortunately, those are typedefs, so they're a little bit difficult to detect properly. On the other hand, the macro CURSOR_SHOWING is defined within the same conditional, so it can be use to detect the absence of said typedefs. */ #ifndef CURSOR_SHOWING /* * Information about the global cursor. */ typedef struct tagCURSORINFO { DWORD cbSize; DWORD flags; HCURSOR hCursor; POINT ptScreenPos; } CURSORINFO, *PCURSORINFO, *LPCURSORINFO; #define CURSOR_SHOWING 0x00000001 #endif /* CURSOR_SHOWING */ #if !defined(OPENSSL_SYS_WINCE) typedef BOOL (WINAPI *CRYPTACQUIRECONTEXTW)(HCRYPTPROV *, LPCWSTR, LPCWSTR, DWORD, DWORD); typedef BOOL (WINAPI *CRYPTGENRANDOM)(HCRYPTPROV, DWORD, BYTE *); typedef BOOL (WINAPI *CRYPTRELEASECONTEXT)(HCRYPTPROV, DWORD); typedef HWND (WINAPI *GETFOREGROUNDWINDOW)(VOID); typedef BOOL (WINAPI *GETCURSORINFO)(PCURSORINFO); typedef DWORD (WINAPI *GETQUEUESTATUS)(UINT); typedef HANDLE (WINAPI *CREATETOOLHELP32SNAPSHOT)(DWORD, DWORD); typedef BOOL (WINAPI *CLOSETOOLHELP32SNAPSHOT)(HANDLE); typedef BOOL (WINAPI *HEAP32FIRST)(LPHEAPENTRY32, DWORD, size_t); typedef BOOL (WINAPI *HEAP32NEXT)(LPHEAPENTRY32); typedef BOOL (WINAPI *HEAP32LIST)(HANDLE, LPHEAPLIST32); typedef BOOL (WINAPI *PROCESS32)(HANDLE, LPPROCESSENTRY32); typedef BOOL (WINAPI *THREAD32)(HANDLE, LPTHREADENTRY32); typedef BOOL (WINAPI *MODULE32)(HANDLE, LPMODULEENTRY32); #include <lmcons.h> #include <lmstats.h> #if 1 /* The NET API is Unicode only. It requires the use of the UNICODE * macro. When UNICODE is defined LPTSTR becomes LPWSTR. LMSTR was * was added to the Platform SDK to allow the NET API to be used in * non-Unicode applications provided that Unicode strings were still * used for input. LMSTR is defined as LPWSTR. */ typedef NET_API_STATUS (NET_API_FUNCTION * NETSTATGET) (LPWSTR, LPWSTR, DWORD, DWORD, LPBYTE*); typedef NET_API_STATUS (NET_API_FUNCTION * NETFREE)(LPBYTE); #endif /* 1 */ #endif /* !OPENSSL_SYS_WINCE */ int RAND_poll(void) { MEMORYSTATUS m; HCRYPTPROV hProvider = 0; DWORD w; int good = 0; /* Determine the OS version we are on so we can turn off things * that do not work properly. */ OSVERSIONINFO osverinfo ; osverinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO) ; GetVersionEx( &osverinfo ) ; #if defined(OPENSSL_SYS_WINCE) # if defined(_WIN32_WCE) && _WIN32_WCE>=300 /* Even though MSDN says _WIN32_WCE>=210, it doesn't seem to be available * in commonly available implementations prior 300... */ { BYTE buf[64]; /* poll the CryptoAPI PRNG */ /* The CryptoAPI returns sizeof(buf) bytes of randomness */ if (CryptAcquireContextW(&hProvider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) { if (CryptGenRandom(hProvider, sizeof(buf), buf)) RAND_add(buf, sizeof(buf), sizeof(buf)); CryptReleaseContext(hProvider, 0); } } # endif #else /* OPENSSL_SYS_WINCE */ /* * None of below libraries are present on Windows CE, which is * why we #ifndef the whole section. This also excuses us from * handling the GetProcAddress issue. The trouble is that in * real Win32 API GetProcAddress is available in ANSI flavor * only. In WinCE on the other hand GetProcAddress is a macro * most commonly defined as GetProcAddressW, which accepts * Unicode argument. If we were to call GetProcAddress under * WinCE, I'd recommend to either redefine GetProcAddress as * GetProcAddressA (there seem to be one in common CE spec) or * implement own shim routine, which would accept ANSI argument * and expand it to Unicode. */ { /* load functions dynamically - not available on all systems */ HMODULE advapi = LoadLibrary(TEXT("ADVAPI32.DLL")); HMODULE kernel = LoadLibrary(TEXT("KERNEL32.DLL")); HMODULE user = NULL; HMODULE netapi = LoadLibrary(TEXT("NETAPI32.DLL")); CRYPTACQUIRECONTEXTW acquire = NULL; CRYPTGENRANDOM gen = NULL; CRYPTRELEASECONTEXT release = NULL; NETSTATGET netstatget = NULL; NETFREE netfree = NULL; BYTE buf[64]; if (netapi) { netstatget = (NETSTATGET) GetProcAddress(netapi,"NetStatisticsGet"); netfree = (NETFREE) GetProcAddress(netapi,"NetApiBufferFree"); } if (netstatget && netfree) { LPBYTE outbuf; /* NetStatisticsGet() is a Unicode only function * STAT_WORKSTATION_0 contains 45 fields and STAT_SERVER_0 * contains 17 fields. We treat each field as a source of * one byte of entropy. */ if (netstatget(NULL, L"LanmanWorkstation", 0, 0, &outbuf) == 0) { RAND_add(outbuf, sizeof(STAT_WORKSTATION_0), 45); netfree(outbuf); } if (netstatget(NULL, L"LanmanServer", 0, 0, &outbuf) == 0) { RAND_add(outbuf, sizeof(STAT_SERVER_0), 17); netfree(outbuf); } } if (netapi) FreeLibrary(netapi); /* It appears like this can cause an exception deep within ADVAPI32.DLL * at random times on Windows 2000. Reported by Jeffrey Altman. * Only use it on NT. */ /* Wolfgang Marczy <WMarczy@topcall.co.at> reports that * the RegQueryValueEx call below can hang on NT4.0 (SP6). * So we don't use this at all for now. */ #if 0 if ( osverinfo.dwPlatformId == VER_PLATFORM_WIN32_NT && osverinfo.dwMajorVersion < 5) { /* Read Performance Statistics from NT/2000 registry * The size of the performance data can vary from call * to call so we must guess the size of the buffer to use * and increase its size if we get an ERROR_MORE_DATA * return instead of ERROR_SUCCESS. */ LONG rc=ERROR_MORE_DATA; char * buf=NULL; DWORD bufsz=0; DWORD length; while (rc == ERROR_MORE_DATA) { buf = realloc(buf,bufsz+8192); if (!buf) break; bufsz += 8192; length = bufsz; rc = RegQueryValueEx(HKEY_PERFORMANCE_DATA, TEXT("Global"), NULL, NULL, buf, &length); } if (rc == ERROR_SUCCESS) { /* For entropy count assume only least significant * byte of each DWORD is random. */ RAND_add(&length, sizeof(length), 0); RAND_add(buf, length, length / 4.0); /* Close the Registry Key to allow Windows to cleanup/close * the open handle * Note: The 'HKEY_PERFORMANCE_DATA' key is implicitly opened * when the RegQueryValueEx above is done. However, if * it is not explicitly closed, it can cause disk * partition manipulation problems. */ RegCloseKey(HKEY_PERFORMANCE_DATA); } if (buf) free(buf); } #endif if (advapi) { /* * If it's available, then it's available in both ANSI * and UNICODE flavors even in Win9x, documentation says. * We favor Unicode... */ acquire = (CRYPTACQUIRECONTEXTW) GetProcAddress(advapi, "CryptAcquireContextW"); gen = (CRYPTGENRANDOM) GetProcAddress(advapi, "CryptGenRandom"); release = (CRYPTRELEASECONTEXT) GetProcAddress(advapi, "CryptReleaseContext"); } if (acquire && gen && release) { /* poll the CryptoAPI PRNG */ /* The CryptoAPI returns sizeof(buf) bytes of randomness */ if (acquire(&hProvider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) { if (gen(hProvider, sizeof(buf), buf) != 0) { RAND_add(buf, sizeof(buf), 0); good = 1; #if 0 printf("randomness from PROV_RSA_FULL\n"); #endif } release(hProvider, 0); } /* poll the Pentium PRG with CryptoAPI */ if (acquire(&hProvider, 0, INTEL_DEF_PROV, PROV_INTEL_SEC, 0)) { if (gen(hProvider, sizeof(buf), buf) != 0) { RAND_add(buf, sizeof(buf), sizeof(buf)); good = 1; #if 0 printf("randomness from PROV_INTEL_SEC\n"); #endif } release(hProvider, 0); } } if (advapi) FreeLibrary(advapi); if ((osverinfo.dwPlatformId != VER_PLATFORM_WIN32_NT || !OPENSSL_isservice()) && (user = LoadLibrary(TEXT("USER32.DLL")))) { GETCURSORINFO cursor; GETFOREGROUNDWINDOW win; GETQUEUESTATUS queue; win = (GETFOREGROUNDWINDOW) GetProcAddress(user, "GetForegroundWindow"); cursor = (GETCURSORINFO) GetProcAddress(user, "GetCursorInfo"); queue = (GETQUEUESTATUS) GetProcAddress(user, "GetQueueStatus"); if (win) { /* window handle */ HWND h = win(); RAND_add(&h, sizeof(h), 0); } if (cursor) { /* unfortunately, its not safe to call GetCursorInfo() * on NT4 even though it exists in SP3 (or SP6) and * higher. */ if ( osverinfo.dwPlatformId == VER_PLATFORM_WIN32_NT && osverinfo.dwMajorVersion < 5) cursor = 0; } if (cursor) { /* cursor position */ /* assume 2 bytes of entropy */ CURSORINFO ci; ci.cbSize = sizeof(CURSORINFO); if (cursor(&ci)) RAND_add(&ci, ci.cbSize, 2); } if (queue) { /* message queue status */ /* assume 1 byte of entropy */ w = queue(QS_ALLEVENTS); RAND_add(&w, sizeof(w), 1); } FreeLibrary(user); } /* Toolhelp32 snapshot: enumerate processes, threads, modules and heap * http://msdn.microsoft.com/library/psdk/winbase/toolhelp_5pfd.htm * (Win 9x and 2000 only, not available on NT) * * This seeding method was proposed in Peter Gutmann, Software * Generation of Practically Strong Random Numbers, * http://www.usenix.org/publications/library/proceedings/sec98/gutmann.html * revised version at http://www.cryptoengines.com/~peter/06_random.pdf * (The assignment of entropy estimates below is arbitrary, but based * on Peter's analysis the full poll appears to be safe. Additional * interactive seeding is encouraged.) */ if (kernel) { CREATETOOLHELP32SNAPSHOT snap; CLOSETOOLHELP32SNAPSHOT close_snap; HANDLE handle; HEAP32FIRST heap_first; HEAP32NEXT heap_next; HEAP32LIST heaplist_first, heaplist_next; PROCESS32 process_first, process_next; THREAD32 thread_first, thread_next; MODULE32 module_first, module_next; HEAPLIST32 hlist; HEAPENTRY32 hentry; PROCESSENTRY32 p; THREADENTRY32 t; MODULEENTRY32 m; DWORD starttime = 0; snap = (CREATETOOLHELP32SNAPSHOT) GetProcAddress(kernel, "CreateToolhelp32Snapshot"); close_snap = (CLOSETOOLHELP32SNAPSHOT) GetProcAddress(kernel, "CloseToolhelp32Snapshot"); heap_first = (HEAP32FIRST) GetProcAddress(kernel, "Heap32First"); heap_next = (HEAP32NEXT) GetProcAddress(kernel, "Heap32Next"); heaplist_first = (HEAP32LIST) GetProcAddress(kernel, "Heap32ListFirst"); heaplist_next = (HEAP32LIST) GetProcAddress(kernel, "Heap32ListNext"); process_first = (PROCESS32) GetProcAddress(kernel, "Process32First"); process_next = (PROCESS32) GetProcAddress(kernel, "Process32Next"); thread_first = (THREAD32) GetProcAddress(kernel, "Thread32First"); thread_next = (THREAD32) GetProcAddress(kernel, "Thread32Next"); module_first = (MODULE32) GetProcAddress(kernel, "Module32First"); module_next = (MODULE32) GetProcAddress(kernel, "Module32Next"); if (snap && heap_first && heap_next && heaplist_first && heaplist_next && process_first && process_next && thread_first && thread_next && module_first && module_next && (handle = snap(TH32CS_SNAPALL,0)) != INVALID_HANDLE_VALUE) { /* heap list and heap walking */ /* HEAPLIST32 contains 3 fields that will change with * each entry. Consider each field a source of 1 byte * of entropy. * HEAPENTRY32 contains 5 fields that will change with * each entry. Consider each field a source of 1 byte * of entropy. */ ZeroMemory(&hlist, sizeof(HEAPLIST32)); hlist.dwSize = sizeof(HEAPLIST32); if (good) starttime = GetTickCount(); #ifdef _MSC_VER if (heaplist_first(handle, &hlist)) { /* following discussion on dev ML, exception on WinCE (or other Win platform) is theoretically of unknown origin; prevent infinite loop here when this theoretical case occurs; otherwise cope with the expected (MSDN documented) exception-throwing behaviour of Heap32Next() on WinCE. based on patch in original message by Tanguy Fautré (2009/03/02) Subject: RAND_poll() and CreateToolhelp32Snapshot() stability */ int ex_cnt_limit = 42; do { RAND_add(&hlist, hlist.dwSize, 3); __try { ZeroMemory(&hentry, sizeof(HEAPENTRY32)); hentry.dwSize = sizeof(HEAPENTRY32); if (heap_first(&hentry, hlist.th32ProcessID, hlist.th32HeapID)) { int entrycnt = 80; do RAND_add(&hentry, hentry.dwSize, 5); while (heap_next(&hentry) && (!good || (GetTickCount()-starttime)<MAXDELAY) && --entrycnt > 0); } } __except (EXCEPTION_EXECUTE_HANDLER) { /* ignore access violations when walking the heap list */ ex_cnt_limit--; } } while (heaplist_next(handle, &hlist) && (!good || (GetTickCount()-starttime)<MAXDELAY) && ex_cnt_limit > 0); } #else if (heaplist_first(handle, &hlist)) { do { RAND_add(&hlist, hlist.dwSize, 3); hentry.dwSize = sizeof(HEAPENTRY32); if (heap_first(&hentry, hlist.th32ProcessID, hlist.th32HeapID)) { int entrycnt = 80; do RAND_add(&hentry, hentry.dwSize, 5); while (heap_next(&hentry) && --entrycnt > 0); } } while (heaplist_next(handle, &hlist) && (!good || (GetTickCount()-starttime)<MAXDELAY)); } #endif /* process walking */ /* PROCESSENTRY32 contains 9 fields that will change * with each entry. Consider each field a source of * 1 byte of entropy. */ p.dwSize = sizeof(PROCESSENTRY32); if (good) starttime = GetTickCount(); if (process_first(handle, &p)) do RAND_add(&p, p.dwSize, 9); while (process_next(handle, &p) && (!good || (GetTickCount()-starttime)<MAXDELAY)); /* thread walking */ /* THREADENTRY32 contains 6 fields that will change * with each entry. Consider each field a source of * 1 byte of entropy. */ t.dwSize = sizeof(THREADENTRY32); if (good) starttime = GetTickCount(); if (thread_first(handle, &t)) do RAND_add(&t, t.dwSize, 6); while (thread_next(handle, &t) && (!good || (GetTickCount()-starttime)<MAXDELAY)); /* module walking */ /* MODULEENTRY32 contains 9 fields that will change * with each entry. Consider each field a source of * 1 byte of entropy. */ m.dwSize = sizeof(MODULEENTRY32); if (good) starttime = GetTickCount(); if (module_first(handle, &m)) do RAND_add(&m, m.dwSize, 9); while (module_next(handle, &m) && (!good || (GetTickCount()-starttime)<MAXDELAY)); if (close_snap) close_snap(handle); else CloseHandle(handle); } FreeLibrary(kernel); } } #endif /* !OPENSSL_SYS_WINCE */ /* timer data */ readtimer(); /* memory usage statistics */ GlobalMemoryStatus(&m); RAND_add(&m, sizeof(m), 1); /* process ID */ w = GetCurrentProcessId(); RAND_add(&w, sizeof(w), 1); #if 0 printf("Exiting RAND_poll\n"); #endif return(1); } int RAND_event(UINT iMsg, WPARAM wParam, LPARAM lParam) { double add_entropy=0; switch (iMsg) { case WM_KEYDOWN: { static WPARAM key; if (key != wParam) add_entropy = 0.05; key = wParam; } break; case WM_MOUSEMOVE: { static int lastx,lasty,lastdx,lastdy; int x,y,dx,dy; x=LOWORD(lParam); y=HIWORD(lParam); dx=lastx-x; dy=lasty-y; if (dx != 0 && dy != 0 && dx-lastdx != 0 && dy-lastdy != 0) add_entropy=.2; lastx=x, lasty=y; lastdx=dx, lastdy=dy; } break; } readtimer(); RAND_add(&iMsg, sizeof(iMsg), add_entropy); RAND_add(&wParam, sizeof(wParam), 0); RAND_add(&lParam, sizeof(lParam), 0); return (RAND_status()); } void RAND_screen(void) /* function available for backward compatibility */ { RAND_poll(); readscreen(); } /* feed timing information to the PRNG */ static void readtimer(void) { DWORD w; LARGE_INTEGER l; static int have_perfc = 1; #if defined(_MSC_VER) && defined(_M_X86) static int have_tsc = 1; DWORD cyclecount; if (have_tsc) { __try { __asm { _emit 0x0f _emit 0x31 mov cyclecount, eax } RAND_add(&cyclecount, sizeof(cyclecount), 1); } __except(EXCEPTION_EXECUTE_HANDLER) { have_tsc = 0; } } #else # define have_tsc 0 #endif if (have_perfc) { if (QueryPerformanceCounter(&l) == 0) have_perfc = 0; else RAND_add(&l, sizeof(l), 0); } if (!have_tsc && !have_perfc) { w = GetTickCount(); RAND_add(&w, sizeof(w), 0); } } /* feed screen contents to PRNG */ /***************************************************************************** * * Created 960901 by Gertjan van Oosten, gertjan@West.NL, West Consulting B.V. * * Code adapted from * <URL:http://support.microsoft.com/default.aspx?scid=kb;[LN];97193>; * the original copyright message is: * * (C) Copyright Microsoft Corp. 1993. All rights reserved. * * You have a royalty-free right to use, modify, reproduce and * distribute the Sample Files (and/or any modified version) in * any way you find useful, provided that you agree that * Microsoft has no warranty obligations or liability for any * Sample Application Files which are modified. */ static void readscreen(void) { #if !defined(OPENSSL_SYS_WINCE) && !defined(OPENSSL_SYS_WIN32_CYGWIN) HDC hScrDC; /* screen DC */ HDC hMemDC; /* memory DC */ HBITMAP hBitmap; /* handle for our bitmap */ HBITMAP hOldBitmap; /* handle for previous bitmap */ BITMAP bm; /* bitmap properties */ unsigned int size; /* size of bitmap */ char *bmbits; /* contents of bitmap */ int w; /* screen width */ int h; /* screen height */ int y; /* y-coordinate of screen lines to grab */ int n = 16; /* number of screen lines to grab at a time */ if (GetVersion() < 0x80000000 && OPENSSL_isservice()>0) return; /* Create a screen DC and a memory DC compatible to screen DC */ hScrDC = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL); hMemDC = CreateCompatibleDC(hScrDC); /* Get screen resolution */ w = GetDeviceCaps(hScrDC, HORZRES); h = GetDeviceCaps(hScrDC, VERTRES); /* Create a bitmap compatible with the screen DC */ hBitmap = CreateCompatibleBitmap(hScrDC, w, n); /* Select new bitmap into memory DC */ hOldBitmap = SelectObject(hMemDC, hBitmap); /* Get bitmap properties */ GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm); size = (unsigned int)bm.bmWidthBytes * bm.bmHeight * bm.bmPlanes; bmbits = OPENSSL_malloc(size); if (bmbits) { /* Now go through the whole screen, repeatedly grabbing n lines */ for (y = 0; y < h-n; y += n) { unsigned char md[MD_DIGEST_LENGTH]; /* Bitblt screen DC to memory DC */ BitBlt(hMemDC, 0, 0, w, n, hScrDC, 0, y, SRCCOPY); /* Copy bitmap bits from memory DC to bmbits */ GetBitmapBits(hBitmap, size, bmbits); /* Get the hash of the bitmap */ MD(bmbits,size,md); /* Seed the random generator with the hash value */ RAND_add(md, MD_DIGEST_LENGTH, 0); } OPENSSL_free(bmbits); } /* Select old bitmap back into memory DC */ hBitmap = SelectObject(hMemDC, hOldBitmap); /* Clean up */ DeleteObject(hBitmap); DeleteDC(hMemDC); DeleteDC(hScrDC); #endif /* !OPENSSL_SYS_WINCE */ } #endif
jjimenezg93/ai-pathfinding
moai/3rdparty/openssl-1.0.0d/crypto/rand/rand_win.c
C
mit
26,817
/* crypto/ecdsa/ecdsa_vrf.c */ /* * Written by Nils Larsch for the OpenSSL project */ /* ==================================================================== * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@OpenSSL.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #include "ecs_locl.h" #ifndef OPENSSL_NO_ENGINE #include <openssl/engine.h> #endif /* returns * 1: correct signature * 0: incorrect signature * -1: error */ int ECDSA_do_verify(const unsigned char *dgst, int dgst_len, const ECDSA_SIG *sig, EC_KEY *eckey) { ECDSA_DATA *ecdsa = ecdsa_check(eckey); if (ecdsa == NULL) return 0; return ecdsa->meth->ecdsa_do_verify(dgst, dgst_len, sig, eckey); } /* returns * 1: correct signature * 0: incorrect signature * -1: error */ int ECDSA_verify(int type, const unsigned char *dgst, int dgst_len, const unsigned char *sigbuf, int sig_len, EC_KEY *eckey) { ECDSA_SIG *s; int ret=-1; s = ECDSA_SIG_new(); if (s == NULL) return(ret); if (d2i_ECDSA_SIG(&s, &sigbuf, sig_len) == NULL) goto err; ret=ECDSA_do_verify(dgst, dgst_len, s, eckey); err: ECDSA_SIG_free(s); return(ret); }
thornbirdblue/codeaurora_lk
lib/openssl/crypto/ecdsa/ecs_vrf.c
C
mit
3,599
/* * DateJS Culture String File * Country Code: ar-SA * Name: Arabic (Saudi Arabia) * Format: "key" : "value" * Key is the en-US term, Value is the Key in the current language. */ Date.CultureStrings = Date.CultureStrings || {}; Date.CultureStrings["ar-SA"] = { "name": "ar-SA", "englishName": "Arabic (Saudi Arabia)", "nativeName": "العربية (المملكة العربية السعودية)", "Sunday": "الاحد", "Monday": "الاثنين", "Tuesday": "الثلاثاء", "Wednesday": "الاربعاء", "Thursday": "الخميس", "Friday": "الجمعة", "Saturday": "السبت", "Sun": "الاحد", "Mon": "الاثنين", "Tue": "الثلاثاء", "Wed": "الاربعاء", "Thu": "الخميس", "Fri": "الجمعة", "Sat": "السبت", "Su": "ح", "Mo": "ن", "Tu": "ث", "We": "ر", "Th": "خ", "Fr": "ج", "Sa": "س", "S_Sun_Initial": "ح", "M_Mon_Initial": "ن", "T_Tue_Initial": "ث", "W_Wed_Initial": "ر", "T_Thu_Initial": "خ", "F_Fri_Initial": "ج", "S_Sat_Initial": "س", "January": "محرم", "February": "صفر", "March": "ربيع الأول", "April": "ربيع الثاني", "May": "جمادى الأولى", "June": "جمادى الثانية", "July": "رجب", "August": "شعبان", "September": "رمضان", "October": "شوال", "November": "ذو القعدة", "December": "ذو الحجة", "Jan_Abbr": "محرم", "Feb_Abbr": "صفر", "Mar_Abbr": "ربيع الاول", "Apr_Abbr": "ربيع الثاني", "May_Abbr": "جمادى الاولى", "Jun_Abbr": "جمادى الثانية", "Jul_Abbr": "رجب", "Aug_Abbr": "شعبان", "Sep_Abbr": "رمضان", "Oct_Abbr": "شوال", "Nov_Abbr": "ذو القعدة", "Dec_Abbr": "ذو الحجة", "AM": "ص", "PM": "م", "firstDayOfWeek": 6, "twoDigitYearMax": 1451, "mdy": "dmy", "M/d/yyyy": "dd/MM/yy", "dddd, MMMM dd, yyyy": "dd/MMMM/yyyy", "h:mm tt": "hh:mm tt", "h:mm:ss tt": "hh:mm:ss tt", "dddd, MMMM dd, yyyy h:mm:ss tt": "dd/MMMM/yyyy hh:mm:ss tt", "yyyy-MM-ddTHH:mm:ss": "yyyy-MM-ddTHH:mm:ss", "yyyy-MM-dd HH:mm:ssZ": "yyyy-MM-dd HH:mm:ssZ", "ddd, dd MMM yyyy HH:mm:ss": "ddd, dd MMM yyyy HH:mm:ss", "MMMM dd": "dd MMMM", "MMMM, yyyy": "MMMM, yyyy", "/jan(uary)?/": "محرم", "/feb(ruary)?/": "صفر", "/mar(ch)?/": "ربيع الأول", "/apr(il)?/": "ربيع الثاني", "/may/": "جمادى الأولى", "/jun(e)?/": "جمادى الثانية", "/jul(y)?/": "رجب", "/aug(ust)?/": "شعبان", "/sep(t(ember)?)?/": "رمضان", "/oct(ober)?/": "شوال", "/nov(ember)?/": "ذو القعدة", "/dec(ember)?/": "ذو الحجة", "/^su(n(day)?)?/": "^الاحد", "/^mo(n(day)?)?/": "^الاثنين", "/^tu(e(s(day)?)?)?/": "^الثلاثاء", "/^we(d(nesday)?)?/": "^الاربعاء", "/^th(u(r(s(day)?)?)?)?/": "^الخميس", "/^fr(i(day)?)?/": "^الجمعة", "/^sa(t(urday)?)?/": "^السبت", "/^next/": "^next", "/^last|past|prev(ious)?/": "^last|past|prev(ious)?", "/^(\\+|aft(er)?|from|hence)/": "^(\\+|aft(er)?|from|hence)", "/^(\\-|bef(ore)?|ago)/": "^(\\-|bef(ore)?|ago)", "/^yes(terday)?/": "^yes(terday)?", "/^t(od(ay)?)?/": "^t(od(ay)?)?", "/^tom(orrow)?/": "^tom(orrow)?", "/^n(ow)?/": "^n(ow)?", "/^ms|milli(second)?s?/": "^ms|milli(second)?s?", "/^sec(ond)?s?/": "^sec(ond)?s?", "/^mn|min(ute)?s?/": "^mn|min(ute)?s?", "/^h(our)?s?/": "^h(our)?s?", "/^w(eek)?s?/": "^w(eek)?s?", "/^m(onth)?s?/": "^m(onth)?s?", "/^d(ay)?s?/": "^d(ay)?s?", "/^y(ear)?s?/": "^y(ear)?s?", "/^(a|p)/": "^(a|p)", "/^(a\\.?m?\\.?|p\\.?m?\\.?)/": "^(a\\.?m?\\.?|p\\.?m?\\.?)", "/^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\\s*(\\+|\\-)\\s*\\d\\d\\d\\d?)|gmt|utc)/": "^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\\s*(\\+|\\-)\\s*\\d\\d\\d\\d?)|gmt|utc)", "/^\\s*(st|nd|rd|th)/": "^\\s*(st|nd|rd|th)", "/^\\s*(\\:|a(?!u|p)|p)/": "^\\s*(\\:|a(?!u|p)|p)", "LINT": "LINT", "TOT": "TOT", "CHAST": "CHAST", "NZST": "NZST", "NFT": "NFT", "SBT": "SBT", "AEST": "AEST", "ACST": "ACST", "JST": "JST", "CWST": "CWST", "CT": "CT", "ICT": "ICT", "MMT": "MMT", "BIOT": "BST", "NPT": "NPT", "IST": "IST", "PKT": "PKT", "AFT": "AFT", "MSK": "MSK", "IRST": "IRST", "FET": "FET", "EET": "EET", "CET": "CET", "UTC": "UTC", "GMT": "GMT", "CVT": "CVT", "GST": "GST", "BRT": "BRT", "NST": "NST", "AST": "AST", "EST": "EST", "CST": "CST", "MST": "MST", "PST": "PST", "AKST": "AKST", "MIT": "MIT", "HST": "HST", "SST": "SST", "BIT": "BIT", "CHADT": "CHADT", "NZDT": "NZDT", "AEDT": "AEDT", "ACDT": "ACDT", "AZST": "AZST", "IRDT": "IRDT", "EEST": "EEST", "CEST": "CEST", "BST": "BST", "PMDT": "PMDT", "ADT": "ADT", "NDT": "NDT", "EDT": "EDT", "CDT": "CDT", "MDT": "MDT", "PDT": "PDT", "AKDT": "AKDT", "HADT": "HADT" }; Date.CultureStrings.lang = "ar-SA";
unit1pro/imlcom
vendors/DateJS/build/i18n/ar-SA.js
JavaScript
mit
6,026
/* * DateJS Culture String File * Country Code: smn-FI * Name: Sami (Inari) (Finland) * Format: "key" : "value" * Key is the en-US term, Value is the Key in the current language. */ Date.CultureStrings = Date.CultureStrings || {}; Date.CultureStrings["smn-FI"] = { "name": "smn-FI", "englishName": "Sami (Inari) (Finland)", "nativeName": "sämikielâ (Suomâ)", "Sunday": "pasepeivi", "Monday": "vuossargâ", "Tuesday": "majebargâ", "Wednesday": "koskokko", "Thursday": "tuorâstâh", "Friday": "vástuppeivi", "Saturday": "lávárdâh", "Sun": "pa", "Mon": "vu", "Tue": "ma", "Wed": "ko", "Thu": "tu", "Fri": "vá", "Sat": "lá", "Su": "pa", "Mo": "vu", "Tu": "ma", "We": "ko", "Th": "tu", "Fr": "vá", "Sa": "lá", "S_Sun_Initial": "p", "M_Mon_Initial": "v", "T_Tue_Initial": "m", "W_Wed_Initial": "k", "T_Thu_Initial": "t", "F_Fri_Initial": "v", "S_Sat_Initial": "l", "January": "uđđâivemáánu", "February": "kuovâmáánu", "March": "njuhčâmáánu", "April": "cuáŋuimáánu", "May": "vyesimáánu", "June": "kesimáánu", "July": "syeinimáánu", "August": "porgemáánu", "September": "čohčâmáánu", "October": "roovvâdmáánu", "November": "skammâmáánu", "December": "juovlâmáánu", "Jan_Abbr": "uđiv", "Feb_Abbr": "kuov", "Mar_Abbr": "njuh", "Apr_Abbr": "cuoŋ", "May_Abbr": "vyes", "Jun_Abbr": "kesi", "Jul_Abbr": "syei", "Aug_Abbr": "porg", "Sep_Abbr": "čoh", "Oct_Abbr": "roov", "Nov_Abbr": "ska", "Dec_Abbr": "juov", "AM": "", "PM": "", "firstDayOfWeek": 1, "twoDigitYearMax": 2029, "mdy": "dmy", "M/d/yyyy": "d.M.yyyy", "dddd, MMMM dd, yyyy": "MMMM d'. p. 'yyyy", "h:mm tt": "H:mm:ss", "h:mm:ss tt": "H:mm:ss", "dddd, MMMM dd, yyyy h:mm:ss tt": "MMMM d'. p. 'yyyy H:mm:ss", "yyyy-MM-ddTHH:mm:ss": "yyyy-MM-ddTHH:mm:ss", "yyyy-MM-dd HH:mm:ssZ": "yyyy-MM-dd HH:mm:ssZ", "ddd, dd MMM yyyy HH:mm:ss": "ddd, dd MMM yyyy HH:mm:ss", "MMMM dd": "MMMM dd", "MMMM, yyyy": "MMMM yyyy", "/jan(uary)?/": "uđđâivemáánu", "/feb(ruary)?/": "kuov(âmáánu)?", "/mar(ch)?/": "njuh(čâmáánu)?", "/apr(il)?/": "cuáŋuimáánu", "/may/": "vyes(imáánu)?", "/jun(e)?/": "kesi(máánu)?", "/jul(y)?/": "syei(nimáánu)?", "/aug(ust)?/": "porg(emáánu)?", "/sep(t(ember)?)?/": "čoh(čâmáánu)?", "/oct(ober)?/": "roov(vâdmáánu)?", "/nov(ember)?/": "ska(mmâmáánu)?", "/dec(ember)?/": "juov(lâmáánu)?", "/^su(n(day)?)?/": "^pasepeivi", "/^mo(n(day)?)?/": "^vuossargâ", "/^tu(e(s(day)?)?)?/": "^majebargâ", "/^we(d(nesday)?)?/": "^koskokko", "/^th(u(r(s(day)?)?)?)?/": "^tuorâstâh", "/^fr(i(day)?)?/": "^vástuppeivi", "/^sa(t(urday)?)?/": "^lávárdâh", "/^next/": "^next", "/^last|past|prev(ious)?/": "^last|past|prev(ious)?", "/^(\\+|aft(er)?|from|hence)/": "^(\\+|aft(er)?|from|hence)", "/^(\\-|bef(ore)?|ago)/": "^(\\-|bef(ore)?|ago)", "/^yes(terday)?/": "^yes(terday)?", "/^t(od(ay)?)?/": "^t(od(ay)?)?", "/^tom(orrow)?/": "^tom(orrow)?", "/^n(ow)?/": "^n(ow)?", "/^ms|milli(second)?s?/": "^ms|milli(second)?s?", "/^sec(ond)?s?/": "^sec(ond)?s?", "/^mn|min(ute)?s?/": "^mn|min(ute)?s?", "/^h(our)?s?/": "^h(our)?s?", "/^w(eek)?s?/": "^w(eek)?s?", "/^m(onth)?s?/": "^m(onth)?s?", "/^d(ay)?s?/": "^d(ay)?s?", "/^y(ear)?s?/": "^y(ear)?s?", "/^(a|p)/": "^(a|p)", "/^(a\\.?m?\\.?|p\\.?m?\\.?)/": "^(a\\.?m?\\.?|p\\.?m?\\.?)", "/^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\\s*(\\+|\\-)\\s*\\d\\d\\d\\d?)|gmt|utc)/": "^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\\s*(\\+|\\-)\\s*\\d\\d\\d\\d?)|gmt|utc)", "/^\\s*(st|nd|rd|th)/": "^\\s*(st|nd|rd|th)", "/^\\s*(\\:|a(?!u|p)|p)/": "^\\s*(\\:|a(?!u|p)|p)", "LINT": "LINT", "TOT": "TOT", "CHAST": "CHAST", "NZST": "NZST", "NFT": "NFT", "SBT": "SBT", "AEST": "AEST", "ACST": "ACST", "JST": "JST", "CWST": "CWST", "CT": "CT", "ICT": "ICT", "MMT": "MMT", "BIOT": "BST", "NPT": "NPT", "IST": "IST", "PKT": "PKT", "AFT": "AFT", "MSK": "MSK", "IRST": "IRST", "FET": "FET", "EET": "EET", "CET": "CET", "UTC": "UTC", "GMT": "GMT", "CVT": "CVT", "GST": "GST", "BRT": "BRT", "NST": "NST", "AST": "AST", "EST": "EST", "CST": "CST", "MST": "MST", "PST": "PST", "AKST": "AKST", "MIT": "MIT", "HST": "HST", "SST": "SST", "BIT": "BIT", "CHADT": "CHADT", "NZDT": "NZDT", "AEDT": "AEDT", "ACDT": "ACDT", "AZST": "AZST", "IRDT": "IRDT", "EEST": "EEST", "CEST": "CEST", "BST": "BST", "PMDT": "PMDT", "ADT": "ADT", "NDT": "NDT", "EDT": "EDT", "CDT": "CDT", "MDT": "MDT", "PDT": "PDT", "AKDT": "AKDT", "HADT": "HADT" }; Date.CultureStrings.lang = "smn-FI";
ramadhinolfski/Bengkel
theme/DateJS/build/i18n/smn-FI.js
JavaScript
mit
5,757
/*! * ws: a node.js websocket client * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com> * MIT Licensed */ var util = require('util') , Validation = require('./Validation').Validation , ErrorCodes = require('./ErrorCodes') , BufferPool = require('./BufferPool') , bufferUtil = require('./BufferUtil').BufferUtil , PerMessageDeflate = require('./PerMessageDeflate'); /** * HyBi Receiver implementation */ function Receiver (extensions) { if (this instanceof Receiver === false) { throw new TypeError("Classes can't be function-called"); } // memory pool for fragmented messages var fragmentedPoolPrevUsed = -1; this.fragmentedBufferPool = new BufferPool(1024, function(db, length) { return db.used + length; }, function(db) { return fragmentedPoolPrevUsed = fragmentedPoolPrevUsed >= 0 ? (fragmentedPoolPrevUsed + db.used) / 2 : db.used; }); // memory pool for unfragmented messages var unfragmentedPoolPrevUsed = -1; this.unfragmentedBufferPool = new BufferPool(1024, function(db, length) { return db.used + length; }, function(db) { return unfragmentedPoolPrevUsed = unfragmentedPoolPrevUsed >= 0 ? (unfragmentedPoolPrevUsed + db.used) / 2 : db.used; }); this.extensions = extensions || {}; this.state = { activeFragmentedOperation: null, lastFragment: false, masked: false, opcode: 0, fragmentedOperation: false }; this.overflow = []; this.headerBuffer = new Buffer(10); this.expectOffset = 0; this.expectBuffer = null; this.expectHandler = null; this.currentMessage = []; this.messageHandlers = []; this.expectHeader(2, this.processPacket); this.dead = false; this.processing = false; this.onerror = function() {}; this.ontext = function() {}; this.onbinary = function() {}; this.onclose = function() {}; this.onping = function() {}; this.onpong = function() {}; } module.exports = Receiver; /** * Add new data to the parser. * * @api public */ Receiver.prototype.add = function(data) { var dataLength = data.length; if (dataLength == 0) return; if (this.expectBuffer == null) { this.overflow.push(data); return; } var toRead = Math.min(dataLength, this.expectBuffer.length - this.expectOffset); fastCopy(toRead, data, this.expectBuffer, this.expectOffset); this.expectOffset += toRead; if (toRead < dataLength) { this.overflow.push(data.slice(toRead)); } while (this.expectBuffer && this.expectOffset == this.expectBuffer.length) { var bufferForHandler = this.expectBuffer; this.expectBuffer = null; this.expectOffset = 0; this.expectHandler.call(this, bufferForHandler); } }; /** * Releases all resources used by the receiver. * * @api public */ Receiver.prototype.cleanup = function() { this.dead = true; this.overflow = null; this.headerBuffer = null; this.expectBuffer = null; this.expectHandler = null; this.unfragmentedBufferPool = null; this.fragmentedBufferPool = null; this.state = null; this.currentMessage = null; this.onerror = null; this.ontext = null; this.onbinary = null; this.onclose = null; this.onping = null; this.onpong = null; }; /** * Waits for a certain amount of header bytes to be available, then fires a callback. * * @api private */ Receiver.prototype.expectHeader = function(length, handler) { if (length == 0) { handler(null); return; } this.expectBuffer = this.headerBuffer.slice(this.expectOffset, this.expectOffset + length); this.expectHandler = handler; var toRead = length; while (toRead > 0 && this.overflow.length > 0) { var fromOverflow = this.overflow.pop(); if (toRead < fromOverflow.length) this.overflow.push(fromOverflow.slice(toRead)); var read = Math.min(fromOverflow.length, toRead); fastCopy(read, fromOverflow, this.expectBuffer, this.expectOffset); this.expectOffset += read; toRead -= read; } }; /** * Waits for a certain amount of data bytes to be available, then fires a callback. * * @api private */ Receiver.prototype.expectData = function(length, handler) { if (length == 0) { handler(null); return; } this.expectBuffer = this.allocateFromPool(length, this.state.fragmentedOperation); this.expectHandler = handler; var toRead = length; while (toRead > 0 && this.overflow.length > 0) { var fromOverflow = this.overflow.pop(); if (toRead < fromOverflow.length) this.overflow.push(fromOverflow.slice(toRead)); var read = Math.min(fromOverflow.length, toRead); fastCopy(read, fromOverflow, this.expectBuffer, this.expectOffset); this.expectOffset += read; toRead -= read; } }; /** * Allocates memory from the buffer pool. * * @api private */ Receiver.prototype.allocateFromPool = function(length, isFragmented) { return (isFragmented ? this.fragmentedBufferPool : this.unfragmentedBufferPool).get(length); }; /** * Start processing a new packet. * * @api private */ Receiver.prototype.processPacket = function (data) { if (this.extensions[PerMessageDeflate.extensionName]) { if ((data[0] & 0x30) != 0) { this.error('reserved fields (2, 3) must be empty', 1002); return; } } else { if ((data[0] & 0x70) != 0) { this.error('reserved fields must be empty', 1002); return; } } this.state.lastFragment = (data[0] & 0x80) == 0x80; this.state.masked = (data[1] & 0x80) == 0x80; var compressed = (data[0] & 0x40) == 0x40; var opcode = data[0] & 0xf; if (opcode === 0) { if (compressed) { this.error('continuation frame cannot have the Per-message Compressed bits', 1002); return; } // continuation frame this.state.fragmentedOperation = true; this.state.opcode = this.state.activeFragmentedOperation; if (!(this.state.opcode == 1 || this.state.opcode == 2)) { this.error('continuation frame cannot follow current opcode', 1002); return; } } else { if (opcode < 3 && this.state.activeFragmentedOperation != null) { this.error('data frames after the initial data frame must have opcode 0', 1002); return; } if (opcode >= 8 && compressed) { this.error('control frames cannot have the Per-message Compressed bits', 1002); return; } this.state.compressed = compressed; this.state.opcode = opcode; if (this.state.lastFragment === false) { this.state.fragmentedOperation = true; this.state.activeFragmentedOperation = opcode; } else this.state.fragmentedOperation = false; } var handler = opcodes[this.state.opcode]; if (typeof handler == 'undefined') this.error('no handler for opcode ' + this.state.opcode, 1002); else { handler.start.call(this, data); } }; /** * Endprocessing a packet. * * @api private */ Receiver.prototype.endPacket = function() { if (!this.state.fragmentedOperation) this.unfragmentedBufferPool.reset(true); else if (this.state.lastFragment) this.fragmentedBufferPool.reset(false); this.expectOffset = 0; this.expectBuffer = null; this.expectHandler = null; if (this.state.lastFragment && this.state.opcode === this.state.activeFragmentedOperation) { // end current fragmented operation this.state.activeFragmentedOperation = null; } this.state.lastFragment = false; this.state.opcode = this.state.activeFragmentedOperation != null ? this.state.activeFragmentedOperation : 0; this.state.masked = false; this.expectHeader(2, this.processPacket); }; /** * Reset the parser state. * * @api private */ Receiver.prototype.reset = function() { if (this.dead) return; this.state = { activeFragmentedOperation: null, lastFragment: false, masked: false, opcode: 0, fragmentedOperation: false }; this.fragmentedBufferPool.reset(true); this.unfragmentedBufferPool.reset(true); this.expectOffset = 0; this.expectBuffer = null; this.expectHandler = null; this.overflow = []; this.currentMessage = []; this.messageHandlers = []; }; /** * Unmask received data. * * @api private */ Receiver.prototype.unmask = function (mask, buf, binary) { if (mask != null && buf != null) bufferUtil.unmask(buf, mask); if (binary) return buf; return buf != null ? buf.toString('utf8') : ''; }; /** * Concatenates a list of buffers. * * @api private */ Receiver.prototype.concatBuffers = function(buffers) { var length = 0; for (var i = 0, l = buffers.length; i < l; ++i) length += buffers[i].length; var mergedBuffer = new Buffer(length); bufferUtil.merge(mergedBuffer, buffers); return mergedBuffer; }; /** * Handles an error * * @api private */ Receiver.prototype.error = function (reason, protocolErrorCode) { this.reset(); this.onerror(reason, protocolErrorCode); return this; }; /** * Execute message handler buffers * * @api private */ Receiver.prototype.flush = function() { if (this.processing || this.dead) return; var handler = this.messageHandlers.shift(); if (!handler) return; this.processing = true; var self = this; handler(function() { self.processing = false; self.flush(); }); }; /** * Apply extensions to message * * @api private */ Receiver.prototype.applyExtensions = function(messageBuffer, fin, compressed, callback) { var self = this; if (compressed) { this.extensions[PerMessageDeflate.extensionName].decompress(messageBuffer, fin, function(err, buffer) { if (self.dead) return; if (err) { callback(new Error('invalid compressed data')); return; } callback(null, buffer); }); } else { callback(null, messageBuffer); } }; /** * Buffer utilities */ function readUInt16BE(start) { return (this[start]<<8) + this[start+1]; } function readUInt32BE(start) { return (this[start]<<24) + (this[start+1]<<16) + (this[start+2]<<8) + this[start+3]; } function fastCopy(length, srcBuffer, dstBuffer, dstOffset) { switch (length) { default: srcBuffer.copy(dstBuffer, dstOffset, 0, length); break; case 16: dstBuffer[dstOffset+15] = srcBuffer[15]; case 15: dstBuffer[dstOffset+14] = srcBuffer[14]; case 14: dstBuffer[dstOffset+13] = srcBuffer[13]; case 13: dstBuffer[dstOffset+12] = srcBuffer[12]; case 12: dstBuffer[dstOffset+11] = srcBuffer[11]; case 11: dstBuffer[dstOffset+10] = srcBuffer[10]; case 10: dstBuffer[dstOffset+9] = srcBuffer[9]; case 9: dstBuffer[dstOffset+8] = srcBuffer[8]; case 8: dstBuffer[dstOffset+7] = srcBuffer[7]; case 7: dstBuffer[dstOffset+6] = srcBuffer[6]; case 6: dstBuffer[dstOffset+5] = srcBuffer[5]; case 5: dstBuffer[dstOffset+4] = srcBuffer[4]; case 4: dstBuffer[dstOffset+3] = srcBuffer[3]; case 3: dstBuffer[dstOffset+2] = srcBuffer[2]; case 2: dstBuffer[dstOffset+1] = srcBuffer[1]; case 1: dstBuffer[dstOffset] = srcBuffer[0]; } } function clone(obj) { var cloned = {}; for (var k in obj) { if (obj.hasOwnProperty(k)) { cloned[k] = obj[k]; } } return cloned; } /** * Opcode handlers */ var opcodes = { // text '1': { start: function(data) { var self = this; // decode length var firstLength = data[1] & 0x7f; if (firstLength < 126) { opcodes['1'].getData.call(self, firstLength); } else if (firstLength == 126) { self.expectHeader(2, function(data) { opcodes['1'].getData.call(self, readUInt16BE.call(data, 0)); }); } else if (firstLength == 127) { self.expectHeader(8, function(data) { if (readUInt32BE.call(data, 0) != 0) { self.error('packets with length spanning more than 32 bit is currently not supported', 1008); return; } opcodes['1'].getData.call(self, readUInt32BE.call(data, 4)); }); } }, getData: function(length) { var self = this; if (self.state.masked) { self.expectHeader(4, function(data) { var mask = data; self.expectData(length, function(data) { opcodes['1'].finish.call(self, mask, data); }); }); } else { self.expectData(length, function(data) { opcodes['1'].finish.call(self, null, data); }); } }, finish: function(mask, data) { var self = this; var packet = this.unmask(mask, data, true) || new Buffer(0); var state = clone(this.state); this.messageHandlers.push(function(callback) { self.applyExtensions(packet, state.lastFragment, state.compressed, function(err, buffer) { if (err) return self.error(err.message, 1007); if (buffer != null) self.currentMessage.push(buffer); if (state.lastFragment) { var messageBuffer = self.concatBuffers(self.currentMessage); self.currentMessage = []; if (!Validation.isValidUTF8(messageBuffer)) { self.error('invalid utf8 sequence', 1007); return; } self.ontext(messageBuffer.toString('utf8'), {masked: state.masked, buffer: messageBuffer}); } callback(); }); }); this.flush(); this.endPacket(); } }, // binary '2': { start: function(data) { var self = this; // decode length var firstLength = data[1] & 0x7f; if (firstLength < 126) { opcodes['2'].getData.call(self, firstLength); } else if (firstLength == 126) { self.expectHeader(2, function(data) { opcodes['2'].getData.call(self, readUInt16BE.call(data, 0)); }); } else if (firstLength == 127) { self.expectHeader(8, function(data) { if (readUInt32BE.call(data, 0) != 0) { self.error('packets with length spanning more than 32 bit is currently not supported', 1008); return; } opcodes['2'].getData.call(self, readUInt32BE.call(data, 4, true)); }); } }, getData: function(length) { var self = this; if (self.state.masked) { self.expectHeader(4, function(data) { var mask = data; self.expectData(length, function(data) { opcodes['2'].finish.call(self, mask, data); }); }); } else { self.expectData(length, function(data) { opcodes['2'].finish.call(self, null, data); }); } }, finish: function(mask, data) { var self = this; var packet = this.unmask(mask, data, true) || new Buffer(0); var state = clone(this.state); this.messageHandlers.push(function(callback) { self.applyExtensions(packet, state.lastFragment, state.compressed, function(err, buffer) { if (err) return self.error(err.message, 1007); if (buffer != null) self.currentMessage.push(buffer); if (state.lastFragment) { var messageBuffer = self.concatBuffers(self.currentMessage); self.currentMessage = []; self.onbinary(messageBuffer, {masked: state.masked, buffer: messageBuffer}); } callback(); }); }); this.flush(); this.endPacket(); } }, // close '8': { start: function(data) { var self = this; if (self.state.lastFragment == false) { self.error('fragmented close is not supported', 1002); return; } // decode length var firstLength = data[1] & 0x7f; if (firstLength < 126) { opcodes['8'].getData.call(self, firstLength); } else { self.error('control frames cannot have more than 125 bytes of data', 1002); } }, getData: function(length) { var self = this; if (self.state.masked) { self.expectHeader(4, function(data) { var mask = data; self.expectData(length, function(data) { opcodes['8'].finish.call(self, mask, data); }); }); } else { self.expectData(length, function(data) { opcodes['8'].finish.call(self, null, data); }); } }, finish: function(mask, data) { var self = this; data = self.unmask(mask, data, true); var state = clone(this.state); this.messageHandlers.push(function() { if (data && data.length == 1) { self.error('close packets with data must be at least two bytes long', 1002); return; } var code = data && data.length > 1 ? readUInt16BE.call(data, 0) : 1000; if (!ErrorCodes.isValidErrorCode(code)) { self.error('invalid error code', 1002); return; } var message = ''; if (data && data.length > 2) { var messageBuffer = data.slice(2); if (!Validation.isValidUTF8(messageBuffer)) { self.error('invalid utf8 sequence', 1007); return; } message = messageBuffer.toString('utf8'); } self.onclose(code, message, {masked: state.masked}); self.reset(); }); this.flush(); }, }, // ping '9': { start: function(data) { var self = this; if (self.state.lastFragment == false) { self.error('fragmented ping is not supported', 1002); return; } // decode length var firstLength = data[1] & 0x7f; if (firstLength < 126) { opcodes['9'].getData.call(self, firstLength); } else { self.error('control frames cannot have more than 125 bytes of data', 1002); } }, getData: function(length) { var self = this; if (self.state.masked) { self.expectHeader(4, function(data) { var mask = data; self.expectData(length, function(data) { opcodes['9'].finish.call(self, mask, data); }); }); } else { self.expectData(length, function(data) { opcodes['9'].finish.call(self, null, data); }); } }, finish: function(mask, data) { var self = this; data = this.unmask(mask, data, true); var state = clone(this.state); this.messageHandlers.push(function(callback) { self.onping(data, {masked: state.masked, binary: true}); callback(); }); this.flush(); this.endPacket(); } }, // pong '10': { start: function(data) { var self = this; if (self.state.lastFragment == false) { self.error('fragmented pong is not supported', 1002); return; } // decode length var firstLength = data[1] & 0x7f; if (firstLength < 126) { opcodes['10'].getData.call(self, firstLength); } else { self.error('control frames cannot have more than 125 bytes of data', 1002); } }, getData: function(length) { var self = this; if (this.state.masked) { this.expectHeader(4, function(data) { var mask = data; self.expectData(length, function(data) { opcodes['10'].finish.call(self, mask, data); }); }); } else { this.expectData(length, function(data) { opcodes['10'].finish.call(self, null, data); }); } }, finish: function(mask, data) { var self = this; data = self.unmask(mask, data, true); var state = clone(this.state); this.messageHandlers.push(function(callback) { self.onpong(data, {masked: state.masked, binary: true}); callback(); }); this.flush(); this.endPacket(); } } }
zshanwei/zshanwei.github.io
node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Receiver.js
JavaScript
mit
19,700
/* * DateJS Culture String File * Country Code: fr-CH * Name: French (Switzerland) * Format: "key" : "value" * Key is the en-US term, Value is the Key in the current language. */ Date.CultureStrings = Date.CultureStrings || {}; Date.CultureStrings["fr-CH"] = { "name": "fr-CH", "englishName": "French (Switzerland)", "nativeName": "français (Suisse)", "Sunday": "dimanche", "Monday": "lundi", "Tuesday": "mardi", "Wednesday": "mercredi", "Thursday": "jeudi", "Friday": "vendredi", "Saturday": "samedi", "Sun": "dim.", "Mon": "lun.", "Tue": "mar.", "Wed": "mer.", "Thu": "jeu.", "Fri": "ven.", "Sat": "sam.", "Su": "di", "Mo": "lu", "Tu": "ma", "We": "me", "Th": "je", "Fr": "ve", "Sa": "sa", "S_Sun_Initial": "d", "M_Mon_Initial": "l", "T_Tue_Initial": "m", "W_Wed_Initial": "m", "T_Thu_Initial": "j", "F_Fri_Initial": "v", "S_Sat_Initial": "s", "January": "janvier", "February": "février", "March": "mars", "April": "avril", "May": "mai", "June": "juin", "July": "juillet", "August": "août", "September": "septembre", "October": "octobre", "November": "novembre", "December": "décembre", "Jan_Abbr": "janv.", "Feb_Abbr": "févr.", "Mar_Abbr": "mars", "Apr_Abbr": "avr.", "May_Abbr": "mai", "Jun_Abbr": "juin", "Jul_Abbr": "juil.", "Aug_Abbr": "août", "Sep_Abbr": "sept.", "Oct_Abbr": "oct.", "Nov_Abbr": "nov.", "Dec_Abbr": "déc.", "AM": "", "PM": "", "firstDayOfWeek": 1, "twoDigitYearMax": 2029, "mdy": "dmy", "M/d/yyyy": "dd.MM.yyyy", "dddd, MMMM dd, yyyy": "dddd, d. MMMM yyyy", "h:mm tt": "HH:mm", "h:mm:ss tt": "HH:mm:ss", "dddd, MMMM dd, yyyy h:mm:ss tt": "dddd, d. MMMM yyyy HH:mm:ss", "yyyy-MM-ddTHH:mm:ss": "yyyy-MM-ddTHH:mm:ss", "yyyy-MM-dd HH:mm:ssZ": "yyyy-MM-dd HH:mm:ssZ", "ddd, dd MMM yyyy HH:mm:ss": "ddd, dd MMM yyyy HH:mm:ss", "MMMM dd": "d MMMM", "MMMM, yyyy": "MMMM yyyy", "/jan(uary)?/": "janv(.(ier)?)?", "/feb(ruary)?/": "févr(.(ier)?)?", "/mar(ch)?/": "mars", "/apr(il)?/": "avr(.(il)?)?", "/may/": "mai", "/jun(e)?/": "juin", "/jul(y)?/": "juil(.(let)?)?", "/aug(ust)?/": "août", "/sep(t(ember)?)?/": "sept(.(embre)?)?", "/oct(ober)?/": "oct(.(obre)?)?", "/nov(ember)?/": "nov(.(embre)?)?", "/dec(ember)?/": "déc(.(embre)?)?", "/^su(n(day)?)?/": "^di(m(.(anche)?)?)?", "/^mo(n(day)?)?/": "^lu(n(.(di)?)?)?", "/^tu(e(s(day)?)?)?/": "^ma(r(.(di)?)?)?", "/^we(d(nesday)?)?/": "^me(r(.(credi)?)?)?", "/^th(u(r(s(day)?)?)?)?/": "^je(u(.(di)?)?)?", "/^fr(i(day)?)?/": "^ve(n(.(dredi)?)?)?", "/^sa(t(urday)?)?/": "^sa(m(.(edi)?)?)?", "/^next/": "^next", "/^last|past|prev(ious)?/": "^last|past|prev(ious)?", "/^(\\+|aft(er)?|from|hence)/": "^(\\+|aft(er)?|from|hence)", "/^(\\-|bef(ore)?|ago)/": "^(\\-|bef(ore)?|ago)", "/^yes(terday)?/": "^yes(terday)?", "/^t(od(ay)?)?/": "^t(od(ay)?)?", "/^tom(orrow)?/": "^tom(orrow)?", "/^n(ow)?/": "^n(ow)?", "/^ms|milli(second)?s?/": "^ms|milli(second)?s?", "/^sec(ond)?s?/": "^sec(ond)?s?", "/^mn|min(ute)?s?/": "^mn|min(ute)?s?", "/^h(our)?s?/": "^h(our)?s?", "/^w(eek)?s?/": "^w(eek)?s?", "/^m(onth)?s?/": "^m(onth)?s?", "/^d(ay)?s?/": "^d(ay)?s?", "/^y(ear)?s?/": "^y(ear)?s?", "/^(a|p)/": "^(a|p)", "/^(a\\.?m?\\.?|p\\.?m?\\.?)/": "^(a\\.?m?\\.?|p\\.?m?\\.?)", "/^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\\s*(\\+|\\-)\\s*\\d\\d\\d\\d?)|gmt|utc)/": "^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\\s*(\\+|\\-)\\s*\\d\\d\\d\\d?)|gmt|utc)", "/^\\s*(st|nd|rd|th)/": "^\\s*(st|nd|rd|th)", "/^\\s*(\\:|a(?!u|p)|p)/": "^\\s*(\\:|a(?!u|p)|p)", "LINT": "LINT", "TOT": "TOT", "CHAST": "CHAST", "NZST": "NZST", "NFT": "NFT", "SBT": "SBT", "AEST": "AEST", "ACST": "ACST", "JST": "JST", "CWST": "CWST", "CT": "CT", "ICT": "ICT", "MMT": "MMT", "BIOT": "BST", "NPT": "NPT", "IST": "IST", "PKT": "PKT", "AFT": "AFT", "MSK": "MSK", "IRST": "IRST", "FET": "FET", "EET": "EET", "CET": "CET", "UTC": "UTC", "GMT": "GMT", "CVT": "CVT", "GST": "GST", "BRT": "BRT", "NST": "NST", "AST": "AST", "EST": "EST", "CST": "CST", "MST": "MST", "PST": "PST", "AKST": "AKST", "MIT": "MIT", "HST": "HST", "SST": "SST", "BIT": "BIT", "CHADT": "CHADT", "NZDT": "NZDT", "AEDT": "AEDT", "ACDT": "ACDT", "AZST": "AZST", "IRDT": "IRDT", "EEST": "EEST", "CEST": "CEST", "BST": "BST", "PMDT": "PMDT", "ADT": "ADT", "NDT": "NDT", "EDT": "EDT", "CDT": "CDT", "MDT": "MDT", "PDT": "PDT", "AKDT": "AKDT", "HADT": "HADT" }; Date.CultureStrings.lang = "fr-CH";
How2Compute/SmartHome
hub/static/vendors/DateJS/build/i18n/fr-CH.js
JavaScript
mit
5,629