Repository: kubernetes/kube-ui Branch: master Commit: a58748cf27b8 Files: 719 Total size: 6.9 MB Directory structure: gitextract_ua0v_2q3/ ├── .gitignore ├── .travis.yml ├── CONTRIBUTING.md ├── Dockerfile ├── Godeps/ │ ├── Godeps.json │ ├── Readme │ └── _workspace/ │ ├── .gitignore │ └── src/ │ └── github.com/ │ └── elazarl/ │ └── go-bindata-assetfs/ │ ├── LICENSE │ ├── README.md │ ├── assetfs.go │ ├── doc.go │ └── go-bindata-assetfs/ │ └── main.go ├── LICENSE ├── Makefile ├── README.md ├── build/ │ └── build-ui.sh ├── data/ │ └── datafile.go ├── docs/ │ └── ui.md ├── hooks/ │ └── boilerplate.go.txt ├── master/ │ ├── .bowerrc │ ├── README.md │ ├── bower.json │ ├── components/ │ │ ├── README.md │ │ └── dashboard/ │ │ ├── .gitkeep │ │ ├── README.md │ │ ├── config/ │ │ │ └── development.example.json │ │ ├── img/ │ │ │ └── .gitkeep │ │ ├── js/ │ │ │ ├── .gitkeep │ │ │ └── modules/ │ │ │ ├── .gitkeep │ │ │ ├── controllers/ │ │ │ │ ├── .gitkeep │ │ │ │ ├── cAdvisorController.js │ │ │ │ ├── dashboard.js │ │ │ │ ├── groupController.js │ │ │ │ ├── header.js │ │ │ │ ├── listEventsController.js │ │ │ │ ├── listMinionsController.js │ │ │ │ ├── listPodsController.js │ │ │ │ ├── listReplicationControllersController.js │ │ │ │ ├── listServicesController.js │ │ │ │ ├── nodeController.js │ │ │ │ ├── podController.js │ │ │ │ ├── replicationController.js │ │ │ │ └── serviceController.js │ │ │ ├── directives/ │ │ │ │ ├── .gitkeep │ │ │ │ ├── d3MinionBarGauge.js │ │ │ │ └── dashboard.js │ │ │ └── services/ │ │ │ ├── d3.js │ │ │ ├── podsMock.js │ │ │ ├── replicationControllersMock.js │ │ │ └── servicesMock.js │ │ ├── less/ │ │ │ ├── .gitkeep │ │ │ ├── dashboard/ │ │ │ │ ├── colors.less │ │ │ │ ├── groups.less │ │ │ │ ├── pods.less │ │ │ │ ├── servers.less │ │ │ │ └── tables.less │ │ │ └── dashboard.less │ │ ├── manifest.json │ │ ├── pages/ │ │ │ ├── .gitkeep │ │ │ ├── footer.html │ │ │ ├── header.html │ │ │ └── home.html │ │ ├── protractor/ │ │ │ ├── .gitignore │ │ │ └── smoke.spec.js │ │ ├── test/ │ │ │ ├── .gitkeep │ │ │ ├── controllers/ │ │ │ │ ├── .gitkeep │ │ │ │ └── header.spec.js │ │ │ ├── directives/ │ │ │ │ └── .gitkeep │ │ │ └── services/ │ │ │ └── .gitkeep │ │ └── views/ │ │ ├── .gitkeep │ │ ├── groups.html │ │ ├── listEvents.html │ │ ├── listMinions.html │ │ ├── listPods.html │ │ ├── listPodsCards.html │ │ ├── listPodsVisualizer.html │ │ ├── listReplicationControllers.html │ │ ├── listServices.html │ │ ├── node.html │ │ ├── partials/ │ │ │ ├── .gitkeep │ │ │ ├── cadvisor.html │ │ │ ├── groupBox.html │ │ │ ├── groupItem.html │ │ │ ├── podTilesByName.html │ │ │ └── podTilesByServer.html │ │ ├── pod.html │ │ ├── replication.html │ │ └── service.html │ ├── gulpfile.js │ ├── js/ │ │ ├── app.config.js │ │ ├── app.directive.js │ │ ├── app.init.js │ │ ├── app.preinit.js │ │ ├── app.run.js │ │ ├── app.service.js │ │ ├── app.skeleton.json │ │ ├── sections.js │ │ └── tabs.js │ ├── karma.conf.js │ ├── less/ │ │ └── app/ │ │ └── base.less │ ├── package.json │ ├── protractor/ │ │ ├── .gitkeep │ │ ├── chrome/ │ │ │ ├── .gitkeep │ │ │ └── smoke.spec.js │ │ └── conf.js │ ├── shared/ │ │ ├── assets/ │ │ │ └── .gitkeep │ │ ├── config/ │ │ │ ├── development.example.json │ │ │ ├── generated-config.js │ │ │ └── production.json │ │ ├── index.html │ │ ├── js/ │ │ │ └── modules/ │ │ │ ├── config.js │ │ │ ├── constants.js │ │ │ ├── controllers/ │ │ │ │ ├── home-page.js │ │ │ │ ├── main.js │ │ │ │ └── tabs-global.js │ │ │ ├── directives/ │ │ │ │ └── sidebar.js │ │ │ └── services/ │ │ │ ├── cAdvisor.js │ │ │ ├── k8sApiService.js │ │ │ ├── pollK8sData.js │ │ │ └── toggle-state.js │ │ ├── vendor/ │ │ │ ├── .gitkeep │ │ │ ├── angular-json-human/ │ │ │ │ └── dist/ │ │ │ │ └── angular-json-human.css │ │ │ └── angular-material/ │ │ │ └── angular-material.css │ │ └── views/ │ │ └── partials/ │ │ ├── 404.html │ │ ├── kubernetes-ui-menu.tmpl.html │ │ ├── md-table.tmpl.html │ │ └── menu-toggle.tmpl.html │ ├── test/ │ │ └── modules/ │ │ ├── controllers/ │ │ │ ├── .gitkeep │ │ │ ├── cAdvisorController.spec.js │ │ │ ├── groupController.spec.js │ │ │ ├── listEventsController.spec.js │ │ │ ├── listMinionsController.spec.js │ │ │ ├── listPodsController.spec.js │ │ │ ├── listReplicationControllersController.spec.js │ │ │ ├── listServicesController.spec.js │ │ │ ├── replicationController.js │ │ │ └── serviceController.spec.js │ │ ├── directives/ │ │ │ └── .gitkeep │ │ └── services/ │ │ └── .gitkeep │ ├── vendor.base.json │ └── vendor.json ├── server/ │ ├── kube-ui.go │ └── sidebar-menu.json ├── test/ │ └── e2e/ │ ├── protractor.conf.js │ └── scenarios.js └── third_party/ └── ui/ └── bower_components/ ├── angular/ │ ├── .bower.json │ ├── README.md │ ├── angular-csp.css │ ├── angular.js │ ├── angular.min.js.gzip │ ├── bower.json │ ├── index.js │ └── package.json ├── angular-animate/ │ ├── .bower.json │ ├── README.md │ ├── angular-animate.js │ ├── bower.json │ ├── index.js │ └── package.json ├── angular-aria/ │ ├── .bower.json │ ├── README.md │ ├── angular-aria.js │ ├── bower.json │ ├── index.js │ └── package.json ├── angular-cookies/ │ ├── .bower.json │ ├── README.md │ ├── angular-cookies.js │ ├── bower.json │ ├── index.js │ └── package.json ├── angular-css/ │ ├── .bower.json │ ├── Gruntfile.js │ ├── LICENSE.txt │ ├── README.md │ ├── angular-css.js │ └── bower.json ├── angular-filter/ │ ├── .bower.json │ ├── .bowerrc │ ├── .travis.yml │ ├── bower.json │ ├── dist/ │ │ └── angular-filter.js │ └── license.md ├── angular-json-human/ │ ├── .bower.json │ ├── LICENSE │ ├── README.md │ ├── bower.json │ └── dist/ │ ├── angular-json-human.css │ └── angular-json-human.js ├── angular-material/ │ ├── .bower.json │ ├── LICENSE │ ├── README.md │ ├── angular-material.css │ ├── angular-material.js │ ├── bower.json │ ├── default-theme.css │ ├── demos/ │ │ └── gridList/ │ │ ├── demoBasicUsage/ │ │ │ └── style.scss │ │ ├── demoDynamicTiles/ │ │ │ └── style.scss │ │ └── demoResponsiveUsage/ │ │ └── style.scss │ ├── modules/ │ │ ├── closure/ │ │ │ ├── autocomplete/ │ │ │ │ ├── autocomplete-default-theme.css │ │ │ │ ├── autocomplete.css │ │ │ │ └── autocomplete.js │ │ │ ├── backdrop/ │ │ │ │ ├── backdrop-default-theme.css │ │ │ │ ├── backdrop.css │ │ │ │ └── backdrop.js │ │ │ ├── bottomSheet/ │ │ │ │ ├── bottomSheet-default-theme.css │ │ │ │ ├── bottomSheet.css │ │ │ │ └── bottomSheet.js │ │ │ ├── button/ │ │ │ │ ├── button-default-theme.css │ │ │ │ ├── button.css │ │ │ │ └── button.js │ │ │ ├── card/ │ │ │ │ ├── card-default-theme.css │ │ │ │ ├── card.css │ │ │ │ └── card.js │ │ │ ├── checkbox/ │ │ │ │ ├── checkbox-default-theme.css │ │ │ │ ├── checkbox.css │ │ │ │ └── checkbox.js │ │ │ ├── content/ │ │ │ │ ├── content-default-theme.css │ │ │ │ ├── content.css │ │ │ │ └── content.js │ │ │ ├── core/ │ │ │ │ ├── core.css │ │ │ │ ├── core.js │ │ │ │ └── default-theme.js │ │ │ ├── dialog/ │ │ │ │ ├── dialog-default-theme.css │ │ │ │ ├── dialog.css │ │ │ │ └── dialog.js │ │ │ ├── divider/ │ │ │ │ ├── divider-default-theme.css │ │ │ │ ├── divider.css │ │ │ │ └── divider.js │ │ │ ├── gridList/ │ │ │ │ ├── gridList-default-theme.css │ │ │ │ ├── gridList.css │ │ │ │ └── gridList.js │ │ │ ├── icon/ │ │ │ │ ├── icon-default-theme.css │ │ │ │ ├── icon.css │ │ │ │ └── icon.js │ │ │ ├── input/ │ │ │ │ ├── input-default-theme.css │ │ │ │ ├── input.css │ │ │ │ └── input.js │ │ │ ├── list/ │ │ │ │ ├── list.css │ │ │ │ └── list.js │ │ │ ├── menu/ │ │ │ │ ├── menu.css │ │ │ │ └── menu.js │ │ │ ├── progressCircular/ │ │ │ │ ├── progressCircular-default-theme.css │ │ │ │ ├── progressCircular.css │ │ │ │ └── progressCircular.js │ │ │ ├── progressLinear/ │ │ │ │ ├── progressLinear-default-theme.css │ │ │ │ ├── progressLinear.css │ │ │ │ └── progressLinear.js │ │ │ ├── radioButton/ │ │ │ │ ├── radioButton-default-theme.css │ │ │ │ ├── radioButton.css │ │ │ │ └── radioButton.js │ │ │ ├── select/ │ │ │ │ ├── select-default-theme.css │ │ │ │ ├── select.css │ │ │ │ └── select.js │ │ │ ├── sidenav/ │ │ │ │ ├── sidenav-default-theme.css │ │ │ │ ├── sidenav.css │ │ │ │ └── sidenav.js │ │ │ ├── slider/ │ │ │ │ ├── slider-default-theme.css │ │ │ │ ├── slider.css │ │ │ │ └── slider.js │ │ │ ├── sticky/ │ │ │ │ ├── sticky.css │ │ │ │ └── sticky.js │ │ │ ├── subheader/ │ │ │ │ ├── subheader-default-theme.css │ │ │ │ ├── subheader.css │ │ │ │ └── subheader.js │ │ │ ├── swipe/ │ │ │ │ └── swipe.js │ │ │ ├── switch/ │ │ │ │ ├── switch-default-theme.css │ │ │ │ ├── switch.css │ │ │ │ └── switch.js │ │ │ ├── tabs/ │ │ │ │ ├── tabs-default-theme.css │ │ │ │ ├── tabs.css │ │ │ │ └── tabs.js │ │ │ ├── textField/ │ │ │ │ ├── textField-default-theme.css │ │ │ │ ├── textField.css │ │ │ │ └── textField.js │ │ │ ├── toast/ │ │ │ │ ├── toast-default-theme.css │ │ │ │ ├── toast.css │ │ │ │ └── toast.js │ │ │ ├── toolbar/ │ │ │ │ ├── toolbar-default-theme.css │ │ │ │ ├── toolbar.css │ │ │ │ └── toolbar.js │ │ │ ├── tooltip/ │ │ │ │ ├── tooltip-default-theme.css │ │ │ │ ├── tooltip.css │ │ │ │ └── tooltip.js │ │ │ └── whiteframe/ │ │ │ ├── whiteframe.css │ │ │ └── whiteframe.js │ │ ├── css/ │ │ │ └── angular-material-layout.css │ │ └── js/ │ │ ├── autocomplete/ │ │ │ ├── autocomplete-default-theme.css │ │ │ ├── autocomplete.css │ │ │ ├── autocomplete.js │ │ │ └── bower.json │ │ ├── backdrop/ │ │ │ ├── backdrop-default-theme.css │ │ │ ├── backdrop.css │ │ │ ├── backdrop.js │ │ │ └── bower.json │ │ ├── bottomSheet/ │ │ │ ├── bottomSheet-default-theme.css │ │ │ ├── bottomSheet.css │ │ │ ├── bottomSheet.js │ │ │ └── bower.json │ │ ├── button/ │ │ │ ├── bower.json │ │ │ ├── button-default-theme.css │ │ │ ├── button.css │ │ │ └── button.js │ │ ├── card/ │ │ │ ├── bower.json │ │ │ ├── card-default-theme.css │ │ │ ├── card.css │ │ │ └── card.js │ │ ├── checkbox/ │ │ │ ├── bower.json │ │ │ ├── checkbox-default-theme.css │ │ │ ├── checkbox.css │ │ │ └── checkbox.js │ │ ├── content/ │ │ │ ├── bower.json │ │ │ ├── content-default-theme.css │ │ │ ├── content.css │ │ │ └── content.js │ │ ├── core/ │ │ │ ├── bower.json │ │ │ ├── core.css │ │ │ ├── core.js │ │ │ └── default-theme.js │ │ ├── dialog/ │ │ │ ├── bower.json │ │ │ ├── dialog-default-theme.css │ │ │ ├── dialog.css │ │ │ └── dialog.js │ │ ├── divider/ │ │ │ ├── bower.json │ │ │ ├── divider-default-theme.css │ │ │ ├── divider.css │ │ │ └── divider.js │ │ ├── icon/ │ │ │ ├── bower.json │ │ │ ├── icon.css │ │ │ └── icon.js │ │ ├── input/ │ │ │ ├── bower.json │ │ │ ├── input-default-theme.css │ │ │ ├── input.css │ │ │ └── input.js │ │ ├── list/ │ │ │ ├── bower.json │ │ │ ├── list.css │ │ │ └── list.js │ │ ├── menu/ │ │ │ ├── bower.json │ │ │ ├── menu.css │ │ │ └── menu.js │ │ ├── progressCircular/ │ │ │ ├── bower.json │ │ │ ├── progressCircular-default-theme.css │ │ │ ├── progressCircular.css │ │ │ └── progressCircular.js │ │ ├── progressLinear/ │ │ │ ├── bower.json │ │ │ ├── progressLinear-default-theme.css │ │ │ ├── progressLinear.css │ │ │ └── progressLinear.js │ │ ├── radioButton/ │ │ │ ├── bower.json │ │ │ ├── radioButton-default-theme.css │ │ │ ├── radioButton.css │ │ │ └── radioButton.js │ │ ├── sidenav/ │ │ │ ├── bower.json │ │ │ ├── sidenav-default-theme.css │ │ │ ├── sidenav.css │ │ │ └── sidenav.js │ │ ├── slider/ │ │ │ ├── bower.json │ │ │ ├── slider-default-theme.css │ │ │ ├── slider.css │ │ │ └── slider.js │ │ ├── sticky/ │ │ │ ├── bower.json │ │ │ ├── sticky.css │ │ │ └── sticky.js │ │ ├── subheader/ │ │ │ ├── bower.json │ │ │ ├── subheader-default-theme.css │ │ │ ├── subheader.css │ │ │ └── subheader.js │ │ ├── swipe/ │ │ │ ├── bower.json │ │ │ └── swipe.js │ │ ├── switch/ │ │ │ ├── bower.json │ │ │ ├── switch-default-theme.css │ │ │ ├── switch.css │ │ │ └── switch.js │ │ ├── tabs/ │ │ │ ├── bower.json │ │ │ ├── tabs-default-theme.css │ │ │ ├── tabs.css │ │ │ └── tabs.js │ │ ├── textField/ │ │ │ ├── bower.json │ │ │ ├── textField-default-theme.css │ │ │ ├── textField.css │ │ │ └── textField.js │ │ ├── toast/ │ │ │ ├── bower.json │ │ │ ├── toast-default-theme.css │ │ │ ├── toast.css │ │ │ └── toast.js │ │ ├── toolbar/ │ │ │ ├── bower.json │ │ │ ├── toolbar-default-theme.css │ │ │ ├── toolbar.css │ │ │ └── toolbar.js │ │ ├── tooltip/ │ │ │ ├── bower.json │ │ │ ├── tooltip-default-theme.css │ │ │ ├── tooltip.css │ │ │ └── tooltip.js │ │ └── whiteframe/ │ │ ├── bower.json │ │ ├── whiteframe.css │ │ └── whiteframe.js │ └── package.json ├── angular-mocks/ │ ├── .bower.json │ ├── README.md │ ├── angular-mocks.js │ ├── bower.json │ ├── ngAnimateMock.js │ ├── ngMock.js │ ├── ngMockE2E.js │ └── package.json ├── angular-route/ │ ├── .bower.json │ ├── README.md │ ├── angular-route.js │ ├── bower.json │ ├── index.js │ └── package.json ├── angularjs-jasmine-matchers/ │ ├── .bower.json │ ├── LICENSE │ ├── README.md │ ├── bower.json │ └── dist/ │ └── matchers.js ├── d3/ │ ├── .bower.json │ ├── .gitattributes │ ├── CONTRIBUTING.md │ ├── LICENSE │ ├── README.md │ ├── bower.json │ ├── d3.js │ └── package.js ├── d3-context-menu/ │ ├── .bower.json │ ├── LICENSE.txt │ ├── bower.json │ ├── css/ │ │ └── d3-context-menu.css │ └── js/ │ └── d3-context-menu.js ├── hammerjs/ │ ├── .bower.json │ ├── .bowerrc │ ├── .gitignore │ ├── .jscsrc │ ├── .jshintrc │ ├── .travis.yml │ ├── CHANGELOG.md │ ├── CONTRIBUTING.md │ ├── Gruntfile.coffee │ ├── LICENSE.md │ ├── README.md │ ├── bower.json │ ├── component.json │ ├── hammer.js │ └── package.json ├── jquery/ │ ├── .bower.json │ ├── MIT-LICENSE.txt │ ├── bower.json │ ├── dist/ │ │ └── jquery.js │ └── src/ │ ├── ajax/ │ │ ├── jsonp.js │ │ ├── load.js │ │ ├── parseJSON.js │ │ ├── parseXML.js │ │ ├── script.js │ │ ├── var/ │ │ │ ├── nonce.js │ │ │ └── rquery.js │ │ └── xhr.js │ ├── ajax.js │ ├── attributes/ │ │ ├── attr.js │ │ ├── classes.js │ │ ├── prop.js │ │ ├── support.js │ │ └── val.js │ ├── attributes.js │ ├── callbacks.js │ ├── core/ │ │ ├── access.js │ │ ├── init.js │ │ ├── parseHTML.js │ │ ├── ready.js │ │ └── var/ │ │ └── rsingleTag.js │ ├── core.js │ ├── css/ │ │ ├── addGetHookIf.js │ │ ├── curCSS.js │ │ ├── defaultDisplay.js │ │ ├── hiddenVisibleSelectors.js │ │ ├── support.js │ │ ├── swap.js │ │ └── var/ │ │ ├── cssExpand.js │ │ ├── getStyles.js │ │ ├── isHidden.js │ │ ├── rmargin.js │ │ └── rnumnonpx.js │ ├── css.js │ ├── data/ │ │ ├── Data.js │ │ ├── accepts.js │ │ └── var/ │ │ ├── data_priv.js │ │ └── data_user.js │ ├── data.js │ ├── deferred.js │ ├── deprecated.js │ ├── dimensions.js │ ├── effects/ │ │ ├── Tween.js │ │ └── animatedSelector.js │ ├── effects.js │ ├── event/ │ │ ├── ajax.js │ │ ├── alias.js │ │ └── support.js │ ├── event.js │ ├── exports/ │ │ ├── amd.js │ │ └── global.js │ ├── intro.js │ ├── jquery.js │ ├── manipulation/ │ │ ├── _evalUrl.js │ │ ├── support.js │ │ └── var/ │ │ └── rcheckableType.js │ ├── manipulation.js │ ├── offset.js │ ├── outro.js │ ├── queue/ │ │ └── delay.js │ ├── queue.js │ ├── selector-native.js │ ├── selector-sizzle.js │ ├── selector.js │ ├── serialize.js │ ├── sizzle/ │ │ └── dist/ │ │ └── sizzle.js │ ├── traversing/ │ │ ├── findFilter.js │ │ └── var/ │ │ └── rneedsContext.js │ ├── traversing.js │ ├── var/ │ │ ├── arr.js │ │ ├── class2type.js │ │ ├── concat.js │ │ ├── hasOwn.js │ │ ├── indexOf.js │ │ ├── pnum.js │ │ ├── push.js │ │ ├── rnotwhite.js │ │ ├── slice.js │ │ ├── strundefined.js │ │ ├── support.js │ │ └── toString.js │ └── wrap.js ├── jsonpath/ │ ├── .bower.json │ ├── .gitignore │ ├── .npmignore │ ├── .travis.yml │ ├── CHANGES.md │ ├── README.md │ ├── lib/ │ │ └── jsonpath.js │ ├── package.json │ └── test/ │ ├── test.arr.js │ ├── test.at_and_dollar.js │ ├── test.eval.js │ ├── test.examples.js │ ├── test.html │ ├── test.intermixed.arr.js │ └── test.parent-selector.js ├── lodash/ │ ├── .bower.json │ ├── LICENSE.txt │ ├── bower.json │ └── dist/ │ ├── lodash.compat.js │ ├── lodash.js │ └── lodash.underscore.js ├── modernizr/ │ ├── .bower.json │ ├── .editorconfig │ ├── .gitignore │ ├── .travis.yml │ ├── feature-detects/ │ │ ├── a-download.js │ │ ├── audio-audiodata-api.js │ │ ├── audio-webaudio-api.js │ │ ├── battery-api.js │ │ ├── battery-level.js │ │ ├── blob-constructor.js │ │ ├── canvas-todataurl-type.js │ │ ├── contenteditable.js │ │ ├── contentsecuritypolicy.js │ │ ├── contextmenu.js │ │ ├── cookies.js │ │ ├── cors.js │ │ ├── css-backgroundposition-shorthand.js │ │ ├── css-backgroundposition-xy.js │ │ ├── css-backgroundrepeat.js │ │ ├── css-backgroundsizecover.js │ │ ├── css-boxsizing.js │ │ ├── css-calc.js │ │ ├── css-cubicbezierrange.js │ │ ├── css-displayrunin.js │ │ ├── css-displaytable.js │ │ ├── css-filters.js │ │ ├── css-hyphens.js │ │ ├── css-lastchild.js │ │ ├── css-mask.js │ │ ├── css-mediaqueries.js │ │ ├── css-objectfit.js │ │ ├── css-overflow-scrolling.js │ │ ├── css-pointerevents.js │ │ ├── css-positionsticky.js │ │ ├── css-regions.js │ │ ├── css-remunit.js │ │ ├── css-resize.js │ │ ├── css-scrollbars.js │ │ ├── css-shapes.js │ │ ├── css-subpixelfont.js │ │ ├── css-supports.js │ │ ├── css-userselect.js │ │ ├── css-vhunit.js │ │ ├── css-vmaxunit.js │ │ ├── css-vminunit.js │ │ ├── css-vwunit.js │ │ ├── custom-protocol-handler.js │ │ ├── dart.js │ │ ├── dataview-api.js │ │ ├── dom-classlist.js │ │ ├── dom-createElement-attrs.js │ │ ├── dom-dataset.js │ │ ├── dom-microdata.js │ │ ├── elem-datalist.js │ │ ├── elem-details.js │ │ ├── elem-output.js │ │ ├── elem-progress-meter.js │ │ ├── elem-ruby.js │ │ ├── elem-time.js │ │ ├── elem-track.js │ │ ├── emoji.js │ │ ├── es5-strictmode.js │ │ ├── event-deviceorientation-motion.js │ │ ├── exif-orientation.js │ │ ├── file-api.js │ │ ├── file-filesystem.js │ │ ├── forms-fileinput.js │ │ ├── forms-formattribute.js │ │ ├── forms-inputnumber-l10n.js │ │ ├── forms-placeholder.js │ │ ├── forms-speechinput.js │ │ ├── forms-validation.js │ │ ├── fullscreen-api.js │ │ ├── gamepad.js │ │ ├── getusermedia.js │ │ ├── ie8compat.js │ │ ├── iframe-sandbox.js │ │ ├── iframe-seamless.js │ │ ├── iframe-srcdoc.js │ │ ├── img-apng.js │ │ ├── img-webp.js │ │ ├── json.js │ │ ├── lists-reversed.js │ │ ├── mathml.js │ │ ├── network-connection.js │ │ ├── network-eventsource.js │ │ ├── network-xhr2.js │ │ ├── notification.js │ │ ├── performance.js │ │ ├── pointerlock-api.js │ │ ├── quota-management-api.js │ │ ├── requestanimationframe.js │ │ ├── script-async.js │ │ ├── script-defer.js │ │ ├── style-scoped.js │ │ ├── svg-filters.js │ │ ├── unicode.js │ │ ├── url-data-uri.js │ │ ├── userdata.js │ │ ├── vibration.js │ │ ├── web-intents.js │ │ ├── webgl-extensions.js │ │ ├── websockets-binary.js │ │ ├── window-framed.js │ │ ├── workers-blobworkers.js │ │ ├── workers-dataworkers.js │ │ └── workers-sharedworkers.js │ ├── grunt.js │ ├── media/ │ │ ├── Modernizr 2 Logo.ai │ │ └── Modernizr 2 Logo.eps │ ├── modernizr.js │ ├── readme.md │ └── test/ │ ├── basic.html │ ├── caniuse.html │ ├── caniuse_files/ │ │ ├── Windsong-webfont.otf │ │ ├── form_validation.html │ │ ├── ga.js │ │ ├── hashchange.html │ │ ├── mathml.html │ │ ├── pushstate.html │ │ ├── style.css │ │ ├── svg-img.svg.1 │ │ └── xhtml.html │ ├── index.html │ ├── js/ │ │ ├── basic.html │ │ ├── dumpdata.js │ │ ├── lib/ │ │ │ ├── detect-global.js │ │ │ ├── jquery-1.7b2.js │ │ │ ├── jsonselect.js │ │ │ ├── polyfills.js │ │ │ └── uaparser.js │ │ ├── setup.js │ │ ├── unit-caniuse.js │ │ └── unit.js │ └── qunit/ │ ├── qunit.css │ ├── qunit.js │ └── run-qunit.js ├── ng-lodash/ │ ├── .bower.json │ ├── .bowerrc │ ├── .editorconfig │ ├── .gitignore │ ├── .jscsrc │ ├── .jshintrc │ ├── .travis.yml │ ├── CONTRIBUTING.md │ ├── License.txt │ ├── README.md │ ├── bower.json │ ├── build/ │ │ └── ng-lodash.js │ └── package.json ├── sprintf/ │ ├── .bower.json │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── bower.json │ ├── demo/ │ │ └── angular.html │ ├── gruntfile.js │ ├── package.json │ ├── src/ │ │ ├── angular-sprintf.js │ │ └── sprintf.js │ └── test/ │ └── test.js └── string-format-js/ ├── .bower.json ├── Gruntfile.js ├── LICENSE.txt ├── README.md ├── bower.json ├── format.js └── package.json ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ # OSX leaves these everywhere on SMB shares ._* # OSX trash .DS_Store # Eclipse files .classpath .project .settings/** # This is where the result of the go build goes /output/** /output /_output/** /_output # Emacs save files *~ \#*\# .\#* # Vim-related files [._]*.s[a-w][a-z] [._]s[a-w][a-z] *.un~ Session.vim .netrwhist # Go test binaries *.test /hack/.test-cmd-auth # JUnit test output from ginkgo e2e tests /junit*.xml # Mercurial files **/.hg **/.hg* # Vagrant .vagrant network_closure.sh # Compiled binaries in third_party /third_party/pkg # Also ignore etcd installed by hack/install-etcd.sh /third_party/etcd* # User cluster configs .kubeconfig .tags* # Web UI master/node_modules/ master/npm-debug.log master/shared/config/development.json npm-debug.log # Karma output test_out # precommit temporary directories created by ./hack/verify-gendocs.sh and ./hack/lib/util.sh _tmp/ doc_tmp/ # binaries kube-ui # artifacts master/npm-11278-00d1fb62/ master/phantomjs/ master/npm-5364-70388efc/ .idea /app/ ================================================ FILE: .travis.yml ================================================ language: node_js sudo: false node_js: - '0.12' cache: directories: - master/node_modules before_install: - export CHROME_BIN=chromium-browser - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start install: # Update npm - npm install -g npm@2.9.1 - npm --version - cd master - npm install # todo: activate next line when E2E tests are fixed # - ./node_modules/.bin/webdriver-manager update script: - npm run build # run unit tests - ./node_modules/.bin/karma start karma.conf.js --singleRun=true --autoWatch=false # todo: fix E2E tests # - cd ../app && ../master/node_modules/.bin/http-server -p 8000 & # - cd ../master && node_modules/.bin/protractor protractor/conf.js ================================================ FILE: CONTRIBUTING.md ================================================ # How to become a contributor and submit your own code ## Contributor License Agreements We'd love to accept your patches! Before we can take them, we have to jump a couple of legal hurdles. Please fill out either the individual or corporate Contributor License Agreement (CLA). * If you are an individual writing original source code and you're sure you own the intellectual property, then you'll need to sign an [individual CLA](http://code.google.com/legal/individual-cla-v1.0.html). * If you work for a company that wants to allow you to contribute your work, then you'll need to sign a [corporate CLA](http://code.google.com/legal/corporate-cla-v1.0.html). Follow either of the two links above to access the appropriate CLA and instructions for how to sign and return it. Once we receive it, we'll be able to accept your pull requests. ## Contributing A Patch 1. Submit an issue describing your proposed change to the repo in question. 1. The repo owner will respond to your issue promptly. 1. If your proposed change is accepted, and you haven't already done so, sign a Contributor License Agreement (see details above). 1. Fork the desired repo, develop and test your code changes. 1. Submit a pull request. ## Protocols for Collaborative Development Please read [this doc](docs/devel/collab.md) for information on how we're running development for the project. Also take a look at the [development guide](docs/devel/development.md) for information on how to set up your environment, run tests, manage dependencies, etc. ## Adding dependencies If your patch depends on new packages, add that package with [`godep`](https://github.com/tools/godep). Follow the [instructions to add a dependency](docs/devel/development.md#godep-and-dependency-management). [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/CONTRIBUTING.md?pixel)]() ================================================ FILE: Dockerfile ================================================ # Copyright 2015 The Kubernetes Authors. 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. FROM scratch MAINTAINER Tim St. Clair ADD kube-ui kube-ui EXPOSE 8080 ENTRYPOINT ["/kube-ui"] ================================================ FILE: Godeps/Godeps.json ================================================ { "ImportPath": "k8s.io/kube-ui", "GoVersion": "go1.4.2", "Packages": [ "./..." ], "Deps": [ { "ImportPath": "github.com/elazarl/go-bindata-assetfs", "Rev": "c57a80f1ab2ad67bafa83f5fd0b4c2ecbd253dd5" } ] } ================================================ FILE: Godeps/Readme ================================================ This directory tree is generated automatically by godep. Please do not edit. See https://github.com/tools/godep for more information. ================================================ FILE: Godeps/_workspace/.gitignore ================================================ /pkg /bin ================================================ FILE: Godeps/_workspace/src/github.com/elazarl/go-bindata-assetfs/LICENSE ================================================ Copyright (c) 2014, Elazar Leibovich All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 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 HOLDER 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. ================================================ FILE: Godeps/_workspace/src/github.com/elazarl/go-bindata-assetfs/README.md ================================================ # go-bindata-assetfs Serve embedded files from [jteeuwen/go-bindata](https://github.com/jteeuwen/go-bindata) with `net/http`. [GoDoc](http://godoc.org/github.com/elazarl/go-bindata-assetfs) ### Installation Install with $ go get github.com/jteeuwen/go-bindata/... $ go get github.com/elazarl/go-bindata-assetfs/... ### Creating embedded data Usage is identical to [jteeuwen/go-bindata](https://github.com/jteeuwen/go-bindata) usage, instead of running `go-bindata` run `go-bindata-assetfs`. The tool will create a `bindata_assetfs.go` file, which contains the embedded data. A typical use case is $ go-bindata-assetfs data/... ### Using assetFS in your code The generated file provides an `assetFS()` function that returns a `http.Filesystem` wrapping the embedded files. What you usually want to do is: http.Handle("/", http.FileServer(assetFS())) This would run an HTTP server serving the embedded files. ## Without running binary tool You can always just run the `go-bindata` tool, and then use import "github.com/elazarl/go-bindata-assetfs" ... http.Handle("/", http.FileServer( &assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, Prefix: "data"})) to serve files embedded from the `data` directory. ================================================ FILE: Godeps/_workspace/src/github.com/elazarl/go-bindata-assetfs/assetfs.go ================================================ package assetfs import ( "bytes" "errors" "io" "io/ioutil" "net/http" "os" "path" "path/filepath" "time" ) var ( fileTimestamp = time.Now() ) // FakeFile implements os.FileInfo interface for a given path and size type FakeFile struct { // Path is the path of this file Path string // Dir marks of the path is a directory Dir bool // Len is the length of the fake file, zero if it is a directory Len int64 } func (f *FakeFile) Name() string { _, name := filepath.Split(f.Path) return name } func (f *FakeFile) Mode() os.FileMode { mode := os.FileMode(0644) if f.Dir { return mode | os.ModeDir } return mode } func (f *FakeFile) ModTime() time.Time { return fileTimestamp } func (f *FakeFile) Size() int64 { return f.Len } func (f *FakeFile) IsDir() bool { return f.Mode().IsDir() } func (f *FakeFile) Sys() interface{} { return nil } // AssetFile implements http.File interface for a no-directory file with content type AssetFile struct { *bytes.Reader io.Closer FakeFile } func NewAssetFile(name string, content []byte) *AssetFile { return &AssetFile{ bytes.NewReader(content), ioutil.NopCloser(nil), FakeFile{name, false, int64(len(content))}} } func (f *AssetFile) Readdir(count int) ([]os.FileInfo, error) { return nil, errors.New("not a directory") } func (f *AssetFile) Size() int64 { return f.FakeFile.Size() } func (f *AssetFile) Stat() (os.FileInfo, error) { return f, nil } // AssetDirectory implements http.File interface for a directory type AssetDirectory struct { AssetFile ChildrenRead int Children []os.FileInfo } func NewAssetDirectory(name string, children []string, fs *AssetFS) *AssetDirectory { fileinfos := make([]os.FileInfo, 0, len(children)) for _, child := range children { _, err := fs.AssetDir(filepath.Join(name, child)) fileinfos = append(fileinfos, &FakeFile{child, err == nil, 0}) } return &AssetDirectory{ AssetFile{ bytes.NewReader(nil), ioutil.NopCloser(nil), FakeFile{name, true, 0}, }, 0, fileinfos} } func (f *AssetDirectory) Readdir(count int) ([]os.FileInfo, error) { if count <= 0 { return f.Children, nil } if f.ChildrenRead+count > len(f.Children) { count = len(f.Children) - f.ChildrenRead } rv := f.Children[f.ChildrenRead : f.ChildrenRead+count] f.ChildrenRead += count return rv, nil } func (f *AssetDirectory) Stat() (os.FileInfo, error) { return f, nil } // AssetFS implements http.FileSystem, allowing // embedded files to be served from net/http package. type AssetFS struct { // Asset should return content of file in path if exists Asset func(path string) ([]byte, error) // AssetDir should return list of files in the path AssetDir func(path string) ([]string, error) // Prefix would be prepended to http requests Prefix string } func (fs *AssetFS) Open(name string) (http.File, error) { name = path.Join(fs.Prefix, name) if len(name) > 0 && name[0] == '/' { name = name[1:] } if children, err := fs.AssetDir(name); err == nil { return NewAssetDirectory(name, children, fs), nil } b, err := fs.Asset(name) if err != nil { return nil, err } return NewAssetFile(name, b), nil } ================================================ FILE: Godeps/_workspace/src/github.com/elazarl/go-bindata-assetfs/doc.go ================================================ // assetfs allows packages to serve static content embedded // with the go-bindata tool with the standard net/http package. // // See https://github.com/jteeuwen/go-bindata for more information // about embedding binary data with go-bindata. // // Usage example, after running // $ go-bindata data/... // use: // http.Handle("/", // http.FileServer( // &assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, Prefix: "data"})) package assetfs ================================================ FILE: Godeps/_workspace/src/github.com/elazarl/go-bindata-assetfs/go-bindata-assetfs/main.go ================================================ package main import ( "bufio" "bytes" "fmt" "os" "os/exec" ) const bindatafile = "bindata.go" func main() { if _, err := exec.LookPath("go-bindata"); err != nil { fmt.Println("Cannot find go-bindata executable in path") fmt.Println("Maybe you need: go get github.com/elazarl/go-bindata-assetfs/...") os.Exit(1) } cmd := exec.Command("go-bindata", os.Args[1:]...) cmd.Stdin = os.Stdin cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr if err := cmd.Run(); err != nil { os.Exit(1) } in, err := os.Open(bindatafile) if err != nil { fmt.Fprintln(os.Stderr, "Cannot read", bindatafile, err) return } out, err := os.Create("bindata_assetfs.go") if err != nil { fmt.Fprintln(os.Stderr, "Cannot write 'bindata_assetfs.go'", err) return } r := bufio.NewReader(in) done := false for line, isPrefix, err := r.ReadLine(); err == nil; line, isPrefix, err = r.ReadLine() { line = append(line, '\n') if _, err := out.Write(line); err != nil { fmt.Fprintln(os.Stderr, "Cannot write to 'bindata_assetfs.go'", err) return } if !done && !isPrefix && bytes.HasPrefix(line, []byte("import (")) { fmt.Fprintln(out, "\t\"github.com/elazarl/go-bindata-assetfs\"") done = true } } fmt.Fprintln(out, ` func assetFS() *assetfs.AssetFS { for k := range _bintree.Children { return &assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, Prefix: k} } panic("unreachable") }`) // Close files BEFORE remove calls (don't use defer). in.Close() out.Close() if err := os.Remove(bindatafile); err != nil { fmt.Fprintln(os.Stderr, "Cannot remove", bindatafile, err) } } ================================================ FILE: LICENSE ================================================ Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ================================================ FILE: Makefile ================================================ # Makefile for the Docker image gcr.io/kube-ui/kube-ui # MAINTAINER: Tim St. Clair # If you update this image please check the tag value before pushing. .PHONY: all bindata container push clean # Keep this at dev, so no one accidentally blows away the latest published version. TAG = dev # current version: v5 PREFIX = staging-k8s.gcr.io all: push bindata: data/datafile.go ./build/build-ui.sh kube-ui: bindata server/kube-ui.go CGO_ENABLED=0 GOOS=linux godep go build -a -installsuffix cgo -ldflags '-w' ./server/kube-ui.go container: kube-ui docker build -t $(PREFIX)/kube-ui:$(TAG) . push: container gcloud docker push $(PREFIX)/kube-ui:$(TAG) clean: rm -f kube-ui ================================================ FILE: README.md ================================================ Join the UI discussion at: https://groups.google.com/forum/#!forum/kubernetes-sig-ui Also please check out the new Dashboard for Kubernetes available at: https://github.com/kubernetes/dashboard This codebase will be retired once the new and improved Dashboard is production ready. # Working with the Kubernetes UI This document explains how to work with the Kubernetes UI. For information on how to access and use it, see [docs/ui.md](docs/ui.md). ## Installing dependencies There are two kinds of dependencies in the UI project: tools and frameworks. The tools help us manage and test the application. They are not part of the application. The frameworks, on the other hand, become part of the application, as described below. * We get the tools via `npm`, the [node package manager](https://www.npmjs.com/). * We get the frameworks via `bower`, a [client-side package manager](http://bower.io/). Before you build the application for the first time, run this command from the `master` directory: ``` npm install ``` It creates a new directory, `master/node_modules`, which contains the tool dependencies. ## Building and serving the app ### Building the app for development To build the application for development, run this command from the `master` directory: ``` npm start ``` It runs `bower install` to install and/or update the framework dependencies, and then `gulp`, a [JavaScript build system](http://gulpjs.com/), to generate a development version of the application. Bower creates a new directory, `third_party/ui/bower_components`, which contains the framework dependencies. Each of them should be referenced in one of the `vendor.json` files below: * `master/vendor.base.json` - 3rd party vendor javascript files required to start the app. All of the dependencies referenced by this file are compiled into `base.js` and loaded before `app.js`. * `master/vendor.json` - 3rd party vendor js or css files required to make the app work, usually by lazy loading. All of the dependencies referenced by this file are compiled into `app/vendor`. (Note: some framework dependencies have been hand edited and checked into source control under `master/shared/vendor`.) The default `gulp` target builds the application for development (e.g., without uglification of js files or minification of css files), and then starts a file watcher that rebuilds the generated files every time the source files are updated. (Note: the file watcher does not support adding or deleting files. It must be stopped and restarted to pick up additions or deletions). The `app` directory and its contents are generated by the build. All of the other files are source or project files, such as tests, scripts, documentation and package manifests. (Note: the build output checked into source control is the production version, built with uglification and minification, as described below, so expect the build output to change if you build for development.) ### Serving the app during development For development you can serve the files locally by installing a web server as follows: ``` sudo npm install -g http-server ``` The server can then be launched from the `app` directory as follows: ``` cd app http-server -a localhost -p 8001 ``` `http-server` is convenient, since we're already using `npm`, but any web server hosting the `app` directory should work. Note that you'll need to tell the application where to find the api server by setting the value of the `k8sApiServer` configuration parameter in `master/shared/config/development.json` and then rebuilding the application. For example, for a cluster running locally at `localhost:8080`, as described [here](https://github.com/GoogleCloudPlatform/kubernetes/tree/master/docs/getting-started-guides/locally.md), you'll want to set it as follows: ``` "k8sApiServer": "http://localhost:8080/api/v1beta3" ``` ### Building the app for production To build the application for production, run this command from the `master` directory: ``` npm run build ``` Like `npm start`, it runs `bower install` to install and/or update the framework dependencies, but then it runs `gulp build` to generate a production version of the application. The `build` target builds the application for production (e.g., with uglification of js files and minification of css files), and does not run a file watcher, so that it can be used in automated build environments. ### Serving the app in production The app is served in production by `kube-apiserver` at: ``` https:///ui/ ``` which redirects to: ``` https:///api/v1/proxy/namespaces/kube-system/services/kube-ui/ ``` ## Configuration ### Configuration settings A json file can be used by `gulp` to automatically create angular constants. This is useful for setting per environment variables such as api endpoints. `master/shared/config/development.json` and `master/shared/config/production.json` are used for application wide configuration in development and production, respectively. * `master/shared/config/production.json` is kept under source control with default values for production. * `master/shared/config/development.json` is not kept under source control. Each developer can create a local version of the file by copy, paste and rename from `master/shared/config/development.example.json`, which is kept under source control with default values for development. The configuration files for the current build environment are compiled into the intermediary `master/shared/config/generated-config.js`, which is then compiled into `app.js`. * Component configuration added to `master/components//config/.json` is combined with the application wide configuration during the build. The generated angular constant is named `ENV`. The shared configuration and component configurations each generate a nested object within it. For example: ``` master ├── shared/config/development.json └── components ├── dashboard/config/development.json └── my_component/config/development.json ``` generates the following in `master/shared/config/generated-config.js`: ``` angular.module('kubernetesApp.config', []) .constant('ENV', { '/': , 'dashboard': , 'my_component': }); ``` ### Kubernetes server configuration **RECOMMENDED**: The Kubernetes api server does not enable CORS by default, so `kube-apiserver` must be started with `--cors_allowed_origins=http://` or `--cors_allowed_origins=.*`. **NOT RECOMMENDED**: If you don't want to/cannot restart the Kubernetes api server, you can start your browser with web security disabled. For example, you can [launch Chrome](http://www.chromium.org/developers/how-tos/run-chromium-with-flags) with flag `--disable-web-security`. Be careful not to visit untrusted web sites when running your browser in this mode. ## Building a new visualizer or component See [master/components/README.md](master/components/README.md). ## Testing Currently, the UI project includes both unit-testing with [Karma](http://karma-runner.github.io/0.12/index.html) and end-to-end testing with [Protractor](http://angular.github.io/protractor/#/). ### Unit testing with Karma To run the existing Karma tests: * Edit the Karma configuration in `master/karma.config.js`, if necessary. * Run the tests. The console should show the test results. ``` cd master node node_modules/.bin/karma start karma.conf.js ``` To run new Karma tests for a component, put new `*.spec.js` files under the appropriate `master/components/**/test/modules/*` directories. To test the chrome, put new `*.spec.js` files under the appropriate `master/test/modules/*` directories. ### End-to-end testing with Protractor To run the existing Protractor tests: * Install the CLIs. ``` sudo npm install -g protractor ``` * Edit the test configuration in `master/protractor/conf.js`, if necessary. * Start the webdriver server. ``` sudo webdriver-manager start ``` * Start the application (see instructions above), running at port 8000. * Run the tests. The console should show the test results. ``` cd master/protractor protractor conf.js ``` To run new protractor tests for a component, put new `*.spec.js` files in the appropriate `master/components/**/protractor/*` directories. To test the chrome, put new `*.spec.js` files under the `master/protractor/chrome` directory. [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/www/README.md?pixel)]() ================================================ FILE: build/build-ui.sh ================================================ #!/bin/bash # Copyright 2014 The Kubernetes Authors 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. # This script builds ui assets into a single go datafile set -o errexit set -o nounset set -o pipefail KUBE_ROOT=$(dirname "${BASH_SOURCE}")/.. # source "${KUBE_ROOT}/hack/lib/init.sh" cd "${KUBE_ROOT}" if ! which go-bindata > /dev/null 2>&1 ; then echo "Cannot find go-bindata. Install with \"go get github.com/jteeuwen/go-bindata/...\"" exit 1 fi readonly TMP_DATAFILE="/tmp/datafile.go" readonly DASHBOARD_SRC="app/..." readonly DASHBOARD_PKG="data" function kube::hack::build_ui() { local pkg="$1" local src="$2" local output_file="${pkg}/datafile.go" go-bindata -nocompress -o "${output_file}" -prefix ${PWD} -pkg "${pkg}" "${src}" local year=$(date +%Y) cat hooks/boilerplate.go.txt | sed "s/YEAR/${year}/" > "${TMP_DATAFILE}" echo -e "// generated by hack/build-ui.sh; DO NOT EDIT\n" >> "${TMP_DATAFILE}" cat "${output_file}" >> "${TMP_DATAFILE}" gofmt -s -w "${TMP_DATAFILE}" mv "${TMP_DATAFILE}" "${output_file}" } kube::hack::build_ui "${DASHBOARD_PKG}" "${DASHBOARD_SRC}" ================================================ FILE: data/datafile.go ================================================ /* Copyright 2016 The Kubernetes Authors 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. */ // generated by hack/build-ui.sh; DO NOT EDIT // Code generated by go-bindata. // sources: // app/assets/css/app.css // app/assets/img/docArrow.png // app/assets/img/ic_arrow_drop_down_24px.svg // app/assets/img/ic_arrow_drop_up_24px.svg // app/assets/img/ic_keyboard_arrow_left_24px.svg // app/assets/img/ic_keyboard_arrow_right_24px.svg // app/assets/img/icons/arrow-back.png // app/assets/img/icons/favicon.png // app/assets/img/icons/ic_arrow_forward_24px.svg // app/assets/img/icons/ic_cancel_24px.svg // app/assets/img/icons/ic_close_24px.svg // app/assets/img/icons/ic_menu.svg // app/assets/img/icons/ic_menu_24px.svg // app/assets/img/icons/list_control_down.png // app/assets/img/kubernetes.svg // app/assets/js/app.js // app/assets/js/base.js // app/components/dashboard/img/icons/ic_arrow_drop_down_18px.svg // app/components/dashboard/img/icons/ic_arrow_drop_down_24px.svg // app/components/dashboard/img/icons/ic_close_18px.svg // app/components/dashboard/img/icons/ic_close_24px.svg // app/components/dashboard/manifest.json // app/components/dashboard/pages/footer.html // app/components/dashboard/pages/header.html // app/components/dashboard/pages/home.html // app/components/dashboard/views/groups.html // app/components/dashboard/views/listEvents.html // app/components/dashboard/views/listMinions.html // app/components/dashboard/views/listPods.html // app/components/dashboard/views/listPodsCards.html // app/components/dashboard/views/listPodsVisualizer.html // app/components/dashboard/views/listReplicationControllers.html // app/components/dashboard/views/listServices.html // app/components/dashboard/views/node.html // app/components/dashboard/views/partials/cadvisor.html // app/components/dashboard/views/partials/groupBox.html // app/components/dashboard/views/partials/groupItem.html // app/components/dashboard/views/partials/podTilesByName.html // app/components/dashboard/views/partials/podTilesByServer.html // app/components/dashboard/views/pod.html // app/components/dashboard/views/replication.html // app/components/dashboard/views/service.html // app/index.html // app/vendor/angular-json-human/dist/angular-json-human.css // app/vendor/angular-material/angular-material.css // app/vendor/d3/d3.min.js // app/views/partials/404.html // app/views/partials/kubernetes-ui-menu.tmpl.html // app/views/partials/md-table.tmpl.html // app/views/partials/menu-toggle.tmpl.html // DO NOT EDIT! package data import ( "fmt" "io/ioutil" "os" "path/filepath" "strings" "time" ) type asset struct { bytes []byte info os.FileInfo } type bindataFileInfo struct { name string size int64 mode os.FileMode modTime time.Time } func (fi bindataFileInfo) Name() string { return fi.name } func (fi bindataFileInfo) Size() int64 { return fi.size } func (fi bindataFileInfo) Mode() os.FileMode { return fi.mode } func (fi bindataFileInfo) ModTime() time.Time { return fi.modTime } func (fi bindataFileInfo) IsDir() bool { return false } func (fi bindataFileInfo) Sys() interface{} { return nil } var _appAssetsCssAppCss = []byte(`.nav-back{width:80px;font-size:14px;padding-left:14px;line-height:15px;background-size:14px 14px;background-repeat:no-repeat;display:block}a{text-decoration:none}.main-fab{position:absolute;z-index:20;font-size:30px;top:100px;left:24px;transform:scale(.88,.88)}.md-breadcrumb{padding-left:16px}.md-table{min-width:100%;border-collapse:collapse}.md-table tbody tr:focus,.md-table tbody tr:hover{cursor:pointer;background-color:rgba(63,81,181,.2)}.md-table-header{border-bottom:1px solid #e6e6e6;color:#828282;text-align:left;font-size:.75em;font-weight:700;padding:16px 16px 16px 0}.md-table-header a{text-decoration:none;color:inherit}.md-table-caret{display:inline-block;vertical-align:middle}.md-table-content{font-size:.8em;padding:16px 16px 16px 0;height:72px}.md-table-td-more{max-width:72px;width:72px;padding:16px}.md-table-thumbs{max-width:104px;width:104px;padding:16px 32px}.md-table-thumbs div{overflow:hidden;width:40px;height:40px;border-radius:20px;border:1px solid rgba(0,0,0,.2);background-size:cover;box-shadow:0 8px 10px rgba(0,0,0,.3);-webkit-box-shadow:0 8px 10px rgba(0,0,0,.1)}.md-table-footer{height:40px}.md-table-count-info{line-height:40px;font-size:.75em}.md-table-footer-item{width:40px;height:40px;vertical-align:middle}.bold,.md-table-active-page{font-weight:700}.gray,.grey{color:#888}md-input-container.md-default-theme .md-input{color:#fff;border-color:#fff;margin-top:24px}.dashboard-subnav{font-size:.9em;min-height:38px;max-height:38px;background-color:#09c1d1!important}.dashboard-subnav md-select.md-default-theme:focus .md-select-label{border-bottom:none;color:#fff}.selectSubPages p{text-align:center;color:#fff}.selectSubPages .md-default-theme .md-select-label.md-placeholder{color:#fff}.selectSubPages .md-select-label{padding-top:0;font-size:1em;line-height:1em;border-bottom:none;padding-bottom:0}.selectSubPages md-select{margin-top:10px;margin-right:80px;padding:0}md-select-menu{max-height:none}.md-toolbar-tools{padding-left:8px;padding-right:8px}.md-toolbar-small{height:38px;min-height:38px}.md-toolbar-tools-small{background-color:#09c1d1}.kubernetes-ui-menu,.kubernetes-ui-menu ul{list-style:none;padding:0}.kubernetes-ui-menu li{margin:0}.kubernetes-ui-menu>li{border-top:1px solid rgba(0,0,0,.12)}.kubernetes-ui-menu .md-button{border-radius:0;color:inherit;cursor:pointer;font-weight:400;line-height:40px;margin:0;max-height:40px;overflow:hidden;padding:0 16px;text-align:left;text-decoration:none;white-space:normal;width:100%}.kubernetes-ui-menu a.md-button{display:block}.kubernetes-ui-menu button.md-button::-moz-focus-inner{padding:0}.kubernetes-ui-menu .md-button.active{color:#03a9f4}.menu-heading{color:#888;display:block;font-size:inherit;font-weight:500;line-height:40px;margin:0;padding:0 16px;text-align:left;width:100%}.kubernetes-ui-menu li.parentActive,.kubernetes-ui-menu li.parentActive .menu-toggle-list{background-color:#f6f6f6}.menu-toggle-list{background:#fff;max-height:999px;overflow:hidden;position:relative;z-index:1;-webkit-transition:.75s cubic-bezier(.35,0,.25,1);-webkit-transition-property:max-height;-moz-transition:.75s cubic-bezier(.35,0,.25,1);-moz-transition-property:max-height;transition:.75s cubic-bezier(.35,0,.25,1);transition-property:max-height}.menu-toggle-list.ng-hide{max-height:0}.kubernetes-ui-menu .menu-toggle-list a.md-button{display:block;padding:0 16px 0 32px;text-transform:none}.md-button-toggle .md-toggle-icon{background:url(../img/icons/list_control_down.png) center center no-repeat;background-size:100% auto;display:inline-block;height:24px;margin:auto 0 auto auto;speak:none;width:24px;transition:transform .3s ease-in-out;-webkit-transition:-webkit-transform .3s ease-in-out}.md-button-toggle .md-toggle-icon.toggled{transform:rotate(180deg);-webkit-transform:rotate(180deg)}.menu-icon{background:0 0;border:none;margin-right:16px;padding:0}.whiteframedemoBasicUsage md-whiteframe{background:#fff;margin:2px;padding:2px}.tabsDefaultTabs{height:100%;width:100%}.tabsDefaultTabs .remove-tab{margin-bottom:40px}.tabsDefaultTabs .home-buttons .md-button{display:block;max-height:30px}.tabsDefaultTabs .home-buttons .md-button.add-tab{margin-top:20px;max-height:30px!important}.tabsDefaultTabs .demo-tab{display:block;position:relative;background:#fff;border:0 solid #000;min-height:0;width:100%}.tabsDefaultTabs .tab0,.tabsDefaultTabs .tab1,.tabsDefaultTabs .tab2,.tabsDefaultTabs .tab3{background-color:#bbdefb}.tabsDefaultTabs .md-header{background-color:#1976D2!important}.tabsDefaultTabs md-tab{color:#90caf9!important}.tabsDefaultTabs md-tab.active,.tabsDefaultTabs md-tab:focus{color:#fff!important}.tabsDefaultTabs md-tab[disabled]{opacity:.5}.tabsDefaultTabs .md-header .md-ripple{border-color:#FFFF8D!important}.tabsDefaultTabs md-tabs-ink-bar{background-color:#FFFF8D!important}.tabsDefaultTabs .title{padding-top:8px;padding-right:8px;text-align:left;text-transform:uppercase;color:#888;margin-top:24px}.tabsDefaultTabs [layout-align]>*,.tabsDefaultTabs form>[layout]>*{margin-left:8px}.tabsDefaultTabs .long>input{width:264px}.menuBtn{background-color:transparent;border:none;height:38px;margin:16px;position:absolute;width:36px}md-toolbar h1{margin:auto}md-list .md-button{color:inherit;font-weight:500;text-align:left;width:100%}md-list .md-button.selected{color:#03a9f4}#content{overflow:hidden}#content md-content{padding-left:0;padding-right:0;padding-top:0}#content .md-button.action{background-color:transparent;border:none;height:38px;margin:8px auto 16px 0;position:absolute;top:10px;right:25px;width:36px}#content img{display:block;height:auto;max-width:500px}.content-wrapper{position:relative}.visuallyhidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}md-toolbar h1{font-size:1.25em;font-weight:400}.menuBtn{background:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIHg9IjBweCIgeT0iMHB4IiB3aWR0aD0iMjRweCIgaGVpZ2h0PSIyNHB4IiB2aWV3Qm94PSIwIDAgMjQgMjQiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDI0IDI0IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPGcgaWQ9IkhlYWRlciI+CiAgICA8Zz4KICAgICAgICA8cmVjdCB4PSItNjE4IiB5PSItMjIzMiIgZmlsbD0ibm9uZSIgd2lkdGg9IjE0MDAiIGhlaWdodD0iMzYwMCIvPgogICAgPC9nPgo8L2c+CjxnIGlkPSJMYWJlbCI+CjwvZz4KPGcgaWQ9Ikljb24iPgogICAgPGc+CiAgICAgICAgPHJlY3QgZmlsbD0ibm9uZSIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0Ii8+CiAgICAgICAgPHBhdGggZD0iTTMsMThoMTh2LTJIM1YxOHogTTMsMTNoMTh2LTJIM1YxM3ogTTMsNnYyaDE4VjZIM3oiIHN0eWxlPSJmaWxsOiNmM2YzZjM7Ii8+CiAgICA8L2c+CjwvZz4KPGcgaWQ9IkdyaWQiIGRpc3BsYXk9Im5vbmUiPgogICAgPGcgZGlzcGxheT0iaW5saW5lIj4KICAgIDwvZz4KPC9nPgo8L3N2Zz4=) center center no-repeat}.actionBtn{background:url(data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzNiIgaGVpZ2h0PSIzNiIgdmlld0JveD0iMCAwIDM2IDM2Ij4NCiAgICA8cGF0aCBkPSJNMCAwaDM2djM2aC0zNnoiIGZpbGw9Im5vbmUiLz4NCiAgICA8cGF0aCBkPSJNNCAyN2gyOHYtM2gtMjh2M3ptMC04aDI4di0zaC0yOHYzem0wLTExdjNoMjh2LTNoLTI4eiIvPg0KPC9zdmc+) center center no-repeat}.kubernetes-ui-logo{background-image:url(../img/kubernetes.svg);background-size:40px 40px;width:40px;height:40px}.kubernetes-ui-text{line-height:40px;vertical-align:middle;padding:2px}md-select-menu.md-default-theme md-option:focus:not([selected]){background:#eee}md-select-menu md-option{transition:box-shadow .4s cubic-bezier(.25,.8,.25,1),background-color .4s cubic-bezier(.25,.8,.25,1),-webkit-transform .4s cubic-bezier(.25,.8,.25,1);transition:box-shadow .4s cubic-bezier(.25,.8,.25,1),background-color .4s cubic-bezier(.25,.8,.25,1),transform .4s cubic-bezier(.25,.8,.25,1)}md-select-menu md-option:not([disabled]):focus,md-select-menu md-option:not([disabled]):hover{background-color:rgba(158,158,158,.2)}.dashboard .body-wrapper{padding:25px}.dashboard [flex-align-self=end]{-webkit-align-self:flex-end;-ms-flex-align-self:end;align-self:flex-end}.dashboard .back{font-size:18px;line-height:27px;margin-bottom:30px}.dashboard .heading{font-size:18px;line-height:21px;color:#222;margin-bottom:25px}.dashboard .heading .label{color:#777}.dashboard .clear-bg{background-color:transparent}.dashboard .list-pods .pod-group{margin:25px}.dashboard .list-pods .pod-group md-grid-list{margin-top:50px;color:#fff}.dashboard .list-pods .pod-group md-grid-list figcaption{width:100%}.dashboard .list-pods .pod-group md-grid-list md-grid-tile-header{padding-left:10px}.dashboard .list-pods .pod-group md-grid-list md-grid-tile-header .labels{width:100%}.dashboard .list-pods .pod-group md-grid-list md-grid-tile{transition:all 700ms ease-in 50ms}.dashboard .list-pods .pod-group md-grid-list .inner-box{padding-left:10px;padding-right:10px}.dashboard .list-pods .pod-group md-grid-list md-grid-tile-footer{background:rgba(0,0,0,.5)}.dashboard .list-pods .pod-group md-grid-list md-grid-tile-footer .pod-title{margin-left:10px}.dashboard .list-pods .pod-group md-grid-list md-grid-tile-footer .pod-host{text-align:right;padding-right:15px}.dashboard .list-pods .pod-group md-grid-list md-grid-tile-footer a{color:#fff}.dashboard .list-pods .pod-group md-grid-list .restarts{width:100%;text-align:right;padding-right:10px}.dashboard .list-pods .pod-group md-grid-list .restarts .restart-button,.dashboard .list-pods .pod-group md-grid-list .restarts .restart-button:focus,.dashboard .list-pods .pod-group md-grid-list .restarts .restart-button:hover,.dashboard .list-pods .pod-group md-grid-list .restarts .restart-button:not([disabled]):focus,.dashboard .list-pods .pod-group md-grid-list .restarts .restart-button:not([disabled]):hover{background-color:#ff1744;width:30px;height:30px}.dashboard .list-pods .gray{background:#f5f5f5}.dashboard .list-pods .dark-overlay{background-color:#292935;opacity:.5}.dashboard .list-pods .light-overlay{background-color:#FFF;opacity:.2}.dashboard .list-pods .color-1{background-color:#2962ff;fill:#2962ff;stroke:#2962ff}.dashboard .list-pods .color-max-1{background-color:#dce5ff;border-color:#dce5ff;fill:#dce5ff}.dashboard .list-pods md-grid-list.list-color-1 md-grid-tile.colored{background-color:#2962ff}.dashboard .list-pods .color-2{background-color:#a0f;fill:#a0f;stroke:#a0f}.dashboard .list-pods .color-max-2{background-color:#e6b3ff;border-color:#e6b3ff;fill:#e6b3ff}.dashboard .list-pods md-grid-list.list-color-2 md-grid-tile.colored{background-color:#a0f}.dashboard .list-pods .color-3{background-color:#00c853;fill:#00c853;stroke:#00c853}.dashboard .list-pods .color-max-3{background-color:#7cffb2;border-color:#7cffb2;fill:#7cffb2}.dashboard .list-pods md-grid-list.list-color-3 md-grid-tile.colored{background-color:#00c853}.dashboard .list-pods .color-4{background-color:#304ffe;fill:#304ffe;stroke:#304ffe}.dashboard .list-pods .color-max-4{background-color:#e2e6ff;border-color:#e2e6ff;fill:#e2e6ff}.dashboard .list-pods md-grid-list.list-color-4 md-grid-tile.colored{background-color:#304ffe}.dashboard .list-pods .color-5{background-color:#0091ea;fill:#0091ea;stroke:#0091ea}.dashboard .list-pods .color-max-5{background-color:#9edaff;border-color:#9edaff;fill:#9edaff}.dashboard .list-pods md-grid-list.list-color-5 md-grid-tile.colored{background-color:#0091ea}.dashboard .list-pods .color-6{background-color:#ff6d00;fill:#ff6d00;stroke:#ff6d00}.dashboard .list-pods .color-max-6{background-color:#ffd3b3;border-color:#ffd3b3;fill:#ffd3b3}.dashboard .list-pods md-grid-list.list-color-6 md-grid-tile.colored{background-color:#ff6d00}.dashboard .list-pods .color-7{background-color:#00bfa5;fill:#00bfa5;stroke:#00bfa5}.dashboard .list-pods .color-max-7{background-color:#72ffec;border-color:#72ffec;fill:#72ffec}.dashboard .list-pods md-grid-list.list-color-7 md-grid-tile.colored{background-color:#00bfa5}.dashboard .list-pods .color-8{background-color:#c51162;fill:#c51162;stroke:#c51162}.dashboard .list-pods .color-max-8{background-color:#f693bf;border-color:#f693bf;fill:#f693bf}.dashboard .list-pods md-grid-list.list-color-8 md-grid-tile.colored{background-color:#c51162}.dashboard .list-pods .color-9{background-color:#64dd17;fill:#64dd17;stroke:#64dd17}.dashboard .list-pods .color-max-9{background-color:#cbf7b0;border-color:#cbf7b0;fill:#cbf7b0}.dashboard .list-pods md-grid-list.list-color-9 md-grid-tile.colored{background-color:#64dd17}.dashboard .list-pods .color-10{background-color:#6200ea;fill:#6200ea;stroke:#6200ea}.dashboard .list-pods .color-max-10{background-color:#c69eff;border-color:#c69eff;fill:#c69eff}.dashboard .list-pods md-grid-list.list-color-10 md-grid-tile.colored{background-color:#6200ea}.dashboard .list-pods .color-11{background-color:#ffd600;fill:#ffd600;stroke:#ffd600}.dashboard .list-pods .color-max-11{background-color:#fff3b3;border-color:#fff3b3;fill:#fff3b3}.dashboard .list-pods md-grid-list.list-color-11 md-grid-tile.colored{background-color:#ffd600}.dashboard .list-pods .color-12{background-color:#00b8d4;fill:#00b8d4;stroke:#00b8d4}.dashboard .list-pods .color-max-12{background-color:#87efff;border-color:#87efff;fill:#87efff}.dashboard .list-pods md-grid-list.list-color-12 md-grid-tile.colored{background-color:#00b8d4}.dashboard .list-pods .color-13{background-color:#ffab00;fill:#ffab00;stroke:#ffab00}.dashboard .list-pods .color-max-13{background-color:#ffe6b3;border-color:#ffe6b3;fill:#ffe6b3}.dashboard .list-pods md-grid-list.list-color-13 md-grid-tile.colored{background-color:#ffab00}.dashboard .list-pods .color-14{background-color:#dd2c00;fill:#dd2c00;stroke:#dd2c00}.dashboard .list-pods .color-max-14{background-color:#ffa791;border-color:#ffa791;fill:#ffa791}.dashboard .list-pods md-grid-list.list-color-14 md-grid-tile.colored{background-color:#dd2c00}.dashboard .list-pods .color-15{background-color:#2979ff;fill:#2979ff;stroke:#2979ff}.dashboard .list-pods .color-max-15{background-color:#dce9ff;border-color:#dce9ff;fill:#dce9ff}.dashboard .list-pods md-grid-list.list-color-15 md-grid-tile.colored{background-color:#2979ff}.dashboard .list-pods .color-16{background-color:#d500f9;fill:#d500f9;stroke:#d500f9}.dashboard .list-pods .color-max-16{background-color:#f3acff;border-color:#f3acff;fill:#f3acff}.dashboard .list-pods md-grid-list.list-color-16 md-grid-tile.colored{background-color:#d500f9}.dashboard .list-pods .color-17{background-color:#00e676;fill:#00e676;stroke:#00e676}.dashboard .list-pods .color-max-17{background-color:#9affce;border-color:#9affce;fill:#9affce}.dashboard .list-pods md-grid-list.list-color-17 md-grid-tile.colored{background-color:#00e676}.dashboard .list-pods .color-18{background-color:#3d5afe;fill:#3d5afe;stroke:#3d5afe}.dashboard .list-pods .color-max-18{background-color:#eff1ff;border-color:#eff1ff;fill:#eff1ff}.dashboard .list-pods md-grid-list.list-color-18 md-grid-tile.colored{background-color:#3d5afe}.dashboard .list-pods .color-19{background-color:#00b0ff;fill:#00b0ff;stroke:#00b0ff}.dashboard .list-pods .color-max-19{background-color:#b3e7ff;border-color:#b3e7ff;fill:#b3e7ff}.dashboard .list-pods md-grid-list.list-color-19 md-grid-tile.colored{background-color:#00b0ff}.dashboard .list-pods .color-20{background-color:#ff9100;fill:#ff9100;stroke:#ff9100}.dashboard .list-pods .color-max-20{background-color:#ffdeb3;border-color:#ffdeb3;fill:#ffdeb3}.dashboard .list-pods md-grid-list.list-color-20 md-grid-tile.colored{background-color:#ff9100}.dashboard .list-pods .color-21{background-color:#1de9b6;fill:#1de9b6;stroke:#1de9b6}.dashboard .list-pods .color-max-21{background-color:#c0f9eb;border-color:#c0f9eb;fill:#c0f9eb}.dashboard .list-pods md-grid-list.list-color-21 md-grid-tile.colored{background-color:#1de9b6}.dashboard .list-pods .color-22{background-color:#f50057;fill:#f50057;stroke:#f50057}.dashboard .list-pods .color-max-22{background-color:#ffa8c7;border-color:#ffa8c7;fill:#ffa8c7}.dashboard .list-pods md-grid-list.list-color-22 md-grid-tile.colored{background-color:#f50057}.dashboard .list-pods .color-23{background-color:#76ff03;fill:#76ff03;stroke:#76ff03}.dashboard .list-pods .color-max-23{background-color:#d7ffb5;border-color:#d7ffb5;fill:#d7ffb5}.dashboard .list-pods md-grid-list.list-color-23 md-grid-tile.colored{background-color:#76ff03}.dashboard .list-pods .color-24{background-color:#651fff;fill:#651fff;stroke:#651fff}.dashboard .list-pods .color-max-24{background-color:#e0d2ff;border-color:#e0d2ff;fill:#e0d2ff}.dashboard .list-pods md-grid-list.list-color-24 md-grid-tile.colored{background-color:#651fff}.dashboard .list-pods .color-25{background-color:#ffea00;fill:#ffea00;stroke:#ffea00}.dashboard .list-pods .color-max-25{background-color:#fff9b3;border-color:#fff9b3;fill:#fff9b3}.dashboard .list-pods md-grid-list.list-color-25 md-grid-tile.colored{background-color:#ffea00}.dashboard .list-pods .color-26{background-color:#00e5ff;fill:#00e5ff;stroke:#00e5ff}.dashboard .list-pods .color-max-26{background-color:#b3f7ff;border-color:#b3f7ff;fill:#b3f7ff}.dashboard .list-pods md-grid-list.list-color-26 md-grid-tile.colored{background-color:#00e5ff}.dashboard .list-pods .color-27{background-color:#ffc400;fill:#ffc400;stroke:#ffc400}.dashboard .list-pods .color-max-27{background-color:#ffedb3;border-color:#ffedb3;fill:#ffedb3}.dashboard .list-pods md-grid-list.list-color-27 md-grid-tile.colored{background-color:#ffc400}.dashboard .list-pods .color-28{background-color:#ff3d00;fill:#ff3d00;stroke:#ff3d00}.dashboard .list-pods .color-max-28{background-color:#ffc5b3;border-color:#ffc5b3;fill:#ffc5b3}.dashboard .list-pods md-grid-list.list-color-28 md-grid-tile.colored{background-color:#ff3d00}.dashboard .list-pods .color-29{background-color:#448aff;fill:#448aff;stroke:#448aff}.dashboard .list-pods .color-max-29{background-color:#f6faff;border-color:#f6faff;fill:#f6faff}.dashboard .list-pods md-grid-list.list-color-29 md-grid-tile.colored{background-color:#448aff}.dashboard .list-pods .color-30{background-color:#e040fb;fill:#e040fb;stroke:#e040fb}.dashboard .list-pods .color-max-30{background-color:#fcefff;border-color:#fcefff;fill:#fcefff}.dashboard .list-pods md-grid-list.list-color-30 md-grid-tile.colored{background-color:#e040fb}.dashboard .list-pods .color-31{background-color:#69f0ae;fill:#69f0ae;stroke:#69f0ae}.dashboard .list-pods .color-max-31{background-color:#fff;border-color:#fff;fill:#fff}.dashboard .list-pods md-grid-list.list-color-31 md-grid-tile.colored{background-color:#69f0ae}.dashboard .list-pods .color-32{background-color:#536dfe;fill:#536dfe;stroke:#536dfe}.dashboard .list-pods .color-max-32{background-color:#fff;border-color:#fff;fill:#fff}.dashboard .list-pods md-grid-list.list-color-32 md-grid-tile.colored{background-color:#536dfe}.dashboard .list-pods .color-33{background-color:#40c4ff;fill:#40c4ff;stroke:#40c4ff}.dashboard .list-pods .color-max-33{background-color:#f3fbff;border-color:#f3fbff;fill:#f3fbff}.dashboard .list-pods md-grid-list.list-color-33 md-grid-tile.colored{background-color:#40c4ff}.dashboard .list-pods .color-34{background-color:#ffab40;fill:#ffab40;stroke:#ffab40}.dashboard .list-pods .color-max-34{background-color:#fffaf3;border-color:#fffaf3;fill:#fffaf3}.dashboard .list-pods md-grid-list.list-color-34 md-grid-tile.colored{background-color:#ffab40}.dashboard .list-pods .color-35{background-color:#64ffda;fill:#64ffda;stroke:#64ffda}.dashboard .list-pods .color-max-35{background-color:#fff;border-color:#fff;fill:#fff}.dashboard .list-pods md-grid-list.list-color-35 md-grid-tile.colored{background-color:#64ffda}.dashboard .list-pods .color-36{background-color:#ff4081;fill:#ff4081;stroke:#ff4081}.dashboard .list-pods .color-max-36{background-color:#fff3f7;border-color:#fff3f7;fill:#fff3f7}.dashboard .list-pods md-grid-list.list-color-36 md-grid-tile.colored{background-color:#ff4081}.dashboard .list-pods .color-37{background-color:#b2ff59;fill:#b2ff59;stroke:#b2ff59}.dashboard .list-pods .color-max-37{background-color:#fff;border-color:#fff;fill:#fff}.dashboard .list-pods md-grid-list.list-color-37 md-grid-tile.colored{background-color:#b2ff59}.dashboard .list-pods .color-38{background-color:#7c4dff;fill:#7c4dff;stroke:#7c4dff}.dashboard .list-pods .color-max-38{background-color:#fff;border-color:#fff;fill:#fff}.dashboard .list-pods md-grid-list.list-color-38 md-grid-tile.colored{background-color:#7c4dff}.dashboard .list-pods .color-39{background-color:#ff0;fill:#ff0;stroke:#ff0}.dashboard .list-pods .color-max-39{background-color:#ffffb3;border-color:#ffffb3;fill:#ffffb3}.dashboard .list-pods md-grid-list.list-color-39 md-grid-tile.colored{background-color:#ff0}.dashboard .list-pods .color-40{background-color:#18ffff;fill:#18ffff;stroke:#18ffff}.dashboard .list-pods .color-max-40{background-color:#cbffff;border-color:#cbffff;fill:#cbffff}.dashboard .list-pods md-grid-list.list-color-40 md-grid-tile.colored{background-color:#18ffff}.dashboard .list-pods .color-41{background-color:#ffd740;fill:#ffd740;stroke:#ffd740}.dashboard .list-pods .color-max-41{background-color:#fffcf3;border-color:#fffcf3;fill:#fffcf3}.dashboard .list-pods md-grid-list.list-color-41 md-grid-tile.colored{background-color:#ffd740}.dashboard .list-pods .color-42{background-color:#ff6e40;fill:#ff6e40;stroke:#ff6e40}.dashboard .list-pods .color-max-42{background-color:#fff6f3;border-color:#fff6f3;fill:#fff6f3}.dashboard .list-pods md-grid-list.list-color-42 md-grid-tile.colored{background-color:#ff6e40}.dashboard .list-pods .color-warning{background-color:#ff9800!important;border-color:#ff9800!important;fill:#ff9800!important;stroke:#ff9800!important}.dashboard .list-pods .color-critical{background-color:#f44336!important;border-color:#f44336!important;fill:#f44336!important;stroke:#f44336!important}.dashboard .list-pods .status-waiting{background-color:#2e2e3b!important;border-color:#dad462!important;border-width:2px!important;border-style:solid!important}.dashboard .list-pods .status-terminated,.dashboard .list-pods .status-unknown{background-color:#ff1744!important;border-color:#e3002c!important;border-width:1px!important;border-style:solid!important}.dashboard .dash-table{min-width:100%;border-collapse:collapse}.dashboard .dash-table tbody tr:focus:not(.no-link),.dashboard .dash-table tbody tr:hover:not(.no-link){cursor:pointer;background-color:rgba(63,81,181,.2)}.dashboard .dash-table .dash-table-header{border-bottom:1px solid #e6e6e6;color:#828282;text-align:left;font-size:.75em;font-weight:700;padding:16px 16px 16px 0}.dashboard .dash-table .dash-table-header a{text-decoration:none;color:inherit}.dashboard .dash-table .dash-table-caret{display:inline-block;vertical-align:middle}.dashboard .dash-table .dash-table-content{font-size:.8em;padding:16px 16px 16px 0;height:72px}.dashboard .dash-table .dash-table-td-more{max-width:72px;width:72px;padding:16px}.dashboard .dash-table .dash-table-thumbs{max-width:104px;width:104px;padding:16px 32px}.dashboard .dash-table .dash-table-thumbs div{overflow:hidden;width:40px;height:40px;border-radius:20px;border:1px solid rgba(0,0,0,.2);background-size:cover;box-shadow:0 8px 10px rgba(0,0,0,.3);-webkit-box-shadow:0 8px 10px rgba(0,0,0,.1)}.dashboard .dash-table .dash-table-footer{height:40px}.dashboard .dash-table .dash-table-count-info{line-height:40px;font-size:.75em}.dashboard .dash-table .dash-table-footer-item{width:40px;height:40px;vertical-align:middle}.dashboard .dash-table .bold,.dashboard .dash-table .dash-table-active-page{font-weight:700}.dashboard .dash-table .grey{color:grey}.dashboard .dash-table md-input-container.md-default-theme .md-input{color:#fff;border-color:#fff;margin-top:24px}.dashboard .server-overview .dark-overlay{background-color:#292935;opacity:.5}.dashboard .server-overview .light-overlay{background-color:#FFF;opacity:.2}.dashboard .server-overview md-grid-list.list-color-1 md-grid-tile.colored{background-color:#2962ff}.dashboard .server-overview md-grid-list.list-color-2 md-grid-tile.colored{background-color:#a0f}.dashboard .server-overview md-grid-list.list-color-3 md-grid-tile.colored{background-color:#00c853}.dashboard .server-overview .color-4{background-color:#304ffe;fill:#304ffe;stroke:#304ffe}.dashboard .server-overview .color-max-4{background-color:#e2e6ff;border-color:#e2e6ff;fill:#e2e6ff}.dashboard .server-overview md-grid-list.list-color-4 md-grid-tile.colored{background-color:#304ffe}.dashboard .server-overview .color-5{background-color:#0091ea;fill:#0091ea;stroke:#0091ea}.dashboard .server-overview .color-max-5{background-color:#9edaff;border-color:#9edaff;fill:#9edaff}.dashboard .server-overview md-grid-list.list-color-5 md-grid-tile.colored{background-color:#0091ea}.dashboard .server-overview .color-6{background-color:#ff6d00;fill:#ff6d00;stroke:#ff6d00}.dashboard .server-overview .color-max-6{background-color:#ffd3b3;border-color:#ffd3b3;fill:#ffd3b3}.dashboard .server-overview md-grid-list.list-color-6 md-grid-tile.colored{background-color:#ff6d00}.dashboard .server-overview .color-7{background-color:#00bfa5;fill:#00bfa5;stroke:#00bfa5}.dashboard .server-overview .color-max-7{background-color:#72ffec;border-color:#72ffec;fill:#72ffec}.dashboard .server-overview md-grid-list.list-color-7 md-grid-tile.colored{background-color:#00bfa5}.dashboard .server-overview .color-8{background-color:#c51162;fill:#c51162;stroke:#c51162}.dashboard .server-overview .color-max-8{background-color:#f693bf;border-color:#f693bf;fill:#f693bf}.dashboard .server-overview md-grid-list.list-color-8 md-grid-tile.colored{background-color:#c51162}.dashboard .server-overview .color-9{background-color:#64dd17;fill:#64dd17;stroke:#64dd17}.dashboard .server-overview .color-max-9{background-color:#cbf7b0;border-color:#cbf7b0;fill:#cbf7b0}.dashboard .server-overview md-grid-list.list-color-9 md-grid-tile.colored{background-color:#64dd17}.dashboard .server-overview .color-10{background-color:#6200ea;fill:#6200ea;stroke:#6200ea}.dashboard .server-overview .color-max-10{background-color:#c69eff;border-color:#c69eff;fill:#c69eff}.dashboard .server-overview md-grid-list.list-color-10 md-grid-tile.colored{background-color:#6200ea}.dashboard .server-overview .color-11{background-color:#ffd600;fill:#ffd600;stroke:#ffd600}.dashboard .server-overview .color-max-11{background-color:#fff3b3;border-color:#fff3b3;fill:#fff3b3}.dashboard .server-overview md-grid-list.list-color-11 md-grid-tile.colored{background-color:#ffd600}.dashboard .server-overview .color-12{background-color:#00b8d4;fill:#00b8d4;stroke:#00b8d4}.dashboard .server-overview .color-max-12{background-color:#87efff;border-color:#87efff;fill:#87efff}.dashboard .server-overview md-grid-list.list-color-12 md-grid-tile.colored{background-color:#00b8d4}.dashboard .server-overview .color-13{background-color:#ffab00;fill:#ffab00;stroke:#ffab00}.dashboard .server-overview .color-max-13{background-color:#ffe6b3;border-color:#ffe6b3;fill:#ffe6b3}.dashboard .server-overview md-grid-list.list-color-13 md-grid-tile.colored{background-color:#ffab00}.dashboard .server-overview .color-14{background-color:#dd2c00;fill:#dd2c00;stroke:#dd2c00}.dashboard .server-overview .color-max-14{background-color:#ffa791;border-color:#ffa791;fill:#ffa791}.dashboard .server-overview md-grid-list.list-color-14 md-grid-tile.colored{background-color:#dd2c00}.dashboard .server-overview .color-15{background-color:#2979ff;fill:#2979ff;stroke:#2979ff}.dashboard .server-overview .color-max-15{background-color:#dce9ff;border-color:#dce9ff;fill:#dce9ff}.dashboard .server-overview md-grid-list.list-color-15 md-grid-tile.colored{background-color:#2979ff}.dashboard .server-overview .color-16{background-color:#d500f9;fill:#d500f9;stroke:#d500f9}.dashboard .server-overview .color-max-16{background-color:#f3acff;border-color:#f3acff;fill:#f3acff}.dashboard .server-overview md-grid-list.list-color-16 md-grid-tile.colored{background-color:#d500f9}.dashboard .server-overview .color-17{background-color:#00e676;fill:#00e676;stroke:#00e676}.dashboard .server-overview .color-max-17{background-color:#9affce;border-color:#9affce;fill:#9affce}.dashboard .server-overview md-grid-list.list-color-17 md-grid-tile.colored{background-color:#00e676}.dashboard .server-overview .color-18{background-color:#3d5afe;fill:#3d5afe;stroke:#3d5afe}.dashboard .server-overview .color-max-18{background-color:#eff1ff;border-color:#eff1ff;fill:#eff1ff}.dashboard .server-overview md-grid-list.list-color-18 md-grid-tile.colored{background-color:#3d5afe}.dashboard .server-overview .color-19{background-color:#00b0ff;fill:#00b0ff;stroke:#00b0ff}.dashboard .server-overview .color-max-19{background-color:#b3e7ff;border-color:#b3e7ff;fill:#b3e7ff}.dashboard .server-overview md-grid-list.list-color-19 md-grid-tile.colored{background-color:#00b0ff}.dashboard .server-overview .color-20{background-color:#ff9100;fill:#ff9100;stroke:#ff9100}.dashboard .server-overview .color-max-20{background-color:#ffdeb3;border-color:#ffdeb3;fill:#ffdeb3}.dashboard .server-overview md-grid-list.list-color-20 md-grid-tile.colored{background-color:#ff9100}.dashboard .server-overview .color-21{background-color:#1de9b6;fill:#1de9b6;stroke:#1de9b6}.dashboard .server-overview .color-max-21{background-color:#c0f9eb;border-color:#c0f9eb;fill:#c0f9eb}.dashboard .server-overview md-grid-list.list-color-21 md-grid-tile.colored{background-color:#1de9b6}.dashboard .server-overview .color-22{background-color:#f50057;fill:#f50057;stroke:#f50057}.dashboard .server-overview .color-max-22{background-color:#ffa8c7;border-color:#ffa8c7;fill:#ffa8c7}.dashboard .server-overview md-grid-list.list-color-22 md-grid-tile.colored{background-color:#f50057}.dashboard .server-overview .color-23{background-color:#76ff03;fill:#76ff03;stroke:#76ff03}.dashboard .server-overview .color-max-23{background-color:#d7ffb5;border-color:#d7ffb5;fill:#d7ffb5}.dashboard .server-overview md-grid-list.list-color-23 md-grid-tile.colored{background-color:#76ff03}.dashboard .server-overview .color-24{background-color:#651fff;fill:#651fff;stroke:#651fff}.dashboard .server-overview .color-max-24{background-color:#e0d2ff;border-color:#e0d2ff;fill:#e0d2ff}.dashboard .server-overview md-grid-list.list-color-24 md-grid-tile.colored{background-color:#651fff}.dashboard .server-overview .color-25{background-color:#ffea00;fill:#ffea00;stroke:#ffea00}.dashboard .server-overview .color-max-25{background-color:#fff9b3;border-color:#fff9b3;fill:#fff9b3}.dashboard .server-overview md-grid-list.list-color-25 md-grid-tile.colored{background-color:#ffea00}.dashboard .server-overview .color-26{background-color:#00e5ff;fill:#00e5ff;stroke:#00e5ff}.dashboard .server-overview .color-max-26{background-color:#b3f7ff;border-color:#b3f7ff;fill:#b3f7ff}.dashboard .server-overview md-grid-list.list-color-26 md-grid-tile.colored{background-color:#00e5ff}.dashboard .server-overview .color-27{background-color:#ffc400;fill:#ffc400;stroke:#ffc400}.dashboard .server-overview .color-max-27{background-color:#ffedb3;border-color:#ffedb3;fill:#ffedb3}.dashboard .server-overview md-grid-list.list-color-27 md-grid-tile.colored{background-color:#ffc400}.dashboard .server-overview .color-28{background-color:#ff3d00;fill:#ff3d00;stroke:#ff3d00}.dashboard .server-overview .color-max-28{background-color:#ffc5b3;border-color:#ffc5b3;fill:#ffc5b3}.dashboard .server-overview md-grid-list.list-color-28 md-grid-tile.colored{background-color:#ff3d00}.dashboard .server-overview .color-29{background-color:#448aff;fill:#448aff;stroke:#448aff}.dashboard .server-overview .color-max-29{background-color:#f6faff;border-color:#f6faff;fill:#f6faff}.dashboard .server-overview md-grid-list.list-color-29 md-grid-tile.colored{background-color:#448aff}.dashboard .server-overview .color-30{background-color:#e040fb;fill:#e040fb;stroke:#e040fb}.dashboard .server-overview .color-max-30{background-color:#fcefff;border-color:#fcefff;fill:#fcefff}.dashboard .server-overview md-grid-list.list-color-30 md-grid-tile.colored{background-color:#e040fb}.dashboard .server-overview .color-31{background-color:#69f0ae;fill:#69f0ae;stroke:#69f0ae}.dashboard .server-overview .color-max-31{background-color:#fff;border-color:#fff;fill:#fff}.dashboard .server-overview md-grid-list.list-color-31 md-grid-tile.colored{background-color:#69f0ae}.dashboard .server-overview .color-32{background-color:#536dfe;fill:#536dfe;stroke:#536dfe}.dashboard .server-overview .color-max-32{background-color:#fff;border-color:#fff;fill:#fff}.dashboard .server-overview md-grid-list.list-color-32 md-grid-tile.colored{background-color:#536dfe}.dashboard .server-overview .color-33{background-color:#40c4ff;fill:#40c4ff;stroke:#40c4ff}.dashboard .server-overview .color-max-33{background-color:#f3fbff;border-color:#f3fbff;fill:#f3fbff}.dashboard .server-overview md-grid-list.list-color-33 md-grid-tile.colored{background-color:#40c4ff}.dashboard .server-overview .color-34{background-color:#ffab40;fill:#ffab40;stroke:#ffab40}.dashboard .server-overview .color-max-34{background-color:#fffaf3;border-color:#fffaf3;fill:#fffaf3}.dashboard .server-overview md-grid-list.list-color-34 md-grid-tile.colored{background-color:#ffab40}.dashboard .server-overview .color-35{background-color:#64ffda;fill:#64ffda;stroke:#64ffda}.dashboard .server-overview .color-max-35{background-color:#fff;border-color:#fff;fill:#fff}.dashboard .server-overview md-grid-list.list-color-35 md-grid-tile.colored{background-color:#64ffda}.dashboard .server-overview .color-36{background-color:#ff4081;fill:#ff4081;stroke:#ff4081}.dashboard .server-overview .color-max-36{background-color:#fff3f7;border-color:#fff3f7;fill:#fff3f7}.dashboard .server-overview md-grid-list.list-color-36 md-grid-tile.colored{background-color:#ff4081}.dashboard .server-overview .color-37{background-color:#b2ff59;fill:#b2ff59;stroke:#b2ff59}.dashboard .server-overview .color-max-37{background-color:#fff;border-color:#fff;fill:#fff}.dashboard .server-overview md-grid-list.list-color-37 md-grid-tile.colored{background-color:#b2ff59}.dashboard .server-overview .color-38{background-color:#7c4dff;fill:#7c4dff;stroke:#7c4dff}.dashboard .server-overview .color-max-38{background-color:#fff;border-color:#fff;fill:#fff}.dashboard .server-overview md-grid-list.list-color-38 md-grid-tile.colored{background-color:#7c4dff}.dashboard .server-overview .color-39{background-color:#ff0;fill:#ff0;stroke:#ff0}.dashboard .server-overview .color-max-39{background-color:#ffffb3;border-color:#ffffb3;fill:#ffffb3}.dashboard .server-overview md-grid-list.list-color-39 md-grid-tile.colored{background-color:#ff0}.dashboard .server-overview .color-40{background-color:#18ffff;fill:#18ffff;stroke:#18ffff}.dashboard .server-overview .color-max-40{background-color:#cbffff;border-color:#cbffff;fill:#cbffff}.dashboard .server-overview md-grid-list.list-color-40 md-grid-tile.colored{background-color:#18ffff}.dashboard .server-overview .color-41{background-color:#ffd740;fill:#ffd740;stroke:#ffd740}.dashboard .server-overview .color-max-41{background-color:#fffcf3;border-color:#fffcf3;fill:#fffcf3}.dashboard .server-overview md-grid-list.list-color-41 md-grid-tile.colored{background-color:#ffd740}.dashboard .server-overview .color-42{background-color:#ff6e40;fill:#ff6e40;stroke:#ff6e40}.dashboard .server-overview .color-max-42{background-color:#fff6f3;border-color:#fff6f3;fill:#fff6f3}.dashboard .server-overview md-grid-list.list-color-42 md-grid-tile.colored{background-color:#ff6e40}.dashboard .server-overview .color-warning{background-color:#ff9800!important;border-color:#ff9800!important;fill:#ff9800!important;stroke:#ff9800!important}.dashboard .server-overview .color-critical{background-color:#f44336!important;border-color:#f44336!important;fill:#f44336!important;stroke:#f44336!important}.dashboard .server-overview .status-waiting{background-color:#2e2e3b!important;border-color:#dad462!important;border-width:2px!important;border-style:solid!important}.dashboard .server-overview .status-terminated,.dashboard .server-overview .status-unknown{background-color:#ff1744!important;border-color:#e3002c!important;border-width:1px!important;border-style:solid!important}.dashboard .server-overview .color-1{background-color:#512DA8;border-color:#512DA8;fill:#512DA8;stroke:#512DA8}.dashboard .server-overview .color-2{background-color:#9C27B0;border-color:#9C27B0;fill:#9C27B0;stroke:#9C27B0}.dashboard .server-overview .color-3{background-color:#00BCD4;border-color:#00BCD4;fill:#00BCD4;stroke:#00BCD4}.dashboard .server-overview .color-max-1{background-color:#b6a2e6;border-color:#b6a2e6;fill:#b6a2e6}.dashboard .server-overview .color-max-2{background-color:#dfa0ea;border-color:#dfa0ea;fill:#dfa0ea}.dashboard .server-overview .color-max-3{background-color:#87f1ff;border-color:#87f1ff;fill:#87f1ff}.dashboard .server-overview .color-max-warning{background-color:#ffd699!important;border-color:#ffd699!important;fill:#ffd699!important}.dashboard .server-overview .color-max-critical{background-color:#fccbc7!important;border-color:#fccbc7!important;fill:#fccbc7!important}.dashboard .server-overview .max_tick_arc{stroke:#FFF!important}.dashboard .server-overview .concentricchart .bg-circle{background:#F9F9F9;fill:#F9F9F9;stroke:#FFF;stroke-width:1px}.dashboard .server-overview .concentricchart text{font-size:12px;font-family:Roboto,sans-serif}.dashboard .server-overview .concentricchart .value_group{fill:#fff}.dashboard .server-overview .concentricchart .legend_group rect{opacity:.8}.dashboard .server-overview svg.legend{height:auto}.dashboard .server-overview svg.legend text{font-size:12px;font-family:Roboto,sans-serif}.dashboard .server-overview svg.legend .hostName{font-size:16px}.dashboard .server-overview .minion-name{text-align:center;vertical-align:bottom;width:100%}.dashboard .server-overview .chart_area{width:325px;height:auto}.dashboard .groups{font-size:13px}.dashboard .groups .header{line-height:21px}.dashboard .groups .header a{padding-left:5px;padding-right:5px}.dashboard .groups .header .selector-area .filter-text{font-size:13px;margin-left:10px}.dashboard .groups .header .selector-area .cancel-button{width:18px;height:18px;padding:0}.dashboard .groups .header .selector-area .cancel-button:focus,.dashboard .groups .header .selector-area .cancel-button:hover{background-color:none!important}.dashboard .groups .header .selector-area .cancel-icon{width:15px;height:15px;fill:#777}.dashboard .groups .select-group-by{min-width:110px;margin-left:10px;margin-right:40px}.dashboard .groups .select-group-by .md-select-label{padding-top:6px;font-size:13px}.dashboard .groups .group-item{padding-top:20px}.dashboard .groups .group-item .filter-button{height:18px;width:18px}.dashboard .groups .group-item .filter-button .filter-icon{width:18px;height:18px}.dashboard .groups .icon-area{min-width:34px}.dashboard .groups .icon-area .group-icon{border-radius:21px;width:21px;height:21px}.dashboard .groups .group-main-area .subtype{line-height:21px}.dashboard .groups md-divider{margin-top:40px;margin-bottom:30px}.dashboard .groups .group-name{padding-top:10px}.dashboard .groups .selectFilter{padding-top:10px;margin-right:30px}.dashboard .groups .selectFilter .md-select-label{border-bottom:none!important;width:17px;min-width:17px;padding-right:0}.dashboard .groups md-select-menu{min-height:40px;max-height:40px}.dashboard .groups .group-link-area{padding-left:15px;padding-bottom:15px}.dashboard .groups .group-link-area button{line-height:12px}.dashboard .groups .group-type-circle{width:21px;height:21px}.dashboard .groups md-select{margin-top:0}.dashboard .detail{color:#222}.dashboard .detail .back{font-size:18px;line-height:27px;margin-bottom:30px}.dashboard .detail .heading{font-size:18px;line-height:21px;color:#222;margin-bottom:25px}.dashboard .detail .heading .label{color:#777}.dashboard .detail td.name{font-size:14px;color:#222;line-height:24px}.dashboard .detail td.value{margin-left:50px;font-size:14px;color:#888;line-height:24px}.dashboard .detail .containerTable td{padding-right:20px}.dashboard .align-top tbody{vertical-align:top}`) func appAssetsCssAppCssBytes() ([]byte, error) { return _appAssetsCssAppCss, nil } func appAssetsCssAppCss() (*asset, error) { bytes, err := appAssetsCssAppCssBytes() if err != nil { return nil, err } info := bindataFileInfo{name: "app/assets/css/app.css", size: 39868, mode: os.FileMode(420), modTime: time.Unix(1454116418, 0)} a := &asset{bytes: bytes, info: info} return a, nil } var _appAssetsImgDocarrowPng = []byte("\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00!\x00\x00\x00\"\b\x06\x00\x00\x00\xd1p\xb0\xc1\x00\x00\x00\x04sBIT\b\b\b\b|\bd\x88\x00\x00\x00\tpHYs\x00\x00\x15\xfd\x00\x00\x15\xfd\x01\xcdpQa\x00\x00\x00\x1ctEXtSoftware\x00Adobe Fireworks CS6\u8f32\x8c\x00\x00\x00\xefIDATX\x85\xd5\xd71\x0e\xc20\f\x05\u0406\xebq\x0568\x01\x8c\x1c\x80\xeep\x1aV\x18Y`\x05\xc1\x19\x10e\x81\xe13\x05UU\xab\xd8\xf1\xb7\xa2~\xc9K\x87\xf4)\x8e\xea4\x00\xa8JgR\x1aPUcB\x84\x10\xfeU\xef.X\xac\x8eh?KU2\x00\x92\x15\xb3\u065e\x01\x00\xaf\xe6\x83\xf9\xf2 >L\xc9\xf5\xa5\x88\b\x88\xd1@(\x88u}B_\xa4\x10\nb:\xdb\xe3\xf6xfCh\xed\xb0@h\b\v\x84\x8a\u0205\xd0\x119\x10\x17\x84\x16\xe2\x86\xd0@\\\x11R\x88;\x82\x01\xa1 \xac\x10\xea(\x1f\xf2&')\xab\x1d\xd7{\xff.4\xef\xaf\u007f;\xac\x003B\x02\x90\xec\xb6\xe9c%\x01\xb8!4\x00\x17\x84\x16@G\xe4\x00\xa8\x88\\\x00\ra\x01\xd0\x10C\x17]\t\x80\u068e\xee\x95_\n\xa0\"\xda\x10\r\x80\x8e\x88\x10\r@\x82\b\u0757\x94\xc8x\xfe\u02bd\xf3\x03\xba\v\x18\x94\x12\x8b\x872\x00\x00\x00\x00IEND\xaeB`\x82") func appAssetsImgDocarrowPngBytes() ([]byte, error) { return _appAssetsImgDocarrowPng, nil } func appAssetsImgDocarrowPng() (*asset, error) { bytes, err := appAssetsImgDocarrowPngBytes() if err != nil { return nil, err } info := bindataFileInfo{name: "app/assets/img/docArrow.png", size: 373, mode: os.FileMode(416), modTime: time.Unix(1454116395, 0)} a := &asset{bytes: bytes, info: info} return a, nil } var _appAssetsImgIc_arrow_drop_down_24pxSvg = []byte(` `) func appAssetsImgIc_arrow_drop_down_24pxSvgBytes() ([]byte, error) { return _appAssetsImgIc_arrow_drop_down_24pxSvg, nil } func appAssetsImgIc_arrow_drop_down_24pxSvg() (*asset, error) { bytes, err := appAssetsImgIc_arrow_drop_down_24pxSvgBytes() if err != nil { return nil, err } info := bindataFileInfo{name: "app/assets/img/ic_arrow_drop_down_24px.svg", size: 166, mode: os.FileMode(416), modTime: time.Unix(1454116395, 0)} a := &asset{bytes: bytes, info: info} return a, nil } var _appAssetsImgIc_arrow_drop_up_24pxSvg = []byte(` `) func appAssetsImgIc_arrow_drop_up_24pxSvgBytes() ([]byte, error) { return _appAssetsImgIc_arrow_drop_up_24pxSvg, nil } func appAssetsImgIc_arrow_drop_up_24pxSvg() (*asset, error) { bytes, err := appAssetsImgIc_arrow_drop_up_24pxSvgBytes() if err != nil { return nil, err } info := bindataFileInfo{name: "app/assets/img/ic_arrow_drop_up_24px.svg", size: 795, mode: os.FileMode(416), modTime: time.Unix(1454116395, 0)} a := &asset{bytes: bytes, info: info} return a, nil } var _appAssetsImgIc_keyboard_arrow_left_24pxSvg = []byte(``) func appAssetsImgIc_keyboard_arrow_left_24pxSvgBytes() ([]byte, error) { return _appAssetsImgIc_keyboard_arrow_left_24pxSvg, nil } func appAssetsImgIc_keyboard_arrow_left_24pxSvg() (*asset, error) { bytes, err := appAssetsImgIc_keyboard_arrow_left_24pxSvgBytes() if err != nil { return nil, err } info := bindataFileInfo{name: "app/assets/img/ic_keyboard_arrow_left_24px.svg", size: 151, mode: os.FileMode(416), modTime: time.Unix(1454116395, 0)} a := &asset{bytes: bytes, info: info} return a, nil } var _appAssetsImgIc_keyboard_arrow_right_24pxSvg = []byte(``) func appAssetsImgIc_keyboard_arrow_right_24pxSvgBytes() ([]byte, error) { return _appAssetsImgIc_keyboard_arrow_right_24pxSvg, nil } func appAssetsImgIc_keyboard_arrow_right_24pxSvg() (*asset, error) { bytes, err := appAssetsImgIc_keyboard_arrow_right_24pxSvgBytes() if err != nil { return nil, err } info := bindataFileInfo{name: "app/assets/img/ic_keyboard_arrow_right_24px.svg", size: 149, mode: os.FileMode(416), modTime: time.Unix(1454116395, 0)} a := &asset{bytes: bytes, info: info} return a, nil } var _appAssetsImgIconsArrowBackPng = []byte("\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x80\x00\x00\x00\x80\b\x06\x00\x00\x00\xc3>a\xcb\x00\x00\x00\x06bKGD\x00\xff\x00\xff\x00\xff\xa0\xbd\xa7\x93\x00\x00\x020IDATx\x9c\xed\xddIn\x13q\x10F\xf1\u05c4\x05\xd7\xe0f\t\xc3\x166\x1c\xc0\x10\xa60\xc5!\x90\x046\x84Ab\xba\v7r`aY2\x02B\xecj\xf7_\xd5\xf5~\x92\x97\x91Jz_za\xc96H\x92$I\x92$I\x92$I\x92$I\x92$I\x92\xa4\xac\xb6Z\x1f\x90\xdc\x1ep\x15\xf8\xd1\xfa\x10\r\xab\x03\xde\x00?\x813\xe0V\xdbs4\xa4\xe5\xf8\x8b\x97#(\xa2\x03N\xf8=\xbe#(\xa2\x03\xa6\xfc=\xfe\xf2\bn\xb7:P\x9bs\x91\xf8\x8e`\xa4V\x89\xef\bF\xa6\x03\xf6Y-\xbe#\x18\x91\x87\xac\x17\u007f\xf1:\x1a\xfed\xf5e\xdd\xff\xfc\xc5k\xca\xfc\t\xa2\x84\xa2\xf1\x0f0~Z\xc6/,\x1a\xff%\xc6O\xeb\x05\xc6/+\x1a\xff\x10\xe3\xa7e\xfc\u008c_\xd8sb\xf1_a\xfc\xb4\x8c_X4\xfek\x8c\x9f\x96\xf1\v3~a\u03c8\xc5?\xc2\xf8i\x19\xbf0\xe3\x17\x16\x8d\u007f\x8c\xf1\xd3z\x8a\xf1\u02ca\xc6?\xc1\xf8iE\xe3\x9f\x02\x97\x86>Z\xfd0~aO0~Y\xd1\xf8\xef1~Z}\xc4\xf7;\x12\x922~a{\xc4\xe2\u007f\xc0\xf8i\x19\xbf\xb0h\xfc\x8f\x18?-\xe3\x17\xf6\x18\xe3\x975!\x16\xff\x13\xc6\xff\xa7\fo\x80\\\t\xfe\xfd\x8c\xf9\x10\x94\u0604\xd8S\xe0;py\xe8\xa3\u056f\t\x8e\xa0\xbc\t\xb1\x11|\xc3\x11\xa4w\x17GP\x9e#\x90#\x90#\x10p\x0fGP^t\x04_q\x04\xe99\x029\x02\xc1.\x8e\xa0\x8e\xa0x\xabsDG\xf0\x0eG\x90Z\xc7\xfc\xeb\xe2##\xf0\xe7\xe3G`\xdd'\xc1\f\xd8\x1e\xfe\\m\u00aa_Qc\xfc\x11\xba\xe8\bf\xc0N\xa3\x1b\xb5A\x1d0\xe5\xff\xf1\xaf\xb5:P\x9bw\xde\bf\xc0\xf5v\xa7i(\x1dp\xc0\x9f\xf1o\xb4 \xf7#U\x14\x00\x00\x02\xf4IDATx\xda|SkHSa\x18~\xce\u0659\xd3m\xce\xcd\xcdL\x99I\xf7D\xa2?QXYBBZ\x19i\xa8\xe4\r\xaa\x95\x18*\x95B\xa4T&\bQZa\x96\x81\x05I\x14R\x96\x81H\x17B\xbbHY\x16d\x14\xa5\xa2&\xe4e\xe66\xdd\u0699\xbb\x9c\xad\xef\x9cyL\xff\xf4\xfd\xfa.\xcf\xf3\xbc\xcfy\xde\xf7P\x98\xb7|>\x9f\xba\u007f\xd4}\xd1h\xf1&5<\xb5\xe9\xbf\x0e\xbb\x85\xfb\xd8%R\x18\x92\x94\xa3a!\x92\xe71Q\xd2R\x8a\xa2L\"\x87\x9a%\ua18c\x9e\x9a\x91I.\xf1z\x9b-\xb2\xf7\x97\x9f\xa8\x92\xd3\b`\x80I\xabW8\xaf\xd6Kq$Yi\x8c\xd0H\xda\u027e\x98\bMR&+\x1778\xeeyx\xa1y:b`\xcc3\xdf\x106\xc5\xc8\x10\xa9\x95\xa0\xb9\x93]p\xbfl1\x83\x924\xd5D\xb8F\x92N\xf5\x8d\xb8\x9e\x1c\xbclJb\x9d\xbe\x05\xa0\xd8h)\xf6m\x96#(\x80B\xd3k\x16=\x83\xae\x05\xef\xfc\xfd\x8d\"\xed\v\xc6\xe6\xf0\xe9Er}a(\xeaZm0\xecPb\xdd\xd2\x00\x98\xff\xf8\xadW\x1f\u0480wW\xd7j\xc5\xf1T\x15\xf2\xaf\x9a\xe0p\xf9`c\xbdzz\xcc\xcciE\xd5\xf2\xc6)\xd4\x15\x84B\xafc\xb0\xeb\xec\x04\xda{f\xd0\xf5\u0749\xdd\x15\x13$\x0f\n7\x8fiQF0\x1e\u038f\x1f1q:\xa6\xeb\x87S'\n\x90\x94A\x1c\x91\xe0(T\xe6\xaa!\x93R\xc2\xfe\\\x8e\x1a\xc1$\xd0q3G\xc4%0Z\xfc\n\xdd}N-\xf3y\xc0%\x15\x056\xac\n@\xdb\a\a\x1et\xdaq\xfb\x84\x0er\x19E:\x04\xc1\xae\xe1\x8a\t)\x1b\x83\x84`?\xf5\xfb\xf3\xe8\x19rS\u0328\x99\x9b\v\x86\xaf\x12\x1d\u01a0\"[\x8dp\xb5\x04\x8f\u07f1\u012e\x0f\xe9\xf1\n\x9c\xca\b\x81\xc7\xeb\u00f4\xdd;\x87\xff=\u0341\x11\xfb}\xfe\x80ZH\x96'\xde{i\x17B\xcb\u06ee\x10\x80w;\xec\xe0\ve%(0E\x82\xad1hp\xa9\xc5\xcag\xe0\x17\xb0\xb2^\x1c\xbdf\x16,7\x97\x87\xe1}\xaf\v\xfb\x13\xe4h\xebv\x80#\x0e\xb4*\x1a-oY\xe4'+q\xb8\xd62\x97\x01\xbf\x98\x8cx9{\xff\r+\xe7\x0f|;\xab\x9a\xa6Q[\xa0Ap\x10\x8d\xbc\xeaIp\xc4q\xd3I\x1d\u05af\x94\tU\xe7\x93\xf7\xc6\u025d\xd4O\xa3\xfb\xd9\xe9;S\x89\u07c6\u0774\xf8@D\x91\xb9U\x01\x9dJ\x02\x8a\f\xfb\x04\xf9V\xbe\x9d\u054f\xacs\xe45QRT\xe6\xa8;\x98\xe8ELjY\x9a\xac\xb7\xb0\x81\xd3[f\ag\xdb\xda@\xe4\x92\xea\xe2\x80\xf1\"\xb7\xc8\f\u0424\x84\xd7\xeb\xcf\xecLV\xc8\xe0\xf2\b&\x85&?\x04\xfb\xf1nmiU\xb6\xc2L\xd3\xff\x06j\xfeh\xf3\xad,i\xb0\bd\x1eS\x95\xab\xb4\x90\xb0w\x12\xae\x9d\x12A#&O\xe6\xab/3\xf5\u0126\x06\xffY\xc5{\x82m[b\x03\x8bVDJ\x1b\xf9\xf3_\x01\x06\x00\xf19?q\xaaE\xa0\xa4\x00\x00\x00\x00IEND\xaeB`\x82") func appAssetsImgIconsFaviconPngBytes() ([]byte, error) { return _appAssetsImgIconsFaviconPng, nil } func appAssetsImgIconsFaviconPng() (*asset, error) { bytes, err := appAssetsImgIconsFaviconPngBytes() if err != nil { return nil, err } info := bindataFileInfo{name: "app/assets/img/icons/favicon.png", size: 1663, mode: os.FileMode(416), modTime: time.Unix(1454116395, 0)} a := &asset{bytes: bytes, info: info} return a, nil } var _appAssetsImgIconsIc_arrow_forward_24pxSvg = []byte(``) func appAssetsImgIconsIc_arrow_forward_24pxSvgBytes() ([]byte, error) { return _appAssetsImgIconsIc_arrow_forward_24pxSvg, nil } func appAssetsImgIconsIc_arrow_forward_24pxSvg() (*asset, error) { bytes, err := appAssetsImgIconsIc_arrow_forward_24pxSvgBytes() if err != nil { return nil, err } info := bindataFileInfo{name: "app/assets/img/icons/ic_arrow_forward_24px.svg", size: 158, mode: os.FileMode(416), modTime: time.Unix(1454116395, 0)} a := &asset{bytes: bytes, info: info} return a, nil } var _appAssetsImgIconsIc_cancel_24pxSvg = []byte(``) func appAssetsImgIconsIc_cancel_24pxSvgBytes() ([]byte, error) { return _appAssetsImgIconsIc_cancel_24pxSvg, nil } func appAssetsImgIconsIc_cancel_24pxSvg() (*asset, error) { bytes, err := appAssetsImgIconsIc_cancel_24pxSvgBytes() if err != nil { return nil, err } info := bindataFileInfo{name: "app/assets/img/icons/ic_cancel_24px.svg", size: 276, mode: os.FileMode(416), modTime: time.Unix(1454116395, 0)} a := &asset{bytes: bytes, info: info} return a, nil } var _appAssetsImgIconsIc_close_24pxSvg = []byte(``) func appAssetsImgIconsIc_close_24pxSvgBytes() ([]byte, error) { return _appAssetsImgIconsIc_close_24pxSvg, nil } func appAssetsImgIconsIc_close_24pxSvg() (*asset, error) { bytes, err := appAssetsImgIconsIc_close_24pxSvgBytes() if err != nil { return nil, err } info := bindataFileInfo{name: "app/assets/img/icons/ic_close_24px.svg", size: 202, mode: os.FileMode(416), modTime: time.Unix(1454116395, 0)} a := &asset{bytes: bytes, info: info} return a, nil } var _appAssetsImgIconsIc_menuSvg = []byte(` `) func appAssetsImgIconsIc_menuSvgBytes() ([]byte, error) { return _appAssetsImgIconsIc_menuSvg, nil } func appAssetsImgIconsIc_menuSvg() (*asset, error) { bytes, err := appAssetsImgIconsIc_menuSvgBytes() if err != nil { return nil, err } info := bindataFileInfo{name: "app/assets/img/icons/ic_menu.svg", size: 791, mode: os.FileMode(416), modTime: time.Unix(1454116395, 0)} a := &asset{bytes: bytes, info: info} return a, nil } var _appAssetsImgIconsIc_menu_24pxSvg = []byte(` `) func appAssetsImgIconsIc_menu_24pxSvgBytes() ([]byte, error) { return _appAssetsImgIconsIc_menu_24pxSvg, nil } func appAssetsImgIconsIc_menu_24pxSvg() (*asset, error) { bytes, err := appAssetsImgIconsIc_menu_24pxSvgBytes() if err != nil { return nil, err } info := bindataFileInfo{name: "app/assets/img/icons/ic_menu_24px.svg", size: 841, mode: os.FileMode(416), modTime: time.Unix(1454116395, 0)} a := &asset{bytes: bytes, info: info} return a, nil } var _appAssetsImgIconsList_control_downPng = []byte("\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x000\x00\x00\x000\b\x03\x00\x00\x00`\xdc\t\xb5\x00\x00\x00\x19tEXtSoftware\x00Adobe ImageReadyq\xc9e<\x00\x00\x00'PLTE\xa8\xa8\xa8\xfc\xfc\xfc\xc0\xc0\xc0\xb6\xb6\xb6\xf7\xf7\xf7\xaa\xaa\xaa\xf6\xf6\xf6\xe6\xe6\xe6\xe8\xe8\u8d75\xb5\xc3\xc3\xc3\xe5\xe5\xe5\xff\xff\xffZLu\xde\x00\x00\x00\rtRNS\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00=\xe8\"\x86\x00\x00\x00\x8bIDATx\xda\xec\xd4I\x12\x80 \fD\xd1\x04\x04\x9c\xee\u007f^\u02c1\xd2`\xb7\x96k\xc3\xd2\xfao\xa1\t\xca\xfc\xf1\x88\x03\a\xbf\x01}\xd7\x06\xb9\u007f\x02S\x8a\x8d\xc8C*\x1c\x94$bE\x1eD\xac0`\x14\xb1\"\xc7\xf5\xc9H\x81\x06+\xba\xad\x0f\xca\xdf\xc1\n\u0537_\xe9*`\u007f\x9b\xc3)p\u007f\x1f\\\x15\xa4\a\x93>\x04\xe9\xd1j\xec\x82\xf4p\x97\xaa@=^\xbe]\xc0\x9el\xeb*p\xcf\xd6[\x03\xe9\xe9}P\xf5\x9f\x80\x03\a\xafg\x11`\x00\xb0\xe4e\a\x17\x87\xea}\x00\x00\x00\x00IEND\xaeB`\x82") func appAssetsImgIconsList_control_downPngBytes() ([]byte, error) { return _appAssetsImgIconsList_control_downPng, nil } func appAssetsImgIconsList_control_downPng() (*asset, error) { bytes, err := appAssetsImgIconsList_control_downPngBytes() if err != nil { return nil, err } info := bindataFileInfo{name: "app/assets/img/icons/list_control_down.png", size: 309, mode: os.FileMode(416), modTime: time.Unix(1454116395, 0)} a := &asset{bytes: bytes, info: info} return a, nil } var _appAssetsImgKubernetesSvg = []byte(` `) func appAssetsImgKubernetesSvgBytes() ([]byte, error) { return _appAssetsImgKubernetesSvg, nil } func appAssetsImgKubernetesSvg() (*asset, error) { bytes, err := appAssetsImgKubernetesSvgBytes() if err != nil { return nil, err } info := bindataFileInfo{name: "app/assets/img/kubernetes.svg", size: 11663, mode: os.FileMode(416), modTime: time.Unix(1454116395, 0)} a := &asset{bytes: bytes, info: info} return a, nil } var _appAssetsJsAppJs = []byte(`function ReplicationController(){}function ServiceController(){}var componentNamespaces=["kubernetesApp.components.dashboard"],app=angular.module("kubernetesApp",["ngRoute","ngMaterial","ngLodash","door3.css","kubernetesApp.config","kubernetesApp.services","angular.filter"].concat(componentNamespaces));app.factory("menu",["$location","$rootScope","sections","$route",function(e,t,a,n){function r(){var e=n.current.originalPath,t=function(t,a){(e===a.url||e===a.url+"/")&&(o.selectSection(t),o.selectPage(t,a))};a.forEach(function(e){e.children?e.children.forEach(function(e){e.pages&&e.pages.forEach(function(a){t(e,a)})}):e.pages?e.pages.forEach(function(a){t(e,a)}):"link"===e.type&&t(e,e)})}var o;return t.$on("$locationChangeSuccess",r),o={sections:a,setSections:function(e){this.sections=e},selectSection:function(e){o.openedSection=e},toggleSelectSection:function(e){o.openedSection=o.openedSection===e?null:e},isSectionSelected:function(e){return o.openedSection===e},selectPage:function(e,t){o.currentSection=e,o.currentPage=t},isPageSelected:function(e){return o.currentPage===e}}}]),angular.module("kubernetesApp.config",[]),angular.module("kubernetesApp.services",["kubernetesApp.config"]),app.config(["$routeProvider",function(e){e.when("/404",{templateUrl:"views/partials/404.html"}).otherwise({redirectTo:"/404"})}]).config(["$routeProvider","manifestRoutes",function(e,t){angular.forEach(t,function(t){var a={templateUrl:t.templateUrl};t.controller&&(a.controller=t.controller),t.css&&(a.css=t.css),e.when(t.url,a)})}]),app.value("sections",[{name:"Dashboard",url:"/dashboard",type:"link",templateUrl:"/components/dashboard/pages/home.html"},{name:"Dashboard",type:"heading",children:[{name:"Dashboard",type:"toggle",url:"/dashboard",templateUrl:"/components/dashboard/pages/home.html",pages:[{name:"Pods",url:"/dashboard/pods",templateUrl:"/components/dashboard/views/listPods.html",type:"link"},{name:"Pod Visualizer",url:"/dashboard/visualpods",templateUrl:"/components/dashboard/views/listPodsVisualizer.html",type:"link"},{name:"Services",url:"/dashboard/services",templateUrl:"/components/dashboard/views/listServices.html",type:"link"},{name:"Replication Controllers",url:"/dashboard/replicationcontrollers",templateUrl:"/components/dashboard/views/listReplicationControllers.html",type:"link"},{name:"Events",url:"/dashboard/events",templateUrl:"/components/dashboard/views/listEvents.html",type:"link"},{name:"Nodes",url:"/dashboard/nodes",templateUrl:"/components/dashboard/views/listMinions.html",type:"link"},{name:"Replication Controller",url:"/dashboard/replicationcontrollers/:replicationControllerId",templateUrl:"/components/dashboard/views/replication.html",type:"link"},{name:"Service",url:"/dashboard/services/:serviceId",templateUrl:"/components/dashboard/views/service.html",type:"link"},{name:"Node",url:"/dashboard/nodes/:nodeId",templateUrl:"/components/dashboard/views/node.html",type:"link"},{name:"Explore",url:"/dashboard/groups/:grouping*?/selector/:selector*?",templateUrl:"/components/dashboard/views/groups.html",type:"link"},{name:"Pod",url:"/dashboard/pods/:podId",templateUrl:"/components/dashboard/views/pod.html",type:"link"}]}]},{name:"Graph",url:"/graph",type:"link",templateUrl:"/components/graph/pages/home.html"},{name:"Graph",url:"/graph/inspect",type:"link",templateUrl:"/components/graph/pages/inspect.html",css:"/components/graph/css/show-details-table.css"},{name:"Graph",type:"heading",children:[{name:"Graph",type:"toggle",url:"/graph",templateUrl:"/components/graph/pages/home.html",pages:[{name:"Test",url:"/graph/test",type:"link",templateUrl:"/components/graph/pages/home.html"}]}]}]),app.directive("includeReplace",function(){"use strict";return{require:"ngInclude",restrict:"A",link:function(e,t,a){t.replaceWith(t.children())}}}).directive("compile",["$compile",function(e){"use strict";return function(t,a,n){t.$watch(function(e){return e.$eval(n.compile)},function(n){a.html(n),e(a.contents())(t)})}}]).directive("kubernetesUiMenu",function(){"use strict";return{templateUrl:"views/partials/kubernetes-ui-menu.tmpl.html"}}).directive("menuToggle",function(){"use strict";return{scope:{section:"="},templateUrl:"views/partials/menu-toggle.tmpl.html",link:function(e,t){var a=t.parent().controller();e.isOpen=function(){return a.isOpen(e.section)},e.toggle=function(){a.toggleOpen(e.section)};var n=t[0].parentNode.parentNode.parentNode;if(n.classList.contains("parent-list-item")){var r=n.querySelector("h2");t[0].firstChild.setAttribute("aria-describedby",r.id)}}}}),app.filter("startFrom",function(){"use strict";return function(e,t){return e.slice(t)}}).filter("nospace",function(){"use strict";return function(e){return e?e.replace(/ /g,""):""}}),app.run(["$route",angular.noop]).run(["lodash",function(e){window._=e}]),app.service("SidebarService",["$rootScope",function(e){var t=this;t.sidebarItems=[],t.clearSidebarItems=function(){t.sidebarItems=[]},t.renderSidebar=function(){var a="";t.sidebarItems.forEach(function(e){a+=e.Html}),a&&(e.sidenavLeft='
'+a+"
")},t.addSidebarItem=function(e){t.sidebarItems.push(e),t.sidebarItems.sort(function(e,t){return e.order>t.order?1:t.order>e.order?-1:0})}}]),app.value("tabs",[{component:"dashboard",title:"Dashboard"}]),app.constant("manifestRoutes",[{description:"Dashboard visualization.",url:"/dashboard/",templateUrl:"components/dashboard/pages/home.html"},{description:"Pods",url:"/dashboard/pods",templateUrl:"components/dashboard/views/listPods.html"},{description:"Services",url:"/dashboard/services",templateUrl:"components/dashboard/views/listServices.html"},{description:"Replication Controllers",url:"/dashboard/replicationcontrollers",templateUrl:"components/dashboard/views/listReplicationControllers.html"},{description:"Events",url:"/dashboard/events",templateUrl:"components/dashboard/views/listEvents.html"},{description:"Nodes",url:"/dashboard/nodes",templateUrl:"components/dashboard/views/listMinions.html"},{description:"Replication Controller",url:"/dashboard/replicationcontrollers/:namespaceId/:replicationControllerId",templateUrl:"components/dashboard/views/replication.html"},{description:"Service",url:"/dashboard/services/:namespaceId/:serviceId",templateUrl:"components/dashboard/views/service.html"},{description:"Node",url:"/dashboard/nodes/:nodeId",templateUrl:"components/dashboard/views/node.html"},{description:"Explore",url:"/dashboard/groups/:grouping*?/selector/:selector*?",templateUrl:"components/dashboard/views/groups.html"},{description:"Pod",url:"/dashboard/pods/:namespaceId/:podId",templateUrl:"components/dashboard/views/pod.html"}]),angular.module("kubernetesApp.config",[]).constant("ENV",{"/":{k8sApiServer:"/api/v1",k8sDataService:"/cluster-insight",k8sDataServicePortName:":cluster-insight",k8sDataServiceEndpoint:"/cluster",k8sDataPollMinIntervalSec:10,k8sDataPollMaxIntervalSec:120,k8sDataPollErrorThreshold:5,cAdvisorProxy:"",cAdvisorPort:"4194"}}).constant("ngConstant",!0),app.controller("PageCtrl",["$scope","$timeout","$mdSidenav","menu","$rootScope",function(e,t,a,n,r){function o(){return v}function s(){e.showKubernetesUiMenu=!e.showKubernetesUiMenu}function i(){t(function(){a("left").close()})}function c(){t(function(){v=!a("left").isOpen(),a("left").toggle()})}function l(){return $location.path()}function u(e){n.selectPage(null,null),$location.path("/")}function d(){e.closeMenu(),h.focus()}function p(e){return n.isPageSelected(e)}function m(e){var t=!1,a=n.openedSection;return a===e?t=!0:e.children&&e.children.forEach(function(e){e===a&&(t=!0)}),t}function f(e){return n.isSectionSelected(e)}function g(e){n.toggleSelectSection(e)}e.menu=n,e.path=l,e.goHome=u,e.openMenu=c,r.openMenu=c,e.closeMenu=i,e.isSectionSelected=m,r.$on("$locationChangeSuccess",d),this.isOpen=f,this.isSelected=p,this.toggleOpen=g,this.shouldLockOpen=o,e.toggleKubernetesUiMenu=s;var h=document.querySelector("[role='main']"),v=(document.querySelector("[role='kubernetes-ui-menu']"),!1);e.showKubernetesUiMenu=!1}]).filter("humanizeDoc",function(){return function(e){return e?"directive"===e.type?e.name.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()}):e.label||e.name:void 0}}),app.controller("TabCtrl",["$scope","$location","tabs",function(e,t,a){e.tabs=a,e.switchTab=function(e){var n=t.path(),r=a[e];if(r){var o="/%s".format(r.component);-1==n.indexOf(o)&&t.path(o)}}}]),function(){"use strict";angular.module("kubernetesApp.services").service("cAdvisorService",["$http","$q","ENV","k8sApi",function(e,t,a,n){function r(a){var n=m(a)+"machine",r=t.defer();return e.get(n).success(function(e){r.resolve(e)}).error(function(e,t){r.reject("There was an error")}),r.promise}function o(a,n){n="undefined"==typeof n?"/":n;var r=m(a)+"containers"+n,o=t.defer(),s={num_stats:10,num_samples:0};return e.post(r,s).success(function(e){o.resolve(e)}).error(function(){o.reject("There was an error")}),o.promise}function s(e,t,a){var n;for(n=a.pop();a.length&&e>=t;n=a.pop())e/=t;return[e,n]}function i(e){var t=s(e,1e3,["TB","GB","MB","KB","Bytes"]);return t[0].toFixed(2)+" "+t[1]}function c(e,t){return e.stats.length>0&&e.stats[0][t]}function l(e,t){var a=new Date(e),n=new Date(t);return 1e6*(a.getTime()-n.getTime())}function u(e,t){var a=t.stats[t.stats.length-1],n=0;if(t.spec.has_cpu&&t.stats.length>=2){var r=t.stats[t.stats.length-2],o=a.cpu.usage.total-r.cpu.usage.total,s=l(a.timestamp,r.timestamp);n=Math.round(o/s/e.num_cores*100),n>100&&(n=100)}return{cpuPercentUsage:n}}function d(e,t){var a=t.stats[t.stats.length-1];if(a.filesystem){for(var n=[],r=0;rb()&&f()},v=function(t){var a=function(t){if(t.resources){var a=function(e){return e.id};t.resources=e.chain(t.resources).sortBy(a).uniq(!0,a).value()}if(t.relations){var n=function(e){return e.source+e.target};t.relations=e.chain(t.relations).sortBy(n).uniq(!0,n).value()}};a(t);var n=JSON.stringify(t),r="";i.data&&(r=JSON.stringify(i.data)),n!==r&&(i.data=t,i.sequenceNumber++),c=0,f()},y=0,k=function(){var e="";return a.length>0&&(e=a[y%a.length],++y),e},P=function(){return n+s()+l()+p()},D=function(e,t){var a=i.useSampleData?k():P();a&&$.getJSON(a).done(function(a,n,r){return a&&a.success?(delete a.success,delete a.timestamp,v(a),e.$apply(),void(u=t?o(function(){D(e,!0)},1e3*d):void 0)):(h(),void(u=t?o(function(){D(e,!0)},1e3*d):void 0))}).fail(function(a,n,r){h(),u=t?o(function(){D(e,!0)},1e3*d):void 0})},x=function(){return u?!0:!1},A=function(e){f(),u||(i.data=void 0,D(e,!0))},w=function(){u&&(o.cancel(u),u=void 0)},C=function(e){w(),f(),i.data=void 0,D(e,!1)};return{k8sdatamodel:i,isPolling:x,refresh:C,start:A,stop:w}}};angular.module("kubernetesApp.services").provider("pollK8sDataService",["lodash",e]).config(["pollK8sDataServiceProvider","ENV",function(e,t){t&&t["/"]&&(t["/"].k8sDataService&&e.setDataService(t["/"].k8sDataService),t["/"].k8sDataServicePortName&&e.setDataServicePortName(t["/"].k8sDataServicePortName),t["/"].k8sDataServiceEndpoint&&e.setDataServiceEndpoint(t["/"].k8sDataServiceEndpoint),t["/"].k8sDataPollIntervalMinSec&&e.setPollIntervalSec(t["/"].k8sDataPollIntervalMinSec),t["/"].k8sDataPollIntervalMaxSec&&e.setPollIntervalSec(t["/"].k8sDataPollIntervalMaxSec),t["/"].k8sDataPollErrorThreshold&&e.setPollErrorThreshold(t["/"].k8sDataPollErrorThreshold))}])}(),app.controller("cAdvisorController",["$scope","$routeParams","k8sApi","lodash","cAdvisorService","$q","$interval",function(e,t,a,n,r,o,s){function i(e,t){var a="color-"+(e+1);return t&&t>=90?a+=" color-critical":t&&t>=80&&(a+=" color-warning"),a}function c(e,t){var a="color-max-"+(e+1);return t&&t>=90?a+=" color-max-critical":t&&t>=80&&(a+=" color-max-warning"),a}function l(t,a,n,r){void 0===e.maxDataByById[t]&&(e.maxDataByById[t]={});var o=a.current,s=n,l=[];(void 0===e.maxDataByById[t].cpu||e.maxDataByById[t].cpu0){e.selectorPieces=a.split(",");for(var i=[],c=[],u=0;u1&&(s=p[1])}else i.push(d)}i.length>0&&o.push("labels="+encodeURI(i.join(","))),c.length>0&&o.push("fields="+encodeURI(c.join(",")))}var m="?"+o.join("&"),f=[],g=s.length>0?1:3,h=e.createBarrier(g,function(){e.groups=e.groupData(f,0),e.loading=!1,e.groupByOptions=l(),e.selectedGroupBy=n.grouping});(""===s||"pod"==s)&&r.getPods(m).success(function(t){e.addLabel("type","pod",t.items);for(var a=0;t.items&&at&&(e=t);var a=e,n=a/t,r=4*n*Math.PI,o=r,s=2*Math.PI,i=s+o;return{startAngle:s,endAngle:i}}var r=n(a.value);e[0].segments[t].startAngle=r.startAngle,e[0].segments[t].endAngle=r.endAngle;var o=a.maxData,s=n(o.maxValue+.2);e[0].segments[t].maxTickStartAngle=s.startAngle,e[0].segments[t].maxTickEndAngle=s.endAngle;var i=n(o.maxValue);e[0].segments[t].maxArcStartAngle=i.startAngle,e[0].segments[t].maxArcEndAngle=i.endAngle,e[0].segments[t].index=t}),t.push(e[0].segments),t[0]}function l(e,a){var n=v,r=750;$.each(a,function(e,t){void 0!==k[e]?a[e].previousEndAngle=k[e].endAngle:a[e].previousEndAngle=0});var o=parseInt(t.thickness,10),s=parseInt(t.graphWidth,10)/3,i=v.select(".path_group"),c=i.selectAll(".arc_group").data(a),l=c.enter().append("g").attr("class","arc_group");l.append("path").attr("class","bg-circle").attr("d",h(o,s)),l.append("path").attr("class",function(e,t){return"max_tick_arc "+e.maxData.maxTickClassNames}),l.append("path").attr("class",function(e,t){return"max_bg_arc "+e.maxData.maxClassNames}),l.append("path").attr("class",function(e,t){return"value_arc "+e.classNames});var f=c.select(".max_tick_arc");f.transition().attr("class",function(e,t){return"max_tick_arc "+e.maxData.maxTickClassNames}).attr("d",function(e){var t=d(o,s);return t.startAngle(e.maxTickStartAngle),t.endAngle(e.maxTickEndAngle),t(e)});var g=c.select(".max_bg_arc");g.transition().attr("class",function(e,t){return"max_bg_arc "+e.maxData.maxClassNames}).attr("d",function(e){var t=d(o,s);return t.startAngle(e.maxArcStartAngle),t.endAngle(e.maxArcEndAngle),t(e)});var b=c.select(".value_arc");b.transition().ease("exp").attr("class",function(e,t){return"value_arc "+e.classNames}).duration(r).attrTween("d",function(e){return u(e,o,s)}),c.exit().select(".value_arc").transition().ease("exp").duration(r).attrTween("d",function(e){return u(e,o,s)}).remove(),p(n,a,s,o),m(n,a)}function u(t,a,n){var r=JSON.parse(JSON.stringify(t));r.endAngle=t.previousEndAngle;var o=e.interpolate(r,t);return function(e){return g(a,n)(o(e))}}function d(t,a){var n=e.svg.arc().innerRadius(function(e){return f(a,e.index)}).outerRadius(function(e){return f(a+t,e.index)});return n}function p(e,t,a,n){v.select(".value_group").selectAll("*").remove();var r=(t.length,e.select(".value_group")),o=r.selectAll("text.value").data(t);o.enter().append("svg:text").attr("class","value").attr("dx",function(e,t){return 68}).attr("dy",function(e,t){return(n+3)*t}).attr("text-anchor",function(e){return"start"}).text(function(e){return e.value}),o.transition().duration(300).attrTween("d",function(e){return u(e,n,a)}),o.exit().remove()}function m(e,t){var a=b;a.select(".label_group").selectAll("*").remove(),a.select(".legend_group").selectAll("*").remove(),a.select(".stats_group").selectAll("*").remove();var n=a.select(".hostName"),r=a.select(".label_group"),o=a.select(".stats_group");n.text(t[0].hostName),n=a.selectAll("text.hostName").data(t),n.attr("text-anchor",function(e){return"start"}).text(function(e){return e.hostName}),n.exit().remove();var s=r.selectAll("text.labels").data(t);s.enter().append("svg:text").attr("class","labels").attr("dy",function(e,t){return 19*t}).attr("text-anchor",function(e){return"start"}).text(function(e){return e.label}),s.exit().remove();var i=o.selectAll("text.stats").data(t);i.enter().append("svg:text").attr("class","stats").attr("dy",function(e,t){return 19*t}).attr("text-anchor",function(e){return"start"}).text(function(e){return e.stats}),i.exit().remove();var c=a.select(".legend_group"),l=c.selectAll("rect").data(t);l.enter().append("svg:rect").attr("x",2).attr("y",function(e,t){return 19*t}).attr("width",13).attr("height",13).attr("class",function(e,t){return"rect "+e.classNames}),l.exit().remove()}function f(e,t){return e-20*t}function g(t,a){var n=e.svg.arc().innerRadius(function(e){return f(a,e.index)}).outerRadius(function(e){return f(a+t,e.index)}).startAngle(function(e,t){return e.startAngle}).endAngle(function(e,t){return e.endAngle});return n}function h(t,a){var n=e.svg.arc().innerRadius(function(e){return f(a,e.index)}).outerRadius(function(e){return f(a+t,e.index)}).startAngle(0).endAngle(function(){return 2*Math.PI});return n}var v=e.select("svg.chart"),b=e.select("svg.legend");window.onresize=function(){return t.$apply()},t.$watch(function(){return angular.element(window)[0].innerWidth},function(){return t.render(t.data)}),t.$watch("data",function(e,t){return n(e,t)},!0);var y=100,k=[];t.render=function(n){if(void 0!==n&&null!==n){e.select(a[0]).select("svg.chart").remove(),e.select(a[0]).select("svg.legend").remove();var o=($(a[0]),t.graphWidth),s=t.graphHeight,i={data:n,width:o,height:s};r(i)}}};e.d3().then(r)}}}])}(),function(){"use strict";angular.module("kubernetesApp.components.dashboard").directive("dashboardHeader",function(){return{restrict:"A",replace:!0,scope:{user:"="},templateUrl:"components/dashboard/pages/header.html",controller:["$scope","$filter","$location","menu","$rootScope",function(e,t,a,n,r){e.menu=n,e.$watch("page",function(e,t){"undefined"!=typeof e&&a.path(e)}),e.subpages=[{category:"dashboard",name:"Explore",value:"/dashboard/groups/type/selector/",id:"groupsView"},{category:"dashboard",name:"Pods",value:"/dashboard/pods",id:"podsView"},{category:"dashboard",name:"Nodes",value:"/dashboard/nodes",id:"minionsView"},{category:"dashboard",name:"Replication Controllers",value:"/dashboard/replicationcontrollers",id:"rcView"},{category:"dashboard",name:"Services",value:"/dashboard/services",id:"servicesView"},{category:"dashboard",name:"Events",value:"/dashboard/events",id:"eventsView"}]}]}}).directive("dashboardFooter",function(){return{restrict:"A",replace:!0,templateUrl:"components/dashboard/pages/footer.html",controller:["$scope","$filter",function(e,t){}]}}).directive("mdTable",function(){return{restrict:"E",scope:{headers:"=",content:"=",sortable:"=",filters:"=",customClass:"=customClass",thumbs:"=",count:"=",doSelect:"&onSelect"},transclude:!0,controller:["$scope","$filter","$window","$location",function(e,t,a,n){var r=t("orderBy");e.currentPage=0,e.nbOfPages=function(){return Math.ceil(e.content.length/e.count)},e.handleSort=function(t){return e.sortable.indexOf(t)>-1?!0:!1},e.order=function(t,a){e.content=r(e.content,t,a),e.predicate=t},e.order(e.sortable[0],!1),e.getNumber=function(e){return new Array(e)},e.goToPage=function(t){e.currentPage=t},e.showMore=function(){return angular.isDefined(e.moreClick)}}],templateUrl:"views/partials/md-table.tmpl.html"}})}(),angular.module("kubernetesApp.components.dashboard").factory("d3DashboardService",["$document","$q","$rootScope",function(e,t,a){function n(){a.$apply(function(){r.resolve(window.d3)})}var r=t.defer(),o=e[0].createElement("script");o.type="text/javascript",o.async=!0,o.src="vendor/d3/d3.min.js",o.onreadystatechange=function(){"complete"==this.readyState&&n()},o.onload=n;var s=e[0].getElementsByTagName("body")[0];return s.appendChild(o),{d3:function(){return r.promise}}}]),function(){"use strict";function e(e){var t={kind:"Pod",apiVersion:"v1",metadata:{name:"redis-master-c0r1n",generateName:"redis-master-",namespace:"default",selfLink:"/api/v1/namespaces/default/pods/redis-master-c0r1n",uid:"f12ddfaf-ff77-11e4-8f2d-080027213276",resourceVersion:"39",creationTimestamp:"2015-05-21T05:12:14Z",labels:{name:"redis-master"},annotations:{"kubernetes.io/created-by":'{"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"ReplicationController","namespace":"default","name":"redis-master","uid":"f12969e0-ff77-11e4-8f2d-080027213276","apiVersion":"v1","resourceVersion":"26"}}'}},spec:{volumes:[{name:"default-token-zb4rq",secret:{secretName:"default-token-zb4rq"}}],containers:[{name:"master",image:"redis",ports:[{containerPort:6379,protocol:"TCP"}],resources:{},volumeMounts:[{name:"default-token-zb4rq",readOnly:!0,mountPath:"/var/run/secrets/kubernetes.io/serviceaccount"}],terminationMessagePath:"/dev/termination-log",imagePullPolicy:"IfNotPresent",capabilities:{},securityContext:{capabilities:{},privileged:!1}}],restartPolicy:"Always",dnsPolicy:"ClusterFirst",serviceAccount:"default",host:"127.0.0.1"},status:{phase:"Running",Condition:[{type:"Ready",status:"True"}],hostIP:"127.0.0.1",podIP:"172.17.0.1",startTime:"2015-05-21T05:12:14Z",containerStatuses:[{name:"master",state:{running:{startedAt:"2015-05-21T05:12:14Z"}},lastState:{},ready:!0,restartCount:0,image:"redis",imageID:"docker://95af5842ddb9b03f7c6ec7601e65924cec516fcedd7e590ae31660057085cf67",containerID:"docker://ae2a1e0a91a8b1015191a0b8e2ce8c55a86fb1a9a2b1e8e3b29430c9d93c8c09"}]}};return{loadAll:function(){return e.when(t)}}}angular.module("pods",[]).service("podService",["$q",e])}(),function(){"use strict";function e(e){var t={kind:"List",apiVersion:"v1",metadata:{},items:[{kind:"ReplicationController",apiVersion:"v1",metadata:{name:"redis-master",namespace:"default",selfLink:"/api/v1/namespaces/default/replicationcontrollers/redis-master",uid:"f12969e0-ff77-11e4-8f2d-080027213276",resourceVersion:"28",creationTimestamp:"2015-05-21T05:12:14Z",labels:{name:"redis-master"}},spec:{replicas:1,selector:{name:"redis-master"},template:{metadata:{creationTimestamp:null,labels:{name:"redis-master"}},spec:{containers:[{name:"master",image:"redis",ports:[{containerPort:6379,protocol:"TCP"}],resources:{},terminationMessagePath:"/dev/termination-log",imagePullPolicy:"IfNotPresent",capabilities:{},securityContext:{capabilities:{},privileged:!1}}],restartPolicy:"Always",dnsPolicy:"ClusterFirst",serviceAccount:""}}},status:{replicas:1}}]};return{loadAll:function(){return e.when(t)}}}angular.module("replicationControllers",[]).service("replicationControllerService",["$q",e])}(),function(){"use strict";function e(e){var t={kind:"List",apiVersion:"v1",metadata:{},items:[{kind:"Service",apiVersion:"v1",metadata:{name:"kubernetes",namespace:"default",selfLink:"/api/v1/namespaces/default/services/kubernetes",resourceVersion:"6",creationTimestamp:null,labels:{component:"apiserver",provider:"kubernetes"}},spec:{ports:[{protocol:"TCP",port:443,targetPort:443}],portalIP:"10.0.0.2",sessionAffinity:"None"},status:{}},{kind:"Service",apiVersion:"v1",metadata:{name:"kubernetes-ro",namespace:"default",selfLink:"/api/v1/namespaces/default/services/kubernetes-ro",resourceVersion:"8",creationTimestamp:null,labels:{component:"apiserver",provider:"kubernetes"}},spec:{ports:[{protocol:"TCP",port:80,targetPort:80}],portalIP:"10.0.0.1",sessionAffinity:"None"},status:{}},{kind:"Service",apiVersion:"v1",metadata:{name:"redis-master",namespace:"default",selfLink:"/api/v1/namespaces/default/services/redis-master",uid:"a6fde246-ff78-11e4-8f2d-080027213276",resourceVersion:"72",creationTimestamp:"2015-05-21T05:17:19Z",labels:{name:"redis-master"}},spec:{ports:[{protocol:"TCP",port:6379,targetPort:6379}],selector:{name:"redis-master"},portalIP:"10.0.0.124",sessionAffinity:"None"},status:{}}]};return{loadAll:function(){return e.when(t)}}}angular.module("services",[]).service("serviceService",["$q",e])}();`) func appAssetsJsAppJsBytes() ([]byte, error) { return _appAssetsJsAppJs, nil } func appAssetsJsAppJs() (*asset, error) { bytes, err := appAssetsJsAppJsBytes() if err != nil { return nil, err } info := bindataFileInfo{name: "app/assets/js/app.js", size: 43636, mode: os.FileMode(420), modTime: time.Unix(1454116418, 0)} a := &asset{bytes: bytes, info: info} return a, nil } var _appAssetsJsBaseJs = []byte(`!function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){function n(e){var t=e.length,n=Z.type(e);return"function"===n||Z.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e}function r(e,t,n){if(Z.isFunction(t))return Z.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return Z.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(ae.test(t))return Z.filter(t,e,n);t=Z.filter(t,e)}return Z.grep(e,function(e){return U.call(t,e)>=0!==n})}function i(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function o(e){var t=he[e]={};return Z.each(e.match(de)||[],function(e,n){t[n]=!0}),t}function s(){J.removeEventListener("DOMContentLoaded",s,!1),e.removeEventListener("load",s,!1),Z.ready()}function a(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=Z.expando+a.uid++}function u(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(be,"-$1").toLowerCase(),n=e.getAttribute(r),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:xe.test(n)?Z.parseJSON(n):n}catch(i){}ye.set(e,t,n)}else n=void 0;return n}function l(){return!0}function c(){return!1}function f(){try{return J.activeElement}catch(e){}}function p(e,t){return Z.nodeName(e,"table")&&Z.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function d(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function h(e){var t=Pe.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function g(e,t){for(var n=0,r=e.length;r>n;n++)ve.set(e[n],"globalEval",!t||ve.get(t[n],"globalEval"))}function m(e,t){var n,r,i,o,s,a,u,l;if(1===t.nodeType){if(ve.hasData(e)&&(o=ve.access(e),s=ve.set(t,o),l=o.events)){delete s.handle,s.events={};for(i in l)for(n=0,r=l[i].length;r>n;n++)Z.event.add(t,i,l[i][n])}ye.hasData(e)&&(a=ye.access(e),u=Z.extend({},a),ye.set(t,u))}}function v(e,t){var n=e.getElementsByTagName?e.getElementsByTagName(t||"*"):e.querySelectorAll?e.querySelectorAll(t||"*"):[];return void 0===t||t&&Z.nodeName(e,t)?Z.merge([e],n):n}function y(e,t){var n=t.nodeName.toLowerCase();"input"===n&&Ne.test(e.type)?t.checked=e.checked:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}function x(t,n){var r,i=Z(n.createElement(t)).appendTo(n.body),o=e.getDefaultComputedStyle&&(r=e.getDefaultComputedStyle(i[0]))?r.display:Z.css(i[0],"display");return i.detach(),o}function b(e){var t=J,n=$e[e];return n||(n=x(e,t),"none"!==n&&n||(We=(We||Z("
iframe with addEventListener('hashchange', function() { document.body.style.background = 'lime'; }, false);

Session history management

[Table] [Single feat] 

Auto (m)

Modernizr test for: "history"

Auto

Test if history.pushState was successful

IndexedDB

[Table] [Single feat] 

Auto (m)

Modernizr test for: "indexeddb"

JSON parsing

[Table] [Single feat] 

Auto

Auto

Create a JS object, convert to JSON string, convert back to object and compare.

CSS3 Multiple backgrounds

[Table] [Single feat] 

Auto (m)

Modernizr test for: "multiplebgs"

Visual-square

background-repeat: repeat-x; background-image: url(caniuse_files/green5x5.png), url(caniuse_files/green5x5.png), url(caniuse_files/green5x5.png), url(caniuse_files/green5x5.png), url(caniuse_files/green5x5.png), url(caniuse_files/green5x5.png); background-position: 0 0, 0 5px, 0 10px, 0 15px, 0 20px, 0 25px;

CSS3 Multiple column layout

[Table] [Single feat] -pre-

Auto (m)

Modernizr test for: "csscolumns"

Visual-square

column-width: 15px; column-gap: 0;

Web Storage - name/value pairs

[Table] [Single feat] 

Auto (m)

Modernizr test for: "localstorage"

Auto

Test if getItem, setItem and removeItem work.

Web Notifications

[Table] [Single feat] 

Auto

Offline web applications

[Table] [Single feat] 

Auto (m)

Modernizr test for: "applicationcache"

querySelector/querySelectorAll

[Table] [Single feat] 

Auto

Auto

querySelector test on selector '[data-foo=bar] + *'

Auto

querySelectorAll test on selector '[data-foo=bar] + *'

SVG (basic support)

[Table] [Single feat] 

Auto (m)

Modernizr test for: "svg"

Visual-square

SVG fail
SVG in <object>

SVG effects for HTML

[Table] [Single feat] 

Visual

SVG fail

Text must appear blurry

SVG with feGaussianBlur filter on foreignObject

Inline SVG in HTML5

[Table] [Single feat] 

Auto (m)

Modernizr test for: "inlinesvg"

Visual-square

SVG SMIL animation

[Table] [Single feat] 

Auto (m)

Modernizr test for: "smil"

Visual-square

SVG fail
SVG with animate element inside a rect

Touch events

[Table] [Single feat] 

Auto (m)

Modernizr test for: "touch"

CSS3 Transforms

[Table] [Single feat] -pre-

Auto (m)

Modernizr test for: "csstransforms"

Visual-square

transform: translate(30px);

CSS3 3D Transforms

[Table] [Single feat] 

Auto (m)

Modernizr test for: "csstransforms3d"

Visual-square

Parent: perspective: 600; perspective-origin: 0 200px; Child: transform: translate3d(-234px, 0, 0) rotate3d(0, 1, 0, -70deg);

Video element

[Table] [Single feat] 

Auto

Interact

Video with controls and all three formats available.

Interact

Video with controls and all three formats available (with MIME).

Web Sockets

[Table] [Single feat] 

Auto (m)

Modernizr test for: "websockets"

Web Workers

[Table] [Single feat] 

Auto (m)

Modernizr test for: "webworkers"

Auto

Create a new Worker using new Worker('worker.js'); Then, test postMessage and onmessage event.

Cross-document messaging

[Table] [Single feat] 

Auto (m)

Modernizr test for: "postmessage"

XMLHttpRequest 2

[Table] [Single feat] 

Auto

XHTML served as application/xhtml+xml

[Table] [Single feat] 

Auto

CSS Generated content

[Table] [Single feat] 

Visual

-
Element with CSS: #gencontent:before { content: 'A'; } #gencontent:after { content: 'Z'; }

CSS Table display

[Table] [Single feat] 

Visual

topleft
topright
bottomleft
bottomright

Should be 2x2 table

HTML5 form features

[Table] [Single feat] 

Visual




date/time/range/number widgets

MathML

[Table] [Single feat] 

Visual

PNG alpha transparency

[Table] [Single feat] 

Visual

Ruby annotation

[Table] [Single feat] 

Visual

(bottom1)(top1)(bottom2)(top2)

Elements should be stacked on top of each other

SVG filters

[Table] [Single feat] 

Visual

object SVG not supported

Visual-square

SVG fail

Must be green (not lime)

SVG with <feColorMatrix type="hueRotate" values="120"/>

Visual-square

SVG fail
SVG with <feFlood flood-color="lime"/>

CSS3 Word-wrap

[Table] [Single feat] 

Visual

abcdefghijklmnopqrstuvwxyz

Text should wrap

Visual

abcdefghijklmnopqrstuvwxyz

Text should overflow box

Visual-square

abcdefghijklmnop
word-wrap: break-word;

calc() as CSS unit value

[Table] [Single feat] 

Visual-square

width: calc(10px + 20px);

Visual-square

height: calc(60px - 100%); width: calc((100% / 2) + 15px - 0.5em); border-right: calc(0.5em) solid lime;

CSS Grid Layout

[Table] [Single feat] 

Visual-square

Grid with two columns, two rows and three elements taking up space.

CSS3 Media Queries

[Table] [Single feat] 

Visual-square

CSS 2.1 selectors

[Table] [Single feat] 

Visual-square

Test for child ( > )selector

Visual-square

Adjacent sibling selector test ( + )

Visual-square

Attribute selector ( [role="none"] )

CSS3 Box-sizing

[Table] [Single feat] 

Visual-square

Data URLs

[Table] [Single feat] 

Visual-square

div with data URL as background image

New semantic elements

[Table] [Single feat] 

Visual-square

section, article, aside, hgroup, header, footer, nav tested for default "block" style.

CSS inline-block

[Table] [Single feat] 

Visual-square

CSS min/max-width/height

[Table] [Single feat] 

Visual-square

Visual-square

Visual-square

Visual-square

CSS3 object-fit/object-position

[Table] [Single feat] 

Visual-square

object-fit: contain

Visual-square

object-position: 30px 30px;

rem (root em) units

[Table] [Single feat] 

Visual-square

A
span with single character and font-size: 5rem;

SVG in CSS backgrounds

[Table] [Single feat] 

Visual-square

SVG in HTML img element

[Table] [Single feat] 

Visual-square

contenteditable attribute (basic support)

[Table] [Single feat] 

Interact

This element should be editable.

Div element with attribute contenteditable="true"

CSS3 selectors

[Table] [Single feat] 

Interact

Test here

Drag and Drop

[Table] [Single feat] 

Interact

Test here

WAI-ARIA Accessibility features

[Table] [Single feat] 

Text API for Canvas

[Table] [Single feat] 

Auto (m)

Modernizr test for: "canvastext"

WebGL - 3D Canvas graphics

[Table] [Single feat] 

Auto (m)

Modernizr test for: "webgl"

Visual-square

SVG fonts

[Table] [Single feat] 

Visual

Windsong font

TTF/OTF - TrueType and OpenType font support

[Table] [Single feat] 

Visual

Windsong font

OTF font test

Visual

Windsong font

TTF font test

WOFF - Web Open Font Format

[Table] [Single feat] 

Visual

Windsong font

Progress & Meter

[Table] [Single feat] 

Visual

fail fail

Progress and meter widgets at 50%

Datalist element

[Table] [Single feat] 

Interact

Show "foo" and "foobar" as options when "f" is entered

Form validation

[Table] [Single feat] 

Interact

Form should show warning and NOT submit

MPEG-4/H.264 video format

[Table] [Single feat] 

Auto

Interact

Video, no MIME, no type attribute.

Interact

Video with source element

Interact

Video with source element and MIME set

Ogg/Theora video format

[Table] [Single feat] 

Auto

Interact

Video, no MIME, no type attribute.

Interact

Video with source element and MIME set

Interact

Video with source element

WebM/VP8 video format

[Table] [Single feat] 

Auto

Interact

Video, no MIME, no type attribute.

Interact

Video with source element

Interact

Video with source element and MIME set

Animated PNG (APNG) [unoff]

[Table] [Single feat] 

Auto

Test for second frame using Canvas element

Visual

Must animate

CSS Canvas Drawings [unoff]

[Table] [Single feat] -pre-

Auto

'getCSSCanvasContext' in document

CSS Reflections [unoff]

[Table] [Single feat] -pre-

Auto (m)

Modernizr test for: "cssreflections"

Visual-square

Web SQL Database [unoff]

[Table] [Single feat] 

Auto (m)

Modernizr test for: "websqldatabase"

Stream API [unoff]

[Table] [Single feat] 

Auto

Test for "getUserMedia" in navigator object

CSS Masks [unoff]

[Table] [Single feat] -pre-

Visual

mask-image: url(caniuse_files/alpha.png);

CSS3 Text-overflow [unoff]

[Table] [Single feat] 

Visual

abcdefghijklmnopqrstuvwxyz

Should end with ellipsis

text-overflow: ellipsis;

CSS text-stroke [unoff]

[Table] [Single feat] -pre-

Visual

green stroked text
text-stroke: 2px lime;

EOT - Embedded OpenType fonts [unoff]

[Table] [Single feat] 

Visual

Windsong font

XHTML+SMIL animation [unoff]

[Table] [Single feat] 

Most tests by Alexis Deveria, additional contributions by Paul Irish

================================================ FILE: third_party/ui/bower_components/modernizr/test/caniuse_files/form_validation.html ================================================
================================================ FILE: third_party/ui/bower_components/modernizr/test/caniuse_files/ga.js ================================================ (function(){var k=void 0,aa=encodeURIComponent,l=String,o=Math,ba="push",ca="cookie",p="charAt",q="indexOf",da="getTime",r="toString",t="window",v="length",w="document",x="split",y="location",ea="protocol",fa="href",z="substring",A="join",C="toLowerCase";var ga="_gat",ha="_gaq",ia="4.9.4",ja="_gaUserPrefs",ka="ioo",D="&",E="=",F="__utma=",H="__utmb=",la="__utmc=",ma="__utmk=",I="__utmv=",J="__utmz=",na="__utmx=",oa="GASO=";var pa=function(){var d=this,f=[],b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";d.set=function(b){f[b]=!0};d.Sc=function(){for(var d=[],e=0;e=0};b.Xc=function(){return b.Jb("Firefox")&&![].reduce};b.Vc=function(){return L[t][ja]};b.Gc=function(){return L[t].external};b.Hc=function(){return L[t].performance||L[t].webkitPerformance};b.Ic=function(){return L[t].top==L[t]};b.Ya=function(b){var e=L[t]&&L[t].gaGlobal;if(b&&!e)e={},L[t].gaGlobal=e;return e};b.ec=function(b){L[w][y].href=b};b.qb= function(d){if(!d||!b.Jb("Firefox"))return d;for(var d=d.replace(/\n|\r/g," "),e=0,f=d[v];e-1&&(b=d[q](b,e),b<0&&(b=d[v]),h=d[z](e+f[q](E)+1,b)));return h},xa=function(d){var f=!1,b=0,h,e;if(!M(d)){f= !0;for(h=0;h-1)}return f},P=function(d,f){var b=aa;return b instanceof Function?f?encodeURI(d):b(d):(K(68),escape(d))},Q=function(d,f){var b=decodeURIComponent,h,d=d[x]("+")[A](" ");if(b instanceof Function)try{h=f?decodeURI(d):b(d)}catch(e){K(17),h=unescape(d)}else K(68),h=unescape(d);return h},R=function(d,f){return d[q](f)>-1}; function ya(d){if(!d||""==d)return"";for(;d[p](0)[v]>0&&" \n\r\t"[q](d[p](0))>-1;)d=d[z](1);for(;d[p](d[v]-1)[v]>0&&" \n\r\t"[q](d[p](d[v]-1))>-1;)d=d[z](0,d[v]-1);return d}var T=function(d,f){d[ba]||K(94);d[d[v]]=f},za=function(d){var f=1,b=0,h;if(!M(d)){f=0;for(h=d[v]-1;h>=0;h--)b=d.charCodeAt(h),f=(f<<6&268435455)+b+(b<<14),b=f&266338304,f=b!=0?f^b>>21:f}return f},Aa=function(){return o.round(o.random()*2147483647)},Ba=function(){};var Ca=function(d,f){this.ib=d;this.jb=f},Da=function(){function d(b){for(var d=[],b=b[x](","),e,f=0;f0&&(i=i[x]("^")[0]);b=i[x](":");i=b[1];d=parseInt(b[0],10);!j&&d0?h(b):"";m.o&&(c=e.Oc(L[w][ca],a,m.o,c,b),a="2"+a,j=b>0?h(m.s):"");a+=c;a=L.qb(a);a[v]>2E3&&(K(69),a=a[z](0,2E3));j=a+"; path="+m.f+"; "+j+e.hb();if(!V.pb())L[w].cookie=j};e.Oc=function(a,c,d,j,i){var g="",i=i||m.s,j=b([j,e.m+i*1],d),g=N(a,"2"+c,";");if(!M(g))return a=b(f(a,c,d,!0),d),g=g[x](a)[A](""),g=j+g;return j};e.hb=function(){return M(m.b)?"":"domain="+ m.b+";"}};var Fa=function(d){function f(a){a=ua(a)?a[A]("."):"";return M(a)?"-":a}function b(a,c){var n=[],b;if(!M(a)&&(n=a[x]("."),c))for(b=0;b')}catch(m){e=h.createElement("iframe"),e.name=f}e.height="0";e.width="0";e.style.display="none";e.style.visibility="hidden";var g=h[y], g=g[ea]+"//"+g.host+"/favicon.ico",g=Ga+"u/post_iframe.html#"+aa(g),a=function(){e.src="";e.parentNode&&e.parentNode.removeChild(e)};ta(L[t],"beforeunload",a);var c=!1,u=0,j=function(){if(!c){try{if(u>9||e.contentWindow[y].host==h[y].host){c=!0;a();var d=L[t],g="beforeunload",n=a;d.removeEventListener?d.removeEventListener(g,n,!1):d.detachEvent&&d.detachEvent("on"+g,n);b&&b();return}}catch(f){}u++;L.setTimeout(j,200)}};ta(e,"load",j);h.body.appendChild(e);e.src=g}else L.setTimeout(function(){d.Ob(f, b)},100)}};var Ka=function(d){var f=this,b=d,h=new Fa(b),e=null,m=!V.pb(),g=function(){};f.Uc=function(){return"https:"==L[w][y][ea]?"https://ssl.google-analytics.com/__utm.gif":"http://www.google-analytics.com/__utm.gif"};f.A=function(a,c,d,j,i,s){e||(e=new Ja);var n=b.B,O=L[w][y];h.Z(d);var B=h.z()[x](".");if(B[1]<500||j){if(i){var S=(new Date)[da](),X;X=(S-B[3])*(b.Ac/1E3);X>=1&&(B[2]=o.min(o.floor(B[2]*1+X),b.zc),B[3]=S)}if(j||!i||B[2]>=1){!j&&i&&(B[2]=B[2]*1-1);j=B[1]*1+1;B[1]=j;i="utmwv="+ia;S="&utms="+ j;X="&utmn="+Aa();j=i+"e"+S+X;a=i+S+X+(M(O.hostname)?"":"&utmhn="+P(O.hostname))+(b.L==100?"":"&utmsp="+P(b.L))+a;if(0==n||2==n)O=2==n?g:s||g,m&&e.Bb(b.ga,a,j,O,!0);if(1==n||2==n)c="&utmac="+c,j+=c,a+=c+"&utmcc="+f.Tc(d),V.Ab&&(d="&aip=1",j+=d,a+=d),a+="&utmu="+qa.Sc(),m&&e.Bb(f.Uc(),a,j,s)}}h.$(B[A]("."));h.aa()};f.Tc=function(a){for(var c=[],b=[F,J,I,na],d=h.g(),i,g=0;g0)for(b=0;b0;)d+=a--^c++;return za(d)}};var Z=function(d,f,b,h){function e(a){var c="",c=a[x]("://")[1][C]();R(c,"/")&&(c=c[x]("/")[0]);return c}var m=h,g=this;g.a=d;g.ob=f;g.m=b;g.mb=function(a){var c=g.ua();return new Z.v(N(a,m.Ea+E,D),N(a,m.Ha+E,D),N(a,m.Ja+E,D),g.R(a,m.Ca,"(not set)"),g.R(a,m.Fa,"(not set)"),g.R(a,m.Ia,c&&!M(c.G)?Q(c.G):k),g.R(a,m.Da,k),N(a,m.vc+E,D))};g.nb=function(a){var c=e(a),b;b=a;var d="";b=b[x]("://")[1][C]();R(b,"/")&&(b=b[x]("/")[1],R(b,"?")&&(d=b[x]("?")[0]));b=d;if(R(c,"google")&&(a=a[x]("?")[A](D),R(a,D+ m.xc+E)&&b==m.wc))return!0;return!1};g.ua=function(){var a,c=g.ob,b,d=m.J;if(!M(c)&&"0"!=c&&R(c,"://")&&!g.nb(c)){a=e(c);for(var i=0;i9?h[z](n+1)*1:0,f++,h=0==h?1:h,a.ra([B,g.m,h,f,e.H()][A](".")),a.sa()}}}}; Z.v=function(d,f,b,h,e,m,g,a){var c=this;c.q=d;c.Q=f;c.ya=b;c.n=h;c.P=e;c.G=m;c.Gb=g;c.xa=a;c.H=function(){var a=[],b=[["cid",c.q],["csr",c.Q],["gclid",c.ya],["ccn",c.n],["cmd",c.P],["ctr",c.G],["cct",c.Gb],["dclid",c.xa]],d,e;if(c.fb())for(d=0;d0&&b<=a.Ta){var f=P(c),h=P(d);f[v]+h[v]<=64&&(e.r[b]=[c,d,g],e.T(),n=!0)}return n};e.Zb=function(a){if((a=e.r[a])&&1===a[2])return a[1]};e.Yb=function(a){var b=e.r;b[a]&&(delete b[a],e.T())};e.Pc=function(){c.t(8);c.t(9);c.t(11);var a=e.r,b,d;for(d in a)if(b=a[d])c.j(8,d,b[0]),c.j(9,d,b[1]),(b=b[2])&&3!=b&&c.j(11,d,""+b)}};var Na=function(){function d(a,b,c,d){k==g[a]&&(g[a]={});k==g[a][b]&&(g[a][b]=[]);g[a][b][c]=d}function f(a,b,c){if(k!=g[a]&&k!=g[a][b])return g[a][b][c]}function b(a,b){if(k!=g[a]&&k!=g[a][b]){g[a][b]=k;var c=!0,d;for(d=0;d0?b+"00":"0"};b.sb=function(){var d=b.Kc();if(d==k||isNaN(d))return!1;if(d<=0)return!0;if(d>2147483648)return!1; var a=b.rb;a.t(14);a.ia(14);var c=b.Jc(d);a.j(14,1,c)&&a.ja(14,1,d)&&b.Lc();h&&h.isValidLoadTime!=k&&h.setPageReadyTime();return!1};b.Wa=function(){if(!b.Mc())return!1;if(!L.Ic())return!1;b.sb()&&ta(L[t],"load",b.sb,!1);return!0}};var $=function(){};$.Zc=function(d){var f="gaso=",b=L[w][y].hash;d=b&&1==b[q](f)?N(b,f,D):(b=L[t].name)&&0<=b[q](f)?N(b,f,D):N(d.g(),oa,";");return d};$.ad=function(d,f){var b=(f||"www")+".google.com",b="https://"+b+"/analytics/reporting/overlay_js?gaso="+d+D+Aa(),h="_gasojs",e=L[w].createElement("script");e.type="text/javascript";e.src=b;if(h)e.id=h;(L[w].getElementsByTagName("head")[0]||L[w].getElementsByTagName("body")[0]).appendChild(e)}; $.load=function(d,f){if(!$.$c){var b=$.Zc(f),h=b&&b.match(/^(?:\|([-0-9a-z.]{1,30})\|)?([-.\w]{10,1200})$/i);if(h)f.Dc(b),f.Ec(),V._gasoDomain=d.b,V._gasoCPath=d.f,$.ad(h[2],h[1]);$.$c=!0}};var Qa=function(d,f,b){function h(){if("auto"==j.b){var a=L[w].domain;"www."==a[z](0,4)&&(a=a[z](4));j.b=a}j.b=j.b[C]()}function e(){h();var a=j.b,b=a[q]("www.google.")*a[q](".google.")*a[q]("google.");return b||"/"!=j.f||a[q]("google.org")>-1}function m(b,c,d){if(M(b)||M(c)||M(d))return"-";b=N(b,F+a.a+".",c);M(b)||(b=b[x]("."),b[5]=""+(b[5]?b[5]*1+1:1),b[3]=b[4],b[4]=d,b=b[A]("."));return b}function g(){return"file:"!=L[w][y][ea]&&e()}var a=this,c=sa(a),u=k,j=new Da,i=!1,s=k;a.n=d;a.m=o.round((new Date)[da]()/ 1E3);a.p=f||"UA-XXXXX-X";a.ab=L[w].referrer;a.oa=k;a.d=k;a.F=!1;a.O=k;a.e=k;a.bb=k;a.pa=k;a.a=k;a.k=k;j.o=b?P(b):k;a.eb=!1;a.mc=function(){return Aa()^a.O.cc()&2147483647};a.lc=function(){if(!j.b||""==j.b||"none"==j.b)return j.b="",1;h();return j.Ua?za(j.b):1};a.kc=function(a,b){if(M(a))a="-";else{b+=j.f&&"/"!=j.f?j.f:"";var c=a[q](b),a=c>=0&&c<=8?"0":"["==a[p](0)&&"]"==a[p](a[v]-1)?"-":a}return a};a.na=function(b){var c="";c+=j.ka?a.O.dc():"";c+=j.la&&!M(L[w].title)?"&utmdt="+P(L[w].title):"";var d; d=L.Ya(!0);if(!d.hid)d.hid=Aa();d=d.hid;c+="&utmhid="+d+"&utmr="+P(l(a.oa))+"&utmp="+P(a.pc(b));return c};a.pc=function(a){var b=L[w][y];a&&K(13);return a=k!=a&&""!=a?P(a,!0):P(b.pathname+b.search,!0)};a.uc=function(b){if(a.D()){var c="";a.e!=k&&a.e.C()[v]>0&&(c+="&utme="+P(a.e.C()));c+=a.na(b);u.A(c,a.p,a.a)}};a.jc=function(){var b=new Fa(j);return b.Z(a.a)?b.Tb():k};a.cb=c("_getLinkerUrl",52,function(b,c){var d=b[x]("#"),e=b,f=a.jc();if(f)if(c&&1>=d[v])e+="#"+f;else if(!c||1>=d[v])1>=d[v]?e+=(R(b, "?")?D:"?")+f:e=d[0]+(R(b,"?")?D:"?")+f+"#"+d[1];return e});a.nc=function(){var b=a.m,c=a.k,d=c.g(),e=a.a+"",f=L.Ya(),g,h=R(d,F+e+"."),i=R(d,H+e),u=R(d,la+e),s,G=[],Y="",Ia=!1,d=M(d)?"":d;if(j.w&&!a.eb){g=L[w][y]&&L[w][y].hash?L[w][y][fa][z](L[w][y][fa][q]("#")):"";j.U&&!M(g)&&(Y=g+D);Y+=L[w][y].search;if(!M(Y)&&R(Y,F))c.Sb(Y),c.Ba()||c.Qb(),s=c.ba(),a.eb=!0;g=c.ea;var va=c.Pa,U=c.Sa;M(g())||(va(Q(g())),R(g(),";")||U());g=c.da;va=c.X;U=c.Y;M(g())||(va(g()),R(g(),";")||U())}M(s)?h?(s=!i||!u)?(s=m(d, ";",l(b)),a.F=!0):(s=N(d,F+e+".",";"),G=N(d,H+e,";")[x](".")):(s=[e,a.mc(),b,b,b,1][A]("."),Ia=a.F=!0):M(c.z())||M(c.ca())?(s=m(Y,D,l(b)),a.F=!0):(G=c.z()[x]("."),e=G[0]);s=s[x](".");L[t]&&f&&f.dh==e&&!j.o&&(s[4]=f.sid?f.sid:s[4],Ia&&(s[3]=f.sid?f.sid:s[4],f.vid&&(b=f.vid[x]("."),s[1]=b[0],s[2]=b[1])));c.Na(s[A]("."));G[0]=e;G[1]=G[1]?G[1]:0;G[2]=k!=G[2]?G[2]:j.Wb;G[3]=G[3]?G[3]:s[4];c.$(G[A]("."));c.Oa(e);M(c.Rb())||c.fa(c.K());c.Qa();c.aa();c.Ra()};a.oc=function(){u=new Ka(j)};a.getName=c("_getName", 58,function(){return a.n});a.c=c("_initData",2,function(){var b;if(!i){if(!a.O)a.O=new La(j.ma);a.a=a.lc();a.k=new Fa(j);a.e=new Na;s=new Ma(j,l(a.a),a.k,a.e);a.oc()}if(g()){if(!i)a.oa=a.kc(a.ab,L[w].domain),b=new Z(l(a.a),a.oa,a.m,j);a.nc(b);s.$b()}if(!i)g()&&b.Pb(a.k,a.F),a.bb=new Na,$.load(j,a.k),i=!0});a.Xa=c("_visitCode",54,function(){a.c();var b=N(a.k.g(),F+a.a+".",";"),b=b[x](".");return b[v]<4?"":b[1]});a.qd=c("_cookiePathCopy",30,function(b){a.c();a.k&&a.k.Ub(a.a,b)});a.D=function(){return a.Xa()% 1E40&&(f=g[z](0,a),g=g[z](a+1));var c=f==ga?V:f==ha?Sa:V.Hb(f);c[g].apply(c,b[e].slice(1))}}catch(u){d++}return d}};var V=new Ra;var Ua=L[t][ga];Ua&&typeof Ua._getTracker=="function"?V=Ua:L[t][ga]=V;var Sa=new Ta;a:{var Va=L[t][ha],Wa=!1;if(Va&&typeof Va[ba]=="function"&&(Wa=ua(Va),!Wa))break a;L[t][ha]=Sa;Wa&&Sa[ba].apply(Sa,Va)};})(); ================================================ FILE: third_party/ui/bower_components/modernizr/test/caniuse_files/hashchange.html ================================================ hashchange test ================================================ FILE: third_party/ui/bower_components/modernizr/test/caniuse_files/mathml.html ================================================ Untitled k = 2 z x 2 2 z y 2 - ( 2 z x y ) 2 ( 1 + ( z x ) 2 + ( z y ) 2 ) 2 ================================================ FILE: third_party/ui/bower_components/modernizr/test/caniuse_files/pushstate.html ================================================ popstate event test ================================================ FILE: third_party/ui/bower_components/modernizr/test/caniuse_files/style.css ================================================ body { font-family: "Lucida Grande", Lucida, Verdana, sans-serif; font-size: 12px; } a { text-decoration: none; } a:hover { text-decoration: underline; } table, tr, th, td { border: 1px solid #AAA; } table { margin-top: 1em; width: 100%; } tbody th { text-align: left; font-size: 14px; width: 200px; } th h3 { margin: 3px; font-size: 12px; } th span.links { font-size: 10px; } dt { font-weight: bold; } tr:hover > th, tr:hover > td + td { background-color: #FFC; } div.test_wrap { display: -moz-inline-stack; display: inline-block; border: 1px solid #CCC; text-align: center; vertical-align: top; min-height: 50px; margin-right: 5px; background: white; position: relative; } div.test_wrap h3 { text-align: center; margin: 2px; font-size: 10px; } div.auto { display: -moz-inline-stack; display: inline-block; border: 1px solid; width: 30px; height: 30px; } div.square { display: -moz-inline-stack; display: inline-block; border: 1px solid; width: 30px; height: 30px; background: red; } div.info { display: none; position: absolute; top: 100%; z-index: 2; left: 0; background: white; padding: 2px; min-width: 300px; border: 1px solid; text-align: left; } div.test_wrap:hover > div.info { display: block; } div.vis_test { display: -moz-inline-stack; display: inline-block; } div.vis_ref { display: -moz-inline-stack; display: inline-block; border-left: 1px dashed black; margin-left: 5px; padding-left: 5px; vertical-align: top; } p.condition { font-style: italic; margin: 2px; clear: both; } .pass { background: lime; } .fail { background: red; } .partial { background: yellow; } .unknown { background: #aaa; } .current span { border-radius: 6px; -moz-border-radius: 6px; background: none repeat scroll 0 0 #E6EA69; color: black; float: right; font-size: 8px; padding: 0 1px; } #intro, #options { width: 400px; background: #EEE; border-radius: 10px; padding: 5px 10px; margin: 10px; float: left; } #intro dt::after { content: ':'; } #intro dd { margin-bottom: 1em; } #opt_submit { display: block; margin: 10px; } #options label { display: block; margin: 5px; } ================================================ FILE: third_party/ui/bower_components/modernizr/test/caniuse_files/svg-img.svg.1 ================================================ ================================================ FILE: third_party/ui/bower_components/modernizr/test/caniuse_files/xhtml.html ================================================ Untitled

true

================================================ FILE: third_party/ui/bower_components/modernizr/test/index.html ================================================ Modernizr Test Suite

Modernizr Test Suite


    JSON.stringify(Modernizr)
    Show the Ref Tests from Caniuse and Modernizr ================================================ FILE: third_party/ui/bower_components/modernizr/test/js/basic.html ================================================ Modernizr Test Suite

    Modernizr Test Suite


      ================================================ FILE: third_party/ui/bower_components/modernizr/test/js/dumpdata.js ================================================ function dumpModernizr(){ var str = ''; dumpModernizr.old = dumpModernizr.old || {}; for (var prop in Modernizr) { // skip previously done ones. if (dumpModernizr.old[prop]) continue; else dumpModernizr.old[prop] = true; if (typeof Modernizr[prop] === 'function') continue; // skip unit test items if (/^test/.test(prop)) continue; if (~TEST.inputs.indexOf(prop)) { str += '
    1. '+prop+'{}
        '; for (var field in Modernizr[prop]) { str += '
      • ' + field + ': ' + Modernizr[prop][field] + '
      • '; } str += '
    2. '; } else { str += '
    3. ' + prop + ': ' + Modernizr[prop] + '
    4. '; } } return str; } function grabFeatDetects(){ // thx github.js $.getScript('https://api.github.com/repos/Modernizr/Modernizr/git/trees/master?recursive=1&callback=processTree'); } function processTree(data){ var filenames = []; for (var i = 0; i < data.data.tree.length; i++){ var file = data.data.tree[i]; var match = file.path.match(/^feature-detects\/(.*)/); if (!match) continue; var relpath = location.host == "modernizr.github.com" ? '../modernizr-git/' : '../'; filenames.push(relpath + match[0]); } var jqxhrs = filenames.map(function(filename){ return jQuery.getScript(filename); }); jQuery.when.apply(jQuery, jqxhrs).done(resultsToDOM); } function resultsToDOM(){ var modOutput = document.createElement('div'), ref = document.getElementById('qunit-testresult') || document.getElementById('qunit-tests'); modOutput.className = 'output'; modOutput.innerHTML = dumpModernizr(); ref.parentNode.insertBefore(modOutput, ref); // Modernizr object as text document.getElementsByTagName('textarea')[0].innerHTML = JSON.stringify(Modernizr); } /* uno */ resultsToDOM(); /* dos */ grabFeatDetects(); /* tres */ setTimeout(resultsToDOM, 5e3); /* quatro */ setTimeout(resultsToDOM, 15e3); ================================================ FILE: third_party/ui/bower_components/modernizr/test/js/lib/detect-global.js ================================================ // https://github.com/kangax/detect-global // tweaked to run without a UI. (function () { function getPropertyDescriptors(object) { var props = { }; for (var prop in object) { // nerfing for firefox who goes crazy over some objects like sessionStorage try { props[prop] = { type: typeof object[prop], value: object[prop] }; } catch(e){ props[prop] = {}; } } return props; } function getCleanWindow() { var elIframe = document.createElement('iframe'); elIframe.style.display = 'none'; var ref = document.getElementsByTagName('script')[0]; ref.parentNode.insertBefore(elIframe, ref); elIframe.src = 'about:blank'; return elIframe.contentWindow; } function appendControl(el, name) { var elCheckbox = document.createElement('input'); elCheckbox.type = 'checkbox'; elCheckbox.checked = true; elCheckbox.id = '__' + name; var elLabel = document.createElement('label'); elLabel.htmlFor = '__' + name; elLabel.innerHTML = 'Exclude ' + name + ' properties?'; elLabel.style.marginLeft = '0.5em'; var elWrapper = document.createElement('p'); elWrapper.style.marginBottom = '0.5em'; elWrapper.appendChild(elCheckbox); elWrapper.appendChild(elLabel); el.appendChild(elWrapper); } function appendAnalyze(el) { var elAnalyze = document.createElement('button'); elAnalyze.id = '__analyze'; elAnalyze.innerHTML = 'Analyze'; elAnalyze.style.marginTop = '1em'; el.appendChild(elAnalyze); } function appendCancel(el) { var elCancel = document.createElement('a'); elCancel.href = '#'; elCancel.innerHTML = 'Cancel'; elCancel.style.cssText = 'color:#eee;margin-left:0.5em;'; elCancel.onclick = function() { el.parentNode.removeChild(el); return false; }; el.appendChild(elCancel); } function initConfigPopup() { var el = document.createElement('div'); el.style.cssText = 'position:fixed; left:10px; top:10px; width:300px; background:rgba(50,50,50,0.9);' + '-moz-border-radius:10px; padding:1em; color: #eee; text-align: left;' + 'font-family: "Helvetica Neue", Verdana, Arial, sans serif; z-index: 99999;'; for (var prop in propSets) { appendControl(el, prop); } appendAnalyze(el); appendCancel(el); var ref = document.getElementsByTagName('script')[0]; ref.parentNode.insertBefore(el, ref); } function getPropsCount(object) { var count = 0; for (var prop in object) { count++; } return count; } function shouldDeleteProperty(propToCheck) { for (var prop in propSets) { var elCheckbox = document.getElementById('__' + prop); var isPropInSet = propSets[prop].indexOf(propToCheck) > -1; if (isPropInSet && (elCheckbox ? elCheckbox.checked : true) ) { return true; } } } function analyze() { var global = (function(){ return this; })(), globalProps = getPropertyDescriptors(global), cleanWindow = getCleanWindow(); for (var prop in cleanWindow) { if (globalProps[prop]) { delete globalProps[prop]; } } for (var prop in globalProps) { if (shouldDeleteProperty(prop)) { delete globalProps[prop]; } } window.__globalsCount = getPropsCount(globalProps); window.__globals = globalProps; window.console && console.log('Total number of global properties: ' + __globalsCount); window.console && console.dir(__globals); } var propSets = { 'Prototype': '$$ $A $F $H $R $break $continue $w Abstract Ajax Class Enumerable Element Field Form ' + 'Hash Insertion ObjectRange PeriodicalExecuter Position Prototype Selector Template Toggle Try'.split(' '), 'Scriptaculous': 'Autocompleter Builder Control Draggable Draggables Droppables Effect Sortable SortableObserver Sound Scriptaculous'.split(' '), 'Firebug': 'loadFirebugConsole console _getFirebugConsoleElement _FirebugConsole _FirebugCommandLine _firebug'.split(' '), 'Mozilla': 'Components XPCNativeWrapper XPCSafeJSObjectWrapper getInterface netscape GetWeakReference GeckoActiveXObject'.split(' '), 'GoogleAnalytics': 'gaJsHost gaGlobal _gat _gaq pageTracker'.split(' '), 'lazyGlobals': 'onhashchange'.split(' ') }; // initConfigPopup(); // disable because we're going UI-less. var analyzeElem = document.getElementById('__analyze'); analyzeElem && (analyzeElem.onclick = analyze); analyze(); // and assign total added globals to window.__globalsCount })(); ================================================ FILE: third_party/ui/bower_components/modernizr/test/js/lib/jquery-1.7b2.js ================================================ /*! * jQuery JavaScript Library v1.7b2 * http://jquery.com/ * * Copyright 2011, John Resig * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * * Includes Sizzle.js * http://sizzlejs.com/ * Copyright 2011, The Dojo Foundation * Released under the MIT, BSD, and GPL Licenses. * * Date: Thu Oct 13 21:12:55 2011 -0400 */ (function( window, undefined ) { // Use the correct document accordingly with window argument (sandbox) var document = window.document, navigator = window.navigator, location = window.location; var jQuery = (function() { // Define a local copy of jQuery var jQuery = function( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' return new jQuery.fn.init( selector, context, rootjQuery ); }, // Map over jQuery in case of overwrite _jQuery = window.jQuery, // Map over the $ in case of overwrite _$ = window.$, // A central reference to the root jQuery(document) rootjQuery, // A simple way to check for HTML strings or ID strings // Prioritize #id over to avoid XSS via location.hash (#9521) quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, // Check if a string has a non-whitespace character in it rnotwhite = /\S/, // Used for trimming whitespace trimLeft = /^\s+/, trimRight = /\s+$/, // Check for digits rdigit = /\d/, // Match a standalone tag rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, // JSON RegExp rvalidchars = /^[\],:{}\s]*$/, rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, // Useragent RegExp rwebkit = /(webkit)[ \/]([\w.]+)/, ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, rmsie = /(msie) ([\w.]+)/, rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, // Matches dashed string for camelizing rdashAlpha = /-([a-z]|[0-9])/ig, rmsPrefix = /^-ms-/, // Used by jQuery.camelCase as callback to replace() fcamelCase = function( all, letter ) { return ( letter + "" ).toUpperCase(); }, // Keep a UserAgent string for use with jQuery.browser userAgent = navigator.userAgent, // For matching the engine and version of the browser browserMatch, // The deferred used on DOM ready readyList, // The ready event handler DOMContentLoaded, // Save a reference to some core methods toString = Object.prototype.toString, hasOwn = Object.prototype.hasOwnProperty, push = Array.prototype.push, slice = Array.prototype.slice, trim = String.prototype.trim, indexOf = Array.prototype.indexOf, // [[Class]] -> type pairs class2type = {}; jQuery.fn = jQuery.prototype = { constructor: jQuery, init: function( selector, context, rootjQuery ) { var match, elem, ret, doc; // Handle $(""), $(null), or $(undefined) if ( !selector ) { return this; } // Handle $(DOMElement) if ( selector.nodeType ) { this.context = this[0] = selector; this.length = 1; return this; } // The body element only exists once, optimize finding it if ( selector === "body" && !context && document.body ) { this.context = document; this[0] = document.body; this.selector = selector; this.length = 1; return this; } // Handle HTML strings if ( typeof selector === "string" ) { // Are we dealing with HTML string or an ID? if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { // Assume that strings that start and end with <> are HTML and skip the regex check match = [ null, selector, null ]; } else { match = quickExpr.exec( selector ); } // Verify a match, and that no context was specified for #id if ( match && (match[1] || !context) ) { // HANDLE: $(html) -> $(array) if ( match[1] ) { context = context instanceof jQuery ? context[0] : context; doc = (context ? context.ownerDocument || context : document); // If a single string is passed in and it's a single tag // just do a createElement and skip the rest ret = rsingleTag.exec( selector ); if ( ret ) { if ( jQuery.isPlainObject( context ) ) { selector = [ document.createElement( ret[1] ) ]; jQuery.fn.attr.call( selector, context, true ); } else { selector = [ doc.createElement( ret[1] ) ]; } } else { ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes; } return jQuery.merge( this, selector ); // HANDLE: $("#id") } else { elem = document.getElementById( match[2] ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 if ( elem && elem.parentNode ) { // Handle the case where IE and Opera return items // by name instead of ID if ( elem.id !== match[2] ) { return rootjQuery.find( selector ); } // Otherwise, we inject the element directly into the jQuery object this.length = 1; this[0] = elem; } this.context = document; this.selector = selector; return this; } // HANDLE: $(expr, $(...)) } else if ( !context || context.jquery ) { return (context || rootjQuery).find( selector ); // HANDLE: $(expr, context) // (which is just equivalent to: $(context).find(expr) } else { return this.constructor( context ).find( selector ); } // HANDLE: $(function) // Shortcut for document ready } else if ( jQuery.isFunction( selector ) ) { return rootjQuery.ready( selector ); } if (selector.selector !== undefined) { this.selector = selector.selector; this.context = selector.context; } return jQuery.makeArray( selector, this ); }, // Start with an empty selector selector: "", // The current version of jQuery being used jquery: "1.7b2", // The default length of a jQuery object is 0 length: 0, // The number of elements contained in the matched element set size: function() { return this.length; }, toArray: function() { return slice.call( this, 0 ); }, // Get the Nth element in the matched element set OR // Get the whole matched element set as a clean array get: function( num ) { return num == null ? // Return a 'clean' array this.toArray() : // Return just the object ( num < 0 ? this[ this.length + num ] : this[ num ] ); }, // Take an array of elements and push it onto the stack // (returning the new matched element set) pushStack: function( elems, name, selector ) { // Build a new jQuery matched element set var ret = this.constructor(); if ( jQuery.isArray( elems ) ) { push.apply( ret, elems ); } else { jQuery.merge( ret, elems ); } // Add the old object onto the stack (as a reference) ret.prevObject = this; ret.context = this.context; if ( name === "find" ) { ret.selector = this.selector + (this.selector ? " " : "") + selector; } else if ( name ) { ret.selector = this.selector + "." + name + "(" + selector + ")"; } // Return the newly-formed element set return ret; }, // Execute a callback for every element in the matched set. // (You can seed the arguments with an array of args, but this is // only used internally.) each: function( callback, args ) { return jQuery.each( this, callback, args ); }, ready: function( fn ) { // Attach the listeners jQuery.bindReady(); // Add the callback readyList.add( fn ); return this; }, eq: function( i ) { return i === -1 ? this.slice( i ) : this.slice( i, +i + 1 ); }, first: function() { return this.eq( 0 ); }, last: function() { return this.eq( -1 ); }, slice: function() { return this.pushStack( slice.apply( this, arguments ), "slice", slice.call(arguments).join(",") ); }, map: function( callback ) { return this.pushStack( jQuery.map(this, function( elem, i ) { return callback.call( elem, i, elem ); })); }, end: function() { return this.prevObject || this.constructor(null); }, // For internal use only. // Behaves like an Array's method, not like a jQuery method. push: push, sort: [].sort, splice: [].splice }; // Give the init function the jQuery prototype for later instantiation jQuery.fn.init.prototype = jQuery.fn; jQuery.extend = jQuery.fn.extend = function() { var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false; // Handle a deep copy situation if ( typeof target === "boolean" ) { deep = target; target = arguments[1] || {}; // skip the boolean and the target i = 2; } // Handle case when target is a string or something (possible in deep copy) if ( typeof target !== "object" && !jQuery.isFunction(target) ) { target = {}; } // extend jQuery itself if only one argument is passed if ( length === i ) { target = this; --i; } for ( ; i < length; i++ ) { // Only deal with non-null/undefined values if ( (options = arguments[ i ]) != null ) { // Extend the base object for ( name in options ) { src = target[ name ]; copy = options[ name ]; // Prevent never-ending loop if ( target === copy ) { continue; } // Recurse if we're merging plain objects or arrays if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { if ( copyIsArray ) { copyIsArray = false; clone = src && jQuery.isArray(src) ? src : []; } else { clone = src && jQuery.isPlainObject(src) ? src : {}; } // Never move original objects, clone them target[ name ] = jQuery.extend( deep, clone, copy ); // Don't bring in undefined values } else if ( copy !== undefined ) { target[ name ] = copy; } } } } // Return the modified object return target; }; jQuery.extend({ noConflict: function( deep ) { if ( window.$ === jQuery ) { window.$ = _$; } if ( deep && window.jQuery === jQuery ) { window.jQuery = _jQuery; } return jQuery; }, // Is the DOM ready to be used? Set to true once it occurs. isReady: false, // A counter to track how many items to wait for before // the ready event fires. See #6781 readyWait: 1, // Hold (or release) the ready event holdReady: function( hold ) { if ( hold ) { jQuery.readyWait++; } else { jQuery.ready( true ); } }, // Handle when the DOM is ready ready: function( wait ) { // Either a released hold or an DOMready/load event and not yet ready if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). if ( !document.body ) { return setTimeout( jQuery.ready, 1 ); } // Remember that the DOM is ready jQuery.isReady = true; // If a normal DOM Ready event fired, decrement, and wait if need be if ( wait !== true && --jQuery.readyWait > 0 ) { return; } // If there are functions bound, to execute readyList.fireWith( document, [ jQuery ] ); // Trigger any bound ready events if ( jQuery.fn.trigger ) { jQuery( document ).trigger( "ready" ).unbind( "ready" ); } } }, bindReady: function() { if ( readyList ) { return; } readyList = jQuery.Callbacks( "once memory" ); // Catch cases where $(document).ready() is called after the // browser event has already occurred. if ( document.readyState === "complete" ) { // Handle it asynchronously to allow scripts the opportunity to delay ready return setTimeout( jQuery.ready, 1 ); } // Mozilla, Opera and webkit nightlies currently support this event if ( document.addEventListener ) { // Use the handy event callback document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); // A fallback to window.onload, that will always work window.addEventListener( "load", jQuery.ready, false ); // If IE event model is used } else if ( document.attachEvent ) { // ensure firing before onload, // maybe late but safe also for iframes document.attachEvent( "onreadystatechange", DOMContentLoaded ); // A fallback to window.onload, that will always work window.attachEvent( "onload", jQuery.ready ); // If IE and not a frame // continually check to see if the document is ready var toplevel = false; try { toplevel = window.frameElement == null; } catch(e) {} if ( document.documentElement.doScroll && toplevel ) { doScrollCheck(); } } }, // See test/unit/core.js for details concerning isFunction. // Since version 1.3, DOM methods and functions like alert // aren't supported. They return false on IE (#2968). isFunction: function( obj ) { return jQuery.type(obj) === "function"; }, isArray: Array.isArray || function( obj ) { return jQuery.type(obj) === "array"; }, // A crude way of determining if an object is a window isWindow: function( obj ) { return obj && typeof obj === "object" && "setInterval" in obj; }, isNumeric: function( obj ) { return obj != null && rdigit.test( obj ) && !isNaN( obj ); }, type: function( obj ) { return obj == null ? String( obj ) : class2type[ toString.call(obj) ] || "object"; }, isPlainObject: function( obj ) { // Must be an Object. // Because of IE, we also have to check the presence of the constructor property. // Make sure that DOM nodes and window objects don't pass through, as well if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { return false; } try { // Not own constructor property must be Object if ( obj.constructor && !hasOwn.call(obj, "constructor") && !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { return false; } } catch ( e ) { // IE8,9 Will throw exceptions on certain host objects #9897 return false; } // Own properties are enumerated firstly, so to speed up, // if last one is own, then all properties are own. var key; for ( key in obj ) {} return key === undefined || hasOwn.call( obj, key ); }, isEmptyObject: function( obj ) { for ( var name in obj ) { return false; } return true; }, error: function( msg ) { throw msg; }, parseJSON: function( data ) { if ( typeof data !== "string" || !data ) { return null; } // Make sure leading/trailing whitespace is removed (IE can't handle it) data = jQuery.trim( data ); // Attempt to parse using the native JSON parser first if ( window.JSON && window.JSON.parse ) { return window.JSON.parse( data ); } // Make sure the incoming data is actual JSON // Logic borrowed from http://json.org/json2.js if ( rvalidchars.test( data.replace( rvalidescape, "@" ) .replace( rvalidtokens, "]" ) .replace( rvalidbraces, "")) ) { return (new Function( "return " + data ))(); } jQuery.error( "Invalid JSON: " + data ); }, // Cross-browser xml parsing parseXML: function( data ) { var xml, tmp; try { if ( window.DOMParser ) { // Standard tmp = new DOMParser(); xml = tmp.parseFromString( data , "text/xml" ); } else { // IE xml = new ActiveXObject( "Microsoft.XMLDOM" ); xml.async = "false"; xml.loadXML( data ); } } catch( e ) { xml = undefined; } if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { jQuery.error( "Invalid XML: " + data ); } return xml; }, noop: function() {}, // Evaluates a script in a global context // Workarounds based on findings by Jim Driscoll // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context globalEval: function( data ) { if ( data && rnotwhite.test( data ) ) { // We use execScript on Internet Explorer // We use an anonymous function so that context is window // rather than jQuery in Firefox ( window.execScript || function( data ) { window[ "eval" ].call( window, data ); } )( data ); } }, // Convert dashed to camelCase; used by the css and data modules // Microsoft forgot to hump their vendor prefix (#9572) camelCase: function( string ) { return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); }, nodeName: function( elem, name ) { return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); }, // args is for internal usage only each: function( object, callback, args ) { var name, i = 0, length = object.length, isObj = length === undefined || jQuery.isFunction( object ); if ( args ) { if ( isObj ) { for ( name in object ) { if ( callback.apply( object[ name ], args ) === false ) { break; } } } else { for ( ; i < length; ) { if ( callback.apply( object[ i++ ], args ) === false ) { break; } } } // A special, fast, case for the most common use of each } else { if ( isObj ) { for ( name in object ) { if ( callback.call( object[ name ], name, object[ name ] ) === false ) { break; } } } else { for ( ; i < length; ) { if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { break; } } } } return object; }, // Use native String.trim function wherever possible trim: trim ? function( text ) { return text == null ? "" : trim.call( text ); } : // Otherwise use our own trimming functionality function( text ) { return text == null ? "" : text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); }, // results is for internal usage only makeArray: function( array, results ) { var ret = results || []; if ( array != null ) { // The window, strings (and functions) also have 'length' // The extra typeof function check is to prevent crashes // in Safari 2 (See: #3039) // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 var type = jQuery.type( array ); if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { push.call( ret, array ); } else { jQuery.merge( ret, array ); } } return ret; }, inArray: function( elem, array, i ) { var len; if ( array ) { if ( indexOf ) { return indexOf.call( array, elem, i ); } len = array.length; i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; for ( ; i < len; i++ ) { // Skip accessing in sparse arrays if ( i in array && array[ i ] === elem ) { return i; } } } return -1; }, merge: function( first, second ) { var i = first.length, j = 0; if ( typeof second.length === "number" ) { for ( var l = second.length; j < l; j++ ) { first[ i++ ] = second[ j ]; } } else { while ( second[j] !== undefined ) { first[ i++ ] = second[ j++ ]; } } first.length = i; return first; }, grep: function( elems, callback, inv ) { var ret = [], retVal; inv = !!inv; // Go through the array, only saving the items // that pass the validator function for ( var i = 0, length = elems.length; i < length; i++ ) { retVal = !!callback( elems[ i ], i ); if ( inv !== retVal ) { ret.push( elems[ i ] ); } } return ret; }, // arg is for internal usage only map: function( elems, callback, arg ) { var value, key, ret = [], i = 0, length = elems.length, // jquery objects are treated as arrays isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; // Go through the array, translating each of the items to their if ( isArray ) { for ( ; i < length; i++ ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret[ ret.length ] = value; } } // Go through every key on the object, } else { for ( key in elems ) { value = callback( elems[ key ], key, arg ); if ( value != null ) { ret[ ret.length ] = value; } } } // Flatten any nested arrays return ret.concat.apply( [], ret ); }, // A global GUID counter for objects guid: 1, // Bind a function to a context, optionally partially applying any // arguments. proxy: function( fn, context ) { if ( typeof context === "string" ) { var tmp = fn[ context ]; context = fn; fn = tmp; } // Quick check to determine if target is callable, in the spec // this throws a TypeError, but we will just return undefined. if ( !jQuery.isFunction( fn ) ) { return undefined; } // Simulated bind var args = slice.call( arguments, 2 ), proxy = function() { return fn.apply( context, args.concat( slice.call( arguments ) ) ); }; // Set the guid of unique handler to the same of original handler, so it can be removed proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; return proxy; }, // Mutifunctional method to get and set values to a collection // The value/s can optionally be executed if it's a function access: function( elems, key, value, exec, fn, pass ) { var length = elems.length; // Setting many attributes if ( typeof key === "object" ) { for ( var k in key ) { jQuery.access( elems, k, key[k], exec, fn, value ); } return elems; } // Setting one attribute if ( value !== undefined ) { // Optionally, function values get executed if exec is true exec = !pass && exec && jQuery.isFunction(value); for ( var i = 0; i < length; i++ ) { fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); } return elems; } // Getting an attribute return length ? fn( elems[0], key ) : undefined; }, now: function() { return (new Date()).getTime(); }, // Use of jQuery.browser is frowned upon. // More details: http://docs.jquery.com/Utilities/jQuery.browser uaMatch: function( ua ) { ua = ua.toLowerCase(); var match = rwebkit.exec( ua ) || ropera.exec( ua ) || rmsie.exec( ua ) || ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || []; return { browser: match[1] || "", version: match[2] || "0" }; }, sub: function() { function jQuerySub( selector, context ) { return new jQuerySub.fn.init( selector, context ); } jQuery.extend( true, jQuerySub, this ); jQuerySub.superclass = this; jQuerySub.fn = jQuerySub.prototype = this(); jQuerySub.fn.constructor = jQuerySub; jQuerySub.sub = this.sub; jQuerySub.fn.init = function init( selector, context ) { if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { context = jQuerySub( context ); } return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); }; jQuerySub.fn.init.prototype = jQuerySub.fn; var rootjQuerySub = jQuerySub(document); return jQuerySub; }, browser: {} }); // Populate the class2type map jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { class2type[ "[object " + name + "]" ] = name.toLowerCase(); }); browserMatch = jQuery.uaMatch( userAgent ); if ( browserMatch.browser ) { jQuery.browser[ browserMatch.browser ] = true; jQuery.browser.version = browserMatch.version; } // Deprecated, use jQuery.browser.webkit instead if ( jQuery.browser.webkit ) { jQuery.browser.safari = true; } // IE doesn't match non-breaking spaces with \s if ( rnotwhite.test( "\xA0" ) ) { trimLeft = /^[\s\xA0]+/; trimRight = /[\s\xA0]+$/; } // All jQuery objects should point back to these rootjQuery = jQuery(document); // Cleanup functions for the document ready method if ( document.addEventListener ) { DOMContentLoaded = function() { document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); jQuery.ready(); }; } else if ( document.attachEvent ) { DOMContentLoaded = function() { // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). if ( document.readyState === "complete" ) { document.detachEvent( "onreadystatechange", DOMContentLoaded ); jQuery.ready(); } }; } // The DOM ready check for Internet Explorer function doScrollCheck() { if ( jQuery.isReady ) { return; } try { // If IE is used, use the trick by Diego Perini // http://javascript.nwbox.com/IEContentLoaded/ document.documentElement.doScroll("left"); } catch(e) { setTimeout( doScrollCheck, 1 ); return; } // and execute any waiting functions jQuery.ready(); } // Expose jQuery as an AMD module, but only for AMD loaders that // understand the issues with loading multiple versions of jQuery // in a page that all might call define(). The loader will indicate // they have special allowances for multiple jQuery versions by // specifying define.amd.jQuery = true. Register as a named module, // since jQuery can be concatenated with other files that may use define, // but not use a proper concatenation script that understands anonymous // AMD modules. A named AMD is safest and most robust way to register. // Lowercase jquery is used because AMD module names are derived from // file names, and jQuery is normally delivered in a lowercase file name. if ( typeof define === "function" && define.amd && define.amd.jQuery ) { define( "jquery", [], function () { return jQuery; } ); } return jQuery; })(); // String to Object flags format cache var flagsCache = {}; // Convert String-formatted flags into Object-formatted ones and store in cache function createFlags( flags ) { var object = flagsCache[ flags ] = {}, i, length; flags = flags.split( /\s+/ ); for ( i = 0, length = flags.length; i < length; i++ ) { object[ flags[i] ] = true; } return object; } /* * Create a callback list using the following parameters: * * flags: an optional list of space-separated flags that will change how * the callback list behaves * * By default a callback list will act like an event callback list and can be * "fired" multiple times. * * Possible flags: * * once: will ensure the callback list can only be fired once (like a Deferred) * * memory: will keep track of previous values and will call any callback added * after the list has been fired right away with the latest "memorized" * values (like a Deferred) * * unique: will ensure a callback can only be added once (no duplicate in the list) * * stopOnFalse: interrupt callings when a callback returns false * */ jQuery.Callbacks = function( flags ) { // Convert flags from String-formatted to Object-formatted // (we check in cache first) flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {}; var // Actual callback list list = [], // Stack of fire calls for repeatable lists stack = [], // Last fire value (for non-forgettable lists) memory, // Flag to know if list is currently firing firing, // First callback to fire (used internally by add and fireWith) firingStart, // End of the loop when firing firingLength, // Index of currently firing callback (modified by remove if needed) firingIndex, // Add one or several callbacks to the list add = function( args ) { var i, length, elem, type, actual; for ( i = 0, length = args.length; i < length; i++ ) { elem = args[ i ]; type = jQuery.type( elem ); if ( type === "array" ) { // Inspect recursively add( elem ); } else if ( type === "function" ) { // Add if not in unique mode and callback is not in if ( !flags.unique || !self.has( elem ) ) { list.push( elem ); } } } }, // Fire callbacks fire = function( context, args ) { args = args || []; memory = !flags.memory || [ context, args ]; firing = true; firingIndex = firingStart || 0; firingStart = 0; firingLength = list.length; for ( ; list && firingIndex < firingLength; firingIndex++ ) { if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) { memory = true; // Mark as halted break; } } firing = false; if ( list ) { if ( !flags.once ) { if ( stack && stack.length ) { memory = stack.shift(); self.fireWith( memory[ 0 ], memory[ 1 ] ); } } else if ( memory === true ) { self.disable(); } else { list = []; } } }, // Actual Callbacks object self = { // Add a callback or a collection of callbacks to the list add: function() { if ( list ) { var length = list.length; add( arguments ); // Do we need to add the callbacks to the // current firing batch? if ( firing ) { firingLength = list.length; // With memory, if we're not firing then // we should call right away, unless previous // firing was halted (stopOnFalse) } else if ( memory && memory !== true ) { firingStart = length; fire( memory[ 0 ], memory[ 1 ] ); } } return this; }, // Remove a callback from the list remove: function() { if ( list ) { var args = arguments, argIndex = 0, argLength = args.length; for ( ; argIndex < argLength ; argIndex++ ) { for ( var i = 0; i < list.length; i++ ) { if ( args[ argIndex ] === list[ i ] ) { // Handle firingIndex and firingLength if ( firing ) { if ( i <= firingLength ) { firingLength--; if ( i <= firingIndex ) { firingIndex--; } } } // Remove the element list.splice( i--, 1 ); // If we have some unicity property then // we only need to do this once if ( flags.unique ) { break; } } } } } return this; }, // Control if a given callback is in the list has: function( fn ) { if ( list ) { var i = 0, length = list.length; for ( ; i < length; i++ ) { if ( fn === list[ i ] ) { return true; } } } return false; }, // Remove all callbacks from the list empty: function() { list = []; return this; }, // Have the list do nothing anymore disable: function() { list = stack = memory = undefined; return this; }, // Is it disabled? disabled: function() { return !list; }, // Lock the list in its current state lock: function() { stack = undefined; if ( !memory || memory === true ) { self.disable(); } return this; }, // Is it locked? locked: function() { return !stack; }, // Call all callbacks with the given context and arguments fireWith: function( context, args ) { if ( stack ) { if ( firing ) { if ( !flags.once ) { stack.push( [ context, args ] ); } } else if ( !( flags.once && memory ) ) { fire( context, args ); } } return this; }, // Call all the callbacks with the given arguments fire: function() { self.fireWith( this, arguments ); return this; }, // To know if the callbacks have already been called at least once fired: function() { return !!memory; } }; return self; }; var // Static reference to slice sliceDeferred = [].slice; jQuery.extend({ Deferred: function( func ) { var doneList = jQuery.Callbacks( "once memory" ), failList = jQuery.Callbacks( "once memory" ), progressList = jQuery.Callbacks( "memory" ), state = "pending", lists = { resolve: doneList, reject: failList, notify: progressList }, promise = { done: doneList.add, fail: failList.add, progress: progressList.add, state: function() { return state; }, // Deprecated isResolved: doneList.fired, isRejected: failList.fired, then: function( doneCallbacks, failCallbacks, progressCallbacks ) { deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks ); return this; }, always: function() { return deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments ); }, pipe: function( fnDone, fnFail, fnProgress ) { return jQuery.Deferred(function( newDefer ) { jQuery.each( { done: [ fnDone, "resolve" ], fail: [ fnFail, "reject" ], progress: [ fnProgress, "notify" ] }, function( handler, data ) { var fn = data[ 0 ], action = data[ 1 ], returned; if ( jQuery.isFunction( fn ) ) { deferred[ handler ](function() { returned = fn.apply( this, arguments ); if ( returned && jQuery.isFunction( returned.promise ) ) { returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify ); } else { newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); } }); } else { deferred[ handler ]( newDefer[ action ] ); } }); }).promise(); }, // Get a promise for this deferred // If obj is provided, the promise aspect is added to the object promise: function( obj ) { if ( obj == null ) { obj = promise; } else { for( var key in promise ) { obj[ key ] = promise[ key ]; } } return obj; } }, deferred = promise.promise({}), key; for ( key in lists ) { deferred[ key ] = lists[ key ].fire; deferred[ key + "With" ] = lists[ key ].fireWith; } // Handle state deferred.done( function() { state = "resolved"; }, failList.disable, progressList.lock ).fail( function() { state = "rejected"; }, doneList.disable, progressList.lock ); // Call given func if any if ( func ) { func.call( deferred, deferred ); } // All done! return deferred; }, // Deferred helper when: function( firstParam ) { var args = sliceDeferred.call( arguments, 0 ), i = 0, length = args.length, pValues = new Array( length ), count = length, pCount = length, deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? firstParam : jQuery.Deferred(), promise = deferred.promise(); function resolveFunc( i ) { return function( value ) { args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; if ( !( --count ) ) { deferred.resolveWith( deferred, args ); } }; } function progressFunc( i ) { return function( value ) { pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; deferred.notifyWith( promise, pValues ); }; } if ( length > 1 ) { for( ; i < length; i++ ) { if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) { args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) ); } else { --count; } } if ( !count ) { deferred.resolveWith( deferred, args ); } } else if ( deferred !== firstParam ) { deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); } return promise; } }); jQuery.support = (function() { var div = document.createElement( "div" ), documentElement = document.documentElement, all, a, select, opt, input, marginDiv, support, fragment, body, testElementParent, testElement, testElementStyle, tds, events, eventName, i, isSupported, offsetSupport; // Preliminary tests div.setAttribute("className", "t"); div.innerHTML = "
      a"; all = div.getElementsByTagName( "*" ); a = div.getElementsByTagName( "a" )[ 0 ]; // Can't get basic test support if ( !all || !all.length || !a ) { return {}; } // First batch of supports tests select = document.createElement( "select" ); opt = select.appendChild( document.createElement("option") ); input = div.getElementsByTagName( "input" )[ 0 ]; support = { // IE strips leading whitespace when .innerHTML is used leadingWhitespace: ( div.firstChild.nodeType === 3 ), // Make sure that tbody elements aren't automatically inserted // IE will insert them into empty tables tbody: !div.getElementsByTagName( "tbody" ).length, // Make sure that link elements get serialized correctly by innerHTML // This requires a wrapper element in IE htmlSerialize: !!div.getElementsByTagName( "link" ).length, // Get the style information from getAttribute // (IE uses .cssText instead) style: /top/.test( a.getAttribute("style") ), // Make sure that URLs aren't manipulated // (IE normalizes it by default) hrefNormalized: ( a.getAttribute( "href" ) === "/a" ), // Make sure that element opacity exists // (IE uses filter instead) // Use a regex to work around a WebKit issue. See #5145 opacity: /^0.55/.test( a.style.opacity ), // Verify style float existence // (IE uses styleFloat instead of cssFloat) cssFloat: !!a.style.cssFloat, // Make sure unknown elements (like HTML5 elems) are handled appropriately unknownElems: !!div.getElementsByTagName( "nav" ).length, // Make sure that if no value is specified for a checkbox // that it defaults to "on". // (WebKit defaults to "" instead) checkOn: ( input.value === "on" ), // Make sure that a selected-by-default option has a working selected property. // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) optSelected: opt.selected, // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) getSetAttribute: div.className !== "t", // Will be defined later submitBubbles: true, changeBubbles: true, focusinBubbles: false, deleteExpando: true, noCloneEvent: true, inlineBlockNeedsLayout: false, shrinkWrapBlocks: false, reliableMarginRight: true }; // Make sure checked status is properly cloned input.checked = true; support.noCloneChecked = input.cloneNode( true ).checked; // Make sure that the options inside disabled selects aren't marked as disabled // (WebKit marks them as disabled) select.disabled = true; support.optDisabled = !opt.disabled; // Test to see if it's possible to delete an expando from an element // Fails in Internet Explorer try { delete div.test; } catch( e ) { support.deleteExpando = false; } if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { div.attachEvent( "onclick", function() { // Cloning a node shouldn't copy over any // bound event handlers (IE does this) support.noCloneEvent = false; }); div.cloneNode( true ).fireEvent( "onclick" ); } // Check if a radio maintains its value // after being appended to the DOM input = document.createElement("input"); input.value = "t"; input.setAttribute("type", "radio"); support.radioValue = input.value === "t"; input.setAttribute("checked", "checked"); div.appendChild( input ); fragment = document.createDocumentFragment(); fragment.appendChild( div.firstChild ); // WebKit doesn't clone checked state correctly in fragments support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; div.innerHTML = ""; // Figure out if the W3C box model works as expected div.style.width = div.style.paddingLeft = "1px"; // We don't want to do body-related feature tests on frameset // documents, which lack a body. So we use // document.getElementsByTagName("body")[0], which is undefined in // frameset documents, while document.body isn’t. (7398) body = document.getElementsByTagName("body")[ 0 ]; // We use our own, invisible, body unless the body is already present // in which case we use a div (#9239) testElement = document.createElement( body ? "div" : "body" ); testElementStyle = { visibility: "hidden", width: 0, height: 0, border: 0, margin: 0, background: "none" }; if ( body ) { jQuery.extend( testElementStyle, { position: "absolute", left: "-999px", top: "-999px" }); } for ( i in testElementStyle ) { testElement.style[ i ] = testElementStyle[ i ]; } testElement.appendChild( div ); testElementParent = body || documentElement; testElementParent.insertBefore( testElement, testElementParent.firstChild ); // Check if a disconnected checkbox will retain its checked // value of true after appended to the DOM (IE6/7) support.appendChecked = input.checked; support.boxModel = div.offsetWidth === 2; if ( "zoom" in div.style ) { // Check if natively block-level elements act like inline-block // elements when setting their display to 'inline' and giving // them layout // (IE < 8 does this) div.style.display = "inline"; div.style.zoom = 1; support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 ); // Check if elements with layout shrink-wrap their children // (IE 6 does this) div.style.display = ""; div.innerHTML = "
      "; support.shrinkWrapBlocks = ( div.offsetWidth !== 2 ); } div.innerHTML = "
      t
      "; tds = div.getElementsByTagName( "td" ); // Check if table cells still have offsetWidth/Height when they are set // to display:none and there are still other visible table cells in a // table row; if so, offsetWidth/Height are not reliable for use when // determining if an element has been hidden directly using // display:none (it is still safe to use offsets if a parent element is // hidden; don safety goggles and see bug #4512 for more information). // (only IE 8 fails this test) isSupported = ( tds[ 0 ].offsetHeight === 0 ); tds[ 0 ].style.display = ""; tds[ 1 ].style.display = "none"; // Check if empty table cells still have offsetWidth/Height // (IE < 8 fail this test) support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); div.innerHTML = ""; // Check if div with explicit width and no margin-right incorrectly // gets computed margin-right based on width of container. For more // info see bug #3333 // Fails in WebKit before Feb 2011 nightlies // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right if ( document.defaultView && document.defaultView.getComputedStyle ) { marginDiv = document.createElement( "div" ); marginDiv.style.width = "0"; marginDiv.style.marginRight = "0"; div.appendChild( marginDiv ); support.reliableMarginRight = ( parseInt( ( document.defaultView.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0; } // Remove the body element we added testElement.innerHTML = ""; // Technique from Juriy Zaytsev // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ // We only care about the case where non-standard event systems // are used, namely in IE. Short-circuiting here helps us to // avoid an eval call (in setAttribute) which can cause CSP // to go haywire. See: https://developer.mozilla.org/en/Security/CSP if ( div.attachEvent ) { for( i in { submit: 1, change: 1, focusin: 1 } ) { eventName = "on" + i; isSupported = ( eventName in div ); if ( !isSupported ) { div.setAttribute( eventName, "return;" ); isSupported = ( typeof div[ eventName ] === "function" ); } support[ i + "Bubbles" ] = isSupported; } } // Determine fixed-position support early testElement.style.position = "static"; testElement.style.top = "0px"; testElement.style.marginTop = "1px"; offsetSupport = (function( body, container ) { var outer, inner, table, td, supports, bodyMarginTop = parseFloat( body.style.marginTop ) || 0, ptlm = "position:absolute;top:0;left:0;width:1px;height:1px;margin:0;", style = "style='" + ptlm + "border:5px solid #000;padding:0;'", html = "
      " + "" + "
      "; container.style.cssText = ptlm + "border:0;visibility:hidden"; container.innerHTML = html; body.insertBefore( container, body.firstChild ); outer = container.firstChild; inner = outer.firstChild; td = outer.nextSibling.firstChild.firstChild; supports = { doesNotAddBorder: (inner.offsetTop !== 5), doesAddBorderForTableAndCells: (td.offsetTop === 5) }; inner.style.position = "fixed"; inner.style.top = "20px"; // safari subtracts parent border width here which is 5px supports.supportsFixedPosition = (inner.offsetTop === 20 || inner.offsetTop === 15); inner.style.position = inner.style.top = ""; outer.style.overflow = "hidden"; outer.style.position = "relative"; supports.subtractsBorderForOverflowNotVisible = (inner.offsetTop === -5); supports.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop); return supports; })( testElement, div ); jQuery.extend( support, offsetSupport ); testElementParent.removeChild( testElement ); // Null connected elements to avoid leaks in IE testElement = fragment = select = opt = body = marginDiv = div = input = null; return support; })(); // Keep track of boxModel jQuery.boxModel = jQuery.support.boxModel; var rbrace = /^(?:\{.*\}|\[.*\])$/, rmultiDash = /([A-Z])/g; jQuery.extend({ cache: {}, // Please use with caution uuid: 0, // Unique for each copy of jQuery on the page // Non-digits removed to match rinlinejQuery expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), // The following elements throw uncatchable exceptions if you // attempt to add expando properties to them. noData: { "embed": true, // Ban all objects except for Flash (which handle expandos) "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", "applet": true }, hasData: function( elem ) { elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; return !!elem && !isEmptyDataObject( elem ); }, data: function( elem, name, data, pvt /* Internal Use Only */ ) { if ( !jQuery.acceptData( elem ) ) { return; } var thisCache, ret, internalKey = jQuery.expando, getByName = typeof name === "string", // We have to handle DOM nodes and JS objects differently because IE6-7 // can't GC object references properly across the DOM-JS boundary isNode = elem.nodeType, // Only DOM nodes need the global jQuery cache; JS object data is // attached directly to the object so GC can occur automatically cache = isNode ? jQuery.cache : elem, // Only defining an ID for JS objects if its cache already exists allows // the code to shortcut on the same path as a DOM node with no cache id = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando; // Avoid doing any more work than we need to when trying to get data on an // object that has no data at all if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) { return; } if ( !id ) { // Only DOM nodes need a new unique ID for each element since their data // ends up in the global cache if ( isNode ) { elem[ jQuery.expando ] = id = ++jQuery.uuid; } else { id = jQuery.expando; } } if ( !cache[ id ] ) { cache[ id ] = {}; // Avoids exposing jQuery metadata on plain JS objects when the object // is serialized using JSON.stringify if ( !isNode ) { cache[ id ].toJSON = jQuery.noop; } } // An object can be passed to jQuery.data instead of a key/value pair; this gets // shallow copied over onto the existing cache if ( typeof name === "object" || typeof name === "function" ) { if ( pvt ) { cache[ id ] = jQuery.extend( cache[ id ], name ); } else { cache[ id ].data = jQuery.extend( cache[ id ].data, name ); } } thisCache = cache[ id ]; // jQuery data() is stored in a separate object inside the object's internal data // cache in order to avoid key collisions between internal data and user-defined // data. if ( !pvt ) { if ( !thisCache.data ) { thisCache.data = {}; } thisCache = thisCache.data; } if ( data !== undefined ) { thisCache[ jQuery.camelCase( name ) ] = data; } // TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should // not attempt to inspect the internal events object using jQuery.data, as this // internal data object is undocumented and subject to change. if ( name === "events" && !thisCache[name] ) { return thisCache[ internalKey ] && thisCache[ internalKey ].events; } // Check for both converted-to-camel and non-converted data property names // If a data property was specified if ( getByName ) { // First Try to find as-is property data ret = thisCache[ name ]; // Test for null|undefined property data if ( ret == null ) { // Try to find the camelCased property ret = thisCache[ jQuery.camelCase( name ) ]; } } else { ret = thisCache; } return ret; }, removeData: function( elem, name, pvt /* Internal Use Only */ ) { if ( !jQuery.acceptData( elem ) ) { return; } var thisCache, i, l, // Reference to internal data cache key internalKey = jQuery.expando, isNode = elem.nodeType, // See jQuery.data for more information cache = isNode ? jQuery.cache : elem, // See jQuery.data for more information id = isNode ? elem[ jQuery.expando ] : jQuery.expando; // If there is already no cache entry for this object, there is no // purpose in continuing if ( !cache[ id ] ) { return; } if ( name ) { thisCache = pvt ? cache[ id ] : cache[ id ].data; if ( thisCache ) { // Support space separated names if ( jQuery.isArray( name ) ) { name = name; } else if ( name in thisCache ) { name = [ name ]; } else { // split the camel cased version by spaces name = jQuery.camelCase( name ); if ( name in thisCache ) { name = [ name ]; } else { name = name.split( " " ); } } for ( i = 0, l = name.length; i < l; i++ ) { delete thisCache[ name[i] ]; } // If there is no data left in the cache, we want to continue // and let the cache object itself get destroyed if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { return; } } } // See jQuery.data for more information if ( !pvt ) { delete cache[ id ].data; // Don't destroy the parent cache unless the internal data object // had been the only thing left in it if ( !isEmptyDataObject(cache[ id ]) ) { return; } } // Browsers that fail expando deletion also refuse to delete expandos on // the window, but it will allow it on all other JS objects; other browsers // don't care // Ensure that `cache` is not a window object #10080 if ( jQuery.support.deleteExpando || !cache.setInterval ) { delete cache[ id ]; } else { cache[ id ] = null; } // We destroyed the cache and need to eliminate the expando on the node to avoid // false lookups in the cache for entries that no longer exist if ( isNode ) { // IE does not allow us to delete expando properties from nodes, // nor does it have a removeAttribute function on Document nodes; // we must handle all of these cases if ( jQuery.support.deleteExpando ) { delete elem[ jQuery.expando ]; } else if ( elem.removeAttribute ) { elem.removeAttribute( jQuery.expando ); } else { elem[ jQuery.expando ] = null; } } }, // For internal use only. _data: function( elem, name, data ) { return jQuery.data( elem, name, data, true ); }, // A method for determining if a DOM node can handle the data expando acceptData: function( elem ) { if ( elem.nodeName ) { var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; if ( match ) { return !(match === true || elem.getAttribute("classid") !== match); } } return true; } }); jQuery.fn.extend({ data: function( key, value ) { var parts, attr, name, data = null; if ( typeof key === "undefined" ) { if ( this.length ) { data = jQuery.data( this[0] ); if ( this[0].nodeType === 1 && !jQuery._data( this[0], "parsedAttrs" ) ) { attr = this[0].attributes; for ( var i = 0, l = attr.length; i < l; i++ ) { name = attr[i].name; if ( name.indexOf( "data-" ) === 0 ) { name = jQuery.camelCase( name.substring(5) ); dataAttr( this[0], name, data[ name ] ); } } jQuery._data( this[0], "parsedAttrs", true ); } } return data; } else if ( typeof key === "object" ) { return this.each(function() { jQuery.data( this, key ); }); } parts = key.split("."); parts[1] = parts[1] ? "." + parts[1] : ""; if ( value === undefined ) { data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); // Try to fetch any internally stored data first if ( data === undefined && this.length ) { data = jQuery.data( this[0], key ); data = dataAttr( this[0], key, data ); } return data === undefined && parts[1] ? this.data( parts[0] ) : data; } else { return this.each(function() { var $this = jQuery( this ), args = [ parts[0], value ]; $this.triggerHandler( "setData" + parts[1] + "!", args ); jQuery.data( this, key, value ); $this.triggerHandler( "changeData" + parts[1] + "!", args ); }); } }, removeData: function( key ) { return this.each(function() { jQuery.removeData( this, key ); }); } }); function dataAttr( elem, key, data ) { // If nothing was found internally, try to fetch any // data from the HTML5 data-* attribute if ( data === undefined && elem.nodeType === 1 ) { var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); data = elem.getAttribute( name ); if ( typeof data === "string" ) { try { data = data === "true" ? true : data === "false" ? false : data === "null" ? null : jQuery.isNumeric( data ) ? parseFloat( data ) : rbrace.test( data ) ? jQuery.parseJSON( data ) : data; } catch( e ) {} // Make sure we set the data so it isn't changed later jQuery.data( elem, key, data ); } else { data = undefined; } } return data; } // checks a cache object for emptiness function isEmptyDataObject( obj ) { for ( var name in obj ) { // if the public data object is empty, the private is still empty if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { continue; } if ( name !== "toJSON" ) { return false; } } return true; } function handleQueueMarkDefer( elem, type, src ) { var deferDataKey = type + "defer", queueDataKey = type + "queue", markDataKey = type + "mark", defer = jQuery._data( elem, deferDataKey ); if ( defer && ( src === "queue" || !jQuery._data(elem, queueDataKey) ) && ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) { // Give room for hard-coded callbacks to fire first // and eventually mark/queue something else on the element setTimeout( function() { if ( !jQuery._data( elem, queueDataKey ) && !jQuery._data( elem, markDataKey ) ) { jQuery.removeData( elem, deferDataKey, true ); defer.fire(); } }, 0 ); } } jQuery.extend({ _mark: function( elem, type ) { if ( elem ) { type = (type || "fx") + "mark"; jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 ); } }, _unmark: function( force, elem, type ) { if ( force !== true ) { type = elem; elem = force; force = false; } if ( elem ) { type = type || "fx"; var key = type + "mark", count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 ); if ( count ) { jQuery._data( elem, key, count ); } else { jQuery.removeData( elem, key, true ); handleQueueMarkDefer( elem, type, "mark" ); } } }, queue: function( elem, type, data ) { var q; if ( elem ) { type = (type || "fx") + "queue"; q = jQuery._data( elem, type ); // Speed up dequeue by getting out quickly if this is just a lookup if ( data ) { if ( !q || jQuery.isArray(data) ) { q = jQuery._data( elem, type, jQuery.makeArray(data) ); } else { q.push( data ); } } return q || []; } }, dequeue: function( elem, type ) { type = type || "fx"; var queue = jQuery.queue( elem, type ), fn = queue.shift(), runner = {}; // If the fx queue is dequeued, always remove the progress sentinel if ( fn === "inprogress" ) { fn = queue.shift(); } if ( fn ) { // Add a progress sentinel to prevent the fx queue from being // automatically dequeued if ( type === "fx" ) { queue.unshift( "inprogress" ); } jQuery._data( elem, type + ".run", runner ); fn.call( elem, function() { jQuery.dequeue( elem, type ); }, runner ); } if ( !queue.length ) { jQuery.removeData( elem, type + "queue " + type + ".run", true ); handleQueueMarkDefer( elem, type, "queue" ); } } }); jQuery.fn.extend({ queue: function( type, data ) { if ( typeof type !== "string" ) { data = type; type = "fx"; } if ( data === undefined ) { return jQuery.queue( this[0], type ); } return this.each(function() { var queue = jQuery.queue( this, type, data ); if ( type === "fx" && queue[0] !== "inprogress" ) { jQuery.dequeue( this, type ); } }); }, dequeue: function( type ) { return this.each(function() { jQuery.dequeue( this, type ); }); }, // Based off of the plugin by Clint Helfers, with permission. // http://blindsignals.com/index.php/2009/07/jquery-delay/ delay: function( time, type ) { time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; type = type || "fx"; return this.queue( type, function( next, runner ) { var timeout = setTimeout( next, time ); runner.stop = function() { clearTimeout( timeout ); }; }); }, clearQueue: function( type ) { return this.queue( type || "fx", [] ); }, // Get a promise resolved when queues of a certain type // are emptied (fx is the type by default) promise: function( type, object ) { if ( typeof type !== "string" ) { object = type; type = undefined; } type = type || "fx"; var defer = jQuery.Deferred(), elements = this, i = elements.length, count = 1, deferDataKey = type + "defer", queueDataKey = type + "queue", markDataKey = type + "mark", tmp; function resolve() { if ( !( --count ) ) { defer.resolveWith( elements, [ elements ] ); } } while( i-- ) { if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) { count++; tmp.add( resolve ); } } resolve(); return defer.promise(); } }); var rclass = /[\n\t\r]/g, rspace = /\s+/, rreturn = /\r/g, rtype = /^(?:button|input)$/i, rfocusable = /^(?:button|input|object|select|textarea)$/i, rclickable = /^a(?:rea)?$/i, rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, nodeHook, boolHook, fixSpecified; jQuery.fn.extend({ attr: function( name, value ) { return jQuery.access( this, name, value, true, jQuery.attr ); }, removeAttr: function( name ) { return this.each(function() { jQuery.removeAttr( this, name ); }); }, prop: function( name, value ) { return jQuery.access( this, name, value, true, jQuery.prop ); }, removeProp: function( name ) { name = jQuery.propFix[ name ] || name; return this.each(function() { // try/catch handles cases where IE balks (such as removing a property on window) try { this[ name ] = undefined; delete this[ name ]; } catch( e ) {} }); }, addClass: function( value ) { var classNames, i, l, elem, setClass, c, cl; if ( jQuery.isFunction( value ) ) { return this.each(function( j ) { jQuery( this ).addClass( value.call(this, j, this.className) ); }); } if ( value && typeof value === "string" ) { classNames = value.split( rspace ); for ( i = 0, l = this.length; i < l; i++ ) { elem = this[ i ]; if ( elem.nodeType === 1 ) { if ( !elem.className && classNames.length === 1 ) { elem.className = value; } else { setClass = " " + elem.className + " "; for ( c = 0, cl = classNames.length; c < cl; c++ ) { if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { setClass += classNames[ c ] + " "; } } elem.className = jQuery.trim( setClass ); } } } } return this; }, removeClass: function( value ) { var classNames, i, l, elem, className, c, cl; if ( jQuery.isFunction( value ) ) { return this.each(function( j ) { jQuery( this ).removeClass( value.call(this, j, this.className) ); }); } if ( (value && typeof value === "string") || value === undefined ) { classNames = (value || "").split( rspace ); for ( i = 0, l = this.length; i < l; i++ ) { elem = this[ i ]; if ( elem.nodeType === 1 && elem.className ) { if ( value ) { className = (" " + elem.className + " ").replace( rclass, " " ); for ( c = 0, cl = classNames.length; c < cl; c++ ) { className = className.replace(" " + classNames[ c ] + " ", " "); } elem.className = jQuery.trim( className ); } else { elem.className = ""; } } } } return this; }, toggleClass: function( value, stateVal ) { var type = typeof value, isBool = typeof stateVal === "boolean"; if ( jQuery.isFunction( value ) ) { return this.each(function( i ) { jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); }); } return this.each(function() { if ( type === "string" ) { // toggle individual class names var className, i = 0, self = jQuery( this ), state = stateVal, classNames = value.split( rspace ); while ( (className = classNames[ i++ ]) ) { // check each className given, space seperated list state = isBool ? state : !self.hasClass( className ); self[ state ? "addClass" : "removeClass" ]( className ); } } else if ( type === "undefined" || type === "boolean" ) { if ( this.className ) { // store className if set jQuery._data( this, "__className__", this.className ); } // toggle whole className this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; } }); }, hasClass: function( selector ) { var className = " " + selector + " "; for ( var i = 0, l = this.length; i < l; i++ ) { if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { return true; } } return false; }, val: function( value ) { var hooks, ret, elem = this[0]; if ( !arguments.length ) { if ( elem ) { hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ]; if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { return ret; } ret = elem.value; return typeof ret === "string" ? // handle most common string cases ret.replace(rreturn, "") : // handle cases where value is null/undef or number ret == null ? "" : ret; } return undefined; } var isFunction = jQuery.isFunction( value ); return this.each(function( i ) { var self = jQuery(this), val; if ( this.nodeType !== 1 ) { return; } if ( isFunction ) { val = value.call( this, i, self.val() ); } else { val = value; } // Treat null/undefined as ""; convert numbers to string if ( val == null ) { val = ""; } else if ( typeof val === "number" ) { val += ""; } else if ( jQuery.isArray( val ) ) { val = jQuery.map(val, function ( value ) { return value == null ? "" : value + ""; }); } hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ]; // If set returns undefined, fall back to normal setting if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { this.value = val; } }); } }); jQuery.extend({ valHooks: { option: { get: function( elem ) { // attributes.value is undefined in Blackberry 4.7 but // uses .value. See #6932 var val = elem.attributes.value; return !val || val.specified ? elem.value : elem.text; } }, select: { get: function( elem ) { var value, index = elem.selectedIndex, values = [], options = elem.options, one = elem.type === "select-one"; // Nothing was selected if ( index < 0 ) { return null; } // Loop through all the selected options for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { var option = options[ i ]; // Don't return options that are disabled or in a disabled optgroup if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { // Get the specific value for the option value = jQuery( option ).val(); // We don't need an array for one selects if ( one ) { return value; } // Multi-Selects return an array values.push( value ); } } // Fixes Bug #2551 -- select.val() broken in IE after form.reset() if ( one && !values.length && options.length ) { return jQuery( options[ index ] ).val(); } return values; }, set: function( elem, value ) { var values = jQuery.makeArray( value ); jQuery(elem).find("option").each(function() { this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; }); if ( !values.length ) { elem.selectedIndex = -1; } return values; } } }, attrFn: { val: true, css: true, html: true, text: true, data: true, width: true, height: true, offset: true }, attr: function( elem, name, value, pass ) { var nType = elem.nodeType; // don't get/set attributes on text, comment and attribute nodes if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { return undefined; } if ( pass && name in jQuery.attrFn ) { return jQuery( elem )[ name ]( value ); } // Fallback to prop when attributes are not supported if ( !("getAttribute" in elem) ) { return jQuery.prop( elem, name, value ); } var ret, hooks, notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); // Normalize the name if needed if ( notxml ) { name = name.toLowerCase(); hooks = jQuery.attrHooks[ name ] || (rboolean.test( name ) ? boolHook : nodeHook); } if ( value !== undefined ) { if ( value === null ) { jQuery.removeAttr( elem, name ); return undefined; } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { return ret; } else { elem.setAttribute( name, "" + value ); return value; } } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { return ret; } else { ret = elem.getAttribute( name ); // Non-existent attributes return null, we normalize to undefined return ret === null ? undefined : ret; } }, removeAttr: function( elem, value ) { var propName, attrNames, name, l, i = 0; if ( elem.nodeType === 1 ) { attrNames = (value || "").split( rspace ); l = attrNames.length; for ( ; i < l; i++ ) { name = attrNames[ i ].toLowerCase(); // See #9699 for explanation of this approach (setting first, then removal) jQuery.attr( elem, name, "" ); elem.removeAttribute( name ); // Set corresponding property to false for boolean attributes if ( rboolean.test( name ) && (propName = jQuery.propFix[ name ] || name) in elem ) { elem[ propName ] = false; } } } }, attrHooks: { type: { set: function( elem, value ) { // We can't allow the type property to be changed (since it causes problems in IE) if ( rtype.test( elem.nodeName ) && elem.parentNode ) { jQuery.error( "type property can't be changed" ); } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { // Setting the type on a radio button after the value resets the value in IE6-9 // Reset value to it's default in case type is set after value // This is for element creation var val = elem.value; elem.setAttribute( "type", value ); if ( val ) { elem.value = val; } return value; } } }, // Use the value property for back compat // Use the nodeHook for button elements in IE6/7 (#1954) value: { get: function( elem, name ) { if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { return nodeHook.get( elem, name ); } return name in elem ? elem.value : null; }, set: function( elem, value, name ) { if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { return nodeHook.set( elem, value, name ); } // Does not return so that setAttribute is also used elem.value = value; } } }, propFix: { tabindex: "tabIndex", readonly: "readOnly", "for": "htmlFor", "class": "className", maxlength: "maxLength", cellspacing: "cellSpacing", cellpadding: "cellPadding", rowspan: "rowSpan", colspan: "colSpan", usemap: "useMap", frameborder: "frameBorder", contenteditable: "contentEditable" }, prop: function( elem, name, value ) { var nType = elem.nodeType; // don't get/set properties on text, comment and attribute nodes if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { return undefined; } var ret, hooks, notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); if ( notxml ) { // Fix name and attach hooks name = jQuery.propFix[ name ] || name; hooks = jQuery.propHooks[ name ]; } if ( value !== undefined ) { if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { return ret; } else { return (elem[ name ] = value); } } else { if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { return ret; } else { return elem[ name ]; } } }, propHooks: { tabIndex: { get: function( elem ) { // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ var attributeNode = elem.getAttributeNode("tabindex"); return attributeNode && attributeNode.specified ? parseInt( attributeNode.value, 10 ) : rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? 0 : undefined; } } } }); // Add the tabIndex propHook to attrHooks for back-compat (different case is intentional) jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex; // Hook for boolean attributes boolHook = { get: function( elem, name ) { // Align boolean attributes with corresponding properties // Fall back to attribute presence where some booleans are not supported var attrNode, property = jQuery.prop( elem, name ); return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? name.toLowerCase() : undefined; }, set: function( elem, value, name ) { var propName; if ( value === false ) { // Remove boolean attributes when set to false jQuery.removeAttr( elem, name ); } else { // value is true since we know at this point it's type boolean and not false // Set boolean attributes to the same name and set the DOM property propName = jQuery.propFix[ name ] || name; if ( propName in elem ) { // Only set the IDL specifically if it already exists on the element elem[ propName ] = true; } elem.setAttribute( name, name.toLowerCase() ); } return name; } }; // IE6/7 do not support getting/setting some attributes with get/setAttribute if ( !jQuery.support.getSetAttribute ) { fixSpecified = { name: true, id: true }; // Use this for any attribute in IE6/7 // This fixes almost every IE6/7 issue nodeHook = jQuery.valHooks.button = { get: function( elem, name ) { var ret; ret = elem.getAttributeNode( name ); return ret && (fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified) ? ret.nodeValue : undefined; }, set: function( elem, value, name ) { // Set the existing or create a new attribute node var ret = elem.getAttributeNode( name ); if ( !ret ) { ret = document.createAttribute( name ); elem.setAttributeNode( ret ); } return (ret.nodeValue = value + ""); } }; // Apply the nodeHook to tabindex jQuery.attrHooks.tabindex.set = nodeHook.set; // Set width and height to auto instead of 0 on empty string( Bug #8150 ) // This is for removals jQuery.each([ "width", "height" ], function( i, name ) { jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { set: function( elem, value ) { if ( value === "" ) { elem.setAttribute( name, "auto" ); return value; } } }); }); // Set contenteditable to false on removals(#10429) // Setting to empty string throws an error as an invalid value jQuery.attrHooks.contenteditable = { get: nodeHook.get, set: function( elem, value, name ) { if ( value === "" ) { value = "false"; } nodeHook.set( elem, value, name ); } }; } // Some attributes require a special call on IE if ( !jQuery.support.hrefNormalized ) { jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { get: function( elem ) { var ret = elem.getAttribute( name, 2 ); return ret === null ? undefined : ret; } }); }); } if ( !jQuery.support.style ) { jQuery.attrHooks.style = { get: function( elem ) { // Return undefined in the case of empty string // Normalize to lowercase since IE uppercases css property names return elem.style.cssText.toLowerCase() || undefined; }, set: function( elem, value ) { return (elem.style.cssText = "" + value); } }; } // Safari mis-reports the default selected property of an option // Accessing the parent's selectedIndex property fixes it if ( !jQuery.support.optSelected ) { jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { get: function( elem ) { var parent = elem.parentNode; if ( parent ) { parent.selectedIndex; // Make sure that it also works with optgroups, see #5701 if ( parent.parentNode ) { parent.parentNode.selectedIndex; } } return null; } }); } // Radios and checkboxes getter/setter if ( !jQuery.support.checkOn ) { jQuery.each([ "radio", "checkbox" ], function() { jQuery.valHooks[ this ] = { get: function( elem ) { // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified return elem.getAttribute("value") === null ? "on" : elem.value; } }; }); } jQuery.each([ "radio", "checkbox" ], function() { jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { set: function( elem, value ) { if ( jQuery.isArray( value ) ) { return (elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0); } } }); }); var rnamespaces = /\.(.*)$/, rformElems = /^(?:textarea|input|select)$/i, rperiod = /\./g, rspaces = / /g, rescape = /[^\w\s.|`]/g, rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/, rhoverHack = /\bhover(\.\S+)?/, rkeyEvent = /^key/, rmouseEvent = /^(?:mouse|contextmenu)|click/, rquickIs = /^([\w\-]+)?(?:#([\w\-]+))?(?:\.([\w\-]+))?(?:\[([\w+\-]+)=["']?([\w\-]*)["']?\])?$/, quickParse = function( selector ) { var quick = rquickIs.exec( selector ); if ( quick ) { // 0 1 2 3 4 5 // [ _, tag, id, class, attrName, attrValue ] quick[1] = ( quick[1] || "" ).toLowerCase(); quick[3] = quick[3] && new RegExp( "\\b" + quick[3] + "\\b" ); } return quick; }, quickIs = function( elem, m ) { return ( (!m[1] || elem.nodeName.toLowerCase() === m[1]) && (!m[2] || elem.id === m[2]) && (!m[3] || m[3].test( elem.className )) && (!m[4] || elem.getAttribute( m[4] ) == m[5]) ); }; /* * Helper functions for managing events -- not part of the public interface. * Props to Dean Edwards' addEvent library for many of the ideas. */ jQuery.event = { add: function( elem, types, handler, data, selector ) { var elemData, eventHandle, events, t, tns, type, namespaces, handleObj, handleObjIn, quick, handlers, special; // Don't attach events to noData or text/comment nodes (allow plain objects tho) if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { return; } // Caller can pass in an object of custom data in lieu of the handler if ( handler.handler ) { handleObjIn = handler; handler = handleObjIn.handler; } // Make sure that the handler has a unique ID, used to find/remove it later if ( !handler.guid ) { handler.guid = jQuery.guid++; } // Init the element's event structure and main handler, if this is the first events = elemData.events; if ( !events ) { elemData.events = events = {}; } eventHandle = elemData.handle; if ( !eventHandle ) { elemData.handle = eventHandle = function( e ) { // Discard the second event of a jQuery.event.trigger() and // when an event is called after a page has unloaded return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? jQuery.event.handle.apply( eventHandle.elem, arguments ) : undefined; }; // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events eventHandle.elem = elem; } // Handle multiple events separated by a space // jQuery(...).bind("mouseover mouseout", fn); types = types.replace( rhoverHack, "mouseover$1 mouseout$1" ).split( " " ); for ( t = 0; t < types.length; t++ ) { tns = rtypenamespace.exec( types[t] ) || []; type = tns[1]; namespaces = (tns[2] || "").split( "." ).sort(); // If event changes its type, use the special event handlers for the changed type special = jQuery.event.special[ type ] || {}; // If selector defined, determine special event api type, otherwise given type type = ( selector ? special.delegateType : special.bindType ) || type; // Update special based on newly reset type special = jQuery.event.special[ type ] || {}; // handleObj is passed to all event handlers handleObj = jQuery.extend({ type: type, origType: tns[1], data: data, handler: handler, guid: handler.guid, selector: selector, namespace: namespaces.join(".") }, handleObjIn ); // Delegated event; pre-analyze selector so it's processed quickly on event dispatch if ( selector ) { handleObj.quick = quickParse( selector ); if ( !handleObj.quick && jQuery.expr.match.POS.test( selector ) ) { handleObj.isPositional = true; } } // Init the event handler queue if we're the first handlers = events[ type ]; if ( !handlers ) { handlers = events[ type ] = []; handlers.delegateCount = 0; // Only use addEventListener/attachEvent if the special events handler returns false if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { // Bind the global event handler to the element if ( elem.addEventListener ) { elem.addEventListener( type, eventHandle, false ); } else if ( elem.attachEvent ) { elem.attachEvent( "on" + type, eventHandle ); } } } if ( special.add ) { special.add.call( elem, handleObj ); if ( !handleObj.handler.guid ) { handleObj.handler.guid = handler.guid; } } // Add to the element's handler list, delegates in front if ( selector ) { handlers.splice( handlers.delegateCount++, 0, handleObj ); } else { handlers.push( handleObj ); } // Keep track of which events have ever been used, for event optimization jQuery.event.global[ type ] = true; } // Nullify elem to prevent memory leaks in IE elem = null; }, global: {}, // Detach an event or set of events from an element remove: function( elem, types, handler, selector ) { var elemData = jQuery.hasData( elem ) && jQuery._data( elem ), t, tns, type, namespaces, origCount, j, events, special, handle, eventType, handleObj; if ( !elemData || !(events = elemData.events) ) { return; } // For removal, types can be an Event object if ( types && types.type && types.handler ) { handler = types.handler; types = types.type; selector = types.selector; } // Once for each type.namespace in types; type may be omitted types = (types || "").replace( rhoverHack, "mouseover$1 mouseout$1" ).split(" "); for ( t = 0; t < types.length; t++ ) { tns = rtypenamespace.exec( types[t] ) || []; type = tns[1]; namespaces = tns[2]; // Unbind all events (on this namespace, if provided) for the element if ( !type ) { namespaces = namespaces? "." + namespaces : ""; for ( j in events ) { jQuery.event.remove( elem, j + namespaces, handler, selector ); } return; } special = jQuery.event.special[ type ] || {}; type = ( selector? special.delegateType : special.bindType ) || type; eventType = events[ type ] || []; origCount = eventType.length; namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null; // Only need to loop for special events or selective removal if ( handler || namespaces || selector || special.remove ) { for ( j = 0; j < eventType.length; j++ ) { handleObj = eventType[ j ]; if ( !handler || handler.guid === handleObj.guid ) { if ( !namespaces || namespaces.test( handleObj.namespace ) ) { if ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) { eventType.splice( j--, 1 ); if ( handleObj.selector ) { eventType.delegateCount--; } if ( special.remove ) { special.remove.call( elem, handleObj ); } } } } } } else { // Removing all events eventType.length = 0; } // Remove generic event handler if we removed something and no more handlers exist // (avoids potential for endless recursion during removal of special event handlers) if ( eventType.length === 0 && origCount !== eventType.length ) { if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { jQuery.removeEvent( elem, type, elemData.handle ); } delete events[ type ]; } } // Remove the expando if it's no longer used if ( jQuery.isEmptyObject( events ) ) { handle = elemData.handle; if ( handle ) { handle.elem = null; } // removeData also checks for emptiness and clears the expando if empty // so use it instead of delete jQuery.removeData( elem, [ "events", "handle" ], true ); } }, // Events that are safe to short-circuit if no handlers are attached. // Native DOM events should not be added, they may have inline handlers. customEvent: { "getData": true, "setData": true, "changeData": true }, trigger: function( event, data, elem, onlyHandlers ) { // Don't do events on text and comment nodes if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { return; } // Event object or event type var type = event.type || event, namespaces = [], cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType; if ( type.indexOf( "!" ) >= 0 ) { // Exclusive events trigger only for the exact event (no namespaces) type = type.slice(0, -1); exclusive = true; } if ( type.indexOf( "." ) >= 0 ) { // Namespaced trigger; create a regexp to match event type in handle() namespaces = type.split("."); type = namespaces.shift(); namespaces.sort(); } if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { // No jQuery handlers for this event type, and it can't have inline handlers return; } // Caller can pass in an Event, Object, or just an event type string event = typeof event === "object" ? // jQuery.Event object event[ jQuery.expando ] ? event : // Object literal new jQuery.Event( type, event ) : // Just the event type (string) new jQuery.Event( type ); event.type = type; event.isTrigger = true; event.exclusive = exclusive; event.namespace = namespaces.join( "." ); event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null; ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; // triggerHandler() and global events don't bubble or run the default action if ( onlyHandlers || !elem ) { event.preventDefault(); } // Handle a global trigger if ( !elem ) { // TODO: Stop taunting the data cache; remove global events and always attach to document cache = jQuery.cache; event.stopPropagation(); for ( i in cache ) { if ( cache[ i ].events && cache[ i ].events[ type ] ) { jQuery.event.trigger( event, data, cache[ i ].handle.elem ); } } return; } // Clean up the event in case it is being reused event.result = undefined; if ( !event.target ) { event.target = elem; } // Clone any incoming data and prepend the event, creating the handler arg list data = data != null ? jQuery.makeArray( data ) : []; data.unshift( event ); // Allow special events to draw outside the lines special = jQuery.event.special[ type ] || {}; if ( special.trigger && special.trigger.apply( elem, data ) === false ) { return; } // Determine event propagation path in advance, per W3C events spec (#9951) // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) eventPath = [[ elem, special.bindType || type ]]; if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { bubbleType = special.delegateType || type; old = null; for ( cur = elem.parentNode; cur; cur = cur.parentNode ) { eventPath.push([ cur, bubbleType ]); old = cur; } // Only add window if we got to document (e.g., not plain obj or detached DOM) if ( old && old === elem.ownerDocument ) { eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); } } // Fire handlers on the event path for ( i = 0; i < eventPath.length; i++ ) { cur = eventPath[i][0]; event.type = eventPath[i][1]; handle = (jQuery._data( cur, "events" ) || {})[ event.type ] && jQuery._data( cur, "handle" ); if ( handle ) { handle.apply( cur, data ); } handle = ontype && cur[ ontype ]; if ( handle && jQuery.acceptData( cur ) ) { handle.apply( cur, data ); } if ( event.isPropagationStopped() ) { break; } } event.type = type; // If nobody prevented the default action, do it now if ( !event.isDefaultPrevented() ) { if ( (!special._default || special._default.call( elem.ownerDocument, event, data ) === false) && !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { // Call a native DOM method on the target with the same name name as the event. // Can't use an .isFunction() check here because IE6/7 fails that test. // Don't do default actions on window, that's where global variables be (#6170) // IE<9 dies on focus/blur to hidden element (#1486) if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { // Don't re-trigger an onFOO event when we call its FOO() method old = elem[ ontype ]; if ( old ) { elem[ ontype ] = null; } // Prevent re-triggering of the same event, since we already bubbled it above jQuery.event.triggered = type; elem[ type ](); jQuery.event.triggered = undefined; if ( old ) { elem[ ontype ] = old; } } } } return event.result; }, handle: function( event ) { // Make a writable jQuery.Event from the native event object event = jQuery.event.fix( event || window.event ); var handlers = ((jQuery._data( this, "events" ) || {})[ event.type ] || []), delegateCount = handlers.delegateCount, args = [].slice.call( arguments, 0 ), handlerQueue = [], i, cur, selMatch, matches, handleObj, sel, hit, related; // Use the fix-ed jQuery.Event rather than the (read-only) native event args[0] = event; // Determine handlers that should run if there are delegated events // Avoid disabled elements in IE (#6911) and non-left-click bubbling in Firefox (#3861) if ( delegateCount && !event.target.disabled && !(event.button && event.type === "click") ) { for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { selMatch = {}; matches = []; for ( i = 0; i < delegateCount; i++ ) { handleObj = handlers[ i ]; sel = handleObj.selector; hit = selMatch[ sel ]; if ( handleObj.isPositional ) { // Since .is() does not work for positionals; see http://jsfiddle.net/eJ4yd/3/ hit = ( hit || (selMatch[ sel ] = jQuery( sel )) ).index( cur ) >= 0; } else if ( hit === undefined ) { hit = selMatch[ sel ] = ( handleObj.quick ? quickIs( cur, handleObj.quick ) : jQuery( cur ).is( sel ) ); } if ( hit ) { matches.push( handleObj ); } } if ( matches.length ) { handlerQueue.push({ elem: cur, matches: matches }); } } } // Copy the remaining (bound) handlers in case they're changed handlers = handlers.slice( delegateCount ); // Run delegates first; they may want to stop propagation beneath us event.delegateTarget = this; for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { matched = handlerQueue[ i ]; dispatch( matched.elem, event, matched.matches, args ); } delete event.delegateTarget; // Run non-delegated handlers for this level if ( handlers.length ) { dispatch( this, event, handlers, args ); } return event.result; }, // Includes some event props shared by KeyEvent and MouseEvent // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), fixHooks: {}, keyHooks: { props: "char charCode key keyCode".split(" "), filter: function( event, original ) { // Add which for key events if ( event.which == null ) { event.which = original.charCode != null ? original.charCode : original.keyCode; } return event; } }, mouseHooks: { props: "button buttons clientX clientY fromElement layerX layerY offsetX offsetY pageX pageY screenX screenY toElement wheelDelta".split(" "), filter: function( event, original ) { var eventDoc, doc, body, button = original.button, fromElement = original.fromElement; // Calculate pageX/Y if missing and clientX/Y available if ( event.pageX == null && original.clientX != null ) { eventDoc = event.target.ownerDocument || document; doc = eventDoc.documentElement; body = eventDoc.body; event.pageX = original.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); event.pageY = original.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); } // Add relatedTarget, if necessary if ( !event.relatedTarget && fromElement ) { event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; } // Add which for click: 1 === left; 2 === middle; 3 === right // Note: button is not normalized, so don't use it if ( !event.which && button !== undefined ) { event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); } return event; } }, fix: function( event ) { if ( event[ jQuery.expando ] ) { return event; } // Create a writable copy of the event object and normalize some properties var i, prop, originalEvent = event, fixHook = jQuery.event.fixHooks[ event.type ] || {}, copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; event = jQuery.Event( originalEvent ); for ( i = copy.length; i; ) { prop = copy[ --i ]; event[ prop ] = originalEvent[ prop ]; } // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) if ( !event.target ) { event.target = originalEvent.srcElement || document; } // Target should not be a text node (#504, Safari) if ( event.target.nodeType === 3 ) { event.target = event.target.parentNode; } // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8) if ( event.metaKey === undefined ) { event.metaKey = event.ctrlKey; } return fixHook.filter? fixHook.filter( event, originalEvent ) : event; }, special: { ready: { // Make sure the ready event is setup setup: jQuery.bindReady }, focus: { delegateType: "focusin", noBubble: true }, blur: { delegateType: "focusout", noBubble: true }, beforeunload: { setup: function( data, namespaces, eventHandle ) { // We only want to do this special case on windows if ( jQuery.isWindow( this ) ) { this.onbeforeunload = eventHandle; } }, teardown: function( namespaces, eventHandle ) { if ( this.onbeforeunload === eventHandle ) { this.onbeforeunload = null; } } } }, simulate: function( type, elem, event, bubble ) { // Piggyback on a donor event to simulate a different one. // Fake originalEvent to avoid donor's stopPropagation, but if the // simulated event prevents default then we do the same on the donor. var e = jQuery.extend( new jQuery.Event(), event, { type: type, isSimulated: true, originalEvent: {} } ); if ( bubble ) { jQuery.event.trigger( e, null, elem ); } else { jQuery.event.handle.call( elem, e ); } if ( e.isDefaultPrevented() ) { event.preventDefault(); } } }; // Run jQuery handler functions; called from jQuery.event.handle function dispatch( target, event, handlers, args ) { var run_all = !event.exclusive && !event.namespace, specialHandle = ( jQuery.event.special[ event.type ] || {} ).handle, j, handleObj, ret; event.currentTarget = target; for ( j = 0; j < handlers.length && !event.isImmediatePropagationStopped(); j++ ) { handleObj = handlers[ j ]; // Triggered event must either 1) be non-exclusive and have no namespace, or // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { // Pass in a reference to the handler function itself // So that we can later remove it event.handler = handleObj.handler; event.data = handleObj.data; event.handleObj = handleObj; ret = ( specialHandle || handleObj.handler ).apply( target, args ); if ( ret !== undefined ) { event.result = ret; if ( ret === false ) { event.preventDefault(); event.stopPropagation(); } } } } } jQuery.removeEvent = document.removeEventListener ? function( elem, type, handle ) { if ( elem.removeEventListener ) { elem.removeEventListener( type, handle, false ); } } : function( elem, type, handle ) { if ( elem.detachEvent ) { elem.detachEvent( "on" + type, handle ); } }; jQuery.Event = function( src, props ) { // Allow instantiation without the 'new' keyword if ( !(this instanceof jQuery.Event) ) { return new jQuery.Event( src, props ); } // Event object if ( src && src.type ) { this.originalEvent = src; this.type = src.type; // Events bubbling up the document may have been marked as prevented // by a handler lower down the tree; reflect the correct value. this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; // Event type } else { this.type = src; } // Put explicitly provided properties onto the event object if ( props ) { jQuery.extend( this, props ); } // Create a timestamp if incoming event doesn't have one this.timeStamp = src && src.timeStamp || jQuery.now(); // Mark it as fixed this[ jQuery.expando ] = true; }; function returnFalse() { return false; } function returnTrue() { return true; } // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html jQuery.Event.prototype = { preventDefault: function() { this.isDefaultPrevented = returnTrue; var e = this.originalEvent; if ( !e ) { return; } // if preventDefault exists run it on the original event if ( e.preventDefault ) { e.preventDefault(); // otherwise set the returnValue property of the original event to false (IE) } else { e.returnValue = false; } }, stopPropagation: function() { this.isPropagationStopped = returnTrue; var e = this.originalEvent; if ( !e ) { return; } // if stopPropagation exists run it on the original event if ( e.stopPropagation ) { e.stopPropagation(); } // otherwise set the cancelBubble property of the original event to true (IE) e.cancelBubble = true; }, stopImmediatePropagation: function() { this.isImmediatePropagationStopped = returnTrue; this.stopPropagation(); }, isDefaultPrevented: returnFalse, isPropagationStopped: returnFalse, isImmediatePropagationStopped: returnFalse }; // Create mouseenter/leave events using mouseover/out and event-time checks jQuery.each({ mouseenter: "mouseover", mouseleave: "mouseout" }, function( orig, fix ) { jQuery.event.special[ orig ] = jQuery.event.special[ fix ] = { delegateType: fix, bindType: fix, handle: function( event ) { var target = this, related = event.relatedTarget, handleObj = event.handleObj, selector = handleObj.selector, oldType, ret; // For a real mouseover/out, always call the handler; for // mousenter/leave call the handler if related is outside the target. // NB: No relatedTarget if the mouse left/entered the browser window if ( !related || handleObj.origType === event.type || (related !== target && !jQuery.contains( target, related )) ) { oldType = event.type; event.type = handleObj.origType; ret = handleObj.handler.apply( this, arguments ); event.type = oldType; } return ret; } }; }); // IE submit delegation if ( !jQuery.support.submitBubbles ) { jQuery.event.special.submit = { setup: function() { // Only need this for delegated form submit events if ( jQuery.nodeName( this, "form" ) ) { return false; } // Lazy-add a submit handler when a descendant form may potentially be submitted jQuery.event.add( this, "click._submit keypress._submit", function( e ) { // Node name check avoids a VML-related crash in IE (#9807) var elem = e.target, form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; if ( form && !form._submit_attached ) { jQuery.event.add( form, "submit._submit", function( event ) { // Form was submitted, bubble the event up the tree if ( this.parentNode ) { jQuery.event.simulate( "submit", this.parentNode, event, true ); } }); form._submit_attached = true; } }); // return undefined since we don't need an event listener }, teardown: function() { // Only need this for delegated form submit events if ( jQuery.nodeName( this, "form" ) ) { return false; } // Remove delegated handlers; cleanData eventually reaps submit handlers attached above jQuery.event.remove( this, "._submit" ); } }; } // IE change delegation and checkbox/radio fix if ( !jQuery.support.changeBubbles ) { jQuery.event.special.change = { setup: function() { if ( rformElems.test( this.nodeName ) ) { // IE doesn't fire change on a check/radio until blur; trigger it on click // after a propertychange. Eat the blur-change in special.change.handle. // This still fires onchange a second time for check/radio after blur. if ( this.type === "checkbox" || this.type === "radio" ) { jQuery.event.add( this, "propertychange._change", function( event ) { if ( event.originalEvent.propertyName === "checked" ) { this._just_changed = true; } }); jQuery.event.add( this, "click._change", function( event ) { if ( this._just_changed ) { this._just_changed = false; jQuery.event.simulate( "change", this, event, true ); } }); } return false; } // Delegated event; lazy-add a change handler on descendant inputs jQuery.event.add( this, "beforeactivate._change", function( e ) { var elem = e.target; if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) { jQuery.event.add( elem, "change._change", function( event ) { if ( this.parentNode && !event.isSimulated ) { jQuery.event.simulate( "change", this.parentNode, event, true ); } }); elem._change_attached = true; } }); }, handle: function( event ) { var elem = event.target; // Swallow native change events from checkbox/radio, we already triggered them above if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { return event.handleObj.handler.apply( this, arguments ); } }, teardown: function() { jQuery.event.remove( this, "._change" ); return rformElems.test( this.nodeName ); } }; } // Create "bubbling" focus and blur events if ( !jQuery.support.focusinBubbles ) { jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { // Attach a single capturing handler while someone wants focusin/focusout var attaches = 0, handler = function( event ) { jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); }; jQuery.event.special[ fix ] = { setup: function() { if ( attaches++ === 0 ) { document.addEventListener( orig, handler, true ); } }, teardown: function() { if ( --attaches === 0 ) { document.removeEventListener( orig, handler, true ); } } }; }); } jQuery.fn.extend({ on: function( types, selector, data, fn, /*INTERNAL*/ one ) { var origFn, type; // Types can be a map of types/handlers if ( typeof types === "object" ) { // ( types-Object, selector, data ) if ( typeof selector !== "string" ) { // ( types-Object, data ) data = selector; selector = undefined; } for ( type in types ) { this.on( type, selector, data, types[ type ], one ); } return this; } if ( data == null && fn == null ) { // ( types, fn ) fn = selector; data = selector = undefined; } else if ( fn == null ) { if ( typeof selector === "string" ) { // ( types, selector, fn ) fn = data; data = undefined; } else { // ( types, data, fn ) fn = data; data = selector; selector = undefined; } } if ( fn === false ) { fn = returnFalse; } else if ( !fn ) { return this; } if ( one === 1 ) { origFn = fn; fn = function( event ) { jQuery.event.remove( event.delegateTarget || this, event ); return origFn.apply( this, arguments ); }; // Use same guid so caller can remove using origFn fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); } return this.each( function() { jQuery.event.add( this, types, fn, data, selector ); }); }, one: function( types, selector, data, fn ) { return this.on.call( this, types, selector, data, fn, 1 ); }, off: function( types, selector, fn ) { if ( types && types.preventDefault ) { // ( event ) native or jQuery.Event return this.off( types.type, types.handler, types.selector ); } if ( typeof types === "object" ) { // ( types-object [, selector] ) for ( var type in types ) { this.off( type, selector, types[ type ] ); } return this; } if ( selector === false || typeof selector === "function" ) { // ( types [, fn] ) fn = selector; selector = undefined; } if ( fn === false ) { fn = returnFalse; } return this.each(function() { jQuery.event.remove( this, types, fn, selector ); }); }, bind: function( types, data, fn ) { return this.on( types, null, data, fn ); }, unbind: function( types, fn ) { return this.off( types, null, fn ); }, live: function( types, data, fn ) { jQuery( this.context ).on( types, this.selector, data, fn ); return this; }, die: function( types, fn ) { jQuery( this.context ).off( types, this.selector || "**", fn ); return this; }, delegate: function( selector, types, data, fn ) { return this.on( types, selector, data, fn ); }, undelegate: function( selector, types, fn ) { // ( namespace ) or ( selector, types [, fn] ) return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn ); }, trigger: function( type, data ) { return this.each(function() { jQuery.event.trigger( type, data, this ); }); }, triggerHandler: function( type, data ) { if ( this[0] ) { return jQuery.event.trigger( type, data, this[0], true ); } }, toggle: function( fn ) { // Save reference to arguments for access in closure var args = arguments, guid = fn.guid || jQuery.guid++, i = 0, toggler = function( event ) { // Figure out which function to execute var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); // Make sure that clicks stop event.preventDefault(); // and execute the function return args[ lastToggle ].apply( this, arguments ) || false; }; // link all the functions, so any of them can unbind this click handler toggler.guid = guid; while ( i < args.length ) { args[ i++ ].guid = guid; } return this.click( toggler ); }, hover: function( fnOver, fnOut ) { return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); } }); jQuery.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( i, name ) { // Handle event binding jQuery.fn[ name ] = function( data, fn ) { if ( fn == null ) { fn = data; data = null; } return arguments.length > 0 ? this.bind( name, data, fn ) : this.trigger( name ); }; if ( jQuery.attrFn ) { jQuery.attrFn[ name ] = true; } if ( rkeyEvent.test( name ) ) { jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; } if ( rmouseEvent.test( name ) ) { jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; } }); /*! * Sizzle CSS Selector Engine * Copyright 2011, The Dojo Foundation * Released under the MIT, BSD, and GPL Licenses. * More information: http://sizzlejs.com/ */ (function(){ var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, expando = "sizcache" + (Math.random() + '').replace('.', ''), done = 0, toString = Object.prototype.toString, hasDuplicate = false, baseHasDuplicate = true, rBackslash = /\\/g, rReturn = /\r\n/g, rNonWord = /\W/; // Here we check if the JavaScript engine is using some sort of // optimization where it does not always call our comparision // function. If that is the case, discard the hasDuplicate value. // Thus far that includes Google Chrome. [0, 0].sort(function() { baseHasDuplicate = false; return 0; }); var Sizzle = function( selector, context, results, seed ) { results = results || []; context = context || document; var origContext = context; if ( context.nodeType !== 1 && context.nodeType !== 9 ) { return []; } if ( !selector || typeof selector !== "string" ) { return results; } var m, set, checkSet, extra, ret, cur, pop, i, prune = true, contextXML = Sizzle.isXML( context ), parts = [], soFar = selector; // Reset the position of the chunker regexp (start from head) do { chunker.exec( "" ); m = chunker.exec( soFar ); if ( m ) { soFar = m[3]; parts.push( m[1] ); if ( m[2] ) { extra = m[3]; break; } } } while ( m ); if ( parts.length > 1 && origPOS.exec( selector ) ) { if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { set = posProcess( parts[0] + parts[1], context, seed ); } else { set = Expr.relative[ parts[0] ] ? [ context ] : Sizzle( parts.shift(), context ); while ( parts.length ) { selector = parts.shift(); if ( Expr.relative[ selector ] ) { selector += parts.shift(); } set = posProcess( selector, set, seed ); } } } else { // Take a shortcut and set the context if the root selector is an ID // (but not if it'll be faster if the inner selector is an ID) if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { ret = Sizzle.find( parts.shift(), context, contextXML ); context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0]; } if ( context ) { ret = seed ? { expr: parts.pop(), set: makeArray(seed) } : Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set; if ( parts.length > 0 ) { checkSet = makeArray( set ); } else { prune = false; } while ( parts.length ) { cur = parts.pop(); pop = cur; if ( !Expr.relative[ cur ] ) { cur = ""; } else { pop = parts.pop(); } if ( pop == null ) { pop = context; } Expr.relative[ cur ]( checkSet, pop, contextXML ); } } else { checkSet = parts = []; } } if ( !checkSet ) { checkSet = set; } if ( !checkSet ) { Sizzle.error( cur || selector ); } if ( toString.call(checkSet) === "[object Array]" ) { if ( !prune ) { results.push.apply( results, checkSet ); } else if ( context && context.nodeType === 1 ) { for ( i = 0; checkSet[i] != null; i++ ) { if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { results.push( set[i] ); } } } else { for ( i = 0; checkSet[i] != null; i++ ) { if ( checkSet[i] && checkSet[i].nodeType === 1 ) { results.push( set[i] ); } } } } else { makeArray( checkSet, results ); } if ( extra ) { Sizzle( extra, origContext, results, seed ); Sizzle.uniqueSort( results ); } return results; }; Sizzle.uniqueSort = function( results ) { if ( sortOrder ) { hasDuplicate = baseHasDuplicate; results.sort( sortOrder ); if ( hasDuplicate ) { for ( var i = 1; i < results.length; i++ ) { if ( results[i] === results[ i - 1 ] ) { results.splice( i--, 1 ); } } } } return results; }; Sizzle.matches = function( expr, set ) { return Sizzle( expr, null, null, set ); }; Sizzle.matchesSelector = function( node, expr ) { return Sizzle( expr, null, null, [node] ).length > 0; }; Sizzle.find = function( expr, context, isXML ) { var set, i, len, match, type, left; if ( !expr ) { return []; } for ( i = 0, len = Expr.order.length; i < len; i++ ) { type = Expr.order[i]; if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { left = match[1]; match.splice( 1, 1 ); if ( left.substr( left.length - 1 ) !== "\\" ) { match[1] = (match[1] || "").replace( rBackslash, "" ); set = Expr.find[ type ]( match, context, isXML ); if ( set != null ) { expr = expr.replace( Expr.match[ type ], "" ); break; } } } } if ( !set ) { set = typeof context.getElementsByTagName !== "undefined" ? context.getElementsByTagName( "*" ) : []; } return { set: set, expr: expr }; }; Sizzle.filter = function( expr, set, inplace, not ) { var match, anyFound, type, found, item, filter, left, i, pass, old = expr, result = [], curLoop = set, isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); while ( expr && set.length ) { for ( type in Expr.filter ) { if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { filter = Expr.filter[ type ]; left = match[1]; anyFound = false; match.splice(1,1); if ( left.substr( left.length - 1 ) === "\\" ) { continue; } if ( curLoop === result ) { result = []; } if ( Expr.preFilter[ type ] ) { match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); if ( !match ) { anyFound = found = true; } else if ( match === true ) { continue; } } if ( match ) { for ( i = 0; (item = curLoop[i]) != null; i++ ) { if ( item ) { found = filter( item, match, i, curLoop ); pass = not ^ found; if ( inplace && found != null ) { if ( pass ) { anyFound = true; } else { curLoop[i] = false; } } else if ( pass ) { result.push( item ); anyFound = true; } } } } if ( found !== undefined ) { if ( !inplace ) { curLoop = result; } expr = expr.replace( Expr.match[ type ], "" ); if ( !anyFound ) { return []; } break; } } } // Improper expression if ( expr === old ) { if ( anyFound == null ) { Sizzle.error( expr ); } else { break; } } old = expr; } return curLoop; }; Sizzle.error = function( msg ) { throw "Syntax error, unrecognized expression: " + msg; }; /** * Utility function for retreiving the text value of an array of DOM nodes * @param {Array|Element} elem */ var getText = Sizzle.getText = function( elem ) { var i, node, nodeType = elem.nodeType, ret = ""; if ( nodeType ) { if ( nodeType === 1 ) { // Use textContent || innerText for elements if ( typeof elem.textContent === 'string' ) { return elem.textContent; } else if ( typeof elem.innerText === 'string' ) { // Replace IE's carriage returns return elem.innerText.replace( rReturn, '' ); } else { // Traverse it's children for ( elem = elem.firstChild; elem; elem = elem.nextSibling) { ret += getText( elem ); } } } else if ( nodeType === 3 || nodeType === 4 ) { return elem.nodeValue; } } else { // If no nodeType, this is expected to be an array for ( i = 0; (node = elem[i]); i++ ) { // Do not traverse comment nodes if ( node.nodeType !== 8 ) { ret += getText( node ); } } } return ret; }; var Expr = Sizzle.selectors = { order: [ "ID", "NAME", "TAG" ], match: { ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ }, leftMatch: {}, attrMap: { "class": "className", "for": "htmlFor" }, attrHandle: { href: function( elem ) { return elem.getAttribute( "href" ); }, type: function( elem ) { return elem.getAttribute( "type" ); } }, relative: { "+": function(checkSet, part){ var isPartStr = typeof part === "string", isTag = isPartStr && !rNonWord.test( part ), isPartStrNotTag = isPartStr && !isTag; if ( isTag ) { part = part.toLowerCase(); } for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { if ( (elem = checkSet[i]) ) { while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? elem || false : elem === part; } } if ( isPartStrNotTag ) { Sizzle.filter( part, checkSet, true ); } }, ">": function( checkSet, part ) { var elem, isPartStr = typeof part === "string", i = 0, l = checkSet.length; if ( isPartStr && !rNonWord.test( part ) ) { part = part.toLowerCase(); for ( ; i < l; i++ ) { elem = checkSet[i]; if ( elem ) { var parent = elem.parentNode; checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; } } } else { for ( ; i < l; i++ ) { elem = checkSet[i]; if ( elem ) { checkSet[i] = isPartStr ? elem.parentNode : elem.parentNode === part; } } if ( isPartStr ) { Sizzle.filter( part, checkSet, true ); } } }, "": function(checkSet, part, isXML){ var nodeCheck, doneName = done++, checkFn = dirCheck; if ( typeof part === "string" && !rNonWord.test( part ) ) { part = part.toLowerCase(); nodeCheck = part; checkFn = dirNodeCheck; } checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); }, "~": function( checkSet, part, isXML ) { var nodeCheck, doneName = done++, checkFn = dirCheck; if ( typeof part === "string" && !rNonWord.test( part ) ) { part = part.toLowerCase(); nodeCheck = part; checkFn = dirNodeCheck; } checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML ); } }, find: { ID: function( match, context, isXML ) { if ( typeof context.getElementById !== "undefined" && !isXML ) { var m = context.getElementById(match[1]); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 return m && m.parentNode ? [m] : []; } }, NAME: function( match, context ) { if ( typeof context.getElementsByName !== "undefined" ) { var ret = [], results = context.getElementsByName( match[1] ); for ( var i = 0, l = results.length; i < l; i++ ) { if ( results[i].getAttribute("name") === match[1] ) { ret.push( results[i] ); } } return ret.length === 0 ? null : ret; } }, TAG: function( match, context ) { if ( typeof context.getElementsByTagName !== "undefined" ) { return context.getElementsByTagName( match[1] ); } } }, preFilter: { CLASS: function( match, curLoop, inplace, result, not, isXML ) { match = " " + match[1].replace( rBackslash, "" ) + " "; if ( isXML ) { return match; } for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { if ( elem ) { if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) { if ( !inplace ) { result.push( elem ); } } else if ( inplace ) { curLoop[i] = false; } } } return false; }, ID: function( match ) { return match[1].replace( rBackslash, "" ); }, TAG: function( match, curLoop ) { return match[1].replace( rBackslash, "" ).toLowerCase(); }, CHILD: function( match ) { if ( match[1] === "nth" ) { if ( !match[2] ) { Sizzle.error( match[0] ); } match[2] = match[2].replace(/^\+|\s*/g, ''); // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); // calculate the numbers (first)n+(last) including if they are negative match[2] = (test[1] + (test[2] || 1)) - 0; match[3] = test[3] - 0; } else if ( match[2] ) { Sizzle.error( match[0] ); } // TODO: Move to normal caching system match[0] = done++; return match; }, ATTR: function( match, curLoop, inplace, result, not, isXML ) { var name = match[1] = match[1].replace( rBackslash, "" ); if ( !isXML && Expr.attrMap[name] ) { match[1] = Expr.attrMap[name]; } // Handle if an un-quoted value was used match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" ); if ( match[2] === "~=" ) { match[4] = " " + match[4] + " "; } return match; }, PSEUDO: function( match, curLoop, inplace, result, not ) { if ( match[1] === "not" ) { // If we're dealing with a complex expression, or a simple one if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { match[3] = Sizzle(match[3], null, null, curLoop); } else { var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); if ( !inplace ) { result.push.apply( result, ret ); } return false; } } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { return true; } return match; }, POS: function( match ) { match.unshift( true ); return match; } }, filters: { enabled: function( elem ) { return elem.disabled === false && elem.type !== "hidden"; }, disabled: function( elem ) { return elem.disabled === true; }, checked: function( elem ) { return elem.checked === true; }, selected: function( elem ) { // Accessing this property makes selected-by-default // options in Safari work properly if ( elem.parentNode ) { elem.parentNode.selectedIndex; } return elem.selected === true; }, parent: function( elem ) { return !!elem.firstChild; }, empty: function( elem ) { return !elem.firstChild; }, has: function( elem, i, match ) { return !!Sizzle( match[3], elem ).length; }, header: function( elem ) { return (/h\d/i).test( elem.nodeName ); }, text: function( elem ) { var attr = elem.getAttribute( "type" ), type = elem.type; // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) // use getAttribute instead to test this case return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); }, radio: function( elem ) { return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; }, checkbox: function( elem ) { return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type; }, file: function( elem ) { return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; }, password: function( elem ) { return elem.nodeName.toLowerCase() === "input" && "password" === elem.type; }, submit: function( elem ) { var name = elem.nodeName.toLowerCase(); return (name === "input" || name === "button") && "submit" === elem.type; }, image: function( elem ) { return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; }, reset: function( elem ) { var name = elem.nodeName.toLowerCase(); return (name === "input" || name === "button") && "reset" === elem.type; }, button: function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && "button" === elem.type || name === "button"; }, input: function( elem ) { return (/input|select|textarea|button/i).test( elem.nodeName ); }, focus: function( elem ) { return elem === elem.ownerDocument.activeElement; } }, setFilters: { first: function( elem, i ) { return i === 0; }, last: function( elem, i, match, array ) { return i === array.length - 1; }, even: function( elem, i ) { return i % 2 === 0; }, odd: function( elem, i ) { return i % 2 === 1; }, lt: function( elem, i, match ) { return i < match[3] - 0; }, gt: function( elem, i, match ) { return i > match[3] - 0; }, nth: function( elem, i, match ) { return match[3] - 0 === i; }, eq: function( elem, i, match ) { return match[3] - 0 === i; } }, filter: { PSEUDO: function( elem, match, i, array ) { var name = match[1], filter = Expr.filters[ name ]; if ( filter ) { return filter( elem, i, match, array ); } else if ( name === "contains" ) { return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; } else if ( name === "not" ) { var not = match[3]; for ( var j = 0, l = not.length; j < l; j++ ) { if ( not[j] === elem ) { return false; } } return true; } else { Sizzle.error( name ); } }, CHILD: function( elem, match ) { var first, last, doneName, parent, cache, count, diff, type = match[1], node = elem; switch ( type ) { case "only": case "first": while ( (node = node.previousSibling) ) { if ( node.nodeType === 1 ) { return false; } } if ( type === "first" ) { return true; } node = elem; case "last": while ( (node = node.nextSibling) ) { if ( node.nodeType === 1 ) { return false; } } return true; case "nth": first = match[2]; last = match[3]; if ( first === 1 && last === 0 ) { return true; } doneName = match[0]; parent = elem.parentNode; if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) { count = 0; for ( node = parent.firstChild; node; node = node.nextSibling ) { if ( node.nodeType === 1 ) { node.nodeIndex = ++count; } } parent[ expando ] = doneName; } diff = elem.nodeIndex - last; if ( first === 0 ) { return diff === 0; } else { return ( diff % first === 0 && diff / first >= 0 ); } } }, ID: function( elem, match ) { return elem.nodeType === 1 && elem.getAttribute("id") === match; }, TAG: function( elem, match ) { return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match; }, CLASS: function( elem, match ) { return (" " + (elem.className || elem.getAttribute("class")) + " ") .indexOf( match ) > -1; }, ATTR: function( elem, match ) { var name = match[1], result = Sizzle.attr ? Sizzle.attr( elem, name ) : Expr.attrHandle[ name ] ? Expr.attrHandle[ name ]( elem ) : elem[ name ] != null ? elem[ name ] : elem.getAttribute( name ), value = result + "", type = match[2], check = match[4]; return result == null ? type === "!=" : !type && Sizzle.attr ? result != null : type === "=" ? value === check : type === "*=" ? value.indexOf(check) >= 0 : type === "~=" ? (" " + value + " ").indexOf(check) >= 0 : !check ? value && result !== false : type === "!=" ? value !== check : type === "^=" ? value.indexOf(check) === 0 : type === "$=" ? value.substr(value.length - check.length) === check : type === "|=" ? value === check || value.substr(0, check.length + 1) === check + "-" : false; }, POS: function( elem, match, i, array ) { var name = match[2], filter = Expr.setFilters[ name ]; if ( filter ) { return filter( elem, i, match, array ); } } } }; var origPOS = Expr.match.POS, fescape = function(all, num){ return "\\" + (num - 0 + 1); }; for ( var type in Expr.match ) { Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); } var makeArray = function( array, results ) { array = Array.prototype.slice.call( array, 0 ); if ( results ) { results.push.apply( results, array ); return results; } return array; }; // Perform a simple check to determine if the browser is capable of // converting a NodeList to an array using builtin methods. // Also verifies that the returned array holds DOM nodes // (which is not the case in the Blackberry browser) try { Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; // Provide a fallback method if it does not work } catch( e ) { makeArray = function( array, results ) { var i = 0, ret = results || []; if ( toString.call(array) === "[object Array]" ) { Array.prototype.push.apply( ret, array ); } else { if ( typeof array.length === "number" ) { for ( var l = array.length; i < l; i++ ) { ret.push( array[i] ); } } else { for ( ; array[i]; i++ ) { ret.push( array[i] ); } } } return ret; }; } var sortOrder, siblingCheck; if ( document.documentElement.compareDocumentPosition ) { sortOrder = function( a, b ) { if ( a === b ) { hasDuplicate = true; return 0; } if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { return a.compareDocumentPosition ? -1 : 1; } return a.compareDocumentPosition(b) & 4 ? -1 : 1; }; } else { sortOrder = function( a, b ) { // The nodes are identical, we can exit early if ( a === b ) { hasDuplicate = true; return 0; // Fallback to using sourceIndex (in IE) if it's available on both nodes } else if ( a.sourceIndex && b.sourceIndex ) { return a.sourceIndex - b.sourceIndex; } var al, bl, ap = [], bp = [], aup = a.parentNode, bup = b.parentNode, cur = aup; // If the nodes are siblings (or identical) we can do a quick check if ( aup === bup ) { return siblingCheck( a, b ); // If no parents were found then the nodes are disconnected } else if ( !aup ) { return -1; } else if ( !bup ) { return 1; } // Otherwise they're somewhere else in the tree so we need // to build up a full list of the parentNodes for comparison while ( cur ) { ap.unshift( cur ); cur = cur.parentNode; } cur = bup; while ( cur ) { bp.unshift( cur ); cur = cur.parentNode; } al = ap.length; bl = bp.length; // Start walking down the tree looking for a discrepancy for ( var i = 0; i < al && i < bl; i++ ) { if ( ap[i] !== bp[i] ) { return siblingCheck( ap[i], bp[i] ); } } // We ended someplace up the tree so do a sibling check return i === al ? siblingCheck( a, bp[i], -1 ) : siblingCheck( ap[i], b, 1 ); }; siblingCheck = function( a, b, ret ) { if ( a === b ) { return ret; } var cur = a.nextSibling; while ( cur ) { if ( cur === b ) { return -1; } cur = cur.nextSibling; } return 1; }; } // Check to see if the browser returns elements by name when // querying by getElementById (and provide a workaround) (function(){ // We're going to inject a fake input element with a specified name var form = document.createElement("div"), id = "script" + (new Date()).getTime(), root = document.documentElement; form.innerHTML = ""; // Inject it into the root element, check its status, and remove it quickly root.insertBefore( form, root.firstChild ); // The workaround has to do additional checks after a getElementById // Which slows things down for other browsers (hence the branching) if ( document.getElementById( id ) ) { Expr.find.ID = function( match, context, isXML ) { if ( typeof context.getElementById !== "undefined" && !isXML ) { var m = context.getElementById(match[1]); return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : []; } }; Expr.filter.ID = function( elem, match ) { var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); return elem.nodeType === 1 && node && node.nodeValue === match; }; } root.removeChild( form ); // release memory in IE root = form = null; })(); (function(){ // Check to see if the browser returns only elements // when doing getElementsByTagName("*") // Create a fake element var div = document.createElement("div"); div.appendChild( document.createComment("") ); // Make sure no comments are found if ( div.getElementsByTagName("*").length > 0 ) { Expr.find.TAG = function( match, context ) { var results = context.getElementsByTagName( match[1] ); // Filter out possible comments if ( match[1] === "*" ) { var tmp = []; for ( var i = 0; results[i]; i++ ) { if ( results[i].nodeType === 1 ) { tmp.push( results[i] ); } } results = tmp; } return results; }; } // Check to see if an attribute returns normalized href attributes div.innerHTML = ""; if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && div.firstChild.getAttribute("href") !== "#" ) { Expr.attrHandle.href = function( elem ) { return elem.getAttribute( "href", 2 ); }; } // release memory in IE div = null; })(); if ( document.querySelectorAll ) { (function(){ var oldSizzle = Sizzle, div = document.createElement("div"), id = "__sizzle__"; div.innerHTML = "

      "; // Safari can't handle uppercase or unicode characters when // in quirks mode. if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { return; } Sizzle = function( query, context, extra, seed ) { context = context || document; // Only use querySelectorAll on non-XML documents // (ID selectors don't work in non-HTML documents) if ( !seed && !Sizzle.isXML(context) ) { // See if we find a selector to speed up var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { // Speed-up: Sizzle("TAG") if ( match[1] ) { return makeArray( context.getElementsByTagName( query ), extra ); // Speed-up: Sizzle(".CLASS") } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { return makeArray( context.getElementsByClassName( match[2] ), extra ); } } if ( context.nodeType === 9 ) { // Speed-up: Sizzle("body") // The body element only exists once, optimize finding it if ( query === "body" && context.body ) { return makeArray( [ context.body ], extra ); // Speed-up: Sizzle("#ID") } else if ( match && match[3] ) { var elem = context.getElementById( match[3] ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 if ( elem && elem.parentNode ) { // Handle the case where IE and Opera return items // by name instead of ID if ( elem.id === match[3] ) { return makeArray( [ elem ], extra ); } } else { return makeArray( [], extra ); } } try { return makeArray( context.querySelectorAll(query), extra ); } catch(qsaError) {} // qSA works strangely on Element-rooted queries // We can work around this by specifying an extra ID on the root // and working up from there (Thanks to Andrew Dupont for the technique) // IE 8 doesn't work on object elements } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { var oldContext = context, old = context.getAttribute( "id" ), nid = old || id, hasParent = context.parentNode, relativeHierarchySelector = /^\s*[+~]/.test( query ); if ( !old ) { context.setAttribute( "id", nid ); } else { nid = nid.replace( /'/g, "\\$&" ); } if ( relativeHierarchySelector && hasParent ) { context = context.parentNode; } try { if ( !relativeHierarchySelector || hasParent ) { return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ); } } catch(pseudoError) { } finally { if ( !old ) { oldContext.removeAttribute( "id" ); } } } } return oldSizzle(query, context, extra, seed); }; for ( var prop in oldSizzle ) { Sizzle[ prop ] = oldSizzle[ prop ]; } // release memory in IE div = null; })(); } (function(){ var html = document.documentElement, matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector; if ( matches ) { // Check to see if it's possible to do matchesSelector // on a disconnected node (IE 9 fails this) var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ), pseudoWorks = false; try { // This should fail with an exception // Gecko does not error, returns false instead matches.call( document.documentElement, "[test!='']:sizzle" ); } catch( pseudoError ) { pseudoWorks = true; } Sizzle.matchesSelector = function( node, expr ) { // Make sure that attribute selectors are quoted expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); if ( !Sizzle.isXML( node ) ) { try { if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { var ret = matches.call( node, expr ); // IE 9's matchesSelector returns false on disconnected nodes if ( ret || !disconnectedMatch || // As well, disconnected nodes are said to be in a document // fragment in IE 9, so check for that node.document && node.document.nodeType !== 11 ) { return ret; } } } catch(e) {} } return Sizzle(expr, null, null, [node]).length > 0; }; } })(); (function(){ var div = document.createElement("div"); div.innerHTML = "
      "; // Opera can't find a second classname (in 9.6) // Also, make sure that getElementsByClassName actually exists if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { return; } // Safari caches class attributes, doesn't catch changes (in 3.2) div.lastChild.className = "e"; if ( div.getElementsByClassName("e").length === 1 ) { return; } Expr.order.splice(1, 0, "CLASS"); Expr.find.CLASS = function( match, context, isXML ) { if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { return context.getElementsByClassName(match[1]); } }; // release memory in IE div = null; })(); function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { for ( var i = 0, l = checkSet.length; i < l; i++ ) { var elem = checkSet[i]; if ( elem ) { var match = false; elem = elem[dir]; while ( elem ) { if ( elem[ expando ] === doneName ) { match = checkSet[elem.sizset]; break; } if ( elem.nodeType === 1 && !isXML ){ elem[ expando ] = doneName; elem.sizset = i; } if ( elem.nodeName.toLowerCase() === cur ) { match = elem; break; } elem = elem[dir]; } checkSet[i] = match; } } } function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { for ( var i = 0, l = checkSet.length; i < l; i++ ) { var elem = checkSet[i]; if ( elem ) { var match = false; elem = elem[dir]; while ( elem ) { if ( elem[ expando ] === doneName ) { match = checkSet[elem.sizset]; break; } if ( elem.nodeType === 1 ) { if ( !isXML ) { elem[ expando ] = doneName; elem.sizset = i; } if ( typeof cur !== "string" ) { if ( elem === cur ) { match = true; break; } } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { match = elem; break; } } elem = elem[dir]; } checkSet[i] = match; } } } if ( document.documentElement.contains ) { Sizzle.contains = function( a, b ) { return a !== b && (a.contains ? a.contains(b) : true); }; } else if ( document.documentElement.compareDocumentPosition ) { Sizzle.contains = function( a, b ) { return !!(a.compareDocumentPosition(b) & 16); }; } else { Sizzle.contains = function() { return false; }; } Sizzle.isXML = function( elem ) { // documentElement is verified for cases where it doesn't yet exist // (such as loading iframes in IE - #4833) var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; return documentElement ? documentElement.nodeName !== "HTML" : false; }; var posProcess = function( selector, context, seed ) { var match, tmpSet = [], later = "", root = context.nodeType ? [context] : context; // Position selectors must be done after the filter // And so must :not(positional) so we move all PSEUDOs to the end while ( (match = Expr.match.PSEUDO.exec( selector )) ) { later += match[0]; selector = selector.replace( Expr.match.PSEUDO, "" ); } selector = Expr.relative[selector] ? selector + "*" : selector; for ( var i = 0, l = root.length; i < l; i++ ) { Sizzle( selector, root[i], tmpSet, seed ); } return Sizzle.filter( later, tmpSet ); }; // EXPOSE // Override sizzle attribute retrieval Sizzle.attr = jQuery.attr; Sizzle.selectors.attrMap = {}; jQuery.find = Sizzle; jQuery.expr = Sizzle.selectors; jQuery.expr[":"] = jQuery.expr.filters; jQuery.unique = Sizzle.uniqueSort; jQuery.text = Sizzle.getText; jQuery.isXMLDoc = Sizzle.isXML; jQuery.contains = Sizzle.contains; })(); var runtil = /Until$/, rparentsprev = /^(?:parents|prevUntil|prevAll)/, // Note: This RegExp should be improved, or likely pulled from Sizzle rmultiselector = /,/, isSimple = /^.[^:#\[\.,]*$/, slice = Array.prototype.slice, POS = jQuery.expr.match.POS, // methods guaranteed to produce a unique set when starting from a unique set guaranteedUnique = { children: true, contents: true, next: true, prev: true }; jQuery.fn.extend({ find: function( selector ) { var self = this, i, l; if ( typeof selector !== "string" ) { return jQuery( selector ).filter(function() { for ( i = 0, l = self.length; i < l; i++ ) { if ( jQuery.contains( self[ i ], this ) ) { return true; } } }); } var ret = this.pushStack( "", "find", selector ), length, n, r; for ( i = 0, l = this.length; i < l; i++ ) { length = ret.length; jQuery.find( selector, this[i], ret ); if ( i > 0 ) { // Make sure that the results are unique for ( n = length; n < ret.length; n++ ) { for ( r = 0; r < length; r++ ) { if ( ret[r] === ret[n] ) { ret.splice(n--, 1); break; } } } } } return ret; }, has: function( target ) { var targets = jQuery( target ); return this.filter(function() { for ( var i = 0, l = targets.length; i < l; i++ ) { if ( jQuery.contains( this, targets[i] ) ) { return true; } } }); }, not: function( selector ) { return this.pushStack( winnow(this, selector, false), "not", selector); }, filter: function( selector ) { return this.pushStack( winnow(this, selector, true), "filter", selector ); }, is: function( selector ) { return !!selector && ( typeof selector === "string" ? // If this is a positional selector, check membership in the returned set // so $("p:first").is("p:last") won't return true for a doc with two "p". POS.test( selector ) ? jQuery( selector, this.context ).index( this[0] ) >= 0 : jQuery.filter( selector, this ).length > 0 : this.filter( selector ).length > 0 ); }, closest: function( selectors, context ) { var ret = [], i, l, cur = this[0]; // Array (deprecated as of jQuery 1.7) if ( jQuery.isArray( selectors ) ) { var level = 1; while ( cur && cur.ownerDocument && cur !== context ) { for ( i = 0; i < selectors.length; i++ ) { if ( jQuery( cur ).is( selectors[ i ] ) ) { ret.push({ selector: selectors[ i ], elem: cur, level: level }); } } cur = cur.parentNode; level++; } return ret; } // String var pos = POS.test( selectors ) || typeof selectors !== "string" ? jQuery( selectors, context || this.context ) : 0; for ( i = 0, l = this.length; i < l; i++ ) { cur = this[i]; while ( cur ) { if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { ret.push( cur ); break; } else { cur = cur.parentNode; if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) { break; } } } } ret = ret.length > 1 ? jQuery.unique( ret ) : ret; return this.pushStack( ret, "closest", selectors ); }, // Determine the position of an element within // the matched set of elements index: function( elem ) { // No argument, return index in parent if ( !elem ) { return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; } // index in selector if ( typeof elem === "string" ) { return jQuery.inArray( this[0], jQuery( elem ) ); } // Locate the position of the desired element return jQuery.inArray( // If it receives a jQuery object, the first element is used elem.jquery ? elem[0] : elem, this ); }, add: function( selector, context ) { var set = typeof selector === "string" ? jQuery( selector, context ) : jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), all = jQuery.merge( this.get(), set ); return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? all : jQuery.unique( all ) ); }, andSelf: function() { return this.add( this.prevObject ); } }); // A painfully simple check to see if an element is disconnected // from a document (should be improved, where feasible). function isDisconnected( node ) { return !node || !node.parentNode || node.parentNode.nodeType === 11; } jQuery.each({ parent: function( elem ) { var parent = elem.parentNode; return parent && parent.nodeType !== 11 ? parent : null; }, parents: function( elem ) { return jQuery.dir( elem, "parentNode" ); }, parentsUntil: function( elem, i, until ) { return jQuery.dir( elem, "parentNode", until ); }, next: function( elem ) { return jQuery.nth( elem, 2, "nextSibling" ); }, prev: function( elem ) { return jQuery.nth( elem, 2, "previousSibling" ); }, nextAll: function( elem ) { return jQuery.dir( elem, "nextSibling" ); }, prevAll: function( elem ) { return jQuery.dir( elem, "previousSibling" ); }, nextUntil: function( elem, i, until ) { return jQuery.dir( elem, "nextSibling", until ); }, prevUntil: function( elem, i, until ) { return jQuery.dir( elem, "previousSibling", until ); }, siblings: function( elem ) { return jQuery.sibling( elem.parentNode.firstChild, elem ); }, children: function( elem ) { return jQuery.sibling( elem.firstChild ); }, contents: function( elem ) { return jQuery.nodeName( elem, "iframe" ) ? elem.contentDocument || elem.contentWindow.document : jQuery.makeArray( elem.childNodes ); } }, function( name, fn ) { jQuery.fn[ name ] = function( until, selector ) { var ret = jQuery.map( this, fn, until ), // The variable 'args' was introduced in // https://github.com/jquery/jquery/commit/52a0238 // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed. // http://code.google.com/p/v8/issues/detail?id=1050 args = slice.call(arguments); if ( !runtil.test( name ) ) { selector = until; } if ( selector && typeof selector === "string" ) { ret = jQuery.filter( selector, ret ); } ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { ret = ret.reverse(); } return this.pushStack( ret, name, args.join(",") ); }; }); jQuery.extend({ filter: function( expr, elems, not ) { if ( not ) { expr = ":not(" + expr + ")"; } return elems.length === 1 ? jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : jQuery.find.matches(expr, elems); }, dir: function( elem, dir, until ) { var matched = [], cur = elem[ dir ]; while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { if ( cur.nodeType === 1 ) { matched.push( cur ); } cur = cur[dir]; } return matched; }, nth: function( cur, result, dir, elem ) { result = result || 1; var num = 0; for ( ; cur; cur = cur[dir] ) { if ( cur.nodeType === 1 && ++num === result ) { break; } } return cur; }, sibling: function( n, elem ) { var r = []; for ( ; n; n = n.nextSibling ) { if ( n.nodeType === 1 && n !== elem ) { r.push( n ); } } return r; } }); // Implement the identical functionality for filter and not function winnow( elements, qualifier, keep ) { // Can't pass null or undefined to indexOf in Firefox 4 // Set to 0 to skip string check qualifier = qualifier || 0; if ( jQuery.isFunction( qualifier ) ) { return jQuery.grep(elements, function( elem, i ) { var retVal = !!qualifier.call( elem, i, elem ); return retVal === keep; }); } else if ( qualifier.nodeType ) { return jQuery.grep(elements, function( elem, i ) { return (elem === qualifier) === keep; }); } else if ( typeof qualifier === "string" ) { var filtered = jQuery.grep(elements, function( elem ) { return elem.nodeType === 1; }); if ( isSimple.test( qualifier ) ) { return jQuery.filter(qualifier, filtered, !keep); } else { qualifier = jQuery.filter( qualifier, filtered ); } } return jQuery.grep(elements, function( elem, i ) { return (jQuery.inArray( elem, qualifier ) >= 0) === keep; }); } function createSafeFragment( document ) { var nodeNames = ( "abbr article aside audio canvas datalist details figcaption figure footer " + "header hgroup mark meter nav output progress section summary time video" ).split( " " ), safeFrag = document.createDocumentFragment(); if ( safeFrag.createElement ) { while ( nodeNames.length ) { safeFrag.createElement( nodeNames.pop() ); } } return safeFrag; } var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, rleadingWhitespace = /^\s+/, rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, rtagName = /<([\w:]+)/, rtbody = /", "" ], legend: [ 1, "
      ", "
      " ], thead: [ 1, "", "
      " ], tr: [ 2, "", "
      " ], td: [ 3, "", "
      " ], col: [ 2, "", "
      " ], area: [ 1, "", "" ], _default: [ 0, "", "" ] }, safeFragment = createSafeFragment( document ); wrapMap.optgroup = wrapMap.option; wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; wrapMap.th = wrapMap.td; // IE can't serialize and ``` Add the module as a dependency to your app ```js var app = angular.module('yourAwesomeApp', ['ngLodash']); ``` And inject it into your controller like so! ```js var YourCtrl = app.controller('yourController', function($scope, lodash) { lodash.assign({ 'a': 1 }, { 'b': 2 }, { 'c': 3 }); }); ``` ## Developing To help us develop this module, we are using Grunt some tasks that may be helpful for you to know about are: ### Testing This command will run JSHint and JSCS testing JS Files (note files within build) are not tested, it will also run your local build of the module with all of the Karma tests: ```grunt test``` it can also be run by using ```npm test``` ### Build This command will build the module, run it through ngMin and then create a minified version of the module, ready for distribution: ```grunt build``` ### Dist This command will build the module initially and then run the test suite. Testing with JSHint, JSCS and Karma: ```grunt dist``` ================================================ FILE: third_party/ui/bower_components/ng-lodash/bower.json ================================================ { "name": "ng-lodash", "version": "0.2.0", "description": "An Angular module wrapper for lodash", "author": ["Rockabox (http://www.rockabox.com)"], "license": "MIT", "keywords": [ "nglodash", "angular", "lodash" ], "ignore": [ "test", "*.", "karma.conf.js", "Gruntfile.js" ], "repository": { "type": "git", "url": "git://github.com/rockabox/ng-lodash.git" }, "main": [ "build/ng-lodash.js" ], "dependencies": { "angular": ">=1.2" }, "devDependencies": { "angular-mocks": ">=1.2" } } ================================================ FILE: third_party/ui/bower_components/ng-lodash/build/ng-lodash.js ================================================ /** * @license * lodash 3.1.0 (Custom Build) * Build: `lodash modern exports="amd,commonjs,node" iife="angular.module('ngLodash', []).constant('lodash', null).config(function ($provide) { %output% $provide.constant('lodash', _);});" --output build/ng-lodash.js` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.7.0 * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ angular.module('ngLodash', []).constant('lodash', null).config([ '$provide', function ($provide) { /** Used as a safe reference for `undefined` in pre-ES5 environments. */ var undefined; /** Used as the semantic version number. */ var VERSION = '3.1.0'; /** Used to compose bitmasks for wrapper metadata. */ var BIND_FLAG = 1, BIND_KEY_FLAG = 2, CURRY_BOUND_FLAG = 4, CURRY_FLAG = 8, CURRY_RIGHT_FLAG = 16, PARTIAL_FLAG = 32, PARTIAL_RIGHT_FLAG = 64, REARG_FLAG = 128, ARY_FLAG = 256; /** Used as default options for `_.trunc`. */ var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = '...'; /** Used to detect when a function becomes hot. */ var HOT_COUNT = 150, HOT_SPAN = 16; /** Used to indicate the type of lazy iteratees. */ var LAZY_FILTER_FLAG = 0, LAZY_MAP_FLAG = 1, LAZY_WHILE_FLAG = 2; /** Used as the `TypeError` message for "Functions" methods. */ var FUNC_ERROR_TEXT = 'Expected a function'; /** Used as the internal argument placeholder. */ var PLACEHOLDER = '__lodash_placeholder__'; /** `Object#toString` result references. */ var argsTag = '[object Arguments]', arrayTag = '[object Array]', boolTag = '[object Boolean]', dateTag = '[object Date]', errorTag = '[object Error]', funcTag = '[object Function]', mapTag = '[object Map]', numberTag = '[object Number]', objectTag = '[object Object]', regexpTag = '[object RegExp]', setTag = '[object Set]', stringTag = '[object String]', weakMapTag = '[object WeakMap]'; var arrayBufferTag = '[object ArrayBuffer]', float32Tag = '[object Float32Array]', float64Tag = '[object Float64Array]', int8Tag = '[object Int8Array]', int16Tag = '[object Int16Array]', int32Tag = '[object Int32Array]', uint8Tag = '[object Uint8Array]', uint8ClampedTag = '[object Uint8ClampedArray]', uint16Tag = '[object Uint16Array]', uint32Tag = '[object Uint32Array]'; /** Used to match empty string literals in compiled template source. */ var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; /** Used to match HTML entities and HTML characters. */ var reEscapedHtml = /&(?:amp|lt|gt|quot|#39|#96);/g, reUnescapedHtml = /[&<>"'`]/g, reHasEscapedHtml = RegExp(reEscapedHtml.source), reHasUnescapedHtml = RegExp(reUnescapedHtml.source); /** Used to match template delimiters. */ var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g; /** * Used to match ES template delimiters. * See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components) * for more details. */ var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; /** Used to match `RegExp` flags from their coerced string values. */ var reFlags = /\w*$/; /** Used to detect named functions. */ var reFuncName = /^\s*function[ \n\r\t]+\w/; /** Used to detect hexadecimal string values. */ var reHexPrefix = /^0[xX]/; /** Used to detect host constructors (Safari > 5). */ var reHostCtor = /^\[object .+?Constructor\]$/; /** Used to match latin-1 supplementary letters (excluding mathematical operators). */ var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g; /** Used to ensure capturing order of template delimiters. */ var reNoMatch = /($^)/; /** * Used to match `RegExp` special characters. * See this [article on `RegExp` characters](http://www.regular-expressions.info/characters.html#special) * for more details. */ var reRegExpChars = /[.*+?^${}()|[\]\/\\]/g, reHasRegExpChars = RegExp(reRegExpChars.source); /** Used to detect functions containing a `this` reference. */ var reThis = /\bthis\b/; /** Used to match unescaped characters in compiled string literals. */ var reUnescapedString = /['\n\r\u2028\u2029\\]/g; /** Used to match words to create compound words. */ var reWords = function () { var upper = '[A-Z\\xc0-\\xd6\\xd8-\\xde]', lower = '[a-z\\xdf-\\xf6\\xf8-\\xff]+'; return RegExp(upper + '{2,}(?=' + upper + lower + ')|' + upper + '?' + lower + '|' + upper + '+|[0-9]+', 'g'); }(); /** Used to detect and test for whitespace. */ var whitespace = ' \t\x0B\f\xa0\ufeff' + '\n\r\u2028\u2029' + '\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000'; /** Used to assign default `context` object properties. */ var contextProps = [ 'Array', 'ArrayBuffer', 'Date', 'Error', 'Float32Array', 'Float64Array', 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Math', 'Number', 'Object', 'RegExp', 'Set', 'String', '_', 'clearTimeout', 'document', 'isFinite', 'parseInt', 'setTimeout', 'TypeError', 'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', 'window', 'WinRTError' ]; /** Used to make template sourceURLs easier to identify. */ var templateCounter = -1; /** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {}; typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; /** Used to identify `toStringTag` values supported by `_.clone`. */ var cloneableTags = {}; cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[stringTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[mapTag] = cloneableTags[setTag] = cloneableTags[weakMapTag] = false; /** Used as an internal `_.debounce` options object by `_.throttle`. */ var debounceOptions = { 'leading': false, 'maxWait': 0, 'trailing': false }; /** Used to map latin-1 supplementary letters to basic latin letters. */ var deburredLetters = { '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', '\xc7': 'C', '\xe7': 'c', '\xd0': 'D', '\xf0': 'd', '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', '\xd1': 'N', '\xf1': 'n', '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', '\xc6': 'Ae', '\xe6': 'ae', '\xde': 'Th', '\xfe': 'th', '\xdf': 'ss' }; /** Used to map characters to HTML entities. */ var htmlEscapes = { '&': '&', '<': '<', '>': '>', '"': '"', '\'': ''', '`': '`' }; /** Used to map HTML entities to characters. */ var htmlUnescapes = { '&': '&', '<': '<', '>': '>', '"': '"', ''': '\'', '`': '`' }; /** Used to determine if values are of the language type `Object`. */ var objectTypes = { 'function': true, 'object': true }; /** Used to escape characters for inclusion in compiled string literals. */ var stringEscapes = { '\\': '\\', '\'': '\'', '\n': 'n', '\r': 'r', '\u2028': 'u2028', '\u2029': 'u2029' }; /** * Used as a reference to the global object. * * The `this` value is used if it is the global object to avoid Greasemonkey's * restricted `window` object, otherwise the `window` object is used. */ var root = objectTypes[typeof window] && window !== (this && this.window) ? window : this; /** Detect free variable `exports`. */ var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports; /** Detect free variable `module`. */ var freeModule = objectTypes[typeof module] && module && !module.nodeType && module; /** Detect free variable `global` from Node.js or Browserified code and use it as `root`. */ var freeGlobal = freeExports && freeModule && typeof global == 'object' && global; if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) { root = freeGlobal; } /** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = freeModule && freeModule.exports === freeExports && freeExports; /*--------------------------------------------------------------------------*/ /** * The base implementation of `compareAscending` which compares values and * sorts them in ascending order without guaranteeing a stable sort. * * @private * @param {*} value The value to compare to `other`. * @param {*} other The value to compare to `value`. * @returns {number} Returns the sort order indicator for `value`. */ function baseCompareAscending(value, other) { if (value !== other) { var valIsReflexive = value === value, othIsReflexive = other === other; if (value > other || !valIsReflexive || typeof value == 'undefined' && othIsReflexive) { return 1; } if (value < other || !othIsReflexive || typeof other == 'undefined' && valIsReflexive) { return -1; } } return 0; } /** * The base implementation of `_.indexOf` without support for binary searches. * * @private * @param {Array} array The array to search. * @param {*} value The value to search for. * @param {number} [fromIndex=0] The index to search from. * @returns {number} Returns the index of the matched value, else `-1`. */ function baseIndexOf(array, value, fromIndex) { if (value !== value) { return indexOfNaN(array, fromIndex); } var index = (fromIndex || 0) - 1, length = array.length; while (++index < length) { if (array[index] === value) { return index; } } return -1; } /** * The base implementation of `_.sortBy` and `_.sortByAll` which uses `comparer` * to define the sort order of `array` and replaces criteria objects with their * corresponding values. * * @private * @param {Array} array The array to sort. * @param {Function} comparer The function to define sort order. * @returns {Array} Returns `array`. */ function baseSortBy(array, comparer) { var length = array.length; array.sort(comparer); while (length--) { array[length] = array[length].value; } return array; } /** * Converts `value` to a string if it is not one. An empty string is returned * for `null` or `undefined` values. * * @private * @param {*} value The value to process. * @returns {string} Returns the string. */ function baseToString(value) { if (typeof value == 'string') { return value; } return value == null ? '' : value + ''; } /** * Used by `_.max` and `_.min` as the default callback for string values. * * @private * @param {string} string The string to inspect. * @returns {number} Returns the code unit of the first character of the string. */ function charAtCallback(string) { return string.charCodeAt(0); } /** * Used by `_.trim` and `_.trimLeft` to get the index of the first character * of `string` that is not found in `chars`. * * @private * @param {string} string The string to inspect. * @param {string} chars The characters to find. * @returns {number} Returns the index of the first character not found in `chars`. */ function charsLeftIndex(string, chars) { var index = -1, length = string.length; while (++index < length && chars.indexOf(string.charAt(index)) > -1) { } return index; } /** * Used by `_.trim` and `_.trimRight` to get the index of the last character * of `string` that is not found in `chars`. * * @private * @param {string} string The string to inspect. * @param {string} chars The characters to find. * @returns {number} Returns the index of the last character not found in `chars`. */ function charsRightIndex(string, chars) { var index = string.length; while (index-- && chars.indexOf(string.charAt(index)) > -1) { } return index; } /** * Used by `_.sortBy` to compare transformed elements of a collection and stable * sort them in ascending order. * * @private * @param {Object} object The object to compare to `other`. * @param {Object} other The object to compare to `object`. * @returns {number} Returns the sort order indicator for `object`. */ function compareAscending(object, other) { return baseCompareAscending(object.criteria, other.criteria) || object.index - other.index; } /** * Used by `_.sortByAll` to compare multiple properties of each element * in a collection and stable sort them in ascending order. * * @private * @param {Object} object The object to compare to `other`. * @param {Object} other The object to compare to `object`. * @returns {number} Returns the sort order indicator for `object`. */ function compareMultipleAscending(object, other) { var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length; while (++index < length) { var result = baseCompareAscending(objCriteria[index], othCriteria[index]); if (result) { return result; } } // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications // that causes it, under certain circumstances, to provide the same value for // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 // for more details. // // This also ensures a stable sort in V8 and other engines. // See https://code.google.com/p/v8/issues/detail?id=90 for more details. return object.index - other.index; } /** * Used by `_.deburr` to convert latin-1 supplementary letters to basic latin letters. * * @private * @param {string} letter The matched letter to deburr. * @returns {string} Returns the deburred letter. */ function deburrLetter(letter) { return deburredLetters[letter]; } /** * Used by `_.escape` to convert characters to HTML entities. * * @private * @param {string} chr The matched character to escape. * @returns {string} Returns the escaped character. */ function escapeHtmlChar(chr) { return htmlEscapes[chr]; } /** * Used by `_.template` to escape characters for inclusion in compiled * string literals. * * @private * @param {string} chr The matched character to escape. * @returns {string} Returns the escaped character. */ function escapeStringChar(chr) { return '\\' + stringEscapes[chr]; } /** * Gets the index at which the first occurrence of `NaN` is found in `array`. * If `fromRight` is provided elements of `array` are iterated from right to left. * * @private * @param {Array} array The array to search. * @param {number} [fromIndex] The index to search from. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {number} Returns the index of the matched `NaN`, else `-1`. */ function indexOfNaN(array, fromIndex, fromRight) { var length = array.length, index = fromRight ? fromIndex || length : (fromIndex || 0) - 1; while (fromRight ? index-- : ++index < length) { var other = array[index]; if (other !== other) { return index; } } return -1; } /** * Checks if `value` is object-like. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. */ function isObjectLike(value) { return value && typeof value == 'object' || false; } /** * Used by `trimmedLeftIndex` and `trimmedRightIndex` to determine if a * character code is whitespace. * * @private * @param {number} charCode The character code to inspect. * @returns {boolean} Returns `true` if `charCode` is whitespace, else `false`. */ function isSpace(charCode) { return charCode <= 160 && (charCode >= 9 && charCode <= 13) || charCode == 32 || charCode == 160 || charCode == 5760 || charCode == 6158 || charCode >= 8192 && (charCode <= 8202 || charCode == 8232 || charCode == 8233 || charCode == 8239 || charCode == 8287 || charCode == 12288 || charCode == 65279); } /** * Replaces all `placeholder` elements in `array` with an internal placeholder * and returns an array of their indexes. * * @private * @param {Array} array The array to modify. * @param {*} placeholder The placeholder to replace. * @returns {Array} Returns the new array of placeholder indexes. */ function replaceHolders(array, placeholder) { var index = -1, length = array.length, resIndex = -1, result = []; while (++index < length) { if (array[index] === placeholder) { array[index] = PLACEHOLDER; result[++resIndex] = index; } } return result; } /** * An implementation of `_.uniq` optimized for sorted arrays without support * for callback shorthands and `this` binding. * * @private * @param {Array} array The array to inspect. * @param {Function} [iteratee] The function invoked per iteration. * @returns {Array} Returns the new duplicate-value-free array. */ function sortedUniq(array, iteratee) { var seen, index = -1, length = array.length, resIndex = -1, result = []; while (++index < length) { var value = array[index], computed = iteratee ? iteratee(value, index, array) : value; if (!index || seen !== computed) { seen = computed; result[++resIndex] = value; } } return result; } /** * Used by `_.trim` and `_.trimLeft` to get the index of the first non-whitespace * character of `string`. * * @private * @param {string} string The string to inspect. * @returns {number} Returns the index of the first non-whitespace character. */ function trimmedLeftIndex(string) { var index = -1, length = string.length; while (++index < length && isSpace(string.charCodeAt(index))) { } return index; } /** * Used by `_.trim` and `_.trimRight` to get the index of the last non-whitespace * character of `string`. * * @private * @param {string} string The string to inspect. * @returns {number} Returns the index of the last non-whitespace character. */ function trimmedRightIndex(string) { var index = string.length; while (index-- && isSpace(string.charCodeAt(index))) { } return index; } /** * Used by `_.unescape` to convert HTML entities to characters. * * @private * @param {string} chr The matched character to unescape. * @returns {string} Returns the unescaped character. */ function unescapeHtmlChar(chr) { return htmlUnescapes[chr]; } /*--------------------------------------------------------------------------*/ /** * Create a new pristine `lodash` function using the given `context` object. * * @static * @memberOf _ * @category Utility * @param {Object} [context=root] The context object. * @returns {Function} Returns a new `lodash` function. * @example * * _.mixin({ 'add': function(a, b) { return a + b; } }); * * var lodash = _.runInContext(); * lodash.mixin({ 'sub': function(a, b) { return a - b; } }); * * _.isFunction(_.add); * // => true * _.isFunction(_.sub); * // => false * * lodash.isFunction(lodash.add); * // => false * lodash.isFunction(lodash.sub); * // => true * * // using `context` to mock `Date#getTime` use in `_.now` * var mock = _.runInContext({ * 'Date': function() { * return { 'getTime': getTimeMock }; * } * }); * * // or creating a suped-up `defer` in Node.js * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; */ function runInContext(context) { // Avoid issues with some ES3 environments that attempt to use values, named // after built-in constructors like `Object`, for the creation of literals. // ES5 clears this up by stating that literals must use built-in constructors. // See https://es5.github.io/#x11.1.5 for more details. context = context ? _.defaults(root.Object(), context, _.pick(root, contextProps)) : root; /** Native constructor references. */ var Array = context.Array, Date = context.Date, Error = context.Error, Function = context.Function, Math = context.Math, Number = context.Number, Object = context.Object, RegExp = context.RegExp, String = context.String, TypeError = context.TypeError; /** Used for native method references. */ var arrayProto = Array.prototype, objectProto = Object.prototype; /** Used to detect DOM support. */ var document = (document = context.window) && document.document; /** Used to resolve the decompiled source of functions. */ var fnToString = Function.prototype.toString; /** Used to the length of n-tuples for `_.unzip`. */ var getLength = baseProperty('length'); /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** Used to generate unique IDs. */ var idCounter = 0; /** * Used to resolve the `toStringTag` of values. * See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) * for more details. */ var objToString = objectProto.toString; /** Used to restore the original `_` reference in `_.noConflict`. */ var oldDash = context._; /** Used to detect if a method is native. */ var reNative = RegExp('^' + escapeRegExp(objToString).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'); /** Native method references. */ var ArrayBuffer = isNative(ArrayBuffer = context.ArrayBuffer) && ArrayBuffer, bufferSlice = isNative(bufferSlice = ArrayBuffer && new ArrayBuffer(0).slice) && bufferSlice, ceil = Math.ceil, clearTimeout = context.clearTimeout, floor = Math.floor, getPrototypeOf = isNative(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, push = arrayProto.push, propertyIsEnumerable = objectProto.propertyIsEnumerable, Set = isNative(Set = context.Set) && Set, setTimeout = context.setTimeout, splice = arrayProto.splice, Uint8Array = isNative(Uint8Array = context.Uint8Array) && Uint8Array, unshift = arrayProto.unshift, WeakMap = isNative(WeakMap = context.WeakMap) && WeakMap; /** Used to clone array buffers. */ var Float64Array = function () { // Safari 5 errors when using an array buffer to initialize a typed array // where the array buffer's `byteLength` is not a multiple of the typed // array's `BYTES_PER_ELEMENT`. try { var func = isNative(func = context.Float64Array) && func, result = new func(new ArrayBuffer(10), 0, 1) && func; } catch (e) { } return result; }(); /* Native method references for those with the same name as other `lodash` methods. */ var nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray, nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate, nativeIsFinite = context.isFinite, nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys, nativeMax = Math.max, nativeMin = Math.min, nativeNow = isNative(nativeNow = Date.now) && nativeNow, nativeNumIsFinite = isNative(nativeNumIsFinite = Number.isFinite) && nativeNumIsFinite, nativeParseInt = context.parseInt, nativeRandom = Math.random; /** Used as references for `-Infinity` and `Infinity`. */ var NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY, POSITIVE_INFINITY = Number.POSITIVE_INFINITY; /** Used as references for the maximum length and index of an array. */ var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; /** Used as the size, in bytes, of each `Float64Array` element. */ var FLOAT64_BYTES_PER_ELEMENT = Float64Array ? Float64Array.BYTES_PER_ELEMENT : 0; /** * Used as the maximum length of an array-like value. * See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) * for more details. */ var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; /** Used to store function metadata. */ var metaMap = WeakMap && new WeakMap(); /*------------------------------------------------------------------------*/ /** * Creates a `lodash` object which wraps `value` to enable intuitive chaining. * Methods that operate on and return arrays, collections, and functions can * be chained together. Methods that return a boolean or single value will * automatically end the chain returning the unwrapped value. Explicit chaining * may be enabled using `_.chain`. The execution of chained methods is lazy, * that is, execution is deferred until `_#value` is implicitly or explicitly * called. * * Lazy evaluation allows several methods to support shortcut fusion. Shortcut * fusion is an optimization that merges iteratees to avoid creating intermediate * arrays and reduce the number of iteratee executions. * * Chaining is supported in custom builds as long as the `_#value` method is * directly or indirectly included in the build. * * In addition to lodash methods, wrappers also have the following `Array` methods: * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, `splice`, * and `unshift` * * The wrapper functions that support shortcut fusion are: * `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`, `first`, * `initial`, `last`, `map`, `pluck`, `reject`, `rest`, `reverse`, `slice`, * `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `where` * * The chainable wrapper functions are: * `after`, `ary`, `assign`, `at`, `before`, `bind`, `bindAll`, `bindKey`, * `callback`, `chain`, `chunk`, `compact`, `concat`, `constant`, `countBy`, * `create`, `curry`, `debounce`, `defaults`, `defer`, `delay`, `difference`, * `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`, `flatten`, * `flattenDeep`, `flow`, `flowRight`, `forEach`, `forEachRight`, `forIn`, * `forInRight`, `forOwn`, `forOwnRight`, `functions`, `groupBy`, `indexBy`, * `initial`, `intersection`, `invert`, `invoke`, `keys`, `keysIn`, `map`, * `mapValues`, `matches`, `memoize`, `merge`, `mixin`, `negate`, `noop`, * `omit`, `once`, `pairs`, `partial`, `partialRight`, `partition`, `pick`, * `pluck`, `property`, `propertyOf`, `pull`, `pullAt`, `push`, `range`, * `rearg`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, * `sortBy`, `sortByAll`, `splice`, `take`, `takeRight`, `takeRightWhile`, * `takeWhile`, `tap`, `throttle`, `thru`, `times`, `toArray`, `toPlainObject`, * `transform`, `union`, `uniq`, `unshift`, `unzip`, `values`, `valuesIn`, * `where`, `without`, `wrap`, `xor`, `zip`, and `zipObject` * * The wrapper functions that are **not** chainable by default are: * `attempt`, `camelCase`, `capitalize`, `clone`, `cloneDeep`, `deburr`, * `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, * `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`, `has`, * `identity`, `includes`, `indexOf`, `isArguments`, `isArray`, `isBoolean`, * `isDate`, `isElement`, `isEmpty`, `isEqual`, `isError`, `isFinite`, * `isFunction`, `isMatch`, `isNative`, `isNaN`, `isNull`, `isNumber`, * `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, * `isTypedArray`, `join`, `kebabCase`, `last`, `lastIndexOf`, `max`, `min`, * `noConflict`, `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, * `random`, `reduce`, `reduceRight`, `repeat`, `result`, `runInContext`, * `shift`, `size`, `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, * `startCase`, `startsWith`, `template`, `trim`, `trimLeft`, `trimRight`, * `trunc`, `unescape`, `uniqueId`, `value`, and `words` * * The wrapper function `sample` will return a wrapped value when `n` is provided, * otherwise an unwrapped value is returned. * * @name _ * @constructor * @category Chain * @param {*} value The value to wrap in a `lodash` instance. * @returns {Object} Returns a `lodash` instance. * @example * * var wrapped = _([1, 2, 3]); * * // returns an unwrapped value * wrapped.reduce(function(sum, n) { return sum + n; }); * // => 6 * * // returns a wrapped value * var squares = wrapped.map(function(n) { return n * n; }); * * _.isArray(squares); * // => false * * _.isArray(squares.value()); * // => true */ function lodash(value) { if (isObjectLike(value) && !isArray(value)) { if (value instanceof LodashWrapper) { return value; } if (hasOwnProperty.call(value, '__wrapped__')) { return new LodashWrapper(value.__wrapped__, value.__chain__, arrayCopy(value.__actions__)); } } return new LodashWrapper(value); } /** * The base constructor for creating `lodash` wrapper objects. * * @private * @param {*} value The value to wrap. * @param {boolean} [chainAll] Enable chaining for all wrapper methods. * @param {Array} [actions=[]] Actions to peform to resolve the unwrapped value. */ function LodashWrapper(value, chainAll, actions) { this.__actions__ = actions || []; this.__chain__ = !!chainAll; this.__wrapped__ = value; } /** * An object environment feature flags. * * @static * @memberOf _ * @type Object */ var support = lodash.support = {}; (function (x) { /** * Detect if functions can be decompiled by `Function#toString` * (all but Firefox OS certified apps, older Opera mobile browsers, and * the PlayStation 3; forced `false` for Windows 8 apps). * * @memberOf _.support * @type boolean */ support.funcDecomp = !isNative(context.WinRTError) && reThis.test(runInContext); /** * Detect if `Function#name` is supported (all but IE). * * @memberOf _.support * @type boolean */ support.funcNames = typeof Function.name == 'string'; /** * Detect if the DOM is supported. * * @memberOf _.support * @type boolean */ try { support.dom = document.createDocumentFragment().nodeType === 11; } catch (e) { support.dom = false; } /** * Detect if `arguments` object indexes are non-enumerable. * * In Firefox < 4, IE < 9, PhantomJS, and Safari < 5.1 `arguments` object * indexes are non-enumerable. Chrome < 25 and Node.js < 0.11.0 treat * `arguments` object indexes as non-enumerable and fail `hasOwnProperty` * checks for indexes that exceed their function's formal parameters with * associated values of `0`. * * @memberOf _.support * @type boolean */ try { support.nonEnumArgs = !propertyIsEnumerable.call(arguments, 1); } catch (e) { support.nonEnumArgs = true; } }(0, 0)); /** * By default, the template delimiters used by lodash are like those in * embedded Ruby (ERB). Change the following template settings to use * alternative delimiters. * * @static * @memberOf _ * @type Object */ lodash.templateSettings = { 'escape': reEscape, 'evaluate': reEvaluate, 'interpolate': reInterpolate, 'variable': '', 'imports': { '_': lodash } }; /*------------------------------------------------------------------------*/ /** * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. * * @private * @param {*} value The value to wrap. */ function LazyWrapper(value) { this.actions = null; this.dir = 1; this.dropCount = 0; this.filtered = false; this.iteratees = null; this.takeCount = POSITIVE_INFINITY; this.views = null; this.wrapped = value; } /** * Creates a clone of the lazy wrapper object. * * @private * @name clone * @memberOf LazyWrapper * @returns {Object} Returns the cloned `LazyWrapper` object. */ function lazyClone() { var actions = this.actions, iteratees = this.iteratees, views = this.views, result = new LazyWrapper(this.wrapped); result.actions = actions ? arrayCopy(actions) : null; result.dir = this.dir; result.dropCount = this.dropCount; result.filtered = this.filtered; result.iteratees = iteratees ? arrayCopy(iteratees) : null; result.takeCount = this.takeCount; result.views = views ? arrayCopy(views) : null; return result; } /** * Reverses the direction of lazy iteration. * * @private * @name reverse * @memberOf LazyWrapper * @returns {Object} Returns the new reversed `LazyWrapper` object. */ function lazyReverse() { if (this.filtered) { var result = new LazyWrapper(this); result.dir = -1; result.filtered = true; } else { result = this.clone(); result.dir *= -1; } return result; } /** * Extracts the unwrapped value from its lazy wrapper. * * @private * @name value * @memberOf LazyWrapper * @returns {*} Returns the unwrapped value. */ function lazyValue() { var array = this.wrapped.value(); if (!isArray(array)) { return baseWrapperValue(array, this.actions); } var dir = this.dir, isRight = dir < 0, view = getView(0, array.length, this.views), start = view.start, end = view.end, length = end - start, dropCount = this.dropCount, takeCount = nativeMin(length, this.takeCount - dropCount), index = isRight ? end : start - 1, iteratees = this.iteratees, iterLength = iteratees ? iteratees.length : 0, resIndex = 0, result = []; outer: while (length-- && resIndex < takeCount) { index += dir; var iterIndex = -1, value = array[index]; while (++iterIndex < iterLength) { var data = iteratees[iterIndex], iteratee = data.iteratee, computed = iteratee(value, index, array), type = data.type; if (type == LAZY_MAP_FLAG) { value = computed; } else if (!computed) { if (type == LAZY_FILTER_FLAG) { continue outer; } else { break outer; } } } if (dropCount) { dropCount--; } else { result[resIndex++] = value; } } return result; } /*------------------------------------------------------------------------*/ /** * Creates a cache object to store key/value pairs. * * @private * @static * @name Cache * @memberOf _.memoize */ function MapCache() { this.__data__ = {}; } /** * Removes `key` and its value from the cache. * * @private * @name delete * @memberOf _.memoize.Cache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed successfully, else `false`. */ function mapDelete(key) { return this.has(key) && delete this.__data__[key]; } /** * Gets the cached value for `key`. * * @private * @name get * @memberOf _.memoize.Cache * @param {string} key The key of the value to get. * @returns {*} Returns the cached value. */ function mapGet(key) { return key == '__proto__' ? undefined : this.__data__[key]; } /** * Checks if a cached value for `key` exists. * * @private * @name has * @memberOf _.memoize.Cache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function mapHas(key) { return key != '__proto__' && hasOwnProperty.call(this.__data__, key); } /** * Adds `value` to `key` of the cache. * * @private * @name set * @memberOf _.memoize.Cache * @param {string} key The key of the value to cache. * @param {*} value The value to cache. * @returns {Object} Returns the cache object. */ function mapSet(key, value) { if (key != '__proto__') { this.__data__[key] = value; } return this; } /*------------------------------------------------------------------------*/ /** * * Creates a cache object to store unique values. * * @private * @param {Array} [values] The values to cache. */ function SetCache(values) { var length = values ? values.length : 0; this.data = { 'hash': nativeCreate(null), 'set': new Set() }; while (length--) { this.push(values[length]); } } /** * Checks if `value` is in `cache` mimicking the return signature of * `_.indexOf` by returning `0` if the value is found, else `-1`. * * @private * @param {Object} cache The cache to search. * @param {*} value The value to search for. * @returns {number} Returns `0` if `value` is found, else `-1`. */ function cacheIndexOf(cache, value) { var data = cache.data, result = typeof value == 'string' || isObject(value) ? data.set.has(value) : data.hash[value]; return result ? 0 : -1; } /** * Adds `value` to the cache. * * @private * @name push * @memberOf SetCache * @param {*} value The value to cache. */ function cachePush(value) { var data = this.data; if (typeof value == 'string' || isObject(value)) { data.set.add(value); } else { data.hash[value] = true; } } /*------------------------------------------------------------------------*/ /** * Copies the values of `source` to `array`. * * @private * @param {Array} source The array to copy values from. * @param {Array} [array=[]] The array to copy values to. * @returns {Array} Returns `array`. */ function arrayCopy(source, array) { var index = -1, length = source.length; array || (array = Array(length)); while (++index < length) { array[index] = source[index]; } return array; } /** * A specialized version of `_.forEach` for arrays without support for callback * shorthands or `this` binding. * * @private * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns `array`. */ function arrayEach(array, iteratee) { var index = -1, length = array.length; while (++index < length) { if (iteratee(array[index], index, array) === false) { break; } } return array; } /** * A specialized version of `_.forEachRight` for arrays without support for * callback shorthands or `this` binding. * * @private * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns `array`. */ function arrayEachRight(array, iteratee) { var length = array.length; while (length--) { if (iteratee(array[length], length, array) === false) { break; } } return array; } /** * A specialized version of `_.every` for arrays without support for callback * shorthands or `this` binding. * * @private * @param {Array} array The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if all elements pass the predicate check, * else `false`. */ function arrayEvery(array, predicate) { var index = -1, length = array.length; while (++index < length) { if (!predicate(array[index], index, array)) { return false; } } return true; } /** * A specialized version of `_.filter` for arrays without support for callback * shorthands or `this` binding. * * @private * @param {Array} array The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {Array} Returns the new filtered array. */ function arrayFilter(array, predicate) { var index = -1, length = array.length, resIndex = -1, result = []; while (++index < length) { var value = array[index]; if (predicate(value, index, array)) { result[++resIndex] = value; } } return result; } /** * A specialized version of `_.map` for arrays without support for callback * shorthands or `this` binding. * * @private * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function arrayMap(array, iteratee) { var index = -1, length = array.length, result = Array(length); while (++index < length) { result[index] = iteratee(array[index], index, array); } return result; } /** * A specialized version of `_.max` for arrays without support for iteratees. * * @private * @param {Array} array The array to iterate over. * @returns {*} Returns the maximum value. */ function arrayMax(array) { var index = -1, length = array.length, result = NEGATIVE_INFINITY; while (++index < length) { var value = array[index]; if (value > result) { result = value; } } return result; } /** * A specialized version of `_.min` for arrays without support for iteratees. * * @private * @param {Array} array The array to iterate over. * @returns {*} Returns the minimum value. */ function arrayMin(array) { var index = -1, length = array.length, result = POSITIVE_INFINITY; while (++index < length) { var value = array[index]; if (value < result) { result = value; } } return result; } /** * A specialized version of `_.reduce` for arrays without support for callback * shorthands or `this` binding. * * @private * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {boolean} [initFromArray] Specify using the first element of `array` * as the initial value. * @returns {*} Returns the accumulated value. */ function arrayReduce(array, iteratee, accumulator, initFromArray) { var index = -1, length = array.length; if (initFromArray && length) { accumulator = array[++index]; } while (++index < length) { accumulator = iteratee(accumulator, array[index], index, array); } return accumulator; } /** * A specialized version of `_.reduceRight` for arrays without support for * callback shorthands or `this` binding. * * @private * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {boolean} [initFromArray] Specify using the last element of `array` * as the initial value. * @returns {*} Returns the accumulated value. */ function arrayReduceRight(array, iteratee, accumulator, initFromArray) { var length = array.length; if (initFromArray && length) { accumulator = array[--length]; } while (length--) { accumulator = iteratee(accumulator, array[length], length, array); } return accumulator; } /** * A specialized version of `_.some` for arrays without support for callback * shorthands or `this` binding. * * @private * @param {Array} array The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if any element passes the predicate check, * else `false`. */ function arraySome(array, predicate) { var index = -1, length = array.length; while (++index < length) { if (predicate(array[index], index, array)) { return true; } } return false; } /** * Used by `_.defaults` to customize its `_.assign` use. * * @private * @param {*} objectValue The destination object property value. * @param {*} sourceValue The source object property value. * @returns {*} Returns the value to assign to the destination object. */ function assignDefaults(objectValue, sourceValue) { return typeof objectValue == 'undefined' ? sourceValue : objectValue; } /** * Used by `_.template` to customize its `_.assign` use. * * **Note:** This method is like `assignDefaults` except that it ignores * inherited property values when checking if a property is `undefined`. * * @private * @param {*} objectValue The destination object property value. * @param {*} sourceValue The source object property value. * @param {string} key The key associated with the object and source values. * @param {Object} object The destination object. * @returns {*} Returns the value to assign to the destination object. */ function assignOwnDefaults(objectValue, sourceValue, key, object) { return typeof objectValue == 'undefined' || !hasOwnProperty.call(object, key) ? sourceValue : objectValue; } /** * The base implementation of `_.assign` without support for argument juggling, * multiple sources, and `this` binding `customizer` functions. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @param {Function} [customizer] The function to customize assigning values. * @returns {Object} Returns the destination object. */ function baseAssign(object, source, customizer) { var props = keys(source); if (!customizer) { return baseCopy(source, object, props); } var index = -1, length = props.length; while (++index < length) { var key = props[index], value = object[key], result = customizer(value, source[key], key, object, source); if ((result === result ? result !== value : value === value) || typeof value == 'undefined' && !(key in object)) { object[key] = result; } } return object; } /** * The base implementation of `_.at` without support for strings and individual * key arguments. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {number[]|string[]} [props] The property names or indexes of elements to pick. * @returns {Array} Returns the new array of picked elements. */ function baseAt(collection, props) { var index = -1, length = collection.length, isArr = isLength(length), propsLength = props.length, result = Array(propsLength); while (++index < propsLength) { var key = props[index]; if (isArr) { key = parseFloat(key); result[index] = isIndex(key, length) ? collection[key] : undefined; } else { result[index] = collection[key]; } } return result; } /** * Copies the properties of `source` to `object`. * * @private * @param {Object} source The object to copy properties from. * @param {Object} [object={}] The object to copy properties to. * @param {Array} props The property names to copy. * @returns {Object} Returns `object`. */ function baseCopy(source, object, props) { if (!props) { props = object; object = {}; } var index = -1, length = props.length; while (++index < length) { var key = props[index]; object[key] = source[key]; } return object; } /** * The base implementation of `_.bindAll` without support for individual * method name arguments. * * @private * @param {Object} object The object to bind and assign the bound methods to. * @param {string[]} methodNames The object method names to bind. * @returns {Object} Returns `object`. */ function baseBindAll(object, methodNames) { var index = -1, length = methodNames.length; while (++index < length) { var key = methodNames[index]; object[key] = createWrapper(object[key], BIND_FLAG, object); } return object; } /** * The base implementation of `_.callback` which supports specifying the * number of arguments to provide to `func`. * * @private * @param {*} [func=_.identity] The value to convert to a callback. * @param {*} [thisArg] The `this` binding of `func`. * @param {number} [argCount] The number of arguments to provide to `func`. * @returns {Function} Returns the callback. */ function baseCallback(func, thisArg, argCount) { var type = typeof func; if (type == 'function') { return typeof thisArg != 'undefined' && isBindable(func) ? bindCallback(func, thisArg, argCount) : func; } if (func == null) { return identity; } // Handle "_.property" and "_.matches" style callback shorthands. return type == 'object' ? baseMatches(func) : baseProperty(func + ''); } /** * The base implementation of `_.clone` without support for argument juggling * and `this` binding `customizer` functions. * * @private * @param {*} value The value to clone. * @param {boolean} [isDeep] Specify a deep clone. * @param {Function} [customizer] The function to customize cloning values. * @param {string} [key] The key of `value`. * @param {Object} [object] The object `value` belongs to. * @param {Array} [stackA=[]] Tracks traversed source objects. * @param {Array} [stackB=[]] Associates clones with source counterparts. * @returns {*} Returns the cloned value. */ function baseClone(value, isDeep, customizer, key, object, stackA, stackB) { var result; if (customizer) { result = object ? customizer(value, key, object) : customizer(value); } if (typeof result != 'undefined') { return result; } if (!isObject(value)) { return value; } var isArr = isArray(value); if (isArr) { result = initCloneArray(value); if (!isDeep) { return arrayCopy(value, result); } } else { var tag = objToString.call(value), isFunc = tag == funcTag; if (tag == objectTag || tag == argsTag || isFunc && !object) { result = initCloneObject(isFunc ? {} : value); if (!isDeep) { return baseCopy(value, result, keys(value)); } } else { return cloneableTags[tag] ? initCloneByTag(value, tag, isDeep) : object ? value : {}; } } // Check for circular references and return corresponding clone. stackA || (stackA = []); stackB || (stackB = []); var length = stackA.length; while (length--) { if (stackA[length] == value) { return stackB[length]; } } // Add the source value to the stack of traversed objects and associate it with its clone. stackA.push(value); stackB.push(result); // Recursively populate clone (susceptible to call stack limits). (isArr ? arrayEach : baseForOwn)(value, function (subValue, key) { result[key] = baseClone(subValue, isDeep, customizer, key, value, stackA, stackB); }); return result; } /** * The base implementation of `_.create` without support for assigning * properties to the created object. * * @private * @param {Object} prototype The object to inherit from. * @returns {Object} Returns the new object. */ var baseCreate = function () { function Object() { } return function (prototype) { if (isObject(prototype)) { Object.prototype = prototype; var result = new Object(); Object.prototype = null; } return result || context.Object(); }; }(); /** * The base implementation of `_.delay` and `_.defer` which accepts an index * of where to slice the arguments to provide to `func`. * * @private * @param {Function} func The function to delay. * @param {number} wait The number of milliseconds to delay invocation. * @param {Object} args The `arguments` object to slice and provide to `func`. * @returns {number} Returns the timer id. */ function baseDelay(func, wait, args, fromIndex) { if (!isFunction(func)) { throw new TypeError(FUNC_ERROR_TEXT); } return setTimeout(function () { func.apply(undefined, baseSlice(args, fromIndex)); }, wait); } /** * The base implementation of `_.difference` which accepts a single array * of values to exclude. * * @private * @param {Array} array The array to inspect. * @param {Array} values The values to exclude. * @returns {Array} Returns the new array of filtered values. */ function baseDifference(array, values) { var length = array ? array.length : 0, result = []; if (!length) { return result; } var index = -1, indexOf = getIndexOf(), isCommon = indexOf == baseIndexOf, cache = isCommon && values.length >= 200 && createCache(values), valuesLength = values.length; if (cache) { indexOf = cacheIndexOf; isCommon = false; values = cache; } outer: while (++index < length) { var value = array[index]; if (isCommon && value === value) { var valuesIndex = valuesLength; while (valuesIndex--) { if (values[valuesIndex] === value) { continue outer; } } result.push(value); } else if (indexOf(values, value) < 0) { result.push(value); } } return result; } /** * The base implementation of `_.forEach` without support for callback * shorthands and `this` binding. * * @private * @param {Array|Object|string} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array|Object|string} Returns `collection`. */ function baseEach(collection, iteratee) { var length = collection ? collection.length : 0; if (!isLength(length)) { return baseForOwn(collection, iteratee); } var index = -1, iterable = toObject(collection); while (++index < length) { if (iteratee(iterable[index], index, iterable) === false) { break; } } return collection; } /** * The base implementation of `_.forEachRight` without support for callback * shorthands and `this` binding. * * @private * @param {Array|Object|string} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array|Object|string} Returns `collection`. */ function baseEachRight(collection, iteratee) { var length = collection ? collection.length : 0; if (!isLength(length)) { return baseForOwnRight(collection, iteratee); } var iterable = toObject(collection); while (length--) { if (iteratee(iterable[length], length, iterable) === false) { break; } } return collection; } /** * The base implementation of `_.every` without support for callback * shorthands or `this` binding. * * @private * @param {Array|Object|string} collection The collection to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if all elements pass the predicate check, * else `false` */ function baseEvery(collection, predicate) { var result = true; baseEach(collection, function (value, index, collection) { result = !!predicate(value, index, collection); return result; }); return result; } /** * The base implementation of `_.filter` without support for callback * shorthands or `this` binding. * * @private * @param {Array|Object|string} collection The collection to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {Array} Returns the new filtered array. */ function baseFilter(collection, predicate) { var result = []; baseEach(collection, function (value, index, collection) { if (predicate(value, index, collection)) { result.push(value); } }); return result; } /** * The base implementation of `_.find`, `_.findLast`, `_.findKey`, and `_.findLastKey`, * without support for callback shorthands and `this` binding, which iterates * over `collection` using the provided `eachFunc`. * * @private * @param {Array|Object|string} collection The collection to search. * @param {Function} predicate The function invoked per iteration. * @param {Function} eachFunc The function to iterate over `collection`. * @param {boolean} [retKey] Specify returning the key of the found element * instead of the element itself. * @returns {*} Returns the found element or its key, else `undefined`. */ function baseFind(collection, predicate, eachFunc, retKey) { var result; eachFunc(collection, function (value, key, collection) { if (predicate(value, key, collection)) { result = retKey ? key : value; return false; } }); return result; } /** * The base implementation of `_.flatten` with added support for restricting * flattening and specifying the start index. * * @private * @param {Array} array The array to flatten. * @param {boolean} [isDeep] Specify a deep flatten. * @param {boolean} [isStrict] Restrict flattening to arrays and `arguments` objects. * @param {number} [fromIndex=0] The index to start from. * @returns {Array} Returns the new flattened array. */ function baseFlatten(array, isDeep, isStrict, fromIndex) { var index = (fromIndex || 0) - 1, length = array.length, resIndex = -1, result = []; while (++index < length) { var value = array[index]; if (isObjectLike(value) && isLength(value.length) && (isArray(value) || isArguments(value))) { if (isDeep) { // Recursively flatten arrays (susceptible to call stack limits). value = baseFlatten(value, isDeep, isStrict); } var valIndex = -1, valLength = value.length; result.length += valLength; while (++valIndex < valLength) { result[++resIndex] = value[valIndex]; } } else if (!isStrict) { result[++resIndex] = value; } } return result; } /** * The base implementation of `baseForIn` and `baseForOwn` which iterates * over `object` properties returned by `keysFunc` invoking `iteratee` for * each property. Iterator functions may exit iteration early by explicitly * returning `false`. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {Function} keysFunc The function to get the keys of `object`. * @returns {Object} Returns `object`. */ function baseFor(object, iteratee, keysFunc) { var index = -1, iterable = toObject(object), props = keysFunc(object), length = props.length; while (++index < length) { var key = props[index]; if (iteratee(iterable[key], key, iterable) === false) { break; } } return object; } /** * This function is like `baseFor` except that it iterates over properties * in the opposite order. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {Function} keysFunc The function to get the keys of `object`. * @returns {Object} Returns `object`. */ function baseForRight(object, iteratee, keysFunc) { var iterable = toObject(object), props = keysFunc(object), length = props.length; while (length--) { var key = props[length]; if (iteratee(iterable[key], key, iterable) === false) { break; } } return object; } /** * The base implementation of `_.forIn` without support for callback * shorthands and `this` binding. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Object} Returns `object`. */ function baseForIn(object, iteratee) { return baseFor(object, iteratee, keysIn); } /** * The base implementation of `_.forOwn` without support for callback * shorthands and `this` binding. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Object} Returns `object`. */ function baseForOwn(object, iteratee) { return baseFor(object, iteratee, keys); } /** * The base implementation of `_.forOwnRight` without support for callback * shorthands and `this` binding. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Object} Returns `object`. */ function baseForOwnRight(object, iteratee) { return baseForRight(object, iteratee, keys); } /** * The base implementation of `_.functions` which creates an array of * `object` function property names filtered from those provided. * * @private * @param {Object} object The object to inspect. * @param {Array} props The property names to filter. * @returns {Array} Returns the new array of filtered property names. */ function baseFunctions(object, props) { var index = -1, length = props.length, resIndex = -1, result = []; while (++index < length) { var key = props[index]; if (isFunction(object[key])) { result[++resIndex] = key; } } return result; } /** * The base implementation of `_.invoke` which requires additional arguments * to be provided as an array of arguments rather than individually. * * @private * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|string} methodName The name of the method to invoke or * the function invoked per iteration. * @param {Array} [args] The arguments to invoke the method with. * @returns {Array} Returns the array of results. */ function baseInvoke(collection, methodName, args) { var index = -1, isFunc = typeof methodName == 'function', length = collection ? collection.length : 0, result = isLength(length) ? Array(length) : []; baseEach(collection, function (value) { var func = isFunc ? methodName : value != null && value[methodName]; result[++index] = func ? func.apply(value, args) : undefined; }); return result; } /** * The base implementation of `_.isEqual` without support for `this` binding * `customizer` functions. * * @private * @param {*} value The value to compare. * @param {*} other The other value to compare. * @param {Function} [customizer] The function to customize comparing values. * @param {boolean} [isWhere] Specify performing partial comparisons. * @param {Array} [stackA] Tracks traversed `value` objects. * @param {Array} [stackB] Tracks traversed `other` objects. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. */ function baseIsEqual(value, other, customizer, isWhere, stackA, stackB) { // Exit early for identical values. if (value === other) { // Treat `+0` vs. `-0` as not equal. return value !== 0 || 1 / value == 1 / other; } var valType = typeof value, othType = typeof other; // Exit early for unlike primitive values. if (valType != 'function' && valType != 'object' && othType != 'function' && othType != 'object' || value == null || other == null) { // Return `false` unless both values are `NaN`. return value !== value && other !== other; } return baseIsEqualDeep(value, other, baseIsEqual, customizer, isWhere, stackA, stackB); } /** * A specialized version of `baseIsEqual` for arrays and objects which performs * deep comparisons and tracks traversed objects enabling objects with circular * references to be compared. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Function} [customizer] The function to customize comparing objects. * @param {boolean} [isWhere] Specify performing partial comparisons. * @param {Array} [stackA=[]] Tracks traversed `value` objects. * @param {Array} [stackB=[]] Tracks traversed `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function baseIsEqualDeep(object, other, equalFunc, customizer, isWhere, stackA, stackB) { var objIsArr = isArray(object), othIsArr = isArray(other), objTag = arrayTag, othTag = arrayTag; if (!objIsArr) { objTag = objToString.call(object); if (objTag == argsTag) { objTag = objectTag; } else if (objTag != objectTag) { objIsArr = isTypedArray(object); } } if (!othIsArr) { othTag = objToString.call(other); if (othTag == argsTag) { othTag = objectTag; } else if (othTag != objectTag) { othIsArr = isTypedArray(other); } } var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag; if (isSameTag && !(objIsArr || objIsObj)) { return equalByTag(object, other, objTag); } var valWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), othWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); if (valWrapped || othWrapped) { return equalFunc(valWrapped ? object.value() : object, othWrapped ? other.value() : other, customizer, isWhere, stackA, stackB); } if (!isSameTag) { return false; } // Assume cyclic values are equal. // For more information on detecting circular references see https://es5.github.io/#JO. stackA || (stackA = []); stackB || (stackB = []); var length = stackA.length; while (length--) { if (stackA[length] == object) { return stackB[length] == other; } } // Add `object` and `other` to the stack of traversed objects. stackA.push(object); stackB.push(other); var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isWhere, stackA, stackB); stackA.pop(); stackB.pop(); return result; } /** * The base implementation of `_.isMatch` without support for callback * shorthands or `this` binding. * * @private * @param {Object} source The object to inspect. * @param {Array} props The source property names to match. * @param {Array} values The source values to match. * @param {Array} strictCompareFlags Strict comparison flags for source values. * @param {Function} [customizer] The function to customize comparing objects. * @returns {boolean} Returns `true` if `object` is a match, else `false`. */ function baseIsMatch(object, props, values, strictCompareFlags, customizer) { var length = props.length; if (object == null) { return !length; } var index = -1, noCustomizer = !customizer; while (++index < length) { if (noCustomizer && strictCompareFlags[index] ? values[index] !== object[props[index]] : !hasOwnProperty.call(object, props[index])) { return false; } } index = -1; while (++index < length) { var key = props[index]; if (noCustomizer && strictCompareFlags[index]) { var result = hasOwnProperty.call(object, key); } else { var objValue = object[key], srcValue = values[index]; result = customizer ? customizer(objValue, srcValue, key) : undefined; if (typeof result == 'undefined') { result = baseIsEqual(srcValue, objValue, customizer, true); } } if (!result) { return false; } } return true; } /** * The base implementation of `_.map` without support for callback shorthands * or `this` binding. * * @private * @param {Array|Object|string} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function baseMap(collection, iteratee) { var result = []; baseEach(collection, function (value, key, collection) { result.push(iteratee(value, key, collection)); }); return result; } /** * The base implementation of `_.matches` which supports specifying whether * `source` should be cloned. * * @private * @param {Object} source The object of property values to match. * @returns {Function} Returns the new function. */ function baseMatches(source) { var props = keys(source), length = props.length; if (length == 1) { var key = props[0], value = source[key]; if (isStrictComparable(value)) { return function (object) { return object != null && value === object[key] && hasOwnProperty.call(object, key); }; } } var values = Array(length), strictCompareFlags = Array(length); while (length--) { value = source[props[length]]; values[length] = value; strictCompareFlags[length] = isStrictComparable(value); } return function (object) { return baseIsMatch(object, props, values, strictCompareFlags); }; } /** * The base implementation of `_.merge` without support for argument juggling, * multiple sources, and `this` binding `customizer` functions. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @param {Function} [customizer] The function to customize merging properties. * @param {Array} [stackA=[]] Tracks traversed source objects. * @param {Array} [stackB=[]] Associates values with source counterparts. * @returns {Object} Returns the destination object. */ function baseMerge(object, source, customizer, stackA, stackB) { var isSrcArr = isLength(source.length) && (isArray(source) || isTypedArray(source)); (isSrcArr ? arrayEach : baseForOwn)(source, function (srcValue, key, source) { if (isObjectLike(srcValue)) { stackA || (stackA = []); stackB || (stackB = []); return baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB); } var value = object[key], result = customizer ? customizer(value, srcValue, key, object, source) : undefined, isCommon = typeof result == 'undefined'; if (isCommon) { result = srcValue; } if ((isSrcArr || typeof result != 'undefined') && (isCommon || (result === result ? result !== value : value === value))) { object[key] = result; } }); return object; } /** * A specialized version of `baseMerge` for arrays and objects which performs * deep merges and tracks traversed objects enabling objects with circular * references to be merged. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @param {string} key The key of the value to merge. * @param {Function} mergeFunc The function to merge values. * @param {Function} [customizer] The function to customize merging properties. * @param {Array} [stackA=[]] Tracks traversed source objects. * @param {Array} [stackB=[]] Associates values with source counterparts. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function baseMergeDeep(object, source, key, mergeFunc, customizer, stackA, stackB) { var length = stackA.length, srcValue = source[key]; while (length--) { if (stackA[length] == srcValue) { object[key] = stackB[length]; return; } } var value = object[key], result = customizer ? customizer(value, srcValue, key, object, source) : undefined, isCommon = typeof result == 'undefined'; if (isCommon) { result = srcValue; if (isLength(srcValue.length) && (isArray(srcValue) || isTypedArray(srcValue))) { result = isArray(value) ? value : value ? arrayCopy(value) : []; } else if (isPlainObject(srcValue) || isArguments(srcValue)) { result = isArguments(value) ? toPlainObject(value) : isPlainObject(value) ? value : {}; } else { isCommon = false; } } // Add the source value to the stack of traversed objects and associate // it with its merged value. stackA.push(srcValue); stackB.push(result); if (isCommon) { // Recursively merge objects and arrays (susceptible to call stack limits). object[key] = mergeFunc(result, srcValue, customizer, stackA, stackB); } else if (result === result ? result !== value : value === value) { object[key] = result; } } /** * The base implementation of `_.property` which does not coerce `key` to a string. * * @private * @param {string} key The key of the property to get. * @returns {Function} Returns the new function. */ function baseProperty(key) { return function (object) { return object == null ? undefined : object[key]; }; } /** * The base implementation of `_.pullAt` without support for individual * index arguments. * * @private * @param {Array} array The array to modify. * @param {number[]} indexes The indexes of elements to remove. * @returns {Array} Returns the new array of removed elements. */ function basePullAt(array, indexes) { var length = indexes.length, result = baseAt(array, indexes); indexes.sort(baseCompareAscending); while (length--) { var index = parseFloat(indexes[length]); if (index != previous && isIndex(index)) { var previous = index; splice.call(array, index, 1); } } return result; } /** * The base implementation of `_.random` without support for argument juggling * and returning floating-point numbers. * * @private * @param {number} min The minimum possible value. * @param {number} max The maximum possible value. * @returns {number} Returns the random number. */ function baseRandom(min, max) { return min + floor(nativeRandom() * (max - min + 1)); } /** * The base implementation of `_.reduce` and `_.reduceRight` without support * for callback shorthands or `this` binding, which iterates over `collection` * using the provided `eachFunc`. * * @private * @param {Array|Object|string} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} accumulator The initial value. * @param {boolean} initFromCollection Specify using the first or last element * of `collection` as the initial value. * @param {Function} eachFunc The function to iterate over `collection`. * @returns {*} Returns the accumulated value. */ function baseReduce(collection, iteratee, accumulator, initFromCollection, eachFunc) { eachFunc(collection, function (value, index, collection) { accumulator = initFromCollection ? (initFromCollection = false, value) : iteratee(accumulator, value, index, collection); }); return accumulator; } /** * The base implementation of `setData` without support for hot loop detection. * * @private * @param {Function} func The function to associate metadata with. * @param {*} data The metadata. * @returns {Function} Returns `func`. */ var baseSetData = !metaMap ? identity : function (func, data) { metaMap.set(func, data); return func; }; /** * The base implementation of `_.slice` without an iteratee call guard. * * @private * @param {Array} array The array to slice. * @param {number} [start=0] The start position. * @param {number} [end=array.length] The end position. * @returns {Array} Returns the slice of `array`. */ function baseSlice(array, start, end) { var index = -1, length = array.length; start = start == null ? 0 : +start || 0; if (start < 0) { start = -start > length ? 0 : length + start; } end = typeof end == 'undefined' || end > length ? length : +end || 0; if (end < 0) { end += length; } length = start > end ? 0 : end - start >>> 0; start >>>= 0; var result = Array(length); while (++index < length) { result[index] = array[index + start]; } return result; } /** * The base implementation of `_.some` without support for callback shorthands * or `this` binding. * * @private * @param {Array|Object|string} collection The collection to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if any element passes the predicate check, * else `false`. */ function baseSome(collection, predicate) { var result; baseEach(collection, function (value, index, collection) { result = predicate(value, index, collection); return !result; }); return !!result; } /** * The base implementation of `_.uniq` without support for callback shorthands * and `this` binding. * * @private * @param {Array} array The array to inspect. * @param {Function} [iteratee] The function invoked per iteration. * @returns {Array} Returns the new duplicate-value-free array. */ function baseUniq(array, iteratee) { var index = -1, indexOf = getIndexOf(), length = array.length, isCommon = indexOf == baseIndexOf, isLarge = isCommon && length >= 200, seen = isLarge && createCache(), result = []; if (seen) { indexOf = cacheIndexOf; isCommon = false; } else { isLarge = false; seen = iteratee ? [] : result; } outer: while (++index < length) { var value = array[index], computed = iteratee ? iteratee(value, index, array) : value; if (isCommon && value === value) { var seenIndex = seen.length; while (seenIndex--) { if (seen[seenIndex] === computed) { continue outer; } } if (iteratee) { seen.push(computed); } result.push(value); } else if (indexOf(seen, computed) < 0) { if (iteratee || isLarge) { seen.push(computed); } result.push(value); } } return result; } /** * The base implementation of `_.values` and `_.valuesIn` which creates an * array of `object` property values corresponding to the property names * returned by `keysFunc`. * * @private * @param {Object} object The object to query. * @param {Array} props The property names to get values for. * @returns {Object} Returns the array of property values. */ function baseValues(object, props) { var index = -1, length = props.length, result = Array(length); while (++index < length) { result[index] = object[props[index]]; } return result; } /** * The base implementation of `wrapperValue` which returns the result of * performing a sequence of actions on the unwrapped `value`, where each * successive action is supplied the return value of the previous. * * @private * @param {*} value The unwrapped value. * @param {Array} actions Actions to peform to resolve the unwrapped value. * @returns {*} Returns the resolved unwrapped value. */ function baseWrapperValue(value, actions) { var result = value; if (result instanceof LazyWrapper) { result = result.value(); } var index = -1, length = actions.length; while (++index < length) { var args = [result], action = actions[index]; push.apply(args, action.args); result = action.func.apply(action.thisArg, args); } return result; } /** * Performs a binary search of `array` to determine the index at which `value` * should be inserted into `array` in order to maintain its sort order. * * @private * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @param {boolean} [retHighest] Specify returning the highest, instead * of the lowest, index at which a value should be inserted into `array`. * @returns {number} Returns the index at which `value` should be inserted * into `array`. */ function binaryIndex(array, value, retHighest) { var low = 0, high = array ? array.length : low; if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { while (low < high) { var mid = low + high >>> 1, computed = array[mid]; if (retHighest ? computed <= value : computed < value) { low = mid + 1; } else { high = mid; } } return high; } return binaryIndexBy(array, value, identity, retHighest); } /** * This function is like `binaryIndex` except that it invokes `iteratee` for * `value` and each element of `array` to compute their sort ranking. The * iteratee is invoked with one argument; (value). * * @private * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @param {Function} iteratee The function invoked per iteration. * @param {boolean} [retHighest] Specify returning the highest, instead * of the lowest, index at which a value should be inserted into `array`. * @returns {number} Returns the index at which `value` should be inserted * into `array`. */ function binaryIndexBy(array, value, iteratee, retHighest) { value = iteratee(value); var low = 0, high = array ? array.length : 0, valIsNaN = value !== value, valIsUndef = typeof value == 'undefined'; while (low < high) { var mid = floor((low + high) / 2), computed = iteratee(array[mid]), isReflexive = computed === computed; if (valIsNaN) { var setLow = isReflexive || retHighest; } else if (valIsUndef) { setLow = isReflexive && (retHighest || typeof computed != 'undefined'); } else { setLow = retHighest ? computed <= value : computed < value; } if (setLow) { low = mid + 1; } else { high = mid; } } return nativeMin(high, MAX_ARRAY_INDEX); } /** * A specialized version of `baseCallback` which only supports `this` binding * and specifying the number of arguments to provide to `func`. * * @private * @param {Function} func The function to bind. * @param {*} thisArg The `this` binding of `func`. * @param {number} [argCount] The number of arguments to provide to `func`. * @returns {Function} Returns the callback. */ function bindCallback(func, thisArg, argCount) { if (typeof func != 'function') { return identity; } if (typeof thisArg == 'undefined') { return func; } switch (argCount) { case 1: return function (value) { return func.call(thisArg, value); }; case 3: return function (value, index, collection) { return func.call(thisArg, value, index, collection); }; case 4: return function (accumulator, value, index, collection) { return func.call(thisArg, accumulator, value, index, collection); }; case 5: return function (value, other, key, object, source) { return func.call(thisArg, value, other, key, object, source); }; } return function () { return func.apply(thisArg, arguments); }; } /** * Creates a clone of the given array buffer. * * @private * @param {ArrayBuffer} buffer The array buffer to clone. * @returns {ArrayBuffer} Returns the cloned array buffer. */ function bufferClone(buffer) { return bufferSlice.call(buffer, 0); } if (!bufferSlice) { // PhantomJS has `ArrayBuffer` and `Uint8Array` but not `Float64Array`. bufferClone = !(ArrayBuffer && Uint8Array) ? constant(null) : function (buffer) { var byteLength = buffer.byteLength, floatLength = Float64Array ? floor(byteLength / FLOAT64_BYTES_PER_ELEMENT) : 0, offset = floatLength * FLOAT64_BYTES_PER_ELEMENT, result = new ArrayBuffer(byteLength); if (floatLength) { var view = new Float64Array(result, 0, floatLength); view.set(new Float64Array(buffer, 0, floatLength)); } if (byteLength != offset) { view = new Uint8Array(result, offset); view.set(new Uint8Array(buffer, offset)); } return result; }; } /** * Creates an array that is the composition of partially applied arguments, * placeholders, and provided arguments into a single array of arguments. * * @private * @param {Array|Object} args The provided arguments. * @param {Array} partials The arguments to prepend to those provided. * @param {Array} holders The `partials` placeholder indexes. * @returns {Array} Returns the new array of composed arguments. */ function composeArgs(args, partials, holders) { var holdersLength = holders.length, argsIndex = -1, argsLength = nativeMax(args.length - holdersLength, 0), leftIndex = -1, leftLength = partials.length, result = Array(argsLength + leftLength); while (++leftIndex < leftLength) { result[leftIndex] = partials[leftIndex]; } while (++argsIndex < holdersLength) { result[holders[argsIndex]] = args[argsIndex]; } while (argsLength--) { result[leftIndex++] = args[argsIndex++]; } return result; } /** * This function is like `composeArgs` except that the arguments composition * is tailored for `_.partialRight`. * * @private * @param {Array|Object} args The provided arguments. * @param {Array} partials The arguments to append to those provided. * @param {Array} holders The `partials` placeholder indexes. * @returns {Array} Returns the new array of composed arguments. */ function composeArgsRight(args, partials, holders) { var holdersIndex = -1, holdersLength = holders.length, argsIndex = -1, argsLength = nativeMax(args.length - holdersLength, 0), rightIndex = -1, rightLength = partials.length, result = Array(argsLength + rightLength); while (++argsIndex < argsLength) { result[argsIndex] = args[argsIndex]; } var pad = argsIndex; while (++rightIndex < rightLength) { result[pad + rightIndex] = partials[rightIndex]; } while (++holdersIndex < holdersLength) { result[pad + holders[holdersIndex]] = args[argsIndex++]; } return result; } /** * Creates a function that aggregates a collection, creating an accumulator * object composed from the results of running each element in the collection * through an iteratee. The `setter` sets the keys and values of the accumulator * object. If `initializer` is provided initializes the accumulator object. * * @private * @param {Function} setter The function to set keys and values of the accumulator object. * @param {Function} [initializer] The function to initialize the accumulator object. * @returns {Function} Returns the new aggregator function. */ function createAggregator(setter, initializer) { return function (collection, iteratee, thisArg) { var result = initializer ? initializer() : {}; iteratee = getCallback(iteratee, thisArg, 3); if (isArray(collection)) { var index = -1, length = collection.length; while (++index < length) { var value = collection[index]; setter(result, value, iteratee(value, index, collection), collection); } } else { baseEach(collection, function (value, key, collection) { setter(result, value, iteratee(value, key, collection), collection); }); } return result; }; } /** * Creates a function that assigns properties of source object(s) to a given * destination object. * * @private * @param {Function} assigner The function to assign values. * @returns {Function} Returns the new assigner function. */ function createAssigner(assigner) { return function () { var length = arguments.length, object = arguments[0]; if (length < 2 || object == null) { return object; } if (length > 3 && isIterateeCall(arguments[1], arguments[2], arguments[3])) { length = 2; } // Juggle arguments. if (length > 3 && typeof arguments[length - 2] == 'function') { var customizer = bindCallback(arguments[--length - 1], arguments[length--], 5); } else if (length > 2 && typeof arguments[length - 1] == 'function') { customizer = arguments[--length]; } var index = 0; while (++index < length) { var source = arguments[index]; if (source) { assigner(object, source, customizer); } } return object; }; } /** * Creates a function that wraps `func` and invokes it with the `this` * binding of `thisArg`. * * @private * @param {Function} func The function to bind. * @param {*} [thisArg] The `this` binding of `func`. * @returns {Function} Returns the new bound function. */ function createBindWrapper(func, thisArg) { var Ctor = createCtorWrapper(func); function wrapper() { return (this instanceof wrapper ? Ctor : func).apply(thisArg, arguments); } return wrapper; } /** * Creates a `Set` cache object to optimize linear searches of large arrays. * * @private * @param {Array} [values] The values to cache. * @returns {null|Object} Returns the new cache object if `Set` is supported, else `null`. */ var createCache = !(nativeCreate && Set) ? constant(null) : function (values) { return new SetCache(values); }; /** * Creates a function that produces compound words out of the words in a * given string. * * @private * @param {Function} callback The function to combine each word. * @returns {Function} Returns the new compounder function. */ function createCompounder(callback) { return function (string) { var index = -1, array = words(deburr(string)), length = array.length, result = ''; while (++index < length) { result = callback(result, array[index], index); } return result; }; } /** * Creates a function that produces an instance of `Ctor` regardless of * whether it was invoked as part of a `new` expression or by `call` or `apply`. * * @private * @param {Function} Ctor The constructor to wrap. * @returns {Function} Returns the new wrapped function. */ function createCtorWrapper(Ctor) { return function () { var thisBinding = baseCreate(Ctor.prototype), result = Ctor.apply(thisBinding, arguments); // Mimic the constructor's `return` behavior. // See https://es5.github.io/#x13.2.2 for more details. return isObject(result) ? result : thisBinding; }; } /** * Creates a function that gets the extremum value of a collection. * * @private * @param {Function} arrayFunc The function to get the extremum value from an array. * @param {boolean} [isMin] Specify returning the minimum, instead of the maximum, * extremum value. * @returns {Function} Returns the new extremum function. */ function createExtremum(arrayFunc, isMin) { return function (collection, iteratee, thisArg) { if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { iteratee = null; } var func = getCallback(), noIteratee = iteratee == null; if (!(func === baseCallback && noIteratee)) { noIteratee = false; iteratee = func(iteratee, thisArg, 3); } if (noIteratee) { var isArr = isArray(collection); if (!isArr && isString(collection)) { iteratee = charAtCallback; } else { return arrayFunc(isArr ? collection : toIterable(collection)); } } return extremumBy(collection, iteratee, isMin); }; } /** * Creates a function that wraps `func` and invokes it with optional `this` * binding of, partial application, and currying. * * @private * @param {Function|string} func The function or method name to reference. * @param {number} bitmask The bitmask of flags. See `createWrapper` for more details. * @param {*} [thisArg] The `this` binding of `func`. * @param {Array} [partials] The arguments to prepend to those provided to the new function. * @param {Array} [holders] The `partials` placeholder indexes. * @param {Array} [partialsRight] The arguments to append to those provided to the new function. * @param {Array} [holdersRight] The `partialsRight` 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 createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { var isAry = bitmask & ARY_FLAG, isBind = bitmask & BIND_FLAG, isBindKey = bitmask & BIND_KEY_FLAG, isCurry = bitmask & CURRY_FLAG, isCurryBound = bitmask & CURRY_BOUND_FLAG, isCurryRight = bitmask & CURRY_RIGHT_FLAG; var Ctor = !isBindKey && createCtorWrapper(func), key = func; function wrapper() { // Avoid `arguments` object use disqualifying optimizations by // converting it to an array before providing it to other functions. var length = arguments.length, index = length, args = Array(length); while (index--) { args[index] = arguments[index]; } if (partials) { args = composeArgs(args, partials, holders); } if (partialsRight) { args = composeArgsRight(args, partialsRight, holdersRight); } if (isCurry || isCurryRight) { var placeholder = wrapper.placeholder, argsHolders = replaceHolders(args, placeholder); length -= argsHolders.length; if (length < arity) { var newArgPos = argPos ? arrayCopy(argPos) : null, newArity = nativeMax(arity - length, 0), newsHolders = isCurry ? argsHolders : null, newHoldersRight = isCurry ? null : argsHolders, newPartials = isCurry ? args : null, newPartialsRight = isCurry ? null : args; bitmask |= isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG; bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG); if (!isCurryBound) { bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG); } var result = createHybridWrapper(func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, ary, newArity); result.placeholder = placeholder; return result; } } var thisBinding = isBind ? thisArg : this; if (isBindKey) { func = thisBinding[key]; } if (argPos) { args = reorder(args, argPos); } if (isAry && ary < args.length) { args.length = ary; } return (this instanceof wrapper ? Ctor || createCtorWrapper(func) : func).apply(thisBinding, args); } return wrapper; } /** * Creates the pad required for `string` based on the given padding length. * The `chars` string may be truncated if the number of padding characters * exceeds the padding length. * * @private * @param {string} string The string to create padding for. * @param {number} [length=0] The padding length. * @param {string} [chars=' '] The string used as padding. * @returns {string} Returns the pad for `string`. */ function createPad(string, length, chars) { var strLength = string.length; length = +length; if (strLength >= length || !nativeIsFinite(length)) { return ''; } var padLength = length - strLength; chars = chars == null ? ' ' : chars + ''; return repeat(chars, ceil(padLength / chars.length)).slice(0, padLength); } /** * Creates a function that wraps `func` and invokes it with the optional `this` * binding of `thisArg` and the `partials` prepended to those provided to * the wrapper. * * @private * @param {Function} func The function to partially apply arguments to. * @param {number} bitmask The bitmask of flags. See `createWrapper` for more details. * @param {*} thisArg The `this` binding of `func`. * @param {Array} partials The arguments to prepend to those provided to the new function. * @returns {Function} Returns the new bound function. */ function createPartialWrapper(func, bitmask, thisArg, partials) { var isBind = bitmask & BIND_FLAG, Ctor = createCtorWrapper(func); function wrapper() { // Avoid `arguments` object use disqualifying optimizations by // converting it to an array before providing it `func`. var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array(argsLength + leftLength); while (++leftIndex < leftLength) { args[leftIndex] = partials[leftIndex]; } while (argsLength--) { args[leftIndex++] = arguments[++argsIndex]; } return (this instanceof wrapper ? Ctor : func).apply(isBind ? thisArg : this, args); } return wrapper; } /** * 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 reference. * @param {number} bitmask The bitmask of 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 && !isFunction(func)) { throw new TypeError(FUNC_ERROR_TEXT); } var length = partials ? partials.length : 0; if (!length) { bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG); partials = holders = null; } length -= holders ? holders.length : 0; if (bitmask & PARTIAL_RIGHT_FLAG) { var partialsRight = partials, holdersRight = holders; partials = holders = null; } var data = !isBindKey && getData(func), newData = [ func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity ]; if (data && data !== true) { mergeData(newData, data); bitmask = newData[1]; arity = newData[9]; } newData[9] = arity == null ? isBindKey ? 0 : func.length : nativeMax(arity - length, 0) || 0; if (bitmask == BIND_FLAG) { var result = createBindWrapper(newData[0], newData[2]); } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !newData[4].length) { result = createPartialWrapper.apply(null, newData); } else { result = createHybridWrapper.apply(null, newData); } var setter = data ? baseSetData : setData; return setter(result, newData); } /** * A specialized version of `baseIsEqualDeep` for arrays with support for * partial deep comparisons. * * @private * @param {Array} array The array to compare. * @param {Array} other The other array to compare. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Function} [customizer] The function to customize comparing arrays. * @param {boolean} [isWhere] Specify performing partial comparisons. * @param {Array} [stackA] Tracks traversed `value` objects. * @param {Array} [stackB] Tracks traversed `other` objects. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. */ function equalArrays(array, other, equalFunc, customizer, isWhere, stackA, stackB) { var index = -1, arrLength = array.length, othLength = other.length, result = true; if (arrLength != othLength && !(isWhere && othLength > arrLength)) { return false; } // Deep compare the contents, ignoring non-numeric properties. while (result && ++index < arrLength) { var arrValue = array[index], othValue = other[index]; result = undefined; if (customizer) { result = isWhere ? customizer(othValue, arrValue, index) : customizer(arrValue, othValue, index); } if (typeof result == 'undefined') { // Recursively compare arrays (susceptible to call stack limits). if (isWhere) { var othIndex = othLength; while (othIndex--) { othValue = other[othIndex]; result = arrValue && arrValue === othValue || equalFunc(arrValue, othValue, customizer, isWhere, stackA, stackB); if (result) { break; } } } else { result = arrValue && arrValue === othValue || equalFunc(arrValue, othValue, customizer, isWhere, stackA, stackB); } } } return !!result; } /** * A specialized version of `baseIsEqualDeep` for comparing objects of * the same `toStringTag`. * * **Note:** This function only supports comparing values with tags of * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. * * @private * @param {Object} value The object to compare. * @param {Object} other The other object to compare. * @param {string} tag The `toStringTag` of the objects to compare. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function equalByTag(object, other, tag) { switch (tag) { case boolTag: case dateTag: // 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 +object == +other; case errorTag: return object.name == other.name && object.message == other.message; case numberTag: // Treat `NaN` vs. `NaN` as equal. return object != +object ? other != +other : object == 0 ? 1 / object == 1 / other : object == +other; case regexpTag: case stringTag: // Coerce regexes to strings and treat strings primitives and string // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details. return object == other + ''; } return false; } /** * A specialized version of `baseIsEqualDeep` for objects with support for * partial deep comparisons. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Function} [customizer] The function to customize comparing values. * @param {boolean} [isWhere] Specify performing partial comparisons. * @param {Array} [stackA] Tracks traversed `value` objects. * @param {Array} [stackB] Tracks traversed `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function equalObjects(object, other, equalFunc, customizer, isWhere, stackA, stackB) { var objProps = keys(object), objLength = objProps.length, othProps = keys(other), othLength = othProps.length; if (objLength != othLength && !isWhere) { return false; } var hasCtor, index = -1; while (++index < objLength) { var key = objProps[index], result = hasOwnProperty.call(other, key); if (result) { var objValue = object[key], othValue = other[key]; result = undefined; if (customizer) { result = isWhere ? customizer(othValue, objValue, key) : customizer(objValue, othValue, key); } if (typeof result == 'undefined') { // Recursively compare objects (susceptible to call stack limits). result = objValue && objValue === othValue || equalFunc(objValue, othValue, customizer, isWhere, stackA, stackB); } } if (!result) { return false; } hasCtor || (hasCtor = key == 'constructor'); } if (!hasCtor) { var objCtor = object.constructor, othCtor = other.constructor; // Non `Object` object instances with different constructors are not equal. if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) && !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) { return false; } } return true; } /** * Gets the extremum value of `collection` invoking `iteratee` for each value * in `collection` to generate the criterion by which the value is ranked. * The `iteratee` is invoked with three arguments; (value, index, collection). * * @private * @param {Array|Object|string} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {boolean} [isMin] Specify returning the minimum, instead of the * maximum, extremum value. * @returns {*} Returns the extremum value. */ function extremumBy(collection, iteratee, isMin) { var exValue = isMin ? POSITIVE_INFINITY : NEGATIVE_INFINITY, computed = exValue, result = computed; baseEach(collection, function (value, index, collection) { var current = iteratee(value, index, collection); if ((isMin ? current < computed : current > computed) || current === exValue && current === result) { computed = current; result = value; } }); return result; } /** * Gets the appropriate "callback" function. If the `_.callback` method is * customized this function returns the custom method, otherwise it returns * the `baseCallback` function. If arguments are provided the chosen function * is invoked with them and its result is returned. * * @private * @returns {Function} Returns the chosen function or its result. */ function getCallback(func, thisArg, argCount) { var result = lodash.callback || callback; result = result === callback ? baseCallback : result; return argCount ? result(func, thisArg, argCount) : result; } /** * Gets metadata for `func`. * * @private * @param {Function} func The function to query. * @returns {*} Returns the metadata for `func`. */ var getData = !metaMap ? noop : function (func) { return metaMap.get(func); }; /** * Gets the appropriate "indexOf" function. If the `_.indexOf` method is * customized this function returns the custom method, otherwise it returns * the `baseIndexOf` function. If arguments are provided the chosen function * is invoked with them and its result is returned. * * @private * @returns {Function|number} Returns the chosen function or its result. */ function getIndexOf(collection, target, fromIndex) { var result = lodash.indexOf || indexOf; result = result === indexOf ? baseIndexOf : result; return collection ? result(collection, target, fromIndex) : result; } /** * Gets the view, applying any `transforms` to the `start` and `end` positions. * * @private * @param {number} start The start of the view. * @param {number} end The end of the view. * @param {Array} [transforms] The transformations to apply to the view. * @returns {Object} Returns an object containing the `start` and `end` * positions of the view. */ function getView(start, end, transforms) { var index = -1, length = transforms ? transforms.length : 0; while (++index < length) { var data = transforms[index], size = data.size; switch (data.type) { case 'drop': start += size; break; case 'dropRight': end -= size; break; case 'take': end = nativeMin(end, start + size); break; case 'takeRight': start = nativeMax(start, end - size); break; } } return { 'start': start, 'end': end }; } /** * Initializes an array clone. * * @private * @param {Array} array The array to clone. * @returns {Array} Returns the initialized clone. */ function initCloneArray(array) { var length = array.length, result = new array.constructor(length); // Add array properties assigned by `RegExp#exec`. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { result.index = array.index; result.input = array.input; } return result; } /** * Initializes an object clone. * * @private * @param {Object} object The object to clone. * @returns {Object} Returns the initialized clone. */ function initCloneObject(object) { var Ctor = object.constructor; if (!(typeof Ctor == 'function' && Ctor instanceof Ctor)) { Ctor = Object; } return new Ctor(); } /** * Initializes an object clone based on its `toStringTag`. * * **Note:** This function only supports cloning values with tags of * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. * * * @private * @param {Object} object The object to clone. * @param {string} tag The `toStringTag` of the object to clone. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the initialized clone. */ function initCloneByTag(object, tag, isDeep) { var Ctor = object.constructor; switch (tag) { case arrayBufferTag: return bufferClone(object); case boolTag: case dateTag: return new Ctor(+object); case float32Tag: case float64Tag: case int8Tag: case int16Tag: case int32Tag: case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: var buffer = object.buffer; return new Ctor(isDeep ? bufferClone(buffer) : buffer, object.byteOffset, object.length); case numberTag: case stringTag: return new Ctor(object); case regexpTag: var result = new Ctor(object.source, reFlags.exec(object)); result.lastIndex = object.lastIndex; } return result; } /** * Checks if `func` is eligible for `this` binding. * * @private * @param {Function} func The function to check. * @returns {boolean} Returns `true` if `func` is eligible, else `false`. */ function isBindable(func) { var support = lodash.support, result = !(support.funcNames ? func.name : support.funcDecomp); if (!result) { var source = fnToString.call(func); if (!support.funcNames) { result = !reFuncName.test(source); } if (!result) { // Check if `func` references the `this` keyword and store the result. result = reThis.test(source) || isNative(func); baseSetData(func, result); } } return result; } /** * Checks if `value` is a valid array-like index. * * @private * @param {*} value The value to check. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. */ function isIndex(value, length) { value = +value; length = length == null ? MAX_SAFE_INTEGER : length; return value > -1 && value % 1 == 0 && value < length; } /** * Checks if the provided arguments are from an iteratee call. * * @private * @param {*} value The potential iteratee value argument. * @param {*} index The potential iteratee index or key argument. * @param {*} object The potential iteratee object argument. * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`. */ function isIterateeCall(value, index, object) { if (!isObject(object)) { return false; } var type = typeof index; if (type == 'number') { var length = object.length, prereq = isLength(length) && isIndex(index, length); } else { prereq = type == 'string' && index in object; } return prereq && object[index] === value; } /** * Checks if `value` is a valid array-like length. * * **Note:** This function is based on ES `ToLength`. See the * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength) * for more details. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. */ function isLength(value) { return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` if suitable for strict * equality comparisons, else `false`. */ function isStrictComparable(value) { return value === value && (value === 0 ? 1 / value > 0 : !isObject(value)); } /** * Merges the function metadata of `source` into `data`. * * Merging metadata reduces the number of wrappers required to invoke a function. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial` * may be applied regardless of execution order. Methods like `_.ary` and `_.rearg` * augment function arguments, making the order in which they are executed important, * preventing the merging of metadata. However, we make an exception for a safe * common case where curried functions have `_.ary` and or `_.rearg` applied. * * @private * @param {Array} data The destination metadata. * @param {Array} source The source metadata. * @returns {Array} Returns `data`. */ function mergeData(data, source) { var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask; var arityFlags = ARY_FLAG | REARG_FLAG, bindFlags = BIND_FLAG | BIND_KEY_FLAG, comboFlags = arityFlags | bindFlags | CURRY_BOUND_FLAG | CURRY_RIGHT_FLAG; var isAry = bitmask & ARY_FLAG && !(srcBitmask & ARY_FLAG), isRearg = bitmask & REARG_FLAG && !(srcBitmask & REARG_FLAG), argPos = (isRearg ? data : source)[7], ary = (isAry ? data : source)[8]; var isCommon = !(bitmask >= REARG_FLAG && srcBitmask > bindFlags) && !(bitmask > bindFlags && srcBitmask >= REARG_FLAG); var isCombo = newBitmask >= arityFlags && newBitmask <= comboFlags && (bitmask < REARG_FLAG || (isRearg || isAry) && argPos.length <= ary); // Exit early if metadata can't be merged. if (!(isCommon || isCombo)) { return data; } // Use source `thisArg` if available. if (srcBitmask & BIND_FLAG) { data[2] = source[2]; // Set when currying a bound function. newBitmask |= bitmask & BIND_FLAG ? 0 : CURRY_BOUND_FLAG; } // Compose partial arguments. var value = source[3]; if (value) { var partials = data[3]; data[3] = partials ? composeArgs(partials, value, source[4]) : arrayCopy(value); data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : arrayCopy(source[4]); } // Compose partial right arguments. value = source[5]; if (value) { partials = data[5]; data[5] = partials ? composeArgsRight(partials, value, source[6]) : arrayCopy(value); data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : arrayCopy(source[6]); } // Use source `argPos` if available. value = source[7]; if (value) { data[7] = arrayCopy(value); } // Use source `ary` if it's smaller. if (srcBitmask & ARY_FLAG) { data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); } // Use source `arity` if one is not provided. if (data[9] == null) { data[9] = source[9]; } // Use source `func` and merge bitmasks. data[0] = source[0]; data[1] = newBitmask; return data; } /** * A specialized version of `_.pick` that picks `object` properties specified * by the `props` array. * * @private * @param {Object} object The source object. * @param {string[]} props The property names to pick. * @returns {Object} Returns the new object. */ function pickByArray(object, props) { object = toObject(object); var index = -1, length = props.length, result = {}; while (++index < length) { var key = props[index]; if (key in object) { result[key] = object[key]; } } return result; } /** * A specialized version of `_.pick` that picks `object` properties `predicate` * returns truthy for. * * @private * @param {Object} object The source object. * @param {Function} predicate The function invoked per iteration. * @returns {Object} Returns the new object. */ function pickByCallback(object, predicate) { var result = {}; baseForIn(object, function (value, key, object) { if (predicate(value, key, object)) { result[key] = value; } }); return result; } /** * Reorder `array` according to the specified indexes where the element at * the first index is assigned as the first element, the element at * the second index is assigned as the second element, and so on. * * @private * @param {Array} array The array to reorder. * @param {Array} indexes The arranged array indexes. * @returns {Array} Returns `array`. */ function reorder(array, indexes) { var arrLength = array.length, length = nativeMin(indexes.length, arrLength), oldArray = arrayCopy(array); while (length--) { var index = indexes[length]; array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; } return array; } /** * Sets metadata for `func`. * * **Note:** If this function becomes hot, i.e. is invoked a lot in a short * period of time, it will trip its breaker and transition to an identity function * to avoid garbage collection pauses in V8. See [V8 issue 2070](https://code.google.com/p/v8/issues/detail?id=2070) * for more details. * * @private * @param {Function} func The function to associate metadata with. * @param {*} data The metadata. * @returns {Function} Returns `func`. */ var setData = function () { var count = 0, lastCalled = 0; return function (key, value) { var stamp = now(), remaining = HOT_SPAN - (stamp - lastCalled); lastCalled = stamp; if (remaining > 0) { if (++count >= HOT_COUNT) { return key; } } else { count = 0; } return baseSetData(key, value); }; }(); /** * A fallback implementation of `_.isPlainObject` which checks if `value` * is an object created by the `Object` constructor or has a `[[Prototype]]` * of `null`. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. */ function shimIsPlainObject(value) { var Ctor, support = lodash.support; // Exit early for non `Object` objects. if (!(isObjectLike(value) && objToString.call(value) == objectTag) || !hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor))) { return false; } // IE < 9 iterates inherited properties before own properties. If the first // iterated property is an object's own property then there are no inherited // enumerable properties. var result; // In most environments an object's own properties are iterated before // its inherited properties. If the last iterated property is an object's // own property then there are no inherited enumerable properties. baseForIn(value, function (subValue, key) { result = key; }); return typeof result == 'undefined' || hasOwnProperty.call(value, result); } /** * A fallback implementation of `Object.keys` which creates an array of the * own enumerable property names of `object`. * * @private * @param {Object} object The object to inspect. * @returns {Array} Returns the array of property names. */ function shimKeys(object) { var props = keysIn(object), propsLength = props.length, length = propsLength && object.length, support = lodash.support; var allowIndexes = length && isLength(length) && (isArray(object) || support.nonEnumArgs && isArguments(object)); var index = -1, result = []; while (++index < propsLength) { var key = props[index]; if (allowIndexes && isIndex(key, length) || hasOwnProperty.call(object, key)) { result.push(key); } } return result; } /** * Converts `value` to an array-like object if it is not one. * * @private * @param {*} value The value to process. * @returns {Array|Object} Returns the array-like object. */ function toIterable(value) { if (value == null) { return []; } if (!isLength(value.length)) { return values(value); } return isObject(value) ? value : Object(value); } /** * Converts `value` to an object if it is not one. * * @private * @param {*} value The value to process. * @returns {Object} Returns the object. */ function toObject(value) { return isObject(value) ? value : Object(value); } /*------------------------------------------------------------------------*/ /** * Creates an array of elements split into groups the length of `size`. * If `collection` can't be split evenly, the final chunk will be the remaining * elements. * * @static * @memberOf _ * @category Array * @param {Array} array The array to process. * @param {numer} [size=1] The length of each chunk. * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. * @returns {Array} Returns the new array containing chunks. * @example * * _.chunk(['a', 'b', 'c', 'd'], 2); * // => [['a', 'b'], ['c', 'd']] * * _.chunk(['a', 'b', 'c', 'd'], 3); * // => [['a', 'b', 'c'], ['d']] */ function chunk(array, size, guard) { if (guard ? isIterateeCall(array, size, guard) : size == null) { size = 1; } else { size = nativeMax(+size || 1, 1); } var index = 0, length = array ? array.length : 0, resIndex = -1, result = Array(ceil(length / size)); while (index < length) { result[++resIndex] = baseSlice(array, index, index += size); } return result; } /** * Creates an array with all falsey values removed. The values `false`, `null`, * `0`, `""`, `undefined`, and `NaN` are falsey. * * @static * @memberOf _ * @category Array * @param {Array} array The array to compact. * @returns {Array} Returns the new array of filtered values. * @example * * _.compact([0, 1, false, 2, '', 3]); * // => [1, 2, 3] */ function compact(array) { var index = -1, length = array ? array.length : 0, resIndex = -1, result = []; while (++index < length) { var value = array[index]; if (value) { result[++resIndex] = value; } } return result; } /** * Creates an array excluding all values of the provided arrays using * `SameValueZero` for equality comparisons. * * **Note:** `SameValueZero` comparisons are like strict equality comparisons, * e.g. `===`, except that `NaN` matches `NaN`. See the * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static * @memberOf _ * @category Array * @param {Array} array The array to inspect. * @param {...Array} [values] The arrays of values to exclude. * @returns {Array} Returns the new array of filtered values. * @example * * _.difference([1, 2, 3], [5, 2, 10]); * // => [1, 3] */ function difference() { var index = -1, length = arguments.length; while (++index < length) { var value = arguments[index]; if (isArray(value) || isArguments(value)) { break; } } return baseDifference(value, baseFlatten(arguments, false, true, ++index)); } /** * Creates a slice of `array` with `n` elements dropped from the beginning. * * @static * @memberOf _ * @type Function * @category Array * @param {Array} array The array to query. * @param {number} [n=1] The number of elements to drop. * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. * @returns {Array} Returns the slice of `array`. * @example * * _.drop([1, 2, 3]); * // => [2, 3] * * _.drop([1, 2, 3], 2); * // => [3] * * _.drop([1, 2, 3], 5); * // => [] * * _.drop([1, 2, 3], 0); * // => [1, 2, 3] */ function drop(array, n, guard) { var length = array ? array.length : 0; if (!length) { return []; } if (guard ? isIterateeCall(array, n, guard) : n == null) { n = 1; } return baseSlice(array, n < 0 ? 0 : n); } /** * Creates a slice of `array` with `n` elements dropped from the end. * * @static * @memberOf _ * @type Function * @category Array * @param {Array} array The array to query. * @param {number} [n=1] The number of elements to drop. * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. * @returns {Array} Returns the slice of `array`. * @example * * _.dropRight([1, 2, 3]); * // => [1, 2] * * _.dropRight([1, 2, 3], 2); * // => [1] * * _.dropRight([1, 2, 3], 5); * // => [] * * _.dropRight([1, 2, 3], 0); * // => [1, 2, 3] */ function dropRight(array, n, guard) { var length = array ? array.length : 0; if (!length) { return []; } if (guard ? isIterateeCall(array, n, guard) : n == null) { n = 1; } n = length - (+n || 0); return baseSlice(array, 0, n < 0 ? 0 : n); } /** * Creates a slice of `array` excluding elements dropped from the end. * Elements are dropped until `predicate` returns falsey. The predicate is * bound to `thisArg` and invoked with three arguments; (value, index, array). * * If a property name is provided for `predicate` the created "_.property" * style callback returns the property value of the given element. * * If an object is provided for `predicate` the created "_.matches" style * callback returns `true` for elements that have the properties of the given * object, else `false`. * * @static * @memberOf _ * @type Function * @category Array * @param {Array} array The array to query. * @param {Function|Object|string} [predicate=_.identity] The function invoked * per element. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the slice of `array`. * @example * * _.dropRightWhile([1, 2, 3], function(n) { return n > 1; }); * // => [1] * * var users = [ * { 'user': 'barney', 'status': 'busy', 'active': false }, * { 'user': 'fred', 'status': 'busy', 'active': true }, * { 'user': 'pebbles', 'status': 'away', 'active': true } * ]; * * // using the "_.property" callback shorthand * _.pluck(_.dropRightWhile(users, 'active'), 'user'); * // => ['barney'] * * // using the "_.matches" callback shorthand * _.pluck(_.dropRightWhile(users, { 'status': 'away' }), 'user'); * // => ['barney', 'fred'] */ function dropRightWhile(array, predicate, thisArg) { var length = array ? array.length : 0; if (!length) { return []; } predicate = getCallback(predicate, thisArg, 3); while (length-- && predicate(array[length], length, array)) { } return baseSlice(array, 0, length + 1); } /** * Creates a slice of `array` excluding elements dropped from the beginning. * Elements are dropped until `predicate` returns falsey. The predicate is * bound to `thisArg` and invoked with three arguments; (value, index, array). * * If a property name is provided for `predicate` the created "_.property" * style callback returns the property value of the given element. * * If an object is provided for `predicate` the created "_.matches" style * callback returns `true` for elements that have the properties of the given * object, else `false`. * * @static * @memberOf _ * @type Function * @category Array * @param {Array} array The array to query. * @param {Function|Object|string} [predicate=_.identity] The function invoked * per element. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the slice of `array`. * @example * * _.dropWhile([1, 2, 3], function(n) { return n < 3; }); * // => [3] * * var users = [ * { 'user': 'barney', 'status': 'busy', 'active': true }, * { 'user': 'fred', 'status': 'busy', 'active': false }, * { 'user': 'pebbles', 'status': 'away', 'active': true } * ]; * * // using the "_.property" callback shorthand * _.pluck(_.dropWhile(users, 'active'), 'user'); * // => ['fred', 'pebbles'] * * // using the "_.matches" callback shorthand * _.pluck(_.dropWhile(users, { 'status': 'busy' }), 'user'); * // => ['pebbles'] */ function dropWhile(array, predicate, thisArg) { var length = array ? array.length : 0; if (!length) { return []; } var index = -1; predicate = getCallback(predicate, thisArg, 3); while (++index < length && predicate(array[index], index, array)) { } return baseSlice(array, index); } /** * This method is like `_.find` except that it returns the index of the first * element `predicate` returns truthy for, instead of the element itself. * * If a property name is provided for `predicate` the created "_.property" * style callback returns the property value of the given element. * * If an object is provided for `predicate` the created "_.matches" style * callback returns `true` for elements that have the properties of the given * object, else `false`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to search. * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {number} Returns the index of the found element, else `-1`. * @example * * var users = [ * { 'user': 'barney', 'age': 36, 'active': false }, * { 'user': 'fred', 'age': 40, 'active': true }, * { 'user': 'pebbles', 'age': 1, 'active': false } * ]; * * _.findIndex(users, function(chr) { return chr.age < 40; }); * // => 0 * * // using the "_.matches" callback shorthand * _.findIndex(users, { 'age': 1 }); * // => 2 * * // using the "_.property" callback shorthand * _.findIndex(users, 'active'); * // => 1 */ function findIndex(array, predicate, thisArg) { var index = -1, length = array ? array.length : 0; predicate = getCallback(predicate, thisArg, 3); while (++index < length) { if (predicate(array[index], index, array)) { return index; } } return -1; } /** * This method is like `_.findIndex` except that it iterates over elements * of `collection` from right to left. * * If a property name is provided for `predicate` the created "_.property" * style callback returns the property value of the given element. * * If an object is provided for `predicate` the created "_.matches" style * callback returns `true` for elements that have the properties of the given * object, else `false`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to search. * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {number} Returns the index of the found element, else `-1`. * @example * * var users = [ * { 'user': 'barney', 'age': 36, 'active': true }, * { 'user': 'fred', 'age': 40, 'active': false }, * { 'user': 'pebbles', 'age': 1, 'active': false } * ]; * * _.findLastIndex(users, function(chr) { return chr.age < 40; }); * // => 2 * * // using the "_.matches" callback shorthand * _.findLastIndex(users, { 'age': 40 }); * // => 1 * * // using the "_.property" callback shorthand * _.findLastIndex(users, 'active'); * // => 0 */ function findLastIndex(array, predicate, thisArg) { var length = array ? array.length : 0; predicate = getCallback(predicate, thisArg, 3); while (length--) { if (predicate(array[length], length, array)) { return length; } } return -1; } /** * Gets the first element of `array`. * * @static * @memberOf _ * @alias head * @category Array * @param {Array} array The array to query. * @returns {*} Returns the first element of `array`. * @example * * _.first([1, 2, 3]); * // => 1 * * _.first([]); * // => undefined */ function first(array) { return array ? array[0] : undefined; } /** * Flattens a nested array. If `isDeep` is `true` the array is recursively * flattened, otherwise it is only flattened a single level. * * @static * @memberOf _ * @category Array * @param {Array} array The array to flatten. * @param {boolean} [isDeep] Specify a deep flatten. * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. * @returns {Array} Returns the new flattened array. * @example * * _.flatten([1, [2], [3, [[4]]]]); * // => [1, 2, 3, [[4]]]; * * // using `isDeep` * _.flatten([1, [2], [3, [[4]]]], true); * // => [1, 2, 3, 4]; */ function flatten(array, isDeep, guard) { var length = array ? array.length : 0; if (guard && isIterateeCall(array, isDeep, guard)) { isDeep = false; } return length ? baseFlatten(array, isDeep) : []; } /** * Recursively flattens a nested array. * * @static * @memberOf _ * @category Array * @param {Array} array The array to recursively flatten. * @returns {Array} Returns the new flattened array. * @example * * _.flattenDeep([1, [2], [3, [[4]]]]); * // => [1, 2, 3, 4]; */ function flattenDeep(array) { var length = array ? array.length : 0; return length ? baseFlatten(array, true) : []; } /** * Gets the index at which the first occurrence of `value` is found in `array` * using `SameValueZero` for equality comparisons. If `fromIndex` is negative, * it is used as the offset from the end of `array`. If `array` is sorted * providing `true` for `fromIndex` performs a faster binary search. * * **Note:** `SameValueZero` comparisons are like strict equality comparisons, * e.g. `===`, except that `NaN` matches `NaN`. See the * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static * @memberOf _ * @category Array * @param {Array} array The array to search. * @param {*} value The value to search for. * @param {boolean|number} [fromIndex=0] The index to search from or `true` * to perform a binary search on a sorted array. * @returns {number} Returns the index of the matched value, else `-1`. * @example * * _.indexOf([1, 2, 3, 1, 2, 3], 2); * // => 1 * * // using `fromIndex` * _.indexOf([1, 2, 3, 1, 2, 3], 2, 3); * // => 4 * * // performing a binary search * _.indexOf([4, 4, 5, 5, 6, 6], 5, true); * // => 2 */ function indexOf(array, value, fromIndex) { var length = array ? array.length : 0; if (!length) { return -1; } if (typeof fromIndex == 'number') { fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex || 0; } else if (fromIndex) { var index = binaryIndex(array, value), other = array[index]; return (value === value ? value === other : other !== other) ? index : -1; } return baseIndexOf(array, value, fromIndex); } /** * Gets all but the last element of `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to query. * @returns {Array} Returns the slice of `array`. * @example * * _.initial([1, 2, 3]); * // => [1, 2] */ function initial(array) { return dropRight(array, 1); } /** * Creates an array of unique values in all provided arrays using `SameValueZero` * for equality comparisons. * * **Note:** `SameValueZero` comparisons are like strict equality comparisons, * e.g. `===`, except that `NaN` matches `NaN`. See the * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to inspect. * @returns {Array} Returns the new array of shared values. * @example * * _.intersection([1, 2, 3], [5, 2, 1, 4], [2, 1]); * // => [1, 2] */ function intersection() { var args = [], argsIndex = -1, argsLength = arguments.length, caches = [], indexOf = getIndexOf(), isCommon = indexOf == baseIndexOf; while (++argsIndex < argsLength) { var value = arguments[argsIndex]; if (isArray(value) || isArguments(value)) { args.push(value); caches.push(isCommon && value.length >= 120 && createCache(argsIndex && value)); } } argsLength = args.length; var array = args[0], index = -1, length = array ? array.length : 0, result = [], seen = caches[0]; outer: while (++index < length) { value = array[index]; if ((seen ? cacheIndexOf(seen, value) : indexOf(result, value)) < 0) { argsIndex = argsLength; while (--argsIndex) { var cache = caches[argsIndex]; if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value)) < 0) { continue outer; } } if (seen) { seen.push(value); } result.push(value); } } return result; } /** * Gets the last element of `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to query. * @returns {*} Returns the last element of `array`. * @example * * _.last([1, 2, 3]); * // => 3 */ function last(array) { var length = array ? array.length : 0; return length ? array[length - 1] : undefined; } /** * This method is like `_.indexOf` except that it iterates over elements of * `array` from right to left. * * @static * @memberOf _ * @category Array * @param {Array} array The array to search. * @param {*} value The value to search for. * @param {boolean|number} [fromIndex=array.length-1] The index to search from * or `true` to perform a binary search on a sorted array. * @returns {number} Returns the index of the matched value, else `-1`. * @example * * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2); * // => 4 * * // using `fromIndex` * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); * // => 1 * * // performing a binary search * _.lastIndexOf([4, 4, 5, 5, 6, 6], 5, true); * // => 3 */ function lastIndexOf(array, value, fromIndex) { var length = array ? array.length : 0; if (!length) { return -1; } var index = length; if (typeof fromIndex == 'number') { index = (fromIndex < 0 ? nativeMax(length + fromIndex, 0) : nativeMin(fromIndex || 0, length - 1)) + 1; } else if (fromIndex) { index = binaryIndex(array, value, true) - 1; var other = array[index]; return (value === value ? value === other : other !== other) ? index : -1; } if (value !== value) { return indexOfNaN(array, index, true); } while (index--) { if (array[index] === value) { return index; } } return -1; } /** * Removes all provided values from `array` using `SameValueZero` for equality * comparisons. * * **Notes:** * - Unlike `_.without`, this method mutates `array`. * - `SameValueZero` comparisons are like strict equality comparisons, e.g. `===`, * except that `NaN` matches `NaN`. See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static * @memberOf _ * @category Array * @param {Array} array The array to modify. * @param {...*} [values] The values to remove. * @returns {Array} Returns `array`. * @example * * var array = [1, 2, 3, 1, 2, 3]; * _.pull(array, 2, 3); * console.log(array); * // => [1, 1] */ function pull() { var array = arguments[0]; if (!(array && array.length)) { return array; } var index = 0, indexOf = getIndexOf(), length = arguments.length; while (++index < length) { var fromIndex = 0, value = arguments[index]; while ((fromIndex = indexOf(array, value, fromIndex)) > -1) { splice.call(array, fromIndex, 1); } } return array; } /** * Removes elements from `array` corresponding to the given indexes and returns * an array of the removed elements. Indexes may be specified as an array of * indexes or as individual arguments. * * **Note:** Unlike `_.at`, this method mutates `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to modify. * @param {...(number|number[])} [indexes] The indexes of elements to remove, * specified as individual indexes or arrays of indexes. * @returns {Array} Returns the new array of removed elements. * @example * * var array = [5, 10, 15, 20]; * var evens = _.pullAt(array, [1, 3]); * * console.log(array); * // => [5, 15] * * console.log(evens); * // => [10, 20] */ function pullAt(array) { return basePullAt(array || [], baseFlatten(arguments, false, false, 1)); } /** * Removes all elements from `array` that `predicate` returns truthy for * and returns an array of the removed elements. The predicate is bound to * `thisArg` and invoked with three arguments; (value, index, array). * * If a property name is provided for `predicate` the created "_.property" * style callback returns the property value of the given element. * * If an object is provided for `predicate` the created "_.matches" style * callback returns `true` for elements that have the properties of the given * object, else `false`. * * **Note:** Unlike `_.filter`, this method mutates `array`. * * @static * @memberOf _ * @category Array * @param {Array} array The array to modify. * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the new array of removed elements. * @example * * var array = [1, 2, 3, 4]; * var evens = _.remove(array, function(n) { return n % 2 == 0; }); * * console.log(array); * // => [1, 3] * * console.log(evens); * // => [2, 4] */ function remove(array, predicate, thisArg) { var index = -1, length = array ? array.length : 0, result = []; predicate = getCallback(predicate, thisArg, 3); while (++index < length) { var value = array[index]; if (predicate(value, index, array)) { result.push(value); splice.call(array, index--, 1); length--; } } return result; } /** * Gets all but the first element of `array`. * * @static * @memberOf _ * @alias tail * @category Array * @param {Array} array The array to query. * @returns {Array} Returns the slice of `array`. * @example * * _.rest([1, 2, 3]); * // => [2, 3] */ function rest(array) { return drop(array, 1); } /** * Creates a slice of `array` from `start` up to, but not including, `end`. * * **Note:** This function is used instead of `Array#slice` to support node * lists in IE < 9 and to ensure dense arrays are returned. * * @static * @memberOf _ * @category Array * @param {Array} array The array to slice. * @param {number} [start=0] The start position. * @param {number} [end=array.length] The end position. * @returns {Array} Returns the slice of `array`. */ function slice(array, start, end) { var length = array ? array.length : 0; if (!length) { return []; } if (end && typeof end != 'number' && isIterateeCall(array, start, end)) { start = 0; end = length; } return baseSlice(array, start, end); } /** * Uses a binary search to determine the lowest index at which `value` should * be inserted into `array` in order to maintain its sort order. If an iteratee * function is provided it is invoked for `value` and each element of `array` * to compute their sort ranking. The iteratee is bound to `thisArg` and * invoked with one argument; (value). * * If a property name is provided for `predicate` the created "_.property" * style callback returns the property value of the given element. * * If an object is provided for `predicate` the created "_.matches" style * callback returns `true` for elements that have the properties of the given * object, else `false`. * * @static * @memberOf _ * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @param {Function|Object|string} [iteratee=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {number} Returns the index at which `value` should be inserted * into `array`. * @example * * _.sortedIndex([30, 50], 40); * // => 1 * * _.sortedIndex([4, 4, 5, 5, 6, 6], 5); * // => 2 * * var dict = { 'data': { 'thirty': 30, 'forty': 40, 'fifty': 50 } }; * * // using an iteratee function * _.sortedIndex(['thirty', 'fifty'], 'forty', function(word) { * return this.data[word]; * }, dict); * // => 1 * * // using the "_.property" callback shorthand * _.sortedIndex([{ 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x'); * // => 1 */ function sortedIndex(array, value, iteratee, thisArg) { var func = getCallback(iteratee); return func === baseCallback && iteratee == null ? binaryIndex(array, value) : binaryIndexBy(array, value, func(iteratee, thisArg, 1)); } /** * This method is like `_.sortedIndex` except that it returns the highest * index at which `value` should be inserted into `array` in order to * maintain its sort order. * * @static * @memberOf _ * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @param {Function|Object|string} [iteratee=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {number} Returns the index at which `value` should be inserted * into `array`. * @example * * _.sortedLastIndex([4, 4, 5, 5, 6, 6], 5); * // => 4 */ function sortedLastIndex(array, value, iteratee, thisArg) { var func = getCallback(iteratee); return func === baseCallback && iteratee == null ? binaryIndex(array, value, true) : binaryIndexBy(array, value, func(iteratee, thisArg, 1), true); } /** * Creates a slice of `array` with `n` elements taken from the beginning. * * @static * @memberOf _ * @type Function * @category Array * @param {Array} array The array to query. * @param {number} [n=1] The number of elements to take. * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. * @returns {Array} Returns the slice of `array`. * @example * * _.take([1, 2, 3]); * // => [1] * * _.take([1, 2, 3], 2); * // => [1, 2] * * _.take([1, 2, 3], 5); * // => [1, 2, 3] * * _.take([1, 2, 3], 0); * // => [] */ function take(array, n, guard) { var length = array ? array.length : 0; if (!length) { return []; } if (guard ? isIterateeCall(array, n, guard) : n == null) { n = 1; } return baseSlice(array, 0, n < 0 ? 0 : n); } /** * Creates a slice of `array` with `n` elements taken from the end. * * @static * @memberOf _ * @type Function * @category Array * @param {Array} array The array to query. * @param {number} [n=1] The number of elements to take. * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. * @returns {Array} Returns the slice of `array`. * @example * * _.takeRight([1, 2, 3]); * // => [3] * * _.takeRight([1, 2, 3], 2); * // => [2, 3] * * _.takeRight([1, 2, 3], 5); * // => [1, 2, 3] * * _.takeRight([1, 2, 3], 0); * // => [] */ function takeRight(array, n, guard) { var length = array ? array.length : 0; if (!length) { return []; } if (guard ? isIterateeCall(array, n, guard) : n == null) { n = 1; } n = length - (+n || 0); return baseSlice(array, n < 0 ? 0 : n); } /** * Creates a slice of `array` with elements taken from the end. Elements are * taken until `predicate` returns falsey. The predicate is bound to `thisArg` * and invoked with three arguments; (value, index, array). * * If a property name is provided for `predicate` the created "_.property" * style callback returns the property value of the given element. * * If an object is provided for `predicate` the created "_.matches" style * callback returns `true` for elements that have the properties of the given * object, else `false`. * * @static * @memberOf _ * @type Function * @category Array * @param {Array} array The array to query. * @param {Function|Object|string} [predicate=_.identity] The function invoked * per element. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the slice of `array`. * @example * * _.takeRightWhile([1, 2, 3], function(n) { return n > 1; }); * // => [2, 3] * * var users = [ * { 'user': 'barney', 'status': 'busy', 'active': false }, * { 'user': 'fred', 'status': 'busy', 'active': true }, * { 'user': 'pebbles', 'status': 'away', 'active': true } * ]; * * // using the "_.property" callback shorthand * _.pluck(_.takeRightWhile(users, 'active'), 'user'); * // => ['fred', 'pebbles'] * * // using the "_.matches" callback shorthand * _.pluck(_.takeRightWhile(users, { 'status': 'away' }), 'user'); * // => ['pebbles'] */ function takeRightWhile(array, predicate, thisArg) { var length = array ? array.length : 0; if (!length) { return []; } predicate = getCallback(predicate, thisArg, 3); while (length-- && predicate(array[length], length, array)) { } return baseSlice(array, length + 1); } /** * Creates a slice of `array` with elements taken from the beginning. Elements * are taken until `predicate` returns falsey. The predicate is bound to * `thisArg` and invoked with three arguments; (value, index, array). * * If a property name is provided for `predicate` the created "_.property" * style callback returns the property value of the given element. * * If an object is provided for `predicate` the created "_.matches" style * callback returns `true` for elements that have the properties of the given * object, else `false`. * * @static * @memberOf _ * @type Function * @category Array * @param {Array} array The array to query. * @param {Function|Object|string} [predicate=_.identity] The function invoked * per element. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the slice of `array`. * @example * * _.takeWhile([1, 2, 3], function(n) { return n < 3; }); * // => [1, 2] * * var users = [ * { 'user': 'barney', 'status': 'busy', 'active': true }, * { 'user': 'fred', 'status': 'busy', 'active': false }, * { 'user': 'pebbles', 'status': 'away', 'active': true } * ]; * * // using the "_.property" callback shorthand * _.pluck(_.takeWhile(users, 'active'), 'user'); * // => ['barney'] * * // using the "_.matches" callback shorthand * _.pluck(_.takeWhile(users, { 'status': 'busy' }), 'user'); * // => ['barney', 'fred'] */ function takeWhile(array, predicate, thisArg) { var length = array ? array.length : 0; if (!length) { return []; } var index = -1; predicate = getCallback(predicate, thisArg, 3); while (++index < length && predicate(array[index], index, array)) { } return baseSlice(array, 0, index); } /** * Creates an array of unique values, in order, of the provided arrays using * `SameValueZero` for equality comparisons. * * **Note:** `SameValueZero` comparisons are like strict equality comparisons, * e.g. `===`, except that `NaN` matches `NaN`. See the * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to inspect. * @returns {Array} Returns the new array of combined values. * @example * * _.union([1, 2, 3], [5, 2, 1, 4], [2, 1]); * // => [1, 2, 3, 5, 4] */ function union() { return baseUniq(baseFlatten(arguments, false, true)); } /** * Creates a duplicate-value-free version of an array using `SameValueZero` * for equality comparisons. Providing `true` for `isSorted` performs a faster * search algorithm for sorted arrays. If an iteratee function is provided it * is invoked for each value in the array to generate the criterion by which * uniqueness is computed. The `iteratee` is bound to `thisArg` and invoked * with three arguments; (value, index, array). * * If a property name is provided for `predicate` the created "_.property" * style callback returns the property value of the given element. * * If an object is provided for `predicate` the created "_.matches" style * callback returns `true` for elements that have the properties of the given * object, else `false`. * * **Note:** `SameValueZero` comparisons are like strict equality comparisons, * e.g. `===`, except that `NaN` matches `NaN`. See the * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static * @memberOf _ * @alias unique * @category Array * @param {Array} array The array to inspect. * @param {boolean} [isSorted] Specify the array is sorted. * @param {Function|Object|string} [iteratee] The function invoked per iteration. * If a property name or object is provided it is used to create a "_.property" * or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Array} Returns the new duplicate-value-free array. * @example * * _.uniq([1, 2, 1]); * // => [1, 2] * * // using `isSorted` * _.uniq([1, 1, 2], true); * // => [1, 2] * * // using an iteratee function * _.uniq([1, 2.5, 1.5, 2], function(n) { return this.floor(n); }, Math); * // => [1, 2.5] * * // using the "_.property" callback shorthand * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 1 }, { 'x': 2 }] */ function uniq(array, isSorted, iteratee, thisArg) { var length = array ? array.length : 0; if (!length) { return []; } // Juggle arguments. if (typeof isSorted != 'boolean' && isSorted != null) { thisArg = iteratee; iteratee = isIterateeCall(array, isSorted, thisArg) ? null : isSorted; isSorted = false; } var func = getCallback(); if (!(func === baseCallback && iteratee == null)) { iteratee = func(iteratee, thisArg, 3); } return isSorted && getIndexOf() == baseIndexOf ? sortedUniq(array, iteratee) : baseUniq(array, iteratee); } /** * This method is like `_.zip` except that it accepts an array of grouped * elements and creates an array regrouping the elements to their pre-`_.zip` * configuration. * * @static * @memberOf _ * @category Array * @param {Array} array The array of grouped elements to process. * @returns {Array} Returns the new array of regrouped elements. * @example * * var zipped = _.zip(['fred', 'barney'], [30, 40], [true, false]); * // => [['fred', 30, true], ['barney', 40, false]] * * _.unzip(zipped); * // => [['fred', 'barney'], [30, 40], [true, false]] */ function unzip(array) { var index = -1, length = (array && array.length && arrayMax(arrayMap(array, getLength))) >>> 0, result = Array(length); while (++index < length) { result[index] = arrayMap(array, baseProperty(index)); } return result; } /** * Creates an array excluding all provided values using `SameValueZero` for * equality comparisons. * * **Note:** `SameValueZero` comparisons are like strict equality comparisons, * e.g. `===`, except that `NaN` matches `NaN`. See the * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static * @memberOf _ * @category Array * @param {Array} array The array to filter. * @param {...*} [values] The values to exclude. * @returns {Array} Returns the new array of filtered values. * @example * * _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); * // => [2, 3, 4] */ function without(array) { return baseDifference(array, baseSlice(arguments, 1)); } /** * Creates an array that is the symmetric difference of the provided arrays. * See [Wikipedia](https://en.wikipedia.org/wiki/Symmetric_difference) for * more details. * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to inspect. * @returns {Array} Returns the new array of values. * @example * * _.xor([1, 2, 3], [5, 2, 1, 4]); * // => [3, 5, 4] * * _.xor([1, 2, 5], [2, 3, 5], [3, 4, 5]); * // => [1, 4, 5] */ function xor() { var index = -1, length = arguments.length; while (++index < length) { var array = arguments[index]; if (isArray(array) || isArguments(array)) { var result = result ? baseDifference(result, array).concat(baseDifference(array, result)) : array; } } return result ? baseUniq(result) : []; } /** * Creates an array of grouped elements, the first of which contains the first * elements of the given arrays, the second of which contains the second elements * of the given arrays, and so on. * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to process. * @returns {Array} Returns the new array of grouped elements. * @example * * _.zip(['fred', 'barney'], [30, 40], [true, false]); * // => [['fred', 30, true], ['barney', 40, false]] */ function zip() { var length = arguments.length, array = Array(length); while (length--) { array[length] = arguments[length]; } return unzip(array); } /** * Creates an object composed from arrays of property names and values. Provide * either a single two dimensional array, e.g. `[[key1, value1], [key2, value2]]` * or two arrays, one of property names and one of corresponding values. * * @static * @memberOf _ * @alias object * @category Array * @param {Array} props The property names. * @param {Array} [values=[]] The property values. * @returns {Object} Returns the new object. * @example * * _.zipObject(['fred', 'barney'], [30, 40]); * // => { 'fred': 30, 'barney': 40 } */ function zipObject(props, values) { var index = -1, length = props ? props.length : 0, result = {}; if (length && !values && !isArray(props[0])) { values = []; } while (++index < length) { var key = props[index]; if (values) { result[key] = values[index]; } else if (key) { result[key[0]] = key[1]; } } return result; } /*------------------------------------------------------------------------*/ /** * Creates a `lodash` object that wraps `value` with explicit method * chaining enabled. * * @static * @memberOf _ * @category Chain * @param {*} value The value to wrap. * @returns {Object} Returns the new `lodash` object. * @example * * var users = [ * { 'user': 'barney', 'age': 36 }, * { 'user': 'fred', 'age': 40 }, * { 'user': 'pebbles', 'age': 1 } * ]; * * var youngest = _.chain(users) * .sortBy('age') * .map(function(chr) { return chr.user + ' is ' + chr.age; }) * .first() * .value(); * // => 'pebbles is 1' */ function chain(value) { var result = lodash(value); result.__chain__ = true; return result; } /** * This method invokes `interceptor` and returns `value`. The interceptor is * bound to `thisArg` and invoked with one argument; (value). The purpose of * this method is to "tap into" a method chain in order to perform operations * on intermediate results within the chain. * * @static * @memberOf _ * @category Chain * @param {*} value The value to provide to `interceptor`. * @param {Function} interceptor The function to invoke. * @param {*} [thisArg] The `this` binding of `interceptor`. * @returns {*} Returns `value`. * @example * * _([1, 2, 3]) * .tap(function(array) { array.pop(); }) * .reverse() * .value(); * // => [2, 1] */ function tap(value, interceptor, thisArg) { interceptor.call(thisArg, value); return value; } /** * This method is like `_.tap` except that it returns the result of `interceptor`. * * @static * @memberOf _ * @category Chain * @param {*} value The value to provide to `interceptor`. * @param {Function} interceptor The function to invoke. * @param {*} [thisArg] The `this` binding of `interceptor`. * @returns {*} Returns the result of `interceptor`. * @example * * _([1, 2, 3]) * .last() * .thru(function(value) { return [value]; }) * .value(); * // => [3] */ function thru(value, interceptor, thisArg) { return interceptor.call(thisArg, value); } /** * Enables explicit method chaining on the wrapper object. * * @name chain * @memberOf _ * @category Chain * @returns {*} Returns the `lodash` object. * @example * * var users = [ * { 'user': 'barney', 'age': 36 }, * { 'user': 'fred', 'age': 40 } * ]; * * // without explicit chaining * _(users).first(); * // => { 'user': 'barney', 'age': 36 } * * // with explicit chaining * _(users).chain() * .first() * .pick('user') * .value(); * // => { 'user': 'barney' } */ function wrapperChain() { return chain(this); } /** * Reverses the wrapped array so the first element becomes the last, the * second element becomes the second to last, and so on. * * **Note:** This method mutates the wrapped array. * * @name reverse * @memberOf _ * @category Chain * @returns {Object} Returns the new reversed `lodash` object. * @example * * var array = [1, 2, 3]; * * _(array).reverse().value() * // => [3, 2, 1] * * console.log(array); * // => [3, 2, 1] */ function wrapperReverse() { var value = this.__wrapped__; if (value instanceof LazyWrapper) { if (this.__actions__.length) { value = new LazyWrapper(this); } return new LodashWrapper(value.reverse()); } return this.thru(function (value) { return value.reverse(); }); } /** * Produces the result of coercing the unwrapped value to a string. * * @name toString * @memberOf _ * @category Chain * @returns {string} Returns the coerced string value. * @example * * _([1, 2, 3]).toString(); * // => '1,2,3' */ function wrapperToString() { return this.value() + ''; } /** * Executes the chained sequence to extract the unwrapped value. * * @name value * @memberOf _ * @alias toJSON, valueOf * @category Chain * @returns {*} Returns the resolved unwrapped value. * @example * * _([1, 2, 3]).value(); * // => [1, 2, 3] */ function wrapperValue() { return baseWrapperValue(this.__wrapped__, this.__actions__); } /*------------------------------------------------------------------------*/ /** * Creates an array of elements corresponding to the given keys, or indexes, * of `collection`. Keys may be specified as individual arguments or as arrays * of keys. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. * @param {...(number|number[]|string|string[])} [props] The property names * or indexes of elements to pick, specified individually or in arrays. * @returns {Array} Returns the new array of picked elements. * @example * * _.at(['a', 'b', 'c', 'd', 'e'], [0, 2, 4]); * // => ['a', 'c', 'e'] * * _.at(['fred', 'barney', 'pebbles'], 0, 2); * // => ['fred', 'pebbles'] */ function at(collection) { var length = collection ? collection.length : 0; if (isLength(length)) { collection = toIterable(collection); } return baseAt(collection, baseFlatten(arguments, false, false, 1)); } /** * Checks if `value` is in `collection` using `SameValueZero` for equality * comparisons. If `fromIndex` is negative, it is used as the offset from * the end of `collection`. * * **Note:** `SameValueZero` comparisons are like strict equality comparisons, * e.g. `===`, except that `NaN` matches `NaN`. See the * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static * @memberOf _ * @alias contains, include * @category Collection * @param {Array|Object|string} collection The collection to search. * @param {*} target The value to search for. * @param {number} [fromIndex=0] The index to search from. * @returns {boolean} Returns `true` if a matching element is found, else `false`. * @example * * _.includes([1, 2, 3], 1); * // => true * * _.includes([1, 2, 3], 1, 2); * // => false * * _.includes({ 'user': 'fred', 'age': 40 }, 'fred'); * // => true * * _.includes('pebbles', 'eb'); * // => true */ function includes(collection, target, fromIndex) { var length = collection ? collection.length : 0; if (!isLength(length)) { collection = values(collection); length = collection.length; } if (!length) { return false; } if (typeof fromIndex == 'number') { fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex || 0; } else { fromIndex = 0; } return typeof collection == 'string' || !isArray(collection) && isString(collection) ? fromIndex < length && collection.indexOf(target, fromIndex) > -1 : getIndexOf(collection, target, fromIndex) > -1; } /** * Creates an object composed of keys generated from the results of running * each element of `collection` through `iteratee`. The corresponding value * of each key is the number of times the key was returned by `iteratee`. * The `iteratee` is bound to `thisArg` and invoked with three arguments; * (value, index|key, collection). * * If a property name is provided for `predicate` the created "_.property" * style callback returns the property value of the given element. * * If an object is provided for `predicate` the created "_.matches" style * callback returns `true` for elements that have the properties of the given * object, else `false`. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Object} Returns the composed aggregate object. * @example * * _.countBy([4.3, 6.1, 6.4], function(n) { return Math.floor(n); }); * // => { '4': 1, '6': 2 } * * _.countBy([4.3, 6.1, 6.4], function(n) { return this.floor(n); }, Math); * // => { '4': 1, '6': 2 } * * _.countBy(['one', 'two', 'three'], 'length'); * // => { '3': 2, '5': 1 } */ var countBy = createAggregator(function (result, value, key) { hasOwnProperty.call(result, key) ? ++result[key] : result[key] = 1; }); /** * Checks if `predicate` returns truthy for **all** elements of `collection`. * The predicate is bound to `thisArg` and invoked with three arguments; * (value, index|key, collection). * * If a property name is provided for `predicate` the created "_.property" * style callback returns the property value of the given element. * * If an object is provided for `predicate` the created "_.matches" style * callback returns `true` for elements that have the properties of the given * object, else `false`. * * @static * @memberOf _ * @alias all * @category Collection * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {boolean} Returns `true` if all elements pass the predicate check, * else `false`. * @example * * _.every([true, 1, null, 'yes']); * // => false * * var users = [ * { 'user': 'barney', 'age': 36 }, * { 'user': 'fred', 'age': 40 } * ]; * * // using the "_.property" callback shorthand * _.every(users, 'age'); * // => true * * // using the "_.matches" callback shorthand * _.every(users, { 'age': 36 }); * // => false */ function every(collection, predicate, thisArg) { var func = isArray(collection) ? arrayEvery : baseEvery; if (typeof predicate != 'function' || typeof thisArg != 'undefined') { predicate = getCallback(predicate, thisArg, 3); } return func(collection, predicate); } /** * Iterates over elements of `collection`, returning an array of all elements * `predicate` returns truthy for. The predicate is bound to `thisArg` and * invoked with three arguments; (value, index|key, collection). * * If a property name is provided for `predicate` the created "_.property" * style callback returns the property value of the given element. * * If an object is provided for `predicate` the created "_.matches" style * callback returns `true` for elements that have the properties of the given * object, else `false`. * * @static * @memberOf _ * @alias select * @category Collection * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the new filtered array. * @example * * var evens = _.filter([1, 2, 3, 4], function(n) { return n % 2 == 0; }); * // => [2, 4] * * var users = [ * { 'user': 'barney', 'age': 36, 'active': false }, * { 'user': 'fred', 'age': 40, 'active': true } * ]; * * // using the "_.property" callback shorthand * _.pluck(_.filter(users, 'active'), 'user'); * // => ['fred'] * * // using the "_.matches" callback shorthand * _.pluck(_.filter(users, { 'age': 36 }), 'user'); * // => ['barney'] */ function filter(collection, predicate, thisArg) { var func = isArray(collection) ? arrayFilter : baseFilter; predicate = getCallback(predicate, thisArg, 3); return func(collection, predicate); } /** * Iterates over elements of `collection`, returning the first element * `predicate` returns truthy for. The predicate is bound to `thisArg` and * invoked with three arguments; (value, index|key, collection). * * If a property name is provided for `predicate` the created "_.property" * style callback returns the property value of the given element. * * If an object is provided for `predicate` the created "_.matches" style * callback returns `true` for elements that have the properties of the given * object, else `false`. * * @static * @memberOf _ * @alias detect * @category Collection * @param {Array|Object|string} collection The collection to search. * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {*} Returns the matched element, else `undefined`. * @example * * var users = [ * { 'user': 'barney', 'age': 36, 'active': false }, * { 'user': 'fred', 'age': 40, 'active': true }, * { 'user': 'pebbles', 'age': 1, 'active': false } * ]; * * _.result(_.find(users, function(chr) { return chr.age < 40; }), 'user'); * // => 'barney' * * // using the "_.matches" callback shorthand * _.result(_.find(users, { 'age': 1 }), 'user'); * // => 'pebbles' * * // using the "_.property" callback shorthand * _.result(_.find(users, 'active'), 'user'); * // => 'fred' */ function find(collection, predicate, thisArg) { if (isArray(collection)) { var index = findIndex(collection, predicate, thisArg); return index > -1 ? collection[index] : undefined; } predicate = getCallback(predicate, thisArg, 3); return baseFind(collection, predicate, baseEach); } /** * This method is like `_.find` except that it iterates over elements of * `collection` from right to left. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to search. * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {*} Returns the matched element, else `undefined`. * @example * * _.findLast([1, 2, 3, 4], function(n) { return n % 2 == 1; }); * // => 3 */ function findLast(collection, predicate, thisArg) { predicate = getCallback(predicate, thisArg, 3); return baseFind(collection, predicate, baseEachRight); } /** * Performs a deep comparison between each element in `collection` and the * source object, returning the first element that has equivalent property * values. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to search. * @param {Object} source The object of property values to match. * @returns {*} Returns the matched element, else `undefined`. * @example * * var users = [ * { 'user': 'barney', 'age': 36, 'status': 'busy' }, * { 'user': 'fred', 'age': 40, 'status': 'busy' } * ]; * * _.result(_.findWhere(users, { 'status': 'busy' }), 'user'); * // => 'barney' * * _.result(_.findWhere(users, { 'age': 40 }), 'user'); * // => 'fred' */ function findWhere(collection, source) { return find(collection, baseMatches(source)); } /** * Iterates over elements of `collection` invoking `iteratee` for each element. * The `iteratee` is bound to `thisArg` and invoked with three arguments; * (value, index|key, collection). Iterator functions may exit iteration early * by explicitly returning `false`. * * **Note:** As with other "Collections" methods, objects with a `length` property * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn` * may be used for object iteration. * * @static * @memberOf _ * @alias each * @category Collection * @param {Array|Object|string} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Array|Object|string} Returns `collection`. * @example * * _([1, 2, 3]).forEach(function(n) { console.log(n); }).value(); * // => logs each value from left to right and returns the array * * _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(n, key) { console.log(n, key); }); * // => logs each value-key pair and returns the object (iteration order is not guaranteed) */ function forEach(collection, iteratee, thisArg) { return typeof iteratee == 'function' && typeof thisArg == 'undefined' && isArray(collection) ? arrayEach(collection, iteratee) : baseEach(collection, bindCallback(iteratee, thisArg, 3)); } /** * This method is like `_.forEach` except that it iterates over elements of * `collection` from right to left. * * @static * @memberOf _ * @alias eachRight * @category Collection * @param {Array|Object|string} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Array|Object|string} Returns `collection`. * @example * * _([1, 2, 3]).forEachRight(function(n) { console.log(n); }).join(','); * // => logs each value from right to left and returns the array */ function forEachRight(collection, iteratee, thisArg) { return typeof iteratee == 'function' && typeof thisArg == 'undefined' && isArray(collection) ? arrayEachRight(collection, iteratee) : baseEachRight(collection, bindCallback(iteratee, thisArg, 3)); } /** * Creates an object composed of keys generated from the results of running * each element of `collection` through `iteratee`. The corresponding value * of each key is an array of the elements responsible for generating the key. * The `iteratee` is bound to `thisArg` and invoked with three arguments; * (value, index|key, collection). * * If a property name is provided for `predicate` the created "_.property" * style callback returns the property value of the given element. * * If an object is provided for `predicate` the created "_.matches" style * callback returns `true` for elements that have the properties of the given * object, else `false`. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Object} Returns the composed aggregate object. * @example * * _.groupBy([4.2, 6.1, 6.4], function(n) { return Math.floor(n); }); * // => { '4': [4.2], '6': [6.1, 6.4] } * * _.groupBy([4.2, 6.1, 6.4], function(n) { return this.floor(n); }, Math); * // => { '4': [4.2], '6': [6.1, 6.4] } * * // using the "_.property" callback shorthand * _.groupBy(['one', 'two', 'three'], 'length'); * // => { '3': ['one', 'two'], '5': ['three'] } */ var groupBy = createAggregator(function (result, value, key) { if (hasOwnProperty.call(result, key)) { result[key].push(value); } else { result[key] = [value]; } }); /** * Creates an object composed of keys generated from the results of running * each element of `collection` through `iteratee`. The corresponding value * of each key is the last element responsible for generating the key. The * iteratee function is bound to `thisArg` and invoked with three arguments; * (value, index|key, collection). * * If a property name is provided for `predicate` the created "_.property" * style callback returns the property value of the given element. * * If an object is provided for `predicate` the created "_.matches" style * callback returns `true` for elements that have the properties of the given * object, else `false`. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Object} Returns the composed aggregate object. * @example * * var keyData = [ * { 'dir': 'left', 'code': 97 }, * { 'dir': 'right', 'code': 100 } * ]; * * _.indexBy(keyData, 'dir'); * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } * * _.indexBy(keyData, function(object) { return String.fromCharCode(object.code); }); * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } * * _.indexBy(keyData, function(object) { return this.fromCharCode(object.code); }, String); * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } */ var indexBy = createAggregator(function (result, value, key) { result[key] = value; }); /** * Invokes the method named by `methodName` on each element in `collection`, * returning an array of the results of each invoked method. Any additional * arguments are provided to each invoked method. If `methodName` is a function * it is invoked for, and `this` bound to, each element in `collection`. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|string} methodName The name of the method to invoke or * the function invoked per iteration. * @param {...*} [args] The arguments to invoke the method with. * @returns {Array} Returns the array of results. * @example * * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort'); * // => [[1, 5, 7], [1, 2, 3]] * * _.invoke([123, 456], String.prototype.split, ''); * // => [['1', '2', '3'], ['4', '5', '6']] */ function invoke(collection, methodName) { return baseInvoke(collection, methodName, baseSlice(arguments, 2)); } /** * Creates an array of values by running each element in `collection` through * `iteratee`. The `iteratee` is bound to `thisArg` and invoked with three * arguments; (value, index|key, collection). * * If a property name is provided for `predicate` the created "_.property" * style callback returns the property value of the given element. * * If an object is provided for `predicate` the created "_.matches" style * callback returns `true` for elements that have the properties of the given * object, else `false`. * * @static * @memberOf _ * @alias collect * @category Collection * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Array} Returns the new mapped array. * @example * * _.map([1, 2, 3], function(n) { return n * 3; }); * // => [3, 6, 9] * * _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(n) { return n * 3; }); * // => [3, 6, 9] (iteration order is not guaranteed) * * var users = [ * { 'user': 'barney' }, * { 'user': 'fred' } * ]; * * // using the "_.property" callback shorthand * _.map(users, 'user'); * // => ['barney', 'fred'] */ function map(collection, iteratee, thisArg) { var func = isArray(collection) ? arrayMap : baseMap; iteratee = getCallback(iteratee, thisArg, 3); return func(collection, iteratee); } /** * Gets the maximum value of `collection`. If `collection` is empty or falsey * `-Infinity` is returned. If an iteratee function is provided it is invoked * for each value in `collection` to generate the criterion by which the value * is ranked. The `iteratee` is bound to `thisArg` and invoked with three * arguments; (value, index, collection). * * If a property name is provided for `predicate` the created "_.property" * style callback returns the property value of the given element. * * If an object is provided for `predicate` the created "_.matches" style * callback returns `true` for elements that have the properties of the given * object, else `false`. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|Object|string} [iteratee] The function invoked per iteration. * If a property name or object is provided it is used to create a "_.property" * or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {*} Returns the maximum value. * @example * * _.max([4, 2, 8, 6]); * // => 8 * * _.max([]); * // => -Infinity * * var users = [ * { 'user': 'barney', 'age': 36 }, * { 'user': 'fred', 'age': 40 } * ]; * * _.max(users, function(chr) { return chr.age; }); * // => { 'user': 'fred', 'age': 40 }; * * // using the "_.property" callback shorthand * _.max(users, 'age'); * // => { 'user': 'fred', 'age': 40 }; */ var max = createExtremum(arrayMax); /** * Gets the minimum value of `collection`. If `collection` is empty or falsey * `Infinity` is returned. If an iteratee function is provided it is invoked * for each value in `collection` to generate the criterion by which the value * is ranked. The `iteratee` is bound to `thisArg` and invoked with three * arguments; (value, index, collection). * * If a property name is provided for `predicate` the created "_.property" * style callback returns the property value of the given element. * * If an object is provided for `predicate` the created "_.matches" style * callback returns `true` for elements that have the properties of the given * object, else `false`. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|Object|string} [iteratee] The function invoked per iteration. * If a property name or object is provided it is used to create a "_.property" * or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {*} Returns the minimum value. * @example * * _.min([4, 2, 8, 6]); * // => 2 * * _.min([]); * // => Infinity * * var users = [ * { 'user': 'barney', 'age': 36 }, * { 'user': 'fred', 'age': 40 } * ]; * * _.min(users, function(chr) { return chr.age; }); * // => { 'user': 'barney', 'age': 36 }; * * // using the "_.property" callback shorthand * _.min(users, 'age'); * // => { 'user': 'barney', 'age': 36 }; */ var min = createExtremum(arrayMin, true); /** * Creates an array of elements split into two groups, the first of which * contains elements `predicate` returns truthy for, while the second of which * contains elements `predicate` returns falsey for. The predicate is bound * to `thisArg` and invoked with three arguments; (value, index|key, collection). * * If a property name is provided for `predicate` the created "_.property" * style callback returns the property value of the given element. * * If an object is provided for `predicate` the created "_.matches" style * callback returns `true` for elements that have the properties of the given * object, else `false`. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the array of grouped elements. * @example * * _.partition([1, 2, 3], function(n) { return n % 2; }); * // => [[1, 3], [2]] * * _.partition([1.2, 2.3, 3.4], function(n) { return this.floor(n) % 2; }, Math); * // => [[1, 3], [2]] * * var users = [ * { 'user': 'barney', 'age': 36, 'active': false }, * { 'user': 'fred', 'age': 40, 'active': true }, * { 'user': 'pebbles', 'age': 1, 'active': false } * ]; * * // using the "_.matches" callback shorthand * _.map(_.partition(users, { 'age': 1 }), function(array) { return _.pluck(array, 'user'); }); * // => [['pebbles'], ['barney', 'fred']] * * // using the "_.property" callback shorthand * _.map(_.partition(users, 'active'), function(array) { return _.pluck(array, 'user'); }); * // => [['fred'], ['barney', 'pebbles']] */ var partition = createAggregator(function (result, value, key) { result[key ? 0 : 1].push(value); }, function () { return [ [], [] ]; }); /** * Gets the value of `key` from all elements in `collection`. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. * @param {string} key The key of the property to pluck. * @returns {Array} Returns the property values. * @example * * var users = [ * { 'user': 'barney', 'age': 36 }, * { 'user': 'fred', 'age': 40 } * ]; * * _.pluck(users, 'user'); * // => ['barney', 'fred'] * * var userIndex = _.indexBy(users, 'user'); * _.pluck(userIndex, 'age'); * // => [36, 40] (iteration order is not guaranteed) */ function pluck(collection, key) { return map(collection, baseProperty(key + '')); } /** * Reduces `collection` to a value which is the accumulated result of running * each element in `collection` through `iteratee`, where each successive * invocation is supplied the return value of the previous. If `accumulator` * is not provided the first element of `collection` is used as the initial * value. The `iteratee` is bound to `thisArg`and invoked with four arguments; * (accumulator, value, index|key, collection). * * @static * @memberOf _ * @alias foldl, inject * @category Collection * @param {Array|Object|string} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {*} Returns the accumulated value. * @example * * var sum = _.reduce([1, 2, 3], function(sum, n) { return sum + n; }); * // => 6 * * var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, n, key) { * result[key] = n * 3; * return result; * }, {}); * // => { 'a': 3, 'b': 6, 'c': 9 } (iteration order is not guaranteed) */ function reduce(collection, iteratee, accumulator, thisArg) { var func = isArray(collection) ? arrayReduce : baseReduce; return func(collection, getCallback(iteratee, thisArg, 4), accumulator, arguments.length < 3, baseEach); } /** * This method is like `_.reduce` except that it iterates over elements of * `collection` from right to left. * * @static * @memberOf _ * @alias foldr * @category Collection * @param {Array|Object|string} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {*} Returns the accumulated value. * @example * * var array = [[0, 1], [2, 3], [4, 5]]; * _.reduceRight(array, function(flattened, other) { return flattened.concat(other); }, []); * // => [4, 5, 2, 3, 0, 1] */ function reduceRight(collection, iteratee, accumulator, thisArg) { var func = isArray(collection) ? arrayReduceRight : baseReduce; return func(collection, getCallback(iteratee, thisArg, 4), accumulator, arguments.length < 3, baseEachRight); } /** * The opposite of `_.filter`; this method returns the elements of `collection` * that `predicate` does **not** return truthy for. * * If a property name is provided for `predicate` the created "_.property" * style callback returns the property value of the given element. * * If an object is provided for `predicate` the created "_.matches" style * callback returns `true` for elements that have the properties of the given * object, else `false`. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the new filtered array. * @example * * var odds = _.reject([1, 2, 3, 4], function(n) { return n % 2 == 0; }); * // => [1, 3] * * var users = [ * { 'user': 'barney', 'age': 36, 'active': false }, * { 'user': 'fred', 'age': 40, 'active': true } * ]; * * // using the "_.property" callback shorthand * _.pluck(_.reject(users, 'active'), 'user'); * // => ['barney'] * * // using the "_.matches" callback shorthand * _.pluck(_.reject(users, { 'age': 36 }), 'user'); * // => ['fred'] */ function reject(collection, predicate, thisArg) { var func = isArray(collection) ? arrayFilter : baseFilter; predicate = getCallback(predicate, thisArg, 3); return func(collection, function (value, index, collection) { return !predicate(value, index, collection); }); } /** * Gets a random element or `n` random elements from a collection. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to sample. * @param {number} [n] The number of elements to sample. * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. * @returns {*} Returns the random sample(s). * @example * * _.sample([1, 2, 3, 4]); * // => 2 * * _.sample([1, 2, 3, 4], 2); * // => [3, 1] */ function sample(collection, n, guard) { if (guard ? isIterateeCall(collection, n, guard) : n == null) { collection = toIterable(collection); var length = collection.length; return length > 0 ? collection[baseRandom(0, length - 1)] : undefined; } var result = shuffle(collection); result.length = nativeMin(n < 0 ? 0 : +n || 0, result.length); return result; } /** * Creates an array of shuffled values, using a version of the Fisher-Yates * shuffle. See [Wikipedia](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle) * for more details. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to shuffle. * @returns {Array} Returns the new shuffled array. * @example * * _.shuffle([1, 2, 3, 4]); * // => [4, 1, 3, 2] */ function shuffle(collection) { collection = toIterable(collection); var index = -1, length = collection.length, result = Array(length); while (++index < length) { var rand = baseRandom(0, index); if (index != rand) { result[index] = result[rand]; } result[rand] = collection[index]; } return result; } /** * Gets the size of `collection` by returning `collection.length` for * array-like values or the number of own enumerable properties for objects. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to inspect. * @returns {number} Returns the size of `collection`. * @example * * _.size([1, 2]); * // => 2 * * _.size({ 'one': 1, 'two': 2, 'three': 3 }); * // => 3 * * _.size('pebbles'); * // => 7 */ function size(collection) { var length = collection ? collection.length : 0; return isLength(length) ? length : keys(collection).length; } /** * Checks if `predicate` returns truthy for **any** element of `collection`. * The function returns as soon as it finds a passing value and does not iterate * over the entire collection. The predicate is bound to `thisArg` and invoked * with three arguments; (value, index|key, collection). * * If a property name is provided for `predicate` the created "_.property" * style callback returns the property value of the given element. * * If an object is provided for `predicate` the created "_.matches" style * callback returns `true` for elements that have the properties of the given * object, else `false`. * * @static * @memberOf _ * @alias any * @category Collection * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {boolean} Returns `true` if any element passes the predicate check, * else `false`. * @example * * _.some([null, 0, 'yes', false], Boolean); * // => true * * var users = [ * { 'user': 'barney', 'age': 36, 'active': false }, * { 'user': 'fred', 'age': 40, 'active': true } * ]; * * // using the "_.property" callback shorthand * _.some(users, 'active'); * // => true * * // using the "_.matches" callback shorthand * _.some(users, { 'age': 1 }); * // => false */ function some(collection, predicate, thisArg) { var func = isArray(collection) ? arraySome : baseSome; if (typeof predicate != 'function' || typeof thisArg != 'undefined') { predicate = getCallback(predicate, thisArg, 3); } return func(collection, predicate); } /** * Creates an array of elements, sorted in ascending order by the results of * running each element in a collection through `iteratee`. This method performs * a stable sort, that is, it preserves the original sort order of equal elements. * The `iteratee` is bound to `thisArg` and invoked with three arguments; * (value, index|key, collection). * * If a property name is provided for `predicate` the created "_.property" * style callback returns the property value of the given element. * * If an object is provided for `predicate` the created "_.matches" style * callback returns `true` for elements that have the properties of the given * object, else `false`. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. * @param {Array|Function|Object|string} [iteratee=_.identity] The function * invoked per iteration. If a property name or an object is provided it is * used to create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Array} Returns the new sorted array. * @example * * _.sortBy([1, 2, 3], function(n) { return Math.sin(n); }); * // => [3, 1, 2] * * _.sortBy([1, 2, 3], function(n) { return this.sin(n); }, Math); * // => [3, 1, 2] * * var users = [ * { 'user': 'fred' }, * { 'user': 'pebbles' }, * { 'user': 'barney' } * ]; * * // using the "_.property" callback shorthand * _.pluck(_.sortBy(users, 'user'), 'user'); * // => ['barney', 'fred', 'pebbles'] */ function sortBy(collection, iteratee, thisArg) { var index = -1, length = collection ? collection.length : 0, result = isLength(length) ? Array(length) : []; if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { iteratee = null; } iteratee = getCallback(iteratee, thisArg, 3); baseEach(collection, function (value, key, collection) { result[++index] = { 'criteria': iteratee(value, key, collection), 'index': index, 'value': value }; }); return baseSortBy(result, compareAscending); } /** * This method is like `_.sortBy` except that it sorts by property names * instead of an iteratee function. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. * @param {...(string|string[])} props The property names to sort by, * specified as individual property names or arrays of property names. * @returns {Array} Returns the new sorted array. * @example * * var users = [ * { 'user': 'barney', 'age': 36 }, * { 'user': 'fred', 'age': 40 }, * { 'user': 'barney', 'age': 26 }, * { 'user': 'fred', 'age': 30 } * ]; * * _.map(_.sortByAll(users, ['user', 'age']), _.values); * // => [['barney', 26], ['barney', 36], ['fred', 30], ['fred', 40]] */ function sortByAll(collection) { var args = arguments; if (args.length > 3 && isIterateeCall(args[1], args[2], args[3])) { args = [ collection, args[1] ]; } var index = -1, length = collection ? collection.length : 0, props = baseFlatten(args, false, false, 1), result = isLength(length) ? Array(length) : []; baseEach(collection, function (value, key, collection) { var length = props.length, criteria = Array(length); while (length--) { criteria[length] = value == null ? undefined : value[props[length]]; } result[++index] = { 'criteria': criteria, 'index': index, 'value': value }; }); return baseSortBy(result, compareMultipleAscending); } /** * Performs a deep comparison between each element in `collection` and the * source object, returning an array of all elements that have equivalent * property values. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to search. * @param {Object} source The object of property values to match. * @returns {Array} Returns the new filtered array. * @example * * var users = [ * { 'user': 'barney', 'age': 36, 'status': 'busy', 'pets': ['hoppy'] }, * { 'user': 'fred', 'age': 40, 'status': 'busy', 'pets': ['baby puss', 'dino'] } * ]; * * _.pluck(_.where(users, { 'age': 36 }), 'user'); * // => ['barney'] * * _.pluck(_.where(users, { 'pets': ['dino'] }), 'user'); * // => ['fred'] * * _.pluck(_.where(users, { 'status': 'busy' }), 'user'); * // => ['barney', 'fred'] */ function where(collection, source) { return filter(collection, baseMatches(source)); } /*------------------------------------------------------------------------*/ /** * Gets the number of milliseconds that have elapsed since the Unix epoch * (1 January 1970 00:00:00 UTC). * * @static * @memberOf _ * @category Date * @example * * _.defer(function(stamp) { console.log(_.now() - stamp); }, _.now()); * // => logs the number of milliseconds it took for the deferred function to be invoked */ var now = nativeNow || function () { return new Date().getTime(); }; /*------------------------------------------------------------------------*/ /** * The opposite of `_.before`; this method creates a function that invokes * `func` once it is called `n` or more times. * * @static * @memberOf _ * @category Function * @param {number} n The number of calls before `func` is invoked. * @param {Function} func The function to restrict. * @returns {Function} Returns the new restricted function. * @example * * var saves = ['profile', 'settings']; * * var done = _.after(saves.length, function() { * console.log('done saving!'); * }); * * _.forEach(saves, function(type) { * asyncSave({ 'type': type, 'complete': done }); * }); * // => logs 'done saving!' after the two async saves have completed */ function after(n, func) { if (!isFunction(func)) { if (isFunction(n)) { var temp = n; n = func; func = temp; } else { throw new TypeError(FUNC_ERROR_TEXT); } } n = nativeIsFinite(n = +n) ? n : 0; return function () { if (--n < 1) { return func.apply(this, arguments); } }; } /** * Creates a function that accepts up to `n` arguments ignoring any * additional arguments. * * @static * @memberOf _ * @category Function * @param {Function} func The function to cap arguments for. * @param {number} [n=func.length] The arity cap. * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. * @returns {Function} Returns the new function. * @example * * _.map(['6', '8', '10'], _.ary(parseInt, 1)); * // => [6, 8, 10] */ function ary(func, n, guard) { if (guard && isIterateeCall(func, n, guard)) { n = null; } n = func && n == null ? func.length : nativeMax(+n || 0, 0); return createWrapper(func, ARY_FLAG, null, null, null, null, n); } /** * Creates a function that invokes `func`, with the `this` binding and arguments * of the created function, while it is called less than `n` times. Subsequent * calls to the created function return the result of the last `func` invocation. * * @static * @memberOf _ * @category Function * @param {number} n The number of calls at which `func` is no longer invoked. * @param {Function} func The function to restrict. * @returns {Function} Returns the new restricted function. * @example * * jQuery('#add').on('click', _.before(5, addContactToList)); * // => allows adding up to 4 contacts to the list */ function before(n, func) { var result; if (!isFunction(func)) { if (isFunction(n)) { var temp = n; n = func; func = temp; } else { throw new TypeError(FUNC_ERROR_TEXT); } } return function () { if (--n > 0) { result = func.apply(this, arguments); } else { func = null; } return result; }; } /** * Creates a function that invokes `func` with the `this` binding of `thisArg` * and prepends any additional `_.bind` arguments to those provided to the * bound function. * * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, * may be used as a placeholder for partially applied arguments. * * **Note:** Unlike native `Function#bind` this method does not set the `length` * property of bound functions. * * @static * @memberOf _ * @category Function * @param {Function} func The function to bind. * @param {*} thisArg The `this` binding of `func`. * @param {...*} [args] The arguments to be partially applied. * @returns {Function} Returns the new bound function. * @example * * var greet = function(greeting, punctuation) { * return greeting + ' ' + this.user + punctuation; * }; * * var object = { 'user': 'fred' }; * * var bound = _.bind(greet, object, 'hi'); * bound('!'); * // => 'hi fred!' * * // using placeholders * var bound = _.bind(greet, object, _, '!'); * bound('hi'); * // => 'hi fred!' */ function bind(func, thisArg) { var bitmask = BIND_FLAG; if (arguments.length > 2) { var partials = baseSlice(arguments, 2), holders = replaceHolders(partials, bind.placeholder); bitmask |= PARTIAL_FLAG; } return createWrapper(func, bitmask, thisArg, partials, holders); } /** * Binds methods of an object to the object itself, overwriting the existing * method. Method names may be specified as individual arguments or as arrays * of method names. If no method names are provided all enumerable function * properties, own and inherited, of `object` are bound. * * **Note:** This method does not set the `length` property of bound functions. * * @static * @memberOf _ * @category Function * @param {Object} object The object to bind and assign the bound methods to. * @param {...(string|string[])} [methodNames] The object method names to bind, * specified as individual method names or arrays of method names. * @returns {Object} Returns `object`. * @example * * var view = { * 'label': 'docs', * 'onClick': function() { console.log('clicked ' + this.label); } * }; * * _.bindAll(view); * jQuery('#docs').on('click', view.onClick); * // => logs 'clicked docs' when the element is clicked */ function bindAll(object) { return baseBindAll(object, arguments.length > 1 ? baseFlatten(arguments, false, false, 1) : functions(object)); } /** * Creates a function that invokes the method at `object[key]` and prepends * any additional `_.bindKey` arguments to those provided to the bound function. * * This method differs from `_.bind` by allowing bound functions to reference * methods that may be redefined or don't yet exist. * See [Peter Michaux's article](http://michaux.ca/articles/lazy-function-definition-pattern) * for more details. * * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic * builds, may be used as a placeholder for partially applied arguments. * * @static * @memberOf _ * @category Function * @param {Object} object The object the method belongs to. * @param {string} key The key of the method. * @param {...*} [args] The arguments to be partially applied. * @returns {Function} Returns the new bound function. * @example * * var object = { * 'user': 'fred', * 'greet': function(greeting, punctuation) { * return greeting + ' ' + this.user + punctuation; * } * }; * * var bound = _.bindKey(object, 'greet', 'hi'); * bound('!'); * // => 'hi fred!' * * object.greet = function(greeting, punctuation) { * return greeting + 'ya ' + this.user + punctuation; * }; * * bound('!'); * // => 'hiya fred!' * * // using placeholders * var bound = _.bindKey(object, 'greet', _, '!'); * bound('hi'); * // => 'hiya fred!' */ function bindKey(object, key) { var bitmask = BIND_FLAG | BIND_KEY_FLAG; if (arguments.length > 2) { var partials = baseSlice(arguments, 2), holders = replaceHolders(partials, bindKey.placeholder); bitmask |= PARTIAL_FLAG; } return createWrapper(key, bitmask, object, partials, holders); } /** * Creates a function that accepts one or more arguments of `func` that when * called either invokes `func` returning its result, if all `func` arguments * have been provided, or returns a function that accepts one or more of the * remaining `func` arguments, and so on. The arity of `func` may be specified * if `func.length` is not sufficient. * * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds, * may be used as a placeholder for provided arguments. * * **Note:** This method does not set the `length` property of curried functions. * * @static * @memberOf _ * @category Function * @param {Function} func The function to curry. * @param {number} [arity=func.length] The arity of `func`. * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. * @returns {Function} Returns the new curried function. * @example * * var abc = function(a, b, c) { * return [a, b, c]; * }; * * var curried = _.curry(abc); * * curried(1)(2)(3); * // => [1, 2, 3] * * curried(1, 2)(3); * // => [1, 2, 3] * * curried(1, 2, 3); * // => [1, 2, 3] * * // using placeholders * curried(1)(_, 3)(2); * // => [1, 2, 3] */ function curry(func, arity, guard) { if (guard && isIterateeCall(func, arity, guard)) { arity = null; } var result = createWrapper(func, CURRY_FLAG, null, null, null, null, null, arity); result.placeholder = curry.placeholder; return result; } /** * This method is like `_.curry` except that arguments are applied to `func` * in the manner of `_.partialRight` instead of `_.partial`. * * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic * builds, may be used as a placeholder for provided arguments. * * **Note:** This method does not set the `length` property of curried functions. * * @static * @memberOf _ * @category Function * @param {Function} func The function to curry. * @param {number} [arity=func.length] The arity of `func`. * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. * @returns {Function} Returns the new curried function. * @example * * var abc = function(a, b, c) { * return [a, b, c]; * }; * * var curried = _.curryRight(abc); * * curried(3)(2)(1); * // => [1, 2, 3] * * curried(2, 3)(1); * // => [1, 2, 3] * * curried(1, 2, 3); * // => [1, 2, 3] * * // using placeholders * curried(3)(1, _)(2); * // => [1, 2, 3] */ function curryRight(func, arity, guard) { if (guard && isIterateeCall(func, arity, guard)) { arity = null; } var result = createWrapper(func, CURRY_RIGHT_FLAG, null, null, null, null, null, arity); result.placeholder = curryRight.placeholder; return result; } /** * Creates a function that delays invoking `func` until after `wait` milliseconds * have elapsed since the last time it was invoked. The created function comes * with a `cancel` method to cancel delayed invocations. Provide an options * object to indicate that `func` should be invoked on the leading and/or * trailing edge of the `wait` timeout. Subsequent calls to the debounced * function return the result of the last `func` invocation. * * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked * on the trailing edge of the timeout only if the the debounced function is * invoked more than once during the `wait` timeout. * * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) * for details over the differences between `_.debounce` and `_.throttle`. * * @static * @memberOf _ * @category Function * @param {Function} func The function to debounce. * @param {number} wait The number of milliseconds to delay. * @param {Object} [options] The options object. * @param {boolean} [options.leading=false] Specify invoking on the leading * edge of the timeout. * @param {number} [options.maxWait] The maximum time `func` is allowed to be * delayed before it is invoked. * @param {boolean} [options.trailing=true] Specify invoking on the trailing * edge of the timeout. * @returns {Function} Returns the new debounced function. * @example * * // avoid costly calculations while the window size is in flux * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); * * // invoke `sendMail` when the click event is fired, debouncing subsequent calls * jQuery('#postbox').on('click', _.debounce(sendMail, 300, { * 'leading': true, * 'trailing': false * })); * * // ensure `batchLog` is invoked once after 1 second of debounced calls * var source = new EventSource('/stream'); * jQuery(source).on('message', _.debounce(batchLog, 250, { * 'maxWait': 1000 * })); * * // cancel a debounced call * var todoChanges = _.debounce(batchLog, 1000); * Object.observe(models.todo, todoChanges); * * Object.observe(models, function(changes) { * if (_.find(changes, { 'user': 'todo', 'type': 'delete'})) { * todoChanges.cancel(); * } * }, ['delete']); * * // ...at some point `models.todo` is changed * models.todo.completed = true; * * // ...before 1 second has passed `models.todo` is deleted * // which cancels the debounced `todoChanges` call * delete models.todo; */ function debounce(func, wait, options) { var args, maxTimeoutId, result, stamp, thisArg, timeoutId, trailingCall, lastCalled = 0, maxWait = false, trailing = true; if (!isFunction(func)) { throw new TypeError(FUNC_ERROR_TEXT); } wait = wait < 0 ? 0 : wait; if (options === true) { var leading = true; trailing = false; } else if (isObject(options)) { leading = options.leading; maxWait = 'maxWait' in options && nativeMax(+options.maxWait || 0, wait); trailing = 'trailing' in options ? options.trailing : trailing; } function cancel() { if (timeoutId) { clearTimeout(timeoutId); } if (maxTimeoutId) { clearTimeout(maxTimeoutId); } maxTimeoutId = timeoutId = trailingCall = undefined; } function delayed() { var remaining = wait - (now() - stamp); if (remaining <= 0 || remaining > wait) { if (maxTimeoutId) { clearTimeout(maxTimeoutId); } var isCalled = trailingCall; maxTimeoutId = timeoutId = trailingCall = undefined; if (isCalled) { lastCalled = now(); result = func.apply(thisArg, args); if (!timeoutId && !maxTimeoutId) { args = thisArg = null; } } } else { timeoutId = setTimeout(delayed, remaining); } } function maxDelayed() { if (timeoutId) { clearTimeout(timeoutId); } maxTimeoutId = timeoutId = trailingCall = undefined; if (trailing || maxWait !== wait) { lastCalled = now(); result = func.apply(thisArg, args); if (!timeoutId && !maxTimeoutId) { args = thisArg = null; } } } function debounced() { args = arguments; stamp = now(); thisArg = this; trailingCall = trailing && (timeoutId || !leading); if (maxWait === false) { var leadingCall = leading && !timeoutId; } else { if (!maxTimeoutId && !leading) { lastCalled = stamp; } var remaining = maxWait - (stamp - lastCalled), isCalled = remaining <= 0 || remaining > maxWait; if (isCalled) { if (maxTimeoutId) { maxTimeoutId = clearTimeout(maxTimeoutId); } lastCalled = stamp; result = func.apply(thisArg, args); } else if (!maxTimeoutId) { maxTimeoutId = setTimeout(maxDelayed, remaining); } } if (isCalled && timeoutId) { timeoutId = clearTimeout(timeoutId); } else if (!timeoutId && wait !== maxWait) { timeoutId = setTimeout(delayed, wait); } if (leadingCall) { isCalled = true; result = func.apply(thisArg, args); } if (isCalled && !timeoutId && !maxTimeoutId) { args = thisArg = null; } return result; } debounced.cancel = cancel; return debounced; } /** * Defers invoking the `func` until the current call stack has cleared. Any * additional arguments are provided to `func` when it is invoked. * * @static * @memberOf _ * @category Function * @param {Function} func The function to defer. * @param {...*} [args] The arguments to invoke the function with. * @returns {number} Returns the timer id. * @example * * _.defer(function(text) { console.log(text); }, 'deferred'); * // logs 'deferred' after one or more milliseconds */ function defer(func) { return baseDelay(func, 1, arguments, 1); } /** * Invokes `func` after `wait` milliseconds. Any additional arguments are * provided to `func` when it is invoked. * * @static * @memberOf _ * @category Function * @param {Function} func The function to delay. * @param {number} wait The number of milliseconds to delay invocation. * @param {...*} [args] The arguments to invoke the function with. * @returns {number} Returns the timer id. * @example * * _.delay(function(text) { console.log(text); }, 1000, 'later'); * // => logs 'later' after one second */ function delay(func, wait) { return baseDelay(func, wait, arguments, 2); } /** * Creates a function that returns the result of invoking the provided * functions with the `this` binding of the created function, where each * successive invocation is supplied the return value of the previous. * * @static * @memberOf _ * @category Function * @param {...Function} [funcs] Functions to invoke. * @returns {Function} Returns the new function. * @example * * function add(x, y) { * return x + y; * } * * function square(n) { * return n * n; * } * * var addSquare = _.flow(add, square); * addSquare(1, 2); * // => 9 */ function flow() { var funcs = arguments, length = funcs.length; if (!length) { return function () { }; } if (!arrayEvery(funcs, isFunction)) { throw new TypeError(FUNC_ERROR_TEXT); } return function () { var index = 0, result = funcs[index].apply(this, arguments); while (++index < length) { result = funcs[index].call(this, result); } return result; }; } /** * This method is like `_.flow` except that it creates a function that * invokes the provided functions from right to left. * * @static * @memberOf _ * @alias backflow, compose * @category Function * @param {...Function} [funcs] Functions to invoke. * @returns {Function} Returns the new function. * @example * * function add(x, y) { * return x + y; * } * * function square(n) { * return n * n; * } * * var addSquare = _.flowRight(square, add); * addSquare(1, 2); * // => 9 */ function flowRight() { var funcs = arguments, fromIndex = funcs.length - 1; if (fromIndex < 0) { return function () { }; } if (!arrayEvery(funcs, isFunction)) { throw new TypeError(FUNC_ERROR_TEXT); } return function () { var index = fromIndex, result = funcs[index].apply(this, arguments); while (index--) { result = funcs[index].call(this, result); } return result; }; } /** * Creates a function that memoizes the result of `func`. If `resolver` is * provided it determines the cache key for storing the result based on the * arguments provided to the memoized function. By default, the first argument * provided to the memoized function is coerced to a string and used as the * cache key. The `func` is invoked with the `this` binding of the memoized * function. * * **Note:** The cache is exposed as the `cache` property on the memoized * function. Its creation may be customized by replacing the `_.memoize.Cache` * constructor with one whose instances implement the ES `Map` method interface * of `get`, `has`, and `set`. See the * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-map-prototype-object) * for more details. * * @static * @memberOf _ * @category Function * @param {Function} func The function to have its output memoized. * @param {Function} [resolver] The function to resolve the cache key. * @returns {Function} Returns the new memoizing function. * @example * * var upperCase = _.memoize(function(string) { * return string.toUpperCase(); * }); * * upperCase('fred'); * // => 'FRED' * * // modifying the result cache * upperCase.cache.set('fred', 'BARNEY'); * upperCase('fred'); * // => 'BARNEY' * * // replacing `_.memoize.Cache` * var object = { 'user': 'fred' }; * var other = { 'user': 'barney' }; * var identity = _.memoize(_.identity); * * identity(object); * // => { 'user': 'fred' } * identity(other); * // => { 'user': 'fred' } * * _.memoize.Cache = WeakMap; * var identity = _.memoize(_.identity); * * identity(object); * // => { 'user': 'fred' } * identity(other); * // => { 'user': 'barney' } */ function memoize(func, resolver) { if (!isFunction(func) || resolver && !isFunction(resolver)) { throw new TypeError(FUNC_ERROR_TEXT); } var memoized = function () { var cache = memoized.cache, key = resolver ? resolver.apply(this, arguments) : arguments[0]; if (cache.has(key)) { return cache.get(key); } var result = func.apply(this, arguments); cache.set(key, result); return result; }; memoized.cache = new memoize.Cache(); return memoized; } /** * Creates a function that negates the result of the predicate `func`. The * `func` predicate is invoked with the `this` binding and arguments of the * created function. * * @static * @memberOf _ * @category Function * @param {Function} predicate The predicate to negate. * @returns {Function} Returns the new function. * @example * * function isEven(n) { * return n % 2 == 0; * } * * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); * // => [1, 3, 5] */ function negate(predicate) { if (!isFunction(predicate)) { throw new TypeError(FUNC_ERROR_TEXT); } return function () { return !predicate.apply(this, arguments); }; } /** * Creates a function that is restricted to invoking `func` once. Repeat calls * to the function return the value of the first call. The `func` is invoked * with the `this` binding of the created function. * * @static * @memberOf _ * @type Function * @category Function * @param {Function} func The function to restrict. * @returns {Function} Returns the new restricted function. * @example * * var initialize = _.once(createApplication); * initialize(); * initialize(); * // `initialize` invokes `createApplication` once */ function once(func) { return before(func, 2); } /** * Creates a function that invokes `func` with `partial` arguments prepended * to those provided to the new function. This method is like `_.bind` except * it does **not** alter the `this` binding. * * The `_.partial.placeholder` value, which defaults to `_` in monolithic * builds, may be used as a placeholder for partially applied arguments. * * **Note:** This method does not set the `length` property of partially * applied functions. * * @static * @memberOf _ * @category Function * @param {Function} func The function to partially apply arguments to. * @param {...*} [args] The arguments to be partially applied. * @returns {Function} Returns the new partially applied function. * @example * * var greet = function(greeting, name) { * return greeting + ' ' + name; * }; * * var sayHelloTo = _.partial(greet, 'hello'); * sayHelloTo('fred'); * // => 'hello fred' * * // using placeholders * var greetFred = _.partial(greet, _, 'fred'); * greetFred('hi'); * // => 'hi fred' */ function partial(func) { var partials = baseSlice(arguments, 1), holders = replaceHolders(partials, partial.placeholder); return createWrapper(func, PARTIAL_FLAG, null, partials, holders); } /** * This method is like `_.partial` except that partially applied arguments * are appended to those provided to the new function. * * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic * builds, may be used as a placeholder for partially applied arguments. * * **Note:** This method does not set the `length` property of partially * applied functions. * * @static * @memberOf _ * @category Function * @param {Function} func The function to partially apply arguments to. * @param {...*} [args] The arguments to be partially applied. * @returns {Function} Returns the new partially applied function. * @example * * var greet = function(greeting, name) { * return greeting + ' ' + name; * }; * * var greetFred = _.partialRight(greet, 'fred'); * greetFred('hi'); * // => 'hi fred' * * // using placeholders * var sayHelloTo = _.partialRight(greet, 'hello', _); * sayHelloTo('fred'); * // => 'hello fred' */ function partialRight(func) { var partials = baseSlice(arguments, 1), holders = replaceHolders(partials, partialRight.placeholder); return createWrapper(func, PARTIAL_RIGHT_FLAG, null, partials, holders); } /** * Creates a function that invokes `func` with arguments arranged according * to the specified indexes where the argument value at the first index is * provided as the first argument, the argument value at the second index is * provided as the second argument, and so on. * * @static * @memberOf _ * @category Function * @param {Function} func The function to rearrange arguments for. * @param {...(number|number[])} indexes The arranged argument indexes, * specified as individual indexes or arrays of indexes. * @returns {Function} Returns the new function. * @example * * var rearged = _.rearg(function(a, b, c) { * return [a, b, c]; * }, 2, 0, 1); * * rearged('b', 'c', 'a') * // => ['a', 'b', 'c'] * * var map = _.rearg(_.map, [1, 0]); * map(function(n) { return n * 3; }, [1, 2, 3]); * // => [3, 6, 9] */ function rearg(func) { var indexes = baseFlatten(arguments, false, false, 1); return createWrapper(func, REARG_FLAG, null, null, null, indexes); } /** * Creates a function that only invokes `func` at most once per every `wait` * milliseconds. The created function comes with a `cancel` method to cancel * delayed invocations. Provide an options object to indicate that `func` * should be invoked on the leading and/or trailing edge of the `wait` timeout. * Subsequent calls to the throttled function return the result of the last * `func` call. * * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked * on the trailing edge of the timeout only if the the throttled function is * invoked more than once during the `wait` timeout. * * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) * for details over the differences between `_.throttle` and `_.debounce`. * * @static * @memberOf _ * @category Function * @param {Function} func The function to throttle. * @param {number} wait The number of milliseconds to throttle invocations to. * @param {Object} [options] The options object. * @param {boolean} [options.leading=true] Specify invoking on the leading * edge of the timeout. * @param {boolean} [options.trailing=true] Specify invoking on the trailing * edge of the timeout. * @returns {Function} Returns the new throttled function. * @example * * // avoid excessively updating the position while scrolling * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); * * // invoke `renewToken` when the click event is fired, but not more than once every 5 minutes * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }) * jQuery('.interactive').on('click', throttled); * * // cancel a trailing throttled call * jQuery(window).on('popstate', throttled.cancel); */ function throttle(func, wait, options) { var leading = true, trailing = true; if (!isFunction(func)) { throw new TypeError(FUNC_ERROR_TEXT); } if (options === false) { leading = false; } else if (isObject(options)) { leading = 'leading' in options ? !!options.leading : leading; trailing = 'trailing' in options ? !!options.trailing : trailing; } debounceOptions.leading = leading; debounceOptions.maxWait = +wait; debounceOptions.trailing = trailing; return debounce(func, wait, debounceOptions); } /** * Creates a function that provides `value` to the wrapper function as its * first argument. Any additional arguments provided to the function are * appended to those provided to the wrapper function. The wrapper is invoked * with the `this` binding of the created function. * * @static * @memberOf _ * @category Function * @param {*} value The value to wrap. * @param {Function} wrapper The wrapper function. * @returns {Function} Returns the new function. * @example * * var p = _.wrap(_.escape, function(func, text) { * return '

      ' + func(text) + '

      '; * }); * * p('fred, barney, & pebbles'); * // => '

      fred, barney, & pebbles

      ' */ function wrap(value, wrapper) { wrapper = wrapper == null ? identity : wrapper; return createWrapper(wrapper, PARTIAL_FLAG, null, [value], []); } /*------------------------------------------------------------------------*/ /** * Creates a clone of `value`. If `isDeep` is `true` nested objects are cloned, * otherwise they are assigned by reference. If `customizer` is provided it is * invoked to produce the cloned values. If `customizer` returns `undefined` * cloning is handled by the method instead. The `customizer` is bound to * `thisArg` and invoked with two argument; (value [, index|key, object]). * * **Note:** This method is loosely based on the structured clone algorithm. * The enumerable properties of `arguments` objects and objects created by * constructors other than `Object` are cloned to plain `Object` objects. An * empty object is returned for uncloneable values such as functions, DOM nodes, * Maps, Sets, and WeakMaps. See the [HTML5 specification](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm) * for more details. * * @static * @memberOf _ * @category Lang * @param {*} value The value to clone. * @param {boolean} [isDeep] Specify a deep clone. * @param {Function} [customizer] The function to customize cloning values. * @param {*} [thisArg] The `this` binding of `customizer`. * @returns {*} Returns the cloned value. * @example * * var users = [ * { 'user': 'barney' }, * { 'user': 'fred' } * ]; * * var shallow = _.clone(users); * shallow[0] === users[0]; * // => true * * var deep = _.clone(users, true); * deep[0] === users[0]; * // => false * * // using a customizer callback * var body = _.clone(document.body, function(value) { * return _.isElement(value) ? value.cloneNode(false) : undefined; * }); * * body === document.body * // => false * body.nodeName * // => BODY * body.childNodes.length; * // => 0 */ function clone(value, isDeep, customizer, thisArg) { // Juggle arguments. if (typeof isDeep != 'boolean' && isDeep != null) { thisArg = customizer; customizer = isIterateeCall(value, isDeep, thisArg) ? null : isDeep; isDeep = false; } customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 1); return baseClone(value, isDeep, customizer); } /** * Creates a deep clone of `value`. If `customizer` is provided it is invoked * to produce the cloned values. If `customizer` returns `undefined` cloning * is handled by the method instead. The `customizer` is bound to `thisArg` * and invoked with two argument; (value [, index|key, object]). * * **Note:** This method is loosely based on the structured clone algorithm. * The enumerable properties of `arguments` objects and objects created by * constructors other than `Object` are cloned to plain `Object` objects. An * empty object is returned for uncloneable values such as functions, DOM nodes, * Maps, Sets, and WeakMaps. See the [HTML5 specification](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm) * for more details. * * @static * @memberOf _ * @category Lang * @param {*} value The value to deep clone. * @param {Function} [customizer] The function to customize cloning values. * @param {*} [thisArg] The `this` binding of `customizer`. * @returns {*} Returns the deep cloned value. * @example * * var users = [ * { 'user': 'barney' }, * { 'user': 'fred' } * ]; * * var deep = _.cloneDeep(users); * deep[0] === users[0]; * // => false * * // using a customizer callback * var el = _.cloneDeep(document.body, function(value) { * return _.isElement(value) ? value.cloneNode(true) : undefined; * }); * * body === document.body * // => false * body.nodeName * // => BODY * body.childNodes.length; * // => 20 */ function cloneDeep(value, customizer, thisArg) { customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 1); return baseClone(value, true, customizer); } /** * Checks if `value` is classified as an `arguments` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * (function() { return _.isArguments(arguments); })(); * // => true * * _.isArguments([1, 2, 3]); * // => false */ function isArguments(value) { var length = isObjectLike(value) ? value.length : undefined; return isLength(length) && objToString.call(value) == argsTag || false; } /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isArray([1, 2, 3]); * // => true * * (function() { return _.isArray(arguments); })(); * // => false */ var isArray = nativeIsArray || function (value) { return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag || false; }; /** * Checks if `value` is classified as a boolean primitive or object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isBoolean(false); * // => true * * _.isBoolean(null); * // => false */ function isBoolean(value) { return value === true || value === false || isObjectLike(value) && objToString.call(value) == boolTag || false; } /** * Checks if `value` is classified as a `Date` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isDate(new Date); * // => true * * _.isDate('Mon April 23 2012'); * // => false */ function isDate(value) { return isObjectLike(value) && objToString.call(value) == dateTag || false; } /** * Checks if `value` is a DOM element. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. * @example * * _.isElement(document.body); * // => true * * _.isElement(''); * // => false */ function isElement(value) { return value && value.nodeType === 1 && isObjectLike(value) && objToString.call(value).indexOf('Element') > -1 || false; } // Fallback for environments without DOM support. if (!support.dom) { isElement = function (value) { return value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value) || false; }; } /** * Checks if a value is empty. A value is considered empty unless it is an * `arguments` object, array, string, or jQuery-like collection with a length * greater than `0` or an object with own enumerable properties. * * @static * @memberOf _ * @category Lang * @param {Array|Object|string} value The value to inspect. * @returns {boolean} Returns `true` if `value` is empty, else `false`. * @example * * _.isEmpty(null); * // => true * * _.isEmpty(true); * // => true * * _.isEmpty(1); * // => true * * _.isEmpty([1, 2, 3]); * // => false * * _.isEmpty({ 'a': 1 }); * // => false */ function isEmpty(value) { if (value == null) { return true; } var length = value.length; if (isLength(length) && (isArray(value) || isString(value) || isArguments(value) || isObjectLike(value) && isFunction(value.splice))) { return !length; } return !keys(value).length; } /** * Performs a deep comparison between two values to determine if they are * equivalent. If `customizer` is provided it is invoked to compare values. * If `customizer` returns `undefined` comparisons are handled by the method * instead. The `customizer` is bound to `thisArg` and invoked with three * arguments; (value, other [, index|key]). * * **Note:** This method supports comparing arrays, booleans, `Date` objects, * numbers, `Object` objects, regexes, and strings. Functions and DOM nodes * are **not** supported. Provide a customizer function to extend support * for comparing other values. * * @static * @memberOf _ * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @param {Function} [customizer] The function to customize comparing values. * @param {*} [thisArg] The `this` binding of `customizer`. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var object = { 'user': 'fred' }; * var other = { 'user': 'fred' }; * * object == other; * // => false * * _.isEqual(object, other); * // => true * * // using a customizer callback * var array = ['hello', 'goodbye']; * var other = ['hi', 'goodbye']; * * _.isEqual(array, other, function(value, other) { * return _.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/) || undefined; * }); * // => true */ function isEqual(value, other, customizer, thisArg) { customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 3); if (!customizer && isStrictComparable(value) && isStrictComparable(other)) { return value === other; } var result = customizer ? customizer(value, other) : undefined; return typeof result == 'undefined' ? baseIsEqual(value, other, customizer) : !!result; } /** * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, * `SyntaxError`, `TypeError`, or `URIError` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an error object, else `false`. * @example * * _.isError(new Error); * // => true * * _.isError(Error); * // => false */ function isError(value) { return isObjectLike(value) && typeof value.message == 'string' && objToString.call(value) == errorTag || false; } /** * Checks if `value` is a finite primitive number. * * **Note:** This method is based on ES `Number.isFinite`. See the * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isfinite) * for more details. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. * @example * * _.isFinite(10); * // => true * * _.isFinite('10'); * // => false * * _.isFinite(true); * // => false * * _.isFinite(Object(10)); * // => false * * _.isFinite(Infinity); * // => false */ var isFinite = nativeNumIsFinite || function (value) { return typeof value == 'number' && nativeIsFinite(value); }; /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { // Avoid a Chakra JIT bug in compatibility modes of IE 11. // See https://github.com/jashkenas/underscore/issues/1621 for more details. return typeof value == 'function' || false; } // Fallback for environments that return incorrect `typeof` operator results. if (isFunction(/x/) || Uint8Array && !isFunction(Uint8Array)) { isFunction = function (value) { // The use of `Object#toString` avoids issues with the `typeof` operator // in older versions of Chrome and Safari which return 'function' for regexes // and Safari 8 equivalents which return 'object' for typed array constructors. return objToString.call(value) == funcTag; }; } /** * Checks if `value` is the language type of `Object`. * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * **Note:** See the [ES5 spec](https://es5.github.io/#x8) for more details. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(1); * // => false */ function isObject(value) { // Avoid a V8 JIT bug in Chrome 19-20. // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. var type = typeof value; return type == 'function' || value && type == 'object' || false; } /** * Performs a deep comparison between `object` and `source` to determine if * `object` contains equivalent property values. If `customizer` is provided * it is invoked to compare values. If `customizer` returns `undefined` * comparisons are handled by the method instead. The `customizer` is bound * to `thisArg` and invoked with three arguments; (value, other, index|key). * * **Note:** This method supports comparing properties of arrays, booleans, * `Date` objects, numbers, `Object` objects, regexes, and strings. Functions * and DOM nodes are **not** supported. Provide a customizer function to extend * support for comparing other values. * * @static * @memberOf _ * @category Lang * @param {Object} source The object to inspect. * @param {Object} source The object of property values to match. * @param {Function} [customizer] The function to customize comparing values. * @param {*} [thisArg] The `this` binding of `customizer`. * @returns {boolean} Returns `true` if `object` is a match, else `false`. * @example * * var object = { 'user': 'fred', 'age': 40 }; * * _.isMatch(object, { 'age': 40 }); * // => true * * _.isMatch(object, { 'age': 36 }); * // => false * * // using a customizer callback * var object = { 'greeting': 'hello' }; * var source = { 'greeting': 'hi' }; * * _.isMatch(object, source, function(value, other) { * return _.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/) || undefined; * }); * // => true */ function isMatch(object, source, customizer, thisArg) { var props = keys(source), length = props.length; customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 3); if (!customizer && length == 1) { var key = props[0], value = source[key]; if (isStrictComparable(value)) { return object != null && value === object[key] && hasOwnProperty.call(object, key); } } var values = Array(length), strictCompareFlags = Array(length); while (length--) { value = values[length] = source[props[length]]; strictCompareFlags[length] = isStrictComparable(value); } return baseIsMatch(object, props, values, strictCompareFlags, customizer); } /** * Checks if `value` is `NaN`. * * **Note:** This method is not the same as native `isNaN` which returns `true` * for `undefined` and other non-numeric values. See the [ES5 spec](https://es5.github.io/#x15.1.2.4) * for more details. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. * @example * * _.isNaN(NaN); * // => true * * _.isNaN(new Number(NaN)); * // => true * * isNaN(undefined); * // => true * * _.isNaN(undefined); * // => false */ function isNaN(value) { // An `NaN` primitive is the only value that is not equal to itself. // Perform the `toStringTag` check first to avoid errors with some host objects in IE. return isNumber(value) && value != +value; } /** * Checks if `value` is a native function. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a native function, else `false`. * @example * * _.isNative(Array.prototype.push); * // => true * * _.isNative(_); * // => false */ function isNative(value) { if (value == null) { return false; } if (objToString.call(value) == funcTag) { return reNative.test(fnToString.call(value)); } return isObjectLike(value) && reHostCtor.test(value) || false; } /** * Checks if `value` is `null`. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is `null`, else `false`. * @example * * _.isNull(null); * // => true * * _.isNull(void 0); * // => false */ function isNull(value) { return value === null; } /** * Checks if `value` is classified as a `Number` primitive or object. * * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are classified * as numbers, use the `_.isFinite` method. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isNumber(8.4); * // => true * * _.isNumber(NaN); * // => true * * _.isNumber('8.4'); * // => false */ function isNumber(value) { return typeof value == 'number' || isObjectLike(value) && objToString.call(value) == numberTag || false; } /** * Checks if `value` is a plain object, that is, an object created by the * `Object` constructor or one with a `[[Prototype]]` of `null`. * * **Note:** This method assumes objects created by the `Object` constructor * have no inherited enumerable properties. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. * @example * * function Foo() { * this.a = 1; * } * * _.isPlainObject(new Foo); * // => false * * _.isPlainObject([1, 2, 3]); * // => false * * _.isPlainObject({ 'x': 0, 'y': 0 }); * // => true * * _.isPlainObject(Object.create(null)); * // => true */ var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function (value) { if (!(value && objToString.call(value) == objectTag)) { return false; } var valueOf = value.valueOf, objProto = isNative(valueOf) && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto); return objProto ? value == objProto || getPrototypeOf(value) == objProto : shimIsPlainObject(value); }; /** * Checks if `value` is classified as a `RegExp` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isRegExp(/abc/); * // => true * * _.isRegExp('/abc/'); * // => false */ function isRegExp(value) { return isObjectLike(value) && objToString.call(value) == regexpTag || false; } /** * Checks if `value` is classified as a `String` primitive or object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isString('abc'); * // => true * * _.isString(1); * // => false */ function isString(value) { return typeof value == 'string' || isObjectLike(value) && objToString.call(value) == stringTag || false; } /** * Checks if `value` is classified as a typed array. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isTypedArray(new Uint8Array); * // => true * * _.isTypedArray([]); * // => false */ function isTypedArray(value) { return isObjectLike(value) && isLength(value.length) && typedArrayTags[objToString.call(value)] || false; } /** * Checks if `value` is `undefined`. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. * @example * * _.isUndefined(void 0); * // => true * * _.isUndefined(null); * // => false */ function isUndefined(value) { return typeof value == 'undefined'; } /** * Converts `value` to an array. * * @static * @memberOf _ * @category Lang * @param {*} value The value to convert. * @returns {Array} Returns the converted array. * @example * * (function() { return _.toArray(arguments).slice(1); })(1, 2, 3); * // => [2, 3] */ function toArray(value) { var length = value ? value.length : 0; if (!isLength(length)) { return values(value); } if (!length) { return []; } return arrayCopy(value); } /** * Converts `value` to a plain object flattening inherited enumerable * properties of `value` to own properties of the plain object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to convert. * @returns {Object} Returns the converted plain object. * @example * * function Foo() { * this.b = 2; * } * * Foo.prototype.c = 3; * * _.assign({ 'a': 1 }, new Foo); * // => { 'a': 1, 'b': 2 } * * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); * // => { 'a': 1, 'b': 2, 'c': 3 } */ function toPlainObject(value) { return baseCopy(value, keysIn(value)); } /*------------------------------------------------------------------------*/ /** * Assigns own enumerable properties of source object(s) to the destination * object. Subsequent sources overwrite property assignments of previous sources. * If `customizer` is provided it is invoked to produce the assigned values. * The `customizer` is bound to `thisArg` and invoked with five arguments; * (objectValue, sourceValue, key, object, source). * * @static * @memberOf _ * @alias extend * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @param {Function} [customizer] The function to customize assigning values. * @param {*} [thisArg] The `this` binding of `customizer`. * @returns {Object} Returns `object`. * @example * * _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred' }); * // => { 'user': 'fred', 'age': 40 } * * // using a customizer callback * var defaults = _.partialRight(_.assign, function(value, other) { * return typeof value == 'undefined' ? other : value; * }); * * defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); * // => { 'user': 'barney', 'age': 36 } */ var assign = createAssigner(baseAssign); /** * Creates an object that inherits from the given `prototype` object. If a * `properties` object is provided its own enumerable properties are assigned * to the created object. * * @static * @memberOf _ * @category Object * @param {Object} prototype The object to inherit from. * @param {Object} [properties] The properties to assign to the object. * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. * @returns {Object} Returns the new object. * @example * * function Shape() { * this.x = 0; * this.y = 0; * } * * function Circle() { * Shape.call(this); * } * * Circle.prototype = _.create(Shape.prototype, { 'constructor': Circle }); * * var circle = new Circle; * circle instanceof Circle; * // => true * * circle instanceof Shape; * // => true */ function create(prototype, properties, guard) { var result = baseCreate(prototype); if (guard && isIterateeCall(prototype, properties, guard)) { properties = null; } return properties ? baseCopy(properties, result, keys(properties)) : result; } /** * Assigns own enumerable properties of source object(s) to the destination * object for all destination properties that resolve to `undefined`. Once a * property is set, additional defaults of the same property are ignored. * * @static * @memberOf _ * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @example * * _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); * // => { 'user': 'barney', 'age': 36 } */ function defaults(object) { if (object == null) { return object; } var args = arrayCopy(arguments); args.push(assignDefaults); return assign.apply(undefined, args); } /** * This method is like `_.findIndex` except that it returns the key of the * first element `predicate` returns truthy for, instead of the element itself. * * If a property name is provided for `predicate` the created "_.property" * style callback returns the property value of the given element. * * If an object is provided for `predicate` the created "_.matches" style * callback returns `true` for elements that have the properties of the given * object, else `false`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to search. * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {string|undefined} Returns the key of the matched element, else `undefined`. * @example * * var users = { * 'barney': { 'age': 36, 'active': true }, * 'fred': { 'age': 40, 'active': false }, * 'pebbles': { 'age': 1, 'active': true } * }; * * _.findKey(users, function(chr) { return chr.age < 40; }); * // => 'barney' (iteration order is not guaranteed) * * // using the "_.matches" callback shorthand * _.findKey(users, { 'age': 1 }); * // => 'pebbles' * * // using the "_.property" callback shorthand * _.findKey(users, 'active'); * // => 'barney' */ function findKey(object, predicate, thisArg) { predicate = getCallback(predicate, thisArg, 3); return baseFind(object, predicate, baseForOwn, true); } /** * This method is like `_.findKey` except that it iterates over elements of * a collection in the opposite order. * * If a property name is provided for `predicate` the created "_.property" * style callback returns the property value of the given element. * * If an object is provided for `predicate` the created "_.matches" style * callback returns `true` for elements that have the properties of the given * object, else `false`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to search. * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {string|undefined} Returns the key of the matched element, else `undefined`. * @example * * var users = { * 'barney': { 'age': 36, 'active': true }, * 'fred': { 'age': 40, 'active': false }, * 'pebbles': { 'age': 1, 'active': true } * }; * * _.findLastKey(users, function(chr) { return chr.age < 40; }); * // => returns `pebbles` assuming `_.findKey` returns `barney` * * // using the "_.matches" callback shorthand * _.findLastKey(users, { 'age': 36 }); * // => 'barney' * * // using the "_.property" callback shorthand * _.findLastKey(users, 'active'); * // => 'pebbles' */ function findLastKey(object, predicate, thisArg) { predicate = getCallback(predicate, thisArg, 3); return baseFind(object, predicate, baseForOwnRight, true); } /** * Iterates over own and inherited enumerable properties of an object invoking * `iteratee` for each property. The `iteratee` is bound to `thisArg` and invoked * with three arguments; (value, key, object). Iterator functions may exit * iteration early by explicitly returning `false`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Object} Returns `object`. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.forIn(new Foo, function(value, key) { * console.log(key); * }); * // => logs 'a', 'b', and 'c' (iteration order is not guaranteed) */ function forIn(object, iteratee, thisArg) { if (typeof iteratee != 'function' || typeof thisArg != 'undefined') { iteratee = bindCallback(iteratee, thisArg, 3); } return baseFor(object, iteratee, keysIn); } /** * This method is like `_.forIn` except that it iterates over properties of * `object` in the opposite order. * * @static * @memberOf _ * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Object} Returns `object`. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.forInRight(new Foo, function(value, key) { * console.log(key); * }); * // => logs 'c', 'b', and 'a' assuming `_.forIn ` logs 'a', 'b', and 'c' */ function forInRight(object, iteratee, thisArg) { iteratee = bindCallback(iteratee, thisArg, 3); return baseForRight(object, iteratee, keysIn); } /** * Iterates over own enumerable properties of an object invoking `iteratee` * for each property. The `iteratee` is bound to `thisArg` and invoked with * three arguments; (value, key, object). Iterator functions may exit iteration * early by explicitly returning `false`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Object} Returns `object`. * @example * * _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(n, key) { * console.log(key); * }); * // => logs '0', '1', and 'length' (iteration order is not guaranteed) */ function forOwn(object, iteratee, thisArg) { if (typeof iteratee != 'function' || typeof thisArg != 'undefined') { iteratee = bindCallback(iteratee, thisArg, 3); } return baseForOwn(object, iteratee); } /** * This method is like `_.forOwn` except that it iterates over properties of * `object` in the opposite order. * * @static * @memberOf _ * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Object} Returns `object`. * @example * * _.forOwnRight({ '0': 'zero', '1': 'one', 'length': 2 }, function(n, key) { * console.log(key); * }); * // => logs 'length', '1', and '0' assuming `_.forOwn` logs '0', '1', and 'length' */ function forOwnRight(object, iteratee, thisArg) { iteratee = bindCallback(iteratee, thisArg, 3); return baseForRight(object, iteratee, keys); } /** * Creates an array of function property names from all enumerable properties, * own and inherited, of `object`. * * @static * @memberOf _ * @alias methods * @category Object * @param {Object} object The object to inspect. * @returns {Array} Returns the new array of property names. * @example * * _.functions(_); * // => ['all', 'any', 'bind', ...] */ function functions(object) { return baseFunctions(object, keysIn(object)); } /** * Checks if `key` exists as a direct property of `object` instead of an * inherited property. * * @static * @memberOf _ * @category Object * @param {Object} object The object to inspect. * @param {string} key The key to check. * @returns {boolean} Returns `true` if `key` is a direct property, else `false`. * @example * * _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); * // => true */ function has(object, key) { return object ? hasOwnProperty.call(object, key) : false; } /** * Creates an object composed of the inverted keys and values of `object`. * If `object` contains duplicate values, subsequent values overwrite property * assignments of previous values unless `multiValue` is `true`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to invert. * @param {boolean} [multiValue] Allow multiple values per key. * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. * @returns {Object} Returns the new inverted object. * @example * * _.invert({ 'first': 'fred', 'second': 'barney' }); * // => { 'fred': 'first', 'barney': 'second' } * * // without `multiValue` * _.invert({ 'first': 'fred', 'second': 'barney', 'third': 'fred' }); * // => { 'fred': 'third', 'barney': 'second' } * * // with `multiValue` * _.invert({ 'first': 'fred', 'second': 'barney', 'third': 'fred' }, true); * // => { 'fred': ['first', 'third'], 'barney': ['second'] } */ function invert(object, multiValue, guard) { if (guard && isIterateeCall(object, multiValue, guard)) { multiValue = null; } var index = -1, props = keys(object), length = props.length, result = {}; while (++index < length) { var key = props[index], value = object[key]; if (multiValue) { if (hasOwnProperty.call(result, value)) { result[value].push(key); } else { result[value] = [key]; } } else { result[value] = key; } } return result; } /** * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.keys) * for more details. * * @static * @memberOf _ * @category Object * @param {Object} object The object to inspect. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keys(new Foo); * // => ['a', 'b'] (iteration order is not guaranteed) * * _.keys('hi'); * // => ['0', '1'] */ var keys = !nativeKeys ? shimKeys : function (object) { if (object) { var Ctor = object.constructor, length = object.length; } if (typeof Ctor == 'function' && Ctor.prototype === object || typeof object != 'function' && (length && isLength(length))) { return shimKeys(object); } return isObject(object) ? nativeKeys(object) : []; }; /** * Creates an array of the own and inherited enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. * * @static * @memberOf _ * @category Object * @param {Object} object The object to inspect. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keysIn(new Foo); * // => ['a', 'b', 'c'] (iteration order is not guaranteed) */ function keysIn(object) { if (object == null) { return []; } if (!isObject(object)) { object = Object(object); } var length = object.length; length = length && isLength(length) && (isArray(object) || support.nonEnumArgs && isArguments(object)) && length || 0; var Ctor = object.constructor, index = -1, isProto = typeof Ctor == 'function' && Ctor.prototype == object, result = Array(length), skipIndexes = length > 0; while (++index < length) { result[index] = index + ''; } for (var key in object) { if (!(skipIndexes && isIndex(key, length)) && !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { result.push(key); } } return result; } /** * Creates an object with the same keys as `object` and values generated by * running each own enumerable property of `object` through `iteratee`. The * iteratee function is bound to `thisArg` and invoked with three arguments; * (value, key, object). * * If a property name is provided for `iteratee` the created "_.property" * style callback returns the property value of the given element. * * If an object is provided for `iteratee` the created "_.matches" style * callback returns `true` for elements that have the properties of the given * object, else `false`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Object} Returns the new mapped object. * @example * * _.mapValues({ 'a': 1, 'b': 2, 'c': 3} , function(n) { return n * 3; }); * // => { 'a': 3, 'b': 6, 'c': 9 } * * var users = { * 'fred': { 'user': 'fred', 'age': 40 }, * 'pebbles': { 'user': 'pebbles', 'age': 1 } * }; * * // using the "_.property" callback shorthand * _.mapValues(users, 'age'); * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) */ function mapValues(object, iteratee, thisArg) { var result = {}; iteratee = getCallback(iteratee, thisArg, 3); baseForOwn(object, function (value, key, object) { result[key] = iteratee(value, key, object); }); return result; } /** * Recursively merges own enumerable properties of the source object(s), that * don't resolve to `undefined` into the destination object. Subsequent sources * overwrite property assignments of previous sources. If `customizer` is * provided it is invoked to produce the merged values of the destination and * source properties. If `customizer` returns `undefined` merging is handled * by the method instead. The `customizer` is bound to `thisArg` and invoked * with five arguments; (objectValue, sourceValue, key, object, source). * * @static * @memberOf _ * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @param {Function} [customizer] The function to customize merging properties. * @param {*} [thisArg] The `this` binding of `customizer`. * @returns {Object} Returns `object`. * @example * * var users = { * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }] * }; * * var ages = { * 'data': [{ 'age': 36 }, { 'age': 40 }] * }; * * _.merge(users, ages); * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] } * * // using a customizer callback * var object = { * 'fruits': ['apple'], * 'vegetables': ['beet'] * }; * * var other = { * 'fruits': ['banana'], * 'vegetables': ['carrot'] * }; * * _.merge(object, other, function(a, b) { * return _.isArray(a) ? a.concat(b) : undefined; * }); * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] } */ var merge = createAssigner(baseMerge); /** * The opposite of `_.pick`; this method creates an object composed of the * own and inherited enumerable properties of `object` that are not omitted. * Property names may be specified as individual arguments or as arrays of * property names. If `predicate` is provided it is invoked for each property * of `object` omitting the properties `predicate` returns truthy for. The * predicate is bound to `thisArg` and invoked with three arguments; * (value, key, object). * * @static * @memberOf _ * @category Object * @param {Object} object The source object. * @param {Function|...(string|string[])} [predicate] The function invoked per * iteration or property names to omit, specified as individual property * names or arrays of property names. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Object} Returns the new object. * @example * * var object = { 'user': 'fred', 'age': 40 }; * * _.omit(object, 'age'); * // => { 'user': 'fred' } * * _.omit(object, _.isNumber); * // => { 'user': 'fred' } */ function omit(object, predicate, thisArg) { if (object == null) { return {}; } if (typeof predicate != 'function') { var props = arrayMap(baseFlatten(arguments, false, false, 1), String); return pickByArray(object, baseDifference(keysIn(object), props)); } predicate = bindCallback(predicate, thisArg, 3); return pickByCallback(object, function (value, key, object) { return !predicate(value, key, object); }); } /** * Creates a two dimensional array of the key-value pairs for `object`, * e.g. `[[key1, value1], [key2, value2]]`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to inspect. * @returns {Array} Returns the new array of key-value pairs. * @example * * _.pairs({ 'barney': 36, 'fred': 40 }); * // => [['barney', 36], ['fred', 40]] (iteration order is not guaranteed) */ function pairs(object) { var index = -1, props = keys(object), length = props.length, result = Array(length); while (++index < length) { var key = props[index]; result[index] = [ key, object[key] ]; } return result; } /** * Creates an object composed of the picked `object` properties. Property * names may be specified as individual arguments or as arrays of property * names. If `predicate` is provided it is invoked for each property of `object` * picking the properties `predicate` returns truthy for. The predicate is * bound to `thisArg` and invoked with three arguments; (value, key, object). * * @static * @memberOf _ * @category Object * @param {Object} object The source object. * @param {Function|...(string|string[])} [predicate] The function invoked per * iteration or property names to pick, specified as individual property * names or arrays of property names. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Object} Returns the new object. * @example * * var object = { 'user': 'fred', 'age': 40 }; * * _.pick(object, 'user'); * // => { 'user': 'fred' } * * _.pick(object, _.isString); * // => { 'user': 'fred' } */ function pick(object, predicate, thisArg) { if (object == null) { return {}; } return typeof predicate == 'function' ? pickByCallback(object, bindCallback(predicate, thisArg, 3)) : pickByArray(object, baseFlatten(arguments, false, false, 1)); } /** * Resolves the value of property `key` on `object`. If the value of `key` is * a function it is invoked with the `this` binding of `object` and its result * is returned, else the property value is returned. If the property value is * `undefined` the `defaultValue` is used in its place. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @param {string} key The key of the property to resolve. * @param {*} [defaultValue] The value returned if the property value * resolves to `undefined`. * @returns {*} Returns the resolved value. * @example * * var object = { 'user': 'fred', 'age': _.constant(40) }; * * _.result(object, 'user'); * // => 'fred' * * _.result(object, 'age'); * // => 40 * * _.result(object, 'status', 'busy'); * // => 'busy' * * _.result(object, 'status', _.constant('busy')); * // => 'busy' */ function result(object, key, defaultValue) { var value = object == null ? undefined : object[key]; if (typeof value == 'undefined') { value = defaultValue; } return isFunction(value) ? value.call(object) : value; } /** * An alternative to `_.reduce`; this method transforms `object` to a new * `accumulator` object which is the result of running each of its own enumerable * properties through `iteratee`, with each invocation potentially mutating * the `accumulator` object. The `iteratee` is bound to `thisArg` and invoked * with four arguments; (accumulator, value, key, object). Iterator functions * may exit iteration early by explicitly returning `false`. * * @static * @memberOf _ * @category Object * @param {Array|Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [accumulator] The custom accumulator value. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {*} Returns the accumulated value. * @example * * var squares = _.transform([1, 2, 3, 4, 5, 6], function(result, n) { * n *= n; * if (n % 2) { * return result.push(n) < 3; * } * }); * // => [1, 9, 25] * * var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, n, key) { * result[key] = n * 3; * }); * // => { 'a': 3, 'b': 6, 'c': 9 } */ function transform(object, iteratee, accumulator, thisArg) { var isArr = isArray(object) || isTypedArray(object); iteratee = getCallback(iteratee, thisArg, 4); if (accumulator == null) { if (isArr || isObject(object)) { var Ctor = object.constructor; if (isArr) { accumulator = isArray(object) ? new Ctor() : []; } else { accumulator = baseCreate(typeof Ctor == 'function' && Ctor.prototype); } } else { accumulator = {}; } } (isArr ? arrayEach : baseForOwn)(object, function (value, index, object) { return iteratee(accumulator, value, index, object); }); return accumulator; } /** * Creates an array of the own enumerable property values of `object`. * * **Note:** Non-object values are coerced to objects. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property values. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.values(new Foo); * // => [1, 2] (iteration order is not guaranteed) * * _.values('hi'); * // => ['h', 'i'] */ function values(object) { return baseValues(object, keys(object)); } /** * Creates an array of the own and inherited enumerable property values * of `object`. * * **Note:** Non-object values are coerced to objects. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property values. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.valuesIn(new Foo); * // => [1, 2, 3] (iteration order is not guaranteed) */ function valuesIn(object) { return baseValues(object, keysIn(object)); } /*------------------------------------------------------------------------*/ /** * Produces a random number between `min` and `max` (inclusive). If only one * argument is provided a number between `0` and the given number is returned. * If `floating` is `true`, or either `min` or `max` are floats, a floating-point * number is returned instead of an integer. * * @static * @memberOf _ * @category Number * @param {number} [min=0] The minimum possible value. * @param {number} [max=1] The maximum possible value. * @param {boolean} [floating] Specify returning a floating-point number. * @returns {number} Returns the random number. * @example * * _.random(0, 5); * // => an integer between 0 and 5 * * _.random(5); * // => also an integer between 0 and 5 * * _.random(5, true); * // => a floating-point number between 0 and 5 * * _.random(1.2, 5.2); * // => a floating-point number between 1.2 and 5.2 */ function random(min, max, floating) { if (floating && isIterateeCall(min, max, floating)) { max = floating = null; } var noMin = min == null, noMax = max == null; if (floating == null) { if (noMax && typeof min == 'boolean') { floating = min; min = 1; } else if (typeof max == 'boolean') { floating = max; noMax = true; } } if (noMin && noMax) { max = 1; noMax = false; } min = +min || 0; if (noMax) { max = min; min = 0; } else { max = +max || 0; } if (floating || min % 1 || max % 1) { var rand = nativeRandom(); return nativeMin(min + rand * (max - min + parseFloat('1e-' + ((rand + '').length - 1))), max); } return baseRandom(min, max); } /*------------------------------------------------------------------------*/ /** * Converts `string` to camel case. * See [Wikipedia](https://en.wikipedia.org/wiki/CamelCase) for more details. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the camel cased string. * @example * * _.camelCase('Foo Bar'); * // => 'fooBar' * * _.camelCase('--foo-bar'); * // => 'fooBar' * * _.camelCase('__foo_bar__'); * // => 'fooBar' */ var camelCase = createCompounder(function (result, word, index) { word = word.toLowerCase(); return result + (index ? word.charAt(0).toUpperCase() + word.slice(1) : word); }); /** * Capitalizes the first character of `string`. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to capitalize. * @returns {string} Returns the capitalized string. * @example * * _.capitalize('fred'); * // => 'Fred' */ function capitalize(string) { string = baseToString(string); return string && string.charAt(0).toUpperCase() + string.slice(1); } /** * Deburrs `string` by converting latin-1 supplementary letters to basic latin letters. * See [Wikipedia](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) * for more details. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to deburr. * @returns {string} Returns the deburred string. * @example * * _.deburr('déjà vu'); * // => 'deja vu' */ function deburr(string) { string = baseToString(string); return string && string.replace(reLatin1, deburrLetter); } /** * Checks if `string` ends with the given target string. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to search. * @param {string} [target] The string to search for. * @param {number} [position=string.length] The position to search from. * @returns {boolean} Returns `true` if `string` ends with `target`, else `false`. * @example * * _.endsWith('abc', 'c'); * // => true * * _.endsWith('abc', 'b'); * // => false * * _.endsWith('abc', 'b', 2); * // => true */ function endsWith(string, target, position) { string = baseToString(string); target = target + ''; var length = string.length; position = (typeof position == 'undefined' ? length : nativeMin(position < 0 ? 0 : +position || 0, length)) - target.length; return position >= 0 && string.indexOf(target, position) == position; } /** * Converts the characters "&", "<", ">", '"', "'", and '`', in `string` to * their corresponding HTML entities. * * **Note:** No other characters are escaped. To escape additional characters * use a third-party library like [_he_](https://mths.be/he). * * Though the ">" character is escaped for symmetry, characters like * ">" and "/" don't require escaping in HTML and have no special meaning * unless they're part of a tag or unquoted attribute value. * See [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) * (under "semi-related fun fact") for more details. * * Backticks are escaped because in Internet Explorer < 9, they can break out * of attribute values or HTML comments. See [#102](https://html5sec.org/#102), * [#108](https://html5sec.org/#108), and [#133](https://html5sec.org/#133) of * the [HTML5 Security Cheatsheet](https://html5sec.org/) for more details. * * When working with HTML you should always quote attribute values to reduce * XSS vectors. See [Ryan Grove's article](http://wonko.com/post/html-escaping) * for more details. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to escape. * @returns {string} Returns the escaped string. * @example * * _.escape('fred, barney, & pebbles'); * // => 'fred, barney, & pebbles' */ function escape(string) { // Reset `lastIndex` because in IE < 9 `String#replace` does not. string = baseToString(string); return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string; } /** * Escapes the `RegExp` special characters "\", "^", "$", ".", "|", "?", "*", * "+", "(", ")", "[", "]", "{" and "}" in `string`. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to escape. * @returns {string} Returns the escaped string. * @example * * _.escapeRegExp('[lodash](https://lodash.com/)'); * // => '\[lodash\]\(https://lodash\.com/\)' */ function escapeRegExp(string) { string = baseToString(string); return string && reHasRegExpChars.test(string) ? string.replace(reRegExpChars, '\\$&') : string; } /** * Converts `string` to kebab case (a.k.a. spinal case). * See [Wikipedia](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles) for * more details. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the kebab cased string. * @example * * _.kebabCase('Foo Bar'); * // => 'foo-bar' * * _.kebabCase('fooBar'); * // => 'foo-bar' * * _.kebabCase('__foo_bar__'); * // => 'foo-bar' */ var kebabCase = createCompounder(function (result, word, index) { return result + (index ? '-' : '') + word.toLowerCase(); }); /** * Pads `string` on the left and right sides if it is shorter then the given * padding length. The `chars` string may be truncated if the number of padding * characters can't be evenly divided by the padding length. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to pad. * @param {number} [length=0] The padding length. * @param {string} [chars=' '] The string used as padding. * @returns {string} Returns the padded string. * @example * * _.pad('abc', 8); * // => ' abc ' * * _.pad('abc', 8, '_-'); * // => '_-abc_-_' * * _.pad('abc', 3); * // => 'abc' */ function pad(string, length, chars) { string = baseToString(string); length = +length; var strLength = string.length; if (strLength >= length || !nativeIsFinite(length)) { return string; } var mid = (length - strLength) / 2, leftLength = floor(mid), rightLength = ceil(mid); chars = createPad('', rightLength, chars); return chars.slice(0, leftLength) + string + chars; } /** * Pads `string` on the left side if it is shorter then the given padding * length. The `chars` string may be truncated if the number of padding * characters exceeds the padding length. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to pad. * @param {number} [length=0] The padding length. * @param {string} [chars=' '] The string used as padding. * @returns {string} Returns the padded string. * @example * * _.padLeft('abc', 6); * // => ' abc' * * _.padLeft('abc', 6, '_-'); * // => '_-_abc' * * _.padLeft('abc', 3); * // => 'abc' */ function padLeft(string, length, chars) { string = baseToString(string); return string && createPad(string, length, chars) + string; } /** * Pads `string` on the right side if it is shorter then the given padding * length. The `chars` string may be truncated if the number of padding * characters exceeds the padding length. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to pad. * @param {number} [length=0] The padding length. * @param {string} [chars=' '] The string used as padding. * @returns {string} Returns the padded string. * @example * * _.padRight('abc', 6); * // => 'abc ' * * _.padRight('abc', 6, '_-'); * // => 'abc_-_' * * _.padRight('abc', 3); * // => 'abc' */ function padRight(string, length, chars) { string = baseToString(string); return string && string + createPad(string, length, chars); } /** * Converts `string` to an integer of the specified radix. If `radix` is * `undefined` or `0`, a `radix` of `10` is used unless `value` is a hexadecimal, * in which case a `radix` of `16` is used. * * **Note:** This method aligns with the ES5 implementation of `parseInt`. * See the [ES5 spec](https://es5.github.io/#E) for more details. * * @static * @memberOf _ * @category String * @param {string} string The string to convert. * @param {number} [radix] The radix to interpret `value` by. * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. * @returns {number} Returns the converted integer. * @example * * _.parseInt('08'); * // => 8 * * _.map(['6', '08', '10'], _.parseInt); * // => [6, 8, 10] */ function parseInt(string, radix, guard) { if (guard && isIterateeCall(string, radix, guard)) { radix = 0; } return nativeParseInt(string, radix); } // Fallback for environments with pre-ES5 implementations. if (nativeParseInt(whitespace + '08') != 8) { parseInt = function (string, radix, guard) { // Firefox < 21 and Opera < 15 follow ES3 for `parseInt`. // Chrome fails to trim leading whitespace characters. // See https://code.google.com/p/v8/issues/detail?id=3109 for more details. if (guard ? isIterateeCall(string, radix, guard) : radix == null) { radix = 0; } else if (radix) { radix = +radix; } string = trim(string); return nativeParseInt(string, radix || (reHexPrefix.test(string) ? 16 : 10)); }; } /** * Repeats the given string `n` times. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to repeat. * @param {number} [n=0] The number of times to repeat the string. * @returns {string} Returns the repeated string. * @example * * _.repeat('*', 3); * // => '***' * * _.repeat('abc', 2); * // => 'abcabc' * * _.repeat('abc', 0); * // => '' */ function repeat(string, n) { var result = ''; string = baseToString(string); n = +n; if (n < 1 || !string || !nativeIsFinite(n)) { return result; } // Leverage the exponentiation by squaring algorithm for a faster repeat. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. do { if (n % 2) { result += string; } n = floor(n / 2); string += string; } while (n); return result; } /** * Converts `string` to snake case. * See [Wikipedia](https://en.wikipedia.org/wiki/Snake_case) for more details. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the snake cased string. * @example * * _.snakeCase('Foo Bar'); * // => 'foo_bar' * * _.snakeCase('fooBar'); * // => 'foo_bar' * * _.snakeCase('--foo-bar'); * // => 'foo_bar' */ var snakeCase = createCompounder(function (result, word, index) { return result + (index ? '_' : '') + word.toLowerCase(); }); /** * Converts `string` to start case. * See [Wikipedia](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage) * for more details. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the start cased string. * @example * * _.startCase('--foo-bar'); * // => 'Foo Bar' * * _.startCase('fooBar'); * // => 'Foo Bar' * * _.startCase('__foo_bar__'); * // => 'Foo Bar' */ var startCase = createCompounder(function (result, word, index) { return result + (index ? ' ' : '') + (word.charAt(0).toUpperCase() + word.slice(1)); }); /** * Checks if `string` starts with the given target string. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to search. * @param {string} [target] The string to search for. * @param {number} [position=0] The position to search from. * @returns {boolean} Returns `true` if `string` starts with `target`, else `false`. * @example * * _.startsWith('abc', 'a'); * // => true * * _.startsWith('abc', 'b'); * // => false * * _.startsWith('abc', 'b', 1); * // => true */ function startsWith(string, target, position) { string = baseToString(string); position = position == null ? 0 : nativeMin(position < 0 ? 0 : +position || 0, string.length); return string.lastIndexOf(target, position) == position; } /** * Creates a compiled template function that can interpolate data properties * in "interpolate" delimiters, HTML-escape interpolated data properties in * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data * properties may be accessed as free variables in the template. If a setting * object is provided it takes precedence over `_.templateSettings` values. * * **Note:** In the development build `_.template` utilizes sourceURLs for easier debugging. * See the [HTML5 Rocks article on sourcemaps](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) * for more details. * * For more information on precompiling templates see * [lodash's custom builds documentation](https://lodash.com/custom-builds). * * For more information on Chrome extension sandboxes see * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). * * @static * @memberOf _ * @category String * @param {string} [string=''] The template string. * @param {Object} [options] The options object. * @param {RegExp} [options.escape] The HTML "escape" delimiter. * @param {RegExp} [options.evaluate] The "evaluate" delimiter. * @param {Object} [options.imports] An object to import into the template as free variables. * @param {RegExp} [options.interpolate] The "interpolate" delimiter. * @param {string} [options.sourceURL] The sourceURL of the template's compiled source. * @param {string} [options.variable] The data object variable name. * @param- {Object} [otherOptions] Enables the legacy `options` param signature. * @returns {Function} Returns the compiled template function. * @example * * // using the "interpolate" delimiter to create a compiled template * var compiled = _.template('hello <%= user %>!'); * compiled({ 'user': 'fred' }); * // => 'hello fred!' * * // using the HTML "escape" delimiter to escape data property values * var compiled = _.template('<%- value %>'); * compiled({ 'value': '
      {{ "%+010d"|sprintf:-123 }}
      {{ "%+010d"|vsprintf:[-123] }}
      {{ "%+010d"|fmt:-123 }}
      {{ "%+010d"|vfmt:[-123] }}
      {{ "I've got %2$d apples and %1$d oranges."|fmt:4:2 }}
      {{ "I've got %(apples)d apples and %(oranges)d oranges."|fmt:{apples: 2, oranges: 4} }}
      ================================================ FILE: third_party/ui/bower_components/sprintf/gruntfile.js ================================================ module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON("package.json"), uglify: { options: { banner: "/*! <%= pkg.name %> | <%= pkg.author %> | <%= pkg.license %> */\n", sourceMap: true }, build: { files: [ { src: "src/sprintf.js", dest: "dist/sprintf.min.js" }, { src: "src/angular-sprintf.js", dest: "dist/angular-sprintf.min.js" } ] } }, watch: { js: { files: "src/*.js", tasks: ["uglify"] } } }) grunt.loadNpmTasks("grunt-contrib-uglify") grunt.loadNpmTasks("grunt-contrib-watch") grunt.registerTask("default", ["uglify", "watch"]) } ================================================ FILE: third_party/ui/bower_components/sprintf/package.json ================================================ { "name": "sprintf-js", "version": "1.0.2", "description": "JavaScript sprintf implementation", "author": "Alexandru Marasteanu (http://alexei.ro/)", "main": "src/sprintf.js", "scripts": { "test": "mocha test/test.js" }, "repository": { "type": "git", "url": "https://github.com/alexei/sprintf.js.git" }, "license": "BSD-3-Clause", "readmeFilename": "README.md", "devDependencies": { "mocha": "*", "grunt": "*", "grunt-contrib-watch": "*", "grunt-contrib-uglify": "*" } } ================================================ FILE: third_party/ui/bower_components/sprintf/src/angular-sprintf.js ================================================ angular. module("sprintf", []). filter("sprintf", function() { return function() { return sprintf.apply(null, arguments) } }). filter("fmt", ["$filter", function($filter) { return $filter("sprintf") }]). filter("vsprintf", function() { return function(format, argv) { return vsprintf(format, argv) } }). filter("vfmt", ["$filter", function($filter) { return $filter("vsprintf") }]) ================================================ FILE: third_party/ui/bower_components/sprintf/src/sprintf.js ================================================ (function(window) { var re = { not_string: /[^s]/, number: /[dief]/, text: /^[^\x25]+/, modulo: /^\x25{2}/, placeholder: /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fiosuxX])/, key: /^([a-z_][a-z_\d]*)/i, key_access: /^\.([a-z_][a-z_\d]*)/i, index_access: /^\[(\d+)\]/, sign: /^[\+\-]/ } function sprintf() { var key = arguments[0], cache = sprintf.cache if (!(cache[key] && cache.hasOwnProperty(key))) { cache[key] = sprintf.parse(key) } return sprintf.format.call(null, cache[key], arguments) } sprintf.format = function(parse_tree, argv) { var cursor = 1, tree_length = parse_tree.length, node_type = "", arg, output = [], i, k, match, pad, pad_character, pad_length, is_positive = true, sign = "" for (i = 0; i < tree_length; i++) { node_type = get_type(parse_tree[i]) if (node_type === "string") { output[output.length] = parse_tree[i] } else if (node_type === "array") { match = parse_tree[i] // convenience purposes only if (match[2]) { // keyword argument arg = argv[cursor] for (k = 0; k < match[2].length; k++) { if (!arg.hasOwnProperty(match[2][k])) { throw new Error(sprintf("[sprintf] property '%s' does not exist", match[2][k])) } arg = arg[match[2][k]] } } else if (match[1]) { // positional argument (explicit) arg = argv[match[1]] } else { // positional argument (implicit) arg = argv[cursor++] } if (get_type(arg) == "function") { arg = arg() } if (re.not_string.test(match[8]) && (get_type(arg) != "number" && isNaN(arg))) { throw new TypeError(sprintf("[sprintf] expecting number but found %s", get_type(arg))) } if (re.number.test(match[8])) { is_positive = arg >= 0 } switch (match[8]) { case "b": arg = arg.toString(2) break case "c": arg = String.fromCharCode(arg) break case "d": case "i": arg = parseInt(arg, 10) break case "e": arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential() break case "f": arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg) break case "o": arg = arg.toString(8) break case "s": arg = ((arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg) break case "u": arg = arg >>> 0 break case "x": arg = arg.toString(16) break case "X": arg = arg.toString(16).toUpperCase() break } if (re.number.test(match[8]) && (!is_positive || match[3])) { sign = is_positive ? "+" : "-" arg = arg.toString().replace(re.sign, "") } else { sign = "" } pad_character = match[4] ? match[4] === "0" ? "0" : match[4].charAt(1) : " " pad_length = match[6] - (sign + arg).length pad = match[6] ? (pad_length > 0 ? str_repeat(pad_character, pad_length) : "") : "" output[output.length] = match[5] ? sign + arg + pad : (pad_character === "0" ? sign + pad + arg : pad + sign + arg) } } return output.join("") } sprintf.cache = {} sprintf.parse = function(fmt) { var _fmt = fmt, match = [], parse_tree = [], arg_names = 0 while (_fmt) { if ((match = re.text.exec(_fmt)) !== null) { parse_tree[parse_tree.length] = match[0] } else if ((match = re.modulo.exec(_fmt)) !== null) { parse_tree[parse_tree.length] = "%" } else if ((match = re.placeholder.exec(_fmt)) !== null) { if (match[2]) { arg_names |= 1 var field_list = [], replacement_field = match[2], field_match = [] if ((field_match = re.key.exec(replacement_field)) !== null) { field_list[field_list.length] = field_match[1] while ((replacement_field = replacement_field.substring(field_match[0].length)) !== "") { if ((field_match = re.key_access.exec(replacement_field)) !== null) { field_list[field_list.length] = field_match[1] } else if ((field_match = re.index_access.exec(replacement_field)) !== null) { field_list[field_list.length] = field_match[1] } else { throw new SyntaxError("[sprintf] failed to parse named argument key") } } } else { throw new SyntaxError("[sprintf] failed to parse named argument key") } match[2] = field_list } else { arg_names |= 2 } if (arg_names === 3) { throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported") } parse_tree[parse_tree.length] = match } else { throw new SyntaxError("[sprintf] unexpected placeholder") } _fmt = _fmt.substring(match[0].length) } return parse_tree } var vsprintf = function(fmt, argv, _argv) { _argv = (argv || []).slice(0) _argv.splice(0, 0, fmt) return sprintf.apply(null, _argv) } /** * helpers */ function get_type(variable) { return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase() } function str_repeat(input, multiplier) { return Array(multiplier + 1).join(input) } /** * export to either browser or node.js */ if (typeof exports !== "undefined") { exports.sprintf = sprintf exports.vsprintf = vsprintf } else { window.sprintf = sprintf window.vsprintf = vsprintf if (typeof define === "function" && define.amd) { define(function() { return { sprintf: sprintf, vsprintf: vsprintf } }) } } })(typeof window === "undefined" ? this : window); ================================================ FILE: third_party/ui/bower_components/sprintf/test/test.js ================================================ var assert = require("assert"), sprintfjs = require("../src/sprintf.js"), sprintf = sprintfjs.sprintf, vsprintf = sprintfjs.vsprintf describe("sprintfjs", function() { it("should return formated strings for simple placeholders", function() { assert.equal("%", sprintf("%%")) assert.equal("10", sprintf("%b", 2)) assert.equal("A", sprintf("%c", 65)) assert.equal("2", sprintf("%d", 2)) assert.equal("2", sprintf("%i", 2)) assert.equal("2", sprintf("%d", "2")) assert.equal("2", sprintf("%i", "2")) assert.equal("2e+0", sprintf("%e", 2)) assert.equal("2", sprintf("%u", 2)) assert.equal("4294967294", sprintf("%u", -2)) assert.equal("2.2", sprintf("%f", 2.2)) assert.equal("10", sprintf("%o", 8)) assert.equal("%s", sprintf("%s", "%s")) assert.equal("ff", sprintf("%x", 255)) assert.equal("FF", sprintf("%X", 255)) assert.equal("Polly wants a cracker", sprintf("%2$s %3$s a %1$s", "cracker", "Polly", "wants")) assert.equal("Hello world!", sprintf("Hello %(who)s!", {"who": "world"})) }) it("should return formated strings for complex placeholders", function() { // sign assert.equal("2", sprintf("%d", 2)) assert.equal("-2", sprintf("%d", -2)) assert.equal("+2", sprintf("%+d", 2)) assert.equal("-2", sprintf("%+d", -2)) assert.equal("2", sprintf("%i", 2)) assert.equal("-2", sprintf("%i", -2)) assert.equal("+2", sprintf("%+i", 2)) assert.equal("-2", sprintf("%+i", -2)) assert.equal("2.2", sprintf("%f", 2.2)) assert.equal("-2.2", sprintf("%f", -2.2)) assert.equal("+2.2", sprintf("%+f", 2.2)) assert.equal("-2.2", sprintf("%+f", -2.2)) assert.equal("-2.3", sprintf("%+.1f", -2.34)) assert.equal("-0.0", sprintf("%+.1f", -0.01)) assert.equal("-000000123", sprintf("%+010d", -123)) assert.equal("______-123", sprintf("%+'_10d", -123)) assert.equal("-234.34 123.2", sprintf("%f %f", -234.34, 123.2)) // padding assert.equal("-0002", sprintf("%05d", -2)) assert.equal("-0002", sprintf("%05i", -2)) assert.equal(" <", sprintf("%5s", "<")) assert.equal("0000<", sprintf("%05s", "<")) assert.equal("____<", sprintf("%'_5s", "<")) assert.equal("> ", sprintf("%-5s", ">")) assert.equal(">0000", sprintf("%0-5s", ">")) assert.equal(">____", sprintf("%'_-5s", ">")) assert.equal("xxxxxx", sprintf("%5s", "xxxxxx")) assert.equal("1234", sprintf("%02u", 1234)) assert.equal(" -10.235", sprintf("%8.3f", -10.23456)) assert.equal("-12.34 xxx", sprintf("%f %s", -12.34, "xxx")) // precision assert.equal("2.3", sprintf("%.1f", 2.345)) assert.equal("xxxxx", sprintf("%5.5s", "xxxxxx")) assert.equal(" x", sprintf("%5.1s", "xxxxxx")) }) it("should return formated strings for callbacks", function() { assert.equal("foobar", sprintf("%s", function() { return "foobar" })) assert.equal(Date.now(), sprintf("%s", Date.now)) // should pass... }) }) ================================================ FILE: third_party/ui/bower_components/string-format-js/.bower.json ================================================ { "name": "string-format-js", "main": "format.js", "version": "0.1.2", "homepage": "https://github.com/tmaeda1981jp/string-format-js", "authors": [ "tmaeda1981jp " ], "description": "String format function for javascript", "keywords": [ "string", "format" ], "license": "MIT", "ignore": [ "**/.*", "node_modules", "bower_components", "libs", "test", "tests" ], "_release": "0.1.2", "_resolution": { "type": "version", "tag": "v0.1.2", "commit": "52882d494f39ec556dd73b75f4e45e4f78f1f7bb" }, "_source": "git://github.com/tmaeda1981jp/string-format-js.git", "_target": "~0.1.2", "_originalSource": "string-format-js" } ================================================ FILE: third_party/ui/bower_components/string-format-js/Gruntfile.js ================================================ /*jslint white: true, nomen: true, maxlen: 120, plusplus: true, */ /*global _:false, $:false, define:false, require:false, */ module.exports = function(grunt) { 'use strict'; // Add the grunt-mocha-test tasks. grunt.loadNpmTasks('grunt-mocha-test'); grunt.loadNpmTasks('grunt-mocha-phantomjs'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), uglify: { my_target: { options: { mangle: true, compress: true, banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' + '<%= grunt.template.today("yyyy-mm-dd") %> */' }, files: { 'format.min.js': ['format.js'] } } }, mochaTest: { test: { options: { // grep: '%b', reporter: 'spec' }, src: ['test/format.spec.js'] } }, mocha_phantomjs: { options: { reporter: 'spec' }, all: ['test/**/*.html'] }, watch: { mochaTest: { files: ['format.js', 'test/format.spec.js'], tasks: ['mochaTest'] }, browserTest: { files: ['format.js', 'test/format.spec.js'], tasks: ['mocha_phantomjs'] } } }); grunt.registerTask('default', 'mochaTest'); grunt.registerTask('browserTest', 'mocha_phantomjs'); }; ================================================ FILE: third_party/ui/bower_components/string-format-js/LICENSE.txt ================================================ Copyright (c) 2014 tmaeda1981jp 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. ================================================ FILE: third_party/ui/bower_components/string-format-js/README.md ================================================ # string-format-js [![Build Status](https://travis-ci.org/tmaeda1981jp/string-format-js.png?branch=master)](https://travis-ci.org/tmaeda1981jp/string-format-js) ## Synopsis String format function for javascript. ## Code Example ### %d ```javascript '%d'.format(10) === '10' '%d, %d'.format(5, 10) === '5, 10' '%d, %d and %d'.format(5, 10, 15) === '5, 10 and 15' '%05d'.format(123) === '00123' '%03d, %05d'.format(1, 123) === '001, 00123' '[%5d]'.format(123) === '[ 123]' '[%10d]'.format(123) === '[ 123]' '[%-5d]'.format(123) === '[123 ]' '[%-10d]'.format(123) === '[123 ]' ``` ### %s ```javascript 'This is a %s'.format('pen') === 'This is a pen' 'This %s %s %s'.format('is', 'a', 'pen') === 'This is a pen' '[%5s]'.format('abc') === '[ abc]' '[%-5s]'.format('abc') === '[abc ]' '[%.4s]'.format('abcde') === '[abcd]' '[%5.4s]'.format('abcde') === '[ abcd]' '[%-5.4s]'.format('abcde') === '[abcd ]' '[%-5.4s]'.format('あいうえお') === '[あいうえ ]' ``` ### %o ```javascript '123 => %o'.format(123) === '123 => 173' '0x7b => %o'.format(0x7b) === '0x7b => 173' ``` ### %b ```javascript '123 => %b'.format(123) === '123 => 1111011' '0x7b => %b'.format(0x7b) === '0x7b => 1111011' ``` ### %x ```javascript '123 => %x'.format(123) === '123 => 7b' ``` ### %X ```javascript '123 => %X'.format(123) === '123 => 7B' ``` ### %u ```javascript '%u'.format(0x12345678 ^ 0xFFFFFFFF) === '3989547399' '%u'.format(-1) === '4294967295' ``` ### %c ```javascript '%c'.format(97) === 'a' '%c'.format(0x61) === 'a' ``` ### %f ```javascript '%f'.format(1.0) === '1.000000' '%.2f'.format(1.0) === '1.00' '[%10f]'.format(1.0) === '[1.00000000]' '[%10.2f]'.format(1.0) === '[ 1.00]' '[%10.2f]'.format(1.2345) === '[ 1.23]' '[%-10.2f]'.format(1.0) === '[1.00 ]' ``` ### %e ```javascript '%e'.format(123) === '1.23e+2' '%e'.format(123.45) === '1.2345e+2' '%.5e'.format(123.45) === '1.23450e+2' '[%15e]'.format(123.45) === '[1.2345000000e+2]' '[%20e]'.format(12345678901.45) === '[1.23456789014500e+10]' '[%15.2e]'.format(123.45) === '[ 1.23e+2]' '[%7.2e]'.format(123.45) === '[1.23e+2]' '[%-15.2e]'.format(123.45) === '[1.23e+2 ]' ``` ### hash ```javascript '#{name}'.format({name:'Takashi Maeda'}) === 'Takashi Maeda' '#{first} #{last}'.format({first:'Takashi', last:'Maeda'}) === 'Takashi Maeda' '#{a} #{b}, #{c} #{d}'.format(a:'Easy', b:'come', c:'easy', d:'go'}) === 'Easy come, easy go' ``` ## Installation ### node ```bash $ npm install string-format-js ``` ### bower ```bash $ bower install string-format-js ``` ## Tests ### node ```bash $ grunt mochaTest ``` ### browser ```bash $ grunt browserTest ``` ## License This software is released under the MIT License, see LICENSE.txt. ================================================ FILE: third_party/ui/bower_components/string-format-js/bower.json ================================================ { "name": "string-format-js", "main": "format.js", "version": "0.1.2", "homepage": "https://github.com/tmaeda1981jp/string-format-js", "authors": [ "tmaeda1981jp " ], "description": "String format function for javascript", "keywords": [ "string", "format" ], "license": "MIT", "ignore": [ "**/.*", "node_modules", "bower_components", "libs", "test", "tests" ] } ================================================ FILE: third_party/ui/bower_components/string-format-js/format.js ================================================ /*jslint white: true, nomen: true, maxlen: 120, plusplus: true, */ /*global _:false, $:false, define:false, require:false, */ (function(global, undefined) { 'use strict'; var string = global.String; if (!string.prototype.format) { string.prototype.format = function() { var i, result = this, isNumber = function(n) { return !isNaN(parseFloat(n)) && isFinite(n); }, Formatter = (function() { var Constr = function(identifier) { var array = function(len){ return new Array(len); }; switch(true) { case /^#\{(\w+)\}*$/.test(identifier): this.formatter = function(line, param) { return line.replace('#{' + RegExp.$1 + '}', param[RegExp.$1]); }; break; case /^([ds])$/.test(identifier): this.formatter = function(line, param) { if (RegExp.$1 === 'd' && !isNumber(param)) { throw new TypeError(); } return line.replace("%" + identifier, param); }; break; // Octet case /^(o)$/.test(identifier): this.formatter = function(line, param) { if (!isNumber(param)) { throw new TypeError(); } return line.replace( "%" + identifier, parseInt(param).toString(8)); }; break; // Binary case /^(b)$/.test(identifier): this.formatter = function(line, param) { if (!isNumber(param)) { throw new TypeError(); } return line.replace( "%" + identifier, parseInt(param).toString(2)); }; break; // Hex case /^([xX])$/.test(identifier): this.formatter = function(line, param) { if (!isNumber(param)) { throw new TypeError(); } var hex = parseInt(param).toString(16); if (identifier === 'X') { hex = hex.toUpperCase(); } return line.replace("%" + identifier, hex); }; break; case /^(c)$/.test(identifier): this.formatter = function(line, param) { if (!isNumber(param)) { throw new TypeError(); } return line.replace("%" + identifier, String.fromCharCode(param)); }; break; case /^(u)$/.test(identifier): this.formatter = function(line, param) { if (!isNumber(param)) { throw new TypeError(); } return line.replace("%" + identifier, parseInt(param, 10) >>> 0); }; break; case /^(-?)(\d*).?(\d?)(e)$/.test(identifier): this.formatter = function(line, param) { if (!isNumber(param)) { throw new TypeError(); } var lpad = RegExp.$1 === '-', width = RegExp.$2, decimal = RegExp.$3 !== '' ? RegExp.$3: undefined, val = param.toExponential(decimal), mantissa, exponent, padLength ; if (width !== '') { if (decimal !== undefined) { padLength = width - val.length; if (padLength >= 0){ val = lpad ? val + array(padLength + 1).join(" "): array(padLength + 1).join(" ") + val; } else { // TODO throw ? } } else { mantissa = val.split('e')[0]; exponent = 'e' + val.split('e')[1]; padLength = width - (mantissa.length + exponent.length); val = padLength >= 0 ? mantissa + (array(padLength + 1)).join("0") + exponent : mantissa.slice(0, padLength) + exponent; } } return line.replace("%" + identifier, val); }; break; case /^(-?)(\d*).?(\d?)(f)$/.test(identifier): this.formatter = function(line, param) { if (!isNumber(param)) { throw new TypeError(); } var lpad = RegExp.$1 === '-', width = RegExp.$2, decimal = RegExp.$3, DOT_LENGTH = '.'.length, integralPart = param > 0 ? Math.floor(param) : Math.ceil(param), val = parseFloat(param).toFixed(decimal !== '' ? decimal : 6), numberPartWidth, spaceWidth; if (width !== '') { if (decimal !== '') { numberPartWidth = integralPart.toString().length + DOT_LENGTH + parseInt(decimal, 10); spaceWidth = width - numberPartWidth; val = lpad ? parseFloat(param).toFixed(decimal) + (array(spaceWidth + 1).join(" ")) : (array(spaceWidth + 1).join(" ")) + parseFloat(param).toFixed(decimal); } else { val = parseFloat(param).toFixed( width - (integralPart.toString().length + DOT_LENGTH)); } } return line.replace("%" + identifier, val); }; break; // Decimal case /^([0\-]?)(\d+)d$/.test(identifier): this.formatter = function(line, param) { if (!isNumber(param)) { throw new TypeError(); } var len = RegExp.$2 - param.toString().length, replaceString = '', result; if (len < 0) { len = 0; } switch(RegExp.$1) { case "": // rpad replaceString = (array(len + 1).join(" ") + param).slice(-RegExp.$2); break; case "-": // lpad replaceString = (param + array(len + 1).join(" ")).slice(-RegExp.$2); break; case "0": // 0pad replaceString = (array(len + 1).join("0") + param).slice(-RegExp.$2); break; } return line.replace("%" + identifier, replaceString); }; break; // String case /^(-?)(\d)s$/.test(identifier): this.formatter = function(line, param) { var len = RegExp.$2 - param.toString().length, replaceString = '', result; if (len < 0) { len = 0; } switch(RegExp.$1) { case "": // rpad replaceString = (array(len + 1).join(" ") + param).slice(-RegExp.$2); break; case "-": // lpad replaceString = (param + array(len + 1).join(" ")).slice(-RegExp.$2); break; default: // TODO throw ? } return line.replace("%" + identifier, replaceString); }; break; // String with max length case /^(-?\d?)\.(\d)s$/.test(identifier): this.formatter = function(line, param) { var replaceString = '', max, spacelen; // %.4s if (RegExp.$1 === '') { replaceString = param.slice(0, RegExp.$2); } // %5.4s %-5.4s else { param = param.slice(0, RegExp.$2); max = Math.abs(RegExp.$1); spacelen = max - param.toString().length; replaceString = RegExp.$1.indexOf('-') !== -1 ? (param + array(spacelen + 1).join(" ")).slice(-max): // lpad (array(spacelen + 1).join(" ") + param).slice(-max); // rpad } return line.replace("%" + identifier, replaceString); }; break; default: this.formatter = function(line, param) { return line; }; } }; Constr.prototype = { format: function(line, param) { return this.formatter.call(this, line, param); } }; return Constr; }()), args = Array.prototype.slice.call(arguments) ; if (args.length === 1 && typeof args[0] === 'object') { for (i=0; i < Object.keys(args[0]).length; i+=1) { if (result.match(/(#\{\w+\})/)) { result = new Formatter(RegExp.$1).format(result, args[0]); } } } else { for (i=0; i