diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000..47f324e1d --- /dev/null +++ b/.eslintignore @@ -0,0 +1,34 @@ +_cli-tpl/ +dist/ +coverage/ + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +**/*.json +# Dependency directories +node_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test + +.cache/ + +# yarn v2 +.yarn diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 000000000..c8c242d22 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,134 @@ +module.exports = { + root: true, + env: { + browser: true, + node: true, + es6: true + }, + parserOptions: { ecmaVersion: 2021 }, + overrides: [ + { + files: ['*.ts'], + parser: '@typescript-eslint/parser', + parserOptions: { + parser: '@typescript-eslint/parser', + ecmaVersion: 2020, + sourceType: 'module', + createDefaultProgram: true, + tsconfigRootDir: __dirname, + project: ['tsconfig.json'], + createDefaultProgram: true + }, + plugins: ['@typescript-eslint', 'jsdoc', 'import', 'deprecation'], + extends: [ + 'plugin:@angular-eslint/recommended', + 'plugin:@angular-eslint/template/process-inline-templates', + 'plugin:prettier/recommended' + ], + rules: { + 'prettier/prettier': ['error'], + 'jsdoc/newline-after-description': 1, + '@angular-eslint/component-class-suffix': [ + 'error', + { + suffixes: ['Directive', 'Component', 'Base', 'Widget'] + } + ], + '@angular-eslint/directive-class-suffix': [ + 'error', + { + suffixes: ['Directive', 'Component', 'Base', 'Widget'] + } + ], + '@angular-eslint/component-selector': [ + 'off', + { + type: ['element', 'attribute'], + prefix: ['app', 'test'], + style: 'kebab-case' + } + ], + '@angular-eslint/directive-selector': [ + 'off', + { + type: 'attribute', + prefix: ['app'] + } + ], + '@angular-eslint/no-attribute-decorator': 'error', + '@angular-eslint/no-conflicting-lifecycle': 'off', + '@angular-eslint/no-forward-ref': 'off', + '@angular-eslint/no-host-metadata-property': 'off', + '@angular-eslint/no-lifecycle-call': 'off', + '@angular-eslint/no-pipe-impure': 'error', + '@angular-eslint/prefer-output-readonly': 'error', + '@angular-eslint/use-component-selector': 'off', + '@angular-eslint/use-component-view-encapsulation': 'off', + '@angular-eslint/no-input-rename': 'off', + '@angular-eslint/no-output-native': 'off', + '@typescript-eslint/array-type': [ + 'error', + { + default: 'array-simple' + } + ], + '@typescript-eslint/ban-types': [ + 'off', + { + types: { + String: { + message: 'Use string instead.' + }, + Number: { + message: 'Use number instead.' + }, + Boolean: { + message: 'Use boolean instead.' + }, + Function: { + message: 'Use specific callable interface instead.' + } + } + } + ], + 'import/no-duplicates': 'error', + 'import/no-unused-modules': 'error', + 'import/no-unassigned-import': 'off', + 'import/order': [ + 'error', + { + alphabetize: { order: 'asc', caseInsensitive: false }, + 'newlines-between': 'always', + groups: ['external', 'internal', ['parent', 'sibling', 'index']], + pathGroups: [], + pathGroupsExcludedImportTypes: [] + } + ], + '@typescript-eslint/no-this-alias': 'error', + '@typescript-eslint/member-ordering': 'off', + 'no-irregular-whitespace': 'error', + 'no-multiple-empty-lines': 'error', + 'no-sparse-arrays': 'error', + 'prefer-object-spread': 'error', + 'prefer-template': 'error', + 'prefer-const': 'off', + 'max-len': 'off', + 'deprecation/deprecation': 'warn' + } + }, + { + files: ['*.html'], + extends: ['plugin:@angular-eslint/template/recommended'], + rules: {} + }, + { + files: ['*.html'], + excludedFiles: ['*inline-template-*.component.html'], + extends: ['plugin:prettier/recommended'], + rules: { + 'prettier/prettier': ['error', { parser: 'angular' }], + '@angular-eslint/template/eqeqeq': 'off' + } + } + ] +}; diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 34f8c300c..000000000 --- a/.eslintrc.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "root": true, - "ignorePatterns": [ - "dist/**/*", - "release/**/*" - ], - "parserOptions": { - "ecmaVersion": "latest" - }, - "overrides": [ - { - "files": [ - "*.ts" - ], - "parserOptions": { - "project": [ - // "./tsconfig.serve.json" - ], - "createDefaultProgram": true - }, - "extends": [], - "rules": { - "prefer-arrow/prefer-arrow-functions": 0, - "@typescript-eslint/member-ordering": 0, - "@angular-eslint/directive-selector": 0, - "@angular-eslint/component-selector": [ - "error", - { - "type": "element", - "prefix": "eo", - "style": "kebab-case" - } - ] - } - }, - { - "files": [ - "*.html" - ], - "extends": [], - "rules": {} - } - ] -} diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..d3934ed34 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +* text=auto eol=lf +*.ts linguist-detectable=false +*.css linguist-detectable=false +*.scss linguist-detectable=false +*.js linguist-detectable=true diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index b54f43ca8..6082db1b5 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -6,7 +6,7 @@ body: value: | Before opening an issue, we recommend: * Use English to communicate. - * Search for duplicates of [Issues](https://github.com/eolinker/eoapi/issues) and [Discussions](https://github.com/eolinker/eoapi/discussions) unresolved. + * Search for duplicates of [Issues](https://github.com/eolinker/postcat/issues) and [Discussions](https://github.com/eolinker/postcat/discussions) unresolved. - type: textarea id: bug-description attributes: @@ -22,7 +22,7 @@ body: label: Environment description: Share your environment details. Reports without proper environment details will likely be closed. placeholder: | - - Eoapi Version [e.g. 1.7.0] + - Postcat Version [e.g. 1.7.0] - OS: [e.g. Darwin arm64 21.5.0] validations: required: true diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 0e300f299..94d799ead 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -6,7 +6,7 @@ body: value: | Before opening an issue, we recommend: * Use English to communicate. - * Search for duplicates of [Issues](https://github.com/eolinker/eoapi/issues) and [Discussions](https://github.com/eolinker/eoapi/discussions) unresolved. + * Search for duplicates of [Issues](https://github.com/eolinker/postcat/issues) and [Discussions](https://github.com/eolinker/postcat/discussions) unresolved. - type: textarea id: bug-description attributes: @@ -22,7 +22,7 @@ body: label: Environment description: Share your environment details. Reports without proper environment details will likely be closed. placeholder: | - - Eoapi Version [e.g. 1.7.0] + - Postcat Version [e.g. 1.7.0] - OS: [e.g. Darwin arm64 21.5.0] validations: required: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2fc0bd9b1..73c4ecfd3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,7 @@ name: Release on: push: - # branches: [for debug] + # branches: [feat/ui-component] tags: - 'v*.*.*' jobs: @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-latest, macos-latest, ubuntu-latest] + os: [windows-latest, macos-latest, macos-12, ubuntu-latest] steps: - name: Check out git repository @@ -47,7 +47,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - - name: Release for MacOS + - name: Release for MacOS arm if: matrix.os == 'macos-latest' env: GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} @@ -84,6 +84,43 @@ jobs: # clean up keychain and provisioning profile security delete-keychain $RUNNER_TEMP/app-signing.keychain-db + - name: Release for MacOS x86 + if: matrix.os == 'macos-12' + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} + P12_PASSWORD: ${{ secrets.P12_PASSWORD }} + # BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }} + KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} + run: | + # create variables + CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 + # PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision + KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db + + # import certificate and provisioning profile from secrets + echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode --output $CERTIFICATE_PATH + # echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode --output $PP_PATH + + # create temporary keychain + security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH + security set-keychain-settings -lut 21600 $KEYCHAIN_PATH + security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH + + # import certificate to keychain + security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH + security list-keychain -d user -s $KEYCHAIN_PATH + + # apply provisioning profile + # mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles + # cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles + echo "${{ secrets.NOTARIZE_JS }}" > scripts/notarize.js + yarn release:m1 + yarn release + + # clean up keychain and provisioning profile + security delete-keychain $RUNNER_TEMP/app-signing.keychain-db + - name: Release for Linux if: matrix.os == 'ubuntu-latest' run: | diff --git a/.gitignore b/.gitignore index e4e35adee..7362ebf0e 100644 --- a/.gitignore +++ b/.gitignore @@ -10,12 +10,14 @@ out/ *.js *.js.map *.webpack.js +!patches/* !src/workbench/node/electron/**/*.js !src/workbench/node/request/**/*.js !src/workbench/node/server/**/*.js !/api/*.js !/scripts/*.js !*.config.js +!.*.js !upload.js # dependencies @@ -57,3 +59,6 @@ Thumbs.db nginx-test.conf docker-compose.dev.yml Dockerfile.dev + +#cache +buildFile diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100755 index 000000000..567ff71f0 --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1,6 @@ +#!/bin/sh + +# shellcheck source=./_/husky.sh +. "$(dirname "$0")/_/husky.sh" + +npx --no-install commitlint --edit "$1" diff --git a/.husky/common.sh b/.husky/common.sh new file mode 100644 index 000000000..9d5129bd7 --- /dev/null +++ b/.husky/common.sh @@ -0,0 +1,9 @@ +#!/bin/sh +command_exists () { + command -v "$1" >/dev/null 2>&1 +} + +# Workaround for Windows 10, Git Bash and Yarn +if command_exists winpty && test -t 1; then + exec < /dev/tty +fi diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 000000000..35f92427c --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,8 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" +. "$(dirname "$0")/common.sh" + +[ -n "$CI" ] && exit 0 + +# Format and submit code according to lintstagedrc.js configuration +npm run lint:lint-staged diff --git a/.npmrc b/.npmrc index f5357d5e2..2acac4454 100644 --- a/.npmrc +++ b/.npmrc @@ -1,2 +1,4 @@ save=true save-exact=true +electron_mirror=https://npmmirror.com/mirrors/electron/ +registry=https://registry.npmmirror.com diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..d250447cc --- /dev/null +++ b/.prettierignore @@ -0,0 +1,18 @@ +# add files you wish to ignore here +**/*.md +**/*.svg +**/test.ts + +.stylelintrc +.prettierrc + +src/assets/* +src/index.html +node_modules/ +.vscode/ +coverage/ +dist/ +package.json +tslint.json + +_cli-tpl/**/* diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 0981b7cc0..000000000 --- a/.prettierrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "singleQuote": true, - "printWidth": 120 -} diff --git a/.stylelintignore b/.stylelintignore new file mode 100644 index 000000000..46e88b05d --- /dev/null +++ b/.stylelintignore @@ -0,0 +1,2 @@ +/dist/* +/public/* diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 000000000..4678a0bd5 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,9 @@ +{ + "recommendations": [ + "cyrilletuzi.angular-schematics", + "dbaeumer.vscode-eslint", + "stylelint.vscode-stylelint", + "esbenp.prettier-vscode", + "heybourn.headwind" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 64873a126..0375ef146 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,16 +1,93 @@ { + "typescript.tsdk": "./node_modules/typescript/lib", "typescript.preferences.importModuleSpecifier": "non-relative", - "eslint.workingDirectories": [ - { - "mode": "auto" - } + "npm.packageManager": "yarn", + "editor.tabSize": 2, + "editor.formatOnSave": true, + "editor.defaultFormatter": "esbenp.prettier-vscode", + "files.eol": "\n", + "eslint.workingDirectories": [{ "mode": "auto" }], + "eslint.probe": [ + "javascript", + "javascriptreact", + "typescript", + "typescriptreact", + "html", + "vue", + "markdown", + "json", + "jsonc" + ], + "eslint.validate": [ + "javascript", + "javascriptreact", + "typescript", + "typescriptreact", + "html", + "vue", + "markdown", + "json", + "jsonc" ], + "stylelint.enable": true, + "stylelint.validate": ["css", "less", "postcss", "scss", "html", "sass"], + "stylelint.packageManager": "yarn", + "editor.codeActionsOnSave": { + "source.fixAll.eslint": true, + "source.fixAll.stylelint": true + }, + "[javascriptreact]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[typescript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.codeActionsOnSave": { + "source.fixAll.eslint": true + } + }, + "[html]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[css]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[less]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[scss]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[markdown]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[jsonc]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "files.watcherExclude": { + "**/.git/objects/**": true, + "**/.git/subtree-cache/**": true, + "**/node_modules/**": true, + "**/bazel-out/**": true, + "**/dist/**": true, + "**/aio/src/generated/**": true + }, + "files.associations": { + "*.json": "jsonc", + ".prettierrc": "jsonc", + ".stylelintrc": "jsonc" + }, "search.exclude": { "**/node_modules": true, + "**/bower_components": true, + "**/bazel-out": true, "**/dist": true, + "**/aio/src/generated": true, + ".history": true, "**/.angular/**/*.*": true, "**/*.code-search": true, "**/*.lock": true }, - "typescript.tsdk": "node_modules\\typescript\\lib" + "[xml]": { + "editor.defaultFormatter": "DotJoshJohnson.xml" + } } diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 374d5aca7..a98439b67 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -26,7 +26,7 @@ { "label": "Build.Renderer", "type": "shell", - "command": "npm run ng:serve", + "command": "npm run serve", "isBackground": true, "group": { "kind": "build", diff --git a/.yarn/releases/yarn-1.18.0.cjs b/.yarn/releases/yarn-1.18.0.cjs new file mode 100755 index 000000000..778dc89f5 --- /dev/null +++ b/.yarn/releases/yarn-1.18.0.cjs @@ -0,0 +1,147155 @@ +#!/usr/bin/env node +module.exports = +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // identity function for calling harmony imports with the correct context +/******/ __webpack_require__.i = function(value) { return value; }; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 549); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { + +module.exports = require("path"); + +/***/ }), +/* 1 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (immutable) */ __webpack_exports__["a"] = __extends; +/* unused harmony export __assign */ +/* unused harmony export __rest */ +/* unused harmony export __decorate */ +/* unused harmony export __param */ +/* unused harmony export __metadata */ +/* unused harmony export __awaiter */ +/* unused harmony export __generator */ +/* unused harmony export __exportStar */ +/* unused harmony export __values */ +/* unused harmony export __read */ +/* unused harmony export __spread */ +/* unused harmony export __await */ +/* unused harmony export __asyncGenerator */ +/* unused harmony export __asyncDelegator */ +/* unused harmony export __asyncValues */ +/* unused harmony export __makeTemplateObject */ +/* unused harmony export __importStar */ +/* unused harmony export __importDefault */ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. 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 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ +/* global Reflect, Promise */ + +var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); +}; + +function __extends(d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} + +var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + } + return __assign.apply(this, arguments); +} + +function __rest(s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) + t[p[i]] = s[p[i]]; + return t; +} + +function __decorate(decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +} + +function __param(paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +} + +function __metadata(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); +} + +function __awaiter(thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} + +function __generator(thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +} + +function __exportStar(m, exports) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} + +function __values(o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +} + +function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +} + +function __spread() { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; +} + +function __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); +} + +function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } +} + +function __asyncDelegator(o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } +} + +function __asyncValues(o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } +} + +function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; +}; + +function __importStar(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result.default = mod; + return result; +} + +function __importDefault(mod) { + return (mod && mod.__esModule) ? mod : { default: mod }; +} + + +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +exports.__esModule = true; + +var _promise = __webpack_require__(227); + +var _promise2 = _interopRequireDefault(_promise); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = function (fn) { + return function () { + var gen = fn.apply(this, arguments); + return new _promise2.default(function (resolve, reject) { + function step(key, arg) { + try { + var info = gen[key](arg); + var value = info.value; + } catch (error) { + reject(error); + return; + } + + if (info.done) { + resolve(value); + } else { + return _promise2.default.resolve(value).then(function (value) { + step("next", value); + }, function (err) { + step("throw", err); + }); + } + } + + return step("next"); + }); + }; +}; + +/***/ }), +/* 3 */ +/***/ (function(module, exports) { + +module.exports = require("util"); + +/***/ }), +/* 4 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getFirstSuitableFolder = exports.readFirstAvailableStream = exports.makeTempDir = exports.hardlinksWork = exports.writeFilePreservingEol = exports.getFileSizeOnDisk = exports.walk = exports.symlink = exports.find = exports.readJsonAndFile = exports.readJson = exports.readFileAny = exports.hardlinkBulk = exports.copyBulk = exports.unlink = exports.glob = exports.link = exports.chmod = exports.lstat = exports.exists = exports.mkdirp = exports.stat = exports.access = exports.rename = exports.readdir = exports.realpath = exports.readlink = exports.writeFile = exports.open = exports.readFileBuffer = exports.lockQueue = exports.constants = undefined; + +var _asyncToGenerator2; + +function _load_asyncToGenerator() { + return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(2)); +} + +let buildActionsForCopy = (() => { + var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (queue, events, possibleExtraneous, reporter) { + + // + let build = (() => { + var _ref5 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (data) { + const src = data.src, + dest = data.dest, + type = data.type; + + const onFresh = data.onFresh || noop; + const onDone = data.onDone || noop; + + // TODO https://github.com/yarnpkg/yarn/issues/3751 + // related to bundled dependencies handling + if (files.has(dest.toLowerCase())) { + reporter.verbose(`The case-insensitive file ${dest} shouldn't be copied twice in one bulk copy`); + } else { + files.add(dest.toLowerCase()); + } + + if (type === 'symlink') { + yield mkdirp((_path || _load_path()).default.dirname(dest)); + onFresh(); + actions.symlink.push({ + dest, + linkname: src + }); + onDone(); + return; + } + + if (events.ignoreBasenames.indexOf((_path || _load_path()).default.basename(src)) >= 0) { + // ignored file + return; + } + + const srcStat = yield lstat(src); + let srcFiles; + + if (srcStat.isDirectory()) { + srcFiles = yield readdir(src); + } + + let destStat; + try { + // try accessing the destination + destStat = yield lstat(dest); + } catch (e) { + // proceed if destination doesn't exist, otherwise error + if (e.code !== 'ENOENT') { + throw e; + } + } + + // if destination exists + if (destStat) { + const bothSymlinks = srcStat.isSymbolicLink() && destStat.isSymbolicLink(); + const bothFolders = srcStat.isDirectory() && destStat.isDirectory(); + const bothFiles = srcStat.isFile() && destStat.isFile(); + + // EINVAL access errors sometimes happen which shouldn't because node shouldn't be giving + // us modes that aren't valid. investigate this, it's generally safe to proceed. + + /* if (srcStat.mode !== destStat.mode) { + try { + await access(dest, srcStat.mode); + } catch (err) {} + } */ + + if (bothFiles && artifactFiles.has(dest)) { + // this file gets changed during build, likely by a custom install script. Don't bother checking it. + onDone(); + reporter.verbose(reporter.lang('verboseFileSkipArtifact', src)); + return; + } + + if (bothFiles && srcStat.size === destStat.size && (0, (_fsNormalized || _load_fsNormalized()).fileDatesEqual)(srcStat.mtime, destStat.mtime)) { + // we can safely assume this is the same file + onDone(); + reporter.verbose(reporter.lang('verboseFileSkip', src, dest, srcStat.size, +srcStat.mtime)); + return; + } + + if (bothSymlinks) { + const srcReallink = yield readlink(src); + if (srcReallink === (yield readlink(dest))) { + // if both symlinks are the same then we can continue on + onDone(); + reporter.verbose(reporter.lang('verboseFileSkipSymlink', src, dest, srcReallink)); + return; + } + } + + if (bothFolders) { + // mark files that aren't in this folder as possibly extraneous + const destFiles = yield readdir(dest); + invariant(srcFiles, 'src files not initialised'); + + for (var _iterator4 = destFiles, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) { + var _ref6; + + if (_isArray4) { + if (_i4 >= _iterator4.length) break; + _ref6 = _iterator4[_i4++]; + } else { + _i4 = _iterator4.next(); + if (_i4.done) break; + _ref6 = _i4.value; + } + + const file = _ref6; + + if (srcFiles.indexOf(file) < 0) { + const loc = (_path || _load_path()).default.join(dest, file); + possibleExtraneous.add(loc); + + if ((yield lstat(loc)).isDirectory()) { + for (var _iterator5 = yield readdir(loc), _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) { + var _ref7; + + if (_isArray5) { + if (_i5 >= _iterator5.length) break; + _ref7 = _iterator5[_i5++]; + } else { + _i5 = _iterator5.next(); + if (_i5.done) break; + _ref7 = _i5.value; + } + + const file = _ref7; + + possibleExtraneous.add((_path || _load_path()).default.join(loc, file)); + } + } + } + } + } + } + + if (destStat && destStat.isSymbolicLink()) { + yield (0, (_fsNormalized || _load_fsNormalized()).unlink)(dest); + destStat = null; + } + + if (srcStat.isSymbolicLink()) { + onFresh(); + const linkname = yield readlink(src); + actions.symlink.push({ + dest, + linkname + }); + onDone(); + } else if (srcStat.isDirectory()) { + if (!destStat) { + reporter.verbose(reporter.lang('verboseFileFolder', dest)); + yield mkdirp(dest); + } + + const destParts = dest.split((_path || _load_path()).default.sep); + while (destParts.length) { + files.add(destParts.join((_path || _load_path()).default.sep).toLowerCase()); + destParts.pop(); + } + + // push all files to queue + invariant(srcFiles, 'src files not initialised'); + let remaining = srcFiles.length; + if (!remaining) { + onDone(); + } + for (var _iterator6 = srcFiles, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : _iterator6[Symbol.iterator]();;) { + var _ref8; + + if (_isArray6) { + if (_i6 >= _iterator6.length) break; + _ref8 = _iterator6[_i6++]; + } else { + _i6 = _iterator6.next(); + if (_i6.done) break; + _ref8 = _i6.value; + } + + const file = _ref8; + + queue.push({ + dest: (_path || _load_path()).default.join(dest, file), + onFresh, + onDone: function (_onDone) { + function onDone() { + return _onDone.apply(this, arguments); + } + + onDone.toString = function () { + return _onDone.toString(); + }; + + return onDone; + }(function () { + if (--remaining === 0) { + onDone(); + } + }), + src: (_path || _load_path()).default.join(src, file) + }); + } + } else if (srcStat.isFile()) { + onFresh(); + actions.file.push({ + src, + dest, + atime: srcStat.atime, + mtime: srcStat.mtime, + mode: srcStat.mode + }); + onDone(); + } else { + throw new Error(`unsure how to copy this: ${src}`); + } + }); + + return function build(_x5) { + return _ref5.apply(this, arguments); + }; + })(); + + const artifactFiles = new Set(events.artifactFiles || []); + const files = new Set(); + + // initialise events + for (var _iterator = queue, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref2; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref2 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref2 = _i.value; + } + + const item = _ref2; + + const onDone = item.onDone; + item.onDone = function () { + events.onProgress(item.dest); + if (onDone) { + onDone(); + } + }; + } + events.onStart(queue.length); + + // start building actions + const actions = { + file: [], + symlink: [], + link: [] + }; + + // custom concurrency logic as we're always executing stacks of CONCURRENT_QUEUE_ITEMS queue items + // at a time due to the requirement to push items onto the queue + while (queue.length) { + const items = queue.splice(0, CONCURRENT_QUEUE_ITEMS); + yield Promise.all(items.map(build)); + } + + // simulate the existence of some files to prevent considering them extraneous + for (var _iterator2 = artifactFiles, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { + var _ref3; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref3 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref3 = _i2.value; + } + + const file = _ref3; + + if (possibleExtraneous.has(file)) { + reporter.verbose(reporter.lang('verboseFilePhantomExtraneous', file)); + possibleExtraneous.delete(file); + } + } + + for (var _iterator3 = possibleExtraneous, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { + var _ref4; + + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref4 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref4 = _i3.value; + } + + const loc = _ref4; + + if (files.has(loc.toLowerCase())) { + possibleExtraneous.delete(loc); + } + } + + return actions; + }); + + return function buildActionsForCopy(_x, _x2, _x3, _x4) { + return _ref.apply(this, arguments); + }; +})(); + +let buildActionsForHardlink = (() => { + var _ref9 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (queue, events, possibleExtraneous, reporter) { + + // + let build = (() => { + var _ref13 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (data) { + const src = data.src, + dest = data.dest; + + const onFresh = data.onFresh || noop; + const onDone = data.onDone || noop; + if (files.has(dest.toLowerCase())) { + // Fixes issue https://github.com/yarnpkg/yarn/issues/2734 + // When bulk hardlinking we have A -> B structure that we want to hardlink to A1 -> B1, + // package-linker passes that modules A1 and B1 need to be hardlinked, + // the recursive linking algorithm of A1 ends up scheduling files in B1 to be linked twice which will case + // an exception. + onDone(); + return; + } + files.add(dest.toLowerCase()); + + if (events.ignoreBasenames.indexOf((_path || _load_path()).default.basename(src)) >= 0) { + // ignored file + return; + } + + const srcStat = yield lstat(src); + let srcFiles; + + if (srcStat.isDirectory()) { + srcFiles = yield readdir(src); + } + + const destExists = yield exists(dest); + if (destExists) { + const destStat = yield lstat(dest); + + const bothSymlinks = srcStat.isSymbolicLink() && destStat.isSymbolicLink(); + const bothFolders = srcStat.isDirectory() && destStat.isDirectory(); + const bothFiles = srcStat.isFile() && destStat.isFile(); + + if (srcStat.mode !== destStat.mode) { + try { + yield access(dest, srcStat.mode); + } catch (err) { + // EINVAL access errors sometimes happen which shouldn't because node shouldn't be giving + // us modes that aren't valid. investigate this, it's generally safe to proceed. + reporter.verbose(err); + } + } + + if (bothFiles && artifactFiles.has(dest)) { + // this file gets changed during build, likely by a custom install script. Don't bother checking it. + onDone(); + reporter.verbose(reporter.lang('verboseFileSkipArtifact', src)); + return; + } + + // correct hardlink + if (bothFiles && srcStat.ino !== null && srcStat.ino === destStat.ino) { + onDone(); + reporter.verbose(reporter.lang('verboseFileSkip', src, dest, srcStat.ino)); + return; + } + + if (bothSymlinks) { + const srcReallink = yield readlink(src); + if (srcReallink === (yield readlink(dest))) { + // if both symlinks are the same then we can continue on + onDone(); + reporter.verbose(reporter.lang('verboseFileSkipSymlink', src, dest, srcReallink)); + return; + } + } + + if (bothFolders) { + // mark files that aren't in this folder as possibly extraneous + const destFiles = yield readdir(dest); + invariant(srcFiles, 'src files not initialised'); + + for (var _iterator10 = destFiles, _isArray10 = Array.isArray(_iterator10), _i10 = 0, _iterator10 = _isArray10 ? _iterator10 : _iterator10[Symbol.iterator]();;) { + var _ref14; + + if (_isArray10) { + if (_i10 >= _iterator10.length) break; + _ref14 = _iterator10[_i10++]; + } else { + _i10 = _iterator10.next(); + if (_i10.done) break; + _ref14 = _i10.value; + } + + const file = _ref14; + + if (srcFiles.indexOf(file) < 0) { + const loc = (_path || _load_path()).default.join(dest, file); + possibleExtraneous.add(loc); + + if ((yield lstat(loc)).isDirectory()) { + for (var _iterator11 = yield readdir(loc), _isArray11 = Array.isArray(_iterator11), _i11 = 0, _iterator11 = _isArray11 ? _iterator11 : _iterator11[Symbol.iterator]();;) { + var _ref15; + + if (_isArray11) { + if (_i11 >= _iterator11.length) break; + _ref15 = _iterator11[_i11++]; + } else { + _i11 = _iterator11.next(); + if (_i11.done) break; + _ref15 = _i11.value; + } + + const file = _ref15; + + possibleExtraneous.add((_path || _load_path()).default.join(loc, file)); + } + } + } + } + } + } + + if (srcStat.isSymbolicLink()) { + onFresh(); + const linkname = yield readlink(src); + actions.symlink.push({ + dest, + linkname + }); + onDone(); + } else if (srcStat.isDirectory()) { + reporter.verbose(reporter.lang('verboseFileFolder', dest)); + yield mkdirp(dest); + + const destParts = dest.split((_path || _load_path()).default.sep); + while (destParts.length) { + files.add(destParts.join((_path || _load_path()).default.sep).toLowerCase()); + destParts.pop(); + } + + // push all files to queue + invariant(srcFiles, 'src files not initialised'); + let remaining = srcFiles.length; + if (!remaining) { + onDone(); + } + for (var _iterator12 = srcFiles, _isArray12 = Array.isArray(_iterator12), _i12 = 0, _iterator12 = _isArray12 ? _iterator12 : _iterator12[Symbol.iterator]();;) { + var _ref16; + + if (_isArray12) { + if (_i12 >= _iterator12.length) break; + _ref16 = _iterator12[_i12++]; + } else { + _i12 = _iterator12.next(); + if (_i12.done) break; + _ref16 = _i12.value; + } + + const file = _ref16; + + queue.push({ + onFresh, + src: (_path || _load_path()).default.join(src, file), + dest: (_path || _load_path()).default.join(dest, file), + onDone: function (_onDone2) { + function onDone() { + return _onDone2.apply(this, arguments); + } + + onDone.toString = function () { + return _onDone2.toString(); + }; + + return onDone; + }(function () { + if (--remaining === 0) { + onDone(); + } + }) + }); + } + } else if (srcStat.isFile()) { + onFresh(); + actions.link.push({ + src, + dest, + removeDest: destExists + }); + onDone(); + } else { + throw new Error(`unsure how to copy this: ${src}`); + } + }); + + return function build(_x10) { + return _ref13.apply(this, arguments); + }; + })(); + + const artifactFiles = new Set(events.artifactFiles || []); + const files = new Set(); + + // initialise events + for (var _iterator7 = queue, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : _iterator7[Symbol.iterator]();;) { + var _ref10; + + if (_isArray7) { + if (_i7 >= _iterator7.length) break; + _ref10 = _iterator7[_i7++]; + } else { + _i7 = _iterator7.next(); + if (_i7.done) break; + _ref10 = _i7.value; + } + + const item = _ref10; + + const onDone = item.onDone || noop; + item.onDone = function () { + events.onProgress(item.dest); + onDone(); + }; + } + events.onStart(queue.length); + + // start building actions + const actions = { + file: [], + symlink: [], + link: [] + }; + + // custom concurrency logic as we're always executing stacks of CONCURRENT_QUEUE_ITEMS queue items + // at a time due to the requirement to push items onto the queue + while (queue.length) { + const items = queue.splice(0, CONCURRENT_QUEUE_ITEMS); + yield Promise.all(items.map(build)); + } + + // simulate the existence of some files to prevent considering them extraneous + for (var _iterator8 = artifactFiles, _isArray8 = Array.isArray(_iterator8), _i8 = 0, _iterator8 = _isArray8 ? _iterator8 : _iterator8[Symbol.iterator]();;) { + var _ref11; + + if (_isArray8) { + if (_i8 >= _iterator8.length) break; + _ref11 = _iterator8[_i8++]; + } else { + _i8 = _iterator8.next(); + if (_i8.done) break; + _ref11 = _i8.value; + } + + const file = _ref11; + + if (possibleExtraneous.has(file)) { + reporter.verbose(reporter.lang('verboseFilePhantomExtraneous', file)); + possibleExtraneous.delete(file); + } + } + + for (var _iterator9 = possibleExtraneous, _isArray9 = Array.isArray(_iterator9), _i9 = 0, _iterator9 = _isArray9 ? _iterator9 : _iterator9[Symbol.iterator]();;) { + var _ref12; + + if (_isArray9) { + if (_i9 >= _iterator9.length) break; + _ref12 = _iterator9[_i9++]; + } else { + _i9 = _iterator9.next(); + if (_i9.done) break; + _ref12 = _i9.value; + } + + const loc = _ref12; + + if (files.has(loc.toLowerCase())) { + possibleExtraneous.delete(loc); + } + } + + return actions; + }); + + return function buildActionsForHardlink(_x6, _x7, _x8, _x9) { + return _ref9.apply(this, arguments); + }; +})(); + +let copyBulk = exports.copyBulk = (() => { + var _ref17 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (queue, reporter, _events) { + const events = { + onStart: _events && _events.onStart || noop, + onProgress: _events && _events.onProgress || noop, + possibleExtraneous: _events ? _events.possibleExtraneous : new Set(), + ignoreBasenames: _events && _events.ignoreBasenames || [], + artifactFiles: _events && _events.artifactFiles || [] + }; + + const actions = yield buildActionsForCopy(queue, events, events.possibleExtraneous, reporter); + events.onStart(actions.file.length + actions.symlink.length + actions.link.length); + + const fileActions = actions.file; + + const currentlyWriting = new Map(); + + yield (_promise || _load_promise()).queue(fileActions, (() => { + var _ref18 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (data) { + let writePromise; + while (writePromise = currentlyWriting.get(data.dest)) { + yield writePromise; + } + + reporter.verbose(reporter.lang('verboseFileCopy', data.src, data.dest)); + const copier = (0, (_fsNormalized || _load_fsNormalized()).copyFile)(data, function () { + return currentlyWriting.delete(data.dest); + }); + currentlyWriting.set(data.dest, copier); + events.onProgress(data.dest); + return copier; + }); + + return function (_x14) { + return _ref18.apply(this, arguments); + }; + })(), CONCURRENT_QUEUE_ITEMS); + + // we need to copy symlinks last as they could reference files we were copying + const symlinkActions = actions.symlink; + yield (_promise || _load_promise()).queue(symlinkActions, function (data) { + const linkname = (_path || _load_path()).default.resolve((_path || _load_path()).default.dirname(data.dest), data.linkname); + reporter.verbose(reporter.lang('verboseFileSymlink', data.dest, linkname)); + return symlink(linkname, data.dest); + }); + }); + + return function copyBulk(_x11, _x12, _x13) { + return _ref17.apply(this, arguments); + }; +})(); + +let hardlinkBulk = exports.hardlinkBulk = (() => { + var _ref19 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (queue, reporter, _events) { + const events = { + onStart: _events && _events.onStart || noop, + onProgress: _events && _events.onProgress || noop, + possibleExtraneous: _events ? _events.possibleExtraneous : new Set(), + artifactFiles: _events && _events.artifactFiles || [], + ignoreBasenames: [] + }; + + const actions = yield buildActionsForHardlink(queue, events, events.possibleExtraneous, reporter); + events.onStart(actions.file.length + actions.symlink.length + actions.link.length); + + const fileActions = actions.link; + + yield (_promise || _load_promise()).queue(fileActions, (() => { + var _ref20 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (data) { + reporter.verbose(reporter.lang('verboseFileLink', data.src, data.dest)); + if (data.removeDest) { + yield (0, (_fsNormalized || _load_fsNormalized()).unlink)(data.dest); + } + yield link(data.src, data.dest); + }); + + return function (_x18) { + return _ref20.apply(this, arguments); + }; + })(), CONCURRENT_QUEUE_ITEMS); + + // we need to copy symlinks last as they could reference files we were copying + const symlinkActions = actions.symlink; + yield (_promise || _load_promise()).queue(symlinkActions, function (data) { + const linkname = (_path || _load_path()).default.resolve((_path || _load_path()).default.dirname(data.dest), data.linkname); + reporter.verbose(reporter.lang('verboseFileSymlink', data.dest, linkname)); + return symlink(linkname, data.dest); + }); + }); + + return function hardlinkBulk(_x15, _x16, _x17) { + return _ref19.apply(this, arguments); + }; +})(); + +let readFileAny = exports.readFileAny = (() => { + var _ref21 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (files) { + for (var _iterator13 = files, _isArray13 = Array.isArray(_iterator13), _i13 = 0, _iterator13 = _isArray13 ? _iterator13 : _iterator13[Symbol.iterator]();;) { + var _ref22; + + if (_isArray13) { + if (_i13 >= _iterator13.length) break; + _ref22 = _iterator13[_i13++]; + } else { + _i13 = _iterator13.next(); + if (_i13.done) break; + _ref22 = _i13.value; + } + + const file = _ref22; + + if (yield exists(file)) { + return readFile(file); + } + } + return null; + }); + + return function readFileAny(_x19) { + return _ref21.apply(this, arguments); + }; +})(); + +let readJson = exports.readJson = (() => { + var _ref23 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (loc) { + return (yield readJsonAndFile(loc)).object; + }); + + return function readJson(_x20) { + return _ref23.apply(this, arguments); + }; +})(); + +let readJsonAndFile = exports.readJsonAndFile = (() => { + var _ref24 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (loc) { + const file = yield readFile(loc); + try { + return { + object: (0, (_map || _load_map()).default)(JSON.parse(stripBOM(file))), + content: file + }; + } catch (err) { + err.message = `${loc}: ${err.message}`; + throw err; + } + }); + + return function readJsonAndFile(_x21) { + return _ref24.apply(this, arguments); + }; +})(); + +let find = exports.find = (() => { + var _ref25 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (filename, dir) { + const parts = dir.split((_path || _load_path()).default.sep); + + while (parts.length) { + const loc = parts.concat(filename).join((_path || _load_path()).default.sep); + + if (yield exists(loc)) { + return loc; + } else { + parts.pop(); + } + } + + return false; + }); + + return function find(_x22, _x23) { + return _ref25.apply(this, arguments); + }; +})(); + +let symlink = exports.symlink = (() => { + var _ref26 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (src, dest) { + if (process.platform !== 'win32') { + // use relative paths otherwise which will be retained if the directory is moved + src = (_path || _load_path()).default.relative((_path || _load_path()).default.dirname(dest), src); + // When path.relative returns an empty string for the current directory, we should instead use + // '.', which is a valid fs.symlink target. + src = src || '.'; + } + + try { + const stats = yield lstat(dest); + if (stats.isSymbolicLink()) { + const resolved = dest; + if (resolved === src) { + return; + } + } + } catch (err) { + if (err.code !== 'ENOENT') { + throw err; + } + } + + // We use rimraf for unlink which never throws an ENOENT on missing target + yield (0, (_fsNormalized || _load_fsNormalized()).unlink)(dest); + + if (process.platform === 'win32') { + // use directory junctions if possible on win32, this requires absolute paths + yield fsSymlink(src, dest, 'junction'); + } else { + yield fsSymlink(src, dest); + } + }); + + return function symlink(_x24, _x25) { + return _ref26.apply(this, arguments); + }; +})(); + +let walk = exports.walk = (() => { + var _ref27 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (dir, relativeDir, ignoreBasenames = new Set()) { + let files = []; + + let filenames = yield readdir(dir); + if (ignoreBasenames.size) { + filenames = filenames.filter(function (name) { + return !ignoreBasenames.has(name); + }); + } + + for (var _iterator14 = filenames, _isArray14 = Array.isArray(_iterator14), _i14 = 0, _iterator14 = _isArray14 ? _iterator14 : _iterator14[Symbol.iterator]();;) { + var _ref28; + + if (_isArray14) { + if (_i14 >= _iterator14.length) break; + _ref28 = _iterator14[_i14++]; + } else { + _i14 = _iterator14.next(); + if (_i14.done) break; + _ref28 = _i14.value; + } + + const name = _ref28; + + const relative = relativeDir ? (_path || _load_path()).default.join(relativeDir, name) : name; + const loc = (_path || _load_path()).default.join(dir, name); + const stat = yield lstat(loc); + + files.push({ + relative, + basename: name, + absolute: loc, + mtime: +stat.mtime + }); + + if (stat.isDirectory()) { + files = files.concat((yield walk(loc, relative, ignoreBasenames))); + } + } + + return files; + }); + + return function walk(_x26, _x27) { + return _ref27.apply(this, arguments); + }; +})(); + +let getFileSizeOnDisk = exports.getFileSizeOnDisk = (() => { + var _ref29 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (loc) { + const stat = yield lstat(loc); + const size = stat.size, + blockSize = stat.blksize; + + + return Math.ceil(size / blockSize) * blockSize; + }); + + return function getFileSizeOnDisk(_x28) { + return _ref29.apply(this, arguments); + }; +})(); + +let getEolFromFile = (() => { + var _ref30 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (path) { + if (!(yield exists(path))) { + return undefined; + } + + const buffer = yield readFileBuffer(path); + + for (let i = 0; i < buffer.length; ++i) { + if (buffer[i] === cr) { + return '\r\n'; + } + if (buffer[i] === lf) { + return '\n'; + } + } + return undefined; + }); + + return function getEolFromFile(_x29) { + return _ref30.apply(this, arguments); + }; +})(); + +let writeFilePreservingEol = exports.writeFilePreservingEol = (() => { + var _ref31 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (path, data) { + const eol = (yield getEolFromFile(path)) || (_os || _load_os()).default.EOL; + if (eol !== '\n') { + data = data.replace(/\n/g, eol); + } + yield writeFile(path, data); + }); + + return function writeFilePreservingEol(_x30, _x31) { + return _ref31.apply(this, arguments); + }; +})(); + +let hardlinksWork = exports.hardlinksWork = (() => { + var _ref32 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (dir) { + const filename = 'test-file' + Math.random(); + const file = (_path || _load_path()).default.join(dir, filename); + const fileLink = (_path || _load_path()).default.join(dir, filename + '-link'); + try { + yield writeFile(file, 'test'); + yield link(file, fileLink); + } catch (err) { + return false; + } finally { + yield (0, (_fsNormalized || _load_fsNormalized()).unlink)(file); + yield (0, (_fsNormalized || _load_fsNormalized()).unlink)(fileLink); + } + return true; + }); + + return function hardlinksWork(_x32) { + return _ref32.apply(this, arguments); + }; +})(); + +// not a strict polyfill for Node's fs.mkdtemp + + +let makeTempDir = exports.makeTempDir = (() => { + var _ref33 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (prefix) { + const dir = (_path || _load_path()).default.join((_os || _load_os()).default.tmpdir(), `yarn-${prefix || ''}-${Date.now()}-${Math.random()}`); + yield (0, (_fsNormalized || _load_fsNormalized()).unlink)(dir); + yield mkdirp(dir); + return dir; + }); + + return function makeTempDir(_x33) { + return _ref33.apply(this, arguments); + }; +})(); + +let readFirstAvailableStream = exports.readFirstAvailableStream = (() => { + var _ref34 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (paths) { + for (var _iterator15 = paths, _isArray15 = Array.isArray(_iterator15), _i15 = 0, _iterator15 = _isArray15 ? _iterator15 : _iterator15[Symbol.iterator]();;) { + var _ref35; + + if (_isArray15) { + if (_i15 >= _iterator15.length) break; + _ref35 = _iterator15[_i15++]; + } else { + _i15 = _iterator15.next(); + if (_i15.done) break; + _ref35 = _i15.value; + } + + const path = _ref35; + + try { + const fd = yield open(path, 'r'); + return (_fs || _load_fs()).default.createReadStream(path, { fd }); + } catch (err) { + // Try the next one + } + } + return null; + }); + + return function readFirstAvailableStream(_x34) { + return _ref34.apply(this, arguments); + }; +})(); + +let getFirstSuitableFolder = exports.getFirstSuitableFolder = (() => { + var _ref36 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (paths, mode = constants.W_OK | constants.X_OK) { + const result = { + skipped: [], + folder: null + }; + + for (var _iterator16 = paths, _isArray16 = Array.isArray(_iterator16), _i16 = 0, _iterator16 = _isArray16 ? _iterator16 : _iterator16[Symbol.iterator]();;) { + var _ref37; + + if (_isArray16) { + if (_i16 >= _iterator16.length) break; + _ref37 = _iterator16[_i16++]; + } else { + _i16 = _iterator16.next(); + if (_i16.done) break; + _ref37 = _i16.value; + } + + const folder = _ref37; + + try { + yield mkdirp(folder); + yield access(folder, mode); + + result.folder = folder; + + return result; + } catch (error) { + result.skipped.push({ + error, + folder + }); + } + } + return result; + }); + + return function getFirstSuitableFolder(_x35) { + return _ref36.apply(this, arguments); + }; +})(); + +exports.copy = copy; +exports.readFile = readFile; +exports.readFileRaw = readFileRaw; +exports.normalizeOS = normalizeOS; + +var _fs; + +function _load_fs() { + return _fs = _interopRequireDefault(__webpack_require__(5)); +} + +var _glob; + +function _load_glob() { + return _glob = _interopRequireDefault(__webpack_require__(99)); +} + +var _os; + +function _load_os() { + return _os = _interopRequireDefault(__webpack_require__(49)); +} + +var _path; + +function _load_path() { + return _path = _interopRequireDefault(__webpack_require__(0)); +} + +var _blockingQueue; + +function _load_blockingQueue() { + return _blockingQueue = _interopRequireDefault(__webpack_require__(110)); +} + +var _promise; + +function _load_promise() { + return _promise = _interopRequireWildcard(__webpack_require__(50)); +} + +var _promise2; + +function _load_promise2() { + return _promise2 = __webpack_require__(50); +} + +var _map; + +function _load_map() { + return _map = _interopRequireDefault(__webpack_require__(29)); +} + +var _fsNormalized; + +function _load_fsNormalized() { + return _fsNormalized = __webpack_require__(218); +} + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const constants = exports.constants = typeof (_fs || _load_fs()).default.constants !== 'undefined' ? (_fs || _load_fs()).default.constants : { + R_OK: (_fs || _load_fs()).default.R_OK, + W_OK: (_fs || _load_fs()).default.W_OK, + X_OK: (_fs || _load_fs()).default.X_OK +}; + +const lockQueue = exports.lockQueue = new (_blockingQueue || _load_blockingQueue()).default('fs lock'); + +const readFileBuffer = exports.readFileBuffer = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.readFile); +const open = exports.open = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.open); +const writeFile = exports.writeFile = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.writeFile); +const readlink = exports.readlink = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.readlink); +const realpath = exports.realpath = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.realpath); +const readdir = exports.readdir = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.readdir); +const rename = exports.rename = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.rename); +const access = exports.access = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.access); +const stat = exports.stat = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.stat); +const mkdirp = exports.mkdirp = (0, (_promise2 || _load_promise2()).promisify)(__webpack_require__(145)); +const exists = exports.exists = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.exists, true); +const lstat = exports.lstat = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.lstat); +const chmod = exports.chmod = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.chmod); +const link = exports.link = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.link); +const glob = exports.glob = (0, (_promise2 || _load_promise2()).promisify)((_glob || _load_glob()).default); +exports.unlink = (_fsNormalized || _load_fsNormalized()).unlink; + +// fs.copyFile uses the native file copying instructions on the system, performing much better +// than any JS-based solution and consumes fewer resources. Repeated testing to fine tune the +// concurrency level revealed 128 as the sweet spot on a quad-core, 16 CPU Intel system with SSD. + +const CONCURRENT_QUEUE_ITEMS = (_fs || _load_fs()).default.copyFile ? 128 : 4; + +const fsSymlink = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.symlink); +const invariant = __webpack_require__(9); +const stripBOM = __webpack_require__(160); + +const noop = () => {}; + +function copy(src, dest, reporter) { + return copyBulk([{ src, dest }], reporter); +} + +function _readFile(loc, encoding) { + return new Promise((resolve, reject) => { + (_fs || _load_fs()).default.readFile(loc, encoding, function (err, content) { + if (err) { + reject(err); + } else { + resolve(content); + } + }); + }); +} + +function readFile(loc) { + return _readFile(loc, 'utf8').then(normalizeOS); +} + +function readFileRaw(loc) { + return _readFile(loc, 'binary'); +} + +function normalizeOS(body) { + return body.replace(/\r\n/g, '\n'); +} + +const cr = '\r'.charCodeAt(0); +const lf = '\n'.charCodeAt(0); + +/***/ }), +/* 5 */ +/***/ (function(module, exports) { + +module.exports = require("fs"); + +/***/ }), +/* 6 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +class MessageError extends Error { + constructor(msg, code) { + super(msg); + this.code = code; + } + +} + +exports.MessageError = MessageError; +class ProcessSpawnError extends MessageError { + constructor(msg, code, process) { + super(msg, code); + this.process = process; + } + +} + +exports.ProcessSpawnError = ProcessSpawnError; +class SecurityError extends MessageError {} + +exports.SecurityError = SecurityError; +class ProcessTermError extends MessageError {} + +exports.ProcessTermError = ProcessTermError; +class ResponseError extends Error { + constructor(msg, responseCode) { + super(msg); + this.responseCode = responseCode; + } + +} + +exports.ResponseError = ResponseError; +class OneTimePasswordError extends Error {} +exports.OneTimePasswordError = OneTimePasswordError; + +/***/ }), +/* 7 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Subscriber; }); +/* unused harmony export SafeSubscriber */ +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_tslib__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_isFunction__ = __webpack_require__(154); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Observer__ = __webpack_require__(420); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Subscription__ = __webpack_require__(25); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__internal_symbol_rxSubscriber__ = __webpack_require__(321); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__config__ = __webpack_require__(185); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__util_hostReportError__ = __webpack_require__(323); +/** PURE_IMPORTS_START tslib,_util_isFunction,_Observer,_Subscription,_internal_symbol_rxSubscriber,_config,_util_hostReportError PURE_IMPORTS_END */ + + + + + + + +var Subscriber = /*@__PURE__*/ (function (_super) { + __WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __extends */](Subscriber, _super); + function Subscriber(destinationOrNext, error, complete) { + var _this = _super.call(this) || this; + _this.syncErrorValue = null; + _this.syncErrorThrown = false; + _this.syncErrorThrowable = false; + _this.isStopped = false; + _this._parentSubscription = null; + switch (arguments.length) { + case 0: + _this.destination = __WEBPACK_IMPORTED_MODULE_2__Observer__["a" /* empty */]; + break; + case 1: + if (!destinationOrNext) { + _this.destination = __WEBPACK_IMPORTED_MODULE_2__Observer__["a" /* empty */]; + break; + } + if (typeof destinationOrNext === 'object') { + if (destinationOrNext instanceof Subscriber) { + _this.syncErrorThrowable = destinationOrNext.syncErrorThrowable; + _this.destination = destinationOrNext; + destinationOrNext.add(_this); + } + else { + _this.syncErrorThrowable = true; + _this.destination = new SafeSubscriber(_this, destinationOrNext); + } + break; + } + default: + _this.syncErrorThrowable = true; + _this.destination = new SafeSubscriber(_this, destinationOrNext, error, complete); + break; + } + return _this; + } + Subscriber.prototype[__WEBPACK_IMPORTED_MODULE_4__internal_symbol_rxSubscriber__["a" /* rxSubscriber */]] = function () { return this; }; + Subscriber.create = function (next, error, complete) { + var subscriber = new Subscriber(next, error, complete); + subscriber.syncErrorThrowable = false; + return subscriber; + }; + Subscriber.prototype.next = function (value) { + if (!this.isStopped) { + this._next(value); + } + }; + Subscriber.prototype.error = function (err) { + if (!this.isStopped) { + this.isStopped = true; + this._error(err); + } + }; + Subscriber.prototype.complete = function () { + if (!this.isStopped) { + this.isStopped = true; + this._complete(); + } + }; + Subscriber.prototype.unsubscribe = function () { + if (this.closed) { + return; + } + this.isStopped = true; + _super.prototype.unsubscribe.call(this); + }; + Subscriber.prototype._next = function (value) { + this.destination.next(value); + }; + Subscriber.prototype._error = function (err) { + this.destination.error(err); + this.unsubscribe(); + }; + Subscriber.prototype._complete = function () { + this.destination.complete(); + this.unsubscribe(); + }; + Subscriber.prototype._unsubscribeAndRecycle = function () { + var _a = this, _parent = _a._parent, _parents = _a._parents; + this._parent = null; + this._parents = null; + this.unsubscribe(); + this.closed = false; + this.isStopped = false; + this._parent = _parent; + this._parents = _parents; + this._parentSubscription = null; + return this; + }; + return Subscriber; +}(__WEBPACK_IMPORTED_MODULE_3__Subscription__["a" /* Subscription */])); + +var SafeSubscriber = /*@__PURE__*/ (function (_super) { + __WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __extends */](SafeSubscriber, _super); + function SafeSubscriber(_parentSubscriber, observerOrNext, error, complete) { + var _this = _super.call(this) || this; + _this._parentSubscriber = _parentSubscriber; + var next; + var context = _this; + if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__util_isFunction__["a" /* isFunction */])(observerOrNext)) { + next = observerOrNext; + } + else if (observerOrNext) { + next = observerOrNext.next; + error = observerOrNext.error; + complete = observerOrNext.complete; + if (observerOrNext !== __WEBPACK_IMPORTED_MODULE_2__Observer__["a" /* empty */]) { + context = Object.create(observerOrNext); + if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__util_isFunction__["a" /* isFunction */])(context.unsubscribe)) { + _this.add(context.unsubscribe.bind(context)); + } + context.unsubscribe = _this.unsubscribe.bind(_this); + } + } + _this._context = context; + _this._next = next; + _this._error = error; + _this._complete = complete; + return _this; + } + SafeSubscriber.prototype.next = function (value) { + if (!this.isStopped && this._next) { + var _parentSubscriber = this._parentSubscriber; + if (!__WEBPACK_IMPORTED_MODULE_5__config__["a" /* config */].useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) { + this.__tryOrUnsub(this._next, value); + } + else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) { + this.unsubscribe(); + } + } + }; + SafeSubscriber.prototype.error = function (err) { + if (!this.isStopped) { + var _parentSubscriber = this._parentSubscriber; + var useDeprecatedSynchronousErrorHandling = __WEBPACK_IMPORTED_MODULE_5__config__["a" /* config */].useDeprecatedSynchronousErrorHandling; + if (this._error) { + if (!useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) { + this.__tryOrUnsub(this._error, err); + this.unsubscribe(); + } + else { + this.__tryOrSetError(_parentSubscriber, this._error, err); + this.unsubscribe(); + } + } + else if (!_parentSubscriber.syncErrorThrowable) { + this.unsubscribe(); + if (useDeprecatedSynchronousErrorHandling) { + throw err; + } + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__util_hostReportError__["a" /* hostReportError */])(err); + } + else { + if (useDeprecatedSynchronousErrorHandling) { + _parentSubscriber.syncErrorValue = err; + _parentSubscriber.syncErrorThrown = true; + } + else { + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__util_hostReportError__["a" /* hostReportError */])(err); + } + this.unsubscribe(); + } + } + }; + SafeSubscriber.prototype.complete = function () { + var _this = this; + if (!this.isStopped) { + var _parentSubscriber = this._parentSubscriber; + if (this._complete) { + var wrappedComplete = function () { return _this._complete.call(_this._context); }; + if (!__WEBPACK_IMPORTED_MODULE_5__config__["a" /* config */].useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) { + this.__tryOrUnsub(wrappedComplete); + this.unsubscribe(); + } + else { + this.__tryOrSetError(_parentSubscriber, wrappedComplete); + this.unsubscribe(); + } + } + else { + this.unsubscribe(); + } + } + }; + SafeSubscriber.prototype.__tryOrUnsub = function (fn, value) { + try { + fn.call(this._context, value); + } + catch (err) { + this.unsubscribe(); + if (__WEBPACK_IMPORTED_MODULE_5__config__["a" /* config */].useDeprecatedSynchronousErrorHandling) { + throw err; + } + else { + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__util_hostReportError__["a" /* hostReportError */])(err); + } + } + }; + SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) { + if (!__WEBPACK_IMPORTED_MODULE_5__config__["a" /* config */].useDeprecatedSynchronousErrorHandling) { + throw new Error('bad call'); + } + try { + fn.call(this._context, value); + } + catch (err) { + if (__WEBPACK_IMPORTED_MODULE_5__config__["a" /* config */].useDeprecatedSynchronousErrorHandling) { + parent.syncErrorValue = err; + parent.syncErrorThrown = true; + return true; + } + else { + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__util_hostReportError__["a" /* hostReportError */])(err); + return true; + } + } + return false; + }; + SafeSubscriber.prototype._unsubscribe = function () { + var _parentSubscriber = this._parentSubscriber; + this._context = null; + this._parentSubscriber = null; + _parentSubscriber.unsubscribe(); + }; + return SafeSubscriber; +}(Subscriber)); + +//# sourceMappingURL=Subscriber.js.map + + +/***/ }), +/* 8 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getPathKey = getPathKey; +const os = __webpack_require__(49); +const path = __webpack_require__(0); +const userHome = __webpack_require__(66).default; + +var _require = __webpack_require__(225); + +const getCacheDir = _require.getCacheDir, + getConfigDir = _require.getConfigDir, + getDataDir = _require.getDataDir; + +const isWebpackBundle = __webpack_require__(278); + +const DEPENDENCY_TYPES = exports.DEPENDENCY_TYPES = ['devDependencies', 'dependencies', 'optionalDependencies', 'peerDependencies']; +const OWNED_DEPENDENCY_TYPES = exports.OWNED_DEPENDENCY_TYPES = ['devDependencies', 'dependencies', 'optionalDependencies']; + +const RESOLUTIONS = exports.RESOLUTIONS = 'resolutions'; +const MANIFEST_FIELDS = exports.MANIFEST_FIELDS = [RESOLUTIONS, ...DEPENDENCY_TYPES]; + +const SUPPORTED_NODE_VERSIONS = exports.SUPPORTED_NODE_VERSIONS = '^4.8.0 || ^5.7.0 || ^6.2.2 || >=8.0.0'; + +const YARN_REGISTRY = exports.YARN_REGISTRY = 'https://registry.yarnpkg.com'; +const NPM_REGISTRY_RE = exports.NPM_REGISTRY_RE = /https?:\/\/registry\.npmjs\.org/g; + +const YARN_DOCS = exports.YARN_DOCS = 'https://yarnpkg.com/en/docs/cli/'; +const YARN_INSTALLER_SH = exports.YARN_INSTALLER_SH = 'https://yarnpkg.com/install.sh'; +const YARN_INSTALLER_MSI = exports.YARN_INSTALLER_MSI = 'https://yarnpkg.com/latest.msi'; + +const SELF_UPDATE_VERSION_URL = exports.SELF_UPDATE_VERSION_URL = 'https://yarnpkg.com/latest-version'; + +// cache version, bump whenever we make backwards incompatible changes +const CACHE_VERSION = exports.CACHE_VERSION = 4; + +// lockfile version, bump whenever we make backwards incompatible changes +const LOCKFILE_VERSION = exports.LOCKFILE_VERSION = 1; + +// max amount of network requests to perform concurrently +const NETWORK_CONCURRENCY = exports.NETWORK_CONCURRENCY = 8; + +// HTTP timeout used when downloading packages +const NETWORK_TIMEOUT = exports.NETWORK_TIMEOUT = 30 * 1000; // in milliseconds + +// max amount of child processes to execute concurrently +const CHILD_CONCURRENCY = exports.CHILD_CONCURRENCY = 5; + +const REQUIRED_PACKAGE_KEYS = exports.REQUIRED_PACKAGE_KEYS = ['name', 'version', '_uid']; + +function getPreferredCacheDirectories() { + const preferredCacheDirectories = [getCacheDir()]; + + if (process.getuid) { + // $FlowFixMe: process.getuid exists, dammit + preferredCacheDirectories.push(path.join(os.tmpdir(), `.yarn-cache-${process.getuid()}`)); + } + + preferredCacheDirectories.push(path.join(os.tmpdir(), `.yarn-cache`)); + + return preferredCacheDirectories; +} + +const PREFERRED_MODULE_CACHE_DIRECTORIES = exports.PREFERRED_MODULE_CACHE_DIRECTORIES = getPreferredCacheDirectories(); +const CONFIG_DIRECTORY = exports.CONFIG_DIRECTORY = getConfigDir(); +const DATA_DIRECTORY = exports.DATA_DIRECTORY = getDataDir(); +const LINK_REGISTRY_DIRECTORY = exports.LINK_REGISTRY_DIRECTORY = path.join(DATA_DIRECTORY, 'link'); +const GLOBAL_MODULE_DIRECTORY = exports.GLOBAL_MODULE_DIRECTORY = path.join(DATA_DIRECTORY, 'global'); + +const NODE_BIN_PATH = exports.NODE_BIN_PATH = process.execPath; +const YARN_BIN_PATH = exports.YARN_BIN_PATH = getYarnBinPath(); + +// Webpack needs to be configured with node.__dirname/__filename = false +function getYarnBinPath() { + if (isWebpackBundle) { + return __filename; + } else { + return path.join(__dirname, '..', 'bin', 'yarn.js'); + } +} + +const NODE_MODULES_FOLDER = exports.NODE_MODULES_FOLDER = 'node_modules'; +const NODE_PACKAGE_JSON = exports.NODE_PACKAGE_JSON = 'package.json'; + +const PNP_FILENAME = exports.PNP_FILENAME = '.pnp.js'; + +const POSIX_GLOBAL_PREFIX = exports.POSIX_GLOBAL_PREFIX = `${process.env.DESTDIR || ''}/usr/local`; +const FALLBACK_GLOBAL_PREFIX = exports.FALLBACK_GLOBAL_PREFIX = path.join(userHome, '.yarn'); + +const META_FOLDER = exports.META_FOLDER = '.yarn-meta'; +const INTEGRITY_FILENAME = exports.INTEGRITY_FILENAME = '.yarn-integrity'; +const LOCKFILE_FILENAME = exports.LOCKFILE_FILENAME = 'yarn.lock'; +const METADATA_FILENAME = exports.METADATA_FILENAME = '.yarn-metadata.json'; +const TARBALL_FILENAME = exports.TARBALL_FILENAME = '.yarn-tarball.tgz'; +const CLEAN_FILENAME = exports.CLEAN_FILENAME = '.yarnclean'; + +const NPM_LOCK_FILENAME = exports.NPM_LOCK_FILENAME = 'package-lock.json'; +const NPM_SHRINKWRAP_FILENAME = exports.NPM_SHRINKWRAP_FILENAME = 'npm-shrinkwrap.json'; + +const DEFAULT_INDENT = exports.DEFAULT_INDENT = ' '; +const SINGLE_INSTANCE_PORT = exports.SINGLE_INSTANCE_PORT = 31997; +const SINGLE_INSTANCE_FILENAME = exports.SINGLE_INSTANCE_FILENAME = '.yarn-single-instance'; + +const ENV_PATH_KEY = exports.ENV_PATH_KEY = getPathKey(process.platform, process.env); + +function getPathKey(platform, env) { + let pathKey = 'PATH'; + + // windows calls its path "Path" usually, but this is not guaranteed. + if (platform === 'win32') { + pathKey = 'Path'; + + for (const key in env) { + if (key.toLowerCase() === 'path') { + pathKey = key; + } + } + } + + return pathKey; +} + +const VERSION_COLOR_SCHEME = exports.VERSION_COLOR_SCHEME = { + major: 'red', + premajor: 'red', + minor: 'yellow', + preminor: 'yellow', + patch: 'green', + prepatch: 'green', + prerelease: 'red', + unchanged: 'white', + unknown: 'red' +}; + +/***/ }), +/* 9 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + + + +/** + * Use invariant() to assert state which your program assumes to be true. + * + * Provide sprintf-style format (only %s is supported) and arguments + * to provide information about what broke and what you were + * expecting. + * + * The invariant message will be stripped in production, but the invariant + * will remain to ensure logic does not differ in production. + */ + +var NODE_ENV = process.env.NODE_ENV; + +var invariant = function(condition, format, a, b, c, d, e, f) { + if (NODE_ENV !== 'production') { + if (format === undefined) { + throw new Error('invariant requires an error message argument'); + } + } + + if (!condition) { + var error; + if (format === undefined) { + error = new Error( + 'Minified exception occurred; use the non-minified dev environment ' + + 'for the full error message and additional helpful warnings.' + ); + } else { + var args = [a, b, c, d, e, f]; + var argIndex = 0; + error = new Error( + format.replace(/%s/g, function() { return args[argIndex++]; }) + ); + error.name = 'Invariant Violation'; + } + + error.framesToPop = 1; // we don't care about invariant's own frame + throw error; + } +}; + +module.exports = invariant; + + +/***/ }), +/* 10 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var YAMLException = __webpack_require__(54); + +var TYPE_CONSTRUCTOR_OPTIONS = [ + 'kind', + 'resolve', + 'construct', + 'instanceOf', + 'predicate', + 'represent', + 'defaultStyle', + 'styleAliases' +]; + +var YAML_NODE_KINDS = [ + 'scalar', + 'sequence', + 'mapping' +]; + +function compileStyleAliases(map) { + var result = {}; + + if (map !== null) { + Object.keys(map).forEach(function (style) { + map[style].forEach(function (alias) { + result[String(alias)] = style; + }); + }); + } + + return result; +} + +function Type(tag, options) { + options = options || {}; + + Object.keys(options).forEach(function (name) { + if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { + throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); + } + }); + + // TODO: Add tag format check. + this.tag = tag; + this.kind = options['kind'] || null; + this.resolve = options['resolve'] || function () { return true; }; + this.construct = options['construct'] || function (data) { return data; }; + this.instanceOf = options['instanceOf'] || null; + this.predicate = options['predicate'] || null; + this.represent = options['represent'] || null; + this.defaultStyle = options['defaultStyle'] || null; + this.styleAliases = compileStyleAliases(options['styleAliases'] || null); + + if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { + throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); + } +} + +module.exports = Type; + + +/***/ }), +/* 11 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Observable; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_canReportError__ = __webpack_require__(322); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_toSubscriber__ = __webpack_require__(932); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__internal_symbol_observable__ = __webpack_require__(117); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_pipe__ = __webpack_require__(324); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__config__ = __webpack_require__(185); +/** PURE_IMPORTS_START _util_canReportError,_util_toSubscriber,_internal_symbol_observable,_util_pipe,_config PURE_IMPORTS_END */ + + + + + +var Observable = /*@__PURE__*/ (function () { + function Observable(subscribe) { + this._isScalar = false; + if (subscribe) { + this._subscribe = subscribe; + } + } + Observable.prototype.lift = function (operator) { + var observable = new Observable(); + observable.source = this; + observable.operator = operator; + return observable; + }; + Observable.prototype.subscribe = function (observerOrNext, error, complete) { + var operator = this.operator; + var sink = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__util_toSubscriber__["a" /* toSubscriber */])(observerOrNext, error, complete); + if (operator) { + operator.call(sink, this.source); + } + else { + sink.add(this.source || (__WEBPACK_IMPORTED_MODULE_4__config__["a" /* config */].useDeprecatedSynchronousErrorHandling && !sink.syncErrorThrowable) ? + this._subscribe(sink) : + this._trySubscribe(sink)); + } + if (__WEBPACK_IMPORTED_MODULE_4__config__["a" /* config */].useDeprecatedSynchronousErrorHandling) { + if (sink.syncErrorThrowable) { + sink.syncErrorThrowable = false; + if (sink.syncErrorThrown) { + throw sink.syncErrorValue; + } + } + } + return sink; + }; + Observable.prototype._trySubscribe = function (sink) { + try { + return this._subscribe(sink); + } + catch (err) { + if (__WEBPACK_IMPORTED_MODULE_4__config__["a" /* config */].useDeprecatedSynchronousErrorHandling) { + sink.syncErrorThrown = true; + sink.syncErrorValue = err; + } + if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__util_canReportError__["a" /* canReportError */])(sink)) { + sink.error(err); + } + else { + console.warn(err); + } + } + }; + Observable.prototype.forEach = function (next, promiseCtor) { + var _this = this; + promiseCtor = getPromiseCtor(promiseCtor); + return new promiseCtor(function (resolve, reject) { + var subscription; + subscription = _this.subscribe(function (value) { + try { + next(value); + } + catch (err) { + reject(err); + if (subscription) { + subscription.unsubscribe(); + } + } + }, reject, resolve); + }); + }; + Observable.prototype._subscribe = function (subscriber) { + var source = this.source; + return source && source.subscribe(subscriber); + }; + Observable.prototype[__WEBPACK_IMPORTED_MODULE_2__internal_symbol_observable__["a" /* observable */]] = function () { + return this; + }; + Observable.prototype.pipe = function () { + var operations = []; + for (var _i = 0; _i < arguments.length; _i++) { + operations[_i] = arguments[_i]; + } + if (operations.length === 0) { + return this; + } + return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__util_pipe__["b" /* pipeFromArray */])(operations)(this); + }; + Observable.prototype.toPromise = function (promiseCtor) { + var _this = this; + promiseCtor = getPromiseCtor(promiseCtor); + return new promiseCtor(function (resolve, reject) { + var value; + _this.subscribe(function (x) { return value = x; }, function (err) { return reject(err); }, function () { return resolve(value); }); + }); + }; + Observable.create = function (subscribe) { + return new Observable(subscribe); + }; + return Observable; +}()); + +function getPromiseCtor(promiseCtor) { + if (!promiseCtor) { + promiseCtor = __WEBPACK_IMPORTED_MODULE_4__config__["a" /* config */].Promise || Promise; + } + if (!promiseCtor) { + throw new Error('no Promise impl found'); + } + return promiseCtor; +} +//# sourceMappingURL=Observable.js.map + + +/***/ }), +/* 12 */ +/***/ (function(module, exports) { + +module.exports = require("crypto"); + +/***/ }), +/* 13 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return OuterSubscriber; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_tslib__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Subscriber__ = __webpack_require__(7); +/** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */ + + +var OuterSubscriber = /*@__PURE__*/ (function (_super) { + __WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __extends */](OuterSubscriber, _super); + function OuterSubscriber() { + return _super !== null && _super.apply(this, arguments) || this; + } + OuterSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { + this.destination.next(innerValue); + }; + OuterSubscriber.prototype.notifyError = function (error, innerSub) { + this.destination.error(error); + }; + OuterSubscriber.prototype.notifyComplete = function (innerSub) { + this.destination.complete(); + }; + return OuterSubscriber; +}(__WEBPACK_IMPORTED_MODULE_1__Subscriber__["a" /* Subscriber */])); + +//# sourceMappingURL=OuterSubscriber.js.map + + +/***/ }), +/* 14 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (immutable) */ __webpack_exports__["a"] = subscribeToResult; +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__InnerSubscriber__ = __webpack_require__(84); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__subscribeTo__ = __webpack_require__(446); +/** PURE_IMPORTS_START _InnerSubscriber,_subscribeTo PURE_IMPORTS_END */ + + +function subscribeToResult(outerSubscriber, result, outerValue, outerIndex, destination) { + if (destination === void 0) { + destination = new __WEBPACK_IMPORTED_MODULE_0__InnerSubscriber__["a" /* InnerSubscriber */](outerSubscriber, outerValue, outerIndex); + } + if (destination.closed) { + return; + } + return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__subscribeTo__["a" /* subscribeTo */])(result)(destination); +} +//# sourceMappingURL=subscribeToResult.js.map + + +/***/ }), +/* 15 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* eslint-disable node/no-deprecated-api */ + + + +var buffer = __webpack_require__(64) +var Buffer = buffer.Buffer + +var safer = {} + +var key + +for (key in buffer) { + if (!buffer.hasOwnProperty(key)) continue + if (key === 'SlowBuffer' || key === 'Buffer') continue + safer[key] = buffer[key] +} + +var Safer = safer.Buffer = {} +for (key in Buffer) { + if (!Buffer.hasOwnProperty(key)) continue + if (key === 'allocUnsafe' || key === 'allocUnsafeSlow') continue + Safer[key] = Buffer[key] +} + +safer.Buffer.prototype = Buffer.prototype + +if (!Safer.from || Safer.from === Uint8Array.from) { + Safer.from = function (value, encodingOrOffset, length) { + if (typeof value === 'number') { + throw new TypeError('The "value" argument must not be of type number. Received type ' + typeof value) + } + if (value && typeof value.length === 'undefined') { + throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type ' + typeof value) + } + return Buffer(value, encodingOrOffset, length) + } +} + +if (!Safer.alloc) { + Safer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size) + } + if (size < 0 || size >= 2 * (1 << 30)) { + throw new RangeError('The value "' + size + '" is invalid for option "size"') + } + var buf = Buffer(size) + if (!fill || fill.length === 0) { + buf.fill(0) + } else if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + return buf + } +} + +if (!safer.kStringMaxLength) { + try { + safer.kStringMaxLength = process.binding('buffer').kStringMaxLength + } catch (e) { + // we can't determine kStringMaxLength in environments where process.binding + // is unsupported, so let's not set it + } +} + +if (!safer.constants) { + safer.constants = { + MAX_LENGTH: safer.kMaxLength + } + if (safer.kStringMaxLength) { + safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength + } +} + +module.exports = safer + + +/***/ }), +/* 16 */ +/***/ (function(module, exports, __webpack_require__) { + +// Copyright (c) 2012, Mark Cavage. All rights reserved. +// Copyright 2015 Joyent, Inc. + +var assert = __webpack_require__(28); +var Stream = __webpack_require__(23).Stream; +var util = __webpack_require__(3); + + +///--- Globals + +/* JSSTYLED */ +var UUID_REGEXP = /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/; + + +///--- Internal + +function _capitalize(str) { + return (str.charAt(0).toUpperCase() + str.slice(1)); +} + +function _toss(name, expected, oper, arg, actual) { + throw new assert.AssertionError({ + message: util.format('%s (%s) is required', name, expected), + actual: (actual === undefined) ? typeof (arg) : actual(arg), + expected: expected, + operator: oper || '===', + stackStartFunction: _toss.caller + }); +} + +function _getClass(arg) { + return (Object.prototype.toString.call(arg).slice(8, -1)); +} + +function noop() { + // Why even bother with asserts? +} + + +///--- Exports + +var types = { + bool: { + check: function (arg) { return typeof (arg) === 'boolean'; } + }, + func: { + check: function (arg) { return typeof (arg) === 'function'; } + }, + string: { + check: function (arg) { return typeof (arg) === 'string'; } + }, + object: { + check: function (arg) { + return typeof (arg) === 'object' && arg !== null; + } + }, + number: { + check: function (arg) { + return typeof (arg) === 'number' && !isNaN(arg); + } + }, + finite: { + check: function (arg) { + return typeof (arg) === 'number' && !isNaN(arg) && isFinite(arg); + } + }, + buffer: { + check: function (arg) { return Buffer.isBuffer(arg); }, + operator: 'Buffer.isBuffer' + }, + array: { + check: function (arg) { return Array.isArray(arg); }, + operator: 'Array.isArray' + }, + stream: { + check: function (arg) { return arg instanceof Stream; }, + operator: 'instanceof', + actual: _getClass + }, + date: { + check: function (arg) { return arg instanceof Date; }, + operator: 'instanceof', + actual: _getClass + }, + regexp: { + check: function (arg) { return arg instanceof RegExp; }, + operator: 'instanceof', + actual: _getClass + }, + uuid: { + check: function (arg) { + return typeof (arg) === 'string' && UUID_REGEXP.test(arg); + }, + operator: 'isUUID' + } +}; + +function _setExports(ndebug) { + var keys = Object.keys(types); + var out; + + /* re-export standard assert */ + if (process.env.NODE_NDEBUG) { + out = noop; + } else { + out = function (arg, msg) { + if (!arg) { + _toss(msg, 'true', arg); + } + }; + } + + /* standard checks */ + keys.forEach(function (k) { + if (ndebug) { + out[k] = noop; + return; + } + var type = types[k]; + out[k] = function (arg, msg) { + if (!type.check(arg)) { + _toss(msg, k, type.operator, arg, type.actual); + } + }; + }); + + /* optional checks */ + keys.forEach(function (k) { + var name = 'optional' + _capitalize(k); + if (ndebug) { + out[name] = noop; + return; + } + var type = types[k]; + out[name] = function (arg, msg) { + if (arg === undefined || arg === null) { + return; + } + if (!type.check(arg)) { + _toss(msg, k, type.operator, arg, type.actual); + } + }; + }); + + /* arrayOf checks */ + keys.forEach(function (k) { + var name = 'arrayOf' + _capitalize(k); + if (ndebug) { + out[name] = noop; + return; + } + var type = types[k]; + var expected = '[' + k + ']'; + out[name] = function (arg, msg) { + if (!Array.isArray(arg)) { + _toss(msg, expected, type.operator, arg, type.actual); + } + var i; + for (i = 0; i < arg.length; i++) { + if (!type.check(arg[i])) { + _toss(msg, expected, type.operator, arg, type.actual); + } + } + }; + }); + + /* optionalArrayOf checks */ + keys.forEach(function (k) { + var name = 'optionalArrayOf' + _capitalize(k); + if (ndebug) { + out[name] = noop; + return; + } + var type = types[k]; + var expected = '[' + k + ']'; + out[name] = function (arg, msg) { + if (arg === undefined || arg === null) { + return; + } + if (!Array.isArray(arg)) { + _toss(msg, expected, type.operator, arg, type.actual); + } + var i; + for (i = 0; i < arg.length; i++) { + if (!type.check(arg[i])) { + _toss(msg, expected, type.operator, arg, type.actual); + } + } + }; + }); + + /* re-export built-in assertions */ + Object.keys(assert).forEach(function (k) { + if (k === 'AssertionError') { + out[k] = assert[k]; + return; + } + if (ndebug) { + out[k] = noop; + return; + } + out[k] = assert[k]; + }); + + /* export ourselves (for unit tests _only_) */ + out._setExports = _setExports; + + return out; +} + +module.exports = _setExports(process.env.NODE_NDEBUG); + + +/***/ }), +/* 17 */ +/***/ (function(module, exports) { + +// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 +var global = module.exports = typeof window != 'undefined' && window.Math == Math + ? window : typeof self != 'undefined' && self.Math == Math ? self + // eslint-disable-next-line no-new-func + : Function('return this')(); +if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef + + +/***/ }), +/* 18 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.sortAlpha = sortAlpha; +exports.sortOptionsByFlags = sortOptionsByFlags; +exports.entries = entries; +exports.removePrefix = removePrefix; +exports.removeSuffix = removeSuffix; +exports.addSuffix = addSuffix; +exports.hyphenate = hyphenate; +exports.camelCase = camelCase; +exports.compareSortedArrays = compareSortedArrays; +exports.sleep = sleep; +const _camelCase = __webpack_require__(230); + +function sortAlpha(a, b) { + // sort alphabetically in a deterministic way + const shortLen = Math.min(a.length, b.length); + for (let i = 0; i < shortLen; i++) { + const aChar = a.charCodeAt(i); + const bChar = b.charCodeAt(i); + if (aChar !== bChar) { + return aChar - bChar; + } + } + return a.length - b.length; +} + +function sortOptionsByFlags(a, b) { + const aOpt = a.flags.replace(/-/g, ''); + const bOpt = b.flags.replace(/-/g, ''); + return sortAlpha(aOpt, bOpt); +} + +function entries(obj) { + const entries = []; + if (obj) { + for (const key in obj) { + entries.push([key, obj[key]]); + } + } + return entries; +} + +function removePrefix(pattern, prefix) { + if (pattern.startsWith(prefix)) { + pattern = pattern.slice(prefix.length); + } + + return pattern; +} + +function removeSuffix(pattern, suffix) { + if (pattern.endsWith(suffix)) { + return pattern.slice(0, -suffix.length); + } + + return pattern; +} + +function addSuffix(pattern, suffix) { + if (!pattern.endsWith(suffix)) { + return pattern + suffix; + } + + return pattern; +} + +function hyphenate(str) { + return str.replace(/[A-Z]/g, match => { + return '-' + match.charAt(0).toLowerCase(); + }); +} + +function camelCase(str) { + if (/[A-Z]/.test(str)) { + return null; + } else { + return _camelCase(str); + } +} + +function compareSortedArrays(array1, array2) { + if (array1.length !== array2.length) { + return false; + } + for (let i = 0, len = array1.length; i < len; i++) { + if (array1[i] !== array2[i]) { + return false; + } + } + return true; +} + +function sleep(ms) { + return new Promise(resolve => { + setTimeout(resolve, ms); + }); +} + +/***/ }), +/* 19 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.stringify = exports.parse = undefined; + +var _asyncToGenerator2; + +function _load_asyncToGenerator() { + return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(2)); +} + +var _parse; + +function _load_parse() { + return _parse = __webpack_require__(105); +} + +Object.defineProperty(exports, 'parse', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_parse || _load_parse()).default; + } +}); + +var _stringify; + +function _load_stringify() { + return _stringify = __webpack_require__(199); +} + +Object.defineProperty(exports, 'stringify', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_stringify || _load_stringify()).default; + } +}); +exports.implodeEntry = implodeEntry; +exports.explodeEntry = explodeEntry; + +var _misc; + +function _load_misc() { + return _misc = __webpack_require__(18); +} + +var _normalizePattern; + +function _load_normalizePattern() { + return _normalizePattern = __webpack_require__(37); +} + +var _parse2; + +function _load_parse2() { + return _parse2 = _interopRequireDefault(__webpack_require__(105)); +} + +var _constants; + +function _load_constants() { + return _constants = __webpack_require__(8); +} + +var _fs; + +function _load_fs() { + return _fs = _interopRequireWildcard(__webpack_require__(4)); +} + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const invariant = __webpack_require__(9); + +const path = __webpack_require__(0); +const ssri = __webpack_require__(77); + +function getName(pattern) { + return (0, (_normalizePattern || _load_normalizePattern()).normalizePattern)(pattern).name; +} + +function blankObjectUndefined(obj) { + return obj && Object.keys(obj).length ? obj : undefined; +} + +function keyForRemote(remote) { + return remote.resolved || (remote.reference && remote.hash ? `${remote.reference}#${remote.hash}` : null); +} + +function serializeIntegrity(integrity) { + // We need this because `Integrity.toString()` does not use sorting to ensure a stable string output + // See https://git.io/vx2Hy + return integrity.toString().split(' ').sort().join(' '); +} + +function implodeEntry(pattern, obj) { + const inferredName = getName(pattern); + const integrity = obj.integrity ? serializeIntegrity(obj.integrity) : ''; + const imploded = { + name: inferredName === obj.name ? undefined : obj.name, + version: obj.version, + uid: obj.uid === obj.version ? undefined : obj.uid, + resolved: obj.resolved, + registry: obj.registry === 'npm' ? undefined : obj.registry, + dependencies: blankObjectUndefined(obj.dependencies), + optionalDependencies: blankObjectUndefined(obj.optionalDependencies), + permissions: blankObjectUndefined(obj.permissions), + prebuiltVariants: blankObjectUndefined(obj.prebuiltVariants) + }; + if (integrity) { + imploded.integrity = integrity; + } + return imploded; +} + +function explodeEntry(pattern, obj) { + obj.optionalDependencies = obj.optionalDependencies || {}; + obj.dependencies = obj.dependencies || {}; + obj.uid = obj.uid || obj.version; + obj.permissions = obj.permissions || {}; + obj.registry = obj.registry || 'npm'; + obj.name = obj.name || getName(pattern); + const integrity = obj.integrity; + if (integrity && integrity.isIntegrity) { + obj.integrity = ssri.parse(integrity); + } + return obj; +} + +class Lockfile { + constructor({ cache, source, parseResultType } = {}) { + this.source = source || ''; + this.cache = cache; + this.parseResultType = parseResultType; + } + + // source string if the `cache` was parsed + + + // if true, we're parsing an old yarn file and need to update integrity fields + hasEntriesExistWithoutIntegrity() { + if (!this.cache) { + return false; + } + + for (const key in this.cache) { + // $FlowFixMe - `this.cache` is clearly defined at this point + if (!/^.*@(file:|http)/.test(key) && this.cache[key] && !this.cache[key].integrity) { + return true; + } + } + + return false; + } + + static fromDirectory(dir, reporter) { + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + // read the manifest in this directory + const lockfileLoc = path.join(dir, (_constants || _load_constants()).LOCKFILE_FILENAME); + + let lockfile; + let rawLockfile = ''; + let parseResult; + + if (yield (_fs || _load_fs()).exists(lockfileLoc)) { + rawLockfile = yield (_fs || _load_fs()).readFile(lockfileLoc); + parseResult = (0, (_parse2 || _load_parse2()).default)(rawLockfile, lockfileLoc); + + if (reporter) { + if (parseResult.type === 'merge') { + reporter.info(reporter.lang('lockfileMerged')); + } else if (parseResult.type === 'conflict') { + reporter.warn(reporter.lang('lockfileConflict')); + } + } + + lockfile = parseResult.object; + } else if (reporter) { + reporter.info(reporter.lang('noLockfileFound')); + } + + return new Lockfile({ cache: lockfile, source: rawLockfile, parseResultType: parseResult && parseResult.type }); + })(); + } + + getLocked(pattern) { + const cache = this.cache; + if (!cache) { + return undefined; + } + + const shrunk = pattern in cache && cache[pattern]; + + if (typeof shrunk === 'string') { + return this.getLocked(shrunk); + } else if (shrunk) { + explodeEntry(pattern, shrunk); + return shrunk; + } + + return undefined; + } + + removePattern(pattern) { + const cache = this.cache; + if (!cache) { + return; + } + delete cache[pattern]; + } + + getLockfile(patterns) { + const lockfile = {}; + const seen = new Map(); + + // order by name so that lockfile manifest is assigned to the first dependency with this manifest + // the others that have the same remoteKey will just refer to the first + // ordering allows for consistency in lockfile when it is serialized + const sortedPatternsKeys = Object.keys(patterns).sort((_misc || _load_misc()).sortAlpha); + + for (var _iterator = sortedPatternsKeys, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + const pattern = _ref; + + const pkg = patterns[pattern]; + const remote = pkg._remote, + ref = pkg._reference; + + invariant(ref, 'Package is missing a reference'); + invariant(remote, 'Package is missing a remote'); + + const remoteKey = keyForRemote(remote); + const seenPattern = remoteKey && seen.get(remoteKey); + if (seenPattern) { + // no point in duplicating it + lockfile[pattern] = seenPattern; + + // if we're relying on our name being inferred and two of the patterns have + // different inferred names then we need to set it + if (!seenPattern.name && getName(pattern) !== pkg.name) { + seenPattern.name = pkg.name; + } + continue; + } + const obj = implodeEntry(pattern, { + name: pkg.name, + version: pkg.version, + uid: pkg._uid, + resolved: remote.resolved, + integrity: remote.integrity, + registry: remote.registry, + dependencies: pkg.dependencies, + peerDependencies: pkg.peerDependencies, + optionalDependencies: pkg.optionalDependencies, + permissions: ref.permissions, + prebuiltVariants: pkg.prebuiltVariants + }); + + lockfile[pattern] = obj; + + if (remoteKey) { + seen.set(remoteKey, obj); + } + } + + return lockfile; + } +} +exports.default = Lockfile; + +/***/ }), +/* 20 */ +/***/ (function(module, exports, __webpack_require__) { + +var store = __webpack_require__(133)('wks'); +var uid = __webpack_require__(137); +var Symbol = __webpack_require__(17).Symbol; +var USE_SYMBOL = typeof Symbol == 'function'; + +var $exports = module.exports = function (name) { + return store[name] || (store[name] = + USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); +}; + +$exports.store = store; + + +/***/ }), +/* 21 */ +/***/ (function(module, exports) { + +exports = module.exports = SemVer; + +// The debug function is excluded entirely from the minified version. +/* nomin */ var debug; +/* nomin */ if (typeof process === 'object' && + /* nomin */ process.env && + /* nomin */ process.env.NODE_DEBUG && + /* nomin */ /\bsemver\b/i.test(process.env.NODE_DEBUG)) + /* nomin */ debug = function() { + /* nomin */ var args = Array.prototype.slice.call(arguments, 0); + /* nomin */ args.unshift('SEMVER'); + /* nomin */ console.log.apply(console, args); + /* nomin */ }; +/* nomin */ else + /* nomin */ debug = function() {}; + +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +exports.SEMVER_SPEC_VERSION = '2.0.0'; + +var MAX_LENGTH = 256; +var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991; + +// Max safe segment length for coercion. +var MAX_SAFE_COMPONENT_LENGTH = 16; + +// The actual regexps go on exports.re +var re = exports.re = []; +var src = exports.src = []; +var R = 0; + +// The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. + +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. + +var NUMERICIDENTIFIER = R++; +src[NUMERICIDENTIFIER] = '0|[1-9]\\d*'; +var NUMERICIDENTIFIERLOOSE = R++; +src[NUMERICIDENTIFIERLOOSE] = '[0-9]+'; + + +// ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. + +var NONNUMERICIDENTIFIER = R++; +src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*'; + + +// ## Main Version +// Three dot-separated numeric identifiers. + +var MAINVERSION = R++; +src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' + + '(' + src[NUMERICIDENTIFIER] + ')\\.' + + '(' + src[NUMERICIDENTIFIER] + ')'; + +var MAINVERSIONLOOSE = R++; +src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[NUMERICIDENTIFIERLOOSE] + ')'; + +// ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. + +var PRERELEASEIDENTIFIER = R++; +src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] + + '|' + src[NONNUMERICIDENTIFIER] + ')'; + +var PRERELEASEIDENTIFIERLOOSE = R++; +src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] + + '|' + src[NONNUMERICIDENTIFIER] + ')'; + + +// ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. + +var PRERELEASE = R++; +src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] + + '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))'; + +var PRERELEASELOOSE = R++; +src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] + + '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))'; + +// ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. + +var BUILDIDENTIFIER = R++; +src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+'; + +// ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. + +var BUILD = R++; +src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] + + '(?:\\.' + src[BUILDIDENTIFIER] + ')*))'; + + +// ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. + +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. + +var FULL = R++; +var FULLPLAIN = 'v?' + src[MAINVERSION] + + src[PRERELEASE] + '?' + + src[BUILD] + '?'; + +src[FULL] = '^' + FULLPLAIN + '$'; + +// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. +var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] + + src[PRERELEASELOOSE] + '?' + + src[BUILD] + '?'; + +var LOOSE = R++; +src[LOOSE] = '^' + LOOSEPLAIN + '$'; + +var GTLT = R++; +src[GTLT] = '((?:<|>)?=?)'; + +// Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. +var XRANGEIDENTIFIERLOOSE = R++; +src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*'; +var XRANGEIDENTIFIER = R++; +src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*'; + +var XRANGEPLAIN = R++; +src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + + '(?:' + src[PRERELEASE] + ')?' + + src[BUILD] + '?' + + ')?)?'; + +var XRANGEPLAINLOOSE = R++; +src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:' + src[PRERELEASELOOSE] + ')?' + + src[BUILD] + '?' + + ')?)?'; + +var XRANGE = R++; +src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$'; +var XRANGELOOSE = R++; +src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$'; + +// Coercion. +// Extract anything that could conceivably be a part of a valid semver +var COERCE = R++; +src[COERCE] = '(?:^|[^\\d])' + + '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + + '(?:$|[^\\d])'; + +// Tilde ranges. +// Meaning is "reasonably at or greater than" +var LONETILDE = R++; +src[LONETILDE] = '(?:~>?)'; + +var TILDETRIM = R++; +src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+'; +re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g'); +var tildeTrimReplace = '$1~'; + +var TILDE = R++; +src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$'; +var TILDELOOSE = R++; +src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$'; + +// Caret ranges. +// Meaning is "at least and backwards compatible with" +var LONECARET = R++; +src[LONECARET] = '(?:\\^)'; + +var CARETTRIM = R++; +src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+'; +re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g'); +var caretTrimReplace = '$1^'; + +var CARET = R++; +src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$'; +var CARETLOOSE = R++; +src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$'; + +// A simple gt/lt/eq thing, or just "" to indicate "any version" +var COMPARATORLOOSE = R++; +src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$'; +var COMPARATOR = R++; +src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$'; + + +// An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` +var COMPARATORTRIM = R++; +src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] + + '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')'; + +// this one has to use the /g flag +re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g'); +var comparatorTrimReplace = '$1$2$3'; + + +// Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. +var HYPHENRANGE = R++; +src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' + + '\\s+-\\s+' + + '(' + src[XRANGEPLAIN] + ')' + + '\\s*$'; + +var HYPHENRANGELOOSE = R++; +src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' + + '\\s+-\\s+' + + '(' + src[XRANGEPLAINLOOSE] + ')' + + '\\s*$'; + +// Star ranges basically just allow anything at all. +var STAR = R++; +src[STAR] = '(<|>)?=?\\s*\\*'; + +// Compile to actual regexp objects. +// All are flag-free, unless they were created above with a flag. +for (var i = 0; i < R; i++) { + debug(i, src[i]); + if (!re[i]) + re[i] = new RegExp(src[i]); +} + +exports.parse = parse; +function parse(version, loose) { + if (version instanceof SemVer) + return version; + + if (typeof version !== 'string') + return null; + + if (version.length > MAX_LENGTH) + return null; + + var r = loose ? re[LOOSE] : re[FULL]; + if (!r.test(version)) + return null; + + try { + return new SemVer(version, loose); + } catch (er) { + return null; + } +} + +exports.valid = valid; +function valid(version, loose) { + var v = parse(version, loose); + return v ? v.version : null; +} + + +exports.clean = clean; +function clean(version, loose) { + var s = parse(version.trim().replace(/^[=v]+/, ''), loose); + return s ? s.version : null; +} + +exports.SemVer = SemVer; + +function SemVer(version, loose) { + if (version instanceof SemVer) { + if (version.loose === loose) + return version; + else + version = version.version; + } else if (typeof version !== 'string') { + throw new TypeError('Invalid Version: ' + version); + } + + if (version.length > MAX_LENGTH) + throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') + + if (!(this instanceof SemVer)) + return new SemVer(version, loose); + + debug('SemVer', version, loose); + this.loose = loose; + var m = version.trim().match(loose ? re[LOOSE] : re[FULL]); + + if (!m) + throw new TypeError('Invalid Version: ' + version); + + this.raw = version; + + // these are actually numbers + this.major = +m[1]; + this.minor = +m[2]; + this.patch = +m[3]; + + if (this.major > MAX_SAFE_INTEGER || this.major < 0) + throw new TypeError('Invalid major version') + + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) + throw new TypeError('Invalid minor version') + + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) + throw new TypeError('Invalid patch version') + + // numberify any prerelease numeric ids + if (!m[4]) + this.prerelease = []; + else + this.prerelease = m[4].split('.').map(function(id) { + if (/^[0-9]+$/.test(id)) { + var num = +id; + if (num >= 0 && num < MAX_SAFE_INTEGER) + return num; + } + return id; + }); + + this.build = m[5] ? m[5].split('.') : []; + this.format(); +} + +SemVer.prototype.format = function() { + this.version = this.major + '.' + this.minor + '.' + this.patch; + if (this.prerelease.length) + this.version += '-' + this.prerelease.join('.'); + return this.version; +}; + +SemVer.prototype.toString = function() { + return this.version; +}; + +SemVer.prototype.compare = function(other) { + debug('SemVer.compare', this.version, this.loose, other); + if (!(other instanceof SemVer)) + other = new SemVer(other, this.loose); + + return this.compareMain(other) || this.comparePre(other); +}; + +SemVer.prototype.compareMain = function(other) { + if (!(other instanceof SemVer)) + other = new SemVer(other, this.loose); + + return compareIdentifiers(this.major, other.major) || + compareIdentifiers(this.minor, other.minor) || + compareIdentifiers(this.patch, other.patch); +}; + +SemVer.prototype.comparePre = function(other) { + if (!(other instanceof SemVer)) + other = new SemVer(other, this.loose); + + // NOT having a prerelease is > having one + if (this.prerelease.length && !other.prerelease.length) + return -1; + else if (!this.prerelease.length && other.prerelease.length) + return 1; + else if (!this.prerelease.length && !other.prerelease.length) + return 0; + + var i = 0; + do { + var a = this.prerelease[i]; + var b = other.prerelease[i]; + debug('prerelease compare', i, a, b); + if (a === undefined && b === undefined) + return 0; + else if (b === undefined) + return 1; + else if (a === undefined) + return -1; + else if (a === b) + continue; + else + return compareIdentifiers(a, b); + } while (++i); +}; + +// preminor will bump the version up to the next minor release, and immediately +// down to pre-release. premajor and prepatch work the same way. +SemVer.prototype.inc = function(release, identifier) { + switch (release) { + case 'premajor': + this.prerelease.length = 0; + this.patch = 0; + this.minor = 0; + this.major++; + this.inc('pre', identifier); + break; + case 'preminor': + this.prerelease.length = 0; + this.patch = 0; + this.minor++; + this.inc('pre', identifier); + break; + case 'prepatch': + // If this is already a prerelease, it will bump to the next version + // drop any prereleases that might already exist, since they are not + // relevant at this point. + this.prerelease.length = 0; + this.inc('patch', identifier); + this.inc('pre', identifier); + break; + // If the input is a non-prerelease version, this acts the same as + // prepatch. + case 'prerelease': + if (this.prerelease.length === 0) + this.inc('patch', identifier); + this.inc('pre', identifier); + break; + + case 'major': + // If this is a pre-major version, bump up to the same major version. + // Otherwise increment major. + // 1.0.0-5 bumps to 1.0.0 + // 1.1.0 bumps to 2.0.0 + if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) + this.major++; + this.minor = 0; + this.patch = 0; + this.prerelease = []; + break; + case 'minor': + // If this is a pre-minor version, bump up to the same minor version. + // Otherwise increment minor. + // 1.2.0-5 bumps to 1.2.0 + // 1.2.1 bumps to 1.3.0 + if (this.patch !== 0 || this.prerelease.length === 0) + this.minor++; + this.patch = 0; + this.prerelease = []; + break; + case 'patch': + // If this is not a pre-release version, it will increment the patch. + // If it is a pre-release it will bump up to the same patch version. + // 1.2.0-5 patches to 1.2.0 + // 1.2.0 patches to 1.2.1 + if (this.prerelease.length === 0) + this.patch++; + this.prerelease = []; + break; + // This probably shouldn't be used publicly. + // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. + case 'pre': + if (this.prerelease.length === 0) + this.prerelease = [0]; + else { + var i = this.prerelease.length; + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++; + i = -2; + } + } + if (i === -1) // didn't increment anything + this.prerelease.push(0); + } + if (identifier) { + // 1.2.0-beta.1 bumps to 1.2.0-beta.2, + // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 + if (this.prerelease[0] === identifier) { + if (isNaN(this.prerelease[1])) + this.prerelease = [identifier, 0]; + } else + this.prerelease = [identifier, 0]; + } + break; + + default: + throw new Error('invalid increment argument: ' + release); + } + this.format(); + this.raw = this.version; + return this; +}; + +exports.inc = inc; +function inc(version, release, loose, identifier) { + if (typeof(loose) === 'string') { + identifier = loose; + loose = undefined; + } + + try { + return new SemVer(version, loose).inc(release, identifier).version; + } catch (er) { + return null; + } +} + +exports.diff = diff; +function diff(version1, version2) { + if (eq(version1, version2)) { + return null; + } else { + var v1 = parse(version1); + var v2 = parse(version2); + if (v1.prerelease.length || v2.prerelease.length) { + for (var key in v1) { + if (key === 'major' || key === 'minor' || key === 'patch') { + if (v1[key] !== v2[key]) { + return 'pre'+key; + } + } + } + return 'prerelease'; + } + for (var key in v1) { + if (key === 'major' || key === 'minor' || key === 'patch') { + if (v1[key] !== v2[key]) { + return key; + } + } + } + } +} + +exports.compareIdentifiers = compareIdentifiers; + +var numeric = /^[0-9]+$/; +function compareIdentifiers(a, b) { + var anum = numeric.test(a); + var bnum = numeric.test(b); + + if (anum && bnum) { + a = +a; + b = +b; + } + + return (anum && !bnum) ? -1 : + (bnum && !anum) ? 1 : + a < b ? -1 : + a > b ? 1 : + 0; +} + +exports.rcompareIdentifiers = rcompareIdentifiers; +function rcompareIdentifiers(a, b) { + return compareIdentifiers(b, a); +} + +exports.major = major; +function major(a, loose) { + return new SemVer(a, loose).major; +} + +exports.minor = minor; +function minor(a, loose) { + return new SemVer(a, loose).minor; +} + +exports.patch = patch; +function patch(a, loose) { + return new SemVer(a, loose).patch; +} + +exports.compare = compare; +function compare(a, b, loose) { + return new SemVer(a, loose).compare(new SemVer(b, loose)); +} + +exports.compareLoose = compareLoose; +function compareLoose(a, b) { + return compare(a, b, true); +} + +exports.rcompare = rcompare; +function rcompare(a, b, loose) { + return compare(b, a, loose); +} + +exports.sort = sort; +function sort(list, loose) { + return list.sort(function(a, b) { + return exports.compare(a, b, loose); + }); +} + +exports.rsort = rsort; +function rsort(list, loose) { + return list.sort(function(a, b) { + return exports.rcompare(a, b, loose); + }); +} + +exports.gt = gt; +function gt(a, b, loose) { + return compare(a, b, loose) > 0; +} + +exports.lt = lt; +function lt(a, b, loose) { + return compare(a, b, loose) < 0; +} + +exports.eq = eq; +function eq(a, b, loose) { + return compare(a, b, loose) === 0; +} + +exports.neq = neq; +function neq(a, b, loose) { + return compare(a, b, loose) !== 0; +} + +exports.gte = gte; +function gte(a, b, loose) { + return compare(a, b, loose) >= 0; +} + +exports.lte = lte; +function lte(a, b, loose) { + return compare(a, b, loose) <= 0; +} + +exports.cmp = cmp; +function cmp(a, op, b, loose) { + var ret; + switch (op) { + case '===': + if (typeof a === 'object') a = a.version; + if (typeof b === 'object') b = b.version; + ret = a === b; + break; + case '!==': + if (typeof a === 'object') a = a.version; + if (typeof b === 'object') b = b.version; + ret = a !== b; + break; + case '': case '=': case '==': ret = eq(a, b, loose); break; + case '!=': ret = neq(a, b, loose); break; + case '>': ret = gt(a, b, loose); break; + case '>=': ret = gte(a, b, loose); break; + case '<': ret = lt(a, b, loose); break; + case '<=': ret = lte(a, b, loose); break; + default: throw new TypeError('Invalid operator: ' + op); + } + return ret; +} + +exports.Comparator = Comparator; +function Comparator(comp, loose) { + if (comp instanceof Comparator) { + if (comp.loose === loose) + return comp; + else + comp = comp.value; + } + + if (!(this instanceof Comparator)) + return new Comparator(comp, loose); + + debug('comparator', comp, loose); + this.loose = loose; + this.parse(comp); + + if (this.semver === ANY) + this.value = ''; + else + this.value = this.operator + this.semver.version; + + debug('comp', this); +} + +var ANY = {}; +Comparator.prototype.parse = function(comp) { + var r = this.loose ? re[COMPARATORLOOSE] : re[COMPARATOR]; + var m = comp.match(r); + + if (!m) + throw new TypeError('Invalid comparator: ' + comp); + + this.operator = m[1]; + if (this.operator === '=') + this.operator = ''; + + // if it literally is just '>' or '' then allow anything. + if (!m[2]) + this.semver = ANY; + else + this.semver = new SemVer(m[2], this.loose); +}; + +Comparator.prototype.toString = function() { + return this.value; +}; + +Comparator.prototype.test = function(version) { + debug('Comparator.test', version, this.loose); + + if (this.semver === ANY) + return true; + + if (typeof version === 'string') + version = new SemVer(version, this.loose); + + return cmp(version, this.operator, this.semver, this.loose); +}; + +Comparator.prototype.intersects = function(comp, loose) { + if (!(comp instanceof Comparator)) { + throw new TypeError('a Comparator is required'); + } + + var rangeTmp; + + if (this.operator === '') { + rangeTmp = new Range(comp.value, loose); + return satisfies(this.value, rangeTmp, loose); + } else if (comp.operator === '') { + rangeTmp = new Range(this.value, loose); + return satisfies(comp.semver, rangeTmp, loose); + } + + var sameDirectionIncreasing = + (this.operator === '>=' || this.operator === '>') && + (comp.operator === '>=' || comp.operator === '>'); + var sameDirectionDecreasing = + (this.operator === '<=' || this.operator === '<') && + (comp.operator === '<=' || comp.operator === '<'); + var sameSemVer = this.semver.version === comp.semver.version; + var differentDirectionsInclusive = + (this.operator === '>=' || this.operator === '<=') && + (comp.operator === '>=' || comp.operator === '<='); + var oppositeDirectionsLessThan = + cmp(this.semver, '<', comp.semver, loose) && + ((this.operator === '>=' || this.operator === '>') && + (comp.operator === '<=' || comp.operator === '<')); + var oppositeDirectionsGreaterThan = + cmp(this.semver, '>', comp.semver, loose) && + ((this.operator === '<=' || this.operator === '<') && + (comp.operator === '>=' || comp.operator === '>')); + + return sameDirectionIncreasing || sameDirectionDecreasing || + (sameSemVer && differentDirectionsInclusive) || + oppositeDirectionsLessThan || oppositeDirectionsGreaterThan; +}; + + +exports.Range = Range; +function Range(range, loose) { + if (range instanceof Range) { + if (range.loose === loose) { + return range; + } else { + return new Range(range.raw, loose); + } + } + + if (range instanceof Comparator) { + return new Range(range.value, loose); + } + + if (!(this instanceof Range)) + return new Range(range, loose); + + this.loose = loose; + + // First, split based on boolean or || + this.raw = range; + this.set = range.split(/\s*\|\|\s*/).map(function(range) { + return this.parseRange(range.trim()); + }, this).filter(function(c) { + // throw out any that are not relevant for whatever reason + return c.length; + }); + + if (!this.set.length) { + throw new TypeError('Invalid SemVer Range: ' + range); + } + + this.format(); +} + +Range.prototype.format = function() { + this.range = this.set.map(function(comps) { + return comps.join(' ').trim(); + }).join('||').trim(); + return this.range; +}; + +Range.prototype.toString = function() { + return this.range; +}; + +Range.prototype.parseRange = function(range) { + var loose = this.loose; + range = range.trim(); + debug('range', range, loose); + // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` + var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE]; + range = range.replace(hr, hyphenReplace); + debug('hyphen replace', range); + // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` + range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace); + debug('comparator trim', range, re[COMPARATORTRIM]); + + // `~ 1.2.3` => `~1.2.3` + range = range.replace(re[TILDETRIM], tildeTrimReplace); + + // `^ 1.2.3` => `^1.2.3` + range = range.replace(re[CARETTRIM], caretTrimReplace); + + // normalize spaces + range = range.split(/\s+/).join(' '); + + // At this point, the range is completely trimmed and + // ready to be split into comparators. + + var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR]; + var set = range.split(' ').map(function(comp) { + return parseComparator(comp, loose); + }).join(' ').split(/\s+/); + if (this.loose) { + // in loose mode, throw out any that are not valid comparators + set = set.filter(function(comp) { + return !!comp.match(compRe); + }); + } + set = set.map(function(comp) { + return new Comparator(comp, loose); + }); + + return set; +}; + +Range.prototype.intersects = function(range, loose) { + if (!(range instanceof Range)) { + throw new TypeError('a Range is required'); + } + + return this.set.some(function(thisComparators) { + return thisComparators.every(function(thisComparator) { + return range.set.some(function(rangeComparators) { + return rangeComparators.every(function(rangeComparator) { + return thisComparator.intersects(rangeComparator, loose); + }); + }); + }); + }); +}; + +// Mostly just for testing and legacy API reasons +exports.toComparators = toComparators; +function toComparators(range, loose) { + return new Range(range, loose).set.map(function(comp) { + return comp.map(function(c) { + return c.value; + }).join(' ').trim().split(' '); + }); +} + +// comprised of xranges, tildes, stars, and gtlt's at this point. +// already replaced the hyphen ranges +// turn into a set of JUST comparators. +function parseComparator(comp, loose) { + debug('comp', comp); + comp = replaceCarets(comp, loose); + debug('caret', comp); + comp = replaceTildes(comp, loose); + debug('tildes', comp); + comp = replaceXRanges(comp, loose); + debug('xrange', comp); + comp = replaceStars(comp, loose); + debug('stars', comp); + return comp; +} + +function isX(id) { + return !id || id.toLowerCase() === 'x' || id === '*'; +} + +// ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 +function replaceTildes(comp, loose) { + return comp.trim().split(/\s+/).map(function(comp) { + return replaceTilde(comp, loose); + }).join(' '); +} + +function replaceTilde(comp, loose) { + var r = loose ? re[TILDELOOSE] : re[TILDE]; + return comp.replace(r, function(_, M, m, p, pr) { + debug('tilde', comp, _, M, m, p, pr); + var ret; + + if (isX(M)) + ret = ''; + else if (isX(m)) + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; + else if (isX(p)) + // ~1.2 == >=1.2.0 <1.3.0 + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; + else if (pr) { + debug('replaceTilde pr', pr); + if (pr.charAt(0) !== '-') + pr = '-' + pr; + ret = '>=' + M + '.' + m + '.' + p + pr + + ' <' + M + '.' + (+m + 1) + '.0'; + } else + // ~1.2.3 == >=1.2.3 <1.3.0 + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0'; + + debug('tilde return', ret); + return ret; + }); +} + +// ^ --> * (any, kinda silly) +// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 +// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 +// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 +// ^1.2.3 --> >=1.2.3 <2.0.0 +// ^1.2.0 --> >=1.2.0 <2.0.0 +function replaceCarets(comp, loose) { + return comp.trim().split(/\s+/).map(function(comp) { + return replaceCaret(comp, loose); + }).join(' '); +} + +function replaceCaret(comp, loose) { + debug('caret', comp, loose); + var r = loose ? re[CARETLOOSE] : re[CARET]; + return comp.replace(r, function(_, M, m, p, pr) { + debug('caret', comp, _, M, m, p, pr); + var ret; + + if (isX(M)) + ret = ''; + else if (isX(m)) + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; + else if (isX(p)) { + if (M === '0') + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; + else + ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0'; + } else if (pr) { + debug('replaceCaret pr', pr); + if (pr.charAt(0) !== '-') + pr = '-' + pr; + if (M === '0') { + if (m === '0') + ret = '>=' + M + '.' + m + '.' + p + pr + + ' <' + M + '.' + m + '.' + (+p + 1); + else + ret = '>=' + M + '.' + m + '.' + p + pr + + ' <' + M + '.' + (+m + 1) + '.0'; + } else + ret = '>=' + M + '.' + m + '.' + p + pr + + ' <' + (+M + 1) + '.0.0'; + } else { + debug('no pr'); + if (M === '0') { + if (m === '0') + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + m + '.' + (+p + 1); + else + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0'; + } else + ret = '>=' + M + '.' + m + '.' + p + + ' <' + (+M + 1) + '.0.0'; + } + + debug('caret return', ret); + return ret; + }); +} + +function replaceXRanges(comp, loose) { + debug('replaceXRanges', comp, loose); + return comp.split(/\s+/).map(function(comp) { + return replaceXRange(comp, loose); + }).join(' '); +} + +function replaceXRange(comp, loose) { + comp = comp.trim(); + var r = loose ? re[XRANGELOOSE] : re[XRANGE]; + return comp.replace(r, function(ret, gtlt, M, m, p, pr) { + debug('xRange', comp, ret, gtlt, M, m, p, pr); + var xM = isX(M); + var xm = xM || isX(m); + var xp = xm || isX(p); + var anyX = xp; + + if (gtlt === '=' && anyX) + gtlt = ''; + + if (xM) { + if (gtlt === '>' || gtlt === '<') { + // nothing is allowed + ret = '<0.0.0'; + } else { + // nothing is forbidden + ret = '*'; + } + } else if (gtlt && anyX) { + // replace X with 0 + if (xm) + m = 0; + if (xp) + p = 0; + + if (gtlt === '>') { + // >1 => >=2.0.0 + // >1.2 => >=1.3.0 + // >1.2.3 => >= 1.2.4 + gtlt = '>='; + if (xm) { + M = +M + 1; + m = 0; + p = 0; + } else if (xp) { + m = +m + 1; + p = 0; + } + } else if (gtlt === '<=') { + // <=0.7.x is actually <0.8.0, since any 0.7.x should + // pass. Similarly, <=7.x is actually <8.0.0, etc. + gtlt = '<'; + if (xm) + M = +M + 1; + else + m = +m + 1; + } + + ret = gtlt + M + '.' + m + '.' + p; + } else if (xm) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; + } else if (xp) { + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; + } + + debug('xRange return', ret); + + return ret; + }); +} + +// Because * is AND-ed with everything else in the comparator, +// and '' means "any version", just remove the *s entirely. +function replaceStars(comp, loose) { + debug('replaceStars', comp, loose); + // Looseness is ignored here. star is always as loose as it gets! + return comp.trim().replace(re[STAR], ''); +} + +// This function is passed to string.replace(re[HYPHENRANGE]) +// M, m, patch, prerelease, build +// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 +// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do +// 1.2 - 3.4 => >=1.2.0 <3.5.0 +function hyphenReplace($0, + from, fM, fm, fp, fpr, fb, + to, tM, tm, tp, tpr, tb) { + + if (isX(fM)) + from = ''; + else if (isX(fm)) + from = '>=' + fM + '.0.0'; + else if (isX(fp)) + from = '>=' + fM + '.' + fm + '.0'; + else + from = '>=' + from; + + if (isX(tM)) + to = ''; + else if (isX(tm)) + to = '<' + (+tM + 1) + '.0.0'; + else if (isX(tp)) + to = '<' + tM + '.' + (+tm + 1) + '.0'; + else if (tpr) + to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr; + else + to = '<=' + to; + + return (from + ' ' + to).trim(); +} + + +// if ANY of the sets match ALL of its comparators, then pass +Range.prototype.test = function(version) { + if (!version) + return false; + + if (typeof version === 'string') + version = new SemVer(version, this.loose); + + for (var i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version)) + return true; + } + return false; +}; + +function testSet(set, version) { + for (var i = 0; i < set.length; i++) { + if (!set[i].test(version)) + return false; + } + + if (version.prerelease.length) { + // Find the set of versions that are allowed to have prereleases + // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 + // That should allow `1.2.3-pr.2` to pass. + // However, `1.2.4-alpha.notready` should NOT be allowed, + // even though it's within the range set by the comparators. + for (var i = 0; i < set.length; i++) { + debug(set[i].semver); + if (set[i].semver === ANY) + continue; + + if (set[i].semver.prerelease.length > 0) { + var allowed = set[i].semver; + if (allowed.major === version.major && + allowed.minor === version.minor && + allowed.patch === version.patch) + return true; + } + } + + // Version has a -pre, but it's not one of the ones we like. + return false; + } + + return true; +} + +exports.satisfies = satisfies; +function satisfies(version, range, loose) { + try { + range = new Range(range, loose); + } catch (er) { + return false; + } + return range.test(version); +} + +exports.maxSatisfying = maxSatisfying; +function maxSatisfying(versions, range, loose) { + var max = null; + var maxSV = null; + try { + var rangeObj = new Range(range, loose); + } catch (er) { + return null; + } + versions.forEach(function (v) { + if (rangeObj.test(v)) { // satisfies(v, range, loose) + if (!max || maxSV.compare(v) === -1) { // compare(max, v, true) + max = v; + maxSV = new SemVer(max, loose); + } + } + }) + return max; +} + +exports.minSatisfying = minSatisfying; +function minSatisfying(versions, range, loose) { + var min = null; + var minSV = null; + try { + var rangeObj = new Range(range, loose); + } catch (er) { + return null; + } + versions.forEach(function (v) { + if (rangeObj.test(v)) { // satisfies(v, range, loose) + if (!min || minSV.compare(v) === 1) { // compare(min, v, true) + min = v; + minSV = new SemVer(min, loose); + } + } + }) + return min; +} + +exports.validRange = validRange; +function validRange(range, loose) { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, loose).range || '*'; + } catch (er) { + return null; + } +} + +// Determine if version is less than all the versions possible in the range +exports.ltr = ltr; +function ltr(version, range, loose) { + return outside(version, range, '<', loose); +} + +// Determine if version is greater than all the versions possible in the range. +exports.gtr = gtr; +function gtr(version, range, loose) { + return outside(version, range, '>', loose); +} + +exports.outside = outside; +function outside(version, range, hilo, loose) { + version = new SemVer(version, loose); + range = new Range(range, loose); + + var gtfn, ltefn, ltfn, comp, ecomp; + switch (hilo) { + case '>': + gtfn = gt; + ltefn = lte; + ltfn = lt; + comp = '>'; + ecomp = '>='; + break; + case '<': + gtfn = lt; + ltefn = gte; + ltfn = gt; + comp = '<'; + ecomp = '<='; + break; + default: + throw new TypeError('Must provide a hilo val of "<" or ">"'); + } + + // If it satisifes the range it is not outside + if (satisfies(version, range, loose)) { + return false; + } + + // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. + + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i]; + + var high = null; + var low = null; + + comparators.forEach(function(comparator) { + if (comparator.semver === ANY) { + comparator = new Comparator('>=0.0.0') + } + high = high || comparator; + low = low || comparator; + if (gtfn(comparator.semver, high.semver, loose)) { + high = comparator; + } else if (ltfn(comparator.semver, low.semver, loose)) { + low = comparator; + } + }); + + // If the edge version comparator has a operator then our version + // isn't outside it + if (high.operator === comp || high.operator === ecomp) { + return false; + } + + // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + if ((!low.operator || low.operator === comp) && + ltefn(version, low.semver)) { + return false; + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false; + } + } + return true; +} + +exports.prerelease = prerelease; +function prerelease(version, loose) { + var parsed = parse(version, loose); + return (parsed && parsed.prerelease.length) ? parsed.prerelease : null; +} + +exports.intersects = intersects; +function intersects(r1, r2, loose) { + r1 = new Range(r1, loose) + r2 = new Range(r2, loose) + return r1.intersects(r2) +} + +exports.coerce = coerce; +function coerce(version) { + if (version instanceof SemVer) + return version; + + if (typeof version !== 'string') + return null; + + var match = version.match(re[COERCE]); + + if (match == null) + return null; + + return parse((match[1] || '0') + '.' + (match[2] || '0') + '.' + (match[3] || '0')); +} + + +/***/ }), +/* 22 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +exports.__esModule = true; + +var _assign = __webpack_require__(591); + +var _assign2 = _interopRequireDefault(_assign); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = _assign2.default || function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + + return target; +}; + +/***/ }), +/* 23 */ +/***/ (function(module, exports) { + +module.exports = require("stream"); + +/***/ }), +/* 24 */ +/***/ (function(module, exports) { + +module.exports = require("url"); + +/***/ }), +/* 25 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Subscription; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_isArray__ = __webpack_require__(41); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_isObject__ = __webpack_require__(444); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_isFunction__ = __webpack_require__(154); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_tryCatch__ = __webpack_require__(56); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_errorObject__ = __webpack_require__(47); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__ = __webpack_require__(441); +/** PURE_IMPORTS_START _util_isArray,_util_isObject,_util_isFunction,_util_tryCatch,_util_errorObject,_util_UnsubscriptionError PURE_IMPORTS_END */ + + + + + + +var Subscription = /*@__PURE__*/ (function () { + function Subscription(unsubscribe) { + this.closed = false; + this._parent = null; + this._parents = null; + this._subscriptions = null; + if (unsubscribe) { + this._unsubscribe = unsubscribe; + } + } + Subscription.prototype.unsubscribe = function () { + var hasErrors = false; + var errors; + if (this.closed) { + return; + } + var _a = this, _parent = _a._parent, _parents = _a._parents, _unsubscribe = _a._unsubscribe, _subscriptions = _a._subscriptions; + this.closed = true; + this._parent = null; + this._parents = null; + this._subscriptions = null; + var index = -1; + var len = _parents ? _parents.length : 0; + while (_parent) { + _parent.remove(this); + _parent = ++index < len && _parents[index] || null; + } + if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__util_isFunction__["a" /* isFunction */])(_unsubscribe)) { + var trial = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__util_tryCatch__["a" /* tryCatch */])(_unsubscribe).call(this); + if (trial === __WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */]) { + hasErrors = true; + errors = errors || (__WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */].e instanceof __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__["a" /* UnsubscriptionError */] ? + flattenUnsubscriptionErrors(__WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */].e.errors) : [__WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */].e]); + } + } + if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__util_isArray__["a" /* isArray */])(_subscriptions)) { + index = -1; + len = _subscriptions.length; + while (++index < len) { + var sub = _subscriptions[index]; + if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__util_isObject__["a" /* isObject */])(sub)) { + var trial = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__util_tryCatch__["a" /* tryCatch */])(sub.unsubscribe).call(sub); + if (trial === __WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */]) { + hasErrors = true; + errors = errors || []; + var err = __WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */].e; + if (err instanceof __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__["a" /* UnsubscriptionError */]) { + errors = errors.concat(flattenUnsubscriptionErrors(err.errors)); + } + else { + errors.push(err); + } + } + } + } + } + if (hasErrors) { + throw new __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__["a" /* UnsubscriptionError */](errors); + } + }; + Subscription.prototype.add = function (teardown) { + if (!teardown || (teardown === Subscription.EMPTY)) { + return Subscription.EMPTY; + } + if (teardown === this) { + return this; + } + var subscription = teardown; + switch (typeof teardown) { + case 'function': + subscription = new Subscription(teardown); + case 'object': + if (subscription.closed || typeof subscription.unsubscribe !== 'function') { + return subscription; + } + else if (this.closed) { + subscription.unsubscribe(); + return subscription; + } + else if (typeof subscription._addParent !== 'function') { + var tmp = subscription; + subscription = new Subscription(); + subscription._subscriptions = [tmp]; + } + break; + default: + throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.'); + } + var subscriptions = this._subscriptions || (this._subscriptions = []); + subscriptions.push(subscription); + subscription._addParent(this); + return subscription; + }; + Subscription.prototype.remove = function (subscription) { + var subscriptions = this._subscriptions; + if (subscriptions) { + var subscriptionIndex = subscriptions.indexOf(subscription); + if (subscriptionIndex !== -1) { + subscriptions.splice(subscriptionIndex, 1); + } + } + }; + Subscription.prototype._addParent = function (parent) { + var _a = this, _parent = _a._parent, _parents = _a._parents; + if (!_parent || _parent === parent) { + this._parent = parent; + } + else if (!_parents) { + this._parents = [parent]; + } + else if (_parents.indexOf(parent) === -1) { + _parents.push(parent); + } + }; + Subscription.EMPTY = (function (empty) { + empty.closed = true; + return empty; + }(new Subscription())); + return Subscription; +}()); + +function flattenUnsubscriptionErrors(errors) { + return errors.reduce(function (errs, err) { return errs.concat((err instanceof __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__["a" /* UnsubscriptionError */]) ? err.errors : err); }, []); +} +//# sourceMappingURL=Subscription.js.map + + +/***/ }), +/* 26 */ +/***/ (function(module, exports, __webpack_require__) { + +// Copyright 2015 Joyent, Inc. + +module.exports = { + bufferSplit: bufferSplit, + addRSAMissing: addRSAMissing, + calculateDSAPublic: calculateDSAPublic, + calculateED25519Public: calculateED25519Public, + calculateX25519Public: calculateX25519Public, + mpNormalize: mpNormalize, + mpDenormalize: mpDenormalize, + ecNormalize: ecNormalize, + countZeros: countZeros, + assertCompatible: assertCompatible, + isCompatible: isCompatible, + opensslKeyDeriv: opensslKeyDeriv, + opensshCipherInfo: opensshCipherInfo, + publicFromPrivateECDSA: publicFromPrivateECDSA, + zeroPadToLength: zeroPadToLength, + writeBitString: writeBitString, + readBitString: readBitString +}; + +var assert = __webpack_require__(16); +var Buffer = __webpack_require__(15).Buffer; +var PrivateKey = __webpack_require__(33); +var Key = __webpack_require__(27); +var crypto = __webpack_require__(12); +var algs = __webpack_require__(32); +var asn1 = __webpack_require__(65); + +var ec, jsbn; +var nacl; + +var MAX_CLASS_DEPTH = 3; + +function isCompatible(obj, klass, needVer) { + if (obj === null || typeof (obj) !== 'object') + return (false); + if (needVer === undefined) + needVer = klass.prototype._sshpkApiVersion; + if (obj instanceof klass && + klass.prototype._sshpkApiVersion[0] == needVer[0]) + return (true); + var proto = Object.getPrototypeOf(obj); + var depth = 0; + while (proto.constructor.name !== klass.name) { + proto = Object.getPrototypeOf(proto); + if (!proto || ++depth > MAX_CLASS_DEPTH) + return (false); + } + if (proto.constructor.name !== klass.name) + return (false); + var ver = proto._sshpkApiVersion; + if (ver === undefined) + ver = klass._oldVersionDetect(obj); + if (ver[0] != needVer[0] || ver[1] < needVer[1]) + return (false); + return (true); +} + +function assertCompatible(obj, klass, needVer, name) { + if (name === undefined) + name = 'object'; + assert.ok(obj, name + ' must not be null'); + assert.object(obj, name + ' must be an object'); + if (needVer === undefined) + needVer = klass.prototype._sshpkApiVersion; + if (obj instanceof klass && + klass.prototype._sshpkApiVersion[0] == needVer[0]) + return; + var proto = Object.getPrototypeOf(obj); + var depth = 0; + while (proto.constructor.name !== klass.name) { + proto = Object.getPrototypeOf(proto); + assert.ok(proto && ++depth <= MAX_CLASS_DEPTH, + name + ' must be a ' + klass.name + ' instance'); + } + assert.strictEqual(proto.constructor.name, klass.name, + name + ' must be a ' + klass.name + ' instance'); + var ver = proto._sshpkApiVersion; + if (ver === undefined) + ver = klass._oldVersionDetect(obj); + assert.ok(ver[0] == needVer[0] && ver[1] >= needVer[1], + name + ' must be compatible with ' + klass.name + ' klass ' + + 'version ' + needVer[0] + '.' + needVer[1]); +} + +var CIPHER_LEN = { + 'des-ede3-cbc': { key: 7, iv: 8 }, + 'aes-128-cbc': { key: 16, iv: 16 } +}; +var PKCS5_SALT_LEN = 8; + +function opensslKeyDeriv(cipher, salt, passphrase, count) { + assert.buffer(salt, 'salt'); + assert.buffer(passphrase, 'passphrase'); + assert.number(count, 'iteration count'); + + var clen = CIPHER_LEN[cipher]; + assert.object(clen, 'supported cipher'); + + salt = salt.slice(0, PKCS5_SALT_LEN); + + var D, D_prev, bufs; + var material = Buffer.alloc(0); + while (material.length < clen.key + clen.iv) { + bufs = []; + if (D_prev) + bufs.push(D_prev); + bufs.push(passphrase); + bufs.push(salt); + D = Buffer.concat(bufs); + for (var j = 0; j < count; ++j) + D = crypto.createHash('md5').update(D).digest(); + material = Buffer.concat([material, D]); + D_prev = D; + } + + return ({ + key: material.slice(0, clen.key), + iv: material.slice(clen.key, clen.key + clen.iv) + }); +} + +/* Count leading zero bits on a buffer */ +function countZeros(buf) { + var o = 0, obit = 8; + while (o < buf.length) { + var mask = (1 << obit); + if ((buf[o] & mask) === mask) + break; + obit--; + if (obit < 0) { + o++; + obit = 8; + } + } + return (o*8 + (8 - obit) - 1); +} + +function bufferSplit(buf, chr) { + assert.buffer(buf); + assert.string(chr); + + var parts = []; + var lastPart = 0; + var matches = 0; + for (var i = 0; i < buf.length; ++i) { + if (buf[i] === chr.charCodeAt(matches)) + ++matches; + else if (buf[i] === chr.charCodeAt(0)) + matches = 1; + else + matches = 0; + + if (matches >= chr.length) { + var newPart = i + 1; + parts.push(buf.slice(lastPart, newPart - matches)); + lastPart = newPart; + matches = 0; + } + } + if (lastPart <= buf.length) + parts.push(buf.slice(lastPart, buf.length)); + + return (parts); +} + +function ecNormalize(buf, addZero) { + assert.buffer(buf); + if (buf[0] === 0x00 && buf[1] === 0x04) { + if (addZero) + return (buf); + return (buf.slice(1)); + } else if (buf[0] === 0x04) { + if (!addZero) + return (buf); + } else { + while (buf[0] === 0x00) + buf = buf.slice(1); + if (buf[0] === 0x02 || buf[0] === 0x03) + throw (new Error('Compressed elliptic curve points ' + + 'are not supported')); + if (buf[0] !== 0x04) + throw (new Error('Not a valid elliptic curve point')); + if (!addZero) + return (buf); + } + var b = Buffer.alloc(buf.length + 1); + b[0] = 0x0; + buf.copy(b, 1); + return (b); +} + +function readBitString(der, tag) { + if (tag === undefined) + tag = asn1.Ber.BitString; + var buf = der.readString(tag, true); + assert.strictEqual(buf[0], 0x00, 'bit strings with unused bits are ' + + 'not supported (0x' + buf[0].toString(16) + ')'); + return (buf.slice(1)); +} + +function writeBitString(der, buf, tag) { + if (tag === undefined) + tag = asn1.Ber.BitString; + var b = Buffer.alloc(buf.length + 1); + b[0] = 0x00; + buf.copy(b, 1); + der.writeBuffer(b, tag); +} + +function mpNormalize(buf) { + assert.buffer(buf); + while (buf.length > 1 && buf[0] === 0x00 && (buf[1] & 0x80) === 0x00) + buf = buf.slice(1); + if ((buf[0] & 0x80) === 0x80) { + var b = Buffer.alloc(buf.length + 1); + b[0] = 0x00; + buf.copy(b, 1); + buf = b; + } + return (buf); +} + +function mpDenormalize(buf) { + assert.buffer(buf); + while (buf.length > 1 && buf[0] === 0x00) + buf = buf.slice(1); + return (buf); +} + +function zeroPadToLength(buf, len) { + assert.buffer(buf); + assert.number(len); + while (buf.length > len) { + assert.equal(buf[0], 0x00); + buf = buf.slice(1); + } + while (buf.length < len) { + var b = Buffer.alloc(buf.length + 1); + b[0] = 0x00; + buf.copy(b, 1); + buf = b; + } + return (buf); +} + +function bigintToMpBuf(bigint) { + var buf = Buffer.from(bigint.toByteArray()); + buf = mpNormalize(buf); + return (buf); +} + +function calculateDSAPublic(g, p, x) { + assert.buffer(g); + assert.buffer(p); + assert.buffer(x); + try { + var bigInt = __webpack_require__(81).BigInteger; + } catch (e) { + throw (new Error('To load a PKCS#8 format DSA private key, ' + + 'the node jsbn library is required.')); + } + g = new bigInt(g); + p = new bigInt(p); + x = new bigInt(x); + var y = g.modPow(x, p); + var ybuf = bigintToMpBuf(y); + return (ybuf); +} + +function calculateED25519Public(k) { + assert.buffer(k); + + if (nacl === undefined) + nacl = __webpack_require__(75); + + var kp = nacl.sign.keyPair.fromSeed(new Uint8Array(k)); + return (Buffer.from(kp.publicKey)); +} + +function calculateX25519Public(k) { + assert.buffer(k); + + if (nacl === undefined) + nacl = __webpack_require__(75); + + var kp = nacl.box.keyPair.fromSeed(new Uint8Array(k)); + return (Buffer.from(kp.publicKey)); +} + +function addRSAMissing(key) { + assert.object(key); + assertCompatible(key, PrivateKey, [1, 1]); + try { + var bigInt = __webpack_require__(81).BigInteger; + } catch (e) { + throw (new Error('To write a PEM private key from ' + + 'this source, the node jsbn lib is required.')); + } + + var d = new bigInt(key.part.d.data); + var buf; + + if (!key.part.dmodp) { + var p = new bigInt(key.part.p.data); + var dmodp = d.mod(p.subtract(1)); + + buf = bigintToMpBuf(dmodp); + key.part.dmodp = {name: 'dmodp', data: buf}; + key.parts.push(key.part.dmodp); + } + if (!key.part.dmodq) { + var q = new bigInt(key.part.q.data); + var dmodq = d.mod(q.subtract(1)); + + buf = bigintToMpBuf(dmodq); + key.part.dmodq = {name: 'dmodq', data: buf}; + key.parts.push(key.part.dmodq); + } +} + +function publicFromPrivateECDSA(curveName, priv) { + assert.string(curveName, 'curveName'); + assert.buffer(priv); + if (ec === undefined) + ec = __webpack_require__(139); + if (jsbn === undefined) + jsbn = __webpack_require__(81).BigInteger; + var params = algs.curves[curveName]; + var p = new jsbn(params.p); + var a = new jsbn(params.a); + var b = new jsbn(params.b); + var curve = new ec.ECCurveFp(p, a, b); + var G = curve.decodePointHex(params.G.toString('hex')); + + var d = new jsbn(mpNormalize(priv)); + var pub = G.multiply(d); + pub = Buffer.from(curve.encodePointHex(pub), 'hex'); + + var parts = []; + parts.push({name: 'curve', data: Buffer.from(curveName)}); + parts.push({name: 'Q', data: pub}); + + var key = new Key({type: 'ecdsa', curve: curve, parts: parts}); + return (key); +} + +function opensshCipherInfo(cipher) { + var inf = {}; + switch (cipher) { + case '3des-cbc': + inf.keySize = 24; + inf.blockSize = 8; + inf.opensslName = 'des-ede3-cbc'; + break; + case 'blowfish-cbc': + inf.keySize = 16; + inf.blockSize = 8; + inf.opensslName = 'bf-cbc'; + break; + case 'aes128-cbc': + case 'aes128-ctr': + case 'aes128-gcm@openssh.com': + inf.keySize = 16; + inf.blockSize = 16; + inf.opensslName = 'aes-128-' + cipher.slice(7, 10); + break; + case 'aes192-cbc': + case 'aes192-ctr': + case 'aes192-gcm@openssh.com': + inf.keySize = 24; + inf.blockSize = 16; + inf.opensslName = 'aes-192-' + cipher.slice(7, 10); + break; + case 'aes256-cbc': + case 'aes256-ctr': + case 'aes256-gcm@openssh.com': + inf.keySize = 32; + inf.blockSize = 16; + inf.opensslName = 'aes-256-' + cipher.slice(7, 10); + break; + default: + throw (new Error( + 'Unsupported openssl cipher "' + cipher + '"')); + } + return (inf); +} + + +/***/ }), +/* 27 */ +/***/ (function(module, exports, __webpack_require__) { + +// Copyright 2017 Joyent, Inc. + +module.exports = Key; + +var assert = __webpack_require__(16); +var algs = __webpack_require__(32); +var crypto = __webpack_require__(12); +var Fingerprint = __webpack_require__(156); +var Signature = __webpack_require__(74); +var DiffieHellman = __webpack_require__(325).DiffieHellman; +var errs = __webpack_require__(73); +var utils = __webpack_require__(26); +var PrivateKey = __webpack_require__(33); +var edCompat; + +try { + edCompat = __webpack_require__(454); +} catch (e) { + /* Just continue through, and bail out if we try to use it. */ +} + +var InvalidAlgorithmError = errs.InvalidAlgorithmError; +var KeyParseError = errs.KeyParseError; + +var formats = {}; +formats['auto'] = __webpack_require__(455); +formats['pem'] = __webpack_require__(86); +formats['pkcs1'] = __webpack_require__(327); +formats['pkcs8'] = __webpack_require__(157); +formats['rfc4253'] = __webpack_require__(103); +formats['ssh'] = __webpack_require__(456); +formats['ssh-private'] = __webpack_require__(192); +formats['openssh'] = formats['ssh-private']; +formats['dnssec'] = __webpack_require__(326); + +function Key(opts) { + assert.object(opts, 'options'); + assert.arrayOfObject(opts.parts, 'options.parts'); + assert.string(opts.type, 'options.type'); + assert.optionalString(opts.comment, 'options.comment'); + + var algInfo = algs.info[opts.type]; + if (typeof (algInfo) !== 'object') + throw (new InvalidAlgorithmError(opts.type)); + + var partLookup = {}; + for (var i = 0; i < opts.parts.length; ++i) { + var part = opts.parts[i]; + partLookup[part.name] = part; + } + + this.type = opts.type; + this.parts = opts.parts; + this.part = partLookup; + this.comment = undefined; + this.source = opts.source; + + /* for speeding up hashing/fingerprint operations */ + this._rfc4253Cache = opts._rfc4253Cache; + this._hashCache = {}; + + var sz; + this.curve = undefined; + if (this.type === 'ecdsa') { + var curve = this.part.curve.data.toString(); + this.curve = curve; + sz = algs.curves[curve].size; + } else if (this.type === 'ed25519' || this.type === 'curve25519') { + sz = 256; + this.curve = 'curve25519'; + } else { + var szPart = this.part[algInfo.sizePart]; + sz = szPart.data.length; + sz = sz * 8 - utils.countZeros(szPart.data); + } + this.size = sz; +} + +Key.formats = formats; + +Key.prototype.toBuffer = function (format, options) { + if (format === undefined) + format = 'ssh'; + assert.string(format, 'format'); + assert.object(formats[format], 'formats[format]'); + assert.optionalObject(options, 'options'); + + if (format === 'rfc4253') { + if (this._rfc4253Cache === undefined) + this._rfc4253Cache = formats['rfc4253'].write(this); + return (this._rfc4253Cache); + } + + return (formats[format].write(this, options)); +}; + +Key.prototype.toString = function (format, options) { + return (this.toBuffer(format, options).toString()); +}; + +Key.prototype.hash = function (algo) { + assert.string(algo, 'algorithm'); + algo = algo.toLowerCase(); + if (algs.hashAlgs[algo] === undefined) + throw (new InvalidAlgorithmError(algo)); + + if (this._hashCache[algo]) + return (this._hashCache[algo]); + var hash = crypto.createHash(algo). + update(this.toBuffer('rfc4253')).digest(); + this._hashCache[algo] = hash; + return (hash); +}; + +Key.prototype.fingerprint = function (algo) { + if (algo === undefined) + algo = 'sha256'; + assert.string(algo, 'algorithm'); + var opts = { + type: 'key', + hash: this.hash(algo), + algorithm: algo + }; + return (new Fingerprint(opts)); +}; + +Key.prototype.defaultHashAlgorithm = function () { + var hashAlgo = 'sha1'; + if (this.type === 'rsa') + hashAlgo = 'sha256'; + if (this.type === 'dsa' && this.size > 1024) + hashAlgo = 'sha256'; + if (this.type === 'ed25519') + hashAlgo = 'sha512'; + if (this.type === 'ecdsa') { + if (this.size <= 256) + hashAlgo = 'sha256'; + else if (this.size <= 384) + hashAlgo = 'sha384'; + else + hashAlgo = 'sha512'; + } + return (hashAlgo); +}; + +Key.prototype.createVerify = function (hashAlgo) { + if (hashAlgo === undefined) + hashAlgo = this.defaultHashAlgorithm(); + assert.string(hashAlgo, 'hash algorithm'); + + /* ED25519 is not supported by OpenSSL, use a javascript impl. */ + if (this.type === 'ed25519' && edCompat !== undefined) + return (new edCompat.Verifier(this, hashAlgo)); + if (this.type === 'curve25519') + throw (new Error('Curve25519 keys are not suitable for ' + + 'signing or verification')); + + var v, nm, err; + try { + nm = hashAlgo.toUpperCase(); + v = crypto.createVerify(nm); + } catch (e) { + err = e; + } + if (v === undefined || (err instanceof Error && + err.message.match(/Unknown message digest/))) { + nm = 'RSA-'; + nm += hashAlgo.toUpperCase(); + v = crypto.createVerify(nm); + } + assert.ok(v, 'failed to create verifier'); + var oldVerify = v.verify.bind(v); + var key = this.toBuffer('pkcs8'); + var curve = this.curve; + var self = this; + v.verify = function (signature, fmt) { + if (Signature.isSignature(signature, [2, 0])) { + if (signature.type !== self.type) + return (false); + if (signature.hashAlgorithm && + signature.hashAlgorithm !== hashAlgo) + return (false); + if (signature.curve && self.type === 'ecdsa' && + signature.curve !== curve) + return (false); + return (oldVerify(key, signature.toBuffer('asn1'))); + + } else if (typeof (signature) === 'string' || + Buffer.isBuffer(signature)) { + return (oldVerify(key, signature, fmt)); + + /* + * Avoid doing this on valid arguments, walking the prototype + * chain can be quite slow. + */ + } else if (Signature.isSignature(signature, [1, 0])) { + throw (new Error('signature was created by too old ' + + 'a version of sshpk and cannot be verified')); + + } else { + throw (new TypeError('signature must be a string, ' + + 'Buffer, or Signature object')); + } + }; + return (v); +}; + +Key.prototype.createDiffieHellman = function () { + if (this.type === 'rsa') + throw (new Error('RSA keys do not support Diffie-Hellman')); + + return (new DiffieHellman(this)); +}; +Key.prototype.createDH = Key.prototype.createDiffieHellman; + +Key.parse = function (data, format, options) { + if (typeof (data) !== 'string') + assert.buffer(data, 'data'); + if (format === undefined) + format = 'auto'; + assert.string(format, 'format'); + if (typeof (options) === 'string') + options = { filename: options }; + assert.optionalObject(options, 'options'); + if (options === undefined) + options = {}; + assert.optionalString(options.filename, 'options.filename'); + if (options.filename === undefined) + options.filename = '(unnamed)'; + + assert.object(formats[format], 'formats[format]'); + + try { + var k = formats[format].read(data, options); + if (k instanceof PrivateKey) + k = k.toPublic(); + if (!k.comment) + k.comment = options.filename; + return (k); + } catch (e) { + if (e.name === 'KeyEncryptedError') + throw (e); + throw (new KeyParseError(options.filename, format, e)); + } +}; + +Key.isKey = function (obj, ver) { + return (utils.isCompatible(obj, Key, ver)); +}; + +/* + * API versions for Key: + * [1,0] -- initial ver, may take Signature for createVerify or may not + * [1,1] -- added pkcs1, pkcs8 formats + * [1,2] -- added auto, ssh-private, openssh formats + * [1,3] -- added defaultHashAlgorithm + * [1,4] -- added ed support, createDH + * [1,5] -- first explicitly tagged version + * [1,6] -- changed ed25519 part names + */ +Key.prototype._sshpkApiVersion = [1, 6]; + +Key._oldVersionDetect = function (obj) { + assert.func(obj.toBuffer); + assert.func(obj.fingerprint); + if (obj.createDH) + return ([1, 4]); + if (obj.defaultHashAlgorithm) + return ([1, 3]); + if (obj.formats['auto']) + return ([1, 2]); + if (obj.formats['pkcs1']) + return ([1, 1]); + return ([1, 0]); +}; + + +/***/ }), +/* 28 */ +/***/ (function(module, exports) { + +module.exports = require("assert"); + +/***/ }), +/* 29 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = nullify; +function nullify(obj = {}) { + if (Array.isArray(obj)) { + for (var _iterator = obj, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + const item = _ref; + + nullify(item); + } + } else if (obj !== null && typeof obj === 'object' || typeof obj === 'function') { + Object.setPrototypeOf(obj, null); + + // for..in can only be applied to 'object', not 'function' + if (typeof obj === 'object') { + for (const key in obj) { + nullify(obj[key]); + } + } + } + + return obj; +} + +/***/ }), +/* 30 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +const escapeStringRegexp = __webpack_require__(388); +const ansiStyles = __webpack_require__(506); +const stdoutColor = __webpack_require__(598).stdout; + +const template = __webpack_require__(599); + +const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); + +// `supportsColor.level` → `ansiStyles.color[name]` mapping +const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m']; + +// `color-convert` models to exclude from the Chalk API due to conflicts and such +const skipModels = new Set(['gray']); + +const styles = Object.create(null); + +function applyOptions(obj, options) { + options = options || {}; + + // Detect level if not set manually + const scLevel = stdoutColor ? stdoutColor.level : 0; + obj.level = options.level === undefined ? scLevel : options.level; + obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0; +} + +function Chalk(options) { + // We check for this.template here since calling `chalk.constructor()` + // by itself will have a `this` of a previously constructed chalk object + if (!this || !(this instanceof Chalk) || this.template) { + const chalk = {}; + applyOptions(chalk, options); + + chalk.template = function () { + const args = [].slice.call(arguments); + return chalkTag.apply(null, [chalk.template].concat(args)); + }; + + Object.setPrototypeOf(chalk, Chalk.prototype); + Object.setPrototypeOf(chalk.template, chalk); + + chalk.template.constructor = Chalk; + + return chalk.template; + } + + applyOptions(this, options); +} + +// Use bright blue on Windows as the normal blue color is illegible +if (isSimpleWindowsTerm) { + ansiStyles.blue.open = '\u001B[94m'; +} + +for (const key of Object.keys(ansiStyles)) { + ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); + + styles[key] = { + get() { + const codes = ansiStyles[key]; + return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key); + } + }; +} + +styles.visible = { + get() { + return build.call(this, this._styles || [], true, 'visible'); + } +}; + +ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g'); +for (const model of Object.keys(ansiStyles.color.ansi)) { + if (skipModels.has(model)) { + continue; + } + + styles[model] = { + get() { + const level = this.level; + return function () { + const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments); + const codes = { + open, + close: ansiStyles.color.close, + closeRe: ansiStyles.color.closeRe + }; + return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model); + }; + } + }; +} + +ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g'); +for (const model of Object.keys(ansiStyles.bgColor.ansi)) { + if (skipModels.has(model)) { + continue; + } + + const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1); + styles[bgModel] = { + get() { + const level = this.level; + return function () { + const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments); + const codes = { + open, + close: ansiStyles.bgColor.close, + closeRe: ansiStyles.bgColor.closeRe + }; + return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model); + }; + } + }; +} + +const proto = Object.defineProperties(() => {}, styles); + +function build(_styles, _empty, key) { + const builder = function () { + return applyStyle.apply(builder, arguments); + }; + + builder._styles = _styles; + builder._empty = _empty; + + const self = this; + + Object.defineProperty(builder, 'level', { + enumerable: true, + get() { + return self.level; + }, + set(level) { + self.level = level; + } + }); + + Object.defineProperty(builder, 'enabled', { + enumerable: true, + get() { + return self.enabled; + }, + set(enabled) { + self.enabled = enabled; + } + }); + + // See below for fix regarding invisible grey/dim combination on Windows + builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey'; + + // `__proto__` is used because we must return a function, but there is + // no way to create a function with a different prototype + builder.__proto__ = proto; // eslint-disable-line no-proto + + return builder; +} + +function applyStyle() { + // Support varags, but simply cast to string in case there's only one arg + const args = arguments; + const argsLen = args.length; + let str = String(arguments[0]); + + if (argsLen === 0) { + return ''; + } + + if (argsLen > 1) { + // Don't slice `arguments`, it prevents V8 optimizations + for (let a = 1; a < argsLen; a++) { + str += ' ' + args[a]; + } + } + + if (!this.enabled || this.level <= 0 || !str) { + return this._empty ? '' : str; + } + + // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe, + // see https://github.com/chalk/chalk/issues/58 + // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop. + const originalDim = ansiStyles.dim.open; + if (isSimpleWindowsTerm && this.hasGrey) { + ansiStyles.dim.open = ''; + } + + for (const code of this._styles.slice().reverse()) { + // Replace any instances already present with a re-opening code + // otherwise only the part of the string until said closing code + // will be colored, and the rest will simply be 'plain'. + str = code.open + str.replace(code.closeRe, code.open) + code.close; + + // Close the styling before a linebreak and reopen + // after next line to fix a bleed issue on macOS + // https://github.com/chalk/chalk/pull/92 + str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`); + } + + // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue + ansiStyles.dim.open = originalDim; + + return str; +} + +function chalkTag(chalk, strings) { + if (!Array.isArray(strings)) { + // If chalk() was called by itself or with a string, + // return the string itself as a string. + return [].slice.call(arguments, 1).join(' '); + } + + const args = [].slice.call(arguments, 2); + const parts = [strings.raw[0]]; + + for (let i = 1; i < strings.length; i++) { + parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&')); + parts.push(String(strings.raw[i])); + } + + return template(chalk, parts.join('')); +} + +Object.defineProperties(Chalk.prototype, styles); + +module.exports = Chalk(); // eslint-disable-line new-cap +module.exports.supportsColor = stdoutColor; +module.exports.default = module.exports; // For TypeScript + + +/***/ }), +/* 31 */ +/***/ (function(module, exports) { + +var core = module.exports = { version: '2.5.7' }; +if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef + + +/***/ }), +/* 32 */ +/***/ (function(module, exports, __webpack_require__) { + +// Copyright 2015 Joyent, Inc. + +var Buffer = __webpack_require__(15).Buffer; + +var algInfo = { + 'dsa': { + parts: ['p', 'q', 'g', 'y'], + sizePart: 'p' + }, + 'rsa': { + parts: ['e', 'n'], + sizePart: 'n' + }, + 'ecdsa': { + parts: ['curve', 'Q'], + sizePart: 'Q' + }, + 'ed25519': { + parts: ['A'], + sizePart: 'A' + } +}; +algInfo['curve25519'] = algInfo['ed25519']; + +var algPrivInfo = { + 'dsa': { + parts: ['p', 'q', 'g', 'y', 'x'] + }, + 'rsa': { + parts: ['n', 'e', 'd', 'iqmp', 'p', 'q'] + }, + 'ecdsa': { + parts: ['curve', 'Q', 'd'] + }, + 'ed25519': { + parts: ['A', 'k'] + } +}; +algPrivInfo['curve25519'] = algPrivInfo['ed25519']; + +var hashAlgs = { + 'md5': true, + 'sha1': true, + 'sha256': true, + 'sha384': true, + 'sha512': true +}; + +/* + * Taken from + * http://csrc.nist.gov/groups/ST/toolkit/documents/dss/NISTReCur.pdf + */ +var curves = { + 'nistp256': { + size: 256, + pkcs8oid: '1.2.840.10045.3.1.7', + p: Buffer.from(('00' + + 'ffffffff 00000001 00000000 00000000' + + '00000000 ffffffff ffffffff ffffffff'). + replace(/ /g, ''), 'hex'), + a: Buffer.from(('00' + + 'FFFFFFFF 00000001 00000000 00000000' + + '00000000 FFFFFFFF FFFFFFFF FFFFFFFC'). + replace(/ /g, ''), 'hex'), + b: Buffer.from(( + '5ac635d8 aa3a93e7 b3ebbd55 769886bc' + + '651d06b0 cc53b0f6 3bce3c3e 27d2604b'). + replace(/ /g, ''), 'hex'), + s: Buffer.from(('00' + + 'c49d3608 86e70493 6a6678e1 139d26b7' + + '819f7e90'). + replace(/ /g, ''), 'hex'), + n: Buffer.from(('00' + + 'ffffffff 00000000 ffffffff ffffffff' + + 'bce6faad a7179e84 f3b9cac2 fc632551'). + replace(/ /g, ''), 'hex'), + G: Buffer.from(('04' + + '6b17d1f2 e12c4247 f8bce6e5 63a440f2' + + '77037d81 2deb33a0 f4a13945 d898c296' + + '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16' + + '2bce3357 6b315ece cbb64068 37bf51f5'). + replace(/ /g, ''), 'hex') + }, + 'nistp384': { + size: 384, + pkcs8oid: '1.3.132.0.34', + p: Buffer.from(('00' + + 'ffffffff ffffffff ffffffff ffffffff' + + 'ffffffff ffffffff ffffffff fffffffe' + + 'ffffffff 00000000 00000000 ffffffff'). + replace(/ /g, ''), 'hex'), + a: Buffer.from(('00' + + 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF' + + 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE' + + 'FFFFFFFF 00000000 00000000 FFFFFFFC'). + replace(/ /g, ''), 'hex'), + b: Buffer.from(( + 'b3312fa7 e23ee7e4 988e056b e3f82d19' + + '181d9c6e fe814112 0314088f 5013875a' + + 'c656398d 8a2ed19d 2a85c8ed d3ec2aef'). + replace(/ /g, ''), 'hex'), + s: Buffer.from(('00' + + 'a335926a a319a27a 1d00896a 6773a482' + + '7acdac73'). + replace(/ /g, ''), 'hex'), + n: Buffer.from(('00' + + 'ffffffff ffffffff ffffffff ffffffff' + + 'ffffffff ffffffff c7634d81 f4372ddf' + + '581a0db2 48b0a77a ecec196a ccc52973'). + replace(/ /g, ''), 'hex'), + G: Buffer.from(('04' + + 'aa87ca22 be8b0537 8eb1c71e f320ad74' + + '6e1d3b62 8ba79b98 59f741e0 82542a38' + + '5502f25d bf55296c 3a545e38 72760ab7' + + '3617de4a 96262c6f 5d9e98bf 9292dc29' + + 'f8f41dbd 289a147c e9da3113 b5f0b8c0' + + '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f'). + replace(/ /g, ''), 'hex') + }, + 'nistp521': { + size: 521, + pkcs8oid: '1.3.132.0.35', + p: Buffer.from(( + '01ffffff ffffffff ffffffff ffffffff' + + 'ffffffff ffffffff ffffffff ffffffff' + + 'ffffffff ffffffff ffffffff ffffffff' + + 'ffffffff ffffffff ffffffff ffffffff' + + 'ffff').replace(/ /g, ''), 'hex'), + a: Buffer.from(('01FF' + + 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF' + + 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF' + + 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF' + + 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFC'). + replace(/ /g, ''), 'hex'), + b: Buffer.from(('51' + + '953eb961 8e1c9a1f 929a21a0 b68540ee' + + 'a2da725b 99b315f3 b8b48991 8ef109e1' + + '56193951 ec7e937b 1652c0bd 3bb1bf07' + + '3573df88 3d2c34f1 ef451fd4 6b503f00'). + replace(/ /g, ''), 'hex'), + s: Buffer.from(('00' + + 'd09e8800 291cb853 96cc6717 393284aa' + + 'a0da64ba').replace(/ /g, ''), 'hex'), + n: Buffer.from(('01ff' + + 'ffffffff ffffffff ffffffff ffffffff' + + 'ffffffff ffffffff ffffffff fffffffa' + + '51868783 bf2f966b 7fcc0148 f709a5d0' + + '3bb5c9b8 899c47ae bb6fb71e 91386409'). + replace(/ /g, ''), 'hex'), + G: Buffer.from(('04' + + '00c6 858e06b7 0404e9cd 9e3ecb66 2395b442' + + '9c648139 053fb521 f828af60 6b4d3dba' + + 'a14b5e77 efe75928 fe1dc127 a2ffa8de' + + '3348b3c1 856a429b f97e7e31 c2e5bd66' + + '0118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9' + + '98f54449 579b4468 17afbd17 273e662c' + + '97ee7299 5ef42640 c550b901 3fad0761' + + '353c7086 a272c240 88be9476 9fd16650'). + replace(/ /g, ''), 'hex') + } +}; + +module.exports = { + info: algInfo, + privInfo: algPrivInfo, + hashAlgs: hashAlgs, + curves: curves +}; + + +/***/ }), +/* 33 */ +/***/ (function(module, exports, __webpack_require__) { + +// Copyright 2017 Joyent, Inc. + +module.exports = PrivateKey; + +var assert = __webpack_require__(16); +var Buffer = __webpack_require__(15).Buffer; +var algs = __webpack_require__(32); +var crypto = __webpack_require__(12); +var Fingerprint = __webpack_require__(156); +var Signature = __webpack_require__(74); +var errs = __webpack_require__(73); +var util = __webpack_require__(3); +var utils = __webpack_require__(26); +var dhe = __webpack_require__(325); +var generateECDSA = dhe.generateECDSA; +var generateED25519 = dhe.generateED25519; +var edCompat; +var nacl; + +try { + edCompat = __webpack_require__(454); +} catch (e) { + /* Just continue through, and bail out if we try to use it. */ +} + +var Key = __webpack_require__(27); + +var InvalidAlgorithmError = errs.InvalidAlgorithmError; +var KeyParseError = errs.KeyParseError; +var KeyEncryptedError = errs.KeyEncryptedError; + +var formats = {}; +formats['auto'] = __webpack_require__(455); +formats['pem'] = __webpack_require__(86); +formats['pkcs1'] = __webpack_require__(327); +formats['pkcs8'] = __webpack_require__(157); +formats['rfc4253'] = __webpack_require__(103); +formats['ssh-private'] = __webpack_require__(192); +formats['openssh'] = formats['ssh-private']; +formats['ssh'] = formats['ssh-private']; +formats['dnssec'] = __webpack_require__(326); + +function PrivateKey(opts) { + assert.object(opts, 'options'); + Key.call(this, opts); + + this._pubCache = undefined; +} +util.inherits(PrivateKey, Key); + +PrivateKey.formats = formats; + +PrivateKey.prototype.toBuffer = function (format, options) { + if (format === undefined) + format = 'pkcs1'; + assert.string(format, 'format'); + assert.object(formats[format], 'formats[format]'); + assert.optionalObject(options, 'options'); + + return (formats[format].write(this, options)); +}; + +PrivateKey.prototype.hash = function (algo) { + return (this.toPublic().hash(algo)); +}; + +PrivateKey.prototype.toPublic = function () { + if (this._pubCache) + return (this._pubCache); + + var algInfo = algs.info[this.type]; + var pubParts = []; + for (var i = 0; i < algInfo.parts.length; ++i) { + var p = algInfo.parts[i]; + pubParts.push(this.part[p]); + } + + this._pubCache = new Key({ + type: this.type, + source: this, + parts: pubParts + }); + if (this.comment) + this._pubCache.comment = this.comment; + return (this._pubCache); +}; + +PrivateKey.prototype.derive = function (newType) { + assert.string(newType, 'type'); + var priv, pub, pair; + + if (this.type === 'ed25519' && newType === 'curve25519') { + if (nacl === undefined) + nacl = __webpack_require__(75); + + priv = this.part.k.data; + if (priv[0] === 0x00) + priv = priv.slice(1); + + pair = nacl.box.keyPair.fromSecretKey(new Uint8Array(priv)); + pub = Buffer.from(pair.publicKey); + + return (new PrivateKey({ + type: 'curve25519', + parts: [ + { name: 'A', data: utils.mpNormalize(pub) }, + { name: 'k', data: utils.mpNormalize(priv) } + ] + })); + } else if (this.type === 'curve25519' && newType === 'ed25519') { + if (nacl === undefined) + nacl = __webpack_require__(75); + + priv = this.part.k.data; + if (priv[0] === 0x00) + priv = priv.slice(1); + + pair = nacl.sign.keyPair.fromSeed(new Uint8Array(priv)); + pub = Buffer.from(pair.publicKey); + + return (new PrivateKey({ + type: 'ed25519', + parts: [ + { name: 'A', data: utils.mpNormalize(pub) }, + { name: 'k', data: utils.mpNormalize(priv) } + ] + })); + } + throw (new Error('Key derivation not supported from ' + this.type + + ' to ' + newType)); +}; + +PrivateKey.prototype.createVerify = function (hashAlgo) { + return (this.toPublic().createVerify(hashAlgo)); +}; + +PrivateKey.prototype.createSign = function (hashAlgo) { + if (hashAlgo === undefined) + hashAlgo = this.defaultHashAlgorithm(); + assert.string(hashAlgo, 'hash algorithm'); + + /* ED25519 is not supported by OpenSSL, use a javascript impl. */ + if (this.type === 'ed25519' && edCompat !== undefined) + return (new edCompat.Signer(this, hashAlgo)); + if (this.type === 'curve25519') + throw (new Error('Curve25519 keys are not suitable for ' + + 'signing or verification')); + + var v, nm, err; + try { + nm = hashAlgo.toUpperCase(); + v = crypto.createSign(nm); + } catch (e) { + err = e; + } + if (v === undefined || (err instanceof Error && + err.message.match(/Unknown message digest/))) { + nm = 'RSA-'; + nm += hashAlgo.toUpperCase(); + v = crypto.createSign(nm); + } + assert.ok(v, 'failed to create verifier'); + var oldSign = v.sign.bind(v); + var key = this.toBuffer('pkcs1'); + var type = this.type; + var curve = this.curve; + v.sign = function () { + var sig = oldSign(key); + if (typeof (sig) === 'string') + sig = Buffer.from(sig, 'binary'); + sig = Signature.parse(sig, type, 'asn1'); + sig.hashAlgorithm = hashAlgo; + sig.curve = curve; + return (sig); + }; + return (v); +}; + +PrivateKey.parse = function (data, format, options) { + if (typeof (data) !== 'string') + assert.buffer(data, 'data'); + if (format === undefined) + format = 'auto'; + assert.string(format, 'format'); + if (typeof (options) === 'string') + options = { filename: options }; + assert.optionalObject(options, 'options'); + if (options === undefined) + options = {}; + assert.optionalString(options.filename, 'options.filename'); + if (options.filename === undefined) + options.filename = '(unnamed)'; + + assert.object(formats[format], 'formats[format]'); + + try { + var k = formats[format].read(data, options); + assert.ok(k instanceof PrivateKey, 'key is not a private key'); + if (!k.comment) + k.comment = options.filename; + return (k); + } catch (e) { + if (e.name === 'KeyEncryptedError') + throw (e); + throw (new KeyParseError(options.filename, format, e)); + } +}; + +PrivateKey.isPrivateKey = function (obj, ver) { + return (utils.isCompatible(obj, PrivateKey, ver)); +}; + +PrivateKey.generate = function (type, options) { + if (options === undefined) + options = {}; + assert.object(options, 'options'); + + switch (type) { + case 'ecdsa': + if (options.curve === undefined) + options.curve = 'nistp256'; + assert.string(options.curve, 'options.curve'); + return (generateECDSA(options.curve)); + case 'ed25519': + return (generateED25519()); + default: + throw (new Error('Key generation not supported with key ' + + 'type "' + type + '"')); + } +}; + +/* + * API versions for PrivateKey: + * [1,0] -- initial ver + * [1,1] -- added auto, pkcs[18], openssh/ssh-private formats + * [1,2] -- added defaultHashAlgorithm + * [1,3] -- added derive, ed, createDH + * [1,4] -- first tagged version + * [1,5] -- changed ed25519 part names and format + */ +PrivateKey.prototype._sshpkApiVersion = [1, 5]; + +PrivateKey._oldVersionDetect = function (obj) { + assert.func(obj.toPublic); + assert.func(obj.createSign); + if (obj.derive) + return ([1, 3]); + if (obj.defaultHashAlgorithm) + return ([1, 2]); + if (obj.formats['auto']) + return ([1, 1]); + return ([1, 0]); +}; + + +/***/ }), +/* 34 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.wrapLifecycle = exports.run = exports.install = exports.Install = undefined; + +var _extends2; + +function _load_extends() { + return _extends2 = _interopRequireDefault(__webpack_require__(22)); +} + +var _asyncToGenerator2; + +function _load_asyncToGenerator() { + return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(2)); +} + +let install = exports.install = (() => { + var _ref29 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, lockfile) { + yield wrapLifecycle(config, flags, (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + const install = new Install(flags, config, reporter, lockfile); + yield install.init(); + })); + }); + + return function install(_x7, _x8, _x9, _x10) { + return _ref29.apply(this, arguments); + }; +})(); + +let run = exports.run = (() => { + var _ref31 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { + let lockfile; + let error = 'installCommandRenamed'; + if (flags.lockfile === false) { + lockfile = new (_lockfile || _load_lockfile()).default(); + } else { + lockfile = yield (_lockfile || _load_lockfile()).default.fromDirectory(config.lockfileFolder, reporter); + } + + if (args.length) { + const exampleArgs = args.slice(); + + if (flags.saveDev) { + exampleArgs.push('--dev'); + } + if (flags.savePeer) { + exampleArgs.push('--peer'); + } + if (flags.saveOptional) { + exampleArgs.push('--optional'); + } + if (flags.saveExact) { + exampleArgs.push('--exact'); + } + if (flags.saveTilde) { + exampleArgs.push('--tilde'); + } + let command = 'add'; + if (flags.global) { + error = 'globalFlagRemoved'; + command = 'global add'; + } + throw new (_errors || _load_errors()).MessageError(reporter.lang(error, `yarn ${command} ${exampleArgs.join(' ')}`)); + } + + yield install(config, reporter, flags, lockfile); + }); + + return function run(_x11, _x12, _x13, _x14) { + return _ref31.apply(this, arguments); + }; +})(); + +let wrapLifecycle = exports.wrapLifecycle = (() => { + var _ref32 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, flags, factory) { + yield config.executeLifecycleScript('preinstall'); + + yield factory(); + + // npm behaviour, seems kinda funky but yay compatibility + yield config.executeLifecycleScript('install'); + yield config.executeLifecycleScript('postinstall'); + + if (!config.production) { + if (!config.disablePrepublish) { + yield config.executeLifecycleScript('prepublish'); + } + yield config.executeLifecycleScript('prepare'); + } + }); + + return function wrapLifecycle(_x15, _x16, _x17) { + return _ref32.apply(this, arguments); + }; +})(); + +exports.hasWrapper = hasWrapper; +exports.setFlags = setFlags; + +var _objectPath; + +function _load_objectPath() { + return _objectPath = _interopRequireDefault(__webpack_require__(304)); +} + +var _hooks; + +function _load_hooks() { + return _hooks = __webpack_require__(374); +} + +var _index; + +function _load_index() { + return _index = _interopRequireDefault(__webpack_require__(220)); +} + +var _errors; + +function _load_errors() { + return _errors = __webpack_require__(6); +} + +var _integrityChecker; + +function _load_integrityChecker() { + return _integrityChecker = _interopRequireDefault(__webpack_require__(208)); +} + +var _lockfile; + +function _load_lockfile() { + return _lockfile = _interopRequireDefault(__webpack_require__(19)); +} + +var _lockfile2; + +function _load_lockfile2() { + return _lockfile2 = __webpack_require__(19); +} + +var _packageFetcher; + +function _load_packageFetcher() { + return _packageFetcher = _interopRequireWildcard(__webpack_require__(210)); +} + +var _packageInstallScripts; + +function _load_packageInstallScripts() { + return _packageInstallScripts = _interopRequireDefault(__webpack_require__(557)); +} + +var _packageCompatibility; + +function _load_packageCompatibility() { + return _packageCompatibility = _interopRequireWildcard(__webpack_require__(209)); +} + +var _packageResolver; + +function _load_packageResolver() { + return _packageResolver = _interopRequireDefault(__webpack_require__(366)); +} + +var _packageLinker; + +function _load_packageLinker() { + return _packageLinker = _interopRequireDefault(__webpack_require__(211)); +} + +var _index2; + +function _load_index2() { + return _index2 = __webpack_require__(57); +} + +var _index3; + +function _load_index3() { + return _index3 = __webpack_require__(78); +} + +var _autoclean; + +function _load_autoclean() { + return _autoclean = __webpack_require__(354); +} + +var _constants; + +function _load_constants() { + return _constants = _interopRequireWildcard(__webpack_require__(8)); +} + +var _normalizePattern; + +function _load_normalizePattern() { + return _normalizePattern = __webpack_require__(37); +} + +var _fs; + +function _load_fs() { + return _fs = _interopRequireWildcard(__webpack_require__(4)); +} + +var _map; + +function _load_map() { + return _map = _interopRequireDefault(__webpack_require__(29)); +} + +var _yarnVersion; + +function _load_yarnVersion() { + return _yarnVersion = __webpack_require__(120); +} + +var _generatePnpMap; + +function _load_generatePnpMap() { + return _generatePnpMap = __webpack_require__(579); +} + +var _workspaceLayout; + +function _load_workspaceLayout() { + return _workspaceLayout = _interopRequireDefault(__webpack_require__(90)); +} + +var _resolutionMap; + +function _load_resolutionMap() { + return _resolutionMap = _interopRequireDefault(__webpack_require__(214)); +} + +var _guessName; + +function _load_guessName() { + return _guessName = _interopRequireDefault(__webpack_require__(169)); +} + +var _audit; + +function _load_audit() { + return _audit = _interopRequireDefault(__webpack_require__(353)); +} + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const deepEqual = __webpack_require__(631); + +const emoji = __webpack_require__(302); +const invariant = __webpack_require__(9); +const path = __webpack_require__(0); +const semver = __webpack_require__(21); +const uuid = __webpack_require__(119); +const ssri = __webpack_require__(77); + +const ONE_DAY = 1000 * 60 * 60 * 24; + +/** + * Try and detect the installation method for Yarn and provide a command to update it with. + */ + +function getUpdateCommand(installationMethod) { + if (installationMethod === 'tar') { + return `curl --compressed -o- -L ${(_constants || _load_constants()).YARN_INSTALLER_SH} | bash`; + } + + if (installationMethod === 'homebrew') { + return 'brew upgrade yarn'; + } + + if (installationMethod === 'deb') { + return 'sudo apt-get update && sudo apt-get install yarn'; + } + + if (installationMethod === 'rpm') { + return 'sudo yum install yarn'; + } + + if (installationMethod === 'npm') { + return 'npm install --global yarn'; + } + + if (installationMethod === 'chocolatey') { + return 'choco upgrade yarn'; + } + + if (installationMethod === 'apk') { + return 'apk update && apk add -u yarn'; + } + + if (installationMethod === 'portage') { + return 'sudo emerge --sync && sudo emerge -au sys-apps/yarn'; + } + + return null; +} + +function getUpdateInstaller(installationMethod) { + // Windows + if (installationMethod === 'msi') { + return (_constants || _load_constants()).YARN_INSTALLER_MSI; + } + + return null; +} + +function normalizeFlags(config, rawFlags) { + const flags = { + // install + har: !!rawFlags.har, + ignorePlatform: !!rawFlags.ignorePlatform, + ignoreEngines: !!rawFlags.ignoreEngines, + ignoreScripts: !!rawFlags.ignoreScripts, + ignoreOptional: !!rawFlags.ignoreOptional, + force: !!rawFlags.force, + flat: !!rawFlags.flat, + lockfile: rawFlags.lockfile !== false, + pureLockfile: !!rawFlags.pureLockfile, + updateChecksums: !!rawFlags.updateChecksums, + skipIntegrityCheck: !!rawFlags.skipIntegrityCheck, + frozenLockfile: !!rawFlags.frozenLockfile, + linkDuplicates: !!rawFlags.linkDuplicates, + checkFiles: !!rawFlags.checkFiles, + audit: !!rawFlags.audit, + + // add + peer: !!rawFlags.peer, + dev: !!rawFlags.dev, + optional: !!rawFlags.optional, + exact: !!rawFlags.exact, + tilde: !!rawFlags.tilde, + ignoreWorkspaceRootCheck: !!rawFlags.ignoreWorkspaceRootCheck, + + // outdated, update-interactive + includeWorkspaceDeps: !!rawFlags.includeWorkspaceDeps, + + // add, remove, update + workspaceRootIsCwd: rawFlags.workspaceRootIsCwd !== false + }; + + if (config.getOption('ignore-scripts')) { + flags.ignoreScripts = true; + } + + if (config.getOption('ignore-platform')) { + flags.ignorePlatform = true; + } + + if (config.getOption('ignore-engines')) { + flags.ignoreEngines = true; + } + + if (config.getOption('ignore-optional')) { + flags.ignoreOptional = true; + } + + if (config.getOption('force')) { + flags.force = true; + } + + return flags; +} + +class Install { + constructor(flags, config, reporter, lockfile) { + this.rootManifestRegistries = []; + this.rootPatternsToOrigin = (0, (_map || _load_map()).default)(); + this.lockfile = lockfile; + this.reporter = reporter; + this.config = config; + this.flags = normalizeFlags(config, flags); + this.resolutions = (0, (_map || _load_map()).default)(); // Legacy resolutions field used for flat install mode + this.resolutionMap = new (_resolutionMap || _load_resolutionMap()).default(config); // Selective resolutions for nested dependencies + this.resolver = new (_packageResolver || _load_packageResolver()).default(config, lockfile, this.resolutionMap); + this.integrityChecker = new (_integrityChecker || _load_integrityChecker()).default(config); + this.linker = new (_packageLinker || _load_packageLinker()).default(config, this.resolver); + this.scripts = new (_packageInstallScripts || _load_packageInstallScripts()).default(config, this.resolver, this.flags.force); + } + + /** + * Create a list of dependency requests from the current directories manifests. + */ + + fetchRequestFromCwd(excludePatterns = [], ignoreUnusedPatterns = false) { + var _this = this; + + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + const patterns = []; + const deps = []; + let resolutionDeps = []; + const manifest = {}; + + const ignorePatterns = []; + const usedPatterns = []; + let workspaceLayout; + + // some commands should always run in the context of the entire workspace + const cwd = _this.flags.includeWorkspaceDeps || _this.flags.workspaceRootIsCwd ? _this.config.lockfileFolder : _this.config.cwd; + + // non-workspaces are always root, otherwise check for workspace root + const cwdIsRoot = !_this.config.workspaceRootFolder || _this.config.lockfileFolder === cwd; + + // exclude package names that are in install args + const excludeNames = []; + for (var _iterator = excludePatterns, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + const pattern = _ref; + + if ((0, (_index3 || _load_index3()).getExoticResolver)(pattern)) { + excludeNames.push((0, (_guessName || _load_guessName()).default)(pattern)); + } else { + // extract the name + const parts = (0, (_normalizePattern || _load_normalizePattern()).normalizePattern)(pattern); + excludeNames.push(parts.name); + } + } + + const stripExcluded = function stripExcluded(manifest) { + for (var _iterator2 = excludeNames, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + const exclude = _ref2; + + if (manifest.dependencies && manifest.dependencies[exclude]) { + delete manifest.dependencies[exclude]; + } + if (manifest.devDependencies && manifest.devDependencies[exclude]) { + delete manifest.devDependencies[exclude]; + } + if (manifest.optionalDependencies && manifest.optionalDependencies[exclude]) { + delete manifest.optionalDependencies[exclude]; + } + } + }; + + for (var _iterator3 = Object.keys((_index2 || _load_index2()).registries), _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { + var _ref3; + + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref3 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref3 = _i3.value; + } + + const registry = _ref3; + + const filename = (_index2 || _load_index2()).registries[registry].filename; + + const loc = path.join(cwd, filename); + if (!(yield (_fs || _load_fs()).exists(loc))) { + continue; + } + + _this.rootManifestRegistries.push(registry); + + const projectManifestJson = yield _this.config.readJson(loc); + yield (0, (_index || _load_index()).default)(projectManifestJson, cwd, _this.config, cwdIsRoot); + + Object.assign(_this.resolutions, projectManifestJson.resolutions); + Object.assign(manifest, projectManifestJson); + + _this.resolutionMap.init(_this.resolutions); + for (var _iterator4 = Object.keys(_this.resolutionMap.resolutionsByPackage), _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) { + var _ref4; + + if (_isArray4) { + if (_i4 >= _iterator4.length) break; + _ref4 = _iterator4[_i4++]; + } else { + _i4 = _iterator4.next(); + if (_i4.done) break; + _ref4 = _i4.value; + } + + const packageName = _ref4; + + const optional = (_objectPath || _load_objectPath()).default.has(manifest.optionalDependencies, packageName) && _this.flags.ignoreOptional; + for (var _iterator8 = _this.resolutionMap.resolutionsByPackage[packageName], _isArray8 = Array.isArray(_iterator8), _i8 = 0, _iterator8 = _isArray8 ? _iterator8 : _iterator8[Symbol.iterator]();;) { + var _ref9; + + if (_isArray8) { + if (_i8 >= _iterator8.length) break; + _ref9 = _iterator8[_i8++]; + } else { + _i8 = _iterator8.next(); + if (_i8.done) break; + _ref9 = _i8.value; + } + + const _ref8 = _ref9; + const pattern = _ref8.pattern; + + resolutionDeps = [...resolutionDeps, { registry, pattern, optional, hint: 'resolution' }]; + } + } + + const pushDeps = function pushDeps(depType, manifest, { hint, optional }, isUsed) { + if (ignoreUnusedPatterns && !isUsed) { + return; + } + // We only take unused dependencies into consideration to get deterministic hoisting. + // Since flat mode doesn't care about hoisting and everything is top level and specified then we can safely + // leave these out. + if (_this.flags.flat && !isUsed) { + return; + } + const depMap = manifest[depType]; + for (const name in depMap) { + if (excludeNames.indexOf(name) >= 0) { + continue; + } + + let pattern = name; + if (!_this.lockfile.getLocked(pattern)) { + // when we use --save we save the dependency to the lockfile with just the name rather than the + // version combo + pattern += '@' + depMap[name]; + } + + // normalization made sure packages are mentioned only once + if (isUsed) { + usedPatterns.push(pattern); + } else { + ignorePatterns.push(pattern); + } + + _this.rootPatternsToOrigin[pattern] = depType; + patterns.push(pattern); + deps.push({ pattern, registry, hint, optional, workspaceName: manifest.name, workspaceLoc: manifest._loc }); + } + }; + + if (cwdIsRoot) { + pushDeps('dependencies', projectManifestJson, { hint: null, optional: false }, true); + pushDeps('devDependencies', projectManifestJson, { hint: 'dev', optional: false }, !_this.config.production); + pushDeps('optionalDependencies', projectManifestJson, { hint: 'optional', optional: true }, true); + } + + if (_this.config.workspaceRootFolder) { + const workspaceLoc = cwdIsRoot ? loc : path.join(_this.config.lockfileFolder, filename); + const workspacesRoot = path.dirname(workspaceLoc); + + let workspaceManifestJson = projectManifestJson; + if (!cwdIsRoot) { + // the manifest we read before was a child workspace, so get the root + workspaceManifestJson = yield _this.config.readJson(workspaceLoc); + yield (0, (_index || _load_index()).default)(workspaceManifestJson, workspacesRoot, _this.config, true); + } + + const workspaces = yield _this.config.resolveWorkspaces(workspacesRoot, workspaceManifestJson); + workspaceLayout = new (_workspaceLayout || _load_workspaceLayout()).default(workspaces, _this.config); + + // add virtual manifest that depends on all workspaces, this way package hoisters and resolvers will work fine + const workspaceDependencies = (0, (_extends2 || _load_extends()).default)({}, workspaceManifestJson.dependencies); + for (var _iterator5 = Object.keys(workspaces), _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) { + var _ref5; + + if (_isArray5) { + if (_i5 >= _iterator5.length) break; + _ref5 = _iterator5[_i5++]; + } else { + _i5 = _iterator5.next(); + if (_i5.done) break; + _ref5 = _i5.value; + } + + const workspaceName = _ref5; + + const workspaceManifest = workspaces[workspaceName].manifest; + workspaceDependencies[workspaceName] = workspaceManifest.version; + + // include dependencies from all workspaces + if (_this.flags.includeWorkspaceDeps) { + pushDeps('dependencies', workspaceManifest, { hint: null, optional: false }, true); + pushDeps('devDependencies', workspaceManifest, { hint: 'dev', optional: false }, !_this.config.production); + pushDeps('optionalDependencies', workspaceManifest, { hint: 'optional', optional: true }, true); + } + } + const virtualDependencyManifest = { + _uid: '', + name: `workspace-aggregator-${uuid.v4()}`, + version: '1.0.0', + _registry: 'npm', + _loc: workspacesRoot, + dependencies: workspaceDependencies, + devDependencies: (0, (_extends2 || _load_extends()).default)({}, workspaceManifestJson.devDependencies), + optionalDependencies: (0, (_extends2 || _load_extends()).default)({}, workspaceManifestJson.optionalDependencies), + private: workspaceManifestJson.private, + workspaces: workspaceManifestJson.workspaces + }; + workspaceLayout.virtualManifestName = virtualDependencyManifest.name; + const virtualDep = {}; + virtualDep[virtualDependencyManifest.name] = virtualDependencyManifest.version; + workspaces[virtualDependencyManifest.name] = { loc: workspacesRoot, manifest: virtualDependencyManifest }; + + // ensure dependencies that should be excluded are stripped from the correct manifest + stripExcluded(cwdIsRoot ? virtualDependencyManifest : workspaces[projectManifestJson.name].manifest); + + pushDeps('workspaces', { workspaces: virtualDep }, { hint: 'workspaces', optional: false }, true); + + const implicitWorkspaceDependencies = (0, (_extends2 || _load_extends()).default)({}, workspaceDependencies); + + for (var _iterator6 = (_constants || _load_constants()).OWNED_DEPENDENCY_TYPES, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : _iterator6[Symbol.iterator]();;) { + var _ref6; + + if (_isArray6) { + if (_i6 >= _iterator6.length) break; + _ref6 = _iterator6[_i6++]; + } else { + _i6 = _iterator6.next(); + if (_i6.done) break; + _ref6 = _i6.value; + } + + const type = _ref6; + + for (var _iterator7 = Object.keys(projectManifestJson[type] || {}), _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : _iterator7[Symbol.iterator]();;) { + var _ref7; + + if (_isArray7) { + if (_i7 >= _iterator7.length) break; + _ref7 = _iterator7[_i7++]; + } else { + _i7 = _iterator7.next(); + if (_i7.done) break; + _ref7 = _i7.value; + } + + const dependencyName = _ref7; + + delete implicitWorkspaceDependencies[dependencyName]; + } + } + + pushDeps('dependencies', { dependencies: implicitWorkspaceDependencies }, { hint: 'workspaces', optional: false }, true); + } + + break; + } + + // inherit root flat flag + if (manifest.flat) { + _this.flags.flat = true; + } + + return { + requests: [...resolutionDeps, ...deps], + patterns, + manifest, + usedPatterns, + ignorePatterns, + workspaceLayout + }; + })(); + } + + /** + * TODO description + */ + + prepareRequests(requests) { + return requests; + } + + preparePatterns(patterns) { + return patterns; + } + preparePatternsForLinking(patterns, cwdManifest, cwdIsRoot) { + return patterns; + } + + prepareManifests() { + var _this2 = this; + + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + const manifests = yield _this2.config.getRootManifests(); + return manifests; + })(); + } + + bailout(patterns, workspaceLayout) { + var _this3 = this; + + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + // We don't want to skip the audit - it could yield important errors + if (_this3.flags.audit) { + return false; + } + // PNP is so fast that the integrity check isn't pertinent + if (_this3.config.plugnplayEnabled) { + return false; + } + if (_this3.flags.skipIntegrityCheck || _this3.flags.force) { + return false; + } + const lockfileCache = _this3.lockfile.cache; + if (!lockfileCache) { + return false; + } + const lockfileClean = _this3.lockfile.parseResultType === 'success'; + const match = yield _this3.integrityChecker.check(patterns, lockfileCache, _this3.flags, workspaceLayout); + if (_this3.flags.frozenLockfile && (!lockfileClean || match.missingPatterns.length > 0)) { + throw new (_errors || _load_errors()).MessageError(_this3.reporter.lang('frozenLockfileError')); + } + + const haveLockfile = yield (_fs || _load_fs()).exists(path.join(_this3.config.lockfileFolder, (_constants || _load_constants()).LOCKFILE_FILENAME)); + + const lockfileIntegrityPresent = !_this3.lockfile.hasEntriesExistWithoutIntegrity(); + const integrityBailout = lockfileIntegrityPresent || !_this3.config.autoAddIntegrity; + + if (match.integrityMatches && haveLockfile && lockfileClean && integrityBailout) { + _this3.reporter.success(_this3.reporter.lang('upToDate')); + return true; + } + + if (match.integrityFileMissing && haveLockfile) { + // Integrity file missing, force script installations + _this3.scripts.setForce(true); + return false; + } + + if (match.hardRefreshRequired) { + // e.g. node version doesn't match, force script installations + _this3.scripts.setForce(true); + return false; + } + + if (!patterns.length && !match.integrityFileMissing) { + _this3.reporter.success(_this3.reporter.lang('nothingToInstall')); + yield _this3.createEmptyManifestFolders(); + yield _this3.saveLockfileAndIntegrity(patterns, workspaceLayout); + return true; + } + + return false; + })(); + } + + /** + * Produce empty folders for all used root manifests. + */ + + createEmptyManifestFolders() { + var _this4 = this; + + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + if (_this4.config.modulesFolder) { + // already created + return; + } + + for (var _iterator9 = _this4.rootManifestRegistries, _isArray9 = Array.isArray(_iterator9), _i9 = 0, _iterator9 = _isArray9 ? _iterator9 : _iterator9[Symbol.iterator]();;) { + var _ref10; + + if (_isArray9) { + if (_i9 >= _iterator9.length) break; + _ref10 = _iterator9[_i9++]; + } else { + _i9 = _iterator9.next(); + if (_i9.done) break; + _ref10 = _i9.value; + } + + const registryName = _ref10; + const folder = _this4.config.registries[registryName].folder; + + yield (_fs || _load_fs()).mkdirp(path.join(_this4.config.lockfileFolder, folder)); + } + })(); + } + + /** + * TODO description + */ + + markIgnored(patterns) { + for (var _iterator10 = patterns, _isArray10 = Array.isArray(_iterator10), _i10 = 0, _iterator10 = _isArray10 ? _iterator10 : _iterator10[Symbol.iterator]();;) { + var _ref11; + + if (_isArray10) { + if (_i10 >= _iterator10.length) break; + _ref11 = _iterator10[_i10++]; + } else { + _i10 = _iterator10.next(); + if (_i10.done) break; + _ref11 = _i10.value; + } + + const pattern = _ref11; + + const manifest = this.resolver.getStrictResolvedPattern(pattern); + const ref = manifest._reference; + invariant(ref, 'expected package reference'); + + // just mark the package as ignored. if the package is used by a required package, the hoister + // will take care of that. + ref.ignore = true; + } + } + + /** + * helper method that gets only recent manifests + * used by global.ls command + */ + getFlattenedDeps() { + var _this5 = this; + + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + var _ref12 = yield _this5.fetchRequestFromCwd(); + + const depRequests = _ref12.requests, + rawPatterns = _ref12.patterns; + + + yield _this5.resolver.init(depRequests, {}); + + const manifests = yield (_packageFetcher || _load_packageFetcher()).fetch(_this5.resolver.getManifests(), _this5.config); + _this5.resolver.updateManifests(manifests); + + return _this5.flatten(rawPatterns); + })(); + } + + /** + * TODO description + */ + + init() { + var _this6 = this; + + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + _this6.checkUpdate(); + + // warn if we have a shrinkwrap + if (yield (_fs || _load_fs()).exists(path.join(_this6.config.lockfileFolder, (_constants || _load_constants()).NPM_SHRINKWRAP_FILENAME))) { + _this6.reporter.warn(_this6.reporter.lang('shrinkwrapWarning')); + } + + // warn if we have an npm lockfile + if (yield (_fs || _load_fs()).exists(path.join(_this6.config.lockfileFolder, (_constants || _load_constants()).NPM_LOCK_FILENAME))) { + _this6.reporter.warn(_this6.reporter.lang('npmLockfileWarning')); + } + + if (_this6.config.plugnplayEnabled) { + _this6.reporter.info(_this6.reporter.lang('plugnplaySuggestV2L1')); + _this6.reporter.info(_this6.reporter.lang('plugnplaySuggestV2L2')); + } + + let flattenedTopLevelPatterns = []; + const steps = []; + + var _ref13 = yield _this6.fetchRequestFromCwd(); + + const depRequests = _ref13.requests, + rawPatterns = _ref13.patterns, + ignorePatterns = _ref13.ignorePatterns, + workspaceLayout = _ref13.workspaceLayout, + manifest = _ref13.manifest; + + let topLevelPatterns = []; + + const artifacts = yield _this6.integrityChecker.getArtifacts(); + if (artifacts) { + _this6.linker.setArtifacts(artifacts); + _this6.scripts.setArtifacts(artifacts); + } + + if ((_packageCompatibility || _load_packageCompatibility()).shouldCheck(manifest, _this6.flags)) { + steps.push((() => { + var _ref14 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (curr, total) { + _this6.reporter.step(curr, total, _this6.reporter.lang('checkingManifest'), emoji.get('mag')); + yield _this6.checkCompatibility(); + }); + + return function (_x, _x2) { + return _ref14.apply(this, arguments); + }; + })()); + } + + const audit = new (_audit || _load_audit()).default(_this6.config, _this6.reporter, { groups: (_constants || _load_constants()).OWNED_DEPENDENCY_TYPES }); + let auditFoundProblems = false; + + steps.push(function (curr, total) { + return (0, (_hooks || _load_hooks()).callThroughHook)('resolveStep', (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + _this6.reporter.step(curr, total, _this6.reporter.lang('resolvingPackages'), emoji.get('mag')); + yield _this6.resolver.init(_this6.prepareRequests(depRequests), { + isFlat: _this6.flags.flat, + isFrozen: _this6.flags.frozenLockfile, + workspaceLayout + }); + topLevelPatterns = _this6.preparePatterns(rawPatterns); + flattenedTopLevelPatterns = yield _this6.flatten(topLevelPatterns); + return { bailout: !_this6.flags.audit && (yield _this6.bailout(topLevelPatterns, workspaceLayout)) }; + })); + }); + + if (_this6.flags.audit) { + steps.push(function (curr, total) { + return (0, (_hooks || _load_hooks()).callThroughHook)('auditStep', (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + _this6.reporter.step(curr, total, _this6.reporter.lang('auditRunning'), emoji.get('mag')); + if (_this6.flags.offline) { + _this6.reporter.warn(_this6.reporter.lang('auditOffline')); + return { bailout: false }; + } + const preparedManifests = yield _this6.prepareManifests(); + // $FlowFixMe - Flow considers `m` in the map operation to be "mixed", so does not recognize `m.object` + const mergedManifest = Object.assign({}, ...Object.values(preparedManifests).map(function (m) { + return m.object; + })); + const auditVulnerabilityCounts = yield audit.performAudit(mergedManifest, _this6.lockfile, _this6.resolver, _this6.linker, topLevelPatterns); + auditFoundProblems = auditVulnerabilityCounts.info || auditVulnerabilityCounts.low || auditVulnerabilityCounts.moderate || auditVulnerabilityCounts.high || auditVulnerabilityCounts.critical; + return { bailout: yield _this6.bailout(topLevelPatterns, workspaceLayout) }; + })); + }); + } + + steps.push(function (curr, total) { + return (0, (_hooks || _load_hooks()).callThroughHook)('fetchStep', (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + _this6.markIgnored(ignorePatterns); + _this6.reporter.step(curr, total, _this6.reporter.lang('fetchingPackages'), emoji.get('truck')); + const manifests = yield (_packageFetcher || _load_packageFetcher()).fetch(_this6.resolver.getManifests(), _this6.config); + _this6.resolver.updateManifests(manifests); + yield (_packageCompatibility || _load_packageCompatibility()).check(_this6.resolver.getManifests(), _this6.config, _this6.flags.ignoreEngines); + })); + }); + + steps.push(function (curr, total) { + return (0, (_hooks || _load_hooks()).callThroughHook)('linkStep', (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + // remove integrity hash to make this operation atomic + yield _this6.integrityChecker.removeIntegrityFile(); + _this6.reporter.step(curr, total, _this6.reporter.lang('linkingDependencies'), emoji.get('link')); + flattenedTopLevelPatterns = _this6.preparePatternsForLinking(flattenedTopLevelPatterns, manifest, _this6.config.lockfileFolder === _this6.config.cwd); + yield _this6.linker.init(flattenedTopLevelPatterns, workspaceLayout, { + linkDuplicates: _this6.flags.linkDuplicates, + ignoreOptional: _this6.flags.ignoreOptional + }); + })); + }); + + if (_this6.config.plugnplayEnabled) { + steps.push(function (curr, total) { + return (0, (_hooks || _load_hooks()).callThroughHook)('pnpStep', (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + const pnpPath = `${_this6.config.lockfileFolder}/${(_constants || _load_constants()).PNP_FILENAME}`; + + const code = yield (0, (_generatePnpMap || _load_generatePnpMap()).generatePnpMap)(_this6.config, flattenedTopLevelPatterns, { + resolver: _this6.resolver, + reporter: _this6.reporter, + targetPath: pnpPath, + workspaceLayout + }); + + try { + const file = yield (_fs || _load_fs()).readFile(pnpPath); + if (file === code) { + return; + } + } catch (error) {} + + yield (_fs || _load_fs()).writeFile(pnpPath, code); + yield (_fs || _load_fs()).chmod(pnpPath, 0o755); + })); + }); + } + + steps.push(function (curr, total) { + return (0, (_hooks || _load_hooks()).callThroughHook)('buildStep', (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + _this6.reporter.step(curr, total, _this6.flags.force ? _this6.reporter.lang('rebuildingPackages') : _this6.reporter.lang('buildingFreshPackages'), emoji.get('hammer')); + + if (_this6.config.ignoreScripts) { + _this6.reporter.warn(_this6.reporter.lang('ignoredScripts')); + } else { + yield _this6.scripts.init(flattenedTopLevelPatterns); + } + })); + }); + + if (_this6.flags.har) { + steps.push((() => { + var _ref21 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (curr, total) { + const formattedDate = new Date().toISOString().replace(/:/g, '-'); + const filename = `yarn-install_${formattedDate}.har`; + _this6.reporter.step(curr, total, _this6.reporter.lang('savingHar', filename), emoji.get('black_circle_for_record')); + yield _this6.config.requestManager.saveHar(filename); + }); + + return function (_x3, _x4) { + return _ref21.apply(this, arguments); + }; + })()); + } + + if (yield _this6.shouldClean()) { + steps.push((() => { + var _ref22 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (curr, total) { + _this6.reporter.step(curr, total, _this6.reporter.lang('cleaningModules'), emoji.get('recycle')); + yield (0, (_autoclean || _load_autoclean()).clean)(_this6.config, _this6.reporter); + }); + + return function (_x5, _x6) { + return _ref22.apply(this, arguments); + }; + })()); + } + + let currentStep = 0; + for (var _iterator11 = steps, _isArray11 = Array.isArray(_iterator11), _i11 = 0, _iterator11 = _isArray11 ? _iterator11 : _iterator11[Symbol.iterator]();;) { + var _ref23; + + if (_isArray11) { + if (_i11 >= _iterator11.length) break; + _ref23 = _iterator11[_i11++]; + } else { + _i11 = _iterator11.next(); + if (_i11.done) break; + _ref23 = _i11.value; + } + + const step = _ref23; + + const stepResult = yield step(++currentStep, steps.length); + if (stepResult && stepResult.bailout) { + if (_this6.flags.audit) { + audit.summary(); + } + if (auditFoundProblems) { + _this6.reporter.warn(_this6.reporter.lang('auditRunAuditForDetails')); + } + _this6.maybeOutputUpdate(); + return flattenedTopLevelPatterns; + } + } + + // fin! + if (_this6.flags.audit) { + audit.summary(); + } + if (auditFoundProblems) { + _this6.reporter.warn(_this6.reporter.lang('auditRunAuditForDetails')); + } + yield _this6.saveLockfileAndIntegrity(topLevelPatterns, workspaceLayout); + yield _this6.persistChanges(); + _this6.maybeOutputUpdate(); + _this6.config.requestManager.clearCache(); + return flattenedTopLevelPatterns; + })(); + } + + checkCompatibility() { + var _this7 = this; + + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + var _ref24 = yield _this7.fetchRequestFromCwd(); + + const manifest = _ref24.manifest; + + yield (_packageCompatibility || _load_packageCompatibility()).checkOne(manifest, _this7.config, _this7.flags.ignoreEngines); + })(); + } + + persistChanges() { + var _this8 = this; + + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + // get all the different registry manifests in this folder + const manifests = yield _this8.config.getRootManifests(); + + if (yield _this8.applyChanges(manifests)) { + yield _this8.config.saveRootManifests(manifests); + } + })(); + } + + applyChanges(manifests) { + let hasChanged = false; + + if (this.config.plugnplayPersist) { + const object = manifests.npm.object; + + + if (typeof object.installConfig !== 'object') { + object.installConfig = {}; + } + + if (this.config.plugnplayEnabled && object.installConfig.pnp !== true) { + object.installConfig.pnp = true; + hasChanged = true; + } else if (!this.config.plugnplayEnabled && typeof object.installConfig.pnp !== 'undefined') { + delete object.installConfig.pnp; + hasChanged = true; + } + + if (Object.keys(object.installConfig).length === 0) { + delete object.installConfig; + } + } + + return Promise.resolve(hasChanged); + } + + /** + * Check if we should run the cleaning step. + */ + + shouldClean() { + return (_fs || _load_fs()).exists(path.join(this.config.lockfileFolder, (_constants || _load_constants()).CLEAN_FILENAME)); + } + + /** + * TODO + */ + + flatten(patterns) { + var _this9 = this; + + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + if (!_this9.flags.flat) { + return patterns; + } + + const flattenedPatterns = []; + + for (var _iterator12 = _this9.resolver.getAllDependencyNamesByLevelOrder(patterns), _isArray12 = Array.isArray(_iterator12), _i12 = 0, _iterator12 = _isArray12 ? _iterator12 : _iterator12[Symbol.iterator]();;) { + var _ref25; + + if (_isArray12) { + if (_i12 >= _iterator12.length) break; + _ref25 = _iterator12[_i12++]; + } else { + _i12 = _iterator12.next(); + if (_i12.done) break; + _ref25 = _i12.value; + } + + const name = _ref25; + + const infos = _this9.resolver.getAllInfoForPackageName(name).filter(function (manifest) { + const ref = manifest._reference; + invariant(ref, 'expected package reference'); + return !ref.ignore; + }); + + if (infos.length === 0) { + continue; + } + + if (infos.length === 1) { + // single version of this package + // take out a single pattern as multiple patterns may have resolved to this package + flattenedPatterns.push(_this9.resolver.patternsByPackage[name][0]); + continue; + } + + const options = infos.map(function (info) { + const ref = info._reference; + invariant(ref, 'expected reference'); + return { + // TODO `and is required by {PARENT}`, + name: _this9.reporter.lang('manualVersionResolutionOption', ref.patterns.join(', '), info.version), + + value: info.version + }; + }); + const versions = infos.map(function (info) { + return info.version; + }); + let version; + + const resolutionVersion = _this9.resolutions[name]; + if (resolutionVersion && versions.indexOf(resolutionVersion) >= 0) { + // use json `resolution` version + version = resolutionVersion; + } else { + version = yield _this9.reporter.select(_this9.reporter.lang('manualVersionResolution', name), _this9.reporter.lang('answer'), options); + _this9.resolutions[name] = version; + } + + flattenedPatterns.push(_this9.resolver.collapseAllVersionsOfPackage(name, version)); + } + + // save resolutions to their appropriate root manifest + if (Object.keys(_this9.resolutions).length) { + const manifests = yield _this9.config.getRootManifests(); + + for (const name in _this9.resolutions) { + const version = _this9.resolutions[name]; + + const patterns = _this9.resolver.patternsByPackage[name]; + if (!patterns) { + continue; + } + + let manifest; + for (var _iterator13 = patterns, _isArray13 = Array.isArray(_iterator13), _i13 = 0, _iterator13 = _isArray13 ? _iterator13 : _iterator13[Symbol.iterator]();;) { + var _ref26; + + if (_isArray13) { + if (_i13 >= _iterator13.length) break; + _ref26 = _iterator13[_i13++]; + } else { + _i13 = _iterator13.next(); + if (_i13.done) break; + _ref26 = _i13.value; + } + + const pattern = _ref26; + + manifest = _this9.resolver.getResolvedPattern(pattern); + if (manifest) { + break; + } + } + invariant(manifest, 'expected manifest'); + + const ref = manifest._reference; + invariant(ref, 'expected reference'); + + const object = manifests[ref.registry].object; + object.resolutions = object.resolutions || {}; + object.resolutions[name] = version; + } + + yield _this9.config.saveRootManifests(manifests); + } + + return flattenedPatterns; + })(); + } + + /** + * Remove offline tarballs that are no longer required + */ + + pruneOfflineMirror(lockfile) { + var _this10 = this; + + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + const mirror = _this10.config.getOfflineMirrorPath(); + if (!mirror) { + return; + } + + const requiredTarballs = new Set(); + for (const dependency in lockfile) { + const resolved = lockfile[dependency].resolved; + if (resolved) { + const basename = path.basename(resolved.split('#')[0]); + if (dependency[0] === '@' && basename[0] !== '@') { + requiredTarballs.add(`${dependency.split('/')[0]}-${basename}`); + } + requiredTarballs.add(basename); + } + } + + const mirrorFiles = yield (_fs || _load_fs()).walk(mirror); + for (var _iterator14 = mirrorFiles, _isArray14 = Array.isArray(_iterator14), _i14 = 0, _iterator14 = _isArray14 ? _iterator14 : _iterator14[Symbol.iterator]();;) { + var _ref27; + + if (_isArray14) { + if (_i14 >= _iterator14.length) break; + _ref27 = _iterator14[_i14++]; + } else { + _i14 = _iterator14.next(); + if (_i14.done) break; + _ref27 = _i14.value; + } + + const file = _ref27; + + const isTarball = path.extname(file.basename) === '.tgz'; + // if using experimental-pack-script-packages-in-mirror flag, don't unlink prebuilt packages + const hasPrebuiltPackage = file.relative.startsWith('prebuilt/'); + if (isTarball && !hasPrebuiltPackage && !requiredTarballs.has(file.basename)) { + yield (_fs || _load_fs()).unlink(file.absolute); + } + } + })(); + } + + /** + * Save updated integrity and lockfiles. + */ + + saveLockfileAndIntegrity(patterns, workspaceLayout) { + var _this11 = this; + + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + const resolvedPatterns = {}; + Object.keys(_this11.resolver.patterns).forEach(function (pattern) { + if (!workspaceLayout || !workspaceLayout.getManifestByPattern(pattern)) { + resolvedPatterns[pattern] = _this11.resolver.patterns[pattern]; + } + }); + + // TODO this code is duplicated in a few places, need a common way to filter out workspace patterns from lockfile + patterns = patterns.filter(function (p) { + return !workspaceLayout || !workspaceLayout.getManifestByPattern(p); + }); + + const lockfileBasedOnResolver = _this11.lockfile.getLockfile(resolvedPatterns); + + if (_this11.config.pruneOfflineMirror) { + yield _this11.pruneOfflineMirror(lockfileBasedOnResolver); + } + + // write integrity hash + if (!_this11.config.plugnplayEnabled) { + yield _this11.integrityChecker.save(patterns, lockfileBasedOnResolver, _this11.flags, workspaceLayout, _this11.scripts.getArtifacts()); + } + + // --no-lockfile or --pure-lockfile or --frozen-lockfile + if (_this11.flags.lockfile === false || _this11.flags.pureLockfile || _this11.flags.frozenLockfile) { + return; + } + + const lockFileHasAllPatterns = patterns.every(function (p) { + return _this11.lockfile.getLocked(p); + }); + const lockfilePatternsMatch = Object.keys(_this11.lockfile.cache || {}).every(function (p) { + return lockfileBasedOnResolver[p]; + }); + const resolverPatternsAreSameAsInLockfile = Object.keys(lockfileBasedOnResolver).every(function (pattern) { + const manifest = _this11.lockfile.getLocked(pattern); + return manifest && manifest.resolved === lockfileBasedOnResolver[pattern].resolved && deepEqual(manifest.prebuiltVariants, lockfileBasedOnResolver[pattern].prebuiltVariants); + }); + const integrityPatternsAreSameAsInLockfile = Object.keys(lockfileBasedOnResolver).every(function (pattern) { + const existingIntegrityInfo = lockfileBasedOnResolver[pattern].integrity; + if (!existingIntegrityInfo) { + // if this entry does not have an integrity, no need to re-write the lockfile because of it + return true; + } + const manifest = _this11.lockfile.getLocked(pattern); + if (manifest && manifest.integrity) { + const manifestIntegrity = ssri.stringify(manifest.integrity); + return manifestIntegrity === existingIntegrityInfo; + } + return false; + }); + + // remove command is followed by install with force, lockfile will be rewritten in any case then + if (!_this11.flags.force && _this11.lockfile.parseResultType === 'success' && lockFileHasAllPatterns && lockfilePatternsMatch && resolverPatternsAreSameAsInLockfile && integrityPatternsAreSameAsInLockfile && patterns.length) { + return; + } + + // build lockfile location + const loc = path.join(_this11.config.lockfileFolder, (_constants || _load_constants()).LOCKFILE_FILENAME); + + // write lockfile + const lockSource = (0, (_lockfile2 || _load_lockfile2()).stringify)(lockfileBasedOnResolver, false, _this11.config.enableLockfileVersions); + yield (_fs || _load_fs()).writeFilePreservingEol(loc, lockSource); + + _this11._logSuccessSaveLockfile(); + })(); + } + + _logSuccessSaveLockfile() { + this.reporter.success(this.reporter.lang('savedLockfile')); + } + + /** + * Load the dependency graph of the current install. Only does package resolving and wont write to the cwd. + */ + hydrate(ignoreUnusedPatterns) { + var _this12 = this; + + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + const request = yield _this12.fetchRequestFromCwd([], ignoreUnusedPatterns); + const depRequests = request.requests, + rawPatterns = request.patterns, + ignorePatterns = request.ignorePatterns, + workspaceLayout = request.workspaceLayout; + + + yield _this12.resolver.init(depRequests, { + isFlat: _this12.flags.flat, + isFrozen: _this12.flags.frozenLockfile, + workspaceLayout + }); + yield _this12.flatten(rawPatterns); + _this12.markIgnored(ignorePatterns); + + // fetch packages, should hit cache most of the time + const manifests = yield (_packageFetcher || _load_packageFetcher()).fetch(_this12.resolver.getManifests(), _this12.config); + _this12.resolver.updateManifests(manifests); + yield (_packageCompatibility || _load_packageCompatibility()).check(_this12.resolver.getManifests(), _this12.config, _this12.flags.ignoreEngines); + + // expand minimal manifests + for (var _iterator15 = _this12.resolver.getManifests(), _isArray15 = Array.isArray(_iterator15), _i15 = 0, _iterator15 = _isArray15 ? _iterator15 : _iterator15[Symbol.iterator]();;) { + var _ref28; + + if (_isArray15) { + if (_i15 >= _iterator15.length) break; + _ref28 = _iterator15[_i15++]; + } else { + _i15 = _iterator15.next(); + if (_i15.done) break; + _ref28 = _i15.value; + } + + const manifest = _ref28; + + const ref = manifest._reference; + invariant(ref, 'expected reference'); + const type = ref.remote.type; + // link specifier won't ever hit cache + + let loc = ''; + if (type === 'link') { + continue; + } else if (type === 'workspace') { + if (!ref.remote.reference) { + continue; + } + loc = ref.remote.reference; + } else { + loc = _this12.config.generateModuleCachePath(ref); + } + const newPkg = yield _this12.config.readManifest(loc); + yield _this12.resolver.updateManifest(ref, newPkg); + } + + return request; + })(); + } + + /** + * Check for updates every day and output a nag message if there's a newer version. + */ + + checkUpdate() { + if (this.config.nonInteractive) { + // don't show upgrade dialog on CI or non-TTY terminals + return; + } + + // don't check if disabled + if (this.config.getOption('disable-self-update-check')) { + return; + } + + // only check for updates once a day + const lastUpdateCheck = Number(this.config.getOption('lastUpdateCheck')) || 0; + if (lastUpdateCheck && Date.now() - lastUpdateCheck < ONE_DAY) { + return; + } + + // don't bug for updates on tagged releases + if ((_yarnVersion || _load_yarnVersion()).version.indexOf('-') >= 0) { + return; + } + + this._checkUpdate().catch(() => { + // swallow errors + }); + } + + _checkUpdate() { + var _this13 = this; + + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + let latestVersion = yield _this13.config.requestManager.request({ + url: (_constants || _load_constants()).SELF_UPDATE_VERSION_URL + }); + invariant(typeof latestVersion === 'string', 'expected string'); + latestVersion = latestVersion.trim(); + if (!semver.valid(latestVersion)) { + return; + } + + // ensure we only check for updates periodically + _this13.config.registries.yarn.saveHomeConfig({ + lastUpdateCheck: Date.now() + }); + + if (semver.gt(latestVersion, (_yarnVersion || _load_yarnVersion()).version)) { + const installationMethod = yield (0, (_yarnVersion || _load_yarnVersion()).getInstallationMethod)(); + _this13.maybeOutputUpdate = function () { + _this13.reporter.warn(_this13.reporter.lang('yarnOutdated', latestVersion, (_yarnVersion || _load_yarnVersion()).version)); + + const command = getUpdateCommand(installationMethod); + if (command) { + _this13.reporter.info(_this13.reporter.lang('yarnOutdatedCommand')); + _this13.reporter.command(command); + } else { + const installer = getUpdateInstaller(installationMethod); + if (installer) { + _this13.reporter.info(_this13.reporter.lang('yarnOutdatedInstaller', installer)); + } + } + }; + } + })(); + } + + /** + * Method to override with a possible upgrade message. + */ + + maybeOutputUpdate() {} +} + +exports.Install = Install; +function hasWrapper(commander, args) { + return true; +} + +function setFlags(commander) { + commander.description('Yarn install is used to install all dependencies for a project.'); + commander.usage('install [flags]'); + commander.option('-A, --audit', 'Run vulnerability audit on installed packages'); + commander.option('-g, --global', 'DEPRECATED'); + commander.option('-S, --save', 'DEPRECATED - save package to your `dependencies`'); + commander.option('-D, --save-dev', 'DEPRECATED - save package to your `devDependencies`'); + commander.option('-P, --save-peer', 'DEPRECATED - save package to your `peerDependencies`'); + commander.option('-O, --save-optional', 'DEPRECATED - save package to your `optionalDependencies`'); + commander.option('-E, --save-exact', 'DEPRECATED'); + commander.option('-T, --save-tilde', 'DEPRECATED'); +} + +/***/ }), +/* 35 */ +/***/ (function(module, exports, __webpack_require__) { + +var isObject = __webpack_require__(52); +module.exports = function (it) { + if (!isObject(it)) throw TypeError(it + ' is not an object!'); + return it; +}; + + +/***/ }), +/* 36 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return SubjectSubscriber; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Subject; }); +/* unused harmony export AnonymousSubject */ +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_tslib__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Observable__ = __webpack_require__(11); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Subscriber__ = __webpack_require__(7); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Subscription__ = __webpack_require__(25); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_ObjectUnsubscribedError__ = __webpack_require__(189); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__SubjectSubscription__ = __webpack_require__(422); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__internal_symbol_rxSubscriber__ = __webpack_require__(321); +/** PURE_IMPORTS_START tslib,_Observable,_Subscriber,_Subscription,_util_ObjectUnsubscribedError,_SubjectSubscription,_internal_symbol_rxSubscriber PURE_IMPORTS_END */ + + + + + + + +var SubjectSubscriber = /*@__PURE__*/ (function (_super) { + __WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __extends */](SubjectSubscriber, _super); + function SubjectSubscriber(destination) { + var _this = _super.call(this, destination) || this; + _this.destination = destination; + return _this; + } + return SubjectSubscriber; +}(__WEBPACK_IMPORTED_MODULE_2__Subscriber__["a" /* Subscriber */])); + +var Subject = /*@__PURE__*/ (function (_super) { + __WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __extends */](Subject, _super); + function Subject() { + var _this = _super.call(this) || this; + _this.observers = []; + _this.closed = false; + _this.isStopped = false; + _this.hasError = false; + _this.thrownError = null; + return _this; + } + Subject.prototype[__WEBPACK_IMPORTED_MODULE_6__internal_symbol_rxSubscriber__["a" /* rxSubscriber */]] = function () { + return new SubjectSubscriber(this); + }; + Subject.prototype.lift = function (operator) { + var subject = new AnonymousSubject(this, this); + subject.operator = operator; + return subject; + }; + Subject.prototype.next = function (value) { + if (this.closed) { + throw new __WEBPACK_IMPORTED_MODULE_4__util_ObjectUnsubscribedError__["a" /* ObjectUnsubscribedError */](); + } + if (!this.isStopped) { + var observers = this.observers; + var len = observers.length; + var copy = observers.slice(); + for (var i = 0; i < len; i++) { + copy[i].next(value); + } + } + }; + Subject.prototype.error = function (err) { + if (this.closed) { + throw new __WEBPACK_IMPORTED_MODULE_4__util_ObjectUnsubscribedError__["a" /* ObjectUnsubscribedError */](); + } + this.hasError = true; + this.thrownError = err; + this.isStopped = true; + var observers = this.observers; + var len = observers.length; + var copy = observers.slice(); + for (var i = 0; i < len; i++) { + copy[i].error(err); + } + this.observers.length = 0; + }; + Subject.prototype.complete = function () { + if (this.closed) { + throw new __WEBPACK_IMPORTED_MODULE_4__util_ObjectUnsubscribedError__["a" /* ObjectUnsubscribedError */](); + } + this.isStopped = true; + var observers = this.observers; + var len = observers.length; + var copy = observers.slice(); + for (var i = 0; i < len; i++) { + copy[i].complete(); + } + this.observers.length = 0; + }; + Subject.prototype.unsubscribe = function () { + this.isStopped = true; + this.closed = true; + this.observers = null; + }; + Subject.prototype._trySubscribe = function (subscriber) { + if (this.closed) { + throw new __WEBPACK_IMPORTED_MODULE_4__util_ObjectUnsubscribedError__["a" /* ObjectUnsubscribedError */](); + } + else { + return _super.prototype._trySubscribe.call(this, subscriber); + } + }; + Subject.prototype._subscribe = function (subscriber) { + if (this.closed) { + throw new __WEBPACK_IMPORTED_MODULE_4__util_ObjectUnsubscribedError__["a" /* ObjectUnsubscribedError */](); + } + else if (this.hasError) { + subscriber.error(this.thrownError); + return __WEBPACK_IMPORTED_MODULE_3__Subscription__["a" /* Subscription */].EMPTY; + } + else if (this.isStopped) { + subscriber.complete(); + return __WEBPACK_IMPORTED_MODULE_3__Subscription__["a" /* Subscription */].EMPTY; + } + else { + this.observers.push(subscriber); + return new __WEBPACK_IMPORTED_MODULE_5__SubjectSubscription__["a" /* SubjectSubscription */](this, subscriber); + } + }; + Subject.prototype.asObservable = function () { + var observable = new __WEBPACK_IMPORTED_MODULE_1__Observable__["a" /* Observable */](); + observable.source = this; + return observable; + }; + Subject.create = function (destination, source) { + return new AnonymousSubject(destination, source); + }; + return Subject; +}(__WEBPACK_IMPORTED_MODULE_1__Observable__["a" /* Observable */])); + +var AnonymousSubject = /*@__PURE__*/ (function (_super) { + __WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __extends */](AnonymousSubject, _super); + function AnonymousSubject(destination, source) { + var _this = _super.call(this) || this; + _this.destination = destination; + _this.source = source; + return _this; + } + AnonymousSubject.prototype.next = function (value) { + var destination = this.destination; + if (destination && destination.next) { + destination.next(value); + } + }; + AnonymousSubject.prototype.error = function (err) { + var destination = this.destination; + if (destination && destination.error) { + this.destination.error(err); + } + }; + AnonymousSubject.prototype.complete = function () { + var destination = this.destination; + if (destination && destination.complete) { + this.destination.complete(); + } + }; + AnonymousSubject.prototype._subscribe = function (subscriber) { + var source = this.source; + if (source) { + return this.source.subscribe(subscriber); + } + else { + return __WEBPACK_IMPORTED_MODULE_3__Subscription__["a" /* Subscription */].EMPTY; + } + }; + return AnonymousSubject; +}(Subject)); + +//# sourceMappingURL=Subject.js.map + + +/***/ }), +/* 37 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.normalizePattern = normalizePattern; + +/** + * Explode and normalize a pattern into its name and range. + */ + +function normalizePattern(pattern) { + let hasVersion = false; + let range = 'latest'; + let name = pattern; + + // if we're a scope then remove the @ and add it back later + let isScoped = false; + if (name[0] === '@') { + isScoped = true; + name = name.slice(1); + } + + // take first part as the name + const parts = name.split('@'); + if (parts.length > 1) { + name = parts.shift(); + range = parts.join('@'); + + if (range) { + hasVersion = true; + } else { + range = '*'; + } + } + + // add back @ scope suffix + if (isScoped) { + name = `@${name}`; + } + + return { name, range, hasVersion }; +} + +/***/ }), +/* 38 */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_RESULT__;/** + * @license + * Lodash + * Copyright JS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ +;(function() { + + /** Used as a safe reference for `undefined` in pre-ES5 environments. */ + var undefined; + + /** Used as the semantic version number. */ + var VERSION = '4.17.10'; + + /** Used as the size to enable large array optimizations. */ + var LARGE_ARRAY_SIZE = 200; + + /** Error message constants. */ + var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.', + FUNC_ERROR_TEXT = 'Expected a function'; + + /** Used to stand-in for `undefined` hash values. */ + var HASH_UNDEFINED = '__lodash_hash_undefined__'; + + /** Used as the maximum memoize cache size. */ + var MAX_MEMOIZE_SIZE = 500; + + /** Used as the internal argument placeholder. */ + var PLACEHOLDER = '__lodash_placeholder__'; + + /** Used to compose bitmasks for cloning. */ + var CLONE_DEEP_FLAG = 1, + CLONE_FLAT_FLAG = 2, + CLONE_SYMBOLS_FLAG = 4; + + /** Used to compose bitmasks for value comparisons. */ + var COMPARE_PARTIAL_FLAG = 1, + COMPARE_UNORDERED_FLAG = 2; + + /** Used to compose bitmasks for function metadata. */ + var WRAP_BIND_FLAG = 1, + WRAP_BIND_KEY_FLAG = 2, + WRAP_CURRY_BOUND_FLAG = 4, + WRAP_CURRY_FLAG = 8, + WRAP_CURRY_RIGHT_FLAG = 16, + WRAP_PARTIAL_FLAG = 32, + WRAP_PARTIAL_RIGHT_FLAG = 64, + WRAP_ARY_FLAG = 128, + WRAP_REARG_FLAG = 256, + WRAP_FLIP_FLAG = 512; + + /** Used as default options for `_.truncate`. */ + var DEFAULT_TRUNC_LENGTH = 30, + DEFAULT_TRUNC_OMISSION = '...'; + + /** Used to detect hot functions by number of calls within a span of milliseconds. */ + var HOT_COUNT = 800, + HOT_SPAN = 16; + + /** Used to indicate the type of lazy iteratees. */ + var LAZY_FILTER_FLAG = 1, + LAZY_MAP_FLAG = 2, + LAZY_WHILE_FLAG = 3; + + /** Used as references for various `Number` constants. */ + var INFINITY = 1 / 0, + MAX_SAFE_INTEGER = 9007199254740991, + MAX_INTEGER = 1.7976931348623157e+308, + NAN = 0 / 0; + + /** Used as references for the maximum length and index of an array. */ + var MAX_ARRAY_LENGTH = 4294967295, + MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, + HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; + + /** Used to associate wrap methods with their bit flags. */ + var wrapFlags = [ + ['ary', WRAP_ARY_FLAG], + ['bind', WRAP_BIND_FLAG], + ['bindKey', WRAP_BIND_KEY_FLAG], + ['curry', WRAP_CURRY_FLAG], + ['curryRight', WRAP_CURRY_RIGHT_FLAG], + ['flip', WRAP_FLIP_FLAG], + ['partial', WRAP_PARTIAL_FLAG], + ['partialRight', WRAP_PARTIAL_RIGHT_FLAG], + ['rearg', WRAP_REARG_FLAG] + ]; + + /** `Object#toString` result references. */ + var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + asyncTag = '[object AsyncFunction]', + boolTag = '[object Boolean]', + dateTag = '[object Date]', + domExcTag = '[object DOMException]', + errorTag = '[object Error]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + mapTag = '[object Map]', + numberTag = '[object Number]', + nullTag = '[object Null]', + objectTag = '[object Object]', + promiseTag = '[object Promise]', + proxyTag = '[object Proxy]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + symbolTag = '[object Symbol]', + undefinedTag = '[object Undefined]', + weakMapTag = '[object WeakMap]', + weakSetTag = '[object WeakSet]'; + + var arrayBufferTag = '[object ArrayBuffer]', + dataViewTag = '[object DataView]', + 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);/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 property names within property paths. */ + var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, + reIsPlainProp = /^\w*$/, + rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; + + /** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). + */ + var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, + reHasRegExpChar = RegExp(reRegExpChar.source); + + /** Used to match leading and trailing whitespace. */ + var reTrim = /^\s+|\s+$/g, + reTrimStart = /^\s+/, + reTrimEnd = /\s+$/; + + /** Used to match wrap detail comments. */ + var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, + reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, + reSplitDetails = /,? & /; + + /** Used to match words composed of alphanumeric characters. */ + var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; + + /** Used to match backslashes in property paths. */ + var reEscapeChar = /\\(\\)?/g; + + /** + * Used to match + * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components). + */ + var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; + + /** Used to match `RegExp` flags from their coerced string values. */ + var reFlags = /\w*$/; + + /** Used to detect bad signed hexadecimal string values. */ + var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; + + /** Used to detect binary string values. */ + var reIsBinary = /^0b[01]+$/i; + + /** Used to detect host constructors (Safari). */ + var reIsHostCtor = /^\[object .+?Constructor\]$/; + + /** Used to detect octal string values. */ + var reIsOctal = /^0o[0-7]+$/i; + + /** Used to detect unsigned integer values. */ + var reIsUint = /^(?:0|[1-9]\d*)$/; + + /** Used to match Latin Unicode letters (excluding mathematical operators). */ + var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; + + /** Used to ensure capturing order of template delimiters. */ + var reNoMatch = /($^)/; + + /** Used to match unescaped characters in compiled string literals. */ + var reUnescapedString = /['\n\r\u2028\u2029\\]/g; + + /** Used to compose unicode character classes. */ + var rsAstralRange = '\\ud800-\\udfff', + rsComboMarksRange = '\\u0300-\\u036f', + reComboHalfMarksRange = '\\ufe20-\\ufe2f', + rsComboSymbolsRange = '\\u20d0-\\u20ff', + rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, + rsDingbatRange = '\\u2700-\\u27bf', + rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', + rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', + rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', + rsPunctuationRange = '\\u2000-\\u206f', + rsSpaceRange = ' \\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', + rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', + rsVarRange = '\\ufe0e\\ufe0f', + rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; + + /** Used to compose unicode capture groups. */ + var rsApos = "['\u2019]", + rsAstral = '[' + rsAstralRange + ']', + rsBreak = '[' + rsBreakRange + ']', + rsCombo = '[' + rsComboRange + ']', + rsDigits = '\\d+', + rsDingbat = '[' + rsDingbatRange + ']', + rsLower = '[' + rsLowerRange + ']', + rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', + rsFitz = '\\ud83c[\\udffb-\\udfff]', + rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', + rsNonAstral = '[^' + rsAstralRange + ']', + rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', + rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', + rsUpper = '[' + rsUpperRange + ']', + rsZWJ = '\\u200d'; + + /** Used to compose unicode regexes. */ + var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')', + rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')', + rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', + rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', + reOptMod = rsModifier + '?', + rsOptVar = '[' + rsVarRange + ']?', + rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', + rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])', + rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])', + rsSeq = rsOptVar + reOptMod + rsOptJoin, + rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, + rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; + + /** Used to match apostrophes. */ + var reApos = RegExp(rsApos, 'g'); + + /** + * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and + * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). + */ + var reComboMark = RegExp(rsCombo, 'g'); + + /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ + var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); + + /** Used to match complex or compound words. */ + var reUnicodeWord = RegExp([ + rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', + rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')', + rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower, + rsUpper + '+' + rsOptContrUpper, + rsOrdUpper, + rsOrdLower, + rsDigits, + rsEmoji + ].join('|'), 'g'); + + /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ + var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); + + /** Used to detect strings that need a more robust regexp to match words. */ + var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; + + /** Used to assign default `context` object properties. */ + var contextProps = [ + 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array', + 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object', + 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array', + 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', + '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout' + ]; + + /** 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[dataViewTag] = 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[dataViewTag] = + cloneableTags[boolTag] = cloneableTags[dateTag] = + cloneableTags[float32Tag] = cloneableTags[float64Tag] = + cloneableTags[int8Tag] = cloneableTags[int16Tag] = + cloneableTags[int32Tag] = cloneableTags[mapTag] = + cloneableTags[numberTag] = cloneableTags[objectTag] = + cloneableTags[regexpTag] = cloneableTags[setTag] = + cloneableTags[stringTag] = cloneableTags[symbolTag] = + cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = + cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; + cloneableTags[errorTag] = cloneableTags[funcTag] = + cloneableTags[weakMapTag] = false; + + /** Used to map Latin Unicode letters to basic Latin letters. */ + var deburredLetters = { + // Latin-1 Supplement block. + '\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', + // Latin Extended-A block. + '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', + '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', + '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', + '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', + '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', + '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', + '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', + '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', + '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', + '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', + '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', + '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', + '\u0134': 'J', '\u0135': 'j', + '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', + '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', + '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', + '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', + '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', + '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', + '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', + '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', + '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', + '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', + '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', + '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', + '\u0163': 't', '\u0165': 't', '\u0167': 't', + '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', + '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', + '\u0174': 'W', '\u0175': 'w', + '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', + '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', + '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', + '\u0132': 'IJ', '\u0133': 'ij', + '\u0152': 'Oe', '\u0153': 'oe', + '\u0149': "'n", '\u017f': 's' + }; + + /** Used to map characters to HTML entities. */ + var htmlEscapes = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''' + }; + + /** Used to map HTML entities to characters. */ + var htmlUnescapes = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + ''': "'" + }; + + /** Used to escape characters for inclusion in compiled string literals. */ + var stringEscapes = { + '\\': '\\', + "'": "'", + '\n': 'n', + '\r': 'r', + '\u2028': 'u2028', + '\u2029': 'u2029' + }; + + /** Built-in method references without a dependency on `root`. */ + var freeParseFloat = parseFloat, + freeParseInt = parseInt; + + /** Detect free variable `global` from Node.js. */ + var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + + /** Detect free variable `self`. */ + var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + + /** Used as a reference to the global object. */ + var root = freeGlobal || freeSelf || Function('return this')(); + + /** Detect free variable `exports`. */ + var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; + + /** Detect free variable `module`. */ + var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; + + /** Detect the popular CommonJS extension `module.exports`. */ + var moduleExports = freeModule && freeModule.exports === freeExports; + + /** Detect free variable `process` from Node.js. */ + var freeProcess = moduleExports && freeGlobal.process; + + /** Used to access faster Node.js helpers. */ + var nodeUtil = (function() { + try { + // Use `util.types` for Node.js 10+. + var types = freeModule && freeModule.require && freeModule.require('util').types; + + if (types) { + return types; + } + + // Legacy `process.binding('util')` for Node.js < 10. + return freeProcess && freeProcess.binding && freeProcess.binding('util'); + } catch (e) {} + }()); + + /* Node.js helper references. */ + var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, + nodeIsDate = nodeUtil && nodeUtil.isDate, + nodeIsMap = nodeUtil && nodeUtil.isMap, + nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, + nodeIsSet = nodeUtil && nodeUtil.isSet, + nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; + + /*--------------------------------------------------------------------------*/ + + /** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ + function apply(func, thisArg, args) { + switch (args.length) { + case 0: return func.call(thisArg); + case 1: return func.call(thisArg, args[0]); + case 2: return func.call(thisArg, args[0], args[1]); + case 3: return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); + } + + /** + * A specialized version of `baseAggregator` for arrays. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} setter The function to set `accumulator` values. + * @param {Function} iteratee The iteratee to transform keys. + * @param {Object} accumulator The initial aggregated object. + * @returns {Function} Returns `accumulator`. + */ + function arrayAggregator(array, setter, iteratee, accumulator) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + var value = array[index]; + setter(accumulator, value, iteratee(value), array); + } + return accumulator; + } + + /** + * A specialized version of `_.forEach` for arrays without support for + * iteratee shorthands. + * + * @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 == null ? 0 : 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 + * iteratee shorthands. + * + * @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 == null ? 0 : array.length; + + while (length--) { + if (iteratee(array[length], length, array) === false) { + break; + } + } + return array; + } + + /** + * A specialized version of `_.every` for arrays without support for + * iteratee shorthands. + * + * @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 == null ? 0 : 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 + * iteratee shorthands. + * + * @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 == null ? 0 : array.length, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index]; + if (predicate(value, index, array)) { + result[resIndex++] = value; + } + } + return result; + } + + /** + * A specialized version of `_.includes` for arrays without support for + * specifying an index to search from. + * + * @private + * @param {Array} [array] The array to inspect. + * @param {*} target The value to search for. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ + function arrayIncludes(array, value) { + var length = array == null ? 0 : array.length; + return !!length && baseIndexOf(array, value, 0) > -1; + } + + /** + * This function is like `arrayIncludes` except that it accepts a comparator. + * + * @private + * @param {Array} [array] The array to inspect. + * @param {*} target The value to search for. + * @param {Function} comparator The comparator invoked per element. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ + function arrayIncludesWith(array, value, comparator) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + if (comparator(value, array[index])) { + return true; + } + } + return false; + } + + /** + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. + * + * @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 == null ? 0 : array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; + } + + /** + * Appends the elements of `values` to `array`. + * + * @private + * @param {Array} array The array to modify. + * @param {Array} values The values to append. + * @returns {Array} Returns `array`. + */ + function arrayPush(array, values) { + var index = -1, + length = values.length, + offset = array.length; + + while (++index < length) { + array[offset + index] = values[index]; + } + return array; + } + + /** + * A specialized version of `_.reduce` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {boolean} [initAccum] Specify using the first element of `array` as + * the initial value. + * @returns {*} Returns the accumulated value. + */ + function arrayReduce(array, iteratee, accumulator, initAccum) { + var index = -1, + length = array == null ? 0 : array.length; + + if (initAccum && 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 + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {boolean} [initAccum] Specify using the last element of `array` as + * the initial value. + * @returns {*} Returns the accumulated value. + */ + function arrayReduceRight(array, iteratee, accumulator, initAccum) { + var length = array == null ? 0 : array.length; + if (initAccum && 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 iteratee + * shorthands. + * + * @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 == null ? 0 : array.length; + + while (++index < length) { + if (predicate(array[index], index, array)) { + return true; + } + } + return false; + } + + /** + * Gets the size of an ASCII `string`. + * + * @private + * @param {string} string The string inspect. + * @returns {number} Returns the string size. + */ + var asciiSize = baseProperty('length'); + + /** + * Converts an ASCII `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ + function asciiToArray(string) { + return string.split(''); + } + + /** + * Splits an ASCII `string` into an array of its words. + * + * @private + * @param {string} The string to inspect. + * @returns {Array} Returns the words of `string`. + */ + function asciiWords(string) { + return string.match(reAsciiWord) || []; + } + + /** + * The base implementation of methods like `_.findKey` and `_.findLastKey`, + * without support for iteratee shorthands, which iterates over `collection` + * using `eachFunc`. + * + * @private + * @param {Array|Object} collection The collection to inspect. + * @param {Function} predicate The function invoked per iteration. + * @param {Function} eachFunc The function to iterate over `collection`. + * @returns {*} Returns the found element or its key, else `undefined`. + */ + function baseFindKey(collection, predicate, eachFunc) { + var result; + eachFunc(collection, function(value, key, collection) { + if (predicate(value, key, collection)) { + result = key; + return false; + } + }); + return result; + } + + /** + * The base implementation of `_.findIndex` and `_.findLastIndex` without + * support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} predicate The function invoked per iteration. + * @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 value, else `-1`. + */ + function baseFindIndex(array, predicate, fromIndex, fromRight) { + var length = array.length, + index = fromIndex + (fromRight ? 1 : -1); + + while ((fromRight ? index-- : ++index < length)) { + if (predicate(array[index], index, array)) { + return index; + } + } + return -1; + } + + /** + * The base implementation of `_.indexOf` without `fromIndex` bounds checks. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function baseIndexOf(array, value, fromIndex) { + return value === value + ? strictIndexOf(array, value, fromIndex) + : baseFindIndex(array, baseIsNaN, fromIndex); + } + + /** + * This function is like `baseIndexOf` except that it accepts a comparator. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @param {Function} comparator The comparator invoked per element. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function baseIndexOfWith(array, value, fromIndex, comparator) { + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (comparator(array[index], value)) { + return index; + } + } + return -1; + } + + /** + * The base implementation of `_.isNaN` without support for number objects. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + */ + function baseIsNaN(value) { + return value !== value; + } + + /** + * The base implementation of `_.mean` and `_.meanBy` without support for + * iteratee shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {number} Returns the mean. + */ + function baseMean(array, iteratee) { + var length = array == null ? 0 : array.length; + return length ? (baseSum(array, iteratee) / length) : NAN; + } + + /** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new accessor function. + */ + function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; + } + + /** + * The base implementation of `_.propertyOf` without support for deep paths. + * + * @private + * @param {Object} object The object to query. + * @returns {Function} Returns the new accessor function. + */ + function basePropertyOf(object) { + return function(key) { + return object == null ? undefined : object[key]; + }; + } + + /** + * The base implementation of `_.reduce` and `_.reduceRight`, without support + * for iteratee shorthands, which iterates over `collection` using `eachFunc`. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} accumulator The initial value. + * @param {boolean} initAccum 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, initAccum, eachFunc) { + eachFunc(collection, function(value, index, collection) { + accumulator = initAccum + ? (initAccum = false, value) + : iteratee(accumulator, value, index, collection); + }); + return accumulator; + } + + /** + * The base implementation of `_.sortBy` 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; + } + + /** + * The base implementation of `_.sum` and `_.sumBy` without support for + * iteratee shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {number} Returns the sum. + */ + function baseSum(array, iteratee) { + var result, + index = -1, + length = array.length; + + while (++index < length) { + var current = iteratee(array[index]); + if (current !== undefined) { + result = result === undefined ? current : (result + current); + } + } + return result; + } + + /** + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. + * + * @private + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. + */ + function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); + + while (++index < n) { + result[index] = iteratee(index); + } + return result; + } + + /** + * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array + * of key-value pairs for `object` corresponding to the property names of `props`. + * + * @private + * @param {Object} object The object to query. + * @param {Array} props The property names to get values for. + * @returns {Object} Returns the key-value pairs. + */ + function baseToPairs(object, props) { + return arrayMap(props, function(key) { + return [key, object[key]]; + }); + } + + /** + * The base implementation of `_.unary` without support for storing metadata. + * + * @private + * @param {Function} func The function to cap arguments for. + * @returns {Function} Returns the new capped function. + */ + function baseUnary(func) { + return function(value) { + return func(value); + }; + } + + /** + * The base implementation of `_.values` and `_.valuesIn` which creates an + * array of `object` property values corresponding to the property names + * of `props`. + * + * @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) { + return arrayMap(props, function(key) { + return object[key]; + }); + } + + /** + * Checks if a `cache` value for `key` exists. + * + * @private + * @param {Object} cache The cache to query. + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function cacheHas(cache, key) { + return cache.has(key); + } + + /** + * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol + * that is not found in the character symbols. + * + * @private + * @param {Array} strSymbols The string symbols to inspect. + * @param {Array} chrSymbols The character symbols to find. + * @returns {number} Returns the index of the first unmatched string symbol. + */ + function charsStartIndex(strSymbols, chrSymbols) { + var index = -1, + length = strSymbols.length; + + while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} + return index; + } + + /** + * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol + * that is not found in the character symbols. + * + * @private + * @param {Array} strSymbols The string symbols to inspect. + * @param {Array} chrSymbols The character symbols to find. + * @returns {number} Returns the index of the last unmatched string symbol. + */ + function charsEndIndex(strSymbols, chrSymbols) { + var index = strSymbols.length; + + while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} + return index; + } + + /** + * Gets the number of `placeholder` occurrences in `array`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} placeholder The placeholder to search for. + * @returns {number} Returns the placeholder count. + */ + function countHolders(array, placeholder) { + var length = array.length, + result = 0; + + while (length--) { + if (array[length] === placeholder) { + ++result; + } + } + return result; + } + + /** + * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A + * letters to basic Latin letters. + * + * @private + * @param {string} letter The matched letter to deburr. + * @returns {string} Returns the deburred letter. + */ + var deburrLetter = basePropertyOf(deburredLetters); + + /** + * Used by `_.escape` to convert characters to HTML entities. + * + * @private + * @param {string} chr The matched character to escape. + * @returns {string} Returns the escaped character. + */ + var escapeHtmlChar = basePropertyOf(htmlEscapes); + + /** + * 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 value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ + function getValue(object, key) { + return object == null ? undefined : object[key]; + } + + /** + * Checks if `string` contains Unicode symbols. + * + * @private + * @param {string} string The string to inspect. + * @returns {boolean} Returns `true` if a symbol is found, else `false`. + */ + function hasUnicode(string) { + return reHasUnicode.test(string); + } + + /** + * Checks if `string` contains a word composed of Unicode symbols. + * + * @private + * @param {string} string The string to inspect. + * @returns {boolean} Returns `true` if a word is found, else `false`. + */ + function hasUnicodeWord(string) { + return reHasUnicodeWord.test(string); + } + + /** + * Converts `iterator` to an array. + * + * @private + * @param {Object} iterator The iterator to convert. + * @returns {Array} Returns the converted array. + */ + function iteratorToArray(iterator) { + var data, + result = []; + + while (!(data = iterator.next()).done) { + result.push(data.value); + } + return result; + } + + /** + * Converts `map` to its key-value pairs. + * + * @private + * @param {Object} map The map to convert. + * @returns {Array} Returns the key-value pairs. + */ + function mapToArray(map) { + var index = -1, + result = Array(map.size); + + map.forEach(function(value, key) { + result[++index] = [key, value]; + }); + return result; + } + + /** + * Creates a unary function that invokes `func` with its argument transformed. + * + * @private + * @param {Function} func The function to wrap. + * @param {Function} transform The argument transform. + * @returns {Function} Returns the new function. + */ + function overArg(func, transform) { + return function(arg) { + return func(transform(arg)); + }; + } + + /** + * 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 = 0, + result = []; + + while (++index < length) { + var value = array[index]; + if (value === placeholder || value === PLACEHOLDER) { + array[index] = PLACEHOLDER; + result[resIndex++] = index; + } + } + return result; + } + + /** + * Gets the value at `key`, unless `key` is "__proto__". + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ + function safeGet(object, key) { + return key == '__proto__' + ? undefined + : object[key]; + } + + /** + * Converts `set` to an array of its values. + * + * @private + * @param {Object} set The set to convert. + * @returns {Array} Returns the values. + */ + function setToArray(set) { + var index = -1, + result = Array(set.size); + + set.forEach(function(value) { + result[++index] = value; + }); + return result; + } + + /** + * Converts `set` to its value-value pairs. + * + * @private + * @param {Object} set The set to convert. + * @returns {Array} Returns the value-value pairs. + */ + function setToPairs(set) { + var index = -1, + result = Array(set.size); + + set.forEach(function(value) { + result[++index] = [value, value]; + }); + return result; + } + + /** + * A specialized version of `_.indexOf` which performs strict equality + * comparisons of values, i.e. `===`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function strictIndexOf(array, value, fromIndex) { + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; + } + + /** + * A specialized version of `_.lastIndexOf` which performs strict equality + * comparisons of values, i.e. `===`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function strictLastIndexOf(array, value, fromIndex) { + var index = fromIndex + 1; + while (index--) { + if (array[index] === value) { + return index; + } + } + return index; + } + + /** + * Gets the number of symbols in `string`. + * + * @private + * @param {string} string The string to inspect. + * @returns {number} Returns the string size. + */ + function stringSize(string) { + return hasUnicode(string) + ? unicodeSize(string) + : asciiSize(string); + } + + /** + * Converts `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ + function stringToArray(string) { + return hasUnicode(string) + ? unicodeToArray(string) + : asciiToArray(string); + } + + /** + * Used by `_.unescape` to convert HTML entities to characters. + * + * @private + * @param {string} chr The matched character to unescape. + * @returns {string} Returns the unescaped character. + */ + var unescapeHtmlChar = basePropertyOf(htmlUnescapes); + + /** + * Gets the size of a Unicode `string`. + * + * @private + * @param {string} string The string inspect. + * @returns {number} Returns the string size. + */ + function unicodeSize(string) { + var result = reUnicode.lastIndex = 0; + while (reUnicode.test(string)) { + ++result; + } + return result; + } + + /** + * Converts a Unicode `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ + function unicodeToArray(string) { + return string.match(reUnicode) || []; + } + + /** + * Splits a Unicode `string` into an array of its words. + * + * @private + * @param {string} The string to inspect. + * @returns {Array} Returns the words of `string`. + */ + function unicodeWords(string) { + return string.match(reUnicodeWord) || []; + } + + /*--------------------------------------------------------------------------*/ + + /** + * Create a new pristine `lodash` function using the `context` object. + * + * @static + * @memberOf _ + * @since 1.1.0 + * @category Util + * @param {Object} [context=root] The context object. + * @returns {Function} Returns a new `lodash` function. + * @example + * + * _.mixin({ 'foo': _.constant('foo') }); + * + * var lodash = _.runInContext(); + * lodash.mixin({ 'bar': lodash.constant('bar') }); + * + * _.isFunction(_.foo); + * // => true + * _.isFunction(_.bar); + * // => false + * + * lodash.isFunction(lodash.foo); + * // => false + * lodash.isFunction(lodash.bar); + * // => true + * + * // Create a suped-up `defer` in Node.js. + * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; + */ + var runInContext = (function runInContext(context) { + context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps)); + + /** Built-in constructor references. */ + var Array = context.Array, + Date = context.Date, + Error = context.Error, + Function = context.Function, + Math = context.Math, + Object = context.Object, + RegExp = context.RegExp, + String = context.String, + TypeError = context.TypeError; + + /** Used for built-in method references. */ + var arrayProto = Array.prototype, + funcProto = Function.prototype, + objectProto = Object.prototype; + + /** Used to detect overreaching core-js shims. */ + var coreJsData = context['__core-js_shared__']; + + /** Used to resolve the decompiled source of functions. */ + var funcToString = funcProto.toString; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** Used to generate unique IDs. */ + var idCounter = 0; + + /** Used to detect methods masquerading as native. */ + var maskSrcKey = (function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? ('Symbol(src)_1.' + uid) : ''; + }()); + + /** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ + var nativeObjectToString = objectProto.toString; + + /** Used to infer the `Object` constructor. */ + var objectCtorString = funcToString.call(Object); + + /** Used to restore the original `_` reference in `_.noConflict`. */ + var oldDash = root._; + + /** Used to detect if a method is native. */ + var reIsNative = RegExp('^' + + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' + ); + + /** Built-in value references. */ + var Buffer = moduleExports ? context.Buffer : undefined, + Symbol = context.Symbol, + Uint8Array = context.Uint8Array, + allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined, + getPrototype = overArg(Object.getPrototypeOf, Object), + objectCreate = Object.create, + propertyIsEnumerable = objectProto.propertyIsEnumerable, + splice = arrayProto.splice, + spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined, + symIterator = Symbol ? Symbol.iterator : undefined, + symToStringTag = Symbol ? Symbol.toStringTag : undefined; + + var defineProperty = (function() { + try { + var func = getNative(Object, 'defineProperty'); + func({}, '', {}); + return func; + } catch (e) {} + }()); + + /** Mocked built-ins. */ + var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, + ctxNow = Date && Date.now !== root.Date.now && Date.now, + ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout; + + /* Built-in method references for those with the same name as other `lodash` methods. */ + var nativeCeil = Math.ceil, + nativeFloor = Math.floor, + nativeGetSymbols = Object.getOwnPropertySymbols, + nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, + nativeIsFinite = context.isFinite, + nativeJoin = arrayProto.join, + nativeKeys = overArg(Object.keys, Object), + nativeMax = Math.max, + nativeMin = Math.min, + nativeNow = Date.now, + nativeParseInt = context.parseInt, + nativeRandom = Math.random, + nativeReverse = arrayProto.reverse; + + /* Built-in method references that are verified to be native. */ + var DataView = getNative(context, 'DataView'), + Map = getNative(context, 'Map'), + Promise = getNative(context, 'Promise'), + Set = getNative(context, 'Set'), + WeakMap = getNative(context, 'WeakMap'), + nativeCreate = getNative(Object, 'create'); + + /** Used to store function metadata. */ + var metaMap = WeakMap && new WeakMap; + + /** Used to lookup unminified function names. */ + var realNames = {}; + + /** Used to detect maps, sets, and weakmaps. */ + var dataViewCtorString = toSource(DataView), + mapCtorString = toSource(Map), + promiseCtorString = toSource(Promise), + setCtorString = toSource(Set), + weakMapCtorString = toSource(WeakMap); + + /** Used to convert symbols to primitives and strings. */ + var symbolProto = Symbol ? Symbol.prototype : undefined, + symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, + symbolToString = symbolProto ? symbolProto.toString : undefined; + + /*------------------------------------------------------------------------*/ + + /** + * Creates a `lodash` object which wraps `value` to enable implicit method + * chain sequences. Methods that operate on and return arrays, collections, + * and functions can be chained together. Methods that retrieve a single value + * or may return a primitive value will automatically end the chain sequence + * and return the unwrapped value. Otherwise, the value must be unwrapped + * with `_#value`. + * + * Explicit chain sequences, which must be unwrapped with `_#value`, may be + * enabled using `_.chain`. + * + * The execution of chained methods is lazy, that is, it's deferred until + * `_#value` is implicitly or explicitly called. + * + * Lazy evaluation allows several methods to support shortcut fusion. + * Shortcut fusion is an optimization to merge iteratee calls; this avoids + * the creation of intermediate arrays and can greatly reduce the number of + * iteratee executions. Sections of a chain sequence qualify for shortcut + * fusion if the section is applied to an array and iteratees accept only + * one argument. The heuristic for whether a section qualifies for shortcut + * fusion is subject to change. + * + * 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 have `Array` and `String` methods. + * + * The wrapper `Array` methods are: + * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift` + * + * The wrapper `String` methods are: + * `replace` and `split` + * + * The wrapper methods that support shortcut fusion are: + * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`, + * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`, + * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` + * + * The chainable wrapper methods are: + * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`, + * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`, + * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, + * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, + * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`, + * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`, + * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`, + * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`, + * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`, + * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`, + * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, + * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`, + * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`, + * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`, + * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, + * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`, + * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`, + * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`, + * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`, + * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`, + * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`, + * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`, + * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, + * `zipObject`, `zipObjectDeep`, and `zipWith` + * + * The wrapper methods that are **not** chainable by default are: + * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, + * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`, + * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`, + * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`, + * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`, + * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, + * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, + * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, + * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, + * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, + * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, + * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, + * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, + * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, + * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, + * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, + * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, + * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`, + * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, + * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`, + * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`, + * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`, + * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, + * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, + * `upperFirst`, `value`, and `words` + * + * @name _ + * @constructor + * @category Seq + * @param {*} value The value to wrap in a `lodash` instance. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * function square(n) { + * return n * n; + * } + * + * var wrapped = _([1, 2, 3]); + * + * // Returns an unwrapped value. + * wrapped.reduce(_.add); + * // => 6 + * + * // Returns a wrapped value. + * var squares = wrapped.map(square); + * + * _.isArray(squares); + * // => false + * + * _.isArray(squares.value()); + * // => true + */ + function lodash(value) { + if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { + if (value instanceof LodashWrapper) { + return value; + } + if (hasOwnProperty.call(value, '__wrapped__')) { + return wrapperClone(value); + } + } + return new LodashWrapper(value); + } + + /** + * The base implementation of `_.create` without support for assigning + * properties to the created object. + * + * @private + * @param {Object} proto The object to inherit from. + * @returns {Object} Returns the new object. + */ + var baseCreate = (function() { + function object() {} + return function(proto) { + if (!isObject(proto)) { + return {}; + } + if (objectCreate) { + return objectCreate(proto); + } + object.prototype = proto; + var result = new object; + object.prototype = undefined; + return result; + }; + }()); + + /** + * The function whose prototype chain sequence wrappers inherit from. + * + * @private + */ + function baseLodash() { + // No operation performed. + } + + /** + * The base constructor for creating `lodash` wrapper objects. + * + * @private + * @param {*} value The value to wrap. + * @param {boolean} [chainAll] Enable explicit method chain sequences. + */ + function LodashWrapper(value, chainAll) { + this.__wrapped__ = value; + this.__actions__ = []; + this.__chain__ = !!chainAll; + this.__index__ = 0; + this.__values__ = undefined; + } + + /** + * By default, the template delimiters used by lodash are like those in + * embedded Ruby (ERB) as well as ES2015 template strings. Change the + * following template settings to use alternative delimiters. + * + * @static + * @memberOf _ + * @type {Object} + */ + lodash.templateSettings = { + + /** + * Used to detect `data` property values to be HTML-escaped. + * + * @memberOf _.templateSettings + * @type {RegExp} + */ + 'escape': reEscape, + + /** + * Used to detect code to be evaluated. + * + * @memberOf _.templateSettings + * @type {RegExp} + */ + 'evaluate': reEvaluate, + + /** + * Used to detect `data` property values to inject. + * + * @memberOf _.templateSettings + * @type {RegExp} + */ + 'interpolate': reInterpolate, + + /** + * Used to reference the data object in the template text. + * + * @memberOf _.templateSettings + * @type {string} + */ + 'variable': '', + + /** + * Used to import variables into the compiled template. + * + * @memberOf _.templateSettings + * @type {Object} + */ + 'imports': { + + /** + * A reference to the `lodash` function. + * + * @memberOf _.templateSettings.imports + * @type {Function} + */ + '_': lodash + } + }; + + // Ensure wrappers are instances of `baseLodash`. + lodash.prototype = baseLodash.prototype; + lodash.prototype.constructor = lodash; + + LodashWrapper.prototype = baseCreate(baseLodash.prototype); + LodashWrapper.prototype.constructor = LodashWrapper; + + /*------------------------------------------------------------------------*/ + + /** + * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. + * + * @private + * @constructor + * @param {*} value The value to wrap. + */ + function LazyWrapper(value) { + this.__wrapped__ = value; + this.__actions__ = []; + this.__dir__ = 1; + this.__filtered__ = false; + this.__iteratees__ = []; + this.__takeCount__ = MAX_ARRAY_LENGTH; + this.__views__ = []; + } + + /** + * Creates a clone of the lazy wrapper object. + * + * @private + * @name clone + * @memberOf LazyWrapper + * @returns {Object} Returns the cloned `LazyWrapper` object. + */ + function lazyClone() { + var result = new LazyWrapper(this.__wrapped__); + result.__actions__ = copyArray(this.__actions__); + result.__dir__ = this.__dir__; + result.__filtered__ = this.__filtered__; + result.__iteratees__ = copyArray(this.__iteratees__); + result.__takeCount__ = this.__takeCount__; + result.__views__ = copyArray(this.__views__); + 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(), + dir = this.__dir__, + isArr = isArray(array), + isRight = dir < 0, + arrLength = isArr ? array.length : 0, + view = getView(0, arrLength, this.__views__), + start = view.start, + end = view.end, + length = end - start, + index = isRight ? end : (start - 1), + iteratees = this.__iteratees__, + iterLength = iteratees.length, + resIndex = 0, + takeCount = nativeMin(length, this.__takeCount__); + + if (!isArr || (!isRight && arrLength == length && takeCount == length)) { + return baseWrapperValue(array, this.__actions__); + } + var result = []; + + outer: + while (length-- && resIndex < takeCount) { + index += dir; + + var iterIndex = -1, + value = array[index]; + + while (++iterIndex < iterLength) { + var data = iteratees[iterIndex], + iteratee = data.iteratee, + type = data.type, + computed = iteratee(value); + + if (type == LAZY_MAP_FLAG) { + value = computed; + } else if (!computed) { + if (type == LAZY_FILTER_FLAG) { + continue outer; + } else { + break outer; + } + } + } + result[resIndex++] = value; + } + return result; + } + + // Ensure `LazyWrapper` is an instance of `baseLodash`. + LazyWrapper.prototype = baseCreate(baseLodash.prototype); + LazyWrapper.prototype.constructor = LazyWrapper; + + /*------------------------------------------------------------------------*/ + + /** + * Creates a hash object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ + function Hash(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + + /** + * Removes all key-value entries from the hash. + * + * @private + * @name clear + * @memberOf Hash + */ + function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; + this.size = 0; + } + + /** + * Removes `key` and its value from the hash. + * + * @private + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ + function hashDelete(key) { + var result = this.has(key) && delete this.__data__[key]; + this.size -= result ? 1 : 0; + return result; + } + + /** + * Gets the hash value for `key`. + * + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? undefined : result; + } + return hasOwnProperty.call(data, key) ? data[key] : undefined; + } + + /** + * Checks if a hash value for `key` exists. + * + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function hashHas(key) { + var data = this.__data__; + return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); + } + + /** + * Sets the hash `key` to `value`. + * + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. + */ + function hashSet(key, value) { + var data = this.__data__; + this.size += this.has(key) ? 0 : 1; + data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; + return this; + } + + // Add methods to `Hash`. + Hash.prototype.clear = hashClear; + Hash.prototype['delete'] = hashDelete; + Hash.prototype.get = hashGet; + Hash.prototype.has = hashHas; + Hash.prototype.set = hashSet; + + /*------------------------------------------------------------------------*/ + + /** + * Creates an list cache object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ + function ListCache(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + + /** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ + function listCacheClear() { + this.__data__ = []; + this.size = 0; + } + + /** + * Removes `key` and its value from the list cache. + * + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ + function listCacheDelete(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + --this.size; + return true; + } + + /** + * Gets the list cache value for `key`. + * + * @private + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + function listCacheGet(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + return index < 0 ? undefined : data[index][1]; + } + + /** + * Checks if a list cache value for `key` exists. + * + * @private + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; + } + + /** + * Sets the list cache `key` to `value`. + * + * @private + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. + */ + function listCacheSet(key, value) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + ++this.size; + data.push([key, value]); + } else { + data[index][1] = value; + } + return this; + } + + // Add methods to `ListCache`. + ListCache.prototype.clear = listCacheClear; + ListCache.prototype['delete'] = listCacheDelete; + ListCache.prototype.get = listCacheGet; + ListCache.prototype.has = listCacheHas; + ListCache.prototype.set = listCacheSet; + + /*------------------------------------------------------------------------*/ + + /** + * Creates a map cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ + function MapCache(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + + /** + * Removes all key-value entries from the map. + * + * @private + * @name clear + * @memberOf MapCache + */ + function mapCacheClear() { + this.size = 0; + this.__data__ = { + 'hash': new Hash, + 'map': new (Map || ListCache), + 'string': new Hash + }; + } + + /** + * Removes `key` and its value from the map. + * + * @private + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ + function mapCacheDelete(key) { + var result = getMapData(this, key)['delete'](key); + this.size -= result ? 1 : 0; + return result; + } + + /** + * Gets the map value for `key`. + * + * @private + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + function mapCacheGet(key) { + return getMapData(this, key).get(key); + } + + /** + * Checks if a map value for `key` exists. + * + * @private + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function mapCacheHas(key) { + return getMapData(this, key).has(key); + } + + /** + * Sets the map `key` to `value`. + * + * @private + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. + */ + function mapCacheSet(key, value) { + var data = getMapData(this, key), + size = data.size; + + data.set(key, value); + this.size += data.size == size ? 0 : 1; + return this; + } + + // Add methods to `MapCache`. + MapCache.prototype.clear = mapCacheClear; + MapCache.prototype['delete'] = mapCacheDelete; + MapCache.prototype.get = mapCacheGet; + MapCache.prototype.has = mapCacheHas; + MapCache.prototype.set = mapCacheSet; + + /*------------------------------------------------------------------------*/ + + /** + * + * Creates an array cache object to store unique values. + * + * @private + * @constructor + * @param {Array} [values] The values to cache. + */ + function SetCache(values) { + var index = -1, + length = values == null ? 0 : values.length; + + this.__data__ = new MapCache; + while (++index < length) { + this.add(values[index]); + } + } + + /** + * Adds `value` to the array cache. + * + * @private + * @name add + * @memberOf SetCache + * @alias push + * @param {*} value The value to cache. + * @returns {Object} Returns the cache instance. + */ + function setCacheAdd(value) { + this.__data__.set(value, HASH_UNDEFINED); + return this; + } + + /** + * Checks if `value` is in the array cache. + * + * @private + * @name has + * @memberOf SetCache + * @param {*} value The value to search for. + * @returns {number} Returns `true` if `value` is found, else `false`. + */ + function setCacheHas(value) { + return this.__data__.has(value); + } + + // Add methods to `SetCache`. + SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; + SetCache.prototype.has = setCacheHas; + + /*------------------------------------------------------------------------*/ + + /** + * Creates a stack cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ + function Stack(entries) { + var data = this.__data__ = new ListCache(entries); + this.size = data.size; + } + + /** + * Removes all key-value entries from the stack. + * + * @private + * @name clear + * @memberOf Stack + */ + function stackClear() { + this.__data__ = new ListCache; + this.size = 0; + } + + /** + * Removes `key` and its value from the stack. + * + * @private + * @name delete + * @memberOf Stack + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ + function stackDelete(key) { + var data = this.__data__, + result = data['delete'](key); + + this.size = data.size; + return result; + } + + /** + * Gets the stack value for `key`. + * + * @private + * @name get + * @memberOf Stack + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + function stackGet(key) { + return this.__data__.get(key); + } + + /** + * Checks if a stack value for `key` exists. + * + * @private + * @name has + * @memberOf Stack + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function stackHas(key) { + return this.__data__.has(key); + } + + /** + * Sets the stack `key` to `value`. + * + * @private + * @name set + * @memberOf Stack + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the stack cache instance. + */ + function stackSet(key, value) { + var data = this.__data__; + if (data instanceof ListCache) { + var pairs = data.__data__; + if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { + pairs.push([key, value]); + this.size = ++data.size; + return this; + } + data = this.__data__ = new MapCache(pairs); + } + data.set(key, value); + this.size = data.size; + return this; + } + + // Add methods to `Stack`. + Stack.prototype.clear = stackClear; + Stack.prototype['delete'] = stackDelete; + Stack.prototype.get = stackGet; + Stack.prototype.has = stackHas; + Stack.prototype.set = stackSet; + + /*------------------------------------------------------------------------*/ + + /** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ + function arrayLikeKeys(value, inherited) { + var isArr = isArray(value), + isArg = !isArr && isArguments(value), + isBuff = !isArr && !isArg && isBuffer(value), + isType = !isArr && !isArg && !isBuff && isTypedArray(value), + skipIndexes = isArr || isArg || isBuff || isType, + result = skipIndexes ? baseTimes(value.length, String) : [], + length = result.length; + + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && + !(skipIndexes && ( + // Safari 9 has enumerable `arguments.length` in strict mode. + key == 'length' || + // Node.js 0.10 has enumerable non-index properties on buffers. + (isBuff && (key == 'offset' || key == 'parent')) || + // PhantomJS 2 has enumerable non-index properties on typed arrays. + (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || + // Skip index properties. + isIndex(key, length) + ))) { + result.push(key); + } + } + return result; + } + + /** + * A specialized version of `_.sample` for arrays. + * + * @private + * @param {Array} array The array to sample. + * @returns {*} Returns the random element. + */ + function arraySample(array) { + var length = array.length; + return length ? array[baseRandom(0, length - 1)] : undefined; + } + + /** + * A specialized version of `_.sampleSize` for arrays. + * + * @private + * @param {Array} array The array to sample. + * @param {number} n The number of elements to sample. + * @returns {Array} Returns the random elements. + */ + function arraySampleSize(array, n) { + return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); + } + + /** + * A specialized version of `_.shuffle` for arrays. + * + * @private + * @param {Array} array The array to shuffle. + * @returns {Array} Returns the new shuffled array. + */ + function arrayShuffle(array) { + return shuffleSelf(copyArray(array)); + } + + /** + * This function is like `assignValue` except that it doesn't assign + * `undefined` values. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ + function assignMergeValue(object, key, value) { + if ((value !== undefined && !eq(object[key], value)) || + (value === undefined && !(key in object))) { + baseAssignValue(object, key, value); + } + } + + /** + * Assigns `value` to `key` of `object` if the existing value is not equivalent + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ + function assignValue(object, key, value) { + var objValue = object[key]; + if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || + (value === undefined && !(key in object))) { + baseAssignValue(object, key, value); + } + } + + /** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function assocIndexOf(array, key) { + var length = array.length; + while (length--) { + if (eq(array[length][0], key)) { + return length; + } + } + return -1; + } + + /** + * Aggregates elements of `collection` on `accumulator` with keys transformed + * by `iteratee` and values set by `setter`. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} setter The function to set `accumulator` values. + * @param {Function} iteratee The iteratee to transform keys. + * @param {Object} accumulator The initial aggregated object. + * @returns {Function} Returns `accumulator`. + */ + function baseAggregator(collection, setter, iteratee, accumulator) { + baseEach(collection, function(value, key, collection) { + setter(accumulator, value, iteratee(value), collection); + }); + return accumulator; + } + + /** + * The base implementation of `_.assign` without support for multiple sources + * or `customizer` functions. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @returns {Object} Returns `object`. + */ + function baseAssign(object, source) { + return object && copyObject(source, keys(source), object); + } + + /** + * The base implementation of `_.assignIn` without support for multiple sources + * or `customizer` functions. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @returns {Object} Returns `object`. + */ + function baseAssignIn(object, source) { + return object && copyObject(source, keysIn(source), object); + } + + /** + * The base implementation of `assignValue` and `assignMergeValue` without + * value checks. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ + function baseAssignValue(object, key, value) { + if (key == '__proto__' && defineProperty) { + defineProperty(object, key, { + 'configurable': true, + 'enumerable': true, + 'value': value, + 'writable': true + }); + } else { + object[key] = value; + } + } + + /** + * The base implementation of `_.at` without support for individual paths. + * + * @private + * @param {Object} object The object to iterate over. + * @param {string[]} paths The property paths to pick. + * @returns {Array} Returns the picked elements. + */ + function baseAt(object, paths) { + var index = -1, + length = paths.length, + result = Array(length), + skip = object == null; + + while (++index < length) { + result[index] = skip ? undefined : get(object, paths[index]); + } + return result; + } + + /** + * The base implementation of `_.clamp` which doesn't coerce arguments. + * + * @private + * @param {number} number The number to clamp. + * @param {number} [lower] The lower bound. + * @param {number} upper The upper bound. + * @returns {number} Returns the clamped number. + */ + function baseClamp(number, lower, upper) { + if (number === number) { + if (upper !== undefined) { + number = number <= upper ? number : upper; + } + if (lower !== undefined) { + number = number >= lower ? number : lower; + } + } + return number; + } + + /** + * The base implementation of `_.clone` and `_.cloneDeep` which tracks + * traversed objects. + * + * @private + * @param {*} value The value to clone. + * @param {boolean} bitmask The bitmask flags. + * 1 - Deep clone + * 2 - Flatten inherited properties + * 4 - Clone symbols + * @param {Function} [customizer] The function to customize cloning. + * @param {string} [key] The key of `value`. + * @param {Object} [object] The parent object of `value`. + * @param {Object} [stack] Tracks traversed objects and their clone counterparts. + * @returns {*} Returns the cloned value. + */ + function baseClone(value, bitmask, customizer, key, object, stack) { + var result, + isDeep = bitmask & CLONE_DEEP_FLAG, + isFlat = bitmask & CLONE_FLAT_FLAG, + isFull = bitmask & CLONE_SYMBOLS_FLAG; + + if (customizer) { + result = object ? customizer(value, key, object, stack) : customizer(value); + } + if (result !== undefined) { + return result; + } + if (!isObject(value)) { + return value; + } + var isArr = isArray(value); + if (isArr) { + result = initCloneArray(value); + if (!isDeep) { + return copyArray(value, result); + } + } else { + var tag = getTag(value), + isFunc = tag == funcTag || tag == genTag; + + if (isBuffer(value)) { + return cloneBuffer(value, isDeep); + } + if (tag == objectTag || tag == argsTag || (isFunc && !object)) { + result = (isFlat || isFunc) ? {} : initCloneObject(value); + if (!isDeep) { + return isFlat + ? copySymbolsIn(value, baseAssignIn(result, value)) + : copySymbols(value, baseAssign(result, value)); + } + } else { + if (!cloneableTags[tag]) { + return object ? value : {}; + } + result = initCloneByTag(value, tag, isDeep); + } + } + // Check for circular references and return its corresponding clone. + stack || (stack = new Stack); + var stacked = stack.get(value); + if (stacked) { + return stacked; + } + stack.set(value, result); + + if (isSet(value)) { + value.forEach(function(subValue) { + result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); + }); + + return result; + } + + if (isMap(value)) { + value.forEach(function(subValue, key) { + result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); + }); + + return result; + } + + var keysFunc = isFull + ? (isFlat ? getAllKeysIn : getAllKeys) + : (isFlat ? keysIn : keys); + + var props = isArr ? undefined : keysFunc(value); + arrayEach(props || value, function(subValue, key) { + if (props) { + key = subValue; + subValue = value[key]; + } + // Recursively populate clone (susceptible to call stack limits). + assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack)); + }); + return result; + } + + /** + * The base implementation of `_.conforms` which doesn't clone `source`. + * + * @private + * @param {Object} source The object of property predicates to conform to. + * @returns {Function} Returns the new spec function. + */ + function baseConforms(source) { + var props = keys(source); + return function(object) { + return baseConformsTo(object, source, props); + }; + } + + /** + * The base implementation of `_.conformsTo` which accepts `props` to check. + * + * @private + * @param {Object} object The object to inspect. + * @param {Object} source The object of property predicates to conform to. + * @returns {boolean} Returns `true` if `object` conforms, else `false`. + */ + function baseConformsTo(object, source, props) { + var length = props.length; + if (object == null) { + return !length; + } + object = Object(object); + while (length--) { + var key = props[length], + predicate = source[key], + value = object[key]; + + if ((value === undefined && !(key in object)) || !predicate(value)) { + return false; + } + } + return true; + } + + /** + * The base implementation of `_.delay` and `_.defer` which accepts `args` + * to provide to `func`. + * + * @private + * @param {Function} func The function to delay. + * @param {number} wait The number of milliseconds to delay invocation. + * @param {Array} args The arguments to provide to `func`. + * @returns {number|Object} Returns the timer id or timeout object. + */ + function baseDelay(func, wait, args) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + return setTimeout(function() { func.apply(undefined, args); }, wait); + } + + /** + * The base implementation of methods like `_.difference` without support + * for excluding multiple arrays or iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Array} values The values to exclude. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of filtered values. + */ + function baseDifference(array, values, iteratee, comparator) { + var index = -1, + includes = arrayIncludes, + isCommon = true, + length = array.length, + result = [], + valuesLength = values.length; + + if (!length) { + return result; + } + if (iteratee) { + values = arrayMap(values, baseUnary(iteratee)); + } + if (comparator) { + includes = arrayIncludesWith; + isCommon = false; + } + else if (values.length >= LARGE_ARRAY_SIZE) { + includes = cacheHas; + isCommon = false; + values = new SetCache(values); + } + outer: + while (++index < length) { + var value = array[index], + computed = iteratee == null ? value : iteratee(value); + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var valuesIndex = valuesLength; + while (valuesIndex--) { + if (values[valuesIndex] === computed) { + continue outer; + } + } + result.push(value); + } + else if (!includes(values, computed, comparator)) { + result.push(value); + } + } + return result; + } + + /** + * The base implementation of `_.forEach` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + */ + var baseEach = createBaseEach(baseForOwn); + + /** + * The base implementation of `_.forEachRight` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + */ + var baseEachRight = createBaseEach(baseForOwnRight, true); + + /** + * The base implementation of `_.every` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} 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 methods like `_.max` and `_.min` which accepts a + * `comparator` to determine the extremum value. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The iteratee invoked per iteration. + * @param {Function} comparator The comparator used to compare values. + * @returns {*} Returns the extremum value. + */ + function baseExtremum(array, iteratee, comparator) { + var index = -1, + length = array.length; + + while (++index < length) { + var value = array[index], + current = iteratee(value); + + if (current != null && (computed === undefined + ? (current === current && !isSymbol(current)) + : comparator(current, computed) + )) { + var computed = current, + result = value; + } + } + return result; + } + + /** + * The base implementation of `_.fill` without an iteratee call guard. + * + * @private + * @param {Array} array The array to fill. + * @param {*} value The value to fill `array` with. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns `array`. + */ + function baseFill(array, value, start, end) { + var length = array.length; + + start = toInteger(start); + if (start < 0) { + start = -start > length ? 0 : (length + start); + } + end = (end === undefined || end > length) ? length : toInteger(end); + if (end < 0) { + end += length; + } + end = start > end ? 0 : toLength(end); + while (start < end) { + array[start++] = value; + } + return array; + } + + /** + * The base implementation of `_.filter` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} 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 `_.flatten` with support for restricting flattening. + * + * @private + * @param {Array} array The array to flatten. + * @param {number} depth The maximum recursion depth. + * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. + * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. + * @param {Array} [result=[]] The initial result value. + * @returns {Array} Returns the new flattened array. + */ + function baseFlatten(array, depth, predicate, isStrict, result) { + var index = -1, + length = array.length; + + predicate || (predicate = isFlattenable); + result || (result = []); + + while (++index < length) { + var value = array[index]; + if (depth > 0 && predicate(value)) { + if (depth > 1) { + // Recursively flatten arrays (susceptible to call stack limits). + baseFlatten(value, depth - 1, predicate, isStrict, result); + } else { + arrayPush(result, value); + } + } else if (!isStrict) { + result[result.length] = value; + } + } + return result; + } + + /** + * The base implementation of `baseForOwn` which iterates over `object` + * properties returned by `keysFunc` and invokes `iteratee` for each property. + * Iteratee 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`. + */ + var baseFor = createBaseFor(); + + /** + * 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`. + */ + var baseForRight = createBaseFor(true); + + /** + * The base implementation of `_.forOwn` without support for iteratee shorthands. + * + * @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 object && baseFor(object, iteratee, keys); + } + + /** + * The base implementation of `_.forOwnRight` without support for iteratee shorthands. + * + * @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 object && baseForRight(object, iteratee, keys); + } + + /** + * The base implementation of `_.functions` which creates an array of + * `object` function property names filtered from `props`. + * + * @private + * @param {Object} object The object to inspect. + * @param {Array} props The property names to filter. + * @returns {Array} Returns the function names. + */ + function baseFunctions(object, props) { + return arrayFilter(props, function(key) { + return isFunction(object[key]); + }); + } + + /** + * The base implementation of `_.get` without support for default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. + */ + function baseGet(object, path) { + path = castPath(path, object); + + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[toKey(path[index++])]; + } + return (index && index == length) ? object : undefined; + } + + /** + * The base implementation of `getAllKeys` and `getAllKeysIn` which uses + * `keysFunc` and `symbolsFunc` to get the enumerable property names and + * symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Function} keysFunc The function to get the keys of `object`. + * @param {Function} symbolsFunc The function to get the symbols of `object`. + * @returns {Array} Returns the array of property names and symbols. + */ + function baseGetAllKeys(object, keysFunc, symbolsFunc) { + var result = keysFunc(object); + return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); + } + + /** + * The base implementation of `getTag` without fallbacks for buggy environments. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ + function baseGetTag(value) { + if (value == null) { + return value === undefined ? undefinedTag : nullTag; + } + return (symToStringTag && symToStringTag in Object(value)) + ? getRawTag(value) + : objectToString(value); + } + + /** + * The base implementation of `_.gt` which doesn't coerce arguments. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is greater than `other`, + * else `false`. + */ + function baseGt(value, other) { + return value > other; + } + + /** + * The base implementation of `_.has` without support for deep paths. + * + * @private + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */ + function baseHas(object, key) { + return object != null && hasOwnProperty.call(object, key); + } + + /** + * The base implementation of `_.hasIn` without support for deep paths. + * + * @private + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */ + function baseHasIn(object, key) { + return object != null && key in Object(object); + } + + /** + * The base implementation of `_.inRange` which doesn't coerce arguments. + * + * @private + * @param {number} number The number to check. + * @param {number} start The start of the range. + * @param {number} end The end of the range. + * @returns {boolean} Returns `true` if `number` is in the range, else `false`. + */ + function baseInRange(number, start, end) { + return number >= nativeMin(start, end) && number < nativeMax(start, end); + } + + /** + * The base implementation of methods like `_.intersection`, without support + * for iteratee shorthands, that accepts an array of arrays to inspect. + * + * @private + * @param {Array} arrays The arrays to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of shared values. + */ + function baseIntersection(arrays, iteratee, comparator) { + var includes = comparator ? arrayIncludesWith : arrayIncludes, + length = arrays[0].length, + othLength = arrays.length, + othIndex = othLength, + caches = Array(othLength), + maxLength = Infinity, + result = []; + + while (othIndex--) { + var array = arrays[othIndex]; + if (othIndex && iteratee) { + array = arrayMap(array, baseUnary(iteratee)); + } + maxLength = nativeMin(array.length, maxLength); + caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) + ? new SetCache(othIndex && array) + : undefined; + } + array = arrays[0]; + + var index = -1, + seen = caches[0]; + + outer: + while (++index < length && result.length < maxLength) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (!(seen + ? cacheHas(seen, computed) + : includes(result, computed, comparator) + )) { + othIndex = othLength; + while (--othIndex) { + var cache = caches[othIndex]; + if (!(cache + ? cacheHas(cache, computed) + : includes(arrays[othIndex], computed, comparator)) + ) { + continue outer; + } + } + if (seen) { + seen.push(computed); + } + result.push(value); + } + } + return result; + } + + /** + * The base implementation of `_.invert` and `_.invertBy` which inverts + * `object` with values transformed by `iteratee` and set by `setter`. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} setter The function to set `accumulator` values. + * @param {Function} iteratee The iteratee to transform values. + * @param {Object} accumulator The initial inverted object. + * @returns {Function} Returns `accumulator`. + */ + function baseInverter(object, setter, iteratee, accumulator) { + baseForOwn(object, function(value, key, object) { + setter(accumulator, iteratee(value), key, object); + }); + return accumulator; + } + + /** + * The base implementation of `_.invoke` without support for individual + * method arguments. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the method to invoke. + * @param {Array} args The arguments to invoke the method with. + * @returns {*} Returns the result of the invoked method. + */ + function baseInvoke(object, path, args) { + path = castPath(path, object); + object = parent(object, path); + var func = object == null ? object : object[toKey(last(path))]; + return func == null ? undefined : apply(func, object, args); + } + + /** + * The base implementation of `_.isArguments`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + */ + function baseIsArguments(value) { + return isObjectLike(value) && baseGetTag(value) == argsTag; + } + + /** + * The base implementation of `_.isArrayBuffer` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. + */ + function baseIsArrayBuffer(value) { + return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; + } + + /** + * The base implementation of `_.isDate` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a date object, else `false`. + */ + function baseIsDate(value) { + return isObjectLike(value) && baseGetTag(value) == dateTag; + } + + /** + * The base implementation of `_.isEqual` which supports partial comparisons + * and tracks traversed objects. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @param {boolean} bitmask The bitmask flags. + * 1 - Unordered comparison + * 2 - Partial comparison + * @param {Function} [customizer] The function to customize comparisons. + * @param {Object} [stack] Tracks traversed `value` and `other` objects. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + */ + function baseIsEqual(value, other, bitmask, customizer, stack) { + if (value === other) { + return true; + } + if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { + return value !== value && other !== other; + } + return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); + } + + /** + * 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 {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} [stack] Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ + function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { + var objIsArr = isArray(object), + othIsArr = isArray(other), + objTag = objIsArr ? arrayTag : getTag(object), + othTag = othIsArr ? arrayTag : getTag(other); + + objTag = objTag == argsTag ? objectTag : objTag; + othTag = othTag == argsTag ? objectTag : othTag; + + var objIsObj = objTag == objectTag, + othIsObj = othTag == objectTag, + isSameTag = objTag == othTag; + + if (isSameTag && isBuffer(object)) { + if (!isBuffer(other)) { + return false; + } + objIsArr = true; + objIsObj = false; + } + if (isSameTag && !objIsObj) { + stack || (stack = new Stack); + return (objIsArr || isTypedArray(object)) + ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) + : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); + } + if (!(bitmask & COMPARE_PARTIAL_FLAG)) { + var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), + othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); + + if (objIsWrapped || othIsWrapped) { + var objUnwrapped = objIsWrapped ? object.value() : object, + othUnwrapped = othIsWrapped ? other.value() : other; + + stack || (stack = new Stack); + return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); + } + } + if (!isSameTag) { + return false; + } + stack || (stack = new Stack); + return equalObjects(object, other, bitmask, customizer, equalFunc, stack); + } + + /** + * The base implementation of `_.isMap` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a map, else `false`. + */ + function baseIsMap(value) { + return isObjectLike(value) && getTag(value) == mapTag; + } + + /** + * The base implementation of `_.isMatch` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @param {Array} matchData The property names, values, and compare flags to match. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + */ + function baseIsMatch(object, source, matchData, customizer) { + var index = matchData.length, + length = index, + noCustomizer = !customizer; + + if (object == null) { + return !length; + } + object = Object(object); + while (index--) { + var data = matchData[index]; + if ((noCustomizer && data[2]) + ? data[1] !== object[data[0]] + : !(data[0] in object) + ) { + return false; + } + } + while (++index < length) { + data = matchData[index]; + var key = data[0], + objValue = object[key], + srcValue = data[1]; + + if (noCustomizer && data[2]) { + if (objValue === undefined && !(key in object)) { + return false; + } + } else { + var stack = new Stack; + if (customizer) { + var result = customizer(objValue, srcValue, key, object, source, stack); + } + if (!(result === undefined + ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) + : result + )) { + return false; + } + } + } + return true; + } + + /** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ + function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) { + return false; + } + var pattern = isFunction(value) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); + } + + /** + * The base implementation of `_.isRegExp` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. + */ + function baseIsRegExp(value) { + return isObjectLike(value) && baseGetTag(value) == regexpTag; + } + + /** + * The base implementation of `_.isSet` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a set, else `false`. + */ + function baseIsSet(value) { + return isObjectLike(value) && getTag(value) == setTag; + } + + /** + * The base implementation of `_.isTypedArray` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + */ + function baseIsTypedArray(value) { + return isObjectLike(value) && + isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; + } + + /** + * The base implementation of `_.iteratee`. + * + * @private + * @param {*} [value=_.identity] The value to convert to an iteratee. + * @returns {Function} Returns the iteratee. + */ + function baseIteratee(value) { + // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. + // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. + if (typeof value == 'function') { + return value; + } + if (value == null) { + return identity; + } + if (typeof value == 'object') { + return isArray(value) + ? baseMatchesProperty(value[0], value[1]) + : baseMatches(value); + } + return property(value); + } + + /** + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ + function baseKeys(object) { + if (!isPrototype(object)) { + return nativeKeys(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty.call(object, key) && key != 'constructor') { + result.push(key); + } + } + return result; + } + + /** + * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ + function baseKeysIn(object) { + if (!isObject(object)) { + return nativeKeysIn(object); + } + var isProto = isPrototype(object), + result = []; + + for (var key in object) { + if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { + result.push(key); + } + } + return result; + } + + /** + * The base implementation of `_.lt` which doesn't coerce arguments. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is less than `other`, + * else `false`. + */ + function baseLt(value, other) { + return value < other; + } + + /** + * The base implementation of `_.map` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} 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 index = -1, + result = isArrayLike(collection) ? Array(collection.length) : []; + + baseEach(collection, function(value, key, collection) { + result[++index] = iteratee(value, key, collection); + }); + return result; + } + + /** + * The base implementation of `_.matches` which doesn't clone `source`. + * + * @private + * @param {Object} source The object of property values to match. + * @returns {Function} Returns the new spec function. + */ + function baseMatches(source) { + var matchData = getMatchData(source); + if (matchData.length == 1 && matchData[0][2]) { + return matchesStrictComparable(matchData[0][0], matchData[0][1]); + } + return function(object) { + return object === source || baseIsMatch(object, source, matchData); + }; + } + + /** + * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. + * + * @private + * @param {string} path The path of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new spec function. + */ + function baseMatchesProperty(path, srcValue) { + if (isKey(path) && isStrictComparable(srcValue)) { + return matchesStrictComparable(toKey(path), srcValue); + } + return function(object) { + var objValue = get(object, path); + return (objValue === undefined && objValue === srcValue) + ? hasIn(object, path) + : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); + }; + } + + /** + * The base implementation of `_.merge` without support for multiple sources. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @param {number} srcIndex The index of `source`. + * @param {Function} [customizer] The function to customize merged values. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. + */ + function baseMerge(object, source, srcIndex, customizer, stack) { + if (object === source) { + return; + } + baseFor(source, function(srcValue, key) { + if (isObject(srcValue)) { + stack || (stack = new Stack); + baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); + } + else { + var newValue = customizer + ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) + : undefined; + + if (newValue === undefined) { + newValue = srcValue; + } + assignMergeValue(object, key, newValue); + } + }, keysIn); + } + + /** + * 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 {number} srcIndex The index of `source`. + * @param {Function} mergeFunc The function to merge values. + * @param {Function} [customizer] The function to customize assigned values. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. + */ + function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { + var objValue = safeGet(object, key), + srcValue = safeGet(source, key), + stacked = stack.get(srcValue); + + if (stacked) { + assignMergeValue(object, key, stacked); + return; + } + var newValue = customizer + ? customizer(objValue, srcValue, (key + ''), object, source, stack) + : undefined; + + var isCommon = newValue === undefined; + + if (isCommon) { + var isArr = isArray(srcValue), + isBuff = !isArr && isBuffer(srcValue), + isTyped = !isArr && !isBuff && isTypedArray(srcValue); + + newValue = srcValue; + if (isArr || isBuff || isTyped) { + if (isArray(objValue)) { + newValue = objValue; + } + else if (isArrayLikeObject(objValue)) { + newValue = copyArray(objValue); + } + else if (isBuff) { + isCommon = false; + newValue = cloneBuffer(srcValue, true); + } + else if (isTyped) { + isCommon = false; + newValue = cloneTypedArray(srcValue, true); + } + else { + newValue = []; + } + } + else if (isPlainObject(srcValue) || isArguments(srcValue)) { + newValue = objValue; + if (isArguments(objValue)) { + newValue = toPlainObject(objValue); + } + else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) { + newValue = initCloneObject(srcValue); + } + } + else { + isCommon = false; + } + } + if (isCommon) { + // Recursively merge objects and arrays (susceptible to call stack limits). + stack.set(srcValue, newValue); + mergeFunc(newValue, srcValue, srcIndex, customizer, stack); + stack['delete'](srcValue); + } + assignMergeValue(object, key, newValue); + } + + /** + * The base implementation of `_.nth` which doesn't coerce arguments. + * + * @private + * @param {Array} array The array to query. + * @param {number} n The index of the element to return. + * @returns {*} Returns the nth element of `array`. + */ + function baseNth(array, n) { + var length = array.length; + if (!length) { + return; + } + n += n < 0 ? length : 0; + return isIndex(n, length) ? array[n] : undefined; + } + + /** + * The base implementation of `_.orderBy` without param guards. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. + * @param {string[]} orders The sort orders of `iteratees`. + * @returns {Array} Returns the new sorted array. + */ + function baseOrderBy(collection, iteratees, orders) { + var index = -1; + iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee())); + + var result = baseMap(collection, function(value, key, collection) { + var criteria = arrayMap(iteratees, function(iteratee) { + return iteratee(value); + }); + return { 'criteria': criteria, 'index': ++index, 'value': value }; + }); + + return baseSortBy(result, function(object, other) { + return compareMultiple(object, other, orders); + }); + } + + /** + * The base implementation of `_.pick` without support for individual + * property identifiers. + * + * @private + * @param {Object} object The source object. + * @param {string[]} paths The property paths to pick. + * @returns {Object} Returns the new object. + */ + function basePick(object, paths) { + return basePickBy(object, paths, function(value, path) { + return hasIn(object, path); + }); + } + + /** + * The base implementation of `_.pickBy` without support for iteratee shorthands. + * + * @private + * @param {Object} object The source object. + * @param {string[]} paths The property paths to pick. + * @param {Function} predicate The function invoked per property. + * @returns {Object} Returns the new object. + */ + function basePickBy(object, paths, predicate) { + var index = -1, + length = paths.length, + result = {}; + + while (++index < length) { + var path = paths[index], + value = baseGet(object, path); + + if (predicate(value, path)) { + baseSet(result, castPath(path, object), value); + } + } + return result; + } + + /** + * A specialized version of `baseProperty` which supports deep paths. + * + * @private + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new accessor function. + */ + function basePropertyDeep(path) { + return function(object) { + return baseGet(object, path); + }; + } + + /** + * The base implementation of `_.pullAllBy` without support for iteratee + * shorthands. + * + * @private + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns `array`. + */ + function basePullAll(array, values, iteratee, comparator) { + var indexOf = comparator ? baseIndexOfWith : baseIndexOf, + index = -1, + length = values.length, + seen = array; + + if (array === values) { + values = copyArray(values); + } + if (iteratee) { + seen = arrayMap(array, baseUnary(iteratee)); + } + while (++index < length) { + var fromIndex = 0, + value = values[index], + computed = iteratee ? iteratee(value) : value; + + while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { + if (seen !== array) { + splice.call(seen, fromIndex, 1); + } + splice.call(array, fromIndex, 1); + } + } + return array; + } + + /** + * The base implementation of `_.pullAt` without support for individual + * indexes or capturing the removed elements. + * + * @private + * @param {Array} array The array to modify. + * @param {number[]} indexes The indexes of elements to remove. + * @returns {Array} Returns `array`. + */ + function basePullAt(array, indexes) { + var length = array ? indexes.length : 0, + lastIndex = length - 1; + + while (length--) { + var index = indexes[length]; + if (length == lastIndex || index !== previous) { + var previous = index; + if (isIndex(index)) { + splice.call(array, index, 1); + } else { + baseUnset(array, index); + } + } + } + return array; + } + + /** + * The base implementation of `_.random` without support for returning + * floating-point numbers. + * + * @private + * @param {number} lower The lower bound. + * @param {number} upper The upper bound. + * @returns {number} Returns the random number. + */ + function baseRandom(lower, upper) { + return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); + } + + /** + * The base implementation of `_.range` and `_.rangeRight` which doesn't + * coerce arguments. + * + * @private + * @param {number} start The start of the range. + * @param {number} end The end of the range. + * @param {number} step The value to increment or decrement by. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Array} Returns the range of numbers. + */ + function baseRange(start, end, step, fromRight) { + var index = -1, + length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), + result = Array(length); + + while (length--) { + result[fromRight ? length : ++index] = start; + start += step; + } + return result; + } + + /** + * The base implementation of `_.repeat` which doesn't coerce arguments. + * + * @private + * @param {string} string The string to repeat. + * @param {number} n The number of times to repeat the string. + * @returns {string} Returns the repeated string. + */ + function baseRepeat(string, n) { + var result = ''; + if (!string || n < 1 || n > MAX_SAFE_INTEGER) { + 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 = nativeFloor(n / 2); + if (n) { + string += string; + } + } while (n); + + return result; + } + + /** + * The base implementation of `_.rest` which doesn't validate or coerce arguments. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + */ + function baseRest(func, start) { + return setToString(overRest(func, start, identity), func + ''); + } + + /** + * The base implementation of `_.sample`. + * + * @private + * @param {Array|Object} collection The collection to sample. + * @returns {*} Returns the random element. + */ + function baseSample(collection) { + return arraySample(values(collection)); + } + + /** + * The base implementation of `_.sampleSize` without param guards. + * + * @private + * @param {Array|Object} collection The collection to sample. + * @param {number} n The number of elements to sample. + * @returns {Array} Returns the random elements. + */ + function baseSampleSize(collection, n) { + var array = values(collection); + return shuffleSelf(array, baseClamp(n, 0, array.length)); + } + + /** + * The base implementation of `_.set`. + * + * @private + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {*} value The value to set. + * @param {Function} [customizer] The function to customize path creation. + * @returns {Object} Returns `object`. + */ + function baseSet(object, path, value, customizer) { + if (!isObject(object)) { + return object; + } + path = castPath(path, object); + + var index = -1, + length = path.length, + lastIndex = length - 1, + nested = object; + + while (nested != null && ++index < length) { + var key = toKey(path[index]), + newValue = value; + + if (index != lastIndex) { + var objValue = nested[key]; + newValue = customizer ? customizer(objValue, key, nested) : undefined; + if (newValue === undefined) { + newValue = isObject(objValue) + ? objValue + : (isIndex(path[index + 1]) ? [] : {}); + } + } + assignValue(nested, key, newValue); + nested = nested[key]; + } + return object; + } + + /** + * The base implementation of `setData` without support for hot loop shorting. + * + * @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 `setToString` without support for hot loop shorting. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ + var baseSetToString = !defineProperty ? identity : function(func, string) { + return defineProperty(func, 'toString', { + 'configurable': true, + 'enumerable': false, + 'value': constant(string), + 'writable': true + }); + }; + + /** + * The base implementation of `_.shuffle`. + * + * @private + * @param {Array|Object} collection The collection to shuffle. + * @returns {Array} Returns the new shuffled array. + */ + function baseShuffle(collection) { + return shuffleSelf(values(collection)); + } + + /** + * 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; + + if (start < 0) { + start = -start > length ? 0 : (length + start); + } + end = end > length ? length : end; + 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 iteratee shorthands. + * + * @private + * @param {Array|Object} 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 `_.sortedIndex` and `_.sortedLastIndex` which + * 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 qualified index. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + */ + function baseSortedIndex(array, value, retHighest) { + var low = 0, + high = array == null ? low : array.length; + + if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { + while (low < high) { + var mid = (low + high) >>> 1, + computed = array[mid]; + + if (computed !== null && !isSymbol(computed) && + (retHighest ? (computed <= value) : (computed < value))) { + low = mid + 1; + } else { + high = mid; + } + } + return high; + } + return baseSortedIndexBy(array, value, identity, retHighest); + } + + /** + * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy` + * which 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 iteratee invoked per element. + * @param {boolean} [retHighest] Specify returning the highest qualified index. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + */ + function baseSortedIndexBy(array, value, iteratee, retHighest) { + value = iteratee(value); + + var low = 0, + high = array == null ? 0 : array.length, + valIsNaN = value !== value, + valIsNull = value === null, + valIsSymbol = isSymbol(value), + valIsUndefined = value === undefined; + + while (low < high) { + var mid = nativeFloor((low + high) / 2), + computed = iteratee(array[mid]), + othIsDefined = computed !== undefined, + othIsNull = computed === null, + othIsReflexive = computed === computed, + othIsSymbol = isSymbol(computed); + + if (valIsNaN) { + var setLow = retHighest || othIsReflexive; + } else if (valIsUndefined) { + setLow = othIsReflexive && (retHighest || othIsDefined); + } else if (valIsNull) { + setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); + } else if (valIsSymbol) { + setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); + } else if (othIsNull || othIsSymbol) { + setLow = false; + } else { + setLow = retHighest ? (computed <= value) : (computed < value); + } + if (setLow) { + low = mid + 1; + } else { + high = mid; + } + } + return nativeMin(high, MAX_ARRAY_INDEX); + } + + /** + * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without + * support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @returns {Array} Returns the new duplicate free array. + */ + function baseSortedUniq(array, iteratee) { + var index = -1, + length = array.length, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + if (!index || !eq(computed, seen)) { + var seen = computed; + result[resIndex++] = value === 0 ? 0 : value; + } + } + return result; + } + + /** + * The base implementation of `_.toNumber` which doesn't ensure correct + * conversions of binary, hexadecimal, or octal string values. + * + * @private + * @param {*} value The value to process. + * @returns {number} Returns the number. + */ + function baseToNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol(value)) { + return NAN; + } + return +value; + } + + /** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ + function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (isArray(value)) { + // Recursively convert values (susceptible to call stack limits). + return arrayMap(value, baseToString) + ''; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; + } + + /** + * The base implementation of `_.uniqBy` without support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new duplicate free array. + */ + function baseUniq(array, iteratee, comparator) { + var index = -1, + includes = arrayIncludes, + length = array.length, + isCommon = true, + result = [], + seen = result; + + if (comparator) { + isCommon = false; + includes = arrayIncludesWith; + } + else if (length >= LARGE_ARRAY_SIZE) { + var set = iteratee ? null : createSet(array); + if (set) { + return setToArray(set); + } + isCommon = false; + includes = cacheHas; + seen = new SetCache; + } + else { + seen = iteratee ? [] : result; + } + outer: + while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var seenIndex = seen.length; + while (seenIndex--) { + if (seen[seenIndex] === computed) { + continue outer; + } + } + if (iteratee) { + seen.push(computed); + } + result.push(value); + } + else if (!includes(seen, computed, comparator)) { + if (seen !== result) { + seen.push(computed); + } + result.push(value); + } + } + return result; + } + + /** + * The base implementation of `_.unset`. + * + * @private + * @param {Object} object The object to modify. + * @param {Array|string} path The property path to unset. + * @returns {boolean} Returns `true` if the property is deleted, else `false`. + */ + function baseUnset(object, path) { + path = castPath(path, object); + object = parent(object, path); + return object == null || delete object[toKey(last(path))]; + } + + /** + * The base implementation of `_.update`. + * + * @private + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to update. + * @param {Function} updater The function to produce the updated value. + * @param {Function} [customizer] The function to customize path creation. + * @returns {Object} Returns `object`. + */ + function baseUpdate(object, path, updater, customizer) { + return baseSet(object, path, updater(baseGet(object, path)), customizer); + } + + /** + * The base implementation of methods like `_.dropWhile` and `_.takeWhile` + * without support for iteratee shorthands. + * + * @private + * @param {Array} array The array to query. + * @param {Function} predicate The function invoked per iteration. + * @param {boolean} [isDrop] Specify dropping elements instead of taking them. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Array} Returns the slice of `array`. + */ + function baseWhile(array, predicate, isDrop, fromRight) { + var length = array.length, + index = fromRight ? length : -1; + + while ((fromRight ? index-- : ++index < length) && + predicate(array[index], index, array)) {} + + return isDrop + ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) + : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); + } + + /** + * 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 perform to resolve the unwrapped value. + * @returns {*} Returns the resolved value. + */ + function baseWrapperValue(value, actions) { + var result = value; + if (result instanceof LazyWrapper) { + result = result.value(); + } + return arrayReduce(actions, function(result, action) { + return action.func.apply(action.thisArg, arrayPush([result], action.args)); + }, result); + } + + /** + * The base implementation of methods like `_.xor`, without support for + * iteratee shorthands, that accepts an array of arrays to inspect. + * + * @private + * @param {Array} arrays The arrays to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of values. + */ + function baseXor(arrays, iteratee, comparator) { + var length = arrays.length; + if (length < 2) { + return length ? baseUniq(arrays[0]) : []; + } + var index = -1, + result = Array(length); + + while (++index < length) { + var array = arrays[index], + othIndex = -1; + + while (++othIndex < length) { + if (othIndex != index) { + result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator); + } + } + } + return baseUniq(baseFlatten(result, 1), iteratee, comparator); + } + + /** + * This base implementation of `_.zipObject` which assigns values using `assignFunc`. + * + * @private + * @param {Array} props The property identifiers. + * @param {Array} values The property values. + * @param {Function} assignFunc The function to assign values. + * @returns {Object} Returns the new object. + */ + function baseZipObject(props, values, assignFunc) { + var index = -1, + length = props.length, + valsLength = values.length, + result = {}; + + while (++index < length) { + var value = index < valsLength ? values[index] : undefined; + assignFunc(result, props[index], value); + } + return result; + } + + /** + * Casts `value` to an empty array if it's not an array like object. + * + * @private + * @param {*} value The value to inspect. + * @returns {Array|Object} Returns the cast array-like object. + */ + function castArrayLikeObject(value) { + return isArrayLikeObject(value) ? value : []; + } + + /** + * Casts `value` to `identity` if it's not a function. + * + * @private + * @param {*} value The value to inspect. + * @returns {Function} Returns cast function. + */ + function castFunction(value) { + return typeof value == 'function' ? value : identity; + } + + /** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @param {Object} [object] The object to query keys on. + * @returns {Array} Returns the cast property path array. + */ + function castPath(value, object) { + if (isArray(value)) { + return value; + } + return isKey(value, object) ? [value] : stringToPath(toString(value)); + } + + /** + * A `baseRest` alias which can be replaced with `identity` by module + * replacement plugins. + * + * @private + * @type {Function} + * @param {Function} func The function to apply a rest parameter to. + * @returns {Function} Returns the new function. + */ + var castRest = baseRest; + + /** + * Casts `array` to a slice if it's needed. + * + * @private + * @param {Array} array The array to inspect. + * @param {number} start The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the cast slice. + */ + function castSlice(array, start, end) { + var length = array.length; + end = end === undefined ? length : end; + return (!start && end >= length) ? array : baseSlice(array, start, end); + } + + /** + * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout). + * + * @private + * @param {number|Object} id The timer id or timeout object of the timer to clear. + */ + var clearTimeout = ctxClearTimeout || function(id) { + return root.clearTimeout(id); + }; + + /** + * Creates a clone of `buffer`. + * + * @private + * @param {Buffer} buffer The buffer to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Buffer} Returns the cloned buffer. + */ + function cloneBuffer(buffer, isDeep) { + if (isDeep) { + return buffer.slice(); + } + var length = buffer.length, + result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); + + buffer.copy(result); + return result; + } + + /** + * Creates a clone of `arrayBuffer`. + * + * @private + * @param {ArrayBuffer} arrayBuffer The array buffer to clone. + * @returns {ArrayBuffer} Returns the cloned array buffer. + */ + function cloneArrayBuffer(arrayBuffer) { + var result = new arrayBuffer.constructor(arrayBuffer.byteLength); + new Uint8Array(result).set(new Uint8Array(arrayBuffer)); + return result; + } + + /** + * Creates a clone of `dataView`. + * + * @private + * @param {Object} dataView The data view to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Object} Returns the cloned data view. + */ + function cloneDataView(dataView, isDeep) { + var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; + return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); + } + + /** + * Creates a clone of `regexp`. + * + * @private + * @param {Object} regexp The regexp to clone. + * @returns {Object} Returns the cloned regexp. + */ + function cloneRegExp(regexp) { + var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); + result.lastIndex = regexp.lastIndex; + return result; + } + + /** + * Creates a clone of the `symbol` object. + * + * @private + * @param {Object} symbol The symbol object to clone. + * @returns {Object} Returns the cloned symbol object. + */ + function cloneSymbol(symbol) { + return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; + } + + /** + * Creates a clone of `typedArray`. + * + * @private + * @param {Object} typedArray The typed array to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Object} Returns the cloned typed array. + */ + function cloneTypedArray(typedArray, isDeep) { + var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; + return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); + } + + /** + * Compares values to sort them in ascending order. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {number} Returns the sort order indicator for `value`. + */ + function compareAscending(value, other) { + if (value !== other) { + var valIsDefined = value !== undefined, + valIsNull = value === null, + valIsReflexive = value === value, + valIsSymbol = isSymbol(value); + + var othIsDefined = other !== undefined, + othIsNull = other === null, + othIsReflexive = other === other, + othIsSymbol = isSymbol(other); + + if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) || + (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) || + (valIsNull && othIsDefined && othIsReflexive) || + (!valIsDefined && othIsReflexive) || + !valIsReflexive) { + return 1; + } + if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) || + (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) || + (othIsNull && valIsDefined && valIsReflexive) || + (!othIsDefined && valIsReflexive) || + !othIsReflexive) { + return -1; + } + } + return 0; + } + + /** + * Used by `_.orderBy` to compare multiple properties of a value to another + * and stable sort them. + * + * If `orders` is unspecified, all values are sorted in ascending order. Otherwise, + * specify an order of "desc" for descending or "asc" for ascending sort order + * of corresponding values. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {boolean[]|string[]} orders The order to sort by for each property. + * @returns {number} Returns the sort order indicator for `object`. + */ + function compareMultiple(object, other, orders) { + var index = -1, + objCriteria = object.criteria, + othCriteria = other.criteria, + length = objCriteria.length, + ordersLength = orders.length; + + while (++index < length) { + var result = compareAscending(objCriteria[index], othCriteria[index]); + if (result) { + if (index >= ordersLength) { + return result; + } + var order = orders[index]; + return result * (order == 'desc' ? -1 : 1); + } + } + // 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://bugs.chromium.org/p/v8/issues/detail?id=90 for more details. + return object.index - other.index; + } + + /** + * Creates an array that is the composition of partially applied arguments, + * placeholders, and provided arguments into a single array of arguments. + * + * @private + * @param {Array} args The provided arguments. + * @param {Array} partials The arguments to prepend to those provided. + * @param {Array} holders The `partials` placeholder indexes. + * @params {boolean} [isCurried] Specify composing for a curried function. + * @returns {Array} Returns the new array of composed arguments. + */ + function composeArgs(args, partials, holders, isCurried) { + var argsIndex = -1, + argsLength = args.length, + holdersLength = holders.length, + leftIndex = -1, + leftLength = partials.length, + rangeLength = nativeMax(argsLength - holdersLength, 0), + result = Array(leftLength + rangeLength), + isUncurried = !isCurried; + + while (++leftIndex < leftLength) { + result[leftIndex] = partials[leftIndex]; + } + while (++argsIndex < holdersLength) { + if (isUncurried || argsIndex < argsLength) { + result[holders[argsIndex]] = args[argsIndex]; + } + } + while (rangeLength--) { + result[leftIndex++] = args[argsIndex++]; + } + return result; + } + + /** + * This function is like `composeArgs` except that the arguments composition + * is tailored for `_.partialRight`. + * + * @private + * @param {Array} args The provided arguments. + * @param {Array} partials The arguments to append to those provided. + * @param {Array} holders The `partials` placeholder indexes. + * @params {boolean} [isCurried] Specify composing for a curried function. + * @returns {Array} Returns the new array of composed arguments. + */ + function composeArgsRight(args, partials, holders, isCurried) { + var argsIndex = -1, + argsLength = args.length, + holdersIndex = -1, + holdersLength = holders.length, + rightIndex = -1, + rightLength = partials.length, + rangeLength = nativeMax(argsLength - holdersLength, 0), + result = Array(rangeLength + rightLength), + isUncurried = !isCurried; + + while (++argsIndex < rangeLength) { + result[argsIndex] = args[argsIndex]; + } + var offset = argsIndex; + while (++rightIndex < rightLength) { + result[offset + rightIndex] = partials[rightIndex]; + } + while (++holdersIndex < holdersLength) { + if (isUncurried || argsIndex < argsLength) { + result[offset + holders[holdersIndex]] = args[argsIndex++]; + } + } + return result; + } + + /** + * 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 copyArray(source, array) { + var index = -1, + length = source.length; + + array || (array = Array(length)); + while (++index < length) { + array[index] = source[index]; + } + return array; + } + + /** + * Copies properties of `source` to `object`. + * + * @private + * @param {Object} source The object to copy properties from. + * @param {Array} props The property identifiers to copy. + * @param {Object} [object={}] The object to copy properties to. + * @param {Function} [customizer] The function to customize copied values. + * @returns {Object} Returns `object`. + */ + function copyObject(source, props, object, customizer) { + var isNew = !object; + object || (object = {}); + + var index = -1, + length = props.length; + + while (++index < length) { + var key = props[index]; + + var newValue = customizer + ? customizer(object[key], source[key], key, object, source) + : undefined; + + if (newValue === undefined) { + newValue = source[key]; + } + if (isNew) { + baseAssignValue(object, key, newValue); + } else { + assignValue(object, key, newValue); + } + } + return object; + } + + /** + * Copies own symbols of `source` to `object`. + * + * @private + * @param {Object} source The object to copy symbols from. + * @param {Object} [object={}] The object to copy symbols to. + * @returns {Object} Returns `object`. + */ + function copySymbols(source, object) { + return copyObject(source, getSymbols(source), object); + } + + /** + * Copies own and inherited symbols of `source` to `object`. + * + * @private + * @param {Object} source The object to copy symbols from. + * @param {Object} [object={}] The object to copy symbols to. + * @returns {Object} Returns `object`. + */ + function copySymbolsIn(source, object) { + return copyObject(source, getSymbolsIn(source), object); + } + + /** + * Creates a function like `_.groupBy`. + * + * @private + * @param {Function} setter The function to set accumulator values. + * @param {Function} [initializer] The accumulator object initializer. + * @returns {Function} Returns the new aggregator function. + */ + function createAggregator(setter, initializer) { + return function(collection, iteratee) { + var func = isArray(collection) ? arrayAggregator : baseAggregator, + accumulator = initializer ? initializer() : {}; + + return func(collection, setter, getIteratee(iteratee, 2), accumulator); + }; + } + + /** + * Creates a function like `_.assign`. + * + * @private + * @param {Function} assigner The function to assign values. + * @returns {Function} Returns the new assigner function. + */ + function createAssigner(assigner) { + return baseRest(function(object, sources) { + var index = -1, + length = sources.length, + customizer = length > 1 ? sources[length - 1] : undefined, + guard = length > 2 ? sources[2] : undefined; + + customizer = (assigner.length > 3 && typeof customizer == 'function') + ? (length--, customizer) + : undefined; + + if (guard && isIterateeCall(sources[0], sources[1], guard)) { + customizer = length < 3 ? undefined : customizer; + length = 1; + } + object = Object(object); + while (++index < length) { + var source = sources[index]; + if (source) { + assigner(object, source, index, customizer); + } + } + return object; + }); + } + + /** + * Creates a `baseEach` or `baseEachRight` function. + * + * @private + * @param {Function} eachFunc The function to iterate over a collection. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ + function createBaseEach(eachFunc, fromRight) { + return function(collection, iteratee) { + if (collection == null) { + return collection; + } + if (!isArrayLike(collection)) { + return eachFunc(collection, iteratee); + } + var length = collection.length, + index = fromRight ? length : -1, + iterable = Object(collection); + + while ((fromRight ? index-- : ++index < length)) { + if (iteratee(iterable[index], index, iterable) === false) { + break; + } + } + return collection; + }; + } + + /** + * Creates a base function for methods like `_.forIn` and `_.forOwn`. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ + function createBaseFor(fromRight) { + return function(object, iteratee, keysFunc) { + var index = -1, + iterable = Object(object), + props = keysFunc(object), + length = props.length; + + while (length--) { + var key = props[fromRight ? length : ++index]; + if (iteratee(iterable[key], key, iterable) === false) { + break; + } + } + return object; + }; + } + + /** + * Creates a function that wraps `func` to invoke it with the optional `this` + * binding of `thisArg`. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} [thisArg] The `this` binding of `func`. + * @returns {Function} Returns the new wrapped function. + */ + function createBind(func, bitmask, thisArg) { + var isBind = bitmask & WRAP_BIND_FLAG, + Ctor = createCtor(func); + + function wrapper() { + var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + return fn.apply(isBind ? thisArg : this, arguments); + } + return wrapper; + } + + /** + * Creates a function like `_.lowerFirst`. + * + * @private + * @param {string} methodName The name of the `String` case method to use. + * @returns {Function} Returns the new case function. + */ + function createCaseFirst(methodName) { + return function(string) { + string = toString(string); + + var strSymbols = hasUnicode(string) + ? stringToArray(string) + : undefined; + + var chr = strSymbols + ? strSymbols[0] + : string.charAt(0); + + var trailing = strSymbols + ? castSlice(strSymbols, 1).join('') + : string.slice(1); + + return chr[methodName]() + trailing; + }; + } + + /** + * Creates a function like `_.camelCase`. + * + * @private + * @param {Function} callback The function to combine each word. + * @returns {Function} Returns the new compounder function. + */ + function createCompounder(callback) { + return function(string) { + return arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); + }; + } + + /** + * 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 createCtor(Ctor) { + return function() { + // Use a `switch` statement to work with class constructors. See + // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist + // for more details. + var args = arguments; + switch (args.length) { + case 0: return new Ctor; + case 1: return new Ctor(args[0]); + case 2: return new Ctor(args[0], args[1]); + case 3: return new Ctor(args[0], args[1], args[2]); + case 4: return new Ctor(args[0], args[1], args[2], args[3]); + case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); + case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); + case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); + } + var thisBinding = baseCreate(Ctor.prototype), + result = Ctor.apply(thisBinding, args); + + // 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 wraps `func` to enable currying. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {number} arity The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ + function createCurry(func, bitmask, arity) { + var Ctor = createCtor(func); + + function wrapper() { + var length = arguments.length, + args = Array(length), + index = length, + placeholder = getHolder(wrapper); + + while (index--) { + args[index] = arguments[index]; + } + var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) + ? [] + : replaceHolders(args, placeholder); + + length -= holders.length; + if (length < arity) { + return createRecurry( + func, bitmask, createHybrid, wrapper.placeholder, undefined, + args, holders, undefined, undefined, arity - length); + } + var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + return apply(fn, this, args); + } + return wrapper; + } + + /** + * Creates a `_.find` or `_.findLast` function. + * + * @private + * @param {Function} findIndexFunc The function to find the collection index. + * @returns {Function} Returns the new find function. + */ + function createFind(findIndexFunc) { + return function(collection, predicate, fromIndex) { + var iterable = Object(collection); + if (!isArrayLike(collection)) { + var iteratee = getIteratee(predicate, 3); + collection = keys(collection); + predicate = function(key) { return iteratee(iterable[key], key, iterable); }; + } + var index = findIndexFunc(collection, predicate, fromIndex); + return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined; + }; + } + + /** + * Creates a `_.flow` or `_.flowRight` function. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new flow function. + */ + function createFlow(fromRight) { + return flatRest(function(funcs) { + var length = funcs.length, + index = length, + prereq = LodashWrapper.prototype.thru; + + if (fromRight) { + funcs.reverse(); + } + while (index--) { + var func = funcs[index]; + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + if (prereq && !wrapper && getFuncName(func) == 'wrapper') { + var wrapper = new LodashWrapper([], true); + } + } + index = wrapper ? index : length; + while (++index < length) { + func = funcs[index]; + + var funcName = getFuncName(func), + data = funcName == 'wrapper' ? getData(func) : undefined; + + if (data && isLaziable(data[0]) && + data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && + !data[4].length && data[9] == 1 + ) { + wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); + } else { + wrapper = (func.length == 1 && isLaziable(func)) + ? wrapper[funcName]() + : wrapper.thru(func); + } + } + return function() { + var args = arguments, + value = args[0]; + + if (wrapper && args.length == 1 && isArray(value)) { + return wrapper.plant(value).value(); + } + var index = 0, + result = length ? funcs[index].apply(this, args) : value; + + while (++index < length) { + result = funcs[index].call(this, result); + } + return result; + }; + }); + } + + /** + * Creates a function that wraps `func` to invoke it with optional `this` + * binding of `thisArg`, partial application, and currying. + * + * @private + * @param {Function|string} func The function or method name to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` 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 createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { + var isAry = bitmask & WRAP_ARY_FLAG, + isBind = bitmask & WRAP_BIND_FLAG, + isBindKey = bitmask & WRAP_BIND_KEY_FLAG, + isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), + isFlip = bitmask & WRAP_FLIP_FLAG, + Ctor = isBindKey ? undefined : createCtor(func); + + function wrapper() { + var length = arguments.length, + args = Array(length), + index = length; + + while (index--) { + args[index] = arguments[index]; + } + if (isCurried) { + var placeholder = getHolder(wrapper), + holdersCount = countHolders(args, placeholder); + } + if (partials) { + args = composeArgs(args, partials, holders, isCurried); + } + if (partialsRight) { + args = composeArgsRight(args, partialsRight, holdersRight, isCurried); + } + length -= holdersCount; + if (isCurried && length < arity) { + var newHolders = replaceHolders(args, placeholder); + return createRecurry( + func, bitmask, createHybrid, wrapper.placeholder, thisArg, + args, newHolders, argPos, ary, arity - length + ); + } + var thisBinding = isBind ? thisArg : this, + fn = isBindKey ? thisBinding[func] : func; + + length = args.length; + if (argPos) { + args = reorder(args, argPos); + } else if (isFlip && length > 1) { + args.reverse(); + } + if (isAry && ary < length) { + args.length = ary; + } + if (this && this !== root && this instanceof wrapper) { + fn = Ctor || createCtor(fn); + } + return fn.apply(thisBinding, args); + } + return wrapper; + } + + /** + * Creates a function like `_.invertBy`. + * + * @private + * @param {Function} setter The function to set accumulator values. + * @param {Function} toIteratee The function to resolve iteratees. + * @returns {Function} Returns the new inverter function. + */ + function createInverter(setter, toIteratee) { + return function(object, iteratee) { + return baseInverter(object, setter, toIteratee(iteratee), {}); + }; + } + + /** + * Creates a function that performs a mathematical operation on two values. + * + * @private + * @param {Function} operator The function to perform the operation. + * @param {number} [defaultValue] The value used for `undefined` arguments. + * @returns {Function} Returns the new mathematical operation function. + */ + function createMathOperation(operator, defaultValue) { + return function(value, other) { + var result; + if (value === undefined && other === undefined) { + return defaultValue; + } + if (value !== undefined) { + result = value; + } + if (other !== undefined) { + if (result === undefined) { + return other; + } + if (typeof value == 'string' || typeof other == 'string') { + value = baseToString(value); + other = baseToString(other); + } else { + value = baseToNumber(value); + other = baseToNumber(other); + } + result = operator(value, other); + } + return result; + }; + } + + /** + * Creates a function like `_.over`. + * + * @private + * @param {Function} arrayFunc The function to iterate over iteratees. + * @returns {Function} Returns the new over function. + */ + function createOver(arrayFunc) { + return flatRest(function(iteratees) { + iteratees = arrayMap(iteratees, baseUnary(getIteratee())); + return baseRest(function(args) { + var thisArg = this; + return arrayFunc(iteratees, function(iteratee) { + return apply(iteratee, thisArg, args); + }); + }); + }); + } + + /** + * Creates the padding for `string` based on `length`. The `chars` string + * is truncated if the number of characters exceeds `length`. + * + * @private + * @param {number} length The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the padding for `string`. + */ + function createPadding(length, chars) { + chars = chars === undefined ? ' ' : baseToString(chars); + + var charsLength = chars.length; + if (charsLength < 2) { + return charsLength ? baseRepeat(chars, length) : chars; + } + var result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); + return hasUnicode(chars) + ? castSlice(stringToArray(result), 0, length).join('') + : result.slice(0, length); + } + + /** + * Creates a function that wraps `func` to invoke it with the `this` binding + * of `thisArg` and `partials` prepended to the arguments it receives. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` 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 wrapped function. + */ + function createPartial(func, bitmask, thisArg, partials) { + var isBind = bitmask & WRAP_BIND_FLAG, + Ctor = createCtor(func); + + function wrapper() { + var argsIndex = -1, + argsLength = arguments.length, + leftIndex = -1, + leftLength = partials.length, + args = Array(leftLength + argsLength), + fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + + while (++leftIndex < leftLength) { + args[leftIndex] = partials[leftIndex]; + } + while (argsLength--) { + args[leftIndex++] = arguments[++argsIndex]; + } + return apply(fn, isBind ? thisArg : this, args); + } + return wrapper; + } + + /** + * Creates a `_.range` or `_.rangeRight` function. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new range function. + */ + function createRange(fromRight) { + return function(start, end, step) { + if (step && typeof step != 'number' && isIterateeCall(start, end, step)) { + end = step = undefined; + } + // Ensure the sign of `-0` is preserved. + start = toFinite(start); + if (end === undefined) { + end = start; + start = 0; + } else { + end = toFinite(end); + } + step = step === undefined ? (start < end ? 1 : -1) : toFinite(step); + return baseRange(start, end, step, fromRight); + }; + } + + /** + * Creates a function that performs a relational operation on two values. + * + * @private + * @param {Function} operator The function to perform the operation. + * @returns {Function} Returns the new relational operation function. + */ + function createRelationalOperation(operator) { + return function(value, other) { + if (!(typeof value == 'string' && typeof other == 'string')) { + value = toNumber(value); + other = toNumber(other); + } + return operator(value, other); + }; + } + + /** + * Creates a function that wraps `func` to continue currying. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {Function} wrapFunc The function to create the `func` wrapper. + * @param {*} placeholder The placeholder value. + * @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} [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 createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { + var isCurry = bitmask & WRAP_CURRY_FLAG, + newHolders = isCurry ? holders : undefined, + newHoldersRight = isCurry ? undefined : holders, + newPartials = isCurry ? partials : undefined, + newPartialsRight = isCurry ? undefined : partials; + + bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG); + bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG); + + if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) { + bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG); + } + var newData = [ + func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, + newHoldersRight, argPos, ary, arity + ]; + + var result = wrapFunc.apply(undefined, newData); + if (isLaziable(func)) { + setData(result, newData); + } + result.placeholder = placeholder; + return setWrapToString(result, func, bitmask); + } + + /** + * Creates a function like `_.round`. + * + * @private + * @param {string} methodName The name of the `Math` method to use when rounding. + * @returns {Function} Returns the new round function. + */ + function createRound(methodName) { + var func = Math[methodName]; + return function(number, precision) { + number = toNumber(number); + precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); + if (precision) { + // Shift with exponential notation to avoid floating-point issues. + // See [MDN](https://mdn.io/round#Examples) for more details. + var pair = (toString(number) + 'e').split('e'), + value = func(pair[0] + 'e' + (+pair[1] + precision)); + + pair = (toString(value) + 'e').split('e'); + return +(pair[0] + 'e' + (+pair[1] - precision)); + } + return func(number); + }; + } + + /** + * Creates a set object of `values`. + * + * @private + * @param {Array} values The values to add to the set. + * @returns {Object} Returns the new set. + */ + var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) { + return new Set(values); + }; + + /** + * Creates a `_.toPairs` or `_.toPairsIn` function. + * + * @private + * @param {Function} keysFunc The function to get the keys of a given object. + * @returns {Function} Returns the new pairs function. + */ + function createToPairs(keysFunc) { + return function(object) { + var tag = getTag(object); + if (tag == mapTag) { + return mapToArray(object); + } + if (tag == setTag) { + return setToPairs(object); + } + return baseToPairs(object, keysFunc(object)); + }; + } + + /** + * Creates a function that either curries or invokes `func` with optional + * `this` binding and partially applied arguments. + * + * @private + * @param {Function|string} func The function or method name to wrap. + * @param {number} bitmask The bitmask 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` + * 512 - `_.flip` + * @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 createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { + var isBindKey = bitmask & WRAP_BIND_KEY_FLAG; + if (!isBindKey && typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + var length = partials ? partials.length : 0; + if (!length) { + bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG); + partials = holders = undefined; + } + ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); + arity = arity === undefined ? arity : toInteger(arity); + length -= holders ? holders.length : 0; + + if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) { + var partialsRight = partials, + holdersRight = holders; + + partials = holders = undefined; + } + var data = isBindKey ? undefined : getData(func); + + var newData = [ + func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, + argPos, ary, arity + ]; + + if (data) { + mergeData(newData, data); + } + func = newData[0]; + bitmask = newData[1]; + thisArg = newData[2]; + partials = newData[3]; + holders = newData[4]; + arity = newData[9] = newData[9] === undefined + ? (isBindKey ? 0 : func.length) + : nativeMax(newData[9] - length, 0); + + if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { + bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); + } + if (!bitmask || bitmask == WRAP_BIND_FLAG) { + var result = createBind(func, bitmask, thisArg); + } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) { + result = createCurry(func, bitmask, arity); + } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { + result = createPartial(func, bitmask, thisArg, partials); + } else { + result = createHybrid.apply(undefined, newData); + } + var setter = data ? baseSetData : setData; + return setWrapToString(setter(result, newData), func, bitmask); + } + + /** + * Used by `_.defaults` to customize its `_.assignIn` use to assign properties + * of source objects to the destination object for all destination properties + * that resolve to `undefined`. + * + * @private + * @param {*} objValue The destination value. + * @param {*} srcValue The source value. + * @param {string} key The key of the property to assign. + * @param {Object} object The parent object of `objValue`. + * @returns {*} Returns the value to assign. + */ + function customDefaultsAssignIn(objValue, srcValue, key, object) { + if (objValue === undefined || + (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { + return srcValue; + } + return objValue; + } + + /** + * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source + * objects into destination objects that are passed thru. + * + * @private + * @param {*} objValue The destination value. + * @param {*} srcValue The source value. + * @param {string} key The key of the property to merge. + * @param {Object} object The parent object of `objValue`. + * @param {Object} source The parent object of `srcValue`. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. + * @returns {*} Returns the value to assign. + */ + function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { + if (isObject(objValue) && isObject(srcValue)) { + // Recursively merge objects and arrays (susceptible to call stack limits). + stack.set(srcValue, objValue); + baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack); + stack['delete'](srcValue); + } + return objValue; + } + + /** + * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain + * objects. + * + * @private + * @param {*} value The value to inspect. + * @param {string} key The key of the property to inspect. + * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`. + */ + function customOmitClone(value) { + return isPlainObject(value) ? undefined : value; + } + + /** + * 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 {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} stack Tracks traversed `array` and `other` objects. + * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. + */ + function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG, + arrLength = array.length, + othLength = other.length; + + if (arrLength != othLength && !(isPartial && othLength > arrLength)) { + return false; + } + // Assume cyclic values are equal. + var stacked = stack.get(array); + if (stacked && stack.get(other)) { + return stacked == other; + } + var index = -1, + result = true, + seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined; + + stack.set(array, other); + stack.set(other, array); + + // Ignore non-index properties. + while (++index < arrLength) { + var arrValue = array[index], + othValue = other[index]; + + if (customizer) { + var compared = isPartial + ? customizer(othValue, arrValue, index, other, array, stack) + : customizer(arrValue, othValue, index, array, other, stack); + } + if (compared !== undefined) { + if (compared) { + continue; + } + result = false; + break; + } + // Recursively compare arrays (susceptible to call stack limits). + if (seen) { + if (!arraySome(other, function(othValue, othIndex) { + if (!cacheHas(seen, othIndex) && + (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { + return seen.push(othIndex); + } + })) { + result = false; + break; + } + } else if (!( + arrValue === othValue || + equalFunc(arrValue, othValue, bitmask, customizer, stack) + )) { + result = false; + break; + } + } + stack['delete'](array); + stack['delete'](other); + 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} object The object to compare. + * @param {Object} other The other object to compare. + * @param {string} tag The `toStringTag` of the objects to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} stack Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ + function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { + switch (tag) { + case dataViewTag: + if ((object.byteLength != other.byteLength) || + (object.byteOffset != other.byteOffset)) { + return false; + } + object = object.buffer; + other = other.buffer; + + case arrayBufferTag: + if ((object.byteLength != other.byteLength) || + !equalFunc(new Uint8Array(object), new Uint8Array(other))) { + return false; + } + return true; + + case boolTag: + case dateTag: + case numberTag: + // Coerce booleans to `1` or `0` and dates to milliseconds. + // Invalid dates are coerced to `NaN`. + return eq(+object, +other); + + case errorTag: + return object.name == other.name && object.message == other.message; + + case regexpTag: + case stringTag: + // Coerce regexes to strings and treat strings, primitives and objects, + // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring + // for more details. + return object == (other + ''); + + case mapTag: + var convert = mapToArray; + + case setTag: + var isPartial = bitmask & COMPARE_PARTIAL_FLAG; + convert || (convert = setToArray); + + if (object.size != other.size && !isPartial) { + return false; + } + // Assume cyclic values are equal. + var stacked = stack.get(object); + if (stacked) { + return stacked == other; + } + bitmask |= COMPARE_UNORDERED_FLAG; + + // Recursively compare objects (susceptible to call stack limits). + stack.set(object, other); + var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); + stack['delete'](object); + return result; + + case symbolTag: + if (symbolValueOf) { + return symbolValueOf.call(object) == symbolValueOf.call(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 {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} stack Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ + function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG, + objProps = getAllKeys(object), + objLength = objProps.length, + othProps = getAllKeys(other), + othLength = othProps.length; + + if (objLength != othLength && !isPartial) { + return false; + } + var index = objLength; + while (index--) { + var key = objProps[index]; + if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { + return false; + } + } + // Assume cyclic values are equal. + var stacked = stack.get(object); + if (stacked && stack.get(other)) { + return stacked == other; + } + var result = true; + stack.set(object, other); + stack.set(other, object); + + var skipCtor = isPartial; + while (++index < objLength) { + key = objProps[index]; + var objValue = object[key], + othValue = other[key]; + + if (customizer) { + var compared = isPartial + ? customizer(othValue, objValue, key, other, object, stack) + : customizer(objValue, othValue, key, object, other, stack); + } + // Recursively compare objects (susceptible to call stack limits). + if (!(compared === undefined + ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) + : compared + )) { + result = false; + break; + } + skipCtor || (skipCtor = key == 'constructor'); + } + if (result && !skipCtor) { + 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)) { + result = false; + } + } + stack['delete'](object); + stack['delete'](other); + return result; + } + + /** + * A specialized version of `baseRest` which flattens the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @returns {Function} Returns the new function. + */ + function flatRest(func) { + return setToString(overRest(func, undefined, flatten), func + ''); + } + + /** + * Creates an array of own enumerable property names and symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names and symbols. + */ + function getAllKeys(object) { + return baseGetAllKeys(object, keys, getSymbols); + } + + /** + * Creates an array of own and inherited enumerable property names and + * symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names and symbols. + */ + function getAllKeysIn(object) { + return baseGetAllKeys(object, keysIn, getSymbolsIn); + } + + /** + * 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 name of `func`. + * + * @private + * @param {Function} func The function to query. + * @returns {string} Returns the function name. + */ + function getFuncName(func) { + var result = (func.name + ''), + array = realNames[result], + length = hasOwnProperty.call(realNames, result) ? array.length : 0; + + while (length--) { + var data = array[length], + otherFunc = data.func; + if (otherFunc == null || otherFunc == func) { + return data.name; + } + } + return result; + } + + /** + * Gets the argument placeholder value for `func`. + * + * @private + * @param {Function} func The function to inspect. + * @returns {*} Returns the placeholder value. + */ + function getHolder(func) { + var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func; + return object.placeholder; + } + + /** + * Gets the appropriate "iteratee" function. If `_.iteratee` is customized, + * this function returns the custom method, otherwise it returns `baseIteratee`. + * If arguments are provided, the chosen function is invoked with them and + * its result is returned. + * + * @private + * @param {*} [value] The value to convert to an iteratee. + * @param {number} [arity] The arity of the created iteratee. + * @returns {Function} Returns the chosen function or its result. + */ + function getIteratee() { + var result = lodash.iteratee || iteratee; + result = result === iteratee ? baseIteratee : result; + return arguments.length ? result(arguments[0], arguments[1]) : result; + } + + /** + * Gets the data for `map`. + * + * @private + * @param {Object} map The map to query. + * @param {string} key The reference key. + * @returns {*} Returns the map data. + */ + function getMapData(map, key) { + var data = map.__data__; + return isKeyable(key) + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; + } + + /** + * Gets the property names, values, and compare flags of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the match data of `object`. + */ + function getMatchData(object) { + var result = keys(object), + length = result.length; + + while (length--) { + var key = result[length], + value = object[key]; + + result[length] = [key, value, isStrictComparable(value)]; + } + return result; + } + + /** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ + function getNative(object, key) { + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; + } + + /** + * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the raw `toStringTag`. + */ + function getRawTag(value) { + var isOwn = hasOwnProperty.call(value, symToStringTag), + tag = value[symToStringTag]; + + try { + value[symToStringTag] = undefined; + var unmasked = true; + } catch (e) {} + + var result = nativeObjectToString.call(value); + if (unmasked) { + if (isOwn) { + value[symToStringTag] = tag; + } else { + delete value[symToStringTag]; + } + } + return result; + } + + /** + * Creates an array of the own enumerable symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of symbols. + */ + var getSymbols = !nativeGetSymbols ? stubArray : function(object) { + if (object == null) { + return []; + } + object = Object(object); + return arrayFilter(nativeGetSymbols(object), function(symbol) { + return propertyIsEnumerable.call(object, symbol); + }); + }; + + /** + * Creates an array of the own and inherited enumerable symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of symbols. + */ + var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { + var result = []; + while (object) { + arrayPush(result, getSymbols(object)); + object = getPrototype(object); + } + return result; + }; + + /** + * Gets the `toStringTag` of `value`. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ + var getTag = baseGetTag; + + // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. + if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || + (Map && getTag(new Map) != mapTag) || + (Promise && getTag(Promise.resolve()) != promiseTag) || + (Set && getTag(new Set) != setTag) || + (WeakMap && getTag(new WeakMap) != weakMapTag)) { + getTag = function(value) { + var result = baseGetTag(value), + Ctor = result == objectTag ? value.constructor : undefined, + ctorString = Ctor ? toSource(Ctor) : ''; + + if (ctorString) { + switch (ctorString) { + case dataViewCtorString: return dataViewTag; + case mapCtorString: return mapTag; + case promiseCtorString: return promiseTag; + case setCtorString: return setTag; + case weakMapCtorString: return weakMapTag; + } + } + return 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.length; + + 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 }; + } + + /** + * Extracts wrapper details from the `source` body comment. + * + * @private + * @param {string} source The source to inspect. + * @returns {Array} Returns the wrapper details. + */ + function getWrapDetails(source) { + var match = source.match(reWrapDetails); + return match ? match[1].split(reSplitDetails) : []; + } + + /** + * Checks if `path` exists on `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @param {Function} hasFunc The function to check properties. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + */ + function hasPath(object, path, hasFunc) { + path = castPath(path, object); + + var index = -1, + length = path.length, + result = false; + + while (++index < length) { + var key = toKey(path[index]); + if (!(result = object != null && hasFunc(object, key))) { + break; + } + object = object[key]; + } + if (result || ++index != length) { + return result; + } + length = object == null ? 0 : object.length; + return !!length && isLength(length) && isIndex(key, length) && + (isArray(object) || isArguments(object)); + } + + /** + * 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 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) { + return (typeof object.constructor == 'function' && !isPrototype(object)) + ? baseCreate(getPrototype(object)) + : {}; + } + + /** + * Initializes an object clone based on its `toStringTag`. + * + * **Note:** This function only supports cloning values with tags of + * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, 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 cloneArrayBuffer(object); + + case boolTag: + case dateTag: + return new Ctor(+object); + + case dataViewTag: + return cloneDataView(object, isDeep); + + case float32Tag: case float64Tag: + case int8Tag: case int16Tag: case int32Tag: + case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: + return cloneTypedArray(object, isDeep); + + case mapTag: + return new Ctor; + + case numberTag: + case stringTag: + return new Ctor(object); + + case regexpTag: + return cloneRegExp(object); + + case setTag: + return new Ctor; + + case symbolTag: + return cloneSymbol(object); + } + } + + /** + * Inserts wrapper `details` in a comment at the top of the `source` body. + * + * @private + * @param {string} source The source to modify. + * @returns {Array} details The details to insert. + * @returns {string} Returns the modified source. + */ + function insertWrapDetails(source, details) { + var length = details.length; + if (!length) { + return source; + } + var lastIndex = length - 1; + details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; + details = details.join(length > 2 ? ', ' : ' '); + return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); + } + + /** + * Checks if `value` is a flattenable `arguments` object or array. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. + */ + function isFlattenable(value) { + return isArray(value) || isArguments(value) || + !!(spreadableSymbol && value && value[spreadableSymbol]); + } + + /** + * 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) { + var type = typeof value; + length = length == null ? MAX_SAFE_INTEGER : length; + + return !!length && + (type == 'number' || + (type != 'symbol' && reIsUint.test(value))) && + (value > -1 && value % 1 == 0 && value < length); + } + + /** + * Checks if the given 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' + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object) + ) { + return eq(object[index], value); + } + return false; + } + + /** + * Checks if `value` is a property name and not a property path. + * + * @private + * @param {*} value The value to check. + * @param {Object} [object] The object to query keys on. + * @returns {boolean} Returns `true` if `value` is a property name, else `false`. + */ + function isKey(value, object) { + if (isArray(value)) { + return false; + } + var type = typeof value; + if (type == 'number' || type == 'symbol' || type == 'boolean' || + value == null || isSymbol(value)) { + return true; + } + return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || + (object != null && value in Object(object)); + } + + /** + * Checks if `value` is suitable for use as unique object key. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is suitable, else `false`. + */ + function isKeyable(value) { + var type = typeof value; + return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') + ? (value !== '__proto__') + : (value === null); + } + + /** + * Checks if `func` has a lazy counterpart. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` has a lazy counterpart, + * else `false`. + */ + function isLaziable(func) { + var funcName = getFuncName(func), + other = lodash[funcName]; + + if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) { + return false; + } + if (func === other) { + return true; + } + var data = getData(other); + return !!data && func === data[0]; + } + + /** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ + function isMasked(func) { + return !!maskSrcKey && (maskSrcKey in func); + } + + /** + * Checks if `func` is capable of being masked. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `func` is maskable, else `false`. + */ + var isMaskable = coreJsData ? isFunction : stubFalse; + + /** + * Checks if `value` is likely a prototype object. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. + */ + function isPrototype(value) { + var Ctor = value && value.constructor, + proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; + + return value === proto; + } + + /** + * 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 && !isObject(value); + } + + /** + * A specialized version of `matchesProperty` for source values suitable + * for strict equality comparisons, i.e. `===`. + * + * @private + * @param {string} key The key of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new spec function. + */ + function matchesStrictComparable(key, srcValue) { + return function(object) { + if (object == null) { + return false; + } + return object[key] === srcValue && + (srcValue !== undefined || (key in Object(object))); + }; + } + + /** + * A specialized version of `_.memoize` which clears the memoized function's + * cache when it exceeds `MAX_MEMOIZE_SIZE`. + * + * @private + * @param {Function} func The function to have its output memoized. + * @returns {Function} Returns the new memoized function. + */ + function memoizeCapped(func) { + var result = memoize(func, function(key) { + if (cache.size === MAX_MEMOIZE_SIZE) { + cache.clear(); + } + return key; + }); + + var cache = result.cache; + return result; + } + + /** + * Merges the function metadata of `source` into `data`. + * + * Merging metadata reduces the number of wrappers used 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` modify function arguments, making the order in which they are + * executed important, preventing the merging of metadata. However, we make + * an exception for a safe combined 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, + isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); + + var isCombo = + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || + ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); + + // Exit early if metadata can't be merged. + if (!(isCommon || isCombo)) { + return data; + } + // Use source `thisArg` if available. + if (srcBitmask & WRAP_BIND_FLAG) { + data[2] = source[2]; + // Set when currying a bound function. + newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; + } + // Compose partial arguments. + var value = source[3]; + if (value) { + var partials = data[3]; + data[3] = partials ? composeArgs(partials, value, source[4]) : value; + data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4]; + } + // Compose partial right arguments. + value = source[5]; + if (value) { + partials = data[5]; + data[5] = partials ? composeArgsRight(partials, value, source[6]) : value; + data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]; + } + // Use source `argPos` if available. + value = source[7]; + if (value) { + data[7] = value; + } + // Use source `ary` if it's smaller. + if (srcBitmask & WRAP_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; + } + + /** + * This function is like + * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * except that it includes inherited enumerable properties. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ + function nativeKeysIn(object) { + var result = []; + if (object != null) { + for (var key in Object(object)) { + result.push(key); + } + } + return result; + } + + /** + * Converts `value` to a string using `Object.prototype.toString`. + * + * @private + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + */ + function objectToString(value) { + return nativeObjectToString.call(value); + } + + /** + * A specialized version of `baseRest` which transforms the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @param {Function} transform The rest array transform. + * @returns {Function} Returns the new function. + */ + function overRest(func, start, transform) { + start = nativeMax(start === undefined ? (func.length - 1) : start, 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); + + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = transform(array); + return apply(func, this, otherArgs); + }; + } + + /** + * Gets the parent value at `path` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Array} path The path to get the parent value of. + * @returns {*} Returns the parent value. + */ + function parent(object, path) { + return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1)); + } + + /** + * 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 = copyArray(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://bugs.chromium.org/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 = shortOut(baseSetData); + + /** + * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout). + * + * @private + * @param {Function} func The function to delay. + * @param {number} wait The number of milliseconds to delay invocation. + * @returns {number|Object} Returns the timer id or timeout object. + */ + var setTimeout = ctxSetTimeout || function(func, wait) { + return root.setTimeout(func, wait); + }; + + /** + * Sets the `toString` method of `func` to return `string`. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ + var setToString = shortOut(baseSetToString); + + /** + * Sets the `toString` method of `wrapper` to mimic the source of `reference` + * with wrapper details in a comment at the top of the source body. + * + * @private + * @param {Function} wrapper The function to modify. + * @param {Function} reference The reference function. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @returns {Function} Returns `wrapper`. + */ + function setWrapToString(wrapper, reference, bitmask) { + var source = (reference + ''); + return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); + } + + /** + * Creates a function that'll short out and invoke `identity` instead + * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` + * milliseconds. + * + * @private + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new shortable function. + */ + function shortOut(func) { + var count = 0, + lastCalled = 0; + + return function() { + var stamp = nativeNow(), + remaining = HOT_SPAN - (stamp - lastCalled); + + lastCalled = stamp; + if (remaining > 0) { + if (++count >= HOT_COUNT) { + return arguments[0]; + } + } else { + count = 0; + } + return func.apply(undefined, arguments); + }; + } + + /** + * A specialized version of `_.shuffle` which mutates and sets the size of `array`. + * + * @private + * @param {Array} array The array to shuffle. + * @param {number} [size=array.length] The size of `array`. + * @returns {Array} Returns `array`. + */ + function shuffleSelf(array, size) { + var index = -1, + length = array.length, + lastIndex = length - 1; + + size = size === undefined ? length : size; + while (++index < size) { + var rand = baseRandom(index, lastIndex), + value = array[rand]; + + array[rand] = array[index]; + array[index] = value; + } + array.length = size; + return array; + } + + /** + * Converts `string` to a property path array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the property path array. + */ + var stringToPath = memoizeCapped(function(string) { + var result = []; + if (string.charCodeAt(0) === 46 /* . */) { + result.push(''); + } + string.replace(rePropName, function(match, number, quote, subString) { + result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); + }); + return result; + }); + + /** + * Converts `value` to a string key if it's not a string or symbol. + * + * @private + * @param {*} value The value to inspect. + * @returns {string|symbol} Returns the key. + */ + function toKey(value) { + if (typeof value == 'string' || isSymbol(value)) { + return value; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; + } + + /** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to convert. + * @returns {string} Returns the source code. + */ + function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} + } + return ''; + } + + /** + * Updates wrapper `details` based on `bitmask` flags. + * + * @private + * @returns {Array} details The details to modify. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @returns {Array} Returns `details`. + */ + function updateWrapDetails(details, bitmask) { + arrayEach(wrapFlags, function(pair) { + var value = '_.' + pair[0]; + if ((bitmask & pair[1]) && !arrayIncludes(details, value)) { + details.push(value); + } + }); + return details.sort(); + } + + /** + * Creates a clone of `wrapper`. + * + * @private + * @param {Object} wrapper The wrapper to clone. + * @returns {Object} Returns the cloned wrapper. + */ + function wrapperClone(wrapper) { + if (wrapper instanceof LazyWrapper) { + return wrapper.clone(); + } + var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); + result.__actions__ = copyArray(wrapper.__actions__); + result.__index__ = wrapper.__index__; + result.__values__ = wrapper.__values__; + return result; + } + + /*------------------------------------------------------------------------*/ + + /** + * Creates an array of elements split into groups the length of `size`. + * If `array` can't be split evenly, the final chunk will be the remaining + * elements. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to process. + * @param {number} [size=1] The length of each chunk + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the new array of 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 === undefined)) { + size = 1; + } else { + size = nativeMax(toInteger(size), 0); + } + var length = array == null ? 0 : array.length; + if (!length || size < 1) { + return []; + } + var index = 0, + resIndex = 0, + result = Array(nativeCeil(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 _ + * @since 0.1.0 + * @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 == null ? 0 : array.length, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index]; + if (value) { + result[resIndex++] = value; + } + } + return result; + } + + /** + * Creates a new array concatenating `array` with any additional arrays + * and/or values. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to concatenate. + * @param {...*} [values] The values to concatenate. + * @returns {Array} Returns the new concatenated array. + * @example + * + * var array = [1]; + * var other = _.concat(array, 2, [3], [[4]]); + * + * console.log(other); + * // => [1, 2, 3, [4]] + * + * console.log(array); + * // => [1] + */ + function concat() { + var length = arguments.length; + if (!length) { + return []; + } + var args = Array(length - 1), + array = arguments[0], + index = length; + + while (index--) { + args[index - 1] = arguments[index]; + } + return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); + } + + /** + * Creates an array of `array` values not included in the other given arrays + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. The order and references of result values are + * determined by the first array. + * + * **Note:** Unlike `_.pullAll`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {...Array} [values] The values to exclude. + * @returns {Array} Returns the new array of filtered values. + * @see _.without, _.xor + * @example + * + * _.difference([2, 1], [2, 3]); + * // => [1] + */ + var difference = baseRest(function(array, values) { + return isArrayLikeObject(array) + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) + : []; + }); + + /** + * This method is like `_.difference` except that it accepts `iteratee` which + * is invoked for each element of `array` and `values` to generate the criterion + * by which they're compared. The order and references of result values are + * determined by the first array. The iteratee is invoked with one argument: + * (value). + * + * **Note:** Unlike `_.pullAllBy`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {...Array} [values] The values to exclude. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor); + * // => [1.2] + * + * // The `_.property` iteratee shorthand. + * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ + var differenceBy = baseRest(function(array, values) { + var iteratee = last(values); + if (isArrayLikeObject(iteratee)) { + iteratee = undefined; + } + return isArrayLikeObject(array) + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)) + : []; + }); + + /** + * This method is like `_.difference` except that it accepts `comparator` + * which is invoked to compare elements of `array` to `values`. The order and + * references of result values are determined by the first array. The comparator + * is invoked with two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.pullAllWith`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {...Array} [values] The values to exclude. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * + * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); + * // => [{ 'x': 2, 'y': 1 }] + */ + var differenceWith = baseRest(function(array, values) { + var comparator = last(values); + if (isArrayLikeObject(comparator)) { + comparator = undefined; + } + return isArrayLikeObject(array) + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator) + : []; + }); + + /** + * Creates a slice of `array` with `n` elements dropped from the beginning. + * + * @static + * @memberOf _ + * @since 0.5.0 + * @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 an iteratee for methods 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 == null ? 0 : array.length; + if (!length) { + return []; + } + n = (guard || n === undefined) ? 1 : toInteger(n); + return baseSlice(array, n < 0 ? 0 : n, length); + } + + /** + * Creates a slice of `array` with `n` elements dropped from the end. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @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 an iteratee for methods 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 == null ? 0 : array.length; + if (!length) { + return []; + } + n = (guard || n === undefined) ? 1 : toInteger(n); + n = length - n; + 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 + * invoked with three arguments: (value, index, array). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the slice of `array`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * _.dropRightWhile(users, function(o) { return !o.active; }); + * // => objects for ['barney'] + * + * // The `_.matches` iteratee shorthand. + * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false }); + * // => objects for ['barney', 'fred'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.dropRightWhile(users, ['active', false]); + * // => objects for ['barney'] + * + * // The `_.property` iteratee shorthand. + * _.dropRightWhile(users, 'active'); + * // => objects for ['barney', 'fred', 'pebbles'] + */ + function dropRightWhile(array, predicate) { + return (array && array.length) + ? baseWhile(array, getIteratee(predicate, 3), true, true) + : []; + } + + /** + * Creates a slice of `array` excluding elements dropped from the beginning. + * Elements are dropped until `predicate` returns falsey. The predicate is + * invoked with three arguments: (value, index, array). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the slice of `array`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * _.dropWhile(users, function(o) { return !o.active; }); + * // => objects for ['pebbles'] + * + * // The `_.matches` iteratee shorthand. + * _.dropWhile(users, { 'user': 'barney', 'active': false }); + * // => objects for ['fred', 'pebbles'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.dropWhile(users, ['active', false]); + * // => objects for ['pebbles'] + * + * // The `_.property` iteratee shorthand. + * _.dropWhile(users, 'active'); + * // => objects for ['barney', 'fred', 'pebbles'] + */ + function dropWhile(array, predicate) { + return (array && array.length) + ? baseWhile(array, getIteratee(predicate, 3), true) + : []; + } + + /** + * Fills elements of `array` with `value` from `start` up to, but not + * including, `end`. + * + * **Note:** This method mutates `array`. + * + * @static + * @memberOf _ + * @since 3.2.0 + * @category Array + * @param {Array} array The array to fill. + * @param {*} value The value to fill `array` with. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns `array`. + * @example + * + * var array = [1, 2, 3]; + * + * _.fill(array, 'a'); + * console.log(array); + * // => ['a', 'a', 'a'] + * + * _.fill(Array(3), 2); + * // => [2, 2, 2] + * + * _.fill([4, 6, 8, 10], '*', 1, 3); + * // => [4, '*', '*', 10] + */ + function fill(array, value, start, end) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { + start = 0; + end = length; + } + return baseFill(array, value, start, end); + } + + /** + * This method is like `_.find` except that it returns the index of the first + * element `predicate` returns truthy for instead of the element itself. + * + * @static + * @memberOf _ + * @since 1.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=0] The index to search from. + * @returns {number} Returns the index of the found element, else `-1`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * _.findIndex(users, function(o) { return o.user == 'barney'; }); + * // => 0 + * + * // The `_.matches` iteratee shorthand. + * _.findIndex(users, { 'user': 'fred', 'active': false }); + * // => 1 + * + * // The `_.matchesProperty` iteratee shorthand. + * _.findIndex(users, ['active', false]); + * // => 0 + * + * // The `_.property` iteratee shorthand. + * _.findIndex(users, 'active'); + * // => 2 + */ + function findIndex(array, predicate, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = fromIndex == null ? 0 : toInteger(fromIndex); + if (index < 0) { + index = nativeMax(length + index, 0); + } + return baseFindIndex(array, getIteratee(predicate, 3), index); + } + + /** + * This method is like `_.findIndex` except that it iterates over elements + * of `collection` from right to left. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=array.length-1] The index to search from. + * @returns {number} Returns the index of the found element, else `-1`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; }); + * // => 2 + * + * // The `_.matches` iteratee shorthand. + * _.findLastIndex(users, { 'user': 'barney', 'active': true }); + * // => 0 + * + * // The `_.matchesProperty` iteratee shorthand. + * _.findLastIndex(users, ['active', false]); + * // => 2 + * + * // The `_.property` iteratee shorthand. + * _.findLastIndex(users, 'active'); + * // => 0 + */ + function findLastIndex(array, predicate, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = length - 1; + if (fromIndex !== undefined) { + index = toInteger(fromIndex); + index = fromIndex < 0 + ? nativeMax(length + index, 0) + : nativeMin(index, length - 1); + } + return baseFindIndex(array, getIteratee(predicate, 3), index, true); + } + + /** + * Flattens `array` a single level deep. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to flatten. + * @returns {Array} Returns the new flattened array. + * @example + * + * _.flatten([1, [2, [3, [4]], 5]]); + * // => [1, 2, [3, [4]], 5] + */ + function flatten(array) { + var length = array == null ? 0 : array.length; + return length ? baseFlatten(array, 1) : []; + } + + /** + * Recursively flattens `array`. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to flatten. + * @returns {Array} Returns the new flattened array. + * @example + * + * _.flattenDeep([1, [2, [3, [4]], 5]]); + * // => [1, 2, 3, 4, 5] + */ + function flattenDeep(array) { + var length = array == null ? 0 : array.length; + return length ? baseFlatten(array, INFINITY) : []; + } + + /** + * Recursively flatten `array` up to `depth` times. + * + * @static + * @memberOf _ + * @since 4.4.0 + * @category Array + * @param {Array} array The array to flatten. + * @param {number} [depth=1] The maximum recursion depth. + * @returns {Array} Returns the new flattened array. + * @example + * + * var array = [1, [2, [3, [4]], 5]]; + * + * _.flattenDepth(array, 1); + * // => [1, 2, [3, [4]], 5] + * + * _.flattenDepth(array, 2); + * // => [1, 2, 3, [4], 5] + */ + function flattenDepth(array, depth) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + depth = depth === undefined ? 1 : toInteger(depth); + return baseFlatten(array, depth); + } + + /** + * The inverse of `_.toPairs`; this method returns an object composed + * from key-value `pairs`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} pairs The key-value pairs. + * @returns {Object} Returns the new object. + * @example + * + * _.fromPairs([['a', 1], ['b', 2]]); + * // => { 'a': 1, 'b': 2 } + */ + function fromPairs(pairs) { + var index = -1, + length = pairs == null ? 0 : pairs.length, + result = {}; + + while (++index < length) { + var pair = pairs[index]; + result[pair[0]] = pair[1]; + } + return result; + } + + /** + * Gets the first element of `array`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @alias first + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the first element of `array`. + * @example + * + * _.head([1, 2, 3]); + * // => 1 + * + * _.head([]); + * // => undefined + */ + function head(array) { + return (array && array.length) ? array[0] : undefined; + } + + /** + * Gets the index at which the first occurrence of `value` is found in `array` + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it's used as the + * offset from the end of `array`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @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`. + * @example + * + * _.indexOf([1, 2, 1, 2], 2); + * // => 1 + * + * // Search from the `fromIndex`. + * _.indexOf([1, 2, 1, 2], 2, 2); + * // => 3 + */ + function indexOf(array, value, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = fromIndex == null ? 0 : toInteger(fromIndex); + if (index < 0) { + index = nativeMax(length + index, 0); + } + return baseIndexOf(array, value, index); + } + + /** + * Gets all but the last element of `array`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @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) { + var length = array == null ? 0 : array.length; + return length ? baseSlice(array, 0, -1) : []; + } + + /** + * Creates an array of unique values that are included in all given arrays + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. The order and references of result values are + * determined by the first array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of intersecting values. + * @example + * + * _.intersection([2, 1], [2, 3]); + * // => [2] + */ + var intersection = baseRest(function(arrays) { + var mapped = arrayMap(arrays, castArrayLikeObject); + return (mapped.length && mapped[0] === arrays[0]) + ? baseIntersection(mapped) + : []; + }); + + /** + * This method is like `_.intersection` except that it accepts `iteratee` + * which is invoked for each element of each `arrays` to generate the criterion + * by which they're compared. The order and references of result values are + * determined by the first array. The iteratee is invoked with one argument: + * (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new array of intersecting values. + * @example + * + * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); + * // => [2.1] + * + * // The `_.property` iteratee shorthand. + * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }] + */ + var intersectionBy = baseRest(function(arrays) { + var iteratee = last(arrays), + mapped = arrayMap(arrays, castArrayLikeObject); + + if (iteratee === last(mapped)) { + iteratee = undefined; + } else { + mapped.pop(); + } + return (mapped.length && mapped[0] === arrays[0]) + ? baseIntersection(mapped, getIteratee(iteratee, 2)) + : []; + }); + + /** + * This method is like `_.intersection` except that it accepts `comparator` + * which is invoked to compare elements of `arrays`. The order and references + * of result values are determined by the first array. The comparator is + * invoked with two arguments: (arrVal, othVal). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of intersecting values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.intersectionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }] + */ + var intersectionWith = baseRest(function(arrays) { + var comparator = last(arrays), + mapped = arrayMap(arrays, castArrayLikeObject); + + comparator = typeof comparator == 'function' ? comparator : undefined; + if (comparator) { + mapped.pop(); + } + return (mapped.length && mapped[0] === arrays[0]) + ? baseIntersection(mapped, undefined, comparator) + : []; + }); + + /** + * Converts all elements in `array` into a string separated by `separator`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to convert. + * @param {string} [separator=','] The element separator. + * @returns {string} Returns the joined string. + * @example + * + * _.join(['a', 'b', 'c'], '~'); + * // => 'a~b~c' + */ + function join(array, separator) { + return array == null ? '' : nativeJoin.call(array, separator); + } + + /** + * Gets the last element of `array`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @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 == null ? 0 : array.length; + 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 _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} [fromIndex=array.length-1] The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.lastIndexOf([1, 2, 1, 2], 2); + * // => 3 + * + * // Search from the `fromIndex`. + * _.lastIndexOf([1, 2, 1, 2], 2, 2); + * // => 1 + */ + function lastIndexOf(array, value, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = length; + if (fromIndex !== undefined) { + index = toInteger(fromIndex); + index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); + } + return value === value + ? strictLastIndexOf(array, value, index) + : baseFindIndex(array, baseIsNaN, index, true); + } + + /** + * Gets the element at index `n` of `array`. If `n` is negative, the nth + * element from the end is returned. + * + * @static + * @memberOf _ + * @since 4.11.0 + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=0] The index of the element to return. + * @returns {*} Returns the nth element of `array`. + * @example + * + * var array = ['a', 'b', 'c', 'd']; + * + * _.nth(array, 1); + * // => 'b' + * + * _.nth(array, -2); + * // => 'c'; + */ + function nth(array, n) { + return (array && array.length) ? baseNth(array, toInteger(n)) : undefined; + } + + /** + * Removes all given values from `array` using + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove` + * to remove elements from an array by predicate. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Array + * @param {Array} array The array to modify. + * @param {...*} [values] The values to remove. + * @returns {Array} Returns `array`. + * @example + * + * var array = ['a', 'b', 'c', 'a', 'b', 'c']; + * + * _.pull(array, 'a', 'c'); + * console.log(array); + * // => ['b', 'b'] + */ + var pull = baseRest(pullAll); + + /** + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @returns {Array} Returns `array`. + * @example + * + * var array = ['a', 'b', 'c', 'a', 'b', 'c']; + * + * _.pullAll(array, ['a', 'c']); + * console.log(array); + * // => ['b', 'b'] + */ + function pullAll(array, values) { + return (array && array.length && values && values.length) + ? basePullAll(array, values) + : array; + } + + /** + * This method is like `_.pullAll` except that it accepts `iteratee` which is + * invoked for each element of `array` and `values` to generate the criterion + * by which they're compared. The iteratee is invoked with one argument: (value). + * + * **Note:** Unlike `_.differenceBy`, this method mutates `array`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns `array`. + * @example + * + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ + function pullAllBy(array, values, iteratee) { + return (array && array.length && values && values.length) + ? basePullAll(array, values, getIteratee(iteratee, 2)) + : array; + } + + /** + * This method is like `_.pullAll` except that it accepts `comparator` which + * is invoked to compare elements of `array` to `values`. The comparator is + * invoked with two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @static + * @memberOf _ + * @since 4.6.0 + * @category Array + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + function pullAllWith(array, values, comparator) { + return (array && array.length && values && values.length) + ? basePullAll(array, values, undefined, comparator) + : array; + } + + /** + * Removes elements from `array` corresponding to `indexes` and returns an + * array of removed elements. + * + * **Note:** Unlike `_.at`, this method mutates `array`. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to modify. + * @param {...(number|number[])} [indexes] The indexes of elements to remove. + * @returns {Array} Returns the new array of removed elements. + * @example + * + * var array = ['a', 'b', 'c', 'd']; + * var pulled = _.pullAt(array, [1, 3]); + * + * console.log(array); + * // => ['a', 'c'] + * + * console.log(pulled); + * // => ['b', 'd'] + */ + var pullAt = flatRest(function(array, indexes) { + var length = array == null ? 0 : array.length, + result = baseAt(array, indexes); + + basePullAt(array, arrayMap(indexes, function(index) { + return isIndex(index, length) ? +index : index; + }).sort(compareAscending)); + + return result; + }); + + /** + * Removes all elements from `array` that `predicate` returns truthy for + * and returns an array of the removed elements. The predicate is invoked + * with three arguments: (value, index, array). + * + * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull` + * to pull elements from an array by value. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Array + * @param {Array} array The array to modify. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @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) { + var result = []; + if (!(array && array.length)) { + return result; + } + var index = -1, + indexes = [], + length = array.length; + + predicate = getIteratee(predicate, 3); + while (++index < length) { + var value = array[index]; + if (predicate(value, index, array)) { + result.push(value); + indexes.push(index); + } + } + basePullAt(array, indexes); + return result; + } + + /** + * Reverses `array` so that the first element becomes the last, the second + * element becomes the second to last, and so on. + * + * **Note:** This method mutates `array` and is based on + * [`Array#reverse`](https://mdn.io/Array/reverse). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to modify. + * @returns {Array} Returns `array`. + * @example + * + * var array = [1, 2, 3]; + * + * _.reverse(array); + * // => [3, 2, 1] + * + * console.log(array); + * // => [3, 2, 1] + */ + function reverse(array) { + return array == null ? array : nativeReverse.call(array); + } + + /** + * Creates a slice of `array` from `start` up to, but not including, `end`. + * + * **Note:** This method is used instead of + * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are + * returned. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @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 == null ? 0 : array.length; + if (!length) { + return []; + } + if (end && typeof end != 'number' && isIterateeCall(array, start, end)) { + start = 0; + end = length; + } + else { + start = start == null ? 0 : toInteger(start); + end = end === undefined ? length : toInteger(end); + } + 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. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * _.sortedIndex([30, 50], 40); + * // => 1 + */ + function sortedIndex(array, value) { + return baseSortedIndex(array, value); + } + + /** + * This method is like `_.sortedIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * var objects = [{ 'x': 4 }, { 'x': 5 }]; + * + * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); + * // => 0 + * + * // The `_.property` iteratee shorthand. + * _.sortedIndexBy(objects, { 'x': 4 }, 'x'); + * // => 0 + */ + function sortedIndexBy(array, value, iteratee) { + return baseSortedIndexBy(array, value, getIteratee(iteratee, 2)); + } + + /** + * This method is like `_.indexOf` except that it performs a binary + * search on a sorted `array`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedIndexOf([4, 5, 5, 5, 6], 5); + * // => 1 + */ + function sortedIndexOf(array, value) { + var length = array == null ? 0 : array.length; + if (length) { + var index = baseSortedIndex(array, value); + if (index < length && eq(array[index], value)) { + return index; + } + } + return -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 _ + * @since 3.0.0 + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * _.sortedLastIndex([4, 5, 5, 5, 6], 5); + * // => 4 + */ + function sortedLastIndex(array, value) { + return baseSortedIndex(array, value, true); + } + + /** + * This method is like `_.sortedLastIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * var objects = [{ 'x': 4 }, { 'x': 5 }]; + * + * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); + * // => 1 + * + * // The `_.property` iteratee shorthand. + * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x'); + * // => 1 + */ + function sortedLastIndexBy(array, value, iteratee) { + return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true); + } + + /** + * This method is like `_.lastIndexOf` except that it performs a binary + * search on a sorted `array`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5); + * // => 3 + */ + function sortedLastIndexOf(array, value) { + var length = array == null ? 0 : array.length; + if (length) { + var index = baseSortedIndex(array, value, true) - 1; + if (eq(array[index], value)) { + return index; + } + } + return -1; + } + + /** + * This method is like `_.uniq` except that it's designed and optimized + * for sorted arrays. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * _.sortedUniq([1, 1, 2]); + * // => [1, 2] + */ + function sortedUniq(array) { + return (array && array.length) + ? baseSortedUniq(array) + : []; + } + + /** + * This method is like `_.uniqBy` except that it's designed and optimized + * for sorted arrays. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); + * // => [1.1, 2.3] + */ + function sortedUniqBy(array, iteratee) { + return (array && array.length) + ? baseSortedUniq(array, getIteratee(iteratee, 2)) + : []; + } + + /** + * Gets all but the first element of `array`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to query. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.tail([1, 2, 3]); + * // => [2, 3] + */ + function tail(array) { + var length = array == null ? 0 : array.length; + return length ? baseSlice(array, 1, length) : []; + } + + /** + * Creates a slice of `array` with `n` elements taken from the beginning. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @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 an iteratee for methods 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) { + if (!(array && array.length)) { + return []; + } + n = (guard || n === undefined) ? 1 : toInteger(n); + return baseSlice(array, 0, n < 0 ? 0 : n); + } + + /** + * Creates a slice of `array` with `n` elements taken from the end. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @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 an iteratee for methods 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 == null ? 0 : array.length; + if (!length) { + return []; + } + n = (guard || n === undefined) ? 1 : toInteger(n); + n = length - n; + return baseSlice(array, n < 0 ? 0 : n, length); + } + + /** + * Creates a slice of `array` with elements taken from the end. Elements are + * taken until `predicate` returns falsey. The predicate is invoked with + * three arguments: (value, index, array). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the slice of `array`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * _.takeRightWhile(users, function(o) { return !o.active; }); + * // => objects for ['fred', 'pebbles'] + * + * // The `_.matches` iteratee shorthand. + * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false }); + * // => objects for ['pebbles'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.takeRightWhile(users, ['active', false]); + * // => objects for ['fred', 'pebbles'] + * + * // The `_.property` iteratee shorthand. + * _.takeRightWhile(users, 'active'); + * // => [] + */ + function takeRightWhile(array, predicate) { + return (array && array.length) + ? baseWhile(array, getIteratee(predicate, 3), false, true) + : []; + } + + /** + * Creates a slice of `array` with elements taken from the beginning. Elements + * are taken until `predicate` returns falsey. The predicate is invoked with + * three arguments: (value, index, array). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the slice of `array`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * _.takeWhile(users, function(o) { return !o.active; }); + * // => objects for ['barney', 'fred'] + * + * // The `_.matches` iteratee shorthand. + * _.takeWhile(users, { 'user': 'barney', 'active': false }); + * // => objects for ['barney'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.takeWhile(users, ['active', false]); + * // => objects for ['barney', 'fred'] + * + * // The `_.property` iteratee shorthand. + * _.takeWhile(users, 'active'); + * // => [] + */ + function takeWhile(array, predicate) { + return (array && array.length) + ? baseWhile(array, getIteratee(predicate, 3)) + : []; + } + + /** + * Creates an array of unique values, in order, from all given arrays using + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of combined values. + * @example + * + * _.union([2], [1, 2]); + * // => [2, 1] + */ + var union = baseRest(function(arrays) { + return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); + }); + + /** + * This method is like `_.union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by + * which uniqueness is computed. Result values are chosen from the first + * array in which the value occurs. The iteratee is invoked with one argument: + * (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new array of combined values. + * @example + * + * _.unionBy([2.1], [1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + * + * // The `_.property` iteratee shorthand. + * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ + var unionBy = baseRest(function(arrays) { + var iteratee = last(arrays); + if (isArrayLikeObject(iteratee)) { + iteratee = undefined; + } + return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)); + }); + + /** + * This method is like `_.union` except that it accepts `comparator` which + * is invoked to compare elements of `arrays`. Result values are chosen from + * the first array in which the value occurs. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of combined values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.unionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + var unionWith = baseRest(function(arrays) { + var comparator = last(arrays); + comparator = typeof comparator == 'function' ? comparator : undefined; + return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator); + }); + + /** + * Creates a duplicate-free version of an array, using + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons, in which only the first occurrence of each element + * is kept. The order of result values is determined by the order they occur + * in the array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * _.uniq([2, 1, 2]); + * // => [2, 1] + */ + function uniq(array) { + return (array && array.length) ? baseUniq(array) : []; + } + + /** + * This method is like `_.uniq` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * uniqueness is computed. The order of result values is determined by the + * order they occur in the array. The iteratee is invoked with one argument: + * (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * _.uniqBy([2.1, 1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + * + * // The `_.property` iteratee shorthand. + * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ + function uniqBy(array, iteratee) { + return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : []; + } + + /** + * This method is like `_.uniq` except that it accepts `comparator` which + * is invoked to compare elements of `array`. The order of result values is + * determined by the order they occur in the array.The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.uniqWith(objects, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] + */ + function uniqWith(array, comparator) { + comparator = typeof comparator == 'function' ? comparator : undefined; + return (array && array.length) ? baseUniq(array, undefined, comparator) : []; + } + + /** + * 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 _ + * @since 1.2.0 + * @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(['a', 'b'], [1, 2], [true, false]); + * // => [['a', 1, true], ['b', 2, false]] + * + * _.unzip(zipped); + * // => [['a', 'b'], [1, 2], [true, false]] + */ + function unzip(array) { + if (!(array && array.length)) { + return []; + } + var length = 0; + array = arrayFilter(array, function(group) { + if (isArrayLikeObject(group)) { + length = nativeMax(group.length, length); + return true; + } + }); + return baseTimes(length, function(index) { + return arrayMap(array, baseProperty(index)); + }); + } + + /** + * This method is like `_.unzip` except that it accepts `iteratee` to specify + * how regrouped values should be combined. The iteratee is invoked with the + * elements of each group: (...group). + * + * @static + * @memberOf _ + * @since 3.8.0 + * @category Array + * @param {Array} array The array of grouped elements to process. + * @param {Function} [iteratee=_.identity] The function to combine + * regrouped values. + * @returns {Array} Returns the new array of regrouped elements. + * @example + * + * var zipped = _.zip([1, 2], [10, 20], [100, 200]); + * // => [[1, 10, 100], [2, 20, 200]] + * + * _.unzipWith(zipped, _.add); + * // => [3, 30, 300] + */ + function unzipWith(array, iteratee) { + if (!(array && array.length)) { + return []; + } + var result = unzip(array); + if (iteratee == null) { + return result; + } + return arrayMap(result, function(group) { + return apply(iteratee, undefined, group); + }); + } + + /** + * Creates an array excluding all given values using + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * **Note:** Unlike `_.pull`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {...*} [values] The values to exclude. + * @returns {Array} Returns the new array of filtered values. + * @see _.difference, _.xor + * @example + * + * _.without([2, 1, 2, 3], 1, 2); + * // => [3] + */ + var without = baseRest(function(array, values) { + return isArrayLikeObject(array) + ? baseDifference(array, values) + : []; + }); + + /** + * Creates an array of unique values that is the + * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) + * of the given arrays. The order of result values is determined by the order + * they occur in the arrays. + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of filtered values. + * @see _.difference, _.without + * @example + * + * _.xor([2, 1], [2, 3]); + * // => [1, 3] + */ + var xor = baseRest(function(arrays) { + return baseXor(arrayFilter(arrays, isArrayLikeObject)); + }); + + /** + * This method is like `_.xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by + * which by which they're compared. The order of result values is determined + * by the order they occur in the arrays. The iteratee is invoked with one + * argument: (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor); + * // => [1.2, 3.4] + * + * // The `_.property` iteratee shorthand. + * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ + var xorBy = baseRest(function(arrays) { + var iteratee = last(arrays); + if (isArrayLikeObject(iteratee)) { + iteratee = undefined; + } + return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2)); + }); + + /** + * This method is like `_.xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The order of result values is + * determined by the order they occur in the arrays. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.xorWith(objects, others, _.isEqual); + * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + var xorWith = baseRest(function(arrays) { + var comparator = last(arrays); + comparator = typeof comparator == 'function' ? comparator : undefined; + return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator); + }); + + /** + * 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 _ + * @since 0.1.0 + * @category Array + * @param {...Array} [arrays] The arrays to process. + * @returns {Array} Returns the new array of grouped elements. + * @example + * + * _.zip(['a', 'b'], [1, 2], [true, false]); + * // => [['a', 1, true], ['b', 2, false]] + */ + var zip = baseRest(unzip); + + /** + * This method is like `_.fromPairs` except that it accepts two arrays, + * one of property identifiers and one of corresponding values. + * + * @static + * @memberOf _ + * @since 0.4.0 + * @category Array + * @param {Array} [props=[]] The property identifiers. + * @param {Array} [values=[]] The property values. + * @returns {Object} Returns the new object. + * @example + * + * _.zipObject(['a', 'b'], [1, 2]); + * // => { 'a': 1, 'b': 2 } + */ + function zipObject(props, values) { + return baseZipObject(props || [], values || [], assignValue); + } + + /** + * This method is like `_.zipObject` except that it supports property paths. + * + * @static + * @memberOf _ + * @since 4.1.0 + * @category Array + * @param {Array} [props=[]] The property identifiers. + * @param {Array} [values=[]] The property values. + * @returns {Object} Returns the new object. + * @example + * + * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]); + * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } } + */ + function zipObjectDeep(props, values) { + return baseZipObject(props || [], values || [], baseSet); + } + + /** + * This method is like `_.zip` except that it accepts `iteratee` to specify + * how grouped values should be combined. The iteratee is invoked with the + * elements of each group: (...group). + * + * @static + * @memberOf _ + * @since 3.8.0 + * @category Array + * @param {...Array} [arrays] The arrays to process. + * @param {Function} [iteratee=_.identity] The function to combine + * grouped values. + * @returns {Array} Returns the new array of grouped elements. + * @example + * + * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) { + * return a + b + c; + * }); + * // => [111, 222] + */ + var zipWith = baseRest(function(arrays) { + var length = arrays.length, + iteratee = length > 1 ? arrays[length - 1] : undefined; + + iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined; + return unzipWith(arrays, iteratee); + }); + + /*------------------------------------------------------------------------*/ + + /** + * Creates a `lodash` wrapper instance that wraps `value` with explicit method + * chain sequences enabled. The result of such sequences must be unwrapped + * with `_#value`. + * + * @static + * @memberOf _ + * @since 1.3.0 + * @category Seq + * @param {*} value The value to wrap. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 }, + * { 'user': 'pebbles', 'age': 1 } + * ]; + * + * var youngest = _ + * .chain(users) + * .sortBy('age') + * .map(function(o) { + * return o.user + ' is ' + o.age; + * }) + * .head() + * .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 invoked with one argument; (value). The purpose of this method is to + * "tap into" a method chain sequence in order to modify intermediate results. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Seq + * @param {*} value The value to provide to `interceptor`. + * @param {Function} interceptor The function to invoke. + * @returns {*} Returns `value`. + * @example + * + * _([1, 2, 3]) + * .tap(function(array) { + * // Mutate input array. + * array.pop(); + * }) + * .reverse() + * .value(); + * // => [2, 1] + */ + function tap(value, interceptor) { + interceptor(value); + return value; + } + + /** + * This method is like `_.tap` except that it returns the result of `interceptor`. + * The purpose of this method is to "pass thru" values replacing intermediate + * results in a method chain sequence. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Seq + * @param {*} value The value to provide to `interceptor`. + * @param {Function} interceptor The function to invoke. + * @returns {*} Returns the result of `interceptor`. + * @example + * + * _(' abc ') + * .chain() + * .trim() + * .thru(function(value) { + * return [value]; + * }) + * .value(); + * // => ['abc'] + */ + function thru(value, interceptor) { + return interceptor(value); + } + + /** + * This method is the wrapper version of `_.at`. + * + * @name at + * @memberOf _ + * @since 1.0.0 + * @category Seq + * @param {...(string|string[])} [paths] The property paths to pick. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; + * + * _(object).at(['a[0].b.c', 'a[1]']).value(); + * // => [3, 4] + */ + var wrapperAt = flatRest(function(paths) { + var length = paths.length, + start = length ? paths[0] : 0, + value = this.__wrapped__, + interceptor = function(object) { return baseAt(object, paths); }; + + if (length > 1 || this.__actions__.length || + !(value instanceof LazyWrapper) || !isIndex(start)) { + return this.thru(interceptor); + } + value = value.slice(start, +start + (length ? 1 : 0)); + value.__actions__.push({ + 'func': thru, + 'args': [interceptor], + 'thisArg': undefined + }); + return new LodashWrapper(value, this.__chain__).thru(function(array) { + if (length && !array.length) { + array.push(undefined); + } + return array; + }); + }); + + /** + * Creates a `lodash` wrapper instance with explicit method chain sequences enabled. + * + * @name chain + * @memberOf _ + * @since 0.1.0 + * @category Seq + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 } + * ]; + * + * // A sequence without explicit chaining. + * _(users).head(); + * // => { 'user': 'barney', 'age': 36 } + * + * // A sequence with explicit chaining. + * _(users) + * .chain() + * .head() + * .pick('user') + * .value(); + * // => { 'user': 'barney' } + */ + function wrapperChain() { + return chain(this); + } + + /** + * Executes the chain sequence and returns the wrapped result. + * + * @name commit + * @memberOf _ + * @since 3.2.0 + * @category Seq + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var array = [1, 2]; + * var wrapped = _(array).push(3); + * + * console.log(array); + * // => [1, 2] + * + * wrapped = wrapped.commit(); + * console.log(array); + * // => [1, 2, 3] + * + * wrapped.last(); + * // => 3 + * + * console.log(array); + * // => [1, 2, 3] + */ + function wrapperCommit() { + return new LodashWrapper(this.value(), this.__chain__); + } + + /** + * Gets the next value on a wrapped object following the + * [iterator protocol](https://mdn.io/iteration_protocols#iterator). + * + * @name next + * @memberOf _ + * @since 4.0.0 + * @category Seq + * @returns {Object} Returns the next iterator value. + * @example + * + * var wrapped = _([1, 2]); + * + * wrapped.next(); + * // => { 'done': false, 'value': 1 } + * + * wrapped.next(); + * // => { 'done': false, 'value': 2 } + * + * wrapped.next(); + * // => { 'done': true, 'value': undefined } + */ + function wrapperNext() { + if (this.__values__ === undefined) { + this.__values__ = toArray(this.value()); + } + var done = this.__index__ >= this.__values__.length, + value = done ? undefined : this.__values__[this.__index__++]; + + return { 'done': done, 'value': value }; + } + + /** + * Enables the wrapper to be iterable. + * + * @name Symbol.iterator + * @memberOf _ + * @since 4.0.0 + * @category Seq + * @returns {Object} Returns the wrapper object. + * @example + * + * var wrapped = _([1, 2]); + * + * wrapped[Symbol.iterator]() === wrapped; + * // => true + * + * Array.from(wrapped); + * // => [1, 2] + */ + function wrapperToIterator() { + return this; + } + + /** + * Creates a clone of the chain sequence planting `value` as the wrapped value. + * + * @name plant + * @memberOf _ + * @since 3.2.0 + * @category Seq + * @param {*} value The value to plant. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * function square(n) { + * return n * n; + * } + * + * var wrapped = _([1, 2]).map(square); + * var other = wrapped.plant([3, 4]); + * + * other.value(); + * // => [9, 16] + * + * wrapped.value(); + * // => [1, 4] + */ + function wrapperPlant(value) { + var result, + parent = this; + + while (parent instanceof baseLodash) { + var clone = wrapperClone(parent); + clone.__index__ = 0; + clone.__values__ = undefined; + if (result) { + previous.__wrapped__ = clone; + } else { + result = clone; + } + var previous = clone; + parent = parent.__wrapped__; + } + previous.__wrapped__ = value; + return result; + } + + /** + * This method is the wrapper version of `_.reverse`. + * + * **Note:** This method mutates the wrapped array. + * + * @name reverse + * @memberOf _ + * @since 0.1.0 + * @category Seq + * @returns {Object} Returns the new `lodash` wrapper instance. + * @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) { + var wrapped = value; + if (this.__actions__.length) { + wrapped = new LazyWrapper(this); + } + wrapped = wrapped.reverse(); + wrapped.__actions__.push({ + 'func': thru, + 'args': [reverse], + 'thisArg': undefined + }); + return new LodashWrapper(wrapped, this.__chain__); + } + return this.thru(reverse); + } + + /** + * Executes the chain sequence to resolve the unwrapped value. + * + * @name value + * @memberOf _ + * @since 0.1.0 + * @alias toJSON, valueOf + * @category Seq + * @returns {*} Returns the resolved unwrapped value. + * @example + * + * _([1, 2, 3]).value(); + * // => [1, 2, 3] + */ + function wrapperValue() { + return baseWrapperValue(this.__wrapped__, this.__actions__); + } + + /*------------------------------------------------------------------------*/ + + /** + * Creates an object composed of keys generated from the results of running + * each element of `collection` thru `iteratee`. The corresponding value of + * each key is the number of times the key was returned by `iteratee`. The + * iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 0.5.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The iteratee to transform keys. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * _.countBy([6.1, 4.2, 6.3], Math.floor); + * // => { '4': 1, '6': 2 } + * + * // The `_.property` iteratee shorthand. + * _.countBy(['one', 'two', 'three'], 'length'); + * // => { '3': 2, '5': 1 } + */ + var countBy = createAggregator(function(result, value, key) { + if (hasOwnProperty.call(result, key)) { + ++result[key]; + } else { + baseAssignValue(result, key, 1); + } + }); + + /** + * Checks if `predicate` returns truthy for **all** elements of `collection`. + * Iteration is stopped once `predicate` returns falsey. The predicate is + * invoked with three arguments: (value, index|key, collection). + * + * **Note:** This method returns `true` for + * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because + * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of + * elements of empty collections. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false`. + * @example + * + * _.every([true, 1, null, 'yes'], Boolean); + * // => false + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': false } + * ]; + * + * // The `_.matches` iteratee shorthand. + * _.every(users, { 'user': 'barney', 'active': false }); + * // => false + * + * // The `_.matchesProperty` iteratee shorthand. + * _.every(users, ['active', false]); + * // => true + * + * // The `_.property` iteratee shorthand. + * _.every(users, 'active'); + * // => false + */ + function every(collection, predicate, guard) { + var func = isArray(collection) ? arrayEvery : baseEvery; + if (guard && isIterateeCall(collection, predicate, guard)) { + predicate = undefined; + } + return func(collection, getIteratee(predicate, 3)); + } + + /** + * Iterates over elements of `collection`, returning an array of all elements + * `predicate` returns truthy for. The predicate is invoked with three + * arguments: (value, index|key, collection). + * + * **Note:** Unlike `_.remove`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + * @see _.reject + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false } + * ]; + * + * _.filter(users, function(o) { return !o.active; }); + * // => objects for ['fred'] + * + * // The `_.matches` iteratee shorthand. + * _.filter(users, { 'age': 36, 'active': true }); + * // => objects for ['barney'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.filter(users, ['active', false]); + * // => objects for ['fred'] + * + * // The `_.property` iteratee shorthand. + * _.filter(users, 'active'); + * // => objects for ['barney'] + */ + function filter(collection, predicate) { + var func = isArray(collection) ? arrayFilter : baseFilter; + return func(collection, getIteratee(predicate, 3)); + } + + /** + * Iterates over elements of `collection`, returning the first element + * `predicate` returns truthy for. The predicate is invoked with three + * arguments: (value, index|key, collection). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=0] The index to search from. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false }, + * { 'user': 'pebbles', 'age': 1, 'active': true } + * ]; + * + * _.find(users, function(o) { return o.age < 40; }); + * // => object for 'barney' + * + * // The `_.matches` iteratee shorthand. + * _.find(users, { 'age': 1, 'active': true }); + * // => object for 'pebbles' + * + * // The `_.matchesProperty` iteratee shorthand. + * _.find(users, ['active', false]); + * // => object for 'fred' + * + * // The `_.property` iteratee shorthand. + * _.find(users, 'active'); + * // => object for 'barney' + */ + var find = createFind(findIndex); + + /** + * This method is like `_.find` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Collection + * @param {Array|Object} collection The collection to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=collection.length-1] The index to search from. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * _.findLast([1, 2, 3, 4], function(n) { + * return n % 2 == 1; + * }); + * // => 3 + */ + var findLast = createFind(findLastIndex); + + /** + * Creates a flattened array of values by running each element in `collection` + * thru `iteratee` and flattening the mapped results. The iteratee is invoked + * with three arguments: (value, index|key, collection). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [n, n]; + * } + * + * _.flatMap([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + function flatMap(collection, iteratee) { + return baseFlatten(map(collection, iteratee), 1); + } + + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @static + * @memberOf _ + * @since 4.7.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + function flatMapDeep(collection, iteratee) { + return baseFlatten(map(collection, iteratee), INFINITY); + } + + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @static + * @memberOf _ + * @since 4.7.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {number} [depth=1] The maximum recursion depth. + * @returns {Array} Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + function flatMapDepth(collection, iteratee, depth) { + depth = depth === undefined ? 1 : toInteger(depth); + return baseFlatten(map(collection, iteratee), depth); + } + + /** + * Iterates over elements of `collection` and invokes `iteratee` for each element. + * The iteratee is invoked with three arguments: (value, index|key, collection). + * Iteratee 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 use `_.forIn` + * or `_.forOwn` for object iteration. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @alias each + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + * @see _.forEachRight + * @example + * + * _.forEach([1, 2], function(value) { + * console.log(value); + * }); + * // => Logs `1` then `2`. + * + * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { + * console.log(key); + * }); + * // => Logs 'a' then 'b' (iteration order is not guaranteed). + */ + function forEach(collection, iteratee) { + var func = isArray(collection) ? arrayEach : baseEach; + return func(collection, getIteratee(iteratee, 3)); + } + + /** + * This method is like `_.forEach` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @alias eachRight + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + * @see _.forEach + * @example + * + * _.forEachRight([1, 2], function(value) { + * console.log(value); + * }); + * // => Logs `2` then `1`. + */ + function forEachRight(collection, iteratee) { + var func = isArray(collection) ? arrayEachRight : baseEachRight; + return func(collection, getIteratee(iteratee, 3)); + } + + /** + * Creates an object composed of keys generated from the results of running + * each element of `collection` thru `iteratee`. The order of grouped values + * is determined by the order they occur in `collection`. The corresponding + * value of each key is an array of elements responsible for generating the + * key. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The iteratee to transform keys. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * _.groupBy([6.1, 4.2, 6.3], Math.floor); + * // => { '4': [4.2], '6': [6.1, 6.3] } + * + * // The `_.property` iteratee 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 { + baseAssignValue(result, key, [value]); + } + }); + + /** + * Checks if `value` is in `collection`. If `collection` is a string, it's + * checked for a substring of `value`, otherwise + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * is used for equality comparisons. If `fromIndex` is negative, it's used as + * the offset from the end of `collection`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object|string} collection The collection to inspect. + * @param {*} value The value to search for. + * @param {number} [fromIndex=0] The index to search from. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. + * @returns {boolean} Returns `true` if `value` is found, else `false`. + * @example + * + * _.includes([1, 2, 3], 1); + * // => true + * + * _.includes([1, 2, 3], 1, 2); + * // => false + * + * _.includes({ 'a': 1, 'b': 2 }, 1); + * // => true + * + * _.includes('abcd', 'bc'); + * // => true + */ + function includes(collection, value, fromIndex, guard) { + collection = isArrayLike(collection) ? collection : values(collection); + fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0; + + var length = collection.length; + if (fromIndex < 0) { + fromIndex = nativeMax(length + fromIndex, 0); + } + return isString(collection) + ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1) + : (!!length && baseIndexOf(collection, value, fromIndex) > -1); + } + + /** + * Invokes the method at `path` of each element in `collection`, returning + * an array of the results of each invoked method. Any additional arguments + * are provided to each invoked method. If `path` is a function, it's invoked + * for, and `this` bound to, each element in `collection`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Array|Function|string} path The path of the method to invoke or + * the function invoked per iteration. + * @param {...*} [args] The arguments to invoke each method with. + * @returns {Array} Returns the array of results. + * @example + * + * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); + * // => [[1, 5, 7], [1, 2, 3]] + * + * _.invokeMap([123, 456], String.prototype.split, ''); + * // => [['1', '2', '3'], ['4', '5', '6']] + */ + var invokeMap = baseRest(function(collection, path, args) { + var index = -1, + isFunc = typeof path == 'function', + result = isArrayLike(collection) ? Array(collection.length) : []; + + baseEach(collection, function(value) { + result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args); + }); + return result; + }); + + /** + * Creates an object composed of keys generated from the results of running + * each element of `collection` thru `iteratee`. The corresponding value of + * each key is the last element responsible for generating the key. The + * iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The iteratee to transform keys. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * var array = [ + * { 'dir': 'left', 'code': 97 }, + * { 'dir': 'right', 'code': 100 } + * ]; + * + * _.keyBy(array, function(o) { + * return String.fromCharCode(o.code); + * }); + * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } + * + * _.keyBy(array, 'dir'); + * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } + */ + var keyBy = createAggregator(function(result, value, key) { + baseAssignValue(result, key, value); + }); + + /** + * Creates an array of values by running each element in `collection` thru + * `iteratee`. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * Many lodash methods are guarded to work as iteratees for methods like + * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. + * + * The guarded methods are: + * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, + * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, + * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`, + * `template`, `trim`, `trimEnd`, `trimStart`, and `words` + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + * @example + * + * function square(n) { + * return n * n; + * } + * + * _.map([4, 8], square); + * // => [16, 64] + * + * _.map({ 'a': 4, 'b': 8 }, square); + * // => [16, 64] (iteration order is not guaranteed) + * + * var users = [ + * { 'user': 'barney' }, + * { 'user': 'fred' } + * ]; + * + * // The `_.property` iteratee shorthand. + * _.map(users, 'user'); + * // => ['barney', 'fred'] + */ + function map(collection, iteratee) { + var func = isArray(collection) ? arrayMap : baseMap; + return func(collection, getIteratee(iteratee, 3)); + } + + /** + * This method is like `_.sortBy` except that it allows specifying the sort + * orders of the iteratees to sort by. If `orders` is unspecified, all values + * are sorted in ascending order. Otherwise, specify an order of "desc" for + * descending or "asc" for ascending sort order of corresponding values. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]] + * The iteratees to sort by. + * @param {string[]} [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. + * @returns {Array} Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 40 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // Sort by `user` in ascending order and by `age` in descending order. + * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] + */ + function orderBy(collection, iteratees, orders, guard) { + if (collection == null) { + return []; + } + if (!isArray(iteratees)) { + iteratees = iteratees == null ? [] : [iteratees]; + } + orders = guard ? undefined : orders; + if (!isArray(orders)) { + orders = orders == null ? [] : [orders]; + } + return baseOrderBy(collection, iteratees, orders); + } + + /** + * Creates an array of elements split into two groups, the first of which + * contains elements `predicate` returns truthy for, the second of which + * contains elements `predicate` returns falsey for. The predicate is + * invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the array of grouped elements. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': true }, + * { 'user': 'pebbles', 'age': 1, 'active': false } + * ]; + * + * _.partition(users, function(o) { return o.active; }); + * // => objects for [['fred'], ['barney', 'pebbles']] + * + * // The `_.matches` iteratee shorthand. + * _.partition(users, { 'age': 1, 'active': false }); + * // => objects for [['pebbles'], ['barney', 'fred']] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.partition(users, ['active', false]); + * // => objects for [['barney', 'pebbles'], ['fred']] + * + * // The `_.property` iteratee shorthand. + * _.partition(users, 'active'); + * // => objects for [['fred'], ['barney', 'pebbles']] + */ + var partition = createAggregator(function(result, value, key) { + result[key ? 0 : 1].push(value); + }, function() { return [[], []]; }); + + /** + * Reduces `collection` to a value which is the accumulated result of running + * each element in `collection` thru `iteratee`, where each successive + * invocation is supplied the return value of the previous. If `accumulator` + * is not given, the first element of `collection` is used as the initial + * value. The iteratee is invoked with four arguments: + * (accumulator, value, index|key, collection). + * + * Many lodash methods are guarded to work as iteratees for methods like + * `_.reduce`, `_.reduceRight`, and `_.transform`. + * + * The guarded methods are: + * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`, + * and `sortBy` + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @returns {*} Returns the accumulated value. + * @see _.reduceRight + * @example + * + * _.reduce([1, 2], function(sum, n) { + * return sum + n; + * }, 0); + * // => 3 + * + * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { + * (result[value] || (result[value] = [])).push(key); + * return result; + * }, {}); + * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed) + */ + function reduce(collection, iteratee, accumulator) { + var func = isArray(collection) ? arrayReduce : baseReduce, + initAccum = arguments.length < 3; + + return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach); + } + + /** + * This method is like `_.reduce` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @returns {*} Returns the accumulated value. + * @see _.reduce + * @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) { + var func = isArray(collection) ? arrayReduceRight : baseReduce, + initAccum = arguments.length < 3; + + return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight); + } + + /** + * The opposite of `_.filter`; this method returns the elements of `collection` + * that `predicate` does **not** return truthy for. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + * @see _.filter + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': true } + * ]; + * + * _.reject(users, function(o) { return !o.active; }); + * // => objects for ['fred'] + * + * // The `_.matches` iteratee shorthand. + * _.reject(users, { 'age': 40, 'active': true }); + * // => objects for ['barney'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.reject(users, ['active', false]); + * // => objects for ['fred'] + * + * // The `_.property` iteratee shorthand. + * _.reject(users, 'active'); + * // => objects for ['barney'] + */ + function reject(collection, predicate) { + var func = isArray(collection) ? arrayFilter : baseFilter; + return func(collection, negate(getIteratee(predicate, 3))); + } + + /** + * Gets a random element from `collection`. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Collection + * @param {Array|Object} collection The collection to sample. + * @returns {*} Returns the random element. + * @example + * + * _.sample([1, 2, 3, 4]); + * // => 2 + */ + function sample(collection) { + var func = isArray(collection) ? arraySample : baseSample; + return func(collection); + } + + /** + * Gets `n` random elements at unique keys from `collection` up to the + * size of `collection`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Collection + * @param {Array|Object} collection The collection to sample. + * @param {number} [n=1] The number of elements to sample. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the random elements. + * @example + * + * _.sampleSize([1, 2, 3], 2); + * // => [3, 1] + * + * _.sampleSize([1, 2, 3], 4); + * // => [2, 3, 1] + */ + function sampleSize(collection, n, guard) { + if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) { + n = 1; + } else { + n = toInteger(n); + } + var func = isArray(collection) ? arraySampleSize : baseSampleSize; + return func(collection, n); + } + + /** + * Creates an array of shuffled values, using a version of the + * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} 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) { + var func = isArray(collection) ? arrayShuffle : baseShuffle; + return func(collection); + } + + /** + * Gets the size of `collection` by returning its length for array-like + * values or the number of own enumerable string keyed properties for objects. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object|string} collection The collection to inspect. + * @returns {number} Returns the collection size. + * @example + * + * _.size([1, 2, 3]); + * // => 3 + * + * _.size({ 'a': 1, 'b': 2 }); + * // => 2 + * + * _.size('pebbles'); + * // => 7 + */ + function size(collection) { + if (collection == null) { + return 0; + } + if (isArrayLike(collection)) { + return isString(collection) ? stringSize(collection) : collection.length; + } + var tag = getTag(collection); + if (tag == mapTag || tag == setTag) { + return collection.size; + } + return baseKeys(collection).length; + } + + /** + * Checks if `predicate` returns truthy for **any** element of `collection`. + * Iteration is stopped once `predicate` returns truthy. The predicate is + * invoked with three arguments: (value, index|key, collection). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @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', 'active': true }, + * { 'user': 'fred', 'active': false } + * ]; + * + * // The `_.matches` iteratee shorthand. + * _.some(users, { 'user': 'barney', 'active': false }); + * // => false + * + * // The `_.matchesProperty` iteratee shorthand. + * _.some(users, ['active', false]); + * // => true + * + * // The `_.property` iteratee shorthand. + * _.some(users, 'active'); + * // => true + */ + function some(collection, predicate, guard) { + var func = isArray(collection) ? arraySome : baseSome; + if (guard && isIterateeCall(collection, predicate, guard)) { + predicate = undefined; + } + return func(collection, getIteratee(predicate, 3)); + } + + /** + * Creates an array of elements, sorted in ascending order by the results of + * running each element in a collection thru each iteratee. This method + * performs a stable sort, that is, it preserves the original sort order of + * equal elements. The iteratees are invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {...(Function|Function[])} [iteratees=[_.identity]] + * The iteratees to sort by. + * @returns {Array} Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 }, + * { 'user': 'barney', 'age': 34 } + * ]; + * + * _.sortBy(users, [function(o) { return o.user; }]); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] + * + * _.sortBy(users, ['user', 'age']); + * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]] + */ + var sortBy = baseRest(function(collection, iteratees) { + if (collection == null) { + return []; + } + var length = iteratees.length; + if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) { + iteratees = []; + } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { + iteratees = [iteratees[0]]; + } + return baseOrderBy(collection, baseFlatten(iteratees, 1), []); + }); + + /*------------------------------------------------------------------------*/ + + /** + * Gets the timestamp of the number of milliseconds that have elapsed since + * the Unix epoch (1 January 1970 00:00:00 UTC). + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Date + * @returns {number} Returns the timestamp. + * @example + * + * _.defer(function(stamp) { + * console.log(_.now() - stamp); + * }, _.now()); + * // => Logs the number of milliseconds it took for the deferred invocation. + */ + var now = ctxNow || function() { + return root.Date.now(); + }; + + /*------------------------------------------------------------------------*/ + + /** + * The opposite of `_.before`; this method creates a function that invokes + * `func` once it's called `n` or more times. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @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 (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + n = toInteger(n); + return function() { + if (--n < 1) { + return func.apply(this, arguments); + } + }; + } + + /** + * Creates a function that invokes `func`, with up to `n` arguments, + * ignoring any additional arguments. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @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 an iteratee for methods like `_.map`. + * @returns {Function} Returns the new capped function. + * @example + * + * _.map(['6', '8', '10'], _.ary(parseInt, 1)); + * // => [6, 8, 10] + */ + function ary(func, n, guard) { + n = guard ? undefined : n; + n = (func && n == null) ? func.length : n; + return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n); + } + + /** + * Creates a function that invokes `func`, with the `this` binding and arguments + * of the created function, while it's called less than `n` times. Subsequent + * calls to the created function return the result of the last `func` invocation. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @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(element).on('click', _.before(5, addContactToList)); + * // => Allows adding up to 4 contacts to the list. + */ + function before(n, func) { + var result; + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + n = toInteger(n); + return function() { + if (--n > 0) { + result = func.apply(this, arguments); + } + if (n <= 1) { + func = undefined; + } + return result; + }; + } + + /** + * Creates a function that invokes `func` with the `this` binding of `thisArg` + * and `partials` prepended to the arguments it receives. + * + * 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 doesn't set the "length" + * property of bound functions. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to bind. + * @param {*} thisArg The `this` binding of `func`. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new bound function. + * @example + * + * function greet(greeting, punctuation) { + * return greeting + ' ' + this.user + punctuation; + * } + * + * var object = { 'user': 'fred' }; + * + * var bound = _.bind(greet, object, 'hi'); + * bound('!'); + * // => 'hi fred!' + * + * // Bound with placeholders. + * var bound = _.bind(greet, object, _, '!'); + * bound('hi'); + * // => 'hi fred!' + */ + var bind = baseRest(function(func, thisArg, partials) { + var bitmask = WRAP_BIND_FLAG; + if (partials.length) { + var holders = replaceHolders(partials, getHolder(bind)); + bitmask |= WRAP_PARTIAL_FLAG; + } + return createWrap(func, bitmask, thisArg, partials, holders); + }); + + /** + * Creates a function that invokes the method at `object[key]` with `partials` + * prepended to the arguments it receives. + * + * 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://peter.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 _ + * @since 0.10.0 + * @category Function + * @param {Object} object The object to invoke the method on. + * @param {string} key The key of the method. + * @param {...*} [partials] 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!' + * + * // Bound with placeholders. + * var bound = _.bindKey(object, 'greet', _, '!'); + * bound('hi'); + * // => 'hiya fred!' + */ + var bindKey = baseRest(function(object, key, partials) { + var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG; + if (partials.length) { + var holders = replaceHolders(partials, getHolder(bindKey)); + bitmask |= WRAP_PARTIAL_FLAG; + } + return createWrap(key, bitmask, object, partials, holders); + }); + + /** + * Creates a function that accepts arguments of `func` and either invokes + * `func` returning its result, if at least `arity` number of arguments have + * been provided, or returns a function that accepts 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 doesn't set the "length" property of curried functions. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Function + * @param {Function} func The function to curry. + * @param {number} [arity=func.length] The arity of `func`. + * @param- {Object} [guard] Enables use as an iteratee for methods 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] + * + * // Curried with placeholders. + * curried(1)(_, 3)(2); + * // => [1, 2, 3] + */ + function curry(func, arity, guard) { + arity = guard ? undefined : arity; + var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, 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 doesn't set the "length" property of curried functions. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Function + * @param {Function} func The function to curry. + * @param {number} [arity=func.length] The arity of `func`. + * @param- {Object} [guard] Enables use as an iteratee for methods 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] + * + * // Curried with placeholders. + * curried(3)(1, _)(2); + * // => [1, 2, 3] + */ + function curryRight(func, arity, guard) { + arity = guard ? undefined : arity; + var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity); + result.placeholder = curryRight.placeholder; + return result; + } + + /** + * Creates a debounced function that delays invoking `func` until after `wait` + * milliseconds have elapsed since the last time the debounced function was + * invoked. The debounced function comes with a `cancel` method to cancel + * delayed `func` invocations and a `flush` method to immediately invoke them. + * Provide `options` to indicate whether `func` should be invoked on the + * leading and/or trailing edge of the `wait` timeout. The `func` is invoked + * with the last arguments provided to the debounced function. 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 debounced function + * is invoked more than once during the `wait` timeout. + * + * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred + * until to the next tick, similar to `setTimeout` with a timeout of `0`. + * + * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) + * for details over the differences between `_.debounce` and `_.throttle`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to debounce. + * @param {number} [wait=0] 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's 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 clicked, debouncing subsequent calls. + * jQuery(element).on('click', _.debounce(sendMail, 300, { + * 'leading': true, + * 'trailing': false + * })); + * + * // Ensure `batchLog` is invoked once after 1 second of debounced calls. + * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); + * var source = new EventSource('/stream'); + * jQuery(source).on('message', debounced); + * + * // Cancel the trailing debounced invocation. + * jQuery(window).on('popstate', debounced.cancel); + */ + function debounce(func, wait, options) { + var lastArgs, + lastThis, + maxWait, + result, + timerId, + lastCallTime, + lastInvokeTime = 0, + leading = false, + maxing = false, + trailing = true; + + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + wait = toNumber(wait) || 0; + if (isObject(options)) { + leading = !!options.leading; + maxing = 'maxWait' in options; + maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; + trailing = 'trailing' in options ? !!options.trailing : trailing; + } + + function invokeFunc(time) { + var args = lastArgs, + thisArg = lastThis; + + lastArgs = lastThis = undefined; + lastInvokeTime = time; + result = func.apply(thisArg, args); + return result; + } + + function leadingEdge(time) { + // Reset any `maxWait` timer. + lastInvokeTime = time; + // Start the timer for the trailing edge. + timerId = setTimeout(timerExpired, wait); + // Invoke the leading edge. + return leading ? invokeFunc(time) : result; + } + + function remainingWait(time) { + var timeSinceLastCall = time - lastCallTime, + timeSinceLastInvoke = time - lastInvokeTime, + timeWaiting = wait - timeSinceLastCall; + + return maxing + ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) + : timeWaiting; + } + + function shouldInvoke(time) { + var timeSinceLastCall = time - lastCallTime, + timeSinceLastInvoke = time - lastInvokeTime; + + // Either this is the first call, activity has stopped and we're at the + // trailing edge, the system time has gone backwards and we're treating + // it as the trailing edge, or we've hit the `maxWait` limit. + return (lastCallTime === undefined || (timeSinceLastCall >= wait) || + (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); + } + + function timerExpired() { + var time = now(); + if (shouldInvoke(time)) { + return trailingEdge(time); + } + // Restart the timer. + timerId = setTimeout(timerExpired, remainingWait(time)); + } + + function trailingEdge(time) { + timerId = undefined; + + // Only invoke if we have `lastArgs` which means `func` has been + // debounced at least once. + if (trailing && lastArgs) { + return invokeFunc(time); + } + lastArgs = lastThis = undefined; + return result; + } + + function cancel() { + if (timerId !== undefined) { + clearTimeout(timerId); + } + lastInvokeTime = 0; + lastArgs = lastCallTime = lastThis = timerId = undefined; + } + + function flush() { + return timerId === undefined ? result : trailingEdge(now()); + } + + function debounced() { + var time = now(), + isInvoking = shouldInvoke(time); + + lastArgs = arguments; + lastThis = this; + lastCallTime = time; + + if (isInvoking) { + if (timerId === undefined) { + return leadingEdge(lastCallTime); + } + if (maxing) { + // Handle invocations in a tight loop. + timerId = setTimeout(timerExpired, wait); + return invokeFunc(lastCallTime); + } + } + if (timerId === undefined) { + timerId = setTimeout(timerExpired, wait); + } + return result; + } + debounced.cancel = cancel; + debounced.flush = flush; + return debounced; + } + + /** + * Defers invoking the `func` until the current call stack has cleared. Any + * additional arguments are provided to `func` when it's invoked. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to defer. + * @param {...*} [args] The arguments to invoke `func` with. + * @returns {number} Returns the timer id. + * @example + * + * _.defer(function(text) { + * console.log(text); + * }, 'deferred'); + * // => Logs 'deferred' after one millisecond. + */ + var defer = baseRest(function(func, args) { + return baseDelay(func, 1, args); + }); + + /** + * Invokes `func` after `wait` milliseconds. Any additional arguments are + * provided to `func` when it's invoked. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @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 `func` with. + * @returns {number} Returns the timer id. + * @example + * + * _.delay(function(text) { + * console.log(text); + * }, 1000, 'later'); + * // => Logs 'later' after one second. + */ + var delay = baseRest(function(func, wait, args) { + return baseDelay(func, toNumber(wait) || 0, args); + }); + + /** + * Creates a function that invokes `func` with arguments reversed. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Function + * @param {Function} func The function to flip arguments for. + * @returns {Function} Returns the new flipped function. + * @example + * + * var flipped = _.flip(function() { + * return _.toArray(arguments); + * }); + * + * flipped('a', 'b', 'c', 'd'); + * // => ['d', 'c', 'b', 'a'] + */ + function flip(func) { + return createWrap(func, WRAP_FLIP_FLAG); + } + + /** + * 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 used as the map 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 + * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) + * method interface of `clear`, `delete`, `get`, `has`, and `set`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @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 memoized function. + * @example + * + * var object = { 'a': 1, 'b': 2 }; + * var other = { 'c': 3, 'd': 4 }; + * + * var values = _.memoize(_.values); + * values(object); + * // => [1, 2] + * + * values(other); + * // => [3, 4] + * + * object.a = 2; + * values(object); + * // => [1, 2] + * + * // Modify the result cache. + * values.cache.set(object, ['a', 'b']); + * values(object); + * // => ['a', 'b'] + * + * // Replace `_.memoize.Cache`. + * _.memoize.Cache = WeakMap; + */ + function memoize(func, resolver) { + if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { + throw new TypeError(FUNC_ERROR_TEXT); + } + var memoized = function() { + var args = arguments, + key = resolver ? resolver.apply(this, args) : args[0], + cache = memoized.cache; + + if (cache.has(key)) { + return cache.get(key); + } + var result = func.apply(this, args); + memoized.cache = cache.set(key, result) || cache; + return result; + }; + memoized.cache = new (memoize.Cache || MapCache); + return memoized; + } + + // Expose `MapCache`. + memoize.Cache = MapCache; + + /** + * 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 _ + * @since 3.0.0 + * @category Function + * @param {Function} predicate The predicate to negate. + * @returns {Function} Returns the new negated 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 (typeof predicate != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + return function() { + var args = arguments; + switch (args.length) { + case 0: return !predicate.call(this); + case 1: return !predicate.call(this, args[0]); + case 2: return !predicate.call(this, args[0], args[1]); + case 3: return !predicate.call(this, args[0], args[1], args[2]); + } + return !predicate.apply(this, args); + }; + } + + /** + * Creates a function that is restricted to invoking `func` once. Repeat calls + * to the function return the value of the first invocation. The `func` is + * invoked with the `this` binding and arguments of the created function. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new restricted function. + * @example + * + * var initialize = _.once(createApplication); + * initialize(); + * initialize(); + * // => `createApplication` is invoked once + */ + function once(func) { + return before(2, func); + } + + /** + * Creates a function that invokes `func` with its arguments transformed. + * + * @static + * @since 4.0.0 + * @memberOf _ + * @category Function + * @param {Function} func The function to wrap. + * @param {...(Function|Function[])} [transforms=[_.identity]] + * The argument transforms. + * @returns {Function} Returns the new function. + * @example + * + * function doubled(n) { + * return n * 2; + * } + * + * function square(n) { + * return n * n; + * } + * + * var func = _.overArgs(function(x, y) { + * return [x, y]; + * }, [square, doubled]); + * + * func(9, 3); + * // => [81, 6] + * + * func(10, 5); + * // => [100, 10] + */ + var overArgs = castRest(function(func, transforms) { + transforms = (transforms.length == 1 && isArray(transforms[0])) + ? arrayMap(transforms[0], baseUnary(getIteratee())) + : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee())); + + var funcsLength = transforms.length; + return baseRest(function(args) { + var index = -1, + length = nativeMin(args.length, funcsLength); + + while (++index < length) { + args[index] = transforms[index].call(this, args[index]); + } + return apply(func, this, args); + }); + }); + + /** + * Creates a function that invokes `func` with `partials` prepended to the + * arguments it receives. 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 doesn't set the "length" property of partially + * applied functions. + * + * @static + * @memberOf _ + * @since 0.2.0 + * @category Function + * @param {Function} func The function to partially apply arguments to. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new partially applied function. + * @example + * + * function greet(greeting, name) { + * return greeting + ' ' + name; + * } + * + * var sayHelloTo = _.partial(greet, 'hello'); + * sayHelloTo('fred'); + * // => 'hello fred' + * + * // Partially applied with placeholders. + * var greetFred = _.partial(greet, _, 'fred'); + * greetFred('hi'); + * // => 'hi fred' + */ + var partial = baseRest(function(func, partials) { + var holders = replaceHolders(partials, getHolder(partial)); + return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders); + }); + + /** + * This method is like `_.partial` except that partially applied arguments + * are appended to the arguments it receives. + * + * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for partially applied arguments. + * + * **Note:** This method doesn't set the "length" property of partially + * applied functions. + * + * @static + * @memberOf _ + * @since 1.0.0 + * @category Function + * @param {Function} func The function to partially apply arguments to. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new partially applied function. + * @example + * + * function greet(greeting, name) { + * return greeting + ' ' + name; + * } + * + * var greetFred = _.partialRight(greet, 'fred'); + * greetFred('hi'); + * // => 'hi fred' + * + * // Partially applied with placeholders. + * var sayHelloTo = _.partialRight(greet, 'hello', _); + * sayHelloTo('fred'); + * // => 'hello fred' + */ + var partialRight = baseRest(function(func, partials) { + var holders = replaceHolders(partials, getHolder(partialRight)); + return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, 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 _ + * @since 3.0.0 + * @category Function + * @param {Function} func The function to rearrange arguments for. + * @param {...(number|number[])} indexes The arranged argument 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 rearg = flatRest(function(func, indexes) { + return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes); + }); + + /** + * Creates a function that invokes `func` with the `this` binding of the + * created function and arguments from `start` and beyond provided as + * an array. + * + * **Note:** This method is based on the + * [rest parameter](https://mdn.io/rest_parameters). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Function + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + * @example + * + * var say = _.rest(function(what, names) { + * return what + ' ' + _.initial(names).join(', ') + + * (_.size(names) > 1 ? ', & ' : '') + _.last(names); + * }); + * + * say('hello', 'fred', 'barney', 'pebbles'); + * // => 'hello fred, barney, & pebbles' + */ + function rest(func, start) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + start = start === undefined ? start : toInteger(start); + return baseRest(func, start); + } + + /** + * Creates a function that invokes `func` with the `this` binding of the + * create function and an array of arguments much like + * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply). + * + * **Note:** This method is based on the + * [spread operator](https://mdn.io/spread_operator). + * + * @static + * @memberOf _ + * @since 3.2.0 + * @category Function + * @param {Function} func The function to spread arguments over. + * @param {number} [start=0] The start position of the spread. + * @returns {Function} Returns the new function. + * @example + * + * var say = _.spread(function(who, what) { + * return who + ' says ' + what; + * }); + * + * say(['fred', 'hello']); + * // => 'fred says hello' + * + * var numbers = Promise.all([ + * Promise.resolve(40), + * Promise.resolve(36) + * ]); + * + * numbers.then(_.spread(function(x, y) { + * return x + y; + * })); + * // => a Promise of 76 + */ + function spread(func, start) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + start = start == null ? 0 : nativeMax(toInteger(start), 0); + return baseRest(function(args) { + var array = args[start], + otherArgs = castSlice(args, 0, start); + + if (array) { + arrayPush(otherArgs, array); + } + return apply(func, this, otherArgs); + }); + } + + /** + * Creates a throttled function that only invokes `func` at most once per + * every `wait` milliseconds. The throttled function comes with a `cancel` + * method to cancel delayed `func` invocations and a `flush` method to + * immediately invoke them. Provide `options` to indicate whether `func` + * should be invoked on the leading and/or trailing edge of the `wait` + * timeout. The `func` is invoked with the last arguments provided to the + * throttled function. Subsequent calls to the throttled 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 throttled function + * is invoked more than once during the `wait` timeout. + * + * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred + * until to the next tick, similar to `setTimeout` with a timeout of `0`. + * + * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) + * for details over the differences between `_.throttle` and `_.debounce`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to throttle. + * @param {number} [wait=0] 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(element).on('click', throttled); + * + * // Cancel the trailing throttled invocation. + * jQuery(window).on('popstate', throttled.cancel); + */ + function throttle(func, wait, options) { + var leading = true, + trailing = true; + + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + if (isObject(options)) { + leading = 'leading' in options ? !!options.leading : leading; + trailing = 'trailing' in options ? !!options.trailing : trailing; + } + return debounce(func, wait, { + 'leading': leading, + 'maxWait': wait, + 'trailing': trailing + }); + } + + /** + * Creates a function that accepts up to one argument, ignoring any + * additional arguments. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Function + * @param {Function} func The function to cap arguments for. + * @returns {Function} Returns the new capped function. + * @example + * + * _.map(['6', '8', '10'], _.unary(parseInt)); + * // => [6, 8, 10] + */ + function unary(func) { + return ary(func, 1); + } + + /** + * Creates a function that provides `value` to `wrapper` as its first + * argument. Any additional arguments provided to the function are appended + * to those provided to the `wrapper`. The wrapper is invoked with the `this` + * binding of the created function. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {*} value The value to wrap. + * @param {Function} [wrapper=identity] 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) { + return partial(castFunction(wrapper), value); + } + + /*------------------------------------------------------------------------*/ + + /** + * Casts `value` as an array if it's not one. + * + * @static + * @memberOf _ + * @since 4.4.0 + * @category Lang + * @param {*} value The value to inspect. + * @returns {Array} Returns the cast array. + * @example + * + * _.castArray(1); + * // => [1] + * + * _.castArray({ 'a': 1 }); + * // => [{ 'a': 1 }] + * + * _.castArray('abc'); + * // => ['abc'] + * + * _.castArray(null); + * // => [null] + * + * _.castArray(undefined); + * // => [undefined] + * + * _.castArray(); + * // => [] + * + * var array = [1, 2, 3]; + * console.log(_.castArray(array) === array); + * // => true + */ + function castArray() { + if (!arguments.length) { + return []; + } + var value = arguments[0]; + return isArray(value) ? value : [value]; + } + + /** + * Creates a shallow clone of `value`. + * + * **Note:** This method is loosely based on the + * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm) + * and supports cloning arrays, array buffers, booleans, date objects, maps, + * numbers, `Object` objects, regexes, sets, strings, symbols, and typed + * arrays. The own enumerable properties of `arguments` objects are cloned + * as plain objects. An empty object is returned for uncloneable values such + * as error objects, functions, DOM nodes, and WeakMaps. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to clone. + * @returns {*} Returns the cloned value. + * @see _.cloneDeep + * @example + * + * var objects = [{ 'a': 1 }, { 'b': 2 }]; + * + * var shallow = _.clone(objects); + * console.log(shallow[0] === objects[0]); + * // => true + */ + function clone(value) { + return baseClone(value, CLONE_SYMBOLS_FLAG); + } + + /** + * This method is like `_.clone` except that it accepts `customizer` which + * is invoked to produce the cloned value. If `customizer` returns `undefined`, + * cloning is handled by the method instead. The `customizer` is invoked with + * up to four arguments; (value [, index|key, object, stack]). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to clone. + * @param {Function} [customizer] The function to customize cloning. + * @returns {*} Returns the cloned value. + * @see _.cloneDeepWith + * @example + * + * function customizer(value) { + * if (_.isElement(value)) { + * return value.cloneNode(false); + * } + * } + * + * var el = _.cloneWith(document.body, customizer); + * + * console.log(el === document.body); + * // => false + * console.log(el.nodeName); + * // => 'BODY' + * console.log(el.childNodes.length); + * // => 0 + */ + function cloneWith(value, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + return baseClone(value, CLONE_SYMBOLS_FLAG, customizer); + } + + /** + * This method is like `_.clone` except that it recursively clones `value`. + * + * @static + * @memberOf _ + * @since 1.0.0 + * @category Lang + * @param {*} value The value to recursively clone. + * @returns {*} Returns the deep cloned value. + * @see _.clone + * @example + * + * var objects = [{ 'a': 1 }, { 'b': 2 }]; + * + * var deep = _.cloneDeep(objects); + * console.log(deep[0] === objects[0]); + * // => false + */ + function cloneDeep(value) { + return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); + } + + /** + * This method is like `_.cloneWith` except that it recursively clones `value`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to recursively clone. + * @param {Function} [customizer] The function to customize cloning. + * @returns {*} Returns the deep cloned value. + * @see _.cloneWith + * @example + * + * function customizer(value) { + * if (_.isElement(value)) { + * return value.cloneNode(true); + * } + * } + * + * var el = _.cloneDeepWith(document.body, customizer); + * + * console.log(el === document.body); + * // => false + * console.log(el.nodeName); + * // => 'BODY' + * console.log(el.childNodes.length); + * // => 20 + */ + function cloneDeepWith(value, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); + } + + /** + * Checks if `object` conforms to `source` by invoking the predicate + * properties of `source` with the corresponding property values of `object`. + * + * **Note:** This method is equivalent to `_.conforms` when `source` is + * partially applied. + * + * @static + * @memberOf _ + * @since 4.14.0 + * @category Lang + * @param {Object} object The object to inspect. + * @param {Object} source The object of property predicates to conform to. + * @returns {boolean} Returns `true` if `object` conforms, else `false`. + * @example + * + * var object = { 'a': 1, 'b': 2 }; + * + * _.conformsTo(object, { 'b': function(n) { return n > 1; } }); + * // => true + * + * _.conformsTo(object, { 'b': function(n) { return n > 2; } }); + * // => false + */ + function conformsTo(object, source) { + return source == null || baseConformsTo(object, source, keys(source)); + } + + /** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ + function eq(value, other) { + return value === other || (value !== value && other !== other); + } + + /** + * Checks if `value` is greater than `other`. + * + * @static + * @memberOf _ + * @since 3.9.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is greater than `other`, + * else `false`. + * @see _.lt + * @example + * + * _.gt(3, 1); + * // => true + * + * _.gt(3, 3); + * // => false + * + * _.gt(1, 3); + * // => false + */ + var gt = createRelationalOperation(baseGt); + + /** + * Checks if `value` is greater than or equal to `other`. + * + * @static + * @memberOf _ + * @since 3.9.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is greater than or equal to + * `other`, else `false`. + * @see _.lte + * @example + * + * _.gte(3, 1); + * // => true + * + * _.gte(3, 3); + * // => true + * + * _.gte(1, 3); + * // => false + */ + var gte = createRelationalOperation(function(value, other) { + return value >= other; + }); + + /** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ + var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { + return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && + !propertyIsEnumerable.call(value, 'callee'); + }; + + /** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ + var isArray = Array.isArray; + + /** + * Checks if `value` is classified as an `ArrayBuffer` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. + * @example + * + * _.isArrayBuffer(new ArrayBuffer(2)); + * // => true + * + * _.isArrayBuffer(new Array(2)); + * // => false + */ + var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; + + /** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ + function isArrayLike(value) { + return value != null && isLength(value.length) && !isFunction(value); + } + + /** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ + function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); + } + + /** + * Checks if `value` is classified as a boolean primitive or object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a boolean, else `false`. + * @example + * + * _.isBoolean(false); + * // => true + * + * _.isBoolean(null); + * // => false + */ + function isBoolean(value) { + return value === true || value === false || + (isObjectLike(value) && baseGetTag(value) == boolTag); + } + + /** + * Checks if `value` is a buffer. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. + * @example + * + * _.isBuffer(new Buffer(2)); + * // => true + * + * _.isBuffer(new Uint8Array(2)); + * // => false + */ + var isBuffer = nativeIsBuffer || stubFalse; + + /** + * Checks if `value` is classified as a `Date` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a date object, else `false`. + * @example + * + * _.isDate(new Date); + * // => true + * + * _.isDate('Mon April 23 2012'); + * // => false + */ + var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; + + /** + * Checks if `value` is likely a DOM element. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @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 isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value); + } + + /** + * Checks if `value` is an empty object, collection, map, or set. + * + * Objects are considered empty if they have no own enumerable string keyed + * properties. + * + * Array-like values such as `arguments` objects, arrays, buffers, strings, or + * jQuery-like collections are considered empty if they have a `length` of `0`. + * Similarly, maps and sets are considered empty if they have a `size` of `0`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @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; + } + if (isArrayLike(value) && + (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || + isBuffer(value) || isTypedArray(value) || isArguments(value))) { + return !value.length; + } + var tag = getTag(value); + if (tag == mapTag || tag == setTag) { + return !value.size; + } + if (isPrototype(value)) { + return !baseKeys(value).length; + } + for (var key in value) { + if (hasOwnProperty.call(value, key)) { + return false; + } + } + return true; + } + + /** + * Performs a deep comparison between two values to determine if they are + * equivalent. + * + * **Note:** This method supports comparing arrays, array buffers, booleans, + * date objects, error objects, maps, numbers, `Object` objects, regexes, + * sets, strings, symbols, and typed arrays. `Object` objects are compared + * by their own, not inherited, enumerable properties. Functions and DOM + * nodes are compared by strict equality, i.e. `===`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.isEqual(object, other); + * // => true + * + * object === other; + * // => false + */ + function isEqual(value, other) { + return baseIsEqual(value, other); + } + + /** + * This method is like `_.isEqual` except that it accepts `customizer` which + * is invoked to compare values. If `customizer` returns `undefined`, comparisons + * are handled by the method instead. The `customizer` is invoked with up to + * six arguments: (objValue, othValue [, index|key, object, other, stack]). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, othValue) { + * if (isGreeting(objValue) && isGreeting(othValue)) { + * return true; + * } + * } + * + * var array = ['hello', 'goodbye']; + * var other = ['hi', 'goodbye']; + * + * _.isEqualWith(array, other, customizer); + * // => true + */ + function isEqualWith(value, other, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + var result = customizer ? customizer(value, other) : undefined; + return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result; + } + + /** + * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, + * `SyntaxError`, `TypeError`, or `URIError` object. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @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) { + if (!isObjectLike(value)) { + return false; + } + var tag = baseGetTag(value); + return tag == errorTag || tag == domExcTag || + (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value)); + } + + /** + * Checks if `value` is a finite primitive number. + * + * **Note:** This method is based on + * [`Number.isFinite`](https://mdn.io/Number/isFinite). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. + * @example + * + * _.isFinite(3); + * // => true + * + * _.isFinite(Number.MIN_VALUE); + * // => true + * + * _.isFinite(Infinity); + * // => false + * + * _.isFinite('3'); + * // => false + */ + function isFinite(value) { + return typeof value == 'number' && nativeIsFinite(value); + } + + /** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ + function isFunction(value) { + if (!isObject(value)) { + return false; + } + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 9 which returns 'object' for typed arrays and other constructors. + var tag = baseGetTag(value); + return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; + } + + /** + * Checks if `value` is an integer. + * + * **Note:** This method is based on + * [`Number.isInteger`](https://mdn.io/Number/isInteger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an integer, else `false`. + * @example + * + * _.isInteger(3); + * // => true + * + * _.isInteger(Number.MIN_VALUE); + * // => false + * + * _.isInteger(Infinity); + * // => false + * + * _.isInteger('3'); + * // => false + */ + function isInteger(value) { + return typeof value == 'number' && value == toInteger(value); + } + + /** + * Checks if `value` is a valid array-like length. + * + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ + function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + } + + /** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @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(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ + function isObject(value) { + var type = typeof value; + return value != null && (type == 'object' || type == 'function'); + } + + /** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ + function isObjectLike(value) { + return value != null && typeof value == 'object'; + } + + /** + * Checks if `value` is classified as a `Map` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a map, else `false`. + * @example + * + * _.isMap(new Map); + * // => true + * + * _.isMap(new WeakMap); + * // => false + */ + var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; + + /** + * Performs a partial deep comparison between `object` and `source` to + * determine if `object` contains equivalent property values. + * + * **Note:** This method is equivalent to `_.matches` when `source` is + * partially applied. + * + * Partial comparisons will match empty array and empty object `source` + * values against any array or object value, respectively. See `_.isEqual` + * for a list of supported value comparisons. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + * @example + * + * var object = { 'a': 1, 'b': 2 }; + * + * _.isMatch(object, { 'b': 2 }); + * // => true + * + * _.isMatch(object, { 'b': 1 }); + * // => false + */ + function isMatch(object, source) { + return object === source || baseIsMatch(object, source, getMatchData(source)); + } + + /** + * This method is like `_.isMatch` except that it accepts `customizer` which + * is invoked to compare values. If `customizer` returns `undefined`, comparisons + * are handled by the method instead. The `customizer` is invoked with five + * arguments: (objValue, srcValue, index|key, object, source). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, srcValue) { + * if (isGreeting(objValue) && isGreeting(srcValue)) { + * return true; + * } + * } + * + * var object = { 'greeting': 'hello' }; + * var source = { 'greeting': 'hi' }; + * + * _.isMatchWith(object, source, customizer); + * // => true + */ + function isMatchWith(object, source, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + return baseIsMatch(object, source, getMatchData(source), customizer); + } + + /** + * Checks if `value` is `NaN`. + * + * **Note:** This method is based on + * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as + * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for + * `undefined` and other non-number values. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @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 + // ActiveX objects in IE. + return isNumber(value) && value != +value; + } + + /** + * Checks if `value` is a pristine native function. + * + * **Note:** This method can't reliably detect native functions in the presence + * of the core-js package because core-js circumvents this kind of detection. + * Despite multiple requests, the core-js maintainer has made it clear: any + * attempt to fix the detection will be obstructed. As a result, we're left + * with little choice but to throw an error. Unfortunately, this also affects + * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill), + * which rely on core-js. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @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 (isMaskable(value)) { + throw new Error(CORE_ERROR_TEXT); + } + return baseIsNative(value); + } + + /** + * Checks if `value` is `null`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @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 `null` or `undefined`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is nullish, else `false`. + * @example + * + * _.isNil(null); + * // => true + * + * _.isNil(void 0); + * // => true + * + * _.isNil(NaN); + * // => false + */ + function isNil(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 _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a number, else `false`. + * @example + * + * _.isNumber(3); + * // => true + * + * _.isNumber(Number.MIN_VALUE); + * // => true + * + * _.isNumber(Infinity); + * // => true + * + * _.isNumber('3'); + * // => false + */ + function isNumber(value) { + return typeof value == 'number' || + (isObjectLike(value) && baseGetTag(value) == numberTag); + } + + /** + * Checks if `value` is a plain object, that is, an object created by the + * `Object` constructor or one with a `[[Prototype]]` of `null`. + * + * @static + * @memberOf _ + * @since 0.8.0 + * @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 + */ + function isPlainObject(value) { + if (!isObjectLike(value) || baseGetTag(value) != objectTag) { + return false; + } + var proto = getPrototype(value); + if (proto === null) { + return true; + } + var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; + return typeof Ctor == 'function' && Ctor instanceof Ctor && + funcToString.call(Ctor) == objectCtorString; + } + + /** + * Checks if `value` is classified as a `RegExp` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. + * @example + * + * _.isRegExp(/abc/); + * // => true + * + * _.isRegExp('/abc/'); + * // => false + */ + var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; + + /** + * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 + * double precision number which isn't the result of a rounded unsafe integer. + * + * **Note:** This method is based on + * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. + * @example + * + * _.isSafeInteger(3); + * // => true + * + * _.isSafeInteger(Number.MIN_VALUE); + * // => false + * + * _.isSafeInteger(Infinity); + * // => false + * + * _.isSafeInteger('3'); + * // => false + */ + function isSafeInteger(value) { + return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; + } + + /** + * Checks if `value` is classified as a `Set` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a set, else `false`. + * @example + * + * _.isSet(new Set); + * // => true + * + * _.isSet(new WeakSet); + * // => false + */ + var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; + + /** + * Checks if `value` is classified as a `String` primitive or object. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a string, else `false`. + * @example + * + * _.isString('abc'); + * // => true + * + * _.isString(1); + * // => false + */ + function isString(value) { + return typeof value == 'string' || + (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); + } + + /** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ + function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && baseGetTag(value) == symbolTag); + } + + /** + * Checks if `value` is classified as a typed array. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + * @example + * + * _.isTypedArray(new Uint8Array); + * // => true + * + * _.isTypedArray([]); + * // => false + */ + var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; + + /** + * Checks if `value` is `undefined`. + * + * @static + * @since 0.1.0 + * @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 value === undefined; + } + + /** + * Checks if `value` is classified as a `WeakMap` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a weak map, else `false`. + * @example + * + * _.isWeakMap(new WeakMap); + * // => true + * + * _.isWeakMap(new Map); + * // => false + */ + function isWeakMap(value) { + return isObjectLike(value) && getTag(value) == weakMapTag; + } + + /** + * Checks if `value` is classified as a `WeakSet` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a weak set, else `false`. + * @example + * + * _.isWeakSet(new WeakSet); + * // => true + * + * _.isWeakSet(new Set); + * // => false + */ + function isWeakSet(value) { + return isObjectLike(value) && baseGetTag(value) == weakSetTag; + } + + /** + * Checks if `value` is less than `other`. + * + * @static + * @memberOf _ + * @since 3.9.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is less than `other`, + * else `false`. + * @see _.gt + * @example + * + * _.lt(1, 3); + * // => true + * + * _.lt(3, 3); + * // => false + * + * _.lt(3, 1); + * // => false + */ + var lt = createRelationalOperation(baseLt); + + /** + * Checks if `value` is less than or equal to `other`. + * + * @static + * @memberOf _ + * @since 3.9.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is less than or equal to + * `other`, else `false`. + * @see _.gte + * @example + * + * _.lte(1, 3); + * // => true + * + * _.lte(3, 3); + * // => true + * + * _.lte(3, 1); + * // => false + */ + var lte = createRelationalOperation(function(value, other) { + return value <= other; + }); + + /** + * Converts `value` to an array. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to convert. + * @returns {Array} Returns the converted array. + * @example + * + * _.toArray({ 'a': 1, 'b': 2 }); + * // => [1, 2] + * + * _.toArray('abc'); + * // => ['a', 'b', 'c'] + * + * _.toArray(1); + * // => [] + * + * _.toArray(null); + * // => [] + */ + function toArray(value) { + if (!value) { + return []; + } + if (isArrayLike(value)) { + return isString(value) ? stringToArray(value) : copyArray(value); + } + if (symIterator && value[symIterator]) { + return iteratorToArray(value[symIterator]()); + } + var tag = getTag(value), + func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values); + + return func(value); + } + + /** + * Converts `value` to a finite number. + * + * @static + * @memberOf _ + * @since 4.12.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted number. + * @example + * + * _.toFinite(3.2); + * // => 3.2 + * + * _.toFinite(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toFinite(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toFinite('3.2'); + * // => 3.2 + */ + function toFinite(value) { + if (!value) { + return value === 0 ? value : 0; + } + value = toNumber(value); + if (value === INFINITY || value === -INFINITY) { + var sign = (value < 0 ? -1 : 1); + return sign * MAX_INTEGER; + } + return value === value ? value : 0; + } + + /** + * Converts `value` to an integer. + * + * **Note:** This method is loosely based on + * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toInteger(3.2); + * // => 3 + * + * _.toInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toInteger(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toInteger('3.2'); + * // => 3 + */ + function toInteger(value) { + var result = toFinite(value), + remainder = result % 1; + + return result === result ? (remainder ? result - remainder : result) : 0; + } + + /** + * Converts `value` to an integer suitable for use as the length of an + * array-like object. + * + * **Note:** This method is based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toLength(3.2); + * // => 3 + * + * _.toLength(Number.MIN_VALUE); + * // => 0 + * + * _.toLength(Infinity); + * // => 4294967295 + * + * _.toLength('3.2'); + * // => 3 + */ + function toLength(value) { + return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0; + } + + /** + * Converts `value` to a number. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {number} Returns the number. + * @example + * + * _.toNumber(3.2); + * // => 3.2 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3.2'); + * // => 3.2 + */ + function toNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol(value)) { + return NAN; + } + if (isObject(value)) { + var other = typeof value.valueOf == 'function' ? value.valueOf() : value; + value = isObject(other) ? (other + '') : other; + } + if (typeof value != 'string') { + return value === 0 ? value : +value; + } + value = value.replace(reTrim, ''); + var isBinary = reIsBinary.test(value); + return (isBinary || reIsOctal.test(value)) + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); + } + + /** + * Converts `value` to a plain object flattening inherited enumerable string + * keyed properties of `value` to own properties of the plain object. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @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 copyObject(value, keysIn(value)); + } + + /** + * Converts `value` to a safe integer. A safe integer can be compared and + * represented correctly. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toSafeInteger(3.2); + * // => 3 + * + * _.toSafeInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toSafeInteger(Infinity); + * // => 9007199254740991 + * + * _.toSafeInteger('3.2'); + * // => 3 + */ + function toSafeInteger(value) { + return value + ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) + : (value === 0 ? value : 0); + } + + /** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ + function toString(value) { + return value == null ? '' : baseToString(value); + } + + /*------------------------------------------------------------------------*/ + + /** + * Assigns own enumerable string keyed properties of source objects to the + * destination object. Source objects are applied from left to right. + * Subsequent sources overwrite property assignments of previous sources. + * + * **Note:** This method mutates `object` and is loosely based on + * [`Object.assign`](https://mdn.io/Object/assign). + * + * @static + * @memberOf _ + * @since 0.10.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.assignIn + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * function Bar() { + * this.c = 3; + * } + * + * Foo.prototype.b = 2; + * Bar.prototype.d = 4; + * + * _.assign({ 'a': 0 }, new Foo, new Bar); + * // => { 'a': 1, 'c': 3 } + */ + var assign = createAssigner(function(object, source) { + if (isPrototype(source) || isArrayLike(source)) { + copyObject(source, keys(source), object); + return; + } + for (var key in source) { + if (hasOwnProperty.call(source, key)) { + assignValue(object, key, source[key]); + } + } + }); + + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias extend + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.assign + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * function Bar() { + * this.c = 3; + * } + * + * Foo.prototype.b = 2; + * Bar.prototype.d = 4; + * + * _.assignIn({ 'a': 0 }, new Foo, new Bar); + * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } + */ + var assignIn = createAssigner(function(object, source) { + copyObject(source, keysIn(source), object); + }); + + /** + * This method is like `_.assignIn` except that it accepts `customizer` + * which is invoked to produce the assigned values. If `customizer` returns + * `undefined`, assignment is handled by the method instead. The `customizer` + * is invoked with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias extendWith + * @category Object + * @param {Object} object The destination object. + * @param {...Object} sources The source objects. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @see _.assignWith + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { + copyObject(source, keysIn(source), object, customizer); + }); + + /** + * This method is like `_.assign` except that it accepts `customizer` + * which is invoked to produce the assigned values. If `customizer` returns + * `undefined`, assignment is handled by the method instead. The `customizer` + * is invoked with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} sources The source objects. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @see _.assignInWith + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + var assignWith = createAssigner(function(object, source, srcIndex, customizer) { + copyObject(source, keys(source), object, customizer); + }); + + /** + * Creates an array of values corresponding to `paths` of `object`. + * + * @static + * @memberOf _ + * @since 1.0.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {...(string|string[])} [paths] The property paths to pick. + * @returns {Array} Returns the picked values. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; + * + * _.at(object, ['a[0].b.c', 'a[1]']); + * // => [3, 4] + */ + var at = flatRest(baseAt); + + /** + * Creates an object that inherits from the `prototype` object. If a + * `properties` object is given, its own enumerable string keyed properties + * are assigned to the created object. + * + * @static + * @memberOf _ + * @since 2.3.0 + * @category Object + * @param {Object} prototype The object to inherit from. + * @param {Object} [properties] The properties to assign to the object. + * @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) { + var result = baseCreate(prototype); + return properties == null ? result : baseAssign(result, properties); + } + + /** + * Assigns own and inherited enumerable string keyed properties of source + * objects to the destination object for all destination properties that + * resolve to `undefined`. Source objects are applied from left to right. + * Once a property is set, additional values of the same property are ignored. + * + * **Note:** This method mutates `object`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.defaultsDeep + * @example + * + * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + var defaults = baseRest(function(object, sources) { + object = Object(object); + + var index = -1; + var length = sources.length; + var guard = length > 2 ? sources[2] : undefined; + + if (guard && isIterateeCall(sources[0], sources[1], guard)) { + length = 1; + } + + while (++index < length) { + var source = sources[index]; + var props = keysIn(source); + var propsIndex = -1; + var propsLength = props.length; + + while (++propsIndex < propsLength) { + var key = props[propsIndex]; + var value = object[key]; + + if (value === undefined || + (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) { + object[key] = source[key]; + } + } + } + + return object; + }); + + /** + * This method is like `_.defaults` except that it recursively assigns + * default properties. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 3.10.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.defaults + * @example + * + * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } }); + * // => { 'a': { 'b': 2, 'c': 3 } } + */ + var defaultsDeep = baseRest(function(args) { + args.push(undefined, customDefaultsMerge); + return apply(mergeWith, undefined, args); + }); + + /** + * This method is like `_.find` except that it returns the key of the first + * element `predicate` returns truthy for instead of the element itself. + * + * @static + * @memberOf _ + * @since 1.1.0 + * @category Object + * @param {Object} object The object to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @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(o) { return o.age < 40; }); + * // => 'barney' (iteration order is not guaranteed) + * + * // The `_.matches` iteratee shorthand. + * _.findKey(users, { 'age': 1, 'active': true }); + * // => 'pebbles' + * + * // The `_.matchesProperty` iteratee shorthand. + * _.findKey(users, ['active', false]); + * // => 'fred' + * + * // The `_.property` iteratee shorthand. + * _.findKey(users, 'active'); + * // => 'barney' + */ + function findKey(object, predicate) { + return baseFindKey(object, getIteratee(predicate, 3), baseForOwn); + } + + /** + * This method is like `_.findKey` except that it iterates over elements of + * a collection in the opposite order. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Object + * @param {Object} object The object to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @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(o) { return o.age < 40; }); + * // => returns 'pebbles' assuming `_.findKey` returns 'barney' + * + * // The `_.matches` iteratee shorthand. + * _.findLastKey(users, { 'age': 36, 'active': true }); + * // => 'barney' + * + * // The `_.matchesProperty` iteratee shorthand. + * _.findLastKey(users, ['active', false]); + * // => 'fred' + * + * // The `_.property` iteratee shorthand. + * _.findLastKey(users, 'active'); + * // => 'pebbles' + */ + function findLastKey(object, predicate) { + return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight); + } + + /** + * Iterates over own and inherited enumerable string keyed properties of an + * object and invokes `iteratee` for each property. The iteratee is invoked + * with three arguments: (value, key, object). Iteratee functions may exit + * iteration early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @since 0.3.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns `object`. + * @see _.forInRight + * @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', then 'c' (iteration order is not guaranteed). + */ + function forIn(object, iteratee) { + return object == null + ? object + : baseFor(object, getIteratee(iteratee, 3), keysIn); + } + + /** + * This method is like `_.forIn` except that it iterates over properties of + * `object` in the opposite order. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns `object`. + * @see _.forIn + * @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', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'. + */ + function forInRight(object, iteratee) { + return object == null + ? object + : baseForRight(object, getIteratee(iteratee, 3), keysIn); + } + + /** + * Iterates over own enumerable string keyed properties of an object and + * invokes `iteratee` for each property. The iteratee is invoked with three + * arguments: (value, key, object). Iteratee functions may exit iteration + * early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @since 0.3.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns `object`. + * @see _.forOwnRight + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forOwn(new Foo, function(value, key) { + * console.log(key); + * }); + * // => Logs 'a' then 'b' (iteration order is not guaranteed). + */ + function forOwn(object, iteratee) { + return object && baseForOwn(object, getIteratee(iteratee, 3)); + } + + /** + * This method is like `_.forOwn` except that it iterates over properties of + * `object` in the opposite order. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns `object`. + * @see _.forOwn + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forOwnRight(new Foo, function(value, key) { + * console.log(key); + * }); + * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'. + */ + function forOwnRight(object, iteratee) { + return object && baseForOwnRight(object, getIteratee(iteratee, 3)); + } + + /** + * Creates an array of function property names from own enumerable properties + * of `object`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to inspect. + * @returns {Array} Returns the function names. + * @see _.functionsIn + * @example + * + * function Foo() { + * this.a = _.constant('a'); + * this.b = _.constant('b'); + * } + * + * Foo.prototype.c = _.constant('c'); + * + * _.functions(new Foo); + * // => ['a', 'b'] + */ + function functions(object) { + return object == null ? [] : baseFunctions(object, keys(object)); + } + + /** + * Creates an array of function property names from own and inherited + * enumerable properties of `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to inspect. + * @returns {Array} Returns the function names. + * @see _.functions + * @example + * + * function Foo() { + * this.a = _.constant('a'); + * this.b = _.constant('b'); + * } + * + * Foo.prototype.c = _.constant('c'); + * + * _.functionsIn(new Foo); + * // => ['a', 'b', 'c'] + */ + function functionsIn(object) { + return object == null ? [] : baseFunctions(object, keysIn(object)); + } + + /** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined`, the `defaultValue` is returned in its place. + * + * @static + * @memberOf _ + * @since 3.7.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ + function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, path); + return result === undefined ? defaultValue : result; + } + + /** + * Checks if `path` is a direct property of `object`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @example + * + * var object = { 'a': { 'b': 2 } }; + * var other = _.create({ 'a': _.create({ 'b': 2 }) }); + * + * _.has(object, 'a'); + * // => true + * + * _.has(object, 'a.b'); + * // => true + * + * _.has(object, ['a', 'b']); + * // => true + * + * _.has(other, 'a'); + * // => false + */ + function has(object, path) { + return object != null && hasPath(object, path, baseHas); + } + + /** + * Checks if `path` is a direct or inherited property of `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @example + * + * var object = _.create({ 'a': _.create({ 'b': 2 }) }); + * + * _.hasIn(object, 'a'); + * // => true + * + * _.hasIn(object, 'a.b'); + * // => true + * + * _.hasIn(object, ['a', 'b']); + * // => true + * + * _.hasIn(object, 'b'); + * // => false + */ + function hasIn(object, path) { + return object != null && hasPath(object, path, baseHasIn); + } + + /** + * 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. + * + * @static + * @memberOf _ + * @since 0.7.0 + * @category Object + * @param {Object} object The object to invert. + * @returns {Object} Returns the new inverted object. + * @example + * + * var object = { 'a': 1, 'b': 2, 'c': 1 }; + * + * _.invert(object); + * // => { '1': 'c', '2': 'b' } + */ + var invert = createInverter(function(result, value, key) { + if (value != null && + typeof value.toString != 'function') { + value = nativeObjectToString.call(value); + } + + result[value] = key; + }, constant(identity)); + + /** + * This method is like `_.invert` except that the inverted object is generated + * from the results of running each element of `object` thru `iteratee`. The + * corresponding inverted value of each inverted key is an array of keys + * responsible for generating the inverted value. The iteratee is invoked + * with one argument: (value). + * + * @static + * @memberOf _ + * @since 4.1.0 + * @category Object + * @param {Object} object The object to invert. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Object} Returns the new inverted object. + * @example + * + * var object = { 'a': 1, 'b': 2, 'c': 1 }; + * + * _.invertBy(object); + * // => { '1': ['a', 'c'], '2': ['b'] } + * + * _.invertBy(object, function(value) { + * return 'group' + value; + * }); + * // => { 'group1': ['a', 'c'], 'group2': ['b'] } + */ + var invertBy = createInverter(function(result, value, key) { + if (value != null && + typeof value.toString != 'function') { + value = nativeObjectToString.call(value); + } + + if (hasOwnProperty.call(result, value)) { + result[value].push(key); + } else { + result[value] = [key]; + } + }, getIteratee); + + /** + * Invokes the method at `path` of `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the method to invoke. + * @param {...*} [args] The arguments to invoke the method with. + * @returns {*} Returns the result of the invoked method. + * @example + * + * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }; + * + * _.invoke(object, 'a[0].b.c.slice', 1, 3); + * // => [2, 3] + */ + var invoke = baseRest(baseInvoke); + + /** + * Creates an array of the own enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. See the + * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * for more details. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @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'] + */ + function keys(object) { + return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); + } + + /** + * Creates an array of the own and inherited enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Object + * @param {Object} object The object to query. + * @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) { + return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); + } + + /** + * The opposite of `_.mapValues`; this method creates an object with the + * same values as `object` and keys generated by running each own enumerable + * string keyed property of `object` thru `iteratee`. The iteratee is invoked + * with three arguments: (value, key, object). + * + * @static + * @memberOf _ + * @since 3.8.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns the new mapped object. + * @see _.mapValues + * @example + * + * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { + * return key + value; + * }); + * // => { 'a1': 1, 'b2': 2 } + */ + function mapKeys(object, iteratee) { + var result = {}; + iteratee = getIteratee(iteratee, 3); + + baseForOwn(object, function(value, key, object) { + baseAssignValue(result, iteratee(value, key, object), value); + }); + return result; + } + + /** + * Creates an object with the same keys as `object` and values generated + * by running each own enumerable string keyed property of `object` thru + * `iteratee`. The iteratee is invoked with three arguments: + * (value, key, object). + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns the new mapped object. + * @see _.mapKeys + * @example + * + * var users = { + * 'fred': { 'user': 'fred', 'age': 40 }, + * 'pebbles': { 'user': 'pebbles', 'age': 1 } + * }; + * + * _.mapValues(users, function(o) { return o.age; }); + * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) + * + * // The `_.property` iteratee shorthand. + * _.mapValues(users, 'age'); + * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) + */ + function mapValues(object, iteratee) { + var result = {}; + iteratee = getIteratee(iteratee, 3); + + baseForOwn(object, function(value, key, object) { + baseAssignValue(result, key, iteratee(value, key, object)); + }); + return result; + } + + /** + * This method is like `_.assign` except that it recursively merges own and + * inherited enumerable string keyed properties of source objects into the + * destination object. Source properties that resolve to `undefined` are + * skipped if a destination value exists. Array and plain object properties + * are merged recursively. Other objects and value types are overridden by + * assignment. Source objects are applied from left to right. Subsequent + * sources overwrite property assignments of previous sources. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 0.5.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @example + * + * var object = { + * 'a': [{ 'b': 2 }, { 'd': 4 }] + * }; + * + * var other = { + * 'a': [{ 'c': 3 }, { 'e': 5 }] + * }; + * + * _.merge(object, other); + * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] } + */ + var merge = createAssigner(function(object, source, srcIndex) { + baseMerge(object, source, srcIndex); + }); + + /** + * This method is like `_.merge` except that it accepts `customizer` which + * 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 invoked with six arguments: + * (objValue, srcValue, key, object, source, stack). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} sources The source objects. + * @param {Function} customizer The function to customize assigned values. + * @returns {Object} Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * if (_.isArray(objValue)) { + * return objValue.concat(srcValue); + * } + * } + * + * var object = { 'a': [1], 'b': [2] }; + * var other = { 'a': [3], 'b': [4] }; + * + * _.mergeWith(object, other, customizer); + * // => { 'a': [1, 3], 'b': [2, 4] } + */ + var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { + baseMerge(object, source, srcIndex, customizer); + }); + + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable property paths of `object` that are not omitted. + * + * **Note:** This method is considerably slower than `_.pick`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The source object. + * @param {...(string|string[])} [paths] The property paths to omit. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + var omit = flatRest(function(object, paths) { + var result = {}; + if (object == null) { + return result; + } + var isDeep = false; + paths = arrayMap(paths, function(path) { + path = castPath(path, object); + isDeep || (isDeep = path.length > 1); + return path; + }); + copyObject(object, getAllKeysIn(object), result); + if (isDeep) { + result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); + } + var length = paths.length; + while (length--) { + baseUnset(result, paths[length]); + } + return result; + }); + + /** + * The opposite of `_.pickBy`; this method creates an object composed of + * the own and inherited enumerable string keyed properties of `object` that + * `predicate` doesn't return truthy for. The predicate is invoked with two + * arguments: (value, key). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The source object. + * @param {Function} [predicate=_.identity] The function invoked per property. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omitBy(object, _.isNumber); + * // => { 'b': '2' } + */ + function omitBy(object, predicate) { + return pickBy(object, negate(getIteratee(predicate))); + } + + /** + * Creates an object composed of the picked `object` properties. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The source object. + * @param {...(string|string[])} [paths] The property paths to pick. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + var pick = flatRest(function(object, paths) { + return object == null ? {} : basePick(object, paths); + }); + + /** + * Creates an object composed of the `object` properties `predicate` returns + * truthy for. The predicate is invoked with two arguments: (value, key). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The source object. + * @param {Function} [predicate=_.identity] The function invoked per property. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pickBy(object, _.isNumber); + * // => { 'a': 1, 'c': 3 } + */ + function pickBy(object, predicate) { + if (object == null) { + return {}; + } + var props = arrayMap(getAllKeysIn(object), function(prop) { + return [prop]; + }); + predicate = getIteratee(predicate); + return basePickBy(object, props, function(value, path) { + return predicate(value, path[0]); + }); + } + + /** + * This method is like `_.get` except that if the resolved value is a + * function it's invoked with the `this` binding of its parent object and + * its result is returned. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to resolve. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] }; + * + * _.result(object, 'a[0].b.c1'); + * // => 3 + * + * _.result(object, 'a[0].b.c2'); + * // => 4 + * + * _.result(object, 'a[0].b.c3', 'default'); + * // => 'default' + * + * _.result(object, 'a[0].b.c3', _.constant('default')); + * // => 'default' + */ + function result(object, path, defaultValue) { + path = castPath(path, object); + + var index = -1, + length = path.length; + + // Ensure the loop is entered when path is empty. + if (!length) { + length = 1; + object = undefined; + } + while (++index < length) { + var value = object == null ? undefined : object[toKey(path[index])]; + if (value === undefined) { + index = length; + value = defaultValue; + } + object = isFunction(value) ? value.call(object) : value; + } + return object; + } + + /** + * Sets the value at `path` of `object`. If a portion of `path` doesn't exist, + * it's created. Arrays are created for missing index properties while objects + * are created for all other missing properties. Use `_.setWith` to customize + * `path` creation. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 3.7.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {*} value The value to set. + * @returns {Object} Returns `object`. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.set(object, 'a[0].b.c', 4); + * console.log(object.a[0].b.c); + * // => 4 + * + * _.set(object, ['x', '0', 'y', 'z'], 5); + * console.log(object.x[0].y.z); + * // => 5 + */ + function set(object, path, value) { + return object == null ? object : baseSet(object, path, value); + } + + /** + * This method is like `_.set` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {*} value The value to set. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @example + * + * var object = {}; + * + * _.setWith(object, '[0][1]', 'a', Object); + * // => { '0': { '1': 'a' } } + */ + function setWith(object, path, value, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + return object == null ? object : baseSet(object, path, value, customizer); + } + + /** + * Creates an array of own enumerable string keyed-value pairs for `object` + * which can be consumed by `_.fromPairs`. If `object` is a map or set, its + * entries are returned. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias entries + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the key-value pairs. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.toPairs(new Foo); + * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) + */ + var toPairs = createToPairs(keys); + + /** + * Creates an array of own and inherited enumerable string keyed-value pairs + * for `object` which can be consumed by `_.fromPairs`. If `object` is a map + * or set, its entries are returned. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias entriesIn + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the key-value pairs. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.toPairsIn(new Foo); + * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed) + */ + var toPairsIn = createToPairs(keysIn); + + /** + * An alternative to `_.reduce`; this method transforms `object` to a new + * `accumulator` object which is the result of running each of its own + * enumerable string keyed properties thru `iteratee`, with each invocation + * potentially mutating the `accumulator` object. If `accumulator` is not + * provided, a new object with the same `[[Prototype]]` will be used. The + * iteratee is invoked with four arguments: (accumulator, value, key, object). + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @since 1.3.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The custom accumulator value. + * @returns {*} Returns the accumulated value. + * @example + * + * _.transform([2, 3, 4], function(result, n) { + * result.push(n *= n); + * return n % 2 == 0; + * }, []); + * // => [4, 9] + * + * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { + * (result[value] || (result[value] = [])).push(key); + * }, {}); + * // => { '1': ['a', 'c'], '2': ['b'] } + */ + function transform(object, iteratee, accumulator) { + var isArr = isArray(object), + isArrLike = isArr || isBuffer(object) || isTypedArray(object); + + iteratee = getIteratee(iteratee, 4); + if (accumulator == null) { + var Ctor = object && object.constructor; + if (isArrLike) { + accumulator = isArr ? new Ctor : []; + } + else if (isObject(object)) { + accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {}; + } + else { + accumulator = {}; + } + } + (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) { + return iteratee(accumulator, value, index, object); + }); + return accumulator; + } + + /** + * Removes the property at `path` of `object`. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to unset. + * @returns {boolean} Returns `true` if the property is deleted, else `false`. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 7 } }] }; + * _.unset(object, 'a[0].b.c'); + * // => true + * + * console.log(object); + * // => { 'a': [{ 'b': {} }] }; + * + * _.unset(object, ['a', '0', 'b', 'c']); + * // => true + * + * console.log(object); + * // => { 'a': [{ 'b': {} }] }; + */ + function unset(object, path) { + return object == null ? true : baseUnset(object, path); + } + + /** + * This method is like `_.set` except that accepts `updater` to produce the + * value to set. Use `_.updateWith` to customize `path` creation. The `updater` + * is invoked with one argument: (value). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.6.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {Function} updater The function to produce the updated value. + * @returns {Object} Returns `object`. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.update(object, 'a[0].b.c', function(n) { return n * n; }); + * console.log(object.a[0].b.c); + * // => 9 + * + * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; }); + * console.log(object.x[0].y.z); + * // => 0 + */ + function update(object, path, updater) { + return object == null ? object : baseUpdate(object, path, castFunction(updater)); + } + + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.6.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {Function} updater The function to produce the updated value. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + function updateWith(object, path, updater, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer); + } + + /** + * Creates an array of the own enumerable string keyed property values of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @since 0.1.0 + * @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 object == null ? [] : baseValues(object, keys(object)); + } + + /** + * Creates an array of the own and inherited enumerable string keyed property + * values of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @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 object == null ? [] : baseValues(object, keysIn(object)); + } + + /*------------------------------------------------------------------------*/ + + /** + * Clamps `number` within the inclusive `lower` and `upper` bounds. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Number + * @param {number} number The number to clamp. + * @param {number} [lower] The lower bound. + * @param {number} upper The upper bound. + * @returns {number} Returns the clamped number. + * @example + * + * _.clamp(-10, -5, 5); + * // => -5 + * + * _.clamp(10, -5, 5); + * // => 5 + */ + function clamp(number, lower, upper) { + if (upper === undefined) { + upper = lower; + lower = undefined; + } + if (upper !== undefined) { + upper = toNumber(upper); + upper = upper === upper ? upper : 0; + } + if (lower !== undefined) { + lower = toNumber(lower); + lower = lower === lower ? lower : 0; + } + return baseClamp(toNumber(number), lower, upper); + } + + /** + * Checks if `n` is between `start` and up to, but not including, `end`. If + * `end` is not specified, it's set to `start` with `start` then set to `0`. + * If `start` is greater than `end` the params are swapped to support + * negative ranges. + * + * @static + * @memberOf _ + * @since 3.3.0 + * @category Number + * @param {number} number The number to check. + * @param {number} [start=0] The start of the range. + * @param {number} end The end of the range. + * @returns {boolean} Returns `true` if `number` is in the range, else `false`. + * @see _.range, _.rangeRight + * @example + * + * _.inRange(3, 2, 4); + * // => true + * + * _.inRange(4, 8); + * // => true + * + * _.inRange(4, 2); + * // => false + * + * _.inRange(2, 2); + * // => false + * + * _.inRange(1.2, 2); + * // => true + * + * _.inRange(5.2, 4); + * // => false + * + * _.inRange(-3, -2, -6); + * // => true + */ + function inRange(number, start, end) { + start = toFinite(start); + if (end === undefined) { + end = start; + start = 0; + } else { + end = toFinite(end); + } + number = toNumber(number); + return baseInRange(number, start, end); + } + + /** + * Produces a random number between the inclusive `lower` and `upper` bounds. + * If only one argument is provided a number between `0` and the given number + * is returned. If `floating` is `true`, or either `lower` or `upper` are + * floats, a floating-point number is returned instead of an integer. + * + * **Note:** JavaScript follows the IEEE-754 standard for resolving + * floating-point values which can produce unexpected results. + * + * @static + * @memberOf _ + * @since 0.7.0 + * @category Number + * @param {number} [lower=0] The lower bound. + * @param {number} [upper=1] The upper bound. + * @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(lower, upper, floating) { + if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) { + upper = floating = undefined; + } + if (floating === undefined) { + if (typeof upper == 'boolean') { + floating = upper; + upper = undefined; + } + else if (typeof lower == 'boolean') { + floating = lower; + lower = undefined; + } + } + if (lower === undefined && upper === undefined) { + lower = 0; + upper = 1; + } + else { + lower = toFinite(lower); + if (upper === undefined) { + upper = lower; + lower = 0; + } else { + upper = toFinite(upper); + } + } + if (lower > upper) { + var temp = lower; + lower = upper; + upper = temp; + } + if (floating || lower % 1 || upper % 1) { + var rand = nativeRandom(); + return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper); + } + return baseRandom(lower, upper); + } + + /*------------------------------------------------------------------------*/ + + /** + * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @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 ? capitalize(word) : word); + }); + + /** + * Converts the first character of `string` to upper case and the remaining + * to lower case. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to capitalize. + * @returns {string} Returns the capitalized string. + * @example + * + * _.capitalize('FRED'); + * // => 'Fred' + */ + function capitalize(string) { + return upperFirst(toString(string).toLowerCase()); + } + + /** + * Deburrs `string` by converting + * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) + * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) + * letters to basic Latin letters and removing + * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @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 = toString(string); + return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); + } + + /** + * Checks if `string` ends with the given target string. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to inspect. + * @param {string} [target] The string to search for. + * @param {number} [position=string.length] The position to search up to. + * @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 = toString(string); + target = baseToString(target); + + var length = string.length; + position = position === undefined + ? length + : baseClamp(toInteger(position), 0, length); + + var end = position; + position -= target.length; + return position >= 0 && string.slice(position, end) == target; + } + + /** + * 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 need 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. + * + * When working with HTML you should always + * [quote attribute values](http://wonko.com/post/html-escaping) to reduce + * XSS vectors. + * + * @static + * @since 0.1.0 + * @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) { + string = toString(string); + return (string && reHasUnescapedHtml.test(string)) + ? string.replace(reUnescapedHtml, escapeHtmlChar) + : string; + } + + /** + * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", + * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @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 = toString(string); + return (string && reHasRegExpChar.test(string)) + ? string.replace(reRegExpChar, '\\$&') + : string; + } + + /** + * Converts `string` to + * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @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(); + }); + + /** + * Converts `string`, as space separated words, to lower case. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the lower cased string. + * @example + * + * _.lowerCase('--Foo-Bar--'); + * // => 'foo bar' + * + * _.lowerCase('fooBar'); + * // => 'foo bar' + * + * _.lowerCase('__FOO_BAR__'); + * // => 'foo bar' + */ + var lowerCase = createCompounder(function(result, word, index) { + return result + (index ? ' ' : '') + word.toLowerCase(); + }); + + /** + * Converts the first character of `string` to lower case. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.lowerFirst('Fred'); + * // => 'fred' + * + * _.lowerFirst('FRED'); + * // => 'fRED' + */ + var lowerFirst = createCaseFirst('toLowerCase'); + + /** + * Pads `string` on the left and right sides if it's shorter than `length`. + * Padding characters are truncated if they can't be evenly divided by `length`. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @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 = toString(string); + length = toInteger(length); + + var strLength = length ? stringSize(string) : 0; + if (!length || strLength >= length) { + return string; + } + var mid = (length - strLength) / 2; + return ( + createPadding(nativeFloor(mid), chars) + + string + + createPadding(nativeCeil(mid), chars) + ); + } + + /** + * Pads `string` on the right side if it's shorter than `length`. Padding + * characters are truncated if they exceed `length`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @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 + * + * _.padEnd('abc', 6); + * // => 'abc ' + * + * _.padEnd('abc', 6, '_-'); + * // => 'abc_-_' + * + * _.padEnd('abc', 3); + * // => 'abc' + */ + function padEnd(string, length, chars) { + string = toString(string); + length = toInteger(length); + + var strLength = length ? stringSize(string) : 0; + return (length && strLength < length) + ? (string + createPadding(length - strLength, chars)) + : string; + } + + /** + * Pads `string` on the left side if it's shorter than `length`. Padding + * characters are truncated if they exceed `length`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @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 + * + * _.padStart('abc', 6); + * // => ' abc' + * + * _.padStart('abc', 6, '_-'); + * // => '_-_abc' + * + * _.padStart('abc', 3); + * // => 'abc' + */ + function padStart(string, length, chars) { + string = toString(string); + length = toInteger(length); + + var strLength = length ? stringSize(string) : 0; + return (length && strLength < length) + ? (createPadding(length - strLength, chars) + string) + : string; + } + + /** + * 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](https://es5.github.io/#x15.1.2.2) of `parseInt`. + * + * @static + * @memberOf _ + * @since 1.1.0 + * @category String + * @param {string} string The string to convert. + * @param {number} [radix=10] The radix to interpret `value` by. + * @param- {Object} [guard] Enables use as an iteratee for methods 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 || radix == null) { + radix = 0; + } else if (radix) { + radix = +radix; + } + return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0); + } + + /** + * Repeats the given string `n` times. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to repeat. + * @param {number} [n=1] The number of times to repeat the string. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {string} Returns the repeated string. + * @example + * + * _.repeat('*', 3); + * // => '***' + * + * _.repeat('abc', 2); + * // => 'abcabc' + * + * _.repeat('abc', 0); + * // => '' + */ + function repeat(string, n, guard) { + if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) { + n = 1; + } else { + n = toInteger(n); + } + return baseRepeat(toString(string), n); + } + + /** + * Replaces matches for `pattern` in `string` with `replacement`. + * + * **Note:** This method is based on + * [`String#replace`](https://mdn.io/String/replace). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to modify. + * @param {RegExp|string} pattern The pattern to replace. + * @param {Function|string} replacement The match replacement. + * @returns {string} Returns the modified string. + * @example + * + * _.replace('Hi Fred', 'Fred', 'Barney'); + * // => 'Hi Barney' + */ + function replace() { + var args = arguments, + string = toString(args[0]); + + return args.length < 3 ? string : string.replace(args[1], args[2]); + } + + /** + * Converts `string` to + * [snake case](https://en.wikipedia.org/wiki/Snake_case). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @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(); + }); + + /** + * Splits `string` by `separator`. + * + * **Note:** This method is based on + * [`String#split`](https://mdn.io/String/split). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to split. + * @param {RegExp|string} separator The separator pattern to split by. + * @param {number} [limit] The length to truncate results to. + * @returns {Array} Returns the string segments. + * @example + * + * _.split('a-b-c', '-', 2); + * // => ['a', 'b'] + */ + function split(string, separator, limit) { + if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) { + separator = limit = undefined; + } + limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0; + if (!limit) { + return []; + } + string = toString(string); + if (string && ( + typeof separator == 'string' || + (separator != null && !isRegExp(separator)) + )) { + separator = baseToString(separator); + if (!separator && hasUnicode(string)) { + return castSlice(stringToArray(string), 0, limit); + } + } + return string.split(separator, limit); + } + + /** + * Converts `string` to + * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). + * + * @static + * @memberOf _ + * @since 3.1.0 + * @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 ? ' ' : '') + upperFirst(word); + }); + + /** + * Checks if `string` starts with the given target string. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to inspect. + * @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 = toString(string); + position = position == null + ? 0 + : baseClamp(toInteger(position), 0, string.length); + + target = baseToString(target); + return string.slice(position, position + target.length) == target; + } + + /** + * 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 given, it takes precedence over `_.templateSettings` values. + * + * **Note:** In the development build `_.template` utilizes + * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) + * for easier debugging. + * + * 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 + * @since 0.1.0 + * @memberOf _ + * @category String + * @param {string} [string=''] The template string. + * @param {Object} [options={}] The options object. + * @param {RegExp} [options.escape=_.templateSettings.escape] + * The HTML "escape" delimiter. + * @param {RegExp} [options.evaluate=_.templateSettings.evaluate] + * The "evaluate" delimiter. + * @param {Object} [options.imports=_.templateSettings.imports] + * An object to import into the template as free variables. + * @param {RegExp} [options.interpolate=_.templateSettings.interpolate] + * The "interpolate" delimiter. + * @param {string} [options.sourceURL='lodash.templateSources[n]'] + * The sourceURL of the compiled template. + * @param {string} [options.variable='obj'] + * The data object variable name. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Function} Returns the compiled template function. + * @example + * + * // Use the "interpolate" delimiter to create a compiled template. + * var compiled = _.template('hello <%= user %>!'); + * compiled({ 'user': 'fred' }); + * // => 'hello fred!' + * + * // Use the HTML "escape" delimiter to escape data property values. + * var compiled = _.template('<%- value %>'); + * compiled({ 'value': ' + @@ -14,26 +14,42 @@ var Buffer = Buffer || []; var process = process || { env: { DEBUG: undefined }, - version: [], + version: [] }; - -
- -
- - - - - - -
-
-
+
+
+ + + + +
+ + diff --git a/src/workbench/browser/src/locale/messages.xlf b/src/workbench/browser/src/locale/messages.xlf deleted file mode 100644 index 1227866f2..000000000 --- a/src/workbench/browser/src/locale/messages.xlf +++ /dev/null @@ -1,3805 +0,0 @@ - - - - - - No mock found with ID - - src/app/app.service.ts - 48 - - - - Version - - src/app/core/services/electron/electron.service.ts - 53 - - - - Classic - - src/app/core/services/theme/theme.model.ts - 3 - - - - Forest - - src/app/core/services/theme/theme.model.ts - 6 - - - - Don't have Eoapi Client? - - src/app/core/services/web/download-client.component.ts - 7 - - - - Download - - src/app/core/services/web/download-client.component.ts - 8 - - - - Windows Client - - src/app/core/services/web/web.service.ts - 18 - - - - MacOS(Intel) Client - - src/app/core/services/web/web.service.ts - 26 - - - - MacOS(M1) Client - - src/app/core/services/web/web.service.ts - 33 - - - - Account - - src/app/pages/account.component.ts - 11 - - - - Username - - src/app/pages/account.component.ts - 14 - - - - Save - - src/app/pages/account.component.ts - 33,35 - - - src/app/pages/workspace.component.ts - 38,40 - - - - Password - - src/app/pages/account.component.ts - 41 - - - - Current password - - src/app/pages/account.component.ts - 46 - - - - New password - - src/app/pages/account.component.ts - 53 - - - - Confirm new password - - src/app/pages/account.component.ts - 60 - - - - Please input your confirm new password; - - src/app/pages/account.component.ts - 64,66 - - - - Please confirm your password; - - src/app/pages/account.component.ts - 68 - - - - Min length is 6; - - src/app/pages/account.component.ts - 70 - - - src/app/pages/user-modal.component.ts - 134 - - - - Max length is 11; - - src/app/pages/account.component.ts - 72 - - - - Reset - - src/app/pages/account.component.ts - 86,88 - - - - Sorry, username is already in use - - src/app/pages/account.component.ts - 141 - - - - Username update success ! - - src/app/pages/account.component.ts - 163 - - - - Validation failed - - src/app/pages/account.component.ts - 186 - - - - Password reset success ! - - src/app/pages/account.component.ts - 197 - - - - New Request - - src/app/pages/api/api-tab.service.ts - 25 - - - src/app/pages/api/api-tab.service.ts - 43 - - - - Preview - - src/app/pages/api/api-tab.service.ts - 28 - - - src/app/pages/api/api-tab.service.ts - 47 - - - - New Websocket - - src/app/pages/api/api-tab.service.ts - 35 - - - src/app/pages/api/api-tab.service.ts - 54 - - - - New API - - src/app/pages/api/api-tab.service.ts - 46 - - - - Collections - - src/app/pages/api/api.component.html - 23 - - - - History - - src/app/pages/api/api.component.html - 39 - - - src/app/pages/api/history/eo-history.component.html - 3 - - - - Environment - - src/app/pages/api/api.component.html - 76 - - - src/app/shared/components/env/env.component.html - 3 - - Environment Dropdown placeholder - - - Manage Environment - - src/app/pages/api/api.component.html - 90 - - - - Enviroment Quick Look - - src/app/pages/api/api.component.html - 99 - - - - Environment Setting - - src/app/pages/api/api.component.html - 153 - - - - Preview - - src/app/pages/api/api.component.ts - 54 - - - - Edit - - src/app/pages/api/api.component.ts - 58 - - - src/app/pages/api/http/mock/api-mock.component.ts - 46,47 - - - - Test - - src/app/pages/api/api.component.ts - 63 - - - - Eoapi Client is required to use Mock. - - src/app/pages/api/api.component.ts - 131 - - - - Group Name - - src/app/pages/api/group/edit/api-group-edit.component.html - 3 - - - - Please enter group name - - src/app/pages/api/group/edit/api-group-edit.component.html - 4 - - - - Data from will be deleted. This cannot be undone. Are you sure you want to delete? - - - src/app/pages/api/group/edit/api-group-edit.component.html - 9,13 - - - - Search - - src/app/pages/api/group/tree/api-group-tree.component.html - 7 - - - src/app/pages/extension/extension.component.html - 8 - - - src/app/shared/components/monaco-editor/monaco-editor.component.ts - 31 - - - - New API - - src/app/pages/api/group/tree/api-group-tree.component.html - 25 - - - - New Group - - src/app/pages/api/group/tree/api-group-tree.component.html - 27 - - - - Import API - - src/app/pages/api/group/tree/api-group-tree.component.html - 29 - - - - Add API - - src/app/pages/api/group/tree/api-group-tree.component.html - 67 - - - - Add Subgroup - - src/app/pages/api/group/tree/api-group-tree.component.html - 70 - - - - Edit - - src/app/pages/api/group/tree/api-group-tree.component.html - 73 - - - src/app/pages/api/group/tree/api-group-tree.component.html - 103 - - - src/app/pages/api/http/mock/api-mock.component.html - 35 - - - - Delete - - src/app/pages/api/group/tree/api-group-tree.component.html - 76 - - - src/app/pages/api/group/tree/api-group-tree.component.html - 115 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 108 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 226 - - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.ts - 121 - - - src/app/pages/api/http/mock/api-mock.component.html - 47 - - - src/app/pages/api/http/test/api-test-util.service.ts - 55 - - - src/app/pages/api/http/test/api-test-util.service.ts - 137 - - - - Copy - - src/app/pages/api/group/tree/api-group-tree.component.html - 109 - - - src/app/shared/components/monaco-editor/monaco-editor.component.ts - 27 - - - - Index - - src/app/pages/api/group/tree/api-group-tree.component.ts - 61 - - - - Import API - - src/app/pages/api/group/tree/api-group-tree.component.ts - 263 - - - src/app/pages/api/overview/api-overview.component.ts - 27 - - - - successfully - - src/app/pages/api/group/tree/api-group-tree.component.ts - 273 - - - src/app/pages/api/overview/api-overview.component.ts - 58 - - - - Failed to - - src/app/pages/api/group/tree/api-group-tree.component.ts - 277 - - - src/app/pages/api/overview/api-overview.component.ts - 61 - - - - Deletion Confirmation? - - src/app/pages/api/group/tree/api-group-tree.component.ts - 287 - - - src/app/pages/workspace.component.ts - 141 - - - - Are you sure you want to delete the data <strong title=""></strong> ? You cannot restore it once deleted! - - src/app/pages/api/group/tree/api-group-tree.component.ts - 288,290 - - - - Add Group - - src/app/pages/api/group/tree/api-group-tree.component.ts - 346 - - - - Add Subgroup - - src/app/pages/api/group/tree/api-group-tree.component.ts - 355 - - - - Edit Group - - src/app/pages/api/group/tree/api-group-tree.component.ts - 364 - - - - Delete Group - - src/app/pages/api/group/tree/api-group-tree.component.ts - 373 - - - - Are you sure delete all history? - - src/app/pages/api/history/eo-history.component.html - 13 - - - - Param - - src/app/pages/api/http/detail/api-detail-util.service.ts - 59 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 32 - - - src/app/pages/api/http/test/api-test-util.service.ts - 14 - - - src/app/pages/api/http/test/body/api-test-body.component.ts - 218 - - - - Name - - src/app/pages/api/http/detail/api-detail-util.service.ts - 77 - - - src/app/pages/api/http/detail/api-detail-util.service.ts - 80 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 55 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 58 - - - src/app/pages/api/http/test/api-test-util.service.ts - 15 - - - - Required - - src/app/pages/api/http/detail/api-detail-util.service.ts - 85 - - - src/app/pages/api/http/detail/api-detail-util.service.ts - 154 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 63 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 175 - - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.ts - 26 - - - - {{item.required?"True":""}} - - src/app/pages/api/http/detail/api-detail-util.service.ts - 87 - - - src/app/pages/api/http/detail/api-detail-util.service.ts - 156 - - - - Description - - src/app/pages/api/http/detail/api-detail-util.service.ts - 92 - - - src/app/pages/api/http/detail/api-detail-util.service.ts - 161 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 70 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 182 - - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.ts - 32 - - - src/app/shared/components/env/env.component.ts - 34 - - - - Example - - src/app/pages/api/http/detail/api-detail-util.service.ts - 100 - - - src/app/pages/api/http/detail/api-detail-util.service.ts - 169 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 78 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 191 - - - - <button type="button" class="eo-operate-btn" ng-click="$ctrl.data.isSpreedBtnClick=!$ctrl.data.isSpreedBtnClick;$ctrl.data.isSpreed=true;$ctrl.mainObject.baseFun.spreedAll($event);$ctrl.data.isSpreed=false;">{{$ctrl.data.isSpreedBtnClick?"Shrink All":"Expand All"}}</button> - - src/app/pages/api/http/detail/api-detail-util.service.ts - 107 - - - src/app/pages/api/http/detail/api-detail-util.service.ts - 176 - - - - <span class="eo-operate-btn fs12" ng-show="item.minimum || - item.maximum || - item.minLength || - item.maxLength || - (item.enum && item.enum.length > 0 && item.enum[0].value)">{{item.isClick?"Shrink":"Expand"}}</span> - - src/app/pages/api/http/detail/api-detail-util.service.ts - 109,113 - - - src/app/pages/api/http/detail/api-detail-util.service.ts - 178,182 - - - - Param Name - - src/app/pages/api/http/detail/api-detail-util.service.ts - 140 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 155 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 158 - - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.ts - 21 - - - src/app/pages/api/http/test/api-test-util.service.ts - 97 - - - src/app/pages/api/http/test/api-test-util.service.ts - 100 - - - src/app/shared/components/api-script/constant.ts - 113 - - - - Type - - src/app/pages/api/http/detail/api-detail-util.service.ts - 147 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 163 - - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.ts - 37 - - - src/app/pages/api/http/test/api-test-util.service.ts - 105 - - - - Request Headers - - src/app/pages/api/http/detail/api-detail.component.html - 10 - - - src/app/pages/api/http/edit/api-edit.component.html - 56 - - - src/app/pages/api/http/test/api-test.component.html - 191 - - - - Query - - src/app/pages/api/http/detail/api-detail.component.html - 16 - - - src/app/pages/api/http/edit/api-edit.component.html - 93 - - - src/app/pages/api/http/test/api-test.component.html - 110 - - - src/app/pages/api/http/test/query/api-test-query.component.html - 3 - - - - REST - - src/app/pages/api/http/detail/api-detail.component.html - 22 - - - src/app/pages/api/http/edit/api-edit.component.html - 106 - - - src/app/pages/api/http/test/api-test.component.html - 123 - - - - Body - - src/app/pages/api/http/detail/api-detail.component.html - 28 - - - src/app/pages/api/http/edit/api-edit.component.html - 70 - - - src/app/pages/api/http/test/api-test.component.html - 85 - - - src/app/pages/api/http/test/api-test.component.html - 183 - - - - The outermost structure is: - - src/app/pages/api/http/detail/api-detail.component.html - 31,32 - - - - Response Headers - - src/app/pages/api/http/detail/api-detail.component.html - 40 - - - src/app/pages/api/http/edit/api-edit.component.html - 126 - - - src/app/pages/api/http/test/api-test.component.html - 179 - - - - Response - - src/app/pages/api/http/detail/api-detail.component.html - 46 - - - src/app/pages/api/http/edit/api-edit.component.html - 122 - - - src/app/pages/api/http/edit/api-edit.component.html - 140 - - - src/app/pages/api/http/mock/api-mock.component.html - 66 - - - src/app/pages/api/http/test/api-test.component.html - 174 - - - - The outermost structure is: - - src/app/pages/api/http/detail/api-detail.component.html - 49,50 - - - - MOCK - - src/app/pages/api/http/detail/api-detail.component.html - 58 - - - - Name - - src/app/pages/api/http/detail/api-detail.component.ts - 30 - - - src/app/pages/api/http/mock/api-mock.component.ts - 24 - - - src/app/shared/components/env/env.component.ts - 32 - - - - Created Type - - src/app/pages/api/http/detail/api-detail.component.ts - 31 - - - src/app/pages/api/http/mock/api-mock.component.ts - 25 - - - - Header - - src/app/pages/api/http/detail/header/api-detail-header.component.ts - 33 - - - src/app/pages/api/http/edit/header/api-edit-header.component.html - 6 - - - src/app/pages/api/http/edit/header/api-edit-header.component.ts - 48 - - - src/app/pages/api/http/test/header/api-test-header.component.html - 8 - - - src/app/pages/api/http/test/header/api-test-header.component.ts - 51 - - - - Key - - src/app/pages/api/http/detail/header/api-detail-header.component.ts - 34 - - - src/app/pages/api/http/edit/header/api-edit-header.component.ts - 49 - - - src/app/pages/api/http/test/header/api-test-header.component.ts - 52 - - - - Detail - - src/app/pages/api/http/edit/api-edit-util.service.ts - 14 - - - - Description - - src/app/pages/api/http/edit/api-edit-util.service.ts - 73 - - - - Example - - src/app/pages/api/http/edit/api-edit-util.service.ts - 81 - - - - More Settings - - src/app/pages/api/http/edit/api-edit-util.service.ts - 90 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 208 - - - - Insert - - src/app/pages/api/http/edit/api-edit-util.service.ts - 103 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 221 - - - - Param Description - - src/app/pages/api/http/edit/api-edit-util.service.ts - 185 - - - - Param Example - - src/app/pages/api/http/edit/api-edit-util.service.ts - 194 - - - - Add Child - - src/app/pages/api/http/edit/api-edit-util.service.ts - 203 - - - src/app/pages/api/http/test/api-test-util.service.ts - 132 - - - - Save - - src/app/pages/api/http/edit/api-edit.component.html - 4 - - - src/app/pages/api/http/mock/api-mock.component.html - 83 - - - src/app/shared/components/env/env.component.html - 64 - - - - API Path - - src/app/pages/api/http/edit/api-edit.component.html - 7 - - - - Please enter API Path - - src/app/pages/api/http/edit/api-edit.component.html - 16 - - - - Group / API Name - - src/app/pages/api/http/edit/api-edit.component.html - 21 - - - - Please select an API group - - src/app/pages/api/http/edit/api-edit.component.html - 24 - - - - Please enter API name - - src/app/pages/api/http/edit/api-edit.component.html - 41 - - - - Request - - src/app/pages/api/http/edit/api-edit.component.html - 51 - - - - Edited successfully - - src/app/pages/api/http/edit/api-edit.component.ts - 130 - - - src/app/pages/api/http/mock/api-mock.component.ts - 244 - - - src/app/shared/components/env/env.component.ts - 151 - - - - Added successfully - - src/app/pages/api/http/edit/api-edit.component.ts - 130 - - - src/app/pages/api/http/mock/api-mock.component.ts - 249 - - - src/app/shared/components/env/env.component.ts - 165 - - - - Failed Operation - - src/app/pages/api/http/edit/api-edit.component.ts - 146 - - - - Root directory - - src/app/pages/api/http/edit/api-edit.component.ts - 190 - - - - JSON Root Type: - - src/app/pages/api/http/edit/body/api-edit-body.component.html - 15 - - - - Binary Description - - src/app/pages/api/http/edit/body/api-edit-body.component.html - 33 - - - - Example - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.html - 30 - - - - Param Example - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.html - 33 - - - - Minimum length - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.ts - 49 - - - - Maximum Length - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.ts - 57 - - - - Minimum - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.ts - 71 - - - - Maximum - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.ts - 79 - - - - Default - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.ts - 97 - - - - Value enum - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.ts - 104 - - - - enum - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.ts - 107 - - - - Description - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.ts - 111 - - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.ts - 114 - - - - New Mock - - src/app/pages/api/http/mock/api-mock.component.html - 3 - - - - Click to Copy - - src/app/pages/api/http/mock/api-mock.component.html - 14 - - - - Preview - - src/app/pages/api/http/mock/api-mock.component.html - 34 - - - src/app/pages/api/http/mock/api-mock.component.ts - 45 - - - - Are you sure you want to delete this Mock? - - src/app/pages/api/http/mock/api-mock.component.html - 43 - - - - Mock Name - - src/app/pages/api/http/mock/api-mock.component.html - 60 - - - - Cancel - - src/app/pages/api/http/mock/api-mock.component.html - 84 - - - src/app/shared/components/env/env.component.html - 63 - - - src/app/shared/components/params-import/params-import.component.html - 32 - - - - Add - - src/app/pages/api/http/mock/api-mock.component.ts - 43 - - - - System creation - - src/app/pages/api/http/mock/api-mock.component.ts - 54 - - - - Manual creation - - src/app/pages/api/http/mock/api-mock.component.ts - 55 - - - - Delete Succeeded - - src/app/pages/api/http/mock/api-mock.component.ts - 233 - - - - Copied - - src/app/pages/api/http/mock/api-mock.component.ts - 270 - - - src/app/shared/components/monaco-editor/monaco-editor.component.ts - 309 - - - src/app/utils/index.utils.ts - 166 - - - - Value - - src/app/pages/api/http/test/api-test-util.service.ts - 16 - - - - Value - - src/app/pages/api/http/test/api-test-util.service.ts - 118 - - - src/app/pages/api/http/test/api-test-util.service.ts - 123 - - - src/app/pages/api/http/test/header/api-test-header.component.ts - 53 - - - src/app/shared/components/env/env.component.ts - 33 - - - - Please enter URL - - src/app/pages/api/http/test/api-test.component.html - 27 - - - src/app/pages/api/websocket/websocket.component.html - 15 - - - - Enter URL - - src/app/pages/api/http/test/api-test.component.html - 32 - - - src/app/pages/api/websocket/websocket.component.html - 19 - - - - Send - - src/app/pages/api/http/test/api-test.component.html - 42 - - - - Abort - - src/app/pages/api/http/test/api-test.component.html - 43 - - - - Save as API - - src/app/pages/api/http/test/api-test.component.html - 57,59 - - - - Headers - - src/app/pages/api/http/test/api-test.component.html - 71 - - - src/app/pages/api/websocket/websocket.component.html - 72 - - - - Pre-request Script - - src/app/pages/api/http/test/api-test.component.html - 136 - - - - After-response Script - - src/app/pages/api/http/test/api-test.component.html - 150 - - - - Save As File - - src/app/pages/api/http/test/api-test.component.html - 204 - - - - Tap or drag files directly to this area - - src/app/pages/api/http/test/body/api-test-body.component.html - 30 - - - src/app/shared/components/extension-select/extension-select.component.html - 40 - - - - The file is too large and needs to be less than 5 MB - - src/app/pages/api/http/test/body/api-test-body.component.ts - 145 - - - - File size must be less than 2M - - src/app/pages/api/http/test/body/api-test-body.component.ts - 232 - - - - No Headers - - src/app/pages/api/http/test/result-header/api-test-result-header.component.html - 3 - - - - No Request Body - - src/app/pages/api/http/test/result-request-body/api-test-result-request-body.component.html - 3 - - - - Click the Send button to get a test report - - src/app/pages/api/http/test/result-response/api-test-result-response.component.html - 4 - - - - Unable to preview non-text type data, you can - - src/app/pages/api/http/test/result-response/api-test-result-response.component.html - 30 - - - - download response - - src/app/pages/api/http/test/result-response/api-test-result-response.component.html - 32,34 - - - src/app/pages/api/http/test/result-response/api-test-result-response.component.html - 44,46 - - - - and open it with other programs. - - src/app/pages/api/http/test/result-response/api-test-result-response.component.html - 35 - - - - The response result exceeds the previewable size, you can - - src/app/pages/api/http/test/result-response/api-test-result-response.component.html - 42 - - - - Import - - src/app/pages/api/overview/api-overview.component.ts - 25 - - - - Export - - src/app/pages/api/overview/api-overview.component.ts - 31 - - - - Export API - - src/app/pages/api/overview/api-overview.component.ts - 33 - - - - Push - - src/app/pages/api/overview/api-overview.component.ts - 37 - - - - Push/Sync API to other platforms - - src/app/pages/api/overview/api-overview.component.ts - 39 - - - - Program will not close unsaved tabs - - src/app/pages/api/tab/api-tab-operate.service.ts - 336 - - - - Close Other Tags (excluding current tabs) - - src/app/pages/api/tab/api-tab.component.html - 68,70 - - - - Close All Tabs - - src/app/pages/api/tab/api-tab.component.html - 71 - - - - Close Tabs To the Left - - src/app/pages/api/tab/api-tab.component.html - 72,74 - - - - Close Tabs to the Right - - src/app/pages/api/tab/api-tab.component.html - 80,82 - - - - Do you want to save the changes? - - src/app/pages/api/tab/api-tab.component.ts - 71 - - - - Your changes will be lost if you don't save them. - - src/app/pages/api/tab/api-tab.component.ts - 72 - - - - Cancel - - src/app/pages/api/tab/api-tab.component.ts - 76 - - - src/app/pages/api/websocket/websocket.component.ts - 305 - - - src/app/shared/services/modal.service.ts - 33 - - - - Don't Save - - src/app/pages/api/tab/api-tab.component.ts - 82 - - - - Save - - src/app/pages/api/tab/api-tab.component.ts - 90 - - - - Connect - - src/app/pages/api/websocket/websocket.component.html - 37,39 - - - - Connecting - - src/app/pages/api/websocket/websocket.component.html - 40,42 - - - - Disconnect - - src/app/pages/api/websocket/websocket.component.html - 51,53 - - - - Query Params - - src/app/pages/api/websocket/websocket.component.html - 89 - - - - Message - - src/app/pages/api/websocket/websocket.component.html - 103 - - - - Send - - src/app/pages/api/websocket/websocket.component.html - 126,128 - - - - Messages - - src/app/pages/api/websocket/websocket.component.html - 139 - - - - Do you want to leave the page? - - src/app/pages/api/websocket/websocket.component.ts - 290 - - - - After leaving, the current long connection is no longer maintained, whether to confirm to leave? - - src/app/pages/api/websocket/websocket.component.ts - 291 - - - - Leave - - src/app/pages/api/websocket/websocket.component.ts - 295 - - - - Please Enter - - src/app/pages/extension/detail/components/extensions.component.ts - 33 - - - - - - src/app/pages/extension/detail/components/extensions.component.ts - 44,46 - - - - Back - - src/app/pages/extension/detail/extension-detail.component.html - 6 - - - - Uninstall - - src/app/pages/extension/detail/extension-detail.component.html - 36 - - - - Install - - src/app/pages/extension/detail/extension-detail.component.html - 37 - - - - Settings - - src/app/pages/extension/detail/extension-detail.component.html - 52 - - - - Details - - src/app/pages/extension/detail/extension-detail.component.html - 57 - - - src/app/pages/extension/list/extension-list.component.html - 23 - - - - Support - - src/app/pages/extension/detail/extension-detail.component.html - 65 - - - - Author - - src/app/pages/extension/detail/extension-detail.component.html - 67 - - - - Version - - src/app/pages/extension/detail/extension-detail.component.html - 68 - - - - Repository - - src/app/pages/extension/detail/extension-detail.component.html - 69 - - - - Homepage - - src/app/pages/extension/detail/extension-detail.component.html - 74 - - - - BugReport - - src/app/pages/extension/detail/extension-detail.component.html - 77 - - - - ChangeLog - - src/app/pages/extension/detail/extension-detail.component.html - 82 - - - - Changelog failed to load - - src/app/pages/extension/detail/extension-detail.component.html - 85 - - - - Reacquire - - src/app/pages/extension/detail/extension-detail.component.html - 87 - - - - This plugin has no documentation yet. - - src/app/pages/extension/detail/extension-detail.component.ts - 68 - - - - Official - - src/app/pages/extension/extension.component.ts - 22 - - - - All - - src/app/pages/extension/extension.component.ts - 28 - - - - Installed - - src/app/pages/extension/extension.component.ts - 58 - - - - Setting - - src/app/pages/extension/list/extension-list.component.html - 20 - - - - Installed - - src/app/pages/extension/list/extension-list.component.html - 35 - - - - Extension list failed to load - - src/app/pages/extension/list/extension-list.component.ts - 70 - - - - Retry - - src/app/pages/extension/list/extension-list.component.ts - 71 - - - - Add people to the workspace - - src/app/pages/member.component.ts - 19 - - - - Search by username - - src/app/pages/member.component.ts - 23 - - - - Select a member above - - src/app/pages/member.component.ts - 34,36 - - - - Manage access - - src/app/pages/member.component.ts - 41 - - - - Add people - - src/app/pages/member.component.ts - 50,52 - - - - Could not find a user matching - - src/app/pages/member.component.ts - 142 - - - - Add new member success - - src/app/pages/member.component.ts - 163 - - - - Warning - - src/app/pages/member.component.ts - 222 - - - - Are you sure you want to remove the member ? - - src/app/pages/member.component.ts - 223 - - - - Delete - - src/app/pages/member.component.ts - 225 - - - src/app/pages/workspace.component.ts - 145 - - - - Search Workspace - - src/app/pages/navbar/navbar.component.html - 33 - - - - New Workspace - - src/app/pages/navbar/navbar.component.html - 39 - - - - Share - - src/app/pages/navbar/navbar.component.html - 74,76 - - - - Share via link - - src/app/pages/navbar/navbar.component.html - 79 - - - - This link will be updated with the API content. Everyone can access it without logging in - - src/app/pages/navbar/navbar.component.html - 80,82 - - - - Document - - src/app/pages/navbar/navbar.component.html - 105 - - - - Report Issue - - src/app/pages/navbar/navbar.component.html - 114 - - - - Open Settings - - src/app/pages/navbar/navbar.component.html - 126 - - - - Sign in for Collaboration - - src/app/pages/navbar/navbar.component.html - 138 - - - - Account Setting - - src/app/pages/navbar/navbar.component.html - 145 - - - - Sign Out - - src/app/pages/navbar/navbar.component.html - 148 - - - - Minimize - - src/app/pages/navbar/navbar.component.html - 158 - - - - Close - - src/app/pages/navbar/navbar.component.html - 178 - - - - Download - - src/app/pages/navbar/navbar.component.html - 187,190 - - - - Do you want to upload local data to the cloud ? - - src/app/pages/user-modal.component.ts - 23 - - - - After confirmation, the system will create a cloud space to upload the local data to the cloud. - - src/app/pages/user-modal.component.ts - 27,29 - - - - Subsequent local space and cloud space are no longer synchronized - - src/app/pages/user-modal.component.ts - 32 - - - - Cancel - - src/app/pages/user-modal.component.ts - 45,47 - - - src/app/pages/user-modal.component.ts - 82,84 - - - - Sync - - src/app/pages/user-modal.component.ts - 55,57 - - - - Check your connection - - src/app/pages/user-modal.component.ts - 65 - - - - Can't connect right now, click to retry or - - src/app/pages/user-modal.component.ts - 69 - - - - config in the configuration - - src/app/pages/user-modal.component.ts - 70,72 - - - - Retry - - src/app/pages/user-modal.component.ts - 92,94 - - - - Sign In/Up - - src/app/pages/user-modal.component.ts - 103 - - - - Enter Email/Phone/Username - - src/app/pages/user-modal.component.ts - 116 - - - - Enter password - - src/app/pages/user-modal.component.ts - 128 - - - - Please input your password; - - src/app/pages/user-modal.component.ts - 132 - - - - Sign In/Up - - src/app/pages/user-modal.component.ts - 149,151 - - - - Open setting - - src/app/pages/user-modal.component.ts - 162 - - - - If you want to collaborate, please - - src/app/pages/user-modal.component.ts - 166 - - - - open the settings - - src/app/pages/user-modal.component.ts - 167,169 - - - - and fill in the configuration - - src/app/pages/user-modal.component.ts - 170 - - - - Add Workspace - - src/app/pages/user-modal.component.ts - 178 - - - - Workspace Name - - src/app/pages/user-modal.component.ts - 190 - - - - Cancel - - src/app/pages/user-modal.component.ts - 205,207 - - - - Save - - src/app/pages/user-modal.component.ts - 216,218 - - - - Successfully logged out ! - - src/app/pages/user-modal.component.ts - 337 - - - - Connect failed - - src/app/pages/user-modal.component.ts - 359 - - - - Connect success - - src/app/pages/user-modal.component.ts - 370 - - - - Please check you username or password - - src/app/pages/user-modal.component.ts - 571 - - - - Please check the account/password, the account must be a mobile phone number or email ! - - src/app/pages/user-modal.component.ts - 579 - - - - Add workspace Failed ! - - src/app/pages/user-modal.component.ts - 682 - - - - Create new workspace successfully ! - - src/app/pages/user-modal.component.ts - 692 - - - - Manage Workspace - - src/app/pages/workspace.component.ts - 14 - - - - Edit Workspace - - src/app/pages/workspace.component.ts - 20 - - - - Name - - src/app/pages/workspace.component.ts - 24 - - - src/app/shared/components/env/env.component.html - 35 - - - - Delete Workspace - - src/app/pages/workspace.component.ts - 45 - - - - After deleting a workspace, all data in the workspace will be permanently deleted. - - src/app/pages/workspace.component.ts - 48 - - - - Delete - - src/app/pages/workspace.component.ts - 58,60 - - - - Edit workspace failed - - src/app/pages/workspace.component.ts - 105 - - - - Edit workspace successfully ! - - src/app/pages/workspace.component.ts - 115 - - - - Are you sure you want to delete the workspace ? -You cannot restore it once deleted! - - src/app/pages/workspace.component.ts - 142,143 - - - - Delete success ! - - src/app/pages/workspace.component.ts - 169 - - - - Snippets - - src/app/shared/components/api-script/api-script.component.html - 4 - - - - Learn more - - src/app/shared/components/api-script/api-script.component.html - 7 - - - - ---input--- - - src/app/shared/components/api-script/api-script.component.html - 29 - - - - ---return--- - - src/app/shared/components/api-script/api-script.component.html - 36 - - - - API Definite - - src/app/shared/components/api-script/constant.ts - 76 - - - - [Required][string] Request url - - src/app/shared/components/api-script/constant.ts - 77 - - - - [Required][string] API name,for report detail - - src/app/shared/components/api-script/constant.ts - 78 - - - - [Not Required][object] Request headers - - src/app/shared/components/api-script/constant.ts - 79 - - - - [Not Required][string] Body type,formdata|json|xml|raw - - src/app/shared/components/api-script/constant.ts - 80 - - - - [Not Required][object] Request Body - - src/app/shared/components/api-script/constant.ts - 81 - - - - [Not Required]If it exceeds the judgment, the request fails, and the default is 1000ms - - src/app/shared/components/api-script/constant.ts - 82 - - - - Execute request,_api_demo_1_result={time:"Test time",code:"HTTP status code",response:"API response",header:"response headers"}, - - src/app/shared/components/api-script/constant.ts - 83 - - - - Assert response - - src/app/shared/components/api-script/constant.ts - 84 - - - - Print info - - src/app/shared/components/api-script/constant.ts - 85 - - - - Print error info - - src/app/shared/components/api-script/constant.ts - 86 - - - - Param Value - - src/app/shared/components/api-script/constant.ts - 114 - - - - Custom Global Variable - - src/app/shared/components/api-script/constant.ts - 119 - - - - Set an global variable - - src/app/shared/components/api-script/constant.ts - 122 - - - src/app/shared/components/api-script/constant.ts - 127 - - - - Get an global variable - - src/app/shared/components/api-script/constant.ts - 132 - - - src/app/shared/components/api-script/constant.ts - 137 - - - - Global Varibale Value - - src/app/shared/components/api-script/constant.ts - 139 - - - - Clear an global variable - - src/app/shared/components/api-script/constant.ts - 143 - - - src/app/shared/components/api-script/constant.ts - 148 - - - - Clear all global variable - - src/app/shared/components/api-script/constant.ts - 153 - - - src/app/shared/components/api-script/constant.ts - 158 - - - - Encode and Decode - - src/app/shared/components/api-script/constant.ts - 164 - - - - JSON Encode - - src/app/shared/components/api-script/constant.ts - 167 - - - src/app/shared/components/api-script/constant.ts - 172 - - - - JSON object - - src/app/shared/components/api-script/constant.ts - 173 - - - src/app/shared/components/api-script/constant.ts - 185 - - - - JSON string - - src/app/shared/components/api-script/constant.ts - 174 - - - src/app/shared/components/api-script/constant.ts - 184 - - - - JSON Decode - - src/app/shared/components/api-script/constant.ts - 178 - - - src/app/shared/components/api-script/constant.ts - 183 - - - - XML Encode - - src/app/shared/components/api-script/constant.ts - 189 - - - src/app/shared/components/api-script/constant.ts - 194 - - - - XML object - - src/app/shared/components/api-script/constant.ts - 195 - - - - XML string - - src/app/shared/components/api-script/constant.ts - 196 - - - src/app/shared/components/api-script/constant.ts - 206 - - - - XML Decode - - src/app/shared/components/api-script/constant.ts - 200 - - - src/app/shared/components/api-script/constant.ts - 205 - - - - XML code - - src/app/shared/components/api-script/constant.ts - 207 - - - - Base64 Encode - - src/app/shared/components/api-script/constant.ts - 211 - - - src/app/shared/components/api-script/constant.ts - 216 - - - - string of wait for encode - - src/app/shared/components/api-script/constant.ts - 217 - - - src/app/shared/components/api-script/constant.ts - 239 - - - - string after encode - - src/app/shared/components/api-script/constant.ts - 218 - - - src/app/shared/components/api-script/constant.ts - 240 - - - - Base64 Decode - - src/app/shared/components/api-script/constant.ts - 222 - - - src/app/shared/components/api-script/constant.ts - 227 - - - - string of wait for decode - - src/app/shared/components/api-script/constant.ts - 228 - - - src/app/shared/components/api-script/constant.ts - 250 - - - - string after decode - - src/app/shared/components/api-script/constant.ts - 229 - - - src/app/shared/components/api-script/constant.ts - 251 - - - - UrlEncode Encode - - src/app/shared/components/api-script/constant.ts - 233 - - - src/app/shared/components/api-script/constant.ts - 238 - - - - UrlEncode Decode - - src/app/shared/components/api-script/constant.ts - 244 - - - src/app/shared/components/api-script/constant.ts - 249 - - - - Gzip zip - - src/app/shared/components/api-script/constant.ts - 255 - - - src/app/shared/components/api-script/constant.ts - 260 - - - - string of wait for zip - - src/app/shared/components/api-script/constant.ts - 261 - - - src/app/shared/components/api-script/constant.ts - 283 - - - - string after zip - - src/app/shared/components/api-script/constant.ts - 262 - - - src/app/shared/components/api-script/constant.ts - 284 - - - - Gzip unzip - - src/app/shared/components/api-script/constant.ts - 266 - - - src/app/shared/components/api-script/constant.ts - 271 - - - - string of wait for unzip - - src/app/shared/components/api-script/constant.ts - 272 - - - src/app/shared/components/api-script/constant.ts - 294 - - - - string after unzip - - src/app/shared/components/api-script/constant.ts - 273 - - - src/app/shared/components/api-script/constant.ts - 295 - - - - Deflate zip - - src/app/shared/components/api-script/constant.ts - 277 - - - src/app/shared/components/api-script/constant.ts - 282 - - - - Deflate unzip - - src/app/shared/components/api-script/constant.ts - 288 - - - src/app/shared/components/api-script/constant.ts - 293 - - - - Encryption and Decryption - - src/app/shared/components/api-script/constant.ts - 301 - - - - MD5 Encryption - - src/app/shared/components/api-script/constant.ts - 309 - - - - Content to be encrypted - - src/app/shared/components/api-script/constant.ts - 313 - - - src/app/shared/components/api-script/constant.ts - 329 - - - src/app/shared/components/api-script/constant.ts - 345 - - - src/app/shared/components/api-script/constant.ts - 361 - - - src/app/shared/components/api-script/constant.ts - 385 - - - src/app/shared/components/api-script/constant.ts - 409 - - - src/app/shared/components/api-script/constant.ts - 433 - - - src/app/shared/components/api-script/constant.ts - 457 - - - src/app/shared/components/api-script/constant.ts - 505 - - - src/app/shared/components/api-script/constant.ts - 537 - - - src/app/shared/components/api-script/constant.ts - 569 - - - src/app/shared/components/api-script/constant.ts - 601 - - - - Encrypted result - - src/app/shared/components/api-script/constant.ts - 316 - - - src/app/shared/components/api-script/constant.ts - 332 - - - src/app/shared/components/api-script/constant.ts - 348 - - - src/app/shared/components/api-script/constant.ts - 468 - - - src/app/shared/components/api-script/constant.ts - 524 - - - src/app/shared/components/api-script/constant.ts - 556 - - - src/app/shared/components/api-script/constant.ts - 588 - - - src/app/shared/components/api-script/constant.ts - 620 - - - - SHA1 Encryption - - src/app/shared/components/api-script/constant.ts - 320 - - - src/app/shared/components/api-script/constant.ts - 325 - - - - SHA256 Encryption - - src/app/shared/components/api-script/constant.ts - 336 - - - src/app/shared/components/api-script/constant.ts - 341 - - - - RSA-SHA1 Signature - - src/app/shared/components/api-script/constant.ts - 352 - - - src/app/shared/components/api-script/constant.ts - 357 - - - - private key - - src/app/shared/components/api-script/constant.ts - 365 - - - src/app/shared/components/api-script/constant.ts - 389 - - - src/app/shared/components/api-script/constant.ts - 461 - - - src/app/shared/components/api-script/constant.ts - 485 - - - - The encoding format of the result, base64 (default) - - src/app/shared/components/api-script/constant.ts - 369 - - - src/app/shared/components/api-script/constant.ts - 393 - - - src/app/shared/components/api-script/constant.ts - 417 - - - src/app/shared/components/api-script/constant.ts - 465 - - - - Content After Signing - - src/app/shared/components/api-script/constant.ts - 372 - - - src/app/shared/components/api-script/constant.ts - 396 - - - src/app/shared/components/api-script/constant.ts - 420 - - - - RSA-SHA256 Signature - - src/app/shared/components/api-script/constant.ts - 376 - - - src/app/shared/components/api-script/constant.ts - 381 - - - - RSA Public Key Encryption - - src/app/shared/components/api-script/constant.ts - 400 - - - src/app/shared/components/api-script/constant.ts - 405 - - - - public key - - src/app/shared/components/api-script/constant.ts - 413 - - - src/app/shared/components/api-script/constant.ts - 437 - - - - RSA Public Key Dencryption - - src/app/shared/components/api-script/constant.ts - 424 - - - src/app/shared/components/api-script/constant.ts - 429 - - - - The encoding format of the content to be decrypted, base64 (default) - - src/app/shared/components/api-script/constant.ts - 441 - - - src/app/shared/components/api-script/constant.ts - 489 - - - - Decrypted content - - src/app/shared/components/api-script/constant.ts - 444 - - - - RSA Private Key Encryption - - src/app/shared/components/api-script/constant.ts - 448 - - - src/app/shared/components/api-script/constant.ts - 453 - - - src/app/shared/components/api-script/constant.ts - 472 - - - src/app/shared/components/api-script/constant.ts - 477 - - - - Content to be decrypted - - src/app/shared/components/api-script/constant.ts - 481 - - - - Decrypted Content - - src/app/shared/components/api-script/constant.ts - 492 - - - - AES Encryption - - src/app/shared/components/api-script/constant.ts - 496 - - - src/app/shared/components/api-script/constant.ts - 501 - - - - password - - src/app/shared/components/api-script/constant.ts - 509 - - - src/app/shared/components/api-script/constant.ts - 541 - - - src/app/shared/components/api-script/constant.ts - 573 - - - src/app/shared/components/api-script/constant.ts - 605 - - - - Padding mode, Pkcs7 (default)/NoPadding/ZeroPadding - - src/app/shared/components/api-script/constant.ts - 513 - - - src/app/shared/components/api-script/constant.ts - 545 - - - src/app/shared/components/api-script/constant.ts - 577 - - - src/app/shared/components/api-script/constant.ts - 609 - - - - Mode, CBC (default)/ECB/CTR/OFB/CFB - - src/app/shared/components/api-script/constant.ts - 517 - - - src/app/shared/components/api-script/constant.ts - 549 - - - src/app/shared/components/api-script/constant.ts - 581 - - - src/app/shared/components/api-script/constant.ts - 613 - - - - offset vector - - src/app/shared/components/api-script/constant.ts - 521 - - - src/app/shared/components/api-script/constant.ts - 553 - - - src/app/shared/components/api-script/constant.ts - 585 - - - src/app/shared/components/api-script/constant.ts - 617 - - - - AES Dencryption - - src/app/shared/components/api-script/constant.ts - 528 - - - src/app/shared/components/api-script/constant.ts - 533 - - - - DES Encryption - - src/app/shared/components/api-script/constant.ts - 560 - - - src/app/shared/components/api-script/constant.ts - 565 - - - - DES Dencryption - - src/app/shared/components/api-script/constant.ts - 592 - - - src/app/shared/components/api-script/constant.ts - 597 - - - - HTTP API request - - src/app/shared/components/api-script/constant.ts - 629 - - - src/app/shared/components/api-script/constant.ts - 719 - - - - Set Request URL - - src/app/shared/components/api-script/constant.ts - 632 - - - - Set HTTP API request path - - src/app/shared/components/api-script/constant.ts - 637 - - - - new url - - src/app/shared/components/api-script/constant.ts - 638 - - - - Set Header - - src/app/shared/components/api-script/constant.ts - 642 - - - - Set HTTP API request header params - - src/app/shared/components/api-script/constant.ts - 647 - - - - params name - - src/app/shared/components/api-script/constant.ts - 649 - - - src/app/shared/components/api-script/constant.ts - 674 - - - src/app/shared/components/api-script/constant.ts - 687 - - - - params value - - src/app/shared/components/api-script/constant.ts - 650 - - - src/app/shared/components/api-script/constant.ts - 675 - - - src/app/shared/components/api-script/constant.ts - 688 - - - - Request body[Form-data] - - src/app/shared/components/api-script/constant.ts - 656 - - - - Request body[Raw] - - src/app/shared/components/api-script/constant.ts - 662 - - - - Set REST params - - src/app/shared/components/api-script/constant.ts - 667 - - - - Set HTTP API REST params - - src/app/shared/components/api-script/constant.ts - 672 - - - - Set Query params - - src/app/shared/components/api-script/constant.ts - 680 - - - - Set HTTP API Query params - - src/app/shared/components/api-script/constant.ts - 685 - - - - Insert new API test[Form-data] - - src/app/shared/components/api-script/constant.ts - 693 - - - - Insert new API test[JSON] - - src/app/shared/components/api-script/constant.ts - 698 - - - - Insert new API test[XML] - - src/app/shared/components/api-script/constant.ts - 703 - - - - Insert new API test[Raw] - - src/app/shared/components/api-script/constant.ts - 708 - - - - Get Response Results - - src/app/shared/components/api-script/constant.ts - 722 - - - - Get the response result of the HTTP API - - src/app/shared/components/api-script/constant.ts - 727 - - - - Set Response Result - - src/app/shared/components/api-script/constant.ts - 731 - - - - Set the response result of the HTTP API - - src/app/shared/components/api-script/constant.ts - 736 - - - - response result - - src/app/shared/components/api-script/constant.ts - 737 - - - - Global variable - - src/app/shared/components/env-list/env-list.component.ts - 12 - - - - No Global variables - - src/app/shared/components/env-list/env-list.component.ts - 17 - - - - Environment Host - - src/app/shared/components/env-list/env-list.component.ts - 20 - - - - Environment Global variable - - src/app/shared/components/env-list/env-list.component.ts - 25 - - - - New - - src/app/shared/components/env/env.component.html - 10 - - - - Are you sure you want to delete? - - src/app/shared/components/env/env.component.html - 21 - - - - Global variable: API Documentation/Test can use to refer to the global variable - - src/app/shared/components/env/env.component.html - 46,48 - - - - {{Variable Name}} - - src/app/shared/components/env/env.component.ts - 23 - - - - New Environment - - src/app/shared/components/env/env.component.ts - 24 - - - src/app/shared/components/env/env.component.ts - 132 - - - - Operate - - src/app/shared/components/env/env.component.ts - 35 - - - - Edit Environment - - src/app/shared/components/env/env.component.ts - 107 - - - - Name is not allowed to be empty - - src/app/shared/components/env/env.component.ts - 141 - - - - Failed to edit - - src/app/shared/components/env/env.component.ts - 158 - - - - Failed to add - - src/app/shared/components/env/env.component.ts - 170 - - - - This feature requires plugin support, please move to Extensions download or open exist extensions. - - src/app/shared/components/extension-select/extension-select.component.html - 25,27 - - - - Only supports importing a single file - - src/app/shared/components/extension-select/extension-select.component.html - 41 - - - - Only files in JSON format are supported - - src/app/shared/components/extension-select/extension-select.component.ts - 44 - - - - Please import the file first - - src/app/shared/components/import-api/import-api.component.ts - 84 - - - - Same as the parent's field - - src/app/shared/components/import-api/import-api.component.ts - 108 - - - - The current data is stored locally,If you want to collaborate,Please - - src/app/shared/components/local-workspace-tip/local-workspace-tip.component.ts - 13 - - - - switch to the cloud workspace - - src/app/shared/components/local-workspace-tip/local-workspace-tip.component.ts - 14,16 - - - - You don't have cloud space yet, please create one - - src/app/shared/components/local-workspace-tip/local-workspace-tip.component.ts - 51 - - - - Search - - src/app/shared/components/manage-access/manage-access.component.html - 4 - - - - Remove - - src/app/shared/components/manage-access/manage-access.component.html - 27 - - - - Format - - src/app/shared/components/monaco-editor/monaco-editor.component.ts - 23 - - - - Replace - - src/app/shared/components/monaco-editor/monaco-editor.component.ts - 35 - - - - Import - - src/app/shared/components/params-import/params-import.component.html - 3 - - - - Import like this: - - src/app/shared/components/params-import/params-import.component.html - 24 - - - - Insert at the end - - src/app/shared/components/params-import/params-import.component.html - 33 - - - - Replace All - - src/app/shared/components/params-import/params-import.component.html - 34 - - - - Replace Changed - - src/app/shared/components/params-import/params-import.component.html - 35 - - - - JSON format invalid - - src/app/shared/components/params-import/params-import.component.ts - 81 - - - - Form format invalid - - src/app/shared/components/params-import/params-import.component.ts - 94 - - - - XML format invalid - - src/app/shared/components/params-import/params-import.component.ts - 104 - - - - About - - src/app/shared/components/setting/common/about.component.ts - 6 - - - - Cloud Storage - - src/app/shared/components/setting/common/data-storage.component.ts - 10 - - - src/app/shared/components/setting/setting.component.ts - 91 - - - - Cloud Storage: Store data on the cloud for team collaboration and product use across devices. - - src/app/shared/components/setting/common/data-storage.component.ts - 15,16 - - - - Learn more.. - - src/app/shared/components/setting/common/data-storage.component.ts - 18 - - - - Host - - src/app/shared/components/setting/common/data-storage.component.ts - 24 - - - - Please input your Host - - src/app/shared/components/setting/common/data-storage.component.ts - 25 - - - - your host - - src/app/shared/components/setting/common/data-storage.component.ts - 26 - - - - Connect - - src/app/shared/components/setting/common/data-storage.component.ts - 32 - - - - Successfully connect to cloud - - src/app/shared/components/setting/common/data-storage.component.ts - 93 - - - - Failed to connect - - src/app/shared/components/setting/common/data-storage.component.ts - 99 - - - - Extensions - - src/app/shared/components/setting/common/extensions.component.ts - 10 - - - - Please Enter - - src/app/shared/components/setting/common/extensions.component.ts - 29 - - - - - - src/app/shared/components/setting/common/extensions.component.ts - 40,42 - - - - No plugins are currently installed, go to install - - src/app/shared/components/setting/common/extensions.component.ts - 78 - - - - Language - - src/app/shared/components/setting/common/language-swtcher.component.ts - 7 - - - src/app/shared/components/setting/common/language-swtcher.component.ts - 10 - - - src/app/shared/components/setting/setting.component.ts - 96 - - - - Account - - src/app/shared/components/setting/setting.component.ts - 73 - - - src/app/shared/components/setting/setting.component.ts - 78 - - - - Password - - src/app/shared/components/setting/setting.component.ts - 82 - - - - About - - src/app/shared/components/setting/setting.component.ts - 100 - - - - Member - - src/app/shared/components/sidebar/sidebar.component.ts - 93 - - - - Workspace - - src/app/shared/components/sidebar/sidebar.component.ts - 103 - - - - Extensions - - src/app/shared/components/sidebar/sidebar.component.ts - 111 - - - - Hide/Show Sidebar - - src/app/shared/components/toolbar/toolbar.component.html - 10 - - - - The test service connection failed, please submit an Issue to contact the community - - src/app/shared/services/api-test/api-test.utils.ts - 219 - - - - Need to deploy cloud services - - src/app/shared/services/data-source/data-source.service.ts - 89 - - - - Store data on the cloud for team collaboration and product use across devices. - - src/app/shared/services/data-source/data-source.service.ts - 90 - - - - Learn more.. - - src/app/shared/services/data-source/data-source.service.ts - 91 - - - - Confirm - - src/app/shared/services/modal.service.ts - 39 - - - - Get City Weather Today - - src/app/shared/services/storage/IndexedDB/lib/index.constant.ts - 6 - - - - City Code : http://www.mca.gov.cn/article/sj/xzqh/2020/20201201.html - - src/app/shared/services/storage/IndexedDB/lib/index.constant.ts - 21 - - - - minimum temperature - - src/app/shared/services/storage/IndexedDB/lib/index.constant.ts - 46 - - - - maximun temperature - - src/app/shared/services/storage/IndexedDB/lib/index.constant.ts - 53 - - - - COVID-19 national epidemic - - src/app/shared/services/storage/IndexedDB/lib/index.constant.ts - 68 - - - - The actual parameter is string, in order to show the document expansion display - - src/app/shared/services/storage/IndexedDB/lib/index.constant.ts - 97 - - - - Default Mock - - src/app/shared/services/storage/IndexedDB/lib/index.ts - 88 - - - - Local workspace - - src/app/shared/services/workspace/workspace.service.ts - 18 - - - - - diff --git a/src/workbench/browser/src/locale/messages.zh.xlf b/src/workbench/browser/src/locale/messages.zh.xlf deleted file mode 100644 index b28fb03ca..000000000 --- a/src/workbench/browser/src/locale/messages.zh.xlf +++ /dev/null @@ -1,4235 +0,0 @@ - - - - - - No mock found with ID - - src/app/app.service.ts - 48 - - 没有找到 ID 为的 Mockï¼ - - - Version - - src/app/core/services/electron/electron.service.ts - 53 - - 版本 - - - Classic - - src/app/core/services/theme/theme.model.ts - 3 - - ç»å…¸ - - - Forest - - src/app/core/services/theme/theme.model.ts - 6 - - 森林 - - - Don't have Eoapi Client? - - src/app/core/services/web/download-client.component.ts - 7 - - 还没有安装 Eoapi 客户端? - - - Download - - src/app/core/services/web/download-client.component.ts - 8 - - 下载 - - - Windows Client - - src/app/core/services/web/web.service.ts - 18 - - Windows 客户端 - - - MacOS(Intel) Client - - src/app/core/services/web/web.service.ts - 26 - - MacOS(Intel) 客户端 - - - MacOS(M1) Client - - src/app/core/services/web/web.service.ts - 33 - - MacOS(M1) 客户端 - - - Account - - src/app/pages/account.component.ts - 11 - - è´¦å· - - - Username - - src/app/pages/account.component.ts - 14 - - 用户å - - - Save - - src/app/pages/account.component.ts - 33,35 - - - src/app/pages/workspace.component.ts - 38,40 - - ä¿å­˜ - - - Password - - src/app/pages/account.component.ts - 41 - - å¯†ç  - - - Current password - - src/app/pages/account.component.ts - 46 - - 当å‰å¯†ç  - - - New password - - src/app/pages/account.component.ts - 53 - - æ–°å¯†ç  - - - Confirm new password - - src/app/pages/account.component.ts - 60 - - ç¡®è®¤æ–°å¯†ç  - - - Please input your confirm new password; - - src/app/pages/account.component.ts - 64,66 - - è¯·è¾“å…¥æ–°å¯†ç  - - - Please confirm your password; - - src/app/pages/account.component.ts - 68 - - 请å†æ¬¡è¾“å…¥å¯†ç  - - - Min length is 6; - - src/app/pages/account.component.ts - 70 - - - src/app/pages/user-modal.component.ts - 134 - - 最å°é•¿åº¦ä¸º 6ï¼› - - - Max length is 11; - - src/app/pages/account.component.ts - 72 - - 最大长度为 11ï¼› - - - Reset - - src/app/pages/account.component.ts - 86,88 - - é‡ç½® - - - Sorry, username is already in use - - src/app/pages/account.component.ts - 141 - - 用户å已存在 - - - Username update success ! - - src/app/pages/account.component.ts - 163 - - 用户å编辑æˆåŠŸï¼ - - - Validation failed - - src/app/pages/account.component.ts - 186 - - 验è¯å¤±è´¥ - - - Password reset success ! - - src/app/pages/account.component.ts - 197 - - 密ç é‡ç½®æˆåŠŸï¼ - - - New Request - - src/app/pages/api/api-tab.service.ts - 25 - - - src/app/pages/api/api-tab.service.ts - 43 - - 新请求 - - - Preview - - src/app/pages/api/api-tab.service.ts - 28 - - - src/app/pages/api/api-tab.service.ts - 47 - - 文档 - - - New Websocket - - src/app/pages/api/api-tab.service.ts - 35 - - - src/app/pages/api/api-tab.service.ts - 54 - - 测试 Websocket - - - New API - - src/app/pages/api/api-tab.service.ts - 46 - - 新请求 - - - Collections - - src/app/pages/api/api.component.html - 23 - - API é›†åˆ - - - History - - src/app/pages/api/api.component.html - 39 - - - src/app/pages/api/history/eo-history.component.html - 3 - - åŽ†å² - - - Environment - - src/app/pages/api/api.component.html - 76 - - - src/app/shared/components/env/env.component.html - 3 - - Environment Dropdown placeholder - 环境 - - - Manage Environment - - src/app/pages/api/api.component.html - 90 - - 管ç†çŽ¯å¢ƒ - - - Enviroment Quick Look - - src/app/pages/api/api.component.html - 99 - - ç‚¹å‡»æŸ¥çœ‹çŽ¯å¢ƒä¿¡æ¯ - - - Environment Setting - - src/app/pages/api/api.component.html - 153 - - 环境设置 - - - Preview - - src/app/pages/api/api.component.ts - 54 - - 文档 - - - Edit - - src/app/pages/api/api.component.ts - 58 - - - src/app/pages/api/http/mock/api-mock.component.ts - 46,47 - - 编辑 - - - Test - - src/app/pages/api/api.component.ts - 63 - - 测试 - - - Eoapi Client is required to use Mock. - - src/app/pages/api/api.component.ts - 131 - - Mock 需è¦ä¸‹è½½ Eoapi 客户端. - - - Group Name - - src/app/pages/api/group/edit/api-group-edit.component.html - 3 - - 分组å称 - - - Please enter group name - - src/app/pages/api/group/edit/api-group-edit.component.html - 4 - - 请输入分组å称 - - - Data from will be deleted. This cannot be undone. Are you sure you want to delete? - - - src/app/pages/api/group/edit/api-group-edit.component.html - 9,13 - - 删除 åŽï¼Œè¯¥åˆ†ç»„下的数æ®éƒ½ä¼šè¢«åˆ é™¤ï¼Œè¯¥æ“作无法撤销,确认删除å—? - - - - Search - - src/app/pages/api/group/tree/api-group-tree.component.html - 7 - - - src/app/pages/extension/extension.component.html - 8 - - - src/app/shared/components/monaco-editor/monaco-editor.component.ts - 31 - - æœç´¢ - - - New API - - src/app/pages/api/group/tree/api-group-tree.component.html - 25 - - 新建 API - - - New Group - - src/app/pages/api/group/tree/api-group-tree.component.html - 27 - - 新建分组 - - - Import API - - src/app/pages/api/group/tree/api-group-tree.component.html - 29 - - 导入 API æ•°æ® - - - Add API - - src/app/pages/api/group/tree/api-group-tree.component.html - 67 - - 添加 API - - - Add Subgroup - - src/app/pages/api/group/tree/api-group-tree.component.html - 70 - - 添加å­åˆ†ç»„ - - - Edit - - src/app/pages/api/group/tree/api-group-tree.component.html - 73 - - - src/app/pages/api/group/tree/api-group-tree.component.html - 103 - - - src/app/pages/api/http/mock/api-mock.component.html - 35 - - 编辑 - - - Delete - - src/app/pages/api/group/tree/api-group-tree.component.html - 76 - - - src/app/pages/api/group/tree/api-group-tree.component.html - 115 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 108 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 226 - - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.ts - 121 - - - src/app/pages/api/http/mock/api-mock.component.html - 47 - - - src/app/pages/api/http/test/api-test-util.service.ts - 55 - - - src/app/pages/api/http/test/api-test-util.service.ts - 137 - - 删除 - - - Copy - - src/app/pages/api/group/tree/api-group-tree.component.html - 109 - - - src/app/shared/components/monaco-editor/monaco-editor.component.ts - 27 - - å¤åˆ¶ - - - Index - - src/app/pages/api/group/tree/api-group-tree.component.ts - 61 - - 概况 - - - Import API - - src/app/pages/api/group/tree/api-group-tree.component.ts - 263 - - - src/app/pages/api/overview/api-overview.component.ts - 27 - - 导入 API - - - successfully - - src/app/pages/api/group/tree/api-group-tree.component.ts - 273 - - - src/app/pages/api/overview/api-overview.component.ts - 58 - - æˆåŠŸ - - - Failed to - - src/app/pages/api/group/tree/api-group-tree.component.ts - 277 - - - src/app/pages/api/overview/api-overview.component.ts - 61 - - 失败 - - - Deletion Confirmation? - - src/app/pages/api/group/tree/api-group-tree.component.ts - 287 - - - src/app/pages/workspace.component.ts - 141 - - 确认删除? - - - Are you sure you want to delete the data <strong title=""></strong> ? You cannot restore it once deleted! - - src/app/pages/api/group/tree/api-group-tree.component.ts - 288,290 - - 确认è¦åˆ é™¤æ•°æ® <strong title=""></strong> å—?删除åŽä¸å¯æ¢å¤ï¼ - - - Add Group - - src/app/pages/api/group/tree/api-group-tree.component.ts - 346 - - 添加分组 - - - Add Subgroup - - src/app/pages/api/group/tree/api-group-tree.component.ts - 355 - - 添加å­åˆ†ç»„ - - - Edit Group - - src/app/pages/api/group/tree/api-group-tree.component.ts - 364 - - 编辑分组 - - - Delete Group - - src/app/pages/api/group/tree/api-group-tree.component.ts - 373 - - 删除分组 - - - Are you sure delete all history? - - src/app/pages/api/history/eo-history.component.html - 13 - - 是å¦ç¡®å®šè¦åˆ é™¤æ‰€æœ‰åŽ†å²ï¼Ÿ - - - Param - - src/app/pages/api/http/detail/api-detail-util.service.ts - 59 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 32 - - - src/app/pages/api/http/test/api-test-util.service.ts - 14 - - - src/app/pages/api/http/test/body/api-test-body.component.ts - 218 - - å‚æ•° - - - Name - - src/app/pages/api/http/detail/api-detail-util.service.ts - 77 - - - src/app/pages/api/http/detail/api-detail-util.service.ts - 80 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 55 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 58 - - - src/app/pages/api/http/test/api-test-util.service.ts - 15 - - å - - - Required - - src/app/pages/api/http/detail/api-detail-util.service.ts - 85 - - - src/app/pages/api/http/detail/api-detail-util.service.ts - 154 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 63 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 175 - - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.ts - 26 - - å¿…å¡« - - - {{item.required?"True":""}} - - src/app/pages/api/http/detail/api-detail-util.service.ts - 87 - - - src/app/pages/api/http/detail/api-detail-util.service.ts - 156 - - {{item.required?"是":""}} - - - Description - - src/app/pages/api/http/detail/api-detail-util.service.ts - 92 - - - src/app/pages/api/http/detail/api-detail-util.service.ts - 161 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 70 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 182 - - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.ts - 32 - - - src/app/shared/components/env/env.component.ts - 34 - - 说明 - - - Example - - src/app/pages/api/http/detail/api-detail-util.service.ts - 100 - - - src/app/pages/api/http/detail/api-detail-util.service.ts - 169 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 78 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 191 - - 示例 - - - <button type="button" class="eo-operate-btn" ng-click="$ctrl.data.isSpreedBtnClick=!$ctrl.data.isSpreedBtnClick;$ctrl.data.isSpreed=true;$ctrl.mainObject.baseFun.spreedAll($event);$ctrl.data.isSpreed=false;">{{$ctrl.data.isSpreedBtnClick?"Shrink All":"Expand All"}}</button> - - src/app/pages/api/http/detail/api-detail-util.service.ts - 107 - - - src/app/pages/api/http/detail/api-detail-util.service.ts - 176 - - <button type="button" class="eo-operate-btn" ng-click="$ctrl.data.isSpreedBtnClick=!$ctrl.data.isSpreedBtnClick;$ctrl.data.isSpreed=true;$ctrl.mainObject.baseFun.spreedAll($event);$ctrl.data.isSpreed=false;">{{$ctrl.data.isSpreedBtnClick?"全部收缩":"全部展开"}}</button> - - - <span class="eo-operate-btn fs12" ng-show="item.minimum || - item.maximum || - item.minLength || - item.maxLength || - (item.enum && item.enum.length > 0 && item.enum[0].value)">{{item.isClick?"Shrink":"Expand"}}</span> - - src/app/pages/api/http/detail/api-detail-util.service.ts - 109,113 - - - src/app/pages/api/http/detail/api-detail-util.service.ts - 178,182 - - <span class="eo-operate-btn fs12" ng-show="item.minimum || - item.maximum || - item.minLength || - item.maxLength || - (item.enum && item.enum.length > 0 && item.enum[0].value)">{{item.isClick?"收缩":"展开"}}</span> - - - Param Name - - src/app/pages/api/http/detail/api-detail-util.service.ts - 140 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 155 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 158 - - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.ts - 21 - - - src/app/pages/api/http/test/api-test-util.service.ts - 97 - - - src/app/pages/api/http/test/api-test-util.service.ts - 100 - - - src/app/shared/components/api-script/constant.ts - 113 - - å‚æ•°å - - - Type - - src/app/pages/api/http/detail/api-detail-util.service.ts - 147 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 163 - - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.ts - 37 - - - src/app/pages/api/http/test/api-test-util.service.ts - 105 - - 类型 - - - Request Headers - - src/app/pages/api/http/detail/api-detail.component.html - 10 - - - src/app/pages/api/http/edit/api-edit.component.html - 56 - - - src/app/pages/api/http/test/api-test.component.html - 191 - - 请求头部 - - - Query - - src/app/pages/api/http/detail/api-detail.component.html - 16 - - - src/app/pages/api/http/edit/api-edit.component.html - 93 - - - src/app/pages/api/http/test/api-test.component.html - 110 - - - src/app/pages/api/http/test/query/api-test-query.component.html - 3 - - Query å‚æ•° - - - REST - - src/app/pages/api/http/detail/api-detail.component.html - 22 - - - src/app/pages/api/http/edit/api-edit.component.html - 106 - - - src/app/pages/api/http/test/api-test.component.html - 123 - - REST å‚æ•° - - - Body - - src/app/pages/api/http/detail/api-detail.component.html - 28 - - - src/app/pages/api/http/edit/api-edit.component.html - 70 - - - src/app/pages/api/http/test/api-test.component.html - 85 - - - src/app/pages/api/http/test/api-test.component.html - 183 - - 请求体 - - - The outermost structure is: - - src/app/pages/api/http/detail/api-detail.component.html - 31,32 - - JSON 根类型: - - - Response Headers - - src/app/pages/api/http/detail/api-detail.component.html - 40 - - - src/app/pages/api/http/edit/api-edit.component.html - 126 - - - src/app/pages/api/http/test/api-test.component.html - 179 - - 返回头部 - - - Response - - src/app/pages/api/http/detail/api-detail.component.html - 46 - - - src/app/pages/api/http/edit/api-edit.component.html - 122 - - - src/app/pages/api/http/edit/api-edit.component.html - 140 - - - src/app/pages/api/http/mock/api-mock.component.html - 66 - - - src/app/pages/api/http/test/api-test.component.html - 174 - - 返回结果 - - - The outermost structure is: - - src/app/pages/api/http/detail/api-detail.component.html - 49,50 - - JSON 根类型: - - - MOCK - - src/app/pages/api/http/detail/api-detail.component.html - 58 - - MOCK - - - Name - - src/app/pages/api/http/detail/api-detail.component.ts - 30 - - - src/app/pages/api/http/mock/api-mock.component.ts - 24 - - - src/app/shared/components/env/env.component.ts - 32 - - å称 - - - Created Type - - src/app/pages/api/http/detail/api-detail.component.ts - 31 - - - src/app/pages/api/http/mock/api-mock.component.ts - 25 - - åˆ›å»ºæ–¹å¼ - - - Header - - src/app/pages/api/http/detail/header/api-detail-header.component.ts - 33 - - - src/app/pages/api/http/edit/header/api-edit-header.component.html - 6 - - - src/app/pages/api/http/edit/header/api-edit-header.component.ts - 48 - - - src/app/pages/api/http/test/header/api-test-header.component.html - 8 - - - src/app/pages/api/http/test/header/api-test-header.component.ts - 51 - - 头部 - - - Key - - src/app/pages/api/http/detail/header/api-detail-header.component.ts - 34 - - - src/app/pages/api/http/edit/header/api-edit-header.component.ts - 49 - - - src/app/pages/api/http/test/header/api-test-header.component.ts - 52 - - 标签 - - - Detail - - src/app/pages/api/http/edit/api-edit-util.service.ts - 14 - - 详情 - - - Description - - src/app/pages/api/http/edit/api-edit-util.service.ts - 73 - - 说明 - - - Example - - src/app/pages/api/http/edit/api-edit-util.service.ts - 81 - - 示例 - - - More Settings - - src/app/pages/api/http/edit/api-edit-util.service.ts - 90 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 208 - - 更多设置 - - - Insert - - src/app/pages/api/http/edit/api-edit-util.service.ts - 103 - - - src/app/pages/api/http/edit/api-edit-util.service.ts - 221 - - æ’å…¥ - - - Param Description - - src/app/pages/api/http/edit/api-edit-util.service.ts - 185 - - å‚数说明 - - - Param Example - - src/app/pages/api/http/edit/api-edit-util.service.ts - 194 - - å‚数示例 - - - Add Child - - src/app/pages/api/http/edit/api-edit-util.service.ts - 203 - - - src/app/pages/api/http/test/api-test-util.service.ts - 132 - - 添加å­å­—段 - - - Save - - src/app/pages/api/http/edit/api-edit.component.html - 4 - - - src/app/pages/api/http/mock/api-mock.component.html - 83 - - - src/app/shared/components/env/env.component.html - 64 - - ä¿å­˜ - - - API Path - - src/app/pages/api/http/edit/api-edit.component.html - 7 - - API 路径 - - - Please enter API Path - - src/app/pages/api/http/edit/api-edit.component.html - 16 - - 请输入 API Path - - - Group / API Name - - src/app/pages/api/http/edit/api-edit.component.html - 21 - - 分组 / API å称 - - - Please select an API group - - src/app/pages/api/http/edit/api-edit.component.html - 24 - - 请选择 API 分组 - - - Please enter API name - - src/app/pages/api/http/edit/api-edit.component.html - 41 - - 请输入 API å称 - - - Request - - src/app/pages/api/http/edit/api-edit.component.html - 51 - - 请求å‚æ•° - - - Edited successfully - - src/app/pages/api/http/edit/api-edit.component.ts - 130 - - - src/app/pages/api/http/mock/api-mock.component.ts - 244 - - - src/app/shared/components/env/env.component.ts - 151 - - 编辑æˆåŠŸ - - - Added successfully - - src/app/pages/api/http/edit/api-edit.component.ts - 130 - - - src/app/pages/api/http/mock/api-mock.component.ts - 249 - - - src/app/shared/components/env/env.component.ts - 165 - - 添加æˆåŠŸ - - - Failed Operation - - src/app/pages/api/http/edit/api-edit.component.ts - 146 - - æ“作失败 - - - Root directory - - src/app/pages/api/http/edit/api-edit.component.ts - 190 - - 根目录 - - - JSON Root Type: - - src/app/pages/api/http/edit/body/api-edit-body.component.html - 15 - - JSON 根类型: - - - Binary Description - - src/app/pages/api/http/edit/body/api-edit-body.component.html - 33 - - Binary 说明 - - - Example - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.html - 30 - - 示例 - - - Param Example - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.html - 33 - - å‚数示例 - - - Minimum length - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.ts - 49 - - 最å°é•¿åº¦ - - - Maximum Length - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.ts - 57 - - 最大长度 - - - Minimum - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.ts - 71 - - 最å°å€¼ - - - Maximum - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.ts - 79 - - 最大值 - - - Default - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.ts - 97 - - 默认 - - - Value enum - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.ts - 104 - - 值å¯èƒ½æ€§ - - - enum - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.ts - 107 - - 枚举值 - - - Description - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.ts - 111 - - - src/app/pages/api/http/edit/extra-setting/api-params-extra-setting.component.ts - 114 - - 说明 - - - New Mock - - src/app/pages/api/http/mock/api-mock.component.html - 3 - - 新建 Mock - - - Click to Copy - - src/app/pages/api/http/mock/api-mock.component.html - 14 - - 点击å¤åˆ¶ - - - Preview - - src/app/pages/api/http/mock/api-mock.component.html - 34 - - - src/app/pages/api/http/mock/api-mock.component.ts - 45 - - 预览 - - - Are you sure you want to delete this Mock? - - src/app/pages/api/http/mock/api-mock.component.html - 43 - - 您确定è¦åˆ é™¤æ­¤Mockå—? - - - Mock Name - - src/app/pages/api/http/mock/api-mock.component.html - 60 - - Mock å称 - - - Cancel - - src/app/pages/api/http/mock/api-mock.component.html - 84 - - - src/app/shared/components/env/env.component.html - 63 - - - src/app/shared/components/params-import/params-import.component.html - 32 - - å–消 - - - Add - - src/app/pages/api/http/mock/api-mock.component.ts - 43 - - 添加 - - - System creation - - src/app/pages/api/http/mock/api-mock.component.ts - 54 - - 系统自动创建 - - - Manual creation - - src/app/pages/api/http/mock/api-mock.component.ts - 55 - - 手动创建 - - - Delete Succeeded - - src/app/pages/api/http/mock/api-mock.component.ts - 233 - - 删除æˆåŠŸ - - - Copied - - src/app/pages/api/http/mock/api-mock.component.ts - 270 - - - src/app/shared/components/monaco-editor/monaco-editor.component.ts - 309 - - - src/app/utils/index.utils.ts - 166 - - å¤åˆ¶æˆåŠŸ - - - Value - - src/app/pages/api/http/test/api-test-util.service.ts - 16 - - 值 - - - Value - - src/app/pages/api/http/test/api-test-util.service.ts - 118 - - - src/app/pages/api/http/test/api-test-util.service.ts - 123 - - - src/app/pages/api/http/test/header/api-test-header.component.ts - 53 - - - src/app/shared/components/env/env.component.ts - 33 - - å‚数值 - - - Please enter URL - - src/app/pages/api/http/test/api-test.component.html - 27 - - - src/app/pages/api/websocket/websocket.component.html - 15 - - 请输入 URL - - - Enter URL - - src/app/pages/api/http/test/api-test.component.html - 32 - - - src/app/pages/api/websocket/websocket.component.html - 19 - - è¯·è¾“å…¥æµ‹è¯•åœ°å€ - - - Send - - src/app/pages/api/http/test/api-test.component.html - 42 - - å‘é€ - - - Abort - - src/app/pages/api/http/test/api-test.component.html - 43 - - 中止 - - - Save as API - - src/app/pages/api/http/test/api-test.component.html - 57,59 - - ä¿å­˜ä¸ºæ–° API - - - Headers - - src/app/pages/api/http/test/api-test.component.html - 71 - - - src/app/pages/api/websocket/websocket.component.html - 72 - - 请求头部 - - - Pre-request Script - - src/app/pages/api/http/test/api-test.component.html - 136 - - å‰ç½®è„šæœ¬ - - - After-response Script - - src/app/pages/api/http/test/api-test.component.html - 150 - - åŽç½®è„šæœ¬ - - - Save As File - - src/app/pages/api/http/test/api-test.component.html - 204 - - ä¿å­˜ä¸ºæ–‡ä»¶ - - - Tap or drag files directly to this area - - src/app/pages/api/http/test/body/api-test-body.component.html - 30 - - - src/app/shared/components/extension-select/extension-select.component.html - 40 - - 点击或直接拖拽文件至此区域 - - - The file is too large and needs to be less than 5 MB - - src/app/pages/api/http/test/body/api-test-body.component.ts - 145 - - 上传文件太大,需å°äºŽ 5 MB - - - File size must be less than 2M - - src/app/pages/api/http/test/body/api-test-body.component.ts - 232 - - 文件大å°å‡éœ€å°äºŽ 2M - - - No Headers - - src/app/pages/api/http/test/result-header/api-test-result-header.component.html - 3 - - 暂无头部 - - - No Request Body - - src/app/pages/api/http/test/result-request-body/api-test-result-request-body.component.html - 3 - - 暂无请求体 - - - Click the Send button to get a test report - - src/app/pages/api/http/test/result-response/api-test-result-response.component.html - 4 - - 点击å‘é€æŒ‰é’®èŽ·å–测试报告 - - - Unable to preview non-text type data, you can - - src/app/pages/api/http/test/result-response/api-test-result-response.component.html - 30 - - 无法预览éžæ–‡æœ¬ç±»åž‹æ•°æ®ï¼Œæ‚¨å¯ä»¥ - - - download response - - src/app/pages/api/http/test/result-response/api-test-result-response.component.html - 32,34 - - - src/app/pages/api/http/test/result-response/api-test-result-response.component.html - 44,46 - - 下载返回值 - - - and open it with other programs. - - src/app/pages/api/http/test/result-response/api-test-result-response.component.html - 35 - - 并用其他程åºæ‰“开。 - - - The response result exceeds the previewable size, you can - - src/app/pages/api/http/test/result-response/api-test-result-response.component.html - 42 - - å“应结果超过了预览大å°ï¼Œæ‚¨å¯ä»¥ - - - Import - - src/app/pages/api/overview/api-overview.component.ts - 25 - - 导入 - - - Export - - src/app/pages/api/overview/api-overview.component.ts - 31 - - 导出 - - - Export API - - src/app/pages/api/overview/api-overview.component.ts - 33 - - 导出 API - - - Push - - src/app/pages/api/overview/api-overview.component.ts - 37 - - æŽ¨é€ - - - Push/Sync API to other platforms - - src/app/pages/api/overview/api-overview.component.ts - 39 - - å°† API 推é€/åŒæ­¥åˆ°å…¶ä»–å¹³å° - - - Program will not close unsaved tabs - - src/app/pages/api/tab/api-tab-operate.service.ts - 336 - - 程åºå°†ä¸ä¼šå…³é—­æœªä¿å­˜çš„标签 - - - Close Other Tags (excluding current tabs) - - src/app/pages/api/tab/api-tab.component.html - 68,70 - - 关闭其它标签(ä¸åŒ…括当å‰æ ‡ç­¾) - - - Close All Tabs - - src/app/pages/api/tab/api-tab.component.html - 71 - - 关闭所有标签 - - - Close Tabs To the Left - - src/app/pages/api/tab/api-tab.component.html - 72,74 - - 关闭左侧标签页 - - - Close Tabs to the Right - - src/app/pages/api/tab/api-tab.component.html - 80,82 - - 关闭å³è¾¹çš„标签 - - - Do you want to save the changes? - - src/app/pages/api/tab/api-tab.component.ts - 71 - - 您è¦ä¿å­˜è¿™äº›æ›´æ”¹å—? - - - Your changes will be lost if you don't save them. - - src/app/pages/api/tab/api-tab.component.ts - 72 - - 如未ä¿å­˜ï¼Œæ‰€æœ‰æ›´æ”¹å°†ä¼šè¢«ä¸¢å¼ƒã€‚ - - - Cancel - - src/app/pages/api/tab/api-tab.component.ts - 76 - - - src/app/pages/api/websocket/websocket.component.ts - 305 - - - src/app/shared/services/modal.service.ts - 33 - - å–消 - - - Don't Save - - src/app/pages/api/tab/api-tab.component.ts - 82 - - 放弃ä¿å­˜ - - - Save - - src/app/pages/api/tab/api-tab.component.ts - 90 - - ä¿å­˜ - - - Connect - - src/app/pages/api/websocket/websocket.component.html - 37,39 - - 连接 - - - Connecting - - src/app/pages/api/websocket/websocket.component.html - 40,42 - - 连接中 - - - Disconnect - - src/app/pages/api/websocket/websocket.component.html - 51,53 - - 断开连接 - - - Query Params - - src/app/pages/api/websocket/websocket.component.html - 89 - - Query å‚æ•° - - - Message - - src/app/pages/api/websocket/websocket.component.html - 103 - - 报文 - - - Send - - src/app/pages/api/websocket/websocket.component.html - 126,128 - - å‘é€ - - - Messages - - src/app/pages/api/websocket/websocket.component.html - 139 - - 报文 - - - Do you want to leave the page? - - src/app/pages/api/websocket/websocket.component.ts - 290 - - 你想è¦ç¦»å¼€å½“å‰é¡µé¢å—? - - - After leaving, the current long connection is no longer maintained, whether to confirm to leave? - - src/app/pages/api/websocket/websocket.component.ts - 291 - - 当å‰çš„长连接将会断开,是å¦ç¡®è®¤ç¦»å¼€ï¼Ÿ - - - Leave - - src/app/pages/api/websocket/websocket.component.ts - 295 - - 离开 - - - Please Enter - - src/app/pages/extension/detail/components/extensions.component.ts - 33 - - 请输入 - - - - - - - src/app/pages/extension/detail/components/extensions.component.ts - 44,46 - - - - - Back - - src/app/pages/extension/detail/extension-detail.component.html - 6 - - 返回 - - - Uninstall - - src/app/pages/extension/detail/extension-detail.component.html - 36 - - å¸è½½ - - - Install - - src/app/pages/extension/detail/extension-detail.component.html - 37 - - 安装 - - - Settings - - src/app/pages/extension/detail/extension-detail.component.html - 52 - - 设置 - - - Details - - src/app/pages/extension/detail/extension-detail.component.html - 57 - - - src/app/pages/extension/list/extension-list.component.html - 23 - - ä»‹ç» - - - Support - - src/app/pages/extension/detail/extension-detail.component.html - 65 - - æ”¯æŒ - - - Author - - src/app/pages/extension/detail/extension-detail.component.html - 67 - - 作者 - - - Version - - src/app/pages/extension/detail/extension-detail.component.html - 68 - - 版本 - - - Repository - - src/app/pages/extension/detail/extension-detail.component.html - 69 - - 代ç ä»“库 - - - Homepage - - src/app/pages/extension/detail/extension-detail.component.html - 74 - - 首页 - - - BugReport - - src/app/pages/extension/detail/extension-detail.component.html - 77 - - 报告问题 - - - ChangeLog - - src/app/pages/extension/detail/extension-detail.component.html - 82 - - 更新日志 - - - Changelog failed to load - - src/app/pages/extension/detail/extension-detail.component.html - 85 - - 更新日志加载失败 - - - Reacquire - - src/app/pages/extension/detail/extension-detail.component.html - 87 - - é‡æ–°èŽ·å– - - - This plugin has no documentation yet. - - src/app/pages/extension/detail/extension-detail.component.ts - 68 - - æ­¤æ’件尚无文档。 - - - Official - - src/app/pages/extension/extension.component.ts - 22 - - 官方 - - - All - - src/app/pages/extension/extension.component.ts - 28 - - 所有 - - - Installed - - src/app/pages/extension/extension.component.ts - 58 - - 已安装 - - - Setting - - src/app/pages/extension/list/extension-list.component.html - 20 - - 设置 - - - Installed - - src/app/pages/extension/list/extension-list.component.html - 35 - - 已安装 - - - Extension list failed to load - - src/app/pages/extension/list/extension-list.component.ts - 70 - - æ’件列表加载失败 - - - Retry - - src/app/pages/extension/list/extension-list.component.ts - 71 - - é‡è¯• - - - Add people to the workspace - - src/app/pages/member.component.ts - 19 - - 添加空间人员 - - - Search by username - - src/app/pages/member.component.ts - 23 - - æœç´¢ç”¨æˆ·å - - - Select a member above - - src/app/pages/member.component.ts - 34,36 - - 添加被选中æˆå‘˜ - - - Manage access - - src/app/pages/member.component.ts - 41 - - åä½œç®¡ç† - - - Add people - - src/app/pages/member.component.ts - 50,52 - - 添加人员 - - - Could not find a user matching - - src/app/pages/member.component.ts - 142 - - 找ä¸åˆ°ç”¨æˆ· - - - Add new member success - - src/app/pages/member.component.ts - 163 - - æˆå‘˜æ·»åŠ æˆåŠŸ - - - Warning - - src/app/pages/member.component.ts - 222 - - 警告 - - - Are you sure you want to remove the member ? - - src/app/pages/member.component.ts - 223 - - 您确定è¦ç§»é™¤æˆå‘˜å—? - - - Delete - - src/app/pages/member.component.ts - 225 - - - src/app/pages/workspace.component.ts - 145 - - 删除 - - - Search Workspace - - src/app/pages/navbar/navbar.component.html - 33 - - æœç´¢ç©ºé—´ - - - New Workspace - - src/app/pages/navbar/navbar.component.html - 39 - - 新建空间 - - - Share - - src/app/pages/navbar/navbar.component.html - 74,76 - - 分享 - - - Share via link - - src/app/pages/navbar/navbar.component.html - 79 - - 通过链接分享 - - - This link will be updated with the API content. Everyone can access it without logging in - - src/app/pages/navbar/navbar.component.html - 80,82 - - æ¯ä¸ªäººéƒ½å¯ä»¥åœ¨æ²¡æœ‰ç™»å½•çš„情况下查看最新的 API 文档 - - - Document - - src/app/pages/navbar/navbar.component.html - 105 - - 文档 - - - Report Issue - - src/app/pages/navbar/navbar.component.html - 114 - - 问题å馈 - - - Open Settings - - src/app/pages/navbar/navbar.component.html - 126 - - 打开设置 - - - Sign in for Collaboration - - src/app/pages/navbar/navbar.component.html - 138 - - 登录åŽå¯ä»¥å作 - - - Account Setting - - src/app/pages/navbar/navbar.component.html - 145 - - è´¦å·è®¾ç½® - - - Sign Out - - src/app/pages/navbar/navbar.component.html - 148 - - 退出登录 - - - Minimize - - src/app/pages/navbar/navbar.component.html - 158 - - 最å°åŒ– - - - Close - - src/app/pages/navbar/navbar.component.html - 178 - - 关闭 - - - Download - - src/app/pages/navbar/navbar.component.html - 187,190 - - 下载 - - - Do you want to upload local data to the cloud ? - - src/app/pages/user-modal.component.ts - 23 - - 您想è¦ä¸Šä¼ æœ¬åœ°æ•°æ®åˆ°äº‘端å—? - - - After confirmation, the system will create a cloud space to upload the local data to the cloud. - - src/app/pages/user-modal.component.ts - 27,29 - - 确认åŽï¼Œè¯¥ç³»ç»Ÿå°†åˆ›å»ºä¸€ä¸ªäº‘空间并将本地数æ®ä¸Šä¼ åˆ°äº‘端。 - - - Subsequent local space and cloud space are no longer synchronized - - src/app/pages/user-modal.component.ts - 32 - - åŽç»­æœ¬åœ°ç©ºé—´å’Œäº‘空间ä¸å†åŒæ­¥ - - - Cancel - - src/app/pages/user-modal.component.ts - 45,47 - - - src/app/pages/user-modal.component.ts - 82,84 - - å–消 - - - Sync - - src/app/pages/user-modal.component.ts - 55,57 - - åŒæ­¥ - - - Check your connection - - src/app/pages/user-modal.component.ts - 65 - - 检查您的网络连接 - - - Can't connect right now, click to retry or - - src/app/pages/user-modal.component.ts - 69 - - ç›®å‰æ— æ³•è¿žæŽ¥ï¼Œç‚¹å‡»é‡è¯•æˆ–者 - - - config in the configuration - - src/app/pages/user-modal.component.ts - 70,72 - - 填写é…ç½® - - - Retry - - src/app/pages/user-modal.component.ts - 92,94 - - é‡è¿ž - - - Sign In/Up - - src/app/pages/user-modal.component.ts - 103 - - 登录/注册 - - - Enter Email/Phone/Username - - src/app/pages/user-modal.component.ts - 116 - - 请输入邮箱/电è¯/用户å - - - Enter password - - src/app/pages/user-modal.component.ts - 128 - - è¾“å…¥å¯†ç  - - - Please input your password; - - src/app/pages/user-modal.component.ts - 132 - - 请输入你的密ç . - - - Sign In/Up - - src/app/pages/user-modal.component.ts - 149,151 - - 登录/注册 - - - Open setting - - src/app/pages/user-modal.component.ts - 162 - - 打开设置 - - - If you want to collaborate, please - - src/app/pages/user-modal.component.ts - 166 - - 如果您想è¦å作,请 - - - open the settings - - src/app/pages/user-modal.component.ts - 167,169 - - 打开设置 - - - and fill in the configuration - - src/app/pages/user-modal.component.ts - 170 - - 并填写é…ç½® - - - Add Workspace - - src/app/pages/user-modal.component.ts - 178 - - 新建空间 - - - Workspace Name - - src/app/pages/user-modal.component.ts - 190 - - 空间å称 - - - Cancel - - src/app/pages/user-modal.component.ts - 205,207 - - å–消 - - - Save - - src/app/pages/user-modal.component.ts - 216,218 - - ä¿å­˜ - - - Successfully logged out ! - - src/app/pages/user-modal.component.ts - 337 - - 退出登录æˆåŠŸ - - - Connect failed - - src/app/pages/user-modal.component.ts - 359 - - 连接失败 - - - Connect success - - src/app/pages/user-modal.component.ts - 370 - - 连接æˆåŠŸ - - - Please check you username or password - - src/app/pages/user-modal.component.ts - 571 - - 请检查您的用户å和密ç ã€‚ - - - Please check the account/password, the account must be a mobile phone number or email ! - - src/app/pages/user-modal.component.ts - 579 - - 请检查账户/密ç ï¼Œè´¦æˆ·å¿…须是手机å·ç æˆ–é‚®ç®±ï¼ - - - Add workspace Failed ! - - src/app/pages/user-modal.component.ts - 682 - - 新建空间失败 ! - - - Create new workspace successfully ! - - src/app/pages/user-modal.component.ts - 692 - - 创建空间æˆåŠŸï¼ - - - Manage Workspace - - src/app/pages/workspace.component.ts - 14 - - 管ç†ç©ºé—´ - - - Edit Workspace - - src/app/pages/workspace.component.ts - 20 - - 编辑空间 - - - Name - - src/app/pages/workspace.component.ts - 24 - - - src/app/shared/components/env/env.component.html - 35 - - å称 - - - Delete Workspace - - src/app/pages/workspace.component.ts - 45 - - 删除空间 - - - After deleting a workspace, all data in the workspace will be permanently deleted. - - src/app/pages/workspace.component.ts - 48 - - 删除空间åŽï¼Œç©ºé—´ä¸­çš„所有数æ®å°†è¢«æ°¸ä¹…删除。 - - - Delete - - src/app/pages/workspace.component.ts - 58,60 - - 删除 - - - Edit workspace failed - - src/app/pages/workspace.component.ts - 105 - - 编辑空间失败 - - - Edit workspace successfully ! - - src/app/pages/workspace.component.ts - 115 - - 编辑空间æˆåŠŸ - - - Are you sure you want to delete the workspace ? -You cannot restore it once deleted! - - src/app/pages/workspace.component.ts - 142,143 - - 您确定è¦åˆ é™¤ç©ºé—´å—? 删除åŽæ— æ³•æ¢å¤ï¼ - - - Delete success ! - - src/app/pages/workspace.component.ts - 169 - - 删除æˆåŠŸï¼ - - - Snippets - - src/app/shared/components/api-script/api-script.component.html - 4 - - 函数示例 - - - Learn more - - src/app/shared/components/api-script/api-script.component.html - 7 - - 了解更多 - - - ---input--- - - src/app/shared/components/api-script/api-script.component.html - 29 - - ---输入--- - - - ---return--- - - src/app/shared/components/api-script/api-script.component.html - 36 - - ---输出--- - - - API Definite - - src/app/shared/components/api-script/constant.ts - 76 - - // API 定义 - - - [Required][string] Request url - - src/app/shared/components/api-script/constant.ts - 77 - - [Required][string] è¯·æ±‚åœ°å€ - - - [Required][string] API name,for report detail - - src/app/shared/components/api-script/constant.ts - 78 - - [å¿…å¡«][string] API å称,用于测试报告显示 API ä¿¡æ¯ - - - [Not Required][object] Request headers - - src/app/shared/components/api-script/constant.ts - 79 - - [éžå¿…å¡«][object] 请求头部 - - - [Not Required][string] Body type,formdata|json|xml|raw - - src/app/shared/components/api-script/constant.ts - 80 - - [éžå¿…å¡«][string] 请求体类型,formdata|json|xml|raw - - - [Not Required][object] Request Body - - src/app/shared/components/api-script/constant.ts - 81 - - [éžå¿…å¡«][object] 请求体 - - - [Not Required]If it exceeds the judgment, the request fails, and the default is 1000ms - - src/app/shared/components/api-script/constant.ts - 82 - - [éžå¿…å¡«] 超过时间则判断为请求失败,默认为1000ms - - - Execute request,_api_demo_1_result={time:"Test time",code:"HTTP status code",response:"API response",header:"response headers"}, - - src/app/shared/components/api-script/constant.ts - 83 - - 执行请求,_api_demo_1_result={time:"测试耗时",code:"HTTP 状æ€ç ",response:"API 返回值",header:"返回头部"}, - - - Assert response - - src/app/shared/components/api-script/constant.ts - 84 - - æ–­è¨€è¿”å›žä¿¡æ¯ - - - Print info - - src/app/shared/components/api-script/constant.ts - 85 - - è¾“å‡ºä¿¡æ¯ - - - Print error info - - src/app/shared/components/api-script/constant.ts - 86 - - è¾“å‡ºé”™è¯¯ä¿¡æ¯ - - - Param Value - - src/app/shared/components/api-script/constant.ts - 114 - - å‚数值 - - - Custom Global Variable - - src/app/shared/components/api-script/constant.ts - 119 - - 自定义全局å˜é‡ - - - Set an global variable - - src/app/shared/components/api-script/constant.ts - 122 - - - src/app/shared/components/api-script/constant.ts - 127 - - 设置全局å˜é‡ - - - Get an global variable - - src/app/shared/components/api-script/constant.ts - 132 - - - src/app/shared/components/api-script/constant.ts - 137 - - 获å–全局å˜é‡ - - - Global Varibale Value - - src/app/shared/components/api-script/constant.ts - 139 - - 全局å˜é‡å€¼ - - - Clear an global variable - - src/app/shared/components/api-script/constant.ts - 143 - - - src/app/shared/components/api-script/constant.ts - 148 - - 清除全局å˜é‡ - - - Clear all global variable - - src/app/shared/components/api-script/constant.ts - 153 - - - src/app/shared/components/api-script/constant.ts - 158 - - 清空所有全局å˜é‡ - - - Encode and Decode - - src/app/shared/components/api-script/constant.ts - 164 - - ç¼–ç å’Œè§£ç  - - - JSON Encode - - src/app/shared/components/api-script/constant.ts - 167 - - - src/app/shared/components/api-script/constant.ts - 172 - - JSON ç¼–ç  - - - JSON object - - src/app/shared/components/api-script/constant.ts - 173 - - - src/app/shared/components/api-script/constant.ts - 185 - - JSON 对象 - - - JSON string - - src/app/shared/components/api-script/constant.ts - 174 - - - src/app/shared/components/api-script/constant.ts - 184 - - JSON 字符串 - - - JSON Decode - - src/app/shared/components/api-script/constant.ts - 178 - - - src/app/shared/components/api-script/constant.ts - 183 - - JSON è§£ç  - - - XML Encode - - src/app/shared/components/api-script/constant.ts - 189 - - - src/app/shared/components/api-script/constant.ts - 194 - - XML ç¼–ç  - - - XML object - - src/app/shared/components/api-script/constant.ts - 195 - - XML 对象 - - - XML string - - src/app/shared/components/api-script/constant.ts - 196 - - - src/app/shared/components/api-script/constant.ts - 206 - - XML 字符串 - - - XML Decode - - src/app/shared/components/api-script/constant.ts - 200 - - - src/app/shared/components/api-script/constant.ts - 205 - - XML è§£ç  - - - XML code - - src/app/shared/components/api-script/constant.ts - 207 - - XML ä»£ç  - - - Base64 Encode - - src/app/shared/components/api-script/constant.ts - 211 - - - src/app/shared/components/api-script/constant.ts - 216 - - Base64 ç¼–ç  - - - string of wait for encode - - src/app/shared/components/api-script/constant.ts - 217 - - - src/app/shared/components/api-script/constant.ts - 239 - - å¾…ç¼–ç å­—符串 - - - string after encode - - src/app/shared/components/api-script/constant.ts - 218 - - - src/app/shared/components/api-script/constant.ts - 240 - - ç¼–ç åŽçš„字符串 - - - Base64 Decode - - src/app/shared/components/api-script/constant.ts - 222 - - - src/app/shared/components/api-script/constant.ts - 227 - - Base64 è§£ç  - - - string of wait for decode - - src/app/shared/components/api-script/constant.ts - 228 - - - src/app/shared/components/api-script/constant.ts - 250 - - 待解ç å­—符串 - - - string after decode - - src/app/shared/components/api-script/constant.ts - 229 - - - src/app/shared/components/api-script/constant.ts - 251 - - 解ç åŽçš„字符串 - - - UrlEncode Encode - - src/app/shared/components/api-script/constant.ts - 233 - - - src/app/shared/components/api-script/constant.ts - 238 - - UrlEncode ç¼–ç  - - - UrlEncode Decode - - src/app/shared/components/api-script/constant.ts - 244 - - - src/app/shared/components/api-script/constant.ts - 249 - - UrlEncode è§£ç  - - - Gzip zip - - src/app/shared/components/api-script/constant.ts - 255 - - - src/app/shared/components/api-script/constant.ts - 260 - - Gzip 压缩 - - - string of wait for zip - - src/app/shared/components/api-script/constant.ts - 261 - - - src/app/shared/components/api-script/constant.ts - 283 - - 待压缩字符串 - - - string after zip - - src/app/shared/components/api-script/constant.ts - 262 - - - src/app/shared/components/api-script/constant.ts - 284 - - 压缩åŽçš„字符串 - - - Gzip unzip - - src/app/shared/components/api-script/constant.ts - 266 - - - src/app/shared/components/api-script/constant.ts - 271 - - Gzip 解压 - - - string of wait for unzip - - src/app/shared/components/api-script/constant.ts - 272 - - - src/app/shared/components/api-script/constant.ts - 294 - - 待解压字符串 - - - string after unzip - - src/app/shared/components/api-script/constant.ts - 273 - - - src/app/shared/components/api-script/constant.ts - 295 - - 压缩åŽçš„字符串 - - - Deflate zip - - src/app/shared/components/api-script/constant.ts - 277 - - - src/app/shared/components/api-script/constant.ts - 282 - - Deflate 压缩 - - - Deflate unzip - - src/app/shared/components/api-script/constant.ts - 288 - - - src/app/shared/components/api-script/constant.ts - 293 - - Deflate 解压 - - - Encryption and Decryption - - src/app/shared/components/api-script/constant.ts - 301 - - 加密/解密 - - - MD5 Encryption - - src/app/shared/components/api-script/constant.ts - 309 - - MD5 加密 - - - Content to be encrypted - - src/app/shared/components/api-script/constant.ts - 313 - - - src/app/shared/components/api-script/constant.ts - 329 - - - src/app/shared/components/api-script/constant.ts - 345 - - - src/app/shared/components/api-script/constant.ts - 361 - - - src/app/shared/components/api-script/constant.ts - 385 - - - src/app/shared/components/api-script/constant.ts - 409 - - - src/app/shared/components/api-script/constant.ts - 433 - - - src/app/shared/components/api-script/constant.ts - 457 - - - src/app/shared/components/api-script/constant.ts - 505 - - - src/app/shared/components/api-script/constant.ts - 537 - - - src/app/shared/components/api-script/constant.ts - 569 - - - src/app/shared/components/api-script/constant.ts - 601 - - 待加密内容 - - - Encrypted result - - src/app/shared/components/api-script/constant.ts - 316 - - - src/app/shared/components/api-script/constant.ts - 332 - - - src/app/shared/components/api-script/constant.ts - 348 - - - src/app/shared/components/api-script/constant.ts - 468 - - - src/app/shared/components/api-script/constant.ts - 524 - - - src/app/shared/components/api-script/constant.ts - 556 - - - src/app/shared/components/api-script/constant.ts - 588 - - - src/app/shared/components/api-script/constant.ts - 620 - - 加密结果 - - - SHA1 Encryption - - src/app/shared/components/api-script/constant.ts - 320 - - - src/app/shared/components/api-script/constant.ts - 325 - - SHA1 加密 - - - SHA256 Encryption - - src/app/shared/components/api-script/constant.ts - 336 - - - src/app/shared/components/api-script/constant.ts - 341 - - SHA256 加密 - - - RSA-SHA1 Signature - - src/app/shared/components/api-script/constant.ts - 352 - - - src/app/shared/components/api-script/constant.ts - 357 - - RSA-SHA1 ç­¾å - - - private key - - src/app/shared/components/api-script/constant.ts - 365 - - - src/app/shared/components/api-script/constant.ts - 389 - - - src/app/shared/components/api-script/constant.ts - 461 - - - src/app/shared/components/api-script/constant.ts - 485 - - ç§é’¥ - - - The encoding format of the result, base64 (default) - - src/app/shared/components/api-script/constant.ts - 369 - - - src/app/shared/components/api-script/constant.ts - 393 - - - src/app/shared/components/api-script/constant.ts - 417 - - - src/app/shared/components/api-script/constant.ts - 465 - - 结果的编ç æ ¼å¼ base64 (默认) - - - Content After Signing - - src/app/shared/components/api-script/constant.ts - 372 - - - src/app/shared/components/api-script/constant.ts - 396 - - - src/app/shared/components/api-script/constant.ts - 420 - - ç­¾ååŽçš„内容 - - - RSA-SHA256 Signature - - src/app/shared/components/api-script/constant.ts - 376 - - - src/app/shared/components/api-script/constant.ts - 381 - - RSA-SHA256 ç­¾å - - - RSA Public Key Encryption - - src/app/shared/components/api-script/constant.ts - 400 - - - src/app/shared/components/api-script/constant.ts - 405 - - RSA 公钥加密 - - - public key - - src/app/shared/components/api-script/constant.ts - 413 - - - src/app/shared/components/api-script/constant.ts - 437 - - 公钥 - - - RSA Public Key Dencryption - - src/app/shared/components/api-script/constant.ts - 424 - - - src/app/shared/components/api-script/constant.ts - 429 - - 公用钥匙加密 - - - The encoding format of the content to be decrypted, base64 (default) - - src/app/shared/components/api-script/constant.ts - 441 - - - src/app/shared/components/api-script/constant.ts - 489 - - è¦è§£å¯†çš„内容的编ç æ ¼å¼ï¼ŒBase64 (默认) - - - Decrypted content - - src/app/shared/components/api-script/constant.ts - 444 - - 已解密的内容 - - - RSA Private Key Encryption - - src/app/shared/components/api-script/constant.ts - 448 - - - src/app/shared/components/api-script/constant.ts - 453 - - - src/app/shared/components/api-script/constant.ts - 472 - - - src/app/shared/components/api-script/constant.ts - 477 - - RSA ç§é’¥åŠ å¯† - - - Content to be decrypted - - src/app/shared/components/api-script/constant.ts - 481 - - 待加密内容 - - - Decrypted Content - - src/app/shared/components/api-script/constant.ts - 492 - - 已解密的内容 - - - AES Encryption - - src/app/shared/components/api-script/constant.ts - 496 - - - src/app/shared/components/api-script/constant.ts - 501 - - AES 加密 - - - password - - src/app/shared/components/api-script/constant.ts - 509 - - - src/app/shared/components/api-script/constant.ts - 541 - - - src/app/shared/components/api-script/constant.ts - 573 - - - src/app/shared/components/api-script/constant.ts - 605 - - å¯†ç  - - - Padding mode, Pkcs7 (default)/NoPadding/ZeroPadding - - src/app/shared/components/api-script/constant.ts - 513 - - - src/app/shared/components/api-script/constant.ts - 545 - - - src/app/shared/components/api-script/constant.ts - 577 - - - src/app/shared/components/api-script/constant.ts - 609 - - 填充模å¼ï¼Œ Pkcs7 (默认)/NoPadding/ZeroPadding - - - Mode, CBC (default)/ECB/CTR/OFB/CFB - - src/app/shared/components/api-script/constant.ts - 517 - - - src/app/shared/components/api-script/constant.ts - 549 - - - src/app/shared/components/api-script/constant.ts - 581 - - - src/app/shared/components/api-script/constant.ts - 613 - - 模å¼, CBC (默认)/ECB/CTR/OFB/CFB - - - offset vector - - src/app/shared/components/api-script/constant.ts - 521 - - - src/app/shared/components/api-script/constant.ts - 553 - - - src/app/shared/components/api-script/constant.ts - 585 - - - src/app/shared/components/api-script/constant.ts - 617 - - å移å‘é‡ - - - AES Dencryption - - src/app/shared/components/api-script/constant.ts - 528 - - - src/app/shared/components/api-script/constant.ts - 533 - - AES 加密 - - - DES Encryption - - src/app/shared/components/api-script/constant.ts - 560 - - - src/app/shared/components/api-script/constant.ts - 565 - - DES 解密 - - - DES Dencryption - - src/app/shared/components/api-script/constant.ts - 592 - - - src/app/shared/components/api-script/constant.ts - 597 - - DES 加密 - - - HTTP API request - - src/app/shared/components/api-script/constant.ts - 629 - - - src/app/shared/components/api-script/constant.ts - 719 - - HTTP 请求 - - - Set Request URL - - src/app/shared/components/api-script/constant.ts - 632 - - è®¾ç½®è¯·æ±‚åœ°å€ - - - Set HTTP API request path - - src/app/shared/components/api-script/constant.ts - 637 - - 设置 HTTP API 的请求路径 - - - new url - - src/app/shared/components/api-script/constant.ts - 638 - - 新的请求路径 - - - Set Header - - src/app/shared/components/api-script/constant.ts - 642 - - 设置 Header å‚æ•° - - - Set HTTP API request header params - - src/app/shared/components/api-script/constant.ts - 647 - - 设置 HTTP API 的请求头部å‚æ•° - - - params name - - src/app/shared/components/api-script/constant.ts - 649 - - - src/app/shared/components/api-script/constant.ts - 674 - - - src/app/shared/components/api-script/constant.ts - 687 - - å‚æ•°å - - - params value - - src/app/shared/components/api-script/constant.ts - 650 - - - src/app/shared/components/api-script/constant.ts - 675 - - - src/app/shared/components/api-script/constant.ts - 688 - - å‚数值 - - - Request body[Form-data] - - src/app/shared/components/api-script/constant.ts - 656 - - 请求体[Form-data] - - - Request body[Raw] - - src/app/shared/components/api-script/constant.ts - 662 - - 请求体[Raw] - - - Set REST params - - src/app/shared/components/api-script/constant.ts - 667 - - 设置 REST å‚æ•° - - - Set HTTP API REST params - - src/app/shared/components/api-script/constant.ts - 672 - - 设置 HTTP API çš„ REST å‚æ•° - - - Set Query params - - src/app/shared/components/api-script/constant.ts - 680 - - 设置 Query å‚æ•° - - - Set HTTP API Query params - - src/app/shared/components/api-script/constant.ts - 685 - - 设置 HTTP API çš„ Query å‚æ•° - - - Insert new API test[Form-data] - - src/app/shared/components/api-script/constant.ts - 693 - - æ’å…¥ API 测试[Form-data] - - - Insert new API test[JSON] - - src/app/shared/components/api-script/constant.ts - 698 - - æ’å…¥ API 测试[JSON] - - - Insert new API test[XML] - - src/app/shared/components/api-script/constant.ts - 703 - - æ’å…¥ API 测试[XML] - - - Insert new API test[Raw] - - src/app/shared/components/api-script/constant.ts - 708 - - æ’å…¥ API 测试[Raw] - - - Get Response Results - - src/app/shared/components/api-script/constant.ts - 722 - - 获å–å“应结果 - - - Get the response result of the HTTP API - - src/app/shared/components/api-script/constant.ts - 727 - - èŽ·å– HTTP API çš„å“应结果 - - - Set Response Result - - src/app/shared/components/api-script/constant.ts - 731 - - 设置å“应结果 - - - Set the response result of the HTTP API - - src/app/shared/components/api-script/constant.ts - 736 - - 设置 HTTP API çš„å“应结果 - - - response result - - src/app/shared/components/api-script/constant.ts - 737 - - å“应结果 - - - Global variable - - src/app/shared/components/env-list/env-list.component.ts - 12 - - 全局å˜é‡ - - - No Global variables - - src/app/shared/components/env-list/env-list.component.ts - 17 - - 暂无全局å˜é‡ - - - Environment Host - - src/app/shared/components/env-list/env-list.component.ts - 20 - - 环境 Host - - - Environment Global variable - - src/app/shared/components/env-list/env-list.component.ts - 25 - - 环境全局å˜é‡ - - - New - - src/app/shared/components/env/env.component.html - 10 - - 新建 - - - Are you sure you want to delete? - - src/app/shared/components/env/env.component.html - 21 - - 是å¦ç¡®å®šåˆ é™¤? - - - Global variable: API Documentation/Test can use to refer to the global variable - - src/app/shared/components/env/env.component.html - 46,48 - - 全局å˜é‡ï¼šåœ¨æŽ¥å£æ–‡æ¡£æˆ–测试的过程中,使用å³å¯å¼•ç”¨è¯¥å…¨å±€å˜é‡ - - - {{Variable Name}} - - src/app/shared/components/env/env.component.ts - 23 - - {{å˜é‡å}} - - - New Environment - - src/app/shared/components/env/env.component.ts - 24 - - - src/app/shared/components/env/env.component.ts - 132 - - 新建环境 - - - Operate - - src/app/shared/components/env/env.component.ts - 35 - - æ“作 - - - Edit Environment - - src/app/shared/components/env/env.component.ts - 107 - - 编辑环境 - - - Name is not allowed to be empty - - src/app/shared/components/env/env.component.ts - 141 - - å称ä¸å…许为空 - - - Failed to edit - - src/app/shared/components/env/env.component.ts - 158 - - 编辑失败 - - - Failed to add - - src/app/shared/components/env/env.component.ts - 170 - - 添加失败 - - - This feature requires plugin support, please move to Extensions download or open exist extensions. - - src/app/shared/components/extension-select/extension-select.component.html - 25,27 - - 该功能需è¦æ’件支æŒï¼Œè¯·ç§»æ­¥è‡³æ’件广场下载或开å¯æ’件功能. - - - Only supports importing a single file - - src/app/shared/components/extension-select/extension-select.component.html - 41 - - 仅支æŒå¯¼å…¥å•ä¸ªæ–‡ä»¶ - - - Only files in JSON format are supported - - src/app/shared/components/extension-select/extension-select.component.ts - 44 - - 仅支æŒä¸Šä¼  JSON æ ¼å¼çš„文件 - - - Please import the file first - - src/app/shared/components/import-api/import-api.component.ts - 84 - - 请先导入文件 - - - Same as the parent's field - - src/app/shared/components/import-api/import-api.component.ts - 108 - - 与父字段 ç›¸åŒ - - - The current data is stored locally,If you want to collaborate,Please - - src/app/shared/components/local-workspace-tip/local-workspace-tip.component.ts - 13 - - 当å‰æ•°æ®å­˜å‚¨åœ¨æœ¬åœ°ï¼Œå¦‚果您想è¦å作,请 - - - switch to the cloud workspace - - src/app/shared/components/local-workspace-tip/local-workspace-tip.component.ts - 14,16 - - 切æ¢åˆ°äº‘空间 - - - You don't have cloud space yet, please create one - - src/app/shared/components/local-workspace-tip/local-workspace-tip.component.ts - 51 - - 您还没有云空间,请创建一个 - - - Search - - src/app/shared/components/manage-access/manage-access.component.html - 4 - - æœç´¢ - - - Remove - - src/app/shared/components/manage-access/manage-access.component.html - 27 - - 移除 - - - Format - - src/app/shared/components/monaco-editor/monaco-editor.component.ts - 23 - - æ•´ç†æ ¼å¼ - - - Replace - - src/app/shared/components/monaco-editor/monaco-editor.component.ts - 35 - - æ›¿æ¢ - - - Import - - src/app/shared/components/params-import/params-import.component.html - 3 - - 导入 - - - Import like this: - - src/app/shared/components/params-import/params-import.component.html - 24 - - 导入格å¼ï¼š - - - Insert at the end - - src/app/shared/components/params-import/params-import.component.html - 33 - - 在末端æ’å…¥ - - - Replace All - - src/app/shared/components/params-import/params-import.component.html - 34 - - å…¨é‡æ›¿æ¢ - - - Replace Changed - - src/app/shared/components/params-import/params-import.component.html - 35 - - 增é‡æ›´æ–° - - - JSON format invalid - - src/app/shared/components/params-import/params-import.component.ts - 81 - - JSON æ ¼å¼ä¸æ­£ç¡® - - - Form format invalid - - src/app/shared/components/params-import/params-import.component.ts - 94 - - Form æ ¼å¼ä¸æ­£ç¡® - - - XML format invalid - - src/app/shared/components/params-import/params-import.component.ts - 104 - - XML æ ¼å¼ä¸æ­£ç¡® - - - About - - src/app/shared/components/setting/common/about.component.ts - 6 - - 关于 - - - Cloud Storage - - src/app/shared/components/setting/common/data-storage.component.ts - 10 - - - src/app/shared/components/setting/setting.component.ts - 91 - - 云端æœåŠ¡ - - - Cloud Storage: Store data on the cloud for team collaboration and product use across devices. - - src/app/shared/components/setting/common/data-storage.component.ts - 15,16 - - 云存储:将数æ®å­˜å‚¨åœ¨äº‘端,供团队å作和跨设备产å“使用。 - - - Learn more.. - - src/app/shared/components/setting/common/data-storage.component.ts - 18 - - 了解更多.. - - - Host - - src/app/shared/components/setting/common/data-storage.component.ts - 24 - - Host - - - Please input your Host - - src/app/shared/components/setting/common/data-storage.component.ts - 25 - - 请输入您的远程 Hostï¼ - - - your host - - src/app/shared/components/setting/common/data-storage.component.ts - 26 - - 远程 Host - - - Connect - - src/app/shared/components/setting/common/data-storage.component.ts - 32 - - 连接 - - - Successfully connect to cloud - - src/app/shared/components/setting/common/data-storage.component.ts - 93 - - æˆåŠŸè¿žæŽ¥äº‘æœåŠ¡ - - - Failed to connect - - src/app/shared/components/setting/common/data-storage.component.ts - 99 - - 连接失败 - - - Extensions - - src/app/shared/components/setting/common/extensions.component.ts - 10 - - æ’件 - - - Please Enter - - src/app/shared/components/setting/common/extensions.component.ts - 29 - - 请输入 - - - - - - - src/app/shared/components/setting/common/extensions.component.ts - 40,42 - - - - - No plugins are currently installed, go to install - - src/app/shared/components/setting/common/extensions.component.ts - 78 - - 该功能需è¦æ’件支æŒï¼Œè¯·ç§»æ­¥è‡³æ’件广场下载 - - - Language - - src/app/shared/components/setting/common/language-swtcher.component.ts - 7 - - - src/app/shared/components/setting/common/language-swtcher.component.ts - 10 - - - src/app/shared/components/setting/setting.component.ts - 96 - - 语言 - - - Account - - src/app/shared/components/setting/setting.component.ts - 73 - - - src/app/shared/components/setting/setting.component.ts - 78 - - è´¦å· - - - Password - - src/app/shared/components/setting/setting.component.ts - 82 - - å¯†ç  - - - About - - src/app/shared/components/setting/setting.component.ts - 100 - - 关于 - - - Member - - src/app/shared/components/sidebar/sidebar.component.ts - 93 - - æˆå‘˜ - - - Workspace - - src/app/shared/components/sidebar/sidebar.component.ts - 103 - - 空间 - - - Extensions - - src/app/shared/components/sidebar/sidebar.component.ts - 111 - - æ’件广场 - - - Hide/Show Sidebar - - src/app/shared/components/toolbar/toolbar.component.html - 10 - - éšè—/å±•ç¤ºä¾§æ  - - - The test service connection failed, please submit an Issue to contact the community - - src/app/shared/services/api-test/api-test.utils.ts - 219 - - 测试æœåŠ¡è¿žæŽ¥å¤±è´¥ï¼Œè¯·æ交 Issue è”系社区 - - - Need to deploy cloud services - - src/app/shared/services/data-source/data-source.service.ts - 89 - - 需è¦éƒ¨ç½²äº‘æœåŠ¡ - - - Store data on the cloud for team collaboration and product use across devices. - - src/app/shared/services/data-source/data-source.service.ts - 90 - - 将数æ®å­˜å‚¨åœ¨äº‘端,供团队å作和跨设备产å“使用。 - - - Learn more.. - - src/app/shared/services/data-source/data-source.service.ts - 91 - - 了解更多.. - - - Confirm - - src/app/shared/services/modal.service.ts - 39 - - 确认 - - - Get City Weather Today - - src/app/shared/services/storage/IndexedDB/lib/index.constant.ts - 6 - - 获å–城市今日天气 - - - City Code : http://www.mca.gov.cn/article/sj/xzqh/2020/20201201.html - - src/app/shared/services/storage/IndexedDB/lib/index.constant.ts - 21 - - åŸŽå¸‚ä»£ç  : http://www.mca.gov.cn/article/sj/xzqh/2020/20201201.html - - - minimum temperature - - src/app/shared/services/storage/IndexedDB/lib/index.constant.ts - 46 - - 最低温度 - - - maximun temperature - - src/app/shared/services/storage/IndexedDB/lib/index.constant.ts - 53 - - 最高温度 - - - COVID-19 national epidemic - - src/app/shared/services/storage/IndexedDB/lib/index.constant.ts - 68 - - 新冠全国疫情 - - - The actual parameter is string, in order to show the document expansion display - - src/app/shared/services/storage/IndexedDB/lib/index.constant.ts - 97 - - 实际å‚数是 string,以便显示文档扩展显示 - - - Default Mock - - src/app/shared/services/storage/IndexedDB/lib/index.ts - 88 - - 默认 Mock - - - Local workspace - - src/app/shared/services/workspace/workspace.service.ts - 18 - - 本地空间 - - - - diff --git a/src/workbench/browser/src/main.ts b/src/workbench/browser/src/main.ts index 8abed7137..c16d43f23 100644 --- a/src/workbench/browser/src/main.ts +++ b/src/workbench/browser/src/main.ts @@ -15,19 +15,19 @@ microApp.start({ // 删除 http://localhost:3001/error.js 的内容 return window .fetch(new URL(url.replace('https://unpkg.com/', ''), `https://unpkg.com/${appName}/page/`).href, options) - .then((res) => res.text()); + .then(res => res.text()); } - return window.fetch(url, options).then((res) => { + return window.fetch(url, options).then(res => { if (res.status > 400) { console.error(res); return ''; } return res.text(); }); - }, + } }); platformBrowserDynamic() .bootstrapModule(AppModule) - .catch((err) => console.error(err)); + .catch(err => console.error(err)); diff --git a/src/workbench/browser/src/ng1/app.module.js b/src/workbench/browser/src/ng1/app.module.js deleted file mode 100644 index 18356a36e..000000000 --- a/src/workbench/browser/src/ng1/app.module.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; -angular.module('eolinker', [ - 'eolinker.directive' -]) -angular.module('eolinker.directive', []) diff --git a/src/workbench/browser/src/ng1/component/auto-complete.js b/src/workbench/browser/src/ng1/component/auto-complete.js deleted file mode 100644 index cbe486ede..000000000 --- a/src/workbench/browser/src/ng1/component/auto-complete.js +++ /dev/null @@ -1,203 +0,0 @@ -/** - * 产å“基本需求 - * (1)å•å‡»ä¸‹æ‹‰æŒ‰é’®ï¼Œä¸‹æ‹‰èœå•ä¸ºå…¨éƒ¨é€‰é¡¹å†…容 - * (2)编辑输入框,下拉èœå•ä¸ºç­›é€‰åŽçš„内容 - * (3)能够通过上下箭头控制下拉èœå•é€‰ä¸­é¡¹ - */ -/** - * @author Eoapi - * @description 自动补全控件 - * @extends {string} placeholder 内置输入框placeholder内容[optional] - * @extends {array} array 预设列表 - * @extends {string} model 输入框绑定对象 - * @extends {string} type 输入对象类型 - * @extends {function} inputChangeFun 输入框预设函数[optional] - */ - -angular.module('eolinker').component('autoCompleteComponent', { - template: `
-
- - -
-
-
    -
  • {{item}}
  • -
-
-
`, - controller: autoCompleteController, - bindings: { - readOnly: '<', - placeholder: '@', - keyName: '@', - maxLength: '@', - required: '<', - inputBlurFun: '&', - inputKeydownFun: '&', - setting: '<', - array: '<', //自定义数组填充数组 - model: '=', //输入框绑定 - inputChangeFun: '&', //输入框值改å˜ç»‘定功能函数 - }, -}); - -autoCompleteController.$inject = ['$scope', '$rootScope', '$element']; - -function autoCompleteController($scope, $rootScope, $element) { - var vm = this; - vm.data = { - query: [], - inputElem: $element[0].getElementsByClassName('input-text-acac'), - inputIsFocus: false, - }; - vm.fun = {}; - vm.selectMainObject = { - itemType: 'html', - itemHtml: '{{item}}', - }; - vm.CONST = { - INPUT_DEFAULT_TRIM: true, - }; - var data = { - originalElemCount: 0, - }, - privateFun = {}; - privateFun.resetWaitingList = () => { - if (vm.model[vm.keyName]) { - vm.data.query = []; - let tmpIndex = 0; - angular.forEach(vm.array, function (val, key) { - var pattern = '/^' + vm.model[vm.keyName].toLowerCase() + '/'; - try { - if (eval(pattern).test(val.toLowerCase())) { - vm.data.query.splice(tmpIndex, 0, val); - tmpIndex++; - } else if (val.toLowerCase().indexOf(vm.model[vm.keyName].toLowerCase()) > -1) { - vm.data.query.push(val); - } - } catch (EVAL_ERR) { - console.error(EVAL_ERR); - } - }); - if (vm.data.query.length <= 0) { - vm.data.viewIsShow = false; - } - } else { - vm.data.query = vm.array; - } - }; - vm.fun.modelChange = function () { - vm.data.inputIsFocus = true; - vm.inputChangeFun(); - privateFun.clearSelectItem(); - privateFun.resetWaitingList(); - }; - privateFun.setDownListWidth = () => { - if (vm.setting && vm.setting.isNeedToResetPosition) { - let tmpObj = $element[0].getElementsByClassName('input-text-acac')[0].offsetParent || {}; - vm.data.inputWidth = tmpObj.clientWidth - 2; - vm.data.inputX = tmpObj.x; - } - }; - vm.fun.changeSwitch = function (inputBool) { - if (vm.readOnly) return; - vm.data.inputIsFocus = inputBool; - if (vm.data.inputIsFocus) { - privateFun.setDownListWidth(); - vm.data.query = vm.array; - } - vm.data.inputElem[0].focus(); - }; - vm.fun.changeText = function (inputText) { - vm.data.inputIsFocus = false; - vm.model[vm.keyName] = inputText; - vm.inputChangeFun(); - }; - - /** - * @description é‡ç½®ä¸‹æ‹‰èœå•é€‰ä¸­é¡¹ - */ - privateFun.clearSelectItem = () => { - data.originalElemCount = 0; - vm.data.currentElementCount = data.originalElemCount - 1; - }; - vm.fun.inputBlur = ($event) => { - $event.stopPropagation(); - vm.data.inputIsFocus = false; - if (vm.inputBlurFun) { - vm.inputBlurFun(); - } - }; - vm.fun.inputFocus = ($event) => { - $event.stopPropagation(); - privateFun.clearSelectItem(); - }; - vm.fun.keydown = function (_default) { - if (!vm.data.hasOwnProperty('currentElementCount')) { - vm.data.currentElementCount = data.originalElemCount - 1; - } - - switch (_default.keyCode) { - case 38: { - // up - vm.data.currentElementCount = - vm.data.currentElementCount <= data.originalElemCount - ? ((vm.data.query || []).length || 1) - 1 - : vm.data.currentElementCount - 1; - ($scope.$root && $scope.$root.$$phase) || $scope.$apply(); - break; - } - case 40: { - // down - _default.preventDefault(); - vm.data.currentElementCount++; - if (vm.data.currentElementCount === (vm.data.query || []).length) { - vm.data.currentElementCount = data.originalElemCount; - } - ($scope.$root && $scope.$root.$$phase) || $scope.$apply(); - break; - } - case 13: { - //enter - _default.preventDefault(); - if (vm.data.currentElementCount >= 0) { - vm.fun.changeText(vm.data.query[vm.data.currentElementCount], vm.data.currentElementCount); - ($scope.$root && $scope.$root.$$phase) || $scope.$apply(); - } - } - } - if (vm.inputKeydownFun) { - vm.inputKeydownFun({ - $event: _default, - changeText: vm.fun.modelChange, - }); - } - }; - $scope.$on('$destroy', () => { - $scope.$destroy(); - $element.remove(); - vm = null; - indexController = null; - }); - vm.$onInit = () => { - privateFun.setDownListWidth(); - if (vm.setting && vm.setting.refleshWaitingList) { - $scope.$watch('$ctrl.array', function () { - if (vm.array) { - privateFun.resetWaitingList(); - } - }); - } - }; -} diff --git a/src/workbench/browser/src/ng1/component/list-block.js b/src/workbench/browser/src/ng1/component/list-block.js deleted file mode 100644 index ac18b439d..000000000 --- a/src/workbench/browser/src/ng1/component/list-block.js +++ /dev/null @@ -1,2256 +0,0 @@ -angular.module('eolinker').component('listBlockCommonComponent', { - template: ` -
-
-
-
- - - - -
-
-
- -
-
-
-
-
-
-
-
- - -
-
-
- -
- -
-
`, - controller: listBlockController, - bindings: { - otherObject: '=', - authorityObject: '<', - wrapStyle: '<', - mainObject: '<', - list: '=', - activeObject: '=', - pageObject: '<', - mark: '@', - }, -}); -listBlockController.$inject = ['$rootScope', '$element', '$scope']; - -function listBlockController($rootScope, $element, $scope) { - let vm = this; - let locale = window.location.href.includes('zh') ? 'zh' : 'en'; - vm.listBlockVarible = { - operate: locale === 'zh' ? 'æ“作' : 'Operation', - column: locale === 'zh' ? '列表项' : 'Column', - minLen: locale === 'zh' ? '最å°é•¿åº¦' : 'Minimum length', - maxLen: locale === 'zh' ? '最大长度' : 'Maximum Length', - minValue: locale === 'zh' ? '最å°å€¼' : 'Minimum value', - maxValue: locale === 'zh' ? '最大值' : 'Maximum value', - valueExampple: locale === 'zh' ? '值å¯èƒ½æ€§' : 'Enum', - fileBtnText: locale === 'zh' ? '选择文件' : 'Select File', - }; - - const fun = {}; - const privateFun = {}; - privateFun.setTabListStorage = (inputStorageName, inputCheckboxObject, inputList) => { - const tmpIndexAddress = {}; - inputList.map((val) => { - if (inputCheckboxObject.indexAddress.hasOwnProperty(val.value)) { - tmpIndexAddress[val.value] = inputCheckboxObject.indexAddress[val.value]; - } else { - delete tmpIndexAddress[val.value]; - } - }); - window.localStorage.setItem(inputStorageName, JSON.stringify(tmpIndexAddress)); - }; - vm.filterActiveObj = {}; - vm.component = { - tabBlockListObj: { - setting: { - hideFilter: true, - trClass: 'hover-tr-lbcc', - trExpression: "ng-if=\"($ctrl.otherObject.isXml&&item.value==='attr')||item.value!=='attr'\"", - }, - baseFun: { - teardownWhenCheckboxIsClick: (inputCheckboxObject, inputList, inputOptions = {}) => { - privateFun.setTabListStorage(inputOptions.mark, inputCheckboxObject, inputList); - }, - }, - tdList: [ - { - type: 'checkbox', - isWantedToExposeObject: true, - checkboxClickAffectTotalItem: true, - activeKey: 'value', - activeValue: 1, - }, - { - thKey: `列表项`, - type: 'html', - html: '', - }, - ], - }, - }; - vm.data = { - MAX_OMIT_LIST_LENTH: 500, - listPartIndex: 1, - moreBtnObj: {}, - sortForm: { - parentContainment: 'tbody-div', - containment: '.tbody-div', - }, - sortAuthorityVar: '', - sort: false, - isEditTable: false, - html: '', - partHtml: {}, - movePart: null, - checkboxTdObject: { - selectAll: false, - indexAddress: {}, - query: [], - }, - bodyTabBlockObj: { - selectAll: false, - indexAddress: {}, - query: [], - }, - TAB_BLOCK_LIST_ARR: [], - tabBlockListHtml: - '', - }; - vm.fun = {}; - const data = { - isAlreadyInitFilter: true, - radioOriginalIndex: 0, - movePart: null, - }; - const CONFIG = { - draggableMainObject: { - setting: { - object: 'width', - affectCount: -1, - dragOffSet: 0, - minWidth: 30, - }, - baseFun: { - mouseup: (inputMark, inputWidth) => { - /** - * @desc 拖动鼠标放开æ“作 - */ - vm.data.dragCacheObj[inputMark] = inputWidth; - window.localStorage.setItem( - vm.mainObject.setting.dragCacheVar || - `${window.location.pathname.toUpperCase().replace(/\./g, '_')}_LIST_DRAG_VAR`, - JSON.stringify(vm.data.dragCacheObj) - ); - }, - }, - dom: $element[0], - }, - }; - vm.fun.watchUi = (inputOpr) => { - switch (inputOpr) { - case 'show_more_list': { - vm.data.listPartIndex++; - break; - } - case 'full_screen': { - vm.data.screenStatus = 'full'; - if (document.getElementsByClassName('group_and_list_container')[0]) - document.getElementsByClassName('group_and_list_container')[0].style.zIndex = 9; - document.body.parentNode.style.overflowY = 'hidden'; - break; - } - case 'zoom_out_screen': { - vm.data.screenStatus = 'default'; - if (document.getElementsByClassName('group_and_list_container')[0]) - document.getElementsByClassName('group_and_list_container')[0].style.zIndex = ''; - document.body.parentNode.style.overflowY = ''; - break; - } - } - }; - vm.fun.sort = function (arg) { - const tmpPartModule = data.movePart; - if (!vm.data.sort) return; - if (vm.mainObject.setting.hasOwnProperty('unSortIndex') && vm.mainObject.setting.unSortIndex === arg.targetIndex) { - return; - } - switch (arg.where) { - case 'before': - case 'in': - case 'after': { - break; - } - default: { - return; - } - } - arg = arg || {}; - const tmp = { - list: [], - oldList: angular.copy(vm.list), - index: arg.originIndex + 1, - targetIndex: arg.targetIndex, - }; - tmp.list.push( - Object.assign({}, arg.from, { - listDepth: arg.where === 'in' ? arg.to.listDepth + 1 : arg.to.listDepth, - isHide: !!(arg.where === 'in' && arg.to.isShrink), - }) - ); - const tmpFunListParse = () => { - const val = tmp.oldList[tmp.index]; - if (arg.where === 'in') { - val.listDepth = arg.to.listDepth + val.listDepth - arg.from.listDepth + 1; - } else { - val.listDepth -= arg.from.listDepth - arg.to.listDepth; - } - if (val.listDepth < 0) val.listDepth = 0; - tmp.list.push(val); - tmp.index++; - }; - if (vm.mainObject.baseFun.checkIsDisabledToSort) { - if (vm.mainObject.baseFun.checkIsDisabledToSort(arg, vm.list)) return; - } - if (vm.mainObject.baseFun.sortPartLastIndex) { - while ( - tmp.index < arg.groupList.length && - (vm.mainObject.baseFun.sortPartLastIndex(arg.from, arg.groupList[tmp.index], { - targetIndex: tmp.index, - originIndex: arg.originIndex, - list: vm.list, - }) || - arg.groupList[tmp.index].listDepth > arg.from.listDepth) - ) { - tmpFunListParse(); - } - } else { - while (tmp.index < arg.groupList.length && arg.groupList[tmp.index].listDepth > arg.from.listDepth) { - tmpFunListParse(); - } - } - if (arg.targetIndex > arg.originIndex && arg.targetIndex < tmp.index) return; - tmp.oldList.splice(arg.originIndex, tmp.index - arg.originIndex); - if (arg.targetIndex > arg.originIndex) { - arg.targetIndex = arg.targetIndex - (tmp.index - arg.originIndex) + 1; - tmp.targetIndex = arg.targetIndex - 1; - } - if (tmp.targetIndex < 0) return; - let tmpResultList = null; - switch (arg.where) { - case 'before': { - if (arg.originIndex < arg.targetIndex) { - tmpResultList = tmp.oldList - .slice(0, arg.targetIndex - 1) - .concat(tmp.list) - .concat(tmp.oldList.slice(arg.targetIndex - 1, tmp.oldList.length)); - } else { - tmpResultList = tmp.oldList - .slice(0, arg.targetIndex || 0) - .concat(tmp.list) - .concat(tmp.oldList.slice(arg.targetIndex || 0, tmp.oldList.length)); - } - break; - } - case 'in': { - // if (arg.to.listDepth >= 4) { - // return; - // } - if (vm.mainObject.baseFun.sortIn) { - vm.mainObject.baseFun.sortIn(tmp.oldList[tmp.targetIndex]); - } - if (vm.mainObject.baseFun.resetSortIn) { - arg.targetIndex = vm.mainObject.baseFun.resetSortIn(arg.targetIndex, tmp.oldList); - } - if (arg.originIndex < arg.targetIndex) { - tmpResultList = tmp.oldList - .slice(0, arg.targetIndex || 1) - .concat(tmp.list) - .concat(tmp.oldList.slice(arg.targetIndex || 1, tmp.oldList.length)); - } else { - tmpResultList = tmp.oldList - .slice(0, arg.targetIndex + 1) - .concat(tmp.list) - .concat(tmp.oldList.slice(arg.targetIndex + 1, tmp.oldList.length)); - } - break; - } - case 'after': { - tmpResultList = tmp.oldList - .slice(0, arg.targetIndex || 1) - .concat(tmp.list) - .concat(tmp.oldList.slice(arg.targetIndex || 1, tmp.oldList.length)); - break; - } - default: { - return; - } - } - - vm.list = tmpResultList; - if (vm.mainObject.baseFun.sort) { - vm.mainObject.baseFun.sort(tmpResultList, tmpPartModule); - } - }; - fun.getTargetEvent = function ($event, inputPointAttr) { - const itemIndex = $event.getAttribute(inputPointAttr || 'eo-attr-index'); - if (itemIndex) { - return $event; - } else { - return fun.getTargetEvent($event.parentNode, inputPointAttr); - } - }; - fun.getTargetIndex = function ($event, inputPointAttr) { - const itemIndex = $event.getAttribute(inputPointAttr || 'eo-attr-index'); - if (itemIndex) { - return itemIndex; - } else { - return fun.getTargetIndex($event.parentNode, inputPointAttr); - } - }; - fun.deleteItem = function (inputIndex) { - if (vm.data.isDepth) { - vm.list.splice(inputIndex, fun.getLastItemIndex(inputIndex, vm.list) - inputIndex || 1); - - // å­é›†ä¸º arrItem 数组结构 - const parentIdx = fun.getParentItemIndex(inputIndex, vm.list); - const isHasArrItem = parentIdx > -1 && fun.checkCurChildListIsArrItems(parentIdx, vm.list); - if (isHasArrItem) { - fun.afterHandleUpdateItems(inputIndex, vm.list); - } - } else { - vm.list.splice(inputIndex, 1); - } - }; - fun.insertItem = function (inputObject) { - // array类型æ’入为æ’å…¥ copy item - if (inputObject.item.isArrItem) { - fun.copyItem( - { - item: inputObject.item, - $index: inputObject.$index, - }, - { isResetDefault: true, isInsertBefore: true } - ); - } else { - vm.list.splice( - inputObject.$index, - 0, - Object.assign( - {}, - { - listDepth: inputObject.item.listDepth, - }, - vm.mainObject.itemStructure - ) - ); - } - }; - /** - * @desc 添加å­çº§ - * @param {object} inputObject 为当å‰å¯¹è±¡æ·»åŠ å­çº§ - */ - fun.addChildItem = function (inputObject) { - const isArrItemsParent = fun.checkCurChildListIsArrItems(inputObject.$index, vm.list); - // 如果当å‰å­—段的å­é›† 是 isArrItem 类型数æ®ï¼Œåˆ™ä»¥å¤åˆ¶itemæ–¹å¼æ·»åŠ  - if (isArrItemsParent) { - const childIdxs = fun.getCurItemIdxRang(inputObject.$index, vm.list); - const firstItemIndex = childIdxs[0]; - - fun.copyItem( - { - item: vm.list[firstItemIndex], - $index: firstItemIndex, - }, - { isResetDefault: true, isInsertBefore: false } - ); - } else { - if (vm.mainObject.baseFun.reduceItemWhenAddChildItem) { - vm.mainObject.baseFun.reduceItemWhenAddChildItem(inputObject.item); - } - - const lastItemIdx = fun.getLastItemIndex(inputObject.$index, vm.list) || 1; - - const currentItem = Object.assign( - {}, - { - listDepth: (inputObject.item.listDepth || 0) + 1, - isHide: !!inputObject.item.isShrink, - }, - vm.mainObject.itemStructure - ); - - let customItem = {}; - - // 自定义更新åŽçš„å­çº§ - if (vm.mainObject.baseFun.customAddChildItem) { - const parentItem = inputObject.item; - customItem = vm.mainObject.baseFun.customAddChildItem(currentItem, parentItem); - } - - const newItem = Object.assign({}, currentItem, customItem); - - vm.list.splice(lastItemIdx, 0, newItem); - } - - // 逻辑处ç†æ·»åŠ å­çº§ï¼Œå¦‚若父级没有勾选,自动勾选 - switch (typeof data.checkboxTdIndex) { - case 'object': { - if (vm.mainObject.setting && vm.mainObject.setting.hasOwnProperty('parentAndChildLinkTdIndex')) { - const tmpCheckboxTd = vm.mainObject.tdList[vm.mainObject.setting.parentAndChildLinkTdIndex]; - if (tmpCheckboxTd) { - fun.clickCheckbox(tmpCheckboxTd, inputObject.$index, 0, true); - } - } - - break; - } - default: { - const tmpCheckboxTd = vm.mainObject.tdList[data.checkboxTdIndex]; - if (tmpCheckboxTd) { - fun.clickCheckbox(tmpCheckboxTd, inputObject.$index, 0, true); - } - break; - } - } - }; - fun.copyItem = (inputObject, { isResetDefault, isInsertBefore } = {}) => { - // å¤åˆ¶ 指定行 - if (inputObject.item.isArrItem) { - const [startIdx, endIdx] = fun.getCurrentItemRange(inputObject.$index, vm.list); - let copyItems = angular.copy(vm.list.slice(startIdx, endIdx + 1)); - - // 获å–æ’å…¥ä½ç½® - let insertIdx = 0; - if (isInsertBefore) { - insertIdx = startIdx; - } else { - const parentIdx = fun.getParentItemIndex(inputObject.$index, vm.list); - const [_, childEndIdx] = fun.getCurrentItemRange(parentIdx, vm.list); - insertIdx = childEndIdx + 1; - } - - if (isResetDefault) { - copyItems = fun.resetTargetItems(copyItems); - } - - vm.list.splice(insertIdx, 0, ...copyItems); - - fun.afterHandleUpdateItems(inputObject.$index, vm.list); - } - }; - - /** - * æ¸…ç©ºæŒ‡å®šæ•°ç»„æ•°æ® - */ - fun.resetTargetItems = (itemArrs) => { - const items = [...itemArrs]; - for (const item of items) { - item.paramInfo = ''; - } - return items; - }; - - /** - * 判断å­çº§åˆ—表是å¦ä¸º isArrItem 结构的å­é›† - */ - fun.checkCurChildListIsArrItems = (targetIndex, inputArray) => { - const childIdxs = fun.getCurItemIdxRang(targetIndex, inputArray); - return childIdxs.length > 0 && childIdxs.every((idx) => inputArray[idx].isArrItem); - }; - - /** - * 处ç†æ–¹æ³•åŽ 更新指定下标的å­é›† å« isArrItem 结构å­é›†çš„å称 - * @param {*} inputObject - */ - fun.afterHandleUpdateItems = (targetIndex, inputArray) => { - const parentIdx = fun.getParentItemIndex(targetIndex, inputArray); - - if (parentIdx === -1) return; - - fun.updateItemsByParentIdx(parentIdx, inputArray); - }; - fun.updateItemsByParentIdx = (parentIdx, inputArray) => { - const parentParamKey = inputArray[parentIdx].paramKey; - - const childIdxs = fun.getCurItemIdxRang(parentIdx, inputArray); - - // æ›´æ–°æ¯ä¸ªæ–°çš„item所处下标 - childIdxs.forEach((childIdx, index) => { - // inputArray[childIdx].paramKey = `${ parentParamKey }[${index}]`; - inputArray[childIdx].paramKey = `item[${index}]`; - }); - }; - /** - * 获å–当å‰å­—段 所有å­å­—段的下标范围 - */ - fun.getCurrentItemRange = (inputIndex, inputArray) => { - const initDepth = inputArray[inputIndex].listDepth; - const startIdx = inputIndex; - let endIdx = startIdx; - - while (endIdx < inputArray.length) { - const isChild = inputArray[endIdx + 1] && inputArray[endIdx + 1].listDepth > initDepth; - - if (isChild) { - endIdx++; - } else { - break; - } - } - return [startIdx, endIdx]; - }; - /** - * 获å–当å‰å­—段 父级的下标 - * - */ - fun.getParentItemIndex = (inputIndex, inputArray) => { - let parentIdx = inputIndex - 1; - if (!inputArray[inputIndex]) return parentIdx; - const currentDepth = inputArray[inputIndex].listDepth; - while (parentIdx >= 0) { - if (inputArray[parentIdx].listDepth === currentDepth - 1) { - break; - } - parentIdx--; - } - // -1 为未找到 - return parentIdx; - }; - /** - * 获å–当å‰å­—段 下一级的下标 数组 - */ - fun.getCurItemIdxRang = (inputIndex, inputArray) => { - const idxs = []; - const curDepth = inputArray[inputIndex].listDepth; - let startIdx = inputIndex + 1; - while (startIdx < inputArray.length) { - // 查找到åŒçº§æˆ–大于åŒçº§å°±é€€å‡º - if (curDepth >= inputArray[startIdx].listDepth) { - break; - } - if (curDepth + 1 === inputArray[startIdx].listDepth) { - idxs.push(startIdx); - } - startIdx++; - } - - return idxs; - }; - - /** - * @desc 循环去设置父级下å­çº§çš„checkbox - * @param {number} inputIndex 当å‰æ“作的åºå· - * @param {array} inputList å¾…æ“作数组 - * @param {string} inputModelKey checkbox绑定的字段å - * @param {boolean} inputIsCheck 是å¦å‹¾é€‰ - */ - fun.loopToSetChildItemCheckbox = (inputIndex, inputList, inputTdObject, inputIsCheck) => { - let tmpNextIndex = inputIndex + 1; - while (tmpNextIndex < inputList.length && inputList[tmpNextIndex].listDepth > inputList[inputIndex].listDepth) { - if ( - inputTdObject.checkIsValidItem && - !inputTdObject.checkIsValidItem({ - item: inputList[tmpNextIndex], - }) - ) { - tmpNextIndex++; - continue; - } - inputList[tmpNextIndex][inputTdObject.modelKey] = inputIsCheck; - tmpNextIndex++; - } - }; - /** - * @desc å•ç‚¹checkbox - * @param {object} inputTdObject checkbox æ“作对象 - * @param {number} inputItemIndex æ“作的行 - * @param {number} inputPartIndex æ“作partåºå· - * @param {boolean} inputIsAlreadyCheck 是å¦å·²ç»æ˜¯å‹¾é€‰ - */ - fun.clickCheckbox = function (inputTdObject, inputItemIndex, inputPartIndex, inputIsAlreadyCheck) { - const tmpAuthority = inputTdObject.authority; - if (tmpAuthority && !vm.authorityObject[tmpAuthority]) return; - const tmpList = vm.list; - if (inputTdObject.fun) { - inputTdObject.fun({ - item: tmpList[inputItemIndex], - $index: inputItemIndex, - }); - return; - } - if (vm.mainObject.baseFun.checkIsValidItem) { - if ( - !vm.mainObject.baseFun.checkIsValidItem({ - item: tmpList[inputItemIndex], - $index: inputItemIndex, - type: inputTdObject.type, - }) - ) - return; - } - if ( - inputTdObject.checkIsValidItem && - !inputTdObject.checkIsValidItem({ - item: tmpList[inputItemIndex], - }) - ) - return; - if (inputTdObject.modelKey) { - let tmpBatchObj = null; - let tmpIsCheck = inputIsAlreadyCheck || !tmpList[inputItemIndex][inputTdObject.modelKey]; - let tmpCheckboxValue; - if (inputTdObject.modelValueArr) { - tmpIsCheck = - tmpList[inputItemIndex][inputTdObject.modelKey] === inputTdObject.modelValueArr[0] || inputIsAlreadyCheck; - tmpCheckboxValue = inputTdObject.modelValueArr[tmpIsCheck ? 1 : 0]; - } else { - tmpCheckboxValue = tmpIsCheck; - } - tmpList[inputItemIndex][inputTdObject.modelKey] = tmpCheckboxValue; - switch (inputTdObject.type) { - case 'checkbox': { - tmpBatchObj = vm.data.checkboxTdObject; - try { - inputItemIndex = parseInt(inputItemIndex); - if (tmpIsCheck) { - if (!inputTdObject.cancelParentAndChildCheckLink) { - // 逻辑处ç†ï¼šä½œä¸ºå­çº§å…ƒç´ ï¼Œè‡ªåŠ¨å‹¾é€‰çˆ¶çº§ - let tmpPreIndex = inputItemIndex - 1; - let tmpCurrentLevel = tmpList[inputItemIndex].listDepth; - while (tmpPreIndex >= 0) { - if (tmpCurrentLevel > tmpList[tmpPreIndex].listDepth) { - tmpList[tmpPreIndex][inputTdObject.modelKey] = tmpCheckboxValue; - tmpCurrentLevel = tmpList[tmpPreIndex].listDepth; - } - if (!tmpCurrentLevel) break; - tmpPreIndex--; - } - } - // 逻辑处ç†ï¼šä½œä¸ºçˆ¶çº§å…ƒç´ ï¼Œå¼¹çª—询问是å¦å‹¾é€‰æ‰€æœ‰å­çº§é€‰é¡¹ï¼Œæ问语:“是å¦å‹¾é€‰æ‰€æœ‰å­çº§ï¼Ÿâ€ - if (!inputIsAlreadyCheck && !inputTdObject.disabledToAlert) { - // disabledToAlerté…置,用于判断是å¦éœ€è¦ç¦ç”¨å¼¹çª—æ示勾选å­çº§ - const tmpNextIndex = inputItemIndex + 1; - if ( - tmpNextIndex < tmpList.length && - tmpList[tmpNextIndex].listDepth > tmpList[inputItemIndex].listDepth - ) { - $rootScope.EnsureModal( - '是å¦å‹¾é€‰æ‰€æœ‰å­çº§ï¼Ÿ', - false, - '是å¦ç¡®è®¤å‹¾é€‰æ­¤å±‚级下的所有å­çº§', - { - btnType: 1, - btnMessage: '确定', - }, - (callback) => { - if (callback) { - fun.loopToSetChildItemCheckbox(inputItemIndex, tmpList, inputTdObject, tmpCheckboxValue); - } - } - ); - } - } - } else { - // 函数传å‚,存在自定义å–消勾选内容 - if (inputTdObject.fnWhenCancelToCheck) { - inputTdObject.fnWhenCancelToCheck(inputItemIndex, tmpList, () => { - fun.loopToSetChildItemCheckbox(inputItemIndex, tmpList, inputTdObject, tmpCheckboxValue); - }); - return; - } - // 逻辑处ç†ï¼šå–消父级勾选时,自动å–消å­çº§å‹¾é€‰æ¡† - fun.loopToSetChildItemCheckbox(inputItemIndex, tmpList, inputTdObject, tmpCheckboxValue); - } - } catch (EXEC_ERR) { - console.error(EXEC_ERR); - } - - break; - } - case 'relationalCheckbox': { - tmpBatchObj = inputTdObject; - if (inputTdObject.checkIsValidToRelate(tmpList[inputItemIndex])) { - fun.clickCheckbox(vm.mainObject.tdList[data.checkboxTdIndex], inputItemIndex, inputPartIndex); - } - break; - } - } - if (tmpIsCheck) { - data.queryLength++; - if (data.queryLength === (vm.list || []).length) { - tmpBatchObj.selectAll = true; - } - } else { - data.queryLength--; - tmpBatchObj.selectAll = false; - } - } else { - const tmpItemActiveKeyValue = tmpList[inputItemIndex][inputTdObject.activeKey]; - if (tmpItemActiveKeyValue === null && !vm.mainObject.setting.isValidToBeNull) return; - if (vm.data.checkboxTdObject.indexAddress[tmpItemActiveKeyValue]) { - vm.data.checkboxTdObject.query.splice(vm.data.checkboxTdObject.query.indexOf(tmpItemActiveKeyValue), 1); - delete vm.data.checkboxTdObject.indexAddress[tmpItemActiveKeyValue]; - vm.data.checkboxTdObject.selectAll = false; - if (vm.mainObject.baseFun.clickCheckbox) { - vm.mainObject.baseFun.clickCheckbox('minus-single', { - targetValue: tmpItemActiveKeyValue, - }); - } - } else { - vm.data.checkboxTdObject.indexAddress[tmpItemActiveKeyValue] = inputTdObject.hasOwnProperty('activeValue') - ? inputTdObject.activeValue - : parseInt(inputItemIndex) + 1; - vm.data.checkboxTdObject.query.push(tmpItemActiveKeyValue); - let tmpQuery = []; - if (vm.mainObject.setting && vm.mainObject.setting.isScrollLoad) { - tmpQuery = vm.otherObject.allQuery.filter((val, key) => { - if (val[inputTdObject.activeKey]) { - return true; - } - return false; - }); - } else { - tmpQuery = vm.list; - } - if (tmpQuery.length === (vm.data.checkboxTdObject.query || []).length) { - vm.data.checkboxTdObject.selectAll = true; - } - if (vm.mainObject.baseFun.clickCheckbox) { - vm.mainObject.baseFun.clickCheckbox('plus-single', { - targetValue: tmpItemActiveKeyValue, - }); - } - } - if (vm.mainObject.baseFun.teardownWhenCheckboxIsClick) { - vm.mainObject.baseFun.teardownWhenCheckboxIsClick(vm.data.checkboxTdObject, tmpList, { - mark: vm.mark, - }); - } - } - }; - vm.fun.moreItemClick = function (inputItem, $event, inputIndex, inputPartIndex) { - $event.stopPropagation(); - switch (inputItem.opr) { - case 'clear': { - vm.list = [angular.copy(vm.mainObject.itemStructure)]; - break; - } - case 'insert_top': { - fun.insertItem({ - item: vm.list[0], - $index: 0, - }); - break; - } - case 'insert_bottom': { - fun.insertItem({ - item: vm.list[0], - $index: vm.list.length, - }); - break; - } - case 'delete': { - fun.deleteItem(inputIndex); - break; - } - case 'addChild': { - fun.addChildItem({ - item: vm.list[inputIndex], - $index: inputIndex, - }); - break; - } - case 'insert_pre': { - fun.insertItem({ - item: vm.list[inputIndex], - $index: inputIndex, - }); - break; - } - case 'insert_next': { - fun.insertItem({ - item: vm.list[inputIndex], - $index: inputIndex + 1, - }); - break; - } - default: { - const tmp = {}; - tmp.btnObject = vm.mainObject.tdList[inputItem.tdKey].btnList[inputItem.btnKey]; - tmp.btnObject = tmp.btnObject.funArr[inputItem.btnFunKey]; - if (tmp.btnObject.fun) { - const inputArg = { - item: vm.list[inputIndex], - $index: inputIndex, - }; - switch (typeof tmp.btnObject.param) { - case 'string': { - eval(`tmp.btnObject.fun(${tmp.btnObject.param})`); - return; - } - default: { - tmp.btnObject.fun(Object.assign(inputArg, tmp.btnObject.param)); - } - } - } - break; - } - } - }; - vm.fun.itemClick = function ($event, inputPartIndex) { - // $event.stopPropagation(); - const tmp = {}; - try { - tmp.point = $event.target.classList[0]; - if ($event.target.classList.value.indexOf('input-checkbox') > -1) { - tmp.point = 'input-checkbox'; - } - } catch (e) { - console.error(e); - tmp.point = 'default'; - } - if (/container-tbd/.test(tmp.point)) return; - if (/^(btn-)|(fbtn-)|(cbtn-)/.test(tmp.point)) { - tmp.itemIndex = parseInt(fun.getTargetIndex($event.target)); - try { - tmp.btnObject = - vm.mainObject.tdList[fun.getTargetIndex($event.target, 'eo-attr-td-index')].btnList[ - fun.getTargetIndex($event.target, 'eo-attr-btn-index') - ] || ''; - } catch (GET_ERR) { - tmp.btnObject = {}; - } - if (!tmp.btnObject.isUnWantToStopPropagation) { - $event.stopPropagation(); - } - if (tmp.point === 'btn-funItem') { - tmp.btnObject = tmp.btnObject.funArr[fun.getTargetIndex($event.target, 'eo-attr-btn-fun-index')]; - } - if (tmp.btnObject.fun) { - const inputArg = { - item: vm.list[tmp.itemIndex], - $index: tmp.itemIndex, - }; - if (/^(fbtn-)/.test(tmp.point)) { - inputArg.callback = vm.fun.watchFormLastChange; - } - switch (typeof tmp.btnObject.param) { - case 'string': { - eval(`tmp.btnObject.fun(${tmp.btnObject.param})`); - return; - } - default: { - tmp.btnObject.fun(Object.assign(inputArg, tmp.btnObject.param)); - return; - } - } - } - switch (tmp.point) { - case 'btn-delete': - case 'cbtn-delete': { - fun.deleteItem(tmp.itemIndex); - break; - } - case 'btn-addChild': { - fun.addChildItem({ - item: vm.list[tmp.itemIndex], - $index: tmp.itemIndex, - }); - break; - } - case 'btn-insert': { - fun.insertItem({ - item: vm.list[tmp.itemIndex], - $index: tmp.itemIndex, - }); - break; - } - } - } else { - $event.stopPropagation(); - if (data.checkboxClickAffectTotalItem && vm.data.checkboxTdObject.isOperating) { - tmp.point = 'input-checkbox'; - } else if (data.radioClickAffectTotalItem) { - tmp.point = 'input-radio'; - } - switch (tmp.point) { - case 'input-checkbox': { - let tmpTdIndex; - if (typeof data.checkboxTdIndex === 'string') { - tmpTdIndex = data.checkboxTdIndex; - } else { - tmpTdIndex = fun.getTargetIndex($event.target, 'eo-attr-td-index'); - } - fun.clickCheckbox(vm.mainObject.tdList[tmpTdIndex], fun.getTargetIndex($event.target), inputPartIndex); - break; - } - case 'relational-checkbox': { - fun.clickCheckbox( - vm.mainObject.tdList[data.relationalCheckboxTdIndex], - fun.getTargetIndex($event.target), - inputPartIndex - ); - break; - } - case 'input-radio': { - tmp.tdObject = vm.mainObject.tdList[data.radioTdIndex]; - tmp.itemIndex = fun.getTargetIndex($event.target); - if (tmp.tdObject.disabledModelKey && vm.list[tmp.itemIndex][tmp.tdObject.disabledModelKey]) { - return; - } - if (tmp.tdObject.modelKey) { - if ( - (data.radioOriginalIndex || 0).toString() === tmp.itemIndex && - tmp.tdObject.isCanBeCancle && - vm.list[data.radioOriginalIndex][tmp.tdObject.modelKey] - ) { - vm.list[tmp.itemIndex][tmp.tdObject.modelKey] = !vm.list[tmp.itemIndex][tmp.tdObject.modelKey]; - data.radioOriginalIndex = 0; - } else { - if (vm.list[data.radioOriginalIndex] && vm.list[data.radioOriginalIndex][tmp.tdObject.modelKey]) - vm.list[data.radioOriginalIndex][tmp.tdObject.modelKey] = false; - else { - for (const key in vm.list) { - const tmpItem = vm.list[key]; - if (tmpItem[tmp.tdObject.modelKey]) { - tmpItem[tmp.tdObject.modelKey] = false; - break; - } - } - } - vm.list[tmp.itemIndex][tmp.tdObject.modelKey] = true; - data.radioOriginalIndex = tmp.itemIndex; - } - } else { - const tmpItemActiveKeyValue = vm.list[tmp.itemIndex][tmp.tdObject.activeKey]; - if (tmpItemActiveKeyValue === null) return; - vm.data.checkboxTdObject.indexAddress = {}; - vm.data.checkboxTdObject.query = []; - if ((data.radioOriginalIndex || 0).toString() === tmp.itemIndex && tmp.tdObject.isCanBeCancle) { - data.radioOriginalIndex = 0; - } else { - vm.data.checkboxTdObject.query.push(tmpItemActiveKeyValue); - vm.data.checkboxTdObject.indexAddress[tmpItemActiveKeyValue] = 1; - data.radioOriginalIndex = tmp.itemIndex; - } - } - break; - } - } - if (!vm.data.checkboxTdObject.isOperating && vm.mainObject.baseFun.trClick) { - tmp.itemIndex = parseInt(fun.getTargetIndex($event.target)); - vm.mainObject.baseFun.trClick({ - item: vm.list[tmp.itemIndex], - $index: tmp.itemIndex, - }); - } - } - }; - vm.fun.selectAll = function (inputTdIndex) { - const tmpTdObj = vm.mainObject.tdList[inputTdIndex]; - const tmpBatchObj = - tmpTdObj.type === 'checkbox' && tmpTdObj.isWantedToExposeObject ? vm.data.checkboxTdObject : tmpTdObj; - const tmpAuthority = tmpTdObj.authority; - if (tmpAuthority && !vm.authorityObject[tmpAuthority]) return; - const tmp = { - modelKey: tmpTdObj.modelKey, - activeKey: tmpTdObj.activeKey, - }; - tmpBatchObj.selectAll = !tmpBatchObj.selectAll; - switch (tmpTdObj.type) { - case 'relationalCheckbox': { - if (tmpTdObj.checkIsValidToRelateAll(tmpBatchObj.selectAll)) { - vm.fun.selectAll(data.checkboxTdIndex); - } - } - } - if (vm.mainObject.baseFun && vm.mainObject.baseFun.selectAll) { - vm.mainObject.baseFun.selectAll(vm.data.checkboxTdObject.selectAll); - return; - } - if (tmp.modelKey) { - if (!tmpBatchObj.selectAll) { - if (vm.list.length === 1 && vm.mainObject.setting.isStaticFirstIndex) { - tmpBatchObj.selectAll = true; - return; - } - } - let tmpIsHadDisabledKeyLength = 0; - for (const key in vm.list) { - if ( - (vm.mainObject.setting.isStaticFirstIndex && key === '0') || - (vm.mainObject.setting.disabledSelectModelKey && - vm.list[key][vm.mainObject.setting.disabledSelectModelKey] === vm.mainObject.setting.disabledSelectVal) - ) { - tmpIsHadDisabledKeyLength++; - continue; - } - if ( - tmpTdObj.checkIsValidItem && - !tmpTdObj.checkIsValidItem({ - item: vm.list[key], - }) - ) - continue; - let tmpValue = tmpBatchObj.selectAll; - if (tmpTdObj.modelValueArr) { - tmpValue = tmpBatchObj.selectAll ? tmpTdObj.modelValueArr[1] : tmpTdObj.modelValueArr[0]; - } - vm.list[key][tmp.modelKey] = tmpValue; - } - data.queryLength = tmpBatchObj.selectAll ? (vm.list || []).length : 0; - if (tmpTdObj.type === 'relationalCheckbox') return; - if (vm.mainObject.baseFun.clickCheckbox) { - vm.mainObject.baseFun.clickCheckbox(`${tmpBatchObj.selectAll ? 'plus' : 'minus'}-all`); - } - } else { - const tmpIndexAddress = vm.data.checkboxTdObject.indexAddress; - const tmpOldListLength = vm.data.checkboxTdObject.query.length; - if (!vm.data.checkboxTdObject.selectAll) { - let tmpQuery = []; - if (vm.mainObject.setting && vm.mainObject.setting.isScrollLoad) { - tmpQuery = vm.otherObject.allQuery; - } else { - tmpQuery = vm.list; - } - for (let i = 0; i < vm.data.checkboxTdObject.query.length; ) { - const activeID = vm.data.checkboxTdObject.query[i]; - if ( - vm.mainObject.baseFun.checkIsValidItem && - !vm.mainObject.baseFun.checkIsValidItem({ - item: tmpQuery[ - tmpQuery.findIndex((listItem) => { - return listItem[tmp.activeKey] === activeID; - }) - ], - indexAddress: tmpIndexAddress, - isSelectAll: true, - }) - ) { - i++; - continue; - } - delete vm.data.checkboxTdObject.indexAddress[activeID]; - vm.data.checkboxTdObject.query.splice(i, 1); - } - if (vm.mainObject.baseFun.cancelToSelectAll) { - vm.mainObject.baseFun.cancelToSelectAll(); - } else if (vm.mainObject.baseFun.clickCheckbox) { - vm.mainObject.baseFun.clickCheckbox('minus-all', { - oldLength: tmpOldListLength, - }); - } - } else { - vm.data.checkboxTdObject.query.splice(0, vm.data.checkboxTdObject.query.length); - if (vm.mainObject.setting.disabledSelectModelKey) { - for (const key in vm.list) { - if ( - vm.list[key][vm.mainObject.setting.disabledSelectModelKey] !== vm.mainObject.setting.disabledSelectVal - ) { - vm.data.checkboxTdObject.query.push(vm.list[key][tmp.activeKey]); - vm.data.checkboxTdObject.indexAddress[vm.list[key][tmp.activeKey]] = tmpTdObj.hasOwnProperty( - 'activeValue' - ) - ? tmpTdObj.activeValue - : parseInt(key) + 1; - } - } - } else { - let tmpQuery = []; - if (vm.mainObject.setting && vm.mainObject.setting.isScrollLoad) { - tmpQuery = vm.otherObject.allQuery; - } else { - tmpQuery = vm.list; - } - for (const key in tmpQuery) { - if ( - tmpQuery[key][tmp.activeKey] === null || - (vm.mainObject.baseFun.checkIsValidItem && - !vm.mainObject.baseFun.checkIsValidItem({ - item: tmpQuery[key], - indexAddress: tmpIndexAddress, - isSelectAll: true, - })) - ) - continue; - vm.data.checkboxTdObject.query.push(tmpQuery[key][tmp.activeKey]); - vm.data.checkboxTdObject.indexAddress[tmpQuery[key][tmp.activeKey]] = tmpTdObj.hasOwnProperty('activeValue') - ? tmpTdObj.activeValue - : parseInt(key) + 1; - } - } - if (vm.mainObject.baseFun.clickCheckbox) { - vm.mainObject.baseFun.clickCheckbox('plus-all', { - oldLength: tmpOldListLength, - currentLenght: vm.data.checkboxTdObject.query.length, - }); - } - } - if (vm.mainObject.baseFun.teardownWhenCheckboxIsClick) { - vm.mainObject.baseFun.teardownWhenCheckboxIsClick(vm.data.checkboxTdObject, vm.list, { - mark: vm.mark, - }); - } - } - }; - fun.getLastItemIndex = function (inputIndex, inputArray) { - let key = inputIndex + 1; - while (key < inputArray.length) { - if ((inputArray[inputIndex].listDepth || 0) >= (inputArray[key].listDepth || 0)) { - return key; - } - key++; - } - return key; - }; - fun.checkIsLastItem = function (inputIndex, inputArray) { - let key = inputIndex + 1; - while (key < inputArray.length) { - if (inputArray[inputIndex].listDepth === inputArray[key].listDepth) { - return false; - } else if (inputArray[inputIndex].listDepth > inputArray[key].listDepth) { - return key; - } - key++; - } - return key; - }; - // ç›‘å¬ åˆ—è¡¨é¡¹ change触å‘事件 - vm.fun.watchFormLastChange = function (inputArg, callback) { - if (!(vm.mainObject.setting && vm.mainObject.setting.munalAddRow) && !inputArg.item.cancleAutomaticAddRow) { - if (vm.data.isDepth) { - if (!(vm.mainObject.setting.munalHideOperateColumn && inputArg.$index === 0)) { - // 判断å­é›†æ˜¯å¦å’ŒArrItem结构,是的è¯æ›´æ–°Itemåå­— - if (fun.checkCurChildListIsArrItems(inputArg.$index, vm.list)) { - fun.updateItemsByParentIdx(inputArg.$index, vm.list); - } - // ArrItem ä¸å†æ–°å¢žåŒçº§å­é¡¹ - if (!inputArg.item.isArrItem) { - const tmpIndex = fun.checkIsLastItem(inputArg.$index, vm.list); - if ( - tmpIndex !== false && - (!vm.mainObject.setting.illegalAutomaticAddRowModelKey || - (vm.mainObject.setting.illegalAutomaticAddRowModelKey && - !inputArg.item.hasOwnProperty(vm.mainObject.setting.illegalAutomaticAddRowModelKey))) - ) { - vm.list.splice( - tmpIndex, - 0, - Object.assign( - {}, - { - listDepth: inputArg.item.listDepth, - }, - vm.mainObject.itemStructure - ) - ); - } - } - } - } else if (inputArg.$index === vm.list.length - 1) { - vm.list.splice( - inputArg.$index + 1, - 0, - Object.assign( - {}, - { - listDepth: inputArg.item.listDepth, - }, - vm.mainObject.itemStructure - ) - ); - } - } - if (vm.mainObject.baseFun && vm.mainObject.baseFun.watchFormLastChange) { - vm.mainObject.baseFun.watchFormLastChange(inputArg); - } - if (callback) { - callback(inputArg); - } - }; - $scope.importFile = function (inputArg, inputEvent) { - console.log('importFile'); - inputArg.$index = this.$parent.$index; - inputArg.item = vm.list[inputArg.$index]; - vm.mainObject.baseFun.importFile(inputArg); - // if (inputEvent) inputEvent.value = ''; - ($scope.$root && $scope.$root.$$phase) || $scope.$apply(); - }; - /** - * @desc 过滤列表函数 - */ - vm.fun.filterCallback = (inputMark, inputFilterActiveObj) => { - vm.filterActiveObj[inputMark] = angular.copy(inputFilterActiveObj); - vm.mainObject.baseFun.filter(vm.filterActiveObj, vm.list); - }; - vm.fun.shrinkList = function ($event) { - $event.stopPropagation(); - const tmp = {}; - tmp.targetDom = fun.getTargetEvent($event.target); - tmp.itemIndex = fun.getTargetIndex($event.target); - vm.list[tmp.itemIndex].isShrink = !vm.list[tmp.itemIndex].isShrink; - fun.operateLevel( - vm.list[tmp.itemIndex].isShrink ? 'shrink' : 'spreed', - vm.list[tmp.itemIndex].listDepth, - parseInt(tmp.itemIndex) + 1 - ); - }; - vm.fun.range = function (inputLength, inputObject) { - inputLength = inputLength || 1; - if ( - !vm.list[inputObject.$index + 1] || - (vm.list[inputObject.$index + 1].listDepth || 0) <= (inputObject.item.listDepth || 0) - ) - inputLength--; - return new Array(inputLength); - }; - vm.fun.sortMouseDown = function ($event, inputIndex) { - if (vm.mainObject.setting.unsortableVar && vm.otherObject && vm.otherObject[vm.mainObject.setting.unsortableVar]) - return; - data.mouseEventElem = angular.element($event.target); - data.mouseEventElem.bind('mousemove', () => { - vm.data.movePart = inputIndex; - }); - }; - vm.fun.mouseUp = function () { - if (data.mouseEventElem) data.mouseEventElem.unbind('mousemove'); - data.movePart = vm.data.movePart; - vm.data.movePart = null; - }; - vm.fun.sortCallback = (inputMark) => { - vm.mainObject.baseFun.automaticSort(inputMark, vm.list, (callback) => { - if (callback) { - vm.list = callback; - } - }); - }; - fun.operateLevel = function (type, inputDepth, inputIndex) { - let tmpShrinkArr = []; - for (let itemIndex = inputIndex; itemIndex < vm.list.length; itemIndex++) { - if (inputDepth >= vm.list[itemIndex].listDepth) break; - switch (type) { - case 'shrink': { - vm.list[itemIndex].isHide = true; - break; - } - case 'spreed': { - const tmpParentShrinkObject = vm.list[(tmpShrinkArr[0] || {}).index || inputIndex - 1 || 0]; - if (vm.list[itemIndex].listDepth <= tmpParentShrinkObject.listDepth) { - const tmpNewShrinkArr = angular.copy(tmpShrinkArr); - for (const shrinkIndexObj of tmpShrinkArr) { - if (shrinkIndexObj.depth < vm.list[itemIndex].listDepth) break; - tmpNewShrinkArr.shift(); - } - tmpShrinkArr = tmpNewShrinkArr; - if (vm.list[itemIndex].listDepth === tmpParentShrinkObject.listDepth) { - itemIndex--; - continue; - } - vm.list[itemIndex].isHide = false; - } else if (!tmpParentShrinkObject.isShrink) { - vm.list[itemIndex].isHide = false; - } - if (vm.list[itemIndex].isShrink) { - tmpShrinkArr.unshift({ - index: itemIndex, - depth: vm.list[itemIndex].listDepth, - key: vm.list[itemIndex].paramKey, - }); - } - break; - } - } - } - }; - fun.parseFloatBtnGroupHtml = function (inputWhich, inputIndex, inputArray, inputExpression) { - let tmpOutputHtml = ''; - if (inputArray) { - tmpOutputHtml += `
`; - for (const btnKey in inputArray) { - const btnVal = inputArray[btnKey]; - tmpOutputHtml += ``; - } - tmpOutputHtml += '
'; - } - return tmpOutputHtml; - }; - /** - * @TODOS ListDepth - */ - fun.initItemHtml = function (inputVal, inputKey) { - let tmpHtml = ''; - let tmpThHtml = ''; - let tmpSortAndFilterHtml = ''; - let tmpDragThHtml = ''; - let tmpFilterItemExpression; - let tmpThFilterItemExpression; - inputVal.blockDefinedClass = inputVal.class || ''; - if (vm.mainObject.setting.draggable || inputVal.mark) { - inputVal.draggableMainObject = Object.assign( - {}, - vm.mainObject.setting.draggableMainObject, - CONFIG.draggableMainObject, - { - mark: inputVal.mark, - } - ); - let addWidthExpression = []; - switch (inputVal.type) { - case 'text': - case 'depthText': - case 'depthHtml': - case 'html': { - addWidthExpression = ['itemExpression']; - break; - } - case 'autoCompleteAndFile': - case 'checkbox': - case 'select': { - addWidthExpression = ['thItemExpression', 'itemExpression']; - break; - } - case 'depthInput': { - addWidthExpression = ['thItemExpression', 'tdItemExpression']; - break; - } - case 'input': - case 'autoComplete': { - addWidthExpression = ['tdItemExpression']; - break; - } - } - addWidthExpression.forEach((expressionName) => { - inputVal[expressionName] = inputVal[expressionName] || ''; - inputVal[expressionName] += `${ - vm.mainObject.setting.draggable ? `ng-style="{width:$ctrl.data.dragCacheObj['${inputVal.mark}']}"` : '' - }`; - }); - if (!inputVal.undivide && inputVal.mark) { - tmpDragThHtml = ` `; - } - inputVal.blockDefinedClass += `${inputVal.mark ? ` th_drag_${inputKey}_lbcc po_re` : ''}`; - } - if (!vm.mainObject.setting.hideFilter && !inputVal.static && inputVal.thKey && !/^ -1) { - if (/(ng-if=")([^"]+)(")/.test(inputVal.thItemExpression)) { - inputVal.thItemExpression = inputVal.thItemExpression.replace( - /(ng-if=")([^"]+)(")/, - `$1$2&&$ctrl.data.bodyTabBlockObj.indexAddress['${tmpVal}']$3` - ); - } else { - inputVal.thItemExpression = `${ - inputVal.thItemExpression || '' - }ng-if="$ctrl.data.bodyTabBlockObj.indexAddress['${tmpVal}']"`; - } - inputVal.tdItemExpression = inputVal.tdItemExpression.replace( - /(ng-if=")([^"]+)(")/, - `$1$2&&$ctrl.data.bodyTabBlockObj.indexAddress['${tmpVal}']$3` - ); - } else if ( - ['checkbox', 'text', 'html'].indexOf(inputVal.type) > -1 && - inputVal.itemExpression && - inputVal.itemExpression.indexOf('ng-if') > -1 - ) { - if (/(ng-if=")([^"]+)(")/.test(inputVal.thItemExpression)) { - inputVal.thItemExpression = inputVal.thItemExpression.replace( - /(ng-if=")([^"]+)(")/, - `$1$2&&$ctrl.data.bodyTabBlockObj.indexAddress['${tmpVal}']$3` - ); - } else { - inputVal.thItemExpression = `${ - inputVal.thItemExpression || '' - }ng-if="$ctrl.data.bodyTabBlockObj.indexAddress['${tmpVal}']"`; - } - inputVal.itemExpression = inputVal.itemExpression.replace( - /(ng-if=")([^"]+)(")/, - `$1$2&&$ctrl.data.bodyTabBlockObj.indexAddress['${tmpVal}']$3` - ); - } else { - tmpFilterItemExpression = `ng-if="$ctrl.data.bodyTabBlockObj.indexAddress['${tmpVal}']"`; - } - } - if (inputVal.sortAndFilterConf) { - tmpSortAndFilterHtml = `${ - inputVal.sortAndFilterConf - ? `` - : '' - }`; - } - if (inputVal.undivide) { - inputVal.blockDefinedClass += ' undivide_line_lbcc'; - } - switch (inputVal.type) { - case 'depthText': { - vm.data.isDepth = true; - tmpThHtml += `
${inputVal.thKey}
`; - tmpHtml += - `${ - '
' + - '
' + - '' + - '' + - '{{item.' - }${inputVal.modelKey}}}` + - '
' + - '
'; - break; - } - case 'depthHtml': { - vm.data.isDepth = true; - tmpThHtml += `
${ - inputVal.thKey - }${tmpDragThHtml}
`; - tmpHtml += - `${ - `
` + - '
' + - '' + - '' - }${inputVal.html}
` + '
'; - break; - } - case 'depthInput': { - vm.data.isEditTable = true; - vm.data.isDepth = true; - tmpThHtml += `
${ - inputVal.thKey - }${tmpDragThHtml}
`; - tmpHtml += - `
` + - `
` + - '' + - '' + - `` + - `

${ - inputVal.errorTipHtml ? inputVal.errorTipHtml : inputVal.errorTip || `请填写${inputVal.thKey}` - }

` + - `
${fun.parseFloatBtnGroupHtml( - 'input', - inputKey, - inputVal.btnList, - " ng-style=\"{'left':(5+15*item.listDepth+($ctrl.data.shrinkBtnLength?25:0))+'px','width':'calc(100% - '+(20+15*item.listDepth+($ctrl.data.shrinkBtnLength?25:0))+'px)'}\"" - )}
`; - break; - } - case 'thHtml': { - tmpThHtml += `
${inputVal.thHtml}
`; - tmpHtml += `
{{item.${inputVal.modelKey}}}
`; - break; - } - case 'html': { - // æ­£åˆ™åŒ¹é… hover 时需è¦å±•ç¤ºçš„ title - // const commonTitleReg = /^\{\{item.*\}\}$/; - // let extractTitle = ''; - // const tmpHtml = inputVal.html; - // console.log(commonTitleReg.test(inputVal.html), inputVal.html); - // if (commonTitleReg.test(inputVal.html)) { - // extractTitle = inputVal.html; - // } else { - // extractTitle = ''; - // } - - tmpThHtml += `
${ - inputVal.thKey - } - ${tmpDragThHtml}${tmpSortAndFilterHtml} -
`; - if (typeof inputVal.html === 'string') { - tmpHtml += `
${inputVal.html.replace( - /eoPlaceholderIndex/g, - inputKey - )}
`; - } else if (inputVal.html) { - tmpHtml = []; - for (const key in inputVal.html) { - tmpHtml.push(`
${inputVal.html[key]}
`); - } - } - - break; - } - case 'text': { - tmpThHtml += `
${ - inputVal.thKey || '' - }${tmpDragThHtml}
`; - if (typeof inputVal.modelKey === 'string') { - tmpHtml += `
{{item.${inputVal.modelKey}}}
`; - } else if (inputVal.modelKey) { - tmpHtml = []; - for (const key in inputVal.modelKey) { - tmpHtml.push( - `
{{item.${ - inputVal.modelKey[key] - }}}
` - ); - } - } - break; - } - case 'sort': { - vm.data.sort = true; - vm.data.sortAuthorityVar = inputVal.authority || ''; - tmpThHtml += `
${inputVal.thKey || ''}${tmpSortAndFilterHtml || ''}
`; - tmpHtml += `
`; - break; - } - case 'radio': { - data.radioClickAffectTotalItem = inputVal.radioClickAffectTotalItem || false; - data.radioOriginalIndex = vm.mainObject.setting.radioOriginalType || 0; - data.radioTdIndex = inputKey; - if (inputVal.isWantedToExposeObject) { - // 是å¦å¸Œæœ›ç»‘定/暴露内置å˜é‡ - vm.data.checkboxTdObject = vm.activeObject = Object.assign({}, vm.data.checkboxTdObject, vm.activeObject); - } - tmpThHtml += `
${inputVal.thKey}
`; - tmpHtml += `
${ - inputVal.modelKey - ? `{{item.${inputVal.modelKey}?"":""}}` - : `{{$ctrl.data.checkboxTdObject.indexAddress[item.${inputVal.activeKey}]?"":""}}` - }
`; - // tmpHtml += '
{{item.' + inputVal.modelKey + '?"":""}}
'; - break; - } - case 'relationalCheckbox': { - // 关系型checkbox - data.relationalCheckboxTdIndex = inputKey; - // $rootScope.global.$watch.push($scope.$watch('$ctrl.list', fun.watchRelationalCheckboxChange, true)); - $scope.$watch('$ctrl.list', fun.watchRelationalCheckboxChange, true); - const tmpAuthorityHtml = inputVal.authority - ? `ng-class="{'disable-checkbox':!$ctrl.authorityObject.${inputVal.authority}}" ` - : ''; - tmpThHtml += `
{{$ctrl.mainObject.tdList[${inputKey}].selectAll?"":" "}}${ - inputVal.thKey ? `${inputVal.thKey}` : '' - }
`; - tmpHtml += `
{{item.${inputVal.modelKey}?"":""}}
`; - break; - } - case 'checkbox': { - data.checkboxClickAffectTotalItem = inputVal.checkboxClickAffectTotalItem || false; - if (data.checkboxTdIndex !== undefined) { - switch (typeof data.checkboxTdIndex) { - case 'string': { - data.checkboxTdIndex = [data.checkboxTdIndex, inputKey]; - break; - } - default: { - data.checkboxTdIndex.push(inputKey); - break; - } - } - } else { - data.checkboxTdIndex = inputKey; - } - if (inputVal.wantToWatchListLength) { - // $rootScope.global.$watch.push($scope.$watch('$ctrl.list.length', fun.watchCheckboxChange, true)); - $scope.$watch('$ctrl.list.length', fun.watchCheckboxChange, true); - } - if (inputVal.modelKey) { - // $rootScope.global.$watch.push($scope.$watch('$ctrl.list', fun.watchCheckboxChange, true)); - $scope.$watch('$ctrl.list', fun.watchCheckboxChange, true); - } - let tmpSelectAllStr; - if (inputVal.isWantedToExposeObject) { - // 是å¦å¸Œæœ›ç»‘定/暴露内置å˜é‡ - // $rootScope.global.$watch.push($scope.$watch('$ctrl.data.checkboxTdObject.isOperating', fun.watchCheckboxChange)); - $scope.$watch('$ctrl.data.checkboxTdObject.isOperating', fun.watchCheckboxChange); - vm.data.checkboxTdObject = vm.activeObject = Object.assign({}, vm.data.checkboxTdObject, vm.activeObject); - tmpSelectAllStr = '{{$ctrl.data.checkboxTdObject.selectAll?"":" "}}'; - } else { - tmpSelectAllStr = `{{$ctrl.mainObject.tdList[${inputKey}].selectAll?"":" "}}`; - } - vm.data.checkboxTdObject.isOperating = vm.data.checkboxTdObject.hasOwnProperty('isOperating') - ? vm.data.checkboxTdObject.isOperating - : true; - var tmpAuthorityHtml = - inputVal.authority || inputVal.itemDisabledExpression - ? `ng-class="${ - inputVal.itemDisabledExpression && inputVal.itemDisabledExpression.indexOf('input-checkbox') > -1 - ? inputVal.itemDisabledExpression - : `{'disable-checkbox':${inputVal.authority ? `!$ctrl.authorityObject.${inputVal.authority}||` : ''}${ - inputVal.itemDisabledExpression - }}` - }"` - : ''; - tmpThHtml += `
${ - inputVal.hideSelectAll - ? '' - : `${tmpSelectAllStr}` - }${ - inputVal.thKey - ? `${ - inputVal.thKey - }` - : '' - }${tmpDragThHtml}
`; - tmpHtml += `
- ${ - inputVal.modelKey - ? `{{${ - inputVal.modelValueArr - ? `item.${inputVal.modelKey}===${ - typeof inputVal.modelValueArr[1] === 'string' - ? `"${inputVal.modelValueArr[1]}"` - : inputVal.modelValueArr[1] - }` - : `item.${inputVal.modelKey}` - }?"":""}}` - : `{{$ctrl.data.checkboxTdObject.indexAddress[item.${inputVal.activeKey}]?"":""}}` - }
`; - break; - } - case 'cbtn': - case 'btn': { - if (inputVal.isDropMenu) { - if (inputVal.defaultConf) { - inputVal.thKey = ``; - } else { - inputVal.thKey = ' '; - } - } - tmpThHtml += `
${inputVal.thKey || vm.listBlockVarible.operate}
`; - tmpHtml += `
`; - for (const btnKey in inputVal.btnList) { - const btnVal = inputVal.btnList[btnKey]; - switch (btnVal.type) { - case 'more': { - vm.data.moreBtnObj[`${inputKey}_${btnKey}`] = []; - for (const btnFunKey in btnVal.funArr) { - const btnFunVal = btnVal.funArr[btnFunKey]; - const tmpItem = { - key: btnFunVal.key, - btnKey, - tdKey: inputKey, - btnFunKey, - expression: btnFunVal.itemExpression, - opr: btnFunVal.operateName, - }; - vm.data.moreBtnObj[`${inputKey}_${btnKey}`].push(tmpItem); - } - tmpHtml += - `
` + - `
`; - break; - } - case 'html': { - tmpHtml += `
${ - btnVal.html - }
`; - break; - } - default: { - tmpHtml += ``; - break; - } - } - } - tmpHtml += '
'; - break; - } - case 'selectMulti': { - vm.data.isEditTable = true; - tmpThHtml += `
${inputVal.thKey}
`; - tmpHtml += `
`; - break; - } - case 'select': { - vm.data.isEditTable = true; - if (vm.mainObject.setting && vm.mainObject.setting.draggableWithSelect) { - inputVal.mainObj = inputVal.mainObj || { - isNeedToResetPosition: true, - }; - } - tmpThHtml += `
${inputVal.thKey}${tmpDragThHtml}
`; - tmpHtml += `
${inputVal.leftHtml || ''}
`; - break; - } - case 'input': { - vm.data.isEditTable = true; - tmpThHtml += `
${ - inputVal.thKey - } ${tmpDragThHtml}
`; - tmpHtml += - `
` + - `` + - `

${ - inputVal.errorTipHtml - ? inputVal.errorTipHtml - : inputVal.errorTip || `请填写${inputVal.thKey.indexOf(' -1 ? '内容' : inputVal.thKey}` - }

${fun.parseFloatBtnGroupHtml('input', inputKey, inputVal.btnList)}
`; - break; - } - case 'autoComplete': { - vm.data.isEditTable = true; - if (vm.mainObject.setting && vm.mainObject.setting.draggableWithSelect) { - inputVal.setting = inputVal.setting || { - isNeedToResetPosition: true, - }; - } - tmpThHtml += `
${ - inputVal.thKey - } ${tmpDragThHtml}
`; - tmpHtml += `${ - `
` + - `` + - `

${ - inputVal.errorTipHtml ? inputVal.errorTipHtml : inputVal.errorTip || `请填写${inputVal.thKey}` - }

` - }${fun.parseFloatBtnGroupHtml('acp', inputKey, inputVal.btnList)}
`; - break; - } - case 'autoCompleteAndFile': { - vm.data.isEditTable = true; - let tmpFileInputHtml = ''; - const tmpFilePlaceholder = inputVal.filePlaceholder || vm.listBlockVarible.fileBtnText; - const tmpFileBtnText = inputVal.fileBtnText || vm.listBlockVarible.fileBtnText; - if (vm.mainObject.setting && vm.mainObject.setting.draggableWithSelect) { - inputVal.setting = inputVal.setting || { - isNeedToResetPosition: true, - }; - } - if (inputVal.munalDefineFileFun) { - tmpFileInputHtml = - `` + - ``; - } else { - tmpFileInputHtml = - `` + - '' + - ``; - } - tmpThHtml += `
${ - inputVal.thKey - } ${tmpDragThHtml}
`; - tmpHtml += - `
` + - `
${tmpFileInputHtml}
` + - `
${fun.parseFloatBtnGroupHtml( - 'acp', - inputKey, - inputVal.btnList - )}
`; - break; - } - default: - break; - } - return { - thHtml: tmpThHtml.replace('$_filter_expression', tmpFilterItemExpression || ''), - tdHtml: tmpHtml.replace('$_filter_expression', tmpFilterItemExpression || ''), - }; - }; - fun.initHtml = function () { - vm.data.TAB_BLOCK_LIST_ARR = []; - const tmp = { - html: '', - thHtml: '', - }; - let tmpStaticHtml = '
'; - try { - tmpStaticHtml = tmpStaticHtml - .replace('{{trClass}}', vm.mainObject.setting.trClass || '') - .replace('{{trNgClass}}', vm.mainObject.setting.trNgClass || '') - .replace('{{trDirective}}', vm.mainObject.setting.trDirective || ''); - } catch (REPLACE_ERR) { - console.error(REPLACE_ERR); - } - for (const key in vm.mainObject.tdList) { - const val = vm.mainObject.tdList[key]; - const tmpHtmlObject = fun.initItemHtml(val, key); - // console.log(val, key); - tmp.thHtml += tmpHtmlObject.thHtml.replace('{{class}}', val.blockDefinedClass || ''); - tmpStaticHtml += tmpHtmlObject.tdHtml - .replace('{{class}}', val.blockDefinedClass || '') - .replace('{{placeholder}}', val.placeholder ? `placeholder="${val.placeholder.trim()}"` : ''); - } - tmp.html = `${ - vm.mainObject.setting.isForm - ? `` - : `
` - }${ - vm.mainObject.setting.blankTips - ? `
${vm.mainObject.setting.blankTips}
` - : '' - }
`; - try { - tmp.html = tmp.html.replace('{{trExpression}}', vm.mainObject.setting.trExpression || ''); - } catch (REPLACE_ERR) { - console.error(REPLACE_ERR); - } - if (vm.mainObject.setting.draggable && !vm.mainObject.setting.hideLastDragTh) { - tmp.thHtml += '
'; - tmpStaticHtml += '
'; - } - tmp.html += `${(vm.mainObject.extraTrHtml || '') + tmpStaticHtml}
${ - vm.mainObject.setting.isForm ? '
' : '
' - }`; - vm.data.thHtml = tmp.thHtml; - vm.data.html = tmp.html; - }; - privateFun.init = () => { - if (vm.mainObject && vm.mainObject.tdList) { - vm.mainObject.setting = vm.mainObject.setting || {}; - vm.mainObject.baseFun = vm.mainObject.baseFun || {}; - if (vm.mainObject.setting.draggable) { - try { - const tmpOriginDragCacheObj = {}; - vm.mainObject.tdList.forEach((val) => { - if (val.mark) { - tmpOriginDragCacheObj[val.mark] = - (typeof val.width === 'string' ? val.width : `${val.width}px`) || '150px'; - } - }); - vm.data.dragCacheObj = Object.assign( - {}, - tmpOriginDragCacheObj, - JSON.parse( - window.localStorage.getItem( - vm.mainObject.setting.dragCacheVar || - `${window.location.pathname.toUpperCase().replace(/\./g, '_')}_LIST_DRAG_VAR` - ) - ) || {} - ); - for (const key in vm.data.dragCacheObj) { - if (vm.data.dragCacheObj[key] === '0px') { - vm.data.dragCacheObj[key] = tmpOriginDragCacheObj[key]; - } - } - } catch (JSON_PARSE_ERROR) { - console.error(JSON_PARSE_ERROR); - } - } - fun.initHtml(); - } - }; - vm.$onInit = function () { - if ( - vm.mainObject.setting && - (vm.mainObject.setting.dragCacheVar || vm.mainObject.setting.filterStorageVar) && - !vm.mainObject.setting.disableToSetFilter - ) { - vm.data.filterStorageKey = - vm.mainObject.setting.filterStorageVar || - (vm.mainObject.setting.dragCacheVar || '').replace('DRAG_VAR', 'FILTER_TAB_BLOCK_LIST') || - `${window.location.pathname.toUpperCase().replace(/\./g, '_')}_FILTER_TAB_BLOCK_LIST`; - try { - vm.data.bodyTabBlockObj.indexAddress = Object.assign( - {}, - JSON.parse(window.localStorage.getItem(vm.data.filterStorageKey) || undefined), - vm.data.bodyTabBlockObj.indexAddress - ); - data.isAlreadyInitFilter = false; - } catch (JSON_ERR) {} - } else { - vm.mainObject.setting = Object.assign( - {}, - { - hideFilter: true, - }, - vm.mainObject.setting - ); - } - if (vm.mainObject.setting && vm.mainObject.setting.isChangeColumn) { - // $rootScope.global.$watch.push($scope.$watch('$ctrl.mainObject.tdList', privateFun.init)); - $scope.$watch('$ctrl.mainObject.tdList', privateFun.init); - } else if (vm.mainObject.setting && vm.mainObject.setting.isWatchTdListLength) { - // $rootScope.global.$watch.push($scope.$watch('$ctrl.mainObject.tdList.length', privateFun.init)); - $scope.$watch('$ctrl.mainObject.tdList.length', privateFun.init); - } else { - privateFun.init(); - } - // $rootScope.global.$watch.push($scope.$watch('(!$ctrl.data.sort)||($ctrl.data.sortAuthorityVar&&!$ctrl.authorityObject[$ctrl.data.sortAuthorityVar])||($ctrl.mainObject.setting.unsortableVar&&$ctrl.otherObject[$ctrl.mainObject.setting.unsortableVar])', () => { - // vm.data.isSortDisabled = (!vm.data.sort) || (vm.data.sortAuthorityVar && !vm.authorityObject[vm.data.sortAuthorityVar]) || (vm.mainObject.setting.unsortableVar && vm.otherObject[vm.mainObject.setting.unsortableVar]); - // })); - $scope.$watch( - '(!$ctrl.data.sort)||($ctrl.data.sortAuthorityVar&&!$ctrl.authorityObject[$ctrl.data.sortAuthorityVar])||($ctrl.mainObject.setting.unsortableVar&&$ctrl.otherObject[$ctrl.mainObject.setting.unsortableVar])', - () => { - vm.data.isSortDisabled = - !vm.data.sort || - (vm.data.sortAuthorityVar && !vm.authorityObject[vm.data.sortAuthorityVar]) || - (vm.mainObject.setting.unsortableVar && vm.otherObject[vm.mainObject.setting.unsortableVar]); - } - ); - }; - vm.fun.copy = () => { - if (vm.mainObject.baseFun.copy) { - return vm.mainObject.baseFun.copy(vm.list, vm.otherObject); - } - }; - vm.fun.import = () => {}; - fun.watchRelationalCheckboxChange = function () { - if ((vm.list || []).length <= 0) return; - const tmpModelItem = vm.mainObject.tdList[data.relationalCheckboxTdIndex]; - const tmpModelKey = tmpModelItem.modelKey; - data.queryLength = 0; - for (const key in vm.list) { - if (vm.list[key][tmpModelKey]) { - data.queryLength++; - } - } - if ((vm.list || []).length === data.queryLength) { - tmpModelItem.selectAll = true; - } else { - tmpModelItem.selectAll = false; - } - }; - /** - * @desc 循环é‡ç½®checkbox modelKeyé€‰ä¸­çŠ¶æ€ - */ - fun.resetCheckbox = (inputTarget) => { - const tmpModelKey = vm.mainObject.tdList[inputTarget].modelKey; - const tmpActiveKey = vm.mainObject.tdList[inputTarget].activeKey; - data.queryLength = 0; - let listCanBeSelectLen = 0; - if (tmpModelKey) { - for (const key in vm.list) { - let hasSelected = false; - if (vm.mainObject.tdList[inputTarget].modelValueArr) { - hasSelected = - vm.list[key] && vm.list[key][tmpModelKey] === vm.mainObject.tdList[inputTarget].modelValueArr[1]; - } else { - hasSelected = vm.list[key] && vm.list[key][tmpModelKey]; - } - let tmpIsValid = true; - if (vm.mainObject.tdList[inputTarget].checkIsValidItem) { - if ( - !vm.mainObject.tdList[inputTarget].checkIsValidItem({ - item: vm.list[key], - }) - ) { - tmpIsValid = false; - } else { - listCanBeSelectLen++; - } - } - if (hasSelected && tmpIsValid) { - data.queryLength++; - } - } - if (!vm.mainObject.tdList[inputTarget].checkIsValidItem) { - listCanBeSelectLen = (vm.list || []).length; - } - if (listCanBeSelectLen === data.queryLength && listCanBeSelectLen != 0) { - vm.mainObject.tdList[inputTarget].selectAll = true; - } else { - vm.mainObject.tdList[inputTarget].selectAll = false; - } - } else { - let tmpFoucsLength = 0; - data.queryLength = (vm.list || []).length; - vm.data.checkboxTdObject.query = []; - for (const key in vm.data.checkboxTdObject.indexAddress) { - vm.data.checkboxTdObject.query.push(vm.mainObject.setting.checkboxKeyIsNum ? parseInt(key) : key); - } - for (const val of vm.list) { - if (vm.data.checkboxTdObject.indexAddress[val[tmpActiveKey]]) tmpFoucsLength++; - } - if (tmpFoucsLength >= data.queryLength) { - vm.data.checkboxTdObject.selectAll = true; - } else { - vm.data.checkboxTdObject.selectAll = false; - } - } - }; - fun.watchCheckboxChange = function () { - // vm.data.shrinkBtnLength=true; - if ((vm.list || []).length <= 0) return; - if (vm.data.checkboxTdObject.isOperating) { - switch (typeof data.checkboxTdIndex) { - case 'string': { - fun.resetCheckbox(data.checkboxTdIndex); - break; - } - default: { - data.checkboxTdIndex.map((val) => { - fun.resetCheckbox(val); - }); - break; - } - } - } - if (vm.mainObject.baseFun && vm.mainObject.baseFun.watchCheckboxChange) { - vm.mainObject.baseFun.watchCheckboxChange(); - } - }; - $scope.$on('$destroy', () => { - $scope.$destroy(); - $element.remove(); - vm = null; - indexController = null; - }); -} diff --git a/src/workbench/browser/src/ng1/component/list-default.js b/src/workbench/browser/src/ng1/component/list-default.js deleted file mode 100644 index 0bd00f26e..000000000 --- a/src/workbench/browser/src/ng1/component/list-default.js +++ /dev/null @@ -1,994 +0,0 @@ -/** - * @author Eoapi - * @description 默认列表组件 - * @extend {object} authorityObject æƒé™ç±»{operate} - * @extend {object} mainObject 主类{setting:{colspan,warning},item:{default,fun}} - * @extend {object} showObject 列表ITEM显示 - * @extend {object} otherObject 批é‡æ“作等é¢å¤–对象 - * @extend {Object} pageObject é¡µç  - */ -angular.module("eolinker").component("listDefaultCommonComponent", { - template: `
`, - controller: listDefaultController, - bindings: { - authorityObject: "<", - mainObject: "<", - showObject: "<", - otherObject: "=", - list: "<", - pageObject: "<", - }, -}); - -listDefaultController.$inject = ["$scope", "$element"]; - -function listDefaultController($scope, $element) { - var vm = this; - vm.data = { - selectAllMore: false, - listOrderBy: {}, - defaultDropMenu: {}, - }; - vm.fun = {}; - var fun = {}, - privateFun = {}; - fun.generateHtml = function (type, array) { - var template = { - html: "", - }; - switch (type) { - case "select": { - template.html = `" + - '"; - break; - } - } - return template.html; - }; - vm.fun.autoSortFun = (inputArg, inputDesc) => { - if (inputArg.$event && inputArg.$event.button !== 0) return; - if (inputArg.listItem.sort !== true) return; - if ( - vm.mainObject.setting.batch && - ((vm.otherObject.batch.isOperating && - vm.mainObject.setting.batchInitStatus !== "open") || - (vm.otherObject.batchMenu && vm.otherObject.batchMenu.isOperating)) - ) - return; - let listOrderBy = { - orderBy: inputArg.item.sortOrderByVal, - }; - if (vm.data.listOrderBy.orderBy === inputArg.item.sortOrderByVal) { - listOrderBy.asc = - inputDesc !== undefined ? inputDesc : inputArg.item.asc == 0 ? 1 : 0; - } else { - listOrderBy.asc = inputDesc !== undefined ? inputDesc : inputArg.item.asc; - } - let isStop = vm.mainObject.baseFun.autoSortFun({ - listOrderBy: listOrderBy, - }); - if (!isStop) { - inputArg.item.asc = listOrderBy.asc; - vm.data.listOrderBy = listOrderBy; - if (vm.mainObject.setting.sortStorageKey) { - window.localStorage.setItem( - vm.mainObject.setting.sortStorageKey, - angular.toJson(listOrderBy) - ); - } - } - }; - /** - * @desc 拖动鼠标放开æ“作 - */ - privateFun.dragMouseup = (inputMark, inputWidth) => { - vm.mainObject.setting.dragCacheObj[inputMark] = inputWidth; - if (vm.mainObject.setting.dragCacheVar) - window.localStorage.setItem( - vm.mainObject.setting.dragCacheVar, - JSON.stringify(vm.mainObject.setting.dragCacheObj) - ); - }; - - fun.getTargetEvent = function ($event, inputPointAttr) { - var itemIndex = $event.getAttribute(inputPointAttr || "eo-attr-index"); - if (itemIndex) { - return $event; - } else { - return fun.getTargetEvent($event.parentNode, inputPointAttr); - } - }; - fun.getTargetIndex = function ($event, inputPointAttr) { - var itemIndex = $event.getAttribute(inputPointAttr || "eo-attr-index"); - if (itemIndex) { - return itemIndex; - } else { - return fun.getTargetIndex($event.parentNode, inputPointAttr); - } - }; - fun.operateLevel = function (inputDepth, $event, inputIndex) { - var tmp = { - operateName: angular.element($event).hasClass("ng-hide") - ? "removeClass" - : "addClass", - }, - tmpParentIsShrinkIndex = inputIndex, - itemIndex = inputIndex; - while ($event && inputDepth < $event.getAttribute("eo-attr-depth")) { - switch (tmp.operateName) { - case "addClass": { - vm.list[itemIndex].isHide = true; - break; - } - case "removeClass": { - var tmpParentShrinkObject = vm.list[tmpParentIsShrinkIndex]; - if ( - vm.list[itemIndex].isShrink && - vm.list[itemIndex].listDepth <= tmpParentShrinkObject.listDepth - ) { - vm.list[itemIndex].isHide = false; - tmpParentIsShrinkIndex = itemIndex; - } else if ( - vm.list[itemIndex].listDepth <= tmpParentShrinkObject.listDepth - ) { - vm.list[itemIndex].isHide = false; - tmpParentIsShrinkIndex = itemIndex; - } else if (!tmpParentShrinkObject.isShrink) { - vm.list[itemIndex].isHide = false; - } - break; - } - } - itemIndex++; - $event = $event.nextElementSibling; - } - }; - vm.fun.shrinkList = function ($event) { - $event.stopPropagation(); - var tmp = {}; - tmp.targetDom = fun.getTargetEvent($event.target); - tmp.itemIndex = fun.getTargetIndex($event.target); - vm.list[tmp.itemIndex].isShrink = !vm.list[tmp.itemIndex].isShrink; - fun.operateLevel( - tmp.targetDom.getAttribute("eo-attr-depth"), - tmp.targetDom.nextElementSibling, - parseInt(tmp.itemIndex) + 1 - ); - }; - privateFun.init = () => { - if (!vm.mainObject) return; - //默认å¯æ‹–动 - // vm.mainObject.setting.hasOwnProperty("draggable")?"":(vm.mainObject.setting.draggable=true); - var template = { - itemHtml: "", - operateHtml: "", - thItemHtml: "", - moreFunArrHtml: "", - }, - tmpItemDragHtml = "", - tmpDragObj; - if (vm.mainObject.setting.draggable) { - try { - let tmpOriginDragCacheObj = vm.mainObject.setting.dragCacheObj; - vm.mainObject.setting.dragCacheObj = Object.assign( - {}, - tmpOriginDragCacheObj, - JSON.parse( - window.localStorage.getItem(vm.mainObject.setting.dragCacheVar) - ) || {} - ); - for (let key in vm.mainObject.setting.dragCacheObj) { - if (vm.mainObject.setting.dragCacheObj[key] === "0px") { - vm.mainObject.setting.dragCacheObj[key] = - tmpOriginDragCacheObj[key]; - } - } - } catch (JSON_PARSE_ERROR) { - console.error(JSON_PARSE_ERROR); - } - tmpDragObj = { - setting: { - object: "width", - affectCount: 2, - minWidth: 30, - }, - baseFun: { - mouseup: privateFun.dragMouseup, - }, - }; - } - if (vm.mainObject.setting.batch || vm.mainObject.setting.radio) { - template.itemHtml = fun.generateHtml("select"); - } - if (vm.mainObject.item.default) { - if (vm.mainObject.setting.autoSort) { - let storageOrderBy = - window.localStorage[vm.mainObject.setting.sortStorageKey]; - if (storageOrderBy) { - vm.data.listOrderBy = JSON.parse(storageOrderBy); - } else { - vm.data.listOrderBy = vm.mainObject.setting.sortDefaultVal.storageVal; - } - } - let tmp_width = - $element[0].offsetWidth / (vm.mainObject.item.default.length + 1); //拖动的å‡åˆ† - angular.forEach(vm.mainObject.item.default, function (listItem, thKey) { - let thItemContent = ""; - switch (listItem.thType) { - case "html": { - thItemContent = listItem.thHtml || ""; - break; - } - default: { - thItemContent = `${listItem.key}`; - } - } - if (vm.mainObject.setting.autoSort && listItem.sort) { - if (vm.data.listOrderBy.orderBy === listItem.sortOrderByVal) { - listItem.asc = vm.data.listOrderBy.asc; - } else { - listItem.asc = - vm.mainObject.setting.sortDefaultVal.sortOrder === "asc" ? 1 : 0; - } - } - if (vm.mainObject.setting.draggable) { - listItem.draggableMainObject = Object.assign({}, tmpDragObj, { - mark: listItem.draggableCacheMark, - }); - } - template.thItemHtml += `${thItemContent} - ${ - vm.mainObject.setting.autoSort && - (listItem.sort || listItem.sortAndFilterConf) - ? `${ - listItem.sortAndFilterConf - ? `` - : `` - }` - : "" - } -
 
`; - tmpItemDragHtml += ` `; - switch (listItem.type) { - default: { - template.itemHtml += `${ - vm.mainObject.setting.canOpenLink && - !listItem.cancelLink - ? `${listItem.html}` - : listItem.html - }\n`; - } - } - }); - } - if (vm.mainObject.item.operate) { - angular.forEach( - vm.mainObject.item.operate.funArr, - function (button, key) { - switch (button.type) { - case "more": { - vm.data.defaultDropMenu[key] = []; - angular.forEach( - button.funArr, - function (moreButton, moreButtonKey) { - vm.data.defaultDropMenu[key].push( - Object.assign({}, moreButton, { - key: moreButton.html || moreButton.key, - expression: `${moreButton.itemExpression || ""} ${ - moreButton.showPoint - ? ` ng-show="item['${moreButton.showPoint}']==${moreButton.show}" ` - : "" - }`, - }) - ); - } - ); - template.operateHtml += ``; - break; - } - case "html": { - template.operateHtml += button.html; - break; - } - default: { - template.operateHtml += '"; - } - } - } - ); - template.operateHtml = - '' + - "
" + - template.operateHtml + - "
" + - ""; - } - vm.data.selectAllSubMenuArr = [ - { - class: "btn_select_all", - key: "é€‰æ‹©æ‰€æœ‰æ•°æ® ï¼ˆå…±{{$ctrl.otherObj.msgCount}}æ¡ï¼‰", - }, - { - class: "btn_select_view", - key: "选择å¯è§æ•°æ® (共{{(($ctrl.otherObj.page*$ctrl.otherObj.pageSize+($ctrl.otherObj.extraOprNum||0))>$ctrl.otherObj.msgCount)?$ctrl.otherObj.msgCount:($ctrl.otherObj.pageSize*$ctrl.otherObj.page+($ctrl.otherObj.extraOprNum||0))}}æ¡ï¼‰", - }, - ]; - let tmpSelectClass = vm.mainObject.setting.batchClass - ? vm.mainObject.setting.batchClass - : !vm.mainObject.setting.page - ? "w_30" - : "w_50"; - let tmpThHtml = - (vm.mainObject.setting.radio - ? `` - : "") + - (vm.mainObject.setting.batch - ? `` + - (!vm.mainObject.setting.page - ? `${ - vm.mainObject.setting.batchText - ? `${vm.mainObject.setting.batchText}` - : "" - }` - : `
- - `) + - "" - : "") + - template.thItemHtml + - '' + - (vm.mainObject.setting.operateThKey || "æ“作") + - `${vm.mainObject.setting.draggable ? "" : ""}`; - let tmpDragHtml = - (vm.mainObject.setting.radio - ? `` - : "") + - (vm.mainObject.setting.batch - ? ` ` - : "") + - tmpItemDragHtml + - ` ${ - vm.mainObject.setting.draggable ? "" : "" - }`; - - template.html = `${ - template.itemHtml + template.operateHtml - }${vm.mainObject.setting.draggable ? "" : ""}`; - try { - template.html = template.html.replace( - "{{trExpression}}", - vm.mainObject.setting.trExpression || "" - ); - template.html = template.html.replace( - "{{trNgClass}}", - vm.mainObject.setting.trNgClass || "" - ); - } catch (REPLACE_ERR) { - console.error(REPLACE_ERR); - } - vm.data.tableHtml = - '
' + - '
' + - "" + - `${tmpThHtml}` + - `
` + - `
- ' - : ">") + - ('' + - tmpDragHtml + - "") + - '' + - template.html + - '
' + - (vm.mainObject.setting.warning || "尚无任何内容") + - "
" + - (vm.mainObject.setting.page - ? `` - : "") + - "
"; - }; - /** - * åˆå§‹åŒ–å•é¡¹è¡¨æ ¼ - */ - vm.$onInit = function () { - vm.authorityObject={operate:1} - privateFun.init(); - }; - // $rootScope.global.$watch.push( - // $scope.$watch("$ctrl.mainObject.item.default", privateFun.init) - // ); - $scope.$watch("$ctrl.mainObject.item.default", privateFun.init); - fun.countItemSelectIsAll = function (inputBool) { - if (inputBool) { - if (vm.mainObject.setting.page) { - let returnFlag = false; - for (var i = 0; i < vm.list.length; i++) { - if ( - vm.otherObject.batch.query.indexOf( - vm.list[i][vm.mainObject.item.primaryKey] - ) === -1 - ) { - returnFlag = true; - break; - } - } - if (vm.list.length && !returnFlag) - vm.otherObject.batch.selectAll = true; - } else { - if ( - (vm.otherObject.batch.query || []).length == (vm.list || []).length - ) { - vm.otherObject.batch.selectAll = true; - } - } - } else { - vm.otherObject.batch.selectAll = false; - } - }; - privateFun.selectBatch = (inputArg) => { - if (vm.mainObject.setting.batchInitStatus !== "open") { - vm.otherObject.batch.query = []; - vm.otherObject.batch.indexAddress = {}; - if (inputArg.selectType === "cancel") { - return; - } - } - switch (inputArg.queryType) { - case "item": { - if (vm.mainObject.setting.hasOwnProperty("disabledSelectModelKey")) { - inputArg.query.map(function (val) { - if ( - val[vm.mainObject.setting.disabledSelectModelKey] !== - vm.mainObject.setting.disabledSelectVal - ) { - privateFun.selectSingle( - inputArg.selectType, - val[vm.mainObject.item.primaryKey] - ); - } - }); - } else { - inputArg.query.map(function (val) { - privateFun.selectSingle( - inputArg.selectType, - val[vm.mainObject.item.primaryKey] - ); - }); - } - break; - } - default: { - //id - inputArg.query.map(function (val) { - privateFun.selectSingle(inputArg.selectType, val); - }); - break; - } - } - }; - privateFun.selectSingle = (type, inputID, callbackInfo) => { - if (vm.mainObject.baseFun && vm.mainObject.baseFun.beforeSelect) { - if (!vm.mainObject.baseFun.beforeSelect(inputID)) return; - } - switch (type) { - case "select": { - if ( - vm.mainObject.setting.batchInitStatus === "open" && - vm.otherObject.batch.indexAddress[inputID] - ) - return; - vm.otherObject.batch.query.push(inputID); - vm.otherObject.batch.indexAddress[inputID] = 1; - break; - } - case "cancel": { - if ( - vm.mainObject.setting.batchInitStatus === "open" && - !vm.otherObject.batch.indexAddress[inputID] - ) - return; - vm.otherObject.batch.query.splice( - vm.otherObject.batch.query.findIndex((id) => id === inputID), - 1 - ); - delete vm.otherObject.batch.indexAddress[inputID]; - break; - } - } - if (callbackInfo) { - callbackInfo.fun(callbackInfo.param); - } - }; - vm.fun.click = function (arg) { - var template = { - $index: 0, - batchFun: (arg) => { - if ( - vm.mainObject.setting.unhover && - !vm.otherObject.batch.isOperating - ) { - let point = ""; - try { - point = arg.$event.target.classList[0]; - } catch (e) {} - if (point !== "eo-checkbox" && point != "select_checkbox") return; - } - let callbackFun = (inputArg) => { - fun.countItemSelectIsAll(inputArg.bool); - if (vm.mainObject.baseFun && vm.mainObject.baseFun.afterSelected) { - vm.mainObject.baseFun.afterSelected(inputArg); - } - }; - if ( - vm.otherObject.batch.indexAddress[ - arg.item[vm.mainObject.item.primaryKey] - ] - ) { - privateFun.selectSingle( - "cancel", - arg.item[vm.mainObject.item.primaryKey], - { - fun: callbackFun, - param: { - bool: false, - type: "cancel", - item: arg.item, - }, - } - ); - } else { - privateFun.selectSingle( - "select", - arg.item[vm.mainObject.item.primaryKey], - { - fun: callbackFun, - param: { - bool: true, - type: "select", - item: arg.item, - }, - } - ); - } - }, - }; - if ( - vm.mainObject.setting.batch && - vm.otherObject.batch.isOperating && - !vm.mainObject.setting.selfControllClickBatch - ) { - template.batchFun(arg); - return; - } - if (vm.mainObject.baseFun && vm.mainObject.baseFun.click) { - vm.mainObject.baseFun.click(arg, template.batchFun); - return; - } - - if (vm.mainObject.setting.radio && vm.otherObject.batch.isOperating) { - template.$index = vm.otherObject.batch.query.indexOf( - arg.item[vm.mainObject.item.primaryKey] - ); - vm.otherObject.batch.query = []; - vm.otherObject.batch.query.push(arg.item[vm.mainObject.item.primaryKey]); - vm.otherObject.batch.indexAddress = {}; - vm.otherObject.batch.indexAddress[ - arg.item[vm.mainObject.item.primaryKey] - ] = arg.$index + 1; - if (vm.mainObject.baseFun && vm.mainObject.baseFun.batchFilter) { - vm.mainObject.baseFun.batchFilter(arg); - } - return; - } - }; - privateFun.clearBatchData = () => {}; - /** - * åˆå§‹åŒ–å•é¡¹è¡¨æ ¼ - */ - vm.fun.selectAll = function (arg, inputEvent) { - if (typeof arg === "object" && !arg.$event) arg.$event = inputEvent; - if (vm.mainObject.baseFun && vm.mainObject.baseFun.selectAll) { - if (vm.mainObject.setting.page) { - let point = "default"; - try { - point = arg.$event.target.classList[0]; - } catch (e) {} - switch (point) { - case "btn_all_show_more": { - vm.data.selectAllMore = true; - break; - } - case "eo-checkbox": - case "btn_select_all": { - if (point === "btn_select_all" || !vm.otherObject.batch.selectAll) { - //é€‰æ‹©æ‰€æœ‰æ•°æ® - vm.mainObject.baseFun.selectAll("selectAll"); - vm.data.selectAllMore = false; - } else { - vm.mainObject.baseFun.selectAll("cancelAll"); - } - break; - } - case "btn_select_view": { - //选择å¯è§æ•°æ® - vm.mainObject.baseFun.selectAll("selectView"); - vm.data.selectAllMore = false; - break; - } - } - } else { - vm.mainObject.baseFun.selectAll(arg); - } - return; - } - if (vm.mainObject.setting.page) { - let point = "default"; - try { - point = arg.$event.target.classList[0]; - } catch (e) {} - switch (point) { - case "btn_all_show_more": { - vm.data.selectAllMore = true; - break; - } - case "eo-checkbox": - case "btn_select_all": { - if (point === "btn_select_all" || !vm.otherObject.batch.selectAll) { - //é€‰æ‹©æ‰€æœ‰æ•°æ® - if ( - vm.pageObject.pageInfo.page === - Math.ceil( - vm.pageObject.pageInfo.msgCount / - vm.pageObject.pageInfo.pageSize - ) - ) { - //已加载到最åŽä¸€é¡µï¼Œä¸èŽ·å–primaryKey ID - privateFun.selectBatch({ - selectType: "select", - queryType: "item", - query: vm.list, - }); - } else { - privateFun.selectBatch({ - selectType: "select", - query: vm.otherObject.allQueryID, - }); - } - vm.data.selectAllMore = false; - vm.otherObject.batch.selectAll = true; - } else { - privateFun.selectBatch({ - selectType: "cancel", - query: vm.otherObject.allQueryID, - }); - vm.otherObject.batch.selectAll = false; - } - break; - } - case "btn_select_view": { - //选择å¯è§æ•°æ® - vm.data.selectAllMore = false; - privateFun.selectBatch({ - selectType: "select", - queryType: "item", - query: vm.list, - }); - vm.otherObject.batch.selectAll = true; - break; - } - } - } else { - let tmpList = vm.otherObject.allList ? vm.otherObject.allList : vm.list; - if (vm.otherObject.batch.selectAll) { - privateFun.selectBatch({ - selectType: "cancel", - queryType: "item", - query: tmpList, - }); - } else { - privateFun.selectBatch({ - selectType: "select", - queryType: "item", - query: tmpList, - }); - } - vm.otherObject.batch.selectAll = !vm.otherObject.batch.selectAll; - } - }; - /** - * @description 统筹绑定调用页é¢åˆ—表功能å•å‡»å‡½æ•° - * @param {extend} obejct æ–¹å¼å€¼ - * @param {object} arg 共用体å˜é‡ï¼ŒåŽæ ¹æ®ä¼ å€¼å‡½æ•°å›žè°ƒæ–¹æ³• - */ - vm.fun.common = function (extend = {}, arg = {}, $event) { - if (arg.$event) { - arg.$event.stopPropagation(); - } else { - arg.$event = $event; - } - if (!extend.fun) { - vm.fun.click(arg); - return; - } - var template = { - params: angular.copy(arg), - }; - switch (typeof extend.params) { - case "string": { - return eval("extend.fun(" + extend.params + ")"); - } - default: { - for (var key in extend.params) { - if (extend.params[key] == null) { - template.params[key] = arg[key]; - } else { - template.params[key] = extend.params[key]; - } - } - return extend.fun(template.params); - } - } - }; -} diff --git a/src/workbench/browser/src/ng1/component/select-default.js b/src/workbench/browser/src/ng1/component/select-default.js deleted file mode 100644 index ad940d010..000000000 --- a/src/workbench/browser/src/ng1/component/select-default.js +++ /dev/null @@ -1,564 +0,0 @@ -/** - * @author Eoapi - * @description 默认下拉èœå• - */ - -angular.module('eolinker').component('selectDefaultCommonComponent', { - template: ` -
-
-

- {{$ctrl.data.text}} - {{$ctrl.mainObject.setting.emptyText||'请选择...'}} - - -

- -
-
-

- - - -

- - -
-
-

暂无任何选项

-
-
- - - -
`, - bindings: { - input: '<', - type: '@', // 下拉框ã€å¹³é“º - output: '=', - required: '@', - multiple: '@', // 如果为true的时候,ä¸èƒ½ç”¨null值作为空白 - modelKey: '@', - inputChangeFun: '&', - disabled: '<', - disabledQuery: '<', - mainObject: '<', - }, - controller: selectDefaultController, -}); - -selectDefaultController.$inject = ['$scope', '$element']; - -function selectDefaultController($scope, $element) { - let vm = this; - vm.data = { - batch: { - selectAll: false, - indexAddress: {}, - }, - text: '', - query: null, - searchInputElem: null, - inputElem: $element[0].getElementsByClassName('input-select'), - q: '', - }; - vm.fun = {}; - const fun = {}; - const data = { - hasSelectAlready: false, - originalElemCount: 0, - output: '', - watchOutput: null, - hasInitial: false, - }; - vm.fun.inputMousedown = function ($event) { - if ($event) $event.stopPropagation(); - - if (vm.mainObject && vm.mainObject.isNeedToResetPosition) { - let tmpObj = vm.data.inputElem[0].getBoundingClientRect(); - vm.data.inputX = tmpObj.x; - vm.data.inputY = tmpObj.y + 30; - } - - vm.data.currentElementCount = data.originalElemCount - 1; - vm.data.q = ''; - vm.data.query = vm.input.query; - if (vm.multiple === 'true') { - fun.resetSelectAll(); - } - }; - vm.fun.searchChange = function () { - const tmpQuery = angular.copy(vm.input.query); - vm.data.currentElementCount = data.originalElemCount; - if (!vm.data.q) { - vm.data.query = tmpQuery; - } else { - vm.data.query = tmpQuery.filter((val, key) => { - if ((val[vm.input.key] || '').toLowerCase().indexOf((vm.data.q || '').toLowerCase()) > -1) { - return val; - } else { - return undefined; - } - }); - } - if (vm.multiple === 'true') { - fun.resetSelectAll(); - } - }; - vm.fun.divFocus = function () { - vm.fun.inputMousedown(); - vm.data.inputElem[0].focus(); - }; - vm.fun.keydown = function (_default) { - if (!vm.data.hasOwnProperty('currentElementCount')) { - vm.data.currentElementCount = data.originalElemCount - 1; - } - switch (_default.keyCode) { - case 38: { - // up - vm.data.currentElementCount = - vm.data.currentElementCount <= data.originalElemCount - ? ((vm.data.query || []).length || 1) - 1 - : vm.data.currentElementCount - 1; - if (vm.data.currentElementCount == data.originalElemCount) { - if (vm.data.searchInputElem) { - vm.data.searchFocusStatus = true; - vm.data.searchInputElem[0].click(); - vm.data.searchInputElem[0].focus(); - // return; - } - } else if (vm.data.currentElementCount == 4) { - vm.data.inputElem[0].focus(); - } - ($scope.$root && $scope.$root.$$phase) || $scope.$apply(); - break; - } - case 40: { - // down - _default.preventDefault(); - vm.data.currentElementCount++; - if (vm.data.currentElementCount == (vm.data.query || []).length) { - vm.data.currentElementCount = data.originalElemCount; - } - if (vm.data.currentElementCount == data.originalElemCount) { - if (vm.data.searchInputElem) { - vm.data.searchFocusStatus = true; - vm.data.searchInputElem[0].click(); - vm.data.searchInputElem[0].focus(); - // return; - } - } else if (vm.data.currentElementCount == 0) { - vm.data.inputElem[0].focus(); - } - - ($scope.$root && $scope.$root.$$phase) || $scope.$apply(); - break; - } - case 13: { - // enter - _default.preventDefault(); - if (vm.data.currentElementCount >= 0) { - let tmpQuery; - if (vm.mainObject && vm.mainObject.fnFilterArr) { - tmpQuery = vm.data.query.filter(vm.mainObject.fnFilterArr); - } else { - tmpQuery = vm.data.query; - } - fun.select(tmpQuery[vm.data.currentElementCount], vm.data.currentElementCount); - if (vm.multiple !== 'true') { - vm.data.inputElem[0].blur(); - } - ($scope.$root && $scope.$root.$$phase) || $scope.$apply(); - } - return false; - } - } - }; - fun.setText = () => { - vm.data.text = ''; - if (vm.multiple === 'true') { - const tmpText = []; - const queryLen = vm.input.query.length; - for (let index = 0; index < queryLen; index++) { - const item = vm.input.query[index]; - if (vm.data.batch.indexAddress[item[vm.input.value]]) { - tmpText.push(item[vm.input.key]); - } - } - fun.resetSelectAll(); - vm.data.text = tmpText.join(','); - } else { - for (const key in vm.input.query) { - const val = vm.input.query[key]; - // 误轻易改为=== - if (vm.output && vm.output[vm.modelKey] == val[vm.input.value]) { - vm.data.text = val[vm.input.key]; - break; - } - } - } - }; - - fun.setValue = (arg) => { - if (vm.multiple === 'true') { - if (vm.data.batch.indexAddress[arg[vm.input.value]]) { - if (vm.required && !(Object.keys(vm.output[vm.modelKey]).length > 1)) return; - vm.output[vm.modelKey].splice( - vm.output[vm.modelKey].findIndex((id) => id === arg[vm.input.value]), - 1 - ); - delete vm.data.batch.indexAddress[arg[vm.input.value]]; - } else { - vm.output[vm.modelKey].push(arg[vm.input.value]); - vm.data.batch.indexAddress[arg[vm.input.value]] = 1; - } - if (vm.inputChangeFun) { - const fnParams = { - value: arg[vm.input.value], - type: vm.data.batch.indexAddress[arg[vm.input.value]] ? 'select' : 'cancel', - }; - vm.inputChangeFun({ - arg: fnParams, - }); - } - } else if (vm.output[vm.modelKey] !== arg[vm.input.value]) { - if (vm.mainObject && vm.mainObject.fnCheckIsValid) { - vm.mainObject.fnCheckIsValid( - vm.output[vm.modelKey], - arg[vm.input.value], - (tmpInputIsValid) => { - if (tmpInputIsValid) vm.output[vm.modelKey] = arg[vm.input.value]; - }, - vm.otherObject - ); - } else { - vm.output[vm.modelKey] = arg[vm.input.value]; - } - if (vm.inputChangeFun) { - vm.inputChangeFun({ arg }); - } - } else if (vm.mainObject && !vm.required) { - vm.output[vm.modelKey] = null; - if (vm.inputChangeFun) { - vm.inputChangeFun(); - } - } - fun.setText(); - }; - vm.fun.clear = function ($event) { - data.hasSelectAlready = true; - $event.stopPropagation(); - if (vm.multiple === 'true') { - vm.output[vm.modelKey] = []; - vm.data.batch.indexAddress = {}; - } else { - vm.output[vm.modelKey] = undefined; - } - vm.data.text = ''; - if (vm.inputChangeFun) { - vm.inputChangeFun({}); - } - }; - fun.select = function (arg) { - if ((vm.disabledQuery && vm.disabledQuery.indexOf(arg[vm.input.value]) > -1) || vm.disabled) return; - data.hasSelectAlready = true; - data.output = data.output || []; - // arg.index = vm.input.index;注释,编写原因未知,影å“多选组件 - if ( - vm.mainObject.checkIsValidFun && - !vm.mainObject.checkIsValidFun(arg, () => { - fun.setValue(arg); - }) - ) - return; - fun.setValue(arg); - }; - fun.resetSelectAll = () => { - if (!vm.data.query) return; - if ( - (vm.output[vm.modelKey] && vm.output[vm.modelKey].length < vm.data.query.length) || - vm.data.query.length === 0 - ) { - vm.data.batch.selectAll = false; - } else { - let tmpSelectAll = true; - const queryLen = vm.data.query.length; - for (let index = 0; index < queryLen; index++) { - const item = vm.data.query[index]; - if (!vm.data.batch.indexAddress[item[vm.input.value]]) { - tmpSelectAll = false; - break; - } - } - vm.data.batch.selectAll = tmpSelectAll; - } - }; - fun.selectAll = () => { - data.hasSelectAlready = true; - if (vm.data.batch.selectAll) { - if (vm.required) { - vm.output[vm.modelKey] = [vm.data.query[0][vm.input.value]]; - vm.data.batch.indexAddress = {}; - vm.data.batch.indexAddress[vm.data.query[0][vm.input.value]] = 1; - } else if (!vm.data.q) { - vm.output[vm.modelKey] = []; - vm.data.batch.indexAddress = {}; - } else { - for (let key = 0; key < vm.data.query.length; key++) { - const item = vm.data.query[key]; - vm.output[vm.modelKey].splice( - vm.output[vm.modelKey].findIndex((id) => id === item[vm.input.value]), - 1 - ); - delete vm.data.batch.indexAddress[item[vm.input.value]]; - } - } - } else { - // é¿å…监å¬outputé‡å¤æ¸²æŸ“ - const valueArr = []; - for (let key = 0; key < vm.data.query.length; key++) { - const val = vm.data.query[key]; - valueArr.push(val[vm.input.value]); - if (!vm.data.batch.indexAddress[val[vm.input.value]]) { - vm.data.batch.indexAddress[val[vm.input.value]] = 1; - } - } - vm.output[vm.modelKey] = valueArr; - } - if (vm.inputChangeFun) { - vm.inputChangeFun(); - } - fun.setText(); - }; - vm.fun.domClick = (inputEvent) => { - inputEvent.stopPropagation(); - }; - fun.getTargetIndex = function ($event, inputPointAttr) { - if (!$event.getAttribute) return -1; - const itemIndex = $event.getAttribute(inputPointAttr || 'eo-attr-index'); - if (itemIndex) { - return itemIndex; - } else { - return fun.getTargetIndex($event.parentNode, inputPointAttr); - } - }; - vm.fun.listMouseDown = function ($event) { - $event.stopPropagation(); - const template = {}; - try { - template.point = $event.target.classList[0]; - } catch (e) { - template.point = 'default'; - } - switch (template.point) { - case 'input-search': { - break; - } - case 'select-btn-item': - case 'item_text': - case 'sd_check_box': - default: { - if (vm.multiple === 'true') { - vm.data.containerFocus = true; - } - template.index = fun.getTargetIndex($event.target, 'eo-attr-index'); - if (template.index === -1) return; - let tmpQuery; - if (vm.mainObject.fnFilterArr) { - tmpQuery = vm.data.query.filter(vm.mainObject.fnFilterArr); - } else { - tmpQuery = vm.data.query; - } - fun.select(tmpQuery[template.index]); - break; - } - case 'sd_all_check_box': { - vm.data.containerFocus = true; - fun.selectAll(); - break; - } - } - }; - vm.fun.searchActiveStatus = function (inputFocusStatus) { - vm.data.searchFocusStatus = inputFocusStatus; - }; - fun.initial = function () { - data.hasInitial = true; - if (vm.multiple === 'true') { - if (vm.input.initialData) vm.output[vm.modelKey] = angular.copy(vm.input.initialData); - vm.data.batch.indexAddress = {}; - if (vm.output[vm.modelKey] && vm.output[vm.modelKey].length) { - angular.forEach(vm.output[vm.modelKey], (val, key) => { - vm.data.batch.indexAddress[val] = 1; - }); - } else if (vm.mainObject.isSelectAll) { - const valueArr = []; - for (let key = 0; key < vm.data.query.length; key++) { - const val = vm.data.query[key]; - valueArr.push(val[vm.input.value]); - if (!vm.data.batch.indexAddress[val[vm.input.value]]) { - vm.data.batch.indexAddress[val[vm.input.value]] = 1; - } - } - vm.output[vm.modelKey] = valueArr; - } - } else { - for (const key in vm.data.query) { - const val = vm.data.query[key]; - if (val[vm.input.value] == vm.input.initialData) { - vm.output = vm.output || {}; - vm.output[vm.modelKey] = val[vm.input.value]; - if (vm.mainObject && vm.mainObject.watchInitialInputChange && vm.inputChangeFun) { - vm.inputChangeFun({ - arg: val, - }); - } - break; - } - } - } - fun.setText(); - }; - $scope.$watch( - '$ctrl.input.query', - () => { - if (!vm.input.query) return; - vm.data.query = vm.input.query; - if (vm.data.query.length >= 5 || vm.multiple === 'true') { - data.originalElemCount = -1; - vm.data.searchInputElem = $element[0].getElementsByClassName('input-search'); - } else { - data.originalElemCount = 0; - } - fun.initial(); - }, - true - ); - const watchInitial = $scope.$watch( - '$ctrl.input.initialData', - () => { - if (!vm.input.query || vm.input.initialData === undefined) return; - if (vm.multiple === 'true' && data.hasSelectAlready && !vm.input.keepWatchInitialData) { - watchInitial(); - return; - } - fun.initial(); - }, - true - ); - - fun.initHtml = () => { - let itemHtml = ''; - const deafultText = `{{item.${vm.input.key}}}`; - switch (vm.mainObject.itemType) { - case 'html': { - itemHtml = vm.mainObject.itemHtml; - itemHtml = itemHtml.replace('${eo_default_text}', deafultText); - break; - } - case 'text': { - itemHtml = deafultText; - break; - } - } - const judgeHtml = vm.multiple - ? `$ctrl.data.batch.indexAddress[item.${vm.input.value}]` - : `$ctrl.output[$ctrl.modelKey]==item.${vm.input.value}`; - const quoteType = { - square: ``, - round: ``, - }; - let checkboxHtml = ''; - if (vm.mainObject.showCheckbox) { - checkboxHtml = quoteType[vm.mainObject.checkboxType]; - } - switch (vm.type) { - case 'tile': { - vm.data.tileHtml = ``; - break; - } - default: { - vm.data.pulldownHtml = `
-

暂无任何æœç´¢é¡¹ -

-

- ${checkboxHtml} - ${itemHtml} -

-
`; - break; - } - } - }; - - vm.$onInit = function () { - vm.modelKey = vm.modelKey || 'value'; - vm.type = vm.type || 'default'; - $element.bind('keydown', vm.fun.keydown); - vm.mainObject = vm.mainObject || {}; - if (vm.mainObject.initFun) { - vm.mainObject.initFun(); - } - vm.mainObject.setting = vm.mainObject.setting || {}; - vm.mainObject.itemType = vm.mainObject.itemType || 'text'; - if ((vm.type === 'tile' || vm.multiple === 'true') && !vm.mainObject.hasOwnProperty('showCheckbox')) { - vm.mainObject.showCheckbox = true; - } - if (!vm.mainObject.hasOwnProperty('checkboxType')) { - if (vm.multiple) { - vm.mainObject.checkboxType = 'square'; - } else { - vm.mainObject.checkboxType = 'round'; - } - } - if (vm.multiple === 'true') { - // éžåˆå§‹åŒ–,外部改å˜å€¼ - $scope.$watch( - '$ctrl.input.changeFlag', - () => { - if (!vm.input.changeFlag || !vm.input.query || vm.input.initialData === undefined) return; - fun.initial(); - }, - true - ); - } - fun.initHtml(); - }; - $scope.$on('$destroy', () => { - $scope.$destroy(); - $element.remove(); - vm = null; - indexController = null; - }); -} diff --git a/src/workbench/browser/src/ng1/component/sort-and-filter.js b/src/workbench/browser/src/ng1/component/sort-and-filter.js deleted file mode 100644 index bc3a4a9c5..000000000 --- a/src/workbench/browser/src/ng1/component/sort-and-filter.js +++ /dev/null @@ -1,185 +0,0 @@ -/** - * @author Eoapi - * @description 排åºå’Œç­›é€‰ - */ -angular.module('eolinker').component('sortAndFilterListDefaultComponent', { - template: `
-
- -
-
-`, - controller: sortAndFitlerController, - bindings: { - mainObj: '<', - sortFun: '&', - filterFun: '&', - otherObj: '<', - }, -}); - -sortAndFitlerController.$inject = ['$rootScope', '$templateCache', '$scope']; - -function sortAndFitlerController($rootScope, $templateCache, $scope) { - var vm = this; - vm.fun = {}; - vm.data = { - activeObj: { - indexAddress: {}, - query: [], - }, - cacheFilter: {}, - }; - vm.dropMenuObj = {}; - let CONST = { - DROP_MENU_HTML: $templateCache.get('app/component/common/list/default/sortAndFilter/index.tmp.html'), - }, - cache = {}; - vm.data.changeFilter = () => { - vm.data.list = cache.list.filter((val) => { - if (!vm.data.keyword) return val; - for (let tmpKey in val) { - if ( - (tmpKey === 'key' || vm.mainObj.filterHtml.indexOf(tmpKey) > -1) && - typeof val[tmpKey] === 'string' && - val[tmpKey].toLowerCase().indexOf(vm.data.keyword.toLowerCase()) > -1 - ) - return val; - } - return undefined; - }); - }; - vm.fun.opr = (inputOpr) => { - switch (inputOpr) { - case 'desc': { - vm.sortFun({ - arg: 0, - }); - break; - } - case 'asc': { - vm.sortFun({ - arg: 1, - }); - break; - } - case 'filter': { - vm.data.cacheFilter = angular.copy(vm.data.activeObj); - let tmpActiveObj = angular.copy(vm.data.activeObj); - vm.data.cacheFilter.selectAll = tmpActiveObj.selectAll = vm.data.activeObj.query.length === cache.list.length; - vm.filterFun({ - arg: tmpActiveObj, - }); - break; - } - case 'focusFilter': { - if (vm.mainObj.fnInit) { - vm.mainObj.filterArr = vm.mainObj.fnInit(); - } - vm.data.keyword = null; - vm.dropMenuObj.html = CONST.DROP_MENU_HTML.replace(/\$_canSort/g, vm.mainObj.canSort) - .replace(/\$_class/g, vm.mainObj.class || 'w_150') - .replace(/\$_canAutomaticSortOrFilter/g, vm.mainObj.canFilter || vm.mainObj.canAutomaticSort) - .replace(/\$_canSearch/g, vm.mainObj.filterArr && vm.mainObj.filterArr.length >= 5 ? true : false); - cache.list = vm.data.list = vm.mainObj.filterArr; - if (!vm.data.cacheFilter.indexAddress) vm.data.cacheFilter = angular.copy(vm.data.activeObj); - else { - for (let key in vm.data.activeObj) { - vm.data.activeObj[key] = angular.copy(vm.data.cacheFilter[key]); - } - } - vm.data.activeObj.isOperating = true; - break; - } - default: { - if (/^sort_/.test(inputOpr)) { - vm.sortFun({ - arg: inputOpr.split('sort_')[1], - }); - } - break; - } - } - }; - vm.$onInit = () => { - if (vm.mainObj.canFilter) { - vm.data.listBlockConf = { - setting: { - isValidToBeNull: true, - checkboxKeyIsNum: vm.mainObj.hasOwnProperty('checkboxKeyIsNum') ? vm.mainObj.checkboxKeyIsNum : true, - }, - tdList: [ - { - type: 'checkbox', - activeKey: vm.mainObj.canFilterValue || 'value', - isWantedToExposeObject: true, - wantToWatchListLength: true, - checkboxClickAffectTotalItem: true, - }, - { - type: 'html', - html: vm.mainObj.filterHtml, - thKey: `筛选项`, - }, - ], - baseFun: { - selectAll: (tmpInputBool) => { - let tmpKey = vm.mainObj.canFilterValue || 'value'; - if (tmpInputBool) { - vm.data.list.map((val) => { - let tmpVal = val[tmpKey]; - if (!vm.data.activeObj.indexAddress[tmpVal]) vm.data.activeObj.indexAddress[tmpVal] = 1; - if (vm.data.activeObj.query.indexOf(tmpVal) === -1) vm.data.activeObj.query.push(tmpVal); - }); - } else { - for (let key in vm.data.activeObj.indexAddress) { - delete vm.data.activeObj.indexAddress[key]; - } - vm.data.activeObj.query.splice(0, vm.data.activeObj.query.length); - } - }, - }, - }; - if (vm.mainObj.filterIndexAddress) { - vm.data.activeObj.indexAddress = vm.mainObj.filterIndexAddress; - return; - } - $scope.$watch('$ctrl.mainObj.filterArr', () => { - if (vm.mainObj.filterArr && vm.mainObj.filterArr.length > 0) { - vm.mainObj.filterArr.map((val) => { - vm.data.activeObj.indexAddress[val[vm.mainObj.canFilterValue || 'value']] = 1; - vm.data.activeObj.query.push(val[vm.mainObj.canFilterValue || 'value']); - }); - vm.data.activeObj.selectAll = true; - vm.data.cacheFilter.selectAll = true; - } - }); - } else if (vm.mainObj.canAutomaticSort) { - vm.data.listBlockConf = { - setting: { - trExpression: `eo-attr-value="sort_{{item.value}}"`, - }, - tdList: [ - { - type: 'text', - modelKey: 'key', - thKey: '排åºé¡¹', - }, - ], - }; - } - }; -} diff --git a/src/workbench/browser/src/ng1/directive/copy-common.directive.js b/src/workbench/browser/src/ng1/directive/copy-common.directive.js deleted file mode 100644 index 10bf28b55..000000000 --- a/src/workbench/browser/src/ng1/directive/copy-common.directive.js +++ /dev/null @@ -1,69 +0,0 @@ -/** - * @description å¤åˆ¶æŒ‡ä»¤ - * @param [string][optional] copyModel å¤åˆ¶ç»‘å®šæ¨¡å— - * @param [string][optional] cacheVariable å¤åˆ¶ç¼“存绑定,用于大数æ®ä¸æ–¹ä¾¿é¡µé¢äº¤äº’è¡Œæ•°æ® - * @extends $rootScope - */ - -angular.module('eolinker').directive('copyCommonDirective', [ - '$rootScope', - function ($rootScope) { - return { - restrict: 'A', - scope: { - copyModel: '<', - text: '@', - mainObj: '<', - fnPrefix: '&', - }, - link: function ($scope, elem, attrs, ctrl) { - var data = { - elem: null, - }, - fun = {}; - fun.btnFun = function ($event) { - $event.stopPropagation(); - let tmpText = - $scope.text || $scope.copyModel || '', - tmpFnTetx; - if ($scope.fnPrefix) { - tmpFnTetx = $scope.fnPrefix({ - text: tmpText, - }); - } - data.elem.value = tmpFnTetx || tmpText; - data.elem.select(); - data.elem.click(); - try { - if (document.execCommand('copy')) { - if ($scope.mainObj && $scope.mainObj.successCallback) { - $scope.mainObj.successCallback(); - } else { - $rootScope.InfoModal({ tip: 'å¤åˆ¶æˆåŠŸ', timeout: 1000, isCustomTitle: true }, 'success'); - } - } else { - if ($scope.mainObj && $scope.mainObj.failureCallback) { - $scope.mainObj.failureCallback(); - } else { - $rootScope.InfoModal('å¤åˆ¶å¤±è´¥', 'error'); - } - } - } catch (err) { - if ($scope.mainObj && $scope.mainObj.failureCallback) { - $scope.mainObj.failureCallback(); - } else { - $rootScope.InfoModal('å¤åˆ¶å¤±è´¥', 'error'); - } - } - }; - fun.init = (function () { - data.elem = document.getElementById('template_textarea_js') || document.createElement('textarea'); - data.elem.setAttribute('style', 'position:fixed,left:0,top:0,opacity:0;height:0;width:0;'); - data.elem.setAttribute('id', 'template_textarea_js'); - document.body.appendChild(data.elem); - elem.bind(attrs.buttonFunction || 'click', fun.btnFun); - })(); - }, - }; - }, -]); diff --git a/src/workbench/browser/src/ng1/directive/drop-change-space.directive.js b/src/workbench/browser/src/ng1/directive/drop-change-space.directive.js deleted file mode 100644 index f3a844d71..000000000 --- a/src/workbench/browser/src/ng1/directive/drop-change-space.directive.js +++ /dev/null @@ -1,115 +0,0 @@ -/** - * 获å–æŸä¸€èŠ‚ç‚¹çš„æ•°é‡ - * @param {string} bindClass 绑定监å¬ç±» - * @param {number} model ç»‘å®šè§†å›¾æ•°æ® - */ -angular.module('eolinker.directive').directive('dragChangeSpacingCommonDirective', [ - '$rootScope', - function ($rootScope) { - return { - restrict: 'A', - scope: { - mainObject: '<', - otherObj: '=', - }, - link: function ($scope, elem, attrs, ngModel) { - let elemAffect, - containerElemAffect = null; - let privateFun = {}, - elemHead = document.getElementsByTagName('head'), - elemWidth = $scope.mainObject.setting.minWidth ? `${$scope.mainObject.setting.minWidth}px` : '0px'; - let dragOffset = 15; //绑定元素冗余的宽度,例如padding-left - - /** - * @desc 更改对象高度 - */ - privateFun.setHeight = (domEvent) => { - if (domEvent.clientY <= $scope.mainObject.setting.clientY) return false; - let tmpHeight = document.body.clientHeight - domEvent.clientY; - if (tmpHeight >= $scope.mainObject.setting.minHeight) { - elemAffect[0].style.height = tmpHeight + 'px'; - if ($scope.mainObject && $scope.mainObject.baseFun && $scope.mainObject.baseFun.heightChange) { - $scope.mainObject.baseFun.heightChange(elemAffect); - } - ($scope.$root && $scope.$root.$$phase) || $scope.$apply(); - } - return false; - }; - /** - * @desc 更改对象宽度 - */ - privateFun.setWidth = (domEvent) => { - let tmpMoveX = domEvent.movementX; - let tmpWidth = elemAffect[0].clientWidth + tmpMoveX; - if (tmpWidth <= $scope.mainObject.setting.minWidth) return; - if (tmpWidth >= $scope.mainObject.setting.maxWidth) return; - // if(containerElemAffect){ - // containerElemAffect[0].style.width=containerElemAffect[0].scrollWidth+tmpMoveX + 'px'; - // } - elemWidth = tmpWidth + 'px'; - let tmpAffectCount = 0; - tmpAffectCount = - $scope.mainObject.setting.affectCount === -1 ? elemAffect.length : $scope.mainObject.setting.affectCount; - for (let key = 0; key < tmpAffectCount; key++) { - elemAffect[key].style.width = elemWidth; - } - if ($scope.otherObj) { - $scope.otherObj[$scope.mainObject.mark] = elemWidth; - } - ($scope.$root && $scope.$root.$$phase) || $scope.$apply(); - }; - - elem.bind('mousedown', (inputEvent) => { - inputEvent.stopPropagation(); - elem.top = elem.offsetTop; - if ($scope.mainObject && $scope.mainObject.baseFun && $scope.mainObject.baseFun.mouseDown) { - $scope.mainObject.baseFun.mouseDown(elemAffect); - } - switch ($scope.mainObject.setting.object) { - case 'height': { - document.onmousemove = privateFun.setHeight; - break; - } - case 'width': { - angular - .element(elemHead) - .append( - '' - ); - document.onmousemove = privateFun.setWidth; - break; - } - } - - document.onmouseup = function () { - document.onmousemove = null; - document.onmouseup = null; - let tmpHeadStyleElem = document.getElementById('eo_tmp_drag'); - angular.element(tmpHeadStyleElem).remove(); - elem.releaseCapture && elem.releaseCapture(); - if ($scope.mainObject && $scope.mainObject.baseFun && $scope.mainObject.baseFun.mouseup) { - $scope.mainObject.baseFun.mouseup($scope.mainObject.mark, elemWidth); - } - }; - elem.setCapture && elem.setCapture(); - return false; - }); - - function main() { - if ($scope.mainObject.dom) { - elemAffect = $scope.mainObject.dom.getElementsByClassName(attrs.affectClass); - } else { - elemAffect = document.getElementsByClassName(attrs.affectClass); - } - if ($scope.mainObject.setting.dragOffSet !== undefined) { - dragOffset = $scope.mainObject.setting.dragOffSet; - } - if (attrs.containerAffectClass) { - containerElemAffect = document.getElementsByClassName(attrs.containerAffectClass); - } - } - main(); - }, - }; - }, -]); diff --git a/src/workbench/browser/src/ng1/directive/drop-down-menu.directive.js b/src/workbench/browser/src/ng1/directive/drop-down-menu.directive.js deleted file mode 100644 index d18ce6a10..000000000 --- a/src/workbench/browser/src/ng1/directive/drop-down-menu.directive.js +++ /dev/null @@ -1,306 +0,0 @@ -/** - * @description 手动控制按钮focus状æ€ï¼Œä½¿ç”¨ä¸Žmac os éžchromeæµè§ˆå™¨ - * @author Eoapi - */ -angular - .module('eolinker.directive') - - .directive('dropDownMenuCommonDirective', [ - '$rootScope', - function ($rootScope) { - return { - restrict: 'AE', - scope: { - dirDisable: '<', - }, - link($scope, elem, attrs, ctrl) { - $scope.data = { - elemArr: elem[0].getElementsByClassName('eo_more_btn'), - }; - const privateFun = {}; - privateFun.initWatchDom = () => { - // $rootScope.global.$watch.push($scope.$watch('data.elemArr.length', () => { - // if ($scope.data.elemArr) { - // let domArr = Array.prototype.slice.call($scope.data.elemArr); - // domArr.map((val) => { - // let tmpElem = val; - // angular.element(tmpElem).bind('click', (event) => { - // tmpElem.focus(); - // }) - // }) - // } - - // })); - $scope.$watch('data.elemArr.length', () => { - if ($scope.data.elemArr) { - const domArr = Array.prototype.slice.call($scope.data.elemArr); - domArr.map((val) => { - const tmpElem = val; - angular.element(tmpElem).bind('click', (event) => { - tmpElem.focus(); - }); - }); - } - }); - }; - const main = (function () { - if (/macintosh|mac os x/i.test(navigator.userAgent) && !/Chrome/i.test(navigator.userAgent)) { - privateFun.initWatchDom(); - $scope.$on('$stateChangeStart', () => { - $scope.data.elemArr = null; - }); - $scope.$on('$stateChangeSuccess', () => { - if (!$scope.data.elemArr) { - $scope.data.elemArr = elem[0].getElementsByClassName('eo_more_btn'); - privateFun.initWatchDom(); - } - }); - } - })(); - }, - }; - }, - ]) - .directive('eoDropRoot', [ - function () { - return { - restrict: 'A', - controllerAs: '$ctrl', - controller: [ - '$scope', - '$compile', - '$element', - function ($scope, $compile, $element) { - const vm = this; - const privateFun = {}; - const data = {}; - privateFun.getTargetValue = function ($event, inputPointAttr) { - if (!$event) return; - const tmpVal = $event.getAttribute(inputPointAttr || 'eo-attr-value'); - if ($event.getAttribute('class') && $event.getAttribute('class').indexOf('eo-drop-root') !== -1) { - return null; - } - if (tmpVal !== null) { - return tmpVal; - } else { - return privateFun.getTargetValue($event.parentNode, inputPointAttr); - } - }; - vm.data = { - showDropMenu: false, - }; - vm.fnStopPropagation = (inputEvent) => { - vm.data.containerFocus = true; - inputEvent.stopPropagation(); - }; - vm.fnClearStopPropagation = () => { - privateFun.resetConf(); - }; - vm.fnWatchUi = (inputEvent) => { - inputEvent.preventDefault(); - const tmpValue = privateFun.getTargetValue(inputEvent.target); - if (tmpValue === null) return; - if (vm.data.targetParentIndex != null) { - vm.data.fnClick({ - target: vm.data.textObj[vm.data.targetParentIndex].childs[tmpValue], - itemEvent: inputEvent, - }); - } else if (vm.data.textObj[tmpValue]) { - vm.data.fnClick({ - target: vm.data.textObj[tmpValue], - itemEvent: inputEvent, - }); - } else { - vm.data.fnClick({ - target: tmpValue, - itemEvent: inputEvent, - }); - } - privateFun.resetConf(); - }; - privateFun.resetConf = () => { - delete vm.data.containerFocus; - delete vm.data.showDropMenu; - delete vm.data.textObj; - delete vm.data.html; - delete vm.data.style; - delete vm.data.fnClick; - delete vm.data.childStyle; - delete vm.data.childs; - delete vm.data.targetParentIndex; - vm.otherObj = null; - ($scope.$root && $scope.$root.$$phase) || $scope.$apply(); - }; - vm.fnChangeChildsBlockDisplay = (inputIsDisplay, inputEvent, inputOpts) => { - if (inputIsDisplay) { - const tmpVal = vm.data.textObj[inputOpts.target]; - vm.data.childStyle = { - top: `${inputOpts.index * 30}px`, - }; - if (tmpVal.childs && tmpVal.childs.length > 0) { - vm.data.childs = tmpVal.childs; - vm.data.targetParentIndex = inputOpts.index; - } else { - delete vm.data.childs; - delete vm.data.targetParentIndex; - } - } else { - const tmpIsChild = inputEvent - ? privateFun.getTargetValue(inputEvent.toElement || inputEvent.relatedTarget, 'target') === 'child' - : false; - if (!tmpIsChild) { - delete vm.data.childs; - delete vm.data.childStyle; - delete vm.data.targetParentIndex; - } - } - }; - $scope.$watch( - '$ctrl.otherObj', - () => { - if (!vm.otherObj) return; - if (vm.otherObj.hasOwnProperty('target')) { - $scope.item = vm.otherObj.target; - } - if (vm.otherObj.hasOwnProperty('authority')) { - vm.authorityObject = vm.otherObj.authority; - } - }, - true - ); - $element.prepend( - $compile( - '
' - )($scope) - ); - }, - ], - }; - }, - ]) - /** - * @tips 如果是通过$compile直接编译eo-drop-elem指令,会出现报错。需è¦æ‰‹åŠ¨åœ¨å¤–部æ­é…eo-Drop-Root或eo-drop-elem包裹在ng-...全局指令上 - */ - .directive('eoDropElem', [ - '$rootScope', - '$parse', - function ($rootScope, $parse) { - return { - restrict: 'AE', - scope: { - fnClick: '&', - textArr: '<', - setting: '<', - }, - require: '?^eoDropRoot', // ä¾èµ–eoDropRoot指令 - link($scope, elem, attrs, $eoDropRoot) { - // let privateFun={}; - // privateFun.getViewData = (inputEvent) => { - // if (inputEvent.offsetParent) { - // let tmpParentData = privateFun.getViewData(inputEvent.offsetParent); - // return { - // left: tmpParentData.left + inputEvent.offsetLeft, - // top: tmpParentData.top + inputEvent.offsetTop - // } - // } - // return { - // left: inputEvent.offsetLeft, - // top: inputEvent.offsetTop - // } - // } - elem.bind('click', (inputEvent) => { - inputEvent.stopPropagation(); - $eoDropRoot.data.showDropMenu = true; - $eoDropRoot.data.fnClick = $scope.fnClick; - if (attrs.otherObj) { - $eoDropRoot.otherObj = $parse(attrs.otherObj)($scope.$parent); - } - $eoDropRoot.data.textObj = {}; - let tmpHtml = ''; - const tmpTextArr = angular.copy($scope.textArr); - let tmpHasChild; - switch (typeof $scope.textArr) { - case 'string': { - tmpHtml = $scope.textArr; - if (attrs.hasOwnProperty('mark')) { - tmpHtml = tmpHtml.replace('$_{mark}', attrs.mark); - } - break; - } - default: { - for (const key in tmpTextArr) { - const val = tmpTextArr[key]; - if (!val.hasOwnProperty('value') || ($scope.setting && $scope.setting.targetIsObj)) { - if (!val.hasOwnProperty('value')) val.value = key; - $eoDropRoot.data.textObj[val.value] = val; - } - if (val.childs && val.childs.length > 0) { - tmpHasChild = true; - tmpHtml += `
${ - val.key - }
`; - } else { - tmpHtml += `
${val.key}
`; - } - } - - break; - } - } - if (tmpHasChild) { - tmpHtml = tmpHtml.replace( - /\$_child_mouseleave/g, - 'ng-mouseenter="$ctrl.fnChangeChildsBlockDisplay(false)"' - ); - tmpHtml = `
${tmpHtml}
{{item.key}}
`; - } else { - tmpHtml = tmpHtml.replace(/\$_child_mouseleave/g, ''); - } - $eoDropRoot.data.html = tmpHtml; - const tmpViewData = elem[0].getBoundingClientRect(); - const tmpTop = tmpViewData.height + 5; - if (tmpViewData.left < 150) { - $eoDropRoot.data.style = { - left: `${tmpViewData.left}px`, - top: `${tmpViewData.top + tmpTop}px`, - }; - } else { - $eoDropRoot.data.style = { - right: `${document.body.clientWidth - tmpViewData.left - tmpViewData.width}px`, - top: `${tmpViewData.top + tmpTop}px`, - }; - } - const targetTop = document.body.offsetHeight - tmpViewData.top; - if (targetTop < 100 && targetTop > 0) { - delete $eoDropRoot.data.style.top; - $eoDropRoot.data.style.bottom = `${document.body.clientHeight - tmpViewData.top + 5}px`; - } - elem[0].focus(); - ($scope.$root && $scope.$root.$$phase) || $scope.$apply(); - }); - const privateFun = {}; - privateFun.resetConf = () => { - if ($eoDropRoot.data.containerFocus) return; - delete $eoDropRoot.data.containerFocus; - delete $eoDropRoot.data.showDropMenu; - delete $eoDropRoot.data.textObj; - delete $eoDropRoot.data.html; - delete $eoDropRoot.data.style; - delete $eoDropRoot.data.fnClick; - delete $eoDropRoot.data.childStyle; - delete $eoDropRoot.data.childs; - delete $eoDropRoot.data.targetParentIndex; - $eoDropRoot.otherObj = null; - ($scope.$root && $scope.$root.$$phase) || $scope.$apply(); - }; - elem.bind('blur', privateFun.resetConf); - }, - }; - }, - ]); diff --git a/src/workbench/browser/src/ng1/directive/get-dom-length.directive.js b/src/workbench/browser/src/ng1/directive/get-dom-length.directive.js deleted file mode 100644 index 601f5c0d9..000000000 --- a/src/workbench/browser/src/ng1/directive/get-dom-length.directive.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * 获å–æŸä¸€èŠ‚ç‚¹çš„æ•°é‡ - * @param {string} bindClass 绑定监å¬ç±» - * @param {number} model ç»‘å®šè§†å›¾æ•°æ® - */ -angular.module('eolinker.directive').directive('getDomLengthCommonDirective', [ - '$rootScope', - function ($rootScope) { - return { - restrict: 'A', - scope: { - model: '=', - }, - link: function ($scope, elem, attrs, ngModel) { - $scope.data = { - domElemQuery: elem[0].getElementsByClassName(attrs.bindClass), - }; - (function main() { - $scope.$watch('data.domElemQuery.length', function () { - $scope.model = $scope.data.domElemQuery.length; - }); - })(); - }, - }; - }, -]); diff --git a/src/workbench/browser/src/ng1/directive/inner-html.directive.js b/src/workbench/browser/src/ng1/directive/inner-html.directive.js deleted file mode 100644 index 6cf403a2d..000000000 --- a/src/workbench/browser/src/ng1/directive/inner-html.directive.js +++ /dev/null @@ -1,68 +0,0 @@ -/* - * author:Eoapi - * 注入HTML指令js - * @require {string} html æ‰€éœ€æ³¨å…¥çš„ä»£ç  - * @param {string} status 注入代ç ç±»åž‹ï¼Œé»˜è®¤ç»‘定angular元素,若关闭状æ€ä¸ºunbind-angular - */ -angular - .module("eolinker.directive") - .directive("innerHtmlCommonDirective", [ - "$compile", - function ($compile) { - return { - restrict: "AE", - scope: { - html: "<", - innerHtmlCommonDirective: "@", - }, - link: function ($scope, elem, attrs, ctrl) { - let _Dom; - $scope.$watch( - attrs.html ? "html" : "innerHtmlCommonDirective", - function () { - var template = { - html: attrs.html - ? $scope.html - : $scope.innerHtmlCommonDirective, - elemFunName: "append", - }; - if (!template.html) { - if (attrs.defaultHtml) { - elem.empty(); - elem[template.elemFunName](attrs.defaultHtml); - } - if (!attrs.allowEmpty) return; - } - if (attrs.remove) elem.empty(); - if (attrs.position == "front") { - template.elemFunName = "prepend"; - } - switch (attrs.status) { - case "unbind-angular": { - elem[template.elemFunName](template.html); - break; - } - default: { - try { - _Dom = $compile(template.html)($scope.$parent); - } catch (CONSTRUCT_DOM_ERR) { - _Dom = $compile("" + template.html + "")( - $scope.$parent - ); - } - elem[template.elemFunName](_Dom); - break; - } - } - } - ); - $scope.$on("$destroy", () => { - $scope.$destroy(); - $scope = null; - if (_Dom) _Dom.remove(); - if (elem) elem.remove(); - }); - }, - }; - }, - ]); diff --git a/src/workbench/browser/src/ng1/directive/insert-html.directive.js b/src/workbench/browser/src/ng1/directive/insert-html.directive.js deleted file mode 100644 index 181b0e20b..000000000 --- a/src/workbench/browser/src/ng1/directive/insert-html.directive.js +++ /dev/null @@ -1,56 +0,0 @@ -angular - .module('eolinker.directive') - .directive('insertHtmlCommonDirective', [ - '$compile', - '$rootScope', - function ($compile, $rootScope) { - return { - restrict: 'AE', - scope: { - bindFun: '&', - }, - link: function ($scope, elem, attrs, ctrl) { - var CONST = { - HTML: document - .getElementById(attrs.templateId) - .innerHTML.replace(/-{-/g, '{{') - .replace(/-}-/g, '}}') - .replace(/{eoData}/g, 'ng'), - }, - data = { - hasDocument: false, - }, - fun = {}; - fun.bindFun = function ($event) { - var tmpBindFunBool = $scope.bindFun(); - switch (typeof tmpBindFunBool) { - case 'object': { - if (tmpBindFunBool.throw == 'needToStopEvent') $event.stopPropagation(); - if (!tmpBindFunBool.valid || data.hasDocument) { - $event.stopPropagation(); - return; - } - break; - } - default: { - if (!tmpBindFunBool || data.hasDocument) { - return; - } - break; - } - } - - data.hasDocument = true; - try { - elem[attrs.insertType || 'append']($compile(CONST.HTML)($scope.$parent)); - } catch (e) { - elem[attrs.insertType || 'append']($compile('
' + CONST.HTML + '
')($scope.$parent)); - } - }; - fun.init = (function () { - elem.bind(attrs.operateMark || 'click', fun.bindFun); - })(); - }, - }; - }, - ]); diff --git a/src/workbench/browser/src/ng1/directive/sort.directive.js b/src/workbench/browser/src/ng1/directive/sort.directive.js deleted file mode 100644 index d6f6d305e..000000000 --- a/src/workbench/browser/src/ng1/directive/sort.directive.js +++ /dev/null @@ -1,689 +0,0 @@ -'use strict'; -/* å‚考文档:https://github.com/kamilkp/angular-sortable-view - *改进者:Eoapi - */ -const $watch = []; -angular - .module('eolinker.directive') - /* - *这是所有的逻辑å‘生的地方。 - *如果多个列表应该彼此连接,以便元素å¯ä»¥åœ¨å®ƒä»¬ä¹‹é—´ç§»åŠ¨ï¼Œå¹¶ä¸”它们具有共åŒçš„祖先,则将此属性放在该元素上。 - *如果没有,并且您ä»ç„¶éœ€è¦å¯å¤šæŽ’åºçš„行为,必须æ供该属性的值。 - *该值将用作将这些根连接在一起的标识符。 - */ - .directive('svGroupRoot', [ - '$rootScope', - function ($rootScope) { - function shouldBeAfter(elem, pointer, isGrid) { - // 转æ¢èŠ‚点时最低ä½ç½®é™åˆ¶ - return isGrid ? elem.x - pointer.x < 0 : elem.y - pointer.y < 0; - } - - function getSortableElements(key) { - // 获å–排åºèŠ‚点 - return ROOTS_MAP[key]; - } - - function removeSortableElements(key) { - // 移除排åºèŠ‚点 - delete ROOTS_MAP[key]; - } - - let sortingInProgress; - var ROOTS_MAP = Object.create(null); // 外容器所包å«çš„排åºèŠ‚点集 - // window.ROOTS_MAP = ROOTS_MAP; // for debug purposes - return { - restrict: 'A', - controller: [ - '$scope', - '$attrs', - '$interpolate', - '$parse', - function ($scope, $attrs, $interpolate, $parse) { - const mapKey = $interpolate($attrs.svGroupRoot)($scope) || $scope.$id; - if (!ROOTS_MAP[mapKey]) ROOTS_MAP[mapKey] = []; - const that = this; - let candidates; // 设置å¯èƒ½ç›®çš„地å€é›† - let $placeholder; // å ä½ç¬¦èŠ‚点 - let options; // 排åºé€‰é¡¹ - let $helper; // å助节点 - 用鼠标指针拖动的节点 - - let $original; // 原始节点 - let $target; // 最åŽå®Œç¾Žç›®çš„åœ°å€ - const isGrid = false; // 是å¦ä¸ºç½‘格结构 - - const inputFun = $parse($attrs.fun)($scope); - this.sortingInProgress = function () { - return sortingInProgress; - }; - $watch.push( - $scope.$watch($attrs.disabled, (currentVal, beforeVal) => { - that.disabled = currentVal; - }) - ); - $scope.$on('$destroy', () => { - $watch.map((val, key) => { - val(); - }); - }); - // 移动更新 - this.$moveUpdate = function ( - opts, - mouse, - svGroupElement, - svOriginal, - svPlaceholder, - originatingPart, - originatingIndex - ) { - // 被移动元素的属性 - if (that.disabled) return; - const svRect = svGroupElement[0].getBoundingClientRect(); - if (opts.tolerance === 'element') - mouse = { - x: ~~(svRect.left + svRect.width / 2), - y: ~~(svRect.top + svRect.height / 2), - }; - - sortingInProgress = true; - candidates = []; // 候选集 - if (!$placeholder) { - if (svPlaceholder) { - // 自定义å ä½ç¬¦ - $placeholder = svPlaceholder.clone(); - $placeholder.removeClass('ng-hide'); - } else { - // 默认å ä½ç¬¦ - $placeholder = svOriginal.clone(); - $placeholder.addClass('sv-group-placeholder'); - $placeholder.css({ - height: `${svGroupElement[0].height}px`, - width: `${svGroupElement[0].width}px`, - }); - } - svOriginal.after($placeholder); - svOriginal.addClass('ng-hide'); - - // 缓存选项,帮助器和原始元素引用 - $original = svOriginal; - options = opts; - $helper = svGroupElement; - ($scope.$root && $scope.$root.$$phase) || $scope.$apply(); - } - - // ----- 移动节点 - $helper[0].reposition({ - x: mouse.x + document.body.scrollLeft - mouse.offset.x * svRect.width, - y: mouse.y + document.body.scrollTop - mouse.offset.y * svRect.height, - }); - // ----- 管ç†å€™é€‰é›† - getSortableElements(mapKey).forEach((se, index) => { - if (opts.containment != null) { - // 优化,移动开始时计算 - if ( - !elementMatchesSelector(se.element, opts.containment) && - !elementMatchesSelector(se.element, `${opts.containment} *`) - ) - return; // 元素ä¸åœ¨å…许的包å«å†… - } - const rect = se.element[0].getBoundingClientRect(); - const center = { - x: ~~(rect.left + rect.width / 2), - y: ~~(rect.top + rect.height / 2), - }; - if ( - !se.container && // ä¸æ˜¯å®¹å™¨å…ƒç´  - (se.element[0].scrollHeight || se.element[0].scrollWidth) - ) { - // 节点å¯è§ - candidates.push({ - element: se.element, - top: rect.top, - view: se.getPart(), - targetIndex: se.getIndex(), - after: shouldBeAfter(center, mouse, isGrid), - }); - } - }); - const helpRect = $helper[0].getBoundingClientRect(); - const placeholderRect = $placeholder[0].getBoundingClientRect(); - const helpCenterTop = helpRect.top + helpRect.height / 2; - const rangeHeight = helpRect.height / 4; - candidates.push({ - top: placeholderRect.top, - element: $placeholder, - placeholder: true, - }); - candidates.sort((a, b) => { - return a.top - b.top; - }); - let { groupDepth } = originatingPart.model(originatingPart.scope)[originatingIndex]; - const initPaddingLeft = groupDepth == 1 ? '10px' : `${(groupDepth - 1) * 2}em`; - candidates.forEach((cand, index) => { - const tmpTargetObj = originatingPart.model(originatingPart.scope)[cand.targetIndex]; - const tmpFunRemoveClass = () => { - if (!cand.placeholder) { - candidates[candidates.length - 1].element.removeClass('sv-group-candidate-bottom'); - cand.element.removeClass('sv-group-candidate-top sv-group-candidate'); - } - }; - let tmpIsFilterInAndAfter = false; - let tmpOnlyCanSortIn = false; - const tmpIsAfter = - helpCenterTop > candidates[candidates.length - 1].top + helpRect.height - rangeHeight; - if ($attrs.disabledModelKey && tmpTargetObj) { - // 判断是å¦ä¸ºä¸èƒ½æ‹–动到目标ä½ç½®çš„节点 - const tmpFilterObj = $parse($attrs.disabledModelKey)($scope); - if (tmpFilterObj) { - if (typeof tmpFilterObj === 'string') { - if (tmpTargetObj[tmpFilterObj] && !tmpIsAfter) { - tmpFunRemoveClass(); - return; - } - } else { - for (const val of tmpFilterObj) { - if (tmpTargetObj[val]) { - tmpFunRemoveClass(); - return; - } - } - } - } - } - if ($attrs.disabledLast && tmpTargetObj) { - const disabledLast = $parse($attrs.disabledLast)($scope); - if (disabledLast) { - if(cand.targetIndex===originatingPart.model(originatingPart.scope).length-1) tmpIsFilterInAndAfter=true; - } - } - if ($attrs.onlyCanSortInModelKey && tmpTargetObj) { - const tmpCanSortInObj = $parse($attrs.onlyCanSortInModelKey)($scope); - if (tmpCanSortInObj) { - if (typeof tmpCanSortInObj === 'string') { - if (tmpTargetObj[tmpCanSortInObj]) { - tmpOnlyCanSortIn = true; - } - } else { - for (const val of tmpCanSortInObj) { - if (tmpTargetObj[val]) { - tmpOnlyCanSortIn = true; - break; - } - } - } - } - } - - const tmpIsBefore = - helpCenterTop > - (index - 1 > -1 - ? candidates[index - 1].top + helpRect.height - rangeHeight - : candidates[0].top - rangeHeight) && helpCenterTop < cand.top + rangeHeight; - - const tmpIsCenter = - !$parse($attrs.unLevel)($scope) && - helpCenterTop > cand.top + rangeHeight && - helpCenterTop < cand.top + helpRect.height - rangeHeight; - if (tmpOnlyCanSortIn && !tmpIsCenter) { - tmpFunRemoveClass(); - } else if (tmpIsFilterInAndAfter && (tmpIsCenter || tmpIsAfter)) { - tmpFunRemoveClass(); - $target = null; - } else if (tmpIsBefore) { - if (!cand.placeholder) { - $target = cand; - $target.where = 'before'; - groupDepth = originatingPart.model(originatingPart.scope)[$target.targetIndex].groupDepth; - $helper.children().css({ - 'padding-left': groupDepth == 1 ? '10px' : `${(groupDepth - 1) * 2}em`, - }); - cand.element.removeClass('sv-group-candidate'); - cand.element.addClass('sv-group-candidate-top'); - } else { - $target = null; - $helper.children().css({ - 'padding-left': initPaddingLeft, - }); - } - } else if (tmpIsCenter) { - if (!cand.placeholder) { - $target = cand; - $target.where = 'in'; - groupDepth = originatingPart.model(originatingPart.scope)[$target.targetIndex].groupDepth; - $helper.children().css({ - 'padding-left': `${groupDepth * 2}em`, - }); - cand.element.addClass('sv-group-candidate'); - } else { - $target = null; - $helper.children().css({ - 'padding-left': initPaddingLeft, - }); - } - } else if (tmpIsAfter) { - if (!cand.placeholder) { - $target = cand; - $target.where = 'after'; - groupDepth = originatingPart.model(originatingPart.scope)[$target.targetIndex].groupDepth; - $helper.children().css({ - 'padding-left': groupDepth == 1 ? '10px' : `${(groupDepth - 1) * 2}em`, - }); - cand.element.removeClass('sv-group-candidate-top sv-group-candidate'); - candidates[candidates.length - 1].element.addClass('sv-group-candidate-bottom'); - } else { - $target = null; - $helper.children().css({ - 'padding-left': initPaddingLeft, - }); - } - } else { - tmpFunRemoveClass(); - } - }); - }; - - this.$drop = function (originatingPart, index, options, origin_scope) { - // è°ƒæ•´é¡ºåº - if (that.disabled) return; - if (!$placeholder) return; - if (options.revert) { - const placeholderRect = $placeholder[0].getBoundingClientRect(); - const helperRect = $helper[0].getBoundingClientRect(); - const distance = Math.sqrt( - Math.pow(helperRect.top - placeholderRect.top, 2) + - Math.pow(helperRect.left - placeholderRect.left, 2) - ); - let duration = (+options.revert * distance) / 200; // æ’定速度:æŒç»­æ—¶é—´å–决于è·ç¦» - duration = Math.min(duration, +options.revert); // 但是它ä¸å†æ˜¯options.revert - ['-webkit-', '-moz-', '-ms-', '-o-', ''].forEach((prefix) => { - if (typeof $helper[0].style[`${prefix}transition`] !== 'undefined') - $helper[0].style[`${prefix}transition`] = `all ${duration}ms ease`; - }); - setTimeout(afterRevert, duration); - } else { - afterRevert(); - } - - function afterRevert() { - // 布局æ¢å¤å‡½æ•° - sortingInProgress = false; - $placeholder.remove(); - $helper.remove(); - $original.removeClass('ng-hide'); - candidates = void 0; - $placeholder = void 0; - options = void 0; - $helper = void 0; - $original = void 0; - if ($target) { - // console.log($target, $target.element.scope(), origin_scope) - $target.element.removeClass('sv-group-candidate sv-group-candidate-top sv-group-candidate-bottom'); - const { targetIndex } = $target; - if ($attrs.fun) { - inputFun({ - originIndex: index, - targetIndex, - where: $target.where, - from: originatingPart.model(originatingPart.scope)[index], - fromScope: origin_scope, - to: originatingPart.model(originatingPart.scope)[targetIndex], - toScope: $target.element.scope(), - groupList: originatingPart.model(originatingPart.scope), - }); - } - } - $target = void 0; - ($scope.$root && $scope.$root.$$phase) || $scope.$apply(); - } - }; - - this.addToSortableElements = function (se) { - // 添加到排åºèŠ‚点集 - getSortableElements(mapKey).push(se); - }; - this.removeFromSortableElements = function (se) { - // 从原本排åºèŠ‚点集移除 - const elems = getSortableElements(mapKey); - const index = elems.indexOf(se); - if (index > -1) { - elems.splice(index, 1); - if (elems.length === 0) removeSortableElements(mapKey); - } - }; - }, - ], - }; - }, - ]) - /* - *此属性应放在作为ngRepeat的元素的容器的元素上。 其值应与ng-repeat属性中的å³ä¾§è¡¨è¾¾å¼ç›¸åŒã€‚ - */ - .directive('svGroupPart', [ - '$parse', - function ($parse) { - return { - restrict: 'A', - require: '^svGroupRoot', // ä¾èµ–svRoot指令 - controller: [ - '$scope', - function ($scope) { - $scope.$svCtrl = this; - this.getPart = function () { - // 获å–sv-root $scope.part - return $scope.part; - }; - this.$drop = function (index, options, origin_scope) { - $scope.$sortableRoot.$drop($scope.part, index, options, origin_scope); - }; - }, - ], - scope: true, - link($scope, $element, $attrs, $sortable) { - if (!$attrs.svGroupPart) throw new Error('no model provided'); - const model = $parse($attrs.svGroupPart); - if (!model.assign) throw new Error('model not assignable'); - $scope.part = { - id: $scope.$id, - element: $element, - model, - scope: $scope, - }; - $scope.$sortableRoot = $sortable; - - const sortablePart = { - element: $element, - getPart: $scope.$svCtrl.getPart, - container: true, - }; - $sortable.addToSortableElements(sortablePart); - $scope.$on('$destroy', () => { - $sortable.removeFromSortableElements(sortablePart); - }); - }, - }; - }, - ]) - /* - *此属性应放置在与ng-repeat属性相åŒçš„元素上。 - *它的(å¯é€‰ï¼‰å€¼åº”该是一个计算为options对象的表达å¼ã€‚ - *å«ï¼šmousedown touchstart mousemove touchmove mouseup touchend touchcancelæ“作 - */ - .directive('svGroupElement', [ - '$parse', - '$rootScope', - function ($parse, $rootScope) { - return { - restrict: 'A', - require: ['?^svGroupPart', '?^svGroupRoot'], // ä¾èµ–svGroupPart以åŠsvRoot指令 - controller: [ - '$scope', - function ($scope) { - $scope.$svCtrl = this; - }, - ], - link($scope, $element, $attrs, $controllers) { - if (!$controllers[0]) return; - const sortableElement = { - element: $element, - getPart: $controllers[0].getPart, - getIndex() { - return $scope.$index; - }, - }; - let opts = $parse($attrs.svGroupElement)($scope); - let containment = null; - if (opts.containment) { - containment = closestElement.call($element, opts.containment); - var containmentRect = containment[0].getBoundingClientRect(); - } - $controllers[1].addToSortableElements(sortableElement); - $scope.$on('$destroy', () => { - $controllers[1].removeFromSortableElements(sortableElement); - }); - const body = angular.element(document.body); - let moveExecuted; - let interval = null; - let handle = $element; - const tmpMouseUpFun = $parse($attrs.mouseUp)($scope); - handle.on('mousedown touchstart', onMousedown); - $scope.$watch('$svCtrl.handle', (customHandle) => { - if (customHandle) { - handle.off('mousedown touchstart', onMousedown); - handle = customHandle; - handle.on('mousedown touchstart', onMousedown); - } - }); - let helper; - let placeholder; - - function onMousedown(e) { - // mouseDown函数 - touchFix(e); - if ($controllers[1].sortingInProgress()) return; - if ($controllers[1].disabled) return; - if (e.button != 0 && e.type === 'mousedown') return; - moveExecuted = false; - opts = angular.extend( - {}, - { - tolerance: 'pointer', - revert: 200, - }, - opts - ); - const mouseMove = { - down: e.pageY, - }; - const target = $element; - const clientRectCache = JSON.parse(JSON.stringify($element[0].getBoundingClientRect())); - - const clientRect = { - ...clientRectCache, - left: clientRectCache.left + (opts.correctionLeft || 0), - top: clientRectCache.top + (opts.correctionTop || 0), - }; - - let clone; - if (!helper) helper = $controllers[0].helper; - if (!placeholder) placeholder = $controllers[0].placeholder; - if (helper) { - clone = helper.clone(); - clone.removeClass('ng-hide'); - clone.css({ - left: `${clientRect.left + document.body.scrollLeft}px`, - top: `${clientRect.top + document.body.scrollTop}px`, - }); - target.addClass('sv-visibility-hidden'); - } else { - clone = target.clone(); - clone.addClass('sv-group-helper').css({ - left: `${clientRect.left + document.body.scrollLeft}px`, - top: `${clientRect.top + document.body.scrollTop}px`, - width: `${clientRect.width}px`, - }); - } - let scrollRange = 0; - clone[0].reposition = function (coords) { - // 克隆元素é‡å®šä½ - if (interval) { - clearInterval(interval); - } - const targetLeft = coords.x; - const targetTop = coords.y; - const helperRect = clone[0].getBoundingClientRect(); - const { body } = document; - const parentContainer = angular.element(document.getElementsByClassName(opts.parentContainment)); - const parentRect = parentContainer[0].getBoundingClientRect(); - - if (containmentRect) { - if (targetTop > parentRect.top - helperRect.height && targetTop < parentRect.top + helperRect.height) { - // 上边界 - scrollRange = parentContainer[0].scrollTop; - interval = setInterval(() => { - scrollRange -= 10; - parentContainer[0].scrollTop = scrollRange; - if (scrollRange == 0) { - clearInterval(interval); - } - }, 70); - } else if ( - targetTop > parentRect.height + parentRect.top - helperRect.height && - targetTop < parentRect.height + parentRect.top + helperRect.height / 4 - ) { - // 下边界 - scrollRange = parentContainer[0].scrollTop; - interval = setInterval(() => { - scrollRange += 10; - parentContainer[0].scrollTop = scrollRange; - if (scrollRange >= parentContainer[0].scrollHeight - parentRect.height) { - clearInterval(interval); - } - }, 70); - } - } - this.style.top = `${targetTop - body.scrollTop}px`; - }; - const pointerOffset = { - x: (e.clientX - clientRect.left) / clientRect.width, - y: (e.clientY - clientRect.top) / clientRect.height, - }; - containment.addClass('sv-sorting-in-progress'); - - function onMousemove(e) { - mouseMove.move = e.pageY; - if (mouseMove.down - mouseMove.move > -5 && mouseMove.down - mouseMove.move < 5) return; - if ($controllers[1].disabled) return; - touchFix(e); - if (!moveExecuted) { - insertElementBefore($element, clone); - moveExecuted = true; - } - $controllers[1].$moveUpdate( - opts, - { - x: e.clientX, - y: e.clientY, - offset: pointerOffset, - }, - clone, - $element, - placeholder, - $controllers[0].getPart(), - $scope.$index - ); - } - containment.bind('mousemove', onMousemove).on('mouseup touchend touchcancel', function mouseup(e) { - if (tmpMouseUpFun) tmpMouseUpFun(); - if (interval) { - clearInterval(interval); - } - containment.off('mousemove', onMousemove); - if (moveExecuted) { - $controllers[0].$drop($scope.$index, opts, $scope); - } - containment.removeClass('sv-sorting-in-progress'); - $element.removeClass('sv-visibility-hidden'); - containment.off('mouseup touchend touchcancel', mouseup); - }); - } - }, - }; - }, - ]) - .directive('svGroupHandle', () => { - return { - require: '?^svGroupElement', // ä¾èµ–svElement指令 - link($scope, $element, $attrs, $svCtrl) { - if ($svCtrl) $svCtrl.handle = $element.add($svCtrl.handle); // 支æŒæ·»åŠ å¤šçº§æŠŠæ‰‹ - $scope.$on('$destroy', () => { - $element.remove(); - }); - }, - }; - }); - -function touchFix(e) { - // 拖动ä½ç½®åŒ¹é… - if (!('clientX' in e) && !('clientY' in e)) { - const touches = e.touches || e.originalEvent.touches; - if (touches && touches.length) { - e.clientX = touches[0].clientX; - e.clientY = touches[0].clientY; - } - e.preventDefault(); - } -} - -function getPreviousSibling(element) { - // 获å–上一级元素 - element = element[0]; - if (element.previousElementSibling) return angular.element(element.previousElementSibling); - else { - let sib = element.previousSibling; - while (sib != null && sib.nodeType != 1) sib = sib.previousSibling; - return angular.element(sib); - } -} - -function insertElementBefore(element, newElement) { - // 在被选元素内部的开头æ’入新节点 - const prevSibl = getPreviousSibling(element); - if (prevSibl.length > 0) { - prevSibl.after(newElement); - } else { - element.parent().prepend(newElement); - } -} - -const dde = document.documentElement; -const matchingFunction = dde.matches - ? 'matches' - : dde.matchesSelector - ? 'matchesSelector' - : dde.webkitMatches - ? 'webkitMatches' - : dde.webkitMatchesSelector - ? 'webkitMatchesSelector' - : dde.msMatches - ? 'msMatches' - : dde.msMatchesSelector - ? 'msMatchesSelector' - : dde.mozMatches - ? 'mozMatches' - : dde.mozMatchesSelector - ? 'mozMatchesSelector' - : null; -if (matchingFunction == null) throw "This browser doesn't support the HTMLElement.matches method"; - -function elementMatchesSelector(element, selector) { - // 设置节点匹é…选择器 - if (element instanceof angular.element) element = element[0]; - if (matchingFunction !== null) return element[matchingFunction](selector); -} - -var closestElement = - angular.element.prototype.closest || - function (selector) { - let el = this[0].parentNode; - while (el !== document.documentElement && !el[matchingFunction](selector)) el = el.parentNode; - if (el[matchingFunction](selector)) return angular.element(el); - else return angular.element(); - }; - -/* - 简å•å®žçŽ°jQuery .add方法 - */ -if (typeof angular.element.prototype.add !== 'function') { - angular.element.prototype.add = function (elem) { - var i, - res = angular.element(); - elem = angular.element(elem); - for (i = 0; i < this.length; i++) { - res.push(this[i]); - } - for (i = 0; i < elem.length; i++) { - res.push(elem[i]); - } - return res; - }; -} diff --git a/src/workbench/browser/src/ng1/index.css b/src/workbench/browser/src/ng1/index.css deleted file mode 100644 index a85db10fa..000000000 --- a/src/workbench/browser/src/ng1/index.css +++ /dev/null @@ -1,16340 +0,0 @@ -@charset "UTF-8"; -/*! Editor.md v1.5.0 | editormd.min.css | Open source online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-06-09 */ -/*! prefixes.scss v0.1.0 | Author: Pandao | https://github.com/pandao/prefixes.scss | MIT license | Copyright (c) 2015 */ -.fa-ul, -.markdown-body .task-list-item, -li.L0, -li.L1, -li.L2, -li.L3, -li.L5, -li.L6, -li.L7, -li.L8 { - list-style-type: none; -} - -.editormd-form br, -.markdown-body hr:after { - clear: both; -} - -.editormd { - width: 90%; - height: 640px; - margin: 0 auto; - text-align: left; - overflow: hidden; - position: relative; - border: 1px solid var(--BORDER); - font-family: 'Meiryo UI', 'Microsoft YaHei', 'Malgun Gothic', 'Segoe UI', 'Trebuchet MS', Helvetica, Monaco, monospace, Tahoma, STXihei, 'åŽæ–‡ç»†é»‘', STHeiti, 'Helvetica Neue', 'Droid Sans', 'wenquanyi micro hei', FreeSans, Arimo, Arial, SimSun, '宋体', Heiti, '黑体', sans-serif; -} - -.editormd *, -.editormd:after, -.editormd:before { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} - -.editormd a { - text-decoration: none; -} - -.editormd img { - border: none; - vertical-align: middle; -} - -.editormd .editormd-html-textarea, -.editormd .editormd-markdown-textarea, -.editormd > textarea { - width: 0; - height: 0; - outline: 0; - resize: none; -} - -.editormd .editormd-html-textarea, -.editormd .editormd-markdown-textarea { - display: none; -} - -.editormd button, -.editormd input[type='text'], -.editormd input[type='button'], -.editormd input[type='submit'], -.editormd select, -.editormd textarea { - -webkit-appearance: none; - -moz-appearance: none; - -ms-appearance: none; - appearance: none; -} - -.editormd::-webkit-scrollbar { - height: 10px; - width: 7px; - background: rgba(0, 0, 0, 0.1); -} - -.editormd::-webkit-scrollbar:hover { - background: rgba(0, 0, 0, 0.2); -} - -.editormd::-webkit-scrollbar-thumb { - background: rgba(0, 0, 0, 0.3); - -webkit-border-radius: 6px; - -moz-border-radius: 6px; - -ms-border-radius: 6px; - -o-border-radius: 6px; - border-radius: 6px; -} - -.editormd::-webkit-scrollbar-thumb:hover { - -webkit-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.25); - -moz-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.25); - -ms-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.25); - -o-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.25); - box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.25); - background-color: rgba(0, 0, 0, 0.4); -} - -.editormd-user-unselect { - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - -o-user-select: none; - user-select: none; -} - -.editormd-toolbar { - width: 100%; - min-height: 37px; - background: var(--MAIN_BG); - display: none; - position: absolute; - top: 0; - left: 0; - z-index: 3; - border-bottom: 1px solid var(--BORDER); -} - -.editormd-toolbar-container { - padding: 0 8px; - min-height: 35px; - -o-user-select: none; - user-select: none; -} - -.editormd-toolbar-container, -.markdown-body .octicon { - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; -} - -.editormd-menu, -.markdown-body ol, -.markdown-body td, -.markdown-body th, -.markdown-body ul { - padding: 0; -} - -.editormd-menu { - margin: 0; - list-style: none; -} - -.editormd-menu > li { - margin: 0; - padding: 5px 1px; - display: inline-block; - position: relative; -} - -.editormd-menu > li.divider { - display: inline-block; - text-indent: -9999px; - margin: 0 5px; - height: 65%; - border-right: 1px solid #ddd; -} - -.editormd-menu > li > a { - outline: 0; - color: #666; - display: inline-block; - min-width: 24px; - font-size: 16px; - text-decoration: none; - text-align: center; - -webkit-border-radius: 2px; - -moz-border-radius: 2px; - -ms-border-radius: 2px; - -o-border-radius: 2px; - border-radius: 2px; - border: 1px solid #fff; - transition: all 300ms ease-out; -} - -.editormd-dropdown-menu > li > a:hover, -.editormd-menu > li > a { - -webkit-transition: all 300ms ease-out; - -moz-transition: all 300ms ease-out; -} - -.editormd-menu > li > a.active, -.editormd-menu > li > a:hover { - border: 1px solid #ddd; - background: #eee; -} - -.editormd-menu > li > a > .fa { - text-align: center; - display: block; - padding: 5px; -} - -.editormd-menu > li > a > .editormd-bold { - padding: 5px 2px; - display: inline-block; - font-weight: 700; -} - -.editormd-menu > li:hover .editormd-dropdown-menu { - display: block; -} - -.editormd-menu > li + li > a { - margin-left: 3px; -} - -.editormd-dropdown-menu { - display: none; - background: var(--MAIN_BG); - border: 1px solid var(--BORDER); - width: 148px; - list-style: none; - position: absolute; - top: 33px; - left: 0; - z-index: 100; - -webkit-box-shadow: 1px 2px 6px rgba(0, 0, 0, 0.15); - -moz-box-shadow: 1px 2px 6px rgba(0, 0, 0, 0.15); - -ms-box-shadow: 1px 2px 6px rgba(0, 0, 0, 0.15); - -o-box-shadow: 1px 2px 6px rgba(0, 0, 0, 0.15); - box-shadow: 1px 2px 6px rgba(0, 0, 0, 0.15); -} - -.editormd-dropdown-menu:after, -.editormd-dropdown-menu:before { - width: 0; - height: 0; - display: block; - content: ''; - position: absolute; - top: -11px; - left: 8px; - border: 5px solid transparent; -} - -.editormd-dropdown-menu:before { - border-bottom-color: #ccc; -} - -.editormd-dropdown-menu:after { - border-bottom-color: #fff; - top: -10px; -} - -.editormd-dropdown-menu > li > a { - color: #666; - display: block; - text-decoration: none; - padding: 8px 10px; -} - -.editormd-dropdown-menu > li > a:hover { - background: #f6f6f6; - transition: all 300ms ease-out; -} - -.editormd-dropdown-menu > li + li { - border-top: 1px solid #ddd; -} - -.editormd-container { - margin: 0; - width: 100%; - height: 100%; - overflow: hidden; - padding: 35px 0 0; - position: relative; - background: var(--MAIN_BG); - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} - -.editormd-dialog { - color: #666; - position: fixed; - z-index: 99999; - display: none; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - -ms-border-radius: 3px; - -o-border-radius: 3px; - border-radius: 3px; - -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); - -moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); - -ms-box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); - -o-box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); - box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); - background: #fff; - font-size: 14px; -} - -.editormd-dialog-container { - position: relative; - padding: 20px; - line-height: 1.4; -} - -.editormd-dialog-container h1 { - font-size: 24px; - margin-bottom: 10px; -} - -.editormd-dialog-container h1 .fa { - color: #2c7eea; - padding-right: 5px; -} - -.editormd-dialog-container h1 small { - padding-left: 5px; - font-weight: 400; - font-size: 12px; - color: #999; -} - -.editormd-dialog-container select { - color: #999; - padding: 3px 8px; - border: 1px solid #ddd; -} - -.editormd-dialog-close { - position: absolute; - top: 12px; - right: 15px; - font-size: 18px; - color: #ccc; - -webkit-transition: color 300ms ease-out; - -moz-transition: color 300ms ease-out; - transition: color 300ms ease-out; -} - -.editormd-dialog-close:hover { - color: #999; -} - -.editormd-dialog-header { - padding: 11px 20px; - border-bottom: 1px solid #eee; - -webkit-transition: background 300ms ease-out; - -moz-transition: background 300ms ease-out; - transition: background 300ms ease-out; -} - -.editormd-dialog-header:hover { - background: #f6f6f6; -} - -.editormd-dialog-title { - font-size: 14px; -} - -.editormd-dialog-footer { - padding: 10px 0 0; - text-align: right; -} - -.editormd-dialog-info { - width: 420px; -} - -.editormd-dialog-info h1 { - font-weight: 400; -} - -.editormd-dialog-info .editormd-dialog-container { - padding: 20px 25px 25px; -} - -.editormd-dialog-info .editormd-dialog-close { - top: 10px; - right: 10px; -} - -.editormd-dialog-info .hover-link:hover, -.editormd-dialog-info p > a { - color: #2196f3; -} - -.editormd-dialog-info .hover-link { - color: #666; -} - -.editormd-dialog-info a .fa-external-link { - display: none; -} - -.editormd-dialog-info a:hover { - color: #2196f3; -} - -.editormd-dialog-info a:hover .fa-external-link { - display: inline-block; -} - -.editormd-container-mask, -.editormd-dialog-mask, -.editormd-mask { - display: none; - width: 100%; - height: 100%; - position: absolute; - top: 0; - left: 0; -} - -.editormd-dialog-mask-bg, -.editormd-mask { - background: var(--MAIN_BG); - opacity: 0.5; - filter: alpha(opacity=50); -} - -.editormd-mask { - position: fixed; - background: #000; - opacity: 0.2; - filter: alpha(opacity=20); - z-index: 99998; -} - -.editormd-container-mask { - z-index: 20; - display: block; - background-color: var(--MAIN_BG); -} - -.editormd-code-block-dialog textarea, -.editormd-preformatted-text-dialog textarea { - width: 100%; - height: 400px; - margin-bottom: 6px; - overflow: auto; - border: 1px solid #eee; - background: var(--MAIN_BG); - padding: 15px; - resize: none; -} - -.editormd-code-toolbar { - color: #999; - font-size: 14px; - margin: -5px 0 10px; -} - -.editormd-grid-table { - width: 99%; - display: table; - border: 1px solid var(--BORDER); - border-collapse: collapse; -} - -.editormd-grid-table-row { - width: 100%; - display: table-row; -} - -.editormd-grid-table-row a { - font-size: 1.4em; - width: 5%; - height: 36px; - color: #999; - text-align: center; - display: table-cell; - vertical-align: middle; - border: 1px solid #ddd; - text-decoration: none; - -webkit-transition: background-color 300ms ease-out, color 100ms ease-in; - -moz-transition: background-color 300ms ease-out, color 100ms ease-in; - transition: background-color 300ms ease-out, color 100ms ease-in; -} - -.editormd-grid-table-row a.selected { - color: #666; - background-color: #eee; -} - -.editormd-grid-table-row a:hover { - color: #777; - background-color: #f6f6f6; -} - -.editormd-tab-head { - list-style: none; - border-bottom: 1px solid #ddd; -} - -.editormd-tab-head li { - display: inline-block; -} - -.editormd-tab-head li a { - color: #999; - display: block; - padding: 6px 12px 5px; - text-align: center; - text-decoration: none; - margin-bottom: -1px; - border: 1px solid #ddd; - -webkit-border-top-left-radius: 3px; - -moz-border-top-left-radius: 3px; - -ms-border-top-left-radius: 3px; - -o-border-top-left-radius: 3px; - border-top-left-radius: 3px; - -webkit-border-top-right-radius: 3px; - -moz-border-top-right-radius: 3px; - -ms-border-top-right-radius: 3px; - -o-border-top-right-radius: 3px; - border-top-right-radius: 3px; - background: #f6f6f6; - -webkit-transition: all 300ms ease-out; - -moz-transition: all 300ms ease-out; - transition: all 300ms ease-out; -} - -.editormd-tab-head li a:hover { - color: #666; - background: #eee; -} - -.editormd-tab-head li.active a { - color: #666; - background: #fff; - border-bottom-color: #fff; -} - -.editormd-tab-head li + li { - margin-left: 3px; -} - -.editormd-tab-box { - padding: 20px 0; -} - -.editormd-form { - color: #666; -} - -.editormd-form label { - float: left; - display: block; - width: 75px; - text-align: left; - padding: 7px 0 15px 5px; - margin: 0 0 2px; - font-weight: 400; -} - -.editormd-form iframe { - display: none; -} - -.editormd-form input:focus { - outline: 0; -} - -.editormd-form input[type='text'], -.editormd-form input[type='number'] { - color: #999; - padding: 8px; - border: 1px solid #ddd; -} - -.editormd-form input[type='number'] { - width: 40px; - display: inline-block; - padding: 6px 8px; -} - -.editormd-form input[type='text'] { - display: inline-block; - width: 264px; -} - -.editormd-form .fa-btns { - display: inline-block; -} - -.editormd-form .fa-btns a { - color: #999; - padding: 7px 10px 0 0; - display: inline-block; - text-decoration: none; - text-align: center; -} - -.editormd-form .fa-btns .fa { - font-size: 1.3em; -} - -.editormd-form .fa-btns label { - float: none; - display: inline-block; - width: auto; - text-align: left; - padding: 0 0 0 5px; - cursor: pointer; -} - -.fa-fw, -.fa-li { - text-align: center; -} - -.editormd-dialog-container .editormd-btn, -.editormd-dialog-container button, -.editormd-dialog-container input[type='submit'], -.editormd-dialog-footer .editormd-btn, -.editormd-dialog-footer button, -.editormd-dialog-footer input[type='submit'], -.editormd-form .editormd-btn, -.editormd-form button, -.editormd-form input[type='submit'] { - color: #666; - min-width: 75px; - cursor: pointer; - background: #fff; - padding: 7px 10px; - border: 1px solid #ddd; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - -ms-border-radius: 3px; - -o-border-radius: 3px; - border-radius: 3px; - -webkit-transition: background 300ms ease-out; - -moz-transition: background 300ms ease-out; - transition: background 300ms ease-out; -} - -.editormd-dialog-container .editormd-btn:hover, -.editormd-dialog-container button:hover, -.editormd-dialog-container input[type='submit']:hover, -.editormd-dialog-footer .editormd-btn:hover, -.editormd-dialog-footer button:hover, -.editormd-dialog-footer input[type='submit']:hover, -.editormd-form .editormd-btn:hover, -.editormd-form button:hover, -.editormd-form input[type='submit']:hover { - background: #eee; -} - -.editormd-dialog-container .editormd-btn + .editormd-btn, -.editormd-dialog-footer .editormd-btn + .editormd-btn, -.editormd-form .editormd-btn + .editormd-btn { - margin-left: 8px; -} - -.editormd-file-input { - width: 75px; - height: 32px; - margin-left: 8px; - position: relative; - display: inline-block; -} - -.editormd-file-input input[type='file'] { - width: 75px; - height: 32px; - opacity: 0; - cursor: pointer; - background: #000; - display: inline-block; - position: absolute; - top: 0; - right: 0; -} - -.editormd-file-input input[type='file']::-webkit-file-upload-button { - visibility: hidden; -} - -.editormd-file-input:hover input[type='submit'] { - background: #eee; -} - -.editormd .CodeMirror, -.editormd-preview { - display: inline-block; - width: 50%; - height: 100%; - vertical-align: top; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; - margin: 0; -} - -.editormd-preview { - position: absolute; - top: 35px; - right: 0; - overflow: auto; - line-height: 1.6; - display: none; - background: var(--MAIN_BG); -} - -.fa, -.fa-stack { - display: inline-block; -} - -.editormd .CodeMirror { - z-index: 3; - float: left; - border-right: 1px solid #ddd; - font-size: 14px; - font-family: 'YaHei Consolas Hybrid', Consolas, '微软雅黑', 'Meiryo UI', 'Malgun Gothic', 'Segoe UI', 'Trebuchet MS', Helvetica, Monaco, courier, monospace; - line-height: 1.6; - margin-top: 35px; -} - -.editormd .CodeMirror pre { - font-size: 14px; - padding: 0 12px; -} - -.editormd .CodeMirror-linenumbers { - padding: 0 5px; -} - -.editormd .CodeMirror-focused .CodeMirror-selected, -.editormd .CodeMirror-selected { - background: #70b7ff; -} - -.editormd .CodeMirror, -.editormd .CodeMirror-scroll, -.editormd .editormd-preview { - -webkit-overflow-scrolling: touch; -} - -.editormd .styled-background { - background-color: #ff7; -} - -.editormd .CodeMirror-focused .cm-matchhighlight { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAFklEQVQI12NgYGBgkKzc8x9CMDAwAAAmhwSbidEoSQAAAABJRU5ErkJggg==); - background-position: bottom; - background-repeat: repeat-x; -} - -.editormd .CodeMirror-empty.CodeMirror-focused { - outline: 0; -} - -.editormd .CodeMirror pre.CodeMirror-placeholder { - color: #999; -} - -.editormd .cm-trailingspace { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAACCAYAAAB/qH1jAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QUXCToH00Y1UgAAACFJREFUCNdjPMDBUc/AwNDAAAFMTAwMDA0OP34wQgX/AQBYgwYEx4f9lQAAAABJRU5ErkJggg==); - background-position: bottom left; - background-repeat: repeat-x; -} - -.editormd .cm-tab { - background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAMCAYAAAAkuj5RAAAAAXNSR0IArs4c6QAAAGFJREFUSMft1LsRQFAQheHPowAKoACx3IgEKtaEHujDjORSgWTH/ZOdnZOcM/sgk/kFFWY0qV8foQwS4MKBCS3qR6ixBJvElOobYAtivseIE120FaowJPN75GMu8j/LfMwNjh4HUpwg4LUAAAAASUVORK5CYII=) right no-repeat; -} - -/*! prefixes.scss v0.1.0 | Author: Pandao | https://github.com/pandao/prefixes.scss | MIT license | Copyright (c) 2015 */ -/*! - * Font Awesome 4.3.0 by @davegandy - http://fontawesome.io - @fontawesome - * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) - */ -/*@font-face { - font-family: FontAwesome; - src: url(../fonts/fontawesome-webfont.eot?v=4.3.0); - src: url(../fonts/fontawesome-webfont.eot?#iefix&v=4.3.0)format("embedded-opentype"), url(../fonts/fontawesome-webfont.woff2?v=4.3.0)format("woff2"), url(../fonts/fontawesome-webfont.woff?v=4.3.0)format("woff"), url(../fonts/fontawesome-webfont.ttf?v=4.3.0)format("truetype"), url(../fonts/fontawesome-webfont.svg?v=4.3.0#fontawesomeregular)format("svg"); - font-weight: 400; - font-style: normal -} - -.fa { - font: normal normal normal 14px/1 FontAwesome; - font-size: inherit; - text-rendering: auto; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - transform: translate(0, 0) -}*/ -.fa-lg { - font-size: 1.33333333em; - line-height: 0.75em; - vertical-align: -15%; -} - -.fa-2x { - font-size: 2em; -} - -.fa-3x { - font-size: 3em; -} - -.fa-4x { - font-size: 4em; -} - -.fa-5x { - font-size: 5em; -} - -.fa-fw { - width: 1.28571429em; -} - -.fa-ul { - padding-left: 0; - margin-left: 2.14285714em; -} - -.fa-ul > li { - position: relative; -} - -.fa-li { - position: absolute; - left: -2.14285714em; - width: 2.14285714em; - top: 0.14285714em; -} - -.fa-li.fa-lg { - left: -1.85714286em; -} - -.fa-border { - padding: 0.2em 0.25em 0.15em; - border: 0.08em solid #eee; - border-radius: 0.1em; -} - -.pull-right { - float: right; -} - -.pull-left { - float: left; -} - -.fa.pull-left { - margin-right: 0.3em; -} - -.fa.pull-right { - margin-left: 0.3em; -} - -.fa-spin { - -webkit-animation: fa-spin 2s infinite linear; - animation: fa-spin 2s infinite linear; -} - -.fa-pulse { - -webkit-animation: fa-spin 1s infinite steps(8); - animation: fa-spin 1s infinite steps(8); -} - -@-webkit-keyframes fa-spin { - 0% { - -webkit-transform: rotate(0); - transform: rotate(0); - } - 100% { - -webkit-transform: rotate(359deg); - transform: rotate(359deg); - } -} -@keyframes fa-spin { - 0% { - -webkit-transform: rotate(0); - transform: rotate(0); - } - 100% { - -webkit-transform: rotate(359deg); - transform: rotate(359deg); - } -} -:root .fa-flip-horizontal, -:root .fa-flip-vertical, -:root .fa-rotate-180, -:root .fa-rotate-270, -:root .fa-rotate-90 { - filter: none; -} - -.fa-stack { - position: relative; - width: 2em; - height: 2em; - line-height: 2em; - vertical-align: middle; -} - -.fa-stack-1x, -.fa-stack-2x { - position: absolute; - left: 0; - width: 100%; - text-align: center; -} - -.fa-stack-1x { - line-height: inherit; -} - -.fa-stack-2x { - font-size: 2em; -} - -.fa-inverse { - color: #fff; -} - - -.editormd-logo, -.editormd-logo-1x, -.editormd-logo-2x, -.editormd-logo-3x, -.editormd-logo-4x, -.editormd-logo-5x, -.editormd-logo-6x, -.editormd-logo-7x, -.editormd-logo-8x { - font-family: editormd-logo; - speak: none; - font-style: normal; - font-weight: 400; - font-variant: normal; - text-transform: none; - font-size: inherit; - line-height: 1; - display: inline-block; - text-rendering: auto; - vertical-align: inherit; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -.markdown-body hr:after, -.markdown-body hr:before { - content: ''; - display: table; -} - -.editormd-logo-1x:before, -.editormd-logo-2x:before, -.editormd-logo-3x:before, -.editormd-logo-4x:before, -.editormd-logo-5x:before, -.editormd-logo-6x:before, -.editormd-logo-7x:before, -.editormd-logo-8x:before, -.editormd-logo:before { - content: '\e1987'; -} - -.editormd-logo-1x { - font-size: 1em; -} - -.editormd-logo-lg { - font-size: 1.2em; -} - -.editormd-logo-2x { - font-size: 2em; -} - -.editormd-logo-3x { - font-size: 3em; -} - -.editormd-logo-4x { - font-size: 4em; -} - -.editormd-logo-5x { - font-size: 5em; -} - -.editormd-logo-6x { - font-size: 6em; -} - -.editormd-logo-7x { - font-size: 7em; -} - -.editormd-logo-8x { - font-size: 8em; -} - -.editormd-logo-color { - color: #2196f3; -} - - -.markdown-body { - -ms-text-size-adjust: 100%; - -webkit-text-size-adjust: 100%; - color: var(--MAIN_TEXT); - overflow: hidden; - font-family: 'Microsoft YaHei', Helvetica, 'Meiryo UI', 'Malgun Gothic', 'Segoe UI', 'Trebuchet MS', Monaco, monospace, Tahoma, STXihei, 'åŽæ–‡ç»†é»‘', STHeiti, 'Helvetica Neue', 'Droid Sans', 'wenquanyi micro hei', FreeSans, Arimo, Arial, SimSun, '宋体', Heiti, '黑体', sans-serif; - font-size: 16px; - line-height: 1.6; - word-wrap: break-word; -} - -.markdown-body strong { - font-weight: 700; -} - -.markdown-body h1 { - margin: 0.67em 0; -} - -.markdown-body img { - border: 0; -} - -.markdown-body hr { - -moz-box-sizing: content-box; - box-sizing: content-box; - height: 0; -} - -.markdown-body input { - color: inherit; - margin: 0; - line-height: normal; - font: 13px/1.4 Helvetica, arial, freesans, clean, sans-serif, 'Segoe UI Emoji', 'Segoe UI Symbol'; -} - -.markdown-body html input[disabled] { - cursor: default; -} - -.markdown-body input[type='checkbox'] { - -moz-box-sizing: border-box; - box-sizing: border-box; - padding: 0; -} - -.markdown-body * { - -moz-box-sizing: border-box; - box-sizing: border-box; -} - -.markdown-body a { - background: 0 0; - color: #4183c4; - text-decoration: none; -} - -.markdown-body a:active, -.markdown-body a:hover { - outline: 0; - text-decoration: underline; -} - -.markdown-body hr { - margin: 15px 0; - overflow: hidden; - background: 0 0; - border: 0; - border-bottom: 1px solid var(--BORDER); -} - -.markdown-body h1, -.markdown-body h2 { - padding-bottom: 0.3em; - border-bottom: 1px solid var(--BORDER); -} - -.markdown-body blockquote { - margin: 0; -} - -.markdown-body ol ol, -.markdown-body ul ol { - list-style-type: lower-roman; -} - -.markdown-body ol ol ol, -.markdown-body ol ul ol, -.markdown-body ul ol ol, -.markdown-body ul ul ol { - list-style-type: lower-alpha; -} - -.markdown-body dd { - margin-left: 0; -} - -.markdown-body code { - font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; -} - -.markdown-body pre { - font: 12px Consolas, 'Liberation Mono', Menlo, Courier, monospace; - word-wrap: normal; -} - -.markdown-body .octicon { - font: normal normal 16px octicons-anchor; - line-height: 1; - display: inline-block; - text-decoration: none; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - user-select: none; -} - -.markdown-body .octicon-link:before { - content: '\f05c'; -} - -.markdown-body > :first-child { - margin-top: 0 !important; -} - -.markdown-body > :last-child { - margin-bottom: 0 !important; -} - -.markdown-body .anchor { - position: absolute; - top: 0; - left: 0; - display: block; - padding-right: 6px; - padding-left: 30px; - margin-left: -30px; -} - -.markdown-body .anchor:focus { - outline: 0; -} - -.markdown-body h1, -.markdown-body h2, -.markdown-body h3, -.markdown-body h4, -.markdown-body h5, -.markdown-body h6 { - position: relative; - margin-top: 1em; - margin-bottom: 16px; - font-weight: 700; - line-height: 1.4; -} - -.markdown-body h1 .octicon-link, -.markdown-body h2 .octicon-link, -.markdown-body h3 .octicon-link, -.markdown-body h4 .octicon-link, -.markdown-body h5 .octicon-link, -.markdown-body h6 .octicon-link { - display: none; - color: #000; - vertical-align: middle; -} - -.markdown-body h1:hover .anchor, -.markdown-body h2:hover .anchor, -.markdown-body h3:hover .anchor, -.markdown-body h4:hover .anchor, -.markdown-body h5:hover .anchor, -.markdown-body h6:hover .anchor { - padding-left: 8px; - margin-left: -30px; - text-decoration: none; -} - -.markdown-body h1:hover .anchor .octicon-link, -.markdown-body h2:hover .anchor .octicon-link, -.markdown-body h3:hover .anchor .octicon-link, -.markdown-body h4:hover .anchor .octicon-link, -.markdown-body h5:hover .anchor .octicon-link, -.markdown-body h6:hover .anchor .octicon-link { - display: inline-block; -} - -.markdown-body h1 { - font-size: 2.25em; - line-height: 1.2; -} - -.markdown-body h1 .anchor { - line-height: 1; -} - -.markdown-body h2 { - font-size: 1.75em; - line-height: 1.225; -} - -.markdown-body h2 .anchor { - line-height: 1; -} - -.markdown-body h3 { - font-size: 1.5em; - line-height: 1.43; -} - -.markdown-body h3 .anchor, -.markdown-body h4 .anchor { - line-height: 1.2; -} - -.markdown-body h4 { - font-size: 1.25em; -} - -.markdown-body h5 .anchor, -.markdown-body h6 .anchor { - line-height: 1.1; -} - -.markdown-body h5 { - font-size: 1em; -} - -.markdown-body h6 { - font-size: 1em; - color: #777; -} - -.markdown-body blockquote, -.markdown-body dl, -.markdown-body ol, -.markdown-body p, -.markdown-body pre, -.markdown-body table, -.markdown-body ul { - margin-top: 0; - margin-bottom: 16px; -} - -.markdown-body ol, -.markdown-body ul { - padding-left: 2em; -} - -.markdown-body ol ol, -.markdown-body ol ul, -.markdown-body ul ol, -.markdown-body ul ul { - margin-top: 0; - margin-bottom: 0; -} - -.markdown-body li > p { - margin-top: 16px; -} - -.markdown-body dl { - padding: 0; -} - -.markdown-body dl dt { - padding: 0; - margin-top: 16px; - font-size: 1em; - font-style: italic; - font-weight: 700; -} - -.markdown-body dl dd { - padding: 0 16px; - margin-bottom: 16px; -} - -.markdown-body blockquote { - padding: 0 15px; - color: #777; - border-left: 4px solid #ddd; -} - -.markdown-body blockquote > :first-child { - margin-top: 0; -} - -.markdown-body blockquote > :last-child { - margin-bottom: 0; -} - -.markdown-body table { - border-collapse: collapse; - border-spacing: 0; - display: block; - width: 100%; - overflow: auto; - word-break: normal; - word-break: keep-all; -} - -.markdown-body table th { - font-weight: 700; -} - -.markdown-body table td, -.markdown-body table th { - padding: 6px 13px; - border: 1px solid #ddd; -} - -.markdown-body table tr { - background-color: #fff; - border-top: 1px solid #ccc; -} - -.markdown-body table tr:nth-child(2n) { - background-color: #f8f8f8; -} - -.markdown-body img { - max-width: 100%; - -moz-box-sizing: border-box; - box-sizing: border-box; -} - -.markdown-body code { - padding: 0.2em 0; - margin: 0; - font-size: 85%; - background-color: rgba(0, 0, 0, 0.04); - border-radius: 3px; -} - -.markdown-body code:after, -.markdown-body code:before { - letter-spacing: -0.2em; - content: '\00a0'; -} - -.markdown-body pre > code { - padding: 0; - margin: 0; - font-size: 100%; - word-break: normal; - white-space: pre; - background: 0 0; - border: 0; -} - -.markdown-body .highlight { - margin-bottom: 16px; -} - -.markdown-body .highlight pre, -.markdown-body pre { - padding: 16px; - overflow: auto; - font-size: 85%; - background-color: #f7f7f7; - border-radius: 3px; -} - -.markdown-body .highlight pre { - margin-bottom: 0; - word-break: normal; -} - -.markdown-body pre code { - display: inline; - max-width: initial; - padding: 0; - margin: 0; - overflow: initial; - line-height: inherit; - word-wrap: normal; - background-color: transparent; - border: 0; -} - -.markdown-body pre code:after, -.markdown-body pre code:before { - content: normal; -} - -.markdown-body .pl-c { - color: #969896; -} - -.markdown-body .pl-c1, -.markdown-body .pl-mdh, -.markdown-body .pl-mm, -.markdown-body .pl-mp, -.markdown-body .pl-mr, -.markdown-body .pl-s1 .pl-v, -.markdown-body .pl-s3, -.markdown-body .pl-sc, -.markdown-body .pl-sv { - color: #0086b3; -} - -.markdown-body .pl-e, -.markdown-body .pl-en { - color: #795da3; -} - -.markdown-body .pl-s1 .pl-s2, -.markdown-body .pl-smi, -.markdown-body .pl-smp, -.markdown-body .pl-stj, -.markdown-body .pl-vo, -.markdown-body .pl-vpf { - color: #333; -} - -.markdown-body .pl-ent { - color: #63a35c; -} - -.markdown-body .pl-k, -.markdown-body .pl-s, -.markdown-body .pl-st { - color: #a71d5d; -} - -.markdown-body .pl-pds, -.markdown-body .pl-s1, -.markdown-body .pl-s1 .pl-pse .pl-s2, -.markdown-body .pl-sr, -.markdown-body .pl-sr .pl-cce, -.markdown-body .pl-sr .pl-sra, -.markdown-body .pl-sr .pl-sre, -.markdown-body .pl-src { - color: #df5000; -} - -.markdown-body .pl-mo, -.markdown-body .pl-v { - color: #1d3e81; -} - -.markdown-body .pl-id { - color: #b52a1d; -} - -.markdown-body .pl-ii { - background-color: #b52a1d; - color: #f8f8f8; -} - -.markdown-body .pl-sr .pl-cce { - color: #63a35c; - font-weight: 700; -} - -.markdown-body .pl-ml { - color: #693a17; -} - -.markdown-body .pl-mh, -.markdown-body .pl-mh .pl-en, -.markdown-body .pl-ms { - color: #1d3e81; - font-weight: 700; -} - -.markdown-body .pl-mq { - color: teal; -} - -.markdown-body .pl-mi { - color: #333; - font-style: italic; -} - -.markdown-body .pl-mb { - color: #333; - font-weight: 700; -} - -.markdown-body .pl-md, -.markdown-body .pl-mdhf { - background-color: #ffecec; - color: #bd2c00; -} - -.markdown-body .pl-mdht, -.markdown-body .pl-mi1 { - background-color: #eaffea; - color: #55a532; -} - -.markdown-body .pl-mdr { - color: #795da3; - font-weight: 700; -} - -.markdown-body kbd { - display: inline-block; - padding: 3px 5px; - font: 11px Consolas, 'Liberation Mono', Menlo, Courier, monospace; - line-height: 10px; - color: #555; - vertical-align: middle; - background-color: #fcfcfc; - border: 1px solid #ccc; - border-bottom-color: #bbb; - border-radius: 3px; - box-shadow: inset 0 -1px 0 #bbb; -} - -.markdown-body .task-list-item + .task-list-item { - margin-top: 3px; -} - -.markdown-body .task-list-item input { - float: left; - margin: 0.3em 0 0.25em -1.6em; - vertical-align: middle; -} - -.markdown-body:checked + .radio-label { - z-index: 1; - position: relative; - border-color: #4183c4; -} - -.editormd-html-preview, -.editormd-preview-container { - text-align: left; - font-size: 14px; - line-height: 1.6; - padding: 20px; - overflow: auto; - width: 100%; - background-color: #fff; -} - -.editormd-html-preview blockquote, -.editormd-preview-container blockquote { - color: #666; - border-left: 4px solid #ddd; - padding-left: 20px; - margin-left: 0; - font-size: 14px; - font-style: italic; -} - -.editormd-html-preview p code, -.editormd-preview-container p code { - margin-left: 5px; - margin-right: 4px; -} - -.editormd-html-preview abbr, -.editormd-preview-container abbr { - background: #ffd; -} - -.editormd-html-preview hr, -.editormd-preview-container hr { - height: 1px; - border: none; - border-top: 1px solid #ddd; - background: 0 0; -} - -.editormd-html-preview code, -.editormd-preview-container code { - border: 1px solid var(--BORDER); - background-color: var(--COMPONENT_BG); - padding: 3px; - border-radius: 3px; - font-size: 14px; -} - -.editormd-html-preview pre, -.editormd-preview-container pre { - border: 1px solid var(--BORDER); - background-color: var(--COMPONENT_BG); - padding: 10px; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - -ms-border-radius: 3px; - -o-border-radius: 3px; - border-radius: 3px; -} - -.editormd-html-preview pre code, -.editormd-preview-container pre code { - padding: 0; -} - -.editormd-html-preview code, -.editormd-html-preview kbd, -.editormd-html-preview pre, -.editormd-preview-container code, -.editormd-preview-container kbd, -.editormd-preview-container pre { - font-family: 'YaHei Consolas Hybrid', Consolas, 'Meiryo UI', 'Malgun Gothic', 'Segoe UI', 'Trebuchet MS', Helvetica, monospace, monospace; -} - -.editormd-html-preview table thead tr, -.editormd-preview-container table thead tr { - background-color: #f8f8f8; -} - -.editormd-html-preview p.editormd-tex, -.editormd-preview-container p.editormd-tex { - text-align: center; -} - -.editormd-html-preview span.editormd-tex, -.editormd-preview-container span.editormd-tex { - margin: 0 5px; -} - -.editormd-html-preview .emoji, -.editormd-preview-container .emoji { - width: 24px; - height: 24px; -} - -.editormd-html-preview .katex, -.editormd-preview-container .katex { - font-size: 1.4em; -} - -.editormd-html-preview .flowchart, -.editormd-html-preview .sequence-diagram, -.editormd-preview-container .flowchart, -.editormd-preview-container .sequence-diagram { - margin: 0 auto; - text-align: center; -} - -.editormd-html-preview .flowchart svg, -.editormd-html-preview .sequence-diagram svg, -.editormd-preview-container .flowchart svg, -.editormd-preview-container .sequence-diagram svg { - margin: 0 auto; -} - -.editormd-html-preview .flowchart text, -.editormd-html-preview .sequence-diagram text, -.editormd-preview-container .flowchart text, -.editormd-preview-container .sequence-diagram text { - font-size: 15px !important; - font-family: 'YaHei Consolas Hybrid', Consolas, 'Microsoft YaHei', 'Malgun Gothic', 'Segoe UI', Helvetica, Arial !important; -} - -/*! Pretty printing styles. Used with prettify.js. */ -.pln { - color: var(--MAIN_TEXT); -} - -@media screen { - .str { - color: #080; - } - - .kwd { - color: #008; - } - - .com { - color: #800; - } - - .typ { - color: #606; - } - - .lit { - color: var(--MAIN_TEXT); - } - - .clo, - .opn, - .pun { - color: var(--MAIN_TEXT); - } - - .tag { - color: #008; - } - - .atn { - color: #606; - } - - .atv { - color: #080; - } - - .dec, - .var { - color: #606; - } - - .fun { - color: red; - } -} -@media print, projection { - .kwd, - .tag, - .typ { - font-weight: 700; - } - - .str { - color: #060; - } - - .kwd { - color: #006; - } - - .com { - color: #600; - font-style: italic; - } - - .typ { - color: #404; - } - - .lit { - color: #044; - } - - .clo, - .opn, - .pun { - color: #440; - } - - .tag { - color: #006; - } - - .atn { - color: #404; - } - - .atv { - color: #060; - } -} -pre.prettyprint { - padding: 2px; - border: 1px solid var(--BORDER); -} - -ol.linenums { - margin-top: 0; - margin-bottom: 0; -} - -li.L1, -li.L3, -li.L5, -li.L7, -li.L9 { - background-color: var(--COMPONENT_BG); -} - -.editormd-html-preview pre.prettyprint, -.editormd-preview-container pre.prettyprint { - padding: 10px; - border: 1px solid var(--BORDER); - white-space: pre-wrap; - word-wrap: break-word; - background-color: var(--COMPONENT_BG); -} - -.editormd-html-preview ol.linenums, -.editormd-preview-container ol.linenums { - color: #999; - padding-left: 2.5em; -} - -.editormd-html-preview ol.linenums li, -.editormd-preview-container ol.linenums li { - list-style-type: decimal; -} - -.editormd-html-preview ol.linenums li code, -.editormd-preview-container ol.linenums li code { - border: none; - background: 0 0; - padding: 0; -} - -.editormd-html-preview .editormd-toc-menu, -.editormd-preview-container .editormd-toc-menu { - margin: 8px 0 12px; - display: inline-block; -} - -.editormd-html-preview .editormd-toc-menu > .markdown-toc, -.editormd-preview-container .editormd-toc-menu > .markdown-toc { - position: relative; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - -ms-border-radius: 4px; - -o-border-radius: 4px; - border-radius: 4px; - border: 1px solid; - display: inline-block; - font-size: 1em; -} - -.editormd-html-preview .editormd-toc-menu > .markdown-toc > ul, -.editormd-preview-container .editormd-toc-menu > .markdown-toc > ul { - width: 160%; - min-width: 180px; - position: absolute; - left: -1px; - top: -2px; - z-index: 100; - padding: 0 10px 10px; - display: none; - background: #fff; - border: 1px solid var(--BORDER); - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - -ms-border-radius: 4px; - -o-border-radius: 4px; - border-radius: 4px; - -webkit-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); - -moz-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); - -ms-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); - -o-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); - box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); -} - -.editormd-html-preview .editormd-toc-menu > .markdown-toc > ul > li ul, -.editormd-preview-container .editormd-toc-menu > .markdown-toc > ul > li ul { - width: 100%; - min-width: 180px; - border: 1px solid var(--BORDER); - display: none; - background: var(--MAIN_BG); - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - -ms-border-radius: 4px; - -o-border-radius: 4px; - border-radius: 4px; -} - -.editormd-html-preview .editormd-toc-menu .toc-menu-btn:hover, -.editormd-html-preview .editormd-toc-menu > .markdown-toc > ul > li a:hover, -.editormd-preview-container .editormd-toc-menu .toc-menu-btn:hover, -.editormd-preview-container .editormd-toc-menu > .markdown-toc > ul > li a:hover { - background-color: #f6f6f6; -} - -.editormd-html-preview .editormd-toc-menu > .markdown-toc > ul > li a, -.editormd-preview-container .editormd-toc-menu > .markdown-toc > ul > li a { - color: #666; - padding: 6px 10px; - display: block; - -webkit-transition: background-color 500ms ease-out; - -moz-transition: background-color 500ms ease-out; - transition: background-color 500ms ease-out; -} - -.editormd-html-preview .editormd-toc-menu > .markdown-toc li, -.editormd-preview-container .editormd-toc-menu > .markdown-toc li { - position: relative; -} - -.editormd-html-preview .editormd-toc-menu > .markdown-toc li > ul, -.editormd-preview-container .editormd-toc-menu > .markdown-toc li > ul { - position: absolute; - top: 32px; - left: 10%; - display: none; - -webkit-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); - -moz-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); - -ms-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); - -o-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); - box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); -} - -.editormd-html-preview .editormd-toc-menu > .markdown-toc li > ul:after, -.editormd-html-preview .editormd-toc-menu > .markdown-toc li > ul:before, -.editormd-preview-container .editormd-toc-menu > .markdown-toc li > ul:after, -.editormd-preview-container .editormd-toc-menu > .markdown-toc li > ul:before { - pointer-events: pointer-events; - position: absolute; - left: 15px; - top: -6px; - display: block; - content: ''; - width: 0; - height: 0; - border: 6px solid transparent; - border-width: 0 6px 6px; - z-index: 3; -} - -.editormd-html-preview .editormd-toc-menu > .markdown-toc li > ul:before, -.editormd-preview-container .editormd-toc-menu > .markdown-toc li > ul:before { - border-bottom-color: #ccc; -} - -.editormd-html-preview .editormd-toc-menu > .markdown-toc li > ul:after, -.editormd-preview-container .editormd-toc-menu > .markdown-toc li > ul:after { - border-bottom-color: #fff; - top: -5px; -} - -.editormd-html-preview .editormd-toc-menu ul, -.editormd-preview-container .editormd-toc-menu ul { - list-style: none; -} - -.editormd-html-preview .editormd-toc-menu a, -.editormd-preview-container .editormd-toc-menu a { - text-decoration: none; -} - -.editormd-html-preview .editormd-toc-menu h1, -.editormd-preview-container .editormd-toc-menu h1 { - font-size: 16px; - padding: 5px 0 10px 10px; - line-height: 1; - border-bottom: 1px solid #eee; -} - -.editormd-html-preview .editormd-toc-menu h1 .fa, -.editormd-preview-container .editormd-toc-menu h1 .fa { - padding-left: 10px; -} - -.editormd-html-preview .editormd-toc-menu .toc-menu-btn, -.editormd-preview-container .editormd-toc-menu .toc-menu-btn { - color: #666; - min-width: 180px; - padding: 5px 10px; - border-radius: 4px; - display: inline-block; - -webkit-transition: background-color 500ms ease-out; - -moz-transition: background-color 500ms ease-out; - transition: background-color 500ms ease-out; -} - -.editormd-html-preview textarea, -.editormd-onlyread .editormd-toolbar { - display: none; -} - -.editormd-html-preview .editormd-toc-menu .toc-menu-btn .fa, -.editormd-preview-container .editormd-toc-menu .toc-menu-btn .fa { - float: right; - padding: 3px 0 0 10px; - font-size: 1.3em; -} - -.markdown-body .editormd-toc-menu ul { - padding-left: 0; -} - -.markdown-body .highlight pre, -.markdown-body pre { - line-height: 1.6; -} - -hr.editormd-page-break { - border: 1px dotted #ccc; - font-size: 0; - height: 2px; -} - -@media only print { - hr.editormd-page-break { - background: 0 0; - border: none; - height: 0; - } -} -.editormd-html-preview hr.editormd-page-break { - background: 0 0; - border: none; - height: 0; -} - -.editormd-preview-close-btn { - color: var(--MAIN_TEXT); - padding: 4px 6px; - font-size: 18px; - -webkit-border-radius: 500px; - -moz-border-radius: 500px; - -ms-border-radius: 500px; - -o-border-radius: 500px; - border-radius: 500px; - display: none; - background-color: #ccc; - position: absolute; - top: 25px; - right: 35px; - z-index: 19; - -webkit-transition: background-color 300ms ease-out; - -moz-transition: background-color 300ms ease-out; - transition: background-color 300ms ease-out; -} - -.editormd-preview-close-btn:hover { - background-color: #999; -} - -.editormd-preview-active { - width: 100%; - padding: 40px; -} - -.editormd-preview-theme-dark { - color: #777; - background: #2c2827; -} - -.editormd-preview-theme-dark .editormd-preview-container { - color: #888; - background-color: #2c2827; -} - -.editormd-preview-theme-dark .editormd-preview-container pre.prettyprint { - border: none; -} - -.editormd-preview-theme-dark .editormd-preview-container blockquote { - color: #555; - padding: 0.5em; - background: #222; - border-color: #333; -} - -.editormd-preview-theme-dark .editormd-preview-container abbr { - color: var(--MAIN_TEXT); - padding: 1px 3px; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - -ms-border-radius: 3px; - -o-border-radius: 3px; - border-radius: 3px; - background: #f90; -} - -.editormd-preview-theme-dark .editormd-preview-container code { - color: var(--MAIN_TEXT); - border: none; - padding: 1px 3px; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - -ms-border-radius: 3px; - -o-border-radius: 3px; - border-radius: 3px; - background: #5a9600; -} - -.editormd-preview-theme-dark .editormd-preview-container table { - border: none; -} - -.editormd-preview-theme-dark .editormd-preview-container .fa-emoji { - color: #b4bf42; -} - -.editormd-preview-theme-dark .editormd-preview-container .katex { - color: #fec93f; -} - -.editormd-preview-theme-dark .editormd-toc-menu > .markdown-toc { - background: var(--MAIN_BG); - border: none; -} - -.editormd-preview-theme-dark .editormd-toc-menu > .markdown-toc h1 { - border-color: var(--BORDER); -} - -.editormd-preview-theme-dark .markdown-body h1, -.editormd-preview-theme-dark .markdown-body h2, -.editormd-preview-theme-dark .markdown-body hr { - border-color: #222; -} - -.editormd-preview-theme-dark pre { - color: #999; - background-color: #111; - background-color: rgba(0, 0, 0, 0.4); -} - -.editormd-preview-theme-dark pre .pln { - color: #999; -} - -.editormd-preview-theme-dark li.L1, -.editormd-preview-theme-dark li.L3, -.editormd-preview-theme-dark li.L5, -.editormd-preview-theme-dark li.L7, -.editormd-preview-theme-dark li.L9 { - background: 0 0; -} - -.editormd-preview-theme-dark [class*='editormd-logo'] { - color: #2196f3; -} - -.editormd-preview-theme-dark .sequence-diagram text { - fill: #fff; -} - -.editormd-preview-theme-dark .sequence-diagram path, -.editormd-preview-theme-dark .sequence-diagram rect { - color: var(--MAIN_TEXT); - fill: #64d1cb; - stroke: #64d1cb; -} - -.editormd-preview-theme-dark .flowchart path, -.editormd-preview-theme-dark .flowchart rect { - stroke: #a6c6ff; -} - -.editormd-preview-theme-dark .flowchart rect { - fill: #a6c6ff; -} - -.editormd-preview-theme-dark .flowchart text { - fill: #5879b4; -} - -@media screen { - .editormd-preview-theme-dark .str { - color: #080; - } - - .editormd-preview-theme-dark .kwd { - color: #f90; - } - - .editormd-preview-theme-dark .com { - color: #444; - } - - .editormd-preview-theme-dark .typ { - color: #606; - } - - .editormd-preview-theme-dark .lit { - color: #066; - } - - .editormd-preview-theme-dark .clo, - .editormd-preview-theme-dark .opn, - .editormd-preview-theme-dark .pun { - color: #660; - } - - .editormd-preview-theme-dark .tag { - color: #f90; - } - - .editormd-preview-theme-dark .atn { - color: #6c95f5; - } - - .editormd-preview-theme-dark .atv { - color: #080; - } - - .editormd-preview-theme-dark .dec, - .editormd-preview-theme-dark .var { - color: #008ba7; - } - - .editormd-preview-theme-dark .fun { - color: red; - } -} -.editormd-onlyread .CodeMirror { - margin-top: 0; -} - -.editormd-onlyread .editormd-preview { - top: 0; -} - -.editormd-fullscreen { - position: fixed; - top: 0; - left: 0; - border: none; - margin: 0 auto; -} - -.editormd-theme-dark { - border-color: #1a1a17; -} - -.editormd-theme-dark .editormd-toolbar { - background: #1a1a17; - border-color: #1a1a17; -} - -.editormd-theme-dark .editormd-menu > li > a { - color: #777; - border-color: #1a1a17; -} - -.editormd-theme-dark .editormd-menu > li > a.active, -.editormd-theme-dark .editormd-menu > li > a:hover { - border-color: #333; - background: #333; -} - -.editormd-theme-dark .editormd-menu > li.divider { - border-right: 1px solid #111; -} - -.editormd-theme-dark .CodeMirror { - border-right: 1px solid rgba(0, 0, 0, 0.1); -} - -.iconfont { - font-family: 'iconfont' !important; - font-style: normal; - -webkit-font-smoothing: antialiased; - -webkit-text-stroke-width: 0.2px; - -moz-osx-font-smoothing: grayscale; -} - -.icon-apikit:before { - content: '\e605'; -} - -.icon-apibee:before { - content: '\e607'; -} - -.icon-goku:before { - content: '\e608'; -} - -.icon-eolink:before { - content: '\e609'; -} - -.icon-gateway:before { - content: '\e617'; -} - -.icon-webhook:before { - content: '\ecdd'; -} - -.icon-more:before { - content: '\e686'; -} - -.icon-table:before { - content: '\ec1a'; -} - -.icon-table-column-width:before { - content: '\ec25'; -} - -.icon-table-edit:before { - content: '\ec26'; -} - -.icon-timetable:before { - content: '\ec47'; -} - -.icon-code-braces:before { - content: '\e7a7'; -} - -.icon-codepen:before { - content: '\e7b1'; -} - -.icon-code-tags:before { - content: '\e7b2'; -} - -.icon-json:before { - content: '\e9ab'; -} - -.icon-unfold-more:before { - content: '\ec7d'; -} - -.icon-download_circle:before { - content: '\e6c1'; -} - -.icon-download:before { - content: '\e83a'; -} - -.icon-link:before { - content: '\e9e7'; -} - -.icon-link-off:before { - content: '\e9e9'; -} - -.icon-link-variant-off:before { - content: '\e9ea'; -} - -.icon-link-variant:before { - content: '\e9eb'; -} - -.icon-refresh:before { - content: '\eb3b'; -} - -.icon-apps:before { - content: '\e611'; -} - -.icon-arrow-down:before { - content: '\e656'; -} - -.icon-arrow-down-bold:before { - content: '\e657'; -} - -.icon-arrow-down-bold-circle-outline:before { - content: '\e658'; -} - -.icon-arrow-down-bold-circle:before { - content: '\e659'; -} - -.icon-arrow-down-drop-circle-outline:before { - content: '\e65b'; -} - -.icon-arrow-down-drop-circle:before { - content: '\e65d'; -} - -.icon-arrow-left:before { - content: '\e660'; -} - -.icon-arrow-left-bold:before { - content: '\e661'; -} - -.icon-arrow-left-bold-circle:before { - content: '\e662'; -} - -.icon-arrow-left-bold-circle-outline:before { - content: '\e663'; -} - -.icon-arrow-left-drop-circle:before { - content: '\e667'; -} - -.icon-arrow-left-drop-circle-outline:before { - content: '\e668'; -} - -.icon-arrow-right:before { - content: '\e669'; -} - -.icon-arrow-right-bold-circle:before { - content: '\e66a'; -} - -.icon-arrow-right-bold:before { - content: '\e66b'; -} - -.icon-arrow-right-bold-circle-outline:before { - content: '\e66c'; -} - -.icon-arrow-right-drop-circle:before { - content: '\e66e'; -} - -.icon-arrow-right-drop-circle-outline:before { - content: '\e66f'; -} - -.icon-arrow-up:before { - content: '\e671'; -} - -.icon-arrow-up-bold:before { - content: '\e672'; -} - -.icon-arrow-up-bold-circle:before { - content: '\e674'; -} - -.icon-arrow-up-bold-circle-outline:before { - content: '\e675'; -} - -.icon-arrow-up-drop-circle-outline:before { - content: '\e67a'; -} - -.icon-arrow-up-drop-circle:before { - content: '\e67b'; -} - -.icon-chevron-down:before { - content: '\e778'; -} - -.icon-chevron-left:before { - content: '\e779'; -} - -.icon-chevron-right:before { - content: '\e77a'; -} - -.icon-chevron-up:before { - content: '\e77b'; -} - -.icon-copyright:before { - content: '\e7dc'; -} - -.icon-menu-down:before { - content: '\ea17'; -} - -.icon-menu-left:before { - content: '\ea19'; -} - -.icon-menu-right:before { - content: '\ea1a'; -} - -.icon-menu-up:before { - content: '\ea1b'; -} - -.icon-update:before { - content: '\ec8c'; -} - -.icon-upload:before { - content: '\ec8e'; -} - -.icon-folder:before { - content: '\e8be'; -} - -.icon-folder-lock:before { - content: '\e8c3'; -} - -.icon-folder-lock-open:before { - content: '\e8c4'; -} - -.icon-folder-outline:before { - content: '\e8c8'; -} - -.icon-folder-star:before { - content: '\e8ca'; -} - -.icon-sort:before { - content: '\ebc6'; -} - -.icon-sort-descending:before { - content: '\ebc7'; -} - -.icon-sort-alphabetical:before { - content: '\ebca'; -} - -.icon-sort-ascending:before { - content: '\ebd8'; -} - -.icon-sort-numeric:before { - content: '\ebe9'; -} - -.icon-sort-variant:before { - content: '\ec06'; -} - -.icon-star-circle:before { - content: '\ec16'; -} - -.icon-star-half:before { - content: '\ec21'; -} - -.icon-star:before { - content: '\ec22'; -} - -.icon-star-off:before { - content: '\ec23'; -} - -.icon-star-outline:before { - content: '\ec24'; -} - -.icon-book:before { - content: '\e746'; -} - -.icon-building:before { - content: '\e747'; -} - -.icon-bug:before { - content: '\e748'; -} - -.icon-bank:before { - content: '\e745'; -} - -.icon-copy:before { - content: '\e74a'; -} - -.icon-code:before { - content: '\e74c'; -} - -.icon-command:before { - content: '\e74d'; -} - -.icon-color_palette:before { - content: '\e74b'; -} - -.icon-repeat:before { - content: '\e755'; -} - -.icon-messages:before { - content: '\e756'; -} - -.icon-send:before { - content: '\e757'; -} - -.icon-rocket:before { - content: '\e758'; -} - -.icon-design:before { - content: '\e759'; -} - -.icon-puzzle:before { - content: '\e75a'; -} - -.icon-window:before { - content: '\e75c'; -} - -.icon-tune:before { - content: '\e762'; -} - -.icon-jianpan:before { - content: '\eac8'; -} - -.icon-pinleijianshao_o:before { - content: '\ec0c'; -} - -.icon-jiesuo:before { - content: '\eac9'; -} - -.icon-kongzhizhongxin_o:before { - content: '\ec0d'; -} - -.icon-shaixuan:before { - content: '\eaca'; -} - -.icon-pinleizengjia_o:before { - content: '\ec0e'; -} - -.icon-shouji:before { - content: '\eacb'; -} - -.icon-renwuzhongxin_o:before { - content: '\ec0f'; -} - -.icon-suoding:before { - content: '\eacc'; -} - -.icon-quanjushezhi_o:before { - content: '\ec10'; -} - -.icon-tupian:before { - content: '\eacd'; -} - -.icon-jinggao_o:before { - content: '\ec11'; -} - -.icon-tianjiafujian:before { - content: '\eace'; -} - -.icon-saoyisao_o:before { - content: '\ec12'; -} - -.icon-wenben:before { - content: '\eacf'; -} - -.icon-shipin_o:before { - content: '\ec13'; -} - -.icon-bangongbao:before { - content: '\ead0'; -} - -.icon-shouye_o:before { - content: '\ec14'; -} - -.icon-shu:before { - content: '\ead1'; -} - -.icon-shuliang-zengjia_o:before { - content: '\ec15'; -} - -.icon-shanchu_o:before { - content: '\ec17'; -} - -.icon-touyingyi:before { - content: '\ead3'; -} - -.icon-tishi_o:before { - content: '\ec18'; -} - -.icon-cangku:before { - content: '\ead7'; -} - -.icon-tuwen_o:before { - content: '\ec19'; -} - -.icon-guanliyuanrenzheng:before { - content: '\ead9'; -} - -.icon-jinzhidengji:before { - content: '\eada'; -} - -.icon-xinzengdaohangliebiao_o:before { - content: '\ec1b'; -} - -.icon-sousuo_o:before { - content: '\ec1c'; -} - -.icon-guanliyuansousuo:before { - content: '\eadc'; -} - -.icon-shuliangjianshao_o:before { - content: '\ec1d'; -} - -.icon-saomafuquan:before { - content: '\eade'; -} - -.icon-yemiankuangjia_o:before { - content: '\ec1e'; -} - -.icon-xiangji_o:before { - content: '\ec1f'; -} - -.icon-function_o:before { - content: '\ec20'; -} - -.icon-weixiufuwu:before { - content: '\eae5'; -} - -.icon-duoxuanxuanzhong:before { - content: '\eae7'; -} - -.icon-jiaobiaoweixuanzhong_o:before { - content: '\ec3b'; -} - -.icon-bofang:before { - content: '\eae8'; -} - -.icon-quxiaoquanping_o:before { - content: '\ec3c'; -} - -.icon-duibi:before { - content: '\eae9'; -} - -.icon-jiaobiaoxuanzhong_o:before { - content: '\ec3d'; -} - -.icon-huojianjiasu:before { - content: '\eaea'; -} - -.icon-quanping_o:before { - content: '\ec3f'; -} - -.icon-gouwudai:before { - content: '\eaeb'; -} - -.icon-dunpaibaowei_o:before { - content: '\ec48'; -} - -.icon-gouwu:before { - content: '\eaec'; -} - -.icon-danxuanweixuanzhong:before { - content: '\eaed'; -} - -.icon-dunpaibaoxianrenzheng_o:before { - content: '\ec4a'; -} - -.icon-danxuanxuanzhong:before { - content: '\eaee'; -} - -.icon-jinbi_o:before { - content: '\ec4b'; -} - -.icon-jiqiren:before { - content: '\eaef'; -} - -.icon-zhangdan_xinzeng_o:before { - content: '\ec4c'; -} - -.icon-jinxianshibutong:before { - content: '\eaf0'; -} - -.icon-zhangdan-wancheng_o:before { - content: '\ec4d'; -} - -.icon-kefu:before { - content: '\eaf1'; -} - -.icon-yinhangqia_o:before { - content: '\ec4e'; -} - -.icon-zhangdan_xiangqing_o:before { - content: '\ec4f'; -} - -.icon-duoxuanweixuanzhong:before { - content: '\eaf4'; -} - -.icon-anniu-zan_o:before { - content: '\ec50'; -} - -.icon-liangliangduibi:before { - content: '\eaf5'; -} - -.icon-biaoqing_xiao_o:before { - content: '\ec51'; -} - -.icon-liwu:before { - content: '\eaf7'; -} - -.icon-chengchang_o:before { - content: '\ec52'; -} - -.icon-shanguangdeng:before { - content: '\eaf8'; -} - -.icon-duanxin_o:before { - content: '\ec53'; -} - -.icon-shengyin:before { - content: '\eaf9'; -} - -.icon-biaoqing_beishang_o:before { - content: '\ec54'; -} - -.icon-renlianshibie:before { - content: '\eafa'; -} - -.icon-fenxiang_o:before { - content: '\ec55'; -} - -.icon-tingzhi:before { - content: '\eafb'; -} - -.icon-biaoqing_o:before { - content: '\ec56'; -} - -.icon-tanhao:before { - content: '\eafc'; -} - -.icon-gerentouxiang_o:before { - content: '\ec57'; -} - -.icon-wenhao:before { - content: '\eafd'; -} - -.icon-qunzu_o:before { - content: '\ec58'; -} - -.icon-xinxi:before { - content: '\eafe'; -} - -.icon-dianhua_o:before { - content: '\ec59'; -} - -.icon-shounadaohang:before { - content: '\eaff'; -} - -.icon-tianjiahaoyou_o:before { - content: '\ec5a'; -} - -.icon-yinliang:before { - content: '\eb00'; -} - -.icon-yingwen:before { - content: '\eb01'; -} - -.icon-xiai_o:before { - content: '\ec5c'; -} - -.icon-yuechi:before { - content: '\eb02'; -} - -.icon-zan_o:before { - content: '\ec5d'; -} - -.icon-yunsuancaozuo:before { - content: '\eb03'; -} - -.icon-naozhong_o:before { - content: '\ec5e'; -} - -.icon-zhediedaohang:before { - content: '\eb04'; -} - -.icon-shijian_o:before { - content: '\ec5f'; -} - -.icon-zhinanzhen:before { - content: '\eb05'; -} - -.icon-riqi_o:before { - content: '\ec60'; -} - -.icon-zhongwen:before { - content: '\eb06'; -} - -.icon-daibanrenwu_o:before { - content: '\ec61'; -} - -.icon-zanting:before { - content: '\eb07'; -} - -.icon-daibanrenwu_quxiao_o:before { - content: '\ec62'; -} - -.icon-zhuti_yifu:before { - content: '\eb08'; -} - -.icon-shuzhuangtu_o:before { - content: '\ec63'; -} - -.icon-zhendong:before { - content: '\eb09'; -} - -.icon-zhexiantu_o:before { - content: '\ec64'; -} - -.icon-zhuti_tiaosepan:before { - content: '\eb0a'; -} - -.icon-yun_o:before { - content: '\ec65'; -} - -.icon-mofabang:before { - content: '\eb0b'; -} - -.icon-yunshangchuan_o:before { - content: '\ec66'; -} - -.icon-zuanshi:before { - content: '\eb0c'; -} - -.icon-yunxiazai_o:before { - content: '\ec67'; -} - -.icon-anniu_guanbi:before { - content: '\eb0d'; -} - -.icon-bingtu_o:before { - content: '\ec68'; -} - -.icon-anquan:before { - content: '\eb0e'; -} - -.icon-zhuzhuangtu_o:before { - content: '\ec69'; -} - -.icon-bangzhu:before { - content: '\eb0f'; -} - -.icon-baoguo_hezi_o:before { - content: '\ec6a'; -} - -.icon-biaoge:before { - content: '\eb10'; -} - -.icon-baoguo_dabao_o:before { - content: '\ec6b'; -} - -.icon-anniu_xuanzhong:before { - content: '\eb11'; -} - -.icon-baoguo_quxiaoshouhuo_o:before { - content: '\ec6c'; -} - -.icon-chexiao:before { - content: '\eb12'; -} - -.icon-baoguo_shouhuo_o:before { - content: '\ec6d'; -} - -.icon-shouye:before { - content: '\eb13'; -} - -.icon-baoguo_shouna_o:before { - content: '\ec6e'; -} - -.icon-duihao:before { - content: '\eb14'; -} - -.icon-baoguo_o:before { - content: '\ec6f'; -} - -.icon-erweima:before { - content: '\eb15'; -} - -.icon-baoguo_lanshou_o:before { - content: '\ec70'; -} - -.icon-caidan:before { - content: '\eb16'; -} - -.icon-didiandingwei_o:before { - content: '\ec71'; -} - -.icon-guanbi:before { - content: '\eb17'; -} - -.icon-ditu_dingwei_o:before { - content: '\ec72'; -} - -.icon-guanyu:before { - content: '\eb18'; -} - -.icon-ditu_diqiu_o:before { - content: '\ec73'; -} - -.icon-cengji:before { - content: '\eb19'; -} - -.icon-fenjianguocheng_o:before { - content: '\ec74'; -} - -.icon-dengyu:before { - content: '\eb1a'; -} - -.icon-fuwu_o:before { - content: '\ec75'; -} - -.icon-daohang:before { - content: '\eb1b'; -} - -.icon-gaojijibao_o:before { - content: '\ec76'; -} - -.icon-jiahao:before { - content: '\eb1c'; -} - -.icon-huopinfenliu_o:before { - content: '\ec77'; -} - -.icon-jieshaoxinxi:before { - content: '\eb1f'; -} - -.icon-jiankong_o:before { - content: '\ec78'; -} - -.icon-jianhao:before { - content: '\eb20'; -} - -.icon-kuaidiyuan_o:before { - content: '\ec79'; -} - -.icon-jinyong:before { - content: '\eb21'; -} - -.icon-shijuedingwei_o:before { - content: '\ec7b'; -} - -.icon-jingliren_o:before { - content: '\ec7c'; -} - -.icon-jinggao:before { - content: '\eb23'; -} - -.icon-xinwen_o:before { - content: '\ec7f'; -} - -.icon-lishijilu:before { - content: '\eb24'; -} - -.icon-xiaoxi_o:before { - content: '\ec80'; -} - -.icon-linggan:before { - content: '\eb25'; -} - -.icon-tongzhizhongxin_o:before { - content: '\ec81'; -} - -.icon-liebiao:before { - content: '\eb26'; -} - -.icon-dengchu_o:before { - content: '\ec82'; -} - -.icon-pinleijianshao:before { - content: '\eb27'; -} - -.icon-yanjing_xianshi_o:before { - content: '\ec83'; -} - -.icon-pinleishanchu:before { - content: '\eb28'; -} - -.icon-gerenxinxi_o:before { - content: '\ec84'; -} - -.icon-pinleizengjia:before { - content: '\eb29'; -} - -.icon-yanjing_yincang_o:before { - content: '\ec85'; -} - -.icon-kongzhizhongxin:before { - content: '\eb2a'; -} - -.icon-anniu_gerenzhongxin_o:before { - content: '\ec86'; -} - -.icon-shanchu:before { - content: '\eb2b'; -} - -.icon-huadongkaiguan-guanbi:before { - content: '\e606'; -} - -.icon-saoyisao:before { - content: '\eb2c'; -} - -.icon-huadongkaiguan-dakai:before { - content: '\ec87'; -} - -.icon-shipin:before { - content: '\eb2d'; -} - -.icon-fuwuguanli:before { - content: '\ec8a'; -} - -.icon-quanjushezhi:before { - content: '\eb2e'; -} - -.icon-yichangshangbao:before { - content: '\ec8d'; -} - -.icon-xinzengdaohangliebiao:before { - content: '\ec98'; -} - -.icon-shuliang-zengjia:before { - content: '\eb30'; -} - -.icon-rili:before { - content: '\ec9f'; -} - -.icon-shuaxin:before { - content: '\eb31'; -} - -.icon-jianzhu:before { - content: '\eca6'; -} - -.icon-shuliangjianshao:before { - content: '\eb32'; -} - -.icon-sandengfen:before { - content: '\eca8'; -} - -.icon-sousuo:before { - content: '\eb33'; -} - -.icon-yizhan:before { - content: '\ecab'; -} - -.icon-tuwen:before { - content: '\eb34'; -} - -.icon-sidengfen:before { - content: '\ecac'; -} - -.icon-xiangji:before { - content: '\eb37'; -} - -.icon-CPhezuo:before { - content: '\ecad'; -} - -.icon-yemiankuangjia:before { - content: '\eb38'; -} - -.icon-dengchu:before { - content: '\ecaf'; -} - -.icon-function:before { - content: '\eb39'; -} - -.icon-youjian:before { - content: '\ec88'; -} - -.icon-anniu_jiantoushouqi:before { - content: '\eb3a'; -} - -.icon-yuyin:before { - content: '\ec99'; -} - -.icon-jiaobiaoweixuanzhong:before { - content: '\eb52'; -} - -.icon-huobiliu:before { - content: '\ec9b'; -} - -.icon-jiaobiaoxuanzhong:before { - content: '\eb53'; -} - -.icon-jiekuan:before { - content: '\ec9c'; -} - -.icon-quxiaoquanping:before { - content: '\eb54'; -} - -.icon-cunkuan:before { - content: '\ec9e'; -} - -.icon-quanping:before { - content: '\eb56'; -} - -.icon-jinrongguanli:before { - content: '\eca1'; -} - -.icon-dunpaibaowei:before { - content: '\eb5e'; -} - -.icon-zijin_dongjie:before { - content: '\eca2'; -} - -.icon-dunpaibaoxianrenzheng:before { - content: '\eb5f'; -} - -.icon-zijin:before { - content: '\eca3'; -} - -.icon-jisuanqi:before { - content: '\eb60'; -} - -.icon-qiandao:before { - content: '\eca9'; -} - -.icon-jinbi:before { - content: '\eb61'; -} - -.icon-huobiliu_o:before { - content: '\ecba'; -} - -.icon-meiyuan:before { - content: '\eb62'; -} - -.icon-jiekuan_o:before { - content: '\ecbb'; -} - -.icon-qianbao:before { - content: '\eb63'; -} - -.icon-jinrongguanli_o:before { - content: '\ecbc'; -} - -.icon-yinhangqia:before { - content: '\eb64'; -} - -.icon-cunkuan_o:before { - content: '\ecbd'; -} - -.icon-zhangdan_xiangqing:before { - content: '\eb65'; -} - -.icon-zhangdan_quxiao_o:before { - content: '\ecbf'; -} - -.icon-zhangdan_quxiao:before { - content: '\eb66'; -} - -.icon-zhangdan_kong_o:before { - content: '\ecc0'; -} - -.icon-zhangdan_xinzeng:before { - content: '\eb67'; -} - -.icon-zijin_dongjie_o:before { - content: '\ecc3'; -} - -.icon-zhangdan-wancheng:before { - content: '\eb68'; -} - -.icon-zijin_o:before { - content: '\ecc4'; -} - -.icon-biaoqing:before { - content: '\eb69'; -} - -.icon-qiandao_o:before { - content: '\ecc7'; -} - -.icon-anniu-zan:before { - content: '\eb6a'; -} - -.icon-jianzhu_o:before { - content: '\ecd6'; -} - -.icon-biaoqing_xiao:before { - content: '\eb6b'; -} - -.icon-sandengfen_o:before { - content: '\ecd8'; -} - -.icon-chengchang:before { - content: '\eb6c'; -} - -.icon-sidengfen_o:before { - content: '\ecdb'; -} - -.icon-dianhua:before { - content: '\eb6d'; -} - -.icon-youjian_o:before { - content: '\ece0'; -} - -.icon-duanxin:before { - content: '\eb6e'; -} - -.icon-circle:before { - content: '\e635'; -} - -.icon-gerentouxiang:before { - content: '\eb6f'; -} - -.icon-chrome:before { - content: '\e665'; -} - -.icon-fenxiang:before { - content: '\eb70'; -} - -.icon-coding:before { - content: '\e62e'; -} - -.icon-qunzu:before { - content: '\eb71'; -} - -.icon-edge:before { - content: '\e7de'; -} - -.icon-biaoqing_beishang:before { - content: '\eb72'; -} - -.icon-github:before { - content: '\e6a5'; -} - -.icon-eo_shoucang:before { - content: '\eb73'; -} - -.icon-zhifubao:before { - content: '\e666'; -} - -.icon-tianjiahaoyou:before { - content: '\eb74'; -} - -.icon-weixinzhifu-copy:before { - content: '\e615'; -} - -.icon-xiai:before { - content: '\eb75'; -} - -.icon-firefox:before { - content: '\e6ab'; -} - -.icon-zan:before { - content: '\eb76'; -} - -.icon-qq:before { - content: '\e69e'; -} - -.icon-daibanrenwu_quxiao:before { - content: '\eb77'; -} - -.icon-api:before { - content: '\e61e'; -} - -.icon-daibanrenwu:before { - content: '\eb78'; -} - -.icon-source-branch:before { - content: '\e8b6'; -} - -.icon-naozhong:before { - content: '\eb79'; -} - -.icon-source-branch-copy:before { - content: '\ece1'; -} - -.icon-shijian:before { - content: '\eb7a'; -} - -.icon-shiyanshiguanli:before { - content: '\e65e'; -} - -.icon-riqi:before { - content: '\eb7b'; -} - -.icon-windows:before { - content: '\ec89'; -} - -.icon-shuzhuangtu:before { - content: '\eb7c'; -} - -.icon-mac:before { - content: '\e6bf'; -} - -.icon-yun:before { - content: '\eb7d'; -} - -.icon-git:before { - content: '\e64a'; -} - -.icon-bingtu:before { - content: '\eb7e'; -} - -.icon-weixin:before { - content: '\e68c'; -} - -.icon-yunshangchuan:before { - content: '\eb7f'; -} - -.icon-github1:before { - content: '\e741'; -} - -.icon-yunxiazai:before { - content: '\eb80'; -} - -.icon-xiajiantou:before { - content: '\ec8b'; -} - -.icon-zhexiantu:before { - content: '\eb81'; -} - -.icon-paixu-jiangxu:before { - content: '\e684'; -} - -.icon-zhuzhuangtu:before { - content: '\eb82'; -} - -.icon-paixu-shengxu:before { - content: '\e685'; -} - -.icon-baoguo_lanshou:before { - content: '\eb83'; -} - -.icon-luyou:before { - content: '\ece6'; -} - -.icon-baoguo_dabao:before { - content: '\eb84'; -} - -.icon-qizhi:before { - content: '\e6dc'; -} - -.icon-baoguo_hezi:before { - content: '\eb85'; -} - -.icon-feishu:before { - content: '\e68b'; -} - -.icon-baoguo_quxiaoshouhuo:before { - content: '\eb86'; -} - -.icon-shejiaodingding:before { - content: '\e677'; -} - -.icon-baoguo_shouhuo:before { - content: '\eb87'; -} - -.icon-oauth:before { - content: '\e60d'; -} - -.icon-didiandingwei:before { - content: '\eb88'; -} - -.icon-huo:before { - content: '\e600'; -} - -.icon-ditu_diqiu:before { - content: '\eb89'; -} - -.icon-baoguo_fahuo:before { - content: '\eb8a'; -} - -.icon-ditu_dingwei:before { - content: '\eb8b'; -} - -.icon-baoguo:before { - content: '\eb8c'; -} - -.icon-huoche:before { - content: '\eb8f'; -} - -.icon-fuwu:before { - content: '\eb90'; -} - -.icon-jiankong:before { - content: '\eb91'; -} - -.icon-jingliren:before { - content: '\eb92'; -} - -.icon-huopinfenliu:before { - content: '\eb93'; -} - -.icon-shijuedingwei:before { - content: '\eb95'; -} - -.icon-xiaoxi:before { - content: '\eb97'; -} - -.icon-xinwen:before { - content: '\eb98'; -} - -.icon-tongzhizhongxin:before { - content: '\eb99'; -} - -.icon-yanjing_yincang:before { - content: '\eb9a'; -} - -.icon-yanjing_xianshi:before { - content: '\eb9b'; -} - -.icon-baocun_o:before { - content: '\eb9c'; -} - -.icon-biaoqian_o:before { - content: '\eb9d'; -} - -.icon-bianjibiaoge_o:before { - content: '\eb9e'; -} - -.icon-dayinji_o:before { - content: '\eb9f'; -} - -.icon-chizi_o:before { - content: '\eba0'; -} - -.icon-bangongbao_o:before { - content: '\eba1'; -} - -.icon-daoru_o:before { - content: '\eba2'; -} - -.icon-diannao_o:before { - content: '\eba3'; -} - -.icon-bianji_o:before { - content: '\eba4'; -} - -.icon-bijibendiannao_o:before { - content: '\eba5'; -} - -.icon-ding_o:before { - content: '\eba6'; -} - -.icon-jianpan_o:before { - content: '\eba7'; -} - -.icon-jianqie_o:before { - content: '\eba8'; -} - -.icon-shaixuan_o:before { - content: '\eba9'; -} - -.icon-jiesuo_o:before { - content: '\ebaa'; -} - -.icon-daochu_o:before { - content: '\ebab'; -} - -.icon-shouji_o:before { - content: '\ebac'; -} - -.icon-tianjiafujian_o:before { - content: '\ebad'; -} - -.icon-shu_o:before { - content: '\ebae'; -} - -.icon-fuzhi_o:before { - content: '\ebaf'; -} - -.icon-wenben_o:before { - content: '\ebb0'; -} - -.icon-touyingyi_o:before { - content: '\ebb1'; -} - -.icon-tupian_o:before { - content: '\ebb3'; -} - -.icon-suoding_o:before { - content: '\ebb4'; -} - -.icon-fuwuguanli_o:before { - content: '\ebba'; -} - -.icon-guanliyuanrenzheng_o:before { - content: '\ebbd'; -} - -.icon-jinzhidengji_o:before { - content: '\ebbe'; -} - -.icon-saomafuquan_o:before { - content: '\ebc0'; -} - -.icon-guanliyuansousuo_o:before { - content: '\ebc1'; -} - -.icon-saomajiahuiche_o:before { - content: '\ebc5'; -} - -.icon-yichangshangbao_o:before { - content: '\ebc8'; -} - -.icon-xunjianweixiu_o:before { - content: '\ebc9'; -} - -.icon-weixiufuwu_o:before { - content: '\ebcb'; -} - -.icon-zhongkong_o:before { - content: '\ebcc'; -} - -.icon-danxuanweixuanzhong_o:before { - content: '\ebcd'; -} - -.icon-bofang_o:before { - content: '\ebce'; -} - -.icon-duoxuanweixuanzhong_o:before { - content: '\ebcf'; -} - -.icon-duoxuanxuanzhong_o:before { - content: '\ebd0'; -} - -.icon-gouwudai_o:before { - content: '\ebd1'; -} - -.icon-gouwu_o:before { - content: '\ebd2'; -} - -.icon-huojianjiasu_o:before { - content: '\ebd3'; -} - -.icon-jiqiren_o:before { - content: '\ebd4'; -} - -.icon-kefu_o:before { - content: '\ebd5'; -} - -.icon-lanya_o:before { - content: '\ebd6'; -} - -.icon-shengyin_o:before { - content: '\ebd7'; -} - -.icon-danxuanxuanzhong_o:before { - content: '\ebd9'; -} - -.icon-liwu_o:before { - content: '\ebdb'; -} - -.icon-liangdu_o:before { - content: '\ebdc'; -} - -.icon-liangliangduibi_o:before { - content: '\ebdd'; -} - -.icon-renlianshibie_o:before { - content: '\ebde'; -} - -.icon-jinxianshibutong_o:before { - content: '\ebe0'; -} - -.icon-shanguangdeng_o:before { - content: '\ebe1'; -} - -.icon-tanhao_o:before { - content: '\ebe2'; -} - -.icon-wenhao_o:before { - content: '\ebe3'; -} - -.icon-xinxi_o:before { - content: '\ebe4'; -} - -.icon-tingzhi_o:before { - content: '\ebe5'; -} - -.icon-yuechi_o:before { - content: '\ebe6'; -} - -.icon-yingwen_o:before { - content: '\ebe7'; -} - -.icon-yuyin_o:before { - content: '\ebe8'; -} - -.icon-zanting_o:before { - content: '\ebea'; -} - -.icon-shounadaohang_o:before { - content: '\ebeb'; -} - -.icon-zhediedaohang_o:before { - content: '\ebec'; -} - -.icon-zhuti_tiaosepan_o:before { - content: '\ebed'; -} - -.icon-zhuti_yifu_o:before { - content: '\ebee'; -} - -.icon-zhuti_o:before { - content: '\ebef'; -} - -.icon-zuanshi_o:before { - content: '\ebf0'; -} - -.icon-zhongwen_o:before { - content: '\ebf1'; -} - -.icon-zhinanzhen_o:before { - content: '\ebf2'; -} - -.icon-anquan_o:before { - content: '\ebf3'; -} - -.icon-caidan_o:before { - content: '\ebf4'; -} - -.icon-anniu_xuanzhong_o:before { - content: '\ebf5'; -} - -.icon-bangzhu_o:before { - content: '\ebf6'; -} - -.icon-cengji_o:before { - content: '\ebf7'; -} - -.icon-chexiao_o:before { - content: '\ebf8'; -} - -.icon-daohang_o:before { - content: '\ebf9'; -} - -.icon-duihao_o:before { - content: '\ebfa'; -} - -.icon-anniu_guanbi_o:before { - content: '\ebfb'; -} - -.icon-erweima_o:before { - content: '\ebfc'; -} - -.icon-guanbi_o:before { - content: '\ebfd'; -} - -.icon-bijibendiannao:before { - content: '\eabb'; -} - -.icon-biaoge_o:before { - content: '\ebfe'; -} - -.icon-bianjibiaoge:before { - content: '\eabc'; -} - -.icon-guanyu_o:before { - content: '\ebff'; -} - -.icon-chizi:before { - content: '\eabd'; -} - -.icon-jiahao_o:before { - content: '\ec00'; -} - -.icon-biaoqian:before { - content: '\eabe'; -} - -.icon-dengyu_o:before { - content: '\ec01'; -} - -.icon-dayinji:before { - content: '\eabf'; -} - -.icon-jiazai_shuang_o:before { - content: '\ec02'; -} - -.icon-baocun:before { - content: '\eac0'; -} - -.icon-jianhao_o:before { - content: '\ec03'; -} - -.icon-bianji:before { - content: '\eac1'; -} - -.icon-jieshaoxinxi_o:before { - content: '\ec04'; -} - -.icon-daochu:before { - content: '\eac2'; -} - -.icon-daoru:before { - content: '\eac3'; -} - -.icon-lishijilu_o:before { - content: '\ec07'; -} - -.icon-diannao:before { - content: '\eac4'; -} - -.icon-liebiao_o:before { - content: '\ec08'; -} - -.icon-fuzhi:before { - content: '\eac5'; -} - -.icon-linggan_o:before { - content: '\ec09'; -} - -.icon-ding:before { - content: '\eac6'; -} - -.icon-jinyong_o:before { - content: '\ec0a'; -} - -.icon-jianqie:before { - content: '\eac7'; -} - -.icon-pinleishanchu_o:before { - content: '\ec0b'; -} - -@keyframes common-animation-emerge { - 0% { - opacity: 0; - } - 100% { - opacity: 1; - } -} -@-webkit-keyframes sticky-up { - 0% { - -webkit-transform: translateY(-200%); - -moz-transform: translateY(-200%); - -ms-transform: translateY(-200%); - transform: translateY(-200%); - } - 100% { - -webkit-transform: translateY(0%); - -moz-transform: translateY(0%); - -ms-transform: translateY(0%); - transform: translateY(0%); - } -} -@keyframes sticky-up { - 0% { - -webkit-transform: translateY(-200%); - -moz-transform: translateY(-200%); - -ms-transform: translateY(-200%); - transform: translateY(-200%); - } - 100% { - -webkit-transform: translateY(0%); - -moz-transform: translateY(0%); - -ms-transform: translateY(0%); - transform: translateY(0%); - } -} -@keyframes full_screen_animation { - 0% { - opacity: 0; - -webkit-transform: scale(0.7); - -moz-transform: scale(0.7); - -ms-transform: scale(0.7); - -o-transform: scale(0.7); - transform: scale(0.7); - } - 100% { - opacity: 1; - -webkit-transform: scale(1); - -moz-transform: scale(1); - -ms-transform: scale(1); - -o-transform: scale(1); - transform: scale(1); - } -} -@keyframes zoom_out_screen_animation { - 0% { - background-color: #e3f7fd; - } - 100% { - background-color: transparent; - } -} -.w_fc, .modal-info-display .modal-dialog, .modal_mask_enable_to_close .modal-content, third-party-step .container_pui_eoui, -perfect-user-info .container_pui_eoui, sidebar-common-component .back_static_scc, list-block-common-component .drag_wrap_lbcc .tbody_div_wrap, list-default-common-component .fixed-height-list .tbody_container_ldcc, list-default-common-component .thead_container_ldcc { - width: fit-content !important; - width: -webkit-fit-content !important; - width: -moz-fit-content !important; -} - -.modal_mask_enable_to_close .modal-content { - height: fit-content !important; - height: -webkit-fit-content !important; - height: -moz-fit-content !important; -} - -.eo-modal-header .icon-guanbi:hover, menu-common-component .common_menu_ul .common-btn:hover, menu-common-component .common_menu_ul .fun-list-li button:hover, unit-test-component .tab-container .icon-guanbi:hover, unit-test-component .tab-container .group-btn-container button:hover, ng-home-project-inside-api .tab-container .icon-guanbi:hover, ng-home-project-inside-api .tab-container .group-btn-container button:hover, ng-home-Project-Inside-Api-Detail .more-btn-group-div .common-fun:hover { - transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1); -} - -.submitted_form .ng-invalid, .modal-open .modal-content .modal-project select-multistage-common-component.eo-input-error .text-div { - border-color: var(--RED_NORMAL) !important; - color: var(--RED_NORMAL) !important; -} -.submitted_form .ng-invalid:focus, .modal-open .modal-content .modal-project select-multistage-common-component.eo-input-error .text-div:focus { - border-color: var(--RED_NORMAL) !important; - color: var(--MAIN_TEXT) !important; -} - -.ngtext { - font-size: 14px; - color: var(--MAIN_TEXT); -} - -env-Operate-Product-Component .ace-table .ace-editor-container { - margin: 0; - width: 100%; -} -env-Operate-Product-Component .ace-table .menu-td { - width: 315px; - background-color: #fff; - padding: 10px; - vertical-align: top; - position: relative; - z-index: 1; -} -env-Operate-Product-Component .ace-table .menu-td .title-p { - margin-bottom: 10px; -} -env-Operate-Product-Component .ace-table .menu-td .second-title-p { - color: #999; - margin-bottom: 10px; - cursor: pointer; -} -env-Operate-Product-Component .ace-table .menu-td .second-title-p .iconfont { - font-size: 12px; - margin-left: 10px; -} -env-Operate-Product-Component .ace-table .menu-td .second-title-p:hover { - color: #555; -} -env-Operate-Product-Component .ace-table .menu-td .label-li { - line-height: 30px; -} -env-Operate-Product-Component .ace-table .menu-td .label-li a { - color: var(--BLUE_NORMAL); - margin: 0 10px 0 5px; -} -env-Operate-Product-Component .ace-table .menu-td .label-li a:hover { - text-decoration: underline; -} -env-Operate-Product-Component .ace-table .menu-td .item-li { - line-height: 30px; - color: var(--BLUE_NORMAL); - cursor: pointer; -} -env-Operate-Product-Component .ace-table .menu-td .item-li:hover { - text-decoration: underline; -} -env-Operate-Product-Component .ace-table .menu-td .menu-div:nth-last-child(n + 2) { - border-bottom: 1px dashed var(--BORDER); - margin-bottom: 10px; -} - -list-default-common-component .footer, list-page-common-component .footer { - background-color: var(--TABLE_HEADER_BG); - display: flex; - padding: 0 var(--GLOBAL_PLATE_PADDING); - flex-direction: row; - align-items: center; - height: 33px; - color: var(--TEXT_TITLE_SEC); -} -list-default-common-component .footer .divide-span, list-page-common-component .footer .divide-span { - border-right: 1px solid var(--BORDER); - height: 30px; - line-height: 30px; -} -list-default-common-component .pagination, list-page-common-component .pagination { - display: flex; - align-items: center; -} -list-default-common-component .pagination .first-page, list-page-common-component .pagination .first-page, -list-default-common-component .pagination .last-page, -list-page-common-component .pagination .last-page { - border-radius: 3px; -} -list-default-common-component .pageFooter .pagination > .active, list-page-common-component .pageFooter .pagination > .active, -list-default-common-component .pageFooter .pagination > .active:hover, -list-page-common-component .pageFooter .pagination > .active:hover, -list-default-common-component .pageFooter .pagination > .active:focus, -list-page-common-component .pageFooter .pagination > .active:focus, -list-default-common-component .pageFooter .pagination > .active, -list-page-common-component .pageFooter .pagination > .active, -list-default-common-component .pageFooter .pagination > .active:hover, -list-page-common-component .pageFooter .pagination > .active:hover, -list-default-common-component .pageFooter .pagination > .active:focus, -list-page-common-component .pageFooter .pagination > .active:focus { - background-color: var(--MAIN_TEXT); -} -list-default-common-component .pageFooter .pagination > .active a, list-page-common-component .pageFooter .pagination > .active a, -list-default-common-component .pageFooter .pagination > .active:hover a, -list-page-common-component .pageFooter .pagination > .active:hover a, -list-default-common-component .pageFooter .pagination > .active:focus a, -list-page-common-component .pageFooter .pagination > .active:focus a, -list-default-common-component .pageFooter .pagination > .active a, -list-page-common-component .pageFooter .pagination > .active a, -list-default-common-component .pageFooter .pagination > .active:hover a, -list-page-common-component .pageFooter .pagination > .active:hover a, -list-default-common-component .pageFooter .pagination > .active:focus a, -list-page-common-component .pageFooter .pagination > .active:focus a { - color: #fff; -} -list-default-common-component .pagination-prev .iconfont, list-page-common-component .pagination-prev .iconfont, -list-default-common-component .pagination-next .iconfont, -list-page-common-component .pagination-next .iconfont { - font-weight: bold; -} -list-default-common-component .pagination-prev, list-page-common-component .pagination-prev { - margin-right: 15px; -} -list-default-common-component .pagination-next, list-page-common-component .pagination-next { - margin-left: 15px; -} -list-default-common-component .pagination-page, list-page-common-component .pagination-page { - width: 25px; - height: 25px; - line-height: 25px; - border-radius: 3px; - margin-right: 5px; -} - -.eo_theme_btn_delete, -.eo_theme_btn_success, -.eo_theme_btn_default, -.eo_theme_btn_info, -.eo_theme_btn_orange, -.eo_theme_btn_warning, -.eo_theme_btn_danger, -.eo_theme_btn_disabled, -.btn_static_test_utac { - height: 28px; - line-height: 28px; - line-height: 27px; - cursor: pointer; - border-radius: 3px; - font-size: var(--BUTTON_FONT_SIZE); - padding: 0 10px; - border-width: 1px; - border-style: solid; -} -.eo_theme_btn_delete .iconfont + span, -.eo_theme_btn_success .iconfont + span, -.eo_theme_btn_default .iconfont + span, -.eo_theme_btn_info .iconfont + span, -.eo_theme_btn_orange .iconfont + span, -.eo_theme_btn_warning .iconfont + span, -.eo_theme_btn_danger .iconfont + span, -.eo_theme_btn_disabled .iconfont + span, -.btn_static_test_utac .iconfont + span { - margin-left: 3px; -} -.eo_theme_btn_delete:hover, -.eo_theme_btn_success:hover, -.eo_theme_btn_default:hover, -.eo_theme_btn_info:hover, -.eo_theme_btn_orange:hover, -.eo_theme_btn_warning:hover, -.eo_theme_btn_danger:hover, -.eo_theme_btn_disabled:hover, -.btn_static_test_utac:hover { - transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1); -} -.eo_theme_btn_delete:disabled, -.eo_theme_btn_success:disabled, -.eo_theme_btn_default:disabled, -.eo_theme_btn_info:disabled, -.eo_theme_btn_orange:disabled, -.eo_theme_btn_warning:disabled, -.eo_theme_btn_danger:disabled, -.eo_theme_btn_disabled:disabled, -.btn_static_test_utac:disabled { - cursor: not-allowed; -} - -:root { - --GLOBAL_FONT_SIZE: 13px; - --GLOBAL_PADDING: 20px; -} - -* { - margin: 0; - padding: 0; - outline: none; - color: inherit; - font-family: inherit; - font-size: inherit; -} - -.group_and_list_container { - /* display: flex; */ - /* flex-wrap: nowrap; */ - /* height: calc(100vh - 31px); */ - z-index: 5; -} - -.container_below_menu_md { - margin: calc(40px + var(--GLOBAL_PLATE_PADDING)) var(--GLOBAL_PLATE_PADDING) var(--GLOBAL_PLATE_PADDING); -} - -.api-status-label { - border-radius: 3px; - margin-right: 8px; - font-size: 12px; - display: inline-block; - min-width: 45px; - height: 18px; - line-height: 18px; - text-align: center; - text-indent: 0; -} - -.base-container-div { - position: absolute !important; - width: 100%; - top: 0; - left: 0; - height: 100%; - z-index: 0; -} - -fieldset { - border: none; -} - -span, -li, -thead th, -p, -div { - cursor: inherit; -} - -th, -td { - text-align: left; - word-break: break-all; -} - -ol, -ul { - list-style-type: none; -} - -body { - position: absolute; - font-family: "Helvetica Neue", "Helvetica", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "WenQuanYi Micro Hei", "Arial", sans-serif; - background: #fff; - width: 100%; - height: 100%; - color: var(--MAIN_TEXT); - font-size: var(--GLOBAL_FONT_SIZE); -} - -a, -button { - cursor: pointer; - text-decoration: none; -} -a *, -button * { - cursor: inherit; -} -a input[type='text'], -button input[type='text'] { - cursor: text; -} -a[disabled], -button[disabled] { - cursor: not-allowed; -} - -button { - background: initial; - border: none; -} - -textarea { - resize: none; -} -textarea:disabled { - background-color: var(--DISABLE_BG); - color: var(--DISABLE_TEXT); - cursor: not-allowed; -} - -.eo-checkbox:disabled { - color: var(--DISABLE_TEXT); - background-color: var(--DISABLE_BG); - border: 1px solid var(--BORDER); -} - -input::-ms-clear { - display: none; -} - -input::-ms-reveal { - display: none; -} - -.absolute { - position: absolute; -} - -.eo-blod { - font-weight: bold; -} - -.inline-block { - display: inline-block; -} - -.eo-tip-container { - position: absolute; - z-index: 100; - visibility: hidden; -} -.eo-tip-container .message-li { - padding: 10px; - line-height: initial; - border-radius: 3px; - background-color: #000; - color: #fff; - font-size: 12px; - text-align: left; - max-width: 500px; - min-width: 200px; -} -.eo-tip-container .message-li * { - color: #fff; -} -.eo-tip-container .arrow-li { - border-color: #000 transparent transparent transparent; - border-width: 5px 5px 0 5px; - border-style: solid; - width: 0; - margin-left: 8px; -} - -.eo-modal-header { - height: 50px; - line-height: 50px; - border-bottom: 1px solid var(--BORDER); - font-size: 18px; - padding: 0 20px; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - position: relative; -} -.eo-modal-header a, -.eo-modal-header input[type='button'] { - padding: 0 16px; -} -.eo-modal-header .icon-guanbi:hover { - color: var(--BLUE_NORMAL); -} - -.eo-modal-article, -.eo_form_default { - padding: 20px; -} -.eo-modal-article .eo_form_margin_top, -.eo_form_default .eo_form_margin_top { - margin-top: 20px; -} -.eo-modal-article .eo_form_first_item_title, -.eo_form_default .eo_form_first_item_title { - margin-bottom: 8px; - font-weight: bold; -} -.eo-modal-article .eo_form_item_title, -.eo_form_default .eo_form_item_title { - margin: 20px 0 8px 0; - font-weight: bold; -} - -.eo-modal-footer { - padding: 15px 20px; - border-top: 1px solid var(--BORDER); - display: flex; - flex-direction: row; - background-color: var(--MODAL_BG); - border-radius: 0 0 4px 4px; -} -.eo-modal-footer button, -.eo-modal-footer input[type='button'] { - margin-right: 8px; -} - -.eo_modal_footer_fixed { - box-sizing: border-box; - position: fixed; - z-index: 10; - bottom: 0; -} - -.eo-operate-btn { - color: var(--BTN_LIGHT_TEXT); - border: none; - background: none; - text-indent: 0; - cursor: pointer; - font-size: 12px; - margin-right: 10px; -} -.eo-operate-btn .iconfont { - padding-right: 2px; -} -.eo-operate-btn:hover { - color: var(--BTN_LIGHT_TEXT_HOVER); - text-decoration: underline; -} -.eo-operate-btn:disabled { - color: var(--TEXT_DISABLE) !important; - cursor: not-allowed !important; -} - -.eo-static-hidden { - height: 0; - overflow: hidden; - visibility: hidden; - position: relative; - padding: 0 !important; -} - -.eo-none-tr { - background-color: inherit !important; - color: var(--TEXT_DISABLE) !important; - line-height: 100px !important; - height: 100px !important; -} -.eo-none-tr td { - text-align: center; - cursor: default; - vertical-align: middle !important; -} - -.no-menu-list-container .common_scss_list .first_level_article { - margin: var(--GLOBAL_PLATE_PADDING) var(--GLOBAL_PLATE_PADDING) 0 var(--GLOBAL_PLATE_PADDING); -} -.no-menu-list-container .footer { - margin: 0 var(--GLOBAL_PLATE_PADDING) var(--GLOBAL_PLATE_PADDING) var(--GLOBAL_PLATE_PADDING); -} - -.eo_to_top_11 { - top: 11px; -} - -.dis-ib { - display: inline-block; -} - -.pull-left { - float: left; -} - -.pull-right { - float: right; -} - -.wrap { - width: 1250px; - height: auto; - margin: 0 auto; -} - -.eo_theme_mask_bg { - position: fixed; - z-index: -1; - width: 100%; - height: 100%; - top: 0; - left: 0; -} - -.eo_tag_item { - height: 18px; - line-height: 18px; - font-size: 12px; - background-color: #f1f8ff; - display: inline-flex; - padding: 0 5px; - border-radius: 3px; - color: #555; - margin-right: 3px; -} - -.eo_desc_box { - border: 1px solid var(--BORDER); - border: 1px solid var(--BORDER); - border-radius: 3px; - padding: 5px; -} - -.eo_disable { - background-color: var(--DISABLE_BG) !important; - color: var(--DISABLE_TEXT) !important; -} - -.eo_more_btn_container { - position: relative; - display: inline-block; -} -.eo_more_btn_container .more-btn:focus + .wrap-container { - display: block; -} -.eo_more_btn_container .common-btn { - border-radius: 3px 0 0 3px; - float: left; -} -.eo_more_btn_container .more-btn { - border-left: 1px solid var(--BORDER); - border-radius: 0 3px 3px 0; - padding: 0; -} -.eo_more_btn_container .wrap-container:hover { - display: block; -} -.eo_more_btn_container .wrap-container { - background-color: var(--COMPONENT_BG); - box-shadow: var(--COMPONENT_SHADOW); - position: absolute; - border-style: solid; - border-width: 1px; - border-radius: 3px; - right: 0; - z-index: 2; - border-color: var(--BORDER); - display: none; - margin-top: 5px; -} -.eo_more_btn_container .wrap-container button, -.eo_more_btn_container .wrap-container a { - height: 35px; - line-height: 35px; - padding: 0 15px; - text-align: left; - word-break: keep-all; - white-space: pre; - display: block; -} -.eo_more_btn_container .wrap-container button:hover, -.eo_more_btn_container .wrap-container a:hover { - background-color: var(--DISABLE_BG); - color: var(--MAIN_TEXT); - text-decoration: underline; -} - -.null_tip_span { - font-size: 16px; - width: 100%; - display: block; - text-align: center; - line-height: 140px; - color: var(--TEXT_DISABLE); -} - -.btn_hover:hover { - color: var(--BLUE_NORMAL); -} - -.eo-sv-handle { - cursor: move; -} - -.eo-textarea { - border-style: solid; - border-width: 1px; - border-radius: 3px; - font-size: 14px; - padding: 4px 6px; - box-sizing: border-box; - width: 250px; -} -.eo-textarea:disabled { - cursor: not-allowed; -} - -.eo_theme_ldt tbody tr:not(.unhover-tr):hover, -.eo_theme_lgt tbody tr:not(.unhover-tr):hover { - background-color: var(--TABLE_ROW_HOVER_BG); -} - -.eo-input, -.eo-select { - border-style: solid; - border-width: 1px; - border-radius: 3px; - font-size: 12px; - padding: 4px 6px; - box-sizing: border-box; - height: 30px; - line-height: 100%; - width: 250px; -} -.eo-input:disabled, -.eo-select:disabled { - cursor: not-allowed; -} - -.number-label:disabled:hover .ams-scss-disable-tip, -.get-more-btn:disabled:hover .ams-scss-disable-tip, -.btn-addChild:disabled:hover .ams-scss-disable-tip { - display: block; -} - -.ams-scss-disable-tip { - position: absolute; - margin-top: -54px; - z-index: 4; - display: none; - margin-left: -10px; -} -.ams-scss-disable-tip .tip-div { - padding: 10px; - word-break: keep-all; - line-height: initial; - border-radius: 3px; - background-color: #000; - color: #fff; - font-size: 12px; - text-align: left; - max-width: 500px; - min-width: 200px; -} -.ams-scss-disable-tip .arrow-div { - border-color: #000 transparent transparent transparent; - border-width: 5px 5px 0 5px; - border-style: solid; - width: 0; - margin-top: 8px; - margin-left: 8px; -} - -.eo-checkbox { - height: 15px; - line-height: 15px; - width: 15px; - font-size: 12px !important; - margin-right: 4px; - cursor: pointer; - display: inline-block; - text-align: center; - border-radius: 3px; - text-indent: 0; - color: var(--MAIN_TEXT); - border: 1px solid var(--BORDER); - font-weight: 100; -} - -.eo_theme_iblock { - background-color: var(--MAIN_BG); -} - -.eo_link { - color: var(--BTN_LIGHT_TEXT) !important; -} -.eo_link:hover { - text-decoration: underline; - color: var(--BTN_LIGHT_TEXT_HOVER); -} - -.eo_mask { - position: fixed; - z-index: -1; - width: 100%; - height: 100%; - top: 0; - left: 0; -} - -.eo_theme_btn_default { - border-style: solid; - border-width: 1px; -} - -.eo_theme_btn_delete:disabled, -.eo_theme_btn_success:disabled, -.eo_theme_btn_info:disabled, -.eo_theme_btn_orange:disabled, -.eo_theme_btn_warning:disabled, -.eo_theme_btn_danger:disabled { - border: 1px solid var(--DISABLE_BG); -} - -.eo_theme_btn_disabled { - color: #999 !important; - background-color: var(--DISABLE_BG) !important; - border: 1px solid var(--BORDER) !important; - cursor: not-allowed; -} - -.eo-more-btn-container { - position: relative; - display: inline-block; -} -.eo-more-btn-container:hover { - color: var(--BLUE_NORMAL); -} -.eo-more-btn-container .eo_more_btn { - line-height: 26px; -} -.eo-more-btn-container .iconfont { - font-size: 24px; -} -.eo-more-btn-container .icon-chevron-down { - font-size: 18px; -} -.eo-more-btn-container .wrap-div { - background-color: var(--COMPONENT_BG); - border: 1px solid var(--BORDER); - box-shadow: var(--COMPONENT_SHADOW); - border-radius: var(--DEFAULT_BORDER_RADIUS); - -ms-animation: fade 0.3s; - -moz-animation: fade 0.3s; - -webkit-animation: fade 0.3s; - animation: fade 0.3s; - position: absolute; - top: 33px; - right: -88px; - border-style: solid; - border-width: 1px; - z-index: 2; - display: none; - margin-top: 5px; -} -.eo-more-btn-container .wrap-div > li, -.eo-more-btn-container .wrap-div p, -.eo-more-btn-container .wrap-div > button { - height: 35px; - line-height: 35px; - padding: 0 15px; - text-align: left; - color: #555; - word-break: keep-all; - white-space: nowrap; - min-width: 60px; - cursor: pointer; -} -.eo-more-btn-container .wrap-div > li:hover, -.eo-more-btn-container .wrap-div p:hover, -.eo-more-btn-container .wrap-div > button:hover { - background-color: var(--DISABLE_BG); - color: var(--MAIN_TEXT); - text-decoration: underline; -} -.eo-more-btn-container .wrap-div > button { - width: 100%; -} -.eo-more-btn-container .eo_more_btn:focus + .wrap-div, .eo-more-btn-container:focus .wrap-div { - display: block; -} - -.eo-wrap-div { - background-color: var(--COMPONENT_BG); - box-shadow: var(--COMPONENT_SHADOW); - position: absolute; - border-style: solid; - border-width: 1px; - border-radius: 3px; - right: 0; - z-index: 2; - border-color: var(--BORDER); - display: none; - margin-top: 5px; -} -.eo-wrap-div p { - height: 35px; - line-height: 35px; - padding: 0 15px; - text-align: left; - color: #555; - word-break: keep-all; - white-space: pre; - min-width: 60px; - cursor: pointer; -} -.eo-wrap-div p:hover { - background-color: var(--DISABLE_BG); - color: var(--MAIN_TEXT); - text-decoration: underline; -} - -.eo-label-purple, -.eo-label-soap { - color: var(--PURPLE_TAG_TEXT); - background-color: var(--PURPLE_TAG_BG); - border-radius: 3px; -} - -.eo-label-success { - color: var(--GREEN_TAG_TEXT); - background-color: var(--GREEN_TAG_BG); - border-radius: 3px; -} - -.eo-label-ws, -.eo-label-socket, -.eo-label-default { - color: var(--BLUE_TAG_TEXT); - background-color: var(--BLUE_TAG_BG); - border-radius: 3px; -} - -.eo-label-danger { - color: var(--RED_TAG_TEXT); - background-color: var(--RED_TAG_BG); - border-radius: 3px; -} - -.eo-label-warning { - color: var(--ORANGE_TAG_TEXT); - background-color: var(--ORANGE_TAG_BG); - border-radius: 3px; -} - -.eo-label-tips { - color: var(--TEXT_DISABLE); - background-color: var(--DISABLE_BG); - border-radius: 3px; -} - -.eo-label-others { - color: var(--WHITE_TAG_TEXT); - background-color: var(--WHITE_TAG_BG); - border-radius: 3px; -} - -.eo-label-yellow { - color: var(--YELLOW_TAG_TEXT); - background-color: var(--YELLOW_TAG_BG); - border-radius: 3px; -} - -.eo-label-options { - color: #fafdff; - background-color: #546e7a; - border-radius: 3px; -} - -.eo-label-green { - color: var(--GREEN_TAG_TEXT); - background-color: var(--GREEN_TAG_BG); - border-radius: 3px; -} - -.eo-color-default { - color: #fff; - background-color: var(--BLUE_NORMAL); - border: 1px solid var(--BLUE_NORMAL); - border-radius: 3px; -} - -.eo-color-success { - color: #fff; - background-color: var(--GREEN_NORMAL); - border: 1px solid var(--GREEN_NORMAL); - border-radius: 3px; -} - -.eo-color-warning { - color: #fff; - background-color: #f18f00; - border: 1px solid #f18f00; - border-radius: 3px; -} - -.eo-color-error { - color: #fff; - background-color: var(--RED_NORMAL); - border: 1px solid var(--RED_NORMAL); - border-radius: 3px; -} - -.eo-color-yellow { - color: #fff; - background-color: #ffcc00; - border: 1px solid #ffcc00; - border-radius: 3px; -} - -.eo-color-danger { - color: #fff; - background-color: #ea0707; - border: 1px solid #ea0707; - border-radius: 3px; -} - -.eo-color-tips { - color: #fff; - background-color: #999; - border: 1px solid #999; - border-radius: 3px; -} - -.eo-color-tips-shallow { - color: #fff; - background-color: #b3b4b3; - border: 1px solid #b3b4b3; - border-radius: 3px; -} - -.eo-color-others { - color: #fff; - background-color: #795548; - border: 1px solid #6d4c41; - border-radius: 3px; -} - -.eo-color-options { - color: #fff; - background-color: var(--MAIN_TEXT); - border: 1px solid #546e7a; - border-radius: 3px; -} - -.eo-color-unuse { - color: #fff; - background-color: #999; - border: 1px solid #c63e21; - border-radius: 3px; -} - -.eo-color-purple { - color: #fff; - background-color: #9c27b0; - border: 1px solid #9c27b0; - border-radius: 3px; -} - -.eo-color-green { - color: #fff; - background-color: #8bc34a; - border: 1px solid #8bc34a; - border-radius: 3px; -} - -.eo-error-tips { - color: var(--RED_NORMAL); - font-size: 12px; - display: none; - line-height: 32px; -} - -.eo-input-error + .eo-error-tips, -.eo-had-input-error + .eo-error-tips, -.eo-had-input-error .eo-error-tips { - display: block; -} - -.eo-status-ws { - color: var(--MAIN_TEXT); -} - -.eo-status-socket { - color: #757575; -} - -.eo-status-options { - color: #546e7a; -} - -.eo-status-green { - color: #8bc34a; -} - -.eo-status-others { - color: #6d4c41; -} - -.eo-status-default { - color: var(--BLUE_NORMAL); -} - -.eo-status-success { - color: var(--GREEN_NORMAL); -} - -.eo-status-warning { - color: #f18f00; -} - -.eo-status-error { - color: var(--RED_NORMAL); -} - -.eo-status-yellow { - color: #fc0; -} - -.eo-status-purple { - color: #9c27b0; -} - -.eo-status-danger { - color: #ea0707; -} - -.eo-status-tips { - color: #999; -} - -.eo-status-disabled { - color: #ccc; -} - - -.eo-tab-icon { - color: #fff; - height: 16px; - line-height: 18px; - border-radius: 8px; - display: inline-block; - padding: 0 5px; - font-size: 12px; - background-color: var(--MAIN_THEME_COLOR); -} - -@keyframes flicker { - 0% { - border: 1px solid var(--BORDER); - } - 50% { - border: 1px solid var(--GREEN_DEEP); - } - 100% { - border: 1px solid var(--BORDER); - } -} -.eo-copy { - -ms-animation: flicker 1s; - -moz-animation: flicker 1s; - -webkit-animation: flicker 1s; - animation: flicker 1s; -} - -.eo_panel_title { - border-left: 3px solid var(--GREEN_NORMAL); - line-height: 30px; - background-color: var(--TABLE_HEADER_BG); -} -.eo_panel_title:hover .shrink_text_ept { - background-color: var(--TABLE_HEADER_BG_HOVER); -} - -.eo-tab-menu { - display: table; - border-bottom: 0; - width: 100%; -} -.eo-tab-menu .item-tab { - padding: 0 15px; - display: inline-block; - cursor: pointer; - height: 38px; - line-height: 38px; - border-bottom-style: solid; - border-bottom-width: 2px; - margin-right: 2px; - border-bottom-color: transparent; -} -.eo-tab-menu .item-tab .icon-circle { - font-size: 12px; - margin-right: 5px; -} -.eo-tab-menu .active-item, -.eo-tab-menu .item-tab:hover { - cursor: default; - color: var(--MAIN_THEME_COLOR); - border-bottom-color: var(--MAIN_THEME_COLOR); -} -.eo-tab-menu .disable-item { - cursor: not-allowed; -} -.eo-tab-menu .disable-item .iconfont { - display: none; -} - -.eo-tab-container { - border: 1px solid var(--BORDER); - display: block; -} - -.eo_theme_lct_tra { - background-color: var(--TABLE_BG_ACTIVE) !important; -} - -.eo-block-container { - border-radius: 3px; - background-color: var(--MAIN_BG); - border: 1px solid var(--BORDER); - display: block; - overflow: auto; - color: var(--MAIN_TEXT); -} - -.eo-method-label { - border-radius: 3px; - margin-right: 8px; - font-size: 12px; - display: inline-block; - min-width: 35px; - height: 18px; - line-height: 18px; - text-align: center; - text-indent: 0; - padding: 0 5px; -} - -.eo_label_member_tips { - border-style: solid; - border-width: 1px; - border-radius: 3px; - border-radius: 3px; - padding: 2px 3px; -} - -.eo-absolute { - position: absolute; -} - -.eo-relative { - position: relative; -} - -.opacity-none { - opacity: 0; -} - -.eo-had-content-error * { - color: #d85030; -} - -.eo-input-error, -.eo-had-input-error input { - border-color: var(--RED_NORMAL) !important; - color: var(--RED_NORMAL) !important; -} -.eo-input-error:focus, -.eo-had-input-error input:focus { - border-color: var(--RED_NORMAL) !important; - color: var(--MAIN_TEXT) !important; -} - -.eo-input-success { - border-color: var(--GREEN_LIGHT) !important; -} - -.eo_popover_tip { - position: absolute; - z-index: 6; - background-color: #000; - height: 30px; - line-height: 30px; - display: inline-block; - padding: 0 10px; - white-space: nowrap; - border-radius: 3px; - text-indent: 0; - color: #fff; - font-size: 12px; - display: none; -} - -.eo-common-table { - border-spacing: 0; - table-layout: fixed; - border-radius: 3px; - border: 1px solid var(--BORDER); -} -.eo-common-table thead td { - background-color: #fafafa; -} -.eo-common-table td { - height: 40px; - line-height: 40px; - vertical-align: top; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - padding-left: 10px; -} -.eo-common-table td:nth-last-child(n + 2) { - border-right: 1px dashed var(--BORDER); -} -.eo-common-table thead { - background-color: #fafafa; -} -.eo-common-table .btn-delete { - height: 25px; - line-height: 25px; - border-radius: 3px; - background-color: #f2f2f2; - color: #999; - display: inline-block; - text-align: center; - border: 1px solid var(--BORDER); - padding: 0 5px; - font-size: 12px; -} -.eo-common-table .btn-delete:hover { - background-color: var(--RED_NORMAL); - color: #fff; - border: 1px solid #d03333; -} -.eo-common-table tbody tr:nth-last-child(n + 2) td { - border-bottom: 1px dashed var(--BORDER); -} -.eo-common-table tbody tr:first-child td { - border-top: 1px solid var(--BORDER); -} -.eo-common-table tbody .hover-tr:hover { - background-color: #fafafa; -} - -.popover { - position: absolute; - z-index: 2; -} -.popover table { - border-spacing: 0; -} - -.arrow { - border-style: solid; - border-width: 5px 10px 5px 0; - border-color: transparent var(--MAIN_TEXT) transparent transparent; -} - -.popover-inner { - background-color: var(--MAIN_TEXT); - padding: 5px 10px; - min-width: 150px; - max-width: 215px; -} -.popover-inner .popover-content { - color: #fff; - font-size: 12px; - line-height: 20px; -} - -input::-webkit-input-placeholder, -textarea::-webkit-input-placeholder { - color: #ccc; -} - -input:-moz-placeholder, -textarea:-moz-placeholder { - color: #ccc; -} - -input::-moz-placeholder, -textarea::-moz-placeholder { - color: #ccc; -} - -input:-ms-input-placeholder, -textarea:-ms-input-placeholder { - color: #ccc; -} - -/* 分页 */ -.pageFooter { - text-align: center; -} -.pageFooter li > a, -.pageFooter li > span { - color: var(--MAIN_TEXT); - width: 35px; -} -.pageFooter .disabled > a { - color: #e5e5e5; - cursor: default; -} -.pageFooter .pagination-prev, -.pageFooter .pagination-next { - border-radius: 3px; -} -.pageFooter .pagination .active, -.pageFooter .pagination .active:hover, -.pageFooter .pagination .active:focus, -.pageFooter .pagination .active, -.pageFooter .pagination .active:hover, -.pageFooter .pagination .active:focus { - background-color: var(--GREEN_DEEP); -} -.pageFooter .pagination .active a, -.pageFooter .pagination .active:hover a, -.pageFooter .pagination .active:focus a, -.pageFooter .pagination .active a, -.pageFooter .pagination .active:hover a, -.pageFooter .pagination .active:focus a { - color: #fff; -} -.pageFooter .pagination-jump { - margin: 20px 0; - color: var(--MAIN_TEXT); - margin-top: 37px; - margin-left: 10px; - display: inline-block; -} -.pageFooter .pagination-jump li { - height: 37px; - line-height: 37px; - display: inline-block; -} -.pageFooter .pagination-jump li input { - height: 33px; - line-height: 33px; - margin: 0 8px; - width: 55px; - border: 1px solid #dfdfdf; - background-color: #fff; -} -.pageFooter .pagination-jump li button { - width: 50px; -} -.pageFooter .pagination-jump li input { - text-indent: 1em; -} -.pageFooter .pagination-sm { - margin: 25px; - display: inline-block; -} -.pageFooter .pagination-sm li { - width: 35px; - height: 35px; - line-height: 36px; - background-color: #fff; - border: 1px solid rgba(0, 0, 0, 0.06); - border-left: none; - text-align: center; - display: inline-flex; -} -.pageFooter .pagination-sm .pagination-prev { - margin-right: 10px; - border-left: 1px solid rgba(0, 0, 0, 0.06); -} -.pageFooter .pagination-sm .pagination-next { - margin-left: 10px; - border-left: 1px solid rgba(0, 0, 0, 0.06); -} -.pageFooter .pagination-sm li:nth-child(2) { - border-left: 1px solid rgba(0, 0, 0, 0.06); -} -.pageFooter .first-page { - border-radius: 3px 0 0 3px; -} -.pageFooter .last-page { - border-radius: 0 3px 3px 0; -} -.pageFooter .only-page { - border-radius: 3px; -} - -comment-Ams-Component .md_tips, -online-service-global-component .md_tips { - position: absolute; - right: 10px; - top: 9px; - z-index: 5; -} -comment-Ams-Component .session_content, -online-service-global-component .session_content { - overflow: auto; - height: 341px; -} -comment-Ams-Component .message_item_container, -online-service-global-component .message_item_container { - width: 100%; - clear: both; -} -comment-Ams-Component .message_item, -online-service-global-component .message_item { - margin-bottom: 20px; -} -comment-Ams-Component .user_message, -online-service-global-component .user_message { - float: right; -} -comment-Ams-Component .user_message .message_time, -online-service-global-component .user_message .message_time { - text-align: right; -} -comment-Ams-Component .service_message, -online-service-global-component .service_message { - float: left; -} -comment-Ams-Component .service_message .message_time, -online-service-global-component .service_message .message_time { - text-align: left; -} -comment-Ams-Component .session_editor_btn_box, -online-service-global-component .session_editor_btn_box { - height: 42px; -} -comment-Ams-Component .message_logo, -online-service-global-component .message_logo { - height: 30px; - border-radius: 50%; - width: 30px; - background-color: var(--BORDER); - background-size: contain; -} -comment-Ams-Component .btn_see_history, -online-service-global-component .btn_see_history { - margin-left: auto; - margin-right: auto; -} -comment-Ams-Component .message_content, -online-service-global-component .message_content { - padding: 10px; - border-radius: 3px; - line-height: 1.6rem; - max-width: 420px; - min-width: 200px; - margin-bottom: 10px; - color: var(--MAIN_TEXT) !important; - background-color: var(--INPUT_BG); -} -comment-Ams-Component .message_content img, -online-service-global-component .message_content img { - max-width: 150px; - max-height: 100px; - cursor: zoom-in; -} -comment-Ams-Component .message_content a, -online-service-global-component .message_content a { - color: var(--BLUE_NORMAL); - text-decoration: underline; -} -comment-Ams-Component .editormd, -online-service-global-component .editormd { - border: none; - border-top: 1px solid var(--BORDER); -} -comment-Ams-Component .editormd .editormd-menu > li > a, -online-service-global-component .editormd .editormd-menu > li > a { - border: none; - color: #979ca4; -} - -.hidden { - display: none; -} - -.hidden-dom { - position: absolute; - width: 0; - height: 0; - overflow: hidden; -} - - -.eo-input, -.eo-textarea, -.eo-select { - border-color: var(--BORDER); - background-color: var(--INPUT_BG); - color: var(--MAIN_TEXT); -} -.eo-input:hover, -.eo-textarea:hover, -.eo-select:hover { - border-color: var(--GREEN_LIGHT); - transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1); -} -.eo-input:focus, -.eo-textarea:focus, -.eo-select:focus { - border-color: var(--GREEN_NORMAL) !important; -} -.eo-input:disabled, -.eo-textarea:disabled, -.eo-select:disabled { - color: var(--TEXT_DISABLE); - background-color: var(--DISABLE_BG); -} - -/** --按钮样å¼-- **/ -.eo_theme_btn_danger { - background-color: var(--BTN_DANGER_BG); - color: var(--BTN_DANGER_TEXT); - border-color: var(--BTN_DANGER_BORDER); -} -.eo_theme_btn_danger:hover, .eo_theme_btn_danger:active { - background-color: var(--BTN_DANGER_BG_HOVER) !important; - color: var(--BTN_DANGER_TEXT) !important; - border-color: var(--BTN_DANGER_BORDER_HOVER) !important; -} -.eo_theme_btn_danger:disabled { - color: var(--TEXT_DISABLE) !important; - background-color: var(--DISABLE_BG) !important; - border-color: var(--DISABLE_BG) !important; -} -.eo_theme_btn_danger:disabled .iconfont { - color: var(--TEXT_DISABLE) !important; -} - -.eo_theme_btn_warning { - background-color: var(--BTN_DANGER_BG); - color: var(--BTN_DANGER_TEXT); - border-color: var(--BTN_DANGER_BORDER); -} -.eo_theme_btn_warning:hover, .eo_theme_btn_warning:active { - background-color: var(--BTN_DANGER_BG_HOVER) !important; - color: var(--BTN_DANGER_TEXT) !important; - border-color: var(--BTN_DANGER_BORDER_HOVER) !important; -} -.eo_theme_btn_warning:disabled { - color: var(--TEXT_DISABLE) !important; - background-color: var(--DISABLE_BG) !important; - border-color: var(--DISABLE_BG) !important; -} -.eo_theme_btn_warning:disabled .iconfont { - color: var(--TEXT_DISABLE) !important; -} - -.eo_theme_btn_success + .eo_theme_btn_success { - background-color: var(--BTN_PRIMARY_MORE_BG); -} -.eo_theme_btn_success + .eo_theme_btn_success:hover { - background-color: var(--BTN_PRIMARY_MORE_HOVER); -} - -.eo_theme_btn_info + .eo_theme_btn_info { - background-color: var(--BTN_SEC_MORE_BG); -} -.eo_theme_btn_info + .eo_theme_btn_info:hover { - background-color: var(--BTN_SEC_MORE_BG_HOVER); -} - -.btn_static_test_utac:hover + .eo_theme_btn_success { - background-color: var(--BTN_PRIMARY_BG_HOVER); -} - -.btn_static_test_utac:hover + .eo_theme_btn_info { - background-color: var(--BTN_SEC_BG_HOVER); -} - -.eo_theme_btn_success { - background-color: var(--BTN_PRIMARY_BG); - color: var(--BTN_PRIMARY_TEXT); - border-color: var(--BTN_PRIMARY_BORDER); -} -.eo_theme_btn_success:hover, .eo_theme_btn_success:active { - background-color: var(--BTN_PRIMARY_BG_HOVER) !important; - color: var(--BTN_PRIMARY_TEXT_HOVER) !important; - border-color: var(--BTN_PRIMARY_BORDER_HOVER) !important; -} -.eo_theme_btn_success:disabled { - color: var(--TEXT_DISABLE) !important; - background-color: var(--DISABLE_BG) !important; - border-color: var(--DISABLE_BG) !important; -} -.eo_theme_btn_success:disabled .iconfont { - color: var(--TEXT_DISABLE) !important; -} - -.eo_theme_btn_info, -.eo_theme_btn_default { - background-color: var(--BTN_SEC_BG); - color: var(--BTN_SEC_TEXT); - border-color: var(--BTN_SEC_BORDER); -} -.eo_theme_btn_info:hover, .eo_theme_btn_info:active, -.eo_theme_btn_default:hover, -.eo_theme_btn_default:active { - background-color: var(--BTN_SEC_BG_HOVER) !important; - color: var(--BTN_SEC_TEXT_HOVER) !important; - border-color: var(--BTN_SEC_BORDER_HOVER) !important; -} -.eo_theme_btn_info:disabled, -.eo_theme_btn_default:disabled { - color: var(--TEXT_DISABLE) !important; - background-color: var(--DISABLE_BG) !important; - border-color: var(--DISABLE_BG) !important; -} -.eo_theme_btn_info:disabled .iconfont, -.eo_theme_btn_default:disabled .iconfont { - color: var(--TEXT_DISABLE) !important; -} - -.introjs-tooltip { - color: #000 !important; -} - -.text_ellipsis_2 { - text-overflow: -o-ellipsis-lastline; - overflow: hidden; - text-overflow: ellipsis; - display: -webkit-box; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; -} - -.word_break_keep_all { - word-break: keep-all; -} - -.bs_bb { - box-sizing: border-box; -} - -.z_index8 { - z-index: 8; -} - -.z_index10 { - z-index: 10; -} - -.z_index2 { - z-index: 2; -} - -.z_index4 { - z-index: 4; -} - -.z_index_minus1 { - z-index: -1; -} - -.va_top { - vertical-align: top; -} - -.op_0 { - opacity: 0; -} - -.op_3 { - opacity: 0.3; -} - -.op_5 { - opacity: 0.5; -} - -.op_10 { - opacity: 1; -} - -.ws_normal { - white-space: normal !important; - word-break: break-all; -} - -.ws_nowrap { - white-space: nowrap; -} - -.scroll_y { - overflow-y: auto; -} - -.text_omit { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -.ws_pw { - white-space: pre-wrap; -} - -.wb_all { - word-break: break-all; -} - -.wb_keep_all { - word-break: keep-all; -} - -.ws_initial { - white-space: initial; -} - -.of_hidden { - overflow: hidden; -} - -.of_inherit { - overflow: inherit !important; -} - -.br_5 { - border-radius: 3px; -} - -.br_3 { - border-radius: 3px; -} - -.eo_to_top_0 { - top: 0; -} - -.eo_to_top_10 { - top: 10px; -} - -.eo_to_top_20 { - top: 20px; -} - -.eo_to_right_0 { - right: 0; -} - -.eo_to_right_750 { - right: -750px; -} - -.eo_to_bottom_0 { - bottom: 0; -} - -.br_0330 { - border-radius: 0 3px 3px 0; -} - -.lh_40 { - line-height: 40px; -} - -.lh_45 { - line-height: 45px; -} - -.lh_50 { - line-height: 50px; -} - -.lh_80 { - line-height: 80px; -} - -.lh_38 { - line-height: 38px !important; -} - -.lh_30 { - line-height: 30px; -} - -.lh_25 { - line-height: 25px; -} - -.lh_35 { - line-height: 35px; -} - -.lh_20 { - line-height: 20px; -} - -.lh_25 { - line-height: 25px; -} - -.lh_1em { - line-height: 1em; -} - -.lh_14 { - line-height: 14px; -} - -.lh_12 { - line-height: 12px; -} - -.lh_1point75 { - line-height: 1.75em; -} - -.lh_init { - line-height: initial; -} - -.clear_b { - clear: both; -} - -.dp_f { - display: flex; -} - -.dp_none { - display: none; -} - -.dp_b { - display: block !important; -} - -.dp_ib { - display: inline-block; -} - -.dp_it { - display: inline-table; -} - -.mw_1100 { - min-width: 1100px; -} - -.mw_100 { - min-width: 100px; -} - -.mw_200 { - min-width: 200px; -} - -.mw_250 { - min-width: 250px; -} - -.mw_110 { - min-width: 110px; -} - -.maw_100 { - max-width: 100px; -} - -.maw_200 { - max-width: 200px; -} - -.maw_100percent { - max-width: 100%; -} - -.mw_300 { - min-width: 300px; -} - -.mw_80 { - min-width: 80px; -} - -.mw_800 { - min-width: 800px; -} - -.mw_55 { - min-width: 55px; -} - -.mw_50 { - min-width: 50px; -} - -.w_10 { - width: 10px; -} - -.w_20 { - width: 20px; -} - -.w_240 { - width: 240px; -} - -.w_380 { - width: 380px; -} - -.w_25 { - width: 25px; -} - -.w_124 { - width: 124px; -} - -.w_inherit { - width: inherit; -} - -.w_15 { - width: 15px; -} - -.w_600 { - width: 600px; -} - -.w_60 { - width: 60px; -} - -.w_145 { - width: 145px; -} - -.w_80 { - width: 80px !important; -} - -.w_120 { - width: 120px; -} - -.w_150 { - width: 150px; -} - -.w_90 { - width: 90px !important; -} - -.w_95 { - width: 95px; -} - -.w_180 { - width: 180px; -} - -.w_160 { - width: 160px; -} - -.w_170 { - width: 170px; -} - -.w_200 { - width: 200px; -} - -.w_300 { - width: 300px; -} - -.w_320 { - width: 320px; -} - -.w_90percent { - width: 90% !important; - width: 90vw !important; -} - -.w_60percent { - width: 60%; -} - -.w_18percent { - width: 18%; -} - -.w_30percent { - width: 30%; -} - -.w_25percent { - width: 25%; -} - -.w_20percent { - width: 20%; -} - -.w_40percent { - width: 40%; -} - -.w_10percent { - width: 10%; -} - -.w_30 { - width: 30px; -} - -.w_400 { - width: 400px; -} - -.w_25 { - width: 25px; -} - -.w_40 { - width: 40px; -} - -.w_450 { - width: 450px; -} - -.w_500 { - width: 500px; -} - -.w_55 { - width: 55px !important; -} - -.w_50 { - width: 50px !important; -} - -.w_250 { - width: 250px !important; -} - -.w_800 { - width: 800px !important; -} - -.w_900 { - width: 800px !important; -} - -.w_220 { - width: 220px; -} - -.w_100 { - width: 100px !important; -} - -.w_50percent { - width: 50%; -} - -.w_65percent { - width: 65%; -} - -.w_100percent { - width: 100% !important; -} - -.w_80percent { - width: 80%; -} - -.w_8percent { - width: 8%; -} - -.mw_fc { - min-width: -moz-fit-content; - min-width: fit-content; -} - -.h_100percent { - height: 100%; -} - -.mh_40 { - min-height: 40px; -} - -.h_50 { - height: 50px; -} - -.h_25 { - height: 25px; -} - -.h_40 { - height: 40px; - line-height: 40px; -} - -.h_60 { - height: 60px; - line-height: 60px; -} - -.h_100 { - height: 100px !important; -} - -.h_54 { - height: 54px !important; -} - -.h_20 { - height: 20px !important; -} - -.h_30 { - height: 30px; -} - -.h_35 { - height: 35px; -} - -.po_re { - position: relative; -} - -.po_unset { - position: unset !important; -} - -.po_ab { - position: absolute; -} - -.po_fix { - position: fixed; -} - -.ti0 { - text-indent: 0; -} - -.ti20 { - text-indent: 20px; -} - -.tac { - text-align: center; -} - -.ta_l { - text-align: left; -} - -.ta_r { - text-align: right; -} - -.ta_j { - text-align: justify; -} - -.ab_r20 { - position: absolute; - right: 20px; -} - -.ab_r10 { - position: absolute; - right: 10px; -} - -.ab_r0 { - position: absolute; - right: 0; -} - -.h6 { - font-size: 16px; - font-weight: bold; -} - -.h20 { - font-size: 20px; - font-weight: bold; -} - -.h24 { - font-size: 24px; - font-weight: bold; -} - -.fwb { - font-weight: bold; -} - -.fw_initial { - font-weight: initial; -} - -.cp { - cursor: pointer; -} - -.cd { - cursor: default; -} - -.ccr { - cursor: col-resize; -} - -.wh35 { - display: inline-block; - width: 35px; - height: 35px; -} - -.c_keyword { - background-color: #ffea00; -} - -.c_keytip { - color: #7f8691; -} - -.c_white { - color: #fff; -} - -.bgc_tips { - background-color: #2979ff; -} - -.c_icon_qian { - color: #888; -} - -.c_back_blue { - color: #007aff; -} - -.c_dark_blue { - color: #132b94; -} - -.c555 { - color: #555; -} - -.cfff { - color: #fff !important; -} - -.c999 { - color: #999 !important; -} - -.c666 { - color: #666; -} - -.c333 { - color: #333; -} - -.cddd { - color: var(--BORDER); -} - -.c_orange { - color: #f18f00; -} - -.c_slight_red { - color: #f44336; -} - -.c_b_g { - color: var(--GREEN_NORMAL); - border: 1px solid; -} - -.c_ng_focus { - color: var(--GREEN_NORMAL); -} - -.bgc_white { - background-color: #fff; -} - -.bgc_g { - background-color: var(--GREEN_NORMAL); -} - -.bgc_grey { - background-color: #999; -} - -.bgc_pink { - background-color: #fae4e6; -} - -.bgc_r { - background-color: var(--RED_NORMAL); -} - -.c_b_y { - color: #f18f00; - border: 1px solid; -} - -.c_b_r { - color: #ea0707; - border: 1px solid; -} - -.c_fast { - color: #ff3d00; -} - -.f_self_end { - align-self: flex-end; -} - -.f_row { - display: flex; - flex-direction: row; -} - -.f_row_ac { - display: flex; - flex-direction: row; - align-items: center; -} - -.f_column { - display: flex; - flex-direction: column; -} - -.f_wrap { - display: flex; - flex-wrap: wrap; -} - -.f_norwrap { - display: flex; - flex-wrap: nowrap; -} - -.f_jc_ac { - justify-content: center; - align-items: center; -} - -.f_js_ac { - justify-content: space-between; - align-items: center; -} - -.f_jc { - justify-content: center; -} - -.f_js { - justify-content: space-between; -} - -.f_je { - justify-content: flex-end; -} - -.f_ac { - align-items: center; -} - -.f_as { - align-items: flex-start; -} - -.f_ae { - align-items: flex-end; -} - -.f_g_1 { - flex-grow: 1; -} - -.btd { - border-top: 1px solid var(--BORDER); -} - -.brd { - border-right: 1px solid var(--BORDER); -} - -.br_none { - border-right: none !important; -} - -.bld { - border-left: 1px solid var(--BORDER); -} - -.bbd { - border-bottom: 1px solid var(--BORDER); -} - -.bte { - border-top: 1px solid var(--DISABLE_BG); -} - -.btd_dashed { - border-top: 1px dashed var(--BORDER); -} - -.bbd_dashed { - border-bottom: 1px dashed var(--BORDER); -} - -.bd_all { - border: 1px solid var(--BORDER); -} - -.bdd_br3 { - border: 1px solid var(--BORDER); - border-radius: 3px; -} - -.fg1 { - flex: 1; -} - -.fg2 { - flex: 2; -} - -.fg_auto { - flex: auto; -} - -.cblue { - color: var(--BLUE_NORMAL); -} - -.cr { - color: var(--RED_NORMAL); -} - -.b_cr { - border: 1px solid var(--RED_NORMAL); -} - -.b_none { - border: none; -} - -.cb { - color: #2196f3; -} - -.cy { - color: #f48932; -} - -.co { - color: #ffb74d; -} - -.ce6 { - color: #e6e6e6; -} - -.cf { - color: #fff; -} - -.cg { - color: var(--GREEN_NORMAL); -} - -.c9 { - color: #999; -} - -.tt_uppercase { - text-transform: uppercase; -} - -.tdu { - text-decoration: underline; -} - -.fs11 { - font-size: 11px; -} - -.fs12 { - font-size: 12px !important; -} - -.fs60 { - font-size: 60px; -} - -.fs14 { - font-size: 14px; -} - -.fs16 { - font-size: 16px; -} - -.fs18 { - font-size: 18px; -} - -.fs20 { - font-size: 20px; -} - -.fs24 { - font-size: 24px !important; -} - -.fs28 { - font-size: 28px !important; -} - -.fs30 { - font-size: 30px; -} - -.fs22 { - font-size: 22px !important; -} - -.fs26 { - font-size: 26px; -} - -.fs32 { - font-size: 32px; -} - -.fs13 { - font-size: 13px; -} - -.m_auto { - margin: auto; -} - -.m20 { - margin: 20px; -} - -.mr60 { - margin-right: 60px; -} - -.ml60 { - margin-left: 60px; -} - -.m10 { - margin: 10px; -} - -.w840 { - width: 840px; -} - -.w400 { - width: 400px; -} - -.w420 { - width: 420px; -} - -.m15 { - margin: 15px; -} - -.mr80 { - margin-right: 80px; -} - -.mr0 { - margin-right: 0; -} - -.mr5 { - margin-right: 5px; -} - -.mr10 { - margin-right: 10px; -} - -.mr15 { - margin-right: 15px; -} - -.mr20 { - margin-right: 20px; -} - -.mr30 { - margin-right: 30px; -} - -.mr40 { - margin-right: 40px; -} - -.mr50 { - margin-right: 50px; -} - -.mr35 { - margin-right: 35px; -} - -.ml12 { - margin-left: 12px; -} - -.ml42 { - margin-left: 42px; -} - -.ml0 { - margin-left: 0; -} - -.ml5 { - margin-left: 5px; -} - -.ml15 { - margin-left: 15px; -} - -.ml10 { - margin-left: 10px; -} - -.ml72 { - margin-left: 72px; -} - -.ml20 { - margin-left: 20px; -} - -.ml30 { - margin-left: 30px; -} - -.ml220 { - margin-left: 220px; -} - -.ml260 { - margin-left: 260px; -} - -.ml40 { - margin-left: 40px; -} - -.ml50 { - margin-left: 50px; -} - -.ml47 { - margin-left: 47px; -} - -.ml_auto { - margin-left: auto; -} - -.mlr5 { - margin-left: 5px; - margin-right: 5px; -} - -.mlr10 { - margin-left: 10px; - margin-right: 10px; -} - -.mlr15 { - margin-left: 15px; - margin-right: 15px; -} - -.mlr20 { - margin-left: 20px; - margin-right: 20px; -} - -.mlr40 { - margin-left: 40px; - margin-right: 40px; -} - -.ml30 { - margin-left: 30px; -} - -.mt0 { - margin-top: 0; -} - -.mt51 { - margin-top: 51px; -} - -.mt60 { - margin-top: 60px; -} - -.mt65 { - margin-top: 65px; -} - -.mt35 { - margin-top: 35px; -} - -.mt25 { - margin-top: 25px; -} - -.mt12 { - margin-top: 12px; -} - -.mt5 { - margin-top: 5px; -} - -.mt10 { - margin-top: 10px; -} - -.mt8 { - margin-top: 8px; -} - -.mt1 { - margin-top: 1px; -} - -.mtb50 { - margin-top: 50px; - margin-bottom: 50px; -} - -.mtb5 { - margin-top: 5px; - margin-bottom: 5px; -} - -.mt20 { - margin-top: 20px; -} - -.mt30 { - margin-top: 30px; -} - -.mt40 { - margin-top: 40px; -} - -.mt50 { - margin-top: 50px; -} - -.mt15 { - margin-top: 15px; -} - -.mt100 { - margin-top: 100px; -} - -.mt150 { - margin-top: 150px; -} - -.mt200 { - margin-top: 200px; -} - -.mb20 { - margin-bottom: 20px; -} - -.mb10 { - margin-bottom: 10px; -} - -.mb15 { - margin-bottom: 15px; -} - -.mb30 { - margin-bottom: 30px; -} - -.mb40 { - margin-bottom: 40px; -} - -.mb50 { - margin-bottom: 50px; -} - -.mb5 { - margin-bottom: 5px; -} - -.mtb10 { - margin-top: 10px; - margin-bottom: 10px; -} - -.mtb15 { - margin-top: 15px; - margin-bottom: 15px; -} - -.mtb20 { - margin-top: 20px; - margin-bottom: 20px; -} - -.mtb40 { - margin-top: 40px; - margin-bottom: 40px; -} - -.pr16 { - padding-left: 16px; -} - -.pr20 { - padding-right: 20px; -} - -.pr5 { - padding-right: 5px; -} - -.pr3 { - padding-right: 3px; -} - -.pr15 { - padding-right: 15px; -} - -.pr10 { - padding-right: 10px; -} - -.p5 { - padding: 5px; -} - -.p10 { - padding: 10px; -} - -.p15 { - padding: var(--GLOBAL_PLATE_PADDING); -} - -.pl15 { - padding-left: 15px; -} - -.p20 { - padding: 20px; -} - -.plr32 { - padding: 0 32px; -} - -.ptd1 { - padding-top: 1px; - padding-bottom: 1px; -} - -.plr30 { - padding-left: 30px; - padding-right: 30px; -} - -.plr3 { - padding-left: 3px; - padding-right: 3px; -} - -.plr40 { - padding-left: 40px; - padding-right: 40px; -} - -.plr5 { - padding-left: 5px; - padding-right: 5px; -} - -.pl0 { - padding-left: 0; -} - -.pl15 { - padding-left: 15px; -} - -.pl20 { - padding-left: 20px; -} - -.pl50 { - padding-left: 50px; -} - -.pl5 { - padding-left: 5px; -} - -.pl3 { - padding-left: 3px; -} - -.plr10 { - padding-left: 10px; - padding-right: 10px; -} - -.plr18 { - padding-left: 18px; - padding-right: 18px; -} - -.plr15 { - padding: 0 15px; -} - -.pl10 { - padding-left: 10px; -} - -.pl8 { - padding-left: 8px; -} - -.plr20 { - padding-left: 20px; - padding-right: 20px; -} - -.ptb2 { - padding-top: 2px; - padding-bottom: 2px; -} - -.ptb5 { - padding-top: 5px; - padding-bottom: 5px; -} - -.pt15 { - padding-top: 15px; -} - -.pt8 { - padding-top: 8px; -} - -.pt10 { - padding-top: 10px; -} - -.pt100 { - padding-top: 100px; -} - -.pt30 { - padding-top: 30px; -} - -.pt20 { - padding-top: 20px; -} - -.pt40 { - padding-top: 40px; -} - -.pb20 { - padding-bottom: 20px; -} - -.pb10 { - padding-bottom: 10px; -} - -.pb15 { - padding-bottom: 15px; -} - -.pb50 { - padding-bottom: 50px; -} - -.ptb10 { - padding-top: 10px; - padding-bottom: 10px; -} - -.ptb15 { - padding-top: 15px; - padding-bottom: 15px; -} - -.ptb20 { - padding-top: 20px; - padding-bottom: 20px; -} - -.btn-back { - border: 1px solid var(--BORDER); - border-radius: 3px; - background-color: #fff; - padding: 0 10px; - font-size: 12px; - display: inline-block; - text-align: center; - height: 32px; - line-height: 30px; -} -.btn-back .iconfont { - margin-right: 5px; -} -.btn-back:hover { - background-color: #fafafa; -} - -.bdn-bgn { - border: none; - background-color: unset; -} - -.vis_hid { - visibility: hidden; -} - -.tips-box { - box-shadow: var(--COMPONENT_SHADOW); - border-radius: 3px; - padding: 0 15px 15px; -} -.tips-box .tips-title { - font-weight: bold; - border-bottom: 1px solid var(--BORDER); - height: 40px; - line-height: 40px; -} -.tips-box .tips-ul { - padding: 10px 0; -} -.tips-box .tips-ul .tips-ul-title { - display: inline-block; - width: 8rem; -} -.tips-box .tips-ul > li { - height: 30px; - line-height: 30px; -} - -.group-btn-left { - border-bottom: 1px solid var(--BORDER); - border-top: 1px solid var(--BORDER); - border-left: 1px solid var(--BORDER); - border-radius: 3px 0 0 3px; -} -.group-btn-left .iconfont { - margin-right: 0 !important; -} - -.group-btn-mid { - margin-left: 0 !important; - border-bottom: 1px solid var(--BORDER); - border-top: 1px solid var(--BORDER); - border-left: 1px solid var(--BORDER); -} -.group-btn-mid .iconfont { - margin-right: 0 !important; -} - -.group-btn { - margin-left: 0 !important; - border: 1px solid var(--BORDER); - border-radius: 3px; -} - -.group-btn-right { - margin-left: 0 !important; - border: 1px solid var(--BORDER); - border-radius: 0 5px 5px 0; -} -.group-btn-right .iconfont { - margin-right: 0 !important; -} - -/* scss 集åˆ*/ -.modal-open { - top: 0; - left: 0; - overflow: hidden; -} -.modal-open .modal { - opacity: 1; -} -.modal-open .modal-dialog { - position: fixed; - width: 100%; - height: 100%; - overflow: auto; - top: 0; - min-width: 1000px; - background-color: var(--MODAL_MASK); -} -.modal-open .ng-eo-modal-header { - height: 45px; - line-height: 45px; - padding: 0 20px; - border-bottom: 1px solid #d9d9d9; -} -.modal-open .error { - background-color: #fff1f0; - border: 1px solid #d85030; -} -.modal-open .error span, -.modal-open .error i { - color: #d85030; -} -.modal-open .success { - background-color: #f2fae3; - border: 1px solid #659f13; -} -.modal-open .success span, -.modal-open .success i { - color: #659f13; -} -@-webkit-keyframes fade { - 0% { - -webkit-transform: scale(0.7); - -moz-transform: scale(0.7); - -ms-transform: scale(0.7); - transform: scale(0.7); - opacity: 0; - } - 100% { - -moz-transform: scale(1); - -ms-transform: scale(1); - transform: scale(1); - opacity: 1; - } -} -@keyframes fade { - 0% { - opacity: 0; - } - 100% { - opacity: 1; - } -} -@keyframes modalsure { - 0% { - top: -51px; - } - 100% { - top: 0px; - } -} -@-webkit-keyframes gradient { - 0% { - opacity: 0; - } - 100% { - opacity: 0.5; - } -} -@keyframes gradient { - 0% { - opacity: 0; - } - 100% { - opacity: 0.5; - } -} -.modal-open .modal-content { - height: -webkit-calc(100% - 100px); - height: -ms-calc(100% - 100px); - height: -moz-calc(100% - 100px); - height: calc(100% - 100px); -} -.modal-open .modal-content .modal_container_sm { - width: 600px; -} -.modal-open .modal-content .modal_container_md { - width: 900px; -} -.modal-open .modal-content .modal_container_lg { - width: 90% !important; -} -.modal-open .modal-content .modal-message > article { - word-break: break-all; -} -.modal-open .modal-content .modal-message p { - line-height: 30px; -} -.modal-open .modal-content .modal-sure { - width: 600px; - text-align: left; - border-radius: 3px; - -ms-animation: modalsure 0.3s; - -moz-animation: modalsure 0.3s; - -webkit-animation: modalsure 0.3s; - animation: modalsure 0.3s; - box-shadow: var(--MODAL_SHADOW); - background-color: var(--MODAL_BG); - border-radius: 3px; - z-index: 2; -} -.modal-open .modal-content .modal-project, -.modal-open .modal-content .modal-group, -.modal-open .modal-content .modal-visual-group, -.modal-open .modal-content .modal-bind, -.modal-open .modal-content .modal-message, -.modal-open .modal-content .modal-team { - width: 600px; - text-align: left; - border-radius: 3px; - -ms-animation: fade 0.3s; - -moz-animation: fade 0.3s; - -webkit-animation: fade 0.3s; - animation: fade 0.3s; - box-shadow: var(--MODAL_SHADOW); - background-color: var(--MODAL_BG); - border-radius: 3px; - z-index: 2; -} -.modal-open .modal-content .modal-tips { - position: fixed; - bottom: 20px; - right: 10px; - width: 368px; - text-align: left; - border-radius: 3px; - -ms-animation: fade 0.2s; - -moz-animation: fade 0.2s; - -webkit-animation: fade 0.2s; - animation: fade 0.2s; - box-shadow: var(--MODAL_SHADOW); - background-color: var(--BLUE_NORMAL); -} -.modal-open .modal-content .modal-tips .issue-article { - overflow: auto; - line-height: 25px; - font-size: 14px; - color: #fff; -} -.modal-open .modal-content .modal-tips img { - max-width: 100%; -} -.modal-open .modal-content .modal-tips .icon-anniu_guanbi { - font-size: 24px; -} -.modal-open .modal-content .modal-tips .modal-tips-header { - padding: 20px 20px 0 0; - color: #fff; - font-size: 14px; - text-align: right; -} -.modal-open .modal-content .modal-crop { - width: 500px; - text-align: left; - border-radius: 3px; - -ms-animation: fade 0.2s; - -moz-animation: fade 0.2s; - -webkit-animation: fade 0.2s; - animation: fade 0.2s; - box-shadow: var(--MODAL_SHADOW); - background-color: var(--MODAL_BG); -} -.modal-open .modal-content .modal-crop canvas { - vertical-align: middle; - margin: auto; -} -.modal-open .modal-content .modal-expression-builder { - -ms-animation: fade 0.2s; - -moz-animation: fade 0.2s; - -webkit-animation: fade 0.2s; - animation: fade 0.2s; - margin-top: 50px; -} -.modal-open .modal-content .modal-visual-group .common-scss-group { - margin-top: 0; - margin-left: 0; - height: 240px; - width: 560px; - border-right: 1px solid var(--BORDER); -} -.modal-open .modal-content .modal-project article .eo-input[type='text'], -.modal-open .modal-content .modal-project article .eo-input[type='password'], -.modal-open .modal-content .modal-project article textarea { - width: 100%; -} -.modal-open .modal-content .modal-project article textarea { - padding: 10px; - height: 60px; - text-indent: 0; -} -.modal-open .modal-content .modal-project .mix_height_textarea_pre { - display: block; - visibility: hidden; - padding: 10px; -} -.modal-open .modal-content .modal-project .mix_height_textarea_pre + textarea { - position: absolute; - top: 0; - left: 0; - box-sizing: border-box; - height: 100%; -} -.modal-open .modal-content .modal-project .mix_height_textarea_container { - min-height: 100px; - position: relative; -} -.modal-open .modal-content .modal-project select-person-common-component .container-div { - width: 100%; -} -.modal-open .modal-content .modal-sure article input[type='text'] { - width: 100%; - margin-top: 10px; -} -.modal-open .modal-content .modal-sure article .api-desc-textarea, -.modal-open .modal-content .modal-sure article .desc-textarea { - height: 80px; - width: 100%; -} -.modal-open .modal-content .modal-sure article .textarea-li { - position: relative; - min-height: 96px; - max-height: 266px; -} -.modal-open .modal-content .modal-sure article .textarea-li pre { - display: block; - visibility: hidden; -} -.modal-open .modal-content .modal-sure article .textarea-li .api-desc-textarea { - position: absolute; - top: 0; - left: 0; - padding: 8px; - height: 100%; - box-sizing: border-box; -} -.modal-open .modal-content .modal-sure .btn-confirm { - min-width: 56px; -} -.modal-open .modal-content .modal-sure .btn-confirm:disabled { - color: var(--MAIN_TEXT); - background-color: var(--BORDER); - border: none; -} -.modal-open .modal-content .modal-team { - width: 250px; -} -.modal-open .modal-content .modal-team article { - padding-top: 0; -} -.modal-open .modal-content .modal-team article .list-ul { - overflow: auto; - height: 400px; -} -.modal-open .modal-content .modal-team article li input { - width: 100%; - margin-bottom: 10px; -} -.modal-open .modal-content .modal-team article li .people-ul { - height: 43px; - line-height: 43px; - margin-top: 20px; -} -.modal-open .modal-content .modal-team article li .people-ul .name-summary-li { - border-radius: 23px; - width: 43px; - background-color: #fafafa; - text-align: center; - color: #999; - border: 1px solid var(--BORDER); -} -.modal-open .modal-content .modal-team article li .people-ul .people-li { - margin-left: 15px; -} -.modal-open .modal-content .modal-team article li .people-ul .people-li p { - height: 21.5px; - line-height: 21.5px; -} -.modal-open .modal-content .modal-team article li .people-ul .people-li p .icon-jingliren { - color: var(--RED_LIGHT); -} -.modal-open .modal-content .modal-team article li .people-ul .people-li .userName-p { - color: #999; -} -.modal-open .modal-content .modal-team article li .search-ul { - position: absolute; - border: 1px solid var(--BORDER); - border-radius: 3px; - padding: 0 10px; - padding-bottom: 10px; - margin-top: -1px; - width: 230px; - background-color: var(--COMPONENT_BG); - box-shadow: var(--COMPONENT_SHADOW); - cursor: pointer; -} -.modal-open .modal-content .modal-team article li .search-ul ul, -.modal-open .modal-content .modal-team article li .search-ul li, -.modal-open .modal-content .modal-team article li .search-ul span { - cursor: pointer; -} -.modal-open .modal-content .modal-team article li .search-ul .people-ul { - margin-top: 10px; -} -.modal-open .modal-content .modal-team article li .search-ul .none-people-ul { - margin-top: 10px; -} -.modal-open .modal-content .modal-team article li .search-ul .none-people-ul li { - text-align: center; - height: 43px; - line-height: 43px; -} -.modal-open .modal-content .modal-team article li .had-invited-search-ul, -.modal-open .modal-content .modal-team article li .nothing-search-ul { - cursor: default; -} -.modal-open .modal-content .modal-team article li .had-invited-search-ul ul, -.modal-open .modal-content .modal-team article li .had-invited-search-ul li, -.modal-open .modal-content .modal-team article li .had-invited-search-ul span, -.modal-open .modal-content .modal-team article li .nothing-search-ul ul, -.modal-open .modal-content .modal-team article li .nothing-search-ul li, -.modal-open .modal-content .modal-team article li .nothing-search-ul span { - cursor: default; -} -.modal-open .modal-content .modal-team article li .had-invited-search-ul .check-status, -.modal-open .modal-content .modal-team article li .nothing-search-ul .check-status { - color: #999; -} -.modal-open .modal-content .modal-group article .group-ul select, -.modal-open .modal-content .modal-group article .group-ul input { - width: 100%; -} -.modal-open .modal-content .modal-bind article select-default-common-component .container-div { - width: 100%; -} - -.modal-info-display { - justify-content: center; - display: flex !important; - flex-direction: row; - width: 100%; -} -.modal-info-display .modal-dialog { - min-width: 145px; - max-width: 368px; - -ms-animation: sticky-up 0.3s; - -moz-animation: sticky-up 0.3s; - -webkit-animation: sticky-up 0.3s; - animation: sticky-up 0.3s; - border-radius: 3px; - height: auto; - box-shadow: var(--MODAL_SHADOW); - top: 0; - margin: 75px auto auto; - z-index: 10000 !important; -} -.modal-info-display .btd_info_modal { - border-top: 1px solid var(--BORDER); -} -.modal-info-display .modal-info header { - min-height: 35px; - padding: 0 10px; -} -.modal-info-display .modal-info p { - padding: 10px 10px; - line-height: 1.75em; -} -.modal-info-display .modal-info p .iconfont { - font-size: 18px; - margin-right: 10px; -} - -.no_modal_mask .modal-dialog { - background: none; -} - -.modal_mask_enable_to_close .modal-content { - margin: auto; -} - -.eo_theme_modal_mask { - position: fixed; - width: -webkit-calc(100% - 12px); - width: -ms-calc(100% - 12px); - width: -moz-calc(100% - 12px); - width: calc(100% - 12px); - height: 100%; - top: 0; - left: 0; - z-index: -1; - -ms-animation: fade 0.7s; - -moz-animation: fade 0.7s; - -webkit-animation: fade 0.7s; - animation: fade 0.7s; -} - -.eo-modal { - position: relative; - margin: 51px auto 20px auto; - border-radius: 3px; - z-index: 1; -} -.eo-modal select-multistage-common-component .container-div { - width: 100%; -} - -.common-modal { - width: 600px; - text-align: left; - border-radius: 3px; - -ms-animation: fade 0.2s; - -moz-animation: fade 0.2s; - -webkit-animation: fade 0.2s; - animation: fade 0.2s; - box-shadow: var(--MODAL_SHADOW); - background-color: var(--MODAL_BG); -} - -ng-eo-modal .modal-dialog { - position: fixed; - width: 100%; - height: 100%; - overflow: auto; - top: 0; - min-width: 1000px; - z-index: 11; - background-color: var(--MODAL_MASK); -} -ng-eo-modal .tfoot_am { - top: 51px; - background-color: #e5e5e5; - height: calc(100% - 81px); -} -ng-eo-modal .modal-dialog-hidden { - opacity: 0; -} -ng-eo-modal .modal-dialog-hidden { - opacity: 0; -} -ng-eo-modal .modal-container { - position: fixed; - top: 11px; - right: 10px; - min-width: 700px; - max-width: 1000px; - width: 45%; - height: calc(100vh - 25px); - background-color: var(--MODAL_BG); - box-shadow: var(--MODAL_SHADOW); - border-radius: 3px; - z-index: 999; -} -ng-eo-modal .modal-container .m-header { - border-bottom: 1px solid var(--BORDER); - padding: 20px; -} -ng-eo-modal .modal-container .m-header .fwb { - font-size: 16px; - color: var(--MAIN_TEXT); -} -ng-eo-modal .modal-container .ng-product-power-member .m-content { - padding: 0; -} -ng-eo-modal .modal-container .m-content { - padding: 20px; - overflow: auto; - flex-grow: 1; -} -ng-eo-modal .modal-container .m-controller { - height: 100%; -} -ng-eo-modal .modal-container .m-default { - display: flex; - flex-direction: column; - height: 100%; -} -ng-eo-modal .modal-container .ng-space-theme { - max-width: 1000px; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .mode-title { - margin: 10px 0; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .mode-content .mode-card { - display: flex; - flex-wrap: wrap; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .mode-content .mode-card .card-wrap { - margin-right: 10px; - margin-bottom: 10px; - width: 200px; - border-radius: var(--DEFAULT_BORDER_RADIUS); - border: 1px solid var(--BORDER); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .mode-content .mode-card .card-wrap .card-container { - height: 92px; - border-bottom: 1px solid var(--BORDER); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .mode-content .mode-card .card-wrap .card-footer { - display: flex; - justify-content: space-between; - align-items: center; - padding: 6px; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .mode-content .mode-text { - display: flex; - flex-wrap: wrap; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .mode-content .mode-text .text-wrap { - margin-right: 10px; - margin-bottom: 10px; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .nav_btn_cc { - border-radius: 3px; - height: 20px; - width: 20px; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .sidebar_cc { - border-right: 1px solid; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .item_scc { - height: 11px; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .item_scc span { - height: 5px; - border-radius: 3px; - margin-left: 5px; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .input_cc { - width: 30%; - height: 20px; - border-radius: 10px; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .nav_cc { - border-bottom: 1px solid; - height: 30px; - min-height: 30px; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .classic_forest_cc { - background-color: #fff; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .classic_forest_cc .nav_cc { - background-color: #004132; - border-bottom-color: #004132; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .classic_forest_cc .input_cc { - background-color: #fff; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .classic_forest_cc .nav_btn_cc { - background-color: rgba(255, 255, 255, 0.25); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .classic_forest_cc .item_scc span { - background-color: rgba(0, 0, 0, 0.8); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .classic_forest_cc .active_item_scc { - background-color: #00785a; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .classic_forest_cc .active_item_scc span { - background-color: rgba(255, 255, 255, 0.8); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .classic_forest_cc .sidebar_cc { - background-color: #fafafa; - border-right-color: rgba(0, 0, 0, 0.15); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .classic_sunrise_cc { - background-color: #fff; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .classic_sunrise_cc .nav_cc { - background-color: #563725; - border-bottom-color: #563725; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .classic_sunrise_cc .input_cc { - background-color: #fff; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .classic_sunrise_cc .nav_btn_cc { - background-color: rgba(255, 255, 255, 0.25); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .classic_sunrise_cc .item_scc span { - background-color: rgba(255, 255, 255, 0.8); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .classic_sunrise_cc .active_item_scc { - background-color: #f57023; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .classic_sunrise_cc .active_item_scc span { - background-color: rgba(255, 255, 255, 0.8); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .classic_sunrise_cc .sidebar_cc { - background-color: #f8f8fa; - border-right-color: rgba(0, 0, 0, 0.15); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .classic_toy_cc { - background-color: #fff; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .classic_toy_cc .nav_cc { - background-color: #1f57e7; - border-bottom-color: #1f57e7; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .classic_toy_cc .input_cc { - background-color: #fff; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .classic_toy_cc .nav_btn_cc { - background-color: rgba(255, 255, 255, 0.25); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .classic_toy_cc .item_scc span { - background-color: rgba(0, 0, 0, 0.8); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .classic_toy_cc .active_item_scc { - background-color: #ffc806; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .classic_toy_cc .active_item_scc span { - background-color: rgba(255, 255, 255, 0.8); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .classic_toy_cc .sidebar_cc { - background-color: #fafafa; - border-right-color: rgba(0, 0, 0, 0.15); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_cloud_cc { - background-color: #fff; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_cloud_cc .nav_cc { - background-color: #f8f8fa; - border-bottom-color: #bbb; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_cloud_cc .input_cc { - background-color: #fff; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_cloud_cc .nav_btn_cc { - background-color: rgba(0, 0, 0, 0.1); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_cloud_cc .item_scc span { - background-color: #fff; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_cloud_cc .active_item_scc { - background-color: #2d9ee0; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_cloud_cc .active_item_scc span { - background-color: #fff; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_cloud_cc .sidebar_cc { - background-color: #f8f8fa; - border-right-color: rgba(0, 0, 0, 0.15); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_sunrise_cc { - background-color: #fff; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_sunrise_cc .nav_cc { - background-color: #f8f8fa; - border-bottom-color: #d9d9d9; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_sunrise_cc .input_cc { - background-color: #fff; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_sunrise_cc .nav_btn_cc { - background-color: rgba(0, 0, 0, 0.1); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_sunrise_cc .item_scc span { - background-color: rgba(255, 255, 255, 0.8); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_sunrise_cc .active_item_scc { - background-color: #f57023; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_sunrise_cc .active_item_scc span { - background-color: rgba(255, 255, 255, 0.8); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_sunrise_cc .sidebar_cc { - background-color: #f8f8fa; - border-right-color: rgba(0, 0, 0, 0.15); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_forest_cc { - background-color: #fff; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_forest_cc .nav_cc { - background-color: #f8f8fa; - border-bottom-color: #d9d9d9; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_forest_cc .input_cc { - background-color: #fff; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_forest_cc .nav_btn_cc { - background-color: rgba(0, 0, 0, 0.1); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_forest_cc .item_scc span { - background-color: rgba(0, 0, 0, 0.8); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_forest_cc .active_item_scc { - background-color: #00785a; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_forest_cc .active_item_scc span { - background-color: rgba(255, 255, 255, 0.8); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_forest_cc .sidebar_cc { - background-color: #f8f8fa; - border-right-color: rgba(0, 0, 0, 0.15); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_purple_cc { - background-color: #fff; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_purple_cc .nav_cc { - background-color: #4a154b; - border-bottom-color: #bbb; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_purple_cc .input_cc { - background-color: #fff; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_purple_cc .nav_btn_cc { - background-color: rgba(255, 255, 255, 0.25); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_purple_cc .item_scc span { - background-color: #fff; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_purple_cc .active_item_scc { - background-color: #4a154b; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_purple_cc .active_item_scc span { - background-color: #fff; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .clean_purple_cc .sidebar_cc { - background-color: #fbfaf7; - border-right-color: rgba(0, 0, 0, 0.15); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_cmd_cc { - background-color: #1e1e1e; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_cmd_cc .nav_cc { - background-color: #1a2b23; - border-bottom-color: #3c3c3c; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_cmd_cc .input_cc { - background-color: rgba(255, 255, 255, 0.2); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_cmd_cc .nav_btn_cc { - background-color: rgba(255, 255, 255, 0.25); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_cmd_cc .item_scc span { - background-color: rgba(255, 255, 255, 0.8); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_cmd_cc .active_item_scc { - background-color: #4ee077; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_cmd_cc .active_item_scc span { - background-color: #1a1d21; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_cmd_cc .sidebar_cc { - background-color: #1a1d21; - border-right-color: rgba(0, 0, 0, 0.15); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_toy_cc { - background-color: #1a1d21; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_toy_cc .nav_cc { - background-color: #1f57e7; - border-bottom-color: #bbb; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_toy_cc .input_cc { - background-color: rgba(255, 255, 255, 0.2); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_toy_cc .nav_btn_cc { - background-color: rgba(255, 255, 255, 0.1); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_toy_cc .item_scc span { - background-color: #000; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_toy_cc .active_item_scc { - background-color: #ffc806; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_toy_cc .active_item_scc span { - background-color: #000; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_toy_cc .sidebar_cc { - background-color: #f8f8fa; - border-right-color: rgba(0, 0, 0, 0.15); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_forest_cc { - background-color: #152a2d; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_forest_cc .nav_cc { - background-color: #152a2d; - border-bottom-color: #bbb; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_forest_cc .input_cc { - background-color: rgba(255, 255, 255, 0.2); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_forest_cc .nav_btn_cc { - background-color: rgba(255, 255, 255, 0.25); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_forest_cc .item_scc span { - background-color: rgba(255, 255, 255, 0.8); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_forest_cc .active_item_scc { - background-color: #eba270; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_forest_cc .active_item_scc span { - background-color: rgba(255, 255, 255, 0.8); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_forest_cc .sidebar_cc { - background-color: #323232; - border-right-color: rgba(0, 0, 0, 0.15); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_dusk_cc { - background-color: #744f4d; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_dusk_cc .nav_cc { - background-color: #461412; - border-bottom-color: #461412; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_dusk_cc .input_cc { - background-color: rgba(255, 255, 255, 0.2); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_dusk_cc .nav_btn_cc { - background-color: rgba(255, 255, 255, 0.1); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_dusk_cc .item_scc span { - background-color: rgba(255, 255, 255, 0.8); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_dusk_cc .active_item_scc { - background-color: #6a1b1b; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_dusk_cc .active_item_scc span { - background-color: rgba(255, 255, 255, 0.8); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_dusk_cc .sidebar_cc { - background-color: #150404; - border-right-color: rgba(0, 0, 0, 0.15); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_black_cc { - background-color: #1e1e1e; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_black_cc .nav_cc { - background-color: #3c3c3c; - border-bottom-color: #3c3c3c; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_black_cc .input_cc { - background-color: rgba(255, 255, 255, 0.2); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_black_cc .nav_btn_cc { - background-color: rgba(255, 255, 255, 0.25); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_black_cc .item_scc span { - background-color: rgba(255, 255, 255, 0.8); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_black_cc .active_item_scc { - background-color: #00785a; -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_black_cc .active_item_scc span { - background-color: rgba(255, 255, 255, 0.8); -} -ng-eo-modal .modal-container .ng-space-theme .m-mode .night_black_cc .sidebar_cc { - background-color: #323232; - border-right-color: rgba(255, 255, 255, 0.15); -} -ng-eo-modal .modal-container .ng-product-power-member { - max-width: 1000px; -} -ng-eo-modal .modal-container .ng-product-power-member .product-select-wrap select-default-common-component .list-container-div { - box-shadow: none; - bottom: 35px; -} -ng-eo-modal .modal-container .ng-product-power-member .search_patfpm { - width: 100%; - background-color: var(--SEC_BG); - border-bottom: 1px solid var(--BORDER); -} -ng-eo-modal .modal-container .ng-product-power-member .search_patfpm input { - margin: 0 10px; - width: calc(100% - 10 * 2px); - text-indent: 28px; -} -ng-eo-modal .modal-container .ng-product-power-member .search_patfpm .iconfont { - position: absolute; - margin-top: 8px; - margin-left: 15px; -} -ng-eo-modal .modal-container .ng-product-power-member .tip_patfpm { - color: var(--YELLOW_TAG_TEXT); - background-color: var(--YELLOW_TAG_BG); - font-size: 12px; - padding: 20px; -} -ng-eo-modal .modal-container .ng-product-power-member .product-select-wrap { - display: flex; - align-items: center; - background-color: var(--SEC_BG); - padding: 15px 15px; - border-top: 1px solid var(--BORDER); -} -ng-eo-modal .modal-container .ng-product-power-member .product-select-wrap > span { - white-space: nowrap; -} -ng-eo-modal .modal-container .ng-product-power-member .product-select-wrap .product-select { - width: 400px; -} -ng-eo-modal .modal-container .ng-product-power-group { - max-width: 1000px; -} -ng-eo-modal .modal-container .ng-product-power-group .m-form-title { - margin-bottom: 8px; - font-weight: bold; -} -ng-eo-modal .modal-container .ng-product-power-group .container-div { - padding-bottom: 10px; -} -ng-eo-modal .modal-container .ng-product-power-group .group-ul input[type='text'] { - width: 100%; -} -ng-eo-modal .modal-container .ng-product-power-group .group-ul select-default-common-component .container-div { - width: -webkit-calc(100% - 2px); - width: -ms-calc(100% - 2px); - width: -moz-calc(100% - 2px); - width: calc(100% - 2px); -} -ng-eo-modal .modal-container .ng-product-power-group .td-tbd, -ng-eo-modal .modal-container .ng-product-power-group .thead-div > div { - padding-right: 0; - padding-left: 0; -} -ng-eo-modal .modal-container .ng-product-power-group .td-tbd:nth-child(n + 2), -ng-eo-modal .modal-container .ng-product-power-group .thead-div > div:nth-child(n + 2) { - border-left: 1px solid var(--DIVIDER); -} -ng-eo-modal .modal-container .ng-product-power-group .checkbox-p { - line-height: 55px; -} -ng-eo-modal .modal-container .ng-product-power-group .checkbox-p:nth-child(n + 2) { - border-top: 1px solid var(--DIVIDER); -} -ng-eo-modal .modal-container-hidden { - transform: translateX(calc(100% + 10px)); -} -ng-eo-modal .default_modal_container { - transition: transform 0.3s; -} -ng-eo-modal .fade_modal_container { - transition: opacity 0.3s ease; -} -ng-eo-modal .bottom_modal_container_hidden { - opacity: 0; - z-index: -1; -} - -.space_theme_modal_container { - width: 475px !important; - min-width: auto !important; -} - -.checkbox-btn { - text-align: center; - border-radius: 3px; - border: 1px solid #bcdffb; - background-color: #e3f7ff; - color: var(--BLUE_NORMAL); - padding: 0 5px; - height: 30px; - line-height: 30px; - font-size: 12px; -} -.checkbox-btn .eo-checkbox { - margin: 6px 5px 0 0; - height: 15px; - line-height: 15px; - width: 15px; - border-color: var(--BLUE_NORMAL); -} - -.list_div_beside_group { - position: relative; - flex: 1; - overflow-y: auto; - background-color: var(--MAIN_BG); -} - -.input-icon-span { - position: absolute; - display: inline-block; - line-height: 38px; - margin: 1px; - text-indent: 15px; -} - -.display-container-div { - display: table; - background-color: #f7f8fc; - position: absolute; - width: 100%; - top: 0; - left: 0; - height: 100%; - z-index: -1; -} - -.menu-divide-span { - line-height: 34px; - margin-top: -4px; - float: left; - color: #999; - font-weight: lighter; -} - -.scroll_bar_container { - background-color: var(--GREEN_NORMAL); - padding: 2px; - height: 10px; - border-radius: 6px; - width: 80px; -} - -.scroll_bar { - background-color: #61d0b3; - width: 40px; - height: 100%; - border-radius: 3px; - display: block; -} - -ace-editor-component { - display: inline-block; - position: relative; - max-width: 100%; - width: 100%; - z-index: 1; -} -ace-editor-component .ace_scrollbar { - z-index: 1; -} -ace-editor-component .container_menu_bar_aeac { - height: 40px; -} -ace-editor-component .btn_item_aeac:disabled { - cursor: not-allowed; - color: #999; -} - -arrange-format-component .ace_container_afc { - display: flex; -} - -auto-complete-component { - position: relative; - width: 100%; -} -auto-complete-component .iconfont { - position: absolute; - right: 5px; - top: 10px; -} -auto-complete-component .eo-input { - width: 100%; -} -auto-complete-component .active_item_acac { - background-color: var(--TABLE_ROW_HOVER_BG); -} -auto-complete-component .container_acac { - display: inline-block; - width: 100%; -} -auto-complete-component .list_container_acac { - position: absolute; - z-index: 1; - height: 100px; - background-color: var(--COMPONENT_BG); - border: 1px solid var(--BORDER); - overflow-y: scroll; - line-height: 20px; - text-indent: 10px; - font-size: 12px; - margin-top: 1px; - width: 100%; - min-width: 100px; -} -auto-complete-component .item_acac:hover { - background-color: var(--TABLE_ROW_HOVER_BG); -} -auto-complete-component input[type=text]:disabled + .icon-chevron-down { - display: none; -} - -ipc-core-component .desc_icc { - white-space: pre-wrap; - word-break: break-word; -} -ipc-core-component .container_ugc { - position: fixed; - width: 100%; - z-index: 10000; -} -ipc-core-component .modal_container_ugc { - margin: 150px auto 0 auto; - box-shadow: var(--MODAL_SHADOW); - width: 540px; - background-color: var(--MODAL_BG); - border-radius: 3px; -} -ipc-core-component .bar_container_ugc { - background-color: #eaeaea; - height: 30px; - border-radius: 5px; - margin: auto; - overflow: hidden; -} -ipc-core-component .bar_ugc { - height: 100%; - width: 100px; - background: #3aa3ff; - transition: 0.5s ease; -} -ipc-core-component .mask_ugc { - position: fixed; - z-index: -1; - width: 100%; - height: 100%; - top: 0; - left: 0; - background-color: rgba(0, 0, 0, 0.15); -} - -multi-tab-component { - color: var(--MAIN_TEXT); - background-color: var(--MAIN_BG); - display: block; -} - -.list_mtc { - border-bottom: 1px solid var(--BORDER); -} - -.item_mtc { - padding: 0 10px; - height: 30px; - line-height: 30px; - position: relative; - cursor: pointer; - margin-right: 5px; - box-sizing: border-box; -} - -.active_item_mtc { - color: var(--MAIN_THEME_COLOR); - border-bottom: 2px solid var(--MAIN_THEME_COLOR); -} - -.hide_bottom_border_line_mtc { - position: absolute; - width: 100%; - bottom: -1px; - left: 0; -} - -.uib-datepicker { - border: 1px solid var(--BORDER); - border-radius: 3px; - background-color: var(--MAIN_BG); - vertical-align: text-top; - width: 250px; -} -.uib-datepicker table { - width: 100%; -} -.uib-datepicker table tr:nth-child(2) { - color: var(--MAIN_TEXT); -} -.uib-datepicker .uib-day, -.uib-datepicker .dp_week_day { - text-align: center; - line-height: initial; -} -.uib-datepicker .uib-left, -.uib-datepicker .uib-right, -.uib-datepicker .uib-title { - height: 40px; - text-align: center; - width: 100%; -} -.uib-datepicker .uib-left, -.uib-datepicker .uib-right { - font-size: 16px; -} -.uib-datepicker .dp_btn_default { - width: 100%; - padding-top: calc(50% - 0.5rem); - padding-bottom: calc(50% - 0.5rem); - border-radius: 50%; -} -.uib-datepicker .dp_btn_default:disabled { - opacity: 0.5; - color: #9E9E9E !important; - cursor: not-allowed; -} -.uib-datepicker .dp_btn_default:hover { - background-color: #29b6f6; - color: #fff; -} -.uib-datepicker .dp_btn_default:disabled { - opacity: 0.5; - cursor: not-allowed; -} -.uib-datepicker .dp_btn_default:disabled:hover { - background-color: initial; -} -.uib-datepicker .dp_btn_current { - color: var(--BLUE_NORMAL); - font-weight: bold; -} -.uib-datepicker .dp_day_selected { - background-color: #4fc3f7; - color: var(--BTN_TEXT); -} -.uib-datepicker .dp_day_selected:disabled { - color: #e0e0e0 !important; - background-color: #4fc3f7 !important; - border-color: var(--BORDER) !important; -} -.uib-datepicker .dp_range_start, -.uib-datepicker .dp_range_end { - background-color: var(--BLUE_NORMAL); -} -.uib-datepicker .dp_range_start:active, -.uib-datepicker .dp_range_end:active { - background-color: #137cdd; -} -.uib-datepicker .uib-day-fade { - color: #9E9E9E; -} - -.datepicker_time_directive { - position: absolute; - z-index: 1; - background-color: var(--COMPONENT_BG); - margin: 10px 0 0 10px; - box-shadow: var(--COMPONENT_SHADOW); - border: 1px solid var(--BORDER); - color: var(--MAIN_TEXT); -} -.datepicker_time_directive .uib-datepicker { - margin: 20px; -} -.datepicker_time_directive .time_desc { - color: var(--MAIN_TEXT); -} -.datepicker_time_directive .datepicker_footer { - padding: 15px 20px; - border-top: 1px solid var(--BORDER); - display: flex; - flex-direction: row; - background-color: var(--COMPONENT_BG); - border-radius: 0 0 4px 4px; -} - -.expression-builder-directive { - height: 100%; -} -.expression-builder-directive .eo-modal-article { - padding: 0; -} -.expression-builder-directive .expression-builder-view { - min-width: 1141px; - width: 80%; - margin: auto; - position: relative; -} -.expression-builder-directive .expression-builder-view .first-level-ul { - overflow: hidden; -} -.expression-builder-directive .expression-builder-view .first-level-ul .first-level-li .title-p { - height: 40px; - line-height: 40px; -} -.expression-builder-directive .expression-builder-view .auto-view-div { - display: grid; - overflow: auto; -} -.expression-builder-directive .expression-builder-view .auto-view-div .method-ul .first-level-li { - height: calc(80vh - 140px); - border-left: 1px solid var(--BORDER); - width: -webkit-calc(33% - 0.07em); - width: -ms-calc(33% - 0.07em); - width: -moz-calc(33% - 0.07em); - width: calc(33% - 0.07em); -} -.expression-builder-directive .expression-builder-view .auto-view-div .method-ul .first-level-li:last-child { - width: -webkit-calc(34% - 0.07em); - width: -ms-calc(34% - 0.07em); - width: -moz-calc(34% - 0.07em); - width: calc(34% - 0.07em); -} -.expression-builder-directive .expression-builder-view .auto-view-div .method-ul .first-level-li:first-child { - border-left: none; -} -.expression-builder-directive .expression-builder-view .auto-view-div .method-ul .first-level-li .title-p { - border-bottom: 1px solid var(--BORDER); - background-color: var(--TABLE_HEADER_BG_HOVER); - padding-left: 20px; -} -.expression-builder-directive .expression-builder-view .auto-view-div .method-ul .first-level-li .second-level-ul { - overflow: auto; - height: -webkit-calc(100% - 50px); - height: -ms-calc(100% - 50px); - height: -moz-calc(100% - 50px); - height: calc(100% - 50px); -} -.expression-builder-directive .expression-builder-view .auto-view-div .method-ul .first-level-li .second-level-ul a:last-child li { - border-bottom: none; -} -.expression-builder-directive .expression-builder-view .auto-view-div .method-ul .first-level-li .second-level-ul a li { - line-height: 30px; - padding: 5px 20px; - border-bottom: 1px solid var(--BORDER); - font-size: 13px; -} -.expression-builder-directive .expression-builder-view .auto-view-div .method-ul .first-level-li .second-level-ul a li:hover { - background-color: var(--TABLE_HEADER_BG_HOVER); - color: var(--MAIN_TEXT); -} -.expression-builder-directive .expression-builder-view .auto-view-div .method-ul .first-level-li .second-level-ul a li .tips-span { - color: #999; - font-size: 12px; -} -.expression-builder-directive .expression-builder-view .auto-view-div .method-ul .first-level-li .second-level-ul a li .f_js_ac > span { - width: 78px; - text-indent: 15px; - float: left; -} -.expression-builder-directive .expression-builder-view .auto-view-div .method-ul .first-level-li .second-level-ul a li .f_js_ac + .f_js_ac { - margin-top: 10px; -} -.expression-builder-directive .expression-builder-view .auto-view-div .method-ul .first-level-li .second-level-ul a .btn-and-input-p input[type=text] { - width: -webkit-calc(100% - 135px); - width: -ms-calc(100% - 135px); - width: -moz-calc(100% - 135px); - width: calc(100% - 135px); - cursor: default; -} -.expression-builder-directive .expression-builder-view .auto-view-div .method-ul .first-level-li .second-level-ul a .random-li input[type=text] { - width: 100px; -} -.expression-builder-directive .expression-builder-view .auto-view-div .method-ul .first-level-li .second-level-ul a .active-li { - background-color: var(--BLUE_NORMAL); - color: #fff; -} -.expression-builder-directive .expression-builder-view .auto-view-div .method-ul .first-level-li .second-level-ul a .active-li .tips-span { - color: #fff; -} -.expression-builder-directive .expression-builder-view .auto-view-div .method-ul .first-level-li .second-level-ul a .active-li:hover { - background-color: var(--BLUE_NORMAL); - color: #fff; -} -.expression-builder-directive .expression-builder-view .auto-view-div .method-ul .only-li, -.expression-builder-directive .expression-builder-view .auto-view-div .method-ul .only-two-li { - border-right: 1px solid var(--BORDER); -} -.expression-builder-directive .expression-builder-view .auto-view-div .expression-ul { - border-top: 1px solid var(--BORDER); - overflow: auto; -} -.expression-builder-directive .expression-builder-view .auto-view-div .expression-ul .item-a { - font-size: 12px; - padding: 0 10px; - margin-right: 10px; - display: inline-block; - height: 28px; - line-height: 26px; -} -.expression-builder-directive .expression-builder-view .auto-view-div .expression-ul .item-a .iconfont { - font-size: 12px; - margin-left: 5px; - color: var(--RED_NORMAL); -} -.expression-builder-directive .expression-builder-view .auto-view-div .expression-ul .item-a .iconfont:hover { - color: var(--RED_DEEP); -} -.expression-builder-directive .expression-builder-view .auto-view-div .expression-ul .eo_theme_btn_info .item-detail { - color: #fff; -} -.expression-builder-directive .expression-builder-view .auto-view-div .expression-ul .first-level-li .title-p { - height: inherit; - padding-left: 20px; -} -.expression-builder-directive .expression-builder-view .auto-view-div .expression-ul .first-level-li .title-p .filter-span { - width: -webkit-calc(100% - 70px); - width: -ms-calc(100% - 70px); - width: -moz-calc(100% - 70px); - width: calc(100% - 70px); -} -.expression-builder-directive .expression-builder-view .preview-ul { - height: 40px; - background-color: var(--TABLE_HEADER_BG_HOVER); - border-top: 1px solid var(--BORDER); -} -.expression-builder-directive .expression-builder-view .preview-ul .first-level-li .title-p { - padding-left: 20px; -} -.expression-builder-directive .expression-builder-view .preview-ul .first-level-li .title-p .result-input { - margin-left: 20px; - line-height: 25px; - display: inline-block; - vertical-align: middle; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - width: -webkit-calc(100% - 75px); - width: -ms-calc(100% - 75px); - width: -moz-calc(100% - 75px); - width: calc(100% - 75px); -} -.expression-builder-directive .bind-expression-builder-view .preview-ul { - display: none; -} - -.apimanagement_scss_api_list table .star-like { - color: #f48932; -} -.apimanagement_scss_api_list table .star-unlike { - color: #ccc; - display: none; -} -.apimanagement_scss_api_list table .icon-circle { - font-size: 12px; - margin-right: 5px; -} -.apimanagement_scss_api_list table tbody tr .name-box { - width: calc(100% - 63px); -} -.apimanagement_scss_api_list table tbody tr .url-box { - width: calc(100% - 55px); -} -.apimanagement_scss_api_list table tbody tr .w_100percent { - width: 100%; -} -.apimanagement_scss_api_list table tbody tr .url-box, -.apimanagement_scss_api_list table tbody tr .name-box { - text-indent: 0px; - vertical-align: middle; - display: inline-block; -} -.apimanagement_scss_api_list table tbody tr .url-box .api-url, -.apimanagement_scss_api_list table tbody tr .url-box .api-name, -.apimanagement_scss_api_list table tbody tr .name-box .api-url, -.apimanagement_scss_api_list table tbody tr .name-box .api-name { - max-width: 100%; - text-indent: 0; - overflow: hidden; - vertical-align: middle; - display: inline-block; -} -.apimanagement_scss_api_list table tbody tr .url-box .api-name, -.apimanagement_scss_api_list table tbody tr .name-box .api-name { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - line-height: 40px; -} -.apimanagement_scss_api_list table tbody tr .url-box .api-url, -.apimanagement_scss_api_list table tbody tr .name-box .api-url { - display: inline-block; -} -.apimanagement_scss_api_list table tbody tr .url-box .api-url-text, -.apimanagement_scss_api_list table tbody tr .name-box .api-url-text { - margin: 10px 0; - max-height: 38px; - line-height: 20px; - display: -webkit-box; - box-sizing: border-box; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - overflow: hidden; -} -.apimanagement_scss_api_list table tbody tr .btn-hover { - height: 20px; - padding: 2px 7.5px; - margin-left: 5px; - display: none; - font-size: 12px; -} -.apimanagement_scss_api_list table tbody tr:hover .star-unlike { - display: block; -} -.apimanagement_scss_api_list table tbody tr:hover .api-url { - max-width: calc(100% - 55px); -} -.apimanagement_scss_api_list table tbody tr:hover .api-name { - max-width: calc(100% - 70.5px); -} -.apimanagement_scss_api_list table tbody tr:hover .btn-hover { - display: initial; -} -.apimanagement_scss_api_list table tbody .could-activer-tr:hover .btn-hover { - display: none; -} - -.red_circle_icon { - color: #fff; - background-color: var(--RED_NORMAL); - border-radius: 50%; - width: 14px; - height: 14px; - line-height: 14px; - font-size: 10px; - margin-left: 5px; - text-align: center; -} - -.va_tr_asad .text-td-tbd { - vertical-align: baseline; - text-align: justify; -} -.va_tr_asad .text-td-tbd.ws_normal { - padding-bottom: 8px; -} - -.apimanagement-scss-api-detail { - position: relative; - padding-bottom: 20px; -} -.apimanagement-scss-api-detail .tab_list_container_hpiad { - right: 0; -} -.apimanagement-scss-api-detail .none_container_asad { - border-radius: 3px; - background-color: var(--TABLE_HEADER_BG); -} -.apimanagement-scss-api-detail .first_level_article { - padding-top: 90px; -} -.apimanagement-scss-api-detail .first_part .tag-item { - background-color: #f1f8ff; - display: inline-flex; - padding: 0 10px; - height: 25px; - line-height: 25px; - border-radius: 3px; - margin-top: 0.35em; - color: #555; - font-size: 12px; -} -.apimanagement-scss-api-detail .first_part .tag-item:first-child { - margin-top: 10px; -} -.apimanagement-scss-api-detail .first_part .tag-item:nth-child(n + 2) { - margin-left: 10px; -} -.apimanagement-scss-api-detail .first_part .eo_popover_tip { - margin-left: -10px; - margin-top: -40px; -} -.apimanagement-scss-api-detail .first_part .triangle-bottom { - width: 0; - height: 0; - border-left: 5px solid transparent; - border-top: 6px solid #000; - border-right: 5px solid transparent; - position: absolute; - margin-top: -10px; - z-index: 3; - margin-left: 8px; - display: none; -} -.apimanagement-scss-api-detail .first_part .list_function_wrap { - position: absolute; - cursor: default; - margin-top: -5px; - display: none; - z-index: 2; - color: #555; - margin-left: 10px; -} -.apimanagement-scss-api-detail .first_part .list_function_wrap .nav-function { - width: 134px; - margin-left: -10px; - background-color: var(--COMPONENT_BG); - border: 1px solid var(--BORDER); - border-radius: 3px; - margin-top: 8px; - box-shadow: var(--COMPONENT_SHADOW); -} -.apimanagement-scss-api-detail .first_part .list_function_wrap .nav-function .strong-li { - font-weight: bold; - color: var(--GREEN_DEEP); -} -.apimanagement-scss-api-detail .first_part .list_function_wrap .nav-function .iconfont { - margin-right: 5px; -} -.apimanagement-scss-api-detail .first_part .list_function_wrap .nav-function li { - cursor: pointer; - text-align: left; - text-indent: 18px; - font-size: 12px; - height: 33px; - line-height: 33px; -} -.apimanagement-scss-api-detail .first_part .list_function_wrap .nav-function li:hover, .apimanagement-scss-api-detail .first_part .list_function_wrap .nav-function li:focus, .apimanagement-scss-api-detail .first_part .list_function_wrap .nav-function li:active { - background-color: #fafafa; -} -.apimanagement-scss-api-detail .first_part .api-status, -.apimanagement-scss-api-detail .first_part .api-starred { - margin-left: 10px; - height: 27px; - line-height: 28px; - border: none; - border-radius: 3px; - text-align: center; - margin-right: 5px; - display: inline-block; -} -.apimanagement-scss-api-detail .first_part .api-status:hover .list_function_wrap, -.apimanagement-scss-api-detail .first_part .api-starred:hover .list_function_wrap { - display: block; -} -.apimanagement-scss-api-detail .first_part .api-status:hover .triangle-bottom, -.apimanagement-scss-api-detail .first_part .api-status:hover .eo_popover_tip, -.apimanagement-scss-api-detail .first_part .api-starred:hover .triangle-bottom, -.apimanagement-scss-api-detail .first_part .api-starred:hover .eo_popover_tip { - display: initial; -} -.apimanagement-scss-api-detail .first_part .star-unlike, -.apimanagement-scss-api-detail .first_part .star-like { - font-size: 20px; - float: left; -} -.apimanagement-scss-api-detail .first_part .star-unlike { - color: #ccc; -} -.apimanagement-scss-api-detail .first_part .star-like { - color: #f18f00; -} -.apimanagement-scss-api-detail .first_part .common-style-li { - padding: 0 5px; - height: 18px; - line-height: 18px; - border-radius: 3px; - text-align: center; - font-size: 14px; - margin-right: 5px; -} -.apimanagement-scss-api-detail .first_part .api-detail { - margin-top: 10px; -} -.apimanagement-scss-api-detail .first_part .api-detail .api-url, -.apimanagement-scss-api-detail .first_part .api-detail .api-name { - word-break: break-all; - width: 100%; - line-height: 1.5em; -} -.apimanagement-scss-api-detail .first_part .api-detail .api-url { - font-size: 22px; -} -.apimanagement-scss-api-detail .first_part .api-detail .api-name { - font-size: 16px; - font-weight: bold; -} -.apimanagement-scss-api-detail .first_part .api-detail .others-li { - color: #999; - font-size: 12px; - width: 100%; - padding-top: 20px; - padding-bottom: 20px; - border-bottom: 1px solid var(--BORDER); -} -.apimanagement-scss-api-detail .first_part .api-detail .others-li span { - margin-right: 30px; -} -.apimanagement-scss-api-detail .first_part .api-detail .others-li .group-span { - max-width: 39%; - overflow: hidden; - text-overflow: ellipsis; - vertical-align: middle; - white-space: nowrap; - text-indent: 0; -} -.apimanagement-scss-api-detail .first_part .api-detail .others-li .update-span { - max-width: 19%; - vertical-align: middle; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} -.apimanagement-scss-api-detail .item_part .hover-tr .btn-hover, -.apimanagement-scss-api-detail .item_part .tr-tbd .btn-hover { - height: 20px; - padding: 0 7.5px; - margin-left: 10px; - display: none; - line-height: 22px; - font-size: 12px; -} -.apimanagement-scss-api-detail .item_part .hover-tr .param-name-span, -.apimanagement-scss-api-detail .item_part .hover-tr .param-type-span, -.apimanagement-scss-api-detail .item_part .tr-tbd .param-name-span, -.apimanagement-scss-api-detail .item_part .tr-tbd .param-type-span { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - display: inline-block; - vertical-align: middle; - max-width: 100%; - line-height: 30px; -} -.apimanagement-scss-api-detail .item_part .hover-tr:hover .param-name-span, -.apimanagement-scss-api-detail .item_part .hover-tr:hover .param-type-span, -.apimanagement-scss-api-detail .item_part .tr-tbd:hover .param-name-span, -.apimanagement-scss-api-detail .item_part .tr-tbd:hover .param-type-span { - max-width: calc(100% - 63.5px); -} -.apimanagement-scss-api-detail .item_part .hover-tr:hover .btn-hover, -.apimanagement-scss-api-detail .item_part .tr-tbd:hover .btn-hover { - display: inline-block; -} -.apimanagement-scss-api-detail .item_part > p, -.apimanagement-scss-api-detail .item_part > header { - margin-top: 25px; - margin-bottom: 15px; - border-left: 3px solid var(--GREEN_NORMAL); - font-size: 18px; -} -.apimanagement-scss-api-detail .item_part > p > span, -.apimanagement-scss-api-detail .item_part > header > span { - font-size: 14px; - text-indent: 5px; -} -.apimanagement-scss-api-detail .response-example-part .result-forward { - position: absolute; - left: calc(50% + 65px); - bottom: 67px; -} -.apimanagement-scss-api-detail .response-example-part header { - padding: 10px; - height: 30px; - line-height: 30px; -} -.apimanagement-scss-api-detail .response-example-part header .icon-mofabang { - color: var(--BLUE_NORMAL); - padding: 0; - padding-right: 5px; - font-size: 13px; -} -.apimanagement-scss-api-detail .response-example-part header .send-format { - color: var(--BLUE_NORMAL); - text-align: center; - height: 30px; - line-height: 30px; - border: 1px solid #bcdffb; - padding: 0 10px; - background-color: #e3f7ff; - border-radius: 3px; - font-size: 12px; -} -.apimanagement-scss-api-detail .response-example-part header .send-format:hover { - background-color: var(--BLUE_NORMAL); - color: #fff; -} -.apimanagement-scss-api-detail .response-example-part header .send-format:hover * { - color: #fff; -} -.apimanagement-scss-api-detail .response-example-part article { - display: table; - width: 100%; -} -.apimanagement-scss-api-detail .response-example-part article .code-span { - position: absolute; - margin: 10px 20px; - padding: 5px 10px; - border-radius: 3px; - background-color: #f5f5f5; - color: #5f7d8b; - border: 1px solid #5f7d8b; - font-size: 12px; -} -.apimanagement-scss-api-detail .response-example-part article .demo-setting-p { - margin: 15px 20px; -} -.apimanagement-scss-api-detail .response-example-part article .demo-setting-p .code-span { - position: relative; - margin: 0 5px 0 0; -} -.apimanagement-scss-api-detail .response-example-part article .copy-url-box input { - background-color: var(--INPUT_BG); - width: 100%; - padding-right: 60px; - cursor: pointer; - text-indent: 114px; - border: none; - border-bottom: 1px solid var(--BORDER); - line-height: 40px; - height: 40px; - border-radius: 0; -} -.apimanagement-scss-api-detail .response-example-part article .copy-url-box input:focus { - box-shadow: none; -} -.apimanagement-scss-api-detail .response-example-part article .copy-url-box .copy-tips { - margin-top: -35px; - padding-right: 10px; - position: relative; - font-size: 12px; - color: #999; - height: 35px; - line-height: 35px; - cursor: pointer; -} -.apimanagement-scss-api-detail .response-example-part article .copy-url-box .copy-success { - color: var(--GREEN_NORMAL); -} -.apimanagement-scss-api-detail .response-example-part article .copy-url-box .copy-error { - color: #c6533b; -} -.apimanagement-scss-api-detail .response-example-part article .back-result-content { - min-height: 130px; - max-height: 500px; - display: flex; - overflow: auto; - border: 1px solid var(--BORDER); - margin: 10px; - border-radius: 3px; - padding: 50px 10px 5px 10px; - line-height: 20px; - font-size: 12px; - max-width: 100%; - width: -webkit-calc(100% - 42px); - width: -ms-calc(100% - 42px); - width: -moz-calc(100% - 42px); - width: calc(100% - 42px); - word-break: break-all; - white-space: pre-wrap; - background-color: var(--INPUT_BG); -} -.apimanagement-scss-api-detail .note-part .common-container .markdown-body { - width: -webkit-calc(100% - 40px); - width: -ms-calc(100% - 40px); - width: -moz-calc(100% - 40px); - width: calc(100% - 40px); -} -.apimanagement-scss-api-detail .raw-article { - background-color: #fafafa; -} - -.apimanagement-scss-api-test .btn_cookie_admin_container { - z-index: 5; - position: fixed; - right: 200px; -} -.apimanagement-scss-api-test .btn_cookie_admin_container button { - line-height: 30px; - height: 30px; - font-size: 12px; -} -.apimanagement-scss-api-test .socket_report_list_container .tbody-div { - max-height: 200px; - overflow-y: scroll; -} -.apimanagement-scss-api-test .socket_report_list_container .thead_div_wrap { - overflow-y: scroll; -} -.apimanagement-scss-api-test .socket_report_text_container { - border-top: 4px solid var(--BORDER); -} -.apimanagement-scss-api-test .focus_socket_report_list_item .tr-tbd { - background-color: var(--TABLE_ROW_HOVER_BG); -} -.apimanagement-scss-api-test .disabled_get_asat .item_mtc[eo-attr-id='body'] { - color: #999; -} -.apimanagement-scss-api-test .disabled_get_asat .item_mtc[eo-attr-id='body'] .icon-circle { - display: none; -} -.apimanagement-scss-api-test .file_binary_btn_asat { - line-height: 30px; - height: 30px; - border: none; - font-size: 12px; - background-color: #2196f3; - color: #fff; - border-radius: 0 3px 3px 0; - padding: 0 10px; -} -.apimanagement-scss-api-test .file_binary_input_asat { - position: absolute; - left: 250px; - line-height: 30px; - height: 30px; - border: none; - width: 68px; - z-index: 1; - opacity: 0; - cursor: pointer; -} -.apimanagement-scss-api-test .text_binary_input_asat { - border-radius: 3px 0 0 3px; -} -.apimanagement-scss-api-test .title_rac { - padding: 0 0 10px 0; - font-weight: bold; -} -.apimanagement-scss-api-test .response_bg_rac { - max-height: 400px; - overflow-y: auto; - line-height: 20px; - border: 1px solid var(--BORDER); - padding: 15px 10px; - border-radius: 3px; - margin-bottom: 15px; -} -.apimanagement-scss-api-test .static-div { - position: absolute; - margin-top: 48px; - width: -webkit-calc(100% - 261px); - width: -ms-calc(100% - 261px); - width: -moz-calc(100% - 261px); - width: calc(100% - 261px); - padding: 10px; - background-color: var(--SEC_BG); - z-index: 3; - width: 100% !important; - top: -7px; - left: 0; - box-sizing: border-box; -} -.apimanagement-scss-api-test .download_btn_asat { - margin: auto; - display: inherit; - line-height: 100px; -} -.apimanagement-scss-api-test .test-bar-container-div { - color: #999; - padding: 40px 0; -} -.apimanagement-scss-api-test .test-bar-container-div > div { - margin: auto; - width: 430px; -} -.apimanagement-scss-api-test .test-bar-container-div .test-bar-group { - margin-top: 10px; -} -.apimanagement-scss-api-test .test-bar-container-div .test-bar-group > span { - display: inline-block; - height: 24px; - border-radius: 3px; -} -.apimanagement-scss-api-test .test-bar-container-div .test-bar-group > span:nth-child(n + 2) { - margin-left: 5px; -} -.apimanagement-scss-api-test .test-bar-container-div .test-bar-group .bar1 { - width: 245px; - border: 1px solid var(--BORDER); -} -.apimanagement-scss-api-test .test-bar-container-div .test-bar-group .bar2 { - width: 80px; - border: 1px solid var(--BORDER); - background-color: #fafafa; -} -.apimanagement-scss-api-test .test-bar-container-div .test-bar-group .bar3 { - width: 80px; - background-color: var(--GREEN_DEEP); - border: 1px solid var(--GREEN_DEEP); -} -.apimanagement-scss-api-test .first_part table { - border-spacing: 0; - width: 100%; -} -.apimanagement-scss-api-test .first_part input[type='text'] { - width: -webkit-calc(100% - 1px); - width: -ms-calc(100% - 1px); - width: -moz-calc(100% - 1px); - width: calc(100% - 1px); - height: 35px; - line-height: 35px; -} -.apimanagement-scss-api-test .first_part .method-td { - width: 100px; -} -.apimanagement-scss-api-test .first_part .method-td select-default-common-component .container-div { - width: 100%; -} -.apimanagement-scss-api-test .first_part .method-td select-default-common-component .text-p { - border-radius: 3px 0 0 3px; - height: 33px; - line-height: 35px; -} -.apimanagement-scss-api-test .first_part .eo_popover_tip { - margin-top: 5px; -} -.apimanagement-scss-api-test .first_part .triangle-bottom { - width: 0; - height: 0; - border-left: 5px solid transparent; - border-bottom: 6px solid #000; - border-right: 5px solid transparent; - position: absolute; - z-index: 3; - margin-left: 15px; - display: none; -} -.apimanagement-scss-api-test .first_part td:hover .triangle-bottom, -.apimanagement-scss-api-test .first_part td:hover .eo_popover_tip { - display: initial; -} -.apimanagement-scss-api-test .first_part .front-uri-td { - width: 80px; -} -.apimanagement-scss-api-test .first_part .front-uri-td .similar-input-span { - max-width: 240px; - display: block; - height: 33px; - line-height: 33px; - word-break: keep-all; - width: auto; - overflow: hidden; - text-overflow: ellipsis; - padding-right: 10px; - background-color: var(--TABLE_HEADER_BG); - border: 1px solid var(--BORDER); - border-right: none; - text-indent: 10px; - white-space: nowrap; -} -.apimanagement-scss-api-test .first_part .uri-td { - padding-right: 10px; -} -.apimanagement-scss-api-test .first_part .uri-td input:first-child { - border-right: none; - border-radius: 3px 0 0 3px; -} -.apimanagement-scss-api-test .first_part .uri-td input:nth-child(2) { - border-radius: 0; - border-right: none; -} -.apimanagement-scss-api-test .first_part .uri-td input:last-child { - border-radius: 0 3px 3px 0; - border-right: 1px solid var(--BORDER); - background-color: var(--INPUT_BG); -} -.apimanagement-scss-api-test .first_part .front-uri-td + .uri-td input:first-child { - border-radius: 0; -} -.apimanagement-scss-api-test .first_part .generate_code_td { - width: 51px; - padding-right: 10px; -} -.apimanagement-scss-api-test .first_part .generate_code_td button { - height: 35px; -} -.apimanagement-scss-api-test .first_part .test-td { - width: 85px; -} -.apimanagement-scss-api-test .first_part .test-td unit-test-ams-component > div { - display: flex; -} -.apimanagement-scss-api-test .first_level_article { - padding: 147px var(--GLOBAL_PLATE_PADDING) 0 var(--GLOBAL_PLATE_PADDING); -} -.apimanagement-scss-api-test .first_level_article .tips-span { - color: red; - font-size: 12px; -} -.apimanagement-scss-api-test .first_level_article .item_part header { - padding: 5px var(--GLOBAL_PLATE_PADDING) 5px var(--GLOBAL_PLATE_PADDING); - border-bottom: 1px solid var(--BORDER); -} -.apimanagement-scss-api-test .first_level_article .item_part header .body-json-type-select { - width: auto; -} -.apimanagement-scss-api-test .first_level_article .item_part header .send-format .iconfont { - font-size: 24px; - margin-right: 2px; -} -.apimanagement-scss-api-test .first_level_article .item_part header .send-format:hover { - color: var(--BLUE_NORMAL); -} -.apimanagement-scss-api-test .first_level_article .item_part header .send-format:disabled { - color: #999; - cursor: not-allowed; -} -.apimanagement-scss-api-test .first_level_article .item_part header .send-format:nth-last-child(n + 2) { - margin-right: 20px; -} -.apimanagement-scss-api-test .first_level_article .eo-static-hidden { - border: none; -} -.apimanagement-scss-api-test .first_level_article .request-param-part .eo-static-hidden { - margin-top: 0; - padding-bottom: 0; -} -.apimanagement-scss-api-test .first_level_article .code_generate_btn { - color: var(--GREEN_NORMAL); -} -.apimanagement-scss-api-test .first_level_article .code_generate_btn:hover { - color: var(--GREEN_DEEP); -} -.apimanagement-scss-api-test .first_level_article .response-example-part header .copy-opacity-btn { - overflow: hidden; - position: absolute; - margin-top: 6px; - opacity: 0; -} -.apimanagement-scss-api-test .first_level_article .response-example-part .test-header-ul li { - line-height: 30px; -} -.apimanagement-scss-api-test .first_level_article .response-example-part .test-header-ul li .test-header-key { - color: #999; -} -.apimanagement-scss-api-test .first_level_article .response-example-part .test-header-ul li .common-value-span { - word-break: break-all; -} -.apimanagement-scss-api-test .first_level_article .response-example-part .test-httpHeader-content { - width: 100%; - height: 30px; - line-height: 30px; - border-radius: 3px; - color: #fff; - text-indent: 10px; - font-size: 16px; -} -.apimanagement-scss-api-test .first_level_article .response-example-part .test-httpHeader-content span { - font-size: 12px; - color: #fff; - margin-right: 10px; -} -.apimanagement-scss-api-test .first_level_article .response-example-part .test-error { - background-color: var(--RED_NORMAL); - border: 1px solid var(--RED_NORMAL); -} -.apimanagement-scss-api-test .first_level_article .response-example-part .test-error-color { - color: var(--RED_NORMAL); -} -.apimanagement-scss-api-test .first_level_article .response-example-part .test-success { - background-color: var(--GREEN_NORMAL); - border: 1px solid var(--GREEN_DEEP); -} -.apimanagement-scss-api-test .first_level_article .response-example-part .test-success-color { - color: var(--GREEN_NORMAL); -} -.apimanagement-scss-api-test .first_level_article .response-example-part .test-warning { - background-color: var(--RED_NORMAL); - border: 1px solid var(--RED_LIGHT); -} -.apimanagement-scss-api-test .first_level_article .response-example-part .test-warning-color { - color: var(--RED_NORMAL); -} -.apimanagement-scss-api-test .first_level_article .response-example-part .test-default { - background-color: #a9a9a9; - border: 1px solid var(--BLUE_NORMAL); -} -.apimanagement-scss-api-test .first_level_article .response-example-part .test-default-color { - color: #a9a9a9; -} -.apimanagement-scss-api-test .first_level_article .response-example-part .back-result-content { - min-height: 78px; - max-height: 500px; - overflow: auto; - margin-top: 20px; - border-radius: 3px; - line-height: 20px; - font-size: 12px; - width: -webkit-calc(100% - 20px); - width: -ms-calc(100% - 20px); - width: -moz-calc(100% - 20px); - width: calc(100% - 20px); - word-break: break-all; - white-space: pre-wrap; - border: 1px solid var(--BORDER); - padding: 10px; -} -.apimanagement-scss-api-test .first_level_article .response-example-part .request-body-div { - word-break: break-all; -} -.apimanagement-scss-api-test .first_level_article .response-example-part .result-item-li span { - display: table-cell; -} -.apimanagement-scss-api-test .first_level_article .btn_static_test_utac { - z-index: 1; - opacity: 0; - width: 50px; - left: 0; -} -.apimanagement-scss-api-test .first_level_article .null-tip-box { - position: relative; - bottom: 120px; - padding: 10px; -} -.apimanagement-scss-api-test .first_level_article .test-history-part header .clear-btn { - color: var(--RED_NORMAL); - text-align: center; - height: 30px; - line-height: 30px; - border: 1px solid var(--RED_NORMAL); - width: 100px; - background-color: rgba(244, 67, 54, 0.03); - border-radius: 3px; -} -.apimanagement-scss-api-test .first_level_article .test-history-part header .clear-btn:hover { - background-color: var(--RED_DEEP); - color: #fff; -} -.apimanagement-scss-api-test .first_level_article .test-history-part .history_container_hpiat { - max-height: 255px; - overflow-y: auto; -} -.apimanagement-scss-api-test .first_level_article .test-history-part .history_container_hpiat .test-error-color { - color: var(--RED_NORMAL); -} -.apimanagement-scss-api-test .first_level_article .test-history-part .history_container_hpiat .test-success-color { - color: var(--GREEN_NORMAL); -} -.apimanagement-scss-api-test .first_level_article .test-history-part .history_container_hpiat .test-warning-color { - color: var(--RED_NORMAL); -} -.apimanagement-scss-api-test .first_level_article .test-history-part .history_container_hpiat .test-default-color { - color: #a9a9a9; -} -.apimanagement-scss-api-test .first_level_article .test-history-part .history_container_hpiat .history-type { - border-radius: 3px; - font-size: 12px; - display: inline-block; - width: 45px; - height: 18px; - line-height: 18px; - text-align: center; - margin-right: 5px; -} -.apimanagement-scss-api-test time-summary-amt-component .http_request_other_box { - border: none; - border-bottom: 1px solid var(--BORDER); -} -.apimanagement-scss-api-test time-summary-amt-component .default_scss_list { - border: none; - padding: 0 15px 15px; -} - -.shrink-div .apimanagement-scss-api-test .static-div { - width: -webkit-calc(100% - 51px); - width: -ms-calc(100% - 51px); - width: -moz-calc(100% - 51px); - width: calc(100% - 51px); -} - -.apimanagement-scss-quickTest .apimanagement-scss-api-test .static-div { - width: -webkit-calc(100% - 502px); - width: -ms-calc(100% - 502px); - width: -moz-calc(100% - 502px); - width: calc(100% - 502px); - margin-top: 46px; -} -.apimanagement-scss-quickTest .apimanagement-scss-api-test menu-common-component { - padding-left: var(--GLOBAL_PLATE_PADDING); -} -.apimanagement-scss-quickTest .tab-container-mask { - position: fixed; - background-color: var(--SEC_BG); - z-index: 2; - width: 100%; - height: 60px; -} -.apimanagement-scss-quickTest .first_level_article { - padding-top: 103px; -} - -.common-scss-group { - width: 240px; - position: relative; - z-index: 3; - height: 100%; -} -.common-scss-group .title-ul { - height: 40px; - line-height: 40px; - padding: 0 10px; - background-color: var(--MAIN_BG); - border-radius: 3px 0 0 0; - border-bottom: 1px solid var(--BORDER); -} -.common-scss-group .title-ul .common-btn { - font-size: var(--BUTTON_FONT_SIZE); - display: inline-block; - vertical-align: middle; -} -.common-scss-group .title-ul .default-btn { - border-style: solid; - border-width: 1px; - margin-left: 5px; - border-radius: 3px; -} -.common-scss-group .group-ul { - background-color: var(--MAIN_BG); - border-radius: 3px 0 0 3px; - height: -webkit-calc(100% - 41px); - height: -ms-calc(100% - 41px); - height: -moz-calc(100% - 41px); - height: calc(100% - 41px); - position: absolute; - width: 100%; - overflow-y: auto; - overflow-x: hidden; - padding: 0 10px; - box-sizing: border-box; -} -.common-scss-group .group-li { - overflow: hidden; - font-size: 12px; - height: 40px; - line-height: 40px; - cursor: pointer; -} -.common-scss-group .group-li .group-name { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - cursor: pointer; -} -.common-scss-group .group-li .active { - float: right; -} -.common-scss-group .group-li .icon-more { - display: inline-block; - padding-right: 10px; -} -.common-scss-group .group-li .group_icon { - font-size: 18px; -} -.common-scss-group .group-li .placeholder_icon { - width: 9px; -} - -.search_gdcc .group-ul { - height: -webkit-calc(100% - 81px); - height: -ms-calc(100% - 81px); - height: -moz-calc(100% - 81px); - height: calc(100% - 81px); -} - -.untop-gdcc { - height: 100%; -} -.untop-gdcc .group-ul { - height: -webkit-calc(100% - 41px); - height: -ms-calc(100% - 41px); - height: -moz-calc(100% - 41px); - height: calc(100% - 41px); - margin-top: 0; -} - -/** -* @name åˆ—è¡¨é»˜è®¤æ ·å¼ -* @author 银云信æ¯ç§‘技有é™å…¬å¸ -*/ -.common_scss_list { - display: flex; -} -.common_scss_list .count-span { - color: #999; - font-weight: initial; - font-size: 12px; -} -.common_scss_list .eo-tip-container .arrow-li { - margin-left: 16px; -} -.common_scss_list .eo-tip-container .message-li { - margin-left: -50px; -} -.common_scss_list .eo-operate-btn .eo-tip-container .message-li { - white-space: pre-line; - max-width: 120px; - min-width: 120px; -} -.common_scss_list .eo-operate-btn:hover .eo-tip-container { - visibility: visible; - margin-top: -70px; - margin-left: -8px; -} - -.default_scss_list, -.common_scss_list .first_level_article { - border-top: 1px solid var(--BORDER); -} -.default_scss_list table, -.common_scss_list .first_level_article table { - width: 100%; - border-spacing: 0; - text-align: left; - table-layout: fixed; -} -.default_scss_list thead tr, -.common_scss_list .first_level_article thead tr { - height: 40px; -} -.default_scss_list th, -.common_scss_list .first_level_article th { - overflow: hidden; -} -.default_scss_list td, -.default_scss_list th, -.common_scss_list .first_level_article td, -.common_scss_list .first_level_article th { - padding-left: 20px; -} -.default_scss_list tbody tr, -.common_scss_list .first_level_article tbody tr { - height: 43px; -} -.default_scss_list tbody tr td, -.common_scss_list .first_level_article tbody tr td { - cursor: inherit; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - border-bottom: 1px solid var(--DIVIDER); -} -.default_scss_list tbody tr .cancel-nowrap, -.common_scss_list .first_level_article tbody tr .cancel-nowrap { - white-space: initial; - overflow: initial; - text-overflow: initial; -} -.default_scss_list tbody tr .operate-td, -.common_scss_list .first_level_article tbody tr .operate-td { - overflow: visible; -} -.default_scss_list .more-function, -.common_scss_list .first_level_article .more-function { - position: absolute; - border-style: solid; - border-width: 1px; - border-radius: 3px; - right: 0px; - z-index: 2; - text-align: left; -} -.default_scss_list .more-function li, -.common_scss_list .first_level_article .more-function li { - height: 35px; - line-height: 35px; - cursor: pointer; - padding: 0 20px; -} -.default_scss_list .more-function li:hover, -.common_scss_list .first_level_article .more-function li:hover { - text-decoration: underline; -} -.default_scss_list .eo-operate-btn, -.common_scss_list .first_level_article .eo-operate-btn { - padding-left: 10px; - border-left: 1px solid var(--BORDER); -} -.default_scss_list .eo-operate-btn:first-child, -.common_scss_list .first_level_article .eo-operate-btn:first-child { - border-left: none; - padding-left: 0; -} -.default_scss_list .list_td_link, -.common_scss_list .first_level_article .list_td_link { - width: 100%; - height: 39px; - line-height: 43px; - display: inline-block; -} -.default_scss_list .none_div, -.common_scss_list .first_level_article .none_div { - color: #999; - line-height: 100px; - height: 100px; - text-align: center; -} -.default_scss_list .hover-tr, -.common_scss_list .first_level_article .hover-tr { - cursor: pointer; -} -.default_scss_list .hover-tr:hover, -.common_scss_list .first_level_article .hover-tr:hover { - background-color: var(--TABLE_ROW_HOVER_BG); -} -.default_scss_list .unhover-tr, -.common_scss_list .first_level_article .unhover-tr { - cursor: default; -} -.default_scss_list .unhover-tr .list_td_link, -.common_scss_list .first_level_article .unhover-tr .list_td_link { - cursor: default; -} - -.common_member_list .eo-component-admin-list { - width: auto; - padding: 0 20px; -} -.common_member_list .logo_eouiat { - width: 31px; - height: 31px; - background-color: #e5e5e5; - border-radius: var(--DEFAULT_BORDER_RADIUS); - border: 1px solid var(--BORDER); - background-size: contain; -} -.common_member_list .common_scss_list .first_level_article .eo-operate-btn { - border: 1px solid var(--BORDER); - border-right: 0; - padding: 0 3px; - margin-right: 0; -} -.common_member_list .common_scss_list .first_level_article .eo-operate-btn .iconfont { - padding-right: 0px; -} -.common_member_list .common_scss_list .first_level_article .eo-operate-btn:first-child { - padding-left: 3px; - border-left: 1px solid var(--BORDER); - border-radius: 3px 0 0 3px; -} -.common_member_list .common_scss_list .first_level_article .eo-operate-btn:last-child { - border-right: 1px solid var(--BORDER); - border-radius: 0 3px 3px 0; -} -.common_member_list .common_scss_list .first_level_article tbody tr { - height: 50px; -} - -old-register-default, -register-default, -login, -forget, -perfect-user-info-component, -third-party-step { - background-color: #fff; -} -old-register-default .lang, -register-default .lang, -login .lang, -forget .lang, -perfect-user-info-component .lang, -third-party-step .lang { - position: fixed; - display: flex; - top: 20px; - right: 20px; - justify-content: center; - align-items: center; - border: 1px solid rgba(0, 0, 0, 0.15); - background-color: #fff; - border-radius: 3px; - padding-left: 5px; -} -old-register-default .lang .lang-select, -register-default .lang .lang-select, -login .lang .lang-select, -forget .lang .lang-select, -perfect-user-info-component .lang .lang-select, -third-party-step .lang .lang-select { - width: 90px; -} -old-register-default .lang .text-p, -old-register-default .lang .input-text, -register-default .lang .text-p, -register-default .lang .input-text, -login .lang .text-p, -login .lang .input-text, -forget .lang .text-p, -forget .lang .input-text, -perfect-user-info-component .lang .text-p, -perfect-user-info-component .lang .input-text, -third-party-step .lang .text-p, -third-party-step .lang .input-text { - border: none; -} -old-register-default .lang .arrow-span, -register-default .lang .arrow-span, -login .lang .arrow-span, -forget .lang .arrow-span, -perfect-user-info-component .lang .arrow-span, -third-party-step .lang .arrow-span { - top: -1px; -} -old-register-default .lang select-default-common-component .text-p, -register-default .lang select-default-common-component .text-p, -login .lang select-default-common-component .text-p, -forget .lang select-default-common-component .text-p, -perfect-user-info-component .lang select-default-common-component .text-p, -third-party-step .lang select-default-common-component .text-p { - color: #333; - background-color: #fff; -} -old-register-default .eo_link, -register-default .eo_link, -login .eo_link, -forget .eo_link, -perfect-user-info-component .eo_link, -third-party-step .eo_link { - color: #2878ff !important; -} -old-register-default .eo_link:hover, -register-default .eo_link:hover, -login .eo_link:hover, -forget .eo_link:hover, -perfect-user-info-component .eo_link:hover, -third-party-step .eo_link:hover { - text-decoration: underline; - color: #498cff; -} -old-register-default .copy_btn_rd, -register-default .copy_btn_rd, -login .copy_btn_rd, -forget .copy_btn_rd, -perfect-user-info-component .copy_btn_rd, -third-party-step .copy_btn_rd { - border: 3px solid #b9d9d0; - border-radius: 3px; - line-height: 45px; - font-size: 16px; - width: 100%; -} -old-register-default .copy_btn_tip_rd, -register-default .copy_btn_tip_rd, -login .copy_btn_tip_rd, -forget .copy_btn_tip_rd, -perfect-user-info-component .copy_btn_tip_rd, -third-party-step .copy_btn_tip_rd { - width: 90px; - background-color: #d9ebe6; -} -old-register-default .code_input_rd, -register-default .code_input_rd, -login .code_input_rd, -forget .code_input_rd, -perfect-user-info-component .code_input_rd, -third-party-step .code_input_rd { - width: 52px; - height: 65px; - border: 1px solid rgba(0, 0, 0, 0.15); - text-align: center; - font-size: 20px; -} -old-register-default .code_input_rd_fist, -register-default .code_input_rd_fist, -login .code_input_rd_fist, -forget .code_input_rd_fist, -perfect-user-info-component .code_input_rd_fist, -third-party-step .code_input_rd_fist { - border-top-left-radius: 5px; - border-bottom-left-radius: 5px; -} -old-register-default .code_input_rd_last, -register-default .code_input_rd_last, -login .code_input_rd_last, -forget .code_input_rd_last, -perfect-user-info-component .code_input_rd_last, -third-party-step .code_input_rd_last { - border-top-right-radius: 5px; - border-bottom-right-radius: 5px; -} -old-register-default .header_container_rd, -register-default .header_container_rd, -login .header_container_rd, -forget .header_container_rd, -perfect-user-info-component .header_container_rd, -third-party-step .header_container_rd { - height: 50px; - position: absolute; - top: 0; - width: 100%; - background-color: #fff; - z-index: 1; - border-bottom: 1px solid rgba(0, 0, 0, 0.15); -} -old-register-default .input_rd, -register-default .input_rd, -login .input_rd, -forget .input_rd, -perfect-user-info-component .input_rd, -third-party-step .input_rd { - border-radius: 3px; - width: 100%; - height: 40px; - border: 1px solid rgba(0, 0, 0, 0.15); - text-indent: 10px; - font-size: 16px; - box-sizing: border-box; -} -old-register-default .input_rd:hover, -old-register-default .code_input_rd:hover, -register-default .input_rd:hover, -register-default .code_input_rd:hover, -login .input_rd:hover, -login .code_input_rd:hover, -forget .input_rd:hover, -forget .code_input_rd:hover, -perfect-user-info-component .input_rd:hover, -perfect-user-info-component .code_input_rd:hover, -third-party-step .input_rd:hover, -third-party-step .code_input_rd:hover { - border-color: #999; - transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1); -} -old-register-default .input_rd:focus, -old-register-default .code_input_rd:focus, -register-default .input_rd:focus, -register-default .code_input_rd:focus, -login .input_rd:focus, -login .code_input_rd:focus, -forget .input_rd:focus, -forget .code_input_rd:focus, -perfect-user-info-component .input_rd:focus, -perfect-user-info-component .code_input_rd:focus, -third-party-step .input_rd:focus, -third-party-step .code_input_rd:focus { - border-color: #019e75; - box-shadow: 0px 0px 4px #00785a; -} -old-register-default .eo-input-error:focus, -register-default .eo-input-error:focus, -login .eo-input-error:focus, -forget .eo-input-error:focus, -perfect-user-info-component .eo-input-error:focus, -third-party-step .eo-input-error:focus { - box-shadow: 0px 0px 4px #e83333; -} -old-register-default .logo_rd, -register-default .logo_rd, -login .logo_rd, -forget .logo_rd, -perfect-user-info-component .logo_rd, -third-party-step .logo_rd { - height: 25px; -} -old-register-default .step_container_rd, -register-default .step_container_rd, -login .step_container_rd, -forget .step_container_rd, -perfect-user-info-component .step_container_rd, -third-party-step .step_container_rd { - width: 360px; -} -old-register-default .ok_btn_rd, -register-default .ok_btn_rd, -login .ok_btn_rd, -forget .ok_btn_rd, -perfect-user-info-component .ok_btn_rd, -third-party-step .ok_btn_rd { - height: 40px; - line-height: 40px; - width: 100%; - margin-top: 25px; - font-size: 16px; -} -old-register-default .f_row_btn, -register-default .f_row_btn, -login .f_row_btn, -forget .f_row_btn, -perfect-user-info-component .f_row_btn, -third-party-step .f_row_btn { - height: 40px; - line-height: 40px; - white-space: nowrap; - font-size: 16px; -} -old-register-default .join_btn_rd, -register-default .join_btn_rd, -login .join_btn_rd, -forget .join_btn_rd, -perfect-user-info-component .join_btn_rd, -third-party-step .join_btn_rd { - border-color: #00479d; -} -old-register-default .create_btn_rd, -register-default .create_btn_rd, -login .create_btn_rd, -forget .create_btn_rd, -perfect-user-info-component .create_btn_rd, -third-party-step .create_btn_rd { - border-color: #00785a; -} -old-register-default .create_icon_rd, -register-default .create_icon_rd, -login .create_icon_rd, -forget .create_icon_rd, -perfect-user-info-component .create_icon_rd, -third-party-step .create_icon_rd { - background-color: #00785a; -} -old-register-default .url_bg_rd, -register-default .url_bg_rd, -login .url_bg_rd, -forget .url_bg_rd, -perfect-user-info-component .url_bg_rd, -third-party-step .url_bg_rd { - background-color: #fff; - height: 22px; - border-radius: 11px; -} - -third-party-step .logout_btn_pui_eoui:hover, -perfect-user-info .logout_btn_pui_eoui:hover { - color: #2196f3; -} -third-party-step .container_pui_eoui, -perfect-user-info .container_pui_eoui { - margin: 150px auto 30px auto; - max-width: 805px; -} -third-party-step .container_rd, -perfect-user-info .container_rd { - display: flex; - border-radius: 3px; - overflow: hidden; -} -third-party-step .left_div, -perfect-user-info .left_div { - width: 325px; - text-align: left; - padding: 0 30px 27px 30px; -} -third-party-step .left_div .register-info .eo-input, -perfect-user-info .left_div .register-info .eo-input { - width: 100%; - height: 40px; - line-height: 40px; -} -third-party-step .left_div .register-info .eo_theme_btn_success, -perfect-user-info .left_div .register-info .eo_theme_btn_success { - width: 100%; - height: 40px; - line-height: 40px; -} -third-party-step .right-div, -perfect-user-info .right-div { - border-left: 1px solid rgba(0, 0, 0, 0.15); - min-height: 100%; - width: 360px; - padding: 0 30px 30px; -} -third-party-step .right-div .title-p, -perfect-user-info .right-div .title-p { - margin: 0 0 15px 0; -} -third-party-step .right-div .title-p:nth-child(n + 2), -perfect-user-info .right-div .title-p:nth-child(n + 2) { - margin-top: 40px; -} -third-party-step .right-div p, -perfect-user-info .right-div p { - line-height: 1.75em; -} -third-party-step .right-div .link-p, -perfect-user-info .right-div .link-p { - margin-top: 35px; -} - -.common_setting_form_list { - width: 100%; - margin: 0; - padding: 20px 20px 20px; - background-color: var(--MAIN_BG); - box-sizing: border-box; -} -.common_setting_form_list .eo-tab-container { - border-radius: 0; - box-shadow: none; -} -.common_setting_form_list .csl_title { - font-size: 26px; -} -.common_setting_form_list .csl_table { - width: 100%; - border-radius: 3px; - border-spacing: 0; - background-color: #fff; - border: 1px solid var(--BORDER); -} -.common_setting_form_list .csl_table td { - padding: 0 10px; - font-size: 14px; -} -.common_setting_form_list .csl_table td:nth-child(n + 2) { - border-left: 1px solid var(--BORDER); -} -.common_setting_form_list .csl_table tr { - height: 40px; - line-height: 40px; -} -.common_setting_form_list .csl_table .title-td { - width: 245px; -} -.common_setting_form_list .csl_table thead td { - font-weight: bold; -} -.common_setting_form_list .csl_table tbody td { - border-top: 1px solid var(--BORDER); -} -.common_setting_form_list .csl_table tbody .tips-td { - font-weight: bold; - text-align: left; - padding-left: 20px; -} -.common_setting_form_list .csl_second_title { - margin-top: 10px; - margin-bottom: 30px; -} -.common_setting_form_list .title_icon { - color: var(--GREEN_NORMAL); - margin-right: 10px; - font-weight: initial; -} -.common_setting_form_list .csl_title + .csl_list_container { - margin-top: 30px; -} -.common_setting_form_list .csl_item { - border-bottom: 1px solid var(--BORDER); -} -.common_setting_form_list .csl_list_container > .csl_item:first-child { - border-top: 0 none; -} -.common_setting_form_list .csl_item_handle { - padding: 20px; - cursor: pointer; -} -.common_setting_form_list .csl_item_sub_menu { - padding: 0 20px; - display: block; -} -.common_setting_form_list .setting_title { - font-size: 22px; -} -.common_setting_form_list .secondary_title { - margin-top: 10px; -} -.common_setting_form_list .di_switch_icon { - font-size: 20px; - font-weight: bold; -} -.common_setting_form_list .form_item { - margin-top: 20px; - display: flex; - flex-direction: column; -} -.common_setting_form_list .form_item:first-child { - margin-top: 0; -} -.common_setting_form_list .form_pb { - padding-bottom: 20px; -} -.common_setting_form_list .form_item_row { - flex-direction: row; - align-items: center; -} -.common_setting_form_list .form_label_sm { - margin-bottom: 10px; - font-weight: bold; -} -.common_setting_form_list .form_label { - margin-bottom: 10px; - font-size: 14px; - font-weight: bold; -} -.common_setting_form_list .secondary_form_label { - color: #999; - margin-bottom: 10px; -} -.common_setting_form_list .form_btn_submit { - margin: 20px 0; -} -.common_setting_form_list .copy_container { - display: flex; - justify-content: space-between; - align-items: center; - border-radius: 3px; - border: 2px solid var(--GREEN_NORMAL); - background-color: #fafffb; - padding: 10px 20px; -} -.common_setting_form_list .btn_copy { - background-color: #fff; - border: 1px solid #e0e0e0; - color: #999; - border-radius: 3px; - padding: 2px 7.5px; - margin-left: 10px; - font-weight: normal; - cursor: pointer; -} - -.no_limit_setting_form_list { - width: auto; - padding: 30px 20px; -} - -.container_pdtj { - background-color: var(--COMPONENT_BG); - font-size: 12px; - padding: 10px; - border-top: 1px solid var(--BORDER); - line-height: 30px; - border-bottom: 2px solid var(--BORDER); - overflow: hidden; -} -.container_pdtj .type-td span { - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; -} -.container_pdtj .default-td { - max-width: 85px; -} -.container_pdtj .divide-span { - color: var(--BORDER); - margin: 0 10px; -} -.container_pdtj table { - max-width: calc(100% - 120px); - border-spacing: 0; -} - -env-ams-component { - position: relative; -} -env-ams-component .arrow_eac { - width: 0; - height: 0; - border-top: 5px solid transparent; - border-left: 6px solid #000; - border-bottom: 5px solid transparent; - position: absolute; - margin-top: 9px; - z-index: 3; - margin-left: -19px; - display: none; -} -env-ams-component .key_item_eac { - min-width: 150px; - color: #666; - padding-left: 0.75em; -} -env-ams-component .val_item_eac { - word-break: break-all; - padding: 5px 0; - white-space: pre-wrap; -} -env-ams-component .item_eac:nth-child(odd) { - background-color: #f7f7f7; - table-layout: fixed; - width: 100%; - border-spacing: 0; -} -env-ams-component .show_detail_btn_eac { - position: absolute; - padding-left: 10px; - padding-right: 9px; - border-left: 1px solid var(--BORDER); - height: 40px; - line-height: 40px; - color: var(--MAIN_TEXT); - background-color: var(--MAIN_BG); - left: 0; -} -env-ams-component .show_detail_btn_eac:hover .arrow_eac, -env-ams-component .show_detail_btn_eac:hover .tip_eac { - display: initial; -} -env-ams-component .tip_eac { - margin-left: -135px; - margin-top: -1px; -} -env-ams-component .text_input_eac { - cursor: pointer; - width: 184px; - height: 40px; - float: left; - padding: 0 30px 0 40px; - background-color: var(--MAIN_BG); - border: none; - text-indent: 5px; -} -env-ams-component .eac_disabled_select .text_input_eac { - cursor: default; -} -env-ams-component .menu_btn_eac { - position: absolute; - right: 0; - text-align: center; - cursor: pointer; - width: 30px; - height: 40px; - line-height: 40px; - background-color: var(--MAIN_BG); -} -env-ams-component .list_container_eac { - width: 182px; - border-radius: 3px; - border: 1px solid var(--BORDER); - margin-top: 5px; - box-shadow: var(--COMPONENT_SHADOW); - max-height: 400px; - overflow: auto; -} -env-ams-component .list_item_common_eac { - padding: 5px 10px; - cursor: pointer; -} -env-ams-component .list_item_admin_eac { - height: 30px; - line-height: 30px; - border-bottom: 1px dashed var(--BORDER); -} -env-ams-component .list_item_admin_eac:hover { - color: var(--BLUE_NORMAL); -} -env-ams-component .list_item_eac { - height: 30px; - line-height: 30px; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} -env-ams-component .list_item_eac:hover { - background-color: var(--LIST_ITEM_BG_HOVER); -} -env-ams-component .item_detail_container_eac { - padding: 5px 15px; - line-height: 1.75em; -} -env-ams-component .item_detail_container_eac + .item_detail_container_eac, -env-ams-component .env_container_eac + .item_detail_container_eac { - border-top: 1px dashed #e7e7e7; -} -env-ams-component .detail_container_eac { - z-index: 8; - right: 10px; - width: 500px; -} -env-ams-component .env_name_eac { - background-color: #f7f7f7; - line-height: 40px; - padding: 0 15px; -} -env-ams-component .front_uri_eac { - padding-left: 0.75em; -} -env-ams-component .detail_container_eac > div { - box-shadow: var(--COMPONENT_SHADOW); - background-color: var(--COMPONENT_BG); - font-size: 12px; - overflow-y: auto; - border: 1px solid var(--BORDER); - border-radius: 3px; - max-height: 500px; - word-break: break-all; -} -env-ams-component .none_detail_tip_eac { - color: #999; - height: 50px; - line-height: 50px; - text-align: center; -} -env-ams-component .mask_eac { - z-index: 7; - opacity: 0.5; - position: fixed; - background: var(--MODAL_MASK); - width: 100%; - height: 100%; - top: 0; - left: 0; -} - -generate-code-ams-component .code-box { - height: calc(100% - 57px); -} -generate-code-ams-component ace-editor-component { - height: 100%; -} -generate-code-ams-component ace-editor-component .ace_editor { - height: calc(100% - 41px) !important; -} - -unit-test-ams-component .eo_more_btn:focus + .wrap-div { - display: block; -} -unit-test-ams-component .wrap-div:hover { - display: block; -} -unit-test-ams-component .wrap-div { - margin-top: 38px; - background-color: var(--COMPONENT_BG); - box-shadow: var(--COMPONENT_SHADOW); - position: absolute; - border-style: solid; - border-width: 1px; - border-radius: 3px; - right: 0; - z-index: 2; - border-color: var(--BORDER); - display: none; -} -unit-test-ams-component .wrap-div button, -unit-test-ams-component .wrap-div a { - height: 35px; - line-height: 35px; - padding: 0 15px; - text-align: left; - color: #555; - word-break: keep-all; - white-space: pre; - display: block; -} -unit-test-ams-component .wrap-div button:hover, -unit-test-ams-component .wrap-div a:hover { - background-color: var(--DISABLE_BG); - color: var(--MAIN_TEXT); - text-decoration: underline; -} -unit-test-ams-component .btn_generate_code { - white-space: nowrap; - height: 35px; - line-height: 35px; -} -unit-test-ams-component .btn_test_utac { - white-space: nowrap; -} -unit-test-ams-component .btn_test_utac:disabled { - cursor: not-allowed; -} -unit-test-ams-component .btn_test_utac, -unit-test-ams-component .btn_test_send { - height: 35px; - line-height: 35px; -} -unit-test-ams-component .eo_theme_btn_default { - border-radius: 3px; -} -unit-test-ams-component .eo_more_btn { - border-left: 1px solid rgba(0, 0, 0, 0.1); - border-radius: 0 3px 3px 0; - padding: 0; - height: 35px; - line-height: 35px; -} - -date-picker-common-component .db_header { - cursor: pointer; -} -date-picker-common-component .uib-datepicker { - position: absolute; - z-index: 3; -} - -/** -* @name ä¾§è¾¹æ  -* @author Eoapi -*/ -sidebar-common-component .circle_tip_scc { - left: 30px; - top: -10px; -} -sidebar-common-component .shrink_or_spreed_line_scc { - width: 5px; - background-color: rgba(0, 0, 0, 0.2); - cursor: pointer; - right: -5px; - top: -51px; -} -sidebar-common-component .shrink_or_spreed_line_scc:hover { - background-color: rgba(0, 0, 0, 0.5); -} -sidebar-common-component .icon-guanyu_o { - font-size: 18px; - color: #666; - margin-left: 5px; -} -sidebar-common-component .star-like { - color: #f44336; -} -sidebar-common-component .list_item_scc { - height: 40px; - overflow: hidden; - padding-left: 15px; - cursor: pointer; -} -sidebar-common-component .back_static_scc { - padding-right: 20px; - border-radius: 0 3px 3px 0; - height: 32px; -} -sidebar-common-component .static_item_scc { - font-size: 24px; - color: #999; - line-height: 45px; - text-align: center; - cursor: pointer; -} -sidebar-common-component .static_item_scc:hover { - color: var(--MAIN_TEXT); -} -sidebar-common-component .static_scc { - background-color: #eaeff3; - min-width: 50px; - position: fixed; - height: calc(100% - 50px); - z-index: 2; - bottom: 0; -} -sidebar-common-component .footer_sidebar_cc { - position: absolute; - bottom: 0; - left: 0; - height: 40px; - line-height: 41px; - background-color: #f2f2f2; - border-top: 1px solid var(--BORDER); - text-indent: 15px; - width: 100%; - overflow: hidden; -} -sidebar-common-component .footer_sidebar_cc:hover { - background-color: #f0f2f5; -} -sidebar-common-component .footer_sidebar_cc:hover .iconfont { - color: #019e75; -} -sidebar-common-component .text_footer_sidebar_cc { - white-space: nowrap; -} -sidebar-common-component .shrink_footer_sidebar_cc .iconfont { - color: #019e75; -} -sidebar-common-component .shrink_footer_sidebar_cc .text_footer_sidebar_cc { - display: none; -} -sidebar-common-component .eo-sidebar { - width: 50px; - color: #444; -} -sidebar-common-component .tip_scc .iconfont { - font-size: 20px; -} -sidebar-common-component .tip_scc .eo-tip-container { - margin-top: 10px !important; -} -sidebar-common-component .eo-sidebar { - height: 100%; - position: fixed; - top: 0; - left: 0; - z-index: 10; - width: 260px; - transition: all 0.3s cubic-bezier(0, 0, 0.2, 1); -} -sidebar-common-component .main_sidebar_scc { - height: calc(100% - 51px); - overflow: hidden; - width: 220px; - transition: all 0.3s cubic-bezier(0, 0, 0.2, 1); - margin-left: 50px; -} -sidebar-common-component .main_sidebar_scc .item-container-ul { - height: 100%; - overflow-x: hidden; -} -sidebar-common-component .divide-li { - border-top-style: solid; - border-top-width: 1px; -} -sidebar-common-component .divide-solid-bottom-li { - border-bottom-style: solid; - border-bottom-width: 1px; -} -sidebar-common-component .divide-solid-top-li { - border-top-style: solid; - border-top-width: 1px; -} -sidebar-common-component .default-div .item-container-ul { - overflow-y: auto; -} -sidebar-common-component .inside-sidebar { - z-index: 7; -} -sidebar-common-component .static-sidebar { - overflow: hidden; -} -sidebar-common-component .static-li { - height: 50px; - line-height: 50px; -} -sidebar-common-component .parent-router-p { - display: none; - text-indent: 15px; - color: #999; - line-height: 28px; -} -sidebar-common-component .s1_tip_style { - border-radius: 3px; - padding: 2px 5px; - font-size: 12px; -} -sidebar-common-component .s1_warning_tip_style { - border-radius: 10px; - max-width: 2rem; - padding: 2px 7px; - font-size: 12px; -} -sidebar-common-component .shrink-sidebar-div .list-item-div1 { - position: absolute; - margin-left: 50px; - display: none; -} -sidebar-common-component .shrink-sidebar-div .list-item-div1 div { - margin-left: 5px; - width: 180px; - border-radius: 3px; - overflow: hidden; - box-shadow: var(--COMPONENT_SHADOW); - padding-bottom: 5px; -} -sidebar-common-component .shrink-sidebar-div .list-item-div1 div .list_item_scc { - height: 40px; - line-height: 40px; -} -sidebar-common-component .shrink-sidebar-div .list-item-div1 div .list_item_scc:nth-child(n + 2) { - margin-top: 5px; -} -sidebar-common-component .shrink-sidebar-div .item-container-li:hover .list-item-div1 { - display: block; -} - -.shrink-div sidebar-common-component .eo-sidebar { - width: 50px; -} -.shrink-div sidebar-common-component .user_data_scc { - display: none; -} -.shrink-div sidebar-common-component .main_sidebar_scc { - width: 0; -} - -.hover_container_scc { - width: 260px !important; -} -.hover_container_scc .main_sidebar_scc { - width: 220px !important; -} -.hover_container_scc .list-item-div1 { - position: initial !important; - margin-left: 0 !important; - display: block !important; -} -.hover_container_scc .user_data_scc { - display: block !important; -} - -.bookmark_trigger_item_scc { - margin-top: -5px; -} - -.static_item_scc:hover .trigger_item_scc { - display: inline-flex; -} - -.text_trigger_item_scc { - background-color: #40404c; - color: #fff; - font-size: 12px; - padding: 5px 10px; - line-height: 20px; - border-radius: 3px; - text-align: left; -} - -.public_logo_scc { - text-indent: 12px; - line-height: 50px; - height: 50px; - border-bottom: 1px solid var(--BORDER); -} - -.public_scc { - width: 210px !important; -} -.public_scc .main_sidebar_scc { - margin-left: 0 !important; -} - -.s2_iaf_style, .s1_if_style { - background-color: var(--SIDEBAR_BG_ACTIVE); - color: var(--SIDEBAR_TEXT_ACTIVE) !important; -} - -tip-common-component { - display: flex; -} -tip-common-component > div { - padding: 5px 10px; - border: 1px solid; - border-radius: 3px; - width: -webkit-calc(100% - 20px); - width: -ms-calc(100% - 20px); - width: -moz-calc(100% - 20px); - width: calc(100% - 20px); -} -tip-common-component .btn_close:hover { - color: #999; -} -tip-common-component .text_container_tcc { - font-size: 12px; - text-align: justify; - line-height: 1.75em; -} -tip-common-component .text_container_tcc .iconfont { - display: inline-block; - font-size: 24px; - margin-right: 5px; -} -tip-common-component .warning-div { - background-color: var(--RED_LIGHT); - border-color: var(--RED_NORMAL); -} -tip-common-component .success-div { - background-color: var(--GREEN_LIGHT); - border-color: var(--GREEN_NORMAL); -} -tip-common-component .success-div .icon-guanyu { - display: inline-block; -} -tip-common-component .info-div { - background-color: var(--BLUE_LIGHT); - border-color: var(--BLUE_NORMAL); -} -tip-common-component .error_div { - background-color: var(--RED_LIGHT); - border-color: var(--RED_NORMAL); -} -tip-common-component .btn_close { - display: block !important; - color: var(--MAIN_TEXT); - line-height: 1.25em; -} - -time-summary-amt-component .timeline_duration_td { - padding: 0 10px; -} -time-summary-amt-component .default_scss_list { - border-bottom: none; - border-radius: 0px; -} -time-summary-amt-component .default_scss_list .color_flag { - width: 2px; - padding: 0; -} -time-summary-amt-component .default_scss_list th { - border-bottom-style: solid; - border-bottom-width: 1px; -} -time-summary-amt-component tip-directive .eo-tip-container .message-li { - margin-left: -175px; -} -time-summary-amt-component .indent_time { - text-indent: 10px; -} -time-summary-amt-component .time_name { - width: 100px; -} -time-summary-amt-component .http_request_box .timeline_duration { - background-color: #d7efff; - text-indent: 5px; - color: #384954; - height: 24px; - line-height: 24px; -} -time-summary-amt-component .http_request_box .left_indent { - text-indent: -50px; -} -time-summary-amt-component .http_request_other_box { - border: 1px solid var(--BORDER); - border-bottom: 0 none; - height: 43px; - line-height: 43px; - padding: 0 15px; -} - -.btn_disabled_loading { - -ms-animation: load 1.7s infinite ease; - -moz-animation: load 1.7s infinite ease; - -webkit-animation: load 1.7s infinite ease; - animation: load 1.7s infinite ease; - display: inline-block; - margin-right: 10px; -} - -.eo-drop-root { - position: fixed; - z-index: 100; - border: 1px solid var(--BORDER); - box-shadow: var(--COMPONENT_SHADOW); - border-radius: var(--DEFAULT_BORDER_RADIUS); - background-color: var(--COMPONENT_BG); - -ms-animation: fade 0.3s; - -moz-animation: fade 0.3s; - -webkit-animation: fade 0.3s; - animation: fade 0.3s; -} -.eo-drop-root .item_edr { - min-width: 100px; - padding-left: 15px; - padding-right: 15px; - box-sizing: border-box; - font-size: 12px; -} -.eo-drop-root .item_edr:hover { - text-decoration: underline; - color: var(--BLUE_NORMAL); -} -.eo-drop-root .had_child_item_edr:hover { - text-decoration: none; -} -.eo-drop-root .had_child_item_edr span:hover:first-child { - text-decoration: underline; -} - -.childs_container_edr { - right: -115px; - position: absolute; - width: 120px; -} -.childs_container_edr .item_edr:nth-last-child(n+2) { - border-bottom: 1px dashed var(--BORDER); -} - -.sv-group-helper { - position: fixed !important; - z-index: 99999; - margin: 0 !important; -} -.sv-group-helper .group-li { - background-color: rgba(221, 221, 221, 0.3); - color: #999; -} -.sv-group-helper .group-li:hover { - background-color: rgba(221, 221, 221, 0.3); -} - -.sv-group-candidate-top { - border-top: 2px solid #26A69A !important; -} - -.sv-group-candidate-bottom { - border-bottom: 2px solid #26A69A !important; -} - -.sv-group-candidate { - border: 2px solid #26A69A !important; -} - -.sv-group-placeholder { - opacity: 0.5; -} - -.sv-sorting-in-progress { - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - -.sv-visibility-hidden { - visibility: hidden !important; - opacity: 0 !important; -} - -.video_vd { - min-height: 400px; -} - -.none_tip_vd { - position: absolute; - top: 160px; - width: 100%; -} - -.sure-template { - position: absolute; - width: 100%; - z-index: 0; - left: 0; - padding-top: 60px; -} -.sure-template .sure-template-first-level-header { - margin-top: 60px; -} -.sure-template .sure-template-first-level-header h1 { - font-size: 3rem; - text-align: center; - margin-bottom: 64px; - font-weight: 300; - font-style: normal; - color: inherit; - text-rendering: optimizeLegibility; - line-height: 1.3; - cursor: default; -} -.sure-template .sure-template-first_level_article { - padding-top: 100px; - padding-bottom: 135px; - border-top: 1px solid #e0e0e0; - background-color: #fefefe; -} -.sure-template .sure-template-first_level_article .sure-template-content { - margin: auto; - text-align: center; -} -.sure-template .sure-template-first_level_article .sure-template-content .title span { - font-size: 88px; -} -.sure-template .sure-template-first_level_article .sure-template-content .first-tip { - font-size: 18px; - margin-top: 30px; -} -.sure-template .sure-template-first_level_article .sure-template-content .second-tip { - margin-top: 10px; - color: var(--MAIN_TEXT); -} -.sure-template .eo-footer .wrap { - margin-top: 0; -} - -.container_gctd { - position: fixed; - z-index: 10000; - display: none; -} -.container_gctd .text_gctd { - padding: 5px 10px; - line-height: initial; - border-radius: 3px; - background-color: #000; - color: #fff; - font-size: 12px; - text-align: left; - max-width: 300px; - color: #fff; - white-space: pre-wrap; -} -.container_gctd .arrow_gctd { - border-color: #000 transparent transparent transparent; - border-width: 5px 5px 0 5px; - border-style: solid; - width: 0; - margin-left: 8px; -} -.container_gctd .html_gctd { - white-space: initial; -} - -.move-tip-directive { - position: fixed; - z-index: 100; - visibility: hidden; -} -.move-tip-directive .message-li { - padding: 6px; - line-height: initial; - border-radius: 3px; - background-color: #000; - color: #fff; - font-size: 12px; - text-align: left; - max-width: 500px; -} -.move-tip-directive .message-li * { - color: #fff; -} -.move-tip-directive .arrow-li { - border-color: #000 transparent transparent transparent; - border-width: 5px 5px 0 5px; - border-style: solid; - width: 0; - margin-left: 8px; -} - -tip-directive { - display: inline-flex; - height: 20px; - line-height: 20px; - margin-left: 5px; -} -tip-directive * { - text-indent: 0; -} -tip-directive .iconfont { - color: rgba(0, 0, 0, 0.5); - cursor: help; - display: inline-block; - font-weight: initial; -} -tip-directive:hover .tips-message { - visibility: visible; -} -tip-directive .eo-tip-container { - transform: translateY(-100%); -} - -gantt-Echart-Common-Component canvas { - cursor: default; - filter: var(--GANTT_ECHART_FILTER); -} - -group-default-common-component .api-more { - display: none; -} -group-default-common-component .api-more:focus-within { - display: flex; -} -group-default-common-component .divide_line_ldcc { - border-right: 1px solid var(--BORDER); - right: 0; - top: 0; - position: absolute; - height: 100%; -} -group-default-common-component .divide_line_ldcc:hover { - border-right-width: 3px; - border-right-color: rgba(255, 150, 0, 0.3); -} -group-default-common-component .cc-group-container { - height: 100%; - background-color: var(--MAIN_BG); - border-right: 0 none; -} -group-default-common-component .divide-li { - border-bottom-style: dashed; - border-bottom-width: 1px; - border-bottom-color: var(--BORDER); -} -group-default-common-component .more-btn-box { - position: relative; -} -group-default-common-component .more-btn-left { - border-radius: 3px 0 0 3px; -} -group-default-common-component .more-btn-right { - border-left: 1px solid rgba(0, 0, 0, 0.1); - border-radius: 0 3px 3px 0; - padding: 0; -} -group-default-common-component .group_child_select::after { - width: 7.5px; - height: 7.5px; - content: " "; - display: inline-block; - margin-top: 50%; - margin-left: 50%; - transform: translate(-50%, -50%); -} -group-default-common-component .shrink-btn:hover { - color: #019e75; -} -group-default-common-component .gd_highlight { - color: var(--RED_DEEP); -} -group-default-common-component .gc_search_form { - height: 40px; - box-sizing: border-box; - padding: 4px 10px; - border-bottom: 1px solid var(--BORDER); -} -group-default-common-component .gc_search_form .search_input_container { - height: 30px; - line-height: 30px; - border: 1px solid var(--BORDER); - border-radius: 30px; - padding-right: 10px; - overflow: hidden; - background-color: var(--INPUT_BG); - white-space: nowrap; -} -group-default-common-component .gc_search_form .search_input_container .search-input { - background-color: transparent; - width: calc(100% - 30px); - height: 100%; - border: none; -} -group-default-common-component .gc_search_form .search_input_container .search-tap-box { - border-radius: 3px; - left: 25px; - background-color: var(--DISABLE_BG); - height: 20px; - line-height: 20px; -} -group-default-common-component .gc_search_form .search_input_container .search-text { - border-right: 1px solid var(--BORDER); - padding: 0 5px; - max-width: 130px; - text-overflow: ellipsis; - transition: max-width 0.1s linear 0s; - overflow: hidden; -} -group-default-common-component .gc_search_form .search_input_container .search-tap .iconfont:hover { - color: var(--RED_NORMAL); -} -group-default-common-component .gc_search_form .search-div { - height: 30px; - line-height: 30px; - border: 1px solid var(--BORDER); - background-color: var(--INPUT_BG); - border-radius: 30px; - box-sizing: border-box; - transition: width 0.3s linear 0s; - overflow: hidden; - white-space: nowrap; -} - -.common-scss-group .group-li { - border-radius: 3px; - height: 28px; - line-height: 35px; - margin: 3px 0; -} - -.common-scss-group .group-li:hover { - background-color: var(--SIDEBAR_BG_ACTIVE); - color: var(--TEXT_ACTIVE); -} -.common-scss-group .group-li:hover .api-more { - display: flex; -} - -.eo_theme_gd_div { - background-color: var(--SIDEBAR_BG_ACTIVE); - color: var(--TEXT_ACTIVE); -} -.eo_theme_gd_div .api-more { - display: flex; -} - -.fixed_role { - padding: 5px 0; -} - -.add { - height: 35px; - line-height: 35px; - font-family: Roboto; - color: #2979ff; -} - -.shrink-group-div .common-scss-group .title-ul { - border-bottom: none; -} - -ng-group-content-common-component .page-list-li { - cursor: pointer; - height: 30px; - line-height: 30px; - font-size: 12px; - border-radius: 3px; - margin: 3px 0px; -} -ng-group-content-common-component .page-list-li:hover { - background-color: var(--SIDEBAR_BG_ACTIVE); - color: var(--TEXT_ACTIVE); -} -ng-group-content-common-component .page-list-li:hover .icon-more { - opacity: 1; -} -ng-group-content-common-component .page-list-li .page-name { - width: calc(100% - 50px); - display: inline-block; - white-space: nowrap; - vertical-align: middle; - overflow: hidden; - text-overflow: ellipsis; -} -ng-group-content-common-component .page-list-li .page-more { - display: flex; - justify-content: flex-end; -} -ng-group-content-common-component .eo_theme_gd_li_fli_a { - background-color: var(--SIDEBAR_BG_ACTIVE); - color: var(--TEXT_ACTIVE); -} -ng-group-content-common-component .divide_line_ldcc { - border-right: 1px solid var(--BORDER); - right: 0; - top: 0; - position: absolute; - height: 100%; -} -ng-group-content-common-component .divide_line_ldcc:hover { - border-right-width: 3px; - border-right-color: rgba(255, 150, 0, 0.3); -} -ng-group-content-common-component .cc-group-container { - height: 100%; - background-color: var(--MAIN_BG); - border-right: 0 none; -} -ng-group-content-common-component .divide-li { - border-bottom-style: dashed; - border-bottom-width: 1px; - border-bottom-color: var(--BORDER); -} -ng-group-content-common-component .more-btn-box { - position: relative; -} -ng-group-content-common-component .more-btn-left { - border-radius: 3px 0 0 3px; -} -ng-group-content-common-component .more-btn-right { - border-left: 1px solid rgba(0, 0, 0, 0.1); - border-radius: 0 3px 3px 0; - padding: 0; -} -ng-group-content-common-component .group_child_select::after { - width: 7.5px; - height: 7.5px; - content: " "; - display: inline-block; - margin-top: 50%; - margin-left: 50%; - transform: translate(-50%, -50%); -} -ng-group-content-common-component .shrink-btn:hover { - color: #019e75; -} -ng-group-content-common-component .gd_highlight { - color: var(--RED_DEEP); -} -ng-group-content-common-component .gc_search_form { - height: 40px; - box-sizing: border-box; - padding: 4px 10px; - border-bottom: 1px solid var(--BORDER); -} -ng-group-content-common-component .gc_search_form .search_input_container { - height: 30px; - line-height: 30px; - border: 1px solid var(--BORDER); - border-radius: 30px; - padding-right: 10px; - box-sizing: border-box; - overflow: hidden; - background-color: var(--INPUT_BG); - white-space: nowrap; -} -ng-group-content-common-component .gc_search_form .search_input_container .search-input { - background-color: transparent; - width: calc(100% - 30px); - height: 100%; - border: none; -} -ng-group-content-common-component .gc_search_form .search_input_container .search-tap-box { - border-radius: 3px; - left: 25px; - background-color: var(--DISABLE_BG); - height: 20px; - line-height: 20px; -} -ng-group-content-common-component .gc_search_form .search_input_container .search-text { - border-right: 1px solid var(--BORDER); - padding: 0 5px; - max-width: 130px; - text-overflow: ellipsis; - transition: max-width 0.1s linear 0s; - overflow: hidden; -} -ng-group-content-common-component .gc_search_form .search_input_container .search-tap .iconfont:hover { - color: var(--RED_NORMAL); -} -ng-group-content-common-component .gc_search_form .search-div { - height: 30px; - line-height: 30px; - border: 1px solid var(--BORDER); - background-color: #fff; - border-radius: 30px; - box-sizing: border-box; - transition: width 0.3s linear 0s; - overflow: hidden; - white-space: nowrap; -} -ng-group-content-common-component .icon-more { - opacity: 0; -} -ng-group-content-common-component .common-scss-group .group-li { - border-radius: 3px; - height: 28px; - line-height: initial; - margin: 3px 0; -} -ng-group-content-common-component .common-scss-group .group-li:hover { - background-color: var(--SIDEBAR_BG_ACTIVE); - color: var(--TEXT_ACTIVE); -} -ng-group-content-common-component .common-scss-group .group-li:hover .icon-more { - opacity: 1; -} -ng-group-content-common-component .eo_theme_gd_div { - background-color: var(--SIDEBAR_BG_ACTIVE); - color: var(--TEXT_ACTIVE); -} -ng-group-content-common-component .eo_theme_gd_div .api-more { - display: flex; -} -ng-group-content-common-component .add { - height: 35px; - line-height: 35px; - font-family: Roboto; - color: #2979ff; -} -ng-group-content-common-component .shrink-group-div .common-scss-group .title-ul { - border-bottom: none; -} - -ng-group-api-quick-common-component .divide_line_ldcc { - border-right: 1px solid var(--BORDER); - right: 0; - top: 0; - position: absolute; - height: 100%; -} -ng-group-api-quick-common-component .divide_line_ldcc:hover { - border-right-width: 3px; - border-right-color: rgba(255, 150, 0, 0.3); -} -ng-group-api-quick-common-component menu-common-component .common_menu_ul { - width: calc(100% - 1px); - border-right: none; - border-top: none; - border-left: none; - z-index: auto; -} -ng-group-api-quick-common-component .common_menu_ul { - background-color: #f7f7f7; - padding: 0 10px !important; -} -ng-group-api-quick-common-component .common-scss-group .group-li { - border-radius: 3px; -} -ng-group-api-quick-common-component .eo_theme_gd_div { - background-color: var(--SIDEBAR_BG_ACTIVE); - color: var(--TEXT_ACTIVE); -} -ng-group-api-quick-common-component .eo_theme_gd_div * { - color: var(--TEXT_ACTIVE); -} -ng-group-api-quick-common-component menu-common-component .common_menu_ul .search-div { - width: 100%; - height: 30px; - line-height: 30px; - border-radius: 30px; -} -ng-group-api-quick-common-component menu-common-component .common-menu-fixed-seperate { - position: static; -} -ng-group-api-quick-common-component menu-common-component .common_menu_ul, -ng-group-api-quick-common-component menu-common-component .common_menu_ul .search-form { - height: 40px; - line-height: 40px; -} -ng-group-api-quick-common-component menu-common-component .common_menu_ul .search-form { - width: 100%; -} -ng-group-api-quick-common-component .more-btn-box { - position: relative; -} -ng-group-api-quick-common-component .more-btn-left { - border-radius: 3px 0 0 3px; -} -ng-group-api-quick-common-component .more-btn-right { - border-left: 1px solid rgba(0, 0, 0, 0.1); - border-radius: 0 var(--DEFAULT_BORDER_RADIUS) var(--DEFAULT_BORDER_RADIUS) 0; - padding: 0; -} -ng-group-api-quick-common-component .common-scss-group .group-li { - height: 30px; - margin: 3px 0; -} -ng-group-api-quick-common-component .common-scss-group .group-li:hover { - background-color: var(--SIDEBAR_BG_ACTIVE); - color: var(--TEXT_ACTIVE); -} -ng-group-api-quick-common-component .common-scss-group .group-li:hover * { - color: var(--TEXT_ACTIVE); -} -ng-group-api-quick-common-component .selected { - background-color: var(--SIDEBAR_BG_ACTIVE); - color: var(--TEXT_ACTIVE); -} -ng-group-api-quick-common-component .selected * { - color: var(--TEXT_ACTIVE); -} -ng-group-api-quick-common-component .cc-group-container { - height: 100%; -} -ng-group-api-quick-common-component .cc-group-container .fixed_role { - border-bottom: 1px dashed var(--BORDER); -} -ng-group-api-quick-common-component .cc-group-container .group-ul { - height: -webkit-calc(100% - 82px); - height: -ms-calc(100% - 82px); - height: -moz-calc(100% - 82px); - height: calc(100% - 82px); -} -ng-group-api-quick-common-component .cc-group-container .group-ul .group-li:hover .group-more { - display: flex; -} -ng-group-api-quick-common-component .cc-group-container .group-ul .group-name { - flex-grow: 1; -} -ng-group-api-quick-common-component .cc-group-container .api-list-li:hover .api-more { - display: flex; -} -ng-group-api-quick-common-component .cc-group-container .api-more, -ng-group-api-quick-common-component .cc-group-container .group-more { - display: none; - justify-content: flex-end; -} -ng-group-api-quick-common-component .cc-group-container .group-more:focus, -ng-group-api-quick-common-component .cc-group-container .btn_api_more:focus { - display: flex; -} -ng-group-api-quick-common-component .cc-group-container .child-group-div .group-list-li { - padding-right: 0; -} -ng-group-api-quick-common-component .cc-group-container .child-group-div .group-list-li > .group-li { - padding-left: 44em; -} -ng-group-api-quick-common-component .cc-group-container .child-group-div .group-list-li .group-name { - text-indent: 0; -} -ng-group-api-quick-common-component .cc-group-container .eo_theme_gd_li_fli_a { - background-color: var(--SIDEBAR_BG_ACTIVE); - color: var(--TEXT_ACTIVE); -} -ng-group-api-quick-common-component .cc-group-container .eo_theme_gd_li_fli_a * { - color: var(--TEXT_ACTIVE); -} -ng-group-api-quick-common-component .cc-group-container .group-tips-box { - height: 40px; - line-height: 40px; -} -ng-group-api-quick-common-component .cc-group-container .group-tips-box .api-name { - padding-left: 18px; -} -ng-group-api-quick-common-component .cc-group-container .eo_theme_gqt_li:hover { - background-color: var(--SIDEBAR_BG_ACTIVE); - color: var(--TEXT_ACTIVE); -} -ng-group-api-quick-common-component .cc-group-container .eo_theme_gqt_li:hover .group-more { - display: flex; -} -ng-group-api-quick-common-component .cc-group-container .eo_theme_gqt_li:hover * { - color: var(--TEXT_ACTIVE); -} -ng-group-api-quick-common-component .cc-group-container .api-list-li { - cursor: pointer; - height: 40px; - line-height: 40px; - font-size: 12px; - border-radius: 3px; -} -ng-group-api-quick-common-component .cc-group-container .api-list-li .api-request-type { - font-weight: bold; - max-width: 40px; - width: 40px; - min-width: 40px; - display: inline-block; -} -ng-group-api-quick-common-component .cc-group-container .api-list-li .api-name { - display: inline-block; - white-space: nowrap; - vertical-align: middle; - overflow: hidden; - text-overflow: ellipsis; -} -ng-group-api-quick-common-component .cc-group-container .eo_theme_gd_li_disabled { - color: #757575; - cursor: not-allowed; -} -ng-group-api-quick-common-component .cc-group-container .eo_theme_gd_li_disabled .api-request-type { - color: #757575; -} -ng-group-api-quick-common-component .cc-group-container .api-list-li { - margin: 3px 0; - height: 30px !important; - line-height: 30px !important; -} -ng-group-api-quick-common-component .cc-group-container .recycle-bin { - position: absolute; - bottom: 0; - left: 0; - width: 100%; - padding: 5px 15px; - box-sizing: border-box; - background-color: var(--MAIN_BG); - border-top: 1px solid var(--BORDER); -} -ng-group-api-quick-common-component .cc-group-container .group-ul { - height: calc(100% - 115px) !important; -} - -list-block-common-component .enlarge_btn_lbcc { - height: 26px; - line-height: 26px; - width: max-content; - font-size: 12px; -} -list-block-common-component .zoom_out_btn_lbcc { - font-size: 26px; - width: 50px; - height: 50px; - border-radius: 25px; - border: 1px solid var(--BORDER); - box-shadow: var(--MODAL_SHADOW); - position: fixed; - background-color: var(--MODAL_BG); - z-index: 1; - right: 10px; - top: 61px; -} -list-block-common-component .more-btn-container .btn_more_safldc { - padding: 0 !important; - height: 15px; - width: 15px; - box-sizing: content-box; -} -list-block-common-component .drop_menu_opr_td_tbd { - padding-top: 11px !important; -} -list-block-common-component .full_screen_container_lbcc { - position: fixed; - top: 0; - left: 0; - width: 100%; - z-index: 999; - background-color: #fafafa; - height: 100%; - padding: 51px 0 31px 0; - -ms-animation: full_screen_animation 0.3s; - -moz-animation: full_screen_animation 0.3s; - -webkit-animation: full_screen_animation 0.3s; - animation: full_screen_animation 0.3s; -} -list-block-common-component .full_screen_container_lbcc .wrap_table_container_lbcc { - height: 100%; -} -list-block-common-component .full_screen_container_lbcc .tbody_div_wrap { - overflow-y: auto !important; - height: 100%; - max-height: 100% !important; -} -list-block-common-component .full_screen_container_lbcc .drag_select_conatiner.td-tbd .container-div { - position: relative !important; -} -list-block-common-component .full_screen_container_lbcc .drag_select_conatiner.td-tbd .container-div .list-container-div { - left: 0 !important; -} -list-block-common-component .full_screen_container_lbcc .tr_container_tbd:last-child { - border-bottom: 1px solid var(--BORDER); -} -list-block-common-component .default_screen_container_lbcc { - -ms-animation: zoom_out_screen_animation 1s; - -moz-animation: zoom_out_screen_animation 1s; - -webkit-animation: zoom_out_screen_animation 1s; - animation: zoom_out_screen_animation 1s; -} -list-block-common-component .enlarge_btn_container_lbcc { - bottom: 0; - right: 0; - padding: 5px; - display: none; - border-radius: 3px 3px 0 0; - border-top: 1px solid var(--BORDER); - border-left: 1px solid var(--BORDER); - border-right: 1px solid var(--BORDER); - width: max-content; -} -list-block-common-component .wrap_lbcc { - /* height: 100%; */ -} -list-block-common-component .wrap_lbcc:hover .enlarge_btn_container_lbcc, -list-block-common-component .wrap_lbcc:focus-within .enlarge_btn_container_lbcc { - display: block; -} -list-block-common-component .disable-tbody-div { - cursor: not-allowed; - opacity: 0.5; -} -list-block-common-component .sort-handle-th sort-and-filter-list-default-component { - position: relative; - margin: auto; - display: inline-block; -} -list-block-common-component .focus_tr_lbcc .tr-tbd { - background-color: var(--TABLE_ROW_HOVER_BG) !important; -} -list-block-common-component > .container-div { - border-top: 1px solid var(--BORDER); - border-bottom: 1px solid var(--BORDER); -} -list-block-common-component .hover-tr-lbcc { - cursor: pointer; -} -list-block-common-component .hover-tr-lbcc:hover { - background-color: #fafafa; -} -list-block-common-component .tr-tbd:hover { - background-color: var(--TABLE_ROW_HOVER_BG); -} -list-block-common-component select-default-common-component .container-div { - width: -webkit-calc(100% - 2px); - width: -ms-calc(100% - 2px); - width: -moz-calc(100% - 2px); - width: calc(100% - 2px); -} -list-block-common-component select-default-common-component .text-p { - border-color: transparent; -} -list-block-common-component .desc-cth { - line-height: 27px; - display: inline-block; - margin-left: 5px; -} -list-block-common-component .hide_select_all_desc_cth { - margin-left: 0; -} -list-block-common-component .eo-checkbox { - margin: auto; -} -list-block-common-component input[type='text'], -list-block-common-component .eo-input, -list-block-common-component .eo-textarea { - width: 100%; - border-color: transparent; -} -list-block-common-component input[type='text']:read-only, -list-block-common-component .eo-input:read-only, -list-block-common-component .eo-textarea:read-only { - box-shadow: none; - text-indent: 0; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} -list-block-common-component .sort-handle-td { - padding-top: 10px; -} -list-block-common-component .sort-handle-td span { - width: 23px; - height: 23px; - line-height: 25px; - border-radius: 3px; - color: var(--MAIN_TEXT); - display: inline-block; - text-align: center; - border: 1px solid var(--BORDER); - cursor: move; -} -list-block-common-component .sort-handle-td, -list-block-common-component .sort-handle-th, -list-block-common-component .static_td_hpiae { - width: 30px; - text-align: center; -} -list-block-common-component .sort-handle-td span { - width: 17px; - height: 17px; - line-height: 16px; -} -list-block-common-component .thead-div, -list-block-common-component .tr-tbd { - display: table; - width: 100%; - table-layout: fixed; -} -list-block-common-component .thead-div > div, -list-block-common-component .tr-tbd > div { - display: table-cell; -} -list-block-common-component .thead-div > div:nth-last-child(n + 2), -list-block-common-component .tr-tbd > div:nth-last-child(n + 2) { - border-right: 1px solid var(--DIVIDER); -} -list-block-common-component .tr-tbd { - height: 38px; -} -list-block-common-component .thead-div > div { - vertical-align: middle; -} -list-block-common-component .text-td-tbd { - vertical-align: middle; -} -list-block-common-component .va-top-td-tbd { - vertical-align: top; - padding-top: 4px; -} -list-block-common-component .thead-div > div, -list-block-common-component .text-td-tbd { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} -list-block-common-component .text-td-tbd .depth-td-tbd { - line-height: 38px; -} -list-block-common-component .depth-td-tbd { - position: relative; - height: 100%; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} -list-block-common-component .depth-td-tdb { - white-space: nowrap; - padding-top: 0 !important; -} -list-block-common-component .depth-td-tdb input[type='text'] { - margin-top: 4px; -} -list-block-common-component .checkbox-th, -list-block-common-component .checkbox-td { - width: 30px; - padding-left: 5px; - padding-right: 5px; -} -list-block-common-component .checkbox-td { - padding-top: 9px !important; -} -list-block-common-component .block_cth { - display: block; -} -list-block-common-component .inline_cth { - display: inline-block; -} -list-block-common-component .thead-div { - background-color: var(--TABLE_HEADER_BG); - font-weight: bold; - height: 39px; -} -list-block-common-component .tbody-div > inner-html-common-directive .tr-tbd { - border-top: 1px solid var(--DIVIDER); -} -list-block-common-component .sv-group-helper { - background-color: rgba(221, 221, 221, 0.3); -} -list-block-common-component .sv-group-helper .tr-tbd { - border-top: none; - background-color: transparent; -} -list-block-common-component .sv-group-helper .divide-td-tbd { - visibility: hidden; -} -list-block-common-component .btn-shrink { - text-align: center; - font-size: 24px; - border: none; - background-color: transparent; - line-height: 38px; - margin-left: -5px; - position: absolute; - left: 0; -} -list-block-common-component .btn-shrink:hover { - color: var(--BLUE_NORMAL); -} -list-block-common-component .placeholder-td-tbd { - display: inline-block; - width: 15px; -} -list-block-common-component .divide_line_lbcc { - right: -6px; - top: 0; - width: 10px; - position: absolute; - height: 100%; -} -list-block-common-component .divide-td-tbd { - border-left: 1px solid var(--BORDER); - position: absolute; - height: 100%; - margin-left: -3px; -} -list-block-common-component .first-divide-td-tbd { - top: 10px; - display: none; -} -list-block-common-component .operate-td-tbd { - padding-top: 7px !important; -} -list-block-common-component .operate-td-tbd > div > button:nth-last-child(n + 2) { - padding-right: 10px; - border-right: 1px solid var(--BORDER); -} -list-block-common-component .operate-td-tbd .eo-operate-btn { - min-height: 25px; -} -list-block-common-component .readonly-tbody-div select-default-common-component .disabled-text-p { - border: none; - background-color: #fff; - color: var(--MAIN_TEXT); - padding-left: 0; -} -list-block-common-component .readonly-tbody-div select-default-common-component .text-p { - cursor: default; -} -list-block-common-component .readonly-tbody-div input { - border: none; -} -list-block-common-component .undivide_line_lbcc { - border-right: none !important; -} -list-block-common-component .drag_wrap_lbcc { - width: 100%; - overflow-x: auto; - height: 100%; -} -list-block-common-component .drag_wrap_lbcc .tbody_div_wrap { - height: calc(100% - 40px); - overflow-y: scroll; - min-width: min-content; -} -list-block-common-component .drag_wrap_lbcc .acp-and-file-tbd, -list-block-common-component .drag_wrap_lbcc auto-complete-component { - position: unset !important; -} -list-block-common-component .drag_wrap_lbcc .acp-and-file-tbd_re { - position: relative !important; -} -list-block-common-component .drag_wrap_lbcc .acp-and-file-tbd_re auto-complete-component { - position: relative !important; -} -list-block-common-component .drag_wrap_without_data_lbcc { - width: 100%; - overflow-x: auto; -} -list-block-common-component .drag_wrap_without_data_lbcc .tbody_div_wrap { - height: calc(100% - 40px); -} -list-block-common-component .file-div { - position: relative; -} -list-block-common-component .file-div .file-input { - position: absolute; - right: 5px; - border-radius: 3px; - line-height: 25px; - height: 23px; - border: none; - top: 4.5px; - width: 65px; - z-index: 1; - opacity: 0; - cursor: pointer; -} -list-block-common-component .file-div .file-input:hover + .file-btn-lbt { - background-color: #3faeff; -} -list-block-common-component .file-div .file-btn-lbt { - position: absolute; - right: 5px; - width: 65px; - top: 3.5px; -} -list-block-common-component .disabled-tr-lbcc { - background-color: var(--DISABLE_BG); - color: var(--DISABLE_TEXT); - cursor: not-allowed; -} -list-block-common-component .float-btn-lbt, -list-block-common-component .file-btn-lbt { - border-radius: 3px; - line-height: 25px; - height: 23px; - border: none; - font-size: 12px; - background-color: #2196f3; - color: var(--BTN_TEXT); -} -list-block-common-component .float-btngroup-tbd { - position: absolute; - display: none; - bottom: calc(100% - 4px); - width: -webkit-calc(100% - 20px); - width: -ms-calc(100% - 20px); - width: -moz-calc(100% - 20px); - width: calc(100% - 20px); - width: max-content !important; - left: 5px; - padding: 5px 5px 0 5px; - background-color: var(--COMPONENT_BG); - border-radius: 3px 3px 0 0; - box-shadow: var(--COMPONENT_SHADOW); -} -list-block-common-component .float-btngroup-tbd .float-btn-lbt { - padding: 0 10px; - margin-bottom: 5px; -} -list-block-common-component .float-btngroup-tbd .float-btn-lbt:hover { - background-color: #3faeff; -} -list-block-common-component .float-btngroup-tbd .float-btn-lbt:nth-last-child(n + 2) { - margin-right: 5px; -} -list-block-common-component .acp-tbd, -list-block-common-component .input-tbd, -list-block-common-component .depth-td-tdb, -list-block-common-component .acp-and-file-tbd { - position: relative; -} -list-block-common-component .acp-and-file-tbd_re:focus-within .float-btngroup-tbd, -list-block-common-component .acp-and-file-tbd:focus-within .float-btngroup-tbd, -list-block-common-component .acp-tbd:focus-within .float-btngroup-tbd, -list-block-common-component .input-tbd:focus-within .float-btngroup-tbd, -list-block-common-component .depth-td-tdb:focus-within .float-btngroup-tbd { - display: block; -} -list-block-common-component .float-btngroup-acp-tbd { - right: 25px; -} -list-block-common-component .float-btngroup-input-tbd { - right: 10px; -} -list-block-common-component .more-btn-container { - position: relative; -} -list-block-common-component .disable-checkbox { - cursor: not-allowed; - color: var(--TEXT_DISABLE); - background-color: var(--DISABLE_BG); -} -list-block-common-component .more-div-btngroup-tbd { - background-color: var(--COMPONENT_BG); - box-shadow: var(--COMPONENT_SHADOW); - position: absolute; - border-style: solid; - border-width: 1px; - border-radius: 3px; - right: 0; - z-index: 2; - border-color: var(--BORDER); - display: none; - margin-top: 5px; - cursor: pointer; -} -list-block-common-component .more-div-btngroup-tbd button { - height: 35px; - line-height: 35px; - padding: 0 15px; - text-align: left; - color: #555; - word-break: keep-all; - display: block; -} -list-block-common-component .more-div-btngroup-tbd button:hover { - background-color: var(--DISABLE_BG); - color: var(--MAIN_TEXT); - text-decoration: underline; -} -list-block-common-component .more-btn-container:focus-within .more-div-btngroup-tbd { - display: block; -} -list-block-common-component .more-btn:focus + .more-div-btngroup-tbd { - display: block; -} -list-block-common-component .tfooter-div { - background-color: var(--TABLE_HEADER_BG); - display: flex; - padding: 0 var(--GLOBAL_PLATE_PADDING); - flex-direction: row; - justify-content: flex-end; - align-items: center; - box-shadow: var(--COMPONENT_SHADOW); - height: 60px; - line-height: 60px; - border-top: 1px solid var(--BORDER); - text-align: center; - position: relative; -} -list-block-common-component .tfooter-div > div { - position: absolute; - left: 20px; -} -list-block-common-component .tfooter-div .pagination { - display: flex; - align-items: center; -} -list-block-common-component .tfooter-div .pagination .first-page, -list-block-common-component .tfooter-div .pagination .last-page { - border-radius: 3px; -} -list-block-common-component .tfooter-div .pagination > .active, -list-block-common-component .tfooter-div .pagination > .active:hover, -list-block-common-component .tfooter-div .pagination > .active:focus, -list-block-common-component .tfooter-div .pagination > .active, -list-block-common-component .tfooter-div .pagination > .active:hover, -list-block-common-component .tfooter-div .pagination > .active:focus { - background-color: var(--MAIN_TEXT); -} -list-block-common-component .tfooter-div .pagination > .active a, -list-block-common-component .tfooter-div .pagination > .active:hover a, -list-block-common-component .tfooter-div .pagination > .active:focus a, -list-block-common-component .tfooter-div .pagination > .active a, -list-block-common-component .tfooter-div .pagination > .active:hover a, -list-block-common-component .tfooter-div .pagination > .active:focus a { - color: #fff; -} -list-block-common-component .tfooter-div .pagination-prev .iconfont, -list-block-common-component .tfooter-div .pagination-next .iconfont { - font-weight: bold; -} -list-block-common-component .tfooter-div .pagination-prev { - margin-right: 15px; -} -list-block-common-component .tfooter-div .pagination-next { - margin-left: 15px; -} -list-block-common-component .tfooter-div .pagination-page { - width: 25px; - height: 25px; - line-height: 25px; - border-radius: 3px; - margin-right: 5px; -} -list-block-common-component .had_select_drag_wrap_lbcc .tr-tbd { - border-top: none !important; -} -list-block-common-component .had_select_drag_wrap_lbcc .thead-div { - border-bottom: 1px solid var(--BORDER); -} -list-block-common-component .had_select_drag_wrap_lbcc .new_item_tr_hpiae .tr-tbd:hover { - background-color: transparent; -} -list-block-common-component .had_select_drag_wrap_lbcc .tbody_div_wrap { - overflow-y: initial; -} -list-block-common-component .had_select_drag_wrap_lbcc .new_td_item_container { - border-right: none !important; -} -list-block-common-component .had_select_drag_wrap_lbcc .tr_container_tbd:nth-last-child(n + 2) .tr-tbd { - border-bottom: 1px solid var(--BORDER); -} -list-block-common-component .had_select_drag_wrap_lbcc .tr_container_tbd { - border-right: 1px solid transparent; - border-left-color: transparent; -} -list-block-common-component .had_select_drag_wrap_lbcc .thead-div > div:first-child { - border-left: 2px solid; - border-left-color: transparent; -} -list-block-common-component .had_select_drag_wrap_lbcc .tr-tbd { - border-top: none !important; - border-left-color: inherit; -} -list-block-common-component .had_select_drag_wrap_lbcc .tr-tbd > div:first-child { - border-left: 2px solid; - border-left-color: inherit; -} -list-block-common-component .had_select_drag_wrap_lbcc .select_conatiner_lbcc { - position: unset !important; -} -list-block-common-component .had_select_drag_wrap_lbcc .select_conatiner_lbcc .container-div { - position: unset !important; -} -list-block-common-component .had_select_drag_wrap_lbcc .select_conatiner_lbcc .list-container-div { - width: 180px; -} -list-block-common-component .had_select_drag_wrap_lbcc .select_conatiner_lbcc auto-complete-component { - position: unset !important; -} - -list-default-common-component { - display: block; -} -list-default-common-component .common_scss_list .first_level_article thead tr { - height: 40px; -} -list-default-common-component .first_level_article { - width: 100%; -} -list-default-common-component th { - overflow: initial !important; -} -list-default-common-component .fixed-height-list { - overflow-y: hidden; -} -list-default-common-component .fixed-height-list .thead_container_ldcc { - overflow-y: initial !important; - overflow-x: initial !important; - min-width: min-content; -} -list-default-common-component .fixed-height-list .tbody_container_ldcc { - position: absolute; - width: 100%; - display: inherit; - overflow-y: scroll; - height: calc(100% - 41px); - overflow-x: hidden; - min-width: min-content; -} -list-default-common-component .list-default-tbody tr:hover { - background-color: var(--TABLE_ROW_HOVER_BG); -} -list-default-common-component .thead_container_ldcc { - z-index: 1; - position: relative; - overflow-x: hidden; - background-color: var(--TABLE_HEADER_BG); -} -list-default-common-component .ccr:hover { - border-right: 3px solid rgba(255, 150, 0, 0.3); -} -list-default-common-component .unplaceholder_thead_ldcc tr { - height: 0 !important; - line-height: 0; -} -list-default-common-component .common_scss_list .first_level_article td, -list-default-common-component .common_scss_list .first_level_article th { - padding-left: 15px; -} -list-default-common-component .placeholder_item { - background-color: transparent; -} -list-default-common-component .select_all_box { - width: 36px; - border: 1px solid var(--BORDER); - padding: 3px; - border-radius: 3px; -} -list-default-common-component .select_all_box .eo-checkbox { - width: 20px; - margin-right: 0px; - height: 20px; - line-height: 20px; -} -list-default-common-component .select_all_box .iconfont { - font-weight: normal; -} -list-default-common-component .select_all_show_more { - line-height: 20px; - padding-left: 4px; -} -list-default-common-component .placeholder_item { - padding: 10px; -} -list-default-common-component .select_all_placeholder { - z-index: 1; - padding-top: 12px; - margin-left: 15px; - margin-top: -17px; -} -list-default-common-component .select_all_placeholder .select_all_ul { - font-weight: normal; - border: 1px solid var(--BORDER); - border-radius: 3px; -} -list-default-common-component .select_all_placeholder .select_all_item { - height: 30px; - line-height: 30px; - padding: 0 10px; - cursor: pointer; - font-size: 12px; -} -list-default-common-component .conatiner_ldcc { - position: relative; - height: 100%; -} -list-default-common-component .conatiner_ldcc_draggable { - overflow-x: auto; -} -list-default-common-component .conatiner_ldcc_draggable .thead_container_ldcc { - overflow-y: initial !important; - overflow-x: initial !important; -} -list-default-common-component .conatiner_ldcc_has_footer { - height: calc(100% - 32px); -} -list-default-common-component .divide_line_ldcc { - border-right: 1px solid rgba(0, 0, 0, 0.05); - right: 0; - top: 0; - position: absolute; - height: 100%; -} -list-default-common-component .th_bdr_none .divide_line_ldcc, -list-default-common-component th:last-child .divide_line_ldcc { - display: none; -} -list-default-common-component .hover_th_ldcc { - cursor: pointer; -} -list-default-common-component .hover_th_ldcc:hover { - background-color: #efefef; -} -list-default-common-component .focus_orderby { - color: #ff0000; -} -list-default-common-component .un_focus_orderBy { - color: rgba(51, 51, 51, 0.2); -} -list-default-common-component .more-btn { - display: inline-block; - line-height: initial; -} -list-default-common-component .footer { - border-top: 1px solid var(--BORDER); -} -list-default-common-component .btn-shrink { - position: absolute; - text-align: center; - font-size: 24px; - border: none; - margin-top: -5px; - left: 0; -} -list-default-common-component .btn-shrink:hover { - color: var(--BLUE_NORMAL); -} - -.group_and_list_container .fixed-height-list { - position: absolute; - height: -webkit-calc(100% - 41px); - height: -ms-calc(100% - 41px); - height: -moz-calc(100% - 41px); - height: calc(100% - 41px); - width: -webkit-calc(100% - 0px); - width: -ms-calc(100% - 0px); - width: -moz-calc(100% - 0px); - width: calc(100% - 0px); -} - -.only_fixed_list_container { - margin: var(--GLOBAL_PLATE_PADDING); -} -.only_fixed_list_container .fixed-height-list { - position: relative; -} - -list-group-common-component article { - background-color: var(--MAIN_BG); - color: var(--MAIN_TEXT); -} -list-group-common-component .icon-folder { - color: #eaad00; -} -list-group-common-component .thead_container { - z-index: 1; - position: relative; - border-top: 1px solid var(--BORDER); -} -list-group-common-component .thead_container thead { - background-color: var(--TABLE_HEADER_BG); -} -list-group-common-component .tbody_container { - height: -webkit-calc(100% - 80px); - height: -ms-calc(100% - 80px); - height: -moz-calc(100% - 80px); - height: calc(100% - 80px); - overflow-y: auto; - overflow-x: hidden; - margin-top: -40px; -} -list-group-common-component .tbody_container thead { - visibility: hidden; -} -list-group-common-component .catalog-navgition .catalog-child { - color: var(--BLUE_NORMAL); -} -list-group-common-component .catalog-navgition .all:last-child .catalog-child { - color: var(--MAIN_TEXT) !important; -} -list-group-common-component .catalog-navgition .cp:hover { - text-decoration: underline; -} -list-group-common-component .bottom-count-div { - padding: 0 28px; - height: 33px; - line-height: 33px; - background-color: var(--TABLE_HEADER_BG); - color: var(--TEXT_TITLE_SEC); - border-top: 1px solid var(--BORDER); -} -list-group-common-component .common_scss_list .first_level_article { - border-top: none !important; -} -list-group-common-component .common_scss_list .first_level_article tbody .btn-return-last-level td { - border-bottom: 1px solid var(--BORDER); -} -list-group-common-component .more-btn { - display: inline-block; - line-height: initial; -} -list-group-common-component .iconfont { - vertical-align: middle; -} -list-group-common-component .default_scss_list .eo-operate-btn, -list-group-common-component .common_scss_list .first_level_article .eo-operate-btn { - padding-left: 0; - border-left: 0px solid var(--BORDER); -} -list-group-common-component .eo-operate-btn:hover { - text-decoration: none; -} - -list-page-common-component { - display: flex; - flex-direction: column; - height: calc(100vh - 81px); - z-index: 5; -} -list-page-common-component .tbody_container_ldcc { - overflow-y: auto; - height: -webkit-calc(100% - 41px); - height: -ms-calc(100% - 41px); - height: -moz-calc(100% - 41px); - height: calc(100% - 41px); -} -list-page-common-component list-default-common-component { - overflow: auto; - width: 100%; - height: calc(100% - 41px); -} -list-page-common-component .common_scss_list .first_level_article { - margin-bottom: 0px; - border-radius: 0px; -} -list-page-common-component .common_scss_list .first_level_article .list-default-tbody tr:last-child td { - border-bottom: none; -} -list-page-common-component .thead_container_ldcc, -list-page-common-component .tbody_container_ldcc { - overflow-y: scroll; -} - -@keyframes load { - 0% { - -webkit-transform: rotate(0deg); - transform: rotate(0deg); - } - 100% { - -webkit-transform: rotate(360deg); - transform: rotate(360deg); - } -} -loading-common-component .loading-content { - top: 109px; - left: -webkit-calc(50% - 75px); - left: -ms-calc(50% - 75px); - left: -moz-calc(50% - 75px); - left: calc(50% - 75px); - position: fixed; - z-index: 10; -} -loading-common-component .loading-content .loading { - width: 135PX; - height: 35px; - box-shadow: var(--COMPONENT_SHADOW); - padding-left: 10px; - border-radius: var(--DEFAULT_BORDER_RADIUS); - background-color: #333; -} -loading-common-component .loading-content .container_lcc { - height: 35px; - line-height: 35px; - text-align: left; - color: #fff; -} -loading-common-component .loading-content .iconfont { - color: #fff; -} -loading-common-component .loading-content .loading_icon_container_lcc { - -ms-animation: load 1.7s infinite ease; - -moz-animation: load 1.7s infinite ease; - -webkit-animation: load 1.7s infinite ease; - animation: load 1.7s infinite ease; - display: inline-block; - margin-right: 10px; -} - -@keyframes load { - 0% { - -webkit-transform: rotate(0deg); - transform: rotate(0deg); - } - 100% { - -webkit-transform: rotate(360deg); - transform: rotate(360deg); - } -} -loading-Part-Common-Component .loading-content { - z-index: 10; -} -loading-Part-Common-Component .loading-content .loading { - padding: 10px; - border-radius: 3px; -} -loading-Part-Common-Component .loading-content .loading li { - height: 50px; - line-height: 50px; - text-align: center; - color: #999; -} -loading-Part-Common-Component .loading-content .loading li .iconfont { - font-size: 18px; - color: #999; -} -loading-Part-Common-Component .loading-content .loading li div { - -ms-animation: load 1.7s infinite ease; - -moz-animation: load 1.7s infinite ease; - -webkit-animation: load 1.7s infinite ease; - animation: load 1.7s infinite ease; - display: inline-block; - margin-right: 10px; -} - -menu-common-component { - background-color: var(--MAIN_BG); - color: var(--MAIN_TEXT); - display: flex; - overflow: hidden; -} -menu-common-component .batch_item_container:last-child > .vertical_divide_line_mdcc { - display: none; -} -menu-common-component .common_menu_ul { - padding: 0 15px; - width: 100%; - height: 40px; - line-height: 40px; - margin-top: var(--GLOBAL_PLATE_PADDING); - border-right: 1px solid var(--BORDER); - background-color: var(--MAIN_BG); -} -menu-common-component .common_menu_ul .list_item_mcc:first-child .more-btn-box .more-btn-div, -menu-common-component .common_menu_ul .menu-title + .list_item_mcc .more-btn-box .more-btn-div, -menu-common-component .common_menu_ul .to_left_list_item_mcc .more-btn-box .more-btn-div { - right: auto; - left: 0; -} -menu-common-component .common_menu_ul .only_drop_menu_btn_mcc { - height: 50px; -} -menu-common-component .common_menu_ul .list_mtc { - border: none; -} -menu-common-component .common_menu_ul .menu-title { - float: left; -} -menu-common-component .common_menu_ul .eo_more_btn:focus + .wrap_div_mcc { - display: block; -} -menu-common-component .common_menu_ul .attr_placeholder_mcc { - font-size: 14px !important; -} -menu-common-component .common_menu_ul .common-btn { - line-height: 27px; - display: inline-block; - text-align: center; -} -menu-common-component .common_menu_ul .common-btn .iconfont { - font-size: 24px; - margin-right: 5px; -} -menu-common-component .common_menu_ul .common-btn:hover { - color: var(--BLUE_NORMAL); -} -menu-common-component .common_menu_ul .common-btn:hover .disabled-tip { - display: block; -} -menu-common-component .common_menu_ul .common-btn:disabled { - color: #999; - cursor: not-allowed; -} -menu-common-component .common_menu_ul .common-btn:disabled .iconfont { - color: #999; - cursor: not-allowed; -} -menu-common-component .common_menu_ul .block-btn .iconfont { - margin-right: 0; -} -menu-common-component .common_menu_ul .block-btn:hover { - color: #fff; -} -menu-common-component .common_menu_ul .block-btn:disabled { - background-color: var(--DISABLE_BG); - color: var(--DISABLE_TEXT); - border: 1px solid var(--BORDER); -} -menu-common-component .common_menu_ul .more-btn-box { - position: relative; - margin-right: 15px; -} -menu-common-component .common_menu_ul .more-btn-box .more-btn-left { - border-radius: 3px 0 0 3px; -} -menu-common-component .common_menu_ul .more-btn-box .more-btn-right { - border-left: 1px solid rgba(0, 0, 0, 0.1); - border-radius: 0 3px 3px 0; - padding: 0; -} -menu-common-component .common_menu_ul .more-btn-box .more-btn-right:focus + .more-btn-div { - display: block; -} -menu-common-component .common_menu_ul .more-btn-box .more-btn-div { - position: absolute; - right: 0; - z-index: 2; - display: none; - margin-top: 5px; -} -menu-common-component .common_menu_ul .more-btn-box .more-btn-div .more-btn-list { - background-color: #fff; - border: 1px solid var(--BORDER); - border-radius: 3px; -} -menu-common-component .common_menu_ul .more-btn-box .more-btn-div .more-btn-list li { - height: 35px; - line-height: 35px; - cursor: pointer; - text-align: left; - min-width: 60px; - padding: 0 10px; - white-space: nowrap; -} -menu-common-component .common_menu_ul .more-btn-box .more-btn-div .more-btn-list li:hover, menu-common-component .common_menu_ul .more-btn-box .more-btn-div .more-btn-list li:focus, menu-common-component .common_menu_ul .more-btn-box .more-btn-div .more-btn-list li:active { - background-color: #fafafa; - text-decoration: underline; -} -menu-common-component .common_menu_ul .block-btn .iconfont, -menu-common-component .common_menu_ul .more-btn-left .iconfont, -menu-common-component .common_menu_ul .more-btn-right .iconfont { - font-size: 14px; -} -menu-common-component .common_menu_ul .default-btn { - border-style: solid; - border-width: 1px; - border-radius: 3px; -} -menu-common-component .common_menu_ul .fun-list-li { - text-align: center; -} -menu-common-component .common_menu_ul .fun-list-li .iconfont { - cursor: pointer; - font-size: 14px; -} -menu-common-component .common_menu_ul .fun-list-li button:hover { - color: var(--BLUE_NORMAL); -} -menu-common-component .common_menu_ul .fun-list-li button:hover .list_function_wrap { - display: block; -} -menu-common-component .common_menu_ul .fun-list-li .disabled-btn, -menu-common-component .common_menu_ul .fun-list-li .eo_more_btn:disabled { - color: #999; - cursor: not-allowed; -} -menu-common-component .common_menu_ul .fun-list-li .disabled-btn .iconfont, -menu-common-component .common_menu_ul .fun-list-li .eo_more_btn:disabled .iconfont { - color: #999; - cursor: not-allowed; -} -menu-common-component .common_menu_ul .fun-list-li .disabled-btn .list_function_wrap, -menu-common-component .common_menu_ul .fun-list-li .eo_more_btn:disabled .list_function_wrap { - display: none; -} -menu-common-component .common_menu_ul .fun-list-li .list_function_wrap { - position: absolute; - cursor: default; - margin-top: -1px; - display: none; - z-index: 4; - color: var(--MAIN_TEXT); - box-shadow: var(--COMPONENT_SHADOW); -} -menu-common-component .common_menu_ul .fun-list-li .list_function_wrap .nav-function { - background-color: var(--COMPONENT_BG); - border: 1px solid var(--BORDER); - border-radius: 3px; -} -menu-common-component .common_menu_ul .fun-list-li .list_function_wrap .nav-function li { - height: 35px; - line-height: 35px; - cursor: pointer; - text-align: left; - min-width: 60px; - padding: 0 10px; - white-space: nowrap; -} -menu-common-component .common_menu_ul .fun-list-li .list_function_wrap .nav-function li:hover, menu-common-component .common_menu_ul .fun-list-li .list_function_wrap .nav-function li:focus, menu-common-component .common_menu_ul .fun-list-li .list_function_wrap .nav-function li:active { - background-color: #fafafa; -} -menu-common-component .common_menu_ul .fun-list-li .list_function_wrap .nav-function .strong-li { - font-weight: bold; - color: var(--BLUE_NORMAL); -} -menu-common-component .common_menu_ul .batch_cancel_ldcc + .fun-list-li { - margin-left: 0; -} -menu-common-component .common_menu_ul .combo_box_mdcc { - line-height: 51px; -} -menu-common-component .common_menu_ul .vertical_divide_line_mdcc { - color: var(--BORDER); -} -menu-common-component .common_menu_ul .divide-span { - border-right: 1px solid var(--BORDER); - margin-right: 15px; - height: 20px; -} -menu-common-component .common_menu_ul .elem-active { - cursor: default; - background-color: var(--GREEN_TAG_BG); - color: var(--GREEN_TAG_TEXT); -} -menu-common-component .common_menu_ul .menu-li { - border-style: solid; - border-width: 1px; - border-radius: 3px; - overflow: hidden; - margin-right: 5px; -} -menu-common-component .common_menu_ul .menu-li a { - padding: 0 20px; - height: 30px; - line-height: 30px; - display: inline-block; -} -menu-common-component .common_menu_ul .first-menu-li { - margin-left: 5px; -} -menu-common-component .common_menu_ul .menu-navigation { - position: absolute; - bottom: 0; -} -menu-common-component .common_menu_ul .menu-navigation li { - cursor: pointer; - height: 40px; - line-height: 40px; - padding: 0 15px; - text-align: center; - margin-right: 2px; - border-bottom-style: solid; - border-bottom-width: 3px; -} -menu-common-component .common_menu_ul .search-form { - height: 40px; - z-index: 2; - right: 0; -} -menu-common-component .common_menu_ul .search-tips { - color: #9e9e9e; - background-color: #ededed; - height: 30px; - line-height: 30px; - border: 1px solid var(--BORDER); - padding: 0 10px; - border-radius: 3px 0 0 3px; - cursor: default; -} -menu-common-component .common_menu_ul .search-div { - height: 28px; - line-height: 28px; - width: 100px; - border: 1px solid var(--BORDER); - background-color: var(--INPUT_BG); - border-radius: 28px; - transition: width 0.3s linear 0s; - overflow: hidden; - white-space: nowrap; -} -menu-common-component .common_menu_ul .search-div .search-input { - background-color: transparent; - width: 100%; - height: 100%; - padding-right: 10px; - border: none; -} -menu-common-component .common_menu_ul .search-div .search-tap-box { - border-radius: 3px; - left: 25px; - background-color: var(--DISABLE_BG); - height: 20px; - line-height: 20px; -} -menu-common-component .common_menu_ul .search-div .search-text { - border-right: 1px solid var(--BORDER); - padding: 0 5px; - max-width: 130px; - text-overflow: ellipsis; - transition: max-width 0.1s linear 0s; - overflow: hidden; -} -menu-common-component .common_menu_ul .search-div .search-tap .iconfont:hover { - color: var(--RED_NORMAL); -} -menu-common-component .common_menu_ul .search-input-width-200 { - width: 200px; -} -menu-common-component .common_menu_ul .search-div-advanced .advanced-btn { - display: none; - height: 20px; - line-height: 20px; - min-width: 24px; -} -menu-common-component .common_menu_ul .search-div-advanced:hover .search-input, menu-common-component .common_menu_ul .search-div-advanced:focus .search-input { - width: calc(100% - 75px); -} -menu-common-component .common_menu_ul .search-div-advanced:hover .search-text, menu-common-component .common_menu_ul .search-div-advanced:focus .search-text { - max-width: 75px; -} -menu-common-component .common_menu_ul .search-div-advanced:hover .advanced-btn, menu-common-component .common_menu_ul .search-div-advanced:focus .advanced-btn { - display: initial; -} -menu-common-component .common_menu_ul .menu-ml15 { - margin-left: 15px; -} -menu-common-component .common_menu_ul .menu-ml10 { - margin-left: 10px; -} -menu-common-component .common_menu_ul .menu-mr15 { - margin-right: 15px; -} -menu-common-component .common_menu_ul .menu-mr10 { - margin-right: 10px; -} -menu-common-component .common_menu_ul .menu-mr5 { - margin-right: 5px; -} -menu-common-component .common_menu_ul .menu-mr0 { - margin-right: 0; -} -menu-common-component .common_menu_ul .menu-ml0 { - margin-left: 0 !important; -} -menu-common-component .content_box_menu_mcc { - border: 0 none; - margin-top: 0; -} -menu-common-component .common-menu-lg { - padding: 20px; - height: auto; - line-height: initial; -} -menu-common-component .common-menu-lg .menu-title { - float: none; - margin-bottom: 15px; -} -menu-common-component .can-operate-placeholder { - height: 92px; -} -menu-common-component .can-operate-has-second-title-placeholder { - height: 131px; -} -menu-common-component .disabled-operate-placeholder { - height: 63px; -} -menu-common-component .disabled-operate-has-second-title-placeholder { - height: 123px; -} -menu-common-component .common-menu-md { - height: 90px; -} -menu-common-component .common-menu-fixed-seperate { - margin: 0; - border-left: none; - border-bottom: 1px solid var(--BORDER); - position: fixed; - z-index: 4; -} -menu-common-component .inside_page_menu_mcc { - box-shadow: none; - background-color: #f8f8f8; - padding: 0 20px; -} -menu-common-component .fixed_menu_mcc { - box-shadow: none; - background-color: var(--MAIN_BG); - padding: 0 var(--GLOBAL_PLATE_PADDING); -} -menu-common-component .divide-li { - line-height: 60px; -} -menu-common-component .tsc_ul { - margin-top: 3px; -} -menu-common-component .view-btn-li > ul { - border-radius: 3px; - overflow: hidden; -} -menu-common-component .view-btn-li > ul .view-common-btn { - cursor: pointer; - height: 30px; - line-height: 30px; - text-align: center; - padding: 0 10px; - border: 1px solid var(--BORDER); -} -menu-common-component .view-btn-li > ul .view-common-btn + .view-common-btn { - margin-left: 0; - border-left-style: none; -} -menu-common-component .un-margin-left { - margin-left: 0; -} -menu-common-component .disabled-tip { - position: absolute; - margin-top: -69px; - z-index: 10; - display: none; -} -menu-common-component .disabled-tip .tip-div { - padding: 10px; - float: unset; - line-height: initial; - border-radius: 3px; - background-color: #000; - color: #fff; - font-size: 12px; - text-align: left; - max-width: 500px; - min-width: 200px; -} -menu-common-component .disabled-tip .arrow-div { - border-color: #000 transparent transparent transparent; - border-width: 5px 5px 0 5px; - border-style: solid; - width: 0; - margin-left: 8px; -} -menu-common-component .block-btn .disabled-tip { - margin-top: -75px; -} - -.shrink-div .common-menu-fixed-seperate { - width: calc(100% - (51px + var(--GLOBAL_PLATE_PADDING))); -} -.shrink-div .common-menu-lg { - width: calc(100% - (71px + var(--GLOBAL_PLATE_PADDING))); -} - -.tab_block_list_mcc .checkbox-th, -.tab_block_list_mcc .checkbox-td { - border-right: none; -} -.tab_block_list_mcc .tbody-div { - max-height: 200px; - overflow: auto; -} -.tab_block_list_mcc .thead-div, -.tab_block_list_mcc .tr-tbd { - height: 30px; -} -.tab_block_list_mcc .checkbox-td { - padding-top: 7px !important; -} - -menu-radio-common-component button:nth-child(n + 2) { - margin-left: 15px; -} -menu-radio-common-component span { - display: inline-block; - line-height: 30px; -} -menu-radio-common-component .disabled_btn { - cursor: not-allowed; -} - -select-default-common-component { - display: block; -} -select-default-common-component .disabled_tile_btn_sdcc { - cursor: not-allowed !important; - color: var(--DISABLE_TEXT); -} -select-default-common-component .disabled_tile_btn_sdcc .square_checkbox { - background-color: var(--DISABLE_BG); - color: var(--DISABLE_TEXT); -} -select-default-common-component .container-div { - width: -webkit-calc(100% - 2px); - width: -ms-calc(100% - 2px); - width: -moz-calc(100% - 2px); - width: calc(100% - 2px); - display: block; - position: relative; - color: var(--MAIN_TEXT); -} -select-default-common-component .container-div:hover .preview-text-p { - border-color: var(--GREEN_LIGHT); - transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1); -} -select-default-common-component .search-p { - background-color: var(--INPUT_BG); - height: 40px; - padding: 0 10px; - line-height: 42px; -} -select-default-common-component .search-p input[type='text'] { - border: none; - background: transparent; - height: 40px; -} -select-default-common-component .search-p .icon-sousuo { - font-size: 16px; - padding-right: 5px; -} -select-default-common-component .search-p input[type='text'] { - width: 100%; -} -select-default-common-component .search-p button { - height: 28px; - line-height: 28px; - padding: 0 10px; - margin-top: 6px; - font-size: 12px; - width: 60px; -} -select-default-common-component .container-focus .list-container-div { - display: block; -} -select-default-common-component .input-text:focus + .list-container-div, -select-default-common-component .container-div:focus-within .list-container-div { - display: block; - position: fixed; -} -select-default-common-component .preview-text-p span:first-child { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - display: block; -} -select-default-common-component .square_checkbox { - border: 1px solid var(--BORDER); - height: 15px; - line-height: 15px; - border-radius: 3px; - margin-right: 10px; - width: 15px; - text-align: center; -} -select-default-common-component .arrow-span { - position: absolute; - right: 5px; - top: 1px; - height: 28px; -} -select-default-common-component .multiple_select .icon-sousuo, -select-default-common-component .multiple_select .item_text { - border-left: 1px solid var(--BORDER); - text-indent: 10px; -} -select-default-common-component .container-div:focus-within .preview-text-p { - border-color: var(--GREEN_DEEP); -} -select-default-common-component .opacity-text-input { - position: absolute; - opacity: 0; - z-index: 1; - top: 0; -} -select-default-common-component .opacity-text-input:focus { - z-index: -1; -} -select-default-common-component .opacity-text-input:disabled { - cursor: not-allowed; -} -select-default-common-component .hide-node { - z-index: -1; -} -select-default-common-component .text-p { - border: 1px solid var(--BORDER); - background-color: var(--INPUT_BG); - border-radius: 3px; - color: var(--MAIN_TEXT); - height: 28px; - line-height: 30px; - padding: 0 5px; - width: 100%; - cursor: pointer; - font-size: 12px; - overflow: hidden; -} -select-default-common-component .disabled_preview_text_p { - color: #999; - background-color: var(--DISABLED_BG); -} -select-default-common-component .list-container-div { - border-radius: 3px; - color: var(--MAIN_TEXT); - background-color: var(--COMPONENT_BG); - border: 1px solid var(--BORDER); - width: 100%; - min-width: max-content; - margin-top: 2px; - font-size: 12px; - position: absolute; - box-shadow: var(--COMPONENT_SHADOW); - z-index: 10; - display: none; -} -select-default-common-component .query-container-child-div { - max-height: 210px; - overflow: auto; -} -select-default-common-component p{ - margin-bottom: 0; -} -select-default-common-component .common-class-item { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - border-bottom: 1px solid var(--BORDER); - cursor: pointer; -} -select-default-common-component .common-class-item:last-child { - border-bottom: none; -} -select-default-common-component .common-class-item:hover { - background-color: var(--LIST_ITEM_BG_HOVER); -} -select-default-common-component .un-search-response-p, -select-default-common-component .common-class-item { - height: 35px; - line-height: 35px; - padding: 0 10px; -} -select-default-common-component .tile_container_div .common_class_tile_item { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - cursor: pointer; -} -select-default-common-component .tile_container_div.f_row_ac { - margin-top: -10px; -} -select-default-common-component .tile_container_div.f_row_ac .common_class_tile_item { - margin-right: 20px; -} -select-default-common-component .tile_container_div.f_row_ac .common_class_tile_item { - margin-top: 10px; -} -select-default-common-component .tile_container_div.f_column .common_class_tile_item + .common_class_tile_item { - margin-top: 10px; -} - -select-multi-common-component:hover .text_container_select_multi_cc { - border: 1px solid var(--GREEN_LIGHT); - transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1); -} -select-multi-common-component .container_select_multi_cc { - display: block; - position: relative; -} -select-multi-common-component .text_container_select_multi_cc { - border: 1px solid var(--BORDER); - background-color: var(--INPUT_BG); - border-radius: 3px; - color: var(--MAIN_TEXT); - height: 32px; - line-height: 32px; - padding: 0 10px; - cursor: pointer; - font-size: 12px; - box-sizing: border-box; -} -select-multi-common-component .text_select_multi_cc { - width: -webkit-calc(100% - 12px); - width: -ms-calc(100% - 12px); - width: -moz-calc(100% - 12px); - width: calc(100% - 12px); - display: block; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} -select-multi-common-component .opacity_text_select_multi_cc { - width: 100%; - box-sizing: border-box; - height: 30px; - position: absolute; - top: 1px; - opacity: 0; - cursor: pointer; -} -select-multi-common-component .opacity_text_select_multi_cc:disabled { - cursor: not-allowed; -} -select-multi-common-component .opacity_text_select_multi_cc:focus { - z-index: -1; -} -select-multi-common-component .container_select_multi_cc:focus-within .drop_container_select_multi_cc { - display: block; -} -select-multi-common-component .container_select_multi_cc:focus-within .text_container_select_multi_cc { - border-color: var(--GREEN_DEEP); -} -select-multi-common-component .opacity_text_select_multi_cc:focus + .drop_container_select_multi_cc { - display: block; -} -select-multi-common-component .disabled_select_multi_cc { - background-color: var(--DISABLE_BG); - color: var(--DISABLE_TEXT); -} -select-multi-common-component .drop_container_select_multi_cc { - border-radius: 3px; - background-color: var(--COMPONENT_BG); - border: 1px solid var(--BORDER); - width: 100%; - margin-top: 5px; - font-size: 12px; - position: absolute; - box-shadow: var(--COMPONENT_SHADOW); - z-index: 5; - display: none; -} -select-multi-common-component .list_select_multi_cc { - max-height: 353px; - overflow: auto; -} -select-multi-common-component .search_select_multi_cc { - background-color: var(--SEC_BG); - height: 40px; - padding: 0 10px; - line-height: 42px; -} -select-multi-common-component .search_select_multi_cc input[type='text'], -select-multi-common-component .search_select_multi_cc button { - border: none; - background: transparent; - height: 40px; -} -select-multi-common-component .search_select_multi_cc .iconfont { - font-size: 16px; - padding-right: 5px; -} -select-multi-common-component .search_select_multi_cc input[type='text'] { - width: 100%; -} -select-multi-common-component .search_select_multi_cc input[type='button'] { - height: 28px; - line-height: 26px; - padding: 0 10px; - margin-top: 6px; -} -select-multi-common-component .item_select_multi_cc { - cursor: pointer; -} -select-multi-common-component .item_select_multi_cc:hover { - background-color: var(--LIST_ITEM_BG_HOVER); -} -select-multi-common-component .loading_select_multi_cc, -select-multi-common-component .none_select_multi_cc, -select-multi-common-component .item_select_multi_cc { - height: 35px; - line-height: 35px; - padding: 0 10px; -} -@keyframes load { - 0% { - -webkit-transform: rotate(0deg); - transform: rotate(0deg); - } - 100% { - -webkit-transform: rotate(360deg); - transform: rotate(360deg); - } -} -select-multi-common-component .loading_animation_select_multi_cc { - -ms-animation: load 1.7s infinite ease; - -moz-animation: load 1.7s infinite ease; - -webkit-animation: load 1.7s infinite ease; - animation: load 1.7s infinite ease; -} - -select-multi-data-common-component:hover .text_container_select_multi_cc { - border: 1px solid var(--GREEN_LIGHT); - transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1); -} -select-multi-data-common-component .container_select_multi_cc { - display: block; - position: relative; -} -select-multi-data-common-component .text_container_select_multi_cc { - border: 1px solid var(--BORDER); - background-color: var(--INPUT_BG); - border-radius: 3px; - color: var(--MAIN_TEXT); - height: 32px; - line-height: 32px; - padding: 0 10px; - cursor: pointer; - font-size: 12px; - box-sizing: border-box; -} -select-multi-data-common-component .text_select_multi_cc { - width: -webkit-calc(100% - 12px); - width: -ms-calc(100% - 12px); - width: -moz-calc(100% - 12px); - width: calc(100% - 12px); - display: block; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} -select-multi-data-common-component .opacity_text_select_multi_cc { - width: 100%; - box-sizing: border-box; - height: 30px; - position: absolute; - top: 1px; - opacity: 0; - cursor: pointer; -} -select-multi-data-common-component .opacity_text_select_multi_cc:disabled { - cursor: not-allowed; -} -select-multi-data-common-component .highlight { - color: #fa5a1b; -} -select-multi-data-common-component .container_select_multi_cc:focus-within .text_container_select_multi_cc { - border-color: var(--GREEN_DEEP); -} -select-multi-data-common-component .disabled_select_multi_cc { - color: var(--TEXT_DISABLE); - background-color: var(--DISABLE_BG); -} -select-multi-data-common-component .drop_container_select_multi_cc { - border-radius: 3px; - background-color: var(--COMPONENT_BG); - border: 1px solid var(--BORDER); - width: 100%; - margin-top: 5px; - font-size: 12px; - position: absolute; - box-shadow: var(--COMPONENT_SHADOW); - z-index: 5; -} -select-multi-data-common-component .list_select_multi_cc { - max-height: 353px; - overflow: auto; -} -select-multi-data-common-component .search_select_multi_cc { - background-color: var(--SEC_BG); - height: 40px; - padding: 0 10px; - line-height: 42px; -} -select-multi-data-common-component .search_select_multi_cc input[type='text'], -select-multi-data-common-component .search_select_multi_cc button { - border: none; - background: transparent; - height: 40px; -} -select-multi-data-common-component .search_select_multi_cc .iconfont { - font-size: 16px; - padding-right: 5px; -} -select-multi-data-common-component .search_select_multi_cc input[type='text'] { - width: 100%; -} -select-multi-data-common-component .search_select_multi_cc input[type='button'] { - height: 28px; - line-height: 26px; - padding: 0 10px; - margin-top: 6px; -} -select-multi-data-common-component .item_select_multi_cc { - cursor: pointer; -} -select-multi-data-common-component .item_select_multi_cc:hover { - background-color: var(--LIST_ITEM_BG_HOVER); -} -select-multi-data-common-component .loading_select_multi_cc, -select-multi-data-common-component .none_select_multi_cc, -select-multi-data-common-component .item_select_multi_cc { - height: 35px; - line-height: 35px; - padding: 0 10px; -} -@keyframes load { - 0% { - -webkit-transform: rotate(0deg); - transform: rotate(0deg); - } - 100% { - -webkit-transform: rotate(360deg); - transform: rotate(360deg); - } -} -select-multi-data-common-component .loading_animation_select_multi_cc { - -ms-animation: load 1.7s infinite ease; - -moz-animation: load 1.7s infinite ease; - -webkit-animation: load 1.7s infinite ease; - animation: load 1.7s infinite ease; -} - -select-multistage-common-component .disabled-text-p { - color: var(--TEXT_DISABLE) !important; - cursor: not-allowed !important; - background-color: var(--DISABLE_BG) !important; -} -select-multistage-common-component .container-div { - width: 100%; - display: block; - position: relative; -} -select-multistage-common-component .text-div { - border: 1px solid var(--BORDER); - background-color: var(--INPUT_BG); - border-radius: 3px; - color: var(--MAIN_TEXT); - height: 30px; - line-height: 30px; - padding: 0 10px; - cursor: pointer; - font-size: 12px; - box-sizing: border-box; -} -select-multistage-common-component .text-div:hover { - border-color: var(--GREEN_NORMAL); - transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1); -} -select-multistage-common-component .text-div:focus { - border-color: var(--GREEN_DEEP); -} -select-multistage-common-component .text-div:disabled { - color: var(--DISABLE_BG); - cursor: not-allowed; - background-color: var(--TEXT_DISABLE); -} -select-multistage-common-component .select-item-div { - width: -webkit-calc(100% - 12px); - width: -ms-calc(100% - 12px); - width: -moz-calc(100% - 12px); - width: calc(100% - 12px); - display: block; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} -select-multistage-common-component .list-container-div { - border-radius: 3px; - color: var(--MAIN_TEXT); - background-color: var(--COMPONENT_BG); - border: 1px solid var(--BORDER); - width: 100%; - margin-top: 5px; - font-size: 12px; - position: absolute; - box-shadow: var(--COMPONENT_SHADOW); - z-index: 5; -} -select-multistage-common-component .query-container-child-div { - max-height: 353px; - overflow: auto; -} -select-multistage-common-component .search-p { - background-color: var(--INPUT_BG); - height: 40px; - padding: 0 10px; - line-height: 42px; -} -select-multistage-common-component .search-p input[type='text'], -select-multistage-common-component .search-p button { - border: none; - background: transparent; - height: 40px; -} -select-multistage-common-component .search-p .iconfont { - font-size: 16px; - padding-right: 5px; -} -select-multistage-common-component .search-p input[type='text'] { - width: 100%; -} -select-multistage-common-component .search-p input[type='button'] { - height: 28px; - line-height: 26px; - padding: 0 10px; - margin-top: 6px; -} -select-multistage-common-component .common-class-item { - cursor: pointer; -} -select-multistage-common-component .common-class-item:hover { - background-color: var(--LIST_ITEM_BG_HOVER); -} -select-multistage-common-component .common-class-item .iconfont { - color: var(--MAIN_TEXT); -} -select-multistage-common-component .un-search-response-p, -select-multistage-common-component .common-class-item { - height: 35px; - line-height: 35px; - padding: 0 10px; -} - -select-person-common-component .container-div { - width: 278px; - display: block; - position: relative; -} -select-person-common-component .container-div:focus-within .list-container-div { - display: block; -} -select-person-common-component .opacity-text-input:focus + .list-container-div { - display: block; -} -select-person-common-component .opacity-text-input { - position: absolute; - opacity: 0; - top: 0; -} -select-person-common-component .opacity-text-input:focus { - z-index: -1; -} -select-person-common-component .opacity-text-input:disabled { - cursor: not-allowed; -} -select-person-common-component .opacity-text-input:disabled + .preview-text-p { - background-color: var(--DISABLE_BG); - color: var(--DISABLE_TEXT); -} -select-person-common-component .opacity-text-input:hover + .preview-text-p { - border-color: #999; - transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1); -} -select-person-common-component .opacity-text-input:focus + .preview-text-p { - border-color: var(--GREEN_DEEP); -} -select-person-common-component .icon-guanbi { - border: none; - background-color: transparent; - position: relative; - height: 0; - line-height: 32px; - margin-top: -32px; - margin-right: 10px; -} -select-person-common-component .sp_check_box { - border: 1px solid var(--BORDER); - height: 15px; - line-height: 15px; - border-radius: 3px; - width: 15px; - margin-right: 10px; - text-align: center; -} -select-person-common-component .hide-node { - z-index: -1; -} -select-person-common-component .logo-img { - background-color: var(--BORDER); - background-size: contain; - width: 16px; - height: 16px; - display: inline-block; - border-radius: 9px; -} -select-person-common-component .name_span { - max-width: 100px; -} -select-person-common-component .multiple_select_preview .name_span::after { - content: ','; -} -select-person-common-component .multiple_select_preview .sp_select_text:nth-last-of-type(1) .name_span::after { - content: ''; -} -select-person-common-component .text-p { - border: 1px solid var(--BORDER); - background-color: var(--INPUT_BG); - border-radius: 3px; - color: var(--MAIN_TEXT); - height: 32px; - line-height: 32px; - padding: 0 10px; - width: 100%; - cursor: pointer; - font-size: 12px; - overflow: hidden; - box-sizing: border-box; -} -select-person-common-component .text_p_with_btn_cancel { - padding-right: 30px; -} -select-person-common-component .disabled-text-p { - cursor: not-allowed; - background-color: var(--DISABLE_BG); - color: var(--DISABLE_TEXT); -} -select-person-common-component .disabled-text-p:hover { - border-color: var(--BORDER); -} -select-person-common-component .list-container-div { - border-radius: 3px; - color: var(--MAIN_TEXT); - background-color: var(--COMPONENT_BG); - border: 1px solid var(--BORDER); - width: 100%; - margin-top: 5px; - font-size: 12px; - position: absolute; - box-shadow: var(--COMPONENT_SHADOW); - z-index: 4; - display: none; -} -select-person-common-component .select-active-item { - background-color: #edf1f1; -} -select-person-common-component .open_select_ul .list-container-div { - display: block; -} -select-person-common-component .open_select_ul .opacity-text-input { - height: 0; -} -select-person-common-component .query-container-child-div { - max-height: 353px; - overflow: auto; -} -select-person-common-component .search-p { - background-color: var(--INPUT_BG); - height: 40px; - padding: 0 10px; - line-height: 42px; -} -select-person-common-component .search-p input[type='text'], -select-person-common-component .search-p button { - border: none; - background: transparent; - height: 40px; -} -select-person-common-component .search-p .iconfont { - font-size: 16px; - padding-right: 5px; -} -select-person-common-component .search-p input[type='text'] { - width: 100%; -} -select-person-common-component .search-p input[type='button'] { - height: 28px; - line-height: 26px; - padding: 0 10px; - margin-top: 6px; -} -select-person-common-component .common-class-item { - cursor: pointer; -} -select-person-common-component .common-class-item:hover { - background-color: var(--LIST_ITEM_BG_HOVER); -} -select-person-common-component .un-search-response-p, -select-person-common-component .common-class-item { - height: 35px; - line-height: 35px; - padding: 0 10px; -} - -select-switch-common-component .switch-box { - height: 40px; - line-height: 40px; -} -select-switch-common-component .switch-box .icon-huadongkaiguan-dakai { - color: var(--GREEN_NORMAL); -} - -tab-select-common-component .tsc_item_li { - height: 30px; - line-height: 30px; - text-align: center; - padding: 0 10px; - cursor: pointer; - border: 1px solid var(--BORDER); -} -tab-select-common-component .m_tab_a { - background-color: var(--GREEN_TAG_BG); - color: var(--GREEN_TAG_TEXT); -} -tab-select-common-component .tsc_item_li:nth-child(n + 2) { - border-left: none; -} -tab-select-common-component .tsc_item_li:first-child { - border-radius: 3px 0 0 3px; -} -tab-select-common-component .tsc_item_li:last-child { - border-radius: 0 3px 3px 0; -} -tab-select-common-component .pull-right .datepicker_time_directive { - right: 0; - z-index: 5; -} -tab-select-common-component .disabled_tscc .tsc_item_li { - cursor: not-allowed; - color: var(--DISABLE_TEXT); -} -tab-select-common-component .disabled_tscc .m_tab_a { - background-color: var(--DISABLE_BG); -} -tab-select-common-component .disabled_tscc .checkbox_tscc { - background-color: var(--DISABLE_BG); - color: #ccc; - cursor: not-allowed; - border: 1px solid var(--BORDER); -} -tab-select-common-component .disabled_tscc .checkbox_tscc .eo-checkbox { - border: 1px solid var(--BORDER); -} -tab-select-common-component .minus_margin { - margin-right: -5px; -} -tab-select-common-component .checkbox_tscc { - margin-right: 5px; - border-radius: 3px; - height: 30px; - padding: 5px; - border: 1px solid var(--BORDER); -} -tab-select-common-component .no_btn { - border: 0 none; - background-color: initial; - padding: 0; -} - -.tsc_ul.f_row_ac { - margin-top: -10px; -} -.tsc_ul.f_row_ac .tsc_item_li, -.tsc_ul.f_row_ac .checkbox_tscc { - margin-top: 10px; -} - -env-Operate-Product-Component { - z-index: 0; -} -env-Operate-Product-Component menu-common-component .common_menu_ul .common-btn { - height: 32px !important; -} -env-Operate-Product-Component .new_text_input_hpiae { - border-right: none !important; - width: 190px; -} -env-Operate-Product-Component .new_text_input_hpiae input[type='text'] { - border-color: #999; -} -env-Operate-Product-Component .eo_more_btn:focus + .wrap_div_hpiae { - display: block; -} -env-Operate-Product-Component .tab_list_container_hpiae { - right: 30px; -} -env-Operate-Product-Component .wrap_div_hpiae { - z-index: 4; - color: var(--MAIN_TEXT); - box-shadow: var(--COMPONENT_SHADOW); - width: 200px; - line-height: 30px; - border: 1px solid var(--BORDER); - background-color: var(--COMPONENT_BG); - font-size: 12px; - display: none; - right: -11px; -} -env-Operate-Product-Component .wrap_div_hpiae .checkbox-th, -env-Operate-Product-Component .wrap_div_hpiae .checkbox-td { - border-right: none; -} -env-Operate-Product-Component .wrap_div_hpiae .tbody-div { - max-height: 200px; - overflow: auto; -} -env-Operate-Product-Component .wrap_div_hpiae .thead-div, -env-Operate-Product-Component .wrap_div_hpiae .tr-tbd { - height: 30px; -} -env-Operate-Product-Component .wrap_div_hpiae .checkbox-td { - padding-top: 7px !important; -} -env-Operate-Product-Component .wrap_div_hpiae:hover { - display: block; -} -env-Operate-Product-Component .api_staus_panel1_hpiae { - background-color: rgba(0, 121, 91, 0.1); -} -env-Operate-Product-Component .api_staus_panel2_hpiae { - background-color: rgba(255, 212, 0, 0.2); -} -env-Operate-Product-Component .api_staus_panel3_hpiae { - background-color: rgba(255, 0, 14, 0.1); -} -env-Operate-Product-Component select-multistage-common-component { - width: 276px; -} -env-Operate-Product-Component select-multistage-common-component .text-div { - border-radius: 3px 0 0 3px; -} -env-Operate-Product-Component package-Admin-Component { - padding: 0 !important; -} -env-Operate-Product-Component .structure_data_hpiae { - line-height: 35px; - border-top: 1px solid #e79f06; -} -env-Operate-Product-Component .divide_line_hpiae { - margin-top: -2px; -} -env-Operate-Product-Component .structure_item_bg { - background-color: rgba(255, 247, 227, 0.5); -} -env-Operate-Product-Component .sv-group-helper .structure_data_hpiae { - display: none; -} -env-Operate-Product-Component .defualt_menu.container_hpiae { - padding: 90px 20px var(--GLOBAL_PLATE_PADDING) 20px; -} -env-Operate-Product-Component .first_level_article select-default-common-component .container-div { - max-width: 248px; -} -env-Operate-Product-Component .first_level_article .first_part { - padding: var(--GLOBAL_PLATE_PADDING); -} -env-Operate-Product-Component .first_level_article .first_part .part-div { - line-height: 32px; -} -env-Operate-Product-Component .first_level_article .first_part .part-div:nth-child(n + 2) { - padding-top: 10px; -} -env-Operate-Product-Component .first_level_article .first_part select-default-common-component .container-div { - width: 80px; -} -env-Operate-Product-Component .first_level_article .first_part .wider_select_default_component .container-div { - width: 275px; -} -env-Operate-Product-Component .first_level_article .first_part .center-sdcc .container-div .text-p { - border-radius: 0; -} -env-Operate-Product-Component .first_level_article .first_part tag-ams-component { - width: -webkit-calc(100% - 50px); - width: -ms-calc(100% - 50px); - width: -moz-calc(100% - 50px); - width: calc(100% - 50px); -} -env-Operate-Product-Component .first_level_article .item_part header { - padding: 10px var(--GLOBAL_PLATE_PADDING) 10px var(--GLOBAL_PLATE_PADDING); - border-bottom: 1px solid var(--BORDER); -} -env-Operate-Product-Component .first_level_article .item_part header .send-format { - color: var(--BLUE_NORMAL); - text-align: center; - height: 30px; - line-height: 30px; - border: 1px solid #bcdffb; - background-color: #e3f7ff; - border-radius: 3px; - padding: 0 10px; - font-size: 12px; -} -env-Operate-Product-Component .first_level_article .item_part header .send-format:hover { - background-color: var(--BLUE_NORMAL); - color: #fff; -} -env-Operate-Product-Component .first_level_article .json-root-type-div .eo-select { - width: auto; -} -env-Operate-Product-Component .first_level_article .eo-static-hidden { - border: none; - padding: 0; - margin: 0; -} -env-Operate-Product-Component .first_level_article .request-param-part .eo-static-hidden { - margin-top: 0; -} -env-Operate-Product-Component .first_level_article .remark-part article { - min-height: 237px; -} -env-Operate-Product-Component .first_level_article .raw-rp { - border: none; - width: -webkit-calc(100% - 20px); - width: -ms-calc(100% - 20px); - width: -moz-calc(100% - 20px); - width: calc(100% - 20px); - height: 100px; - padding: 10px; - background-color: var(--INPUT_BG); - display: flex; -} -env-Operate-Product-Component .ace-table { - margin-top: 20px; - border-spacing: 0; - width: 100%; - box-shadow: var(--COMPONENT_SHADOW); -} - -.list_container_safldc { - font-weight: initial; - font-size: 12px; - min-width: 150px; -} -.list_container_safldc .thead-div, -.list_container_safldc .tr-tbd { - height: 30px; -} -.list_container_safldc .search_safldc { - text-indent: 30px; - width: 100%; - box-sizing: border-box; - line-height: 28px; - font-size: 12px; - border: none; - background-color: var(--INPUT_BG); -} -.list_container_safldc .tbody-div { - max-height: 200px; - overflow: auto; -} -.list_container_safldc .eo-operate-btn { - border-left: none !important; -} -.list_container_safldc .checkbox-td { - padding-top: 6px !important; -} - -.btn_more_safldc { - line-height: 13px !important; - font-size: 12px !important; - padding: 2px 3px; - border: 1px solid var(--BORDER); - border-radius: 3px; - color: var(--MAIN_TEXT); -} -.btn_more_safldc:disabled { - background-color: var(--DISABLE_BG); - cursor: not-allowed; -} - -.active_btn_more_safldc { - color: var(--BLUE_NORMAL); -} - -.sort_btn_safldc:hover { - color: var(--BLUE_NORMAL); -} - -.block_list_safldc { - text-align: left; -} - -.container_scfldc:focus-within .list_container_safldc { - display: initial; -} - -.modal-open .modal-content .ams-modal-response-demo { - width: 80% !important; -} -.modal-open .modal-content .ams_show_db_field { - width: 610px; -} -.modal-open .modal-content .ams_show_db_field .btn { - display: inline-block; - padding: 0 15px; - border-radius: 3px; - font-size: 12px; - height: 35px; - line-height: 35px; - color: #999; - background-color: #f2f2f2; -} -.modal-open .modal-content .ams_show_db_field .title { - color: #a0a0a0; - font-weight: bold; - font-size: 12px; -} -.modal-open .modal-content .ams_show_db_field .btn-yellowfill { - background-color: #f59856; - color: #fff; -} -.modal-open .modal-content .ams_show_db_field .btn-bluefill { - background-color: #2296f3; - color: #fff; -} -.modal-open .modal-content .ams_show_db_field .btn-greenfill { - background-color: #4caf50; - color: #fff; -} -.modal-open .modal-content .ams_select_db_field { - width: 800px; -} -.modal-open .modal-content .ams_select_db_field .eo-had-input-error .preview-text-p { - border-color: var(--RED_NORMAL); -} -.modal-open .modal-content .ams_select_db_field .eo-had-input-error .preview-text-p * { - color: var(--RED_NORMAL); -} -.modal-open .modal-content .ams_select_db_field select-default-common-component .query-container-child-div { - max-width: 450px; -} -.modal-open .modal-content .ams-modal-mock-setting { - width: 80%; - text-align: left; - -ms-animation: fade 0.2s; - -moz-animation: fade 0.2s; - -webkit-animation: fade 0.2s; - animation: fade 0.2s; - box-shadow: var(--MODAL_SHADOW); - background-color: var(--MODAL_BG); - position: unset; -} -.modal-open .modal-content .ams-modal-plug-api-status { - width: 700px; - text-align: left; - -ms-animation: fade 0.2s; - -moz-animation: fade 0.2s; - -webkit-animation: fade 0.2s; - animation: fade 0.2s; - box-shadow: var(--MODAL_SHADOW); - background-color: var(--MODAL_BG); -} -.modal-open .modal-content .ams-modal-plug-api-status .status-tab { - width: 120px; - height: 35px; - border-width: 1px; - border-style: solid; - border-color: var(--BORDER); -} -.modal-open .modal-content .ams-modal-plug-api-status .status-tab:hover { - background-color: var(--TABLE_ROW_HOVER_BG); - border-color: var(--BORDER); - border-radius: 3px; -} -.modal-open .modal-content .ams-modal-plug-api-status .elem-active { - background-color: var(--TABLE_ROW_HOVER_BG); - border-color: var(--BORDER); - border-radius: 3px; -} -.modal-open .modal-content .ams-modal-add-api-project { - min-width: 800px; - width: 70%; - text-align: left; - box-shadow: var(--MODAL_SHADOW); - background-color: var(--MODAL_BG); -} -.modal-open .modal-content .ams-modal-add-api-project .thead-table { - line-height: 40px; - border-spacing: 0; - table-layout: fixed; - width: 100%; - background: var(--TABLE_HEADER_BG); - border-bottom: 1px dashed var(--BORDER); -} -.modal-open .modal-content .ams-modal-add-api-project .thead-table th { - padding-left: 20px; -} -.modal-open .modal-content .ams-modal-add-api-project .tbody-div { - overflow-y: auto; - height: 400px; -} -.modal-open .modal-content .ams-modal-add-api-project .tbody-table { - width: 100%; - border-spacing: 0; - table-layout: fixed; -} -.modal-open .modal-content .ams-modal-add-api-project .tbody-table .iconfont { - cursor: pointer; -} -.modal-open .modal-content .ams-modal-add-api-project .tbody-table tr:nth-child(odd) { - background: #fafafa; -} -.modal-open .modal-content .ams-modal-add-api-project .tbody-table tr:nth-child(even) { - background: #fff; -} -.modal-open .modal-content .ams-modal-add-api-project .tbody-table tr { - height: 40px; - line-height: 40px; -} -.modal-open .modal-content .ams-modal-add-api-project .tbody-table tr:hover { - background: #f0f0f0; - cursor: pointer; -} -.modal-open .modal-content .ams-modal-add-api-project .tbody-table tr:hover .icon-eo_star-outline { - display: inline-block; -} -.modal-open .modal-content .ams-modal-add-api-project .tbody-table td { - color: #666; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - padding-left: 20px; -} -.modal-open .modal-content .ams-modal-add-api-project .tbody-table .elem-active:nth-child(odd), .modal-open .modal-content .ams-modal-add-api-project .tbody-table .elem-active:nth-child(even) { - background-color: #ffecb3; -} -.modal-open .modal-content .ams-modal-add-api-project group-default-common-Component .cc-group-container { - border: none; - border-right: 1px solid var(--BORDER); -} -.modal-open .modal-content .ams-modal-add-api-project table .required-td { - width: 50px; - text-align: center; - padding-left: 0; -} -.modal-open .modal-content .ams-modal-add-api-project table .second-th { - width: 55%; -} -.modal-open .modal-content .ams-modal-code { - width: 600px; - text-align: left; - -ms-animation: fade 0.2s; - -moz-animation: fade 0.2s; - -webkit-animation: fade 0.2s; - animation: fade 0.2s; - box-shadow: var(--MODAL_SHADOW); - background-color: var(--MODAL_BG); - border-radius: 3px; -} -.modal-open .modal-content .ams-modal-test-example-admin { - width: 90%; - text-align: left; - -ms-animation: fade 0.2s; - -moz-animation: fade 0.2s; - -webkit-animation: fade 0.2s; - animation: fade 0.2s; - box-shadow: var(--MODAL_SHADOW); - background-color: var(--MODAL_BG); - position: unset; -} - -home-project-default { - display: block; -} -home-project-default .title-p { - line-height: 50px; - border-bottom: 1px solid var(--BORDER); - color: #999; -} -home-project-default .divide-span { - font-size: 16px; - line-height: 48px; -} -home-project-default .button-spreed { - line-height: 48px; -} - -home-project-inside .env-li { - position: fixed; - right: 108px; - height: 30px; - line-height: 30px; - z-index: 6; -} -home-project-inside .env-sm-menu-top { - margin-top: calc(11px + var(--GLOBAL_PLATE_PADDING)); -} -home-project-inside .env-md-menu-top { - right: 0px; -} - -ng-home-project-inside .env-li { - position: fixed; - right: 108px; - height: 30px; - line-height: 30px; - z-index: 6; -} -ng-home-project-inside .env-sm-menu-top { - margin-top: calc(11px + var(--GLOBAL_PLATE_PADDING)); -} -ng-home-project-inside .env-md-menu-top { - right: 15px; -} - -.private_admin_open_api_modal { - width: 615px; - text-align: left; - -ms-animation: fade 0.2s; - -moz-animation: fade 0.2s; - -webkit-animation: fade 0.2s; - animation: fade 0.2s; - box-shadow: var(--MODAL_SHADOW); - background-color: #fff; -} -.private_admin_open_api_modal .get_link { - text-align: center; -} -.private_admin_open_api_modal .get_link input { - cursor: pointer; - width: 100%; -} -.private_admin_open_api_modal .get_link .copy-tips { - margin-top: -29px; - position: relative; - font-size: 12px; - color: #999; - background-color: #fff; - padding: 0 10px; - margin-right: 1px; - line-height: 28px; - cursor: pointer; -} -.private_admin_open_api_modal .get_link .copy-success { - color: var(--BTN_PRIMARY_BG); -} -.private_admin_open_api_modal .get_link .copy-error { - color: #c6533b; -} -.private_admin_open_api_modal .tips_div { - font-size: 12px; - padding: 20px; - background-color: #f3f3f3; - border: 1px solid #d7d7d7; - border-radius: 3px; -} - -.vspex-modal-select-public-file { - width: 640px; - text-align: left; - border-radius: 5px; - -ms-animation: fade 0.2s; - -moz-animation: fade 0.2s; - -webkit-animation: fade 0.2s; - animation: fade 0.2s; - box-shadow: var(--MODAL_SHADOW); - background-color: #fff; - overflow: hidden; -} -.vspex-modal-select-public-file article input { - margin: 10px 0 20px 0; - width: 100%; - text-indent: 28px; -} -.vspex-modal-select-public-file article .search-btn { - position: absolute; - top: 15px; - font-size: 20px; - left: 9px; -} - -.vspex-modal-change-password { - width: 500px; - text-align: left; - -ms-animation: fade 0.2s; - -moz-animation: fade 0.2s; - -webkit-animation: fade 0.2s; - animation: fade 0.2s; - box-shadow: var(--MODAL_SHADOW); - background-color: #fff; -} -.vspex-modal-change-password .eo-input { - width: 100%; -} - -.vspex-modal-upload-file article .container-li:nth-child(n + 2) { - margin-top: 10px; -} -.vspex-modal-upload-file article .group-ul { - display: inline-block; -} -.vspex-modal-upload-file article .group-ul .eo-input { - margin-top: 10px; - width: 100%; - display: inline-block; - line-height: 25px; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} -.vspex-modal-upload-file article .group-ul label { - color: #999; - cursor: pointer; -} -.vspex-modal-upload-file article .group-ul select { - text-indent: 0; - color: #333; -} -.vspex-modal-upload-file article .group-inherit { - width: 100%; -} -.vspex-modal-upload-file article .group-name { - width: 60%; -} -.vspex-modal-upload-file article .group-select:nth-last-child(n + 2) { - width: -webkit-calc(33.33333% - 10px); - width: -ms-calc(33.33333% - 10px); - width: -moz-calc(33.33333% - 10px); - width: calc(33.33333% - 10px); - margin-right: 10px; -} -.vspex-modal-upload-file article .group-select:last-child { - width: -webkit-calc(33.33333% - 1px); - width: -ms-calc(33.33333% - 1px); - width: -moz-calc(33.33333% - 1px); - width: calc(33.33333% - 1px); -} - -ams-api-case-opr-modal-component .uri_container input:first-child { - border-right: none; - border-radius: 3px 0 0 3px; -} -ams-api-case-opr-modal-component .uri_container input:nth-child(2) { - border-radius: 0; - border-right: none; -} -ams-api-case-opr-modal-component .uri_container input:last-child { - border-radius: 0 3px 3px 0; - border-right: 1px solid var(--BORDER); - background-color: var(--INPUT_BG); -} -ams-api-case-opr-modal-component .second-level-div { - height: 100%; -} -ams-api-case-opr-modal-component .second-level-div > article { - width: -webkit-calc(100% - 40px); - width: -ms-calc(100% - 40px); - width: -moz-calc(100% - 40px); - width: calc(100% - 40px); - height: -webkit-calc(100% - 143px); - height: -ms-calc(100% - 143px); - height: -moz-calc(100% - 143px); - height: calc(100% - 143px); -} -ams-api-case-opr-modal-component .second-level-div > article .title-p { - line-height: 40px; - margin-top: 10px; -} -ams-api-case-opr-modal-component .second-level-div > article .form-ul { - display: inline-flex; - width: 100%; -} -ams-api-case-opr-modal-component .second-level-div > article .form-ul select-default-common-component .container-div { - width: 80px; -} -ams-api-case-opr-modal-component .second-level-div > article .form-ul .method-li { - margin-right: 5px; -} -ams-api-case-opr-modal-component .second-level-div > article .form-ul .uri-li { - width: -webkit-calc(100% - 2px); - width: -ms-calc(100% - 2px); - width: -moz-calc(100% - 2px); - width: calc(100% - 2px); -} -ams-api-case-opr-modal-component .second-level-div > article .form-ul .uri-li input[type="text"] { - width: 100%; - border-radius: 0 3px 3px 0; -} -ams-api-case-opr-modal-component .second-level-div > article .regex-p { - margin-bottom: 10px; -} -ams-api-case-opr-modal-component .request_protocol_select_amtea .container-div { - width: 80px; -} -ams-api-case-opr-modal-component .request_type_select_amtea .preview-text-p { - border-radius: 0; - width: 70px; -} -ams-api-case-opr-modal-component .item_part header { - padding: 10px 15px 10px 15px; - min-height: 30px; - border-bottom: 1px solid var(--BORDER); -} -ams-api-case-opr-modal-component .item_part header .send-format { - color: var(--BLUE_NORMAL); - text-align: center; - height: 30px; - line-height: 30px; - border: 1px solid #bcdffb; - padding: 0 10px; - font-size: 12px; - background-color: #e3f7ff; -} -ams-api-case-opr-modal-component .item_part header .send-format:hover { - background-color: var(--BLUE_NORMAL); - color: #fff; -} -ams-api-case-opr-modal-component .item_part header .send-format:hover * { - color: #fff; -} -ams-api-case-opr-modal-component .eo-static-hidden { - border: none; -} -ams-api-case-opr-modal-component .request-header-part header { - border-bottom: 1px solid var(--BORDER); -} -ams-api-case-opr-modal-component .request-header-part header .icon-record { - font-size: 12px; - color: #a2e602; -} -ams-api-case-opr-modal-component .request-param-part header { - border-bottom: 1px solid var(--BORDER); -} -ams-api-case-opr-modal-component .request-param-part header .form-to-json-btn { - text-align: center; - margin-left: 5px; - height: 30px; - line-height: 30px; - border: 1px solid var(--BLUE_NORMAL); - color: var(--BLUE_NORMAL); - border-radius: 3px; - padding: 0 5px; -} -ams-api-case-opr-modal-component .request-param-part header .form-to-json-btn .eo-checkbox { - margin: 6px 5px 0 0; - height: 15px; - line-height: 15px; - width: 15px; -} -ams-api-case-opr-modal-component .inject-code-part table td { - padding-left: 0; -} - -api-case-test { - line-height: initial; -} -api-case-test .td-tbd { - border-bottom: 1px solid var(--BORDER); -} -api-case-test .tr-tbd { - border-top: none !important; -} -api-case-test .test_status_tips { - font-size: 12px; - width: 42px; - text-align: center; -} -api-case-test .float_case_inside_report { - width: 80%; - min-width: 850px; - margin-left: 20px; - position: fixed; - top: 50px; - height: 100%; - border-left: 1px solid var(--BORDER); - transition: right 300ms; - margin-bottom: -50px; - box-shadow: var(--COMPONENT_SHADOW); - z-index: 8; -} -api-case-test .float_case_inside_report .last_column_content, -api-case-test .float_case_inside_report .first_column .wrap_table_container_lbcc { - overflow: auto; - height: calc(100vh - 140px); -} -api-case-test .fcir_eo_to_right { - right: 100%; -} -api-case-test .acr_mask { - z-index: 7; - opacity: 0.5; - position: fixed; - background: #2d2525; - width: 100%; - height: 100%; - top: 0; - left: 0; -} -api-case-test .acr_block_title { - background-color: var(--TABLE_HEADER_BG); - font-weight: bold; - border-bottom: 1px solid var(--BORDER); - padding: 5px 10px; -} -api-case-test .has_script_report .collection_list { - overflow: auto; - height: calc(100vh - 334px); -} -api-case-test .first_column { - width: 225px; - flex-shrink: 0; - border-right: 1px solid var(--BORDER); -} -api-case-test .first_column list-block-common-component .tr-tbd { - height: 75px; -} -api-case-test .first_column .thead_div_wrap { - display: none; -} -api-case-test .first_column .ts_detail { - font-size: 12px; - min-width: 115px; - line-height: 1.2rem; -} -api-case-test .second_column { - width: 225px; - flex-shrink: 0; - border-right: 1px solid var(--BORDER); -} -api-case-test .select_elem_active { - background-color: #fff0e6; - color: var(--MAIN_TEXT); -} -api-case-test .disabled_select_elem { - color: #999; - cursor: not-allowed; -} -api-case-test .last_column { - flex: 1; - width: 0; -} -api-case-test .arc_list_item { - height: 40px; - padding: 0px 10px; - border-bottom: 1px solid var(--BORDER); -} -api-case-test .see_test_history { - position: absolute; - right: 50px; - top: 166px; -} - -.lds_spinner { - color: official; - display: inline-block; - position: relative; - width: 80px; - height: 80px; -} - -.lds_spinner div { - transform-origin: 40px 40px; - animation: lds_spinner 1.2s linear infinite; -} - -.lds_spinner div:after { - content: " "; - display: block; - position: absolute; - top: 3px; - left: 37px; - width: 8px; - height: 15px; - border-radius: 20%; - background: #999; -} - -.lds_spinner div:nth-child(1) { - transform: rotate(0deg); - animation-delay: -1.3s; -} - -.lds_spinner div:nth-child(2) { - transform: rotate(45deg); - animation-delay: -1.1s; -} - -.lds_spinner div:nth-child(3) { - transform: rotate(90deg); - animation-delay: -0.9s; -} - -.lds_spinner div:nth-child(4) { - transform: rotate(135deg); - animation-delay: -0.7s; -} - -.lds_spinner div:nth-child(5) { - transform: rotate(180deg); - animation-delay: -0.5s; -} - -.lds_spinner div:nth-child(6) { - transform: rotate(225deg); - animation-delay: -0.3s; -} - -.lds_spinner div:nth-child(7) { - transform: rotate(270deg); - animation-delay: 0.1s; -} - -.lds_spinner div:nth-child(8) { - transform: rotate(315deg); - animation-delay: 0s; -} - -@keyframes lds_spinner { - 0% { - opacity: 1; - } - 100% { - opacity: 0; - } -} -ng-home-project-inside .env-li { - position: fixed; - right: 108px; - height: 30px; - line-height: 30px; - z-index: 6; -} -ng-home-project-inside .env-sm-menu-top { - margin-top: calc(11px + var(--GLOBAL_PLATE_PADDING)); -} -ng-home-project-inside .env-md-menu-top { - right: 15px; -} -ng-home-project-inside ng-home-project-inside-api-list .common_scss_list .fixed-height-list { - height: -webkit-calc(100% - 82px); - height: -ms-calc(100% - 82px); - height: -moz-calc(100% - 82px); - height: calc(100% - 82px); -} -ng-home-project-inside ng-home-project-inside-code-list .none_add_group_list .common_scss_list .fixed-height-list { - height: -webkit-calc(100% - 41px); - height: -ms-calc(100% - 41px); - height: -moz-calc(100% - 41px); - height: calc(100% - 41px); -} -ng-home-project-inside ng-home-project-inside-code-list .child_group_list .common_scss_list .fixed-height-list { - height: -webkit-calc(100% - 123px); - height: -ms-calc(100% - 123px); - height: -moz-calc(100% - 123px); - height: calc(100% - 123px); -} -ng-home-project-inside ng-home-project-inside-code-list list-default-common-component .first_level_article { - border-top: none !important; -} -ng-home-project-inside ng-home-project-inside-code-list list-default-common-component .first_level_article .tbody_container_ldcc .list-default-tbody tr td:nth-child(2) .list-edit-cur-item { - padding-left: 0px; -} -ng-home-project-inside ng-home-project-inside-code-list list-default-common-component .first_level_article .eo-operate-btn { - margin-left: 10px; -} -ng-home-project-inside ng-home-project-inside-code-list list-default-common-component .fixed-height-list .tbody_container_ldcc { - height: 100% !important; -} -ng-home-project-inside > .container-div { - width: 100%; -} -ng-home-project-inside > .container-div .home-project-inside-default menu-common-component { - width: calc(100% - 19px); -} -ng-home-project-inside > .container-div .home-project-inside-default .batch-test-btn tip-directive .iconfont { - margin-right: -5px; - color: rgba(255, 255, 255, 0.9); -} -ng-home-project-inside > .container-div .home-project-inside-default .batch-test-btn .tip-directive-none .iconfont { - color: #999; -} -ng-home-project-inside > .container-div .markdown-body { - margin-bottom: 0; - border-radius: 3px; -} -ng-home-project-inside > .container-div .markdown-body ul li { - list-style-type: initial; -} -ng-home-project-inside > .container-div .markdown-body ol li { - list-style-type: decimal; -} -ng-home-project-inside home-project-inside-overview .operate-box-top .icon-huadongkaiguan-dakai { - color: var(--GREEN_NORMAL); -} - -others-journel-sheet { - padding-bottom: 19px; -} -others-journel-sheet menu-common-component .common_menu_ul { - border: none; - margin-top: 0; - line-height: 30px; - padding-right: 0px; -} -others-journel-sheet list-page-common-component { - height: calc(100vh - 168px); -} - -unit-test-component .left_container_ut { - background-color: var(--COMPONENT_BG); - z-index: 3; - border-right: 1px solid var(--BORDER); - min-width: 240px; - width: 240px; - height: -webkit-calc(100vh - 81px); - height: -ms-calc(100vh - 81px); - height: -moz-calc(100vh - 81px); - height: calc(100vh - 81px); -} -unit-test-component .btn_cookie_admin_container { - top: 61px; - right: 202px !important; -} -unit-test-component .divide_line { - border-right: 1px solid var(--BORDER); - height: 15px; - margin: 0 15px; -} -unit-test-component .list_ut { - height: -webkit-calc(100% - 47px); - height: -ms-calc(100% - 47px); - height: -moz-calc(100% - 47px); - height: calc(100% - 47px); - width: 100%; - overflow: auto; -} -unit-test-component .url_item_list_ut { - word-break: break-all; - text-overflow: ellipsis; - display: -webkit-box; - -webkit-box-orient: vertical; - -webkit-line-clamp: 2; - overflow: hidden; -} -unit-test-component .label_test_method_ut { - font-size: 12px; - width: 45px; - height: 18px; - line-height: 18px; - text-align: center; -} -unit-test-component .item_list_ut { - border-bottom: 1px solid var(--BORDER); -} -unit-test-component .item_list_ut:hover { - background-color: var(--COMPONENT_BG); -} -unit-test-component .btn_shrink_ut:hover { - color: #019e75; -} -unit-test-component .header_left_ut { - height: 40px; - padding: 0 10px; - background-color: var(--COMPONENT_BG); - border-radius: 3px 0 0 0; - border-bottom: 1px solid var(--BORDER); -} -unit-test-component .tab-container-mask { - height: 40px !important; -} -unit-test-component .quick-save-td { - position: relative; - width: 90px; -} -unit-test-component .quick-save-td .save-text { - word-break: keep-all; - white-space: nowrap; -} -unit-test-component .quick-save-td .save-btn-qstd:focus + .eo-wrap-div { - display: block; -} -unit-test-component .quick-save-td .save-btn-qstd { - height: 35px; - line-height: 35px; -} -unit-test-component .btn_cookie_admin_container { - top: 56px; -} -unit-test-component .first_level_article { - margin-left: 0 !important; - padding-left: 0 !important; - padding-right: 0 !important; - height: -webkit-calc(100vh - 184px); - height: -ms-calc(100vh - 184px); - height: -moz-calc(100vh - 184px); - height: calc(100vh - 184px); - overflow-y: auto; -} -unit-test-component .env-li { - right: 0; -} -unit-test-component .static-div { - border: 1px solid var(--BORDER); - border-left: none; - border-right: none; - margin-top: 47px !important; -} -unit-test-component .tab-container { - z-index: 5; - position: absolute; - left: 0; - width: -webkit-calc(100% - 274px); - width: -ms-calc(100% - 274px); - width: -moz-calc(100% - 274px); - width: calc(100% - 274px); - box-sizing: border-box; - padding-left: 10px; - padding-top: 4px; -} -unit-test-component .tab-container .icon-guanbi { - display: none; -} -unit-test-component .tab-container .item-tc:hover .icon-guanbi { - display: inline-block; -} -unit-test-component .tab-container .icon-guanbi:hover { - color: var(--BLUE_NORMAL); -} -unit-test-component .tab-container .group-btn-container button { - width: 35px; - height: 30px; - border-radius: 3px; -} -unit-test-component .tab-container .group-btn-container button:hover { - color: var(--BLUE_NORMAL); - background-color: rgba(0, 0, 0, 0.07); -} -unit-test-component .tab-container .group-btn-container .btn-add { - border-right: none; - border-radius: 3px; -} -unit-test-component .tab-container .group-btn-container .more-btn-container { - position: relative; -} -unit-test-component .tab-container .group-btn-container .wrap-div { - background-color: var(--COMPONENT_BG); - box-shadow: var(--COMPONENT_SHADOW); - position: absolute; - border-style: solid; - border-width: 1px; - border-radius: 3px; - right: 0; - z-index: 2; - border-color: var(--BORDER); - display: none; - margin-top: 5px; -} -unit-test-component .tab-container .group-btn-container .wrap-div p { - height: 35px; - line-height: 35px; - padding: 0 15px; - text-align: left; - color: #555; - word-break: keep-all; - white-space: pre; - min-width: 60px; - cursor: pointer; -} -unit-test-component .tab-container .group-btn-container .wrap-div p:hover { - background-color: var(--DISABLE_BG); - color: var(--MAIN_TEXT); - text-decoration: underline; -} -unit-test-component .tab-container .group-btn-container .btn-more:focus + .wrap-div { - display: block; -} -unit-test-component .tab-container .tab-container .item-tc:hover .icon-guanbi { - display: inline-block; -} -unit-test-component .tab-container .tab-container .active-item-tc:after { - content: ' '; - position: absolute; - bottom: -1px; - left: 0; - height: 1px; - width: 100%; - background-color: var(--MAIN_BG); -} -unit-test-component .tab-container .item-tc { - position: relative; - height: 35px; - line-height: 35px; - font-size: 12px; - padding: 0 10px; - border-top: 1px solid transparent; - border-radius: 3px 3px 0 0; - width: 130px; - min-width: 30px; - cursor: pointer; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - border: 1px solid transparent; -} -unit-test-component .tab-container .item-tc:nth-last-child(n + 2) { - margin-right: 5px; -} -unit-test-component .tab-container .item-tc .tab-content { - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - width: calc(100% - 30px); - display: inline-block; -} -unit-test-component .tab-container .item-tc span:first-child { - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - width: -webkit-calc(100% - 15px); - width: -ms-calc(100% - 15px); - width: -moz-calc(100% - 15px); - width: calc(100% - 15px); - display: inline-block; -} -unit-test-component .tab-container .item-tc:hover { - border-left: 1px solid var(--BORDER); - border-right: 1px solid var(--BORDER); - border-top: 1px solid var(--BORDER); -} -unit-test-component .tab-container .active-item-tc { - position: relative; - background-color: var(--MAIN_BG); - cursor: default; - border-bottom: 1px solid var(--MAIN_BG); - color: var(--MAIN_TEXT); - border-left: 1px solid var(--BORDER); - border-right: 1px solid var(--BORDER); - border-top: 1px solid var(--BORDER); -} -unit-test-component .tab-container .api-request-type { - font-weight: bold; - display: inline-block; - margin-right: 5px; -} - -:root { - --NAV_TOP: 50px; -} - -.pc_home .group_and_list_container { - height: -webkit-calc(100% - calc(51px + var(--NAV_TOP))); - height: -ms-calc(100% - calc(51px + var(--NAV_TOP))); - height: -moz-calc(100% - calc(51px + var(--NAV_TOP))); - height: calc(100% - calc(51px + var(--NAV_TOP))); -} -.pc_home .home .home-content .home-div, .pc_home .admin_container { - margin-top: calc(var(--NAV_TOP) + calc(51px)); -} -.pc_home group-quick-test-common-component .cc-group-container { - top: calc(var(--NAV_TOP) + 60px); -} -.pc_home .eo-sidebar { - height: -webkit-calc(100% - var(--NAV_TOP)); - height: -ms-calc(100% - var(--NAV_TOP)); - height: -moz-calc(100% - var(--NAV_TOP)); - height: calc(100% - var(--NAV_TOP)); - top: var(--NAV_TOP); -} -.pc_home .product_list_en5 { - top: var(--NAV_TOP); -} -.pc_home eo-navbar5 { - top: var(--NAV_TOP); -} -.pc_home sidebar-common-component .static_scc { - height: calc(100% - 100px); - top: 100px; -} -.pc_home sidebar-common-component .eo-sidebar, .pc_home eo-nav-admin .nav-container { - top: var(--NAV_TOP) !important; -} - -.container_en { - height: 50px; - background: #000; - padding: 0 20px; - position: fixed; - top: 0; - z-index: 11; - width: -webkit-calc(100% - 40px); - width: -ms-calc(100% - 40px); - width: -moz-calc(100% - 40px); - width: calc(100% - 40px); - left: 0; -} -.container_en a { - height: 28px; - width: 28px; - padding: 0; - line-height: 28px; - text-align: center; -} -.container_en input { - background-color: #ddd !important; -} - -eo-Electron-Proxy .eo-input.ng-dirty.ng-invalid, eo-Electron-Proxy .submitted_form .eo-input.ng-dirty.ng-invalid { - border-color: #e83333 !important; - color: #e83333 !important; -} - -setting .login-wrap .login-content { - margin: 100px auto 30px auto; - width: 385px; -} -setting .login-wrap .link_local_login:hover { - text-decoration: underline; -} -setting .login-wrap .block_container_login_eoui { - box-shadow: 0 0 14px #d4d4d4; - border-radius: 3px; - overflow: hidden; - width: 325px; - text-align: left; - padding: 20px 30px; - background-color: #fff; -} -setting .login-wrap header .title-p { - font-size: 24px; - font-weight: bold; - margin-bottom: 10px; -} -setting .login-wrap header .tips-p { - color: #666; - line-height: 1.75em; -} -setting .login-wrap article li .checkbox-label { - border: 1px solid #dcdcdc; - height: 23px; - line-height: 26px; - width: 23px; - font-size: 13px; - margin-right: 4px; - cursor: pointer; - display: inline-block; - text-align: center; - border-radius: 3px; -} -setting .login-wrap article li:first-child { - margin-top: 10px; -} -setting .login-wrap article .eo-input { - width: -webkit-calc(100% - 2px); - width: -ms-calc(100% - 2px); - width: -moz-calc(100% - 2px); - width: calc(100% - 2px); - height: 40px; - line-height: 40px; -} -setting .login-wrap article .eo_theme_btn_success, -setting .login-wrap article .eo_theme_btn_default { - width: 100%; - height: 40px; - line-height: 40px; -} -setting .login-wrap article .common-btn { - color: #666; - cursor: pointer; -} -setting .login-wrap article .common-btn:hover { - color: #333; -} -setting .login-wrap article .remember-btn { - margin-right: 11px; -} - -unit-test env-ams-component { - position: fixed; - right: 0; - z-index: 6; -} - -eo-api-edit { - z-index: 0; -} -eo-api-edit .connect_left_btn { - border-radius: 3px 0 0 3px; - margin-right: 0 !important; -} -eo-api-edit .connect_right_btn { - margin-left: 0 !important; - border-radius: 0 3px 3px 0; -} -eo-api-edit .static_td_hpiae { - border-right-color: transparent !important; -} -eo-api-edit .drag_select_conatiner.td-tbd { - position: unset !important; -} -eo-api-edit .drag_select_conatiner.td-tbd .container-div { - position: unset !important; -} -eo-api-edit .drag_select_conatiner.td-tbd .list-container-div, -eo-api-edit .drag_select_conatiner.td-tbd .list_container_acac { - width: 180px; -} -eo-api-edit .drag_select_conatiner.td-tbd auto-complete-component { - position: unset !important; -} -eo-api-edit .drag_block_container .tr-tbd { - border-top: none !important; -} -eo-api-edit .drag_block_container .thead-div { - border-bottom: 1px solid var(--BORDER); -} -eo-api-edit .drag_block_container .new_item_tr_hpiae .tr-tbd:hover { - background-color: var(--TABLE_ROW_HOVER_BG); -} -eo-api-edit .drag_block_container .tbody_div_wrap { - overflow-y: initial; -} -eo-api-edit .drag_block_container .new_td_item_container { - border-right: none !important; -} -eo-api-edit .drag_block_container .tr_container_tbd:nth-last-child(n + 2) .tr-tbd { - border-bottom: 1px solid var(--BORDER); -} -eo-api-edit .drag_block_container .tr_container_tbd { - border-right: 1px solid transparent; - border-left-color: transparent; -} -eo-api-edit .drag_block_container .thead-div > div:first-child { - border-left: 2px solid; - border-left-color: transparent; -} -eo-api-edit .drag_block_container .tr-tbd { - border-top: none !important; - border-left-color: inherit; -} -eo-api-edit .drag_block_container .tr-tbd > div:first-child { - border-left: 2px solid; - border-left-color: inherit; -} -eo-api-edit .new_text_input_hpiae { - border-right: none !important; -} -eo-api-edit .new_text_input_hpiae input[type='text'] { - border-color: #999; -} -eo-api-edit .eo_more_btn:focus + .wrap_div_hpiae { - display: block; -} -eo-api-edit .eo-input.first, -eo-api-edit .eo-input.last, -eo-api-edit .eo-input.center { - min-width: 200px; -} -eo-api-edit .eo-input.first { - border-radius: 3px 0 0 3px; - border-right: 0 none; -} -eo-api-edit .eo-input.center { - border-radius: 0; - border-right: 0 none; -} -eo-api-edit .eo-input.last { - border-radius: 0 3px 3px 0; -} -eo-api-edit .concat_container .eo-input:first-child { - border-radius: 3px 0 0 3px; -} -eo-api-edit .tab_list_container_hpiae { - right: 30px; -} -eo-api-edit .wrap_div_hpiae { - z-index: 4; - color: var(--MAIN_TEXT); - box-shadow: var(--COMPONENT_SHADOW); - width: 200px; - line-height: 30px; - border: 1px solid var(--BORDER); - background-color: var(--COMPONENT_BG); - font-size: 12px; - display: none; - right: -11px; -} -eo-api-edit .wrap_div_hpiae .checkbox-th, -eo-api-edit .wrap_div_hpiae .checkbox-td { - border-right: none; -} -eo-api-edit .wrap_div_hpiae .tbody-div { - max-height: 200px; - overflow: auto; -} -eo-api-edit .wrap_div_hpiae .thead-div, -eo-api-edit .wrap_div_hpiae .tr-tbd { - height: 30px; -} -eo-api-edit .wrap_div_hpiae .checkbox-td { - padding-top: 7px !important; -} -eo-api-edit .wrap_div_hpiae:hover { - display: block; -} -eo-api-edit .api_staus_panel1_hpiae { - background-color: rgba(0, 121, 91, 0.1); -} -eo-api-edit .api_staus_panel2_hpiae { - background-color: rgba(255, 212, 0, 0.2); -} -eo-api-edit .api_staus_panel3_hpiae { - background-color: rgba(255, 0, 14, 0.1); -} -eo-api-edit select-multistage-common-component { - width: 276px; -} -eo-api-edit select-multistage-common-component .text-div { - border-radius: 3px 0 0 3px; -} -eo-api-edit package-Admin-Component { - padding: 0 !important; -} -eo-api-edit .static_td_hpiae { - padding: 0; -} -eo-api-edit .structure_data_hpiae { - border-top: 1px solid; - border-bottom: 1px solid var(--BORDER) !important; - border-right: 1px solid; - position: absolute; - width: -webkit-calc(100% - 2px); - width: -ms-calc(100% - 2px); - width: -moz-calc(100% - 2px); - width: calc(100% - 2px); - background-color: #fff; - top: -37px; - border-left: 2px solid transparent; - -ms-animation: common-animation-emerge 0.2s; - -moz-animation: common-animation-emerge 0.2s; - -webkit-animation: common-animation-emerge 0.2s; - animation: common-animation-emerge 0.2s; - z-index: 2; -} -eo-api-edit .last_index_structure_item { - box-shadow: var(--COMPONENT_SHADOW); -} -eo-api-edit .last_index_structure_item .tr-tbd { - border-bottom-color: inherit !important; -} -eo-api-edit .last_index_structure_item .td-tbd, -eo-api-edit .last_index_structure_item .sort-handle-td { - border-color: inherit; -} -eo-api-edit .divide_line_hpiae { - margin-top: -2px; -} -eo-api-edit .sv-group-helper .structure_data_hpiae { - display: none; -} -eo-api-edit .container_hpiae { - padding: calc(40px + var(--GLOBAL_PLATE_PADDING)) 20px var(--GLOBAL_PLATE_PADDING) 20px; -} -eo-api-edit .first_level_article select-default-common-component .container-div { - max-width: 248px; -} -eo-api-edit .first_level_article .first_part { - padding: var(--GLOBAL_PLATE_PADDING); -} -eo-api-edit .first_level_article .first_part .part-div { - line-height: 32px; -} -eo-api-edit .first_level_article .first_part .part-div:nth-child(n + 2) { - padding-top: 10px; -} -eo-api-edit .first_level_article .first_part select-default-common-component.w_80 .container-div { - width: 80px; -} -eo-api-edit .first_level_article .first_part .wider_select_default_component .container-div { - width: 275px; -} -eo-api-edit .first_level_article .first_part .center-sdcc .container-div .text-p { - border-radius: 0; -} -eo-api-edit .first_level_article .first_part tag-ams-component { - width: -webkit-calc(100% - 50px); - width: -ms-calc(100% - 50px); - width: -moz-calc(100% - 50px); - width: calc(100% - 50px); -} -eo-api-edit .first_level_article .item_part header { - padding: 10px var(--GLOBAL_PLATE_PADDING) 10px var(--GLOBAL_PLATE_PADDING); - border-bottom: 1px solid var(--BORDER); -} -eo-api-edit .first_level_article .item_part header .send-format { - color: var(--BLUE_NORMAL); - text-align: center; - height: 30px; - line-height: 30px; - border: 1px solid #bcdffb; - background-color: #e3f7ff; - border-radius: 3px; - padding: 0 10px; - font-size: 12px; -} -eo-api-edit .first_level_article .item_part header .send-format:hover { - background-color: var(--BLUE_NORMAL); - color: #fff; -} -eo-api-edit .first_level_article .json-root-type-div .eo-select { - width: auto; -} -eo-api-edit .first_level_article .eo-static-hidden { - border: none; - padding: 0; - margin: 0; -} -eo-api-edit .first_level_article .request-param-part .eo-static-hidden { - margin-top: 0; -} -eo-api-edit .first_level_article .remark-part article { - min-height: 237px; -} -eo-api-edit .first_level_article .raw-rp { - border: none; - width: -webkit-calc(100% - 20px); - width: -ms-calc(100% - 20px); - width: -moz-calc(100% - 20px); - width: calc(100% - 20px); - height: 100px; - padding: 10px; - background-color: var(--INPUT_BG); - display: flex; -} - -eo-api-tmp-list .new_tmp_btn_container .more-btn-box { - height: auto !important; -} - -ng-home-project-inside-api .show-sidebar { - width: calc(100% - 650px) !important; -} -ng-home-project-inside-api .icon-guanbi { - display: none; -} -ng-home-project-inside-api .icon-guanbi { - position: absolute; - right: 10px; -} -ng-home-project-inside-api .tab-container .item-tc:hover .icon-guanbi { - display: inline-block; -} -ng-home-project-inside-api .tab-container .active-item-tc:after { - content: ' '; - position: absolute; - bottom: -1px; - left: 0; - height: 1px; - width: 100%; - background-color: var(--MAIN_BG); -} -ng-home-project-inside-api .env-md-menu-top { - right: 20px; -} -ng-home-project-inside-api .apimanagement-scss-api-test .static-div { - width: -webkit-calc(100% - 502px); - width: -ms-calc(100% - 502px); - width: -moz-calc(100% - 502px); - width: calc(100% - 502px); -} -ng-home-project-inside-api .apimanagement-scss-api-test .btn_cookie_admin_container { - top: 56px; -} -ng-home-project-inside-api .apimanagement-scss-api-test .quick-save-td { - position: relative; - width: 115px; -} -ng-home-project-inside-api .apimanagement-scss-api-test .quick-save-td .save-text { - word-break: keep-all; - white-space: nowrap; -} -ng-home-project-inside-api .apimanagement-scss-api-test .quick-save-td .save-btn-qstd:focus + .eo-wrap-div { - display: block; -} -ng-home-project-inside-api .apimanagement-scss-api-test .quick-save-td .save-btn-qstd { - height: 35px; - line-height: 35px; -} -ng-home-project-inside-api .apimanagement-scss-api-test .quick_test_container .static-div { - margin-top: -48px; - border: 1px solid var(--BORDER); - border-left: none; - border-right: none; -} -ng-home-project-inside-api .apimanagement-scss-api-test .quick_test_container .first_level_article { - margin-top: 55px; - height: calc(100vh - 196px); -} -ng-home-project-inside-api .recyle_list_container_env { - right: 30px; -} -ng-home-project-inside-api .api-inside-empty { - width: calc(100% - 422px); - z-index: 10; - top: 100px; - height: calc(100% - 60px); - position: fixed; - padding: 90px; - display: flex; - justify-content: center; - background-color: var(--MAIN_BG); -} -ng-home-project-inside-api .api-inside-view { - padding-top: 60px; -} -ng-home-project-inside-api .tab-container-mask { - position: fixed; - background-color: var(--SEC_BG); - z-index: 4; - width: 100%; - height: 60px; -} -ng-home-project-inside-api .tab-container-mask-empty { - z-index: 10; - height: calc(100vh - 80px); -} -ng-home-project-inside-api .tab-container { - position: fixed; - width: -webkit-calc(100% - 560px); - width: -ms-calc(100% - 560px); - width: -moz-calc(100% - 560px); - width: calc(100% - 560px); - padding-top: 4px; - padding-left: 0; - z-index: 5; -} -ng-home-project-inside-api .tab-container .icon-guanbi:hover { - color: var(--BLUE_NORMAL); -} -ng-home-project-inside-api .tab-container .group-btn-container button { - width: 35px; - height: 30px; - border-radius: 3px; -} -ng-home-project-inside-api .tab-container .group-btn-container button:hover { - color: var(--BLUE_NORMAL); - background-color: rgba(0, 0, 0, 0.07); -} -ng-home-project-inside-api .tab-container .group-btn-container .btn-add { - border-right: none; - border-radius: 3px; -} -ng-home-project-inside-api .tab-container .group-btn-container .more-btn-container { - position: relative; -} -ng-home-project-inside-api .tab-container .group-btn-container .wrap-div { - background-color: var(--COMPONENT_BG); - box-shadow: var(--COMPONENT_SHADOW); - position: absolute; - border-style: solid; - border-width: 1px; - border-radius: 3px; - right: 0; - z-index: 2; - border-color: var(--BORDER); - display: none; - margin-top: 5px; -} -ng-home-project-inside-api .tab-container .group-btn-container .wrap-div p { - height: 35px; - line-height: 35px; - padding: 0 15px; - text-align: left; - color: #555; - word-break: keep-all; - white-space: pre; - min-width: 60px; - cursor: pointer; -} -ng-home-project-inside-api .tab-container .group-btn-container .wrap-div p:hover { - background-color: var(--DISABLE_BG); - color: var(--MAIN_TEXT); - text-decoration: underline; -} -ng-home-project-inside-api .tab-container .group-btn-container .btn-more:focus + .wrap-div { - display: block; -} -ng-home-project-inside-api .tab-container .item-tc { - position: relative; - height: 35px; - line-height: 35px; - font-size: 12px; - padding: 0 10px; - border-top: 1px solid transparent; - border-radius: 3px 3px 0 0; - width: 130px; - min-width: 30px; - cursor: pointer; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - border: 1px solid transparent; -} -ng-home-project-inside-api .tab-container .item-tc:nth-last-child(n + 2) { - margin-right: 5px; -} -ng-home-project-inside-api .tab-container .item-tc .tab-content { - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - width: calc(100% - 30px); - display: inline-block; -} -ng-home-project-inside-api .tab-container .item-tc span:first-child { - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - width: -webkit-calc(100% - 15px); - width: -ms-calc(100% - 15px); - width: -moz-calc(100% - 15px); - width: calc(100% - 15px); - display: inline-block; -} -ng-home-project-inside-api .tab-container .item-tc:hover { - border-left: 1px solid var(--BORDER); - border-right: 1px solid var(--BORDER); - border-top: 1px solid var(--BORDER); -} -ng-home-project-inside-api .tab-container .active-item-tc { - position: relative; - background-color: var(--MAIN_BG); - cursor: default; - border-bottom: 1px solid var(--MAIN_BG); - color: var(--MAIN_TEXT); - border-left: 1px solid var(--BORDER); - border-right: 1px solid var(--BORDER); - border-top: 1px solid var(--BORDER); -} -ng-home-project-inside-api .tab-container .api-request-type { - font-weight: bold; - display: inline-block; - margin-right: 5px; -} - -ng-home-Project-Inside-Api-Detail comment-ams-component .gosc_session_box { - height: calc(100vh - 140px); -} -ng-home-Project-Inside-Api-Detail comment-ams-component .gosc_session_box .editormd .CodeMirror { - border-right: none; -} -ng-home-Project-Inside-Api-Detail .float-container { - width: 750px; - margin-left: 20px; - position: fixed; - top: 50px; - height: 100%; - border-left: 1px solid var(--BORDER); - overflow: auto; - transition: right 300ms; - margin-bottom: -50px; - box-shadow: var(--COMPONENT_SHADOW); - z-index: 11; - background-color: var(--COMPONENT_BG); -} -ng-home-Project-Inside-Api-Detail .float-container .container_header { - padding: 15px 20px; - border-bottom: 1px; - border-bottom: 1px solid var(--BORDER); -} -ng-home-Project-Inside-Api-Detail .apimanagement-scss-api-detail .first_part .api-url { - font-size: 14px; -} -ng-home-Project-Inside-Api-Detail .apimanagement-scss-api-detail .first_part .api-name { - font-size: 14px; - font-weight: bold; -} -ng-home-Project-Inside-Api-Detail .apimanagement-scss-api-detail .first_part .api-detail .api-status { - margin-left: 0px; -} -ng-home-Project-Inside-Api-Detail .unread_num_tip::after { - content: ''; - right: 29px; - top: 6px; - color: #fff; - background-color: var(--RED_NORMAL); - border-radius: 50%; - padding: 4px; - display: block; - position: absolute; - font-size: 12px; -} -ng-home-Project-Inside-Api-Detail .more-btn-group-div > div, -ng-home-Project-Inside-Api-Detail .more-btn-group-div > button { - position: relative; -} -ng-home-Project-Inside-Api-Detail .more-btn-group-div > div:nth-last-child(n + 1), -ng-home-Project-Inside-Api-Detail .more-btn-group-div > button:nth-last-child(n + 1) { - margin-left: 15px; -} -ng-home-Project-Inside-Api-Detail .more-btn-group-div button:focus .wrap-div { - display: block; -} -ng-home-Project-Inside-Api-Detail .more-btn-group-div .test_more_btn:focus + .wrap-div { - display: block; -} -ng-home-Project-Inside-Api-Detail .more-btn-group-div .eo-tip-container .message-li { - margin-left: -190px; -} -ng-home-Project-Inside-Api-Detail .more-btn-group-div .more-test-container .wrap-div { - margin-top: 35px; -} -ng-home-Project-Inside-Api-Detail .more-btn-group-div .wrap-div:hover { - display: block; -} -ng-home-Project-Inside-Api-Detail .more-btn-group-div .test-btn { - border-radius: 3px 0 0 3px; - border-right: none; -} -ng-home-Project-Inside-Api-Detail .more-btn-group-div .test_more_btn { - border-left: 1px solid rgba(0, 0, 0, 0.1); - border-radius: 0 3px 3px 0; - padding: 0; -} -ng-home-Project-Inside-Api-Detail .more-btn-group-div .common-fun { - cursor: pointer; - display: flex; - align-items: center; -} -ng-home-Project-Inside-Api-Detail .more-btn-group-div .common-fun .iconfont { - font-size: 18px; -} -ng-home-Project-Inside-Api-Detail .more-btn-group-div .common-fun:hover { - color: var(--BLUE_NORMAL); -} -ng-home-Project-Inside-Api-Detail .more-btn-group-div .wrap-div { - background-color: var(--COMPONENT_BG); - box-shadow: var(--COMPONENT_SHADOW); - position: absolute; - border-style: solid; - border-width: 1px; - border-radius: 3px; - right: 0px; - z-index: 2; - border-color: var(--BORDER); - display: none; - margin-top: 5px; -} -ng-home-Project-Inside-Api-Detail .more-btn-group-div .wrap-div p { - height: 35px; - line-height: 35px; - padding: 0 15px; - text-align: left; - color: #555; - word-break: keep-all; - white-space: pre; -} -ng-home-Project-Inside-Api-Detail .more-btn-group-div .wrap-div p:hover { - background-color: var(--DISABLE_BG); - color: var(--MAIN_TEXT); - text-decoration: underline; -} - -ams-api-case-report .container_air { - display: block; - margin-top: 40px; - background-color: var(--COMPONENT_BG); -} -ams-api-case-report .container_air menu-common-component .common_menu_ul { - border: none; - margin-top: 0; - padding-left: 10px; -} -ams-api-case-report .show_btn_hair { - height: 22px; - line-height: 22px; - font-size: 12px; -} -ams-api-case-report list-page-common-component { - height: calc(100vh - 167px); -} - -.show_case_modal_hair .tbody_div_wrap { - max-height: 400px; - overflow: auto; -} - -eo-api-unit-test-response-match-rule header { - border-bottom: 1px solid var(--BORDER); -} -eo-api-unit-test-response-match-rule header .menu-ul { - display: flex; - width: 100%; -} -eo-api-unit-test-response-match-rule textarea { - border: 1px solid var(--BORDER); - border-radius: 3px; - width: -webkit-calc(100% - 52px); - width: -ms-calc(100% - 52px); - width: -moz-calc(100% - 52px); - width: calc(100% - 52px); - height: 100px; - padding: 10px; - background-color: #fafafa; -} -eo-api-unit-test-response-match-rule .title_p { - font-size: 14px; - margin-bottom: 10px; - font-weight: bold; -} - -.test_report_modal { - width: 75vw; - min-width: 600px; -} - -ng-footer .ng-footer-wrap { - height: 30px; - box-sizing: border-box; - border-top-width: 1px; - border-top-style: solid; - border-color: var(--BORDER); - background-color: var(--FOOTER_BG); - padding: 5px 15px; - position: fixed; - bottom: 0; - width: 100%; - z-index: 10; - color: var(--FOOTER_TEXT); -} - -ng-search-box-component .gd_highlight { - color: var(--RED_DEEP); -} -ng-search-box-component .search_text_container:hover .search_blur + .trigger_item { - display: block; -} -ng-search-box-component .search_box { - position: absolute; - top: 61px; - margin-left: -180px; - width: 480px; -} -ng-search-box-component .search_box .focus_search_item_sgs { - background-color: var(--TABLE_ROW_HOVER_BG); -} -ng-search-box-component .search_box .search_input { - position: relative; - display: block; - width: 100%; - height: 50px; - line-height: 50px; - font-size: 14px; - padding-left: 20px; - border-radius: 10px; - box-sizing: border-box; -} -ng-search-box-component .search_box .search_input .searchTitle { - margin-right: 10px; -} -ng-search-box-component .search_box .search_input .tit { - position: absolute; - display: inline-block; -} -ng-search-box-component .search_box .search_input .tit .Tab { - margin-left: 25px; -} -ng-search-box-component .search_box .search_input .tit .icon-jianpan_o::before { - position: absolute; - top: 0; - left: 2px; - font-size: 22px; - margin-right: 3px; -} -ng-search-box-component .search_box .env_search { - position: absolute; - top: 1px; - right: 7px; -} -ng-search-box-component .search_box .env_search .env_search_item { - display: inline-block; - width: 80px; - height: 30px; - line-height: 28px; - font-family: Microsoft Yahei; - font-size: 12px; - text-align: center; - border: 1px solid var(--BORDER); - margin: 0 5px; - border-radius: 3px; -} -ng-search-box-component .search_box .env_search .active_search_item { - color: #fff; - background-color: #00785a; -} -ng-search-box-component .search_box .env_search .no_active { - color: #525e71; -} -ng-search-box-component .search_box .history_title { - width: 100%; - height: 50px; - box-sizing: border-box; - line-height: 50px; - padding-left: 20px; - font-size: 14px; - border-bottom: 1px solid var(--BORDER); -} -ng-search-box-component .search_box .history_title button { - color: #00785a; - margin-left: 5px; -} -ng-search-box-component .search_box .history_title button:hover { - text-decoration: underline; - color: #00785a; -} -ng-search-box-component .search_box .history_search { - width: 480px; - box-sizing: border-box; - box-shadow: var(--COMPONENT_SHADOW); - border-radius: 0 0 10px 10px; -} -ng-search-box-component .search_box .history_search li { - width: 100%; - box-sizing: border-box; - padding: 10px 20px; - cursor: pointer; -} -ng-search-box-component .search_box .history_search li .text { - display: inline-block; - min-width: 135px; - white-space: nowrap; -} -ng-search-box-component .search_box .history_search li .key { - margin-left: 10px; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} -ng-search-box-component .search_box .search_type { - background-color: var(--COMPONENT_BG); - border-top: 1px solid var(--BORDER); - box-shadow: var(--COMPONENT_SHADOW); - box-sizing: border-box; - border-radius: 0 0 10px 10px; -} -ng-search-box-component .search_box .search_type li { - width: 480px; - box-sizing: border-box; - padding: 10px 20px; - cursor: pointer; -} -ng-search-box-component .search_box .search_type li .text { - display: inline-block; - min-width: 135px; - white-space: nowrap; -} -ng-search-box-component .search_box .search_type li .key { - display: inline-block; - width: 345px; - box-sizing: border-box; - margin-left: 10px; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} -ng-search-box-component .search_box .search_type_data { - color: var(--MAIN_TEXT); - box-sizing: border-box; - border-radius: 0 0 10px 10px; - box-shadow: var(--COMPONENT_SHADOW); - border-top: 1px solid var(--BORDER); - overflow-y: auto; - max-height: 60vh; -} -ng-search-box-component .search_box .search_type_data li:last-child { - border-radius: 0 0 5px 5px; -} -ng-search-box-component .search_box .search_type_data li { - padding: 10px 20px; - cursor: pointer; -} -ng-search-box-component .search_box .search_type_data .eo-method-label { - min-width: 29px; - border-radius: 3px; - padding: 0 3px; -} -ng-search-box-component .search_box .search_type_data .apiRequestMode { - border-radius: 3px; - background-color: var(--COMPONENT_BG); - color: var(--MAIN_TEXT); - font-size: 12px; - padding: 0 1px; - margin-right: 5px; - border: 1px solid var(--BORDER); -} -ng-search-box-component .search_box .search_type_data .index { - min-width: 20px; - height: 20px; - line-height: 20px; - font-size: 12px; - border-radius: 3px; - text-align: center; - box-shadow: var(--COMPONENT_SHADOW); - border: 1px solid var(--BORDER); -} -ng-search-box-component .search_box .no_result { - height: 100px; - width: 100%; - line-height: 100px; - text-align: center; - box-shadow: var(--COMPONENT_SHADOW); - border-radius: 0 0 10px 10px; - border-top: 1px solid var(--BORDER); -} -ng-search-box-component .search_box .no_result .item_keyboard_sgs { - border-radius: var(--DEFAULT_BORDER_RADIUS); - border: 1px solid var(--BORDER); - color: var(--MAIN_TEXT); - padding: 2px 6px; - margin-right: 5px; - min-width: 24px; - text-align: center; - box-sizing: border-box; - box-shadow: var(--COMPONENT_SHADOW); -} -ng-search-box-component .item_panel { - color: var(--MAIN_TEXT); - background-color: var(--COMPONENT_BG); - border: 1px solid var(--BORDER); - border-radius: 3px; -} -ng-search-box-component .key_tip { - position: absolute; - right: 10px; - font-size: 20px; - opacity: 0; -} -ng-search-box-component .key_tip .iconfont { - margin-left: 10px !important; -} -ng-search-box-component .key_tip .icon-chevron-up::before { - color: #7f8691; -} -ng-search-box-component .history_selected { - background-color: var(--TABLE_ROW_HOVER_BG); -} -ng-search-box-component .search_type_item:hover, -ng-search-box-component .selected { - background-color: var(--TABLE_ROW_HOVER_BG); -} -ng-search-box-component .search_type_item:hover .key, -ng-search-box-component .selected .key { - padding-right: 70px; -} -ng-search-box-component .search_type_item:hover .key_tip, -ng-search-box-component .selected .key_tip { - opacity: 1; -} -ng-search-box-component .search_type_data_item:hover, -ng-search-box-component .history_search_item:hover { - background-color: var(--TABLE_ROW_HOVER_BG); -} -ng-search-box-component .ng_eo_btn { - background-color: var(--INPUT_BG); - border: none; - height: 32px; - line-height: 32px; - border-radius: 32px; - font-size: var(--BUTTON_FONT_SIZE); - padding: 0 10px; - color: var(--MAIN_TEXT); -} -ng-search-box-component .search_focus { - background-color: var(--COMPONENT_BG); - color: var(--MAIN_TEXT); - opacity: 1; -} - -/** -* @author 银云信æ¯ç§‘技有é™å…¬å¸ -*/ -ng-home .home { - height: calc(100vh - 31px); - overflow-y: auto; - padding-bottom: 31px; -} -ng-home .bigZIndex { - z-index: 1000 !important; -} -ng-home list-group-common-component .first_level_article { - position: absolute; - height: calc(100% - 80px); -} -ng-home list-group-common-component .first_level_article .bottom-count-div { - position: absolute; - bottom: 0; - left: 0; - right: 0; -} -ng-home .fixed_home_box { - background-color: var(--MAIN_BG); - color: var(--MAIN_TEXT); -} -ng-home .fieldset-env .text_input_eac, -ng-home .fieldset-env .menu_btn_eac, -ng-home .fieldset-env .show_detail_btn_eac { - height: 30px; - line-height: 30px; -} -ng-home fieldset .all-env { - border: 1px solid var(--BORDER); - border-left: none; -} -ng-home .home-common-project-list { - height: calc(100vh - 81px); -} -ng-home .home-common-project-list .eo-operate-btn:hover { - text-decoration: underline; - --BLUE_NORMAL: #888; -} -ng-home .home-common-project-list .no-title-placeholder { - height: 72px; -} -ng-home .apimanagement-scss-quickTest .apimanagement-scss-api-test .static-div { - width: calc(100% - 256px); - margin-top: 46px; -} -ng-home home-testcase-case-inside-case-manage-default .common_menu_ul .fun-list-li, -ng-home home-wiki-inside-template-detail .common_menu_ul .fun-list-li, -ng-home home-testcase-plan-inside-case-manage .common_menu_ul .fun-list-li { - height: 100%; -} -ng-home home-wiki-inside-template-detail .common_menu_ul .fun-list-li button span:nth-child(2) { - line-height: 40px; -} -ng-home ng-home-testcase-plan-inside-setting .eo-tab-container, -ng-home home-testcase-case-inside-setting .eo-tab-container { - border: none; -} -ng-home authority-group-product-component group-default-common-component .actural-group-box .group-li { - padding-left: 10px !important; -} -ng-home home-project-inside-data-structure-operate structure-operate-product-component .eo-tab-container { - border: none; -} -ng-home ng-home-automatic-inside .env-li env-ams-component .all-env { - border-bottom: 1px solid var(--BORDER); -} -ng-home ng-home-project-inside-api-list .width0, -ng-home scene-batch-test-ams-component .width0 { - width: 0 !important; -} -ng-home home-testcase-case-inside .group_and_list_container { - width: 100%; -} -ng-home home-testcase-plan-inside-authority-sidebar { - width: 100%; -} -ng-home home-testcase-plan-inside-authority-sidebar group-default-common-component .cc-group-container { - width: 100% !important; -} -ng-home group-default-common-component .cc-group-container { - margin: 0; -} -ng-home ng-home-project-inside-api-detail .apimanagement-scss-api-detail .first_level_article { - padding-top: 47px; -} -ng-home multi-tab-component .active_item_mtc, -ng-home multi-tab-component .item_mtc:hover { - border-bottom: 2px solid var(--MAIN_THEME_COLOR); - box-shadow: none; -} -ng-home home-project-default .can-operate-placeholder, -ng-home home-monitor-default .can-operate-placeholder, -ng-home home-database-default .can-operate-placeholder, -ng-home home-testcase-case-default .can-operate-placeholder, -ng-home home-wiki-default .can-operate-placeholder, -ng-home home-testcase-plan-default .can-operate-placeholder, -ng-home home-automatic-default .can-operate-placeholder { - height: 50px; -} -ng-home menu-common-component .common_menu_ul { - margin-top: 0; -} -ng-home ng-home-ams others-journel-sheet menu-common-component .common_menu_ul { - line-height: 39px; -} -ng-home ng-multi-tab-component { - border-bottom: 1px solid var(--BORDER) !important; -} -ng-home .common-menu-lg { - padding: 10px; - height: auto; - line-height: initial; -} -ng-home .no-title-placeholder { - height: 110px !important; -} -ng-home .inside_page_menu_mcc { - background-color: var(--MAIN_BG); - border-top: 1px solid var(--BORDER); -} -ng-home .group_and_list_container { - width: 100%; -} -ng-home home-project-inside-case .container_hpic { - width: 100%; -} -ng-home home-project-inside-iteration-plan .container_hpic { - width: 100%; -} -ng-home overview-Product-Component .list-box { - margin: 0; -} -ng-home ng-home-project-inside-api .tab-container-mask { - height: 40px; -} -ng-home ng-home-project-inside-api .api-inside-view { - padding-top: 40px; -} -ng-home ng-home-project-inside-api .api-inside-view menu-common-component .common_menu_ul { - border-top: 1px solid var(--BORDER); -} -ng-home ng-home-project-inside-api .apimanagement-scss-api-test .static-div { - width: calc(100% - 241px); -} -ng-home ng-home-project-inside-api .env-md-menu-top { - right: 0; -} -ng-home ng-home-project-inside-api .tab-container { - padding-top: 4px; - padding-left: 10px; - box-sizing: border-box; -} -ng-home ng-home-project-inside-api .tab-container .active-item-tc { - background-color: var(--MAIN_BG); -} -ng-home home-project-inside-iteration-plan-a .chart-container { - margin-top: -1px; -} -ng-home ng-home-project-inside-api-test .static-div-fixed { - position: fixed; - width: 87%; - background-color: var(--TABLE_HEADER_BG); - z-index: 9999; -} -ng-home ng-home-project-inside-api-test .apimanagement-scss-api-test .first_level_article { - padding: 0; - height: calc(100vh - 217px); - overflow-y: auto; - margin-top: 96px; -} -ng-home upgrade-tip-component .eo-modal { - margin: 0 auto 20px auto !important; - padding-top: 100px; -} -ng-home home-monitor-inside-overview .amt_summary_chart_common_scss { - margin: 0 !important; - top: 0 !important; -} -ng-home home-automatic-inside header .env-sm-menu-top { - margin-top: calc(-4px + var(--GLOBAL_PLATE_PADDING)); -} -ng-home home-automatic-inside header .env-li { - right: 313px; -} -ng-home home-automatic-inside-common-case menu-common-component .common_menu_ul .menu-navigation, -ng-home home-automatic-inside-scene-test-data menu-common-component .common_menu_ul .menu-navigation, -ng-home home-automatic-inside-scene-api menu-common-component .common_menu_ul .menu-navigation { - top: 60px; - width: 100%; -} -ng-home upgrade-tip-component .eo-modal { - margin: 100px auto 20px auto; -} -@keyframes showCourseDialog { - from { - opacity: 0; - bottom: -10px; - } - to { - opacity: 1; - bottom: 10px; - } -} -@keyframes hideCourseDialog { - from { - opacity: 1; - bottom: 10px; - } - to { - opacity: 0; - bottom: -250px; - } -} -ng-home .course_modal { - margin-bottom: 35px; - width: 250px; - padding: 10px 10px 10px 20px; - background-color: var(--GREEN_NORMAL); - box-shadow: var(--MODAL_SHADOW); - animation: showCourseDialog 0.5s ease 1 forwards; - z-index: 5; - color: #fff; -} -ng-home .course_modal .btn_close { - padding: 3px 3px 2px 3px; - background-color: rgba(255, 255, 255, 0.2); - border-radius: 3px; -} -ng-home .course_modal .btn_close:hover { - background-color: rgba(255, 255, 255, 0.3); -} -ng-home .course_modal .link_course:hover { - text-decoration: underline; -} -ng-home > div { - min-width: 1000px; -} -ng-home .home-content .home-div .home-header li button { - width: 100px; - height: 30px; - line-height: 30px; - margin-top: 15px; -} -ng-home .home-content .home-div .home-header li button span { - margin-right: 5px; -} -ng-home .home-common-only-list-div { - padding: 0 var(--GLOBAL_PLATE_PADDING) var(--GLOBAL_PLATE_PADDING); -} - - -.eo_shrink_container .main_sidebar_scc, -.eo_shrink_container ng-group-api-quick-common-component, -.eo_shrink_container group-default-common-component, -.eo_shrink_container ng-group-content-common-component { - display: none; -} -.eo_shrink_container .side-navbar { - overflow: unset; - position: relative; - z-index: 7; -} -.eo_shrink_container .side-navbar .nav-wrap { - width: 50px; -} -.eo_shrink_container .nav-wrap-text { - display: none; -} -.eo_shrink_container .nav-wrap:hover .trigger_item_scc { - display: inline-flex; -} -.eo_shrink_container .nav-wrap:hover .nav-lists-2 { - display: block; -} -.eo_shrink_container .layout_main_sidebar_scc { - overflow: hidden; - padding: 0 10px; - cursor: pointer; - display: flex; - align-items: center; - justify-content: flex-start; - padding: 5px 5px; - margin: 10px 10px; - border-radius: 3px; - position: relative; - box-shadow: var(--COMPONENT_SHADOW); -} -.eo_shrink_container .layout_main_sidebar_scc .ng_s2_iaf_style, -.eo_shrink_container .layout_main_sidebar_scc .ng_s1_if_style { - background-color: var(--COMPONENT_BG); - color: var(--SIDEBAR_TEXT_ACTIVE) !important; -} -.eo_shrink_container unit-test-component .left_container_ut { - display: none; -} -.eo_shrink_container home-project-inside-quick-test-sidebar { - display: none; -} - -/*# sourceMappingURL=index.css.map */ diff --git a/src/workbench/browser/src/ng1/lib/angular/angular.js b/src/workbench/browser/src/ng1/lib/angular/angular.js deleted file mode 100644 index 551c93f6e..000000000 --- a/src/workbench/browser/src/ng1/lib/angular/angular.js +++ /dev/null @@ -1,37300 +0,0 @@ -/** - * @license AngularJS v1.8.2 - * (c) 2010-2020 Google LLC. http://angularjs.org - * License: MIT - */ -(function (window) { - 'use strict'; - - /* exported - minErrConfig, - errorHandlingConfig, - isValidObjectMaxDepth - */ - - var minErrConfig = { - objectMaxDepth: 5, - urlErrorParamsEnabled: true - }; - - /** - * @ngdoc function - * @name angular.errorHandlingConfig - * @module ng - * @kind function - * - * @description - * Configure several aspects of error handling in AngularJS if used as a setter or return the - * current configuration if used as a getter. The following options are supported: - * - * - **objectMaxDepth**: The maximum depth to which objects are traversed when stringified for error messages. - * - * Omitted or undefined options will leave the corresponding configuration values unchanged. - * - * @param {Object=} config - The configuration object. May only contain the options that need to be - * updated. Supported keys: - * - * * `objectMaxDepth` **{Number}** - The max depth for stringifying objects. Setting to a - * non-positive or non-numeric value, removes the max depth limit. - * Default: 5 - * - * * `urlErrorParamsEnabled` **{Boolean}** - Specifies whether the generated error url will - * contain the parameters of the thrown error. Disabling the parameters can be useful if the - * generated error url is very long. - * - * Default: true. When used without argument, it returns the current value. - */ - function errorHandlingConfig(config) { - if (isObject(config)) { - if (isDefined(config.objectMaxDepth)) { - minErrConfig.objectMaxDepth = isValidObjectMaxDepth(config.objectMaxDepth) ? config.objectMaxDepth : NaN; - } - if (isDefined(config.urlErrorParamsEnabled) && isBoolean(config.urlErrorParamsEnabled)) { - minErrConfig.urlErrorParamsEnabled = config.urlErrorParamsEnabled; - } - } else { - return minErrConfig; - } - } - - /** - * @private - * @param {Number} maxDepth - * @return {boolean} - */ - function isValidObjectMaxDepth(maxDepth) { - return isNumber(maxDepth) && maxDepth > 0; - } - - - /** - * @description - * - * This object provides a utility for producing rich Error messages within - * AngularJS. It can be called as follows: - * - * var exampleMinErr = minErr('example'); - * throw exampleMinErr('one', 'This {0} is {1}', foo, bar); - * - * The above creates an instance of minErr in the example namespace. The - * resulting error will have a namespaced error code of example.one. The - * resulting error will replace {0} with the value of foo, and {1} with the - * value of bar. The object is not restricted in the number of arguments it can - * take. - * - * If fewer arguments are specified than necessary for interpolation, the extra - * interpolation markers will be preserved in the final string. - * - * Since data will be parsed statically during a build step, some restrictions - * are applied with respect to how minErr instances are created and called. - * Instances should have names of the form namespaceMinErr for a minErr created - * using minErr('namespace'). Error codes, namespaces and template strings - * should all be static strings, not variables or general expressions. - * - * @param {string} module The namespace to use for the new minErr instance. - * @param {function} ErrorConstructor Custom error constructor to be instantiated when returning - * error from returned function, for cases when a particular type of error is useful. - * @returns {function(code:string, template:string, ...templateArgs): Error} minErr instance - */ - /** - * @description 解æžè¯­è¨€HTML - * @author Eoapi - * @param {string} inputHtml 待解æžæ•°æ® - * @return {string} 语言解æžåŽå†…容 - */ - function eoFunParseLang(inputHtml) { - if (!inputHtml) return inputHtml; - var tmpHtmlArr = (inputHtml).split('-|-'); - if (tmpHtmlArr.length > 1) { - tmpHtmlArr.map(function (val, key) { - if (/^[a-z0-9]/.test(val)) { - tmpHtmlArr[key] = window.eoLang[val]; - } - }) - } - return tmpHtmlArr.join(''); - } - /** - * @desc 解æžé…置的HTML - */ - function eoFnParseConf(inputHtml) { - return inputHtml; - // if (!inputHtml || (typeof inputHtml !== "string") || ("Eolink" === window.GLOBAL_CONF.EN_NAME)) return inputHtml; - // return inputHtml.replace(/Eolink/g, window.GLOBAL_CONF.EN_NAME); - } - - function minErr(module, ErrorConstructor) { - ErrorConstructor = ErrorConstructor || Error; - - var url="https://www.eolinker.com"; //Eoapi æºç ï¼švar url = 'https://errors.angularjs.org/1.8.2/'; - var regex = url.replace('.', '\\.') + '[\\s\\S]*'; - var errRegExp = new RegExp(regex, 'g'); - - return function () { - var code = arguments[0], - template = arguments[1], - message = '[' + (module ? module + ':' : '') + code + '] ', - templateArgs = sliceArgs(arguments, 2).map(function (arg) { - return toDebugString(arg, minErrConfig.objectMaxDepth); - }), - paramPrefix, i; - - // A minErr message has two parts: the message itself and the url that contains the - // encoded message. - // The message's parameters can contain other error messages which also include error urls. - // To prevent the messages from getting too long, we strip the error urls from the parameters. - - message += template.replace(/\{\d+\}/g, function (match) { - var index = +match.slice(1, -1); - - if (index < templateArgs.length) { - return templateArgs[index].replace(errRegExp, ''); - } - - return match; - }); - - message += '\n' + url + (module ? module + '/' : '') + code; - - if (minErrConfig.urlErrorParamsEnabled) { - for (i = 0, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') { - message += paramPrefix + 'p' + i + '=' + encodeURIComponent(templateArgs[i]); - } - } - - return new ErrorConstructor(message); - }; - } - - /* We need to tell ESLint what variables are being exported */ - /* exported - angular, - msie, - jqLite, - jQuery, - slice, - splice, - push, - toString, - minErrConfig, - errorHandlingConfig, - isValidObjectMaxDepth, - ngMinErr, - angularModule, - uid, - REGEX_STRING_REGEXP, - VALIDITY_STATE_PROPERTY, - - lowercase, - uppercase, - nodeName_, - isArrayLike, - forEach, - forEachSorted, - reverseParams, - nextUid, - setHashKey, - extend, - toInt, - inherit, - merge, - noop, - identity, - valueFn, - isUndefined, - isDefined, - isObject, - isBlankObject, - isString, - isNumber, - isNumberNaN, - isDate, - isError, - isArray, - isFunction, - isRegExp, - isWindow, - isScope, - isFile, - isFormData, - isBlob, - isBoolean, - isPromiseLike, - trim, - escapeForRegexp, - isElement, - makeMap, - includes, - arrayRemove, - copy, - simpleCompare, - equals, - csp, - jq, - concat, - sliceArgs, - bind, - toJsonReplacer, - toJson, - fromJson, - convertTimezoneToLocal, - timezoneToOffset, - addDateMinutes, - startingTag, - tryDecodeURIComponent, - parseKeyValue, - toKeyValue, - encodeUriSegment, - encodeUriQuery, - angularInit, - bootstrap, - getTestability, - snake_case, - bindJQuery, - assertArg, - assertArgFn, - assertNotHasOwnProperty, - getter, - getBlockNodes, - hasOwnProperty, - createMap, - stringify, - UNSAFE_restoreLegacyJqLiteXHTMLReplacement, - - NODE_TYPE_ELEMENT, - NODE_TYPE_ATTRIBUTE, - NODE_TYPE_TEXT, - NODE_TYPE_COMMENT, - NODE_TYPE_DOCUMENT, - NODE_TYPE_DOCUMENT_FRAGMENT - */ - - //////////////////////////////////// - - /** - * @ngdoc module - * @name ng - * @module ng - * @installation - * @description - * - * The ng module is loaded by default when an AngularJS application is started. The module itself - * contains the essential components for an AngularJS application to function. The table below - * lists a high level breakdown of each of the services/factories, filters, directives and testing - * components available within this core module. - * - */ - - var REGEX_STRING_REGEXP = /^\/(.+)\/([a-z]*)$/; - - // The name of a form control's ValidityState property. - // This is used so that it's possible for internal tests to create mock ValidityStates. - var VALIDITY_STATE_PROPERTY = 'validity'; - - - var hasOwnProperty = Object.prototype.hasOwnProperty; - - /** - * @private - * - * @description Converts the specified string to lowercase. - * @param {string} string String to be converted to lowercase. - * @returns {string} Lowercased string. - */ - var lowercase = function (string) { - return isString(string) ? string.toLowerCase() : string; - }; - - /** - * @private - * - * @description Converts the specified string to uppercase. - * @param {string} string String to be converted to uppercase. - * @returns {string} Uppercased string. - */ - var uppercase = function (string) { - return isString(string) ? string.toUpperCase() : string; - }; - - - var - msie, // holds major version number for IE, or NaN if UA is not IE. - jqLite, // delay binding since jQuery could be loaded after us. - jQuery, // delay binding - slice = [].slice, - splice = [].splice, - push = [].push, - toString = Object.prototype.toString, - getPrototypeOf = Object.getPrototypeOf, - ngMinErr = minErr('ng'), - - /** @name angular */ - angular = window.angular || (window.angular = {}), - angularModule, - uid = 0; - - // Support: IE 9-11 only - /** - * documentMode is an IE-only property - * http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx - */ - msie = window.document.documentMode; - - - /** - * @private - * @param {*} obj - * @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments, - * String ...) - */ - function isArrayLike(obj) { - - // `null`, `undefined` and `window` are not array-like - if (obj == null || isWindow(obj)) return false; - - // arrays, strings and jQuery/jqLite objects are array like - // * jqLite is either the jQuery or jqLite constructor function - // * we have to check the existence of jqLite first as this method is called - // via the forEach method when constructing the jqLite object in the first place - if (isArray(obj) || isString(obj) || (jqLite && obj instanceof jqLite)) return true; - - // Support: iOS 8.2 (not reproducible in simulator) - // "length" in obj used to prevent JIT error (gh-11508) - var length = 'length' in Object(obj) && obj.length; - - // NodeList objects (with `item` method) and - // other objects with suitable length characteristics are array-like - return isNumber(length) && (length >= 0 && (length - 1) in obj || typeof obj.item === 'function'); - - } - - /** - * @ngdoc function - * @name angular.forEach - * @module ng - * @kind function - * - * @description - * Invokes the `iterator` function once for each item in `obj` collection, which can be either an - * object or an array. The `iterator` function is invoked with `iterator(value, key, obj)`, where `value` - * is the value of an object property or an array element, `key` is the object property key or - * array element index and obj is the `obj` itself. Specifying a `context` for the function is optional. - * - * It is worth noting that `.forEach` does not iterate over inherited properties because it filters - * using the `hasOwnProperty` method. - * - * Unlike ES262's - * [Array.prototype.forEach](http://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.18), - * providing 'undefined' or 'null' values for `obj` will not throw a TypeError, but rather just - * return the value provided. - * - ```js - var values = {name: 'misko', gender: 'male'}; - var log = []; - angular.forEach(values, function(value, key) { - this.push(key + ': ' + value); - }, log); - expect(log).toEqual(['name: misko', 'gender: male']); - ``` - * - * @param {Object|Array} obj Object to iterate over. - * @param {Function} iterator Iterator function. - * @param {Object=} context Object to become context (`this`) for the iterator function. - * @returns {Object|Array} Reference to `obj`. - */ - - function forEach(obj, iterator, context) { - var key, length; - if (obj) { - if (isFunction(obj)) { - for (key in obj) { - if (key !== 'prototype' && key !== 'length' && key !== 'name' && obj.hasOwnProperty(key)) { - iterator.call(context, obj[key], key, obj); - } - } - } else if (isArray(obj) || isArrayLike(obj)) { - var isPrimitive = typeof obj !== 'object'; - for (key = 0, length = obj.length; key < length; key++) { - if (isPrimitive || key in obj) { - iterator.call(context, obj[key], key, obj); - } - } - } else if (obj.forEach && obj.forEach !== forEach) { - obj.forEach(iterator, context, obj); - } else if (isBlankObject(obj)) { - // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty - for (key in obj) { - iterator.call(context, obj[key], key, obj); - } - } else if (typeof obj.hasOwnProperty === 'function') { - // Slow path for objects inheriting Object.prototype, hasOwnProperty check needed - for (key in obj) { - if (obj.hasOwnProperty(key)) { - iterator.call(context, obj[key], key, obj); - } - } - } else { - // Slow path for objects which do not have a method `hasOwnProperty` - for (key in obj) { - if (hasOwnProperty.call(obj, key)) { - iterator.call(context, obj[key], key, obj); - } - } - } - } - return obj; - } - - function forEachSorted(obj, iterator, context) { - var keys = Object.keys(obj).sort(); - for (var i = 0; i < keys.length; i++) { - iterator.call(context, obj[keys[i]], keys[i]); - } - return keys; - } - - - /** - * when using forEach the params are value, key, but it is often useful to have key, value. - * @param {function(string, *)} iteratorFn - * @returns {function(*, string)} - */ - function reverseParams(iteratorFn) { - return function (value, key) { - iteratorFn(key, value); - }; - } - - /** - * A consistent way of creating unique IDs in angular. - * - * Using simple numbers allows us to generate 28.6 million unique ids per second for 10 years before - * we hit number precision issues in JavaScript. - * - * Math.pow(2,53) / 60 / 60 / 24 / 365 / 10 = 28.6M - * - * @returns {number} an unique alpha-numeric string - */ - function nextUid() { - return ++uid; - } - - - /** - * Set or clear the hashkey for an object. - * @param obj object - * @param h the hashkey (!truthy to delete the hashkey) - */ - function setHashKey(obj, h) { - if (h) { - obj.$$hashKey = h; - } else { - delete obj.$$hashKey; - } - } - - - function baseExtend(dst, objs, deep) { - var h = dst.$$hashKey; - - for (var i = 0, ii = objs.length; i < ii; ++i) { - var obj = objs[i]; - if (!isObject(obj) && !isFunction(obj)) continue; - var keys = Object.keys(obj); - for (var j = 0, jj = keys.length; j < jj; j++) { - var key = keys[j]; - var src = obj[key]; - - if (deep && isObject(src)) { - if (isDate(src)) { - dst[key] = new Date(src.valueOf()); - } else if (isRegExp(src)) { - dst[key] = new RegExp(src); - } else if (src.nodeName) { - dst[key] = src.cloneNode(true); - } else if (isElement(src)) { - dst[key] = src.clone(); - } else { - if (key !== '__proto__') { - if (!isObject(dst[key])) dst[key] = isArray(src) ? [] : {}; - baseExtend(dst[key], [src], true); - } - } - } else { - dst[key] = src; - } - } - } - - setHashKey(dst, h); - return dst; - } - - /** - * @ngdoc function - * @name angular.extend - * @module ng - * @kind function - * - * @description - * Extends the destination object `dst` by copying own enumerable properties from the `src` object(s) - * to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so - * by passing an empty object as the target: `var object = angular.extend({}, object1, object2)`. - * - * **Note:** Keep in mind that `angular.extend` does not support recursive merge (deep copy). Use - * {@link angular.merge} for this. - * - * @param {Object} dst Destination object. - * @param {...Object} src Source object(s). - * @returns {Object} Reference to `dst`. - */ - function extend(dst) { - return baseExtend(dst, slice.call(arguments, 1), false); - } - - - /** - * @ngdoc function - * @name angular.merge - * @module ng - * @kind function - * - * @description - * Deeply extends the destination object `dst` by copying own enumerable properties from the `src` object(s) - * to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so - * by passing an empty object as the target: `var object = angular.merge({}, object1, object2)`. - * - * Unlike {@link angular.extend extend()}, `merge()` recursively descends into object properties of source - * objects, performing a deep copy. - * - * @deprecated - * sinceVersion="1.6.5" - * This function is deprecated, but will not be removed in the 1.x lifecycle. - * There are edge cases (see {@link angular.merge#known-issues known issues}) that are not - * supported by this function. We suggest using another, similar library for all-purpose merging, - * such as [lodash's merge()](https://lodash.com/docs/4.17.4#merge). - * - * @knownIssue - * This is a list of (known) object types that are not handled correctly by this function: - * - [`Blob`](https://developer.mozilla.org/docs/Web/API/Blob) - * - [`MediaStream`](https://developer.mozilla.org/docs/Web/API/MediaStream) - * - [`CanvasGradient`](https://developer.mozilla.org/docs/Web/API/CanvasGradient) - * - AngularJS {@link $rootScope.Scope scopes}; - * - * `angular.merge` also does not support merging objects with circular references. - * - * @param {Object} dst Destination object. - * @param {...Object} src Source object(s). - * @returns {Object} Reference to `dst`. - */ - function merge(dst) { - return baseExtend(dst, slice.call(arguments, 1), true); - } - - - - function toInt(str) { - return parseInt(str, 10); - } - - var isNumberNaN = Number.isNaN || function isNumberNaN(num) { - // eslint-disable-next-line no-self-compare - return num !== num; - }; - - - function inherit(parent, extra) { - return extend(Object.create(parent), extra); - } - - /** - * @ngdoc function - * @name angular.noop - * @module ng - * @kind function - * - * @description - * A function that performs no operations. This function can be useful when writing code in the - * functional style. - ```js - function foo(callback) { - var result = calculateResult(); - (callback || angular.noop)(result); - } - ``` - */ - function noop() {} - noop.$inject = []; - - - /** - * @ngdoc function - * @name angular.identity - * @module ng - * @kind function - * - * @description - * A function that returns its first argument. This function is useful when writing code in the - * functional style. - * - ```js - function transformer(transformationFn, value) { - return (transformationFn || angular.identity)(value); - }; - - // E.g. - function getResult(fn, input) { - return (fn || angular.identity)(input); - }; - - getResult(function(n) { return n * 2; }, 21); // returns 42 - getResult(null, 21); // returns 21 - getResult(undefined, 21); // returns 21 - ``` - * - * @param {*} value to be returned. - * @returns {*} the value passed in. - */ - function identity($) { - return $; - } - identity.$inject = []; - - - function valueFn(value) { - return function valueRef() { - return value; - }; - } - - function hasCustomToString(obj) { - //Eoapiï¼Œå¤„ç† object æ²¡æœ‰æ­£å¸¸è½¬æ¢ bug - return isFunction(obj.toString) && obj.toString !== toString&&obj.toString()!=="[object Object]";//自定义 - //æºç ï¼šreturn isFunction(obj.toString) && obj.toString !== toString; - //end - } - - - /** - * @ngdoc function - * @name angular.isUndefined - * @module ng - * @kind function - * - * @description - * Determines if a reference is undefined. - * - * @param {*} value Reference to check. - * @returns {boolean} True if `value` is undefined. - */ - function isUndefined(value) { - return typeof value === 'undefined'; - } - - - /** - * @ngdoc function - * @name angular.isDefined - * @module ng - * @kind function - * - * @description - * Determines if a reference is defined. - * - * @param {*} value Reference to check. - * @returns {boolean} True if `value` is defined. - */ - function isDefined(value) { - return typeof value !== 'undefined'; - } - - - /** - * @ngdoc function - * @name angular.isObject - * @module ng - * @kind function - * - * @description - * Determines if a reference is an `Object`. Unlike `typeof` in JavaScript, `null`s are not - * considered to be objects. Note that JavaScript arrays are objects. - * - * @param {*} value Reference to check. - * @returns {boolean} True if `value` is an `Object` but not `null`. - */ - function isObject(value) { - // http://jsperf.com/isobject4 - return value !== null && typeof value === 'object'; - } - - - /** - * Determine if a value is an object with a null prototype - * - * @returns {boolean} True if `value` is an `Object` with a null prototype - */ - function isBlankObject(value) { - return value !== null && typeof value === 'object' && !getPrototypeOf(value); - } - - - /** - * @ngdoc function - * @name angular.isString - * @module ng - * @kind function - * - * @description - * Determines if a reference is a `String`. - * - * @param {*} value Reference to check. - * @returns {boolean} True if `value` is a `String`. - */ - function isString(value) { - return typeof value === 'string'; - } - - - /** - * @ngdoc function - * @name angular.isNumber - * @module ng - * @kind function - * - * @description - * Determines if a reference is a `Number`. - * - * This includes the "special" numbers `NaN`, `+Infinity` and `-Infinity`. - * - * If you wish to exclude these then you can use the native - * [`isFinite'](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isFinite) - * method. - * - * @param {*} value Reference to check. - * @returns {boolean} True if `value` is a `Number`. - */ - function isNumber(value) { - return typeof value === 'number'; - } - - - /** - * @ngdoc function - * @name angular.isDate - * @module ng - * @kind function - * - * @description - * Determines if a value is a date. - * - * @param {*} value Reference to check. - * @returns {boolean} True if `value` is a `Date`. - */ - function isDate(value) { - return toString.call(value) === '[object Date]'; - } - - - /** - * @ngdoc function - * @name angular.isArray - * @module ng - * @kind function - * - * @description - * Determines if a reference is an `Array`. - * - * @param {*} value Reference to check. - * @returns {boolean} True if `value` is an `Array`. - */ - function isArray(arr) { - return Array.isArray(arr) || arr instanceof Array; - } - - /** - * @description - * Determines if a reference is an `Error`. - * Loosely based on https://www.npmjs.com/package/iserror - * - * @param {*} value Reference to check. - * @returns {boolean} True if `value` is an `Error`. - */ - function isError(value) { - var tag = toString.call(value); - switch (tag) { - case '[object Error]': - return true; - case '[object Exception]': - return true; - case '[object DOMException]': - return true; - default: - return value instanceof Error; - } - } - - /** - * @ngdoc function - * @name angular.isFunction - * @module ng - * @kind function - * - * @description - * Determines if a reference is a `Function`. - * - * @param {*} value Reference to check. - * @returns {boolean} True if `value` is a `Function`. - */ - function isFunction(value) { - return typeof value === 'function'; - } - - - /** - * Determines if a value is a regular expression object. - * - * @private - * @param {*} value Reference to check. - * @returns {boolean} True if `value` is a `RegExp`. - */ - function isRegExp(value) { - return toString.call(value) === '[object RegExp]'; - } - - - /** - * Checks if `obj` is a window object. - * - * @private - * @param {*} obj Object to check - * @returns {boolean} True if `obj` is a window obj. - */ - function isWindow(obj) { - return obj && obj.window === obj; - } - - - function isScope(obj) { - return obj && obj.$evalAsync && obj.$watch; - } - - - function isFile(obj) { - return toString.call(obj) === '[object File]'; - } - - - function isFormData(obj) { - return toString.call(obj) === '[object FormData]'; - } - - - function isBlob(obj) { - return toString.call(obj) === '[object Blob]'; - } - - - function isBoolean(value) { - return typeof value === 'boolean'; - } - - - function isPromiseLike(obj) { - return obj && isFunction(obj.then); - } - - - var TYPED_ARRAY_REGEXP = /^\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array]$/; - - function isTypedArray(value) { - return value && isNumber(value.length) && TYPED_ARRAY_REGEXP.test(toString.call(value)); - } - - function isArrayBuffer(obj) { - return toString.call(obj) === '[object ArrayBuffer]'; - } - - - var trim = function (value) { - return isString(value) ? value.trim() : value; - }; - - // Copied from: - // http://docs.closure-library.googlecode.com/git/local_closure_goog_string_string.js.source.html#line1021 - // Prereq: s is a string. - var escapeForRegexp = function (s) { - return s - .replace(/([-()[\]{}+?*.$^|,:#= 0) { - array.splice(index, 1); - } - return index; - } - - /** - * @ngdoc function - * @name angular.copy - * @module ng - * @kind function - * - * @description - * Creates a deep copy of `source`, which should be an object or an array. This functions is used - * internally, mostly in the change-detection code. It is not intended as an all-purpose copy - * function, and has several limitations (see below). - * - * * If no destination is supplied, a copy of the object or array is created. - * * If a destination is provided, all of its elements (for arrays) or properties (for objects) - * are deleted and then all elements/properties from the source are copied to it. - * * If `source` is not an object or array (inc. `null` and `undefined`), `source` is returned. - * * If `source` is identical to `destination` an exception will be thrown. - * - *
- * - *
- * Only enumerable properties are taken into account. Non-enumerable properties (both on `source` - * and on `destination`) will be ignored. - *
- * - *
- * `angular.copy` does not check if destination and source are of the same type. It's the - * developer's responsibility to make sure they are compatible. - *
- * - * @knownIssue - * This is a non-exhaustive list of object types / features that are not handled correctly by - * `angular.copy`. Note that since this functions is used by the change detection code, this - * means binding or watching objects of these types (or that include these types) might not work - * correctly. - * - [`File`](https://developer.mozilla.org/docs/Web/API/File) - * - [`Map`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map) - * - [`ImageData`](https://developer.mozilla.org/docs/Web/API/ImageData) - * - [`MediaStream`](https://developer.mozilla.org/docs/Web/API/MediaStream) - * - [`Set`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set) - * - [`WeakMap`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/WeakMap) - * - [`getter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get)/ - * [`setter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set) - * - * @param {*} source The source that will be used to make a copy. Can be any type, including - * primitives, `null`, and `undefined`. - * @param {(Object|Array)=} destination Destination into which the source is copied. If provided, - * must be of the same type as `source`. - * @returns {*} The copy or updated `destination`, if `destination` was specified. - * - * @example - - -
-
-
-
- Gender: -
- - -
-
form = {{user | json}}
-
leader = {{leader | json}}
-
-
- - // Module: copyExample - angular. - module('copyExample', []). - controller('ExampleController', ['$scope', function($scope) { - $scope.leader = {}; - - $scope.reset = function() { - // Example with 1 argument - $scope.user = angular.copy($scope.leader); - }; - - $scope.update = function(user) { - // Example with 2 arguments - angular.copy(user, $scope.leader); - }; - - $scope.reset(); - }]); - -
- */ - function copy(source, destination, maxDepth) { - var stackSource = []; - var stackDest = []; - maxDepth = isValidObjectMaxDepth(maxDepth) ? maxDepth : NaN; - - if (destination) { - if (isTypedArray(destination) || isArrayBuffer(destination)) { - throw ngMinErr('cpta', 'Can\'t copy! TypedArray destination cannot be mutated.'); - } - if (source === destination) { - throw ngMinErr('cpi', 'Can\'t copy! Source and destination are identical.'); - } - - // Empty the destination object - if (isArray(destination)) { - destination.length = 0; - } else { - forEach(destination, function (value, key) { - if (key !== '$$hashKey') { - delete destination[key]; - } - }); - } - - stackSource.push(source); - stackDest.push(destination); - return copyRecurse(source, destination, maxDepth); - } - - return copyElement(source, maxDepth); - - function copyRecurse(source, destination, maxDepth) { - maxDepth--; - if (maxDepth < 0) { - return '...'; - } - var h = destination.$$hashKey; - var key; - if (isArray(source)) { - for (var i = 0, ii = source.length; i < ii; i++) { - destination.push(copyElement(source[i], maxDepth)); - } - } else if (isBlankObject(source)) { - // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty - for (key in source) { - destination[key] = copyElement(source[key], maxDepth); - } - } else if (source && typeof source.hasOwnProperty === 'function') { - // Slow path, which must rely on hasOwnProperty - for (key in source) { - if (source.hasOwnProperty(key)) { - destination[key] = copyElement(source[key], maxDepth); - } - } - } else { - // Slowest path --- hasOwnProperty can't be called as a method - for (key in source) { - if (hasOwnProperty.call(source, key)) { - destination[key] = copyElement(source[key], maxDepth); - } - } - } - setHashKey(destination, h); - return destination; - } - - function copyElement(source, maxDepth) { - // Simple values - if (!isObject(source)) { - return source; - } - - // Already copied values - var index = stackSource.indexOf(source); - if (index !== -1) { - return stackDest[index]; - } - - if (isWindow(source) || isScope(source)) { - throw ngMinErr('cpws', - 'Can\'t copy! Making copies of Window or Scope instances is not supported.'); - } - - var needsRecurse = false; - var destination = copyType(source); - - if (destination === undefined) { - destination = isArray(source) ? [] : Object.create(getPrototypeOf(source)); - needsRecurse = true; - } - - stackSource.push(source); - stackDest.push(destination); - - return needsRecurse ? - copyRecurse(source, destination, maxDepth) : - destination; - } - - function copyType(source) { - switch (toString.call(source)) { - case '[object Int8Array]': - case '[object Int16Array]': - case '[object Int32Array]': - case '[object Float32Array]': - case '[object Float64Array]': - case '[object Uint8Array]': - case '[object Uint8ClampedArray]': - case '[object Uint16Array]': - case '[object Uint32Array]': - return new source.constructor(copyElement(source.buffer), source.byteOffset, source.length); - - case '[object ArrayBuffer]': - // Support: IE10 - if (!source.slice) { - // If we're in this case we know the environment supports ArrayBuffer - /* eslint-disable no-undef */ - var copied = new ArrayBuffer(source.byteLength); - new Uint8Array(copied).set(new Uint8Array(source)); - /* eslint-enable */ - return copied; - } - return source.slice(0); - - case '[object Boolean]': - case '[object Number]': - case '[object String]': - case '[object Date]': - return new source.constructor(source.valueOf()); - - case '[object RegExp]': - var re = new RegExp(source.source, source.toString().match(/[^/]*$/)[0]); - re.lastIndex = source.lastIndex; - return re; - - case '[object Blob]': - return new source.constructor([source], { - type: source.type - }); - } - - if (isFunction(source.cloneNode)) { - return source.cloneNode(true); - } - } - } - - - // eslint-disable-next-line no-self-compare - function simpleCompare(a, b) { - return a === b || (a !== a && b !== b); - } - - - /** - * @ngdoc function - * @name angular.equals - * @module ng - * @kind function - * - * @description - * Determines if two objects or two values are equivalent. Supports value types, regular - * expressions, arrays and objects. - * - * Two objects or values are considered equivalent if at least one of the following is true: - * - * * Both objects or values pass `===` comparison. - * * Both objects or values are of the same type and all of their properties are equal by - * comparing them with `angular.equals`. - * * Both values are NaN. (In JavaScript, NaN == NaN => false. But we consider two NaN as equal) - * * Both values represent the same regular expression (In JavaScript, - * /abc/ == /abc/ => false. But we consider two regular expressions as equal when their textual - * representation matches). - * - * During a property comparison, properties of `function` type and properties with names - * that begin with `$` are ignored. - * - * Scope and DOMWindow objects are being compared only by identify (`===`). - * - * @param {*} o1 Object or value to compare. - * @param {*} o2 Object or value to compare. - * @returns {boolean} True if arguments are equal. - * - * @example - - -
-
-

User 1

- Name: - Age: - -

User 2

- Name: - Age: - -
-
- -
- User 1:
{{user1 | json}}
- User 2:
{{user2 | json}}
- Equal:
{{result}}
-
-
-
- - angular.module('equalsExample', []).controller('ExampleController', ['$scope', function($scope) { - $scope.user1 = {}; - $scope.user2 = {}; - $scope.compare = function() { - $scope.result = angular.equals($scope.user1, $scope.user2); - }; - }]); - -
- */ - function equals(o1, o2) { - if (o1 === o2) return true; - if (o1 === null || o2 === null) return false; - // eslint-disable-next-line no-self-compare - if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN - var t1 = typeof o1, - t2 = typeof o2, - length, key, keySet; - if (t1 === t2 && t1 === 'object') { - if (isArray(o1)) { - if (!isArray(o2)) return false; - if ((length = o1.length) === o2.length) { - for (key = 0; key < length; key++) { - if (!equals(o1[key], o2[key])) return false; - } - return true; - } - } else if (isDate(o1)) { - if (!isDate(o2)) return false; - return simpleCompare(o1.getTime(), o2.getTime()); - } else if (isRegExp(o1)) { - if (!isRegExp(o2)) return false; - return o1.toString() === o2.toString(); - } else { - if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2) || - isArray(o2) || isDate(o2) || isRegExp(o2)) return false; - keySet = createMap(); - for (key in o1) { - if (key.charAt(0) === '$' || isFunction(o1[key])) continue; - if (!equals(o1[key], o2[key])) return false; - keySet[key] = true; - } - for (key in o2) { - if (!(key in keySet) && - key.charAt(0) !== '$' && - isDefined(o2[key]) && - !isFunction(o2[key])) return false; - } - return true; - } - } - return false; - } - - var csp = function () { - if (!isDefined(csp.rules)) { - - - var ngCspElement = (window.document.querySelector('[ng-csp]') || - window.document.querySelector('[data-ng-csp]')); - - if (ngCspElement) { - var ngCspAttribute = ngCspElement.getAttribute('ng-csp') || - ngCspElement.getAttribute('data-ng-csp'); - csp.rules = { - noUnsafeEval: !ngCspAttribute || (ngCspAttribute.indexOf('no-unsafe-eval') !== -1), - noInlineStyle: !ngCspAttribute || (ngCspAttribute.indexOf('no-inline-style') !== -1) - }; - } else { - csp.rules = { - noUnsafeEval: noUnsafeEval(), - noInlineStyle: false - }; - } - } - - return csp.rules; - - function noUnsafeEval() { - try { - // eslint-disable-next-line no-new, no-new-func - new Function(''); - return false; - } catch (e) { - return true; - } - } - }; - - /** - * @ngdoc directive - * @module ng - * @name ngJq - * - * @element ANY - * @param {string=} ngJq the name of the library available under `window` - * to be used for angular.element - * @description - * Use this directive to force the angular.element library. This should be - * used to force either jqLite by leaving ng-jq blank or setting the name of - * the jquery variable under window (eg. jQuery). - * - * Since AngularJS looks for this directive when it is loaded (doesn't wait for the - * DOMContentLoaded event), it must be placed on an element that comes before the script - * which loads angular. Also, only the first instance of `ng-jq` will be used and all - * others ignored. - * - * @example - * This example shows how to force jqLite using the `ngJq` directive to the `html` tag. - ```html - - - ... - ... - - ``` - * @example - * This example shows how to use a jQuery based library of a different name. - * The library name must be available at the top most 'window'. - ```html - - - ... - ... - - ``` - */ - var jq = function () { - if (isDefined(jq.name_)) return jq.name_; - var el; - var i, ii = ngAttrPrefixes.length, - prefix, name; - for (i = 0; i < ii; ++i) { - prefix = ngAttrPrefixes[i]; - el = window.document.querySelector('[' + prefix.replace(':', '\\:') + 'jq]'); - if (el) { - name = el.getAttribute(prefix + 'jq'); - break; - } - } - - return (jq.name_ = name); - }; - - function concat(array1, array2, index) { - return array1.concat(slice.call(array2, index)); - } - - function sliceArgs(args, startIndex) { - return slice.call(args, startIndex || 0); - } - - - /** - * @ngdoc function - * @name angular.bind - * @module ng - * @kind function - * - * @description - * Returns a function which calls function `fn` bound to `self` (`self` becomes the `this` for - * `fn`). You can supply optional `args` that are prebound to the function. This feature is also - * known as [partial application](http://en.wikipedia.org/wiki/Partial_application), as - * distinguished from [function currying](http://en.wikipedia.org/wiki/Currying#Contrast_with_partial_function_application). - * - * @param {Object} self Context which `fn` should be evaluated in. - * @param {function()} fn Function to be bound. - * @param {...*} args Optional arguments to be prebound to the `fn` function call. - * @returns {function()} Function that wraps the `fn` with all the specified bindings. - */ - function bind(self, fn) { - var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : []; - if (isFunction(fn) && !(fn instanceof RegExp)) { - return curryArgs.length ? - function () { - return arguments.length ? - fn.apply(self, concat(curryArgs, arguments, 0)) : - fn.apply(self, curryArgs); - } : - function () { - return arguments.length ? - fn.apply(self, arguments) : - fn.call(self); - }; - } else { - // In IE, native methods are not functions so they cannot be bound (note: they don't need to be). - return fn; - } - } - - - function toJsonReplacer(key, value) { - var val = value; - - if (typeof key === 'string' && key.charAt(0) === '$' && key.charAt(1) === '$') { - val = undefined; - } else if (isWindow(value)) { - val = '$WINDOW'; - } else if (value && window.document === value) { - val = '$DOCUMENT'; - } else if (isScope(value)) { - val = '$SCOPE'; - } - - return val; - } - - - /** - * @ngdoc function - * @name angular.toJson - * @module ng - * @kind function - * - * @description - * Serializes input into a JSON-formatted string. Properties with leading $$ characters will be - * stripped since AngularJS uses this notation internally. - * - * @param {Object|Array|Date|string|number|boolean} obj Input to be serialized into JSON. - * @param {boolean|number} [pretty=2] If set to true, the JSON output will contain newlines and whitespace. - * If set to an integer, the JSON output will contain that many spaces per indentation. - * @returns {string|undefined} JSON-ified string representing `obj`. - * @knownIssue - * - * The Safari browser throws a `RangeError` instead of returning `null` when it tries to stringify a `Date` - * object with an invalid date value. The only reliable way to prevent this is to monkeypatch the - * `Date.prototype.toJSON` method as follows: - * - * ``` - * var _DatetoJSON = Date.prototype.toJSON; - * Date.prototype.toJSON = function() { - * try { - * return _DatetoJSON.call(this); - * } catch(e) { - * if (e instanceof RangeError) { - * return null; - * } - * throw e; - * } - * }; - * ``` - * - * See https://github.com/angular/angular.js/pull/14221 for more information. - */ - function toJson(obj, pretty) { - if (isUndefined(obj)) return undefined; - if (!isNumber(pretty)) { - pretty = pretty ? 2 : null; - } - return JSON.stringify(obj, toJsonReplacer, pretty); - } - - - /** - * @ngdoc function - * @name angular.fromJson - * @module ng - * @kind function - * - * @description - * Deserializes a JSON string. - * - * @param {string} json JSON string to deserialize. - * @returns {Object|Array|string|number} Deserialized JSON string. - */ - function fromJson(json) { - return isString(json) ? - JSON.parse(json) : - json; - } - - - var ALL_COLONS = /:/g; - - function timezoneToOffset(timezone, fallback) { - // Support: IE 9-11 only, Edge 13-15+ - // IE/Edge do not "understand" colon (`:`) in timezone - timezone = timezone.replace(ALL_COLONS, ''); - var requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000; - return isNumberNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset; - } - - - function addDateMinutes(date, minutes) { - date = new Date(date.getTime()); - date.setMinutes(date.getMinutes() + minutes); - return date; - } - - - function convertTimezoneToLocal(date, timezone, reverse) { - reverse = reverse ? -1 : 1; - var dateTimezoneOffset = date.getTimezoneOffset(); - var timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset); - return addDateMinutes(date, reverse * (timezoneOffset - dateTimezoneOffset)); - } - - - /** - * @returns {string} Returns the string representation of the element. - */ - function startingTag(element) { - element = jqLite(element).clone().empty(); - var elemHtml = jqLite('
').append(element).html(); - try { - return element[0].nodeType === NODE_TYPE_TEXT ? lowercase(elemHtml) : - elemHtml. - match(/^(<[^>]+>)/)[1]. - replace(/^<([\w-]+)/, function (match, nodeName) { - return '<' + lowercase(nodeName); - }); - } catch (e) { - return lowercase(elemHtml); - } - - } - - - ///////////////////////////////////////////////// - - /** - * Tries to decode the URI component without throwing an exception. - * - * @private - * @param str value potential URI component to check. - * @returns {boolean} True if `value` can be decoded - * with the decodeURIComponent function. - */ - function tryDecodeURIComponent(value) { - try { - return decodeURIComponent(value); - } catch (e) { - // Ignore any invalid uri component. - } - } - - - /** - * Parses an escaped url query string into key-value pairs. - * @returns {Object.} - */ - function parseKeyValue( /**string*/ keyValue) { - var obj = {}; - forEach((keyValue || '').split('&'), function (keyValue) { - var splitPoint, key, val; - if (keyValue) { - key = keyValue = keyValue.replace(/\+/g, '%20'); - splitPoint = keyValue.indexOf('='); - if (splitPoint !== -1) { - key = keyValue.substring(0, splitPoint); - val = keyValue.substring(splitPoint + 1); - } - key = tryDecodeURIComponent(key); - if (isDefined(key)) { - val = isDefined(val) ? tryDecodeURIComponent(val) : true; - if (!hasOwnProperty.call(obj, key)) { - obj[key] = val; - } else if (isArray(obj[key])) { - obj[key].push(val); - } else { - obj[key] = [obj[key], val]; - } - } - } - }); - return obj; - } - - function toKeyValue(obj) { - var parts = []; - forEach(obj, function (value, key) { - if (isArray(value)) { - forEach(value, function (arrayValue) { - parts.push(encodeUriQuery(key, true) + - (arrayValue === true ? '' : '=' + encodeUriQuery(arrayValue, true))); - }); - } else { - parts.push(encodeUriQuery(key, true) + - (value === true ? '' : '=' + encodeUriQuery(value, true))); - } - }); - return parts.length ? parts.join('&') : ''; - } - - - /** - * We need our custom method because encodeURIComponent is too aggressive and doesn't follow - * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path - * segments: - * segment = *pchar - * pchar = unreserved / pct-encoded / sub-delims / ":" / "@" - * pct-encoded = "%" HEXDIG HEXDIG - * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" - * sub-delims = "!" / "$" / "&" / "'" / "(" / ")" - * / "*" / "+" / "," / ";" / "=" - */ - function encodeUriSegment(val) { - return encodeUriQuery(val, true). - replace(/%26/gi, '&'). - replace(/%3D/gi, '='). - replace(/%2B/gi, '+'); - } - - - /** - * This method is intended for encoding *key* or *value* parts of query component. We need a custom - * method because encodeURIComponent is too aggressive and encodes stuff that doesn't have to be - * encoded per http://tools.ietf.org/html/rfc3986: - * query = *( pchar / "/" / "?" ) - * pchar = unreserved / pct-encoded / sub-delims / ":" / "@" - * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" - * pct-encoded = "%" HEXDIG HEXDIG - * sub-delims = "!" / "$" / "&" / "'" / "(" / ")" - * / "*" / "+" / "," / ";" / "=" - */ - function encodeUriQuery(val, pctEncodeSpaces) { - return encodeURIComponent(val). - replace(/%40/gi, '@'). - replace(/%3A/gi, ':'). - replace(/%24/g, '$'). - replace(/%2C/gi, ','). - replace(/%3B/gi, ';'). - replace(/%20/g, (pctEncodeSpaces ? '%20' : '+')); - } - - var ngAttrPrefixes = ['ng-', 'data-ng-', 'ng:', 'x-ng-']; - - function getNgAttribute(element, ngAttr) { - var attr, i, ii = ngAttrPrefixes.length; - for (i = 0; i < ii; ++i) { - attr = ngAttrPrefixes[i] + ngAttr; - if (isString(attr = element.getAttribute(attr))) { - return attr; - } - } - return null; - } - - function allowAutoBootstrap(document) { - var script = document.currentScript; - - if (!script) { - // Support: IE 9-11 only - // IE does not have `document.currentScript` - return true; - } - - // If the `currentScript` property has been clobbered just return false, since this indicates a probable attack - if (!(script instanceof window.HTMLScriptElement || script instanceof window.SVGScriptElement)) { - return false; - } - - var attributes = script.attributes; - var srcs = [attributes.getNamedItem('src'), attributes.getNamedItem('href'), attributes.getNamedItem('xlink:href')]; - - return srcs.every(function (src) { - if (!src) { - return true; - } - if (!src.value) { - return false; - } - - var link = document.createElement('a'); - link.href = src.value; - - if (document.location.origin === link.origin) { - // Same-origin resources are always allowed, even for banned URL schemes. - return true; - } - // Disabled bootstrapping unless angular.js was loaded from a known scheme used on the web. - // This is to prevent angular.js bundled with browser extensions from being used to bypass the - // content security policy in web pages and other browser extensions. - switch (link.protocol) { - case 'http:': - case 'https:': - case 'ftp:': - case 'blob:': - case 'file:': - case 'data:': - return true; - default: - return false; - } - }); - } - - // Cached as it has to run during loading so that document.currentScript is available. - var isAutoBootstrapAllowed = allowAutoBootstrap(window.document); - - /** - * @ngdoc directive - * @name ngApp - * @module ng - * - * @element ANY - * @param {angular.Module} ngApp an optional application - * {@link angular.module module} name to load. - * @param {boolean=} ngStrictDi if this attribute is present on the app element, the injector will be - * created in "strict-di" mode. This means that the application will Failed to invoke functions which - * do not use explicit function annotation (and are thus unsuitable for minification), as described - * in {@link guide/di the Dependency Injection guide}, and useful debugging info will assist in - * tracking down the root of these bugs. - * - * @description - * - * Use this directive to **auto-bootstrap** an AngularJS application. The `ngApp` directive - * designates the **root element** of the application and is typically placed near the root element - * of the page - e.g. on the `` or `` tags. - * - * There are a few things to keep in mind when using `ngApp`: - * - only one AngularJS application can be auto-bootstrapped per HTML document. The first `ngApp` - * found in the document will be used to define the root element to auto-bootstrap as an - * application. To run multiple applications in an HTML document you must manually bootstrap them using - * {@link angular.bootstrap} instead. - * - AngularJS applications cannot be nested within each other. - * - Do not use a directive that uses {@link ng.$compile#transclusion transclusion} on the same element as `ngApp`. - * This includes directives such as {@link ng.ngIf `ngIf`}, {@link ng.ngInclude `ngInclude`} and - * {@link ngRoute.ngView `ngView`}. - * Doing this misplaces the app {@link ng.$rootElement `$rootElement`} and the app's {@link auto.$injector injector}, - * causing animations to stop working and making the injector inaccessible from outside the app. - * - * You can specify an **AngularJS module** to be used as the root module for the application. This - * module will be loaded into the {@link auto.$injector} when the application is bootstrapped. It - * should contain the application code needed or have dependencies on other modules that will - * contain the code. See {@link angular.module} for more information. - * - * In the example below if the `ngApp` directive were not placed on the `html` element then the - * document would not be compiled, the `AppController` would not be instantiated and the `{{ a+b }}` - * would not be resolved to `3`. - * - * @example - * - * ### Simple Usage - * - * `ngApp` is the easiest, and most common way to bootstrap an application. - * - - -
- I can add: {{a}} + {{b}} = {{ a+b }} -
-
- - angular.module('ngAppDemo', []).controller('ngAppDemoController', function($scope) { - $scope.a = 1; - $scope.b = 2; - }); - -
- * - * @example - * - * ### With `ngStrictDi` - * - * Using `ngStrictDi`, you would see something like this: - * - - -
-
- I can add: {{a}} + {{b}} = {{ a+b }} - -

This renders because the controller does not Failed to - instantiate, by using explicit annotation style (see - script.js for details) -

-
- -
- Name:
- Hello, {{name}}! - -

This renders because the controller does not Failed to - instantiate, by using explicit annotation style - (see script.js for details) -

-
- -
- I can add: {{a}} + {{b}} = {{ a+b }} - -

The controller could not be instantiated, due to relying - on automatic function annotations (which are disabled in - strict mode). As such, the content of this section is not - interpolated, and there should be an error in your web console. -

-
-
-
- - angular.module('ngAppStrictDemo', []) - // BadController will Failed to instantiate, due to relying on automatic function annotation, - // rather than an explicit annotation - .controller('BadController', function($scope) { - $scope.a = 1; - $scope.b = 2; - }) - // Unlike BadController, GoodController1 and GoodController2 will not Failed to be instantiated, - // due to using explicit annotations using the array style and $inject property, respectively. - .controller('GoodController1', ['$scope', function($scope) { - $scope.a = 1; - $scope.b = 2; - }]) - .controller('GoodController2', GoodController2); - function GoodController2($scope) { - $scope.name = 'World'; - } - GoodController2.$inject = ['$scope']; - - - div[ng-controller] { - margin-bottom: 1em; - -webkit-border-radius: 4px; - border-radius: 4px; - border: 1px solid; - padding: .5em; - } - div[ng-controller^=Good] { - border-color: #d6e9c6; - background-color: #dff0d8; - color: #3c763d; - } - div[ng-controller^=Bad] { - border-color: #ebccd1; - background-color: #f2dede; - color: #a94442; - margin-bottom: 0; - } - -
- */ - function angularInit(element, bootstrap) { - var appElement, - module, - config = {}; - - // The element `element` has priority over any other element. - forEach(ngAttrPrefixes, function (prefix) { - var name = prefix + 'app'; - - if (!appElement && element.hasAttribute && element.hasAttribute(name)) { - appElement = element; - module = element.getAttribute(name); - } - }); - forEach(ngAttrPrefixes, function (prefix) { - var name = prefix + 'app'; - var candidate; - - if (!appElement && (candidate = element.querySelector('[' + name.replace(':', '\\:') + ']'))) { - appElement = candidate; - module = candidate.getAttribute(name); - } - }); - if (appElement) { - if (!isAutoBootstrapAllowed) { - window.console.error('AngularJS: disabling automatic bootstrap. - * - * - * - * ``` - * - * @param {DOMElement} element DOM element which is the root of AngularJS application. - * @param {Array=} modules an array of modules to load into the application. - * Each item in the array should be the name of a predefined module or a (DI annotated) - * function that will be invoked by the injector as a `config` block. - * See: {@link angular.module modules} - * @param {Object=} config an object for defining configuration options for the application. The - * following keys are supported: - * - * * `strictDi` - disable automatic function annotation for the application. This is meant to - * assist in finding bugs which break minified code. Defaults to `false`. - * - * @returns {auto.$injector} Returns the newly created injector for this app. - */ - function bootstrap(element, modules, config) { - if (!isObject(config)) config = {}; - var defaultConfig = { - strictDi: false - }; - config = extend(defaultConfig, config); - var doBootstrap = function () { - element = jqLite(element); - - if (element.injector()) { - var tag = (element[0] === window.document) ? 'document' : startingTag(element); - // Encode angle brackets to prevent input from being sanitized to empty string #8683. - throw ngMinErr( - 'btstrpd', - 'App already bootstrapped with this element \'{0}\'', - tag.replace(//, '>')); - } - - modules = modules || []; - modules.unshift(['$provide', function ($provide) { - $provide.value('$rootElement', element); - }]); - - if (config.debugInfoEnabled) { - // Pushing so that this overrides `debugInfoEnabled` setting defined in user's `modules`. - modules.push(['$compileProvider', function ($compileProvider) { - $compileProvider.debugInfoEnabled(true); - }]); - } - - modules.unshift('ng'); - var injector = createInjector(modules, config.strictDi); - injector.invoke(['$rootScope', '$rootElement', '$compile', '$injector', - function bootstrapApply(scope, element, compile, injector) { - scope.$apply(function () { - element.data('$injector', injector); - compile(element)(scope); - }); - } - ]); - return injector; - }; - - var NG_ENABLE_DEBUG_INFO = /^NG_ENABLE_DEBUG_INFO!/; - var NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/; - - if (window && NG_ENABLE_DEBUG_INFO.test(window.name)) { - config.debugInfoEnabled = true; - window.name = window.name.replace(NG_ENABLE_DEBUG_INFO, ''); - } - - if (window && !NG_DEFER_BOOTSTRAP.test(window.name)) { - return doBootstrap(); - } - - window.name = window.name.replace(NG_DEFER_BOOTSTRAP, ''); - angular.resumeBootstrap = function (extraModules) { - forEach(extraModules, function (module) { - modules.push(module); - }); - return doBootstrap(); - }; - - if (isFunction(angular.resumeDeferredBootstrap)) { - angular.resumeDeferredBootstrap(); - } - } - - /** - * @ngdoc function - * @name angular.reloadWithDebugInfo - * @module ng - * @description - * Use this function to reload the current application with debug information turned on. - * This takes precedence over a call to `$compileProvider.debugInfoEnabled(false)`. - * - * See {@link ng.$compileProvider#debugInfoEnabled} for more. - */ - function reloadWithDebugInfo() { - window.name = 'NG_ENABLE_DEBUG_INFO!' + window.name; - window.location.reload(); - } - - /** - * @name angular.getTestability - * @module ng - * @description - * Get the testability service for the instance of AngularJS on the given - * element. - * @param {DOMElement} element DOM element which is the root of AngularJS application. - */ - function getTestability(rootElement) { - var injector = angular.element(rootElement).injector(); - if (!injector) { - throw ngMinErr('test', - 'no injector found for element argument to getTestability'); - } - return injector.get('$$testability'); - } - - var SNAKE_CASE_REGEXP = /[A-Z]/g; - - function snake_case(name, separator) { - separator = separator || '_'; - return name.replace(SNAKE_CASE_REGEXP, function (letter, pos) { - return (pos ? separator : '') + letter.toLowerCase(); - }); - } - - var bindJQueryFired = false; - - function bindJQuery() { - var originalCleanData; - - if (bindJQueryFired) { - return; - } - - // bind to jQuery if present; - var jqName = jq(); - jQuery = isUndefined(jqName) ? window.jQuery : // use jQuery (if present) - !jqName ? undefined : // use jqLite - window[jqName]; // use jQuery specified by `ngJq` - - // Use jQuery if it exists with proper functionality, otherwise default to us. - // AngularJS 1.2+ requires jQuery 1.7+ for on()/off() support. - // AngularJS 1.3+ technically requires at least jQuery 2.1+ but it may work with older - // versions. It will not work for sure with jQuery <1.7, though. - if (jQuery && jQuery.fn.on) { - jqLite = jQuery; - extend(jQuery.fn, { - scope: JQLitePrototype.scope, - isolateScope: JQLitePrototype.isolateScope, - controller: /** @type {?} */ (JQLitePrototype).controller, - injector: JQLitePrototype.injector, - inheritedData: JQLitePrototype.inheritedData - }); - } else { - jqLite = JQLite; - } - - // All nodes removed from the DOM via various jqLite/jQuery APIs like .remove() - // are passed through jqLite/jQuery.cleanData. Monkey-patch this method to fire - // the $destroy event on all removed nodes. - originalCleanData = jqLite.cleanData; - jqLite.cleanData = function (elems) { - var events; - for (var i = 0, elem; - (elem = elems[i]) != null; i++) { - events = (jqLite._data(elem) || {}).events; - if (events && events.$destroy) { - jqLite(elem).triggerHandler('$destroy'); - } - } - originalCleanData(elems); - }; - - angular.element = jqLite; - - // Prevent double-proxying. - bindJQueryFired = true; - } - - /** - * @ngdoc function - * @name angular.UNSAFE_restoreLegacyJqLiteXHTMLReplacement - * @module ng - * @kind function - * - * @description - * Restores the pre-1.8 behavior of jqLite that turns XHTML-like strings like - * `
` to `
` instead of `
`. - * The new behavior is a security fix. Thus, if you need to call this function, please try to adjust - * your code for this change and remove your use of this function as soon as possible. - - * Note that this only patches jqLite. If you use jQuery 3.5.0 or newer, please read the - * [jQuery 3.5 upgrade guide](https://jquery.com/upgrade-guide/3.5/) for more details - * about the workarounds. - */ - function UNSAFE_restoreLegacyJqLiteXHTMLReplacement() { - JQLite.legacyXHTMLReplacement = true; - } - - /** - * throw error if the argument is falsy. - */ - function assertArg(arg, name, reason) { - if (!arg) { - throw ngMinErr('areq', 'Argument \'{0}\' is {1}', (name || '?'), (reason || 'required')); - } - return arg; - } - - function assertArgFn(arg, name, acceptArrayAnnotation) { - if (acceptArrayAnnotation && isArray(arg)) { - arg = arg[arg.length - 1]; - } - - assertArg(isFunction(arg), name, 'not a function, got ' + - (arg && typeof arg === 'object' ? arg.constructor.name || 'Object' : typeof arg)); - return arg; - } - - /** - * throw error if the name given is hasOwnProperty - * @param {String} name the name to test - * @param {String} context the context in which the name is used, such as module or directive - */ - function assertNotHasOwnProperty(name, context) { - if (name === 'hasOwnProperty') { - throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context); - } - } - - /** - * Return the value accessible from the object by path. Any undefined traversals are ignored - * @param {Object} obj starting object - * @param {String} path path to traverse - * @param {boolean} [bindFnToScope=true] - * @returns {Object} value as accessible by path - */ - //TODO(misko): this function needs to be removed - function getter(obj, path, bindFnToScope) { - if (!path) return obj; - var keys = path.split('.'); - var key; - var lastInstance = obj; - var len = keys.length; - - for (var i = 0; i < len; i++) { - key = keys[i]; - if (obj) { - obj = (lastInstance = obj)[key]; - } - } - if (!bindFnToScope && isFunction(obj)) { - return bind(lastInstance, obj); - } - return obj; - } - - /** - * Return the DOM siblings between the first and last node in the given array. - * @param {Array} array like object - * @returns {Array} the inputted object or a jqLite collection containing the nodes - */ - function getBlockNodes(nodes) { - // TODO(perf): update `nodes` instead of creating a new object? - var node = nodes[0]; - var endNode = nodes[nodes.length - 1]; - var blockNodes; - - for (var i = 1; node !== endNode && (node = node.nextSibling); i++) { - if (blockNodes || nodes[i] !== node) { - if (!blockNodes) { - blockNodes = jqLite(slice.call(nodes, 0, i)); - } - blockNodes.push(node); - } - } - - return blockNodes || nodes; - } - - - /** - * Creates a new object without a prototype. This object is useful for lookup without having to - * guard against prototypically inherited properties via hasOwnProperty. - * - * Related micro-benchmarks: - * - http://jsperf.com/object-create2 - * - http://jsperf.com/proto-map-lookup/2 - * - http://jsperf.com/for-in-vs-object-keys2 - * - * @returns {Object} - */ - function createMap() { - return Object.create(null); - } - - function stringify(value) { - if (value == null) { // null || undefined - return ''; - } - switch (typeof value) { - case 'string': - break; - case 'number': - value = '' + value; - break; - default: - if (hasCustomToString(value) && !isArray(value) && !isDate(value)) { - value = value.toString(); - } else { - value = toJson(value); - } - } - - return value; - } - - var NODE_TYPE_ELEMENT = 1; - var NODE_TYPE_ATTRIBUTE = 2; - var NODE_TYPE_TEXT = 3; - var NODE_TYPE_COMMENT = 8; - var NODE_TYPE_DOCUMENT = 9; - var NODE_TYPE_DOCUMENT_FRAGMENT = 11; - - /** - * @ngdoc type - * @name angular.Module - * @module ng - * @description - * - * Interface for configuring AngularJS {@link angular.module modules}. - */ - - function setupModuleLoader(window) { - - var $injectorMinErr = minErr('$injector'); - var ngMinErr = minErr('ng'); - - function ensure(obj, name, factory) { - return obj[name] || (obj[name] = factory()); - } - - var angular = ensure(window, 'angular', Object); - - // We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap - angular.$$minErr = angular.$$minErr || minErr; - - return ensure(angular, 'module', function () { - /** @type {Object.} */ - var modules = {}; - - /** - * @ngdoc function - * @name angular.module - * @module ng - * @description - * - * The `angular.module` is a global place for creating, registering and retrieving AngularJS - * modules. - * All modules (AngularJS core or 3rd party) that should be available to an application must be - * registered using this mechanism. - * - * Passing one argument retrieves an existing {@link angular.Module}, - * whereas passing more than one argument creates a new {@link angular.Module} - * - * - * # Module - * - * A module is a collection of services, directives, controllers, filters, and configuration information. - * `angular.module` is used to configure the {@link auto.$injector $injector}. - * - * ```js - * // Create a new module - * var myModule = angular.module('myModule', []); - * - * // register a new service - * myModule.value('appName', 'MyCoolApp'); - * - * // configure existing services inside initialization blocks. - * myModule.config(['$locationProvider', function($locationProvider) { - * // Configure existing providers - * $locationProvider.hashPrefix('!'); - * }]); - * ``` - * - * Then you can create an injector and load your modules like this: - * - * ```js - * var injector = angular.injector(['ng', 'myModule']) - * ``` - * - * However it's more likely that you'll just use - * {@link ng.directive:ngApp ngApp} or - * {@link angular.bootstrap} to simplify this process for you. - * - * @param {!string} name The name of the module to create or retrieve. - * @param {!Array.=} requires If specified then new module is being created. If - * unspecified then the module is being retrieved for further configuration. - * @param {Function=} configFn Optional configuration function for the module. Same as - * {@link angular.Module#config Module#config()}. - * @returns {angular.Module} new module with the {@link angular.Module} api. - */ - return function module(name, requires, configFn) { - - var info = {}; - - var assertNotHasOwnProperty = function (name, context) { - if (name === 'hasOwnProperty') { - throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context); - } - }; - - assertNotHasOwnProperty(name, 'module'); - if (requires && modules.hasOwnProperty(name)) { - modules[name] = null; - } - return ensure(modules, name, function () { - if (!requires) { - throw $injectorMinErr('nomod', 'Module \'{0}\' is not available! You either misspelled ' + - 'the module name or forgot to load it. If registering a module ensure that you ' + - 'specify the dependencies as the second argument.', name); - } - - /** @type {!Array.>} */ - var invokeQueue = []; - - /** @type {!Array.} */ - var configBlocks = []; - - /** @type {!Array.} */ - var runBlocks = []; - - var config = invokeLater('$injector', 'invoke', 'push', configBlocks); - - /** @type {angular.Module} */ - var moduleInstance = { - // Private state - _invokeQueue: invokeQueue, - _configBlocks: configBlocks, - _runBlocks: runBlocks, - - /** - * @ngdoc method - * @name angular.Module#info - * @module ng - * - * @param {Object=} info Information about the module - * @returns {Object|Module} The current info object for this module if called as a getter, - * or `this` if called as a setter. - * - * @description - * Read and write custom information about this module. - * For example you could put the version of the module in here. - * - * ```js - * angular.module('myModule', []).info({ version: '1.0.0' }); - * ``` - * - * The version could then be read back out by accessing the module elsewhere: - * - * ``` - * var version = angular.module('myModule').info().version; - * ``` - * - * You can also retrieve this information during runtime via the - * {@link $injector#modules `$injector.modules`} property: - * - * ```js - * var version = $injector.modules['myModule'].info().version; - * ``` - */ - info: function (value) { - if (isDefined(value)) { - if (!isObject(value)) throw ngMinErr('aobj', 'Argument \'{0}\' must be an object', 'value'); - info = value; - return this; - } - return info; - }, - - /** - * @ngdoc property - * @name angular.Module#requires - * @module ng - * - * @description - * Holds the list of modules which the injector will load before the current module is - * loaded. - */ - requires: requires, - - /** - * @ngdoc property - * @name angular.Module#name - * @module ng - * - * @description - * Name of the module. - */ - name: name, - - - /** - * @ngdoc method - * @name angular.Module#provider - * @module ng - * @param {string} name service name - * @param {Function} providerType Construction function for creating new instance of the - * service. - * @description - * See {@link auto.$provide#provider $provide.provider()}. - */ - provider: invokeLaterAndSetModuleName('$provide', 'provider'), - - /** - * @ngdoc method - * @name angular.Module#factory - * @module ng - * @param {string} name service name - * @param {Function} providerFunction Function for creating new instance of the service. - * @description - * See {@link auto.$provide#factory $provide.factory()}. - */ - factory: invokeLaterAndSetModuleName('$provide', 'factory'), - - /** - * @ngdoc method - * @name angular.Module#service - * @module ng - * @param {string} name service name - * @param {Function} constructor A constructor function that will be instantiated. - * @description - * See {@link auto.$provide#service $provide.service()}. - */ - service: invokeLaterAndSetModuleName('$provide', 'service'), - - /** - * @ngdoc method - * @name angular.Module#value - * @module ng - * @param {string} name service name - * @param {*} object Service instance object. - * @description - * See {@link auto.$provide#value $provide.value()}. - */ - value: invokeLater('$provide', 'value'), - - /** - * @ngdoc method - * @name angular.Module#constant - * @module ng - * @param {string} name constant name - * @param {*} object Constant value. - * @description - * Because the constants are fixed, they get applied before other provide methods. - * See {@link auto.$provide#constant $provide.constant()}. - */ - constant: invokeLater('$provide', 'constant', 'unshift'), - - /** - * @ngdoc method - * @name angular.Module#decorator - * @module ng - * @param {string} name The name of the service to decorate. - * @param {Function} decorFn This function will be invoked when the service needs to be - * instantiated and should return the decorated service instance. - * @description - * See {@link auto.$provide#decorator $provide.decorator()}. - */ - decorator: invokeLaterAndSetModuleName('$provide', 'decorator', configBlocks), - - /** - * @ngdoc method - * @name angular.Module#animation - * @module ng - * @param {string} name animation name - * @param {Function} animationFactory Factory function for creating new instance of an - * animation. - * @description - * - * **NOTE**: animations take effect only if the **ngAnimate** module is loaded. - * - * - * Defines an animation hook that can be later used with - * {@link $animate $animate} service and directives that use this service. - * - * ```js - * module.animation('.animation-name', function($inject1, $inject2) { - * return { - * eventName : function(element, done) { - * //code to run the animation - * //once complete, then run done() - * return function cancellationFunction(element) { - * //code to cancel the animation - * } - * } - * } - * }) - * ``` - * - * See {@link ng.$animateProvider#register $animateProvider.register()} and - * {@link ngAnimate ngAnimate module} for more information. - */ - animation: invokeLaterAndSetModuleName('$animateProvider', 'register'), - - /** - * @ngdoc method - * @name angular.Module#filter - * @module ng - * @param {string} name Filter name - this must be a valid AngularJS expression identifier - * @param {Function} filterFactory Factory function for creating new instance of filter. - * @description - * See {@link ng.$filterProvider#register $filterProvider.register()}. - * - *
- * **Note:** Filter names must be valid AngularJS {@link expression} identifiers, such as `uppercase` or `orderBy`. - * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace - * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores - * (`myapp_subsection_filterx`). - *
- */ - filter: invokeLaterAndSetModuleName('$filterProvider', 'register'), - - /** - * @ngdoc method - * @name angular.Module#controller - * @module ng - * @param {string|Object} name Controller name, or an object map of controllers where the - * keys are the names and the values are the constructors. - * @param {Function} constructor Controller constructor function. - * @description - * See {@link ng.$controllerProvider#register $controllerProvider.register()}. - */ - controller: invokeLaterAndSetModuleName('$controllerProvider', 'register'), - - /** - * @ngdoc method - * @name angular.Module#directive - * @module ng - * @param {string|Object} name Directive name, or an object map of directives where the - * keys are the names and the values are the factories. - * @param {Function} directiveFactory Factory function for creating new instance of - * directives. - * @description - * See {@link ng.$compileProvider#directive $compileProvider.directive()}. - */ - directive: invokeLaterAndSetModuleName('$compileProvider', 'directive'), - - /** - * @ngdoc method - * @name angular.Module#component - * @module ng - * @param {string|Object} name Name of the component in camelCase (i.e. `myComp` which will match ``), - * or an object map of components where the keys are the names and the values are the component definition objects. - * @param {Object} options Component definition object (a simplified - * {@link ng.$compile#directive-definition-object directive definition object}) - * - * @description - * See {@link ng.$compileProvider#component $compileProvider.component()}. - */ - component: invokeLaterAndSetModuleName('$compileProvider', 'component'), - - /** - * @ngdoc method - * @name angular.Module#config - * @module ng - * @param {Function} configFn Execute this function on module load. Useful for service - * configuration. - * @description - * Use this method to configure services by injecting their - * {@link angular.Module#provider `providers`}, e.g. for adding routes to the - * {@link ngRoute.$routeProvider $routeProvider}. - * - * Note that you can only inject {@link angular.Module#provider `providers`} and - * {@link angular.Module#constant `constants`} into this function. - * - * For more about how to configure services, see - * {@link providers#provider-recipe Provider Recipe}. - */ - config: config, - - /** - * @ngdoc method - * @name angular.Module#run - * @module ng - * @param {Function} initializationFn Execute this function after injector creation. - * Useful for application initialization. - * @description - * Use this method to register work which should be performed when the injector is done - * loading all modules. - */ - run: function (block) { - runBlocks.push(block); - return this; - } - }; - - if (configFn) { - config(configFn); - } - - return moduleInstance; - - /** - * @param {string} provider - * @param {string} method - * @param {String=} insertMethod - * @returns {angular.Module} - */ - function invokeLater(provider, method, insertMethod, queue) { - if (!queue) queue = invokeQueue; - return function () { - queue[insertMethod || 'push']([provider, method, arguments]); - return moduleInstance; - }; - } - - /** - * @param {string} provider - * @param {string} method - * @returns {angular.Module} - */ - function invokeLaterAndSetModuleName(provider, method, queue) { - if (!queue) queue = invokeQueue; - return function (recipeName, factoryFunction) { - if (factoryFunction && isFunction(factoryFunction)) factoryFunction.$$moduleName = name; - queue.push([provider, method, arguments]); - return moduleInstance; - }; - } - }); - }; - }); - - } - - /* global shallowCopy: true */ - - /** - * Creates a shallow copy of an object, an array or a primitive. - * - * Assumes that there are no proto properties for objects. - */ - function shallowCopy(src, dst) { - if (isArray(src)) { - dst = dst || []; - - for (var i = 0, ii = src.length; i < ii; i++) { - dst[i] = src[i]; - } - } else if (isObject(src)) { - dst = dst || {}; - - for (var key in src) { - if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) { - dst[key] = src[key]; - } - } - } - - return dst || src; - } - - /* exported toDebugString */ - - function serializeObject(obj, maxDepth) { - var seen = []; - - // There is no direct way to stringify object until reaching a specific depth - // and a very deep object can cause a performance issue, so we copy the object - // based on this specific depth and then stringify it. - if (isValidObjectMaxDepth(maxDepth)) { - // This file is also included in `angular-loader`, so `copy()` might not always be available in - // the closure. Therefore, it is lazily retrieved as `angular.copy()` when needed. - obj = angular.copy(obj, null, maxDepth); - } - return JSON.stringify(obj, function (key, val) { - val = toJsonReplacer(key, val); - if (isObject(val)) { - - if (seen.indexOf(val) >= 0) return '...'; - - seen.push(val); - } - return val; - }); - } - - function toDebugString(obj, maxDepth) { - if (typeof obj === 'function') { - return obj.toString().replace(/ \{[\s\S]*$/, ''); - } else if (isUndefined(obj)) { - return 'undefined'; - } else if (typeof obj !== 'string') { - return serializeObject(obj, maxDepth); - } - return obj; - } - - /* global angularModule: true, - version: true, - - $CompileProvider, - - htmlAnchorDirective, - inputDirective, - hiddenInputBrowserCacheDirective, - formDirective, - scriptDirective, - selectDirective, - optionDirective, - ngBindDirective, - ngBindHtmlDirective, - ngBindTemplateDirective, - ngClassDirective, - ngClassEvenDirective, - ngClassOddDirective, - ngCloakDirective, - ngControllerDirective, - ngFormDirective, - ngHideDirective, - ngIfDirective, - ngIncludeDirective, - ngIncludeFillContentDirective, - ngInitDirective, - ngNonBindableDirective, - ngPluralizeDirective, - ngRefDirective, - ngRepeatDirective, - ngShowDirective, - ngStyleDirective, - ngSwitchDirective, - ngSwitchWhenDirective, - ngSwitchDefaultDirective, - ngOptionsDirective, - ngTranscludeDirective, - ngModelDirective, - ngListDirective, - ngChangeDirective, - patternDirective, - patternDirective, - requiredDirective, - requiredDirective, - minlengthDirective, - minlengthDirective, - maxlengthDirective, - maxlengthDirective, - ngValueDirective, - ngModelOptionsDirective, - ngAttributeAliasDirectives, - ngEventDirectives, - - $AnchorScrollProvider, - $AnimateProvider, - $CoreAnimateCssProvider, - $$CoreAnimateJsProvider, - $$CoreAnimateQueueProvider, - $$AnimateRunnerFactoryProvider, - $$AnimateAsyncRunFactoryProvider, - $BrowserProvider, - $CacheFactoryProvider, - $ControllerProvider, - $DateProvider, - $DocumentProvider, - $$IsDocumentHiddenProvider, - $ExceptionHandlerProvider, - $FilterProvider, - $$ForceReflowProvider, - $InterpolateProvider, - $$IntervalFactoryProvider, - $IntervalProvider, - $HttpProvider, - $HttpParamSerializerProvider, - $HttpParamSerializerJQLikeProvider, - $HttpBackendProvider, - $xhrFactoryProvider, - $jsonpCallbacksProvider, - $LocationProvider, - $LogProvider, - $$MapProvider, - $ParseProvider, - $RootScopeProvider, - $QProvider, - $$QProvider, - $$SanitizeUriProvider, - $SceProvider, - $SceDelegateProvider, - $SnifferProvider, - $$TaskTrackerFactoryProvider, - $TemplateCacheProvider, - $TemplateRequestProvider, - $$TestabilityProvider, - $TimeoutProvider, - $$RAFProvider, - $WindowProvider, - $$jqLiteProvider, - $$CookieReaderProvider - */ - - - /** - * @ngdoc object - * @name angular.version - * @module ng - * @description - * An object that contains information about the current AngularJS version. - * - * This object has the following properties: - * - * - `full` – `{string}` – Full version string, such as "0.9.18". - * - `major` – `{number}` – Major version number, such as "0". - * - `minor` – `{number}` – Minor version number, such as "9". - * - `dot` – `{number}` – Dot version number, such as "18". - * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat". - */ - var version = { - // These placeholder strings will be replaced by grunt's `build` task. - // They need to be double- or single-quoted. - full: '1.8.2', - major: 1, - minor: 8, - dot: 2, - codeName: 'meteoric-mining' - }; - - - function publishExternalAPI(angular) { - extend(angular, { - 'errorHandlingConfig': errorHandlingConfig, - 'bootstrap': bootstrap, - 'copy': copy, - 'extend': extend, - 'merge': merge, - 'equals': equals, - 'element': jqLite, - 'forEach': forEach, - 'injector': createInjector, - 'noop': noop, - 'bind': bind, - 'toJson': toJson, - 'fromJson': fromJson, - 'identity': identity, - 'isUndefined': isUndefined, - 'isDefined': isDefined, - 'isString': isString, - 'isFunction': isFunction, - 'isObject': isObject, - 'isNumber': isNumber, - 'isElement': isElement, - 'isArray': isArray, - 'version': version, - 'isDate': isDate, - 'callbacks': { - $$counter: 0 - }, - 'getTestability': getTestability, - 'reloadWithDebugInfo': reloadWithDebugInfo, - 'UNSAFE_restoreLegacyJqLiteXHTMLReplacement': UNSAFE_restoreLegacyJqLiteXHTMLReplacement, - '$$minErr': minErr, - '$$csp': csp, - '$$encodeUriSegment': encodeUriSegment, - '$$encodeUriQuery': encodeUriQuery, - '$$lowercase': lowercase, - '$$stringify': stringify, - '$$uppercase': uppercase - }); - - angularModule = setupModuleLoader(window); - - angularModule('ng', ['ngLocale'], ['$provide', - function ngModule($provide) { - // $$sanitizeUriProvider needs to be before $compileProvider as it is used by it. - $provide.provider({ - $$sanitizeUri: $$SanitizeUriProvider - }); - $provide.provider('$compile', $CompileProvider). - directive({ - a: htmlAnchorDirective, - input: inputDirective, - textarea: inputDirective, - form: formDirective, - script: scriptDirective, - select: selectDirective, - option: optionDirective, - ngBind: ngBindDirective, - ngBindHtml: ngBindHtmlDirective, - ngBindTemplate: ngBindTemplateDirective, - ngClass: ngClassDirective, - ngClassEven: ngClassEvenDirective, - ngClassOdd: ngClassOddDirective, - ngCloak: ngCloakDirective, - ngController: ngControllerDirective, - ngForm: ngFormDirective, - ngHide: ngHideDirective, - ngIf: ngIfDirective, - ngInclude: ngIncludeDirective, - ngInit: ngInitDirective, - ngNonBindable: ngNonBindableDirective, - ngPluralize: ngPluralizeDirective, - ngRef: ngRefDirective, - ngRepeat: ngRepeatDirective, - ngShow: ngShowDirective, - ngStyle: ngStyleDirective, - ngSwitch: ngSwitchDirective, - ngSwitchWhen: ngSwitchWhenDirective, - ngSwitchDefault: ngSwitchDefaultDirective, - ngOptions: ngOptionsDirective, - ngTransclude: ngTranscludeDirective, - ngModel: ngModelDirective, - ngList: ngListDirective, - ngChange: ngChangeDirective, - pattern: patternDirective, - ngPattern: patternDirective, - required: requiredDirective, - ngRequired: requiredDirective, - minlength: minlengthDirective, - ngMinlength: minlengthDirective, - maxlength: maxlengthDirective, - ngMaxlength: maxlengthDirective, - ngValue: ngValueDirective, - ngModelOptions: ngModelOptionsDirective - }). - directive({ - ngInclude: ngIncludeFillContentDirective, - input: hiddenInputBrowserCacheDirective - }). - directive(ngAttributeAliasDirectives). - directive(ngEventDirectives); - $provide.provider({ - $anchorScroll: $AnchorScrollProvider, - $animate: $AnimateProvider, - $animateCss: $CoreAnimateCssProvider, - $$animateJs: $$CoreAnimateJsProvider, - $$animateQueue: $$CoreAnimateQueueProvider, - $$AnimateRunner: $$AnimateRunnerFactoryProvider, - $$animateAsyncRun: $$AnimateAsyncRunFactoryProvider, - $browser: $BrowserProvider, - $cacheFactory: $CacheFactoryProvider, - $controller: $ControllerProvider, - $document: $DocumentProvider, - $$isDocumentHidden: $$IsDocumentHiddenProvider, - $exceptionHandler: $ExceptionHandlerProvider, - $filter: $FilterProvider, - $$forceReflow: $$ForceReflowProvider, - $interpolate: $InterpolateProvider, - $interval: $IntervalProvider, - $$intervalFactory: $$IntervalFactoryProvider, - $http: $HttpProvider, - $httpParamSerializer: $HttpParamSerializerProvider, - $httpParamSerializerJQLike: $HttpParamSerializerJQLikeProvider, - $httpBackend: $HttpBackendProvider, - $xhrFactory: $xhrFactoryProvider, - $jsonpCallbacks: $jsonpCallbacksProvider, - $location: $LocationProvider, - $log: $LogProvider, - $parse: $ParseProvider, - $rootScope: $RootScopeProvider, - $q: $QProvider, - $$q: $$QProvider, - $sce: $SceProvider, - $sceDelegate: $SceDelegateProvider, - $sniffer: $SnifferProvider, - $$taskTrackerFactory: $$TaskTrackerFactoryProvider, - $templateCache: $TemplateCacheProvider, - $templateRequest: $TemplateRequestProvider, - $$testability: $$TestabilityProvider, - $timeout: $TimeoutProvider, - $window: $WindowProvider, - $$rAF: $$RAFProvider, - $$jqLite: $$jqLiteProvider, - $$Map: $$MapProvider, - $$cookieReader: $$CookieReaderProvider - }); - } - ]) - .info({ - //Eoapi æºç ï¼šangularVersion: '1.8.2'; - }); - } - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Any commits to this file should be reviewed with security in mind. * - * Changes to this file can potentially create security vulnerabilities. * - * An approval from 2 Core members with history of modifying * - * this file is required. * - * * - * Does the change somehow allow for arbitrary javascript to be executed? * - * Or allows for someone to change the prototype of built-in objects? * - * Or gives undesired access to variables likes document or window? * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - /* global - JQLitePrototype: true, - BOOLEAN_ATTR: true, - ALIASED_ATTR: true - */ - - ////////////////////////////////// - //JQLite - ////////////////////////////////// - - /** - * @ngdoc function - * @name angular.element - * @module ng - * @kind function - * - * @description - * Wraps a raw DOM element or HTML string as a [jQuery](http://jquery.com) element. - * - * If jQuery is available, `angular.element` is an alias for the - * [jQuery](http://api.jquery.com/jQuery/) function. If jQuery is not available, `angular.element` - * delegates to AngularJS's built-in subset of jQuery, called "jQuery lite" or **jqLite**. - * - * jqLite is a tiny, API-compatible subset of jQuery that allows - * AngularJS to manipulate the DOM in a cross-browser compatible way. jqLite implements only the most - * commonly needed functionality with the goal of having a very small footprint. - * - * To use `jQuery`, simply ensure it is loaded before the `angular.js` file. You can also use the - * {@link ngJq `ngJq`} directive to specify that jqlite should be used over jQuery, or to use a - * specific version of jQuery if multiple versions exist on the page. - * - *
**Note:** All element references in AngularJS are always wrapped with jQuery or - * jqLite (such as the element argument in a directive's compile / link function). They are never raw DOM references.
- * - *
**Note:** Keep in mind that this function will not find elements - * by tag name / CSS selector. For lookups by tag name, try instead `angular.element(document).find(...)` - * or `$document.find()`, or use the standard DOM APIs, e.g. `document.querySelectorAll()`.
- * - * ## AngularJS's jqLite - * jqLite provides only the following jQuery methods: - * - * - [`addClass()`](http://api.jquery.com/addClass/) - Does not support a function as first argument - * - [`after()`](http://api.jquery.com/after/) - * - [`append()`](http://api.jquery.com/append/) - Contrary to jQuery, this doesn't clone elements - * so will not work correctly when invoked on a jqLite object containing more than one DOM node - * - [`attr()`](http://api.jquery.com/attr/) - Does not support functions as parameters - * - [`bind()`](http://api.jquery.com/bind/) (_deprecated_, use [`on()`](http://api.jquery.com/on/)) - Does not support namespaces, selectors or eventData - * - [`children()`](http://api.jquery.com/children/) - Does not support selectors - * - [`clone()`](http://api.jquery.com/clone/) - * - [`contents()`](http://api.jquery.com/contents/) - * - [`css()`](http://api.jquery.com/css/) - Only retrieves inline-styles, does not call `getComputedStyle()`. - * As a setter, does not convert numbers to strings or append 'px', and also does not have automatic property prefixing. - * - [`data()`](http://api.jquery.com/data/) - * - [`detach()`](http://api.jquery.com/detach/) - * - [`empty()`](http://api.jquery.com/empty/) - * - [`eq()`](http://api.jquery.com/eq/) - * - [`find()`](http://api.jquery.com/find/) - Limited to lookups by tag name - * - [`hasClass()`](http://api.jquery.com/hasClass/) - * - [`html()`](http://api.jquery.com/html/) - * - [`next()`](http://api.jquery.com/next/) - Does not support selectors - * - [`on()`](http://api.jquery.com/on/) - Does not support namespaces, selectors or eventData - * - [`off()`](http://api.jquery.com/off/) - Does not support namespaces, selectors or event object as parameter - * - [`one()`](http://api.jquery.com/one/) - Does not support namespaces or selectors - * - [`parent()`](http://api.jquery.com/parent/) - Does not support selectors - * - [`prepend()`](http://api.jquery.com/prepend/) - * - [`prop()`](http://api.jquery.com/prop/) - * - [`ready()`](http://api.jquery.com/ready/) (_deprecated_, use `angular.element(callback)` instead of `angular.element(document).ready(callback)`) - * - [`remove()`](http://api.jquery.com/remove/) - * - [`removeAttr()`](http://api.jquery.com/removeAttr/) - Does not support multiple attributes - * - [`removeClass()`](http://api.jquery.com/removeClass/) - Does not support a function as first argument - * - [`removeData()`](http://api.jquery.com/removeData/) - * - [`replaceWith()`](http://api.jquery.com/replaceWith/) - * - [`text()`](http://api.jquery.com/text/) - * - [`toggleClass()`](http://api.jquery.com/toggleClass/) - Does not support a function as first argument - * - [`triggerHandler()`](http://api.jquery.com/triggerHandler/) - Passes a dummy event object to handlers - * - [`unbind()`](http://api.jquery.com/unbind/) (_deprecated_, use [`off()`](http://api.jquery.com/off/)) - Does not support namespaces or event object as parameter - * - [`val()`](http://api.jquery.com/val/) - * - [`wrap()`](http://api.jquery.com/wrap/) - * - * jqLite also provides a method restoring pre-1.8 insecure treatment of XHTML-like tags. - * This legacy behavior turns input like `
` to `
` - * instead of `
` like version 1.8 & newer do. To restore it, invoke: - * ```js - * angular.UNSAFE_restoreLegacyJqLiteXHTMLReplacement(); - * ``` - * Note that this only patches jqLite. If you use jQuery 3.5.0 or newer, please read the - * [jQuery 3.5 upgrade guide](https://jquery.com/upgrade-guide/3.5/) for more details - * about the workarounds. - * - * ## jQuery/jqLite Extras - * AngularJS also provides the following additional methods and events to both jQuery and jqLite: - * - * ### Events - * - `$destroy` - AngularJS intercepts all jqLite/jQuery's DOM destruction apis and fires this event - * on all DOM nodes being removed. This can be used to clean up any 3rd party bindings to the DOM - * element before it is removed. - * - * ### Methods - * - `controller(name)` - retrieves the controller of the current element or its parent. By default - * retrieves controller associated with the `ngController` directive. If `name` is provided as - * camelCase directive name, then the controller for this directive will be retrieved (e.g. - * `'ngModel'`). - * - `injector()` - retrieves the injector of the current element or its parent. - * - `scope()` - retrieves the {@link ng.$rootScope.Scope scope} of the current - * element or its parent. Requires {@link guide/production#disabling-debug-data Debug Data} to - * be enabled. - * - `isolateScope()` - retrieves an isolate {@link ng.$rootScope.Scope scope} if one is attached directly to the - * current element. This getter should be used only on elements that contain a directive which starts a new isolate - * scope. Calling `scope()` on this element always returns the original non-isolate scope. - * Requires {@link guide/production#disabling-debug-data Debug Data} to be enabled. - * - `inheritedData()` - same as `data()`, but walks up the DOM until a value is found or the top - * parent element is reached. - * - * @knownIssue You cannot spy on `angular.element` if you are using Jasmine version 1.x. See - * https://github.com/angular/angular.js/issues/14251 for more information. - * - * @param {string|DOMElement} element HTML string or DOMElement to be wrapped into jQuery. - * @returns {Object} jQuery object. - */ - - JQLite.expando = 'ng339'; - - var jqCache = JQLite.cache = {}, - jqId = 1; - - /* - * !!! This is an undocumented "private" function !!! - */ - JQLite._data = function (node) { - //jQuery always returns an object on cache miss - return this.cache[node[this.expando]] || {}; - }; - - function jqNextId() { - return ++jqId; - } - - - var DASH_LOWERCASE_REGEXP = /-([a-z])/g; - var MS_HACK_REGEXP = /^-ms-/; - var MOUSE_EVENT_MAP = { - mouseleave: 'mouseout', - mouseenter: 'mouseover' - }; - var jqLiteMinErr = minErr('jqLite'); - - /** - * Converts kebab-case to camelCase. - * There is also a special case for the ms prefix starting with a lowercase letter. - * @param name Name to normalize - */ - function cssKebabToCamel(name) { - return kebabToCamel(name.replace(MS_HACK_REGEXP, 'ms-')); - } - - function fnCamelCaseReplace(all, letter) { - return letter.toUpperCase(); - } - - /** - * Converts kebab-case to camelCase. - * @param name Name to normalize - */ - function kebabToCamel(name) { - return name - .replace(DASH_LOWERCASE_REGEXP, fnCamelCaseReplace); - } - - var SINGLE_TAG_REGEXP = /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/; - var HTML_REGEXP = /<|&#?\w+;/; - var TAG_NAME_REGEXP = /<([\w:-]+)/; - var XHTML_TAG_REGEXP = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi; - - // Table parts need to be wrapped with `` or they're - // stripped to their contents when put in a div. - // XHTML parsers do not magically insert elements in the - // same way that tag soup parsers do, so we cannot shorten - // this by omitting or other required elements. - var wrapMap = { - thead: ['table'], - col: ['colgroup', 'table'], - tr: ['tbody', 'table'], - td: ['tr', 'tbody', 'table'] - }; - - wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; - wrapMap.th = wrapMap.td; - - // Support: IE <10 only - // IE 9 requires an option wrapper & it needs to have the whole table structure - // set up in advance; assigning `""` to `tr.innerHTML` doesn't work, etc. - var wrapMapIE9 = { - option: [1, ''], - _default: [0, '', ''] - }; - - for (var key in wrapMap) { - var wrapMapValueClosing = wrapMap[key]; - var wrapMapValue = wrapMapValueClosing.slice().reverse(); - wrapMapIE9[key] = [wrapMapValue.length, '<' + wrapMapValue.join('><') + '>', '']; - } - - wrapMapIE9.optgroup = wrapMapIE9.option; - - function jqLiteIsTextNode(html) { - return !HTML_REGEXP.test(html); - } - - function jqLiteAcceptsData(node) { - // The window object can accept data but has no nodeType - // Otherwise we are only interested in elements (1) and documents (9) - var nodeType = node.nodeType; - return nodeType === NODE_TYPE_ELEMENT || !nodeType || nodeType === NODE_TYPE_DOCUMENT; - } - - function jqLiteHasData(node) { - for (var key in jqCache[node.ng339]) { - return true; - } - return false; - } - - function jqLiteBuildFragment(html, context) { - var tmp, tag, wrap, finalHtml, - fragment = context.createDocumentFragment(), - nodes = [], - i; - - if (jqLiteIsTextNode(html)) { - // Convert non-html into a text node - nodes.push(context.createTextNode(html)); - } else { - // Convert html into DOM nodes - tmp = fragment.appendChild(context.createElement('div')); - tag = (TAG_NAME_REGEXP.exec(html) || ['', ''])[1].toLowerCase(); - finalHtml = JQLite.legacyXHTMLReplacement ? - html.replace(XHTML_TAG_REGEXP, '<$1>') : - html; - - if (msie < 10) { - wrap = wrapMapIE9[tag] || wrapMapIE9._default; - tmp.innerHTML = wrap[1] + finalHtml + wrap[2]; - - // Descend through wrappers to the right content - i = wrap[0]; - while (i--) { - tmp = tmp.firstChild; - } - } else { - wrap = wrapMap[tag] || []; - - // Create wrappers & descend into them - i = wrap.length; - while (--i > -1) { - tmp.appendChild(window.document.createElement(wrap[i])); - tmp = tmp.firstChild; - } - - tmp.innerHTML = finalHtml; - } - - nodes = concat(nodes, tmp.childNodes); - - tmp = fragment.firstChild; - tmp.textContent = ''; - } - - // Remove wrapper from fragment - fragment.textContent = ''; - fragment.innerHTML = ''; // Clear inner HTML - forEach(nodes, function (node) { - fragment.appendChild(node); - }); - - return fragment; - } - - function jqLiteParseHTML(html, context) { - context = context || window.document; - var parsed; - - if ((parsed = SINGLE_TAG_REGEXP.exec(html))) { - return [context.createElement(parsed[1])]; - } - - if ((parsed = jqLiteBuildFragment(html, context))) { - return parsed.childNodes; - } - - return []; - } - - function jqLiteWrapNode(node, wrapper) { - var parent = node.parentNode; - - if (parent) { - parent.replaceChild(wrapper, node); - } - - wrapper.appendChild(node); - } - - - // IE9-11 has no method "contains" in SVG element and in Node.prototype. Bug #10259. - var jqLiteContains = window.Node.prototype.contains || /** @this */ function (arg) { - // eslint-disable-next-line no-bitwise - return !!(this.compareDocumentPosition(arg) & 16); - }; - - ///////////////////////////////////////////// - function JQLite(element) { - if (element instanceof JQLite) { - return element; - } - - var argIsString; - - if (isString(element)) { - element = trim(element); - argIsString = true; - } - if (!(this instanceof JQLite)) { - if (argIsString && element.charAt(0) !== '<') { - throw jqLiteMinErr('nosel', 'Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element'); - } - return new JQLite(element); - } - - if (argIsString) { - jqLiteAddNodes(this, jqLiteParseHTML(element)); - } else if (isFunction(element)) { - jqLiteReady(element); - } else { - jqLiteAddNodes(this, element); - } - } - - function jqLiteClone(element) { - return element.cloneNode(true); - } - - function jqLiteDealoc(element, onlyDescendants) { - if (!onlyDescendants && jqLiteAcceptsData(element)) jqLite.cleanData([element]); - - if (element.querySelectorAll) { - jqLite.cleanData(element.querySelectorAll('*')); - } - } - - function isEmptyObject(obj) { - var name; - - for (name in obj) { - return false; - } - return true; - } - - function removeIfEmptyData(element) { - var expandoId = element.ng339; - var expandoStore = expandoId && jqCache[expandoId]; - - var events = expandoStore && expandoStore.events; - var data = expandoStore && expandoStore.data; - - if ((!data || isEmptyObject(data)) && (!events || isEmptyObject(events))) { - delete jqCache[expandoId]; - element.ng339 = undefined; // don't delete DOM expandos. IE and Chrome don't like it - } - } - - function jqLiteOff(element, type, fn, unsupported) { - if (isDefined(unsupported)) throw jqLiteMinErr('offargs', 'jqLite#off() does not support the `selector` argument'); - - var expandoStore = jqLiteExpandoStore(element); - var events = expandoStore && expandoStore.events; - var handle = expandoStore && expandoStore.handle; - - if (!handle) return; //no listeners registered - - if (!type) { - for (type in events) { - if (type !== '$destroy') { - element.removeEventListener(type, handle); - } - delete events[type]; - } - } else { - - var removeHandler = function (type) { - var listenerFns = events[type]; - if (isDefined(fn)) { - arrayRemove(listenerFns || [], fn); - } - if (!(isDefined(fn) && listenerFns && listenerFns.length > 0)) { - element.removeEventListener(type, handle); - delete events[type]; - } - }; - - forEach(type.split(' '), function (type) { - removeHandler(type); - if (MOUSE_EVENT_MAP[type]) { - removeHandler(MOUSE_EVENT_MAP[type]); - } - }); - } - - removeIfEmptyData(element); - } - - function jqLiteRemoveData(element, name) { - var expandoId = element.ng339; - var expandoStore = expandoId && jqCache[expandoId]; - - if (expandoStore) { - if (name) { - delete expandoStore.data[name]; - } else { - expandoStore.data = {}; - } - - removeIfEmptyData(element); - } - } - - - function jqLiteExpandoStore(element, createIfNecessary) { - var expandoId = element.ng339, - expandoStore = expandoId && jqCache[expandoId]; - - if (createIfNecessary && !expandoStore) { - element.ng339 = expandoId = jqNextId(); - expandoStore = jqCache[expandoId] = { - events: {}, - data: {}, - handle: undefined - }; - } - - return expandoStore; - } - - - function jqLiteData(element, key, value) { - if (jqLiteAcceptsData(element)) { - var prop; - - var isSimpleSetter = isDefined(value); - var isSimpleGetter = !isSimpleSetter && key && !isObject(key); - var massGetter = !key; - var expandoStore = jqLiteExpandoStore(element, !isSimpleGetter); - var data = expandoStore && expandoStore.data; - - if (isSimpleSetter) { // data('key', value) - data[kebabToCamel(key)] = value; - } else { - if (massGetter) { // data() - return data; - } else { - if (isSimpleGetter) { // data('key') - // don't force creation of expandoStore if it doesn't exist yet - return data && data[kebabToCamel(key)]; - } else { // mass-setter: data({key1: val1, key2: val2}) - for (prop in key) { - data[kebabToCamel(prop)] = key[prop]; - } - } - } - } - } - } - - function jqLiteHasClass(element, selector) { - if (!element.getAttribute) return false; - return ((' ' + (element.getAttribute('class') || '') + ' ').replace(/[\n\t]/g, ' ').indexOf(' ' + selector + ' ') > -1); - } - - function jqLiteRemoveClass(element, cssClasses) { - if (cssClasses && element.setAttribute) { - var existingClasses = (' ' + (element.getAttribute('class') || '') + ' ') - .replace(/[\n\t]/g, ' '); - var newClasses = existingClasses; - - forEach(cssClasses.split(' '), function (cssClass) { - cssClass = trim(cssClass); - newClasses = newClasses.replace(' ' + cssClass + ' ', ' '); - }); - - if (newClasses !== existingClasses) { - element.setAttribute('class', trim(newClasses)); - } - } - } - - function jqLiteAddClass(element, cssClasses) { - if (cssClasses && element.setAttribute) { - var existingClasses = (' ' + (element.getAttribute('class') || '') + ' ') - .replace(/[\n\t]/g, ' '); - var newClasses = existingClasses; - - forEach(cssClasses.split(' '), function (cssClass) { - cssClass = trim(cssClass); - if (newClasses.indexOf(' ' + cssClass + ' ') === -1) { - newClasses += cssClass + ' '; - } - }); - - if (newClasses !== existingClasses) { - element.setAttribute('class', trim(newClasses)); - } - } - } - - - function jqLiteAddNodes(root, elements) { - // THIS CODE IS VERY HOT. Don't make changes without benchmarking. - - if (elements) { - - // if a Node (the most common case) - if (elements.nodeType) { - root[root.length++] = elements; - } else { - var length = elements.length; - - // if an Array or NodeList and not a Window - if (typeof length === 'number' && elements.window !== elements) { - if (length) { - for (var i = 0; i < length; i++) { - root[root.length++] = elements[i]; - } - } - } else { - root[root.length++] = elements; - } - } - } - } - - - function jqLiteController(element, name) { - return jqLiteInheritedData(element, '$' + (name || 'ngController') + 'Controller'); - } - - function jqLiteInheritedData(element, name, value) { - // if element is the document object work with the html element instead - // this makes $(document).scope() possible - if (element.nodeType === NODE_TYPE_DOCUMENT) { - element = element.documentElement; - } - var names = isArray(name) ? name : [name]; - - while (element) { - for (var i = 0, ii = names.length; i < ii; i++) { - if (isDefined(value = jqLite.data(element, names[i]))) return value; - } - - // If dealing with a document fragment node with a host element, and no parent, use the host - // element as the parent. This enables directives within a Shadow DOM or polyfilled Shadow DOM - // to lookup parent controllers. - element = element.parentNode || (element.nodeType === NODE_TYPE_DOCUMENT_FRAGMENT && element.host); - } - } - - function jqLiteEmpty(element) { - jqLiteDealoc(element, true); - while (element.firstChild) { - element.removeChild(element.firstChild); - } - } - - function jqLiteRemove(element, keepData) { - if (!keepData) jqLiteDealoc(element); - var parent = element.parentNode; - if (parent) parent.removeChild(element); - } - - - function jqLiteDocumentLoaded(action, win) { - win = win || window; - if (win.document.readyState === 'complete') { - // Force the action to be run async for consistent behavior - // from the action's point of view - // i.e. it will definitely not be in a $apply - win.setTimeout(action); - } else { - // No need to unbind this handler as load is only ever called once - jqLite(win).on('load', action); - } - } - - function jqLiteReady(fn) { - function trigger() { - window.document.removeEventListener('DOMContentLoaded', trigger); - window.removeEventListener('load', trigger); - fn(); - } - - // check if document is already loaded - if (window.document.readyState === 'complete') { - window.setTimeout(fn); - } else { - // We can not use jqLite since we are not done loading and jQuery could be loaded later. - - // Works for modern browsers and IE9 - window.document.addEventListener('DOMContentLoaded', trigger); - - // Fallback to window.onload for others - window.addEventListener('load', trigger); - } - } - - ////////////////////////////////////////// - // Functions which are declared directly. - ////////////////////////////////////////// - var JQLitePrototype = JQLite.prototype = { - ready: jqLiteReady, - toString: function () { - var value = []; - forEach(this, function (e) { - value.push('' + e); - }); - return '[' + value.join(', ') + ']'; - }, - - eq: function (index) { - return (index >= 0) ? jqLite(this[index]) : jqLite(this[this.length + index]); - }, - - length: 0, - push: push, - sort: [].sort, - splice: [].splice - }; - - ////////////////////////////////////////// - // Functions iterating getter/setters. - // these functions return self on setter and - // value on get. - ////////////////////////////////////////// - var BOOLEAN_ATTR = {}; - forEach('multiple,selected,checked,disabled,readOnly,required,open'.split(','), function (value) { - BOOLEAN_ATTR[lowercase(value)] = value; - }); - var BOOLEAN_ELEMENTS = {}; - forEach('input,select,option,textarea,button,form,details'.split(','), function (value) { - BOOLEAN_ELEMENTS[value] = true; - }); - var ALIASED_ATTR = { - 'ngMinlength': 'minlength', - 'ngMaxlength': 'maxlength', - 'ngMin': 'min', - 'ngMax': 'max', - 'ngPattern': 'pattern', - 'ngStep': 'step' - }; - - function getBooleanAttrName(element, name) { - // check dom last since we will most likely fail on name - var booleanAttr = BOOLEAN_ATTR[name.toLowerCase()]; - - // booleanAttr is here twice to minimize DOM access - return booleanAttr && BOOLEAN_ELEMENTS[nodeName_(element)] && booleanAttr; - } - - function getAliasedAttrName(name) { - return ALIASED_ATTR[name]; - } - - forEach({ - data: jqLiteData, - removeData: jqLiteRemoveData, - hasData: jqLiteHasData, - cleanData: function jqLiteCleanData(nodes) { - for (var i = 0, ii = nodes.length; i < ii; i++) { - jqLiteRemoveData(nodes[i]); - jqLiteOff(nodes[i]); - } - } - }, function (fn, name) { - JQLite[name] = fn; - }); - - forEach({ - data: jqLiteData, - inheritedData: jqLiteInheritedData, - - scope: function (element) { - // Can't use jqLiteData here directly so we stay compatible with jQuery! - return jqLite.data(element, '$scope') || jqLiteInheritedData(element.parentNode || element, ['$isolateScope', '$scope']); - }, - - isolateScope: function (element) { - // Can't use jqLiteData here directly so we stay compatible with jQuery! - return jqLite.data(element, '$isolateScope') || jqLite.data(element, '$isolateScopeNoTemplate'); - }, - - controller: jqLiteController, - - injector: function (element) { - return jqLiteInheritedData(element, '$injector'); - }, - - removeAttr: function (element, name) { - element.removeAttribute(name); - }, - - hasClass: jqLiteHasClass, - - css: function (element, name, value) { - name = cssKebabToCamel(name); - - if (isDefined(value)) { - element.style[name] = value; - } else { - return element.style[name]; - } - }, - - attr: function (element, name, value) { - var ret; - var nodeType = element.nodeType; - if (nodeType === NODE_TYPE_TEXT || nodeType === NODE_TYPE_ATTRIBUTE || nodeType === NODE_TYPE_COMMENT || - !element.getAttribute) { - return; - } - - var lowercasedName = lowercase(name); - var isBooleanAttr = BOOLEAN_ATTR[lowercasedName]; - - if (isDefined(value)) { - // setter - - if (value === null || (value === false && isBooleanAttr)) { - element.removeAttribute(name); - } else { - element.setAttribute(name, isBooleanAttr ? lowercasedName : value); - } - } else { - // getter - - ret = element.getAttribute(name); - - if (isBooleanAttr && ret !== null) { - ret = lowercasedName; - } - // Normalize non-existing attributes to undefined (as jQuery). - return ret === null ? undefined : ret; - } - }, - - prop: function (element, name, value) { - if (isDefined(value)) { - element[name] = value; - } else { - return element[name]; - } - }, - - text: (function () { - getText.$dv = ''; - return getText; - - function getText(element, value) { - if (isUndefined(value)) { - var nodeType = element.nodeType; - return (nodeType === NODE_TYPE_ELEMENT || nodeType === NODE_TYPE_TEXT) ? element.textContent : ''; - } - element.textContent = value; - } - })(), - - val: function (element, value) { - if (isUndefined(value)) { - if (element.multiple && nodeName_(element) === 'select') { - var result = []; - forEach(element.options, function (option) { - if (option.selected) { - result.push(option.value || option.text); - } - }); - return result; - } - return element.value; - } - element.value = value; - }, - - html: function (element, value) { - if (isUndefined(value)) { - return element.innerHTML; - } - jqLiteDealoc(element, true); - element.innerHTML = value; - }, - - empty: jqLiteEmpty - }, function (fn, name) { - /** - * Properties: writes return selection, reads return first value - */ - JQLite.prototype[name] = function (arg1, arg2) { - var i, key; - var nodeCount = this.length; - - // jqLiteHasClass has only two arguments, but is a getter-only fn, so we need to special-case it - // in a way that survives minification. - // jqLiteEmpty takes no arguments but is a setter. - if (fn !== jqLiteEmpty && - (isUndefined((fn.length === 2 && (fn !== jqLiteHasClass && fn !== jqLiteController)) ? arg1 : arg2))) { - if (isObject(arg1)) { - - // we are a write, but the object properties are the key/values - for (i = 0; i < nodeCount; i++) { - if (fn === jqLiteData) { - // data() takes the whole object in jQuery - fn(this[i], arg1); - } else { - for (key in arg1) { - fn(this[i], key, arg1[key]); - } - } - } - // return self for chaining - return this; - } else { - // we are a read, so read the first child. - // TODO: do we still need this? - var value = fn.$dv; - // Only if we have $dv do we iterate over all, otherwise it is just the first element. - var jj = (isUndefined(value)) ? Math.min(nodeCount, 1) : nodeCount; - for (var j = 0; j < jj; j++) { - var nodeValue = fn(this[j], arg1, arg2); - value = value ? value + nodeValue : nodeValue; - } - return value; - } - } else { - // we are a write, so apply to all children - for (i = 0; i < nodeCount; i++) { - fn(this[i], arg1, arg2); - } - // return self for chaining - return this; - } - }; - }); - - function createEventHandler(element, events) { - var eventHandler = function (event, type) { - // jQuery specific api - event.isDefaultPrevented = function () { - return event.defaultPrevented; - }; - - var eventFns = events[type || event.type]; - var eventFnsLength = eventFns ? eventFns.length : 0; - - if (!eventFnsLength) return; - - if (isUndefined(event.immediatePropagationStopped)) { - var originalStopImmediatePropagation = event.stopImmediatePropagation; - event.stopImmediatePropagation = function () { - event.immediatePropagationStopped = true; - - if (event.stopPropagation) { - event.stopPropagation(); - } - - if (originalStopImmediatePropagation) { - originalStopImmediatePropagation.call(event); - } - }; - } - - event.isImmediatePropagationStopped = function () { - return event.immediatePropagationStopped === true; - }; - - // Some events have special handlers that wrap the real handler - var handlerWrapper = eventFns.specialHandlerWrapper || defaultHandlerWrapper; - - // Copy event handlers in case event handlers array is modified during execution. - if ((eventFnsLength > 1)) { - eventFns = shallowCopy(eventFns); - } - - for (var i = 0; i < eventFnsLength; i++) { - if (!event.isImmediatePropagationStopped()) { - handlerWrapper(element, event, eventFns[i]); - } - } - }; - - // TODO: this is a hack for angularMocks/clearDataCache that makes it possible to deregister all - // events on `element` - eventHandler.elem = element; - return eventHandler; - } - - function defaultHandlerWrapper(element, event, handler) { - handler.call(element, event); - } - - function specialMouseHandlerWrapper(target, event, handler) { - // Refer to jQuery's implementation of mouseenter & mouseleave - // Read about mouseenter and mouseleave: - // http://www.quirksmode.org/js/events_mouse.html#link8 - var related = event.relatedTarget; - // 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 || (related !== target && !jqLiteContains.call(target, related))) { - handler.call(target, event); - } - } - - ////////////////////////////////////////// - // Functions iterating traversal. - // These functions chain results into a single - // selector. - ////////////////////////////////////////// - forEach({ - removeData: jqLiteRemoveData, - - on: function jqLiteOn(element, type, fn, unsupported) { - if (isDefined(unsupported)) throw jqLiteMinErr('onargs', 'jqLite#on() does not support the `selector` or `eventData` parameters'); - - // Do not add event handlers to non-elements because they will not be cleaned up. - if (!jqLiteAcceptsData(element)) { - return; - } - - var expandoStore = jqLiteExpandoStore(element, true); - var events = expandoStore.events; - var handle = expandoStore.handle; - - if (!handle) { - handle = expandoStore.handle = createEventHandler(element, events); - } - - // http://jsperf.com/string-indexof-vs-split - var types = type.indexOf(' ') >= 0 ? type.split(' ') : [type]; - var i = types.length; - - var addHandler = function (type, specialHandlerWrapper, noEventListener) { - var eventFns = events[type]; - - if (!eventFns) { - eventFns = events[type] = []; - eventFns.specialHandlerWrapper = specialHandlerWrapper; - if (type !== '$destroy' && !noEventListener) { - element.addEventListener(type, handle); - } - } - - eventFns.push(fn); - }; - - while (i--) { - type = types[i]; - if (MOUSE_EVENT_MAP[type]) { - addHandler(MOUSE_EVENT_MAP[type], specialMouseHandlerWrapper); - addHandler(type, undefined, true); - } else { - addHandler(type); - } - } - }, - - off: jqLiteOff, - - one: function (element, type, fn) { - element = jqLite(element); - - //add the listener twice so that when it is called - //you can remove the original function and still be - //able to call element.off(ev, fn) normally - element.on(type, function onFn() { - element.off(type, fn); - element.off(type, onFn); - }); - element.on(type, fn); - }, - - replaceWith: function (element, replaceNode) { - var index, parent = element.parentNode; - jqLiteDealoc(element); - forEach(new JQLite(replaceNode), function (node) { - if (index) { - parent.insertBefore(node, index.nextSibling); - } else { - parent.replaceChild(node, element); - } - index = node; - }); - }, - - children: function (element) { - var children = []; - forEach(element.childNodes, function (element) { - if (element.nodeType === NODE_TYPE_ELEMENT) { - children.push(element); - } - }); - return children; - }, - - contents: function (element) { - return element.contentDocument || element.childNodes || []; - }, - - append: function (element, node) { - var nodeType = element.nodeType; - if (nodeType !== NODE_TYPE_ELEMENT && nodeType !== NODE_TYPE_DOCUMENT_FRAGMENT) return; - - node = new JQLite(node); - - for (var i = 0, ii = node.length; i < ii; i++) { - var child = node[i]; - element.appendChild(child); - } - }, - - prepend: function (element, node) { - if (element.nodeType === NODE_TYPE_ELEMENT) { - var index = element.firstChild; - forEach(new JQLite(node), function (child) { - element.insertBefore(child, index); - }); - } - }, - - wrap: function (element, wrapNode) { - jqLiteWrapNode(element, jqLite(wrapNode).eq(0).clone()[0]); - }, - - remove: jqLiteRemove, - - detach: function (element) { - jqLiteRemove(element, true); - }, - - after: function (element, newElement) { - var index = element, - parent = element.parentNode; - - if (parent) { - newElement = new JQLite(newElement); - - for (var i = 0, ii = newElement.length; i < ii; i++) { - var node = newElement[i]; - parent.insertBefore(node, index.nextSibling); - index = node; - } - } - }, - - addClass: jqLiteAddClass, - removeClass: jqLiteRemoveClass, - - toggleClass: function (element, selector, condition) { - if (selector) { - forEach(selector.split(' '), function (className) { - var classCondition = condition; - if (isUndefined(classCondition)) { - classCondition = !jqLiteHasClass(element, className); - } - (classCondition ? jqLiteAddClass : jqLiteRemoveClass)(element, className); - }); - } - }, - - parent: function (element) { - var parent = element.parentNode; - return parent && parent.nodeType !== NODE_TYPE_DOCUMENT_FRAGMENT ? parent : null; - }, - - next: function (element) { - return element.nextElementSibling; - }, - - find: function (element, selector) { - if (element.getElementsByTagName) { - return element.getElementsByTagName(selector); - } else { - return []; - } - }, - - clone: jqLiteClone, - - triggerHandler: function (element, event, extraParameters) { - - var dummyEvent, eventFnsCopy, handlerArgs; - var eventName = event.type || event; - var expandoStore = jqLiteExpandoStore(element); - var events = expandoStore && expandoStore.events; - var eventFns = events && events[eventName]; - - if (eventFns) { - // Create a dummy event to pass to the handlers - dummyEvent = { - preventDefault: function () { - this.defaultPrevented = true; - }, - isDefaultPrevented: function () { - return this.defaultPrevented === true; - }, - stopImmediatePropagation: function () { - this.immediatePropagationStopped = true; - }, - isImmediatePropagationStopped: function () { - return this.immediatePropagationStopped === true; - }, - stopPropagation: noop, - type: eventName, - target: element - }; - - // If a custom event was provided then extend our dummy event with it - if (event.type) { - dummyEvent = extend(dummyEvent, event); - } - - // Copy event handlers in case event handlers array is modified during execution. - eventFnsCopy = shallowCopy(eventFns); - handlerArgs = extraParameters ? [dummyEvent].concat(extraParameters) : [dummyEvent]; - - forEach(eventFnsCopy, function (fn) { - if (!dummyEvent.isImmediatePropagationStopped()) { - fn.apply(element, handlerArgs); - } - }); - } - } - }, function (fn, name) { - /** - * chaining functions - */ - JQLite.prototype[name] = function (arg1, arg2, arg3) { - var value; - - for (var i = 0, ii = this.length; i < ii; i++) { - if (isUndefined(value)) { - value = fn(this[i], arg1, arg2, arg3); - if (isDefined(value)) { - // any function which returns a value needs to be wrapped - value = jqLite(value); - } - } else { - jqLiteAddNodes(value, fn(this[i], arg1, arg2, arg3)); - } - } - return isDefined(value) ? value : this; - }; - }); - - // bind legacy bind/unbind to on/off - JQLite.prototype.bind = JQLite.prototype.on; - JQLite.prototype.unbind = JQLite.prototype.off; - - - // Provider for private $$jqLite service - /** @this */ - function $$jqLiteProvider() { - this.$get = function $$jqLite() { - return extend(JQLite, { - hasClass: function (node, classes) { - if (node.attr) node = node[0]; - return jqLiteHasClass(node, classes); - }, - addClass: function (node, classes) { - if (node.attr) node = node[0]; - return jqLiteAddClass(node, classes); - }, - removeClass: function (node, classes) { - if (node.attr) node = node[0]; - return jqLiteRemoveClass(node, classes); - } - }); - }; - } - - /** - * Computes a hash of an 'obj'. - * Hash of a: - * string is string - * number is number as string - * object is either result of calling $$hashKey function on the object or uniquely generated id, - * that is also assigned to the $$hashKey property of the object. - * - * @param obj - * @returns {string} hash string such that the same input will have the same hash string. - * The resulting string key is in 'type:hashKey' format. - */ - function hashKey(obj, nextUidFn) { - var key = obj && obj.$$hashKey; - - if (key) { - if (typeof key === 'function') { - key = obj.$$hashKey(); - } - return key; - } - - var objType = typeof obj; - if (objType === 'function' || (objType === 'object' && obj !== null)) { - key = obj.$$hashKey = objType + ':' + (nextUidFn || nextUid)(); - } else { - key = objType + ':' + obj; - } - - return key; - } - - // A minimal ES2015 Map implementation. - // Should be bug/feature equivalent to the native implementations of supported browsers - // (for the features required in Angular). - // See https://kangax.github.io/compat-table/es6/#test-Map - var nanKey = Object.create(null); - - function NgMapShim() { - this._keys = []; - this._values = []; - this._lastKey = NaN; - this._lastIndex = -1; - } - NgMapShim.prototype = { - _idx: function (key) { - if (key !== this._lastKey) { - this._lastKey = key; - this._lastIndex = this._keys.indexOf(key); - } - return this._lastIndex; - }, - _transformKey: function (key) { - return isNumberNaN(key) ? nanKey : key; - }, - get: function (key) { - key = this._transformKey(key); - var idx = this._idx(key); - if (idx !== -1) { - return this._values[idx]; - } - }, - has: function (key) { - key = this._transformKey(key); - var idx = this._idx(key); - return idx !== -1; - }, - set: function (key, value) { - key = this._transformKey(key); - var idx = this._idx(key); - if (idx === -1) { - idx = this._lastIndex = this._keys.length; - } - this._keys[idx] = key; - this._values[idx] = value; - - // Support: IE11 - // Do not `return this` to simulate the partial IE11 implementation - }, - delete: function (key) { - key = this._transformKey(key); - var idx = this._idx(key); - if (idx === -1) { - return false; - } - this._keys.splice(idx, 1); - this._values.splice(idx, 1); - this._lastKey = NaN; - this._lastIndex = -1; - return true; - } - }; - - // For now, always use `NgMapShim`, even if `window.Map` is available. Some native implementations - // are still buggy (often in subtle ways) and can cause hard-to-debug failures. When native `Map` - // implementations get more stable, we can reconsider switching to `window.Map` (when available). - var NgMap = NgMapShim; - - var $$MapProvider = [ /** @this */ function () { - this.$get = [function () { - return NgMap; - }]; - }]; - - /** - * @ngdoc function - * @module ng - * @name angular.injector - * @kind function - * - * @description - * Creates an injector object that can be used for retrieving services as well as for - * dependency injection (see {@link guide/di dependency injection}). - * - * @param {Array.} modules A list of module functions or their aliases. See - * {@link angular.module}. The `ng` module must be explicitly added. - * @param {boolean=} [strictDi=false] Whether the injector should be in strict mode, which - * disallows argument name annotation inference. - * @returns {injector} Injector object. See {@link auto.$injector $injector}. - * - * @example - * Typical usage - * ```js - * // create an injector - * var $injector = angular.injector(['ng']); - * - * // use the injector to kick off your application - * // use the type inference to auto inject arguments, or use implicit injection - * $injector.invoke(function($rootScope, $compile, $document) { - * $compile($document)($rootScope); - * $rootScope.$digest(); - * }); - * ``` - * - * Sometimes you want to get access to the injector of a currently running AngularJS app - * from outside AngularJS. Perhaps, you want to inject and compile some markup after the - * application has been bootstrapped. You can do this using the extra `injector()` added - * to JQuery/jqLite elements. See {@link angular.element}. - * - * *This is fairly rare but could be the case if a third party library is injecting the - * markup.* - * - * In the following example a new block of HTML containing a `ng-controller` - * directive is added to the end of the document body by JQuery. We then compile and link - * it into the current AngularJS scope. - * - * ```js - * var $div = $('
{{content.label}}
'); - * $(document.body).append($div); - * - * angular.element(document).injector().invoke(function($compile) { - * var scope = angular.element($div).scope(); - * $compile($div)(scope); - * }); - * ``` - */ - - - /** - * @ngdoc module - * @name auto - * @installation - * @description - * - * Implicit module which gets automatically added to each {@link auto.$injector $injector}. - */ - - var ARROW_ARG = /^([^(]+?)=>/; - var FN_ARGS = /^[^(]*\(\s*([^)]*)\)/m; - var FN_ARG_SPLIT = /,/; - var FN_ARG = /^\s*(_?)(\S+?)\1\s*$/; - var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; - var $injectorMinErr = minErr('$injector'); - - function stringifyFn(fn) { - return Function.prototype.toString.call(fn); - } - - function extractArgs(fn) { - var fnText = stringifyFn(fn).replace(STRIP_COMMENTS, ''), - args = fnText.match(ARROW_ARG) || fnText.match(FN_ARGS); - return args; - } - - function anonFn(fn) { - // For anonymous functions, showing at the very least the function signature can help in - // debugging. - var args = extractArgs(fn); - if (args) { - return 'function(' + (args[1] || '').replace(/[\s\r\n]+/, ' ') + ')'; - } - return 'fn'; - } - - function annotate(fn, strictDi, name) { - var $inject, - argDecl, - last; - - if (typeof fn === 'function') { - if (!($inject = fn.$inject)) { - $inject = []; - if (fn.length) { - if (strictDi) { - if (!isString(name) || !name) { - name = fn.name || anonFn(fn); - } - throw $injectorMinErr('strictdi', - '{0} is not using explicit annotation and cannot be invoked in strict mode', name); - } - argDecl = extractArgs(fn); - forEach(argDecl[1].split(FN_ARG_SPLIT), function (arg) { - arg.replace(FN_ARG, function (all, underscore, name) { - $inject.push(name); - }); - }); - } - fn.$inject = $inject; - } - } else if (isArray(fn)) { - last = fn.length - 1; - assertArgFn(fn[last], 'fn'); - $inject = fn.slice(0, last); - } else { - assertArgFn(fn, 'fn', true); - } - return $inject; - } - - /////////////////////////////////////// - - /** - * @ngdoc service - * @name $injector - * - * @description - * - * `$injector` is used to retrieve object instances as defined by - * {@link auto.$provide provider}, instantiate types, invoke methods, - * and load modules. - * - * The following always holds true: - * - * ```js - * var $injector = angular.injector(); - * expect($injector.get('$injector')).toBe($injector); - * expect($injector.invoke(function($injector) { - * return $injector; - * })).toBe($injector); - * ``` - * - * ## Injection Function Annotation - * - * JavaScript does not have annotations, and annotations are needed for dependency injection. The - * following are all valid ways of annotating function with injection arguments and are equivalent. - * - * ```js - * // inferred (only works if code not minified/obfuscated) - * $injector.invoke(function(serviceA){}); - * - * // annotated - * function explicit(serviceA) {}; - * explicit.$inject = ['serviceA']; - * $injector.invoke(explicit); - * - * // inline - * $injector.invoke(['serviceA', function(serviceA){}]); - * ``` - * - * ### Inference - * - * In JavaScript calling `toString()` on a function returns the function definition. The definition - * can then be parsed and the function arguments can be extracted. This method of discovering - * annotations is disallowed when the injector is in strict mode. - * *NOTE:* This does not work with minification, and obfuscation tools since these tools change the - * argument names. - * - * ### `$inject` Annotation - * By adding an `$inject` property onto a function the injection parameters can be specified. - * - * ### Inline - * As an array of injection names, where the last item in the array is the function to call. - */ - - /** - * @ngdoc property - * @name $injector#modules - * @type {Object} - * @description - * A hash containing all the modules that have been loaded into the - * $injector. - * - * You can use this property to find out information about a module via the - * {@link angular.Module#info `myModule.info(...)`} method. - * - * For example: - * - * ``` - * var info = $injector.modules['ngAnimate'].info(); - * ``` - * - * **Do not use this property to attempt to modify the modules after the application - * has been bootstrapped.** - */ - - - /** - * @ngdoc method - * @name $injector#get - * - * @description - * Return an instance of the service. - * - * @param {string} name The name of the instance to retrieve. - * @param {string=} caller An optional string to provide the origin of the function call for error messages. - * @return {*} The instance. - */ - - /** - * @ngdoc method - * @name $injector#invoke - * - * @description - * Invoke the method and supply the method arguments from the `$injector`. - * - * @param {Function|Array.} fn The injectable function to invoke. Function parameters are - * injected according to the {@link guide/di $inject Annotation} rules. - * @param {Object=} self The `this` for the invoked method. - * @param {Object=} locals Optional object. If preset then any argument names are read from this - * object first, before the `$injector` is consulted. - * @returns {*} the value returned by the invoked `fn` function. - */ - - /** - * @ngdoc method - * @name $injector#has - * - * @description - * Allows the user to query if the particular service exists. - * - * @param {string} name Name of the service to query. - * @returns {boolean} `true` if injector has given service. - */ - - /** - * @ngdoc method - * @name $injector#instantiate - * @description - * Create a new instance of JS type. The method takes a constructor function, invokes the new - * operator, and supplies all of the arguments to the constructor function as specified by the - * constructor annotation. - * - * @param {Function} Type Annotated constructor function. - * @param {Object=} locals Optional object. If preset then any argument names are read from this - * object first, before the `$injector` is consulted. - * @returns {Object} new instance of `Type`. - */ - - /** - * @ngdoc method - * @name $injector#annotate - * - * @description - * Returns an array of service names which the function is requesting for injection. This API is - * used by the injector to determine which services need to be injected into the function when the - * function is invoked. There are three ways in which the function can be annotated with the needed - * dependencies. - * - * #### Argument names - * - * The simplest form is to extract the dependencies from the arguments of the function. This is done - * by converting the function into a string using `toString()` method and extracting the argument - * names. - * ```js - * // Given - * function MyController($scope, $route) { - * // ... - * } - * - * // Then - * expect(injector.annotate(MyController)).toEqual(['$scope', '$route']); - * ``` - * - * You can disallow this method by using strict injection mode. - * - * This method does not work with code minification / obfuscation. For this reason the following - * annotation strategies are supported. - * - * #### The `$inject` property - * - * If a function has an `$inject` property and its value is an array of strings, then the strings - * represent names of services to be injected into the function. - * ```js - * // Given - * var MyController = function(obfuscatedScope, obfuscatedRoute) { - * // ... - * } - * // Define function dependencies - * MyController['$inject'] = ['$scope', '$route']; - * - * // Then - * expect(injector.annotate(MyController)).toEqual(['$scope', '$route']); - * ``` - * - * #### The array notation - * - * It is often desirable to inline Injected functions and that's when setting the `$inject` property - * is very inconvenient. In these situations using the array notation to specify the dependencies in - * a way that survives minification is a better choice: - * - * ```js - * // We wish to write this (not minification / obfuscation safe) - * injector.invoke(function($compile, $rootScope) { - * // ... - * }); - * - * // We are forced to write break inlining - * var tmpFn = function(obfuscatedCompile, obfuscatedRootScope) { - * // ... - * }; - * tmpFn.$inject = ['$compile', '$rootScope']; - * injector.invoke(tmpFn); - * - * // To better support inline function the inline annotation is supported - * injector.invoke(['$compile', '$rootScope', function(obfCompile, obfRootScope) { - * // ... - * }]); - * - * // Therefore - * expect(injector.annotate( - * ['$compile', '$rootScope', function(obfus_$compile, obfus_$rootScope) {}]) - * ).toEqual(['$compile', '$rootScope']); - * ``` - * - * @param {Function|Array.} fn Function for which dependent service names need to - * be retrieved as described above. - * - * @param {boolean=} [strictDi=false] Disallow argument name annotation inference. - * - * @returns {Array.} The names of the services which the function requires. - */ - /** - * @ngdoc method - * @name $injector#loadNewModules - * - * @description - * - * **This is a dangerous API, which you use at your own risk!** - * - * Add the specified modules to the current injector. - * - * This method will add each of the injectables to the injector and execute all of the config and run - * blocks for each module passed to the method. - * - * If a module has already been loaded into the injector then it will not be loaded again. - * - * * The application developer is responsible for loading the code containing the modules; and for - * ensuring that lazy scripts are not downloaded and executed more often that desired. - * * Previously compiled HTML will not be affected by newly loaded directives, filters and components. - * * Modules cannot be unloaded. - * - * You can use {@link $injector#modules `$injector.modules`} to check whether a module has been loaded - * into the injector, which may indicate whether the script has been executed already. - * - * @example - * Here is an example of loading a bundle of modules, with a utility method called `getScript`: - * - * ```javascript - * app.factory('loadModule', function($injector) { - * return function loadModule(moduleName, bundleUrl) { - * return getScript(bundleUrl).then(function() { $injector.loadNewModules([moduleName]); }); - * }; - * }) - * ``` - * - * @param {Array=} mods an array of modules to load into the application. - * Each item in the array should be the name of a predefined module or a (DI annotated) - * function that will be invoked by the injector as a `config` block. - * See: {@link angular.module modules} - */ - - - /** - * @ngdoc service - * @name $provide - * - * @description - * - * The {@link auto.$provide $provide} service has a number of methods for registering components - * with the {@link auto.$injector $injector}. Many of these functions are also exposed on - * {@link angular.Module}. - * - * An AngularJS **service** is a singleton object created by a **service factory**. These **service - * factories** are functions which, in turn, are created by a **service provider**. - * The **service providers** are constructor functions. When instantiated they must contain a - * property called `$get`, which holds the **service factory** function. - * - * When you request a service, the {@link auto.$injector $injector} is responsible for finding the - * correct **service provider**, instantiating it and then calling its `$get` **service factory** - * function to get the instance of the **service**. - * - * Often services have no configuration options and there is no need to add methods to the service - * provider. The provider will be no more than a constructor function with a `$get` property. For - * these cases the {@link auto.$provide $provide} service has additional helper methods to register - * services without specifying a provider. - * - * * {@link auto.$provide#provider provider(name, provider)} - registers a **service provider** with the - * {@link auto.$injector $injector} - * * {@link auto.$provide#constant constant(name, obj)} - registers a value/object that can be accessed by - * providers and services. - * * {@link auto.$provide#value value(name, obj)} - registers a value/object that can only be accessed by - * services, not providers. - * * {@link auto.$provide#factory factory(name, fn)} - registers a service **factory function** - * that will be wrapped in a **service provider** object, whose `$get` property will contain the - * given factory function. - * * {@link auto.$provide#service service(name, Fn)} - registers a **constructor function** - * that will be wrapped in a **service provider** object, whose `$get` property will instantiate - * a new object using the given constructor function. - * * {@link auto.$provide#decorator decorator(name, decorFn)} - registers a **decorator function** that - * will be able to modify or replace the implementation of another service. - * - * See the individual methods for more information and examples. - */ - - /** - * @ngdoc method - * @name $provide#provider - * @description - * - * Register a **provider function** with the {@link auto.$injector $injector}. Provider functions - * are constructor functions, whose instances are responsible for "providing" a factory for a - * service. - * - * Service provider names start with the name of the service they provide followed by `Provider`. - * For example, the {@link ng.$log $log} service has a provider called - * {@link ng.$logProvider $logProvider}. - * - * Service provider objects can have additional methods which allow configuration of the provider - * and its service. Importantly, you can configure what kind of service is created by the `$get` - * method, or how that service will act. For example, the {@link ng.$logProvider $logProvider} has a - * method {@link ng.$logProvider#debugEnabled debugEnabled} - * which lets you specify whether the {@link ng.$log $log} service will log debug messages to the - * console or not. - * - * It is possible to inject other providers into the provider function, - * but the injected provider must have been defined before the one that requires it. - * - * @param {string} name The name of the instance. NOTE: the provider will be available under `name + - 'Provider'` key. - * @param {(Object|function())} provider If the provider is: - * - * - `Object`: then it should have a `$get` method. The `$get` method will be invoked using - * {@link auto.$injector#invoke $injector.invoke()} when an instance needs to be created. - * - `Constructor`: a new instance of the provider will be created using - * {@link auto.$injector#instantiate $injector.instantiate()}, then treated as `object`. - * - * @returns {Object} registered provider instance - - * @example - * - * The following example shows how to create a simple event tracking service and register it using - * {@link auto.$provide#provider $provide.provider()}. - * - * ```js - * // Define the eventTracker provider - * function EventTrackerProvider() { - * var trackingUrl = '/track'; - * - * // A provider method for configuring where the tracked events should been saved - * this.setTrackingUrl = function(url) { - * trackingUrl = url; - * }; - * - * // The service factory function - * this.$get = ['$http', function($http) { - * var trackedEvents = {}; - * return { - * // Call this to track an event - * event: function(event) { - * var count = trackedEvents[event] || 0; - * count += 1; - * trackedEvents[event] = count; - * return count; - * }, - * // Call this to save the tracked events to the trackingUrl - * save: function() { - * $http.post(trackingUrl, trackedEvents); - * } - * }; - * }]; - * } - * - * describe('eventTracker', function() { - * var postSpy; - * - * beforeEach(module(function($provide) { - * // Register the eventTracker provider - * $provide.provider('eventTracker', EventTrackerProvider); - * })); - * - * beforeEach(module(function(eventTrackerProvider) { - * // Configure eventTracker provider - * eventTrackerProvider.setTrackingUrl('/custom-track'); - * })); - * - * it('tracks events', inject(function(eventTracker) { - * expect(eventTracker.event('login')).toEqual(1); - * expect(eventTracker.event('login')).toEqual(2); - * })); - * - * it('saves to the tracking url', inject(function(eventTracker, $http) { - * postSpy = spyOn($http, 'post'); - * eventTracker.event('login'); - * eventTracker.save(); - * expect(postSpy).toHaveBeenCalled(); - * expect(postSpy.mostRecentCall.args[0]).not.toEqual('/track'); - * expect(postSpy.mostRecentCall.args[0]).toEqual('/custom-track'); - * expect(postSpy.mostRecentCall.args[1]).toEqual({ 'login': 1 }); - * })); - * }); - * ``` - */ - - /** - * @ngdoc method - * @name $provide#factory - * @description - * - * Register a **service factory**, which will be called to return the service instance. - * This is short for registering a service where its provider consists of only a `$get` property, - * which is the given service factory function. - * You should use {@link auto.$provide#factory $provide.factory(getFn)} if you do not need to - * configure your service in a provider. - * - * @param {string} name The name of the instance. - * @param {Function|Array.} $getFn The injectable $getFn for the instance creation. - * Internally this is a short hand for `$provide.provider(name, {$get: $getFn})`. - * @returns {Object} registered provider instance - * - * @example - * Here is an example of registering a service - * ```js - * $provide.factory('ping', ['$http', function($http) { - * return function ping() { - * return $http.send('/ping'); - * }; - * }]); - * ``` - * You would then inject and use this service like this: - * ```js - * someModule.controller('Ctrl', ['ping', function(ping) { - * ping(); - * }]); - * ``` - */ - - - /** - * @ngdoc method - * @name $provide#service - * @description - * - * Register a **service constructor**, which will be invoked with `new` to create the service - * instance. - * This is short for registering a service where its provider's `$get` property is a factory - * function that returns an instance instantiated by the injector from the service constructor - * function. - * - * Internally it looks a bit like this: - * - * ``` - * { - * $get: function() { - * return $injector.instantiate(constructor); - * } - * } - * ``` - * - * - * You should use {@link auto.$provide#service $provide.service(class)} if you define your service - * as a type/class. - * - * @param {string} name The name of the instance. - * @param {Function|Array.} constructor An injectable class (constructor function) - * that will be instantiated. - * @returns {Object} registered provider instance - * - * @example - * Here is an example of registering a service using - * {@link auto.$provide#service $provide.service(class)}. - * ```js - * var Ping = function($http) { - * this.$http = $http; - * }; - * - * Ping.$inject = ['$http']; - * - * Ping.prototype.send = function() { - * return this.$http.get('/ping'); - * }; - * $provide.service('ping', Ping); - * ``` - * You would then inject and use this service like this: - * ```js - * someModule.controller('Ctrl', ['ping', function(ping) { - * ping.send(); - * }]); - * ``` - */ - - - /** - * @ngdoc method - * @name $provide#value - * @description - * - * Register a **value service** with the {@link auto.$injector $injector}, such as a string, a - * number, an array, an object or a function. This is short for registering a service where its - * provider's `$get` property is a factory function that takes no arguments and returns the **value - * service**. That also means it is not possible to inject other services into a value service. - * - * Value services are similar to constant services, except that they cannot be injected into a - * module configuration function (see {@link angular.Module#config}) but they can be overridden by - * an AngularJS {@link auto.$provide#decorator decorator}. - * - * @param {string} name The name of the instance. - * @param {*} value The value. - * @returns {Object} registered provider instance - * - * @example - * Here are some examples of creating value services. - * ```js - * $provide.value('ADMIN_USER', 'admin'); - * - * $provide.value('RoleLookup', { admin: 0, writer: 1, reader: 2 }); - * - * $provide.value('halfOf', function(value) { - * return value / 2; - * }); - * ``` - */ - - - /** - * @ngdoc method - * @name $provide#constant - * @description - * - * Register a **constant service** with the {@link auto.$injector $injector}, such as a string, - * a number, an array, an object or a function. Like the {@link auto.$provide#value value}, it is not - * possible to inject other services into a constant. - * - * But unlike {@link auto.$provide#value value}, a constant can be - * injected into a module configuration function (see {@link angular.Module#config}) and it cannot - * be overridden by an AngularJS {@link auto.$provide#decorator decorator}. - * - * @param {string} name The name of the constant. - * @param {*} value The constant value. - * @returns {Object} registered instance - * - * @example - * Here a some examples of creating constants: - * ```js - * $provide.constant('SHARD_HEIGHT', 306); - * - * $provide.constant('MY_COLOURS', ['red', 'blue', 'grey']); - * - * $provide.constant('double', function(value) { - * return value * 2; - * }); - * ``` - */ - - - /** - * @ngdoc method - * @name $provide#decorator - * @description - * - * Register a **decorator function** with the {@link auto.$injector $injector}. A decorator function - * intercepts the creation of a service, allowing it to override or modify the behavior of the - * service. The return value of the decorator function may be the original service, or a new service - * that replaces (or wraps and delegates to) the original service. - * - * You can find out more about using decorators in the {@link guide/decorators} guide. - * - * @param {string} name The name of the service to decorate. - * @param {Function|Array.} decorator This function will be invoked when the service needs to be - * provided and should return the decorated service instance. The function is called using - * the {@link auto.$injector#invoke injector.invoke} method and is therefore fully injectable. - * Local injection arguments: - * - * * `$delegate` - The original service instance, which can be replaced, monkey patched, configured, - * decorated or delegated to. - * - * @example - * Here we decorate the {@link ng.$log $log} service to convert warnings to errors by intercepting - * calls to {@link ng.$log#error $log.warn()}. - * ```js - * $provide.decorator('$log', ['$delegate', function($delegate) { - * $delegate.warn = $delegate.error; - * return $delegate; - * }]); - * ``` - */ - - - function createInjector(modulesToLoad, strictDi) { - strictDi = (strictDi === true); - var INSTANTIATING = {}, - providerSuffix = 'Provider', - path = [], - loadedModules = new NgMap(), - providerCache = { - $provide: { - provider: supportObject(provider), - factory: supportObject(factory), - service: supportObject(service), - value: supportObject(value), - constant: supportObject(constant), - decorator: decorator - } - }, - providerInjector = (providerCache.$injector = - createInternalInjector(providerCache, function (serviceName, caller) { - if (angular.isString(caller)) { - path.push(caller); - } - throw $injectorMinErr('unpr', 'Unknown provider: {0}', path.join(' <- ')); - })), - instanceCache = {}, - protoInstanceInjector = - createInternalInjector(instanceCache, function (serviceName, caller) { - var provider = providerInjector.get(serviceName + providerSuffix, caller); - return instanceInjector.invoke( - provider.$get, provider, undefined, serviceName); - }), - instanceInjector = protoInstanceInjector; - - providerCache['$injector' + providerSuffix] = { - $get: valueFn(protoInstanceInjector) - }; - instanceInjector.modules = providerInjector.modules = createMap(); - var runBlocks = loadModules(modulesToLoad); - instanceInjector = protoInstanceInjector.get('$injector'); - instanceInjector.strictDi = strictDi; - forEach(runBlocks, function (fn) { - if (fn) instanceInjector.invoke(fn); - }); - - instanceInjector.loadNewModules = function (mods) { - forEach(loadModules(mods), function (fn) { - if (fn) instanceInjector.invoke(fn); - }); - }; - - - return instanceInjector; - - //////////////////////////////////// - // $provider - //////////////////////////////////// - - function supportObject(delegate) { - return function (key, value) { - if (isObject(key)) { - forEach(key, reverseParams(delegate)); - } else { - return delegate(key, value); - } - }; - } - - function provider(name, provider_) { - assertNotHasOwnProperty(name, 'service'); - if (isFunction(provider_) || isArray(provider_)) { - provider_ = providerInjector.instantiate(provider_); - } - if (!provider_.$get) { - throw $injectorMinErr('pget', 'Provider \'{0}\' must define $get factory method.', name); - } - return (providerCache[name + providerSuffix] = provider_); - } - - function enforceReturnValue(name, factory) { - return /** @this */ function enforcedReturnValue() { - var result = instanceInjector.invoke(factory, this); - if (isUndefined(result)) { - throw $injectorMinErr('undef', 'Provider \'{0}\' must return a value from $get factory method.', name); - } - return result; - }; - } - - function factory(name, factoryFn, enforce) { - return provider(name, { - $get: enforce !== false ? enforceReturnValue(name, factoryFn) : factoryFn - }); - } - - function service(name, constructor) { - return factory(name, ['$injector', function ($injector) { - return $injector.instantiate(constructor); - }]); - } - - function value(name, val) { - return factory(name, valueFn(val), false); - } - - function constant(name, value) { - assertNotHasOwnProperty(name, 'constant'); - providerCache[name] = value; - instanceCache[name] = value; - } - - function decorator(serviceName, decorFn) { - var origProvider = providerInjector.get(serviceName + providerSuffix), - orig$get = origProvider.$get; - - origProvider.$get = function () { - var origInstance = instanceInjector.invoke(orig$get, origProvider); - return instanceInjector.invoke(decorFn, null, { - $delegate: origInstance - }); - }; - } - - //////////////////////////////////// - // Module Loading - //////////////////////////////////// - function loadModules(modulesToLoad) { - assertArg(isUndefined(modulesToLoad) || isArray(modulesToLoad), 'modulesToLoad', 'not an array'); - var runBlocks = [], - moduleFn; - forEach(modulesToLoad, function (module) { - if (loadedModules.get(module)) return; - loadedModules.set(module, true); - - function runInvokeQueue(queue) { - var i, ii; - for (i = 0, ii = queue.length; i < ii; i++) { - var invokeArgs = queue[i], - provider = providerInjector.get(invokeArgs[0]); - - provider[invokeArgs[1]].apply(provider, invokeArgs[2]); - } - } - - try { - if (isString(module)) { - moduleFn = angularModule(module); - instanceInjector.modules[module] = moduleFn; - runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks); - runInvokeQueue(moduleFn._invokeQueue); - runInvokeQueue(moduleFn._configBlocks); - } else if (isFunction(module)) { - runBlocks.push(providerInjector.invoke(module)); - } else if (isArray(module)) { - runBlocks.push(providerInjector.invoke(module)); - } else { - assertArgFn(module, 'module'); - } - } catch (e) { - if (isArray(module)) { - module = module[module.length - 1]; - } - if (e.message && e.stack && e.stack.indexOf(e.message) === -1) { - // Safari & FF's stack traces don't contain error.message content - // unlike those of Chrome and IE - // So if stack doesn't contain message, we create a new string that contains both. - // Since error.stack is read-only in Safari, I'm overriding e and not e.stack here. - // eslint-disable-next-line no-ex-assign - e = e.message + '\n' + e.stack; - } - throw $injectorMinErr('modulerr', 'Failed to instantiate module {0} due to:\n{1}', - module, e.stack || e.message || e); - } - }); - return runBlocks; - } - - //////////////////////////////////// - // internal Injector - //////////////////////////////////// - - function createInternalInjector(cache, factory) { - - function getService(serviceName, caller) { - if (cache.hasOwnProperty(serviceName)) { - if (cache[serviceName] === INSTANTIATING) { - throw $injectorMinErr('cdep', 'Circular dependency found: {0}', - serviceName + ' <- ' + path.join(' <- ')); - } - return cache[serviceName]; - } else { - try { - path.unshift(serviceName); - cache[serviceName] = INSTANTIATING; - cache[serviceName] = factory(serviceName, caller); - return cache[serviceName]; - } catch (err) { - if (cache[serviceName] === INSTANTIATING) { - delete cache[serviceName]; - } - throw err; - } finally { - path.shift(); - } - } - } - - - function injectionArgs(fn, locals, serviceName) { - var args = [], - $inject = createInjector.$$annotate(fn, strictDi, serviceName); - - for (var i = 0, length = $inject.length; i < length; i++) { - var key = $inject[i]; - if (typeof key !== 'string') { - throw $injectorMinErr('itkn', - 'Incorrect injection token! Expected service name as string, got {0}', key); - } - args.push(locals && locals.hasOwnProperty(key) ? locals[key] : - getService(key, serviceName)); - } - return args; - } - - function isClass(func) { - // Support: IE 9-11 only - // IE 9-11 do not support classes and IE9 leaks with the code below. - if (msie || typeof func !== 'function') { - return false; - } - var result = func.$$ngIsClass; - if (!isBoolean(result)) { - result = func.$$ngIsClass = /^class\b/.test(stringifyFn(func)); - } - return result; - } - - function invoke(fn, self, locals, serviceName) { - if (typeof locals === 'string') { - serviceName = locals; - locals = null; - } - - var args = injectionArgs(fn, locals, serviceName); - if (isArray(fn)) { - fn = fn[fn.length - 1]; - } - - if (!isClass(fn)) { - // http://jsperf.com/angularjs-invoke-apply-vs-switch - // #5388 - return fn.apply(self, args); - } else { - args.unshift(null); - return new(Function.prototype.bind.apply(fn, args))(); - } - } - - - function instantiate(Type, locals, serviceName) { - // Check if Type is annotated and use just the given function at n-1 as parameter - // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]); - var ctor = (isArray(Type) ? Type[Type.length - 1] : Type); - var args = injectionArgs(Type, locals, serviceName); - // Empty object at position 0 is ignored for invocation with `new`, but required. - args.unshift(null); - return new(Function.prototype.bind.apply(ctor, args))(); - } - - - return { - invoke: invoke, - instantiate: instantiate, - get: getService, - annotate: createInjector.$$annotate, - has: function (name) { - return providerCache.hasOwnProperty(name + providerSuffix) || cache.hasOwnProperty(name); - } - }; - } - } - - createInjector.$$annotate = annotate; - - /** - * @ngdoc provider - * @name $anchorScrollProvider - * @this - * - * @description - * Use `$anchorScrollProvider` to disable automatic scrolling whenever - * {@link ng.$location#hash $location.hash()} changes. - */ - function $AnchorScrollProvider() { - - var autoScrollingEnabled = true; - - /** - * @ngdoc method - * @name $anchorScrollProvider#disableAutoScrolling - * - * @description - * By default, {@link ng.$anchorScroll $anchorScroll()} will automatically detect changes to - * {@link ng.$location#hash $location.hash()} and scroll to the element matching the new hash.
- * Use this method to disable automatic scrolling. - * - * If automatic scrolling is disabled, one must explicitly call - * {@link ng.$anchorScroll $anchorScroll()} in order to scroll to the element related to the - * current hash. - */ - this.disableAutoScrolling = function () { - autoScrollingEnabled = false; - }; - - /** - * @ngdoc service - * @name $anchorScroll - * @kind function - * @requires $window - * @requires $location - * @requires $rootScope - * - * @description - * When called, it scrolls to the element related to the specified `hash` or (if omitted) to the - * current value of {@link ng.$location#hash $location.hash()}, according to the rules specified - * in the - * [HTML5 spec](http://www.w3.org/html/wg/drafts/html/master/browsers.html#an-indicated-part-of-the-document). - * - * It also watches the {@link ng.$location#hash $location.hash()} and automatically scrolls to - * match any anchor whenever it changes. This can be disabled by calling - * {@link ng.$anchorScrollProvider#disableAutoScrolling $anchorScrollProvider.disableAutoScrolling()}. - * - * Additionally, you can use its {@link ng.$anchorScroll#yOffset yOffset} property to specify a - * vertical scroll-offset (either fixed or dynamic). - * - * @param {string=} hash The hash specifying the element to scroll to. If omitted, the value of - * {@link ng.$location#hash $location.hash()} will be used. - * - * @property {(number|function|jqLite)} yOffset - * If set, specifies a vertical scroll-offset. This is often useful when there are fixed - * positioned elements at the top of the page, such as navbars, headers etc. - * - * `yOffset` can be specified in various ways: - * - **number**: A fixed number of pixels to be used as offset.

- * - **function**: A getter function called everytime `$anchorScroll()` is executed. Must return - * a number representing the offset (in pixels).

- * - **jqLite**: A jqLite/jQuery element to be used for specifying the offset. The distance from - * the top of the page to the element's bottom will be used as offset.
- * **Note**: The element will be taken into account only as long as its `position` is set to - * `fixed`. This option is useful, when dealing with responsive navbars/headers that adjust - * their height and/or positioning according to the viewport's size. - * - *
- *
- * In order for `yOffset` to work properly, scrolling should take place on the document's root and - * not some child element. - *
- * - * @example - - -
- Go to bottom - You're at the bottom! -
-
- - angular.module('anchorScrollExample', []) - .controller('ScrollController', ['$scope', '$location', '$anchorScroll', - function($scope, $location, $anchorScroll) { - $scope.gotoBottom = function() { - // set the location.hash to the id of - // the element you wish to scroll to. - $location.hash('bottom'); - - // call $anchorScroll() - $anchorScroll(); - }; - }]); - - - #scrollArea { - height: 280px; - overflow: auto; - } - - #bottom { - display: block; - margin-top: 2000px; - } - -
- * - *
- * The example below illustrates the use of a vertical scroll-offset (specified as a fixed value). - * See {@link ng.$anchorScroll#yOffset $anchorScroll.yOffset} for more details. - * - * @example - - - -
- Anchor {{x}} of 5 -
-
- - angular.module('anchorScrollOffsetExample', []) - .run(['$anchorScroll', function($anchorScroll) { - $anchorScroll.yOffset = 50; // always scroll by 50 extra pixels - }]) - .controller('headerCtrl', ['$anchorScroll', '$location', '$scope', - function($anchorScroll, $location, $scope) { - $scope.gotoAnchor = function(x) { - var newHash = 'anchor' + x; - if ($location.hash() !== newHash) { - // set the $location.hash to `newHash` and - // $anchorScroll will automatically scroll to it - $location.hash('anchor' + x); - } else { - // call $anchorScroll() explicitly, - // since $location.hash hasn't changed - $anchorScroll(); - } - }; - } - ]); - - - body { - padding-top: 50px; - } - - .anchor { - border: 2px dashed DarkOrchid; - padding: 10px 10px 200px 10px; - } - - .fixed-header { - background-color: rgba(0, 0, 0, 0.2); - height: 50px; - position: fixed; - top: 0; left: 0; right: 0; - } - - .fixed-header > a { - display: inline-block; - margin: 5px 15px; - } - -
- */ - this.$get = ['$window', '$location', '$rootScope', function ($window, $location, $rootScope) { - var document = $window.document; - - // Helper function to get first anchor from a NodeList - // (using `Array#some()` instead of `angular#forEach()` since it's more performant - // and working in all supported browsers.) - function getFirstAnchor(list) { - var result = null; - Array.prototype.some.call(list, function (element) { - if (nodeName_(element) === 'a') { - result = element; - return true; - } - }); - return result; - } - - function getYOffset() { - - var offset = scroll.yOffset; - - if (isFunction(offset)) { - offset = offset(); - } else if (isElement(offset)) { - var elem = offset[0]; - var style = $window.getComputedStyle(elem); - if (style.position !== 'fixed') { - offset = 0; - } else { - offset = elem.getBoundingClientRect().bottom; - } - } else if (!isNumber(offset)) { - offset = 0; - } - - return offset; - } - - function scrollTo(elem) { - if (elem) { - elem.scrollIntoView(); - - var offset = getYOffset(); - - if (offset) { - // `offset` is the number of pixels we should scroll UP in order to align `elem` properly. - // This is true ONLY if the call to `elem.scrollIntoView()` initially aligns `elem` at the - // top of the viewport. - // - // IF the number of pixels from the top of `elem` to the end of the page's content is less - // than the height of the viewport, then `elem.scrollIntoView()` will align the `elem` some - // way down the page. - // - // This is often the case for elements near the bottom of the page. - // - // In such cases we do not need to scroll the whole `offset` up, just the difference between - // the top of the element and the offset, which is enough to align the top of `elem` at the - // desired position. - var elemTop = elem.getBoundingClientRect().top; - $window.scrollBy(0, elemTop - offset); - } - } else { - $window.scrollTo(0, 0); - } - } - - function scroll(hash) { - // Allow numeric hashes - hash = isString(hash) ? hash : isNumber(hash) ? hash.toString() : $location.hash(); - var elm; - - // empty hash, scroll to the top of the page - if (!hash) scrollTo(null); - - // element with given id - else if ((elm = document.getElementById(hash))) scrollTo(elm); - - // first anchor with given name :-D - else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm); - - // no element and hash === 'top', scroll to the top of the page - else if (hash === 'top') scrollTo(null); - } - - // does not scroll when user clicks on anchor link that is currently on - // (no url change, no $location.hash() change), browser native does scroll - if (autoScrollingEnabled) { - $rootScope.$watch(function autoScrollWatch() { - return $location.hash(); - }, - function autoScrollWatchAction(newVal, oldVal) { - // skip the initial scroll if $location.hash is empty - if (newVal === oldVal && newVal === '') return; - - jqLiteDocumentLoaded(function () { - $rootScope.$evalAsync(scroll); - }); - }); - } - - return scroll; - }]; - } - - var $animateMinErr = minErr('$animate'); - var ELEMENT_NODE = 1; - var NG_ANIMATE_CLASSNAME = 'ng-animate'; - - function mergeClasses(a, b) { - if (!a && !b) return ''; - if (!a) return b; - if (!b) return a; - if (isArray(a)) a = a.join(' '); - if (isArray(b)) b = b.join(' '); - return a + ' ' + b; - } - - function extractElementNode(element) { - for (var i = 0; i < element.length; i++) { - var elm = element[i]; - if (elm.nodeType === ELEMENT_NODE) { - return elm; - } - } - } - - function splitClasses(classes) { - if (isString(classes)) { - classes = classes.split(' '); - } - - // Use createMap() to prevent class assumptions involving property names in - // Object.prototype - var obj = createMap(); - forEach(classes, function (klass) { - // sometimes the split leaves empty string values - // incase extra spaces were applied to the options - if (klass.length) { - obj[klass] = true; - } - }); - return obj; - } - - // if any other type of options value besides an Object value is - // passed into the $animate.method() animation then this helper code - // will be run which will ignore it. While this patch is not the - // greatest solution to this, a lot of existing plugins depend on - // $animate to either call the callback (< 1.2) or return a promise - // that can be changed. This helper function ensures that the options - // are wiped clean incase a callback function is provided. - function prepareAnimateOptions(options) { - return isObject(options) ? - options : {}; - } - - var $$CoreAnimateJsProvider = /** @this */ function () { - this.$get = noop; - }; - - // this is prefixed with Core since it conflicts with - // the animateQueueProvider defined in ngAnimate/animateQueue.js - var $$CoreAnimateQueueProvider = /** @this */ function () { - var postDigestQueue = new NgMap(); - var postDigestElements = []; - - this.$get = ['$$AnimateRunner', '$rootScope', - function ($$AnimateRunner, $rootScope) { - return { - enabled: noop, - on: noop, - off: noop, - pin: noop, - - push: function (element, event, options, domOperation) { - if (domOperation) { - domOperation(); - } - - options = options || {}; - if (options.from) { - element.css(options.from); - } - if (options.to) { - element.css(options.to); - } - - if (options.addClass || options.removeClass) { - addRemoveClassesPostDigest(element, options.addClass, options.removeClass); - } - - var runner = new $$AnimateRunner(); - - // since there are no animations to run the runner needs to be - // notified that the animation call is complete. - runner.complete(); - return runner; - } - }; - - - function updateData(data, classes, value) { - var changed = false; - if (classes) { - classes = isString(classes) ? classes.split(' ') : - isArray(classes) ? classes : []; - forEach(classes, function (className) { - if (className) { - changed = true; - data[className] = value; - } - }); - } - return changed; - } - - function handleCSSClassChanges() { - forEach(postDigestElements, function (element) { - var data = postDigestQueue.get(element); - if (data) { - var existing = splitClasses(element.attr('class')); - var toAdd = ''; - var toRemove = ''; - forEach(data, function (status, className) { - var hasClass = !!existing[className]; - if (status !== hasClass) { - if (status) { - toAdd += (toAdd.length ? ' ' : '') + className; - } else { - toRemove += (toRemove.length ? ' ' : '') + className; - } - } - }); - - forEach(element, function (elm) { - if (toAdd) { - jqLiteAddClass(elm, toAdd); - } - if (toRemove) { - jqLiteRemoveClass(elm, toRemove); - } - }); - postDigestQueue.delete(element); - } - }); - postDigestElements.length = 0; - } - - - function addRemoveClassesPostDigest(element, add, remove) { - var data = postDigestQueue.get(element) || {}; - - var classesAdded = updateData(data, add, true); - var classesRemoved = updateData(data, remove, false); - - if (classesAdded || classesRemoved) { - - postDigestQueue.set(element, data); - postDigestElements.push(element); - - if (postDigestElements.length === 1) { - $rootScope.$$postDigest(handleCSSClassChanges); - } - } - } - } - ]; - }; - - /** - * @ngdoc provider - * @name $animateProvider - * - * @description - * Default implementation of $animate that doesn't perform any animations, instead just - * synchronously performs DOM updates and resolves the returned runner promise. - * - * In order to enable animations the `ngAnimate` module has to be loaded. - * - * To see the functional implementation check out `src/ngAnimate/animate.js`. - */ - var $AnimateProvider = ['$provide', /** @this */ function ($provide) { - var provider = this; - var classNameFilter = null; - var customFilter = null; - - this.$$registeredAnimations = Object.create(null); - - /** - * @ngdoc method - * @name $animateProvider#register - * - * @description - * Registers a new injectable animation factory function. The factory function produces the - * animation object which contains callback functions for each event that is expected to be - * animated. - * - * * `eventFn`: `function(element, ... , doneFunction, options)` - * The element to animate, the `doneFunction` and the options fed into the animation. Depending - * on the type of animation additional arguments will be injected into the animation function. The - * list below explains the function signatures for the different animation methods: - * - * - setClass: function(element, addedClasses, removedClasses, doneFunction, options) - * - addClass: function(element, addedClasses, doneFunction, options) - * - removeClass: function(element, removedClasses, doneFunction, options) - * - enter, leave, move: function(element, doneFunction, options) - * - animate: function(element, fromStyles, toStyles, doneFunction, options) - * - * Make sure to trigger the `doneFunction` once the animation is fully complete. - * - * ```js - * return { - * //enter, leave, move signature - * eventFn : function(element, done, options) { - * //code to run the animation - * //once complete, then run done() - * return function endFunction(wasCancelled) { - * //code to cancel the animation - * } - * } - * } - * ``` - * - * @param {string} name The name of the animation (this is what the class-based CSS value will be compared to). - * @param {Function} factory The factory function that will be executed to return the animation - * object. - */ - this.register = function (name, factory) { - if (name && name.charAt(0) !== '.') { - throw $animateMinErr('notcsel', 'Expecting class selector starting with \'.\' got \'{0}\'.', name); - } - - var key = name + '-animation'; - provider.$$registeredAnimations[name.substr(1)] = key; - $provide.factory(key, factory); - }; - - /** - * @ngdoc method - * @name $animateProvider#customFilter - * - * @description - * Sets and/or returns the custom filter function that is used to "filter" animations, i.e. - * determine if an animation is allowed or not. When no filter is specified (the default), no - * animation will be blocked. Setting the `customFilter` value will only allow animations for - * which the filter function's return value is truthy. - * - * This allows to easily create arbitrarily complex rules for filtering animations, such as - * allowing specific events only, or enabling animations on specific subtrees of the DOM, etc. - * Filtering animations can also boost performance for low-powered devices, as well as - * applications containing a lot of structural operations. - * - *
- * **Best Practice:** - * Keep the filtering function as lean as possible, because it will be called for each DOM - * action (e.g. insertion, removal, class change) performed by "animation-aware" directives. - * See {@link guide/animations#which-directives-support-animations- here} for a list of built-in - * directives that support animations. - * Performing computationally expensive or time-consuming operations on each call of the - * filtering function can make your animations sluggish. - *
- * - * **Note:** If present, `customFilter` will be checked before - * {@link $animateProvider#classNameFilter classNameFilter}. - * - * @param {Function=} filterFn - The filter function which will be used to filter all animations. - * If a falsy value is returned, no animation will be performed. The function will be called - * with the following arguments: - * - **node** `{DOMElement}` - The DOM element to be animated. - * - **event** `{String}` - The name of the animation event (e.g. `enter`, `leave`, `addClass` - * etc). - * - **options** `{Object}` - A collection of options/styles used for the animation. - * @return {Function} The current filter function or `null` if there is none set. - */ - this.customFilter = function (filterFn) { - if (arguments.length === 1) { - customFilter = isFunction(filterFn) ? filterFn : null; - } - - return customFilter; - }; - - /** - * @ngdoc method - * @name $animateProvider#classNameFilter - * - * @description - * Sets and/or returns the CSS class regular expression that is checked when performing - * an animation. Upon bootstrap the classNameFilter value is not set at all and will - * therefore enable $animate to attempt to perform an animation on any element that is triggered. - * When setting the `classNameFilter` value, animations will only be performed on elements - * that successfully match the filter expression. This in turn can boost performance - * for low-powered devices as well as applications containing a lot of structural operations. - * - * **Note:** If present, `classNameFilter` will be checked after - * {@link $animateProvider#customFilter customFilter}. If `customFilter` is present and returns - * false, `classNameFilter` will not be checked. - * - * @param {RegExp=} expression The className expression which will be checked against all animations - * @return {RegExp} The current CSS className expression value. If null then there is no expression value - */ - this.classNameFilter = function (expression) { - if (arguments.length === 1) { - classNameFilter = (expression instanceof RegExp) ? expression : null; - if (classNameFilter) { - var reservedRegex = new RegExp('[(\\s|\\/)]' + NG_ANIMATE_CLASSNAME + '[(\\s|\\/)]'); - if (reservedRegex.test(classNameFilter.toString())) { - classNameFilter = null; - throw $animateMinErr('nongcls', '$animateProvider.classNameFilter(regex) prohibits accepting a regex value which matches/contains the "{0}" CSS class.', NG_ANIMATE_CLASSNAME); - } - } - } - return classNameFilter; - }; - - this.$get = ['$$animateQueue', function ($$animateQueue) { - function domInsert(element, parentElement, afterElement) { - // if for some reason the previous element was removed - // from the dom sometime before this code runs then let's - // just stick to using the parent element as the anchor - if (afterElement) { - var afterNode = extractElementNode(afterElement); - if (afterNode && !afterNode.parentNode && !afterNode.previousElementSibling) { - afterElement = null; - } - } - if (afterElement) { - afterElement.after(element); - } else { - parentElement.prepend(element); - } - } - - /** - * @ngdoc service - * @name $animate - * @description The $animate service exposes a series of DOM utility methods that provide support - * for animation hooks. The default behavior is the application of DOM operations, however, - * when an animation is detected (and animations are enabled), $animate will do the heavy lifting - * to ensure that animation runs with the triggered DOM operation. - * - * By default $animate doesn't trigger any animations. This is because the `ngAnimate` module isn't - * included and only when it is active then the animation hooks that `$animate` triggers will be - * functional. Once active then all structural `ng-` directives will trigger animations as they perform - * their DOM-related operations (enter, leave and move). Other directives such as `ngClass`, - * `ngShow`, `ngHide` and `ngMessages` also provide support for animations. - * - * It is recommended that the`$animate` service is always used when executing DOM-related procedures within directives. - * - * To learn more about enabling animation support, click here to visit the - * {@link ngAnimate ngAnimate module page}. - */ - return { - // we don't call it directly since non-existant arguments may - // be interpreted as null within the sub enabled function - - /** - * - * @ngdoc method - * @name $animate#on - * @kind function - * @description Sets up an event listener to fire whenever the animation event (enter, leave, move, etc...) - * has fired on the given element or among any of its children. Once the listener is fired, the provided callback - * is fired with the following params: - * - * ```js - * $animate.on('enter', container, - * function callback(element, phase) { - * // cool we detected an enter animation within the container - * } - * ); - * ``` - * - *
- * **Note**: Generally, the events that are fired correspond 1:1 to `$animate` method names, - * e.g. {@link ng.$animate#addClass addClass()} will fire `addClass`, and {@link ng.ngClass} - * will fire `addClass` if classes are added, and `removeClass` if classes are removed. - * However, there are two exceptions: - * - *
    - *
  • if both an {@link ng.$animate#addClass addClass()} and a - * {@link ng.$animate#removeClass removeClass()} action are performed during the same - * animation, the event fired will be `setClass`. This is true even for `ngClass`.
  • - *
  • an {@link ng.$animate#animate animate()} call that adds and removes classes will fire - * the `setClass` event, but if it either removes or adds classes, - * it will fire `animate` instead.
  • - *
- * - *
- * - * @param {string} event the animation event that will be captured (e.g. enter, leave, move, addClass, removeClass, etc...) - * @param {DOMElement} container the container element that will capture each of the animation events that are fired on itself - * as well as among its children - * @param {Function} callback the callback function that will be fired when the listener is triggered. - * - * The arguments present in the callback function are: - * * `element` - The captured DOM element that the animation was fired on. - * * `phase` - The phase of the animation. The two possible phases are **start** (when the animation starts) and **close** (when it ends). - * * `data` - an object with these properties: - * * addClass - `{string|null}` - space-separated CSS classes to add to the element - * * removeClass - `{string|null}` - space-separated CSS classes to remove from the element - * * from - `{Object|null}` - CSS properties & values at the beginning of the animation - * * to - `{Object|null}` - CSS properties & values at the end of the animation - * - * Note that the callback does not trigger a scope digest. Wrap your call into a - * {@link $rootScope.Scope#$apply scope.$apply} to propagate changes to the scope. - */ - on: $$animateQueue.on, - - /** - * - * @ngdoc method - * @name $animate#off - * @kind function - * @description Deregisters an event listener based on the event which has been associated with the provided element. This method - * can be used in three different ways depending on the arguments: - * - * ```js - * // remove all the animation event listeners listening for `enter` - * $animate.off('enter'); - * - * // remove listeners for all animation events from the container element - * $animate.off(container); - * - * // remove all the animation event listeners listening for `enter` on the given element and its children - * $animate.off('enter', container); - * - * // remove the event listener function provided by `callback` that is set - * // to listen for `enter` on the given `container` as well as its children - * $animate.off('enter', container, callback); - * ``` - * - * @param {string|DOMElement} event|container the animation event (e.g. enter, leave, move, - * addClass, removeClass, etc...), or the container element. If it is the element, all other - * arguments are ignored. - * @param {DOMElement=} container the container element the event listener was placed on - * @param {Function=} callback the callback function that was registered as the listener - */ - off: $$animateQueue.off, - - /** - * @ngdoc method - * @name $animate#pin - * @kind function - * @description Associates the provided element with a host parent element to allow the element to be animated even if it exists - * outside of the DOM structure of the AngularJS application. By doing so, any animation triggered via `$animate` can be issued on the - * element despite being outside the realm of the application or within another application. Say for example if the application - * was bootstrapped on an element that is somewhere inside of the `` tag, but we wanted to allow for an element to be situated - * as a direct child of `document.body`, then this can be achieved by pinning the element via `$animate.pin(element)`. Keep in mind - * that calling `$animate.pin(element, parentElement)` will not actually insert into the DOM anywhere; it will just create the association. - * - * Note that this feature is only active when the `ngAnimate` module is used. - * - * @param {DOMElement} element the external element that will be pinned - * @param {DOMElement} parentElement the host parent element that will be associated with the external element - */ - pin: $$animateQueue.pin, - - /** - * - * @ngdoc method - * @name $animate#enabled - * @kind function - * @description Used to get and set whether animations are enabled or not on the entire application or on an element and its children. This - * function can be called in four ways: - * - * ```js - * // returns true or false - * $animate.enabled(); - * - * // changes the enabled state for all animations - * $animate.enabled(false); - * $animate.enabled(true); - * - * // returns true or false if animations are enabled for an element - * $animate.enabled(element); - * - * // changes the enabled state for an element and its children - * $animate.enabled(element, true); - * $animate.enabled(element, false); - * ``` - * - * @param {DOMElement=} element the element that will be considered for checking/setting the enabled state - * @param {boolean=} enabled whether or not the animations will be enabled for the element - * - * @return {boolean} whether or not animations are enabled - */ - enabled: $$animateQueue.enabled, - - /** - * @ngdoc method - * @name $animate#cancel - * @kind function - * @description Cancels the provided animation and applies the end state of the animation. - * Note that this does not cancel the underlying operation, e.g. the setting of classes or - * adding the element to the DOM. - * - * @param {animationRunner} animationRunner An animation runner returned by an $animate function. - * - * @example - - - angular.module('animationExample', ['ngAnimate']).component('cancelExample', { - templateUrl: 'template.html', - controller: function($element, $animate) { - this.runner = null; - - this.addClass = function() { - this.runner = $animate.addClass($element.find('div'), 'red'); - var ctrl = this; - this.runner.finally(function() { - ctrl.runner = null; - }); - }; - - this.removeClass = function() { - this.runner = $animate.removeClass($element.find('div'), 'red'); - var ctrl = this; - this.runner.finally(function() { - ctrl.runner = null; - }); - }; - - this.cancel = function() { - $animate.cancel(this.runner); - }; - } - }); - - -

- - -
- -
-

CSS-Animated Text
-

-
- - - - - .red-add, .red-remove { - transition: all 4s cubic-bezier(0.250, 0.460, 0.450, 0.940); - } - - .red, - .red-add.red-add-active { - color: #FF0000; - font-size: 40px; - } - - .red-remove.red-remove-active { - font-size: 10px; - color: black; - } - - -
- */ - cancel: function (runner) { - if (runner.cancel) { - runner.cancel(); - } - }, - - /** - * - * @ngdoc method - * @name $animate#enter - * @kind function - * @description Inserts the element into the DOM either after the `after` element (if provided) or - * as the first child within the `parent` element and then triggers an animation. - * A promise is returned that will be resolved during the next digest once the animation - * has completed. - * - * @param {DOMElement} element the element which will be inserted into the DOM - * @param {DOMElement} parent the parent element which will append the element as - * a child (so long as the after element is not present) - * @param {DOMElement=} after the sibling element after which the element will be appended - * @param {object=} options an optional collection of options/styles that will be applied to the element. - * The object can have the following properties: - * - * - **addClass** - `{string}` - space-separated CSS classes to add to element - * - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to` - * - **removeClass** - `{string}` - space-separated CSS classes to remove from element - * - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from` - * - * @return {Runner} the animation runner - */ - enter: function (element, parent, after, options) { - parent = parent && jqLite(parent); - after = after && jqLite(after); - parent = parent || after.parent(); - domInsert(element, parent, after); - return $$animateQueue.push(element, 'enter', prepareAnimateOptions(options)); - }, - - /** - * - * @ngdoc method - * @name $animate#move - * @kind function - * @description Inserts (moves) the element into its new position in the DOM either after - * the `after` element (if provided) or as the first child within the `parent` element - * and then triggers an animation. A promise is returned that will be resolved - * during the next digest once the animation has completed. - * - * @param {DOMElement} element the element which will be moved into the new DOM position - * @param {DOMElement} parent the parent element which will append the element as - * a child (so long as the after element is not present) - * @param {DOMElement=} after the sibling element after which the element will be appended - * @param {object=} options an optional collection of options/styles that will be applied to the element. - * The object can have the following properties: - * - * - **addClass** - `{string}` - space-separated CSS classes to add to element - * - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to` - * - **removeClass** - `{string}` - space-separated CSS classes to remove from element - * - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from` - * - * @return {Runner} the animation runner - */ - move: function (element, parent, after, options) { - parent = parent && jqLite(parent); - after = after && jqLite(after); - parent = parent || after.parent(); - domInsert(element, parent, after); - return $$animateQueue.push(element, 'move', prepareAnimateOptions(options)); - }, - - /** - * @ngdoc method - * @name $animate#leave - * @kind function - * @description Triggers an animation and then removes the element from the DOM. - * When the function is called a promise is returned that will be resolved during the next - * digest once the animation has completed. - * - * @param {DOMElement} element the element which will be removed from the DOM - * @param {object=} options an optional collection of options/styles that will be applied to the element. - * The object can have the following properties: - * - * - **addClass** - `{string}` - space-separated CSS classes to add to element - * - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to` - * - **removeClass** - `{string}` - space-separated CSS classes to remove from element - * - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from` - * - * @return {Runner} the animation runner - */ - leave: function (element, options) { - return $$animateQueue.push(element, 'leave', prepareAnimateOptions(options), function () { - element.remove(); - }); - }, - - /** - * @ngdoc method - * @name $animate#addClass - * @kind function - * - * @description Triggers an addClass animation surrounding the addition of the provided CSS class(es). Upon - * execution, the addClass operation will only be handled after the next digest and it will not trigger an - * animation if element already contains the CSS class or if the class is removed at a later step. - * Note that class-based animations are treated differently compared to structural animations - * (like enter, move and leave) since the CSS classes may be added/removed at different points - * depending if CSS or JavaScript animations are used. - * - * @param {DOMElement} element the element which the CSS classes will be applied to - * @param {string} className the CSS class(es) that will be added (multiple classes are separated via spaces) - * @param {object=} options an optional collection of options/styles that will be applied to the element. - * The object can have the following properties: - * - * - **removeClass** - `{string}` - space-separated CSS classes to remove from element - * - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to` - * - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from` - * - * @return {Runner} animationRunner the animation runner - */ - addClass: function (element, className, options) { - options = prepareAnimateOptions(options); - options.addClass = mergeClasses(options.addclass, className); - return $$animateQueue.push(element, 'addClass', options); - }, - - /** - * @ngdoc method - * @name $animate#removeClass - * @kind function - * - * @description Triggers a removeClass animation surrounding the removal of the provided CSS class(es). Upon - * execution, the removeClass operation will only be handled after the next digest and it will not trigger an - * animation if element does not contain the CSS class or if the class is added at a later step. - * Note that class-based animations are treated differently compared to structural animations - * (like enter, move and leave) since the CSS classes may be added/removed at different points - * depending if CSS or JavaScript animations are used. - * - * @param {DOMElement} element the element which the CSS classes will be applied to - * @param {string} className the CSS class(es) that will be removed (multiple classes are separated via spaces) - * @param {object=} options an optional collection of options/styles that will be applied to the element. - * The object can have the following properties: - * - * - **addClass** - `{string}` - space-separated CSS classes to add to element - * - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to` - * - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from` - * - * @return {Runner} the animation runner - */ - removeClass: function (element, className, options) { - options = prepareAnimateOptions(options); - options.removeClass = mergeClasses(options.removeClass, className); - return $$animateQueue.push(element, 'removeClass', options); - }, - - /** - * @ngdoc method - * @name $animate#setClass - * @kind function - * - * @description Performs both the addition and removal of a CSS classes on an element and (during the process) - * triggers an animation surrounding the class addition/removal. Much like `$animate.addClass` and - * `$animate.removeClass`, `setClass` will only evaluate the classes being added/removed once a digest has - * passed. Note that class-based animations are treated differently compared to structural animations - * (like enter, move and leave) since the CSS classes may be added/removed at different points - * depending if CSS or JavaScript animations are used. - * - * @param {DOMElement} element the element which the CSS classes will be applied to - * @param {string} add the CSS class(es) that will be added (multiple classes are separated via spaces) - * @param {string} remove the CSS class(es) that will be removed (multiple classes are separated via spaces) - * @param {object=} options an optional collection of options/styles that will be applied to the element. - * The object can have the following properties: - * - * - **addClass** - `{string}` - space-separated CSS classes to add to element - * - **removeClass** - `{string}` - space-separated CSS classes to remove from element - * - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to` - * - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from` - * - * @return {Runner} the animation runner - */ - setClass: function (element, add, remove, options) { - options = prepareAnimateOptions(options); - options.addClass = mergeClasses(options.addClass, add); - options.removeClass = mergeClasses(options.removeClass, remove); - return $$animateQueue.push(element, 'setClass', options); - }, - - /** - * @ngdoc method - * @name $animate#animate - * @kind function - * - * @description Performs an inline animation on the element which applies the provided to and from CSS styles to the element. - * If any detected CSS transition, keyframe or JavaScript matches the provided className value, then the animation will take - * on the provided styles. For example, if a transition animation is set for the given className, then the provided `from` and - * `to` styles will be applied alongside the given transition. If the CSS style provided in `from` does not have a corresponding - * style in `to`, the style in `from` is applied immediately, and no animation is run. - * If a JavaScript animation is detected then the provided styles will be given in as function parameters into the `animate` - * method (or as part of the `options` parameter): - * - * ```js - * ngModule.animation('.my-inline-animation', function() { - * return { - * animate : function(element, from, to, done, options) { - * //animation - * done(); - * } - * } - * }); - * ``` - * - * @param {DOMElement} element the element which the CSS styles will be applied to - * @param {object} from the from (starting) CSS styles that will be applied to the element and across the animation. - * @param {object} to the to (destination) CSS styles that will be applied to the element and across the animation. - * @param {string=} className an optional CSS class that will be applied to the element for the duration of the animation. If - * this value is left as empty then a CSS class of `ng-inline-animate` will be applied to the element. - * (Note that if no animation is detected then this value will not be applied to the element.) - * @param {object=} options an optional collection of options/styles that will be applied to the element. - * The object can have the following properties: - * - * - **addClass** - `{string}` - space-separated CSS classes to add to element - * - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to` - * - **removeClass** - `{string}` - space-separated CSS classes to remove from element - * - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from` - * - * @return {Runner} the animation runner - */ - animate: function (element, from, to, className, options) { - options = prepareAnimateOptions(options); - options.from = options.from ? extend(options.from, from) : from; - options.to = options.to ? extend(options.to, to) : to; - - className = className || 'ng-inline-animate'; - options.tempClasses = mergeClasses(options.tempClasses, className); - return $$animateQueue.push(element, 'animate', options); - } - }; - }]; - }]; - - var $$AnimateAsyncRunFactoryProvider = /** @this */ function () { - this.$get = ['$$rAF', function ($$rAF) { - var waitQueue = []; - - function waitForTick(fn) { - waitQueue.push(fn); - if (waitQueue.length > 1) return; - $$rAF(function () { - for (var i = 0; i < waitQueue.length; i++) { - waitQueue[i](); - } - waitQueue = []; - }); - } - - return function () { - var passed = false; - waitForTick(function () { - passed = true; - }); - return function (callback) { - if (passed) { - callback(); - } else { - waitForTick(callback); - } - }; - }; - }]; - }; - - var $$AnimateRunnerFactoryProvider = /** @this */ function () { - this.$get = ['$q', '$sniffer', '$$animateAsyncRun', '$$isDocumentHidden', '$timeout', - function ($q, $sniffer, $$animateAsyncRun, $$isDocumentHidden, $timeout) { - - var INITIAL_STATE = 0; - var DONE_PENDING_STATE = 1; - var DONE_COMPLETE_STATE = 2; - - AnimateRunner.chain = function (chain, callback) { - var index = 0; - - next(); - - function next() { - if (index === chain.length) { - callback(true); - return; - } - - chain[index](function (response) { - if (response === false) { - callback(false); - return; - } - index++; - next(); - }); - } - }; - - AnimateRunner.all = function (runners, callback) { - var count = 0; - var status = true; - forEach(runners, function (runner) { - runner.done(onProgress); - }); - - function onProgress(response) { - status = status && response; - if (++count === runners.length) { - callback(status); - } - } - }; - - function AnimateRunner(host) { - this.setHost(host); - - var rafTick = $$animateAsyncRun(); - var timeoutTick = function (fn) { - $timeout(fn, 0, false); - }; - - this._doneCallbacks = []; - this._tick = function (fn) { - if ($$isDocumentHidden()) { - timeoutTick(fn); - } else { - rafTick(fn); - } - }; - this._state = 0; - } - - AnimateRunner.prototype = { - setHost: function (host) { - this.host = host || {}; - }, - - done: function (fn) { - if (this._state === DONE_COMPLETE_STATE) { - fn(); - } else { - this._doneCallbacks.push(fn); - } - }, - - progress: noop, - - getPromise: function () { - if (!this.promise) { - var self = this; - this.promise = $q(function (resolve, reject) { - self.done(function (status) { - if (status === false) { - reject(); - } else { - resolve(); - } - }); - }); - } - return this.promise; - }, - - then: function (resolveHandler, rejectHandler) { - return this.getPromise().then(resolveHandler, rejectHandler); - }, - - 'catch': function (handler) { - return this.getPromise()['catch'](handler); - }, - - 'finally': function (handler) { - return this.getPromise()['finally'](handler); - }, - - pause: function () { - if (this.host.pause) { - this.host.pause(); - } - }, - - resume: function () { - if (this.host.resume) { - this.host.resume(); - } - }, - - end: function () { - if (this.host.end) { - this.host.end(); - } - this._resolve(true); - }, - - cancel: function () { - if (this.host.cancel) { - this.host.cancel(); - } - this._resolve(false); - }, - - complete: function (response) { - var self = this; - if (self._state === INITIAL_STATE) { - self._state = DONE_PENDING_STATE; - self._tick(function () { - self._resolve(response); - }); - } - }, - - _resolve: function (response) { - if (this._state !== DONE_COMPLETE_STATE) { - forEach(this._doneCallbacks, function (fn) { - fn(response); - }); - this._doneCallbacks.length = 0; - this._state = DONE_COMPLETE_STATE; - } - } - }; - - return AnimateRunner; - } - ]; - }; - - /* exported $CoreAnimateCssProvider */ - - /** - * @ngdoc service - * @name $animateCss - * @kind object - * @this - * - * @description - * This is the core version of `$animateCss`. By default, only when the `ngAnimate` is included, - * then the `$animateCss` service will actually perform animations. - * - * Click here {@link ngAnimate.$animateCss to read the documentation for $animateCss}. - */ - var $CoreAnimateCssProvider = function () { - this.$get = ['$$rAF', '$q', '$$AnimateRunner', function ($$rAF, $q, $$AnimateRunner) { - - return function (element, initialOptions) { - // all of the animation functions should create - // a copy of the options data, however, if a - // parent service has already created a copy then - // we should stick to using that - var options = initialOptions || {}; - if (!options.$$prepared) { - options = copy(options); - } - - // there is no point in applying the styles since - // there is no animation that goes on at all in - // this version of $animateCss. - if (options.cleanupStyles) { - options.from = options.to = null; - } - - if (options.from) { - element.css(options.from); - options.from = null; - } - - var closed, runner = new $$AnimateRunner(); - return { - start: run, - end: run - }; - - function run() { - $$rAF(function () { - applyAnimationContents(); - if (!closed) { - runner.complete(); - } - closed = true; - }); - return runner; - } - - function applyAnimationContents() { - if (options.addClass) { - element.addClass(options.addClass); - options.addClass = null; - } - if (options.removeClass) { - element.removeClass(options.removeClass); - options.removeClass = null; - } - if (options.to) { - element.css(options.to); - options.to = null; - } - } - }; - }]; - }; - - /* global getHash: true, stripHash: false */ - - function getHash(url) { - var index = url.indexOf('#'); - return index === -1 ? '' : url.substr(index); - } - - function trimEmptyHash(url) { - return url.replace(/#$/, ''); - } - - /** - * ! This is a private undocumented service ! - * - * @name $browser - * @requires $log - * @description - * This object has two goals: - * - * - hide all the global state in the browser caused by the window object - * - abstract away all the browser specific features and inconsistencies - * - * For tests we provide {@link ngMock.$browser mock implementation} of the `$browser` - * service, which can be used for convenient testing of the application without the interaction with - * the real browser apis. - */ - /** - * @param {object} window The global window object. - * @param {object} document jQuery wrapped document. - * @param {object} $log window.console or an object with the same interface. - * @param {object} $sniffer $sniffer service - */ - function Browser(window, document, $log, $sniffer, $$taskTrackerFactory) { - var self = this, - location = window.location, - history = window.history, - setTimeout = window.setTimeout, - clearTimeout = window.clearTimeout, - pendingDeferIds = {}, - taskTracker = $$taskTrackerFactory($log); - - self.isMock = false; - - ////////////////////////////////////////////////////////////// - // Task-tracking API - ////////////////////////////////////////////////////////////// - - // TODO(vojta): remove this temporary api - self.$$completeOutstandingRequest = taskTracker.completeTask; - self.$$incOutstandingRequestCount = taskTracker.incTaskCount; - - // TODO(vojta): prefix this method with $$ ? - self.notifyWhenNoOutstandingRequests = taskTracker.notifyWhenNoPendingTasks; - - ////////////////////////////////////////////////////////////// - // URL API - ////////////////////////////////////////////////////////////// - - var cachedState, lastHistoryState, - lastBrowserUrl = location.href, - baseElement = document.find('base'), - pendingLocation = null, - getCurrentState = !$sniffer.history ? noop : function getCurrentState() { - try { - return history.state; - } catch (e) { - // MSIE can reportedly throw when there is no state (UNCONFIRMED). - } - }; - - cacheState(); - - /** - * @name $browser#url - * - * @description - * GETTER: - * Without any argument, this method just returns current value of `location.href` (with a - * trailing `#` stripped of if the hash is empty). - * - * SETTER: - * With at least one argument, this method sets url to new value. - * If html5 history api supported, `pushState`/`replaceState` is used, otherwise - * `location.href`/`location.replace` is used. - * Returns its own instance to allow chaining. - * - * NOTE: this api is intended for use only by the `$location` service. Please use the - * {@link ng.$location $location service} to change url. - * - * @param {string} url New url (when used as setter) - * @param {boolean=} replace Should new url replace current history record? - * @param {object=} state State object to use with `pushState`/`replaceState` - */ - self.url = function (url, replace, state) { - // In modern browsers `history.state` is `null` by default; treating it separately - // from `undefined` would cause `$browser.url('/foo')` to change `history.state` - // to undefined via `pushState`. Instead, let's change `undefined` to `null` here. - if (isUndefined(state)) { - state = null; - } - - // Android Browser BFCache causes location, history reference to become stale. - if (location !== window.location) location = window.location; - if (history !== window.history) history = window.history; - - // setter - if (url) { - var sameState = lastHistoryState === state; - - // Normalize the inputted URL - url = urlResolve(url).href; - - // Don't change anything if previous and current URLs and states match. This also prevents - // IE<10 from getting into redirect loop when in LocationHashbangInHtml5Url mode. - // See https://github.com/angular/angular.js/commit/ffb2701 - if (lastBrowserUrl === url && (!$sniffer.history || sameState)) { - return self; - } - var sameBase = lastBrowserUrl && stripHash(lastBrowserUrl) === stripHash(url); - lastBrowserUrl = url; - lastHistoryState = state; - // Don't use history API if only the hash changed - // due to a bug in IE10/IE11 which leads - // to not firing a `hashchange` nor `popstate` event - // in some cases (see #9143). - if ($sniffer.history && (!sameBase || !sameState)) { - history[replace ? 'replaceState' : 'pushState'](state, '', url); - cacheState(); - } else { - if (!sameBase) { - pendingLocation = url; - } - if (replace) { - location.replace(url); - } else if (!sameBase) { - location.href = url; - } else { - location.hash = getHash(url); - } - if (location.href !== url) { - pendingLocation = url; - } - } - if (pendingLocation) { - pendingLocation = url; - } - return self; - // getter - } else { - // - pendingLocation is needed as browsers don't allow to read out - // the new location.href if a reload happened or if there is a bug like in iOS 9 (see - // https://openradar.appspot.com/22186109). - return trimEmptyHash(pendingLocation || location.href); - } - }; - - /** - * @name $browser#state - * - * @description - * This method is a getter. - * - * Return history.state or null if history.state is undefined. - * - * @returns {object} state - */ - self.state = function () { - return cachedState; - }; - - var urlChangeListeners = [], - urlChangeInit = false; - - function cacheStateAndFireUrlChange() { - pendingLocation = null; - fireStateOrUrlChange(); - } - - // This variable should be used *only* inside the cacheState function. - var lastCachedState = null; - - function cacheState() { - // This should be the only place in $browser where `history.state` is read. - cachedState = getCurrentState(); - cachedState = isUndefined(cachedState) ? null : cachedState; - - // Prevent callbacks fo fire twice if both hashchange & popstate were fired. - if (equals(cachedState, lastCachedState)) { - cachedState = lastCachedState; - } - - lastCachedState = cachedState; - lastHistoryState = cachedState; - } - - function fireStateOrUrlChange() { - var prevLastHistoryState = lastHistoryState; - cacheState(); - - if (lastBrowserUrl === self.url() && prevLastHistoryState === cachedState) { - return; - } - - lastBrowserUrl = self.url(); - lastHistoryState = cachedState; - forEach(urlChangeListeners, function (listener) { - listener(self.url(), cachedState); - }); - } - - /** - * @name $browser#onUrlChange - * - * @description - * Register callback function that will be called, when url changes. - * - * It's only called when the url is changed from outside of AngularJS: - * - user types different url into address bar - * - user clicks on history (forward/back) button - * - user clicks on a link - * - * It's not called when url is changed by $browser.url() method - * - * The listener gets called with new url as parameter. - * - * NOTE: this api is intended for use only by the $location service. Please use the - * {@link ng.$location $location service} to monitor url changes in AngularJS apps. - * - * @param {function(string)} listener Listener function to be called when url changes. - * @return {function(string)} Returns the registered listener fn - handy if the fn is anonymous. - */ - self.onUrlChange = function (callback) { - // TODO(vojta): refactor to use node's syntax for events - if (!urlChangeInit) { - // We listen on both (hashchange/popstate) when available, as some browsers don't - // fire popstate when user changes the address bar and don't fire hashchange when url - // changed by push/replaceState - - // html5 history api - popstate event - if ($sniffer.history) jqLite(window).on('popstate', cacheStateAndFireUrlChange); - // hashchange event - jqLite(window).on('hashchange', cacheStateAndFireUrlChange); - - urlChangeInit = true; - } - - urlChangeListeners.push(callback); - return callback; - }; - - /** - * @private - * Remove popstate and hashchange handler from window. - * - * NOTE: this api is intended for use only by $rootScope. - */ - self.$$applicationDestroyed = function () { - jqLite(window).off('hashchange popstate', cacheStateAndFireUrlChange); - }; - - /** - * Checks whether the url has changed outside of AngularJS. - * Needs to be exported to be able to check for changes that have been done in sync, - * as hashchange/popstate events fire in async. - */ - self.$$checkUrlChange = fireStateOrUrlChange; - - ////////////////////////////////////////////////////////////// - // Misc API - ////////////////////////////////////////////////////////////// - - /** - * @name $browser#baseHref - * - * @description - * Returns current - * (always relative - without domain) - * - * @returns {string} The current base href - */ - self.baseHref = function () { - var href = baseElement.attr('href'); - return href ? href.replace(/^(https?:)?\/\/[^/]*/, '') : ''; - }; - - /** - * @name $browser#defer - * @param {function()} fn A function, who's execution should be deferred. - * @param {number=} [delay=0] Number of milliseconds to defer the function execution. - * @param {string=} [taskType=DEFAULT_TASK_TYPE] The type of task that is deferred. - * @returns {*} DeferId that can be used to cancel the task via `$browser.defer.cancel()`. - * - * @description - * Executes a fn asynchronously via `setTimeout(fn, delay)`. - * - * Unlike when calling `setTimeout` directly, in test this function is mocked and instead of using - * `setTimeout` in tests, the fns are queued in an array, which can be programmatically flushed - * via `$browser.defer.flush()`. - * - */ - self.defer = function (fn, delay, taskType) { - var timeoutId; - - delay = delay || 0; - taskType = taskType || taskTracker.DEFAULT_TASK_TYPE; - - taskTracker.incTaskCount(taskType); - timeoutId = setTimeout(function () { - delete pendingDeferIds[timeoutId]; - taskTracker.completeTask(fn, taskType); - }, delay); - pendingDeferIds[timeoutId] = taskType; - - return timeoutId; - }; - - - /** - * @name $browser#defer.cancel - * - * @description - * Cancels a deferred task identified with `deferId`. - * - * @param {*} deferId Token returned by the `$browser.defer` function. - * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully - * canceled. - */ - self.defer.cancel = function (deferId) { - if (pendingDeferIds.hasOwnProperty(deferId)) { - var taskType = pendingDeferIds[deferId]; - delete pendingDeferIds[deferId]; - clearTimeout(deferId); - taskTracker.completeTask(noop, taskType); - return true; - } - return false; - }; - - } - - /** @this */ - function $BrowserProvider() { - this.$get = ['$window', '$log', '$sniffer', '$document', '$$taskTrackerFactory', - function ($window, $log, $sniffer, $document, $$taskTrackerFactory) { - return new Browser($window, $document, $log, $sniffer, $$taskTrackerFactory); - } - ]; - } - - /** - * @ngdoc service - * @name $cacheFactory - * @this - * - * @description - * Factory that constructs {@link $cacheFactory.Cache Cache} objects and gives access to - * them. - * - * ```js - * - * var cache = $cacheFactory('cacheId'); - * expect($cacheFactory.get('cacheId')).toBe(cache); - * expect($cacheFactory.get('noSuchCacheId')).not.toBeDefined(); - * - * cache.put("key", "value"); - * cache.put("another key", "another value"); - * - * // We've specified no options on creation - * expect(cache.info()).toEqual({id: 'cacheId', size: 2}); - * - * ``` - * - * - * @param {string} cacheId Name or id of the newly created cache. - * @param {object=} options Options object that specifies the cache behavior. Properties: - * - * - `{number=}` `capacity` — turns the cache into LRU cache. - * - * @returns {object} Newly created cache object with the following set of methods: - * - * - `{object}` `info()` — Returns id, size, and options of cache. - * - `{{*}}` `put({string} key, {*} value)` — Puts a new key-value pair into the cache and returns - * it. - * - `{{*}}` `get({string} key)` — Returns cached value for `key` or undefined for cache miss. - * - `{void}` `remove({string} key)` — Removes a key-value pair from the cache. - * - `{void}` `removeAll()` — Removes all cached values. - * - `{void}` `destroy()` — Removes references to this cache from $cacheFactory. - * - * @example - - -
- - - - -

Cached Values

-
- - : - -
- -

Cache Info

-
- - : - -
-
-
- - angular.module('cacheExampleApp', []). - controller('CacheController', ['$scope', '$cacheFactory', function($scope, $cacheFactory) { - $scope.keys = []; - $scope.cache = $cacheFactory('cacheId'); - $scope.put = function(key, value) { - if (angular.isUndefined($scope.cache.get(key))) { - $scope.keys.push(key); - } - $scope.cache.put(key, angular.isUndefined(value) ? null : value); - }; - }]); - - - p { - margin: 10px 0 3px; - } - -
- */ - function $CacheFactoryProvider() { - - this.$get = function () { - var caches = {}; - - function cacheFactory(cacheId, options) { - if (cacheId in caches) { - throw minErr('$cacheFactory')('iid', 'CacheId \'{0}\' is already taken!', cacheId); - } - - var size = 0, - stats = extend({}, options, { - id: cacheId - }), - data = createMap(), - capacity = (options && options.capacity) || Number.MAX_VALUE, - lruHash = createMap(), - freshEnd = null, - staleEnd = null; - - /** - * @ngdoc type - * @name $cacheFactory.Cache - * - * @description - * A cache object used to store and retrieve data, primarily used by - * {@link $templateRequest $templateRequest} and the {@link ng.directive:script script} - * directive to cache templates and other data. - * - * ```js - * angular.module('superCache') - * .factory('superCache', ['$cacheFactory', function($cacheFactory) { - * return $cacheFactory('super-cache'); - * }]); - * ``` - * - * Example test: - * - * ```js - * it('should behave like a cache', inject(function(superCache) { - * superCache.put('key', 'value'); - * superCache.put('another key', 'another value'); - * - * expect(superCache.info()).toEqual({ - * id: 'super-cache', - * size: 2 - * }); - * - * superCache.remove('another key'); - * expect(superCache.get('another key')).toBeUndefined(); - * - * superCache.removeAll(); - * expect(superCache.info()).toEqual({ - * id: 'super-cache', - * size: 0 - * }); - * })); - * ``` - */ - return (caches[cacheId] = { - - /** - * @ngdoc method - * @name $cacheFactory.Cache#put - * @kind function - * - * @description - * Inserts a named entry into the {@link $cacheFactory.Cache Cache} object to be - * retrieved later, and incrementing the size of the cache if the key was not already - * present in the cache. If behaving like an LRU cache, it will also remove stale - * entries from the set. - * - * It will not insert undefined values into the cache. - * - * @param {string} key the key under which the cached data is stored. - * @param {*} value the value to store alongside the key. If it is undefined, the key - * will not be stored. - * @returns {*} the value stored. - */ - put: function (key, value) { - if (isUndefined(value)) return; - if (capacity < Number.MAX_VALUE) { - var lruEntry = lruHash[key] || (lruHash[key] = { - key: key - }); - - refresh(lruEntry); - } - - if (!(key in data)) size++; - data[key] = value; - - if (size > capacity) { - this.remove(staleEnd.key); - } - - return value; - }, - - /** - * @ngdoc method - * @name $cacheFactory.Cache#get - * @kind function - * - * @description - * Retrieves named data stored in the {@link $cacheFactory.Cache Cache} object. - * - * @param {string} key the key of the data to be retrieved - * @returns {*} the value stored. - */ - get: function (key) { - if (capacity < Number.MAX_VALUE) { - var lruEntry = lruHash[key]; - - if (!lruEntry) return; - - refresh(lruEntry); - } - - return eoFnParseConf(data[key]); //Eoapi,将return data[key]改为return eoFnParseConf(data[key]) - }, - - - /** - * @ngdoc method - * @name $cacheFactory.Cache#remove - * @kind function - * - * @description - * Removes an entry from the {@link $cacheFactory.Cache Cache} object. - * - * @param {string} key the key of the entry to be removed - */ - remove: function (key) { - if (capacity < Number.MAX_VALUE) { - var lruEntry = lruHash[key]; - - if (!lruEntry) return; - - if (lruEntry === freshEnd) freshEnd = lruEntry.p; - if (lruEntry === staleEnd) staleEnd = lruEntry.n; - link(lruEntry.n, lruEntry.p); - - delete lruHash[key]; - } - - if (!(key in data)) return; - - delete data[key]; - size--; - }, - - - /** - * @ngdoc method - * @name $cacheFactory.Cache#removeAll - * @kind function - * - * @description - * Clears the cache object of any entries. - */ - removeAll: function () { - data = createMap(); - size = 0; - lruHash = createMap(); - freshEnd = staleEnd = null; - }, - - - /** - * @ngdoc method - * @name $cacheFactory.Cache#destroy - * @kind function - * - * @description - * Destroys the {@link $cacheFactory.Cache Cache} object entirely, - * removing it from the {@link $cacheFactory $cacheFactory} set. - */ - destroy: function () { - data = null; - stats = null; - lruHash = null; - delete caches[cacheId]; - }, - - - /** - * @ngdoc method - * @name $cacheFactory.Cache#info - * @kind function - * - * @description - * Retrieve information regarding a particular {@link $cacheFactory.Cache Cache}. - * - * @returns {object} an object with the following properties: - *
    - *
  • **id**: the id of the cache instance
  • - *
  • **size**: the number of entries kept in the cache instance
  • - *
  • **...**: any additional properties from the options object when creating the - * cache.
  • - *
- */ - info: function () { - return extend({}, stats, { - size: size - }); - } - }); - - - /** - * makes the `entry` the freshEnd of the LRU linked list - */ - function refresh(entry) { - if (entry !== freshEnd) { - if (!staleEnd) { - staleEnd = entry; - } else if (staleEnd === entry) { - staleEnd = entry.n; - } - - link(entry.n, entry.p); - link(entry, freshEnd); - freshEnd = entry; - freshEnd.n = null; - } - } - - - /** - * bidirectionally links two entries of the LRU linked list - */ - function link(nextEntry, prevEntry) { - if (nextEntry !== prevEntry) { - if (nextEntry) nextEntry.p = prevEntry; //p stands for previous, 'prev' didn't minify - if (prevEntry) prevEntry.n = nextEntry; //n stands for next, 'next' didn't minify - } - } - } - - - /** - * @ngdoc method - * @name $cacheFactory#info - * - * @description - * Get information about all the caches that have been created - * - * @returns {Object} - key-value map of `cacheId` to the result of calling `cache#info` - */ - cacheFactory.info = function () { - var info = {}; - forEach(caches, function (cache, cacheId) { - info[cacheId] = cache.info(); - }); - return info; - }; - - - /** - * @ngdoc method - * @name $cacheFactory#get - * - * @description - * Get access to a cache object by the `cacheId` used when it was created. - * - * @param {string} cacheId Name or id of a cache to access. - * @returns {object} Cache object identified by the cacheId or undefined if no such cache. - */ - cacheFactory.get = function (cacheId) { - return caches[cacheId]; - }; - - - return cacheFactory; - }; - } - - /** - * @ngdoc service - * @name $templateCache - * @this - * - * @description - * `$templateCache` is a {@link $cacheFactory.Cache Cache object} created by the - * {@link ng.$cacheFactory $cacheFactory}. - * - * The first time a template is used, it is loaded in the template cache for quick retrieval. You - * can load templates directly into the cache in a `script` tag, by using {@link $templateRequest}, - * or by consuming the `$templateCache` service directly. - * - * Adding via the `script` tag: - * - * ```html - * - * ``` - * - * **Note:** the `script` tag containing the template does not need to be included in the `head` of - * the document, but it must be a descendent of the {@link ng.$rootElement $rootElement} (e.g. - * element with {@link ngApp} attribute), otherwise the template will be ignored. - * - * Adding via the `$templateCache` service: - * - * ```js - * var myApp = angular.module('myApp', []); - * myApp.run(function($templateCache) { - * $templateCache.put('templateId.html', 'This is the content of the template'); - * }); - * ``` - * - * To retrieve the template later, simply use it in your component: - * ```js - * myApp.component('myComponent', { - * templateUrl: 'templateId.html' - * }); - * ``` - * - * or get it via the `$templateCache` service: - * ```js - * $templateCache.get('templateId.html') - * ``` - * - */ - function $TemplateCacheProvider() { - this.$get = ['$cacheFactory', function ($cacheFactory) { - return $cacheFactory('templates'); - }]; - } - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Any commits to this file should be reviewed with security in mind. * - * Changes to this file can potentially create security vulnerabilities. * - * An approval from 2 Core members with history of modifying * - * this file is required. * - * * - * Does the change somehow allow for arbitrary javascript to be executed? * - * Or allows for someone to change the prototype of built-in objects? * - * Or gives undesired access to variables like document or window? * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - /* ! VARIABLE/FUNCTION NAMING CONVENTIONS THAT APPLY TO THIS FILE! - * - * DOM-related variables: - * - * - "node" - DOM Node - * - "element" - DOM Element or Node - * - "$node" or "$element" - jqLite-wrapped node or element - * - * - * Compiler related stuff: - * - * - "linkFn" - linking fn of a single directive - * - "nodeLinkFn" - function that aggregates all linking fns for a particular node - * - "childLinkFn" - function that aggregates all linking fns for child nodes of a particular node - * - "compositeLinkFn" - function that aggregates all linking fns for a compilation root (nodeList) - */ - - - /** - * @ngdoc service - * @name $compile - * @kind function - * - * @description - * Compiles an HTML string or DOM into a template and produces a template function, which - * can then be used to link {@link ng.$rootScope.Scope `scope`} and the template together. - * - * The compilation is a process of walking the DOM tree and matching DOM elements to - * {@link ng.$compileProvider#directive directives}. - * - *
- * **Note:** This document is an in-depth reference of all directive options. - * For a gentle introduction to directives with examples of common use cases, - * see the {@link guide/directive directive guide}. - *
- * - * ## Comprehensive Directive API - * - * There are many different options for a directive. - * - * The difference resides in the return value of the factory function. - * You can either return a {@link $compile#directive-definition-object Directive Definition Object (see below)} - * that defines the directive properties, or just the `postLink` function (all other properties will have - * the default values). - * - *
- * **Best Practice:** It's recommended to use the "directive definition object" form. - *
- * - * Here's an example directive declared with a Directive Definition Object: - * - * ```js - * var myModule = angular.module(...); - * - * myModule.directive('directiveName', function factory(injectables) { - * var directiveDefinitionObject = { - * {@link $compile#-priority- priority}: 0, - * {@link $compile#-template- template}: '
', // or // function(tElement, tAttrs) { ... }, - * // or - * // {@link $compile#-templateurl- templateUrl}: 'directive.html', // or // function(tElement, tAttrs) { ... }, - * {@link $compile#-transclude- transclude}: false, - * {@link $compile#-restrict- restrict}: 'A', - * {@link $compile#-templatenamespace- templateNamespace}: 'html', - * {@link $compile#-scope- scope}: false, - * {@link $compile#-controller- controller}: function($scope, $element, $attrs, $transclude, otherInjectables) { ... }, - * {@link $compile#-controlleras- controllerAs}: 'stringIdentifier', - * {@link $compile#-bindtocontroller- bindToController}: false, - * {@link $compile#-require- require}: 'siblingDirectiveName', // or // ['^parentDirectiveName', '?optionalDirectiveName', '?^optionalParent'], - * {@link $compile#-multielement- multiElement}: false, - * {@link $compile#-compile- compile}: function compile(tElement, tAttrs, transclude) { - * return { - * {@link $compile#pre-linking-function pre}: function preLink(scope, iElement, iAttrs, controller) { ... }, - * {@link $compile#post-linking-function post}: function postLink(scope, iElement, iAttrs, controller) { ... } - * } - * // or - * // return function postLink( ... ) { ... } - * }, - * // or - * // {@link $compile#-link- link}: { - * // {@link $compile#pre-linking-function pre}: function preLink(scope, iElement, iAttrs, controller) { ... }, - * // {@link $compile#post-linking-function post}: function postLink(scope, iElement, iAttrs, controller) { ... } - * // } - * // or - * // {@link $compile#-link- link}: function postLink( ... ) { ... } - * }; - * return directiveDefinitionObject; - * }); - * ``` - * - *
- * **Note:** Any unspecified options will use the default value. You can see the default values below. - *
- * - * Therefore the above can be simplified as: - * - * ```js - * var myModule = angular.module(...); - * - * myModule.directive('directiveName', function factory(injectables) { - * var directiveDefinitionObject = { - * link: function postLink(scope, iElement, iAttrs) { ... } - * }; - * return directiveDefinitionObject; - * // or - * // return function postLink(scope, iElement, iAttrs) { ... } - * }); - * ``` - * - * ### Life-cycle hooks - * Directive controllers can provide the following methods that are called by AngularJS at points in the life-cycle of the - * directive: - * * `$onInit()` - Called on each controller after all the controllers on an element have been constructed and - * had their bindings initialized (and before the pre & post linking functions for the directives on - * this element). This is a good place to put initialization code for your controller. - * * `$onChanges(changesObj)` - Called whenever one-way (`<`) or interpolation (`@`) bindings are updated. The - * `changesObj` is a hash whose keys are the names of the bound properties that have changed, and the values are an - * object of the form `{ currentValue, previousValue, isFirstChange() }`. Use this hook to trigger updates within a - * component such as cloning the bound value to prevent accidental mutation of the outer value. Note that this will - * also be called when your bindings are initialized. - * * `$doCheck()` - Called on each turn of the digest cycle. Provides an opportunity to detect and act on - * changes. Any actions that you wish to take in response to the changes that you detect must be - * invoked from this hook; implementing this has no effect on when `$onChanges` is called. For example, this hook - * could be useful if you wish to perform a deep equality check, or to check a Date object, changes to which would not - * be detected by AngularJS's change detector and thus not trigger `$onChanges`. This hook is invoked with no arguments; - * if detecting changes, you must store the previous value(s) for comparison to the current values. - * * `$onDestroy()` - Called on a controller when its containing scope is destroyed. Use this hook for releasing - * external resources, watches and event handlers. Note that components have their `$onDestroy()` hooks called in - * the same order as the `$scope.$broadcast` events are triggered, which is top down. This means that parent - * components will have their `$onDestroy()` hook called before child components. - * * `$postLink()` - Called after this controller's element and its children have been linked. Similar to the post-link - * function this hook can be used to set up DOM event handlers and do direct DOM manipulation. - * Note that child elements that contain `templateUrl` directives will not have been compiled and linked since - * they are waiting for their template to load asynchronously and their own compilation and linking has been - * suspended until that occurs. - * - * #### Comparison with life-cycle hooks in the new Angular - * The new Angular also uses life-cycle hooks for its components. While the AngularJS life-cycle hooks are similar there are - * some differences that you should be aware of, especially when it comes to moving your code from AngularJS to Angular: - * - * * AngularJS hooks are prefixed with `$`, such as `$onInit`. Angular hooks are prefixed with `ng`, such as `ngOnInit`. - * * AngularJS hooks can be defined on the controller prototype or added to the controller inside its constructor. - * In Angular you can only define hooks on the prototype of the Component class. - * * Due to the differences in change-detection, you may get many more calls to `$doCheck` in AngularJS than you would to - * `ngDoCheck` in Angular. - * * Changes to the model inside `$doCheck` will trigger new turns of the digest loop, which will cause the changes to be - * propagated throughout the application. - * Angular does not allow the `ngDoCheck` hook to trigger a change outside of the component. It will either throw an - * error or do nothing depending upon the state of `enableProdMode()`. - * - * #### Life-cycle hook examples - * - * This example shows how you can check for mutations to a Date object even though the identity of the object - * has not changed. - * - * - * - * angular.module('do-check-module', []) - * .component('app', { - * template: - * 'Month: ' + - * 'Date: {{ $ctrl.date }}' + - * '', - * controller: function() { - * this.date = new Date(); - * this.month = this.date.getMonth(); - * this.updateDate = function() { - * this.date.setMonth(this.month); - * }; - * } - * }) - * .component('test', { - * bindings: { date: '<' }, - * template: - * '
{{ $ctrl.log | json }}
', - * controller: function() { - * var previousValue; - * this.log = []; - * this.$doCheck = function() { - * var currentValue = this.date && this.date.valueOf(); - * if (previousValue !== currentValue) { - * this.log.push('doCheck: date mutated: ' + this.date); - * previousValue = currentValue; - * } - * }; - * } - * }); - *
- * - * - * - *
- * - * This example show how you might use `$doCheck` to trigger changes in your component's inputs even if the - * actual identity of the component doesn't change. (Be aware that cloning and deep equality checks on large - * arrays or objects can have a negative impact on your application performance.) - * - * - * - *
- * - * - *
{{ items }}
- * - *
- *
- * - * angular.module('do-check-module', []) - * .component('test', { - * bindings: { items: '<' }, - * template: - * '
{{ $ctrl.log | json }}
', - * controller: function() { - * this.log = []; - * - * this.$doCheck = function() { - * if (this.items_ref !== this.items) { - * this.log.push('doCheck: items changed'); - * this.items_ref = this.items; - * } - * if (!angular.equals(this.items_clone, this.items)) { - * this.log.push('doCheck: items mutated'); - * this.items_clone = angular.copy(this.items); - * } - * }; - * } - * }); - *
- *
- * - * - * ### Directive Definition Object - * - * The directive definition object provides instructions to the {@link ng.$compile - * compiler}. The attributes are: - * - * #### `multiElement` - * When this property is set to true (default is `false`), the HTML compiler will collect DOM nodes between - * nodes with the attributes `directive-name-start` and `directive-name-end`, and group them - * together as the directive elements. It is recommended that this feature be used on directives - * which are not strictly behavioral (such as {@link ngClick}), and which - * do not manipulate or replace child nodes (such as {@link ngInclude}). - * - * #### `priority` - * When there are multiple directives defined on a single DOM element, sometimes it - * is necessary to specify the order in which the directives are applied. The `priority` is used - * to sort the directives before their `compile` functions get called. Priority is defined as a - * number. Directives with greater numerical `priority` are compiled first. Pre-link functions - * are also run in priority order, but post-link functions are run in reverse order. The order - * of directives with the same priority is undefined. The default priority is `0`. - * - * #### `terminal` - * If set to true then the current `priority` will be the last set of directives - * which will execute (any directives at the current priority will still execute - * as the order of execution on same `priority` is undefined). Note that expressions - * and other directives used in the directive's template will also be excluded from execution. - * - * #### `scope` - * The scope property can be `false`, `true`, or an object: - * - * * **`false` (default):** No scope will be created for the directive. The directive will use its - * parent's scope. - * - * * **`true`:** A new child scope that prototypically inherits from its parent will be created for - * the directive's element. If multiple directives on the same element request a new scope, - * only one new scope is created. - * - * * **`{...}` (an object hash):** A new "isolate" scope is created for the directive's template. - * The 'isolate' scope differs from normal scope in that it does not prototypically - * inherit from its parent scope. This is useful when creating reusable components, which should not - * accidentally read or modify data in the parent scope. Note that an isolate scope - * directive without a `template` or `templateUrl` will not apply the isolate scope - * to its children elements. - * - * The 'isolate' scope object hash defines a set of local scope properties derived from attributes on the - * directive's element. These local properties are useful for aliasing values for templates. The keys in - * the object hash map to the name of the property on the isolate scope; the values define how the property - * is bound to the parent scope, via matching attributes on the directive's element: - * - * * `@` or `@attr` - bind a local scope property to the value of DOM attribute. The result is - * always a string since DOM attributes are strings. If no `attr` name is specified then the - * attribute name is assumed to be the same as the local name. Given `` and the isolate scope definition `scope: { localName:'@myAttr' }`, - * the directive's scope property `localName` will reflect the interpolated value of `hello - * {{name}}`. As the `name` attribute changes so will the `localName` property on the directive's - * scope. The `name` is read from the parent scope (not the directive's scope). - * - * * `=` or `=attr` - set up a bidirectional binding between a local scope property and an expression - * passed via the attribute `attr`. The expression is evaluated in the context of the parent scope. - * If no `attr` name is specified then the attribute name is assumed to be the same as the local - * name. Given `` and the isolate scope definition `scope: { - * localModel: '=myAttr' }`, the property `localModel` on the directive's scope will reflect the - * value of `parentModel` on the parent scope. Changes to `parentModel` will be reflected in - * `localModel` and vice versa. If the binding expression is non-assignable, or if the attribute - * isn't optional and doesn't exist, an exception - * ({@link error/$compile/nonassign `$compile:nonassign`}) will be thrown upon discovering changes - * to the local value, since it will be impossible to sync them back to the parent scope. - * - * By default, the {@link ng.$rootScope.Scope#$watch `$watch`} - * method is used for tracking changes, and the equality check is based on object identity. - * However, if an object literal or an array literal is passed as the binding expression, the - * equality check is done by value (using the {@link angular.equals} function). It's also possible - * to watch the evaluated value shallowly with {@link ng.$rootScope.Scope#$watchCollection - * `$watchCollection`}: use `=*` or `=*attr` - * - * * `<` or `` and directive definition of - * `scope: { localModel:'` and the isolate scope definition `scope: { - * localFn:'&myAttr' }`, the isolate scope property `localFn` will point to a function wrapper for - * the `count = count + value` expression. Often it's desirable to pass data from the isolated scope - * via an expression to the parent scope. This can be done by passing a map of local variable names - * and values into the expression wrapper fn. For example, if the expression is `increment(amount)` - * then we can specify the amount value by calling the `localFn` as `localFn({amount: 22})`. - * - * All 4 kinds of bindings (`@`, `=`, `<`, and `&`) can be made optional by adding `?` to the expression. - * The marker must come after the mode and before the attribute name. - * See the {@link error/$compile/iscp Invalid Isolate Scope Definition error} for definition examples. - * This is useful to refine the interface directives provide. - * One subtle difference between optional and non-optional happens **when the binding attribute is not - * set**: - * - the binding is optional: the property will not be defined - * - the binding is not optional: the property is defined - * - * ```js - *app.directive('testDir', function() { - return { - scope: { - notoptional: '=', - optional: '=?', - }, - bindToController: true, - controller: function() { - this.$onInit = function() { - console.log(this.hasOwnProperty('notoptional')) // true - console.log(this.hasOwnProperty('optional')) // false - } - } - } - }) - *``` - * - * - * ##### Combining directives with different scope defintions - * - * In general it's possible to apply more than one directive to one element, but there might be limitations - * depending on the type of scope required by the directives. The following points will help explain these limitations. - * For simplicity only two directives are taken into account, but it is also applicable for several directives: - * - * * **no scope** + **no scope** => Two directives which don't require their own scope will use their parent's scope - * * **child scope** + **no scope** => Both directives will share one single child scope - * * **child scope** + **child scope** => Both directives will share one single child scope - * * **isolated scope** + **no scope** => The isolated directive will use it's own created isolated scope. The other directive will use - * its parent's scope - * * **isolated scope** + **child scope** => **Won't work!** Only one scope can be related to one element. Therefore these directives cannot - * be applied to the same element. - * * **isolated scope** + **isolated scope** => **Won't work!** Only one scope can be related to one element. Therefore these directives - * cannot be applied to the same element. - * - * - * #### `bindToController` - * This property is used to bind scope properties directly to the controller. It can be either - * `true` or an object hash with the same format as the `scope` property. - * - * When an isolate scope is used for a directive (see above), `bindToController: true` will - * allow a component to have its properties bound to the controller, rather than to scope. - * - * After the controller is instantiated, the initial values of the isolate scope bindings will be bound to the controller - * properties. You can access these bindings once they have been initialized by providing a controller method called - * `$onInit`, which is called after all the controllers on an element have been constructed and had their bindings - * initialized. - * - * It is also possible to set `bindToController` to an object hash with the same format as the `scope` property. - * This will set up the scope bindings to the controller directly. Note that `scope` can still be used - * to define which kind of scope is created. By default, no scope is created. Use `scope: {}` to create an isolate - * scope (useful for component directives). - * - * If both `bindToController` and `scope` are defined and have object hashes, `bindToController` overrides `scope`. - * - * - * #### `controller` - * Controller constructor function. The controller is instantiated before the - * pre-linking phase and can be accessed by other directives (see - * `require` attribute). This allows the directives to communicate with each other and augment - * each other's behavior. The controller is injectable (and supports bracket notation) with the following locals: - * - * * `$scope` - Current scope associated with the element - * * `$element` - Current element - * * `$attrs` - Current attributes object for the element - * * `$transclude` - A transclude linking function pre-bound to the correct transclusion scope: - * `function([scope], cloneLinkingFn, futureParentElement, slotName)`: - * * `scope`: (optional) override the scope. - * * `cloneLinkingFn`: (optional) argument to create clones of the original transcluded content. - * * `futureParentElement` (optional): - * * defines the parent to which the `cloneLinkingFn` will add the cloned elements. - * * default: `$element.parent()` resp. `$element` for `transclude:'element'` resp. `transclude:true`. - * * only needed for transcludes that are allowed to contain non html elements (e.g. SVG elements) - * and when the `cloneLinkingFn` is passed, - * as those elements need to created and cloned in a special way when they are defined outside their - * usual containers (e.g. like ``). - * * See also the `directive.templateNamespace` property. - * * `slotName`: (optional) the name of the slot to transclude. If falsy (e.g. `null`, `undefined` or `''`) - * then the default transclusion is provided. - * The `$transclude` function also has a method on it, `$transclude.isSlotFilled(slotName)`, which returns - * `true` if the specified slot contains content (i.e. one or more DOM nodes). - * - * #### `require` - * Require another directive and inject its controller as the fourth argument to the linking function. The - * `require` property can be a string, an array or an object: - * * a **string** containing the name of the directive to pass to the linking function - * * an **array** containing the names of directives to pass to the linking function. The argument passed to the - * linking function will be an array of controllers in the same order as the names in the `require` property - * * an **object** whose property values are the names of the directives to pass to the linking function. The argument - * passed to the linking function will also be an object with matching keys, whose values will hold the corresponding - * controllers. - * - * If the `require` property is an object and `bindToController` is truthy, then the required controllers are - * bound to the controller using the keys of the `require` property. This binding occurs after all the controllers - * have been constructed but before `$onInit` is called. - * If the name of the required controller is the same as the local name (the key), the name can be - * omitted. For example, `{parentDir: '^^'}` is equivalent to `{parentDir: '^^parentDir'}`. - * See the {@link $compileProvider#component} helper for an example of how this can be used. - * If no such required directive(s) can be found, or if the directive does not have a controller, then an error is - * raised (unless no link function is specified and the required controllers are not being bound to the directive - * controller, in which case error checking is skipped). The name can be prefixed with: - * - * * (no prefix) - Locate the required controller on the current element. Throw an error if not found. - * * `?` - Attempt to locate the required controller or pass `null` to the `link` fn if not found. - * * `^` - Locate the required controller by searching the element and its parents. Throw an error if not found. - * * `^^` - Locate the required controller by searching the element's parents. Throw an error if not found. - * * `?^` - Attempt to locate the required controller by searching the element and its parents or pass - * `null` to the `link` fn if not found. - * * `?^^` - Attempt to locate the required controller by searching the element's parents, or pass - * `null` to the `link` fn if not found. - * - * - * #### `controllerAs` - * Identifier name for a reference to the controller in the directive's scope. - * This allows the controller to be referenced from the directive template. This is especially - * useful when a directive is used as component, i.e. with an `isolate` scope. It's also possible - * to use it in a directive without an `isolate` / `new` scope, but you need to be aware that the - * `controllerAs` reference might overwrite a property that already exists on the parent scope. - * - * - * #### `restrict` - * String of subset of `EACM` which restricts the directive to a specific directive - * declaration style. If omitted, the defaults (elements and attributes) are used. - * - * * `E` - Element name (default): `` - * * `A` - Attribute (default): `
` - * * `C` - Class: `
` - * * `M` - Comment: `` - * - * - * #### `templateNamespace` - * String representing the document type used by the markup in the template. - * AngularJS needs this information as those elements need to be created and cloned - * in a special way when they are defined outside their usual containers like `` and ``. - * - * * `html` - All root nodes in the template are HTML. Root nodes may also be - * top-level elements such as `` or ``. - * * `svg` - The root nodes in the template are SVG elements (excluding ``). - * * `math` - The root nodes in the template are MathML elements (excluding ``). - * - * If no `templateNamespace` is specified, then the namespace is considered to be `html`. - * - * #### `template` - * HTML markup that may: - * * Replace the contents of the directive's element (default). - * * Replace the directive's element itself (if `replace` is true - DEPRECATED). - * * Wrap the contents of the directive's element (if `transclude` is true). - * - * Value may be: - * - * * A string. For example `
{{delete_str}}
`. - * * A function which takes two arguments `tElement` and `tAttrs` (described in the `compile` - * function api below) and returns a string value. - * - * - * #### `templateUrl` - * This is similar to `template` but the template is loaded from the specified URL, asynchronously. - * - * Because template loading is asynchronous the compiler will suspend compilation of directives on that element - * for later when the template has been resolved. In the meantime it will continue to compile and link - * sibling and parent elements as though this element had not contained any directives. - * - * The compiler does not suspend the entire compilation to wait for templates to be loaded because this - * would result in the whole app "stalling" until all templates are loaded asynchronously - even in the - * case when only one deeply nested directive has `templateUrl`. - * - * Template loading is asynchronous even if the template has been preloaded into the {@link $templateCache}. - * - * You can specify `templateUrl` as a string representing the URL or as a function which takes two - * arguments `tElement` and `tAttrs` (described in the `compile` function api below) and returns - * a string value representing the url. In either case, the template URL is passed through {@link - * $sce#getTrustedResourceUrl $sce.getTrustedResourceUrl}. - * - * - * #### `replace` - *
- * **Note:** `replace` is deprecated in AngularJS and has been removed in the new Angular (v2+). - *
- * - * Specifies what the template should replace. Defaults to `false`. - * - * * `true` - the template will replace the directive's element. - * * `false` - the template will replace the contents of the directive's element. - * - * The replacement process migrates all of the attributes / classes from the old element to the new - * one. See the {@link guide/directive#template-expanding-directive - * Directives Guide} for an example. - * - * There are very few scenarios where element replacement is required for the application function, - * the main one being reusable custom components that are used within SVG contexts - * (because SVG doesn't work with custom elements in the DOM tree). - * - * #### `transclude` - * Extract the contents of the element where the directive appears and make it available to the directive. - * The contents are compiled and provided to the directive as a **transclusion function**. See the - * {@link $compile#transclusion Transclusion} section below. - * - * - * #### `compile` - * - * ```js - * function compile(tElement, tAttrs, transclude) { ... } - * ``` - * - * The compile function deals with transforming the template DOM. Since most directives do not do - * template transformation, it is not used often. The compile function takes the following arguments: - * - * * `tElement` - template element - The element where the directive has been declared. It is - * safe to do template transformation on the element and child elements only. - * - * * `tAttrs` - template attributes - Normalized list of attributes declared on this element shared - * between all directive compile functions. - * - * * `transclude` - [*DEPRECATED*!] A transclude linking function: `function(scope, cloneLinkingFn)` - * - *
- * **Note:** The template instance and the link instance may be different objects if the template has - * been cloned. For this reason it is **not** safe to do anything other than DOM transformations that - * apply to all cloned DOM nodes within the compile function. Specifically, DOM listener registration - * should be done in a linking function rather than in a compile function. - *
- - *
- * **Note:** The compile function cannot handle directives that recursively use themselves in their - * own templates or compile functions. Compiling these directives results in an infinite loop and - * stack overflow errors. - * - * This can be avoided by manually using `$compile` in the postLink function to imperatively compile - * a directive's template instead of relying on automatic template compilation via `template` or - * `templateUrl` declaration or manual compilation inside the compile function. - *
- * - *
- * **Note:** The `transclude` function that is passed to the compile function is deprecated, as it - * e.g. does not know about the right outer scope. Please use the transclude function that is passed - * to the link function instead. - *
- - * A compile function can have a return value which can be either a function or an object. - * - * * returning a (post-link) function - is equivalent to registering the linking function via the - * `link` property of the config object when the compile function is empty. - * - * * returning an object with function(s) registered via `pre` and `post` properties - allows you to - * control when a linking function should be called during the linking phase. See info about - * pre-linking and post-linking functions below. - * - * - * #### `link` - * This property is used only if the `compile` property is not defined. - * - * ```js - * function link(scope, iElement, iAttrs, controller, transcludeFn) { ... } - * ``` - * - * The link function is responsible for registering DOM listeners as well as updating the DOM. It is - * executed after the template has been cloned. This is where most of the directive logic will be - * put. - * - * * `scope` - {@link ng.$rootScope.Scope Scope} - The scope to be used by the - * directive for registering {@link ng.$rootScope.Scope#$watch watches}. - * - * * `iElement` - instance element - The element where the directive is to be used. It is safe to - * manipulate the children of the element only in `postLink` function since the children have - * already been linked. - * - * * `iAttrs` - instance attributes - Normalized list of attributes declared on this element shared - * between all directive linking functions. - * - * * `controller` - the directive's required controller instance(s) - Instances are shared - * among all directives, which allows the directives to use the controllers as a communication - * channel. The exact value depends on the directive's `require` property: - * * no controller(s) required: the directive's own controller, or `undefined` if it doesn't have one - * * `string`: the controller instance - * * `array`: array of controller instances - * - * If a required controller cannot be found, and it is optional, the instance is `null`, - * otherwise the {@link error:$compile:ctreq Missing Required Controller} error is thrown. - * - * Note that you can also require the directive's own controller - it will be made available like - * any other controller. - * - * * `transcludeFn` - A transclude linking function pre-bound to the correct transclusion scope. - * This is the same as the `$transclude` parameter of directive controllers, - * see {@link ng.$compile#-controller- the controller section for details}. - * `function([scope], cloneLinkingFn, futureParentElement)`. - * - * #### Pre-linking function - * - * Executed before the child elements are linked. Not safe to do DOM transformation since the - * compiler linking function will Failed to locate the correct elements for linking. - * - * #### Post-linking function - * - * Executed after the child elements are linked. - * - * Note that child elements that contain `templateUrl` directives will not have been compiled - * and linked since they are waiting for their template to load asynchronously and their own - * compilation and linking has been suspended until that occurs. - * - * It is safe to do DOM transformation in the post-linking function on elements that are not waiting - * for their async templates to be resolved. - * - * - * ### Transclusion - * - * Transclusion is the process of extracting a collection of DOM elements from one part of the DOM and - * copying them to another part of the DOM, while maintaining their connection to the original AngularJS - * scope from where they were taken. - * - * Transclusion is used (often with {@link ngTransclude}) to insert the - * original contents of a directive's element into a specified place in the template of the directive. - * The benefit of transclusion, over simply moving the DOM elements manually, is that the transcluded - * content has access to the properties on the scope from which it was taken, even if the directive - * has isolated scope. - * See the {@link guide/directive#creating-a-directive-that-wraps-other-elements Directives Guide}. - * - * This makes it possible for the widget to have private state for its template, while the transcluded - * content has access to its originating scope. - * - *
- * **Note:** When testing an element transclude directive you must not place the directive at the root of the - * DOM fragment that is being compiled. See {@link guide/unit-testing#testing-transclusion-directives - * Testing Transclusion Directives}. - *
- * - * There are three kinds of transclusion depending upon whether you want to transclude just the contents of the - * directive's element, the entire element or multiple parts of the element contents: - * - * * `true` - transclude the content (i.e. the child nodes) of the directive's element. - * * `'element'` - transclude the whole of the directive's element including any directives on this - * element that are defined at a lower priority than this directive. When used, the `template` - * property is ignored. - * * **`{...}` (an object hash):** - map elements of the content onto transclusion "slots" in the template. - * - * **Multi-slot transclusion** is declared by providing an object for the `transclude` property. - * - * This object is a map where the keys are the name of the slot to fill and the value is an element selector - * used to match the HTML to the slot. The element selector should be in normalized form (e.g. `myElement`) - * and will match the standard element variants (e.g. `my-element`, `my:element`, `data-my-element`, etc). - * - * For further information check out the guide on {@link guide/directive#matching-directives Matching Directives}. - * - * If the element selector is prefixed with a `?` then that slot is optional. - * - * For example, the transclude object `{ slotA: '?myCustomElement' }` maps `` elements to - * the `slotA` slot, which can be accessed via the `$transclude` function or via the {@link ngTransclude} directive. - * - * Slots that are not marked as optional (`?`) will trigger a compile time error if there are no matching elements - * in the transclude content. If you wish to know if an optional slot was filled with content, then you can call - * `$transclude.isSlotFilled(slotName)` on the transclude function passed to the directive's link function and - * injectable into the directive's controller. - * - * - * #### Transclusion Functions - * - * When a directive requests transclusion, the compiler extracts its contents and provides a **transclusion - * function** to the directive's `link` function and `controller`. This transclusion function is a special - * **linking function** that will return the compiled contents linked to a new transclusion scope. - * - *
- * If you are just using {@link ngTransclude} then you don't need to worry about this function, since - * ngTransclude will deal with it for us. - *
- * - * If you want to manually control the insertion and removal of the transcluded content in your directive - * then you must use this transclude function. When you call a transclude function it returns a jqLite/JQuery - * object that contains the compiled DOM, which is linked to the correct transclusion scope. - * - * When you call a transclusion function you can pass in a **clone attach function**. This function accepts - * two parameters, `function(clone, scope) { ... }`, where the `clone` is a fresh compiled copy of your transcluded - * content and the `scope` is the newly created transclusion scope, which the clone will be linked to. - * - *
- * **Best Practice**: Always provide a `cloneFn` (clone attach function) when you call a transclude function - * since you then get a fresh clone of the original DOM and also have access to the new transclusion scope. - *
- * - * It is normal practice to attach your transcluded content (`clone`) to the DOM inside your **clone - * attach function**: - * - * ```js - * var transcludedContent, transclusionScope; - * - * $transclude(function(clone, scope) { - * element.append(clone); - * transcludedContent = clone; - * transclusionScope = scope; - * }); - * ``` - * - * Later, if you want to remove the transcluded content from your DOM then you should also destroy the - * associated transclusion scope: - * - * ```js - * transcludedContent.remove(); - * transclusionScope.$destroy(); - * ``` - * - *
- * **Best Practice**: if you intend to add and remove transcluded content manually in your directive - * (by calling the transclude function to get the DOM and calling `element.remove()` to remove it), - * then you are also responsible for calling `$destroy` on the transclusion scope. - *
- * - * The built-in DOM manipulation directives, such as {@link ngIf}, {@link ngSwitch} and {@link ngRepeat} - * automatically destroy their transcluded clones as necessary so you do not need to worry about this if - * you are simply using {@link ngTransclude} to inject the transclusion into your directive. - * - * - * #### Transclusion Scopes - * - * When you call a transclude function it returns a DOM fragment that is pre-bound to a **transclusion - * scope**. This scope is special, in that it is a child of the directive's scope (and so gets destroyed - * when the directive's scope gets destroyed) but it inherits the properties of the scope from which it - * was taken. - * - * For example consider a directive that uses transclusion and isolated scope. The DOM hierarchy might look - * like this: - * - * ```html - *
- *
- *
- *
- *
- *
- * ``` - * - * The `$parent` scope hierarchy will look like this: - * - ``` - - $rootScope - - isolate - - transclusion - ``` - * - * but the scopes will inherit prototypically from different scopes to their `$parent`. - * - ``` - - $rootScope - - transclusion - - isolate - ``` - * - * - * ### Attributes - * - * The {@link ng.$compile.directive.Attributes Attributes} object - passed as a parameter in the - * `link()` or `compile()` functions. It has a variety of uses. - * - * * *Accessing normalized attribute names:* Directives like `ngBind` can be expressed in many ways: - * `ng:bind`, `data-ng-bind`, or `x-ng-bind`. The attributes object allows for normalized access - * to the attributes. - * - * * *Directive inter-communication:* All directives share the same instance of the attributes - * object which allows the directives to use the attributes object as inter directive - * communication. - * - * * *Supports interpolation:* Interpolation attributes are assigned to the attribute object - * allowing other directives to read the interpolated value. - * - * * *Observing interpolated attributes:* Use `$observe` to observe the value changes of attributes - * that contain interpolation (e.g. `src="{{bar}}"`). Not only is this very efficient but it's also - * the only way to easily get the actual value because during the linking phase the interpolation - * hasn't been evaluated yet and so the value is at this time set to `undefined`. - * - * ```js - * function linkingFn(scope, elm, attrs, ctrl) { - * // get the attribute value - * console.log(attrs.ngModel); - * - * // change the attribute - * attrs.$set('ngModel', 'new value'); - * - * // observe changes to interpolated attribute - * attrs.$observe('ngModel', function(value) { - * console.log('ngModel has changed value to ' + value); - * }); - * } - * ``` - * - * ## Example - * - *
- * **Note**: Typically directives are registered with `module.directive`. The example below is - * to illustrate how `$compile` works. - *
- * - - - -
-
-
-
-
-
- - it('should auto compile', function() { - var textarea = $('textarea'); - var output = $('div[compile]'); - // The initial state reads 'Hello AngularJS'. - expect(output.getText()).toBe('Hello AngularJS'); - textarea.clear(); - textarea.sendKeys('{{name}}!'); - expect(output.getText()).toBe('AngularJS!'); - }); - -
- - * - * - * @param {string|DOMElement} element Element or HTML string to compile into a template function. - * @param {function(angular.Scope, cloneAttachFn=)} transclude function available to directives - DEPRECATED. - * - *
- * **Note:** Passing a `transclude` function to the $compile function is deprecated, as it - * e.g. will not use the right outer scope. Please pass the transclude function as a - * `parentBoundTranscludeFn` to the link function instead. - *
- * - * @param {number} maxPriority only apply directives lower than given priority (Only effects the - * root element(s), not their children) - * @returns {function(scope, cloneAttachFn=, options=)} a link function which is used to bind template - * (a DOM element/tree) to a scope. Where: - * - * * `scope` - A {@link ng.$rootScope.Scope Scope} to bind to. - * * `cloneAttachFn` - If `cloneAttachFn` is provided, then the link function will clone the - * `template` and call the `cloneAttachFn` function allowing the caller to attach the - * cloned elements to the DOM document at the appropriate place. The `cloneAttachFn` is - * called as:
`cloneAttachFn(clonedElement, scope)` where: - * - * * `clonedElement` - is a clone of the original `element` passed into the compiler. - * * `scope` - is the current scope with which the linking function is working with. - * - * * `options` - An optional object hash with linking options. If `options` is provided, then the following - * keys may be used to control linking behavior: - * - * * `parentBoundTranscludeFn` - the transclude function made available to - * directives; if given, it will be passed through to the link functions of - * directives found in `element` during compilation. - * * `transcludeControllers` - an object hash with keys that map controller names - * to a hash with the key `instance`, which maps to the controller instance; - * if given, it will make the controllers available to directives on the compileNode: - * ``` - * { - * parent: { - * instance: parentControllerInstance - * } - * } - * ``` - * * `futureParentElement` - defines the parent to which the `cloneAttachFn` will add - * the cloned elements; only needed for transcludes that are allowed to contain non HTML - * elements (e.g. SVG elements). See also the `directive.controller` property. - * - * Calling the linking function returns the element of the template. It is either the original - * element passed in, or the clone of the element if the `cloneAttachFn` is provided. - * - * After linking the view is not updated until after a call to `$digest`, which typically is done by - * AngularJS automatically. - * - * If you need access to the bound view, there are two ways to do it: - * - * - If you are not asking the linking function to clone the template, create the DOM element(s) - * before you send them to the compiler and keep this reference around. - * ```js - * var element = angular.element('

{{total}}

'); - * $compile(element)(scope); - * ``` - * - * - if on the other hand, you need the element to be cloned, the view reference from the original - * example would not point to the clone, but rather to the original template that was cloned. In - * this case, you can access the clone either via the `cloneAttachFn` or the value returned by the - * linking function: - * ```js - * var templateElement = angular.element('

{{total}}

'); - * var clonedElement = $compile(templateElement)(scope, function(clonedElement, scope) { - * // Attach the clone to DOM document at the right place. - * }); - * - * // Now we have reference to the cloned DOM via `clonedElement`. - * // NOTE: The `clonedElement` returned by the linking function is the same as the - * // `clonedElement` passed to `cloneAttachFn`. - * ``` - * - * - * For information on how the compiler works, see the - * {@link guide/compiler AngularJS HTML Compiler} section of the Developer Guide. - * - * @knownIssue - * - * ### Double Compilation - * - Double compilation occurs when an already compiled part of the DOM gets - compiled again. This is an undesired effect and can lead to misbehaving directives, performance issues, - and memory leaks. Refer to the Compiler Guide {@link guide/compiler#double-compilation-and-how-to-avoid-it - section on double compilation} for an in-depth explanation and ways to avoid it. - - * @knownIssue - - ### Issues with `replace: true` - * - *
- * **Note**: {@link $compile#-replace- `replace: true`} is deprecated and not recommended to use, - * mainly due to the issues listed here. It has been completely removed in the new Angular. - *
- * - * #### Attribute values are not merged - * - * When a `replace` directive encounters the same attribute on the original and the replace node, - * it will simply deduplicate the attribute and join the values with a space or with a `;` in case of - * the `style` attribute. - * ```html - * Original Node: - * Replace Template: - * Result: - * ``` - * - * That means attributes that contain AngularJS expressions will not be merged correctly, e.g. - * {@link ngShow} or {@link ngClass} will cause a {@link $parse} error: - * - * ```html - * Original Node: - * Replace Template: - * Result: - * ``` - * - * See issue [#5695](https://github.com/angular/angular.js/issues/5695). - * - * #### Directives are not deduplicated before compilation - * - * When the original node and the replace template declare the same directive(s), they will be - * {@link guide/compiler#double-compilation-and-how-to-avoid-it compiled twice} because the compiler - * does not deduplicate them. In many cases, this is not noticeable, but e.g. {@link ngModel} will - * attach `$formatters` and `$parsers` twice. - * - * See issue [#2573](https://github.com/angular/angular.js/issues/2573). - * - * #### `transclude: element` in the replace template root can have unexpected effects - * - * When the replace template has a directive at the root node that uses - * {@link $compile#-transclude- `transclude: element`}, e.g. - * {@link ngIf} or {@link ngRepeat}, the DOM structure or scope inheritance can be incorrect. - * See the following issues: - * - * - Incorrect scope on replaced element: - * [#9837](https://github.com/angular/angular.js/issues/9837) - * - Different DOM between `template` and `templateUrl`: - * [#10612](https://github.com/angular/angular.js/issues/14326) - * - */ - - /** - * @ngdoc directive - * @name ngProp - * @restrict A - * @element ANY - * - * @usage - * - * ```html - * - * - * ``` - * - * or with uppercase letters in property (e.g. "propName"): - * - * - * ```html - * - * - * ``` - * - * - * @description - * The `ngProp` directive binds an expression to a DOM element property. - * `ngProp` allows writing to arbitrary properties by including - * the property name in the attribute, e.g. `ng-prop-value="'my value'"` binds 'my value' to - * the `value` property. - * - * Usually, it's not necessary to write to properties in AngularJS, as the built-in directives - * handle the most common use cases (instead of the above example, you would use {@link ngValue}). - * - * However, [custom elements](https://developer.mozilla.org/docs/Web/Web_Components/Using_custom_elements) - * often use custom properties to hold data, and `ngProp` can be used to provide input to these - * custom elements. - * - * ## Binding to camelCase properties - * - * Since HTML attributes are case-insensitive, camelCase properties like `innerHTML` must be escaped. - * AngularJS uses the underscore (_) in front of a character to indicate that it is uppercase, so - * `innerHTML` must be written as `ng-prop-inner_h_t_m_l="expression"` (Note that this is just an - * example, and for binding HTML {@link ngBindHtml} should be used. - * - * ## Security - * - * Binding expressions to arbitrary properties poses a security risk, as properties like `innerHTML` - * can insert potentially dangerous HTML into the application, e.g. script tags that execute - * malicious code. - * For this reason, `ngProp` applies Strict Contextual Escaping with the {@link ng.$sce $sce service}. - * This means vulnerable properties require their content to be "trusted", based on the - * context of the property. For example, the `innerHTML` is in the `HTML` context, and the - * `iframe.src` property is in the `RESOURCE_URL` context, which requires that values written to - * this property are trusted as a `RESOURCE_URL`. - * - * This can be set explicitly by calling $sce.trustAs(type, value) on the value that is - * trusted before passing it to the `ng-prop-*` directive. There are exist shorthand methods for - * each context type in the form of {@link ng.$sce#trustAsResourceUrl $sce.trustAsResourceUrl()} et al. - * - * In some cases you can also rely upon automatic sanitization of untrusted values - see below. - * - * Based on the context, other options may exist to mark a value as trusted / configure the behavior - * of {@link ng.$sce}. For example, to restrict the `RESOURCE_URL` context to specific origins, use - * the {@link $sceDelegateProvider#trustedResourceUrlList trustedResourceUrlList()} - * and {@link $sceDelegateProvider#bannedResourceUrlList bannedResourceUrlList()}. - * - * {@link ng.$sce#what-trusted-context-types-are-supported- Find out more about the different context types}. - * - * ### HTML Sanitization - * - * By default, `$sce` will throw an error if it detects untrusted HTML content, and will not bind the - * content. - * However, if you include the {@link ngSanitize ngSanitize module}, it will try to sanitize the - * potentially dangerous HTML, e.g. strip non-trusted tags and attributes when binding to - * `innerHTML`. - * - * @example - * ### Binding to different contexts - * - * - * - * angular.module('exampleNgProp', []) - * .component('main', { - * templateUrl: 'main.html', - * controller: function($sce) { - * this.safeContent = 'Safe content'; - * this.unsafeContent = ''; - * this.trustedUnsafeContent = $sce.trustAsHtml(this.unsafeContent); - * } - * }); - * - * - *
- *
- * Binding to a property without security context: - *
- * innerText (safeContent) - *
- * - *
- * "Safe" content that requires a security context will throw because the contents could potentially be dangerous ... - *
- * innerHTML (safeContent) - *
- * - *
- * ... so that actually dangerous content cannot be executed: - *
- * innerHTML (unsafeContent) - *
- * - *
- * ... but unsafe Content that has been trusted explicitly works - only do this if you are 100% sure! - *
- * innerHTML (trustedUnsafeContent) - *
- *
- *
- * - *
- *
- * - * .prop-unit { - * margin-bottom: 10px; - * } - * - * .prop-binding { - * min-height: 30px; - * border: 1px solid blue; - * } - * - * .prop-note { - * font-family: Monospace; - * } - * - *
- * - * - * @example - * ### Binding to innerHTML with ngSanitize - * - * - * - * angular.module('exampleNgProp', ['ngSanitize']) - * .component('main', { - * templateUrl: 'main.html', - * controller: function($sce) { - * this.safeContent = 'Safe content'; - * this.unsafeContent = ''; - * this.trustedUnsafeContent = $sce.trustAsHtml(this.unsafeContent); - * } - * }); - * - * - *
- *
- * "Safe" content will be sanitized ... - *
- * innerHTML (safeContent) - *
- * - *
- * ... as will dangerous content: - *
- * innerHTML (unsafeContent) - *
- * - *
- * ... and content that has been trusted explicitly works the same as without ngSanitize: - *
- * innerHTML (trustedUnsafeContent) - *
- *
- *
- * - *
- *
- * - * .prop-unit { - * margin-bottom: 10px; - * } - * - * .prop-binding { - * min-height: 30px; - * border: 1px solid blue; - * } - * - * .prop-note { - * font-family: Monospace; - * } - * - *
- * - */ - - /** @ngdoc directive - * @name ngOn - * @restrict A - * @element ANY - * - * @usage - * - * ```html - * - * - * ``` - * - * or with uppercase letters in property (e.g. "eventName"): - * - * - * ```html - * - * - * ``` - * - * @description - * The `ngOn` directive adds an event listener to a DOM element via - * {@link angular.element angular.element().on()}, and evaluates an expression when the event is - * fired. - * `ngOn` allows adding listeners for arbitrary events by including - * the event name in the attribute, e.g. `ng-on-drop="onDrop()"` executes the 'onDrop()' expression - * when the `drop` event is fired. - * - * AngularJS provides specific directives for many events, such as {@link ngClick}, so in most - * cases it is not necessary to use `ngOn`. However, AngularJS does not support all events - * (e.g. the `drop` event in the example above), and new events might be introduced in later DOM - * standards. - * - * Another use-case for `ngOn` is listening to - * [custom events](https://developer.mozilla.org/docs/Web/Guide/Events/Creating_and_triggering_events) - * fired by - * [custom elements](https://developer.mozilla.org/docs/Web/Web_Components/Using_custom_elements). - * - * ## Binding to camelCase properties - * - * Since HTML attributes are case-insensitive, camelCase properties like `myEvent` must be escaped. - * AngularJS uses the underscore (_) in front of a character to indicate that it is uppercase, so - * `myEvent` must be written as `ng-on-my_event="expression"`. - * - * @example - * ### Bind to built-in DOM events - * - * - * - * angular.module('exampleNgOn', []) - * .component('main', { - * templateUrl: 'main.html', - * controller: function() { - * this.clickCount = 0; - * this.mouseoverCount = 0; - * - * this.loadingState = 0; - * } - * }); - * - * - *
- * This is equivalent to `ngClick` and `ngMouseover`:
- *
- * clickCount: {{$ctrl.clickCount}}
- * mouseover: {{$ctrl.mouseoverCount}} - * - *
- * - * For the `error` and `load` event on images no built-in AngularJS directives exist:
- *
- *
- * Image is loading - * Image load error - * Image loaded successfully - *
- *
- *
- * - *
- *
- *
- * - * - * @example - * ### Bind to custom DOM events - * - * - * - * angular.module('exampleNgOn', []) - * .component('main', { - * templateUrl: 'main.html', - * controller: function() { - * this.eventLog = ''; - * - * this.listener = function($event) { - * this.eventLog = 'Event with type "' + $event.type + '" fired at ' + $event.detail; - * }; - * } - * }) - * .component('childComponent', { - * templateUrl: 'child.html', - * controller: function($element) { - * this.fireEvent = function() { - * var event = new CustomEvent('customtype', { detail: new Date()}); - * - * $element[0].dispatchEvent(event); - * }; - * } - * }); - * - * - *
- * Event log: {{$ctrl.eventLog}} - *
- * - - * - * - *
- *
- *
- */ - - var $compileMinErr = minErr('$compile'); - - function UNINITIALIZED_VALUE() {} - var _UNINITIALIZED_VALUE = new UNINITIALIZED_VALUE(); - - /** - * @ngdoc provider - * @name $compileProvider - * - * @description - */ - $CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider']; - /** @this */ - function $CompileProvider($provide, $$sanitizeUriProvider) { - var hasDirectives = {}, - Suffix = 'Directive', - COMMENT_DIRECTIVE_REGEXP = /^\s*directive:\s*([\w-]+)\s+(.*)$/, - CLASS_DIRECTIVE_REGEXP = /(([\w-]+)(?::([^;]+))?;?)/, - ALL_OR_NOTHING_ATTRS = makeMap('ngSrc,ngSrcset,src,srcset'), - REQUIRE_PREFIX_REGEXP = /^(?:(\^\^?)?(\?)?(\^\^?)?)?/; - - // Ref: http://developers.whatwg.org/webappapis.html#event-handler-idl-attributes - // The assumption is that future DOM event attribute names will begin with - // 'on' and be composed of only English letters. - var EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/; - var bindingCache = createMap(); - - function parseIsolateBindings(scope, directiveName, isController) { - var LOCAL_REGEXP = /^([@&]|[=<](\*?))(\??)\s*([\w$]*)$/; - - var bindings = createMap(); - - forEach(scope, function (definition, scopeName) { - definition = definition.trim(); - - if (definition in bindingCache) { - bindings[scopeName] = bindingCache[definition]; - return; - } - var match = definition.match(LOCAL_REGEXP); - - if (!match) { - throw $compileMinErr('iscp', - 'Invalid {3} for directive \'{0}\'.' + - ' Definition: {... {1}: \'{2}\' ...}', - directiveName, scopeName, definition, - (isController ? 'controller bindings definition' : - 'isolate scope definition')); - } - - bindings[scopeName] = { - mode: match[1][0], - collection: match[2] === '*', - optional: match[3] === '?', - attrName: match[4] || scopeName - }; - if (match[4]) { - bindingCache[definition] = bindings[scopeName]; - } - }); - - return bindings; - } - - function parseDirectiveBindings(directive, directiveName) { - var bindings = { - isolateScope: null, - bindToController: null - }; - if (isObject(directive.scope)) { - if (directive.bindToController === true) { - bindings.bindToController = parseIsolateBindings(directive.scope, - directiveName, true); - bindings.isolateScope = {}; - } else { - bindings.isolateScope = parseIsolateBindings(directive.scope, - directiveName, false); - } - } - if (isObject(directive.bindToController)) { - bindings.bindToController = - parseIsolateBindings(directive.bindToController, directiveName, true); - } - if (bindings.bindToController && !directive.controller) { - // There is no controller - throw $compileMinErr('noctrl', - 'Cannot bind to controller without directive \'{0}\'s controller.', - directiveName); - } - return bindings; - } - - function assertValidDirectiveName(name) { - var letter = name.charAt(0); - if (!letter || letter !== lowercase(letter)) { - throw $compileMinErr('baddir', 'Directive/Component name \'{0}\' is invalid. The first character must be a lowercase letter', name); - } - if (name !== name.trim()) { - throw $compileMinErr('baddir', - 'Directive/Component name \'{0}\' is invalid. The name should not contain leading or trailing whitespaces', - name); - } - } - - function getDirectiveRequire(directive) { - var require = directive.require || (directive.controller && directive.name); - - if (!isArray(require) && isObject(require)) { - forEach(require, function (value, key) { - var match = value.match(REQUIRE_PREFIX_REGEXP); - var name = value.substring(match[0].length); - if (!name) require[key] = match[0] + key; - }); - } - - return require; - } - - function getDirectiveRestrict(restrict, name) { - if (restrict && !(isString(restrict) && /[EACM]/.test(restrict))) { - throw $compileMinErr('badrestrict', - 'Restrict property \'{0}\' of directive \'{1}\' is invalid', - restrict, - name); - } - - return restrict || 'EA'; - } - - /** - * @ngdoc method - * @name $compileProvider#directive - * @kind function - * - * @description - * Register a new directive with the compiler. - * - * @param {string|Object} name Name of the directive in camel-case (i.e. `ngBind` which will match - * as `ng-bind`), or an object map of directives where the keys are the names and the values - * are the factories. - * @param {Function|Array} directiveFactory An injectable directive factory function. See the - * {@link guide/directive directive guide} and the {@link $compile compile API} for more info. - * @returns {ng.$compileProvider} Self for chaining. - */ - this.directive = function registerDirective(name, directiveFactory) { - assertArg(name, 'name'); - assertNotHasOwnProperty(name, 'directive'); - if (isString(name)) { - assertValidDirectiveName(name); - assertArg(directiveFactory, 'directiveFactory'); - if (!hasDirectives.hasOwnProperty(name)) { - hasDirectives[name] = []; - $provide.factory(name + Suffix, ['$injector', '$exceptionHandler', - function ($injector, $exceptionHandler) { - var directives = []; - forEach(hasDirectives[name], function (directiveFactory, index) { - try { - var directive = $injector.invoke(directiveFactory); - if (isFunction(directive)) { - directive = { - compile: valueFn(directive) - }; - } else if (!directive.compile && directive.link) { - directive.compile = valueFn(directive.link); - } - directive.priority = directive.priority || 0; - directive.index = index; - directive.name = directive.name || name; - directive.require = getDirectiveRequire(directive); - directive.restrict = getDirectiveRestrict(directive.restrict, name); - directive.$$moduleName = directiveFactory.$$moduleName; - directives.push(directive); - } catch (e) { - $exceptionHandler(e); - } - }); - return directives; - } - ]); - } - hasDirectives[name].push(directiveFactory); - } else { - forEach(name, reverseParams(registerDirective)); - } - return this; - }; - - /** - * @ngdoc method - * @name $compileProvider#component - * @module ng - * @param {string|Object} name Name of the component in camelCase (i.e. `myComp` which will match ``), - * or an object map of components where the keys are the names and the values are the component definition objects. - * @param {Object} options Component definition object (a simplified - * {@link ng.$compile#directive-definition-object directive definition object}), - * with the following properties (all optional): - * - * - `controller` – `{(string|function()=}` – controller constructor function that should be - * associated with newly created scope or the name of a {@link ng.$compile#-controller- - * registered controller} if passed as a string. An empty `noop` function by default. - * - `controllerAs` – `{string=}` – identifier name for to reference the controller in the component's scope. - * If present, the controller will be published to scope under the `controllerAs` name. - * If not present, this will default to be `$ctrl`. - * - `template` – `{string=|function()=}` – html template as a string or a function that - * returns an html template as a string which should be used as the contents of this component. - * Empty string by default. - * - * If `template` is a function, then it is {@link auto.$injector#invoke injected} with - * the following locals: - * - * - `$element` - Current element - * - `$attrs` - Current attributes object for the element - * - * - `templateUrl` – `{string=|function()=}` – path or function that returns a path to an html - * template that should be used as the contents of this component. - * - * If `templateUrl` is a function, then it is {@link auto.$injector#invoke injected} with - * the following locals: - * - * - `$element` - Current element - * - `$attrs` - Current attributes object for the element - * - * - `bindings` – `{object=}` – defines bindings between DOM attributes and component properties. - * Component properties are always bound to the component controller and not to the scope. - * See {@link ng.$compile#-bindtocontroller- `bindToController`}. - * - `transclude` – `{boolean=}` – whether {@link $compile#transclusion content transclusion} is enabled. - * Disabled by default. - * - `require` - `{Object=}` - requires the controllers of other directives and binds them to - * this component's controller. The object keys specify the property names under which the required - * controllers (object values) will be bound. See {@link ng.$compile#-require- `require`}. - * - `$...` – additional properties to attach to the directive factory function and the controller - * constructor function. (This is used by the component router to annotate) - * - * @returns {ng.$compileProvider} the compile provider itself, for chaining of function calls. - * @description - * Register a **component definition** with the compiler. This is a shorthand for registering a special - * type of directive, which represents a self-contained UI component in your application. Such components - * are always isolated (i.e. `scope: {}`) and are always restricted to elements (i.e. `restrict: 'E'`). - * - * Component definitions are very simple and do not require as much configuration as defining general - * directives. Component definitions usually consist only of a template and a controller backing it. - * - * In order to make the definition easier, components enforce best practices like use of `controllerAs`, - * `bindToController`. They always have **isolate scope** and are restricted to elements. - * - * Here are a few examples of how you would usually define components: - * - * ```js - * var myMod = angular.module(...); - * myMod.component('myComp', { - * template: '
My name is {{$ctrl.name}}
', - * controller: function() { - * this.name = 'shahar'; - * } - * }); - * - * myMod.component('myComp', { - * template: '
My name is {{$ctrl.name}}
', - * bindings: {name: '@'} - * }); - * - * myMod.component('myComp', { - * templateUrl: 'views/my-comp.html', - * controller: 'MyCtrl', - * controllerAs: 'ctrl', - * bindings: {name: '@'} - * }); - * - * ``` - * For more examples, and an in-depth guide, see the {@link guide/component component guide}. - * - *
- * See also {@link ng.$compileProvider#directive $compileProvider.directive()}. - */ - this.component = function registerComponent(name, options) { - if (!isString(name)) { - forEach(name, reverseParams(bind(this, registerComponent))); - return this; - } - - var controller = options.controller || function () {}; - - function factory($injector) { - function makeInjectable(fn) { - if (isFunction(fn) || isArray(fn)) { - return /** @this */ function (tElement, tAttrs) { - return $injector.invoke(fn, this, { - $element: tElement, - $attrs: tAttrs - }); - }; - } else { - return fn; - } - } - - var template = (!options.template && !options.templateUrl ? '' : options.template); - /** - * @description å ä½ï¼Œå¾…处ç†è¯­è¨€htmlæ•°æ®ï¼Œtemplate - * @author Eoapi - */ - var ddo = { - controller: controller, - controllerAs: identifierForController(options.controller) || options.controllerAs || '$ctrl', - template: makeInjectable(template), - templateUrl: makeInjectable(options.templateUrl), - transclude: options.transclude, - scope: {}, - bindToController: options.bindings || {}, - restrict: 'E', - require: options.require - }; - if (window.eoLang) { - ddo.template = eoFunParseLang(ddo.template); - } - /** - * @desc 全局替æ¢å†…容 - */ - ddo.template = eoFnParseConf(ddo.template); - // Copy annotations (starting with $) over to the DDO - forEach(options, function (val, key) { - if (key.charAt(0) === '$') ddo[key] = val; - }); - - return ddo; - } - - // TODO(pete) remove the following `forEach` before we release 1.6.0 - // The component-router@0.2.0 looks for the annotations on the controller constructor - // Nothing in AngularJS looks for annotations on the factory function but we can't remove - // it from 1.5.x yet. - - // Copy any annotation properties (starting with $) over to the factory and controller constructor functions - // These could be used by libraries such as the new component router - forEach(options, function (val, key) { - if (key.charAt(0) === '$') { - factory[key] = val; - // Don't try to copy over annotations to named controller - if (isFunction(controller)) controller[key] = val; - } - }); - - factory.$inject = ['$injector']; - - return this.directive(name, factory); - }; - - - /** - * @ngdoc method - * @name $compileProvider#aHrefSanitizationTrustedUrlList - * @kind function - * - * @description - * Retrieves or overrides the default regular expression that is used for determining trusted safe - * urls during a[href] sanitization. - * - * The sanitization is a security measure aimed at preventing XSS attacks via html links. - * - * Any url about to be assigned to a[href] via data-binding is first normalized and turned into - * an absolute url. Afterwards, the url is matched against the `aHrefSanitizationTrustedUrlList` - * regular expression. If a match is found, the original url is written into the dom. Otherwise, - * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM. - * - * @param {RegExp=} regexp New regexp to trust urls with. - * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for - * chaining otherwise. - */ - this.aHrefSanitizationTrustedUrlList = function (regexp) { - if (isDefined(regexp)) { - $$sanitizeUriProvider.aHrefSanitizationTrustedUrlList(regexp); - return this; - } else { - return $$sanitizeUriProvider.aHrefSanitizationTrustedUrlList(); - } - }; - - - /** - * @ngdoc method - * @name $compileProvider#aHrefSanitizationWhitelist - * @kind function - * - * @deprecated - * sinceVersion="1.8.1" - * - * This method is deprecated. Use {@link $compileProvider#aHrefSanitizationTrustedUrlList - * aHrefSanitizationTrustedUrlList} instead. - */ - Object.defineProperty(this, 'aHrefSanitizationWhitelist', { - get: function () { - return this.aHrefSanitizationTrustedUrlList; - }, - set: function (value) { - this.aHrefSanitizationTrustedUrlList = value; - } - }); - - - /** - * @ngdoc method - * @name $compileProvider#imgSrcSanitizationTrustedUrlList - * @kind function - * - * @description - * Retrieves or overrides the default regular expression that is used for determining trusted safe - * urls during img[src] sanitization. - * - * The sanitization is a security measure aimed at prevent XSS attacks via html links. - * - * Any url about to be assigned to img[src] via data-binding is first normalized and turned into - * an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationTrustedUrlList` - * regular expression. If a match is found, the original url is written into the dom. Otherwise, - * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM. - * - * @param {RegExp=} regexp New regexp to trust urls with. - * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for - * chaining otherwise. - */ - this.imgSrcSanitizationTrustedUrlList = function (regexp) { - if (isDefined(regexp)) { - $$sanitizeUriProvider.imgSrcSanitizationTrustedUrlList(regexp); - return this; - } else { - return $$sanitizeUriProvider.imgSrcSanitizationTrustedUrlList(); - } - }; - - - /** - * @ngdoc method - * @name $compileProvider#imgSrcSanitizationWhitelist - * @kind function - * - * @deprecated - * sinceVersion="1.8.1" - * - * This method is deprecated. Use {@link $compileProvider#imgSrcSanitizationTrustedUrlList - * imgSrcSanitizationTrustedUrlList} instead. - */ - Object.defineProperty(this, 'imgSrcSanitizationWhitelist', { - get: function () { - return this.imgSrcSanitizationTrustedUrlList; - }, - set: function (value) { - this.imgSrcSanitizationTrustedUrlList = value; - } - }); - - /** - * @ngdoc method - * @name $compileProvider#debugInfoEnabled - * - * @param {boolean=} enabled update the debugInfoEnabled state if provided, otherwise just return the - * current debugInfoEnabled state - * @returns {*} current value if used as getter or itself (chaining) if used as setter - * - * @kind function - * - * @description - * Call this method to enable/disable various debug runtime information in the compiler such as adding - * binding information and a reference to the current scope on to DOM elements. - * If enabled, the compiler will add the following to DOM elements that have been bound to the scope - * * `ng-binding` CSS class - * * `ng-scope` and `ng-isolated-scope` CSS classes - * * `$binding` data property containing an array of the binding expressions - * * Data properties used by the {@link angular.element#methods `scope()`/`isolateScope()` methods} to return - * the element's scope. - * * Placeholder comments will contain information about what directive and binding caused the placeholder. - * E.g. ``. - * - * You may want to disable this in production for a significant performance boost. See - * {@link guide/production#disabling-debug-data Disabling Debug Data} for more. - * - * The default value is true. - */ - var debugInfoEnabled = true; - this.debugInfoEnabled = function (enabled) { - if (isDefined(enabled)) { - debugInfoEnabled = enabled; - return this; - } - return debugInfoEnabled; - }; - - /** - * @ngdoc method - * @name $compileProvider#strictComponentBindingsEnabled - * - * @param {boolean=} enabled update the strictComponentBindingsEnabled state if provided, - * otherwise return the current strictComponentBindingsEnabled state. - * @returns {*} current value if used as getter or itself (chaining) if used as setter - * - * @kind function - * - * @description - * Call this method to enable / disable the strict component bindings check. If enabled, the - * compiler will enforce that all scope / controller bindings of a - * {@link $compileProvider#directive directive} / {@link $compileProvider#component component} - * that are not set as optional with `?`, must be provided when the directive is instantiated. - * If not provided, the compiler will throw the - * {@link error/$compile/missingattr $compile:missingattr error}. - * - * The default value is false. - */ - var strictComponentBindingsEnabled = false; - this.strictComponentBindingsEnabled = function (enabled) { - if (isDefined(enabled)) { - strictComponentBindingsEnabled = enabled; - return this; - } - return strictComponentBindingsEnabled; - }; - - var TTL = 10; - /** - * @ngdoc method - * @name $compileProvider#onChangesTtl - * @description - * - * Sets the number of times `$onChanges` hooks can trigger new changes before giving up and - * assuming that the model is unstable. - * - * The current default is 10 iterations. - * - * In complex applications it's possible that dependencies between `$onChanges` hooks and bindings will result - * in several iterations of calls to these hooks. However if an application needs more than the default 10 - * iterations to stabilize then you should investigate what is causing the model to continuously change during - * the `$onChanges` hook execution. - * - * Increasing the TTL could have performance implications, so you should not change it without proper justification. - * - * @param {number} limit The number of `$onChanges` hook iterations. - * @returns {number|object} the current limit (or `this` if called as a setter for chaining) - */ - this.onChangesTtl = function (value) { - if (arguments.length) { - TTL = value; - return this; - } - return TTL; - }; - - var commentDirectivesEnabledConfig = true; - /** - * @ngdoc method - * @name $compileProvider#commentDirectivesEnabled - * @description - * - * It indicates to the compiler - * whether or not directives on comments should be compiled. - * Defaults to `true`. - * - * Calling this function with false disables the compilation of directives - * on comments for the whole application. - * This results in a compilation performance gain, - * as the compiler doesn't have to check comments when looking for directives. - * This should however only be used if you are sure that no comment directives are used in - * the application (including any 3rd party directives). - * - * @param {boolean} enabled `false` if the compiler may ignore directives on comments - * @returns {boolean|object} the current value (or `this` if called as a setter for chaining) - */ - this.commentDirectivesEnabled = function (value) { - if (arguments.length) { - commentDirectivesEnabledConfig = value; - return this; - } - return commentDirectivesEnabledConfig; - }; - - - var cssClassDirectivesEnabledConfig = true; - /** - * @ngdoc method - * @name $compileProvider#cssClassDirectivesEnabled - * @description - * - * It indicates to the compiler - * whether or not directives on element classes should be compiled. - * Defaults to `true`. - * - * Calling this function with false disables the compilation of directives - * on element classes for the whole application. - * This results in a compilation performance gain, - * as the compiler doesn't have to check element classes when looking for directives. - * This should however only be used if you are sure that no class directives are used in - * the application (including any 3rd party directives). - * - * @param {boolean} enabled `false` if the compiler may ignore directives on element classes - * @returns {boolean|object} the current value (or `this` if called as a setter for chaining) - */ - this.cssClassDirectivesEnabled = function (value) { - if (arguments.length) { - cssClassDirectivesEnabledConfig = value; - return this; - } - return cssClassDirectivesEnabledConfig; - }; - - - /** - * The security context of DOM Properties. - * @private - */ - var PROP_CONTEXTS = createMap(); - - /** - * @ngdoc method - * @name $compileProvider#addPropertySecurityContext - * @description - * - * Defines the security context for DOM properties bound by ng-prop-*. - * - * @param {string} elementName The element name or '*' to match any element. - * @param {string} propertyName The DOM property name. - * @param {string} ctx The {@link $sce} security context in which this value is safe for use, e.g. `$sce.URL` - * @returns {object} `this` for chaining - */ - this.addPropertySecurityContext = function (elementName, propertyName, ctx) { - var key = (elementName.toLowerCase() + '|' + propertyName.toLowerCase()); - - if (key in PROP_CONTEXTS && PROP_CONTEXTS[key] !== ctx) { - throw $compileMinErr('ctxoverride', 'Property context \'{0}.{1}\' already set to \'{2}\', cannot override to \'{3}\'.', elementName, propertyName, PROP_CONTEXTS[key], ctx); - } - - PROP_CONTEXTS[key] = ctx; - return this; - }; - - /* Default property contexts. - * - * Copy of https://github.com/angular/angular/blob/6.0.6/packages/compiler/src/schema/dom_security_schema.ts#L31-L58 - * Changing: - * - SecurityContext.* => SCE_CONTEXTS/$sce.* - * - STYLE => CSS - * - various URL => MEDIA_URL - * - *|formAction, form|action URL => RESOURCE_URL (like the attribute) - */ - (function registerNativePropertyContexts() { - function registerContext(ctx, values) { - forEach(values, function (v) { - PROP_CONTEXTS[v.toLowerCase()] = ctx; - }); - } - - registerContext(SCE_CONTEXTS.HTML, [ - 'iframe|srcdoc', - '*|innerHTML', - '*|outerHTML' - ]); - registerContext(SCE_CONTEXTS.CSS, ['*|style']); - registerContext(SCE_CONTEXTS.URL, [ - 'area|href', 'area|ping', - 'a|href', 'a|ping', - 'blockquote|cite', - 'body|background', - 'del|cite', - 'input|src', - 'ins|cite', - 'q|cite' - ]); - registerContext(SCE_CONTEXTS.MEDIA_URL, [ - 'audio|src', - 'img|src', 'img|srcset', - 'source|src', 'source|srcset', - 'track|src', - 'video|src', 'video|poster' - ]); - registerContext(SCE_CONTEXTS.RESOURCE_URL, [ - '*|formAction', - 'applet|code', 'applet|codebase', - 'base|href', - 'embed|src', - 'frame|src', - 'form|action', - 'head|profile', - 'html|manifest', - 'iframe|src', - 'link|href', - 'media|src', - 'object|codebase', 'object|data', - 'script|src' - ]); - })(); - - - this.$get = [ - '$injector', '$interpolate', '$exceptionHandler', '$templateRequest', '$parse', - '$controller', '$rootScope', '$sce', '$animate', - function ($injector, $interpolate, $exceptionHandler, $templateRequest, $parse, - $controller, $rootScope, $sce, $animate) { - - var SIMPLE_ATTR_NAME = /^\w/; - var specialAttrHolder = window.document.createElement('div'); - - - var commentDirectivesEnabled = commentDirectivesEnabledConfig; - var cssClassDirectivesEnabled = cssClassDirectivesEnabledConfig; - - - var onChangesTtl = TTL; - // The onChanges hooks should all be run together in a single digest - // When changes occur, the call to trigger their hooks will be added to this queue - var onChangesQueue; - - // This function is called in a $$postDigest to trigger all the onChanges hooks in a single digest - function flushOnChangesQueue() { - try { - if (!(--onChangesTtl)) { - // We have hit the TTL limit so reset everything - onChangesQueue = undefined; - throw $compileMinErr('infchng', '{0} $onChanges() iterations reached. Aborting!\n', TTL); - } - // We must run this hook in an apply since the $$postDigest runs outside apply - $rootScope.$apply(function () { - for (var i = 0, ii = onChangesQueue.length; i < ii; ++i) { - try { - onChangesQueue[i](); - } catch (e) { - $exceptionHandler(e); - } - } - // Reset the queue to trigger a new schedule next time there is a change - onChangesQueue = undefined; - }); - } finally { - onChangesTtl++; - } - } - - - function sanitizeSrcset(value, invokeType) { - if (!value) { - return value; - } - if (!isString(value)) { - throw $compileMinErr('srcset', 'Can\'t pass trusted values to `{0}`: "{1}"', invokeType, value.toString()); - } - - // Such values are a bit too complex to handle automatically inside $sce. - // Instead, we sanitize each of the URIs individually, which works, even dynamically. - - // It's not possible to work around this using `$sce.trustAsMediaUrl`. - // If you want to programmatically set explicitly trusted unsafe URLs, you should use - // `$sce.trustAsHtml` on the whole `img` tag and inject it into the DOM using the - // `ng-bind-html` directive. - - var result = ''; - - // first check if there are spaces because it's not the same pattern - var trimmedSrcset = trim(value); - // ( 999x ,| 999w ,| ,|, ) - var srcPattern = /(\s+\d+x\s*,|\s+\d+w\s*,|\s+,|,\s+)/; - var pattern = /\s/.test(trimmedSrcset) ? srcPattern : /(,)/; - - // split srcset into tuple of uri and descriptor except for the last item - var rawUris = trimmedSrcset.split(pattern); - - // for each tuples - var nbrUrisWith2parts = Math.floor(rawUris.length / 2); - for (var i = 0; i < nbrUrisWith2parts; i++) { - var innerIdx = i * 2; - // sanitize the uri - result += $sce.getTrustedMediaUrl(trim(rawUris[innerIdx])); - // add the descriptor - result += ' ' + trim(rawUris[innerIdx + 1]); - } - - // split the last item into uri and descriptor - var lastTuple = trim(rawUris[i * 2]).split(/\s/); - - // sanitize the last uri - result += $sce.getTrustedMediaUrl(trim(lastTuple[0])); - - // and add the last descriptor if any - if (lastTuple.length === 2) { - result += (' ' + trim(lastTuple[1])); - } - return result; - } - - - function Attributes(element, attributesToCopy) { - if (attributesToCopy) { - var keys = Object.keys(attributesToCopy); - var i, l, key; - - for (i = 0, l = keys.length; i < l; i++) { - key = keys[i]; - this[key] = attributesToCopy[key]; - } - } else { - this.$attr = {}; - } - - this.$$element = element; - } - - Attributes.prototype = { - /** - * @ngdoc method - * @name $compile.directive.Attributes#$normalize - * @kind function - * - * @description - * Converts an attribute name (e.g. dash/colon/underscore-delimited string, optionally prefixed with `x-` or - * `data-`) to its normalized, camelCase form. - * - * Also there is special case for Moz prefix starting with upper case letter. - * - * For further information check out the guide on {@link guide/directive#matching-directives Matching Directives} - * - * @param {string} name Name to normalize - */ - $normalize: directiveNormalize, - - - /** - * @ngdoc method - * @name $compile.directive.Attributes#$addClass - * @kind function - * - * @description - * Adds the CSS class value specified by the classVal parameter to the element. If animations - * are enabled then an animation will be triggered for the class addition. - * - * @param {string} classVal The className value that will be added to the element - */ - $addClass: function (classVal) { - if (classVal && classVal.length > 0) { - $animate.addClass(this.$$element, classVal); - } - }, - - /** - * @ngdoc method - * @name $compile.directive.Attributes#$removeClass - * @kind function - * - * @description - * Removes the CSS class value specified by the classVal parameter from the element. If - * animations are enabled then an animation will be triggered for the class removal. - * - * @param {string} classVal The className value that will be removed from the element - */ - $removeClass: function (classVal) { - if (classVal && classVal.length > 0) { - $animate.removeClass(this.$$element, classVal); - } - }, - - /** - * @ngdoc method - * @name $compile.directive.Attributes#$updateClass - * @kind function - * - * @description - * Adds and removes the appropriate CSS class values to the element based on the difference - * between the new and old CSS class values (specified as newClasses and oldClasses). - * - * @param {string} newClasses The current CSS className value - * @param {string} oldClasses The former CSS className value - */ - $updateClass: function (newClasses, oldClasses) { - var toAdd = tokenDifference(newClasses, oldClasses); - if (toAdd && toAdd.length) { - $animate.addClass(this.$$element, toAdd); - } - - var toRemove = tokenDifference(oldClasses, newClasses); - if (toRemove && toRemove.length) { - $animate.removeClass(this.$$element, toRemove); - } - }, - - /** - * Set a normalized attribute on the element in a way such that all directives - * can share the attribute. This function properly handles boolean attributes. - * @param {string} key Normalized key. (ie ngAttribute) - * @param {string|boolean} value The value to set. If `null` attribute will be deleted. - * @param {boolean=} writeAttr If false, does not write the value to DOM element attribute. - * Defaults to true. - * @param {string=} attrName Optional none normalized name. Defaults to key. - */ - $set: function (key, value, writeAttr, attrName) { - // TODO: decide whether or not to throw an error if "class" - // is set through this function since it may cause $updateClass to - // become unstable. - - var node = this.$$element[0], - booleanKey = getBooleanAttrName(node, key), - aliasedKey = getAliasedAttrName(key), - observer = key, - nodeName; - - if (booleanKey) { - this.$$element.prop(key, value); - attrName = booleanKey; - } else if (aliasedKey) { - this[aliasedKey] = value; - observer = aliasedKey; - } - - this[key] = value; - - // translate normalized key to actual key - if (attrName) { - this.$attr[key] = attrName; - } else { - attrName = this.$attr[key]; - if (!attrName) { - this.$attr[key] = attrName = snake_case(key, '-'); - } - } - - nodeName = nodeName_(this.$$element); - - // Sanitize img[srcset] values. - if (nodeName === 'img' && key === 'srcset') { - this[key] = value = sanitizeSrcset(value, '$set(\'srcset\', value)'); - } - - if (writeAttr !== false) { - if (value === null || isUndefined(value)) { - this.$$element.removeAttr(attrName); - } else { - if (SIMPLE_ATTR_NAME.test(attrName)) { - // jQuery skips special boolean attrs treatment in XML nodes for - // historical reasons and hence AngularJS cannot freely call - // `.attr(attrName, false) with such attributes. To avoid issues - // in XHTML, call `removeAttr` in such cases instead. - // See https://github.com/jquery/jquery/issues/4249 - if (booleanKey && value === false) { - this.$$element.removeAttr(attrName); - } else { - this.$$element.attr(attrName, value); - } - } else { - setSpecialAttr(this.$$element[0], attrName, value); - } - } - } - - // fire observers - var $$observers = this.$$observers; - if ($$observers) { - forEach($$observers[observer], function (fn) { - try { - fn(value); - } catch (e) { - $exceptionHandler(e); - } - }); - } - }, - - - /** - * @ngdoc method - * @name $compile.directive.Attributes#$observe - * @kind function - * - * @description - * Observes an interpolated attribute. - * - * The observer function will be invoked once during the next `$digest` following - * compilation. The observer is then invoked whenever the interpolated value - * changes. - * - * @param {string} key Normalized key. (ie ngAttribute) . - * @param {function(interpolatedValue)} fn Function that will be called whenever - the interpolated value of the attribute changes. - * See the {@link guide/interpolation#how-text-and-attribute-bindings-work Interpolation - * guide} for more info. - * @returns {function()} Returns a deregistration function for this observer. - */ - $observe: function (key, fn) { - var attrs = this, - $$observers = (attrs.$$observers || (attrs.$$observers = createMap())), - listeners = ($$observers[key] || ($$observers[key] = [])); - - listeners.push(fn); - $rootScope.$evalAsync(function () { - if (!listeners.$$inter && attrs.hasOwnProperty(key) && !isUndefined(attrs[key])) { - // no one registered attribute interpolation function, so lets call it manually - fn(attrs[key]); - } - }); - - return function () { - arrayRemove(listeners, fn); - }; - } - }; - - function setSpecialAttr(element, attrName, value) { - // Attributes names that do not start with letters (such as `(click)`) cannot be set using `setAttribute` - // so we have to jump through some hoops to get such an attribute - // https://github.com/angular/angular.js/pull/13318 - specialAttrHolder.innerHTML = ''; - var attributes = specialAttrHolder.firstChild.attributes; - var attribute = attributes[0]; - // We have to remove the attribute from its container element before we can add it to the destination element - attributes.removeNamedItem(attribute.name); - attribute.value = value; - element.attributes.setNamedItem(attribute); - } - - function safeAddClass($element, className) { - try { - $element.addClass(className); - } catch (e) { - // ignore, since it means that we are trying to set class on - // SVG element, where class name is read-only. - } - } - - - var startSymbol = $interpolate.startSymbol(), - endSymbol = $interpolate.endSymbol(), - denormalizeTemplate = (startSymbol === '{{' && endSymbol === '}}') ? - identity : - function denormalizeTemplate(template) { - return template.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol); - }, - NG_PREFIX_BINDING = /^ng(Attr|Prop|On)([A-Z].*)$/; - var MULTI_ELEMENT_DIR_RE = /^(.+)Start$/; - - compile.$$addBindingInfo = debugInfoEnabled ? function $$addBindingInfo($element, binding) { - var bindings = $element.data('$binding') || []; - - if (isArray(binding)) { - bindings = bindings.concat(binding); - } else { - bindings.push(binding); - } - - $element.data('$binding', bindings); - } : noop; - - compile.$$addBindingClass = debugInfoEnabled ? function $$addBindingClass($element) { - safeAddClass($element, 'ng-binding'); - } : noop; - - compile.$$addScopeInfo = debugInfoEnabled ? function $$addScopeInfo($element, scope, isolated, noTemplate) { - var dataName = isolated ? (noTemplate ? '$isolateScopeNoTemplate' : '$isolateScope') : '$scope'; - $element.data(dataName, scope); - } : noop; - - compile.$$addScopeClass = debugInfoEnabled ? function $$addScopeClass($element, isolated) { - safeAddClass($element, isolated ? 'ng-isolate-scope' : 'ng-scope'); - } : noop; - - compile.$$createComment = function (directiveName, comment) { - var content = ''; - if (debugInfoEnabled) { - content = ' ' + (directiveName || '') + ': '; - if (comment) content += comment + ' '; - } - return window.document.createComment(content); - }; - - return compile; - - //================================ - - function compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, - previousCompileContext) { - if (!($compileNodes instanceof jqLite)) { - // jquery always rewraps, whereas we need to preserve the original selector so that we can - // modify it. - $compileNodes = jqLite($compileNodes); - } - var compositeLinkFn = - compileNodes($compileNodes, transcludeFn, $compileNodes, - maxPriority, ignoreDirective, previousCompileContext); - compile.$$addScopeClass($compileNodes); - var namespace = null; - return function publicLinkFn(scope, cloneConnectFn, options) { - if (!$compileNodes) { - throw $compileMinErr('multilink', 'This element has already been linked.'); - } - assertArg(scope, 'scope'); - - if (previousCompileContext && previousCompileContext.needsNewScope) { - // A parent directive did a replace and a directive on this element asked - // for transclusion, which caused us to lose a layer of element on which - // we could hold the new transclusion scope, so we will create it manually - // here. - scope = scope.$parent.$new(); - } - - options = options || {}; - var parentBoundTranscludeFn = options.parentBoundTranscludeFn, - transcludeControllers = options.transcludeControllers, - futureParentElement = options.futureParentElement; - - // When `parentBoundTranscludeFn` is passed, it is a - // `controllersBoundTransclude` function (it was previously passed - // as `transclude` to directive.link) so we must unwrap it to get - // its `boundTranscludeFn` - if (parentBoundTranscludeFn && parentBoundTranscludeFn.$$boundTransclude) { - parentBoundTranscludeFn = parentBoundTranscludeFn.$$boundTransclude; - } - - if (!namespace) { - namespace = detectNamespaceForChildElements(futureParentElement); - } - var $linkNode; - if (namespace !== 'html') { - // When using a directive with replace:true and templateUrl the $compileNodes - // (or a child element inside of them) - // might change, so we need to recreate the namespace adapted compileNodes - // for call to the link function. - // Note: This will already clone the nodes... - $linkNode = jqLite( - wrapTemplate(namespace, jqLite('
').append($compileNodes).html()) - ); - } else if (cloneConnectFn) { - // important!!: we must call our jqLite.clone() since the jQuery one is trying to be smart - // and sometimes changes the structure of the DOM. - $linkNode = JQLitePrototype.clone.call($compileNodes); - } else { - $linkNode = $compileNodes; - } - - if (transcludeControllers) { - for (var controllerName in transcludeControllers) { - $linkNode.data('$' + controllerName + 'Controller', transcludeControllers[controllerName].instance); - } - } - - compile.$$addScopeInfo($linkNode, scope); - - if (cloneConnectFn) cloneConnectFn($linkNode, scope); - if (compositeLinkFn) compositeLinkFn(scope, $linkNode, $linkNode, parentBoundTranscludeFn); - - if (!cloneConnectFn) { - $compileNodes = compositeLinkFn = null; - } - /** - * @desc 加入默认class,便于åŽç»­åˆ é™¤ - * @author Eoapi - */ - // if(!$linkNode.hasClass("eoui_view"))$linkNode.addClass("eoscope_"+scope.$id) - /**--end-- */ - return $linkNode; - }; - } - - function detectNamespaceForChildElements(parentElement) { - // TODO: Make this detect MathML as well... - var node = parentElement && parentElement[0]; - if (!node) { - return 'html'; - } else { - return nodeName_(node) !== 'foreignobject' && toString.call(node).match(/SVG/) ? 'svg' : 'html'; - } - } - - /** - * Compile function matches each node in nodeList against the directives. Once all directives - * for a particular node are collected their compile functions are executed. The compile - * functions return values - the linking functions - are combined into a composite linking - * function, which is the a linking function for the node. - * - * @param {NodeList} nodeList an array of nodes or NodeList to compile - * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the - * scope argument is auto-generated to the new child of the transcluded parent scope. - * @param {DOMElement=} $rootElement If the nodeList is the root of the compilation tree then - * the rootElement must be set the jqLite collection of the compile root. This is - * needed so that the jqLite collection items can be replaced with widgets. - * @param {number=} maxPriority Max directive priority. - * @returns {Function} A composite linking function of all of the matched directives or null. - */ - function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority, ignoreDirective, - previousCompileContext) { - var linkFns = [], - // `nodeList` can be either an element's `.childNodes` (live NodeList) - // or a jqLite/jQuery collection or an array - notLiveList = isArray(nodeList) || (nodeList instanceof jqLite), - attrs, directives, nodeLinkFn, childNodes, childLinkFn, linkFnFound, nodeLinkFnFound; - - - for (var i = 0; i < nodeList.length; i++) { - attrs = new Attributes(); - - // Support: IE 11 only - // Workaround for #11781 and #14924 - if (msie === 11) { - mergeConsecutiveTextNodes(nodeList, i, notLiveList); - } - - // We must always refer to `nodeList[i]` hereafter, - // since the nodes can be replaced underneath us. - directives = collectDirectives(nodeList[i], [], attrs, i === 0 ? maxPriority : undefined, - ignoreDirective); - - nodeLinkFn = (directives.length) ? - applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement, - null, [], [], previousCompileContext) : - null; - - if (nodeLinkFn && nodeLinkFn.scope) { - compile.$$addScopeClass(attrs.$$element); - } - - childLinkFn = (nodeLinkFn && nodeLinkFn.terminal || - !(childNodes = nodeList[i].childNodes) || - !childNodes.length) ? - null : - compileNodes(childNodes, - nodeLinkFn ? ( - (nodeLinkFn.transcludeOnThisElement || !nodeLinkFn.templateOnThisElement) && - nodeLinkFn.transclude) : transcludeFn); - - if (nodeLinkFn || childLinkFn) { - linkFns.push(i, nodeLinkFn, childLinkFn); - linkFnFound = true; - nodeLinkFnFound = nodeLinkFnFound || nodeLinkFn; - } - - //use the previous context only for the first element in the virtual group - previousCompileContext = null; - } - - // return a linking function if we have found anything, null otherwise - return linkFnFound ? compositeLinkFn : null; - - function compositeLinkFn(scope, nodeList, $rootElement, parentBoundTranscludeFn) { - var nodeLinkFn, childLinkFn, node, childScope, i, ii, idx, childBoundTranscludeFn; - var stableNodeList; - - - if (nodeLinkFnFound) { - // copy nodeList so that if a nodeLinkFn removes or adds an element at this DOM level our - // offsets don't get screwed up - var nodeListLength = nodeList.length; - stableNodeList = new Array(nodeListLength); - - // create a sparse array by only copying the elements which have a linkFn - for (i = 0; i < linkFns.length; i += 3) { - idx = linkFns[i]; - stableNodeList[idx] = nodeList[idx]; - } - } else { - stableNodeList = nodeList; - } - - for (i = 0, ii = linkFns.length; i < ii;) { - node = stableNodeList[linkFns[i++]]; - nodeLinkFn = linkFns[i++]; - childLinkFn = linkFns[i++]; - - if (nodeLinkFn) { - if (nodeLinkFn.scope) { - childScope = scope.$new(); - compile.$$addScopeInfo(jqLite(node), childScope); - } else { - childScope = scope; - } - - if (nodeLinkFn.transcludeOnThisElement) { - childBoundTranscludeFn = createBoundTranscludeFn( - scope, nodeLinkFn.transclude, parentBoundTranscludeFn); - - } else if (!nodeLinkFn.templateOnThisElement && parentBoundTranscludeFn) { - childBoundTranscludeFn = parentBoundTranscludeFn; - - } else if (!parentBoundTranscludeFn && transcludeFn) { - childBoundTranscludeFn = createBoundTranscludeFn(scope, transcludeFn); - - } else { - childBoundTranscludeFn = null; - } - - nodeLinkFn(childLinkFn, childScope, node, $rootElement, childBoundTranscludeFn); - - } else if (childLinkFn) { - childLinkFn(scope, node.childNodes, undefined, parentBoundTranscludeFn); - } - } - } - } - - function mergeConsecutiveTextNodes(nodeList, idx, notLiveList) { - var node = nodeList[idx]; - var parent = node.parentNode; - var sibling; - - if (node.nodeType !== NODE_TYPE_TEXT) { - return; - } - - while (true) { - sibling = parent ? node.nextSibling : nodeList[idx + 1]; - if (!sibling || sibling.nodeType !== NODE_TYPE_TEXT) { - break; - } - - node.nodeValue = node.nodeValue + sibling.nodeValue; - - if (sibling.parentNode) { - sibling.parentNode.removeChild(sibling); - } - if (notLiveList && sibling === nodeList[idx + 1]) { - nodeList.splice(idx + 1, 1); - } - } - } - - function createBoundTranscludeFn(scope, transcludeFn, previousBoundTranscludeFn) { - function boundTranscludeFn(transcludedScope, cloneFn, controllers, futureParentElement, containingScope) { - - if (!transcludedScope) { - transcludedScope = scope.$new(false, containingScope); - transcludedScope.$$transcluded = true; - } - - return transcludeFn(transcludedScope, cloneFn, { - parentBoundTranscludeFn: previousBoundTranscludeFn, - transcludeControllers: controllers, - futureParentElement: futureParentElement - }); - } - - // We need to attach the transclusion slots onto the `boundTranscludeFn` - // so that they are available inside the `controllersBoundTransclude` function - var boundSlots = boundTranscludeFn.$$slots = createMap(); - for (var slotName in transcludeFn.$$slots) { - if (transcludeFn.$$slots[slotName]) { - boundSlots[slotName] = createBoundTranscludeFn(scope, transcludeFn.$$slots[slotName], previousBoundTranscludeFn); - } else { - boundSlots[slotName] = null; - } - } - - return boundTranscludeFn; - } - - /** - * Looks for directives on the given node and adds them to the directive collection which is - * sorted. - * - * @param node Node to search. - * @param directives An array to which the directives are added to. This array is sorted before - * the function returns. - * @param attrs The shared attrs object which is used to populate the normalized attributes. - * @param {number=} maxPriority Max directive priority. - */ - function collectDirectives(node, directives, attrs, maxPriority, ignoreDirective) { - var nodeType = node.nodeType, - attrsMap = attrs.$attr, - match, - nodeName, - className; - - switch (nodeType) { - case NODE_TYPE_ELEMENT: - /* Element */ - - nodeName = nodeName_(node); - - // use the node name: - addDirective(directives, - directiveNormalize(nodeName), 'E', maxPriority, ignoreDirective); - - // iterate over the attributes - for (var attr, name, nName, value, ngPrefixMatch, nAttrs = node.attributes, - j = 0, jj = nAttrs && nAttrs.length; j < jj; j++) { - var attrStartName = false; - var attrEndName = false; - - var isNgAttr = false, - isNgProp = false, - isNgEvent = false; - var multiElementMatch; - - attr = nAttrs[j]; - name = attr.name; - value = attr.value; - - nName = directiveNormalize(name.toLowerCase()); - - // Support ng-attr-*, ng-prop-* and ng-on-* - if ((ngPrefixMatch = nName.match(NG_PREFIX_BINDING))) { - isNgAttr = ngPrefixMatch[1] === 'Attr'; - isNgProp = ngPrefixMatch[1] === 'Prop'; - isNgEvent = ngPrefixMatch[1] === 'On'; - - // Normalize the non-prefixed name - name = name.replace(PREFIX_REGEXP, '') - .toLowerCase() - .substr(4 + ngPrefixMatch[1].length).replace(/_(.)/g, function (match, letter) { - return letter.toUpperCase(); - }); - - // Support *-start / *-end multi element directives - } else if ((multiElementMatch = nName.match(MULTI_ELEMENT_DIR_RE)) && directiveIsMultiElement(multiElementMatch[1])) { - attrStartName = name; - attrEndName = name.substr(0, name.length - 5) + 'end'; - name = name.substr(0, name.length - 6); - } - - if (isNgProp || isNgEvent) { - attrs[nName] = value; - attrsMap[nName] = attr.name; - - if (isNgProp) { - addPropertyDirective(node, directives, nName, name); - } else { - addEventDirective(directives, nName, name); - } - } else { - // Update nName for cases where a prefix was removed - // NOTE: the .toLowerCase() is unnecessary and causes https://github.com/angular/angular.js/issues/16624 for ng-attr-* - nName = directiveNormalize(name.toLowerCase()); - attrsMap[nName] = name; - - if (isNgAttr || !attrs.hasOwnProperty(nName)) { - attrs[nName] = value; - if (getBooleanAttrName(node, nName)) { - attrs[nName] = true; // presence means true - } - } - - addAttrInterpolateDirective(node, directives, value, nName, isNgAttr); - addDirective(directives, nName, 'A', maxPriority, ignoreDirective, attrStartName, - attrEndName); - } - } - - if (nodeName === 'input' && node.getAttribute('type') === 'hidden') { - // Hidden input elements can have strange behaviour when navigating back to the page - // This tells the browser not to try to cache and reinstate previous values - node.setAttribute('autocomplete', 'off'); - } - - // use class as directive - if (!cssClassDirectivesEnabled) break; - className = node.className; - if (isObject(className)) { - // Maybe SVGAnimatedString - className = className.animVal; - } - if (isString(className) && className !== '') { - while ((match = CLASS_DIRECTIVE_REGEXP.exec(className))) { - nName = directiveNormalize(match[2]); - if (addDirective(directives, nName, 'C', maxPriority, ignoreDirective)) { - attrs[nName] = trim(match[3]); - } - className = className.substr(match.index + match[0].length); - } - } - break; - case NODE_TYPE_TEXT: - /* Text Node */ - addTextInterpolateDirective(directives, node.nodeValue); - break; - case NODE_TYPE_COMMENT: - /* Comment */ - if (!commentDirectivesEnabled) break; - collectCommentDirectives(node, directives, attrs, maxPriority, ignoreDirective); - break; - } - - directives.sort(byPriority); - return directives; - } - - function collectCommentDirectives(node, directives, attrs, maxPriority, ignoreDirective) { - // function created because of performance, try/catch disables - // the optimization of the whole function #14848 - try { - var match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue); - if (match) { - var nName = directiveNormalize(match[1]); - if (addDirective(directives, nName, 'M', maxPriority, ignoreDirective)) { - attrs[nName] = trim(match[2]); - } - } - } catch (e) { - // turns out that under some circumstances IE9 throws errors when one attempts to read - // comment's node value. - // Just ignore it and continue. (Can't seem to reproduce in test case.) - } - } - - /** - * Given a node with a directive-start it collects all of the siblings until it finds - * directive-end. - * @param node - * @param attrStart - * @param attrEnd - * @returns {*} - */ - function groupScan(node, attrStart, attrEnd) { - var nodes = []; - var depth = 0; - if (attrStart && node.hasAttribute && node.hasAttribute(attrStart)) { - do { - if (!node) { - throw $compileMinErr('uterdir', - 'Unterminated attribute, found \'{0}\' but no matching \'{1}\' found.', - attrStart, attrEnd); - } - if (node.nodeType === NODE_TYPE_ELEMENT) { - if (node.hasAttribute(attrStart)) depth++; - if (node.hasAttribute(attrEnd)) depth--; - } - nodes.push(node); - node = node.nextSibling; - } while (depth > 0); - } else { - nodes.push(node); - } - - return jqLite(nodes); - } - - /** - * Wrapper for linking function which converts normal linking function into a grouped - * linking function. - * @param linkFn - * @param attrStart - * @param attrEnd - * @returns {Function} - */ - function groupElementsLinkFnWrapper(linkFn, attrStart, attrEnd) { - return function groupedElementsLink(scope, element, attrs, controllers, transcludeFn) { - element = groupScan(element[0], attrStart, attrEnd); - return linkFn(scope, element, attrs, controllers, transcludeFn); - }; - } - - /** - * A function generator that is used to support both eager and lazy compilation - * linking function. - * @param eager - * @param $compileNodes - * @param transcludeFn - * @param maxPriority - * @param ignoreDirective - * @param previousCompileContext - * @returns {Function} - */ - function compilationGenerator(eager, $compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext) { - var compiled; - - if (eager) { - return compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext); - } - return /** @this */ function lazyCompilation() { - if (!compiled) { - compiled = compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext); - - // Null out all of these references in order to make them eligible for garbage collection - // since this is a potentially long lived closure - $compileNodes = transcludeFn = previousCompileContext = null; - } - return compiled.apply(this, arguments); - }; - } - - /** - * Once the directives have been collected, their compile functions are executed. This method - * is responsible for inlining directive templates as well as terminating the application - * of the directives if the terminal directive has been reached. - * - * @param {Array} directives Array of collected directives to execute their compile function. - * this needs to be pre-sorted by priority order. - * @param {Node} compileNode The raw DOM node to apply the compile functions to - * @param {Object} templateAttrs The shared attribute function - * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the - * scope argument is auto-generated to the new - * child of the transcluded parent scope. - * @param {JQLite} jqCollection If we are working on the root of the compile tree then this - * argument has the root jqLite array so that we can replace nodes - * on it. - * @param {Object=} originalReplaceDirective An optional directive that will be ignored when - * compiling the transclusion. - * @param {Array.} preLinkFns - * @param {Array.} postLinkFns - * @param {Object} previousCompileContext Context used for previous compilation of the current - * node - * @returns {Function} linkFn - */ - function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn, - jqCollection, originalReplaceDirective, preLinkFns, postLinkFns, - previousCompileContext) { - previousCompileContext = previousCompileContext || {}; - - var terminalPriority = -Number.MAX_VALUE, - newScopeDirective = previousCompileContext.newScopeDirective, - controllerDirectives = previousCompileContext.controllerDirectives, - newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective, - templateDirective = previousCompileContext.templateDirective, - nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective, - hasTranscludeDirective = false, - hasTemplate = false, - hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective, - $compileNode = templateAttrs.$$element = jqLite(compileNode), - directive, - directiveName, - $template, - replaceDirective = originalReplaceDirective, - childTranscludeFn = transcludeFn, - linkFn, - didScanForMultipleTransclusion = false, - mightHaveMultipleTransclusionError = false, - directiveValue; - - // executes all directives on the current element - for (var i = 0, ii = directives.length; i < ii; i++) { - directive = directives[i]; - var attrStart = directive.$$start; - var attrEnd = directive.$$end; - - // collect multiblock sections - if (attrStart) { - $compileNode = groupScan(compileNode, attrStart, attrEnd); - } - $template = undefined; - - if (terminalPriority > directive.priority) { - break; // prevent further processing of directives - } - - directiveValue = directive.scope; - - if (directiveValue) { - - // skip the check for directives with async templates, we'll check the derived sync - // directive when the template arrives - if (!directive.templateUrl) { - if (isObject(directiveValue)) { - // This directive is trying to add an isolated scope. - // Check that there is no scope of any kind already - assertNoDuplicate('new/isolated scope', newIsolateScopeDirective || newScopeDirective, - directive, $compileNode); - newIsolateScopeDirective = directive; - } else { - // This directive is trying to add a child scope. - // Check that there is no isolated scope already - assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive, - $compileNode); - } - } - - newScopeDirective = newScopeDirective || directive; - } - - directiveName = directive.name; - - // If we encounter a condition that can result in transclusion on the directive, - // then scan ahead in the remaining directives for others that may cause a multiple - // transclusion error to be thrown during the compilation process. If a matching directive - // is found, then we know that when we encounter a transcluded directive, we need to eagerly - // compile the `transclude` function rather than doing it lazily in order to throw - // exceptions at the correct time - if (!didScanForMultipleTransclusion && ((directive.replace && (directive.templateUrl || directive.template)) || - (directive.transclude && !directive.$$tlb))) { - var candidateDirective; - - for (var scanningIndex = i + 1; - (candidateDirective = directives[scanningIndex++]);) { - if ((candidateDirective.transclude && !candidateDirective.$$tlb) || - (candidateDirective.replace && (candidateDirective.templateUrl || candidateDirective.template))) { - mightHaveMultipleTransclusionError = true; - break; - } - } - - didScanForMultipleTransclusion = true; - } - - if (!directive.templateUrl && directive.controller) { - controllerDirectives = controllerDirectives || createMap(); - assertNoDuplicate('\'' + directiveName + '\' controller', - controllerDirectives[directiveName], directive, $compileNode); - controllerDirectives[directiveName] = directive; - } - - directiveValue = directive.transclude; - - if (directiveValue) { - hasTranscludeDirective = true; - - // Special case ngIf and ngRepeat so that we don't complain about duplicate transclusion. - // This option should only be used by directives that know how to safely handle element transclusion, - // where the transcluded nodes are added or replaced after linking. - if (!directive.$$tlb) { - assertNoDuplicate('transclusion', nonTlbTranscludeDirective, directive, $compileNode); - nonTlbTranscludeDirective = directive; - } - - if (directiveValue === 'element') { - hasElementTranscludeDirective = true; - terminalPriority = directive.priority; - $template = $compileNode; - $compileNode = templateAttrs.$$element = - jqLite(compile.$$createComment(directiveName, templateAttrs[directiveName])); - compileNode = $compileNode[0]; - replaceWith(jqCollection, sliceArgs($template), compileNode); - - childTranscludeFn = compilationGenerator(mightHaveMultipleTransclusionError, $template, transcludeFn, terminalPriority, - replaceDirective && replaceDirective.name, { - // Don't pass in: - // - controllerDirectives - otherwise we'll create duplicates controllers - // - newIsolateScopeDirective or templateDirective - combining templates with - // element transclusion doesn't make sense. - // - // We need only nonTlbTranscludeDirective so that we prevent putting transclusion - // on the same element more than once. - nonTlbTranscludeDirective: nonTlbTranscludeDirective - }); - } else { - - var slots = createMap(); - - if (!isObject(directiveValue)) { - $template = jqLite(jqLiteClone(compileNode)).contents(); - } else { - - // We have transclusion slots, - // collect them up, compile them and store their transclusion functions - $template = window.document.createDocumentFragment(); - - var slotMap = createMap(); - var filledSlots = createMap(); - - // Parse the element selectors - forEach(directiveValue, function (elementSelector, slotName) { - // If an element selector starts with a ? then it is optional - var optional = (elementSelector.charAt(0) === '?'); - elementSelector = optional ? elementSelector.substring(1) : elementSelector; - - slotMap[elementSelector] = slotName; - - // We explicitly assign `null` since this implies that a slot was defined but not filled. - // Later when calling boundTransclusion functions with a slot name we only error if the - // slot is `undefined` - slots[slotName] = null; - - // filledSlots contains `true` for all slots that are either optional or have been - // filled. This is used to check that we have not missed any required slots - filledSlots[slotName] = optional; - }); - - // Add the matching elements into their slot - forEach($compileNode.contents(), function (node) { - var slotName = slotMap[directiveNormalize(nodeName_(node))]; - if (slotName) { - filledSlots[slotName] = true; - slots[slotName] = slots[slotName] || window.document.createDocumentFragment(); - slots[slotName].appendChild(node); - } else { - $template.appendChild(node); - } - }); - - // Check for required slots that were not filled - forEach(filledSlots, function (filled, slotName) { - if (!filled) { - throw $compileMinErr('reqslot', 'Required transclusion slot `{0}` was not filled.', slotName); - } - }); - - for (var slotName in slots) { - if (slots[slotName]) { - // Only define a transclusion function if the slot was filled - var slotCompileNodes = jqLite(slots[slotName].childNodes); - slots[slotName] = compilationGenerator(mightHaveMultipleTransclusionError, slotCompileNodes, transcludeFn); - } - } - - $template = jqLite($template.childNodes); - } - - $compileNode.empty(); // clear contents - childTranscludeFn = compilationGenerator(mightHaveMultipleTransclusionError, $template, transcludeFn, undefined, - undefined, { - needsNewScope: directive.$$isolateScope || directive.$$newScope - }); - childTranscludeFn.$$slots = slots; - } - } - - if (directive.template) { - hasTemplate = true; - assertNoDuplicate('template', templateDirective, directive, $compileNode); - templateDirective = directive; - - directiveValue = (isFunction(directive.template)) ? - directive.template($compileNode, templateAttrs) : - directive.template; - - directiveValue = denormalizeTemplate(directiveValue); - - if (directive.replace) { - replaceDirective = directive; - if (jqLiteIsTextNode(directiveValue)) { - $template = []; - } else { - $template = removeComments(wrapTemplate(directive.templateNamespace, trim(directiveValue))); - } - compileNode = $template[0]; - - if ($template.length !== 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) { - throw $compileMinErr('tplrt', - 'Template for directive \'{0}\' must have exactly one root element. {1}', - directiveName, ''); - } - - replaceWith(jqCollection, $compileNode, compileNode); - - var newTemplateAttrs = { - $attr: {} - }; - - // combine directives from the original node and from the template: - // - take the array of directives for this element - // - split it into two parts, those that already applied (processed) and those that weren't (unprocessed) - // - collect directives from the template and sort them by priority - // - combine directives as: processed + template + unprocessed - var templateDirectives = collectDirectives(compileNode, [], newTemplateAttrs); - var unprocessedDirectives = directives.splice(i + 1, directives.length - (i + 1)); - - if (newIsolateScopeDirective || newScopeDirective) { - // The original directive caused the current element to be replaced but this element - // also needs to have a new scope, so we need to tell the template directives - // that they would need to get their scope from further up, if they require transclusion - markDirectiveScope(templateDirectives, newIsolateScopeDirective, newScopeDirective); - } - directives = directives.concat(templateDirectives).concat(unprocessedDirectives); - mergeTemplateAttributes(templateAttrs, newTemplateAttrs); - - ii = directives.length; - } else { - $compileNode.html(directiveValue); - } - } - - if (directive.templateUrl) { - hasTemplate = true; - assertNoDuplicate('template', templateDirective, directive, $compileNode); - templateDirective = directive; - - if (directive.replace) { - replaceDirective = directive; - } - - // eslint-disable-next-line no-func-assign - nodeLinkFn = compileTemplateUrl(directives.splice(i, directives.length - i), $compileNode, - templateAttrs, jqCollection, hasTranscludeDirective && childTranscludeFn, preLinkFns, postLinkFns, { - controllerDirectives: controllerDirectives, - newScopeDirective: (newScopeDirective !== directive) && newScopeDirective, - newIsolateScopeDirective: newIsolateScopeDirective, - templateDirective: templateDirective, - nonTlbTranscludeDirective: nonTlbTranscludeDirective - }); - ii = directives.length; - } else if (directive.compile) { - try { - linkFn = directive.compile($compileNode, templateAttrs, childTranscludeFn); - var context = directive.$$originalDirective || directive; - if (isFunction(linkFn)) { - addLinkFns(null, bind(context, linkFn), attrStart, attrEnd); - } else if (linkFn) { - addLinkFns(bind(context, linkFn.pre), bind(context, linkFn.post), attrStart, attrEnd); - } - } catch (e) { - $exceptionHandler(e, startingTag($compileNode)); - } - } - - if (directive.terminal) { - nodeLinkFn.terminal = true; - terminalPriority = Math.max(terminalPriority, directive.priority); - } - - } - - nodeLinkFn.scope = newScopeDirective && newScopeDirective.scope === true; - nodeLinkFn.transcludeOnThisElement = hasTranscludeDirective; - nodeLinkFn.templateOnThisElement = hasTemplate; - nodeLinkFn.transclude = childTranscludeFn; - - previousCompileContext.hasElementTranscludeDirective = hasElementTranscludeDirective; - - // might be normal or delayed nodeLinkFn depending on if templateUrl is present - return nodeLinkFn; - - //////////////////// - - function addLinkFns(pre, post, attrStart, attrEnd) { - if (pre) { - if (attrStart) pre = groupElementsLinkFnWrapper(pre, attrStart, attrEnd); - pre.require = directive.require; - pre.directiveName = directiveName; - if (newIsolateScopeDirective === directive || directive.$$isolateScope) { - pre = cloneAndAnnotateFn(pre, { - isolateScope: true - }); - } - preLinkFns.push(pre); - } - if (post) { - if (attrStart) post = groupElementsLinkFnWrapper(post, attrStart, attrEnd); - post.require = directive.require; - post.directiveName = directiveName; - if (newIsolateScopeDirective === directive || directive.$$isolateScope) { - post = cloneAndAnnotateFn(post, { - isolateScope: true - }); - } - postLinkFns.push(post); - } - } - - function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) { - var i, ii, linkFn, isolateScope, controllerScope, elementControllers, transcludeFn, $element, - attrs, scopeBindingInfo; - - if (compileNode === linkNode) { - attrs = templateAttrs; - $element = templateAttrs.$$element; - } else { - $element = jqLite(linkNode); - attrs = new Attributes($element, templateAttrs); - } - - controllerScope = scope; - if (newIsolateScopeDirective) { - isolateScope = scope.$new(true); - } else if (newScopeDirective) { - controllerScope = scope.$parent; - } - - if (boundTranscludeFn) { - // track `boundTranscludeFn` so it can be unwrapped if `transcludeFn` - // is later passed as `parentBoundTranscludeFn` to `publicLinkFn` - transcludeFn = controllersBoundTransclude; - transcludeFn.$$boundTransclude = boundTranscludeFn; - // expose the slots on the `$transclude` function - transcludeFn.isSlotFilled = function (slotName) { - return !!boundTranscludeFn.$$slots[slotName]; - }; - } - - if (controllerDirectives) { - elementControllers = setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope, newIsolateScopeDirective); - } - - if (newIsolateScopeDirective) { - // Initialize isolate scope bindings for new isolate scope directive. - compile.$$addScopeInfo($element, isolateScope, true, !(templateDirective && (templateDirective === newIsolateScopeDirective || - templateDirective === newIsolateScopeDirective.$$originalDirective))); - compile.$$addScopeClass($element, true); - isolateScope.$$isolateBindings = - newIsolateScopeDirective.$$isolateBindings; - scopeBindingInfo = initializeDirectiveBindings(scope, attrs, isolateScope, - isolateScope.$$isolateBindings, - newIsolateScopeDirective); - if (scopeBindingInfo.removeWatches) { - isolateScope.$on('$destroy', scopeBindingInfo.removeWatches); - } - } - - // Initialize bindToController bindings - for (var name in elementControllers) { - var controllerDirective = controllerDirectives[name]; - var controller = elementControllers[name]; - var bindings = controllerDirective.$$bindings.bindToController; - - controller.instance = controller(); - $element.data('$' + controllerDirective.name + 'Controller', controller.instance); - controller.bindingInfo = - initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective); - } - - // Bind the required controllers to the controller, if `require` is an object and `bindToController` is truthy - forEach(controllerDirectives, function (controllerDirective, name) { - var require = controllerDirective.require; - if (controllerDirective.bindToController && !isArray(require) && isObject(require)) { - extend(elementControllers[name].instance, getControllers(name, require, $element, elementControllers)); - } - }); - - // Handle the init and destroy lifecycle hooks on all controllers that have them - forEach(elementControllers, function (controller) { - var controllerInstance = controller.instance; - if (isFunction(controllerInstance.$onChanges)) { - try { - controllerInstance.$onChanges(controller.bindingInfo.initialChanges); - } catch (e) { - $exceptionHandler(e); - } - } - if (isFunction(controllerInstance.$onInit)) { - try { - controllerInstance.$onInit(); - } catch (e) { - $exceptionHandler(e); - } - } - if (isFunction(controllerInstance.$doCheck)) { - controllerScope.$watch(function () { - controllerInstance.$doCheck(); - }); - controllerInstance.$doCheck(); - } - if (isFunction(controllerInstance.$onDestroy)) { - controllerScope.$on('$destroy', function callOnDestroyHook() { - controllerInstance.$onDestroy(); - }); - } - }); - - // PRELINKING - for (i = 0, ii = preLinkFns.length; i < ii; i++) { - linkFn = preLinkFns[i]; - invokeLinkFn(linkFn, - linkFn.isolateScope ? isolateScope : scope, - $element, - attrs, - linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers), - transcludeFn - ); - } - - // RECURSION - // We only pass the isolate scope, if the isolate directive has a template, - // otherwise the child elements do not belong to the isolate directive. - var scopeToChild = scope; - if (newIsolateScopeDirective && (newIsolateScopeDirective.template || newIsolateScopeDirective.templateUrl === null)) { - scopeToChild = isolateScope; - } - if (childLinkFn) { - childLinkFn(scopeToChild, linkNode.childNodes, undefined, boundTranscludeFn); - } - - // POSTLINKING - for (i = postLinkFns.length - 1; i >= 0; i--) { - linkFn = postLinkFns[i]; - invokeLinkFn(linkFn, - linkFn.isolateScope ? isolateScope : scope, - $element, - attrs, - linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers), - transcludeFn - ); - } - - // Trigger $postLink lifecycle hooks - forEach(elementControllers, function (controller) { - var controllerInstance = controller.instance; - if (isFunction(controllerInstance.$postLink)) { - controllerInstance.$postLink(); - } - }); - - // This is the function that is injected as `$transclude`. - // Note: all arguments are optional! - function controllersBoundTransclude(scope, cloneAttachFn, futureParentElement, slotName) { - var transcludeControllers; - // No scope passed in: - if (!isScope(scope)) { - slotName = futureParentElement; - futureParentElement = cloneAttachFn; - cloneAttachFn = scope; - scope = undefined; - } - - if (hasElementTranscludeDirective) { - transcludeControllers = elementControllers; - } - if (!futureParentElement) { - futureParentElement = hasElementTranscludeDirective ? $element.parent() : $element; - } - if (slotName) { - // slotTranscludeFn can be one of three things: - // * a transclude function - a filled slot - // * `null` - an optional slot that was not filled - // * `undefined` - a slot that was not declared (i.e. invalid) - var slotTranscludeFn = boundTranscludeFn.$$slots[slotName]; - if (slotTranscludeFn) { - return slotTranscludeFn(scope, cloneAttachFn, transcludeControllers, futureParentElement, scopeToChild); - } else if (isUndefined(slotTranscludeFn)) { - throw $compileMinErr('noslot', - 'No parent directive that requires a transclusion with slot name "{0}". ' + - 'Element: {1}', - slotName, startingTag($element)); - } - } else { - return boundTranscludeFn(scope, cloneAttachFn, transcludeControllers, futureParentElement, scopeToChild); - } - } - } - } - - function getControllers(directiveName, require, $element, elementControllers) { - var value; - - if (isString(require)) { - var match = require.match(REQUIRE_PREFIX_REGEXP); - var name = require.substring(match[0].length); - var inheritType = match[1] || match[3]; - var optional = match[2] === '?'; - - //If only parents then start at the parent element - if (inheritType === '^^') { - $element = $element.parent(); - //Otherwise attempt getting the controller from elementControllers in case - //the element is transcluded (and has no data) and to avoid .data if possible - } else { - value = elementControllers && elementControllers[name]; - value = value && value.instance; - } - - if (!value) { - var dataName = '$' + name + 'Controller'; - - if (inheritType === '^^' && $element[0] && $element[0].nodeType === NODE_TYPE_DOCUMENT) { - // inheritedData() uses the documentElement when it finds the document, so we would - // require from the element itself. - value = null; - } else { - value = inheritType ? $element.inheritedData(dataName) : $element.data(dataName); - } - } - - if (!value && !optional) { - throw $compileMinErr('ctreq', - 'Controller \'{0}\', required by directive \'{1}\', can\'t be found!', - name, directiveName); - } - } else if (isArray(require)) { - value = []; - for (var i = 0, ii = require.length; i < ii; i++) { - value[i] = getControllers(directiveName, require[i], $element, elementControllers); - } - } else if (isObject(require)) { - value = {}; - forEach(require, function (controller, property) { - value[property] = getControllers(directiveName, controller, $element, elementControllers); - }); - } - - return value || null; - } - - function setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope, newIsolateScopeDirective) { - var elementControllers = createMap(); - for (var controllerKey in controllerDirectives) { - var directive = controllerDirectives[controllerKey]; - var locals = { - $scope: directive === newIsolateScopeDirective || directive.$$isolateScope ? isolateScope : scope, - $element: $element, - $attrs: attrs, - $transclude: transcludeFn - }; - - var controller = directive.controller; - if (controller === '@') { - controller = attrs[directive.name]; - } - - var controllerInstance = $controller(controller, locals, true, directive.controllerAs); - - // For directives with element transclusion the element is a comment. - // In this case .data will not attach any data. - // Instead, we save the controllers for the element in a local hash and attach to .data - // later, once we have the actual element. - elementControllers[directive.name] = controllerInstance; - $element.data('$' + directive.name + 'Controller', controllerInstance.instance); - } - return elementControllers; - } - - // Depending upon the context in which a directive finds itself it might need to have a new isolated - // or child scope created. For instance: - // * if the directive has been pulled into a template because another directive with a higher priority - // asked for element transclusion - // * if the directive itself asks for transclusion but it is at the root of a template and the original - // element was replaced. See https://github.com/angular/angular.js/issues/12936 - function markDirectiveScope(directives, isolateScope, newScope) { - for (var j = 0, jj = directives.length; j < jj; j++) { - directives[j] = inherit(directives[j], { - $$isolateScope: isolateScope, - $$newScope: newScope - }); - } - } - - /** - * looks up the directive and decorates it with exception handling and proper parameters. We - * call this the boundDirective. - * - * @param {string} name name of the directive to look up. - * @param {string} location The directive must be found in specific format. - * String containing any of theses characters: - * - * * `E`: element name - * * `A': attribute - * * `C`: class - * * `M`: comment - * @returns {boolean} true if directive was added. - */ - function addDirective(tDirectives, name, location, maxPriority, ignoreDirective, startAttrName, - endAttrName) { - if (name === ignoreDirective) return null; - var match = null; - if (hasDirectives.hasOwnProperty(name)) { - for (var directive, directives = $injector.get(name + Suffix), - i = 0, ii = directives.length; i < ii; i++) { - directive = directives[i]; - if ((isUndefined(maxPriority) || maxPriority > directive.priority) && - directive.restrict.indexOf(location) !== -1) { - if (startAttrName) { - directive = inherit(directive, { - $$start: startAttrName, - $$end: endAttrName - }); - } - if (!directive.$$bindings) { - var bindings = directive.$$bindings = - parseDirectiveBindings(directive, directive.name); - if (isObject(bindings.isolateScope)) { - directive.$$isolateBindings = bindings.isolateScope; - } - } - tDirectives.push(directive); - match = directive; - } - } - } - return match; - } - - - /** - * looks up the directive and returns true if it is a multi-element directive, - * and therefore requires DOM nodes between -start and -end markers to be grouped - * together. - * - * @param {string} name name of the directive to look up. - * @returns true if directive was registered as multi-element. - */ - function directiveIsMultiElement(name) { - if (hasDirectives.hasOwnProperty(name)) { - for (var directive, directives = $injector.get(name + Suffix), - i = 0, ii = directives.length; i < ii; i++) { - directive = directives[i]; - if (directive.multiElement) { - return true; - } - } - } - return false; - } - - /** - * When the element is replaced with HTML template then the new attributes - * on the template need to be merged with the existing attributes in the DOM. - * The desired effect is to have both of the attributes present. - * - * @param {object} dst destination attributes (original DOM) - * @param {object} src source attributes (from the directive template) - */ - function mergeTemplateAttributes(dst, src) { - var srcAttr = src.$attr, - dstAttr = dst.$attr; - - // reapply the old attributes to the new element - forEach(dst, function (value, key) { - if (key.charAt(0) !== '$') { - if (src[key] && src[key] !== value) { - if (value.length) { - value += (key === 'style' ? ';' : ' ') + src[key]; - } else { - value = src[key]; - } - } - dst.$set(key, value, true, srcAttr[key]); - } - }); - - // copy the new attributes on the old attrs object - forEach(src, function (value, key) { - // Check if we already set this attribute in the loop above. - // `dst` will never contain hasOwnProperty as DOM parser won't let it. - // You will get an "InvalidCharacterError: DOM Exception 5" error if you - // have an attribute like "has-own-property" or "data-has-own-property", etc. - if (!dst.hasOwnProperty(key) && key.charAt(0) !== '$') { - dst[key] = value; - - if (key !== 'class' && key !== 'style') { - dstAttr[key] = srcAttr[key]; - } - } - }); - } - - - function compileTemplateUrl(directives, $compileNode, tAttrs, - $rootElement, childTranscludeFn, preLinkFns, postLinkFns, previousCompileContext) { - var linkQueue = [], - afterTemplateNodeLinkFn, - afterTemplateChildLinkFn, - beforeTemplateCompileNode = $compileNode[0], - origAsyncDirective = directives.shift(), - derivedSyncDirective = inherit(origAsyncDirective, { - templateUrl: null, - transclude: null, - replace: null, - $$originalDirective: origAsyncDirective - }), - templateUrl = (isFunction(origAsyncDirective.templateUrl)) ? - origAsyncDirective.templateUrl($compileNode, tAttrs) : - origAsyncDirective.templateUrl, - templateNamespace = origAsyncDirective.templateNamespace; - - $compileNode.empty(); - - $templateRequest(templateUrl) - .then(function (content) { - var compileNode, tempTemplateAttrs, $template, childBoundTranscludeFn; - /** - * @description å ä½ï¼Œå¾…处ç†è¯­è¨€htmlæ•°æ®ï¼ŒtemplateUrl - * @author Eoapi - */ - if (window.eoLang) { - content = denormalizeTemplate(eoFunParseLang(content)); - } else { - content = denormalizeTemplate(content); - } - /** - * @desc 全局替æ¢å†…容 - */ - content = denormalizeTemplate(eoFnParseConf(content)); - if (origAsyncDirective.replace) { - if (jqLiteIsTextNode(content)) { - $template = []; - } else { - $template = removeComments(wrapTemplate(templateNamespace, trim(content))); - } - compileNode = $template[0]; - - if ($template.length !== 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) { - throw $compileMinErr('tplrt', - 'Template for directive \'{0}\' must have exactly one root element. {1}', - origAsyncDirective.name, templateUrl); - } - - tempTemplateAttrs = { - $attr: {} - }; - replaceWith($rootElement, $compileNode, compileNode); - var templateDirectives = collectDirectives(compileNode, [], tempTemplateAttrs); - - if (isObject(origAsyncDirective.scope)) { - // the original directive that caused the template to be loaded async required - // an isolate scope - markDirectiveScope(templateDirectives, true); - } - directives = templateDirectives.concat(directives); - mergeTemplateAttributes(tAttrs, tempTemplateAttrs); - } else { - compileNode = beforeTemplateCompileNode; - $compileNode.html(content); - } - - directives.unshift(derivedSyncDirective); - - afterTemplateNodeLinkFn = applyDirectivesToNode(directives, compileNode, tAttrs, - childTranscludeFn, $compileNode, origAsyncDirective, preLinkFns, postLinkFns, - previousCompileContext); - forEach($rootElement, function (node, i) { - if (node === compileNode) { - $rootElement[i] = $compileNode[0]; - } - }); - afterTemplateChildLinkFn = compileNodes($compileNode[0].childNodes, childTranscludeFn); - - while (linkQueue.length) { - var scope = linkQueue.shift(), - beforeTemplateLinkNode = linkQueue.shift(), - linkRootElement = linkQueue.shift(), - boundTranscludeFn = linkQueue.shift(), - linkNode = $compileNode[0]; - - if (scope.$$destroyed) continue; - - if (beforeTemplateLinkNode !== beforeTemplateCompileNode) { - var oldClasses = beforeTemplateLinkNode.className; - - if (!(previousCompileContext.hasElementTranscludeDirective && - origAsyncDirective.replace)) { - // it was cloned therefore we have to clone as well. - linkNode = jqLiteClone(compileNode); - } - replaceWith(linkRootElement, jqLite(beforeTemplateLinkNode), linkNode); - - // Copy in CSS classes from original node - safeAddClass(jqLite(linkNode), oldClasses); - } - if (afterTemplateNodeLinkFn.transcludeOnThisElement) { - childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn); - } else { - childBoundTranscludeFn = boundTranscludeFn; - } - afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, linkNode, $rootElement, - childBoundTranscludeFn); - } - linkQueue = null; - }).catch(function (error) { - if (error instanceof Error) { - $exceptionHandler(error); - } - }); - - return function delayedNodeLinkFn(ignoreChildLinkFn, scope, node, rootElement, boundTranscludeFn) { - var childBoundTranscludeFn = boundTranscludeFn; - if (scope.$$destroyed) return; - if (linkQueue) { - linkQueue.push(scope, - node, - rootElement, - childBoundTranscludeFn); - } else { - if (afterTemplateNodeLinkFn.transcludeOnThisElement) { - childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn); - } - afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, node, rootElement, childBoundTranscludeFn); - } - }; - } - - - /** - * Sorting function for bound directives. - */ - function byPriority(a, b) { - var diff = b.priority - a.priority; - if (diff !== 0) return diff; - if (a.name !== b.name) return (a.name < b.name) ? -1 : 1; - return a.index - b.index; - } - - function assertNoDuplicate(what, previousDirective, directive, element) { - - function wrapModuleNameIfDefined(moduleName) { - return moduleName ? - (' (module: ' + moduleName + ')') : - ''; - } - - if (previousDirective) { - throw $compileMinErr('multidir', 'Multiple directives [{0}{1}, {2}{3}] asking for {4} on: {5}', - previousDirective.name, wrapModuleNameIfDefined(previousDirective.$$moduleName), - directive.name, wrapModuleNameIfDefined(directive.$$moduleName), what, startingTag(element)); - } - } - - - function addTextInterpolateDirective(directives, text) { - var interpolateFn = $interpolate(text, true); - if (interpolateFn) { - directives.push({ - priority: 0, - compile: function textInterpolateCompileFn(templateNode) { - var templateNodeParent = templateNode.parent(), - hasCompileParent = !!templateNodeParent.length; - - // When transcluding a template that has bindings in the root - // we don't have a parent and thus need to add the class during linking fn. - if (hasCompileParent) compile.$$addBindingClass(templateNodeParent); - - return function textInterpolateLinkFn(scope, node) { - var parent = node.parent(); - if (!hasCompileParent) compile.$$addBindingClass(parent); - compile.$$addBindingInfo(parent, interpolateFn.expressions); - scope.$watch(interpolateFn, function interpolateFnWatchAction(value) { - node[0].nodeValue = value; - }); - }; - } - }); - } - } - - - function wrapTemplate(type, template) { - type = lowercase(type || 'html'); - switch (type) { - case 'svg': - case 'math': - var wrapper = window.document.createElement('div'); - wrapper.innerHTML = '<' + type + '>' + template + ''; - return wrapper.childNodes[0].childNodes; - default: - return template; - } - } - - - function getTrustedAttrContext(nodeName, attrNormalizedName) { - if (attrNormalizedName === 'srcdoc') { - return $sce.HTML; - } - // All nodes with src attributes require a RESOURCE_URL value, except for - // img and various html5 media nodes, which require the MEDIA_URL context. - if (attrNormalizedName === 'src' || attrNormalizedName === 'ngSrc') { - if (['img', 'video', 'audio', 'source', 'track'].indexOf(nodeName) === -1) { - return $sce.RESOURCE_URL; - } - return $sce.MEDIA_URL; - } else if (attrNormalizedName === 'xlinkHref') { - // Some xlink:href are okay, most aren't - if (nodeName === 'image') return $sce.MEDIA_URL; - if (nodeName === 'a') return $sce.URL; - return $sce.RESOURCE_URL; - } else if ( - // Formaction - (nodeName === 'form' && attrNormalizedName === 'action') || - // If relative URLs can go where they are not expected to, then - // all sorts of trust issues can arise. - (nodeName === 'base' && attrNormalizedName === 'href') || - // links can be stylesheets or imports, which can run script in the current origin - (nodeName === 'link' && attrNormalizedName === 'href') - ) { - return $sce.RESOURCE_URL; - } else if (nodeName === 'a' && (attrNormalizedName === 'href' || - attrNormalizedName === 'ngHref')) { - return $sce.URL; - } - } - - function getTrustedPropContext(nodeName, propNormalizedName) { - var prop = propNormalizedName.toLowerCase(); - return PROP_CONTEXTS[nodeName + '|' + prop] || PROP_CONTEXTS['*|' + prop]; - } - - function sanitizeSrcsetPropertyValue(value) { - return sanitizeSrcset($sce.valueOf(value), 'ng-prop-srcset'); - } - - function addPropertyDirective(node, directives, attrName, propName) { - if (EVENT_HANDLER_ATTR_REGEXP.test(propName)) { - throw $compileMinErr('nodomevents', 'Property bindings for HTML DOM event properties are disallowed'); - } - - var nodeName = nodeName_(node); - var trustedContext = getTrustedPropContext(nodeName, propName); - - var sanitizer = identity; - // Sanitize img[srcset] + source[srcset] values. - if (propName === 'srcset' && (nodeName === 'img' || nodeName === 'source')) { - sanitizer = sanitizeSrcsetPropertyValue; - } else if (trustedContext) { - sanitizer = $sce.getTrusted.bind($sce, trustedContext); - } - - directives.push({ - priority: 100, - compile: function ngPropCompileFn(_, attr) { - var ngPropGetter = $parse(attr[attrName]); - var ngPropWatch = $parse(attr[attrName], function sceValueOf(val) { - // Unwrap the value to compare the actual inner safe value, not the wrapper object. - return $sce.valueOf(val); - }); - - return { - pre: function ngPropPreLinkFn(scope, $element) { - function applyPropValue() { - var propValue = ngPropGetter(scope); - $element[0][propName] = sanitizer(propValue); - } - - applyPropValue(); - scope.$watch(ngPropWatch, applyPropValue); - } - }; - } - }); - } - - function addEventDirective(directives, attrName, eventName) { - directives.push( - createEventDirective($parse, $rootScope, $exceptionHandler, attrName, eventName, /*forceAsync=*/ false) - ); - } - - function addAttrInterpolateDirective(node, directives, value, name, isNgAttr) { - var nodeName = nodeName_(node); - var trustedContext = getTrustedAttrContext(nodeName, name); - var mustHaveExpression = !isNgAttr; - var allOrNothing = ALL_OR_NOTHING_ATTRS[name] || isNgAttr; - - var interpolateFn = $interpolate(value, mustHaveExpression, trustedContext, allOrNothing); - - // no interpolation found -> ignore - if (!interpolateFn) return; - - if (name === 'multiple' && nodeName === 'select') { - throw $compileMinErr('selmulti', - 'Binding to the \'multiple\' attribute is not supported. Element: {0}', - startingTag(node)); - } - - if (EVENT_HANDLER_ATTR_REGEXP.test(name)) { - throw $compileMinErr('nodomevents', 'Interpolations for HTML DOM event attributes are disallowed'); - } - - directives.push({ - priority: 100, - compile: function () { - return { - pre: function attrInterpolatePreLinkFn(scope, element, attr) { - var $$observers = (attr.$$observers || (attr.$$observers = createMap())); - - // If the attribute has changed since last $interpolate()ed - var newValue = attr[name]; - if (newValue !== value) { - // we need to interpolate again since the attribute value has been updated - // (e.g. by another directive's compile function) - // ensure unset/empty values make interpolateFn falsy - interpolateFn = newValue && $interpolate(newValue, true, trustedContext, allOrNothing); - value = newValue; - } - - // if attribute was updated so that there is no interpolation going on we don't want to - // register any observers - if (!interpolateFn) return; - - // initialize attr object so that it's ready in case we need the value for isolate - // scope initialization, otherwise the value would not be available from isolate - // directive's linking fn during linking phase - attr[name] = interpolateFn(scope); - - ($$observers[name] || ($$observers[name] = [])).$$inter = true; - (attr.$$observers && attr.$$observers[name].$$scope || scope). - $watch(interpolateFn, function interpolateFnWatchAction(newValue, oldValue) { - //special case for class attribute addition + removal - //so that class changes can tap into the animation - //hooks provided by the $animate service. Be sure to - //skip animations when the first digest occurs (when - //both the new and the old values are the same) since - //the CSS classes are the non-interpolated values - if (name === 'class' && newValue !== oldValue) { - attr.$updateClass(newValue, oldValue); - } else { - attr.$set(name, newValue); - } - }); - } - }; - } - }); - } - - - /** - * This is a special jqLite.replaceWith, which can replace items which - * have no parents, provided that the containing jqLite collection is provided. - * - * @param {JqLite=} $rootElement The root of the compile tree. Used so that we can replace nodes - * in the root of the tree. - * @param {JqLite} elementsToRemove The jqLite element which we are going to replace. We keep - * the shell, but replace its DOM node reference. - * @param {Node} newNode The new DOM node. - */ - function replaceWith($rootElement, elementsToRemove, newNode) { - var firstElementToRemove = elementsToRemove[0], - removeCount = elementsToRemove.length, - parent = firstElementToRemove.parentNode, - i, ii; - - if ($rootElement) { - for (i = 0, ii = $rootElement.length; i < ii; i++) { - if ($rootElement[i] === firstElementToRemove) { - $rootElement[i++] = newNode; - for (var j = i, j2 = j + removeCount - 1, - jj = $rootElement.length; j < jj; j++, j2++) { - if (j2 < jj) { - $rootElement[j] = $rootElement[j2]; - } else { - delete $rootElement[j]; - } - } - $rootElement.length -= removeCount - 1; - - // If the replaced element is also the jQuery .context then replace it - // .context is a deprecated jQuery api, so we should set it only when jQuery set it - // http://api.jquery.com/context/ - if ($rootElement.context === firstElementToRemove) { - $rootElement.context = newNode; - } - break; - } - } - } - - if (parent) { - parent.replaceChild(newNode, firstElementToRemove); - } - - // Append all the `elementsToRemove` to a fragment. This will... - // - remove them from the DOM - // - allow them to still be traversed with .nextSibling - // - allow a single fragment.qSA to fetch all elements being removed - var fragment = window.document.createDocumentFragment(); - for (i = 0; i < removeCount; i++) { - fragment.appendChild(elementsToRemove[i]); - } - - if (jqLite.hasData(firstElementToRemove)) { - // Copy over user data (that includes AngularJS's $scope etc.). Don't copy private - // data here because there's no public interface in jQuery to do that and copying over - // event listeners (which is the main use of private data) wouldn't work anyway. - jqLite.data(newNode, jqLite.data(firstElementToRemove)); - - // Remove $destroy event listeners from `firstElementToRemove` - jqLite(firstElementToRemove).off('$destroy'); - } - - // Cleanup any data/listeners on the elements and children. - // This includes invoking the $destroy event on any elements with listeners. - jqLite.cleanData(fragment.querySelectorAll('*')); - - // Update the jqLite collection to only contain the `newNode` - for (i = 1; i < removeCount; i++) { - delete elementsToRemove[i]; - } - elementsToRemove[0] = newNode; - elementsToRemove.length = 1; - } - - - function cloneAndAnnotateFn(fn, annotation) { - return extend(function () { - return fn.apply(null, arguments); - }, fn, annotation); - } - - - function invokeLinkFn(linkFn, scope, $element, attrs, controllers, transcludeFn) { - try { - linkFn(scope, $element, attrs, controllers, transcludeFn); - } catch (e) { - $exceptionHandler(e, startingTag($element)); - } - } - - function strictBindingsCheck(attrName, directiveName) { - if (strictComponentBindingsEnabled) { - throw $compileMinErr('missingattr', - 'Attribute \'{0}\' of \'{1}\' is non-optional and must be set!', - attrName, directiveName); - } - } - - // Set up $watches for isolate scope and controller bindings. - function initializeDirectiveBindings(scope, attrs, destination, bindings, directive) { - var removeWatchCollection = []; - var initialChanges = {}; - var changes; - - forEach(bindings, function initializeBinding(definition, scopeName) { - var attrName = definition.attrName, - optional = definition.optional, - mode = definition.mode, // @, =, <, or & - lastValue, - parentGet, parentSet, compare, removeWatch; - - switch (mode) { - - case '@': - if (!optional && !hasOwnProperty.call(attrs, attrName)) { - strictBindingsCheck(attrName, directive.name); - destination[scopeName] = attrs[attrName] = undefined; - - } - removeWatch = attrs.$observe(attrName, function (value) { - if (isString(value) || isBoolean(value)) { - var oldValue = destination[scopeName]; - recordChanges(scopeName, value, oldValue); - destination[scopeName] = value; - } - }); - attrs.$$observers[attrName].$$scope = scope; - lastValue = attrs[attrName]; - if (isString(lastValue)) { - // If the attribute has been provided then we trigger an interpolation to ensure - // the value is there for use in the link fn - destination[scopeName] = $interpolate(lastValue)(scope); - } else if (isBoolean(lastValue)) { - // If the attributes is one of the BOOLEAN_ATTR then AngularJS will have converted - // the value to boolean rather than a string, so we special case this situation - destination[scopeName] = lastValue; - } - initialChanges[scopeName] = new SimpleChange(_UNINITIALIZED_VALUE, destination[scopeName]); - removeWatchCollection.push(removeWatch); - break; - - case '=': - if (!hasOwnProperty.call(attrs, attrName)) { - if (optional) break; - strictBindingsCheck(attrName, directive.name); - attrs[attrName] = undefined; - } - if (optional && !attrs[attrName]) break; - - parentGet = $parse(attrs[attrName]); - if (parentGet.literal) { - compare = equals; - } else { - compare = simpleCompare; - } - parentSet = parentGet.assign || function () { - // reset the change, or we will throw this exception on every $digest - lastValue = destination[scopeName] = parentGet(scope); - throw $compileMinErr('nonassign', - 'Expression \'{0}\' in attribute \'{1}\' used with directive \'{2}\' is non-assignable!', - attrs[attrName], attrName, directive.name); - }; - lastValue = destination[scopeName] = parentGet(scope); - var parentValueWatch = function parentValueWatch(parentValue) { - if (!compare(parentValue, destination[scopeName])) { - // we are out of sync and need to copy - if (!compare(parentValue, lastValue)) { - // parent changed and it has precedence - destination[scopeName] = parentValue; - } else { - // if the parent can be assigned then do so - parentSet(scope, parentValue = destination[scopeName]); - } - } - lastValue = parentValue; - return lastValue; - }; - parentValueWatch.$stateful = true; - if (definition.collection) { - removeWatch = scope.$watchCollection(attrs[attrName], parentValueWatch); - } else { - removeWatch = scope.$watch($parse(attrs[attrName], parentValueWatch), null, parentGet.literal); - } - removeWatchCollection.push(removeWatch); - break; - - case '<': - if (!hasOwnProperty.call(attrs, attrName)) { - if (optional) break; - strictBindingsCheck(attrName, directive.name); - attrs[attrName] = undefined; - } - if (optional && !attrs[attrName]) break; - - parentGet = $parse(attrs[attrName]); - var isLiteral = parentGet.literal; - - var initialValue = destination[scopeName] = parentGet(scope); - initialChanges[scopeName] = new SimpleChange(_UNINITIALIZED_VALUE, destination[scopeName]); - - removeWatch = scope[definition.collection ? '$watchCollection' : '$watch'](parentGet, function parentValueWatchAction(newValue, oldValue) { - if (oldValue === newValue) { - if (oldValue === initialValue || (isLiteral && equals(oldValue, initialValue))) { - return; - } - oldValue = initialValue; - } - recordChanges(scopeName, newValue, oldValue); - destination[scopeName] = newValue; - }, isLiteral); - - removeWatchCollection.push(removeWatch); - break; - - case '&': - if (!optional && !hasOwnProperty.call(attrs, attrName)) { - strictBindingsCheck(attrName, directive.name); - } - // Don't assign Object.prototype method to scope - parentGet = attrs.hasOwnProperty(attrName) ? $parse(attrs[attrName]) : noop; - - // Don't assign noop to destination if expression is not valid - if (parentGet === noop && optional) break; - - destination[scopeName] = function (locals) { - return parentGet(scope, locals); - }; - break; - } - }); - - function recordChanges(key, currentValue, previousValue) { - if (isFunction(destination.$onChanges) && !simpleCompare(currentValue, previousValue)) { - // If we have not already scheduled the top level onChangesQueue handler then do so now - if (!onChangesQueue) { - scope.$$postDigest(flushOnChangesQueue); - onChangesQueue = []; - } - // If we have not already queued a trigger of onChanges for this controller then do so now - if (!changes) { - changes = {}; - onChangesQueue.push(triggerOnChangesHook); - } - // If the has been a change on this property already then we need to reuse the previous value - if (changes[key]) { - previousValue = changes[key].previousValue; - } - // Store this change - changes[key] = new SimpleChange(previousValue, currentValue); - } - } - - function triggerOnChangesHook() { - destination.$onChanges(changes); - // Now clear the changes so that we schedule onChanges when more changes arrive - changes = undefined; - } - - return { - initialChanges: initialChanges, - removeWatches: removeWatchCollection.length && function removeWatches() { - for (var i = 0, ii = removeWatchCollection.length; i < ii; ++i) { - removeWatchCollection[i](); - } - } - }; - } - } - ]; - } - - function SimpleChange(previous, current) { - this.previousValue = previous; - this.currentValue = current; - } - SimpleChange.prototype.isFirstChange = function () { - return this.previousValue === _UNINITIALIZED_VALUE; - }; - - - var PREFIX_REGEXP = /^((?:x|data)[:\-_])/i; - var SPECIAL_CHARS_REGEXP = /[:\-_]+(.)/g; - - /** - * Converts all accepted directives format into proper directive name. - * @param name Name to normalize - */ - function directiveNormalize(name) { - return name - .replace(PREFIX_REGEXP, '') - .replace(SPECIAL_CHARS_REGEXP, function (_, letter, offset) { - return offset ? letter.toUpperCase() : letter; - }); - } - - /** - * @ngdoc type - * @name $compile.directive.Attributes - * - * @description - * A shared object between directive compile / linking functions which contains normalized DOM - * element attributes. The values reflect current binding state `{{ }}`. The normalization is - * needed since all of these are treated as equivalent in AngularJS: - * - * ``` - * - * ``` - */ - - /** - * @ngdoc property - * @name $compile.directive.Attributes#$attr - * - * @description - * A map of DOM element attribute names to the normalized name. This is - * needed to do reverse lookup from normalized name back to actual name. - */ - - - /** - * @ngdoc method - * @name $compile.directive.Attributes#$set - * @kind function - * - * @description - * Set DOM element attribute value. - * - * - * @param {string} name Normalized element attribute name of the property to modify. The name is - * reverse-translated using the {@link ng.$compile.directive.Attributes#$attr $attr} - * property to the original name. - * @param {string} value Value to set the attribute to. The value can be an interpolated string. - */ - - - - /** - * Closure compiler type information - */ - - function nodesetLinkingFn( - /* angular.Scope */ - scope, - /* NodeList */ - nodeList, - /* Element */ - rootElement, - /* function(Function) */ - boundTranscludeFn - ) {} - - function directiveLinkingFn( - /* nodesetLinkingFn */ - nodesetLinkingFn, - /* angular.Scope */ - scope, - /* Node */ - node, - /* Element */ - rootElement, - /* function(Function) */ - boundTranscludeFn - ) {} - - function tokenDifference(str1, str2) { - var values = '', - tokens1 = str1.split(/\s+/), - tokens2 = str2.split(/\s+/); - - outer: - for (var i = 0; i < tokens1.length; i++) { - var token = tokens1[i]; - for (var j = 0; j < tokens2.length; j++) { - if (token === tokens2[j]) continue outer; - } - values += (values.length > 0 ? ' ' : '') + token; - } - return values; - } - - function removeComments(jqNodes) { - jqNodes = jqLite(jqNodes); - var i = jqNodes.length; - - if (i <= 1) { - return jqNodes; - } - - while (i--) { - var node = jqNodes[i]; - if (node.nodeType === NODE_TYPE_COMMENT || - (node.nodeType === NODE_TYPE_TEXT && node.nodeValue.trim() === '')) { - splice.call(jqNodes, i, 1); - } - } - return jqNodes; - } - - var $controllerMinErr = minErr('$controller'); - - - var CNTRL_REG = /^(\S+)(\s+as\s+([\w$]+))?$/; - - function identifierForController(controller, ident) { - if (ident && isString(ident)) return ident; - if (isString(controller)) { - var match = CNTRL_REG.exec(controller); - if (match) return match[3]; - } - } - - - /** - * @ngdoc provider - * @name $controllerProvider - * @this - * - * @description - * The {@link ng.$controller $controller service} is used by AngularJS to create new - * controllers. - * - * This provider allows controller registration via the - * {@link ng.$controllerProvider#register register} method. - */ - function $ControllerProvider() { - var controllers = {}; - - /** - * @ngdoc method - * @name $controllerProvider#has - * @param {string} name Controller name to check. - */ - this.has = function (name) { - return controllers.hasOwnProperty(name); - }; - - /** - * @ngdoc method - * @name $controllerProvider#register - * @param {string|Object} name Controller name, or an object map of controllers where the keys are - * the names and the values are the constructors. - * @param {Function|Array} constructor Controller constructor fn (optionally decorated with DI - * annotations in the array notation). - */ - this.register = function (name, constructor) { - assertNotHasOwnProperty(name, 'controller'); - if (isObject(name)) { - extend(controllers, name); - } else { - controllers[name] = constructor; - } - }; - - this.$get = ['$injector', function ($injector) { - - /** - * @ngdoc service - * @name $controller - * @requires $injector - * - * @param {Function|string} constructor If called with a function then it's considered to be the - * controller constructor function. Otherwise it's considered to be a string which is used - * to retrieve the controller constructor using the following steps: - * - * * check if a controller with given name is registered via `$controllerProvider` - * * check if evaluating the string on the current scope returns a constructor - * - * The string can use the `controller as property` syntax, where the controller instance is published - * as the specified property on the `scope`; the `scope` must be injected into `locals` param for this - * to work correctly. - * - * @param {Object} locals Injection locals for Controller. - * @return {Object} Instance of given controller. - * - * @description - * `$controller` service is responsible for instantiating controllers. - * - * It's just a simple call to {@link auto.$injector $injector}, but extracted into - * a service, so that one can override this service with [BC version](https://gist.github.com/1649788). - */ - return function $controller(expression, locals, later, ident) { - // PRIVATE API: - // param `later` --- indicates that the controller's constructor is invoked at a later time. - // If true, $controller will allocate the object with the correct - // prototype chain, but will not invoke the controller until a returned - // callback is invoked. - // param `ident` --- An optional label which overrides the label parsed from the controller - // expression, if any. - var instance, match, constructor, identifier; - later = later === true; - if (ident && isString(ident)) { - identifier = ident; - } - - if (isString(expression)) { - match = expression.match(CNTRL_REG); - if (!match) { - throw $controllerMinErr('ctrlfmt', - 'Badly formed controller string \'{0}\'. ' + - 'Must match `__name__ as __id__` or `__name__`.', expression); - } - constructor = match[1]; - identifier = identifier || match[3]; - expression = controllers.hasOwnProperty(constructor) ? - controllers[constructor] : - getter(locals.$scope, constructor, true); - - if (!expression) { - throw $controllerMinErr('ctrlreg', - 'The controller with the name \'{0}\' is not registered.', constructor); - } - - assertArgFn(expression, constructor, true); - } - - if (later) { - // Instantiate controller later: - // This machinery is used to create an instance of the object before calling the - // controller's constructor itself. - // - // This allows properties to be added to the controller before the constructor is - // invoked. Primarily, this is used for isolate scope bindings in $compile. - // - // This feature is not intended for use by applications, and is thus not documented - // publicly. - // Object creation: http://jsperf.com/create-constructor/2 - var controllerPrototype = (isArray(expression) ? - expression[expression.length - 1] : expression).prototype; - instance = Object.create(controllerPrototype || null); - - if (identifier) { - addIdentifier(locals, identifier, instance, constructor || expression.name); - } - - return extend(function $controllerInit() { - var result = $injector.invoke(expression, instance, locals, constructor); - if (result !== instance && (isObject(result) || isFunction(result))) { - instance = result; - if (identifier) { - // If result changed, re-assign controllerAs value to scope. - addIdentifier(locals, identifier, instance, constructor || expression.name); - } - } - return instance; - }, { - instance: instance, - identifier: identifier - }); - } - - instance = $injector.instantiate(expression, locals, constructor); - - if (identifier) { - addIdentifier(locals, identifier, instance, constructor || expression.name); - } - - return instance; - }; - - function addIdentifier(locals, identifier, instance, name) { - if (!(locals && isObject(locals.$scope))) { - throw minErr('$controller')('noscp', - 'Cannot export controller \'{0}\' as \'{1}\'! No $scope object provided via `locals`.', - name, identifier); - } - - locals.$scope[identifier] = instance; - } - }]; - } - - /** - * @ngdoc service - * @name $document - * @requires $window - * @this - * - * @description - * A {@link angular.element jQuery or jqLite} wrapper for the browser's `window.document` object. - * - * @example - - -
-

$document title:

-

window.document title:

-
-
- - angular.module('documentExample', []) - .controller('ExampleController', ['$scope', '$document', function($scope, $document) { - $scope.title = $document[0].title; - $scope.windowTitle = angular.element(window.document)[0].title; - }]); - -
- */ - function $DocumentProvider() { - this.$get = ['$window', function (window) { - return jqLite(window.document); - }]; - } - - - /** - * @private - * @this - * Listens for document visibility change and makes the current status accessible. - */ - function $$IsDocumentHiddenProvider() { - this.$get = ['$document', '$rootScope', function ($document, $rootScope) { - var doc = $document[0]; - var hidden = doc && doc.hidden; - - $document.on('visibilitychange', changeListener); - - $rootScope.$on('$destroy', function () { - $document.off('visibilitychange', changeListener); - }); - - function changeListener() { - hidden = doc.hidden; - } - - return function () { - return hidden; - }; - }]; - } - - /** - * @ngdoc service - * @name $exceptionHandler - * @requires ng.$log - * @this - * - * @description - * Any uncaught exception in AngularJS expressions is delegated to this service. - * The default implementation simply delegates to `$log.error` which logs it into - * the browser console. - * - * In unit tests, if `angular-mocks.js` is loaded, this service is overridden by - * {@link ngMock.$exceptionHandler mock $exceptionHandler} which aids in testing. - * - * ## Example: - * - * The example below will overwrite the default `$exceptionHandler` in order to (a) log uncaught - * errors to the backend for later inspection by the developers and (b) to use `$log.warn()` instead - * of `$log.error()`. - * - * ```js - * angular. - * module('exceptionOverwrite', []). - * factory('$exceptionHandler', ['$log', 'logErrorsToBackend', function($log, logErrorsToBackend) { - * return function myExceptionHandler(exception, cause) { - * logErrorsToBackend(exception, cause); - * $log.warn(exception, cause); - * }; - * }]); - * ``` - * - *
- * Note, that code executed in event-listeners (even those registered using jqLite's `on`/`bind` - * methods) does not delegate exceptions to the {@link ng.$exceptionHandler $exceptionHandler} - * (unless executed during a digest). - * - * If you wish, you can manually delegate exceptions, e.g. - * `try { ... } catch(e) { $exceptionHandler(e); }` - * - * @param {Error} exception Exception associated with the error. - * @param {string=} cause Optional information about the context in which - * the error was thrown. - * - */ - function $ExceptionHandlerProvider() { - this.$get = ['$log', function ($log) { - return function (exception, cause) { - $log.error.apply($log, arguments); - }; - }]; - } - - var $$ForceReflowProvider = /** @this */ function () { - this.$get = ['$document', function ($document) { - return function (domNode) { - //the line below will force the browser to perform a repaint so - //that all the animated elements within the animation frame will - //be properly updated and drawn on screen. This is required to - //ensure that the preparation animation is properly flushed so that - //the active state picks up from there. DO NOT REMOVE THIS LINE. - //DO NOT OPTIMIZE THIS LINE. THE MINIFIER WILL REMOVE IT OTHERWISE WHICH - //WILL RESULT IN AN UNPREDICTABLE BUG THAT IS VERY HARD TO TRACK DOWN AND - //WILL TAKE YEARS AWAY FROM YOUR LIFE. - if (domNode) { - if (!domNode.nodeType && domNode instanceof jqLite) { - domNode = domNode[0]; - } - } else { - domNode = $document[0].body; - } - return domNode.offsetWidth + 1; - }; - }]; - }; - - var APPLICATION_JSON = 'application/json'; - var CONTENT_TYPE_APPLICATION_JSON = { - 'Content-Type': APPLICATION_JSON + ';charset=utf-8' - }; - var JSON_START = /^\[|^\{(?!\{)/; - var JSON_ENDS = { - '[': /]$/, - '{': /}$/ - }; - var JSON_PROTECTION_PREFIX = /^\)]\}',?\n/; - var $httpMinErr = minErr('$http'); - - function serializeValue(v) { - if (isObject(v)) { - return isDate(v) ? v.toISOString() : toJson(v); - } - return v; - } - - - /** @this */ - function $HttpParamSerializerProvider() { - /** - * @ngdoc service - * @name $httpParamSerializer - * @description - * - * Default {@link $http `$http`} params serializer that converts objects to strings - * according to the following rules: - * - * * `{'foo': 'bar'}` results in `foo=bar` - * * `{'foo': Date.now()}` results in `foo=2015-04-01T09%3A50%3A49.262Z` (`toISOString()` and encoded representation of a Date object) - * * `{'foo': ['bar', 'baz']}` results in `foo=bar&foo=baz` (repeated key for each array element) - * * `{'foo': {'bar':'baz'}}` results in `foo=%7B%22bar%22%3A%22baz%22%7D` (stringified and encoded representation of an object) - * - * Note that serializer will sort the request parameters alphabetically. - */ - - this.$get = function () { - return function ngParamSerializer(params) { - if (!params) return ''; - var parts = []; - forEachSorted(params, function (value, key) { - if (value === null || isUndefined(value) || isFunction(value)) return; - if (isArray(value)) { - forEach(value, function (v) { - parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(v))); - }); - } else { - parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(value))); - } - }); - - return parts.join('&'); - }; - }; - } - - /** @this */ - function $HttpParamSerializerJQLikeProvider() { - /** - * @ngdoc service - * @name $httpParamSerializerJQLike - * - * @description - * - * Alternative {@link $http `$http`} params serializer that follows - * jQuery's [`param()`](http://api.jquery.com/jquery.param/) method logic. - * The serializer will also sort the params alphabetically. - * - * To use it for serializing `$http` request parameters, set it as the `paramSerializer` property: - * - * ```js - * $http({ - * url: myUrl, - * method: 'GET', - * params: myParams, - * paramSerializer: '$httpParamSerializerJQLike' - * }); - * ``` - * - * It is also possible to set it as the default `paramSerializer` in the - * {@link $httpProvider#defaults `$httpProvider`}. - * - * Additionally, you can inject the serializer and use it explicitly, for example to serialize - * form data for submission: - * - * ```js - * .controller(function($http, $httpParamSerializerJQLike) { - * //... - * - * $http({ - * url: myUrl, - * method: 'POST', - * data: $httpParamSerializerJQLike(myData), - * headers: { - * 'Content-Type': 'application/x-www-form-urlencoded' - * } - * }); - * - * }); - * ``` - * - */ - this.$get = function () { - return function jQueryLikeParamSerializer(params) { - if (!params) return ''; - var parts = []; - serialize(params, '', true); - return parts.join('&'); - - function serialize(toSerialize, prefix, topLevel) { - if (isArray(toSerialize)) { - forEach(toSerialize, function (value, index) { - serialize(value, prefix + '[' + (isObject(value) ? index : '') + ']'); - }); - } else if (isObject(toSerialize) && !isDate(toSerialize)) { - forEachSorted(toSerialize, function (value, key) { - serialize(value, prefix + - (topLevel ? '' : '[') + - key + - (topLevel ? '' : ']')); - }); - } else { - if (isFunction(toSerialize)) { - toSerialize = toSerialize(); - } - parts.push(encodeUriQuery(prefix) + '=' + - (toSerialize == null ? '' : encodeUriQuery(serializeValue(toSerialize)))); - } - } - }; - }; - } - - function defaultHttpResponseTransform(data, headers) { - if (isString(data)) { - // Strip json vulnerability protection prefix and trim whitespace - var tempData = data.replace(JSON_PROTECTION_PREFIX, '').trim(); - - if (tempData) { - var contentType = headers('Content-Type'); - var hasJsonContentType = contentType && (contentType.indexOf(APPLICATION_JSON) === 0); - - if (hasJsonContentType || isJsonLike(tempData)) { - try { - data = fromJson(tempData); - } catch (e) { - if (!hasJsonContentType) { - return data; - } - throw $httpMinErr('baddata', 'Data must be a valid JSON object. Received: "{0}". ' + - 'Parse error: "{1}"', data, e); - } - } - } - } - - return data; - } - - function isJsonLike(str) { - var jsonStart = str.match(JSON_START); - return jsonStart && JSON_ENDS[jsonStart[0]].test(str); - } - - /** - * Parse headers into key value object - * - * @param {string} headers Raw headers as a string - * @returns {Object} Parsed headers as key value object - */ - function parseHeaders(headers) { - var parsed = createMap(), - i; - - function fillInParsed(key, val) { - if (key) { - parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; - } - } - - if (isString(headers)) { - forEach(headers.split('\n'), function (line) { - i = line.indexOf(':'); - fillInParsed(lowercase(trim(line.substr(0, i))), trim(line.substr(i + 1))); - }); - } else if (isObject(headers)) { - forEach(headers, function (headerVal, headerKey) { - fillInParsed(lowercase(headerKey), trim(headerVal)); - }); - } - - return parsed; - } - - - /** - * Returns a function that provides access to parsed headers. - * - * Headers are lazy parsed when first requested. - * @see parseHeaders - * - * @param {(string|Object)} headers Headers to provide access to. - * @returns {function(string=)} Returns a getter function which if called with: - * - * - if called with an argument returns a single header value or null - * - if called with no arguments returns an object containing all headers. - */ - function headersGetter(headers) { - var headersObj; - - return function (name) { - if (!headersObj) headersObj = parseHeaders(headers); - - if (name) { - var value = headersObj[lowercase(name)]; - if (value === undefined) { - value = null; - } - return value; - } - - return headersObj; - }; - } - - - /** - * Chain all given functions - * - * This function is used for both request and response transforming - * - * @param {*} data Data to transform. - * @param {function(string=)} headers HTTP headers getter fn. - * @param {number} status HTTP status code of the response. - * @param {(Function|Array.)} fns Function or an array of functions. - * @returns {*} Transformed data. - */ - function transformData(data, headers, status, fns) { - if (isFunction(fns)) { - return fns(data, headers, status); - } - - forEach(fns, function (fn) { - data = fn(data, headers, status); - }); - - return data; - } - - - function isSuccess(status) { - return 200 <= status && status < 300; - } - - - /** - * @ngdoc provider - * @name $httpProvider - * @this - * - * @description - * Use `$httpProvider` to change the default behavior of the {@link ng.$http $http} service. - */ - function $HttpProvider() { - /** - * @ngdoc property - * @name $httpProvider#defaults - * @description - * - * Object containing default values for all {@link ng.$http $http} requests. - * - * - **`defaults.cache`** - {boolean|Object} - A boolean value or object created with - * {@link ng.$cacheFactory `$cacheFactory`} to enable or disable caching of HTTP responses - * by default. See {@link $http#caching $http Caching} for more information. - * - * - **`defaults.headers`** - {Object} - Default headers for all $http requests. - * Refer to {@link ng.$http#setting-http-headers $http} for documentation on - * setting default headers. - * - **`defaults.headers.common`** - * - **`defaults.headers.post`** - * - **`defaults.headers.put`** - * - **`defaults.headers.patch`** - * - * - **`defaults.jsonpCallbackParam`** - `{string}` - the name of the query parameter that passes the name of the - * callback in a JSONP request. The value of this parameter will be replaced with the expression generated by the - * {@link $jsonpCallbacks} service. Defaults to `'callback'`. - * - * - **`defaults.paramSerializer`** - `{string|function(Object):string}` - A function - * used to the prepare string representation of request parameters (specified as an object). - * If specified as string, it is interpreted as a function registered with the {@link auto.$injector $injector}. - * Defaults to {@link ng.$httpParamSerializer $httpParamSerializer}. - * - * - **`defaults.transformRequest`** - - * `{Array|function(data, headersGetter)}` - - * An array of functions (or a single function) which are applied to the request data. - * By default, this is an array with one request transformation function: - * - * - If the `data` property of the request configuration object contains an object, serialize it - * into JSON format. - * - * - **`defaults.transformResponse`** - - * `{Array|function(data, headersGetter, status)}` - - * An array of functions (or a single function) which are applied to the response data. By default, - * this is an array which applies one response transformation function that does two things: - * - * - If XSRF prefix is detected, strip it - * (see {@link ng.$http#security-considerations Security Considerations in the $http docs}). - * - If the `Content-Type` is `application/json` or the response looks like JSON, - * deserialize it using a JSON parser. - * - * - **`defaults.xsrfCookieName`** - {string} - Name of cookie containing the XSRF token. - * Defaults value is `'XSRF-TOKEN'`. - * - * - **`defaults.xsrfHeaderName`** - {string} - Name of HTTP header to populate with the - * XSRF token. Defaults value is `'X-XSRF-TOKEN'`. - * - */ - var defaults = this.defaults = { - // transform incoming response data - transformResponse: [defaultHttpResponseTransform], - - // transform outgoing request data - transformRequest: [function (d) { - return isObject(d) && !isFile(d) && !isBlob(d) && !isFormData(d) ? toJson(d) : d; - }], - - // default headers - headers: { - common: { - 'Accept': 'application/json, text/plain, */*' - }, - post: shallowCopy(CONTENT_TYPE_APPLICATION_JSON), - put: shallowCopy(CONTENT_TYPE_APPLICATION_JSON), - patch: shallowCopy(CONTENT_TYPE_APPLICATION_JSON) - }, - - xsrfCookieName: 'XSRF-TOKEN', - xsrfHeaderName: 'X-XSRF-TOKEN', - - paramSerializer: '$httpParamSerializer', - - jsonpCallbackParam: 'callback' - }; - - var useApplyAsync = false; - /** - * @ngdoc method - * @name $httpProvider#useApplyAsync - * @description - * - * Configure $http service to combine processing of multiple http responses received at around - * the same time via {@link ng.$rootScope.Scope#$applyAsync $rootScope.$applyAsync}. This can result in - * significant performance improvement for bigger applications that make many HTTP requests - * concurrently (common during application bootstrap). - * - * Defaults to false. If no value is specified, returns the current configured value. - * - * @param {boolean=} value If true, when requests are loaded, they will schedule a deferred - * "apply" on the next tick, giving time for subsequent requests in a roughly ~10ms window - * to load and share the same digest cycle. - * - * @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining. - * otherwise, returns the current configured value. - */ - this.useApplyAsync = function (value) { - if (isDefined(value)) { - useApplyAsync = !!value; - return this; - } - return useApplyAsync; - }; - - /** - * @ngdoc property - * @name $httpProvider#interceptors - * @description - * - * Array containing service factories for all synchronous or asynchronous {@link ng.$http $http} - * pre-processing of request or postprocessing of responses. - * - * These service factories are ordered by request, i.e. they are applied in the same order as the - * array, on request, but reverse order, on response. - * - * {@link ng.$http#interceptors Interceptors detailed info} - */ - var interceptorFactories = this.interceptors = []; - - /** - * @ngdoc property - * @name $httpProvider#xsrfTrustedOrigins - * @description - * - * Array containing URLs whose origins are trusted to receive the XSRF token. See the - * {@link ng.$http#security-considerations Security Considerations} sections for more details on - * XSRF. - * - * **Note:** An "origin" consists of the [URI scheme](https://en.wikipedia.org/wiki/URI_scheme), - * the [hostname](https://en.wikipedia.org/wiki/Hostname) and the - * [port number](https://en.wikipedia.org/wiki/Port_(computer_networking). For `http:` and - * `https:`, the port number can be omitted if using th default ports (80 and 443 respectively). - * Examples: `http://example.com`, `https://api.example.com:9876` - * - *
- * It is not possible to trust specific URLs/paths. The `path`, `query` and `fragment` parts - * of a URL will be ignored. For example, `https://foo.com/path/bar?query=baz#fragment` will be - * treated as `https://foo.com`, meaning that **all** requests to URLs starting with - * `https://foo.com/` will include the XSRF token. - *
- * - * @example - * - * ```js - * // App served from `https://example.com/`. - * angular. - * module('xsrfTrustedOriginsExample', []). - * config(['$httpProvider', function($httpProvider) { - * $httpProvider.xsrfTrustedOrigins.push('https://api.example.com'); - * }]). - * run(['$http', function($http) { - * // The XSRF token will be sent. - * $http.get('https://api.example.com/preferences').then(...); - * - * // The XSRF token will NOT be sent. - * $http.get('https://stats.example.com/activity').then(...); - * }]); - * ``` - */ - var xsrfTrustedOrigins = this.xsrfTrustedOrigins = []; - - /** - * @ngdoc property - * @name $httpProvider#xsrfWhitelistedOrigins - * @description - * - * @deprecated - * sinceVersion="1.8.1" - * - * This property is deprecated. Use {@link $httpProvider#xsrfTrustedOrigins xsrfTrustedOrigins} - * instead. - */ - Object.defineProperty(this, 'xsrfWhitelistedOrigins', { - get: function () { - return this.xsrfTrustedOrigins; - }, - set: function (origins) { - this.xsrfTrustedOrigins = origins; - } - }); - - this.$get = ['$browser', '$httpBackend', '$$cookieReader', '$cacheFactory', '$rootScope', '$q', '$injector', '$sce', - function ($browser, $httpBackend, $$cookieReader, $cacheFactory, $rootScope, $q, $injector, $sce) { - - var defaultCache = $cacheFactory('$http'); - - /** - * Make sure that default param serializer is exposed as a function - */ - defaults.paramSerializer = isString(defaults.paramSerializer) ? - $injector.get(defaults.paramSerializer) : defaults.paramSerializer; - - /** - * Interceptors stored in reverse order. Inner interceptors before outer interceptors. - * The reversal is needed so that we can build up the interception chain around the - * server request. - */ - var reversedInterceptors = []; - - forEach(interceptorFactories, function (interceptorFactory) { - reversedInterceptors.unshift(isString(interceptorFactory) ? - $injector.get(interceptorFactory) : $injector.invoke(interceptorFactory)); - }); - - /** - * A function to check request URLs against a list of allowed origins. - */ - var urlIsAllowedOrigin = urlIsAllowedOriginFactory(xsrfTrustedOrigins); - - /** - * @ngdoc service - * @kind function - * @name $http - * @requires ng.$httpBackend - * @requires $cacheFactory - * @requires $rootScope - * @requires $q - * @requires $injector - * - * @description - * The `$http` service is a core AngularJS service that facilitates communication with the remote - * HTTP servers via the browser's [XMLHttpRequest](https://developer.mozilla.org/en/xmlhttprequest) - * object or via [JSONP](http://en.wikipedia.org/wiki/JSONP). - * - * For unit testing applications that use `$http` service, see - * {@link ngMock.$httpBackend $httpBackend mock}. - * - * For a higher level of abstraction, please check out the {@link ngResource.$resource - * $resource} service. - * - * The $http API is based on the {@link ng.$q deferred/promise APIs} exposed by - * the $q service. While for simple usage patterns this doesn't matter much, for advanced usage - * it is important to familiarize yourself with these APIs and the guarantees they provide. - * - * - * ## General usage - * The `$http` service is a function which takes a single argument — a {@link $http#usage configuration object} — - * that is used to generate an HTTP request and returns a {@link ng.$q promise} that is - * resolved (request success) or rejected (request failure) with a - * {@link ng.$http#$http-returns response} object. - * - * ```js - * // Simple GET request example: - * $http({ - * method: 'GET', - * url: '/someUrl' - * }).then(function successCallback(response) { - * // this callback will be called asynchronously - * // when the response is available - * }, function errorCallback(response) { - * // called asynchronously if an error occurs - * // or server returns response with an error status. - * }); - * ``` - * - * - * ## Shortcut methods - * - * Shortcut methods are also available. All shortcut methods require passing in the URL, and - * request data must be passed in for POST/PUT requests. An optional config can be passed as the - * last argument. - * - * ```js - * $http.get('/someUrl', config).then(successCallback, errorCallback); - * $http.post('/someUrl', data, config).then(successCallback, errorCallback); - * ``` - * - * Complete list of shortcut methods: - * - * - {@link ng.$http#get $http.get} - * - {@link ng.$http#head $http.head} - * - {@link ng.$http#post $http.post} - * - {@link ng.$http#put $http.put} - * - {@link ng.$http#delete $http.delete} - * - {@link ng.$http#jsonp $http.jsonp} - * - {@link ng.$http#patch $http.patch} - * - * - * ## Writing Unit Tests that use $http - * When unit testing (using {@link ngMock ngMock}), it is necessary to call - * {@link ngMock.$httpBackend#flush $httpBackend.flush()} to flush each pending - * request using trained responses. - * - * ``` - * $httpBackend.expectGET(...); - * $http.get(...); - * $httpBackend.flush(); - * ``` - * - * ## Setting HTTP Headers - * - * The $http service will automatically add certain HTTP headers to all requests. These defaults - * can be fully configured by accessing the `$httpProvider.defaults.headers` configuration - * object, which currently contains this default configuration: - * - * - `$httpProvider.defaults.headers.common` (headers that are common for all requests): - * - Accept: application/json, text/plain, \*/\* - * - `$httpProvider.defaults.headers.post`: (header defaults for POST requests) - * - `Content-Type: application/json` - * - `$httpProvider.defaults.headers.put` (header defaults for PUT requests) - * - `Content-Type: application/json` - * - * To add or overwrite these defaults, simply add or remove a property from these configuration - * objects. To add headers for an HTTP method other than POST or PUT, simply add a new object - * with the lowercased HTTP method name as the key, e.g. - * `$httpProvider.defaults.headers.get = { 'My-Header' : 'value' }`. - * - * The defaults can also be set at runtime via the `$http.defaults` object in the same - * fashion. For example: - * - * ``` - * module.run(function($http) { - * $http.defaults.headers.common.Authorization = 'Basic YmVlcDpib29w'; - * }); - * ``` - * - * In addition, you can supply a `headers` property in the config object passed when - * calling `$http(config)`, which overrides the defaults without changing them globally. - * - * To explicitly remove a header automatically added via $httpProvider.defaults.headers on a per request basis, - * Use the `headers` property, setting the desired header to `undefined`. For example: - * - * ```js - * var req = { - * method: 'POST', - * url: 'http://example.com', - * headers: { - * 'Content-Type': undefined - * }, - * data: { test: 'test' } - * } - * - * $http(req).then(function(){...}, function(){...}); - * ``` - * - * ## Transforming Requests and Responses - * - * Both requests and responses can be transformed using transformation functions: `transformRequest` - * and `transformResponse`. These properties can be a single function that returns - * the transformed value (`function(data, headersGetter, status)`) or an array of such transformation functions, - * which allows you to `push` or `unshift` a new transformation function into the transformation chain. - * - *
- * **Note:** AngularJS does not make a copy of the `data` parameter before it is passed into the `transformRequest` pipeline. - * That means changes to the properties of `data` are not local to the transform function (since Javascript passes objects by reference). - * For example, when calling `$http.get(url, $scope.myObject)`, modifications to the object's properties in a transformRequest - * function will be reflected on the scope and in any templates where the object is data-bound. - * To prevent this, transform functions should have no side-effects. - * If you need to modify properties, it is recommended to make a copy of the data, or create new object to return. - *
- * - * ### Default Transformations - * - * The `$httpProvider` provider and `$http` service expose `defaults.transformRequest` and - * `defaults.transformResponse` properties. If a request does not provide its own transformations - * then these will be applied. - * - * You can augment or replace the default transformations by modifying these properties by adding to or - * replacing the array. - * - * AngularJS provides the following default transformations: - * - * Request transformations (`$httpProvider.defaults.transformRequest` and `$http.defaults.transformRequest`) is - * an array with one function that does the following: - * - * - If the `data` property of the request configuration object contains an object, serialize it - * into JSON format. - * - * Response transformations (`$httpProvider.defaults.transformResponse` and `$http.defaults.transformResponse`) is - * an array with one function that does the following: - * - * - If XSRF prefix is detected, strip it (see Security Considerations section below). - * - If the `Content-Type` is `application/json` or the response looks like JSON, - * deserialize it using a JSON parser. - * - * - * ### Overriding the Default Transformations Per Request - * - * If you wish to override the request/response transformations only for a single request then provide - * `transformRequest` and/or `transformResponse` properties on the configuration object passed - * into `$http`. - * - * Note that if you provide these properties on the config object the default transformations will be - * overwritten. If you wish to augment the default transformations then you must include them in your - * local transformation array. - * - * The following code demonstrates adding a new response transformation to be run after the default response - * transformations have been run. - * - * ```js - * function appendTransform(defaults, transform) { - * - * // We can't guarantee that the default transformation is an array - * defaults = angular.isArray(defaults) ? defaults : [defaults]; - * - * // Append the new transformation to the defaults - * return defaults.concat(transform); - * } - * - * $http({ - * url: '...', - * method: 'GET', - * transformResponse: appendTransform($http.defaults.transformResponse, function(value) { - * return doTransform(value); - * }) - * }); - * ``` - * - * - * ## Caching - * - * {@link ng.$http `$http`} responses are not cached by default. To enable caching, you must - * set the config.cache value or the default cache value to TRUE or to a cache object (created - * with {@link ng.$cacheFactory `$cacheFactory`}). If defined, the value of config.cache takes - * precedence over the default cache value. - * - * In order to: - * * cache all responses - set the default cache value to TRUE or to a cache object - * * cache a specific response - set config.cache value to TRUE or to a cache object - * - * If caching is enabled, but neither the default cache nor config.cache are set to a cache object, - * then the default `$cacheFactory("$http")` object is used. - * - * The default cache value can be set by updating the - * {@link ng.$http#defaults `$http.defaults.cache`} property or the - * {@link $httpProvider#defaults `$httpProvider.defaults.cache`} property. - * - * When caching is enabled, {@link ng.$http `$http`} stores the response from the server using - * the relevant cache object. The next time the same request is made, the response is returned - * from the cache without sending a request to the server. - * - * Take note that: - * - * * Only GET and JSONP requests are cached. - * * The cache key is the request URL including search parameters; headers are not considered. - * * Cached responses are returned asynchronously, in the same way as responses from the server. - * * If multiple identical requests are made using the same cache, which is not yet populated, - * one request will be made to the server and remaining requests will return the same response. - * * A cache-control header on the response does not affect if or how responses are cached. - * - * - * ## Interceptors - * - * Before you start creating interceptors, be sure to understand the - * {@link ng.$q $q and deferred/promise APIs}. - * - * For purposes of global error handling, authentication, or any kind of synchronous or - * asynchronous pre-processing of request or postprocessing of responses, it is desirable to be - * able to intercept requests before they are handed to the server and - * responses before they are handed over to the application code that - * initiated these requests. The interceptors leverage the {@link ng.$q - * promise APIs} to fulfill this need for both synchronous and asynchronous pre-processing. - * - * The interceptors are service factories that are registered with the `$httpProvider` by - * adding them to the `$httpProvider.interceptors` array. The factory is called and - * injected with dependencies (if specified) and returns the interceptor. - * - * There are two kinds of interceptors (and two kinds of rejection interceptors): - * - * * `request`: interceptors get called with a http {@link $http#usage config} object. The function is free to - * modify the `config` object or create a new one. The function needs to return the `config` - * object directly, or a promise containing the `config` or a new `config` object. - * * `requestError`: interceptor gets called when a previous interceptor threw an error or - * resolved with a rejection. - * * `response`: interceptors get called with http `response` object. The function is free to - * modify the `response` object or create a new one. The function needs to return the `response` - * object directly, or as a promise containing the `response` or a new `response` object. - * * `responseError`: interceptor gets called when a previous interceptor threw an error or - * resolved with a rejection. - * - * - * ```js - * // register the interceptor as a service - * $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) { - * return { - * // optional method - * 'request': function(config) { - * // do something on success - * return config; - * }, - * - * // optional method - * 'requestError': function(rejection) { - * // do something on error - * if (canRecover(rejection)) { - * return responseOrNewPromise - * } - * return $q.reject(rejection); - * }, - * - * - * - * // optional method - * 'response': function(response) { - * // do something on success - * return response; - * }, - * - * // optional method - * 'responseError': function(rejection) { - * // do something on error - * if (canRecover(rejection)) { - * return responseOrNewPromise - * } - * return $q.reject(rejection); - * } - * }; - * }); - * - * $httpProvider.interceptors.push('myHttpInterceptor'); - * - * - * // alternatively, register the interceptor via an anonymous factory - * $httpProvider.interceptors.push(function($q, dependency1, dependency2) { - * return { - * 'request': function(config) { - * // same as above - * }, - * - * 'response': function(response) { - * // same as above - * } - * }; - * }); - * ``` - * - * ## Security Considerations - * - * When designing web applications, consider security threats from: - * - * - [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx) - * - [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery) - * - * Both server and the client must cooperate in order to eliminate these threats. AngularJS comes - * pre-configured with strategies that address these issues, but for this to work backend server - * cooperation is required. - * - * ### JSON Vulnerability Protection - * - * A [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx) - * allows third party website to turn your JSON resource URL into - * [JSONP](http://en.wikipedia.org/wiki/JSONP) request under some conditions. To - * counter this your server can prefix all JSON requests with following string `")]}',\n"`. - * AngularJS will automatically strip the prefix before processing it as JSON. - * - * For example if your server needs to return: - * ```js - * ['one','two'] - * ``` - * - * which is vulnerable to attack, your server can return: - * ```js - * )]}', - * ['one','two'] - * ``` - * - * AngularJS will strip the prefix, before processing the JSON. - * - * - * ### Cross Site Request Forgery (XSRF) Protection - * - * [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery) is an attack technique by - * which the attacker can trick an authenticated user into unknowingly executing actions on your - * website. AngularJS provides a mechanism to counter XSRF. When performing XHR requests, the - * $http service reads a token from a cookie (by default, `XSRF-TOKEN`) and sets it as an HTTP - * header (by default `X-XSRF-TOKEN`). Since only JavaScript that runs on your domain could read - * the cookie, your server can be assured that the XHR came from JavaScript running on your - * domain. - * - * To take advantage of this, your server needs to set a token in a JavaScript readable session - * cookie called `XSRF-TOKEN` on the first HTTP GET request. On subsequent XHR requests the - * server can verify that the cookie matches the `X-XSRF-TOKEN` HTTP header, and therefore be - * sure that only JavaScript running on your domain could have sent the request. The token must - * be unique for each user and must be verifiable by the server (to prevent the JavaScript from - * making up its own tokens). We recommend that the token is a digest of your site's - * authentication cookie with a [salt](https://en.wikipedia.org/wiki/Salt_(cryptography)) - * for added security. - * - * The header will — by default — **not** be set for cross-domain requests. This - * prevents unauthorized servers (e.g. malicious or compromised 3rd-party APIs) from gaining - * access to your users' XSRF tokens and exposing them to Cross Site Request Forgery. If you - * want to, you can trust additional origins to also receive the XSRF token, by adding them - * to {@link ng.$httpProvider#xsrfTrustedOrigins xsrfTrustedOrigins}. This might be - * useful, for example, if your application, served from `example.com`, needs to access your API - * at `api.example.com`. - * See {@link ng.$httpProvider#xsrfTrustedOrigins $httpProvider.xsrfTrustedOrigins} for - * more details. - * - *
- * **Warning**
- * Only trusted origins that you have control over and make sure you understand the - * implications of doing so. - *
- * - * The name of the cookie and the header can be specified using the `xsrfCookieName` and - * `xsrfHeaderName` properties of either `$httpProvider.defaults` at config-time, - * `$http.defaults` at run-time, or the per-request config object. - * - * In order to prevent collisions in environments where multiple AngularJS apps share the - * same domain or subdomain, we recommend that each application uses a unique cookie name. - * - * - * @param {object} config Object describing the request to be made and how it should be - * processed. The object has following properties: - * - * - **method** – `{string}` – HTTP method (e.g. 'GET', 'POST', etc) - * - **url** – `{string|TrustedObject}` – Absolute or relative URL of the resource that is being requested; - * or an object created by a call to `$sce.trustAsResourceUrl(url)`. - * - **params** – `{Object.}` – Map of strings or objects which will be serialized - * with the `paramSerializer` and appended as GET parameters. - * - **data** – `{string|Object}` – Data to be sent as the request message data. - * - **headers** – `{Object}` – Map of strings or functions which return strings representing - * HTTP headers to send to the server. If the return value of a function is null, the - * header will not be sent. Functions accept a config object as an argument. - * - **eventHandlers** - `{Object}` - Event listeners to be bound to the XMLHttpRequest object. - * To bind events to the XMLHttpRequest upload object, use `uploadEventHandlers`. - * The handler will be called in the context of a `$apply` block. - * - **uploadEventHandlers** - `{Object}` - Event listeners to be bound to the XMLHttpRequest upload - * object. To bind events to the XMLHttpRequest object, use `eventHandlers`. - * The handler will be called in the context of a `$apply` block. - * - **xsrfHeaderName** – `{string}` – Name of HTTP header to populate with the XSRF token. - * - **xsrfCookieName** – `{string}` – Name of cookie containing the XSRF token. - * - **transformRequest** – - * `{function(data, headersGetter)|Array.}` – - * transform function or an array of such functions. The transform function takes the http - * request body and headers and returns its transformed (typically serialized) version. - * See {@link ng.$http#overriding-the-default-transformations-per-request - * Overriding the Default Transformations} - * - **transformResponse** – - * `{function(data, headersGetter, status)|Array.}` – - * transform function or an array of such functions. The transform function takes the http - * response body, headers and status and returns its transformed (typically deserialized) version. - * See {@link ng.$http#overriding-the-default-transformations-per-request - * Overriding the Default Transformations} - * - **paramSerializer** - `{string|function(Object):string}` - A function used to - * prepare the string representation of request parameters (specified as an object). - * If specified as string, it is interpreted as function registered with the - * {@link $injector $injector}, which means you can create your own serializer - * by registering it as a {@link auto.$provide#service service}. - * The default serializer is the {@link $httpParamSerializer $httpParamSerializer}; - * alternatively, you can use the {@link $httpParamSerializerJQLike $httpParamSerializerJQLike} - * - **cache** – `{boolean|Object}` – A boolean value or object created with - * {@link ng.$cacheFactory `$cacheFactory`} to enable or disable caching of the HTTP response. - * See {@link $http#caching $http Caching} for more information. - * - **timeout** – `{number|Promise}` – timeout in milliseconds, or {@link ng.$q promise} - * that should abort the request when resolved. - * - * A numerical timeout or a promise returned from {@link ng.$timeout $timeout}, will set - * the `xhrStatus` in the {@link $http#$http-returns response} to "timeout", and any other - * resolved promise will set it to "abort", following standard XMLHttpRequest behavior. - * - * - **withCredentials** - `{boolean}` - whether to set the `withCredentials` flag on the - * XHR object. See [requests with credentials](https://developer.mozilla.org/docs/Web/HTTP/Access_control_CORS#Requests_with_credentials) - * for more information. - * - **responseType** - `{string}` - see - * [XMLHttpRequest.responseType](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype). - * - * @returns {HttpPromise} A {@link ng.$q `Promise}` that will be resolved (request success) - * or rejected (request failure) with a response object. - * - * The response object has these properties: - * - * - **data** – `{string|Object}` – The response body transformed with - * the transform functions. - * - **status** – `{number}` – HTTP status code of the response. - * - **headers** – `{function([headerName])}` – Header getter function. - * - **config** – `{Object}` – The configuration object that was used - * to generate the request. - * - **statusText** – `{string}` – HTTP status text of the response. - * - **xhrStatus** – `{string}` – Status of the XMLHttpRequest - * (`complete`, `error`, `timeout` or `abort`). - * - * - * A response status code between 200 and 299 is considered a success status - * and will result in the success callback being called. Any response status - * code outside of that range is considered an error status and will result - * in the error callback being called. - * Also, status codes less than -1 are normalized to zero. -1 usually means - * the request was aborted, e.g. using a `config.timeout`. More information - * about the status might be available in the `xhrStatus` property. - * - * Note that if the response is a redirect, XMLHttpRequest will transparently - * follow it, meaning that the outcome (success or error) will be determined - * by the final response status code. - * - * - * @property {Array.} pendingRequests Array of config objects for currently pending - * requests. This is primarily meant to be used for debugging purposes. - * - * - * @example - - -
- - -
- - - -
http status code: {{status}}
-
http response data: {{data}}
-
-
- - angular.module('httpExample', []) - .config(['$sceDelegateProvider', function($sceDelegateProvider) { - // We must add the JSONP endpoint that we are using to the trusted list to show that we trust it - $sceDelegateProvider.trustedResourceUrlList([ - 'self', - 'https://angularjs.org/**' - ]); - }]) - .controller('FetchController', ['$scope', '$http', '$templateCache', - function($scope, $http, $templateCache) { - $scope.method = 'GET'; - $scope.url = 'http-hello.html'; - - $scope.fetch = function() { - $scope.code = null; - $scope.response = null; - - $http({method: $scope.method, url: $scope.url, cache: $templateCache}). - then(function(response) { - $scope.status = response.status; - $scope.data = response.data; - }, function(response) { - $scope.data = response.data || 'Request failed'; - $scope.status = response.status; - }); - }; - - $scope.updateModel = function(method, url) { - $scope.method = method; - $scope.url = url; - }; - }]); - - - Hello, $http! - - - var status = element(by.binding('status')); - var data = element(by.binding('data')); - var fetchBtn = element(by.id('fetchbtn')); - var sampleGetBtn = element(by.id('samplegetbtn')); - var invalidJsonpBtn = element(by.id('invalidjsonpbtn')); - - it('should make an xhr GET request', function() { - sampleGetBtn.click(); - fetchBtn.click(); - expect(status.getText()).toMatch('200'); - expect(data.getText()).toMatch(/Hello, \$http!/); - }); - -// Commented out due to flakes. See https://github.com/angular/angular.js/issues/9185 -// it('should make a JSONP request to angularjs.org', function() { -// var sampleJsonpBtn = element(by.id('samplejsonpbtn')); -// sampleJsonpBtn.click(); -// fetchBtn.click(); -// expect(status.getText()).toMatch('200'); -// expect(data.getText()).toMatch(/Super Hero!/); -// }); - - it('should make JSONP request to invalid URL and invoke the error handler', - function() { - invalidJsonpBtn.click(); - fetchBtn.click(); - expect(status.getText()).toMatch('0'); - expect(data.getText()).toMatch('Request failed'); - }); - -
- */ - function $http(requestConfig) { - - if (!isObject(requestConfig)) { - throw minErr('$http')('badreq', 'Http request configuration must be an object. Received: {0}', requestConfig); - } - - if (!isString($sce.valueOf(requestConfig.url))) { - throw minErr('$http')('badreq', 'Http request configuration url must be a string or a $sce trusted object. Received: {0}', requestConfig.url); - } - - var config = extend({ - method: 'get', - transformRequest: defaults.transformRequest, - transformResponse: defaults.transformResponse, - paramSerializer: defaults.paramSerializer, - jsonpCallbackParam: defaults.jsonpCallbackParam - }, requestConfig); - - config.headers = mergeHeaders(requestConfig); - config.method = uppercase(config.method); - config.paramSerializer = isString(config.paramSerializer) ? - $injector.get(config.paramSerializer) : config.paramSerializer; - - $browser.$$incOutstandingRequestCount('$http'); - - var requestInterceptors = []; - var responseInterceptors = []; - var promise = $q.resolve(config); - - // apply interceptors - forEach(reversedInterceptors, function (interceptor) { - if (interceptor.request || interceptor.requestError) { - requestInterceptors.unshift(interceptor.request, interceptor.requestError); - } - if (interceptor.response || interceptor.responseError) { - responseInterceptors.push(interceptor.response, interceptor.responseError); - } - }); - - promise = chainInterceptors(promise, requestInterceptors); - promise = promise.then(serverRequest); - promise = chainInterceptors(promise, responseInterceptors); - promise = promise.finally(completeOutstandingRequest); - - return promise; - - - function chainInterceptors(promise, interceptors) { - for (var i = 0, ii = interceptors.length; i < ii;) { - var thenFn = interceptors[i++]; - var rejectFn = interceptors[i++]; - - promise = promise.then(thenFn, rejectFn); - } - - interceptors.length = 0; - - return promise; - } - - function completeOutstandingRequest() { - $browser.$$completeOutstandingRequest(noop, '$http'); - } - - function executeHeaderFns(headers, config) { - var headerContent, processedHeaders = {}; - - forEach(headers, function (headerFn, header) { - if (isFunction(headerFn)) { - headerContent = headerFn(config); - if (headerContent != null) { - processedHeaders[header] = headerContent; - } - } else { - processedHeaders[header] = headerFn; - } - }); - - return processedHeaders; - } - - function mergeHeaders(config) { - var defHeaders = defaults.headers, - reqHeaders = extend({}, config.headers), - defHeaderName, lowercaseDefHeaderName, reqHeaderName; - - defHeaders = extend({}, defHeaders.common, defHeaders[lowercase(config.method)]); - - // using for-in instead of forEach to avoid unnecessary iteration after header has been found - defaultHeadersIteration: - for (defHeaderName in defHeaders) { - lowercaseDefHeaderName = lowercase(defHeaderName); - - for (reqHeaderName in reqHeaders) { - if (lowercase(reqHeaderName) === lowercaseDefHeaderName) { - continue defaultHeadersIteration; - } - } - - reqHeaders[defHeaderName] = defHeaders[defHeaderName]; - } - - // execute if header value is a function for merged headers - return executeHeaderFns(reqHeaders, shallowCopy(config)); - } - - function serverRequest(config) { - var headers = config.headers; - var reqData = transformData(config.data, headersGetter(headers), undefined, config.transformRequest); - - // strip content-type if data is undefined - if (isUndefined(reqData)) { - forEach(headers, function (value, header) { - if (lowercase(header) === 'content-type') { - delete headers[header]; - } - }); - } - - if (isUndefined(config.withCredentials) && !isUndefined(defaults.withCredentials)) { - config.withCredentials = defaults.withCredentials; - } - - // send request - return sendReq(config, reqData).then(transformResponse, transformResponse); - } - - function transformResponse(response) { - // make a copy since the response must be cacheable - var resp = extend({}, response); - resp.data = transformData(response.data, response.headers, response.status, - config.transformResponse); - return (isSuccess(response.status)) ? - resp : - $q.reject(resp); - } - } - - $http.pendingRequests = []; - - /** - * @ngdoc method - * @name $http#get - * - * @description - * Shortcut method to perform `GET` request. - * - * @param {string|TrustedObject} url Absolute or relative URL of the resource that is being requested; - * or an object created by a call to `$sce.trustAsResourceUrl(url)`. - * @param {Object=} config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}. - * @returns {HttpPromise} A Promise that will be resolved or rejected with a response object. - * See {@link ng.$http#$http-returns `$http()` return value}. - */ - - /** - * @ngdoc method - * @name $http#delete - * - * @description - * Shortcut method to perform `DELETE` request. - * - * @param {string|TrustedObject} url Absolute or relative URL of the resource that is being requested; - * or an object created by a call to `$sce.trustAsResourceUrl(url)`. - * @param {Object=} config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}. - * @returns {HttpPromise} A Promise that will be resolved or rejected with a response object. - * See {@link ng.$http#$http-returns `$http()` return value}. - */ - - /** - * @ngdoc method - * @name $http#head - * - * @description - * Shortcut method to perform `HEAD` request. - * - * @param {string|TrustedObject} url Absolute or relative URL of the resource that is being requested; - * or an object created by a call to `$sce.trustAsResourceUrl(url)`. - * @param {Object=} config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}. - * @returns {HttpPromise} A Promise that will be resolved or rejected with a response object. - * See {@link ng.$http#$http-returns `$http()` return value}. - */ - - /** - * @ngdoc method - * @name $http#jsonp - * - * @description - * Shortcut method to perform `JSONP` request. - * - * Note that, since JSONP requests are sensitive because the response is given full access to the browser, - * the url must be declared, via {@link $sce} as a trusted resource URL. - * You can trust a URL by adding it to the trusted resource URL list via - * {@link $sceDelegateProvider#trustedResourceUrlList `$sceDelegateProvider.trustedResourceUrlList`} or - * by explicitly trusting the URL via {@link $sce#trustAsResourceUrl `$sce.trustAsResourceUrl(url)`}. - * - * You should avoid generating the URL for the JSONP request from user provided data. - * Provide additional query parameters via `params` property of the `config` parameter, rather than - * modifying the URL itself. - * - * JSONP requests must specify a callback to be used in the response from the server. This callback - * is passed as a query parameter in the request. You must specify the name of this parameter by - * setting the `jsonpCallbackParam` property on the request config object. - * - * ``` - * $http.jsonp('some/trusted/url', {jsonpCallbackParam: 'callback'}) - * ``` - * - * You can also specify a default callback parameter name in `$http.defaults.jsonpCallbackParam`. - * Initially this is set to `'callback'`. - * - *
- * You can no longer use the `JSON_CALLBACK` string as a placeholder for specifying where the callback - * parameter value should go. - *
- * - * If you would like to customise where and how the callbacks are stored then try overriding - * or decorating the {@link $jsonpCallbacks} service. - * - * @param {string|TrustedObject} url Absolute or relative URL of the resource that is being requested; - * or an object created by a call to `$sce.trustAsResourceUrl(url)`. - * @param {Object=} config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}. - * @returns {HttpPromise} A Promise that will be resolved or rejected with a response object. - * See {@link ng.$http#$http-returns `$http()` return value}. - */ - createShortMethods('get', 'delete', 'head', 'jsonp'); - - /** - * @ngdoc method - * @name $http#post - * - * @description - * Shortcut method to perform `POST` request. - * - * @param {string} url Relative or absolute URL specifying the destination of the request - * @param {*} data Request content - * @param {Object=} config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}. - * @returns {HttpPromise} A Promise that will be resolved or rejected with a response object. - * See {@link ng.$http#$http-returns `$http()` return value}. - */ - - /** - * @ngdoc method - * @name $http#put - * - * @description - * Shortcut method to perform `PUT` request. - * - * @param {string} url Relative or absolute URL specifying the destination of the request - * @param {*} data Request content - * @param {Object=} config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}. - * @returns {HttpPromise} A Promise that will be resolved or rejected with a response object. - * See {@link ng.$http#$http-returns `$http()` return value}. - */ - - /** - * @ngdoc method - * @name $http#patch - * - * @description - * Shortcut method to perform `PATCH` request. - * - * @param {string} url Relative or absolute URL specifying the destination of the request - * @param {*} data Request content - * @param {Object=} config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}. - * @returns {HttpPromise} A Promise that will be resolved or rejected with a response object. - * See {@link ng.$http#$http-returns `$http()` return value}. - */ - createShortMethodsWithData('post', 'put', 'patch'); - - /** - * @ngdoc property - * @name $http#defaults - * - * @description - * Runtime equivalent of the `$httpProvider.defaults` property. Allows configuration of - * default headers, withCredentials as well as request and response transformations. - * - * See "Setting HTTP Headers" and "Transforming Requests and Responses" sections above. - */ - $http.defaults = defaults; - - - return $http; - - - function createShortMethods(names) { - forEach(arguments, function (name) { - $http[name] = function (url, config) { - return $http(extend({}, config || {}, { - method: name, - url: url - })); - }; - }); - } - - - function createShortMethodsWithData(name) { - forEach(arguments, function (name) { - $http[name] = function (url, data, config) { - return $http(extend({}, config || {}, { - method: name, - url: url, - data: data - })); - }; - }); - } - - - /** - * Makes the request. - * - * !!! ACCESSES CLOSURE VARS: - * $httpBackend, defaults, $log, $rootScope, defaultCache, $http.pendingRequests - */ - function sendReq(config, reqData) { - var deferred = $q.defer(), - promise = deferred.promise, - cache, - cachedResp, - reqHeaders = config.headers, - isJsonp = lowercase(config.method) === 'jsonp', - url = config.url; - - if (isJsonp) { - // JSONP is a pretty sensitive operation where we're allowing a script to have full access to - // our DOM and JS space. So we require that the URL satisfies SCE.RESOURCE_URL. - url = $sce.getTrustedResourceUrl(url); - } else if (!isString(url)) { - // If it is not a string then the URL must be a $sce trusted object - url = $sce.valueOf(url); - } - - url = buildUrl(url, config.paramSerializer(config.params)); - - if (isJsonp) { - // Check the url and add the JSONP callback placeholder - url = sanitizeJsonpCallbackParam(url, config.jsonpCallbackParam); - } - - $http.pendingRequests.push(config); - promise.then(removePendingReq, removePendingReq); - - if ((config.cache || defaults.cache) && config.cache !== false && - (config.method === 'GET' || config.method === 'JSONP')) { - cache = isObject(config.cache) ? config.cache : - isObject( /** @type {?} */ (defaults).cache) ? - /** @type {?} */ - (defaults).cache : - defaultCache; - } - - if (cache) { - cachedResp = cache.get(url); - if (isDefined(cachedResp)) { - if (isPromiseLike(cachedResp)) { - // cached request has already been sent, but there is no response yet - cachedResp.then(resolvePromiseWithResult, resolvePromiseWithResult); - } else { - // serving from cache - if (isArray(cachedResp)) { - resolvePromise(cachedResp[1], cachedResp[0], shallowCopy(cachedResp[2]), cachedResp[3], cachedResp[4]); - } else { - resolvePromise(cachedResp, 200, {}, 'OK', 'complete'); - } - } - } else { - // put the promise for the non-transformed response into cache as a placeholder - cache.put(url, promise); - } - } - - - // if we won't have the response in cache, set the xsrf headers and - // send the request to the backend - if (isUndefined(cachedResp)) { - var xsrfValue = urlIsAllowedOrigin(config.url) ? - $$cookieReader()[config.xsrfCookieName || defaults.xsrfCookieName] : - undefined; - if (xsrfValue) { - reqHeaders[(config.xsrfHeaderName || defaults.xsrfHeaderName)] = xsrfValue; - } - - $httpBackend(config.method, url, reqData, done, reqHeaders, config.timeout, - config.withCredentials, config.responseType, - createApplyHandlers(config.eventHandlers), - createApplyHandlers(config.uploadEventHandlers)); - } - - return promise; - - function createApplyHandlers(eventHandlers) { - if (eventHandlers) { - var applyHandlers = {}; - forEach(eventHandlers, function (eventHandler, key) { - applyHandlers[key] = function (event) { - if (useApplyAsync) { - $rootScope.$applyAsync(callEventHandler); - } else if ($rootScope.$$phase) { - callEventHandler(); - } else { - $rootScope.$apply(callEventHandler); - } - - function callEventHandler() { - eventHandler(event); - } - }; - }); - return applyHandlers; - } - } - - - /** - * Callback registered to $httpBackend(): - * - caches the response if desired - * - resolves the raw $http promise - * - calls $apply - */ - function done(status, response, headersString, statusText, xhrStatus) { - if (cache) { - if (isSuccess(status)) { - cache.put(url, [status, response, parseHeaders(headersString), statusText, xhrStatus]); - } else { - // remove promise from the cache - cache.remove(url); - } - } - - function resolveHttpPromise() { - resolvePromise(response, status, headersString, statusText, xhrStatus); - } - - if (useApplyAsync) { - $rootScope.$applyAsync(resolveHttpPromise); - } else { - resolveHttpPromise(); - if (!$rootScope.$$phase) $rootScope.$apply(); - } - } - - - /** - * Resolves the raw $http promise. - */ - function resolvePromise(response, status, headers, statusText, xhrStatus) { - //status: HTTP response status code, 0, -1 (aborted by timeout / promise) - status = status >= -1 ? status : 0; - - (isSuccess(status) ? deferred.resolve : deferred.reject)({ - data: response, - status: status, - headers: headersGetter(headers), - config: config, - statusText: statusText, - xhrStatus: xhrStatus - }); - } - - function resolvePromiseWithResult(result) { - resolvePromise(result.data, result.status, shallowCopy(result.headers()), result.statusText, result.xhrStatus); - } - - function removePendingReq() { - var idx = $http.pendingRequests.indexOf(config); - if (idx !== -1) $http.pendingRequests.splice(idx, 1); - } - } - - - function buildUrl(url, serializedParams) { - if (serializedParams.length > 0) { - url += ((url.indexOf('?') === -1) ? '?' : '&') + serializedParams; - } - return url; - } - - function sanitizeJsonpCallbackParam(url, cbKey) { - var parts = url.split('?'); - if (parts.length > 2) { - // Throw if the url contains more than one `?` query indicator - throw $httpMinErr('badjsonp', 'Illegal use more than one "?", in url, "{1}"', url); - } - var params = parseKeyValue(parts[1]); - forEach(params, function (value, key) { - if (value === 'JSON_CALLBACK') { - // Throw if the url already contains a reference to JSON_CALLBACK - throw $httpMinErr('badjsonp', 'Illegal use of JSON_CALLBACK in url, "{0}"', url); - } - if (key === cbKey) { - // Throw if the callback param was already provided - throw $httpMinErr('badjsonp', 'Illegal use of callback param, "{0}", in url, "{1}"', cbKey, url); - } - }); - - // Add in the JSON_CALLBACK callback param value - url += ((url.indexOf('?') === -1) ? '?' : '&') + cbKey + '=JSON_CALLBACK'; - - return url; - } - } - ]; - } - - /** - * @ngdoc service - * @name $xhrFactory - * @this - * - * @description - * Factory function used to create XMLHttpRequest objects. - * - * Replace or decorate this service to create your own custom XMLHttpRequest objects. - * - * ``` - * angular.module('myApp', []) - * .factory('$xhrFactory', function() { - * return function createXhr(method, url) { - * return new window.XMLHttpRequest({mozSystem: true}); - * }; - * }); - * ``` - * - * @param {string} method HTTP method of the request (GET, POST, PUT, ..) - * @param {string} url URL of the request. - */ - function $xhrFactoryProvider() { - this.$get = function () { - return function createXhr() { - return new window.XMLHttpRequest(); - }; - }; - } - - /** - * @ngdoc service - * @name $httpBackend - * @requires $jsonpCallbacks - * @requires $document - * @requires $xhrFactory - * @this - * - * @description - * HTTP backend used by the {@link ng.$http service} that delegates to - * XMLHttpRequest object or JSONP and deals with browser incompatibilities. - * - * You should never need to use this service directly, instead use the higher-level abstractions: - * {@link ng.$http $http} or {@link ngResource.$resource $resource}. - * - * During testing this implementation is swapped with {@link ngMock.$httpBackend mock - * $httpBackend} which can be trained with responses. - */ - function $HttpBackendProvider() { - this.$get = ['$browser', '$jsonpCallbacks', '$document', '$xhrFactory', function ($browser, $jsonpCallbacks, $document, $xhrFactory) { - return createHttpBackend($browser, $xhrFactory, $browser.defer, $jsonpCallbacks, $document[0]); - }]; - } - - function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDocument) { - // TODO(vojta): fix the signature - return function (method, url, post, callback, headers, timeout, withCredentials, responseType, eventHandlers, uploadEventHandlers) { - url = url || $browser.url(); - - if (lowercase(method) === 'jsonp') { - var callbackPath = callbacks.createCallback(url); - var jsonpDone = jsonpReq(url, callbackPath, function (status, text) { - // jsonpReq only ever sets status to 200 (OK), 404 (ERROR) or -1 (WAITING) - var response = (status === 200) && callbacks.getResponse(callbackPath); - completeRequest(callback, status, response, '', text, 'complete'); - callbacks.removeCallback(callbackPath); - }); - } else { - - var xhr = createXhr(method, url); - var abortedByTimeout = false; - - xhr.open(method, url, true); - forEach(headers, function (value, key) { - if (isDefined(value)) { - xhr.setRequestHeader(key, value); - } - }); - - xhr.onload = function requestLoaded() { - var statusText = xhr.statusText || ''; - - // responseText is the old-school way of retrieving response (supported by IE9) - // response/responseType properties were introduced in XHR Level2 spec (supported by IE10) - var response = ('response' in xhr) ? xhr.response : xhr.responseText; - - // normalize IE9 bug (http://bugs.jquery.com/ticket/1450) - var status = xhr.status === 1223 ? 204 : xhr.status; - - // fix status code when it is 0 (0 status is undocumented). - // Occurs when accessing file resources or on Android 4.1 stock browser - // while retrieving files from application cache. - if (status === 0) { - status = response ? 200 : urlResolve(url).protocol === 'file' ? 404 : 0; - } - - completeRequest(callback, - status, - response, - xhr.getAllResponseHeaders(), - statusText, - 'complete'); - }; - - var requestError = function () { - // The response is always empty - // See https://xhr.spec.whatwg.org/#request-error-steps and https://fetch.spec.whatwg.org/#concept-network-error - completeRequest(callback, -1, null, null, '', 'error'); - }; - - var requestAborted = function () { - completeRequest(callback, -1, null, null, '', abortedByTimeout ? 'timeout' : 'abort'); - }; - - var requestTimeout = function () { - // The response is always empty - // See https://xhr.spec.whatwg.org/#request-error-steps and https://fetch.spec.whatwg.org/#concept-network-error - completeRequest(callback, -1, null, null, '', 'timeout'); - }; - - xhr.onerror = requestError; - xhr.ontimeout = requestTimeout; - xhr.onabort = requestAborted; - - forEach(eventHandlers, function (value, key) { - xhr.addEventListener(key, value); - }); - - forEach(uploadEventHandlers, function (value, key) { - xhr.upload.addEventListener(key, value); - }); - - if (withCredentials) { - xhr.withCredentials = true; - } - - if (responseType) { - try { - xhr.responseType = responseType; - } catch (e) { - // WebKit added support for the json responseType value on 09/03/2013 - // https://bugs.webkit.org/show_bug.cgi?id=73648. Versions of Safari prior to 7 are - // known to throw when setting the value "json" as the response type. Other older - // browsers implementing the responseType - // - // The json response type can be ignored if not supported, because JSON payloads are - // parsed on the client-side regardless. - if (responseType !== 'json') { - throw e; - } - } - } - - xhr.send(isUndefined(post) ? null : post); - } - - // Since we are using xhr.abort() when a request times out, we have to set a flag that - // indicates to requestAborted if the request timed out or was aborted. - // - // http.timeout = numerical timeout timeout - // http.timeout = $timeout timeout - // http.timeout = promise abort - // xhr.abort() abort (The xhr object is normally inaccessible, but - // can be exposed with the xhrFactory) - if (timeout > 0) { - var timeoutId = $browserDefer(function () { - timeoutRequest('timeout'); - }, timeout); - } else if (isPromiseLike(timeout)) { - timeout.then(function () { - timeoutRequest(isDefined(timeout.$$timeoutId) ? 'timeout' : 'abort'); - }); - } - - function timeoutRequest(reason) { - abortedByTimeout = reason === 'timeout'; - if (jsonpDone) { - jsonpDone(); - } - if (xhr) { - xhr.abort(); - } - } - - function completeRequest(callback, status, response, headersString, statusText, xhrStatus) { - // cancel timeout and subsequent timeout promise resolution - if (isDefined(timeoutId)) { - $browserDefer.cancel(timeoutId); - } - jsonpDone = xhr = null; - - callback(status, response, headersString, statusText, xhrStatus); - } - }; - - function jsonpReq(url, callbackPath, done) { - url = url.replace('JSON_CALLBACK', callbackPath); - // we can't use jQuery/jqLite here because jQuery does crazy stuff with script elements, e.g.: - // - fetches local scripts via XHR and evals them - // - adds and immediately removes script elements from the document - var script = rawDocument.createElement('script'), - callback = null; - script.type = 'text/javascript'; - script.src = url; - script.async = true; - - callback = function (event) { - script.removeEventListener('load', callback); - script.removeEventListener('error', callback); - rawDocument.body.removeChild(script); - script = null; - var status = -1; - var text = 'unknown'; - - if (event) { - if (event.type === 'load' && !callbacks.wasCalled(callbackPath)) { - event = { - type: 'error' - }; - } - text = event.type; - status = event.type === 'error' ? 404 : 200; - } - - if (done) { - done(status, text); - } - }; - - script.addEventListener('load', callback); - script.addEventListener('error', callback); - rawDocument.body.appendChild(script); - return callback; - } - } - - var $interpolateMinErr = angular.$interpolateMinErr = minErr('$interpolate'); - $interpolateMinErr.throwNoconcat = function (text) { - throw $interpolateMinErr('noconcat', - 'Error while interpolating: {0}\nStrict Contextual Escaping disallows ' + - 'interpolations that concatenate multiple expressions when a trusted value is ' + - 'required. See http://docs.angularjs.org/api/ng.$sce', text); - }; - - $interpolateMinErr.interr = function (text, err) { - return $interpolateMinErr('interr', 'Can\'t interpolate: {0}\n{1}', text, err.toString()); - }; - - /** - * @ngdoc provider - * @name $interpolateProvider - * @this - * - * @description - * - * Used for configuring the interpolation markup. Defaults to `{{` and `}}`. - * - *
- * This feature is sometimes used to mix different markup languages, e.g. to wrap an AngularJS - * template within a Python Jinja template (or any other template language). Mixing templating - * languages is **very dangerous**. The embedding template language will not safely escape AngularJS - * expressions, so any user-controlled values in the template will cause Cross Site Scripting (XSS) - * security bugs! - *
- * - * @example - - - -
- //demo.label// -
-
- - it('should interpolate binding with custom symbols', function() { - expect(element(by.binding('demo.label')).getText()).toBe('This binding is brought you by // interpolation symbols.'); - }); - -
- */ - function $InterpolateProvider() { - var startSymbol = '{{'; - var endSymbol = '}}'; - - /** - * @ngdoc method - * @name $interpolateProvider#startSymbol - * @description - * Symbol to denote start of expression in the interpolated string. Defaults to `{{`. - * - * @param {string=} value new value to set the starting symbol to. - * @returns {string|self} Returns the symbol when used as getter and self if used as setter. - */ - this.startSymbol = function (value) { - if (value) { - startSymbol = value; - return this; - } - return startSymbol; - }; - - /** - * @ngdoc method - * @name $interpolateProvider#endSymbol - * @description - * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`. - * - * @param {string=} value new value to set the ending symbol to. - * @returns {string|self} Returns the symbol when used as getter and self if used as setter. - */ - this.endSymbol = function (value) { - if (value) { - endSymbol = value; - return this; - } - return endSymbol; - }; - - - this.$get = ['$parse', '$exceptionHandler', '$sce', function ($parse, $exceptionHandler, $sce) { - var startSymbolLength = startSymbol.length, - endSymbolLength = endSymbol.length, - escapedStartRegexp = new RegExp(startSymbol.replace(/./g, escape), 'g'), - escapedEndRegexp = new RegExp(endSymbol.replace(/./g, escape), 'g'); - - function escape(ch) { - return '\\\\\\' + ch; - } - - function unescapeText(text) { - return text.replace(escapedStartRegexp, startSymbol). - replace(escapedEndRegexp, endSymbol); - } - - // TODO: this is the same as the constantWatchDelegate in parse.js - function constantWatchDelegate(scope, listener, objectEquality, constantInterp) { - var unwatch = scope.$watch(function constantInterpolateWatch(scope) { - unwatch(); - return constantInterp(scope); - }, listener, objectEquality); - return unwatch; - } - - /** - * @ngdoc service - * @name $interpolate - * @kind function - * - * @requires $parse - * @requires $sce - * - * @description - * - * Compiles a string with markup into an interpolation function. This service is used by the - * HTML {@link ng.$compile $compile} service for data binding. See - * {@link ng.$interpolateProvider $interpolateProvider} for configuring the - * interpolation markup. - * - * - * ```js - * var $interpolate = ...; // injected - * var exp = $interpolate('Hello {{name | uppercase}}!'); - * expect(exp({name:'AngularJS'})).toEqual('Hello ANGULARJS!'); - * ``` - * - * `$interpolate` takes an optional fourth argument, `allOrNothing`. If `allOrNothing` is - * `true`, the interpolation function will return `undefined` unless all embedded expressions - * evaluate to a value other than `undefined`. - * - * ```js - * var $interpolate = ...; // injected - * var context = {greeting: 'Hello', name: undefined }; - * - * // default "forgiving" mode - * var exp = $interpolate('{{greeting}} {{name}}!'); - * expect(exp(context)).toEqual('Hello !'); - * - * // "allOrNothing" mode - * exp = $interpolate('{{greeting}} {{name}}!', false, null, true); - * expect(exp(context)).toBeUndefined(); - * context.name = 'AngularJS'; - * expect(exp(context)).toEqual('Hello AngularJS!'); - * ``` - * - * `allOrNothing` is useful for interpolating URLs. `ngSrc` and `ngSrcset` use this behavior. - * - * #### Escaped Interpolation - * $interpolate provides a mechanism for escaping interpolation markers. Start and end markers - * can be escaped by preceding each of their characters with a REVERSE SOLIDUS U+005C (backslash). - * It will be rendered as a regular start/end marker, and will not be interpreted as an expression - * or binding. - * - * This enables web-servers to prevent script injection attacks and defacing attacks, to some - * degree, while also enabling code examples to work without relying on the - * {@link ng.directive:ngNonBindable ngNonBindable} directive. - * - * **For security purposes, it is strongly encouraged that web servers escape user-supplied data, - * replacing angle brackets (<, >) with &lt; and &gt; respectively, and replacing all - * interpolation start/end markers with their escaped counterparts.** - * - * Escaped interpolation markers are only replaced with the actual interpolation markers in rendered - * output when the $interpolate service processes the text. So, for HTML elements interpolated - * by {@link ng.$compile $compile}, or otherwise interpolated with the `mustHaveExpression` parameter - * set to `true`, the interpolated text must contain an unescaped interpolation expression. As such, - * this is typically useful only when user-data is used in rendering a template from the server, or - * when otherwise untrusted data is used by a directive. - * - * - * - *
- *

{{apptitle}}: \{\{ username = "defaced value"; \}\} - *

- *

{{username}} attempts to inject code which will deface the - * application, but fails to accomplish their task, because the server has correctly - * escaped the interpolation start/end markers with REVERSE SOLIDUS U+005C (backslash) - * characters.

- *

Instead, the result of the attempted script injection is visible, and can be removed - * from the database by an administrator.

- *
- *
- *
- * - * @knownIssue - * It is currently not possible for an interpolated expression to contain the interpolation end - * symbol. For example, `{{ '}}' }}` will be incorrectly interpreted as `{{ ' }}` + `' }}`, i.e. - * an interpolated expression consisting of a single-quote (`'`) and the `' }}` string. - * - * @knownIssue - * All directives and components must use the standard `{{` `}}` interpolation symbols - * in their templates. If you change the application interpolation symbols the {@link $compile} - * service will attempt to denormalize the standard symbols to the custom symbols. - * The denormalization process is not clever enough to know not to replace instances of the standard - * symbols where they would not normally be treated as interpolation symbols. For example in the following - * code snippet the closing braces of the literal object will get incorrectly denormalized: - * - * ``` - *
- * ``` - * - * See https://github.com/angular/angular.js/pull/14610#issuecomment-219401099 for more information. - * - * @param {string} text The text with markup to interpolate. - * @param {boolean=} mustHaveExpression if set to true then the interpolation string must have - * embedded expression in order to return an interpolation function. Strings with no - * embedded expression will return null for the interpolation function. - * @param {string=} trustedContext when provided, the returned function passes the interpolated - * result through {@link ng.$sce#getTrusted $sce.getTrusted(interpolatedResult, - * trustedContext)} before returning it. Refer to the {@link ng.$sce $sce} service that - * provides Strict Contextual Escaping for details. - * @param {boolean=} allOrNothing if `true`, then the returned function returns undefined - * unless all embedded expressions evaluate to a value other than `undefined`. - * @returns {function(context)} an interpolation function which is used to compute the - * interpolated string. The function has these parameters: - * - * - `context`: evaluation context for all expressions embedded in the interpolated text - */ - function $interpolate(text, mustHaveExpression, trustedContext, allOrNothing) { - var contextAllowsConcatenation = trustedContext === $sce.URL || trustedContext === $sce.MEDIA_URL; - - // Provide a quick exit and simplified result function for text with no interpolation - if (!text.length || text.indexOf(startSymbol) === -1) { - if (mustHaveExpression) return; - - var unescapedText = unescapeText(text); - if (contextAllowsConcatenation) { - unescapedText = $sce.getTrusted(trustedContext, unescapedText); - } - var constantInterp = valueFn(unescapedText); - constantInterp.exp = text; - constantInterp.expressions = []; - constantInterp.$$watchDelegate = constantWatchDelegate; - - return constantInterp; - } - - allOrNothing = !!allOrNothing; - var startIndex, - endIndex, - index = 0, - expressions = [], - parseFns, - textLength = text.length, - exp, - concat = [], - expressionPositions = [], - singleExpression; - - - while (index < textLength) { - if (((startIndex = text.indexOf(startSymbol, index)) !== -1) && - ((endIndex = text.indexOf(endSymbol, startIndex + startSymbolLength)) !== -1)) { - if (index !== startIndex) { - concat.push(unescapeText(text.substring(index, startIndex))); - } - exp = text.substring(startIndex + startSymbolLength, endIndex); - expressions.push(exp); - index = endIndex + endSymbolLength; - expressionPositions.push(concat.length); - concat.push(''); // Placeholder that will get replaced with the evaluated expression. - } else { - // we did not find an interpolation, so we have to add the remainder to the separators array - if (index !== textLength) { - concat.push(unescapeText(text.substring(index))); - } - break; - } - } - - singleExpression = concat.length === 1 && expressionPositions.length === 1; - // Intercept expression if we need to stringify concatenated inputs, which may be SCE trusted - // objects rather than simple strings - // (we don't modify the expression if the input consists of only a single trusted input) - var interceptor = contextAllowsConcatenation && singleExpression ? undefined : parseStringifyInterceptor; - parseFns = expressions.map(function (exp) { - return $parse(exp, interceptor); - }); - - // Concatenating expressions makes it hard to reason about whether some combination of - // concatenated values are unsafe to use and could easily lead to XSS. By requiring that a - // single expression be used for some $sce-managed secure contexts (RESOURCE_URLs mostly), - // we ensure that the value that's used is assigned or constructed by some JS code somewhere - // that is more testable or make it obvious that you bound the value to some user controlled - // value. This helps reduce the load when auditing for XSS issues. - - // Note that URL and MEDIA_URL $sce contexts do not need this, since `$sce` can sanitize the values - // passed to it. In that case, `$sce.getTrusted` will be called on either the single expression - // or on the overall concatenated string (losing trusted types used in the mix, by design). - // Both these methods will sanitize plain strings. Also, HTML could be included, but since it's - // only used in srcdoc attributes, this would not be very useful. - - if (!mustHaveExpression || expressions.length) { - var compute = function (values) { - for (var i = 0, ii = expressions.length; i < ii; i++) { - if (allOrNothing && isUndefined(values[i])) return; - concat[expressionPositions[i]] = values[i]; - } - - if (contextAllowsConcatenation) { - // If `singleExpression` then `concat[0]` might be a "trusted" value or `null`, rather than a string - return $sce.getTrusted(trustedContext, singleExpression ? concat[0] : concat.join('')); - } else if (trustedContext && concat.length > 1) { - // This context does not allow more than one part, e.g. expr + string or exp + exp. - $interpolateMinErr.throwNoconcat(text); - } - // In an unprivileged context or only one part: just concatenate and return. - return concat.join(''); - }; - - return extend(function interpolationFn(context) { - var i = 0; - var ii = expressions.length; - var values = new Array(ii); - - try { - for (; i < ii; i++) { - values[i] = parseFns[i](context); - } - - return compute(values); - } catch (err) { - $exceptionHandler($interpolateMinErr.interr(text, err)); - } - - }, { - // all of these properties are undocumented for now - exp: text, //just for compatibility with regular watchers created via $watch - expressions: expressions, - $$watchDelegate: function (scope, listener) { - var lastValue; - return scope.$watchGroup(parseFns, /** @this */ function interpolateFnWatcher(values, oldValues) { - var currValue = compute(values); - listener.call(this, currValue, values !== oldValues ? lastValue : currValue, scope); - lastValue = currValue; - }); - } - }); - } - - function parseStringifyInterceptor(value) { - try { - // In concatenable contexts, getTrusted comes at the end, to avoid sanitizing individual - // parts of a full URL. We don't care about losing the trustedness here. - // In non-concatenable contexts, where there is only one expression, this interceptor is - // not applied to the expression. - value = (trustedContext && !contextAllowsConcatenation) ? - $sce.getTrusted(trustedContext, value) : - $sce.valueOf(value); - return allOrNothing && !isDefined(value) ? value : stringify(value); - } catch (err) { - $exceptionHandler($interpolateMinErr.interr(text, err)); - } - } - } - - - /** - * @ngdoc method - * @name $interpolate#startSymbol - * @description - * Symbol to denote the start of expression in the interpolated string. Defaults to `{{`. - * - * Use {@link ng.$interpolateProvider#startSymbol `$interpolateProvider.startSymbol`} to change - * the symbol. - * - * @returns {string} start symbol. - */ - $interpolate.startSymbol = function () { - return startSymbol; - }; - - - /** - * @ngdoc method - * @name $interpolate#endSymbol - * @description - * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`. - * - * Use {@link ng.$interpolateProvider#endSymbol `$interpolateProvider.endSymbol`} to change - * the symbol. - * - * @returns {string} end symbol. - */ - $interpolate.endSymbol = function () { - return endSymbol; - }; - - return $interpolate; - }]; - } - - var $intervalMinErr = minErr('$interval'); - - /** @this */ - function $IntervalProvider() { - this.$get = ['$$intervalFactory', '$window', - function ($$intervalFactory, $window) { - var intervals = {}; - var setIntervalFn = function (tick, delay, deferred) { - var id = $window.setInterval(tick, delay); - intervals[id] = deferred; - return id; - }; - var clearIntervalFn = function (id) { - $window.clearInterval(id); - delete intervals[id]; - }; - - /** - * @ngdoc service - * @name $interval - * - * @description - * AngularJS's wrapper for `window.setInterval`. The `fn` function is executed every `delay` - * milliseconds. - * - * The return value of registering an interval function is a promise. This promise will be - * notified upon each tick of the interval, and will be resolved after `count` iterations, or - * run indefinitely if `count` is not defined. The value of the notification will be the - * number of iterations that have run. - * To cancel an interval, call `$interval.cancel(promise)`. - * - * In tests you can use {@link ngMock.$interval#flush `$interval.flush(millis)`} to - * move forward by `millis` milliseconds and trigger any functions scheduled to run in that - * time. - * - *
- * **Note**: Intervals created by this service must be explicitly destroyed when you are finished - * with them. In particular they are not automatically destroyed when a controller's scope or a - * directive's element are destroyed. - * You should take this into consideration and make sure to always cancel the interval at the - * appropriate moment. See the example below for more details on how and when to do this. - *
- * - * @param {function()} fn A function that should be called repeatedly. If no additional arguments - * are passed (see below), the function is called with the current iteration count. - * @param {number} delay Number of milliseconds between each function call. - * @param {number=} [count=0] Number of times to repeat. If not set, or 0, will repeat - * indefinitely. - * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise - * will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block. - * @param {...*=} Pass additional parameters to the executed function. - * @returns {promise} A promise which will be notified on each iteration. It will resolve once all iterations of the interval complete. - * - * @example - * - * - * - * - *
- *
- *
- * Current time is: - *
- * Blood 1 : {{blood_1}} - * Blood 2 : {{blood_2}} - * - * - * - *
- *
- * - *
- *
- */ - var interval = $$intervalFactory(setIntervalFn, clearIntervalFn); - - /** - * @ngdoc method - * @name $interval#cancel - * - * @description - * Cancels a task associated with the `promise`. - * - * @param {Promise=} promise returned by the `$interval` function. - * @returns {boolean} Returns `true` if the task was successfully canceled. - */ - interval.cancel = function (promise) { - if (!promise) return false; - - if (!promise.hasOwnProperty('$$intervalId')) { - throw $intervalMinErr('badprom', - '`$interval.cancel()` called with a promise that was not generated by `$interval()`.'); - } - - if (!intervals.hasOwnProperty(promise.$$intervalId)) return false; - - var id = promise.$$intervalId; - var deferred = intervals[id]; - - // Interval cancels should not report an unhandled promise. - markQExceptionHandled(deferred.promise); - deferred.reject('canceled'); - clearIntervalFn(id); - - return true; - }; - - return interval; - } - ]; - } - - /** @this */ - function $$IntervalFactoryProvider() { - this.$get = ['$browser', '$q', '$$q', '$rootScope', - function ($browser, $q, $$q, $rootScope) { - return function intervalFactory(setIntervalFn, clearIntervalFn) { - return function intervalFn(fn, delay, count, invokeApply) { - var hasParams = arguments.length > 4, - args = hasParams ? sliceArgs(arguments, 4) : [], - iteration = 0, - skipApply = isDefined(invokeApply) && !invokeApply, - deferred = (skipApply ? $$q : $q).defer(), - promise = deferred.promise; - - count = isDefined(count) ? count : 0; - - function callback() { - if (!hasParams) { - fn(iteration); - } else { - fn.apply(null, args); - } - } - - function tick() { - if (skipApply) { - $browser.defer(callback); - } else { - $rootScope.$evalAsync(callback); - } - deferred.notify(iteration++); - - if (count > 0 && iteration >= count) { - deferred.resolve(iteration); - clearIntervalFn(promise.$$intervalId); - } - - if (!skipApply) $rootScope.$apply(); - } - - promise.$$intervalId = setIntervalFn(tick, delay, deferred, skipApply); - - return promise; - }; - }; - } - ]; - } - - /** - * @ngdoc service - * @name $jsonpCallbacks - * @requires $window - * @description - * This service handles the lifecycle of callbacks to handle JSONP requests. - * Override this service if you wish to customise where the callbacks are stored and - * how they vary compared to the requested url. - */ - var $jsonpCallbacksProvider = /** @this */ function () { - this.$get = function () { - var callbacks = angular.callbacks; - var callbackMap = {}; - - function createCallback(callbackId) { - var callback = function (data) { - callback.data = data; - callback.called = true; - }; - callback.id = callbackId; - return callback; - } - - return { - /** - * @ngdoc method - * @name $jsonpCallbacks#createCallback - * @param {string} url the url of the JSONP request - * @returns {string} the callback path to send to the server as part of the JSONP request - * @description - * {@link $httpBackend} calls this method to create a callback and get hold of the path to the callback - * to pass to the server, which will be used to call the callback with its payload in the JSONP response. - */ - createCallback: function (url) { - var callbackId = '_' + (callbacks.$$counter++).toString(36); - var callbackPath = 'angular.callbacks.' + callbackId; - var callback = createCallback(callbackId); - callbackMap[callbackPath] = callbacks[callbackId] = callback; - return callbackPath; - }, - /** - * @ngdoc method - * @name $jsonpCallbacks#wasCalled - * @param {string} callbackPath the path to the callback that was sent in the JSONP request - * @returns {boolean} whether the callback has been called, as a result of the JSONP response - * @description - * {@link $httpBackend} calls this method to find out whether the JSONP response actually called the - * callback that was passed in the request. - */ - wasCalled: function (callbackPath) { - return callbackMap[callbackPath].called; - }, - /** - * @ngdoc method - * @name $jsonpCallbacks#getResponse - * @param {string} callbackPath the path to the callback that was sent in the JSONP request - * @returns {*} the data received from the response via the registered callback - * @description - * {@link $httpBackend} calls this method to get hold of the data that was provided to the callback - * in the JSONP response. - */ - getResponse: function (callbackPath) { - return callbackMap[callbackPath].data; - }, - /** - * @ngdoc method - * @name $jsonpCallbacks#removeCallback - * @param {string} callbackPath the path to the callback that was sent in the JSONP request - * @description - * {@link $httpBackend} calls this method to remove the callback after the JSONP request has - * completed or timed-out. - */ - removeCallback: function (callbackPath) { - var callback = callbackMap[callbackPath]; - delete callbacks[callback.id]; - delete callbackMap[callbackPath]; - } - }; - }; - }; - - /** - * @ngdoc service - * @name $locale - * - * @description - * $locale service provides localization rules for various AngularJS components. As of right now the - * only public api is: - * - * * `id` – `{string}` – locale id formatted as `languageId-countryId` (e.g. `en-us`) - */ - - /* global stripHash: true */ - - var PATH_MATCH = /^([^?#]*)(\?([^#]*))?(#(.*))?$/, - DEFAULT_PORTS = { - 'http': 80, - 'https': 443, - 'ftp': 21 - }; - var $locationMinErr = minErr('$location'); - - - /** - * Encode path using encodeUriSegment, ignoring forward slashes - * - * @param {string} path Path to encode - * @returns {string} - */ - function encodePath(path) { - var segments = path.split('/'), - i = segments.length; - - while (i--) { - // decode forward slashes to prevent them from being double encoded - segments[i] = encodeUriSegment(segments[i].replace(/%2F/g, '/')); - } - - return segments.join('/'); - } - - function decodePath(path, html5Mode) { - var segments = path.split('/'), - i = segments.length; - - while (i--) { - segments[i] = decodeURIComponent(segments[i]); - if (html5Mode) { - // encode forward slashes to prevent them from being mistaken for path separators - segments[i] = segments[i].replace(/\//g, '%2F'); - } - } - - return segments.join('/'); - } - - function normalizePath(pathValue, searchValue, hashValue) { - var search = toKeyValue(searchValue), - hash = hashValue ? '#' + encodeUriSegment(hashValue) : '', - path = encodePath(pathValue); - - return path + (search ? '?' + search : '') + hash; - } - - function parseAbsoluteUrl(absoluteUrl, locationObj) { - var parsedUrl = urlResolve(absoluteUrl); - - locationObj.$$protocol = parsedUrl.protocol; - locationObj.$$host = parsedUrl.hostname; - locationObj.$$port = toInt(parsedUrl.port) || DEFAULT_PORTS[parsedUrl.protocol] || null; - } - - var DOUBLE_SLASH_REGEX = /^\s*[\\/]{2,}/; - - function parseAppUrl(url, locationObj, html5Mode) { - - if (DOUBLE_SLASH_REGEX.test(url)) { - throw $locationMinErr('badpath', 'Invalid url "{0}".', url); - } - - var prefixed = (url.charAt(0) !== '/'); - if (prefixed) { - url = '/' + url; - } - var match = urlResolve(url); - var path = prefixed && match.pathname.charAt(0) === '/' ? match.pathname.substring(1) : match.pathname; - locationObj.$$path = decodePath(path, html5Mode); - locationObj.$$search = parseKeyValue(match.search); - locationObj.$$hash = decodeURIComponent(match.hash); - - // make sure path starts with '/'; - if (locationObj.$$path && locationObj.$$path.charAt(0) !== '/') { - locationObj.$$path = '/' + locationObj.$$path; - } - } - - function startsWith(str, search) { - return str.slice(0, search.length) === search; - } - - /** - * - * @param {string} base - * @param {string} url - * @returns {string} returns text from `url` after `base` or `undefined` if it does not begin with - * the expected string. - */ - function stripBaseUrl(base, url) { - if (startsWith(url, base)) { - return url.substr(base.length); - } - } - - function stripHash(url) { - var index = url.indexOf('#'); - return index === -1 ? url : url.substr(0, index); - } - - function stripFile(url) { - return url.substr(0, stripHash(url).lastIndexOf('/') + 1); - } - - /* return the server only (scheme://host:port) */ - function serverBase(url) { - return url.substring(0, url.indexOf('/', url.indexOf('//') + 2)); - } - - - /** - * LocationHtml5Url represents a URL - * This object is exposed as $location service when HTML5 mode is enabled and supported - * - * @constructor - * @param {string} appBase application base URL - * @param {string} appBaseNoFile application base URL stripped of any filename - * @param {string} basePrefix URL path prefix - */ - function LocationHtml5Url(appBase, appBaseNoFile, basePrefix) { - this.$$html5 = true; - basePrefix = basePrefix || ''; - parseAbsoluteUrl(appBase, this); - - - /** - * Parse given HTML5 (regular) URL string into properties - * @param {string} url HTML5 URL - * @private - */ - this.$$parse = function (url) { - var pathUrl = stripBaseUrl(appBaseNoFile, url); - if (!isString(pathUrl)) { - throw $locationMinErr('ipthprfx', 'Invalid url "{0}", missing path prefix "{1}".', url, - appBaseNoFile); - } - - parseAppUrl(pathUrl, this, true); - - if (!this.$$path) { - this.$$path = '/'; - } - - this.$$compose(); - }; - - this.$$normalizeUrl = function (url) { - return appBaseNoFile + url.substr(1); // first char is always '/' - }; - - this.$$parseLinkUrl = function (url, relHref) { - if (relHref && relHref[0] === '#') { - // special case for links to hash fragments: - // keep the old url and only replace the hash fragment - this.hash(relHref.slice(1)); - return true; - } - var appUrl, prevAppUrl; - var rewrittenUrl; - - - if (isDefined(appUrl = stripBaseUrl(appBase, url))) { - prevAppUrl = appUrl; - if (basePrefix && isDefined(appUrl = stripBaseUrl(basePrefix, appUrl))) { - rewrittenUrl = appBaseNoFile + (stripBaseUrl('/', appUrl) || appUrl); - } else { - rewrittenUrl = appBase + prevAppUrl; - } - } else if (isDefined(appUrl = stripBaseUrl(appBaseNoFile, url))) { - rewrittenUrl = appBaseNoFile + appUrl; - } else if (appBaseNoFile === url + '/') { - rewrittenUrl = appBaseNoFile; - } - if (rewrittenUrl) { - this.$$parse(rewrittenUrl); - } - return !!rewrittenUrl; - }; - } - - - /** - * LocationHashbangUrl represents URL - * This object is exposed as $location service when developer doesn't opt into html5 mode. - * It also serves as the base class for html5 mode fallback on legacy browsers. - * - * @constructor - * @param {string} appBase application base URL - * @param {string} appBaseNoFile application base URL stripped of any filename - * @param {string} hashPrefix hashbang prefix - */ - function LocationHashbangUrl(appBase, appBaseNoFile, hashPrefix) { - - parseAbsoluteUrl(appBase, this); - - - /** - * Parse given hashbang URL into properties - * @param {string} url Hashbang URL - * @private - */ - this.$$parse = function (url) { - var withoutBaseUrl = stripBaseUrl(appBase, url) || stripBaseUrl(appBaseNoFile, url); - var withoutHashUrl; - - if (!isUndefined(withoutBaseUrl) && withoutBaseUrl.charAt(0) === '#') { - - // The rest of the URL starts with a hash so we have - // got either a hashbang path or a plain hash fragment - withoutHashUrl = stripBaseUrl(hashPrefix, withoutBaseUrl); - if (isUndefined(withoutHashUrl)) { - // There was no hashbang prefix so we just have a hash fragment - withoutHashUrl = withoutBaseUrl; - } - - } else { - // There was no hashbang path nor hash fragment: - // If we are in HTML5 mode we use what is left as the path; - // Otherwise we ignore what is left - if (this.$$html5) { - withoutHashUrl = withoutBaseUrl; - } else { - withoutHashUrl = ''; - if (isUndefined(withoutBaseUrl)) { - appBase = url; - /** @type {?} */ - (this).replace(); - } - } - } - - parseAppUrl(withoutHashUrl, this, false); - - this.$$path = removeWindowsDriveName(this.$$path, withoutHashUrl, appBase); - - this.$$compose(); - - /* - * In Windows, on an anchor node on documents loaded from - * the filesystem, the browser will return a pathname - * prefixed with the drive name ('/C:/path') when a - * pathname without a drive is set: - * * a.setAttribute('href', '/foo') - * * a.pathname === '/C:/foo' //true - * - * Inside of AngularJS, we're always using pathnames that - * do not include drive names for routing. - */ - function removeWindowsDriveName(path, url, base) { - /* - Matches paths for file protocol on windows, - such as /C:/foo/bar, and captures only /foo/bar. - */ - var windowsFilePathExp = /^\/[A-Z]:(\/.*)/; - - var firstPathSegmentMatch; - - //Get the relative path from the input URL. - if (startsWith(url, base)) { - url = url.replace(base, ''); - } - - // The input URL intentionally contains a first path segment that ends with a colon. - if (windowsFilePathExp.exec(url)) { - return path; - } - - firstPathSegmentMatch = windowsFilePathExp.exec(path); - return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path; - } - }; - - this.$$normalizeUrl = function (url) { - return appBase + (url ? hashPrefix + url : ''); - }; - - this.$$parseLinkUrl = function (url, relHref) { - if (stripHash(appBase) === stripHash(url)) { - this.$$parse(url); - return true; - } - return false; - }; - } - - - /** - * LocationHashbangUrl represents URL - * This object is exposed as $location service when html5 history api is enabled but the browser - * does not support it. - * - * @constructor - * @param {string} appBase application base URL - * @param {string} appBaseNoFile application base URL stripped of any filename - * @param {string} hashPrefix hashbang prefix - */ - function LocationHashbangInHtml5Url(appBase, appBaseNoFile, hashPrefix) { - this.$$html5 = true; - LocationHashbangUrl.apply(this, arguments); - - this.$$parseLinkUrl = function (url, relHref) { - if (relHref && relHref[0] === '#') { - // special case for links to hash fragments: - // keep the old url and only replace the hash fragment - this.hash(relHref.slice(1)); - return true; - } - - var rewrittenUrl; - var appUrl; - - if (appBase === stripHash(url)) { - rewrittenUrl = url; - } else if ((appUrl = stripBaseUrl(appBaseNoFile, url))) { - rewrittenUrl = appBase + hashPrefix + appUrl; - } else if (appBaseNoFile === url + '/') { - rewrittenUrl = appBaseNoFile; - } - if (rewrittenUrl) { - this.$$parse(rewrittenUrl); - } - return !!rewrittenUrl; - }; - - this.$$normalizeUrl = function (url) { - // include hashPrefix in $$absUrl when $$url is empty so IE9 does not reload page because of removal of '#' - return appBase + hashPrefix + url; - }; - } - - - var locationPrototype = { - - /** - * Ensure absolute URL is initialized. - * @private - */ - $$absUrl: '', - - /** - * Are we in html5 mode? - * @private - */ - $$html5: false, - - /** - * Has any change been replacing? - * @private - */ - $$replace: false, - - /** - * Compose url and update `url` and `absUrl` property - * @private - */ - $$compose: function () { - this.$$url = normalizePath(this.$$path, this.$$search, this.$$hash); - this.$$absUrl = this.$$normalizeUrl(this.$$url); - this.$$urlUpdatedByLocation = true; - }, - - /** - * @ngdoc method - * @name $location#absUrl - * - * @description - * This method is getter only. - * - * Return full URL representation with all segments encoded according to rules specified in - * [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt). - * - * - * ```js - * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo - * var absUrl = $location.absUrl(); - * // => "http://example.com/#/some/path?foo=bar&baz=xoxo" - * ``` - * - * @return {string} full URL - */ - absUrl: locationGetter('$$absUrl'), - - /** - * @ngdoc method - * @name $location#url - * - * @description - * This method is getter / setter. - * - * Return URL (e.g. `/path?a=b#hash`) when called without any parameter. - * - * Change path, search and hash, when called with parameter and return `$location`. - * - * - * ```js - * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo - * var url = $location.url(); - * // => "/some/path?foo=bar&baz=xoxo" - * ``` - * - * @param {string=} url New URL without base prefix (e.g. `/path?a=b#hash`) - * @return {string} url - */ - url: function (url) { - if (isUndefined(url)) { - return this.$$url; - } - - var match = PATH_MATCH.exec(url); - if (match[1] || url === '') this.path(decodeURIComponent(match[1])); - if (match[2] || match[1] || url === '') this.search(match[3] || ''); - this.hash(match[5] || ''); - - return this; - }, - - /** - * @ngdoc method - * @name $location#protocol - * - * @description - * This method is getter only. - * - * Return protocol of current URL. - * - * - * ```js - * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo - * var protocol = $location.protocol(); - * // => "http" - * ``` - * - * @return {string} protocol of current URL - */ - protocol: locationGetter('$$protocol'), - - /** - * @ngdoc method - * @name $location#host - * - * @description - * This method is getter only. - * - * Return host of current URL. - * - * Note: compared to the non-AngularJS version `location.host` which returns `hostname:port`, this returns the `hostname` portion only. - * - * - * ```js - * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo - * var host = $location.host(); - * // => "example.com" - * - * // given URL http://user:password@example.com:8080/#/some/path?foo=bar&baz=xoxo - * host = $location.host(); - * // => "example.com" - * host = location.host; - * // => "example.com:8080" - * ``` - * - * @return {string} host of current URL. - */ - host: locationGetter('$$host'), - - /** - * @ngdoc method - * @name $location#port - * - * @description - * This method is getter only. - * - * Return port of current URL. - * - * - * ```js - * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo - * var port = $location.port(); - * // => 80 - * ``` - * - * @return {Number} port - */ - port: locationGetter('$$port'), - - /** - * @ngdoc method - * @name $location#path - * - * @description - * This method is getter / setter. - * - * Return path of current URL when called without any parameter. - * - * Change path when called with parameter and return `$location`. - * - * Note: Path should always begin with forward slash (/), this method will add the forward slash - * if it is missing. - * - * - * ```js - * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo - * var path = $location.path(); - * // => "/some/path" - * ``` - * - * @param {(string|number)=} path New path - * @return {(string|object)} path if called with no parameters, or `$location` if called with a parameter - */ - path: locationGetterSetter('$$path', function (path) { - path = path !== null ? path.toString() : ''; - return path.charAt(0) === '/' ? path : '/' + path; - }), - - /** - * @ngdoc method - * @name $location#search - * - * @description - * This method is getter / setter. - * - * Return search part (as object) of current URL when called without any parameter. - * - * Change search part when called with parameter and return `$location`. - * - * - * ```js - * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo - * var searchObject = $location.search(); - * // => {foo: 'bar', baz: 'xoxo'} - * - * // set foo to 'yipee' - * $location.search('foo', 'yipee'); - * // $location.search() => {foo: 'yipee', baz: 'xoxo'} - * ``` - * - * @param {string|Object.|Object.>} search New search params - string or - * hash object. - * - * When called with a single argument the method acts as a setter, setting the `search` component - * of `$location` to the specified value. - * - * If the argument is a hash object containing an array of values, these values will be encoded - * as duplicate search parameters in the URL. - * - * @param {(string|Number|Array|boolean)=} paramValue If `search` is a string or number, then `paramValue` - * will override only a single search property. - * - * If `paramValue` is an array, it will override the property of the `search` component of - * `$location` specified via the first argument. - * - * If `paramValue` is `null`, the property specified via the first argument will be deleted. - * - * If `paramValue` is `true`, the property specified via the first argument will be added with no - * value nor trailing equal sign. - * - * @return {Object} If called with no arguments returns the parsed `search` object. If called with - * one or more arguments returns `$location` object itself. - */ - search: function (search, paramValue) { - switch (arguments.length) { - case 0: - return this.$$search; - case 1: - if (isString(search) || isNumber(search)) { - search = search.toString(); - this.$$search = parseKeyValue(search); - } else if (isObject(search)) { - search = copy(search, {}); - // remove object undefined or null properties - forEach(search, function (value, key) { - if (value == null) delete search[key]; - }); - - this.$$search = search; - } else { - throw $locationMinErr('isrcharg', - 'The first argument of the `$location#search()` call must be a string or an object.'); - } - break; - default: - if (isUndefined(paramValue) || paramValue === null) { - delete this.$$search[search]; - } else { - this.$$search[search] = paramValue; - } - } - - this.$$compose(); - return this; - }, - - /** - * @ngdoc method - * @name $location#hash - * - * @description - * This method is getter / setter. - * - * Returns the hash fragment when called without any parameters. - * - * Changes the hash fragment when called with a parameter and returns `$location`. - * - * - * ```js - * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo#hashValue - * var hash = $location.hash(); - * // => "hashValue" - * ``` - * - * @param {(string|number)=} hash New hash fragment - * @return {string} hash - */ - hash: locationGetterSetter('$$hash', function (hash) { - return hash !== null ? hash.toString() : ''; - }), - - /** - * @ngdoc method - * @name $location#replace - * - * @description - * If called, all changes to $location during the current `$digest` will replace the current history - * record, instead of adding a new one. - */ - replace: function () { - this.$$replace = true; - return this; - } - }; - - forEach([LocationHashbangInHtml5Url, LocationHashbangUrl, LocationHtml5Url], function (Location) { - Location.prototype = Object.create(locationPrototype); - - /** - * @ngdoc method - * @name $location#state - * - * @description - * This method is getter / setter. - * - * Return the history state object when called without any parameter. - * - * Change the history state object when called with one parameter and return `$location`. - * The state object is later passed to `pushState` or `replaceState`. - * - * NOTE: This method is supported only in HTML5 mode and only in browsers supporting - * the HTML5 History API (i.e. methods `pushState` and `replaceState`). If you need to support - * older browsers (like IE9 or Android < 4.0), don't use this method. - * - * @param {object=} state State object for pushState or replaceState - * @return {object} state - */ - Location.prototype.state = function (state) { - if (!arguments.length) { - return this.$$state; - } - - if (Location !== LocationHtml5Url || !this.$$html5) { - throw $locationMinErr('nostate', 'History API state support is available only ' + - 'in HTML5 mode and only in browsers supporting HTML5 History API'); - } - // The user might modify `stateObject` after invoking `$location.state(stateObject)` - // but we're changing the $$state reference to $browser.state() during the $digest - // so the modification window is narrow. - this.$$state = isUndefined(state) ? null : state; - this.$$urlUpdatedByLocation = true; - - return this; - }; - }); - - - function locationGetter(property) { - return /** @this */ function () { - return this[property]; - }; - } - - - function locationGetterSetter(property, preprocess) { - return /** @this */ function (value) { - if (isUndefined(value)) { - return this[property]; - } - - this[property] = preprocess(value); - this.$$compose(); - - return this; - }; - } - - - /** - * @ngdoc service - * @name $location - * - * @requires $rootElement - * - * @description - * The $location service parses the URL in the browser address bar (based on the - * [window.location](https://developer.mozilla.org/en/window.location)) and makes the URL - * available to your application. Changes to the URL in the address bar are reflected into - * $location service and changes to $location are reflected into the browser address bar. - * - * **The $location service:** - * - * - Exposes the current URL in the browser address bar, so you can - * - Watch and observe the URL. - * - Change the URL. - * - Synchronizes the URL with the browser when the user - * - Changes the address bar. - * - Clicks the back or forward button (or clicks a History link). - * - Clicks on a link. - * - Represents the URL object as a set of methods (protocol, host, port, path, search, hash). - * - * For more information see {@link guide/$location Developer Guide: Using $location} - */ - - /** - * @ngdoc provider - * @name $locationProvider - * @this - * - * @description - * Use the `$locationProvider` to configure how the application deep linking paths are stored. - */ - function $LocationProvider() { - var hashPrefix = '!', - html5Mode = { - enabled: false, - requireBase: true, - rewriteLinks: true - }; - - /** - * @ngdoc method - * @name $locationProvider#hashPrefix - * @description - * The default value for the prefix is `'!'`. - * @param {string=} prefix Prefix for hash part (containing path and search) - * @returns {*} current value if used as getter or itself (chaining) if used as setter - */ - this.hashPrefix = function (prefix) { - if (isDefined(prefix)) { - hashPrefix = prefix; - return this; - } else { - return hashPrefix; - } - }; - - /** - * @ngdoc method - * @name $locationProvider#html5Mode - * @description - * @param {(boolean|Object)=} mode If boolean, sets `html5Mode.enabled` to value. - * If object, sets `enabled`, `requireBase` and `rewriteLinks` to respective values. Supported - * properties: - * - **enabled** – `{boolean}` – (default: false) If true, will rely on `history.pushState` to - * change urls where supported. Will fall back to hash-prefixed paths in browsers that do not - * support `pushState`. - * - **requireBase** - `{boolean}` - (default: `true`) When html5Mode is enabled, specifies - * whether or not a tag is required to be present. If `enabled` and `requireBase` are - * true, and a base tag is not present, an error will be thrown when `$location` is injected. - * See the {@link guide/$location $location guide for more information} - * - **rewriteLinks** - `{boolean|string}` - (default: `true`) When html5Mode is enabled, - * enables/disables URL rewriting for relative links. If set to a string, URL rewriting will - * only happen on links with an attribute that matches the given string. For example, if set - * to `'internal-link'`, then the URL will only be rewritten for `` links. - * Note that [attribute name normalization](guide/directive#normalization) does not apply - * here, so `'internalLink'` will **not** match `'internal-link'`. - * - * @returns {Object} html5Mode object if used as getter or itself (chaining) if used as setter - */ - this.html5Mode = function (mode) { - if (isBoolean(mode)) { - html5Mode.enabled = mode; - return this; - } else if (isObject(mode)) { - - if (isBoolean(mode.enabled)) { - html5Mode.enabled = mode.enabled; - } - - if (isBoolean(mode.requireBase)) { - html5Mode.requireBase = mode.requireBase; - } - - if (isBoolean(mode.rewriteLinks) || isString(mode.rewriteLinks)) { - html5Mode.rewriteLinks = mode.rewriteLinks; - } - - return this; - } else { - return html5Mode; - } - }; - - /** - * @ngdoc event - * @name $location#$locationChangeStart - * @eventType broadcast on root scope - * @description - * Broadcasted before a URL will change. - * - * This change can be prevented by calling - * `preventDefault` method of the event. See {@link ng.$rootScope.Scope#$on} for more - * details about event object. Upon successful change - * {@link ng.$location#$locationChangeSuccess $locationChangeSuccess} is fired. - * - * The `newState` and `oldState` parameters may be defined only in HTML5 mode and when - * the browser supports the HTML5 History API. - * - * @param {Object} angularEvent Synthetic event object. - * @param {string} newUrl New URL - * @param {string=} oldUrl URL that was before it was changed. - * @param {string=} newState New history state object - * @param {string=} oldState History state object that was before it was changed. - */ - - /** - * @ngdoc event - * @name $location#$locationChangeSuccess - * @eventType broadcast on root scope - * @description - * Broadcasted after a URL was changed. - * - * The `newState` and `oldState` parameters may be defined only in HTML5 mode and when - * the browser supports the HTML5 History API. - * - * @param {Object} angularEvent Synthetic event object. - * @param {string} newUrl New URL - * @param {string=} oldUrl URL that was before it was changed. - * @param {string=} newState New history state object - * @param {string=} oldState History state object that was before it was changed. - */ - - this.$get = ['$rootScope', '$browser', '$sniffer', '$rootElement', '$window', - function ($rootScope, $browser, $sniffer, $rootElement, $window) { - var $location, - LocationMode, - baseHref = $browser.baseHref(), // if base[href] is undefined, it defaults to '' - initialUrl = $browser.url(), - appBase; - - if (html5Mode.enabled) { - if (!baseHref && html5Mode.requireBase) { - throw $locationMinErr('nobase', - '$location in HTML5 mode requires a tag to be present!'); - } - appBase = serverBase(initialUrl) + (baseHref || '/'); - LocationMode = $sniffer.history ? LocationHtml5Url : LocationHashbangInHtml5Url; - } else { - appBase = stripHash(initialUrl); - LocationMode = LocationHashbangUrl; - } - var appBaseNoFile = stripFile(appBase); - - $location = new LocationMode(appBase, appBaseNoFile, '#' + hashPrefix); - $location.$$parseLinkUrl(initialUrl, initialUrl); - - $location.$$state = $browser.state(); - - var IGNORE_URI_REGEXP = /^\s*(javascript|mailto):/i; - - // Determine if two URLs are equal despite potentially having different encoding/normalizing - // such as $location.absUrl() vs $browser.url() - // See https://github.com/angular/angular.js/issues/16592 - function urlsEqual(a, b) { - return a === b || urlResolve(a).href === urlResolve(b).href; - } - - function setBrowserUrlWithFallback(url, replace, state) { - var oldUrl = $location.url(); - var oldState = $location.$$state; - try { - $browser.url(url, replace, state); - - // Make sure $location.state() returns referentially identical (not just deeply equal) - // state object; this makes possible quick checking if the state changed in the digest - // loop. Checking deep equality would be too expensive. - $location.$$state = $browser.state(); - } catch (e) { - // Restore old values if pushState fails - $location.url(oldUrl); - $location.$$state = oldState; - - throw e; - } - } - - $rootElement.on('click', function (event) { - var rewriteLinks = html5Mode.rewriteLinks; - // TODO(vojta): rewrite link when opening in new tab/window (in legacy browser) - // currently we open nice url link and redirect then - - if (!rewriteLinks || event.ctrlKey || event.metaKey || event.shiftKey || event.which === 2 || event.button === 2) return; - - var elm = jqLite(event.target); - - // traverse the DOM up to find first A tag - while (nodeName_(elm[0]) !== 'a') { - // ignore rewriting if no A tag (reached root element, or no parent - removed from document) - if (elm[0] === $rootElement[0] || !(elm = elm.parent())[0]) return; - } - - if (isString(rewriteLinks) && isUndefined(elm.attr(rewriteLinks))) return; - - var absHref = elm.prop('href'); - // get the actual href attribute - see - // http://msdn.microsoft.com/en-us/library/ie/dd347148(v=vs.85).aspx - var relHref = elm.attr('href') || elm.attr('xlink:href'); - - if (isObject(absHref) && absHref.toString() === '[object SVGAnimatedString]') { - // SVGAnimatedString.animVal should be identical to SVGAnimatedString.baseVal, unless during - // an animation. - absHref = urlResolve(absHref.animVal).href; - } - - // Ignore when url is started with javascript: or mailto: - if (IGNORE_URI_REGEXP.test(absHref)) return; - - if (absHref && !elm.attr('target') && !event.isDefaultPrevented()) { - if ($location.$$parseLinkUrl(absHref, relHref)) { - // We do a preventDefault for all urls that are part of the AngularJS application, - // in html5mode and also without, so that we are able to abort navigation without - // getting double entries in the location history. - event.preventDefault(); - // update location manually - if ($location.absUrl() !== $browser.url()) { - $rootScope.$apply(); - } - } - } - }); - - - // rewrite hashbang url <> html5 url - if ($location.absUrl() !== initialUrl) { - $browser.url($location.absUrl(), true); - } - - var initializing = true; - - // update $location when $browser url changes - $browser.onUrlChange(function (newUrl, newState) { - - if (!startsWith(newUrl, appBaseNoFile)) { - // If we are navigating outside of the app then force a reload - $window.location.href = newUrl; - return; - } - - $rootScope.$evalAsync(function () { - var oldUrl = $location.absUrl(); - var oldState = $location.$$state; - var defaultPrevented; - $location.$$parse(newUrl); - $location.$$state = newState; - - defaultPrevented = $rootScope.$broadcast('$locationChangeStart', newUrl, oldUrl, - newState, oldState).defaultPrevented; - - // if the location was changed by a `$locationChangeStart` handler then stop - // processing this location change - if ($location.absUrl() !== newUrl) return; - - if (defaultPrevented) { - $location.$$parse(oldUrl); - $location.$$state = oldState; - setBrowserUrlWithFallback(oldUrl, false, oldState); - } else { - initializing = false; - afterLocationChange(oldUrl, oldState); - } - }); - if (!$rootScope.$$phase) $rootScope.$digest(); - }); - - // update browser - $rootScope.$watch(function $locationWatch() { - if (initializing || $location.$$urlUpdatedByLocation) { - $location.$$urlUpdatedByLocation = false; - - var oldUrl = $browser.url(); - var newUrl = $location.absUrl(); - var oldState = $browser.state(); - var currentReplace = $location.$$replace; - var urlOrStateChanged = !urlsEqual(oldUrl, newUrl) || - ($location.$$html5 && $sniffer.history && oldState !== $location.$$state); - - if (initializing || urlOrStateChanged) { - initializing = false; - - $rootScope.$evalAsync(function () { - var newUrl = $location.absUrl(); - var defaultPrevented = $rootScope.$broadcast('$locationChangeStart', newUrl, oldUrl, - $location.$$state, oldState).defaultPrevented; - - // if the location was changed by a `$locationChangeStart` handler then stop - // processing this location change - if ($location.absUrl() !== newUrl) return; - - if (defaultPrevented) { - $location.$$parse(oldUrl); - $location.$$state = oldState; - } else { - if (urlOrStateChanged) { - setBrowserUrlWithFallback(newUrl, currentReplace, - oldState === $location.$$state ? null : $location.$$state); - } - afterLocationChange(oldUrl, oldState); - } - }); - } - } - - $location.$$replace = false; - - // we don't need to return anything because $evalAsync will make the digest loop dirty when - // there is a change - }); - - return $location; - - function afterLocationChange(oldUrl, oldState) { - $rootScope.$broadcast('$locationChangeSuccess', $location.absUrl(), oldUrl, - $location.$$state, oldState); - } - } - ]; - } - - /** - * @ngdoc service - * @name $log - * @requires $window - * - * @description - * Simple service for logging. Default implementation safely writes the message - * into the browser's console (if present). - * - * The main purpose of this service is to simplify debugging and troubleshooting. - * - * To reveal the location of the calls to `$log` in the JavaScript console, - * you can "blackbox" the AngularJS source in your browser: - * - * [Mozilla description of blackboxing](https://developer.mozilla.org/en-US/docs/Tools/Debugger/How_to/Black_box_a_source). - * [Chrome description of blackboxing](https://developer.chrome.com/devtools/docs/blackboxing). - * - * Note: Not all browsers support blackboxing. - * - * The default is to log `debug` messages. You can use - * {@link ng.$logProvider ng.$logProvider#debugEnabled} to change this. - * - * @example - - - angular.module('logExample', []) - .controller('LogController', ['$scope', '$log', function($scope, $log) { - $scope.$log = $log; - $scope.message = 'Hello World!'; - }]); - - -
-

Reload this page with open console, enter text and hit the log button...

- - - - - - -
-
-
- */ - - /** - * @ngdoc provider - * @name $logProvider - * @this - * - * @description - * Use the `$logProvider` to configure how the application logs messages - */ - function $LogProvider() { - var debug = true, - self = this; - - /** - * @ngdoc method - * @name $logProvider#debugEnabled - * @description - * @param {boolean=} flag enable or disable debug level messages - * @returns {*} current value if used as getter or itself (chaining) if used as setter - */ - this.debugEnabled = function (flag) { - if (isDefined(flag)) { - debug = flag; - return this; - } else { - return debug; - } - }; - - this.$get = ['$window', function ($window) { - // Support: IE 9-11, Edge 12-14+ - // IE/Edge display errors in such a way that it requires the user to click in 4 places - // to see the stack trace. There is no way to feature-detect it so there's a chance - // of the user agent sniffing to go wrong but since it's only about logging, this shouldn't - // break apps. Other browsers display errors in a sensible way and some of them map stack - // traces along source maps if available so it makes sense to let browsers display it - // as they want. - var formatStackTrace = msie || /\bEdge\//.test($window.navigator && $window.navigator.userAgent); - - return { - /** - * @ngdoc method - * @name $log#log - * - * @description - * Write a log message - */ - log: consoleLog('log'), - - /** - * @ngdoc method - * @name $log#info - * - * @description - * Write an information message - */ - info: consoleLog('info'), - - /** - * @ngdoc method - * @name $log#warn - * - * @description - * Write a warning message - */ - warn: consoleLog('warn'), - - /** - * @ngdoc method - * @name $log#error - * - * @description - * Write an error message - */ - error: consoleLog('error'), - - /** - * @ngdoc method - * @name $log#debug - * - * @description - * Write a debug message - */ - debug: (function () { - var fn = consoleLog('debug'); - - return function () { - if (debug) { - fn.apply(self, arguments); - } - }; - })() - }; - - function formatError(arg) { - if (isError(arg)) { - if (arg.stack && formatStackTrace) { - arg = (arg.message && arg.stack.indexOf(arg.message) === -1) ? - 'Error: ' + arg.message + '\n' + arg.stack : - arg.stack; - } else if (arg.sourceURL) { - arg = arg.message + '\n' + arg.sourceURL + ':' + arg.line; - } - } - return arg; - } - - function consoleLog(type) { - var console = $window.console || {}, - logFn = console[type] || console.log || noop; - - return function () { - var args = []; - forEach(arguments, function (arg) { - args.push(formatError(arg)); - }); - // Support: IE 9 only - // console methods don't inherit from Function.prototype in IE 9 so we can't - // call `logFn.apply(console, args)` directly. - return Function.prototype.apply.call(logFn, console, args); - }; - } - }]; - } - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Any commits to this file should be reviewed with security in mind. * - * Changes to this file can potentially create security vulnerabilities. * - * An approval from 2 Core members with history of modifying * - * this file is required. * - * * - * Does the change somehow allow for arbitrary javascript to be executed? * - * Or allows for someone to change the prototype of built-in objects? * - * Or gives undesired access to variables likes document or window? * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - var $parseMinErr = minErr('$parse'); - - var objectValueOf = {}.constructor.prototype.valueOf; - - // Sandboxing AngularJS Expressions - // ------------------------------ - // AngularJS expressions are no longer sandboxed. So it is now even easier to access arbitrary JS code by - // various means such as obtaining a reference to native JS functions like the Function constructor. - // - // As an example, consider the following AngularJS expression: - // - // {}.toString.constructor('alert("evil JS code")') - // - // It is important to realize that if you create an expression from a string that contains user provided - // content then it is possible that your application contains a security vulnerability to an XSS style attack. - // - // See https://docs.angularjs.org/guide/security - - - function getStringValue(name) { - // Property names must be strings. This means that non-string objects cannot be used - // as keys in an object. Any non-string object, including a number, is typecasted - // into a string via the toString method. - // -- MDN, https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Property_accessors#Property_names - // - // So, to ensure that we are checking the same `name` that JavaScript would use, we cast it - // to a string. It's not always possible. If `name` is an object and its `toString` method is - // 'broken' (doesn't return a string, isn't a function, etc.), an error will be thrown: - // - // TypeError: Cannot convert object to primitive value - // - // For performance reasons, we don't catch this error here and allow it to propagate up the call - // stack. Note that you'll get the same error in JavaScript if you try to access a property using - // such a 'broken' object as a key. - return name + ''; - } - - - var OPERATORS = createMap(); - forEach('+ - * / % === !== == != < > <= >= && || ! = |'.split(' '), function (operator) { - OPERATORS[operator] = true; - }); - var ESCAPE = { - 'n': '\n', - 'f': '\f', - 'r': '\r', - 't': '\t', - 'v': '\v', - '\'': '\'', - '"': '"' - }; - - - ///////////////////////////////////////// - - - /** - * @constructor - */ - var Lexer = function Lexer(options) { - this.options = options; - }; - - Lexer.prototype = { - constructor: Lexer, - - lex: function (text) { - this.text = text; - this.index = 0; - this.tokens = []; - - while (this.index < this.text.length) { - var ch = this.text.charAt(this.index); - if (ch === '"' || ch === '\'') { - this.readString(ch); - } else if (this.isNumber(ch) || ch === '.' && this.isNumber(this.peek())) { - this.readNumber(); - } else if (this.isIdentifierStart(this.peekMultichar())) { - this.readIdent(); - } else if (this.is(ch, '(){}[].,;:?')) { - this.tokens.push({ - index: this.index, - text: ch - }); - this.index++; - } else if (this.isWhitespace(ch)) { - this.index++; - } else { - var ch2 = ch + this.peek(); - var ch3 = ch2 + this.peek(2); - var op1 = OPERATORS[ch]; - var op2 = OPERATORS[ch2]; - var op3 = OPERATORS[ch3]; - if (op1 || op2 || op3) { - var token = op3 ? ch3 : (op2 ? ch2 : ch); - this.tokens.push({ - index: this.index, - text: token, - operator: true - }); - this.index += token.length; - } else { - this.throwError('Unexpected next character ', this.index, this.index + 1); - } - } - } - return this.tokens; - }, - - is: function (ch, chars) { - return chars.indexOf(ch) !== -1; - }, - - peek: function (i) { - var num = i || 1; - return (this.index + num < this.text.length) ? this.text.charAt(this.index + num) : false; - }, - - isNumber: function (ch) { - return ('0' <= ch && ch <= '9') && typeof ch === 'string'; - }, - - isWhitespace: function (ch) { - // IE treats non-breaking space as \u00A0 - return (ch === ' ' || ch === '\r' || ch === '\t' || - ch === '\n' || ch === '\v' || ch === '\u00A0'); - }, - - isIdentifierStart: function (ch) { - return this.options.isIdentifierStart ? - this.options.isIdentifierStart(ch, this.codePointAt(ch)) : - this.isValidIdentifierStart(ch); - }, - - isValidIdentifierStart: function (ch) { - return ('a' <= ch && ch <= 'z' || - 'A' <= ch && ch <= 'Z' || - '_' === ch || ch === '$'); - }, - - isIdentifierContinue: function (ch) { - return this.options.isIdentifierContinue ? - this.options.isIdentifierContinue(ch, this.codePointAt(ch)) : - this.isValidIdentifierContinue(ch); - }, - - isValidIdentifierContinue: function (ch, cp) { - return this.isValidIdentifierStart(ch, cp) || this.isNumber(ch); - }, - - codePointAt: function (ch) { - if (ch.length === 1) return ch.charCodeAt(0); - // eslint-disable-next-line no-bitwise - return (ch.charCodeAt(0) << 10) + ch.charCodeAt(1) - 0x35FDC00; - }, - - peekMultichar: function () { - var ch = this.text.charAt(this.index); - var peek = this.peek(); - if (!peek) { - return ch; - } - var cp1 = ch.charCodeAt(0); - var cp2 = peek.charCodeAt(0); - if (cp1 >= 0xD800 && cp1 <= 0xDBFF && cp2 >= 0xDC00 && cp2 <= 0xDFFF) { - return ch + peek; - } - return ch; - }, - - isExpOperator: function (ch) { - return (ch === '-' || ch === '+' || this.isNumber(ch)); - }, - - throwError: function (error, start, end) { - end = end || this.index; - var colStr = (isDefined(start) ? - 's ' + start + '-' + this.index + ' [' + this.text.substring(start, end) + ']' : - ' ' + end); - throw $parseMinErr('lexerr', 'Lexer Error: {0} at column{1} in expression [{2}].', - error, colStr, this.text); - }, - - readNumber: function () { - var number = ''; - var start = this.index; - while (this.index < this.text.length) { - var ch = lowercase(this.text.charAt(this.index)); - if (ch === '.' || this.isNumber(ch)) { - number += ch; - } else { - var peekCh = this.peek(); - if (ch === 'e' && this.isExpOperator(peekCh)) { - number += ch; - } else if (this.isExpOperator(ch) && - peekCh && this.isNumber(peekCh) && - number.charAt(number.length - 1) === 'e') { - number += ch; - } else if (this.isExpOperator(ch) && - (!peekCh || !this.isNumber(peekCh)) && - number.charAt(number.length - 1) === 'e') { - this.throwError('Invalid exponent'); - } else { - break; - } - } - this.index++; - } - this.tokens.push({ - index: start, - text: number, - constant: true, - value: Number(number) - }); - }, - - readIdent: function () { - var start = this.index; - this.index += this.peekMultichar().length; - while (this.index < this.text.length) { - var ch = this.peekMultichar(); - if (!this.isIdentifierContinue(ch)) { - break; - } - this.index += ch.length; - } - this.tokens.push({ - index: start, - text: this.text.slice(start, this.index), - identifier: true - }); - }, - - readString: function (quote) { - var start = this.index; - this.index++; - var string = ''; - var rawString = quote; - var escape = false; - while (this.index < this.text.length) { - var ch = this.text.charAt(this.index); - rawString += ch; - if (escape) { - if (ch === 'u') { - var hex = this.text.substring(this.index + 1, this.index + 5); - if (!hex.match(/[\da-f]{4}/i)) { - this.throwError('Invalid unicode escape [\\u' + hex + ']'); - } - this.index += 4; - string += String.fromCharCode(parseInt(hex, 16)); - } else { - var rep = ESCAPE[ch]; - string = string + (rep || ch); - } - escape = false; - } else if (ch === '\\') { - escape = true; - } else if (ch === quote) { - this.index++; - this.tokens.push({ - index: start, - text: rawString, - constant: true, - value: string - }); - return; - } else { - string += ch; - } - this.index++; - } - this.throwError('Unterminated quote', start); - } - }; - - var AST = function AST(lexer, options) { - this.lexer = lexer; - this.options = options; - }; - - AST.Program = 'Program'; - AST.ExpressionStatement = 'ExpressionStatement'; - AST.AssignmentExpression = 'AssignmentExpression'; - AST.ConditionalExpression = 'ConditionalExpression'; - AST.LogicalExpression = 'LogicalExpression'; - AST.BinaryExpression = 'BinaryExpression'; - AST.UnaryExpression = 'UnaryExpression'; - AST.CallExpression = 'CallExpression'; - AST.MemberExpression = 'MemberExpression'; - AST.Identifier = 'Identifier'; - AST.Literal = 'Literal'; - AST.ArrayExpression = 'ArrayExpression'; - AST.Property = 'Property'; - AST.ObjectExpression = 'ObjectExpression'; - AST.ThisExpression = 'ThisExpression'; - AST.LocalsExpression = 'LocalsExpression'; - - // Internal use only - AST.NGValueParameter = 'NGValueParameter'; - - AST.prototype = { - ast: function (text) { - this.text = text; - this.tokens = this.lexer.lex(text); - - var value = this.program(); - - if (this.tokens.length !== 0) { - this.throwError('is an unexpected token', this.tokens[0]); - } - - return value; - }, - - program: function () { - var body = []; - while (true) { - if (this.tokens.length > 0 && !this.peek('}', ')', ';', ']')) - body.push(this.expressionStatement()); - if (!this.expect(';')) { - return { - type: AST.Program, - body: body - }; - } - } - }, - - expressionStatement: function () { - return { - type: AST.ExpressionStatement, - expression: this.filterChain() - }; - }, - - filterChain: function () { - var left = this.expression(); - while (this.expect('|')) { - left = this.filter(left); - } - return left; - }, - - expression: function () { - return this.assignment(); - }, - - assignment: function () { - var result = this.ternary(); - if (this.expect('=')) { - if (!isAssignable(result)) { - throw $parseMinErr('lval', 'Trying to assign a value to a non l-value'); - } - - result = { - type: AST.AssignmentExpression, - left: result, - right: this.assignment(), - operator: '=' - }; - } - return result; - }, - - ternary: function () { - var test = this.logicalOR(); - var alternate; - var consequent; - if (this.expect('?')) { - alternate = this.expression(); - if (this.consume(':')) { - consequent = this.expression(); - return { - type: AST.ConditionalExpression, - test: test, - alternate: alternate, - consequent: consequent - }; - } - } - return test; - }, - - logicalOR: function () { - var left = this.logicalAND(); - while (this.expect('||')) { - left = { - type: AST.LogicalExpression, - operator: '||', - left: left, - right: this.logicalAND() - }; - } - return left; - }, - - logicalAND: function () { - var left = this.equality(); - while (this.expect('&&')) { - left = { - type: AST.LogicalExpression, - operator: '&&', - left: left, - right: this.equality() - }; - } - return left; - }, - - equality: function () { - var left = this.relational(); - var token; - while ((token = this.expect('==', '!=', '===', '!=='))) { - left = { - type: AST.BinaryExpression, - operator: token.text, - left: left, - right: this.relational() - }; - } - return left; - }, - - relational: function () { - var left = this.additive(); - var token; - while ((token = this.expect('<', '>', '<=', '>='))) { - left = { - type: AST.BinaryExpression, - operator: token.text, - left: left, - right: this.additive() - }; - } - return left; - }, - - additive: function () { - var left = this.multiplicative(); - var token; - while ((token = this.expect('+', '-'))) { - left = { - type: AST.BinaryExpression, - operator: token.text, - left: left, - right: this.multiplicative() - }; - } - return left; - }, - - multiplicative: function () { - var left = this.unary(); - var token; - while ((token = this.expect('*', '/', '%'))) { - left = { - type: AST.BinaryExpression, - operator: token.text, - left: left, - right: this.unary() - }; - } - return left; - }, - - unary: function () { - var token; - if ((token = this.expect('+', '-', '!'))) { - return { - type: AST.UnaryExpression, - operator: token.text, - prefix: true, - argument: this.unary() - }; - } else { - return this.primary(); - } - }, - - primary: function () { - var primary; - if (this.expect('(')) { - primary = this.filterChain(); - this.consume(')'); - } else if (this.expect('[')) { - primary = this.arrayDeclaration(); - } else if (this.expect('{')) { - primary = this.object(); - } else if (this.selfReferential.hasOwnProperty(this.peek().text)) { - primary = copy(this.selfReferential[this.consume().text]); - } else if (this.options.literals.hasOwnProperty(this.peek().text)) { - primary = { - type: AST.Literal, - value: this.options.literals[this.consume().text] - }; - } else if (this.peek().identifier) { - primary = this.identifier(); - } else if (this.peek().constant) { - primary = this.constant(); - } else { - this.throwError('not a primary expression', this.peek()); - } - - var next; - while ((next = this.expect('(', '[', '.'))) { - if (next.text === '(') { - primary = { - type: AST.CallExpression, - callee: primary, - arguments: this.parseArguments() - }; - this.consume(')'); - } else if (next.text === '[') { - primary = { - type: AST.MemberExpression, - object: primary, - property: this.expression(), - computed: true - }; - this.consume(']'); - } else if (next.text === '.') { - primary = { - type: AST.MemberExpression, - object: primary, - property: this.identifier(), - computed: false - }; - } else { - this.throwError('IMPOSSIBLE'); - } - } - return primary; - }, - - filter: function (baseExpression) { - var args = [baseExpression]; - var result = { - type: AST.CallExpression, - callee: this.identifier(), - arguments: args, - filter: true - }; - - while (this.expect(':')) { - args.push(this.expression()); - } - - return result; - }, - - parseArguments: function () { - var args = []; - if (this.peekToken().text !== ')') { - do { - args.push(this.filterChain()); - } while (this.expect(',')); - } - return args; - }, - - identifier: function () { - var token = this.consume(); - if (!token.identifier) { - this.throwError('is not a valid identifier', token); - } - return { - type: AST.Identifier, - name: token.text - }; - }, - - constant: function () { - // TODO check that it is a constant - return { - type: AST.Literal, - value: this.consume().value - }; - }, - - arrayDeclaration: function () { - var elements = []; - if (this.peekToken().text !== ']') { - do { - if (this.peek(']')) { - // Support trailing commas per ES5.1. - break; - } - elements.push(this.expression()); - } while (this.expect(',')); - } - this.consume(']'); - - return { - type: AST.ArrayExpression, - elements: elements - }; - }, - - object: function () { - var properties = [], - property; - if (this.peekToken().text !== '}') { - do { - if (this.peek('}')) { - // Support trailing commas per ES5.1. - break; - } - property = { - type: AST.Property, - kind: 'init' - }; - if (this.peek().constant) { - property.key = this.constant(); - property.computed = false; - this.consume(':'); - property.value = this.expression(); - } else if (this.peek().identifier) { - property.key = this.identifier(); - property.computed = false; - if (this.peek(':')) { - this.consume(':'); - property.value = this.expression(); - } else { - property.value = property.key; - } - } else if (this.peek('[')) { - this.consume('['); - property.key = this.expression(); - this.consume(']'); - property.computed = true; - this.consume(':'); - property.value = this.expression(); - } else { - this.throwError('invalid key', this.peek()); - } - properties.push(property); - } while (this.expect(',')); - } - this.consume('}'); - - return { - type: AST.ObjectExpression, - properties: properties - }; - }, - - throwError: function (msg, token) { - throw $parseMinErr('syntax', - 'Syntax Error: Token \'{0}\' {1} at column {2} of the expression [{3}] starting at [{4}].', - token.text, msg, (token.index + 1), this.text, this.text.substring(token.index)); - }, - - consume: function (e1) { - if (this.tokens.length === 0) { - throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text); - } - - var token = this.expect(e1); - if (!token) { - this.throwError('is unexpected, expecting [' + e1 + ']', this.peek()); - } - return token; - }, - - peekToken: function () { - if (this.tokens.length === 0) { - throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text); - } - return this.tokens[0]; - }, - - peek: function (e1, e2, e3, e4) { - return this.peekAhead(0, e1, e2, e3, e4); - }, - - peekAhead: function (i, e1, e2, e3, e4) { - if (this.tokens.length > i) { - var token = this.tokens[i]; - var t = token.text; - if (t === e1 || t === e2 || t === e3 || t === e4 || - (!e1 && !e2 && !e3 && !e4)) { - return token; - } - } - return false; - }, - - expect: function (e1, e2, e3, e4) { - var token = this.peek(e1, e2, e3, e4); - if (token) { - this.tokens.shift(); - return token; - } - return false; - }, - - selfReferential: { - 'this': { - type: AST.ThisExpression - }, - '$locals': { - type: AST.LocalsExpression - } - } - }; - - function ifDefined(v, d) { - return typeof v !== 'undefined' ? v : d; - } - - function plusFn(l, r) { - if (typeof l === 'undefined') return r; - if (typeof r === 'undefined') return l; - return l + r; - } - - function isStateless($filter, filterName) { - var fn = $filter(filterName); - return !fn.$stateful; - } - - var PURITY_ABSOLUTE = 1; - var PURITY_RELATIVE = 2; - - // Detect nodes which could depend on non-shallow state of objects - function isPure(node, parentIsPure) { - switch (node.type) { - // Computed members might invoke a stateful toString() - case AST.MemberExpression: - if (node.computed) { - return false; - } - break; - - // Unary always convert to primative - case AST.UnaryExpression: - return PURITY_ABSOLUTE; - - // The binary + operator can invoke a stateful toString(). - case AST.BinaryExpression: - return node.operator !== '+' ? PURITY_ABSOLUTE : false; - - // Functions / filters probably read state from within objects - case AST.CallExpression: - return false; - } - - return (undefined === parentIsPure) ? PURITY_RELATIVE : parentIsPure; - } - - function findConstantAndWatchExpressions(ast, $filter, parentIsPure) { - var allConstants; - var argsToWatch; - var isStatelessFilter; - - var astIsPure = ast.isPure = isPure(ast, parentIsPure); - - switch (ast.type) { - case AST.Program: - allConstants = true; - forEach(ast.body, function (expr) { - findConstantAndWatchExpressions(expr.expression, $filter, astIsPure); - allConstants = allConstants && expr.expression.constant; - }); - ast.constant = allConstants; - break; - case AST.Literal: - ast.constant = true; - ast.toWatch = []; - break; - case AST.UnaryExpression: - findConstantAndWatchExpressions(ast.argument, $filter, astIsPure); - ast.constant = ast.argument.constant; - ast.toWatch = ast.argument.toWatch; - break; - case AST.BinaryExpression: - findConstantAndWatchExpressions(ast.left, $filter, astIsPure); - findConstantAndWatchExpressions(ast.right, $filter, astIsPure); - ast.constant = ast.left.constant && ast.right.constant; - ast.toWatch = ast.left.toWatch.concat(ast.right.toWatch); - break; - case AST.LogicalExpression: - findConstantAndWatchExpressions(ast.left, $filter, astIsPure); - findConstantAndWatchExpressions(ast.right, $filter, astIsPure); - ast.constant = ast.left.constant && ast.right.constant; - ast.toWatch = ast.constant ? [] : [ast]; - break; - case AST.ConditionalExpression: - findConstantAndWatchExpressions(ast.test, $filter, astIsPure); - findConstantAndWatchExpressions(ast.alternate, $filter, astIsPure); - findConstantAndWatchExpressions(ast.consequent, $filter, astIsPure); - ast.constant = ast.test.constant && ast.alternate.constant && ast.consequent.constant; - ast.toWatch = ast.constant ? [] : [ast]; - break; - case AST.Identifier: - ast.constant = false; - ast.toWatch = [ast]; - break; - case AST.MemberExpression: - findConstantAndWatchExpressions(ast.object, $filter, astIsPure); - if (ast.computed) { - findConstantAndWatchExpressions(ast.property, $filter, astIsPure); - } - ast.constant = ast.object.constant && (!ast.computed || ast.property.constant); - ast.toWatch = ast.constant ? [] : [ast]; - break; - case AST.CallExpression: - isStatelessFilter = ast.filter ? isStateless($filter, ast.callee.name) : false; - allConstants = isStatelessFilter; - argsToWatch = []; - forEach(ast.arguments, function (expr) { - findConstantAndWatchExpressions(expr, $filter, astIsPure); - allConstants = allConstants && expr.constant; - argsToWatch.push.apply(argsToWatch, expr.toWatch); - }); - ast.constant = allConstants; - ast.toWatch = isStatelessFilter ? argsToWatch : [ast]; - break; - case AST.AssignmentExpression: - findConstantAndWatchExpressions(ast.left, $filter, astIsPure); - findConstantAndWatchExpressions(ast.right, $filter, astIsPure); - ast.constant = ast.left.constant && ast.right.constant; - ast.toWatch = [ast]; - break; - case AST.ArrayExpression: - allConstants = true; - argsToWatch = []; - forEach(ast.elements, function (expr) { - findConstantAndWatchExpressions(expr, $filter, astIsPure); - allConstants = allConstants && expr.constant; - argsToWatch.push.apply(argsToWatch, expr.toWatch); - }); - ast.constant = allConstants; - ast.toWatch = argsToWatch; - break; - case AST.ObjectExpression: - allConstants = true; - argsToWatch = []; - forEach(ast.properties, function (property) { - findConstantAndWatchExpressions(property.value, $filter, astIsPure); - allConstants = allConstants && property.value.constant; - argsToWatch.push.apply(argsToWatch, property.value.toWatch); - if (property.computed) { - //`{[key]: value}` implicitly does `key.toString()` which may be non-pure - findConstantAndWatchExpressions(property.key, $filter, /*parentIsPure=*/ false); - allConstants = allConstants && property.key.constant; - argsToWatch.push.apply(argsToWatch, property.key.toWatch); - } - }); - ast.constant = allConstants; - ast.toWatch = argsToWatch; - break; - case AST.ThisExpression: - ast.constant = false; - ast.toWatch = []; - break; - case AST.LocalsExpression: - ast.constant = false; - ast.toWatch = []; - break; - } - } - - function getInputs(body) { - if (body.length !== 1) return; - var lastExpression = body[0].expression; - var candidate = lastExpression.toWatch; - if (candidate.length !== 1) return candidate; - return candidate[0] !== lastExpression ? candidate : undefined; - } - - function isAssignable(ast) { - return ast.type === AST.Identifier || ast.type === AST.MemberExpression; - } - - function assignableAST(ast) { - if (ast.body.length === 1 && isAssignable(ast.body[0].expression)) { - return { - type: AST.AssignmentExpression, - left: ast.body[0].expression, - right: { - type: AST.NGValueParameter - }, - operator: '=' - }; - } - } - - function isLiteral(ast) { - return ast.body.length === 0 || - ast.body.length === 1 && ( - ast.body[0].expression.type === AST.Literal || - ast.body[0].expression.type === AST.ArrayExpression || - ast.body[0].expression.type === AST.ObjectExpression); - } - - function isConstant(ast) { - return ast.constant; - } - - function ASTCompiler($filter) { - this.$filter = $filter; - } - - ASTCompiler.prototype = { - compile: function (ast) { - var self = this; - this.state = { - nextId: 0, - filters: {}, - fn: { - vars: [], - body: [], - own: {} - }, - assign: { - vars: [], - body: [], - own: {} - }, - inputs: [] - }; - findConstantAndWatchExpressions(ast, self.$filter); - var extra = ''; - var assignable; - this.stage = 'assign'; - if ((assignable = assignableAST(ast))) { - this.state.computing = 'assign'; - var result = this.nextId(); - this.recurse(assignable, result); - this.return_(result); - extra = 'fn.assign=' + this.generateFunction('assign', 's,v,l'); - } - var toWatch = getInputs(ast.body); - self.stage = 'inputs'; - forEach(toWatch, function (watch, key) { - var fnKey = 'fn' + key; - self.state[fnKey] = { - vars: [], - body: [], - own: {} - }; - self.state.computing = fnKey; - var intoId = self.nextId(); - self.recurse(watch, intoId); - self.return_(intoId); - self.state.inputs.push({ - name: fnKey, - isPure: watch.isPure - }); - watch.watchId = key; - }); - this.state.computing = 'fn'; - this.stage = 'main'; - this.recurse(ast); - var fnString = - // The build and minification steps remove the string "use strict" from the code, but this is done using a regex. - // This is a workaround for this until we do a better job at only removing the prefix only when we should. - '"' + this.USE + ' ' + this.STRICT + '";\n' + - this.filterPrefix() + - 'var fn=' + this.generateFunction('fn', 's,l,a,i') + - extra + - this.watchFns() + - 'return fn;'; - - // eslint-disable-next-line no-new-func - var fn = (new Function('$filter', - 'getStringValue', - 'ifDefined', - 'plus', - fnString))( - this.$filter, - getStringValue, - ifDefined, - plusFn); - this.state = this.stage = undefined; - return fn; - }, - - USE: 'use', - - STRICT: 'strict', - - watchFns: function () { - var result = []; - var inputs = this.state.inputs; - var self = this; - forEach(inputs, function (input) { - result.push('var ' + input.name + '=' + self.generateFunction(input.name, 's')); - if (input.isPure) { - result.push(input.name, '.isPure=' + JSON.stringify(input.isPure) + ';'); - } - }); - if (inputs.length) { - result.push('fn.inputs=[' + inputs.map(function (i) { - return i.name; - }).join(',') + '];'); - } - return result.join(''); - }, - - generateFunction: function (name, params) { - return 'function(' + params + '){' + - this.varsPrefix(name) + - this.body(name) + - '};'; - }, - - filterPrefix: function () { - var parts = []; - var self = this; - forEach(this.state.filters, function (id, filter) { - parts.push(id + '=$filter(' + self.escape(filter) + ')'); - }); - if (parts.length) return 'var ' + parts.join(',') + ';'; - return ''; - }, - - varsPrefix: function (section) { - return this.state[section].vars.length ? 'var ' + this.state[section].vars.join(',') + ';' : ''; - }, - - body: function (section) { - return this.state[section].body.join(''); - }, - - recurse: function (ast, intoId, nameId, recursionFn, create, skipWatchIdCheck) { - var left, right, self = this, - args, expression, computed; - recursionFn = recursionFn || noop; - if (!skipWatchIdCheck && isDefined(ast.watchId)) { - intoId = intoId || this.nextId(); - this.if_('i', - this.lazyAssign(intoId, this.computedMember('i', ast.watchId)), - this.lazyRecurse(ast, intoId, nameId, recursionFn, create, true) - ); - return; - } - switch (ast.type) { - case AST.Program: - forEach(ast.body, function (expression, pos) { - self.recurse(expression.expression, undefined, undefined, function (expr) { - right = expr; - }); - if (pos !== ast.body.length - 1) { - self.current().body.push(right, ';'); - } else { - self.return_(right); - } - }); - break; - case AST.Literal: - expression = this.escape(ast.value); - this.assign(intoId, expression); - recursionFn(intoId || expression); - break; - case AST.UnaryExpression: - this.recurse(ast.argument, undefined, undefined, function (expr) { - right = expr; - }); - expression = ast.operator + '(' + this.ifDefined(right, 0) + ')'; - this.assign(intoId, expression); - recursionFn(expression); - break; - case AST.BinaryExpression: - this.recurse(ast.left, undefined, undefined, function (expr) { - left = expr; - }); - this.recurse(ast.right, undefined, undefined, function (expr) { - right = expr; - }); - if (ast.operator === '+') { - expression = this.plus(left, right); - } else if (ast.operator === '-') { - expression = this.ifDefined(left, 0) + ast.operator + this.ifDefined(right, 0); - } else { - expression = '(' + left + ')' + ast.operator + '(' + right + ')'; - } - this.assign(intoId, expression); - recursionFn(expression); - break; - case AST.LogicalExpression: - intoId = intoId || this.nextId(); - self.recurse(ast.left, intoId); - self.if_(ast.operator === '&&' ? intoId : self.not(intoId), self.lazyRecurse(ast.right, intoId)); - recursionFn(intoId); - break; - case AST.ConditionalExpression: - intoId = intoId || this.nextId(); - self.recurse(ast.test, intoId); - self.if_(intoId, self.lazyRecurse(ast.alternate, intoId), self.lazyRecurse(ast.consequent, intoId)); - recursionFn(intoId); - break; - case AST.Identifier: - intoId = intoId || this.nextId(); - if (nameId) { - nameId.context = self.stage === 'inputs' ? 's' : this.assign(this.nextId(), this.getHasOwnProperty('l', ast.name) + '?l:s'); - nameId.computed = false; - nameId.name = ast.name; - } - self.if_(self.stage === 'inputs' || self.not(self.getHasOwnProperty('l', ast.name)), - function () { - self.if_(self.stage === 'inputs' || 's', function () { - if (create && create !== 1) { - self.if_( - self.isNull(self.nonComputedMember('s', ast.name)), - self.lazyAssign(self.nonComputedMember('s', ast.name), '{}')); - } - self.assign(intoId, self.nonComputedMember('s', ast.name)); - }); - }, intoId && self.lazyAssign(intoId, self.nonComputedMember('l', ast.name)) - ); - recursionFn(intoId); - break; - case AST.MemberExpression: - left = nameId && (nameId.context = this.nextId()) || this.nextId(); - intoId = intoId || this.nextId(); - self.recurse(ast.object, left, undefined, function () { - self.if_(self.notNull(left), function () { - if (ast.computed) { - right = self.nextId(); - self.recurse(ast.property, right); - self.getStringValue(right); - if (create && create !== 1) { - self.if_(self.not(self.computedMember(left, right)), self.lazyAssign(self.computedMember(left, right), '{}')); - } - expression = self.computedMember(left, right); - self.assign(intoId, expression); - if (nameId) { - nameId.computed = true; - nameId.name = right; - } - } else { - if (create && create !== 1) { - self.if_(self.isNull(self.nonComputedMember(left, ast.property.name)), self.lazyAssign(self.nonComputedMember(left, ast.property.name), '{}')); - } - expression = self.nonComputedMember(left, ast.property.name); - self.assign(intoId, expression); - if (nameId) { - nameId.computed = false; - nameId.name = ast.property.name; - } - } - }, function () { - self.assign(intoId, 'undefined'); - }); - recursionFn(intoId); - }, !!create); - break; - case AST.CallExpression: - intoId = intoId || this.nextId(); - if (ast.filter) { - right = self.filter(ast.callee.name); - args = []; - forEach(ast.arguments, function (expr) { - var argument = self.nextId(); - self.recurse(expr, argument); - args.push(argument); - }); - expression = right + '(' + args.join(',') + ')'; - self.assign(intoId, expression); - recursionFn(intoId); - } else { - right = self.nextId(); - left = {}; - args = []; - self.recurse(ast.callee, right, left, function () { - self.if_(self.notNull(right), function () { - forEach(ast.arguments, function (expr) { - self.recurse(expr, ast.constant ? undefined : self.nextId(), undefined, function (argument) { - args.push(argument); - }); - }); - if (left.name) { - expression = self.member(left.context, left.name, left.computed) + '(' + args.join(',') + ')'; - } else { - expression = right + '(' + args.join(',') + ')'; - } - self.assign(intoId, expression); - }, function () { - self.assign(intoId, 'undefined'); - }); - recursionFn(intoId); - }); - } - break; - case AST.AssignmentExpression: - right = this.nextId(); - left = {}; - this.recurse(ast.left, undefined, left, function () { - self.if_(self.notNull(left.context), function () { - self.recurse(ast.right, right); - expression = self.member(left.context, left.name, left.computed) + ast.operator + right; - self.assign(intoId, expression); - recursionFn(intoId || expression); - }); - }, 1); - break; - case AST.ArrayExpression: - args = []; - forEach(ast.elements, function (expr) { - self.recurse(expr, ast.constant ? undefined : self.nextId(), undefined, function (argument) { - args.push(argument); - }); - }); - expression = '[' + args.join(',') + ']'; - this.assign(intoId, expression); - recursionFn(intoId || expression); - break; - case AST.ObjectExpression: - args = []; - computed = false; - forEach(ast.properties, function (property) { - if (property.computed) { - computed = true; - } - }); - if (computed) { - intoId = intoId || this.nextId(); - this.assign(intoId, '{}'); - forEach(ast.properties, function (property) { - if (property.computed) { - left = self.nextId(); - self.recurse(property.key, left); - } else { - left = property.key.type === AST.Identifier ? - property.key.name : - ('' + property.key.value); - } - right = self.nextId(); - self.recurse(property.value, right); - self.assign(self.member(intoId, left, property.computed), right); - }); - } else { - forEach(ast.properties, function (property) { - self.recurse(property.value, ast.constant ? undefined : self.nextId(), undefined, function (expr) { - args.push(self.escape( - property.key.type === AST.Identifier ? property.key.name : - ('' + property.key.value)) + - ':' + expr); - }); - }); - expression = '{' + args.join(',') + '}'; - this.assign(intoId, expression); - } - recursionFn(intoId || expression); - break; - case AST.ThisExpression: - this.assign(intoId, 's'); - recursionFn(intoId || 's'); - break; - case AST.LocalsExpression: - this.assign(intoId, 'l'); - recursionFn(intoId || 'l'); - break; - case AST.NGValueParameter: - this.assign(intoId, 'v'); - recursionFn(intoId || 'v'); - break; - } - }, - - getHasOwnProperty: function (element, property) { - var key = element + '.' + property; - var own = this.current().own; - if (!own.hasOwnProperty(key)) { - own[key] = this.nextId(false, element + '&&(' + this.escape(property) + ' in ' + element + ')'); - } - return own[key]; - }, - - assign: function (id, value) { - if (!id) return; - this.current().body.push(id, '=', value, ';'); - return id; - }, - - filter: function (filterName) { - if (!this.state.filters.hasOwnProperty(filterName)) { - this.state.filters[filterName] = this.nextId(true); - } - return this.state.filters[filterName]; - }, - - ifDefined: function (id, defaultValue) { - return 'ifDefined(' + id + ',' + this.escape(defaultValue) + ')'; - }, - - plus: function (left, right) { - return 'plus(' + left + ',' + right + ')'; - }, - - return_: function (id) { - this.current().body.push('return ', id, ';'); - }, - - if_: function (test, alternate, consequent) { - if (test === true) { - alternate(); - } else { - var body = this.current().body; - body.push('if(', test, '){'); - alternate(); - body.push('}'); - if (consequent) { - body.push('else{'); - consequent(); - body.push('}'); - } - } - }, - - not: function (expression) { - return '!(' + expression + ')'; - }, - - isNull: function (expression) { - return expression + '==null'; - }, - - notNull: function (expression) { - return expression + '!=null'; - }, - - nonComputedMember: function (left, right) { - var SAFE_IDENTIFIER = /^[$_a-zA-Z][$_a-zA-Z0-9]*$/; - var UNSAFE_CHARACTERS = /[^$_a-zA-Z0-9]/g; - if (SAFE_IDENTIFIER.test(right)) { - return left + '.' + right; - } else { - return left + '["' + right.replace(UNSAFE_CHARACTERS, this.stringEscapeFn) + '"]'; - } - }, - - computedMember: function (left, right) { - return left + '[' + right + ']'; - }, - - member: function (left, right, computed) { - if (computed) return this.computedMember(left, right); - return this.nonComputedMember(left, right); - }, - - getStringValue: function (item) { - this.assign(item, 'getStringValue(' + item + ')'); - }, - - lazyRecurse: function (ast, intoId, nameId, recursionFn, create, skipWatchIdCheck) { - var self = this; - return function () { - self.recurse(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck); - }; - }, - - lazyAssign: function (id, value) { - var self = this; - return function () { - self.assign(id, value); - }; - }, - - stringEscapeRegex: /[^ a-zA-Z0-9]/g, - - stringEscapeFn: function (c) { - return '\\u' + ('0000' + c.charCodeAt(0).toString(16)).slice(-4); - }, - - escape: function (value) { - if (isString(value)) return '\'' + value.replace(this.stringEscapeRegex, this.stringEscapeFn) + '\''; - if (isNumber(value)) return value.toString(); - if (value === true) return 'true'; - if (value === false) return 'false'; - if (value === null) return 'null'; - if (typeof value === 'undefined') return 'undefined'; - - throw $parseMinErr('esc', 'IMPOSSIBLE'); - }, - - nextId: function (skip, init) { - var id = 'v' + (this.state.nextId++); - if (!skip) { - this.current().vars.push(id + (init ? '=' + init : '')); - } - return id; - }, - - current: function () { - return this.state[this.state.computing]; - } - }; - - - function ASTInterpreter($filter) { - this.$filter = $filter; - } - - ASTInterpreter.prototype = { - compile: function (ast) { - var self = this; - findConstantAndWatchExpressions(ast, self.$filter); - var assignable; - var assign; - if ((assignable = assignableAST(ast))) { - assign = this.recurse(assignable); - } - var toWatch = getInputs(ast.body); - var inputs; - if (toWatch) { - inputs = []; - forEach(toWatch, function (watch, key) { - var input = self.recurse(watch); - input.isPure = watch.isPure; - watch.input = input; - inputs.push(input); - watch.watchId = key; - }); - } - var expressions = []; - forEach(ast.body, function (expression) { - expressions.push(self.recurse(expression.expression)); - }); - var fn = ast.body.length === 0 ? noop : - ast.body.length === 1 ? expressions[0] : - function (scope, locals) { - var lastValue; - forEach(expressions, function (exp) { - lastValue = exp(scope, locals); - }); - return lastValue; - }; - if (assign) { - fn.assign = function (scope, value, locals) { - return assign(scope, locals, value); - }; - } - if (inputs) { - fn.inputs = inputs; - } - return fn; - }, - - recurse: function (ast, context, create) { - var left, right, self = this, - args; - if (ast.input) { - return this.inputs(ast.input, ast.watchId); - } - switch (ast.type) { - case AST.Literal: - return this.value(ast.value, context); - case AST.UnaryExpression: - right = this.recurse(ast.argument); - return this['unary' + ast.operator](right, context); - case AST.BinaryExpression: - left = this.recurse(ast.left); - right = this.recurse(ast.right); - return this['binary' + ast.operator](left, right, context); - case AST.LogicalExpression: - left = this.recurse(ast.left); - right = this.recurse(ast.right); - return this['binary' + ast.operator](left, right, context); - case AST.ConditionalExpression: - return this['ternary?:']( - this.recurse(ast.test), - this.recurse(ast.alternate), - this.recurse(ast.consequent), - context - ); - case AST.Identifier: - return self.identifier(ast.name, context, create); - case AST.MemberExpression: - left = this.recurse(ast.object, false, !!create); - if (!ast.computed) { - right = ast.property.name; - } - if (ast.computed) right = this.recurse(ast.property); - return ast.computed ? - this.computedMember(left, right, context, create) : - this.nonComputedMember(left, right, context, create); - case AST.CallExpression: - args = []; - forEach(ast.arguments, function (expr) { - args.push(self.recurse(expr)); - }); - if (ast.filter) right = this.$filter(ast.callee.name); - if (!ast.filter) right = this.recurse(ast.callee, true); - return ast.filter ? - function (scope, locals, assign, inputs) { - var values = []; - for (var i = 0; i < args.length; ++i) { - values.push(args[i](scope, locals, assign, inputs)); - } - var value = right.apply(undefined, values, inputs); - return context ? { - context: undefined, - name: undefined, - value: value - } : value; - } : - function (scope, locals, assign, inputs) { - var rhs = right(scope, locals, assign, inputs); - var value; - if (rhs.value != null) { - var values = []; - for (var i = 0; i < args.length; ++i) { - values.push(args[i](scope, locals, assign, inputs)); - } - value = rhs.value.apply(rhs.context, values); - } - return context ? { - value: value - } : value; - }; - case AST.AssignmentExpression: - left = this.recurse(ast.left, true, 1); - right = this.recurse(ast.right); - return function (scope, locals, assign, inputs) { - var lhs = left(scope, locals, assign, inputs); - var rhs = right(scope, locals, assign, inputs); - lhs.context[lhs.name] = rhs; - return context ? { - value: rhs - } : rhs; - }; - case AST.ArrayExpression: - args = []; - forEach(ast.elements, function (expr) { - args.push(self.recurse(expr)); - }); - return function (scope, locals, assign, inputs) { - var value = []; - for (var i = 0; i < args.length; ++i) { - value.push(args[i](scope, locals, assign, inputs)); - } - return context ? { - value: value - } : value; - }; - case AST.ObjectExpression: - args = []; - forEach(ast.properties, function (property) { - if (property.computed) { - args.push({ - key: self.recurse(property.key), - computed: true, - value: self.recurse(property.value) - }); - } else { - args.push({ - key: property.key.type === AST.Identifier ? - property.key.name : ('' + property.key.value), - computed: false, - value: self.recurse(property.value) - }); - } - }); - return function (scope, locals, assign, inputs) { - var value = {}; - for (var i = 0; i < args.length; ++i) { - if (args[i].computed) { - value[args[i].key(scope, locals, assign, inputs)] = args[i].value(scope, locals, assign, inputs); - } else { - value[args[i].key] = args[i].value(scope, locals, assign, inputs); - } - } - return context ? { - value: value - } : value; - }; - case AST.ThisExpression: - return function (scope) { - return context ? { - value: scope - } : scope; - }; - case AST.LocalsExpression: - return function (scope, locals) { - return context ? { - value: locals - } : locals; - }; - case AST.NGValueParameter: - return function (scope, locals, assign) { - return context ? { - value: assign - } : assign; - }; - } - }, - - 'unary+': function (argument, context) { - return function (scope, locals, assign, inputs) { - var arg = argument(scope, locals, assign, inputs); - if (isDefined(arg)) { - arg = +arg; - } else { - arg = 0; - } - return context ? { - value: arg - } : arg; - }; - }, - 'unary-': function (argument, context) { - return function (scope, locals, assign, inputs) { - var arg = argument(scope, locals, assign, inputs); - if (isDefined(arg)) { - arg = -arg; - } else { - arg = -0; - } - return context ? { - value: arg - } : arg; - }; - }, - 'unary!': function (argument, context) { - return function (scope, locals, assign, inputs) { - var arg = !argument(scope, locals, assign, inputs); - return context ? { - value: arg - } : arg; - }; - }, - 'binary+': function (left, right, context) { - return function (scope, locals, assign, inputs) { - var lhs = left(scope, locals, assign, inputs); - var rhs = right(scope, locals, assign, inputs); - var arg = plusFn(lhs, rhs); - return context ? { - value: arg - } : arg; - }; - }, - 'binary-': function (left, right, context) { - return function (scope, locals, assign, inputs) { - var lhs = left(scope, locals, assign, inputs); - var rhs = right(scope, locals, assign, inputs); - var arg = (isDefined(lhs) ? lhs : 0) - (isDefined(rhs) ? rhs : 0); - return context ? { - value: arg - } : arg; - }; - }, - 'binary*': function (left, right, context) { - return function (scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) * right(scope, locals, assign, inputs); - return context ? { - value: arg - } : arg; - }; - }, - 'binary/': function (left, right, context) { - return function (scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) / right(scope, locals, assign, inputs); - return context ? { - value: arg - } : arg; - }; - }, - 'binary%': function (left, right, context) { - return function (scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) % right(scope, locals, assign, inputs); - return context ? { - value: arg - } : arg; - }; - }, - 'binary===': function (left, right, context) { - return function (scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) === right(scope, locals, assign, inputs); - return context ? { - value: arg - } : arg; - }; - }, - 'binary!==': function (left, right, context) { - return function (scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) !== right(scope, locals, assign, inputs); - return context ? { - value: arg - } : arg; - }; - }, - 'binary==': function (left, right, context) { - return function (scope, locals, assign, inputs) { - // eslint-disable-next-line eqeqeq - var arg = left(scope, locals, assign, inputs) == right(scope, locals, assign, inputs); - return context ? { - value: arg - } : arg; - }; - }, - 'binary!=': function (left, right, context) { - return function (scope, locals, assign, inputs) { - // eslint-disable-next-line eqeqeq - var arg = left(scope, locals, assign, inputs) != right(scope, locals, assign, inputs); - return context ? { - value: arg - } : arg; - }; - }, - 'binary<': function (left, right, context) { - return function (scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) < right(scope, locals, assign, inputs); - return context ? { - value: arg - } : arg; - }; - }, - 'binary>': function (left, right, context) { - return function (scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) > right(scope, locals, assign, inputs); - return context ? { - value: arg - } : arg; - }; - }, - 'binary<=': function (left, right, context) { - return function (scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) <= right(scope, locals, assign, inputs); - return context ? { - value: arg - } : arg; - }; - }, - 'binary>=': function (left, right, context) { - return function (scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) >= right(scope, locals, assign, inputs); - return context ? { - value: arg - } : arg; - }; - }, - 'binary&&': function (left, right, context) { - return function (scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) && right(scope, locals, assign, inputs); - return context ? { - value: arg - } : arg; - }; - }, - 'binary||': function (left, right, context) { - return function (scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) || right(scope, locals, assign, inputs); - return context ? { - value: arg - } : arg; - }; - }, - 'ternary?:': function (test, alternate, consequent, context) { - return function (scope, locals, assign, inputs) { - var arg = test(scope, locals, assign, inputs) ? alternate(scope, locals, assign, inputs) : consequent(scope, locals, assign, inputs); - return context ? { - value: arg - } : arg; - }; - }, - value: function (value, context) { - return function () { - return context ? { - context: undefined, - name: undefined, - value: value - } : value; - }; - }, - identifier: function (name, context, create) { - return function (scope, locals, assign, inputs) { - var base = locals && (name in locals) ? locals : scope; - if (create && create !== 1 && base && base[name] == null) { - base[name] = {}; - } - var value = base ? base[name] : undefined; - if (context) { - return { - context: base, - name: name, - value: value - }; - } else { - return value; - } - }; - }, - computedMember: function (left, right, context, create) { - return function (scope, locals, assign, inputs) { - var lhs = left(scope, locals, assign, inputs); - var rhs; - var value; - if (lhs != null) { - rhs = right(scope, locals, assign, inputs); - rhs = getStringValue(rhs); - if (create && create !== 1) { - if (lhs && !(lhs[rhs])) { - lhs[rhs] = {}; - } - } - value = lhs[rhs]; - } - if (context) { - return { - context: lhs, - name: rhs, - value: value - }; - } else { - return value; - } - }; - }, - nonComputedMember: function (left, right, context, create) { - return function (scope, locals, assign, inputs) { - var lhs = left(scope, locals, assign, inputs); - if (create && create !== 1) { - if (lhs && lhs[right] == null) { - lhs[right] = {}; - } - } - var value = lhs != null ? lhs[right] : undefined; - if (context) { - return { - context: lhs, - name: right, - value: value - }; - } else { - return value; - } - }; - }, - inputs: function (input, watchId) { - return function (scope, value, locals, inputs) { - if (inputs) return inputs[watchId]; - return input(scope, value, locals); - }; - } - }; - - /** - * @constructor - */ - function Parser(lexer, $filter, options) { - this.ast = new AST(lexer, options); - this.astCompiler = options.csp ? new ASTInterpreter($filter) : - new ASTCompiler($filter); - } - - Parser.prototype = { - constructor: Parser, - - parse: function (text) { - var ast = this.getAst(text); - var fn = this.astCompiler.compile(ast.ast); - fn.literal = isLiteral(ast.ast); - fn.constant = isConstant(ast.ast); - fn.oneTime = ast.oneTime; - return fn; - }, - - getAst: function (exp) { - var oneTime = false; - exp = exp.trim(); - - if (exp.charAt(0) === ':' && exp.charAt(1) === ':') { - oneTime = true; - exp = exp.substring(2); - } - return { - ast: this.ast.ast(exp), - oneTime: oneTime - }; - } - }; - - function getValueOf(value) { - return isFunction(value.valueOf) ? value.valueOf() : objectValueOf.call(value); - } - - /////////////////////////////////// - - /** - * @ngdoc service - * @name $parse - * @kind function - * - * @description - * - * Converts AngularJS {@link guide/expression expression} into a function. - * - * ```js - * var getter = $parse('user.name'); - * var setter = getter.assign; - * var context = {user:{name:'AngularJS'}}; - * var locals = {user:{name:'local'}}; - * - * expect(getter(context)).toEqual('AngularJS'); - * setter(context, 'newValue'); - * expect(context.user.name).toEqual('newValue'); - * expect(getter(context, locals)).toEqual('local'); - * ``` - * - * - * @param {string} expression String expression to compile. - * @returns {function(context, locals)} a function which represents the compiled expression: - * - * * `context` – `{object}` – an object against which any expressions embedded in the strings - * are evaluated against (typically a scope object). - * * `locals` – `{object=}` – local variables context object, useful for overriding values in - * `context`. - * - * The returned function also has the following properties: - * * `literal` – `{boolean}` – whether the expression's top-level node is a JavaScript - * literal. - * * `constant` – `{boolean}` – whether the expression is made entirely of JavaScript - * constant literals. - * * `assign` – `{?function(context, value)}` – if the expression is assignable, this will be - * set to a function to change its value on the given context. - * - */ - - - /** - * @ngdoc provider - * @name $parseProvider - * @this - * - * @description - * `$parseProvider` can be used for configuring the default behavior of the {@link ng.$parse $parse} - * service. - */ - function $ParseProvider() { - var cache = createMap(); - var literals = { - 'true': true, - 'false': false, - 'null': null, - 'undefined': undefined - }; - var identStart, identContinue; - - /** - * @ngdoc method - * @name $parseProvider#addLiteral - * @description - * - * Configure $parse service to add literal values that will be present as literal at expressions. - * - * @param {string} literalName Token for the literal value. The literal name value must be a valid literal name. - * @param {*} literalValue Value for this literal. All literal values must be primitives or `undefined`. - * - **/ - this.addLiteral = function (literalName, literalValue) { - literals[literalName] = literalValue; - }; - - /** - * @ngdoc method - * @name $parseProvider#setIdentifierFns - * - * @description - * - * Allows defining the set of characters that are allowed in AngularJS expressions. The function - * `identifierStart` will get called to know if a given character is a valid character to be the - * first character for an identifier. The function `identifierContinue` will get called to know if - * a given character is a valid character to be a follow-up identifier character. The functions - * `identifierStart` and `identifierContinue` will receive as arguments the single character to be - * identifier and the character code point. These arguments will be `string` and `numeric`. Keep in - * mind that the `string` parameter can be two characters long depending on the character - * representation. It is expected for the function to return `true` or `false`, whether that - * character is allowed or not. - * - * Since this function will be called extensively, keep the implementation of these functions fast, - * as the performance of these functions have a direct impact on the expressions parsing speed. - * - * @param {function=} identifierStart The function that will decide whether the given character is - * a valid identifier start character. - * @param {function=} identifierContinue The function that will decide whether the given character is - * a valid identifier continue character. - */ - this.setIdentifierFns = function (identifierStart, identifierContinue) { - identStart = identifierStart; - identContinue = identifierContinue; - return this; - }; - - this.$get = ['$filter', function ($filter) { - var noUnsafeEval = csp().noUnsafeEval; - var $parseOptions = { - csp: noUnsafeEval, - literals: copy(literals), - isIdentifierStart: isFunction(identStart) && identStart, - isIdentifierContinue: isFunction(identContinue) && identContinue - }; - $parse.$$getAst = $$getAst; - return $parse; - - function $parse(exp, interceptorFn) { - var parsedExpression, cacheKey; - - switch (typeof exp) { - case 'string': - exp = exp.trim(); - cacheKey = exp; - - parsedExpression = cache[cacheKey]; - - if (!parsedExpression) { - var lexer = new Lexer($parseOptions); - var parser = new Parser(lexer, $filter, $parseOptions); - parsedExpression = parser.parse(exp); - - cache[cacheKey] = addWatchDelegate(parsedExpression); - } - return addInterceptor(parsedExpression, interceptorFn); - - case 'function': - return addInterceptor(exp, interceptorFn); - - default: - return addInterceptor(noop, interceptorFn); - } - } - - function $$getAst(exp) { - var lexer = new Lexer($parseOptions); - var parser = new Parser(lexer, $filter, $parseOptions); - return parser.getAst(exp).ast; - } - - function expressionInputDirtyCheck(newValue, oldValueOfValue, compareObjectIdentity) { - - if (newValue == null || oldValueOfValue == null) { // null/undefined - return newValue === oldValueOfValue; - } - - if (typeof newValue === 'object') { - - // attempt to convert the value to a primitive type - // TODO(docs): add a note to docs that by implementing valueOf even objects and arrays can - // be cheaply dirty-checked - newValue = getValueOf(newValue); - - if (typeof newValue === 'object' && !compareObjectIdentity) { - // objects/arrays are not supported - deep-watching them would be too expensive - return false; - } - - // fall-through to the primitive equality check - } - - //Primitive or NaN - // eslint-disable-next-line no-self-compare - return newValue === oldValueOfValue || (newValue !== newValue && oldValueOfValue !== oldValueOfValue); - } - - function inputsWatchDelegate(scope, listener, objectEquality, parsedExpression, prettyPrintExpression) { - var inputExpressions = parsedExpression.inputs; - var lastResult; - - if (inputExpressions.length === 1) { - var oldInputValueOf = expressionInputDirtyCheck; // init to something unique so that equals check fails - inputExpressions = inputExpressions[0]; - return scope.$watch(function expressionInputWatch(scope) { - var newInputValue = inputExpressions(scope); - if (!expressionInputDirtyCheck(newInputValue, oldInputValueOf, inputExpressions.isPure)) { - lastResult = parsedExpression(scope, undefined, undefined, [newInputValue]); - oldInputValueOf = newInputValue && getValueOf(newInputValue); - } - return lastResult; - }, listener, objectEquality, prettyPrintExpression); - } - - var oldInputValueOfValues = []; - var oldInputValues = []; - for (var i = 0, ii = inputExpressions.length; i < ii; i++) { - oldInputValueOfValues[i] = expressionInputDirtyCheck; // init to something unique so that equals check fails - oldInputValues[i] = null; - } - - return scope.$watch(function expressionInputsWatch(scope) { - var changed = false; - - for (var i = 0, ii = inputExpressions.length; i < ii; i++) { - var newInputValue = inputExpressions[i](scope); - if (changed || (changed = !expressionInputDirtyCheck(newInputValue, oldInputValueOfValues[i], inputExpressions[i].isPure))) { - oldInputValues[i] = newInputValue; - oldInputValueOfValues[i] = newInputValue && getValueOf(newInputValue); - } - } - - if (changed) { - lastResult = parsedExpression(scope, undefined, undefined, oldInputValues); - } - - return lastResult; - }, listener, objectEquality, prettyPrintExpression); - } - - function oneTimeWatchDelegate(scope, listener, objectEquality, parsedExpression, prettyPrintExpression) { - var isDone = parsedExpression.literal ? isAllDefined : isDefined; - var unwatch, lastValue; - - var exp = parsedExpression.$$intercepted || parsedExpression; - var post = parsedExpression.$$interceptor || identity; - - var useInputs = parsedExpression.inputs && !exp.inputs; - - // Propogate the literal/inputs/constant attributes - // ... but not oneTime since we are handling it - oneTimeWatch.literal = parsedExpression.literal; - oneTimeWatch.constant = parsedExpression.constant; - oneTimeWatch.inputs = parsedExpression.inputs; - - // Allow other delegates to run on this wrapped expression - addWatchDelegate(oneTimeWatch); - - unwatch = scope.$watch(oneTimeWatch, listener, objectEquality, prettyPrintExpression); - - return unwatch; - - function unwatchIfDone() { - if (isDone(lastValue)) { - unwatch(); - } - } - - function oneTimeWatch(scope, locals, assign, inputs) { - lastValue = useInputs && inputs ? inputs[0] : exp(scope, locals, assign, inputs); - if (isDone(lastValue)) { - scope.$$postDigest(unwatchIfDone); - } - return post(lastValue); - } - } - - function isAllDefined(value) { - var allDefined = true; - forEach(value, function (val) { - if (!isDefined(val)) allDefined = false; - }); - return allDefined; - } - - function constantWatchDelegate(scope, listener, objectEquality, parsedExpression) { - var unwatch = scope.$watch(function constantWatch(scope) { - unwatch(); - return parsedExpression(scope); - }, listener, objectEquality); - return unwatch; - } - - function addWatchDelegate(parsedExpression) { - if (parsedExpression.constant) { - parsedExpression.$$watchDelegate = constantWatchDelegate; - } else if (parsedExpression.oneTime) { - parsedExpression.$$watchDelegate = oneTimeWatchDelegate; - } else if (parsedExpression.inputs) { - parsedExpression.$$watchDelegate = inputsWatchDelegate; - } - - return parsedExpression; - } - - function chainInterceptors(first, second) { - function chainedInterceptor(value) { - return second(first(value)); - } - chainedInterceptor.$stateful = first.$stateful || second.$stateful; - chainedInterceptor.$$pure = first.$$pure && second.$$pure; - - return chainedInterceptor; - } - - function addInterceptor(parsedExpression, interceptorFn) { - if (!interceptorFn) return parsedExpression; - - // Extract any existing interceptors out of the parsedExpression - // to ensure the original parsedExpression is always the $$intercepted - if (parsedExpression.$$interceptor) { - interceptorFn = chainInterceptors(parsedExpression.$$interceptor, interceptorFn); - parsedExpression = parsedExpression.$$intercepted; - } - - var useInputs = false; - - var fn = function interceptedExpression(scope, locals, assign, inputs) { - var value = useInputs && inputs ? inputs[0] : parsedExpression(scope, locals, assign, inputs); - return interceptorFn(value); - }; - - // Maintain references to the interceptor/intercepted - fn.$$intercepted = parsedExpression; - fn.$$interceptor = interceptorFn; - - // Propogate the literal/oneTime/constant attributes - fn.literal = parsedExpression.literal; - fn.oneTime = parsedExpression.oneTime; - fn.constant = parsedExpression.constant; - - // Treat the interceptor like filters. - // If it is not $stateful then only watch its inputs. - // If the expression itself has no inputs then use the full expression as an input. - if (!interceptorFn.$stateful) { - useInputs = !parsedExpression.inputs; - fn.inputs = parsedExpression.inputs ? parsedExpression.inputs : [parsedExpression]; - - if (!interceptorFn.$$pure) { - fn.inputs = fn.inputs.map(function (e) { - // Remove the isPure flag of inputs when it is not absolute because they are now wrapped in a - // non-pure interceptor function. - if (e.isPure === PURITY_RELATIVE) { - return function depurifier(s) { - return e(s); - }; - } - return e; - }); - } - } - - return addWatchDelegate(fn); - } - }]; - } - - /** - * @ngdoc service - * @name $q - * @requires $rootScope - * - * @description - * A service that helps you run functions asynchronously, and use their return values (or exceptions) - * when they are done processing. - * - * This is a [Promises/A+](https://promisesaplus.com/)-compliant implementation of promises/deferred - * objects inspired by [Kris Kowal's Q](https://github.com/kriskowal/q). - * - * $q can be used in two fashions --- one which is more similar to Kris Kowal's Q or jQuery's Deferred - * implementations, and the other which resembles ES6 (ES2015) promises to some degree. - * - * ## $q constructor - * - * The streamlined ES6 style promise is essentially just using $q as a constructor which takes a `resolver` - * function as the first argument. This is similar to the native Promise implementation from ES6, - * see [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise). - * - * While the constructor-style use is supported, not all of the supporting methods from ES6 promises are - * available yet. - * - * It can be used like so: - * - * ```js - * // for the purpose of this example let's assume that variables `$q` and `okToGreet` - * // are available in the current lexical scope (they could have been injected or passed in). - * - * function asyncGreet(name) { - * // perform some asynchronous operation, resolve or reject the promise when appropriate. - * return $q(function(resolve, reject) { - * setTimeout(function() { - * if (okToGreet(name)) { - * resolve('Hello, ' + name + '!'); - * } else { - * reject('Greeting ' + name + ' is not allowed.'); - * } - * }, 1000); - * }); - * } - * - * var promise = asyncGreet('Robin Hood'); - * promise.then(function(greeting) { - * alert('Success: ' + greeting); - * }, function(reason) { - * alert('Failed: ' + reason); - * }); - * ``` - * - * Note: progress/notify callbacks are not currently supported via the ES6-style interface. - * - * Note: unlike ES6 behavior, an exception thrown in the constructor function will NOT implicitly reject the promise. - * - * However, the more traditional CommonJS-style usage is still available, and documented below. - * - * [The CommonJS Promise proposal](http://wiki.commonjs.org/wiki/Promises) describes a promise as an - * interface for interacting with an object that represents the result of an action that is - * performed asynchronously, and may or may not be finished at any given point in time. - * - * From the perspective of dealing with error handling, deferred and promise APIs are to - * asynchronous programming what `try`, `catch` and `throw` keywords are to synchronous programming. - * - * ```js - * // for the purpose of this example let's assume that variables `$q` and `okToGreet` - * // are available in the current lexical scope (they could have been injected or passed in). - * - * function asyncGreet(name) { - * var deferred = $q.defer(); - * - * setTimeout(function() { - * deferred.notify('About to greet ' + name + '.'); - * - * if (okToGreet(name)) { - * deferred.resolve('Hello, ' + name + '!'); - * } else { - * deferred.reject('Greeting ' + name + ' is not allowed.'); - * } - * }, 1000); - * - * return deferred.promise; - * } - * - * var promise = asyncGreet('Robin Hood'); - * promise.then(function(greeting) { - * alert('Success: ' + greeting); - * }, function(reason) { - * alert('Failed: ' + reason); - * }, function(update) { - * alert('Got notification: ' + update); - * }); - * ``` - * - * At first it might not be obvious why this extra complexity is worth the trouble. The payoff - * comes in the way of guarantees that promise and deferred APIs make, see - * https://github.com/kriskowal/uncommonjs/blob/master/promises/specification.md. - * - * Additionally the promise api allows for composition that is very hard to do with the - * traditional callback ([CPS](http://en.wikipedia.org/wiki/Continuation-passing_style)) approach. - * For more on this please see the [Q documentation](https://github.com/kriskowal/q) especially the - * section on serial or parallel joining of promises. - * - * ## The Deferred API - * - * A new instance of deferred is constructed by calling `$q.defer()`. - * - * The purpose of the deferred object is to expose the associated Promise instance as well as APIs - * that can be used for signaling the successful or unsuccessful completion, as well as the status - * of the task. - * - * **Methods** - * - * - `resolve(value)` – resolves the derived promise with the `value`. If the value is a rejection - * constructed via `$q.reject`, the promise will be rejected instead. - * - `reject(reason)` – rejects the derived promise with the `reason`. This is equivalent to - * resolving it with a rejection constructed via `$q.reject`. - * - `notify(value)` - provides updates on the status of the promise's execution. This may be called - * multiple times before the promise is either resolved or rejected. - * - * **Properties** - * - * - promise – `{Promise}` – promise object associated with this deferred. - * - * - * ## The Promise API - * - * A new promise instance is created when a deferred instance is created and can be retrieved by - * calling `deferred.promise`. - * - * The purpose of the promise object is to allow for interested parties to get access to the result - * of the deferred task when it completes. - * - * **Methods** - * - * - `then(successCallback, [errorCallback], [notifyCallback])` – regardless of when the promise was or - * will be resolved or rejected, `then` calls one of the success or error callbacks asynchronously - * as soon as the result is available. The callbacks are called with a single argument: the result - * or rejection reason. Additionally, the notify callback may be called zero or more times to - * provide a progress indication, before the promise is resolved or rejected. - * - * This method *returns a new promise* which is resolved or rejected via the return value of the - * `successCallback`, `errorCallback` (unless that value is a promise, in which case it is resolved - * with the value which is resolved in that promise using - * [promise chaining](http://www.html5rocks.com/en/tutorials/es6/promises/#toc-promises-queues)). - * It also notifies via the return value of the `notifyCallback` method. The promise cannot be - * resolved or rejected from the notifyCallback method. The errorCallback and notifyCallback - * arguments are optional. - * - * - `catch(errorCallback)` – shorthand for `promise.then(null, errorCallback)` - * - * - `finally(callback, notifyCallback)` – allows you to observe either the fulfillment or rejection of a promise, - * but to do so without modifying the final value. This is useful to release resources or do some - * clean-up that needs to be done whether the promise was rejected or resolved. See the [full - * specification](https://github.com/kriskowal/q/wiki/API-Reference#promisefinallycallback) for - * more information. - * - * ## Chaining promises - * - * Because calling the `then` method of a promise returns a new derived promise, it is easily - * possible to create a chain of promises: - * - * ```js - * promiseB = promiseA.then(function(result) { - * return result + 1; - * }); - * - * // promiseB will be resolved immediately after promiseA is resolved and its value - * // will be the result of promiseA incremented by 1 - * ``` - * - * It is possible to create chains of any length and since a promise can be resolved with another - * promise (which will defer its resolution further), it is possible to pause/defer resolution of - * the promises at any point in the chain. This makes it possible to implement powerful APIs like - * $http's response interceptors. - * - * - * ## Differences between Kris Kowal's Q and $q - * - * There are two main differences: - * - * - $q is integrated with the {@link ng.$rootScope.Scope} Scope model observation - * mechanism in AngularJS, which means faster propagation of resolution or rejection into your - * models and avoiding unnecessary browser repaints, which would result in flickering UI. - * - Q has many more features than $q, but that comes at a cost of bytes. $q is tiny, but contains - * all the important functionality needed for common async tasks. - * - * ## Testing - * - * ```js - * it('should simulate promise', inject(function($q, $rootScope) { - * var deferred = $q.defer(); - * var promise = deferred.promise; - * var resolvedValue; - * - * promise.then(function(value) { resolvedValue = value; }); - * expect(resolvedValue).toBeUndefined(); - * - * // Simulate resolving of promise - * deferred.resolve(123); - * // Note that the 'then' function does not get called synchronously. - * // This is because we want the promise API to always be async, whether or not - * // it got called synchronously or asynchronously. - * expect(resolvedValue).toBeUndefined(); - * - * // Propagate promise resolution to 'then' functions using $apply(). - * $rootScope.$apply(); - * expect(resolvedValue).toEqual(123); - * })); - * ``` - * - * @param {function(function, function)} resolver Function which is responsible for resolving or - * rejecting the newly created promise. The first parameter is a function which resolves the - * promise, the second parameter is a function which rejects the promise. - * - * @returns {Promise} The newly created promise. - */ - /** - * @ngdoc provider - * @name $qProvider - * @this - * - * @description - */ - function $QProvider() { - var errorOnUnhandledRejections = true; - this.$get = ['$rootScope', '$exceptionHandler', function ($rootScope, $exceptionHandler) { - return qFactory(function (callback) { - $rootScope.$evalAsync(callback); - }, $exceptionHandler, errorOnUnhandledRejections); - }]; - - /** - * @ngdoc method - * @name $qProvider#errorOnUnhandledRejections - * @kind function - * - * @description - * Retrieves or overrides whether to generate an error when a rejected promise is not handled. - * This feature is enabled by default. - * - * @param {boolean=} value Whether to generate an error when a rejected promise is not handled. - * @returns {boolean|ng.$qProvider} Current value when called without a new value or self for - * chaining otherwise. - */ - this.errorOnUnhandledRejections = function (value) { - if (isDefined(value)) { - errorOnUnhandledRejections = value; - return this; - } else { - return errorOnUnhandledRejections; - } - }; - } - - /** @this */ - function $$QProvider() { - var errorOnUnhandledRejections = true; - this.$get = ['$browser', '$exceptionHandler', function ($browser, $exceptionHandler) { - return qFactory(function (callback) { - $browser.defer(callback); - }, $exceptionHandler, errorOnUnhandledRejections); - }]; - - this.errorOnUnhandledRejections = function (value) { - if (isDefined(value)) { - errorOnUnhandledRejections = value; - return this; - } else { - return errorOnUnhandledRejections; - } - }; - } - - /** - * Constructs a promise manager. - * - * @param {function(function)} nextTick Function for executing functions in the next turn. - * @param {function(...*)} exceptionHandler Function into which unexpected exceptions are passed for - * debugging purposes. - * @param {boolean=} errorOnUnhandledRejections Whether an error should be generated on unhandled - * promises rejections. - * @returns {object} Promise manager. - */ - function qFactory(nextTick, exceptionHandler, errorOnUnhandledRejections) { - var $qMinErr = minErr('$q', TypeError); - var queueSize = 0; - var checkQueue = []; - - /** - * @ngdoc method - * @name ng.$q#defer - * @kind function - * - * @description - * Creates a `Deferred` object which represents a task which will finish in the future. - * - * @returns {Deferred} Returns a new instance of deferred. - */ - function defer() { - return new Deferred(); - } - - function Deferred() { - var promise = this.promise = new Promise(); - //Non prototype methods necessary to support unbound execution :/ - this.resolve = function (val) { - resolvePromise(promise, val); - }; - this.reject = function (reason) { - rejectPromise(promise, reason); - }; - this.notify = function (progress) { - notifyPromise(promise, progress); - }; - } - - - function Promise() { - this.$$state = { - status: 0 - }; - } - - extend(Promise.prototype, { - then: function (onFulfilled, onRejected, progressBack) { - if (isUndefined(onFulfilled) && isUndefined(onRejected) && isUndefined(progressBack)) { - return this; - } - var result = new Promise(); - - this.$$state.pending = this.$$state.pending || []; - this.$$state.pending.push([result, onFulfilled, onRejected, progressBack]); - if (this.$$state.status > 0) scheduleProcessQueue(this.$$state); - - return result; - }, - - 'catch': function (callback) { - return this.then(null, callback); - }, - - 'finally': function (callback, progressBack) { - return this.then(function (value) { - return handleCallback(value, resolve, callback); - }, function (error) { - return handleCallback(error, reject, callback); - }, progressBack); - } - }); - - function processQueue(state) { - var fn, promise, pending; - - pending = state.pending; - state.processScheduled = false; - state.pending = undefined; - try { - for (var i = 0, ii = pending.length; i < ii; ++i) { - markQStateExceptionHandled(state); - promise = pending[i][0]; - fn = pending[i][state.status]; - try { - if (isFunction(fn)) { - resolvePromise(promise, fn(state.value)); - } else if (state.status === 1) { - resolvePromise(promise, state.value); - } else { - rejectPromise(promise, state.value); - } - } catch (e) { - rejectPromise(promise, e); - // This error is explicitly marked for being passed to the $exceptionHandler - if (e && e.$$passToExceptionHandler === true) { - exceptionHandler(e); - } - } - } - } finally { - --queueSize; - if (errorOnUnhandledRejections && queueSize === 0) { - nextTick(processChecks); - } - } - } - - function processChecks() { - // eslint-disable-next-line no-unmodified-loop-condition - while (!queueSize && checkQueue.length) { - var toCheck = checkQueue.shift(); - if (!isStateExceptionHandled(toCheck)) { - markQStateExceptionHandled(toCheck); - var errorMessage = 'Possibly unhandled rejection: ' + toDebugString(toCheck.value); - if (isError(toCheck.value)) { - exceptionHandler(toCheck.value, errorMessage); - } else { - exceptionHandler(errorMessage); - } - } - } - } - - function scheduleProcessQueue(state) { - if (errorOnUnhandledRejections && !state.pending && state.status === 2 && !isStateExceptionHandled(state)) { - if (queueSize === 0 && checkQueue.length === 0) { - nextTick(processChecks); - } - checkQueue.push(state); - } - if (state.processScheduled || !state.pending) return; - state.processScheduled = true; - ++queueSize; - nextTick(function () { - processQueue(state); - }); - } - - function resolvePromise(promise, val) { - if (promise.$$state.status) return; - if (val === promise) { - $$reject(promise, $qMinErr( - 'qcycle', - 'Expected promise to be resolved with value other than itself \'{0}\'', - val)); - } else { - $$resolve(promise, val); - } - - } - - function $$resolve(promise, val) { - var then; - var done = false; - try { - if (isObject(val) || isFunction(val)) then = val.then; - if (isFunction(then)) { - promise.$$state.status = -1; - then.call(val, doResolve, doReject, doNotify); - } else { - promise.$$state.value = val; - promise.$$state.status = 1; - scheduleProcessQueue(promise.$$state); - } - } catch (e) { - doReject(e); - } - - function doResolve(val) { - if (done) return; - done = true; - $$resolve(promise, val); - } - - function doReject(val) { - if (done) return; - done = true; - $$reject(promise, val); - } - - function doNotify(progress) { - notifyPromise(promise, progress); - } - } - - function rejectPromise(promise, reason) { - if (promise.$$state.status) return; - $$reject(promise, reason); - } - - function $$reject(promise, reason) { - promise.$$state.value = reason; - promise.$$state.status = 2; - scheduleProcessQueue(promise.$$state); - } - - function notifyPromise(promise, progress) { - var callbacks = promise.$$state.pending; - - if ((promise.$$state.status <= 0) && callbacks && callbacks.length) { - nextTick(function () { - var callback, result; - for (var i = 0, ii = callbacks.length; i < ii; i++) { - result = callbacks[i][0]; - callback = callbacks[i][3]; - try { - notifyPromise(result, isFunction(callback) ? callback(progress) : progress); - } catch (e) { - exceptionHandler(e); - } - } - }); - } - } - - /** - * @ngdoc method - * @name $q#reject - * @kind function - * - * @description - * Creates a promise that is resolved as rejected with the specified `reason`. This api should be - * used to forward rejection in a chain of promises. If you are dealing with the last promise in - * a promise chain, you don't need to worry about it. - * - * When comparing deferreds/promises to the familiar behavior of try/catch/throw, think of - * `reject` as the `throw` keyword in JavaScript. This also means that if you "catch" an error via - * a promise error callback and you want to forward the error to the promise derived from the - * current promise, you have to "rethrow" the error by returning a rejection constructed via - * `reject`. - * - * ```js - * promiseB = promiseA.then(function(result) { - * // success: do something and resolve promiseB - * // with the old or a new result - * return result; - * }, function(reason) { - * // error: handle the error if possible and - * // resolve promiseB with newPromiseOrValue, - * // otherwise forward the rejection to promiseB - * if (canHandle(reason)) { - * // handle the error and recover - * return newPromiseOrValue; - * } - * return $q.reject(reason); - * }); - * ``` - * - * @param {*} reason Constant, message, exception or an object representing the rejection reason. - * @returns {Promise} Returns a promise that was already resolved as rejected with the `reason`. - */ - function reject(reason) { - var result = new Promise(); - rejectPromise(result, reason); - return result; - } - - function handleCallback(value, resolver, callback) { - var callbackOutput = null; - try { - if (isFunction(callback)) callbackOutput = callback(); - } catch (e) { - return reject(e); - } - if (isPromiseLike(callbackOutput)) { - return callbackOutput.then(function () { - return resolver(value); - }, reject); - } else { - return resolver(value); - } - } - - /** - * @ngdoc method - * @name $q#when - * @kind function - * - * @description - * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. - * This is useful when you are dealing with an object that might or might not be a promise, or if - * the promise comes from a source that can't be trusted. - * - * @param {*} value Value or a promise - * @param {Function=} successCallback - * @param {Function=} errorCallback - * @param {Function=} progressCallback - * @returns {Promise} Returns a promise of the passed value or promise - */ - - - function when(value, callback, errback, progressBack) { - var result = new Promise(); - resolvePromise(result, value); - return result.then(callback, errback, progressBack); - } - - /** - * @ngdoc method - * @name $q#resolve - * @kind function - * - * @description - * Alias of {@link ng.$q#when when} to maintain naming consistency with ES6. - * - * @param {*} value Value or a promise - * @param {Function=} successCallback - * @param {Function=} errorCallback - * @param {Function=} progressCallback - * @returns {Promise} Returns a promise of the passed value or promise - */ - var resolve = when; - - /** - * @ngdoc method - * @name $q#all - * @kind function - * - * @description - * Combines multiple promises into a single promise that is resolved when all of the input - * promises are resolved. - * - * @param {Array.|Object.} promises An array or hash of promises. - * @returns {Promise} Returns a single promise that will be resolved with an array/hash of values, - * each value corresponding to the promise at the same index/key in the `promises` array/hash. - * If any of the promises is resolved with a rejection, this resulting promise will be rejected - * with the same rejection value. - */ - - function all(promises) { - var result = new Promise(), - counter = 0, - results = isArray(promises) ? [] : {}; - - forEach(promises, function (promise, key) { - counter++; - when(promise).then(function (value) { - results[key] = value; - if (!(--counter)) resolvePromise(result, results); - }, function (reason) { - rejectPromise(result, reason); - }); - }); - - if (counter === 0) { - resolvePromise(result, results); - } - - return result; - } - - /** - * @ngdoc method - * @name $q#race - * @kind function - * - * @description - * Returns a promise that resolves or rejects as soon as one of those promises - * resolves or rejects, with the value or reason from that promise. - * - * @param {Array.|Object.} promises An array or hash of promises. - * @returns {Promise} a promise that resolves or rejects as soon as one of the `promises` - * resolves or rejects, with the value or reason from that promise. - */ - - function race(promises) { - var deferred = defer(); - - forEach(promises, function (promise) { - when(promise).then(deferred.resolve, deferred.reject); - }); - - return deferred.promise; - } - - function $Q(resolver) { - if (!isFunction(resolver)) { - throw $qMinErr('norslvr', 'Expected resolverFn, got \'{0}\'', resolver); - } - - var promise = new Promise(); - - function resolveFn(value) { - resolvePromise(promise, value); - } - - function rejectFn(reason) { - rejectPromise(promise, reason); - } - - resolver(resolveFn, rejectFn); - - return promise; - } - - // Let's make the instanceof operator work for promises, so that - // `new $q(fn) instanceof $q` would evaluate to true. - $Q.prototype = Promise.prototype; - - $Q.defer = defer; - $Q.reject = reject; - $Q.when = when; - $Q.resolve = resolve; - $Q.all = all; - $Q.race = race; - - return $Q; - } - - function isStateExceptionHandled(state) { - return !!state.pur; - } - - function markQStateExceptionHandled(state) { - state.pur = true; - } - - function markQExceptionHandled(q) { - // Built-in `$q` promises will always have a `$$state` property. This check is to allow - // overwriting `$q` with a different promise library (e.g. Bluebird + angular-bluebird-promises). - // (Currently, this is the only method that might be called with a promise, even if it is not - // created by the built-in `$q`.) - if (q.$$state) { - markQStateExceptionHandled(q.$$state); - } - } - - /** @this */ - function $$RAFProvider() { //rAF - this.$get = ['$window', '$timeout', function ($window, $timeout) { - var requestAnimationFrame = $window.requestAnimationFrame || - $window.webkitRequestAnimationFrame; - - var cancelAnimationFrame = $window.cancelAnimationFrame || - $window.webkitCancelAnimationFrame || - $window.webkitCancelRequestAnimationFrame; - - var rafSupported = !!requestAnimationFrame; - var raf = rafSupported ? - function (fn) { - var id = requestAnimationFrame(fn); - return function () { - cancelAnimationFrame(id); - }; - } : - function (fn) { - var timer = $timeout(fn, 16.66, false); // 1000 / 60 = 16.666 - return function () { - $timeout.cancel(timer); - }; - }; - - raf.supported = rafSupported; - - return raf; - }]; - } - - /** - * DESIGN NOTES - * - * The design decisions behind the scope are heavily favored for speed and memory consumption. - * - * The typical use of scope is to watch the expressions, which most of the time return the same - * value as last time so we optimize the operation. - * - * Closures construction is expensive in terms of speed as well as memory: - * - No closures, instead use prototypical inheritance for API - * - Internal state needs to be stored on scope directly, which means that private state is - * exposed as $$____ properties - * - * Loop operations are optimized by using while(count--) { ... } - * - This means that in order to keep the same order of execution as addition we have to add - * items to the array at the beginning (unshift) instead of at the end (push) - * - * Child scopes are created and removed often - * - Using an array would be slow since inserts in the middle are expensive; so we use linked lists - * - * There are fewer watches than observers. This is why you don't want the observer to be implemented - * in the same way as watch. Watch requires return of the initialization function which is expensive - * to construct. - */ - - - /** - * @ngdoc provider - * @name $rootScopeProvider - * @description - * - * Provider for the $rootScope service. - */ - - /** - * @ngdoc method - * @name $rootScopeProvider#digestTtl - * @description - * - * Sets the number of `$digest` iterations the scope should attempt to execute before giving up and - * assuming that the model is unstable. - * - * The current default is 10 iterations. - * - * In complex applications it's possible that the dependencies between `$watch`s will result in - * several digest iterations. However if an application needs more than the default 10 digest - * iterations for its model to stabilize then you should investigate what is causing the model to - * continuously change during the digest. - * - * Increasing the TTL could have performance implications, so you should not change it without - * proper justification. - * - * @param {number} limit The number of digest iterations. - */ - - - /** - * @ngdoc service - * @name $rootScope - * @this - * - * @description - * - * Every application has a single root {@link ng.$rootScope.Scope scope}. - * All other scopes are descendant scopes of the root scope. Scopes provide separation - * between the model and the view, via a mechanism for watching the model for changes. - * They also provide event emission/broadcast and subscription facility. See the - * {@link guide/scope developer guide on scopes}. - */ - function $RootScopeProvider() { - var TTL = 10; - var $rootScopeMinErr = minErr('$rootScope'); - var lastDirtyWatch = null; - var applyAsyncId = null; - - this.digestTtl = function (value) { - if (arguments.length) { - TTL = value; - } - return TTL; - }; - - function createChildScopeClass(parent) { - function ChildScope() { - this.$$watchers = this.$$nextSibling = - this.$$childHead = this.$$childTail = null; - this.$$listeners = {}; - this.$$listenerCount = {}; - this.$$watchersCount = 0; - this.$id = nextUid(); - this.$$ChildScope = null; - this.$$suspended = false; - } - ChildScope.prototype = parent; - return ChildScope; - } - - this.$get = ['$exceptionHandler', '$parse', '$browser', - function ($exceptionHandler, $parse, $browser) { - - function destroyChildScope($event) { - $event.currentScope.$$destroyed = true; - } - /** - * @desc 自动自循环去清ç†èŠ‚点 - * @author Eoapi - */ - function cleanUpScope($scope) { - // Support: IE 9 only - if ($scope.$$childHead && !$scope.$first) { - cleanUpScope($scope.$$childHead); - } - if ($scope.$$nextSibling && !$scope.$first) { - cleanUpScope($scope.$$nextSibling); - } - // try{ - // angular.element(document.getElementsByClassName("eoscope_"+$scope.$id)).remove(); - // }catch(DOM_REMOVE_ERR){ - // console.log(DOM_REMOVE_ERR) - // } - $scope = $scope.$parent = $scope.$$nextSibling = $scope.$$prevSibling = $scope.$$childHead = $scope.$$childTail = $scope.$root = $scope.$$watchers = null; - } - /**--start old--- Eoapi - * function cleanUpScope($scope) { - * - * // Support: IE 9 only - * if (msie === 9) { - * // There is a memory leak in IE9 if all child scopes are not disconnected - * // completely when a scope is destroyed. So this code will recurse up through - * // all this scopes children - * // - * // See issue https://github.com/angular/angular.js/issues/10706 - * if ($scope.$$childHead) { - * cleanUpScope($scope.$$childHead); - * } - * if ($scope.$$nextSibling) { - * cleanUpScope($scope.$$nextSibling); - * } - * } - * - * // The code below works around IE9 and V8's memory leaks - * // - * // See: - * // - https://code.google.com/p/v8/issues/detail?id=2073#c26 - * // - https://github.com/angular/angular.js/issues/6794#issuecomment-38648909 - * // - https://github.com/angular/angular.js/issues/1313#issuecomment-10378451 - * - * $scope.$parent = $scope.$$nextSibling = $scope.$$prevSibling = $scope.$$childHead = - * $scope.$$childTail = $scope.$root = $scope.$$watchers = null; - *} - *---end Eoapi - */ - - /** - * @ngdoc type - * @name $rootScope.Scope - * - * @description - * A root scope can be retrieved using the {@link ng.$rootScope $rootScope} key from the - * {@link auto.$injector $injector}. Child scopes are created using the - * {@link ng.$rootScope.Scope#$new $new()} method. (Most scopes are created automatically when - * compiled HTML template is executed.) See also the {@link guide/scope Scopes guide} for - * an in-depth introduction and usage examples. - * - * - * ## Inheritance - * A scope can inherit from a parent scope, as in this example: - * ```js - var parent = $rootScope; - var child = parent.$new(); - - parent.salutation = "Hello"; - expect(child.salutation).toEqual('Hello'); - - child.salutation = "Welcome"; - expect(child.salutation).toEqual('Welcome'); - expect(parent.salutation).toEqual('Hello'); - * ``` - * - * When interacting with `Scope` in tests, additional helper methods are available on the - * instances of `Scope` type. See {@link ngMock.$rootScope.Scope ngMock Scope} for additional - * details. - * - * - * @param {Object.=} providers Map of service factory which need to be - * provided for the current scope. Defaults to {@link ng}. - * @param {Object.=} instanceCache Provides pre-instantiated services which should - * append/override services provided by `providers`. This is handy - * when unit-testing and having the need to override a default - * service. - * @returns {Object} Newly created scope. - * - */ - function Scope() { - this.$id = nextUid(); - this.$$phase = this.$parent = this.$$watchers = - this.$$nextSibling = this.$$prevSibling = - this.$$childHead = this.$$childTail = null; - this.$root = this; - this.$$destroyed = false; - this.$$suspended = false; - this.$$listeners = {}; - this.$$listenerCount = {}; - this.$$watchersCount = 0; - this.$$isolateBindings = null; - } - - /** - * @ngdoc property - * @name $rootScope.Scope#$id - * - * @description - * Unique scope ID (monotonically increasing) useful for debugging. - */ - - /** - * @ngdoc property - * @name $rootScope.Scope#$parent - * - * @description - * Reference to the parent scope. - */ - - /** - * @ngdoc property - * @name $rootScope.Scope#$root - * - * @description - * Reference to the root scope. - */ - - Scope.prototype = { - constructor: Scope, - /** - * @ngdoc method - * @name $rootScope.Scope#$new - * @kind function - * - * @description - * Creates a new child {@link ng.$rootScope.Scope scope}. - * - * The parent scope will propagate the {@link ng.$rootScope.Scope#$digest $digest()} event. - * The scope can be removed from the scope hierarchy using {@link ng.$rootScope.Scope#$destroy $destroy()}. - * - * {@link ng.$rootScope.Scope#$destroy $destroy()} must be called on a scope when it is - * desired for the scope and its child scopes to be permanently detached from the parent and - * thus stop participating in model change detection and listener notification by invoking. - * - * @param {boolean} isolate If true, then the scope does not prototypically inherit from the - * parent scope. The scope is isolated, as it can not see parent scope properties. - * When creating widgets, it is useful for the widget to not accidentally read parent - * state. - * - * @param {Scope} [parent=this] The {@link ng.$rootScope.Scope `Scope`} that will be the `$parent` - * of the newly created scope. Defaults to `this` scope if not provided. - * This is used when creating a transclude scope to correctly place it - * in the scope hierarchy while maintaining the correct prototypical - * inheritance. - * - * @returns {Object} The newly created child scope. - * - */ - $new: function (isolate, parent) { - var child; - - parent = parent || this; - - if (isolate) { - child = new Scope(); - child.$root = this.$root; - } else { - // Only create a child scope class if somebody asks for one, - // but cache it to allow the VM to optimize lookups. - if (!this.$$ChildScope) { - this.$$ChildScope = createChildScopeClass(this); - } - child = new this.$$ChildScope(); - } - child.$parent = parent; - child.$$prevSibling = parent.$$childTail; - if (parent.$$childHead) { - parent.$$childTail.$$nextSibling = child; - parent.$$childTail = child; - } else { - parent.$$childHead = parent.$$childTail = child; - } - - // When the new scope is not isolated or we inherit from `this`, and - // the parent scope is destroyed, the property `$$destroyed` is inherited - // prototypically. In all other cases, this property needs to be set - // when the parent scope is destroyed. - // The listener needs to be added after the parent is set - if (isolate || parent !== this) child.$on('$destroy', destroyChildScope); - - return child; - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$watch - * @kind function - * - * @description - * Registers a `listener` callback to be executed whenever the `watchExpression` changes. - * - * - The `watchExpression` is called on every call to {@link ng.$rootScope.Scope#$digest - * $digest()} and should return the value that will be watched. (`watchExpression` should not change - * its value when executed multiple times with the same input because it may be executed multiple - * times by {@link ng.$rootScope.Scope#$digest $digest()}. That is, `watchExpression` should be - * [idempotent](http://en.wikipedia.org/wiki/Idempotence).) - * - The `listener` is called only when the value from the current `watchExpression` and the - * previous call to `watchExpression` are not equal (with the exception of the initial run, - * see below). Inequality is determined according to reference inequality, - * [strict comparison](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators) - * via the `!==` Javascript operator, unless `objectEquality == true` - * (see next point) - * - When `objectEquality == true`, inequality of the `watchExpression` is determined - * according to the {@link angular.equals} function. To save the value of the object for - * later comparison, the {@link angular.copy} function is used. This therefore means that - * watching complex objects will have adverse memory and performance implications. - * - This should not be used to watch for changes in objects that are (or contain) - * [File](https://developer.mozilla.org/docs/Web/API/File) objects due to limitations with {@link angular.copy `angular.copy`}. - * - The watch `listener` may change the model, which may trigger other `listener`s to fire. - * This is achieved by rerunning the watchers until no changes are detected. The rerun - * iteration limit is 10 to prevent an infinite loop deadlock. - * - * - * If you want to be notified whenever {@link ng.$rootScope.Scope#$digest $digest} is called, - * you can register a `watchExpression` function with no `listener`. (Be prepared for - * multiple calls to your `watchExpression` because it will execute multiple times in a - * single {@link ng.$rootScope.Scope#$digest $digest} cycle if a change is detected.) - * - * After a watcher is registered with the scope, the `listener` fn is called asynchronously - * (via {@link ng.$rootScope.Scope#$evalAsync $evalAsync}) to initialize the - * watcher. In rare cases, this is undesirable because the listener is called when the result - * of `watchExpression` didn't change. To detect this scenario within the `listener` fn, you - * can compare the `newVal` and `oldVal`. If these two values are identical (`===`) then the - * listener was called due to initialization. - * - * - * - * @example - * ```js - // let's assume that scope was dependency injected as the $rootScope - var scope = $rootScope; - scope.name = 'misko'; - scope.counter = 0; - - expect(scope.counter).toEqual(0); - scope.$watch('name', function(newValue, oldValue) { - scope.counter = scope.counter + 1; - }); - expect(scope.counter).toEqual(0); - - scope.$digest(); - // the listener is always called during the first $digest loop after it was registered - expect(scope.counter).toEqual(1); - - scope.$digest(); - // but now it will not be called unless the value changes - expect(scope.counter).toEqual(1); - - scope.name = 'adam'; - scope.$digest(); - expect(scope.counter).toEqual(2); - - - - // Using a function as a watchExpression - var food; - scope.foodCounter = 0; - expect(scope.foodCounter).toEqual(0); - scope.$watch( - // This function returns the value being watched. It is called for each turn of the $digest loop - function() { return food; }, - // This is the change listener, called when the value returned from the above function changes - function(newValue, oldValue) { - if ( newValue !== oldValue ) { - // Only increment the counter if the value changed - scope.foodCounter = scope.foodCounter + 1; - } - } - ); - // No digest has been run so the counter will be zero - expect(scope.foodCounter).toEqual(0); - - // Run the digest but since food has not changed count will still be zero - scope.$digest(); - expect(scope.foodCounter).toEqual(0); - - // Update food and run digest. Now the counter will increment - food = 'cheeseburger'; - scope.$digest(); - expect(scope.foodCounter).toEqual(1); - - * ``` - * - * - * - * @param {(function()|string)} watchExpression Expression that is evaluated on each - * {@link ng.$rootScope.Scope#$digest $digest} cycle. A change in the return value triggers - * a call to the `listener`. - * - * - `string`: Evaluated as {@link guide/expression expression} - * - `function(scope)`: called with current `scope` as a parameter. - * @param {function(newVal, oldVal, scope)} listener Callback called whenever the value - * of `watchExpression` changes. - * - * - `newVal` contains the current value of the `watchExpression` - * - `oldVal` contains the previous value of the `watchExpression` - * - `scope` refers to the current scope - * @param {boolean=} [objectEquality=false] Compare for object equality using {@link angular.equals} instead of - * comparing for reference equality. - * @returns {function()} Returns a deregistration function for this listener. - */ - $watch: function (watchExp, listener, objectEquality, prettyPrintExpression) { - var get = $parse(watchExp); - var fn = isFunction(listener) ? listener : noop; - - if (get.$$watchDelegate) { - return get.$$watchDelegate(this, fn, objectEquality, get, watchExp); - } - var scope = this, - array = scope.$$watchers, - watcher = { - fn: fn, - last: initWatchVal, - get: get, - exp: prettyPrintExpression || watchExp, - eq: !!objectEquality - }; - - lastDirtyWatch = null; - - if (!array) { - array = scope.$$watchers = []; - array.$$digestWatchIndex = -1; - } - // we use unshift since we use a while loop in $digest for speed. - // the while loop reads in reverse order. - array.unshift(watcher); - array.$$digestWatchIndex++; - incrementWatchersCount(this, 1); - - return function deregisterWatch() { - var index = arrayRemove(array, watcher); - if (index >= 0) { - incrementWatchersCount(scope, -1); - if (index < array.$$digestWatchIndex) { - array.$$digestWatchIndex--; - } - } - lastDirtyWatch = null; - }; - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$watchGroup - * @kind function - * - * @description - * A variant of {@link ng.$rootScope.Scope#$watch $watch()} where it watches an array of `watchExpressions`. - * If any one expression in the collection changes the `listener` is executed. - * - * - The items in the `watchExpressions` array are observed via the standard `$watch` operation. Their return - * values are examined for changes on every call to `$digest`. - * - The `listener` is called whenever any expression in the `watchExpressions` array changes. - * - * @param {Array.} watchExpressions Array of expressions that will be individually - * watched using {@link ng.$rootScope.Scope#$watch $watch()} - * - * @param {function(newValues, oldValues, scope)} listener Callback called whenever the return value of any - * expression in `watchExpressions` changes - * The `newValues` array contains the current values of the `watchExpressions`, with the indexes matching - * those of `watchExpression` - * and the `oldValues` array contains the previous values of the `watchExpressions`, with the indexes matching - * those of `watchExpression` - * The `scope` refers to the current scope. - * @returns {function()} Returns a de-registration function for all listeners. - */ - $watchGroup: function (watchExpressions, listener) { - var oldValues = new Array(watchExpressions.length); - var newValues = new Array(watchExpressions.length); - var deregisterFns = []; - var self = this; - var changeReactionScheduled = false; - var firstRun = true; - - if (!watchExpressions.length) { - // No expressions means we call the listener ASAP - var shouldCall = true; - self.$evalAsync(function () { - if (shouldCall) listener(newValues, newValues, self); - }); - return function deregisterWatchGroup() { - shouldCall = false; - }; - } - - if (watchExpressions.length === 1) { - // Special case size of one - return this.$watch(watchExpressions[0], function watchGroupAction(value, oldValue, scope) { - newValues[0] = value; - oldValues[0] = oldValue; - listener(newValues, (value === oldValue) ? newValues : oldValues, scope); - }); - } - - forEach(watchExpressions, function (expr, i) { - var unwatchFn = self.$watch(expr, function watchGroupSubAction(value) { - newValues[i] = value; - if (!changeReactionScheduled) { - changeReactionScheduled = true; - self.$evalAsync(watchGroupAction); - } - }); - deregisterFns.push(unwatchFn); - }); - - function watchGroupAction() { - changeReactionScheduled = false; - - try { - if (firstRun) { - firstRun = false; - listener(newValues, newValues, self); - } else { - listener(newValues, oldValues, self); - } - } finally { - for (var i = 0; i < watchExpressions.length; i++) { - oldValues[i] = newValues[i]; - } - } - } - - return function deregisterWatchGroup() { - while (deregisterFns.length) { - deregisterFns.shift()(); - } - }; - }, - - - /** - * @ngdoc method - * @name $rootScope.Scope#$watchCollection - * @kind function - * - * @description - * Shallow watches the properties of an object and fires whenever any of the properties change - * (for arrays, this implies watching the array items; for object maps, this implies watching - * the properties). If a change is detected, the `listener` callback is fired. - * - * - The `obj` collection is observed via standard $watch operation and is examined on every - * call to $digest() to see if any items have been added, removed, or moved. - * - The `listener` is called whenever anything within the `obj` has changed. Examples include - * adding, removing, and moving items belonging to an object or array. - * - * - * @example - * ```js - $scope.names = ['igor', 'matias', 'misko', 'james']; - $scope.dataCount = 4; - - $scope.$watchCollection('names', function(newNames, oldNames) { - $scope.dataCount = newNames.length; - }); - - expect($scope.dataCount).toEqual(4); - $scope.$digest(); - - //still at 4 ... no changes - expect($scope.dataCount).toEqual(4); - - $scope.names.pop(); - $scope.$digest(); - - //now there's been a change - expect($scope.dataCount).toEqual(3); - * ``` - * - * - * @param {string|function(scope)} obj Evaluated as {@link guide/expression expression}. The - * expression value should evaluate to an object or an array which is observed on each - * {@link ng.$rootScope.Scope#$digest $digest} cycle. Any shallow change within the - * collection will trigger a call to the `listener`. - * - * @param {function(newCollection, oldCollection, scope)} listener a callback function called - * when a change is detected. - * - The `newCollection` object is the newly modified data obtained from the `obj` expression - * - The `oldCollection` object is a copy of the former collection data. - * Due to performance considerations, the`oldCollection` value is computed only if the - * `listener` function declares two or more arguments. - * - The `scope` argument refers to the current scope. - * - * @returns {function()} Returns a de-registration function for this listener. When the - * de-registration function is executed, the internal watch operation is terminated. - */ - $watchCollection: function (obj, listener) { - // Mark the interceptor as - // ... $$pure when literal since the instance will change when any input changes - $watchCollectionInterceptor.$$pure = $parse(obj).literal; - // ... $stateful when non-literal since we must read the state of the collection - $watchCollectionInterceptor.$stateful = !$watchCollectionInterceptor.$$pure; - - var self = this; - // the current value, updated on each dirty-check run - var newValue; - // a shallow copy of the newValue from the last dirty-check run, - // updated to match newValue during dirty-check run - var oldValue; - // a shallow copy of the newValue from when the last change happened - var veryOldValue; - // only track veryOldValue if the listener is asking for it - var trackVeryOldValue = (listener.length > 1); - var changeDetected = 0; - var changeDetector = $parse(obj, $watchCollectionInterceptor); - var internalArray = []; - var internalObject = {}; - var initRun = true; - var oldLength = 0; - - function $watchCollectionInterceptor(_value) { - newValue = _value; - var newLength, key, bothNaN, newItem, oldItem; - - // If the new value is undefined, then return undefined as the watch may be a one-time watch - if (isUndefined(newValue)) return; - - if (!isObject(newValue)) { // if primitive - if (oldValue !== newValue) { - oldValue = newValue; - changeDetected++; - } - } else if (isArrayLike(newValue)) { - if (oldValue !== internalArray) { - // we are transitioning from something which was not an array into array. - oldValue = internalArray; - oldLength = oldValue.length = 0; - changeDetected++; - } - - newLength = newValue.length; - - if (oldLength !== newLength) { - // if lengths do not match we need to trigger change notification - changeDetected++; - oldValue.length = oldLength = newLength; - } - // copy the items to oldValue and look for changes. - for (var i = 0; i < newLength; i++) { - oldItem = oldValue[i]; - newItem = newValue[i]; - - // eslint-disable-next-line no-self-compare - bothNaN = (oldItem !== oldItem) && (newItem !== newItem); - if (!bothNaN && (oldItem !== newItem)) { - changeDetected++; - oldValue[i] = newItem; - } - } - } else { - if (oldValue !== internalObject) { - // we are transitioning from something which was not an object into object. - oldValue = internalObject = {}; - oldLength = 0; - changeDetected++; - } - // copy the items to oldValue and look for changes. - newLength = 0; - for (key in newValue) { - if (hasOwnProperty.call(newValue, key)) { - newLength++; - newItem = newValue[key]; - oldItem = oldValue[key]; - - if (key in oldValue) { - // eslint-disable-next-line no-self-compare - bothNaN = (oldItem !== oldItem) && (newItem !== newItem); - if (!bothNaN && (oldItem !== newItem)) { - changeDetected++; - oldValue[key] = newItem; - } - } else { - oldLength++; - oldValue[key] = newItem; - changeDetected++; - } - } - } - if (oldLength > newLength) { - // we used to have more keys, need to find them and destroy them. - changeDetected++; - for (key in oldValue) { - if (!hasOwnProperty.call(newValue, key)) { - oldLength--; - delete oldValue[key]; - } - } - } - } - return changeDetected; - } - - function $watchCollectionAction() { - if (initRun) { - initRun = false; - listener(newValue, newValue, self); - } else { - listener(newValue, veryOldValue, self); - } - - // make a copy for the next time a collection is changed - if (trackVeryOldValue) { - if (!isObject(newValue)) { - //primitive - veryOldValue = newValue; - } else if (isArrayLike(newValue)) { - veryOldValue = new Array(newValue.length); - for (var i = 0; i < newValue.length; i++) { - veryOldValue[i] = newValue[i]; - } - } else { // if object - veryOldValue = {}; - for (var key in newValue) { - if (hasOwnProperty.call(newValue, key)) { - veryOldValue[key] = newValue[key]; - } - } - } - } - } - - return this.$watch(changeDetector, $watchCollectionAction); - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$digest - * @kind function - * - * @description - * Processes all of the {@link ng.$rootScope.Scope#$watch watchers} of the current scope and - * its children. Because a {@link ng.$rootScope.Scope#$watch watcher}'s listener can change - * the model, the `$digest()` keeps calling the {@link ng.$rootScope.Scope#$watch watchers} - * until no more listeners are firing. This means that it is possible to get into an infinite - * loop. This function will throw `'Maximum iteration limit exceeded.'` if the number of - * iterations exceeds 10. - * - * Usually, you don't call `$digest()` directly in - * {@link ng.directive:ngController controllers} or in - * {@link ng.$compileProvider#directive directives}. - * Instead, you should call {@link ng.$rootScope.Scope#$apply $apply()} (typically from within - * a {@link ng.$compileProvider#directive directive}), which will force a `$digest()`. - * - * If you want to be notified whenever `$digest()` is called, - * you can register a `watchExpression` function with - * {@link ng.$rootScope.Scope#$watch $watch()} with no `listener`. - * - * In unit tests, you may need to call `$digest()` to simulate the scope life cycle. - * - * @example - * ```js - var scope = ...; - scope.name = 'misko'; - scope.counter = 0; - - expect(scope.counter).toEqual(0); - scope.$watch('name', function(newValue, oldValue) { - scope.counter = scope.counter + 1; - }); - expect(scope.counter).toEqual(0); - - scope.$digest(); - // the listener is always called during the first $digest loop after it was registered - expect(scope.counter).toEqual(1); - - scope.$digest(); - // but now it will not be called unless the value changes - expect(scope.counter).toEqual(1); - - scope.name = 'adam'; - scope.$digest(); - expect(scope.counter).toEqual(2); - * ``` - * - */ - $digest: function () { - var watch, value, last, fn, get, - watchers, - dirty, ttl = TTL, - next, current, target = asyncQueue.length ? $rootScope : this, - watchLog = [], - logIdx, asyncTask; - - beginPhase('$digest'); - // Check for changes to browser url that happened in sync before the call to $digest - $browser.$$checkUrlChange(); - - if (this === $rootScope && applyAsyncId !== null) { - // If this is the root scope, and $applyAsync has scheduled a deferred $apply(), then - // cancel the scheduled $apply and flush the queue of expressions to be evaluated. - $browser.defer.cancel(applyAsyncId); - flushApplyAsync(); - } - - lastDirtyWatch = null; - - do { // "while dirty" loop - dirty = false; - current = target; - - // It's safe for asyncQueuePosition to be a local variable here because this loop can't - // be reentered recursively. Calling $digest from a function passed to $evalAsync would - // lead to a '$digest already in progress' error. - for (var asyncQueuePosition = 0; asyncQueuePosition < asyncQueue.length; asyncQueuePosition++) { - try { - asyncTask = asyncQueue[asyncQueuePosition]; - fn = asyncTask.fn; - fn(asyncTask.scope, asyncTask.locals); - } catch (e) { - $exceptionHandler(e); - } - lastDirtyWatch = null; - } - asyncQueue.length = 0; - - traverseScopesLoop: - do { // "traverse the scopes" loop - if ((watchers = !current.$$suspended && current.$$watchers)) { - // process our watches - watchers.$$digestWatchIndex = watchers.length; - while (watchers.$$digestWatchIndex--) { - try { - watch = watchers[watchers.$$digestWatchIndex]; - // Most common watches are on primitives, in which case we can short - // circuit it with === operator, only when === fails do we use .equals - if (watch) { - get = watch.get; - if ((value = get(current)) !== (last = watch.last) && - !(watch.eq ? - equals(value, last) : - (isNumberNaN(value) && isNumberNaN(last)))) { - dirty = true; - lastDirtyWatch = watch; - watch.last = watch.eq ? copy(value, null) : value; - fn = watch.fn; - fn(value, ((last === initWatchVal) ? value : last), current); - if (ttl < 5) { - logIdx = 4 - ttl; - if (!watchLog[logIdx]) watchLog[logIdx] = []; - watchLog[logIdx].push({ - msg: isFunction(watch.exp) ? 'fn: ' + (watch.exp.name || watch.exp.toString()) : watch.exp, - newVal: value, - oldVal: last - }); - } - } else if (watch === lastDirtyWatch) { - // If the most recently dirty watcher is now clean, short circuit since the remaining watchers - // have already been tested. - dirty = false; - break traverseScopesLoop; - } - } - } catch (e) { - $exceptionHandler(e); - } - } - } - - // Insanity Warning: scope depth-first traversal - // yes, this code is a bit crazy, but it works and we have tests to prove it! - // this piece should be kept in sync with the traversal in $broadcast - // (though it differs due to having the extra check for $$suspended and does not - // check $$listenerCount) - if (!(next = ((!current.$$suspended && current.$$watchersCount && current.$$childHead) || - (current !== target && current.$$nextSibling)))) { - while (current !== target && !(next = current.$$nextSibling)) { - current = current.$parent; - } - } - } while ((current = next)); - - // `break traverseScopesLoop;` takes us to here - - if ((dirty || asyncQueue.length) && !(ttl--)) { - clearPhase(); - throw $rootScopeMinErr('infdig', - '{0} $digest() iterations reached. Aborting!\n' + - 'Watchers fired in the last 5 iterations: {1}', - TTL, watchLog); - } - - } while (dirty || asyncQueue.length); - - clearPhase(); - - // postDigestQueuePosition isn't local here because this loop can be reentered recursively. - while (postDigestQueuePosition < postDigestQueue.length) { - try { - postDigestQueue[postDigestQueuePosition++](); - } catch (e) { - $exceptionHandler(e); - } - } - postDigestQueue.length = postDigestQueuePosition = 0; - - // Check for changes to browser url that happened during the $digest - // (for which no event is fired; e.g. via `history.pushState()`) - $browser.$$checkUrlChange(); - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$suspend - * @kind function - * - * @description - * Suspend watchers of this scope subtree so that they will not be invoked during digest. - * - * This can be used to optimize your application when you know that running those watchers - * is redundant. - * - * **Warning** - * - * Suspending scopes from the digest cycle can have unwanted and difficult to debug results. - * Only use this approach if you are confident that you know what you are doing and have - * ample tests to ensure that bindings get updated as you expect. - * - * Some of the things to consider are: - * - * * Any external event on a directive/component will not trigger a digest while the hosting - * scope is suspended - even if the event handler calls `$apply()` or `$rootScope.$digest()`. - * * Transcluded content exists on a scope that inherits from outside a directive but exists - * as a child of the directive's containing scope. If the containing scope is suspended the - * transcluded scope will also be suspended, even if the scope from which the transcluded - * scope inherits is not suspended. - * * Multiple directives trying to manage the suspended status of a scope can confuse each other: - * * A call to `$suspend()` on an already suspended scope is a no-op. - * * A call to `$resume()` on a non-suspended scope is a no-op. - * * If two directives suspend a scope, then one of them resumes the scope, the scope will no - * longer be suspended. This could result in the other directive believing a scope to be - * suspended when it is not. - * * If a parent scope is suspended then all its descendants will be also excluded from future - * digests whether or not they have been suspended themselves. Note that this also applies to - * isolate child scopes. - * * Calling `$digest()` directly on a descendant of a suspended scope will still run the watchers - * for that scope and its descendants. When digesting we only check whether the current scope is - * locally suspended, rather than checking whether it has a suspended ancestor. - * * Calling `$resume()` on a scope that has a suspended ancestor will not cause the scope to be - * included in future digests until all its ancestors have been resumed. - * * Resolved promises, e.g. from explicit `$q` deferreds and `$http` calls, trigger `$apply()` - * against the `$rootScope` and so will still trigger a global digest even if the promise was - * initiated by a component that lives on a suspended scope. - */ - $suspend: function () { - this.$$suspended = true; - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$isSuspended - * @kind function - * - * @description - * Call this method to determine if this scope has been explicitly suspended. It will not - * tell you whether an ancestor has been suspended. - * To determine if this scope will be excluded from a digest triggered at the $rootScope, - * for example, you must check all its ancestors: - * - * ``` - * function isExcludedFromDigest(scope) { - * while(scope) { - * if (scope.$isSuspended()) return true; - * scope = scope.$parent; - * } - * return false; - * ``` - * - * Be aware that a scope may not be included in digests if it has a suspended ancestor, - * even if `$isSuspended()` returns false. - * - * @returns true if the current scope has been suspended. - */ - $isSuspended: function () { - return this.$$suspended; - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$resume - * @kind function - * - * @description - * Resume watchers of this scope subtree in case it was suspended. - * - * See {@link $rootScope.Scope#$suspend} for information about the dangers of using this approach. - */ - $resume: function () { - this.$$suspended = false; - }, - - /** - * @ngdoc event - * @name $rootScope.Scope#$destroy - * @eventType broadcast on scope being destroyed - * - * @description - * Broadcasted when a scope and its children are being destroyed. - * - * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to - * clean up DOM bindings before an element is removed from the DOM. - */ - - /** - * @ngdoc method - * @name $rootScope.Scope#$destroy - * @kind function - * - * @description - * Removes the current scope (and all of its children) from the parent scope. Removal implies - * that calls to {@link ng.$rootScope.Scope#$digest $digest()} will no longer - * propagate to the current scope and its children. Removal also implies that the current - * scope is eligible for garbage collection. - * - * The `$destroy()` is usually used by directives such as - * {@link ng.directive:ngRepeat ngRepeat} for managing the - * unrolling of the loop. - * - * Just before a scope is destroyed, a `$destroy` event is broadcasted on this scope. - * Application code can register a `$destroy` event handler that will give it a chance to - * perform any necessary cleanup. - * - * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to - * clean up DOM bindings before an element is removed from the DOM. - */ - $destroy: function () { - // We can't destroy a scope that has been already destroyed. - if (this.$$destroyed) return; - var parent = this.$parent; - - this.$broadcast('$destroy'); - this.$$destroyed = true; - - if (this === $rootScope) { - //Remove handlers attached to window when $rootScope is removed - $browser.$$applicationDestroyed(); - } - - incrementWatchersCount(this, -this.$$watchersCount); - for (var eventName in this.$$listenerCount) { - decrementListenerCount(this, this.$$listenerCount[eventName], eventName); - } - - // sever all the references to parent scopes (after this cleanup, the current scope should - // not be retained by any of our references and should be eligible for garbage collection) - if (parent && parent.$$childHead === this) parent.$$childHead = this.$$nextSibling; - if (parent && parent.$$childTail === this) parent.$$childTail = this.$$prevSibling; - if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling; - if (this.$$nextSibling) this.$$nextSibling.$$prevSibling = this.$$prevSibling; - - // Disable listeners, watchers and apply/digest methods - this.$destroy = this.$digest = this.$apply = this.$evalAsync = this.$applyAsync = noop; - this.$on = this.$watch = this.$watchGroup = function () { - return noop; - }; - this.$$listeners = {}; - - // Disconnect the next sibling to prevent `cleanUpScope` destroying those too - this.$$nextSibling = null; - cleanUpScope(this); - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$eval - * @kind function - * - * @description - * Executes the `expression` on the current scope and returns the result. Any exceptions in - * the expression are propagated (uncaught). This is useful when evaluating AngularJS - * expressions. - * - * @example - * ```js - var scope = ng.$rootScope.Scope(); - scope.a = 1; - scope.b = 2; - - expect(scope.$eval('a+b')).toEqual(3); - expect(scope.$eval(function(scope){ return scope.a + scope.b; })).toEqual(3); - * ``` - * - * @param {(string|function())=} expression An AngularJS expression to be executed. - * - * - `string`: execute using the rules as defined in {@link guide/expression expression}. - * - `function(scope)`: execute the function with the current `scope` parameter. - * - * @param {(object)=} locals Local variables object, useful for overriding values in scope. - * @returns {*} The result of evaluating the expression. - */ - $eval: function (expr, locals) { - return $parse(expr)(this, locals); - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$evalAsync - * @kind function - * - * @description - * Executes the expression on the current scope at a later point in time. - * - * The `$evalAsync` makes no guarantees as to when the `expression` will be executed, only - * that: - * - * - it will execute after the function that scheduled the evaluation (preferably before DOM - * rendering). - * - at least one {@link ng.$rootScope.Scope#$digest $digest cycle} will be performed after - * `expression` execution. - * - * Any exceptions from the execution of the expression are forwarded to the - * {@link ng.$exceptionHandler $exceptionHandler} service. - * - * __Note:__ if this function is called outside of a `$digest` cycle, a new `$digest` cycle - * will be scheduled. However, it is encouraged to always call code that changes the model - * from within an `$apply` call. That includes code evaluated via `$evalAsync`. - * - * @param {(string|function())=} expression An AngularJS expression to be executed. - * - * - `string`: execute using the rules as defined in {@link guide/expression expression}. - * - `function(scope)`: execute the function with the current `scope` parameter. - * - * @param {(object)=} locals Local variables object, useful for overriding values in scope. - */ - $evalAsync: function (expr, locals) { - // if we are outside of an $digest loop and this is the first time we are scheduling async - // task also schedule async auto-flush - if (!$rootScope.$$phase && !asyncQueue.length) { - $browser.defer(function () { - if (asyncQueue.length) { - $rootScope.$digest(); - } - }, null, '$evalAsync'); - } - - asyncQueue.push({ - scope: this, - fn: $parse(expr), - locals: locals - }); - }, - - $$postDigest: function (fn) { - postDigestQueue.push(fn); - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$apply - * @kind function - * - * @description - * `$apply()` is used to execute an expression in AngularJS from outside of the AngularJS - * framework. (For example from browser DOM events, setTimeout, XHR or third party libraries). - * Because we are calling into the AngularJS framework we need to perform proper scope life - * cycle of {@link ng.$exceptionHandler exception handling}, - * {@link ng.$rootScope.Scope#$digest executing watches}. - * - * **Life cycle: Pseudo-Code of `$apply()`** - * - * ```js - function $apply(expr) { - try { - return $eval(expr); - } catch (e) { - $exceptionHandler(e); - } finally { - $root.$digest(); - } - } - * ``` - * - * - * Scope's `$apply()` method transitions through the following stages: - * - * 1. The {@link guide/expression expression} is executed using the - * {@link ng.$rootScope.Scope#$eval $eval()} method. - * 2. Any exceptions from the execution of the expression are forwarded to the - * {@link ng.$exceptionHandler $exceptionHandler} service. - * 3. The {@link ng.$rootScope.Scope#$watch watch} listeners are fired immediately after the - * expression was executed using the {@link ng.$rootScope.Scope#$digest $digest()} method. - * - * - * @param {(string|function())=} exp An AngularJS expression to be executed. - * - * - `string`: execute using the rules as defined in {@link guide/expression expression}. - * - `function(scope)`: execute the function with current `scope` parameter. - * - * @returns {*} The result of evaluating the expression. - */ - $apply: function (expr) { - try { - beginPhase('$apply'); - try { - return this.$eval(expr); - } finally { - clearPhase(); - } - } catch (e) { - $exceptionHandler(e); - } finally { - try { - $rootScope.$digest(); - } catch (e) { - $exceptionHandler(e); - // eslint-disable-next-line no-unsafe-finally - throw e; - } - } - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$applyAsync - * @kind function - * - * @description - * Schedule the invocation of $apply to occur at a later time. The actual time difference - * varies across browsers, but is typically around ~10 milliseconds. - * - * This can be used to queue up multiple expressions which need to be evaluated in the same - * digest. - * - * @param {(string|function())=} exp An AngularJS expression to be executed. - * - * - `string`: execute using the rules as defined in {@link guide/expression expression}. - * - `function(scope)`: execute the function with current `scope` parameter. - */ - $applyAsync: function (expr) { - var scope = this; - if (expr) { - applyAsyncQueue.push($applyAsyncExpression); - } - expr = $parse(expr); - scheduleApplyAsync(); - - function $applyAsyncExpression() { - scope.$eval(expr); - } - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$on - * @kind function - * - * @description - * Listens on events of a given type. See {@link ng.$rootScope.Scope#$emit $emit} for - * discussion of event life cycle. - * - * The event listener function format is: `function(event, args...)`. The `event` object - * passed into the listener has the following attributes: - * - * - `targetScope` - `{Scope}`: the scope on which the event was `$emit`-ed or - * `$broadcast`-ed. - * - `currentScope` - `{Scope}`: the scope that is currently handling the event. Once the - * event propagates through the scope hierarchy, this property is set to null. - * - `name` - `{string}`: name of the event. - * - `stopPropagation` - `{function=}`: calling `stopPropagation` function will cancel - * further event propagation (available only for events that were `$emit`-ed). - * - `preventDefault` - `{function}`: calling `preventDefault` sets `defaultPrevented` flag - * to true. - * - `defaultPrevented` - `{boolean}`: true if `preventDefault` was called. - * - * @param {string} name Event name to listen on. - * @param {function(event, ...args)} listener Function to call when the event is emitted. - * @returns {function()} Returns a deregistration function for this listener. - */ - $on: function (name, listener) { - var namedListeners = this.$$listeners[name]; - if (!namedListeners) { - this.$$listeners[name] = namedListeners = []; - } - namedListeners.push(listener); - - var current = this; - do { - if (!current.$$listenerCount[name]) { - current.$$listenerCount[name] = 0; - } - current.$$listenerCount[name]++; - } while ((current = current.$parent)); - - var self = this; - return function () { - var indexOfListener = namedListeners.indexOf(listener); - if (indexOfListener !== -1) { - // Use delete in the hope of the browser deallocating the memory for the array entry, - // while not shifting the array indexes of other listeners. - // See issue https://github.com/angular/angular.js/issues/16135 - delete namedListeners[indexOfListener]; - decrementListenerCount(self, 1, name); - } - }; - }, - - - /** - * @ngdoc method - * @name $rootScope.Scope#$emit - * @kind function - * - * @description - * Dispatches an event `name` upwards through the scope hierarchy notifying the - * registered {@link ng.$rootScope.Scope#$on} listeners. - * - * The event life cycle starts at the scope on which `$emit` was called. All - * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get - * notified. Afterwards, the event traverses upwards toward the root scope and calls all - * registered listeners along the way. The event will stop propagating if one of the listeners - * cancels it. - * - * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed - * onto the {@link ng.$exceptionHandler $exceptionHandler} service. - * - * @param {string} name Event name to emit. - * @param {...*} args Optional one or more arguments which will be passed onto the event listeners. - * @return {Object} Event object (see {@link ng.$rootScope.Scope#$on}). - */ - $emit: function (name, args) { - var empty = [], - namedListeners, - scope = this, - stopPropagation = false, - event = { - name: name, - targetScope: scope, - stopPropagation: function () { - stopPropagation = true; - }, - preventDefault: function () { - event.defaultPrevented = true; - }, - defaultPrevented: false - }, - listenerArgs = concat([event], arguments, 1), - i, length; - - do { - namedListeners = scope.$$listeners[name] || empty; - event.currentScope = scope; - for (i = 0, length = namedListeners.length; i < length; i++) { - - // if listeners were deregistered, defragment the array - if (!namedListeners[i]) { - namedListeners.splice(i, 1); - i--; - length--; - continue; - } - try { - //allow all listeners attached to the current scope to run - namedListeners[i].apply(null, listenerArgs); - } catch (e) { - $exceptionHandler(e); - } - } - //if any listener on the current scope stops propagation, prevent bubbling - if (stopPropagation) { - break; - } - //traverse upwards - scope = scope.$parent; - } while (scope); - - event.currentScope = null; - - return event; - }, - - - /** - * @ngdoc method - * @name $rootScope.Scope#$broadcast - * @kind function - * - * @description - * Dispatches an event `name` downwards to all child scopes (and their children) notifying the - * registered {@link ng.$rootScope.Scope#$on} listeners. - * - * The event life cycle starts at the scope on which `$broadcast` was called. All - * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get - * notified. Afterwards, the event propagates to all direct and indirect scopes of the current - * scope and calls all registered listeners along the way. The event cannot be canceled. - * - * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed - * onto the {@link ng.$exceptionHandler $exceptionHandler} service. - * - * @param {string} name Event name to broadcast. - * @param {...*} args Optional one or more arguments which will be passed onto the event listeners. - * @return {Object} Event object, see {@link ng.$rootScope.Scope#$on} - */ - $broadcast: function (name, args) { - var target = this, - current = target, - next = target, - event = { - name: name, - targetScope: target, - preventDefault: function () { - event.defaultPrevented = true; - }, - defaultPrevented: false - }; - - if (!target.$$listenerCount[name]) return event; - - var listenerArgs = concat([event], arguments, 1), - listeners, i, length; - - //down while you can, then up and next sibling or up and next sibling until back at root - while ((current = next)) { - event.currentScope = current; - listeners = current.$$listeners[name] || []; - for (i = 0, length = listeners.length; i < length; i++) { - // if listeners were deregistered, defragment the array - if (!listeners[i]) { - listeners.splice(i, 1); - i--; - length--; - continue; - } - - try { - listeners[i].apply(null, listenerArgs); - } catch (e) { - $exceptionHandler(e); - } - } - - // Insanity Warning: scope depth-first traversal - // yes, this code is a bit crazy, but it works and we have tests to prove it! - // this piece should be kept in sync with the traversal in $digest - // (though it differs due to having the extra check for $$listenerCount and - // does not check $$suspended) - if (!(next = ((current.$$listenerCount[name] && current.$$childHead) || - (current !== target && current.$$nextSibling)))) { - while (current !== target && !(next = current.$$nextSibling)) { - current = current.$parent; - } - } - } - - event.currentScope = null; - return event; - } - }; - - var $rootScope = new Scope(); - - //The internal queues. Expose them on the $rootScope for debugging/testing purposes. - var asyncQueue = $rootScope.$$asyncQueue = []; - var postDigestQueue = $rootScope.$$postDigestQueue = []; - var applyAsyncQueue = $rootScope.$$applyAsyncQueue = []; - - var postDigestQueuePosition = 0; - - return $rootScope; - - - function beginPhase(phase) { - if ($rootScope.$$phase) { - throw $rootScopeMinErr('inprog', '{0} already in progress', $rootScope.$$phase); - } - - $rootScope.$$phase = phase; - } - - function clearPhase() { - $rootScope.$$phase = null; - } - - function incrementWatchersCount(current, count) { - do { - current.$$watchersCount += count; - } while ((current = current.$parent)); - } - - function decrementListenerCount(current, count, name) { - do { - current.$$listenerCount[name] -= count; - - if (current.$$listenerCount[name] === 0) { - delete current.$$listenerCount[name]; - } - } while ((current = current.$parent)); - } - - /** - * function used as an initial value for watchers. - * because it's unique we can easily tell it apart from other values - */ - function initWatchVal() {} - - function flushApplyAsync() { - while (applyAsyncQueue.length) { - try { - applyAsyncQueue.shift()(); - } catch (e) { - $exceptionHandler(e); - } - } - applyAsyncId = null; - } - - function scheduleApplyAsync() { - if (applyAsyncId === null) { - applyAsyncId = $browser.defer(function () { - $rootScope.$apply(flushApplyAsync); - }, null, '$applyAsync'); - } - } - } - ]; - } - - /** - * @ngdoc service - * @name $rootElement - * - * @description - * The root element of AngularJS application. This is either the element where {@link - * ng.directive:ngApp ngApp} was declared or the element passed into - * {@link angular.bootstrap}. The element represents the root element of application. It is also the - * location where the application's {@link auto.$injector $injector} service gets - * published, and can be retrieved using `$rootElement.injector()`. - */ - - - // the implementation is in angular.bootstrap - - /** - * @this - * @description - * Private service to sanitize uris for links and images. Used by $compile and $sanitize. - */ - function $$SanitizeUriProvider() { - - var aHrefSanitizationTrustedUrlList = /^\s*(https?|s?ftp|mailto|tel|file):/, - imgSrcSanitizationTrustedUrlList = /^\s*((https?|ftp|file|blob):|data:image\/)/; - - /** - * @description - * Retrieves or overrides the default regular expression that is used for determining trusted safe - * urls during a[href] sanitization. - * - * The sanitization is a security measure aimed at prevent XSS attacks via HTML anchor links. - * - * Any url due to be assigned to an `a[href]` attribute via interpolation is marked as requiring - * the $sce.URL security context. When interpolation occurs a call is made to `$sce.trustAsUrl(url)` - * which in turn may call `$$sanitizeUri(url, isMedia)` to sanitize the potentially malicious URL. - * - * If the URL matches the `aHrefSanitizationTrustedUrlList` regular expression, it is returned unchanged. - * - * If there is no match the URL is returned prefixed with `'unsafe:'` to ensure that when it is written - * to the DOM it is inactive and potentially malicious code will not be executed. - * - * @param {RegExp=} regexp New regexp to trust urls with. - * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for - * chaining otherwise. - */ - this.aHrefSanitizationTrustedUrlList = function (regexp) { - if (isDefined(regexp)) { - aHrefSanitizationTrustedUrlList = regexp; - return this; - } - return aHrefSanitizationTrustedUrlList; - }; - - - /** - * @description - * Retrieves or overrides the default regular expression that is used for determining trusted safe - * urls during img[src] sanitization. - * - * The sanitization is a security measure aimed at prevent XSS attacks via HTML image src links. - * - * Any URL due to be assigned to an `img[src]` attribute via interpolation is marked as requiring - * the $sce.MEDIA_URL security context. When interpolation occurs a call is made to - * `$sce.trustAsMediaUrl(url)` which in turn may call `$$sanitizeUri(url, isMedia)` to sanitize - * the potentially malicious URL. - * - * If the URL matches the `imgSrcSanitizationTrustedUrlList` regular expression, it is returned - * unchanged. - * - * If there is no match the URL is returned prefixed with `'unsafe:'` to ensure that when it is written - * to the DOM it is inactive and potentially malicious code will not be executed. - * - * @param {RegExp=} regexp New regexp to trust urls with. - * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for - * chaining otherwise. - */ - this.imgSrcSanitizationTrustedUrlList = function (regexp) { - if (isDefined(regexp)) { - imgSrcSanitizationTrustedUrlList = regexp; - return this; - } - return imgSrcSanitizationTrustedUrlList; - }; - - this.$get = function () { - return function sanitizeUri(uri, isMediaUrl) { - // if (!uri) return uri; - var regex = isMediaUrl ? imgSrcSanitizationTrustedUrlList : aHrefSanitizationTrustedUrlList; - var normalizedVal = urlResolve(uri && uri.trim()).href; - if (normalizedVal !== '' && !normalizedVal.match(regex)) { - return 'unsafe:' + normalizedVal; - } - return uri; - }; - }; - } - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Any commits to this file should be reviewed with security in mind. * - * Changes to this file can potentially create security vulnerabilities. * - * An approval from 2 Core members with history of modifying * - * this file is required. * - * * - * Does the change somehow allow for arbitrary javascript to be executed? * - * Or allows for someone to change the prototype of built-in objects? * - * Or gives undesired access to variables likes document or window? * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - /* exported $SceProvider, $SceDelegateProvider */ - - var $sceMinErr = minErr('$sce'); - - var SCE_CONTEXTS = { - // HTML is used when there's HTML rendered (e.g. ng-bind-html, iframe srcdoc binding). - HTML: 'html', - - // Style statements or stylesheets. Currently unused in AngularJS. - CSS: 'css', - - // An URL used in a context where it refers to the source of media, which are not expected to be run - // as scripts, such as an image, audio, video, etc. - MEDIA_URL: 'mediaUrl', - - // An URL used in a context where it does not refer to a resource that loads code. - // A value that can be trusted as a URL can also trusted as a MEDIA_URL. - URL: 'url', - - // RESOURCE_URL is a subtype of URL used where the referred-to resource could be interpreted as - // code. (e.g. ng-include, script src binding, templateUrl) - // A value that can be trusted as a RESOURCE_URL, can also trusted as a URL and a MEDIA_URL. - RESOURCE_URL: 'resourceUrl', - - // Script. Currently unused in AngularJS. - JS: 'js' - }; - - // Helper functions follow. - - var UNDERSCORE_LOWERCASE_REGEXP = /_([a-z])/g; - - function snakeToCamel(name) { - return name - .replace(UNDERSCORE_LOWERCASE_REGEXP, fnCamelCaseReplace); - } - - function adjustMatcher(matcher) { - if (matcher === 'self') { - return matcher; - } else if (isString(matcher)) { - // Strings match exactly except for 2 wildcards - '*' and '**'. - // '*' matches any character except those from the set ':/.?&'. - // '**' matches any character (like .* in a RegExp). - // More than 2 *'s raises an error as it's ill defined. - if (matcher.indexOf('***') > -1) { - throw $sceMinErr('iwcard', - 'Illegal sequence *** in string matcher. String: {0}', matcher); - } - matcher = escapeForRegexp(matcher). - replace(/\\\*\\\*/g, '.*'). - replace(/\\\*/g, '[^:/.?&;]*'); - return new RegExp('^' + matcher + '$'); - } else if (isRegExp(matcher)) { - // The only other type of matcher allowed is a Regexp. - // Match entire URL / disallow partial matches. - // Flags are reset (i.e. no global, ignoreCase or multiline) - return new RegExp('^' + matcher.source + '$'); - } else { - throw $sceMinErr('imatcher', - 'Matchers may only be "self", string patterns or RegExp objects'); - } - } - - - function adjustMatchers(matchers) { - var adjustedMatchers = []; - if (isDefined(matchers)) { - forEach(matchers, function (matcher) { - adjustedMatchers.push(adjustMatcher(matcher)); - }); - } - return adjustedMatchers; - } - - - /** - * @ngdoc service - * @name $sceDelegate - * @kind function - * - * @description - * - * `$sceDelegate` is a service that is used by the `$sce` service to provide {@link ng.$sce Strict - * Contextual Escaping (SCE)} services to AngularJS. - * - * For an overview of this service and the functionnality it provides in AngularJS, see the main - * page for {@link ng.$sce SCE}. The current page is targeted for developers who need to alter how - * SCE works in their application, which shouldn't be needed in most cases. - * - *
- * AngularJS strongly relies on contextual escaping for the security of bindings: disabling or - * modifying this might cause cross site scripting (XSS) vulnerabilities. For libraries owners, - * changes to this service will also influence users, so be extra careful and document your changes. - *
- * - * Typically, you would configure or override the {@link ng.$sceDelegate $sceDelegate} instead of - * the `$sce` service to customize the way Strict Contextual Escaping works in AngularJS. This is - * because, while the `$sce` provides numerous shorthand methods, etc., you really only need to - * override 3 core functions (`trustAs`, `getTrusted` and `valueOf`) to replace the way things - * work because `$sce` delegates to `$sceDelegate` for these operations. - * - * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} to configure this service. - * - * The default instance of `$sceDelegate` should work out of the box with little pain. While you - * can override it completely to change the behavior of `$sce`, the common case would - * involve configuring the {@link ng.$sceDelegateProvider $sceDelegateProvider} instead by setting - * your own trusted and banned resource lists for trusting URLs used for loading AngularJS resources - * such as templates. Refer {@link ng.$sceDelegateProvider#trustedResourceUrlList - * $sceDelegateProvider.trustedResourceUrlList} and {@link - * ng.$sceDelegateProvider#bannedResourceUrlList $sceDelegateProvider.bannedResourceUrlList} - */ - - /** - * @ngdoc provider - * @name $sceDelegateProvider - * @this - * - * @description - * - * The `$sceDelegateProvider` provider allows developers to configure the {@link ng.$sceDelegate - * $sceDelegate service}, used as a delegate for {@link ng.$sce Strict Contextual Escaping (SCE)}. - * - * The `$sceDelegateProvider` allows one to get/set the `trustedResourceUrlList` and - * `bannedResourceUrlList` used to ensure that the URLs used for sourcing AngularJS templates and - * other script-running URLs are safe (all places that use the `$sce.RESOURCE_URL` context). See - * {@link ng.$sceDelegateProvider#trustedResourceUrlList - * $sceDelegateProvider.trustedResourceUrlList} and - * {@link ng.$sceDelegateProvider#bannedResourceUrlList $sceDelegateProvider.bannedResourceUrlList}, - * - * For the general details about this service in AngularJS, read the main page for {@link ng.$sce - * Strict Contextual Escaping (SCE)}. - * - * **Example**: Consider the following case.
- * - * - your app is hosted at url `http://myapp.example.com/` - * - but some of your templates are hosted on other domains you control such as - * `http://srv01.assets.example.com/`, `http://srv02.assets.example.com/`, etc. - * - and you have an open redirect at `http://myapp.example.com/clickThru?...`. - * - * Here is what a secure configuration for this scenario might look like: - * - * ``` - * angular.module('myApp', []).config(function($sceDelegateProvider) { - * $sceDelegateProvider.trustedResourceUrlList([ - * // Allow same origin resource loads. - * 'self', - * // Allow loading from our assets domain. Notice the difference between * and **. - * 'http://srv*.assets.example.com/**' - * ]); - * - * // The banned resource URL list overrides the trusted resource URL list so the open redirect - * // here is blocked. - * $sceDelegateProvider.bannedResourceUrlList([ - * 'http://myapp.example.com/clickThru**' - * ]); - * }); - * ``` - * Note that an empty trusted resource URL list will block every resource URL from being loaded, and will require - * you to manually mark each one as trusted with `$sce.trustAsResourceUrl`. However, templates - * requested by {@link ng.$templateRequest $templateRequest} that are present in - * {@link ng.$templateCache $templateCache} will not go through this check. If you have a mechanism - * to populate your templates in that cache at config time, then it is a good idea to remove 'self' - * from the trusted resource URL lsit. This helps to mitigate the security impact of certain types - * of issues, like for instance attacker-controlled `ng-includes`. - */ - - function $SceDelegateProvider() { - this.SCE_CONTEXTS = SCE_CONTEXTS; - - // Resource URLs can also be trusted by policy. - var trustedResourceUrlList = ['self'], - bannedResourceUrlList = []; - - /** - * @ngdoc method - * @name $sceDelegateProvider#trustedResourceUrlList - * @kind function - * - * @param {Array=} trustedResourceUrlList When provided, replaces the trustedResourceUrlList with - * the value provided. This must be an array or null. A snapshot of this array is used so - * further changes to the array are ignored. - * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items - * allowed in this array. - * - * @return {Array} The currently set trusted resource URL array. - * - * @description - * Sets/Gets the list trusted of resource URLs. - * - * The **default value** when no `trustedResourceUrlList` has been explicitly set is `['self']` - * allowing only same origin resource requests. - * - *
- * **Note:** the default `trustedResourceUrlList` of 'self' is not recommended if your app shares - * its origin with other apps! It is a good idea to limit it to only your application's directory. - *
- */ - this.trustedResourceUrlList = function (value) { - if (arguments.length) { - trustedResourceUrlList = adjustMatchers(value); - } - return trustedResourceUrlList; - }; - - /** - * @ngdoc method - * @name $sceDelegateProvider#resourceUrlWhitelist - * @kind function - * - * @deprecated - * sinceVersion="1.8.1" - * - * This method is deprecated. Use {@link $sceDelegateProvider#trustedResourceUrlList - * trustedResourceUrlList} instead. - */ - Object.defineProperty(this, 'resourceUrlWhitelist', { - get: function () { - return this.trustedResourceUrlList; - }, - set: function (value) { - this.trustedResourceUrlList = value; - } - }); - - /** - * @ngdoc method - * @name $sceDelegateProvider#bannedResourceUrlList - * @kind function - * - * @param {Array=} bannedResourceUrlList When provided, replaces the `bannedResourceUrlList` with - * the value provided. This must be an array or null. A snapshot of this array is used so - * further changes to the array are ignored.

- * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items - * allowed in this array.

- * The typical usage for the `bannedResourceUrlList` is to **block - * [open redirects](http://cwe.mitre.org/data/definitions/601.html)** served by your domain as - * these would otherwise be trusted but actually return content from the redirected domain. - *

- * Finally, **the banned resource URL list overrides the trusted resource URL list** and has - * the final say. - * - * @return {Array} The currently set `bannedResourceUrlList` array. - * - * @description - * Sets/Gets the `bannedResourceUrlList` of trusted resource URLs. - * - * The **default value** when no trusted resource URL list has been explicitly set is the empty - * array (i.e. there is no `bannedResourceUrlList`.) - */ - this.bannedResourceUrlList = function (value) { - if (arguments.length) { - bannedResourceUrlList = adjustMatchers(value); - } - return bannedResourceUrlList; - }; - - /** - * @ngdoc method - * @name $sceDelegateProvider#resourceUrlBlacklist - * @kind function - * - * @deprecated - * sinceVersion="1.8.1" - * - * This method is deprecated. Use {@link $sceDelegateProvider#bannedResourceUrlList - * bannedResourceUrlList} instead. - */ - Object.defineProperty(this, 'resourceUrlBlacklist', { - get: function () { - return this.bannedResourceUrlList; - }, - set: function (value) { - this.bannedResourceUrlList = value; - } - }); - - this.$get = ['$injector', '$$sanitizeUri', function ($injector, $$sanitizeUri) { - - var htmlSanitizer = function htmlSanitizer(html) { - throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.'); - }; - - if ($injector.has('$sanitize')) { - htmlSanitizer = $injector.get('$sanitize'); - } - - - function matchUrl(matcher, parsedUrl) { - if (matcher === 'self') { - return urlIsSameOrigin(parsedUrl) || urlIsSameOriginAsBaseUrl(parsedUrl); - } else { - // definitely a regex. See adjustMatchers() - return !!matcher.exec(parsedUrl.href); - } - } - - function isResourceUrlAllowedByPolicy(url) { - var parsedUrl = urlResolve(url.toString()); - var i, n, allowed = false; - // Ensure that at least one item from the trusted resource URL list allows this url. - for (i = 0, n = trustedResourceUrlList.length; i < n; i++) { - if (matchUrl(trustedResourceUrlList[i], parsedUrl)) { - allowed = true; - break; - } - } - if (allowed) { - // Ensure that no item from the banned resource URL list has blocked this url. - for (i = 0, n = bannedResourceUrlList.length; i < n; i++) { - if (matchUrl(bannedResourceUrlList[i], parsedUrl)) { - allowed = false; - break; - } - } - } - return allowed; - } - - function generateHolderType(Base) { - var holderType = function TrustedValueHolderType(trustedValue) { - this.$$unwrapTrustedValue = function () { - return trustedValue; - }; - }; - if (Base) { - holderType.prototype = new Base(); - } - holderType.prototype.valueOf = function sceValueOf() { - return this.$$unwrapTrustedValue(); - }; - holderType.prototype.toString = function sceToString() { - return this.$$unwrapTrustedValue().toString(); - }; - return holderType; - } - - var trustedValueHolderBase = generateHolderType(), - byType = {}; - - byType[SCE_CONTEXTS.HTML] = generateHolderType(trustedValueHolderBase); - byType[SCE_CONTEXTS.CSS] = generateHolderType(trustedValueHolderBase); - byType[SCE_CONTEXTS.MEDIA_URL] = generateHolderType(trustedValueHolderBase); - byType[SCE_CONTEXTS.URL] = generateHolderType(byType[SCE_CONTEXTS.MEDIA_URL]); - byType[SCE_CONTEXTS.JS] = generateHolderType(trustedValueHolderBase); - byType[SCE_CONTEXTS.RESOURCE_URL] = generateHolderType(byType[SCE_CONTEXTS.URL]); - - /** - * @ngdoc method - * @name $sceDelegate#trustAs - * - * @description - * Returns a trusted representation of the parameter for the specified context. This trusted - * object will later on be used as-is, without any security check, by bindings or directives - * that require this security context. - * For instance, marking a string as trusted for the `$sce.HTML` context will entirely bypass - * the potential `$sanitize` call in corresponding `$sce.HTML` bindings or directives, such as - * `ng-bind-html`. Note that in most cases you won't need to call this function: if you have the - * sanitizer loaded, passing the value itself will render all the HTML that does not pose a - * security risk. - * - * See {@link ng.$sceDelegate#getTrusted getTrusted} for the function that will consume those - * trusted values, and {@link ng.$sce $sce} for general documentation about strict contextual - * escaping. - * - * @param {string} type The context in which this value is safe for use, e.g. `$sce.URL`, - * `$sce.RESOURCE_URL`, `$sce.HTML`, `$sce.JS` or `$sce.CSS`. - * - * @param {*} value The value that should be considered trusted. - * @return {*} A trusted representation of value, that can be used in the given context. - */ - function trustAs(type, trustedValue) { - var Constructor = (byType.hasOwnProperty(type) ? byType[type] : null); - if (!Constructor) { - throw $sceMinErr('icontext', - 'Attempted to trust a value in invalid context. Context: {0}; Value: {1}', - type, trustedValue); - } - if (trustedValue === null || isUndefined(trustedValue) || trustedValue === '') { - return trustedValue; - } - // All the current contexts in SCE_CONTEXTS happen to be strings. In order to avoid trusting - // mutable objects, we ensure here that the value passed in is actually a string. - if (typeof trustedValue !== 'string') { - throw $sceMinErr('itype', - 'Attempted to trust a non-string value in a content requiring a string: Context: {0}', - type); - } - return new Constructor(trustedValue); - } - - /** - * @ngdoc method - * @name $sceDelegate#valueOf - * - * @description - * If the passed parameter had been returned by a prior call to {@link ng.$sceDelegate#trustAs - * `$sceDelegate.trustAs`}, returns the value that had been passed to {@link - * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}. - * - * If the passed parameter is not a value that had been returned by {@link - * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}, it must be returned as-is. - * - * @param {*} value The result of a prior {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`} - * call or anything else. - * @return {*} The `value` that was originally provided to {@link ng.$sceDelegate#trustAs - * `$sceDelegate.trustAs`} if `value` is the result of such a call. Otherwise, returns - * `value` unchanged. - */ - function valueOf(maybeTrusted) { - if (maybeTrusted instanceof trustedValueHolderBase) { - return maybeTrusted.$$unwrapTrustedValue(); - } else { - return maybeTrusted; - } - } - - /** - * @ngdoc method - * @name $sceDelegate#getTrusted - * - * @description - * Given an object and a security context in which to assign it, returns a value that's safe to - * use in this context, which was represented by the parameter. To do so, this function either - * unwraps the safe type it has been given (for instance, a {@link ng.$sceDelegate#trustAs - * `$sceDelegate.trustAs`} result), or it might try to sanitize the value given, depending on - * the context and sanitizer availablility. - * - * The contexts that can be sanitized are $sce.MEDIA_URL, $sce.URL and $sce.HTML. The first two are available - * by default, and the third one relies on the `$sanitize` service (which may be loaded through - * the `ngSanitize` module). Furthermore, for $sce.RESOURCE_URL context, a plain string may be - * accepted if the resource url policy defined by {@link ng.$sceDelegateProvider#trustedResourceUrlList - * `$sceDelegateProvider.trustedResourceUrlList`} and {@link ng.$sceDelegateProvider#bannedResourceUrlList - * `$sceDelegateProvider.bannedResourceUrlList`} accepts that resource. - * - * This function will throw if the safe type isn't appropriate for this context, or if the - * value given cannot be accepted in the context (which might be caused by sanitization not - * being available, or the value not being recognized as safe). - * - *

- * Disabling auto-escaping is extremely dangerous, it usually creates a Cross Site Scripting - * (XSS) vulnerability in your application. - *
- * - * @param {string} type The context in which this value is to be used (such as `$sce.HTML`). - * @param {*} maybeTrusted The result of a prior {@link ng.$sceDelegate#trustAs - * `$sceDelegate.trustAs`} call, or anything else (which will not be considered trusted.) - * @return {*} A version of the value that's safe to use in the given context, or throws an - * exception if this is impossible. - */ - function getTrusted(type, maybeTrusted) { - if (maybeTrusted === null || isUndefined(maybeTrusted) || maybeTrusted === '') { - return maybeTrusted; - } - var constructor = (byType.hasOwnProperty(type) ? byType[type] : null); - // If maybeTrusted is a trusted class instance or subclass instance, then unwrap and return - // as-is. - if (constructor && maybeTrusted instanceof constructor) { - return maybeTrusted.$$unwrapTrustedValue(); - } - - // If maybeTrusted is a trusted class instance but not of the correct trusted type - // then unwrap it and allow it to pass through to the rest of the checks - if (isFunction(maybeTrusted.$$unwrapTrustedValue)) { - maybeTrusted = maybeTrusted.$$unwrapTrustedValue(); - } - - // If we get here, then we will either sanitize the value or throw an exception. - if (type === SCE_CONTEXTS.MEDIA_URL || type === SCE_CONTEXTS.URL) { - // we attempt to sanitize non-resource URLs - return $$sanitizeUri(maybeTrusted.toString(), type === SCE_CONTEXTS.MEDIA_URL); - } else if (type === SCE_CONTEXTS.RESOURCE_URL) { - if (isResourceUrlAllowedByPolicy(maybeTrusted)) { - return maybeTrusted; - } else { - throw $sceMinErr('insecurl', - 'Blocked loading resource from url not allowed by $sceDelegate policy. URL: {0}', - maybeTrusted.toString()); - } - } else if (type === SCE_CONTEXTS.HTML) { - // htmlSanitizer throws its own error when no sanitizer is available. - return htmlSanitizer(maybeTrusted); - } - // Default error when the $sce service has no way to make the input safe. - throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.'); - } - - return { - trustAs: trustAs, - getTrusted: getTrusted, - valueOf: valueOf - }; - }]; - } - - - /** - * @ngdoc provider - * @name $sceProvider - * @this - * - * @description - * - * The $sceProvider provider allows developers to configure the {@link ng.$sce $sce} service. - * - enable/disable Strict Contextual Escaping (SCE) in a module - * - override the default implementation with a custom delegate - * - * Read more about {@link ng.$sce Strict Contextual Escaping (SCE)}. - */ - - /** - * @ngdoc service - * @name $sce - * @kind function - * - * @description - * - * `$sce` is a service that provides Strict Contextual Escaping services to AngularJS. - * - * ## Strict Contextual Escaping - * - * Strict Contextual Escaping (SCE) is a mode in which AngularJS constrains bindings to only render - * trusted values. Its goal is to assist in writing code in a way that (a) is secure by default, and - * (b) makes auditing for security vulnerabilities such as XSS, clickjacking, etc. a lot easier. - * - * ### Overview - * - * To systematically block XSS security bugs, AngularJS treats all values as untrusted by default in - * HTML or sensitive URL bindings. When binding untrusted values, AngularJS will automatically - * run security checks on them (sanitizations, trusted URL resource, depending on context), or throw - * when it cannot guarantee the security of the result. That behavior depends strongly on contexts: - * HTML can be sanitized, but template URLs cannot, for instance. - * - * To illustrate this, consider the `ng-bind-html` directive. It renders its value directly as HTML: - * we call that the *context*. When given an untrusted input, AngularJS will attempt to sanitize it - * before rendering if a sanitizer is available, and throw otherwise. To bypass sanitization and - * render the input as-is, you will need to mark it as trusted for that context before attempting - * to bind it. - * - * As of version 1.2, AngularJS ships with SCE enabled by default. - * - * ### In practice - * - * Here's an example of a binding in a privileged context: - * - * ``` - * - *
- * ``` - * - * Notice that `ng-bind-html` is bound to `userHtml` controlled by the user. With SCE - * disabled, this application allows the user to render arbitrary HTML into the DIV, which would - * be an XSS security bug. In a more realistic example, one may be rendering user comments, blog - * articles, etc. via bindings. (HTML is just one example of a context where rendering user - * controlled input creates security vulnerabilities.) - * - * For the case of HTML, you might use a library, either on the client side, or on the server side, - * to sanitize unsafe HTML before binding to the value and rendering it in the document. - * - * How would you ensure that every place that used these types of bindings was bound to a value that - * was sanitized by your library (or returned as safe for rendering by your server?) How can you - * ensure that you didn't accidentally delete the line that sanitized the value, or renamed some - * properties/fields and forgot to update the binding to the sanitized value? - * - * To be secure by default, AngularJS makes sure bindings go through that sanitization, or - * any similar validation process, unless there's a good reason to trust the given value in this - * context. That trust is formalized with a function call. This means that as a developer, you - * can assume all untrusted bindings are safe. Then, to audit your code for binding security issues, - * you just need to ensure the values you mark as trusted indeed are safe - because they were - * received from your server, sanitized by your library, etc. You can organize your codebase to - * help with this - perhaps allowing only the files in a specific directory to do this. - * Ensuring that the internal API exposed by that code doesn't markup arbitrary values as safe then - * becomes a more manageable task. - * - * In the case of AngularJS' SCE service, one uses {@link ng.$sce#trustAs $sce.trustAs} - * (and shorthand methods such as {@link ng.$sce#trustAsHtml $sce.trustAsHtml}, etc.) to - * build the trusted versions of your values. - * - * ### How does it work? - * - * In privileged contexts, directives and code will bind to the result of {@link ng.$sce#getTrusted - * $sce.getTrusted(context, value)} rather than to the value directly. Think of this function as - * a way to enforce the required security context in your data sink. Directives use {@link - * ng.$sce#parseAs $sce.parseAs} rather than `$parse` to watch attribute bindings, which performs - * the {@link ng.$sce#getTrusted $sce.getTrusted} behind the scenes on non-constant literals. Also, - * when binding without directives, AngularJS will understand the context of your bindings - * automatically. - * - * As an example, {@link ng.directive:ngBindHtml ngBindHtml} uses {@link - * ng.$sce#parseAsHtml $sce.parseAsHtml(binding expression)}. Here's the actual code (slightly - * simplified): - * - * ``` - * var ngBindHtmlDirective = ['$sce', function($sce) { - * return function(scope, element, attr) { - * scope.$watch($sce.parseAsHtml(attr.ngBindHtml), function(value) { - * element.html(value || ''); - * }); - * }; - * }]; - * ``` - * - * ### Impact on loading templates - * - * This applies both to the {@link ng.directive:ngInclude `ng-include`} directive as well as - * `templateUrl`'s specified by {@link guide/directive directives}. - * - * By default, AngularJS only loads templates from the same domain and protocol as the application - * document. This is done by calling {@link ng.$sce#getTrustedResourceUrl - * $sce.getTrustedResourceUrl} on the template URL. To load templates from other domains and/or - * protocols, you may either add them to the {@link ng.$sceDelegateProvider#trustedResourceUrlList - * trustedResourceUrlList} or {@link ng.$sce#trustAsResourceUrl wrap them} into trusted values. - * - * *Please note*: - * The browser's - * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest) - * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/) - * policy apply in addition to this and may further restrict whether the template is successfully - * loaded. This means that without the right CORS policy, loading templates from a different domain - * won't work on all browsers. Also, loading templates from `file://` URL does not work on some - * browsers. - * - * ### This feels like too much overhead - * - * It's important to remember that SCE only applies to interpolation expressions. - * - * If your expressions are constant literals, they're automatically trusted and you don't need to - * call `$sce.trustAs` on them (e.g. - * `
`) just works (remember to include the - * `ngSanitize` module). The `$sceDelegate` will also use the `$sanitize` service if it is available - * when binding untrusted values to `$sce.HTML` context. - * AngularJS provides an implementation in `angular-sanitize.js`, and if you - * wish to use it, you will also need to depend on the {@link ngSanitize `ngSanitize`} module in - * your application. - * - * The included {@link ng.$sceDelegate $sceDelegate} comes with sane defaults to allow you to load - * templates in `ng-include` from your application's domain without having to even know about SCE. - * It blocks loading templates from other domains or loading templates over http from an https - * served document. You can change these by setting your own custom {@link - * ng.$sceDelegateProvider#trustedResourceUrlList trusted resource URL list} and {@link - * ng.$sceDelegateProvider#bannedResourceUrlList banned resource URL list} for matching such URLs. - * - * This significantly reduces the overhead. It is far easier to pay the small overhead and have an - * application that's secure and can be audited to verify that with much more ease than bolting - * security onto an application later. - * - * - * ### What trusted context types are supported? - * - * | Context | Notes | - * |---------------------|----------------| - * | `$sce.HTML` | For HTML that's safe to source into the application. The {@link ng.directive:ngBindHtml ngBindHtml} directive uses this context for bindings. If an unsafe value is encountered and the {@link ngSanitize $sanitize} module is present this will sanitize the value instead of throwing an error. | - * | `$sce.CSS` | For CSS that's safe to source into the application. Currently unused. Feel free to use it in your own directives. | - * | `$sce.MEDIA_URL` | For URLs that are safe to render as media. Is automatically converted from string by sanitizing when needed. | - * | `$sce.URL` | For URLs that are safe to follow as links. Is automatically converted from string by sanitizing when needed. Note that `$sce.URL` makes a stronger statement about the URL than `$sce.MEDIA_URL` does and therefore contexts requiring values trusted for `$sce.URL` can be used anywhere that values trusted for `$sce.MEDIA_URL` are required.| - * | `$sce.RESOURCE_URL` | For URLs that are not only safe to follow as links, but whose contents are also safe to include in your application. Examples include `ng-include`, `src` / `ngSrc` bindings for tags other than `IMG` (e.g. `IFRAME`, `OBJECT`, etc.)

Note that `$sce.RESOURCE_URL` makes a stronger statement about the URL than `$sce.URL` or `$sce.MEDIA_URL` do and therefore contexts requiring values trusted for `$sce.RESOURCE_URL` can be used anywhere that values trusted for `$sce.URL` or `$sce.MEDIA_URL` are required.

The {@link $sceDelegateProvider#trustedResourceUrlList $sceDelegateProvider#trustedResourceUrlList()} and {@link $sceDelegateProvider#bannedResourceUrlList $sceDelegateProvider#bannedResourceUrlList()} can be used to restrict trusted origins for `RESOURCE_URL` | - * | `$sce.JS` | For JavaScript that is safe to execute in your application's context. Currently unused. Feel free to use it in your own directives. | - * - * - *
- * Be aware that, before AngularJS 1.7.0, `a[href]` and `img[src]` used to sanitize their - * interpolated values directly rather than rely upon {@link ng.$sce#getTrusted `$sce.getTrusted`}. - * - * **As of 1.7.0, this is no longer the case.** - * - * Now such interpolations are marked as requiring `$sce.URL` (for `a[href]`) or `$sce.MEDIA_URL` - * (for `img[src]`), so that the sanitization happens (via `$sce.getTrusted...`) when the `$interpolate` - * service evaluates the expressions. - *
- * - * There are no CSS or JS context bindings in AngularJS currently, so their corresponding `$sce.trustAs` - * functions aren't useful yet. This might evolve. - * - * ### Format of items in {@link ng.$sceDelegateProvider#trustedResourceUrlList trustedResourceUrlList}/{@link ng.$sceDelegateProvider#bannedResourceUrlList bannedResourceUrlList} - * - * Each element in these arrays must be one of the following: - * - * - **'self'** - * - The special **string**, `'self'`, can be used to match against all URLs of the **same - * domain** as the application document using the **same protocol**. - * - **String** (except the special value `'self'`) - * - The string is matched against the full *normalized / absolute URL* of the resource - * being tested (substring matches are not good enough.) - * - There are exactly **two wildcard sequences** - `*` and `**`. All other characters - * match themselves. - * - `*`: matches zero or more occurrences of any character other than one of the following 6 - * characters: '`:`', '`/`', '`.`', '`?`', '`&`' and '`;`'. It's a useful wildcard for use - * for matching resource URL lists. - * - `**`: matches zero or more occurrences of *any* character. As such, it's not - * appropriate for use in a scheme, domain, etc. as it would match too much. (e.g. - * http://**.example.com/ would match http://evil.com/?ignore=.example.com/ and that might - * not have been the intention.) Its usage at the very end of the path is ok. (e.g. - * http://foo.example.com/templates/**). - * - **RegExp** (*see caveat below*) - * - *Caveat*: While regular expressions are powerful and offer great flexibility, their syntax - * (and all the inevitable escaping) makes them *harder to maintain*. It's easy to - * accidentally introduce a bug when one updates a complex expression (imho, all regexes should - * have good test coverage). For instance, the use of `.` in the regex is correct only in a - * small number of cases. A `.` character in the regex used when matching the scheme or a - * subdomain could be matched against a `:` or literal `.` that was likely not intended. It - * is highly recommended to use the string patterns and only fall back to regular expressions - * as a last resort. - * - The regular expression must be an instance of RegExp (i.e. not a string.) It is - * matched against the **entire** *normalized / absolute URL* of the resource being tested - * (even when the RegExp did not have the `^` and `$` codes.) In addition, any flags - * present on the RegExp (such as multiline, global, ignoreCase) are ignored. - * - If you are generating your JavaScript from some other templating engine (not - * recommended, e.g. in issue [#4006](https://github.com/angular/angular.js/issues/4006)), - * remember to escape your regular expression (and be aware that you might need more than - * one level of escaping depending on your templating engine and the way you interpolated - * the value.) Do make use of your platform's escaping mechanism as it might be good - * enough before coding your own. E.g. Ruby has - * [Regexp.escape(str)](http://www.ruby-doc.org/core-2.0.0/Regexp.html#method-c-escape) - * and Python has [re.escape](http://docs.python.org/library/re.html#re.escape). - * Javascript lacks a similar built in function for escaping. Take a look at Google - * Closure library's [goog.string.regExpEscape(s)]( - * http://docs.closure-library.googlecode.com/git/closure_goog_string_string.js.source.html#line962). - * - * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} for an example. - * - * ### Show me an example using SCE. - * - * - * - *
- *

- * User comments
- * By default, HTML that isn't explicitly trusted (e.g. Alice's comment) is sanitized when - * $sanitize is available. If $sanitize isn't available, this results in an error instead of an - * exploit. - *
- *
- * {{userComment.name}}: - * - *
- *
- *
- *
- *
- * - * - * angular.module('mySceApp', ['ngSanitize']) - * .controller('AppController', ['$http', '$templateCache', '$sce', - * function AppController($http, $templateCache, $sce) { - * var self = this; - * $http.get('test_data.json', {cache: $templateCache}).then(function(response) { - * self.userComments = response.data; - * }); - * self.explicitlyTrustedHtml = $sce.trustAsHtml( - * 'Hover over this text.'); - * }]); - * - * - * - * [ - * { "name": "Alice", - * "htmlComment": - * "Is anyone reading this?" - * }, - * { "name": "Bob", - * "htmlComment": "Yes! Am I the only other one?" - * } - * ] - * - * - * - * describe('SCE doc demo', function() { - * it('should sanitize untrusted values', function() { - * expect(element.all(by.css('.htmlComment')).first().getAttribute('innerHTML')) - * .toBe('Is anyone reading this?'); - * }); - * - * it('should NOT sanitize explicitly trusted values', function() { - * expect(element(by.id('explicitlyTrustedHtml')).getAttribute('innerHTML')).toBe( - * 'Hover over this text.'); - * }); - * }); - * - *
- * - * - * - * ## Can I disable SCE completely? - * - * Yes, you can. However, this is strongly discouraged. SCE gives you a lot of security benefits - * for little coding overhead. It will be much harder to take an SCE disabled application and - * either secure it on your own or enable SCE at a later stage. It might make sense to disable SCE - * for cases where you have a lot of existing code that was written before SCE was introduced and - * you're migrating them a module at a time. Also do note that this is an app-wide setting, so if - * you are writing a library, you will cause security bugs applications using it. - * - * That said, here's how you can completely disable SCE: - * - * ``` - * angular.module('myAppWithSceDisabledmyApp', []).config(function($sceProvider) { - * // Completely disable SCE. For demonstration purposes only! - * // Do not use in new projects or libraries. - * $sceProvider.enabled(false); - * }); - * ``` - * - */ - - function $SceProvider() { - var enabled = true; - - /** - * @ngdoc method - * @name $sceProvider#enabled - * @kind function - * - * @param {boolean=} value If provided, then enables/disables SCE application-wide. - * @return {boolean} True if SCE is enabled, false otherwise. - * - * @description - * Enables/disables SCE and returns the current value. - */ - this.enabled = function (value) { - if (arguments.length) { - enabled = !!value; - } - return enabled; - }; - - - /* Design notes on the default implementation for SCE. - * - * The API contract for the SCE delegate - * ------------------------------------- - * The SCE delegate object must provide the following 3 methods: - * - * - trustAs(contextEnum, value) - * This method is used to tell the SCE service that the provided value is OK to use in the - * contexts specified by contextEnum. It must return an object that will be accepted by - * getTrusted() for a compatible contextEnum and return this value. - * - * - valueOf(value) - * For values that were not produced by trustAs(), return them as is. For values that were - * produced by trustAs(), return the corresponding input value to trustAs. Basically, if - * trustAs is wrapping the given values into some type, this operation unwraps it when given - * such a value. - * - * - getTrusted(contextEnum, value) - * This function should return the value that is safe to use in the context specified by - * contextEnum or throw and exception otherwise. - * - * NOTE: This contract deliberately does NOT state that values returned by trustAs() must be - * opaque or wrapped in some holder object. That happens to be an implementation detail. For - * instance, an implementation could maintain a registry of all trusted objects by context. In - * such a case, trustAs() would return the same object that was passed in. getTrusted() would - * return the same object passed in if it was found in the registry under a compatible context or - * throw an exception otherwise. An implementation might only wrap values some of the time based - * on some criteria. getTrusted() might return a value and not throw an exception for special - * constants or objects even if not wrapped. All such implementations fulfill this contract. - * - * - * A note on the inheritance model for SCE contexts - * ------------------------------------------------ - * I've used inheritance and made RESOURCE_URL wrapped types a subtype of URL wrapped types. This - * is purely an implementation details. - * - * The contract is simply this: - * - * getTrusted($sce.RESOURCE_URL, value) succeeding implies that getTrusted($sce.URL, value) - * will also succeed. - * - * Inheritance happens to capture this in a natural way. In some future, we may not use - * inheritance anymore. That is OK because no code outside of sce.js and sceSpecs.js would need to - * be aware of this detail. - */ - - this.$get = ['$parse', '$sceDelegate', function ( - $parse, $sceDelegate) { - // Support: IE 9-11 only - // Prereq: Ensure that we're not running in IE<11 quirks mode. In that mode, IE < 11 allow - // the "expression(javascript expression)" syntax which is insecure. - if (enabled && msie < 8) { - throw $sceMinErr('iequirks', - 'Strict Contextual Escaping does not support Internet Explorer version < 11 in quirks ' + - 'mode. You can fix this by adding the text to the top of your HTML ' + - 'document. See http://docs.angularjs.org/api/ng.$sce for more information.'); - } - - var sce = shallowCopy(SCE_CONTEXTS); - - /** - * @ngdoc method - * @name $sce#isEnabled - * @kind function - * - * @return {Boolean} True if SCE is enabled, false otherwise. If you want to set the value, you - * have to do it at module config time on {@link ng.$sceProvider $sceProvider}. - * - * @description - * Returns a boolean indicating if SCE is enabled. - */ - sce.isEnabled = function () { - return enabled; - }; - sce.trustAs = $sceDelegate.trustAs; - sce.getTrusted = $sceDelegate.getTrusted; - sce.valueOf = $sceDelegate.valueOf; - - if (!enabled) { - sce.trustAs = sce.getTrusted = function (type, value) { - return value; - }; - sce.valueOf = identity; - } - - /** - * @ngdoc method - * @name $sce#parseAs - * - * @description - * Converts AngularJS {@link guide/expression expression} into a function. This is like {@link - * ng.$parse $parse} and is identical when the expression is a literal constant. Otherwise, it - * wraps the expression in a call to {@link ng.$sce#getTrusted $sce.getTrusted(*type*, - * *result*)} - * - * @param {string} type The SCE context in which this result will be used. - * @param {string} expression String expression to compile. - * @return {function(context, locals)} A function which represents the compiled expression: - * - * * `context` – `{object}` – an object against which any expressions embedded in the - * strings are evaluated against (typically a scope object). - * * `locals` – `{object=}` – local variables context object, useful for overriding values - * in `context`. - */ - sce.parseAs = function sceParseAs(type, expr) { - var parsed = $parse(expr); - if (parsed.literal && parsed.constant) { - return parsed; - } else { - return $parse(expr, function (value) { - return sce.getTrusted(type, value); - }); - } - }; - - /** - * @ngdoc method - * @name $sce#trustAs - * - * @description - * Delegates to {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}. As such, returns a - * wrapped object that represents your value, and the trust you have in its safety for the given - * context. AngularJS can then use that value as-is in bindings of the specified secure context. - * This is used in bindings for `ng-bind-html`, `ng-include`, and most `src` attribute - * interpolations. See {@link ng.$sce $sce} for strict contextual escaping. - * - * @param {string} type The context in which this value is safe for use, e.g. `$sce.URL`, - * `$sce.RESOURCE_URL`, `$sce.HTML`, `$sce.JS` or `$sce.CSS`. - * - * @param {*} value The value that that should be considered trusted. - * @return {*} A wrapped version of value that can be used as a trusted variant of your `value` - * in the context you specified. - */ - - /** - * @ngdoc method - * @name $sce#trustAsHtml - * - * @description - * Shorthand method. `$sce.trustAsHtml(value)` → - * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.HTML, value)`} - * - * @param {*} value The value to mark as trusted for `$sce.HTML` context. - * @return {*} A wrapped version of value that can be used as a trusted variant of your `value` - * in `$sce.HTML` context (like `ng-bind-html`). - */ - - /** - * @ngdoc method - * @name $sce#trustAsCss - * - * @description - * Shorthand method. `$sce.trustAsCss(value)` → - * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.CSS, value)`} - * - * @param {*} value The value to mark as trusted for `$sce.CSS` context. - * @return {*} A wrapped version of value that can be used as a trusted variant - * of your `value` in `$sce.CSS` context. This context is currently unused, so there are - * almost no reasons to use this function so far. - */ - - /** - * @ngdoc method - * @name $sce#trustAsUrl - * - * @description - * Shorthand method. `$sce.trustAsUrl(value)` → - * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.URL, value)`} - * - * @param {*} value The value to mark as trusted for `$sce.URL` context. - * @return {*} A wrapped version of value that can be used as a trusted variant of your `value` - * in `$sce.URL` context. That context is currently unused, so there are almost no reasons - * to use this function so far. - */ - - /** - * @ngdoc method - * @name $sce#trustAsResourceUrl - * - * @description - * Shorthand method. `$sce.trustAsResourceUrl(value)` → - * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.RESOURCE_URL, value)`} - * - * @param {*} value The value to mark as trusted for `$sce.RESOURCE_URL` context. - * @return {*} A wrapped version of value that can be used as a trusted variant of your `value` - * in `$sce.RESOURCE_URL` context (template URLs in `ng-include`, most `src` attribute - * bindings, ...) - */ - - /** - * @ngdoc method - * @name $sce#trustAsJs - * - * @description - * Shorthand method. `$sce.trustAsJs(value)` → - * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.JS, value)`} - * - * @param {*} value The value to mark as trusted for `$sce.JS` context. - * @return {*} A wrapped version of value that can be used as a trusted variant of your `value` - * in `$sce.JS` context. That context is currently unused, so there are almost no reasons to - * use this function so far. - */ - - /** - * @ngdoc method - * @name $sce#getTrusted - * - * @description - * Delegates to {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted`}. As such, - * takes any input, and either returns a value that's safe to use in the specified context, - * or throws an exception. This function is aware of trusted values created by the `trustAs` - * function and its shorthands, and when contexts are appropriate, returns the unwrapped value - * as-is. Finally, this function can also throw when there is no way to turn `maybeTrusted` in a - * safe value (e.g., no sanitization is available or possible.) - * - * @param {string} type The context in which this value is to be used. - * @param {*} maybeTrusted The result of a prior {@link ng.$sce#trustAs - * `$sce.trustAs`} call, or anything else (which will not be considered trusted.) - * @return {*} A version of the value that's safe to use in the given context, or throws an - * exception if this is impossible. - */ - - /** - * @ngdoc method - * @name $sce#getTrustedHtml - * - * @description - * Shorthand method. `$sce.getTrustedHtml(value)` → - * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.HTML, value)`} - * - * @param {*} value The value to pass to `$sce.getTrusted`. - * @return {*} The return value of `$sce.getTrusted($sce.HTML, value)` - */ - - /** - * @ngdoc method - * @name $sce#getTrustedCss - * - * @description - * Shorthand method. `$sce.getTrustedCss(value)` → - * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.CSS, value)`} - * - * @param {*} value The value to pass to `$sce.getTrusted`. - * @return {*} The return value of `$sce.getTrusted($sce.CSS, value)` - */ - - /** - * @ngdoc method - * @name $sce#getTrustedUrl - * - * @description - * Shorthand method. `$sce.getTrustedUrl(value)` → - * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.URL, value)`} - * - * @param {*} value The value to pass to `$sce.getTrusted`. - * @return {*} The return value of `$sce.getTrusted($sce.URL, value)` - */ - - /** - * @ngdoc method - * @name $sce#getTrustedResourceUrl - * - * @description - * Shorthand method. `$sce.getTrustedResourceUrl(value)` → - * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.RESOURCE_URL, value)`} - * - * @param {*} value The value to pass to `$sceDelegate.getTrusted`. - * @return {*} The return value of `$sce.getTrusted($sce.RESOURCE_URL, value)` - */ - - /** - * @ngdoc method - * @name $sce#getTrustedJs - * - * @description - * Shorthand method. `$sce.getTrustedJs(value)` → - * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.JS, value)`} - * - * @param {*} value The value to pass to `$sce.getTrusted`. - * @return {*} The return value of `$sce.getTrusted($sce.JS, value)` - */ - - /** - * @ngdoc method - * @name $sce#parseAsHtml - * - * @description - * Shorthand method. `$sce.parseAsHtml(expression string)` → - * {@link ng.$sce#parseAs `$sce.parseAs($sce.HTML, value)`} - * - * @param {string} expression String expression to compile. - * @return {function(context, locals)} A function which represents the compiled expression: - * - * * `context` – `{object}` – an object against which any expressions embedded in the - * strings are evaluated against (typically a scope object). - * * `locals` – `{object=}` – local variables context object, useful for overriding values - * in `context`. - */ - - /** - * @ngdoc method - * @name $sce#parseAsCss - * - * @description - * Shorthand method. `$sce.parseAsCss(value)` → - * {@link ng.$sce#parseAs `$sce.parseAs($sce.CSS, value)`} - * - * @param {string} expression String expression to compile. - * @return {function(context, locals)} A function which represents the compiled expression: - * - * * `context` – `{object}` – an object against which any expressions embedded in the - * strings are evaluated against (typically a scope object). - * * `locals` – `{object=}` – local variables context object, useful for overriding values - * in `context`. - */ - - /** - * @ngdoc method - * @name $sce#parseAsUrl - * - * @description - * Shorthand method. `$sce.parseAsUrl(value)` → - * {@link ng.$sce#parseAs `$sce.parseAs($sce.URL, value)`} - * - * @param {string} expression String expression to compile. - * @return {function(context, locals)} A function which represents the compiled expression: - * - * * `context` – `{object}` – an object against which any expressions embedded in the - * strings are evaluated against (typically a scope object). - * * `locals` – `{object=}` – local variables context object, useful for overriding values - * in `context`. - */ - - /** - * @ngdoc method - * @name $sce#parseAsResourceUrl - * - * @description - * Shorthand method. `$sce.parseAsResourceUrl(value)` → - * {@link ng.$sce#parseAs `$sce.parseAs($sce.RESOURCE_URL, value)`} - * - * @param {string} expression String expression to compile. - * @return {function(context, locals)} A function which represents the compiled expression: - * - * * `context` – `{object}` – an object against which any expressions embedded in the - * strings are evaluated against (typically a scope object). - * * `locals` – `{object=}` – local variables context object, useful for overriding values - * in `context`. - */ - - /** - * @ngdoc method - * @name $sce#parseAsJs - * - * @description - * Shorthand method. `$sce.parseAsJs(value)` → - * {@link ng.$sce#parseAs `$sce.parseAs($sce.JS, value)`} - * - * @param {string} expression String expression to compile. - * @return {function(context, locals)} A function which represents the compiled expression: - * - * * `context` – `{object}` – an object against which any expressions embedded in the - * strings are evaluated against (typically a scope object). - * * `locals` – `{object=}` – local variables context object, useful for overriding values - * in `context`. - */ - - // Shorthand delegations. - var parse = sce.parseAs, - getTrusted = sce.getTrusted, - trustAs = sce.trustAs; - - forEach(SCE_CONTEXTS, function (enumValue, name) { - var lName = lowercase(name); - sce[snakeToCamel('parse_as_' + lName)] = function (expr) { - return parse(enumValue, expr); - }; - sce[snakeToCamel('get_trusted_' + lName)] = function (value) { - return getTrusted(enumValue, value); - }; - sce[snakeToCamel('trust_as_' + lName)] = function (value) { - return trustAs(enumValue, value); - }; - }); - - return sce; - }]; - } - - /* exported $SnifferProvider */ - - /** - * !!! This is an undocumented "private" service !!! - * - * @name $sniffer - * @requires $window - * @requires $document - * @this - * - * @property {boolean} history Does the browser support html5 history api ? - * @property {boolean} transitions Does the browser support CSS transition events ? - * @property {boolean} animations Does the browser support CSS animation events ? - * - * @description - * This is very simple implementation of testing browser's features. - */ - function $SnifferProvider() { - this.$get = ['$window', '$document', function ($window, $document) { - var eventSupport = {}, - // Chrome Packaged Apps are not allowed to access `history.pushState`. - // If not sandboxed, they can be detected by the presence of `chrome.app.runtime` - // (see https://developer.chrome.com/apps/api_index). If sandboxed, they can be detected by - // the presence of an extension runtime ID and the absence of other Chrome runtime APIs - // (see https://developer.chrome.com/apps/manifest/sandbox). - // (NW.js apps have access to Chrome APIs, but do support `history`.) - isNw = $window.nw && $window.nw.process, - isChromePackagedApp = !isNw && - $window.chrome && - ($window.chrome.app && $window.chrome.app.runtime || - !$window.chrome.app && $window.chrome.runtime && $window.chrome.runtime.id), - hasHistoryPushState = !isChromePackagedApp && $window.history && $window.history.pushState, - android = - toInt((/android (\d+)/.exec(lowercase(($window.navigator || {}).userAgent)) || [])[1]), - boxee = /Boxee/i.test(($window.navigator || {}).userAgent), - document = $document[0] || {}, - bodyStyle = document.body && document.body.style, - transitions = false, - animations = false; - - if (bodyStyle) { - // Support: Android <5, Blackberry Browser 10, default Chrome in Android 4.4.x - // Mentioned browsers need a -webkit- prefix for transitions & animations. - transitions = !!('transition' in bodyStyle || 'webkitTransition' in bodyStyle); - animations = !!('animation' in bodyStyle || 'webkitAnimation' in bodyStyle); - } - - - return { - // Android has history.pushState, but it does not update location correctly - // so let's not use the history API at all. - // http://code.google.com/p/android/issues/detail?id=17471 - // https://github.com/angular/angular.js/issues/904 - - // older webkit browser (533.9) on Boxee box has exactly the same problem as Android has - // so let's not use the history API also - // We are purposefully using `!(android < 4)` to cover the case when `android` is undefined - history: !!(hasHistoryPushState && !(android < 4) && !boxee), - hasEvent: function (event) { - // Support: IE 9-11 only - // IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have - // it. In particular the event is not fired when backspace or delete key are pressed or - // when cut operation is performed. - // IE10+ implements 'input' event but it erroneously fires under various situations, - // e.g. when placeholder changes, or a form is focused. - if (event === 'input' && msie) return false; - - if (isUndefined(eventSupport[event])) { - var divElm = document.createElement('div'); - eventSupport[event] = 'on' + event in divElm; - } - - return eventSupport[event]; - }, - csp: csp(), - transitions: transitions, - animations: animations, - android: android - }; - }]; - } - - /** - * ! This is a private undocumented service ! - * - * @name $$taskTrackerFactory - * @description - * A function to create `TaskTracker` instances. - * - * A `TaskTracker` can keep track of pending tasks (grouped by type) and can notify interested - * parties when all pending tasks (or tasks of a specific type) have been completed. - * - * @param {$log} log - A logger instance (such as `$log`). Used to log error during callback - * execution. - * - * @this - */ - function $$TaskTrackerFactoryProvider() { - this.$get = valueFn(function (log) { - return new TaskTracker(log); - }); - } - - function TaskTracker(log) { - var self = this; - var taskCounts = {}; - var taskCallbacks = []; - - var ALL_TASKS_TYPE = self.ALL_TASKS_TYPE = '$$all$$'; - var DEFAULT_TASK_TYPE = self.DEFAULT_TASK_TYPE = '$$default$$'; - - /** - * Execute the specified function and decrement the appropriate `taskCounts` counter. - * If the counter reaches 0, all corresponding `taskCallbacks` are executed. - * - * @param {Function} fn - The function to execute. - * @param {string=} [taskType=DEFAULT_TASK_TYPE] - The type of task that is being completed. - */ - self.completeTask = completeTask; - - /** - * Increase the task count for the specified task type (or the default task type if non is - * specified). - * - * @param {string=} [taskType=DEFAULT_TASK_TYPE] - The type of task whose count will be increased. - */ - self.incTaskCount = incTaskCount; - - /** - * Execute the specified callback when all pending tasks have been completed. - * - * If there are no pending tasks, the callback is executed immediately. You can optionally limit - * the tasks that will be waited for to a specific type, by passing a `taskType`. - * - * @param {function} callback - The function to call when there are no pending tasks. - * @param {string=} [taskType=ALL_TASKS_TYPE] - The type of tasks that will be waited for. - */ - self.notifyWhenNoPendingTasks = notifyWhenNoPendingTasks; - - function completeTask(fn, taskType) { - taskType = taskType || DEFAULT_TASK_TYPE; - - try { - fn(); - } finally { - decTaskCount(taskType); - - var countForType = taskCounts[taskType]; - var countForAll = taskCounts[ALL_TASKS_TYPE]; - - // If at least one of the queues (`ALL_TASKS_TYPE` or `taskType`) is empty, run callbacks. - if (!countForAll || !countForType) { - var getNextCallback = !countForAll ? getLastCallback : getLastCallbackForType; - var nextCb; - - while ((nextCb = getNextCallback(taskType))) { - try { - nextCb(); - } catch (e) { - log.error(e); - } - } - } - } - } - - function decTaskCount(taskType) { - taskType = taskType || DEFAULT_TASK_TYPE; - if (taskCounts[taskType]) { - taskCounts[taskType]--; - taskCounts[ALL_TASKS_TYPE]--; - } - } - - function getLastCallback() { - var cbInfo = taskCallbacks.pop(); - return cbInfo && cbInfo.cb; - } - - function getLastCallbackForType(taskType) { - for (var i = taskCallbacks.length - 1; i >= 0; --i) { - var cbInfo = taskCallbacks[i]; - if (cbInfo.type === taskType) { - taskCallbacks.splice(i, 1); - return cbInfo.cb; - } - } - } - - function incTaskCount(taskType) { - taskType = taskType || DEFAULT_TASK_TYPE; - taskCounts[taskType] = (taskCounts[taskType] || 0) + 1; - taskCounts[ALL_TASKS_TYPE] = (taskCounts[ALL_TASKS_TYPE] || 0) + 1; - } - - function notifyWhenNoPendingTasks(callback, taskType) { - taskType = taskType || ALL_TASKS_TYPE; - if (!taskCounts[taskType]) { - callback(); - } else { - taskCallbacks.push({ - type: taskType, - cb: callback - }); - } - } - } - - var $templateRequestMinErr = minErr('$templateRequest'); - - /** - * @ngdoc provider - * @name $templateRequestProvider - * @this - * - * @description - * Used to configure the options passed to the {@link $http} service when making a template request. - * - * For example, it can be used for specifying the "Accept" header that is sent to the server, when - * requesting a template. - */ - function $TemplateRequestProvider() { - - var httpOptions; - - /** - * @ngdoc method - * @name $templateRequestProvider#httpOptions - * @description - * The options to be passed to the {@link $http} service when making the request. - * You can use this to override options such as the "Accept" header for template requests. - * - * The {@link $templateRequest} will set the `cache` and the `transformResponse` properties of the - * options if not overridden here. - * - * @param {string=} value new value for the {@link $http} options. - * @returns {string|self} Returns the {@link $http} options when used as getter and self if used as setter. - */ - this.httpOptions = function (val) { - if (val) { - httpOptions = val; - return this; - } - return httpOptions; - }; - - /** - * @ngdoc service - * @name $templateRequest - * - * @description - * The `$templateRequest` service runs security checks then downloads the provided template using - * `$http` and, upon success, stores the contents inside of `$templateCache`. If the HTTP request - * fails or the response data of the HTTP request is empty, a `$compile` error will be thrown (the - * exception can be thwarted by setting the 2nd parameter of the function to true). Note that the - * contents of `$templateCache` are trusted, so the call to `$sce.getTrustedUrl(tpl)` is omitted - * when `tpl` is of type string and `$templateCache` has the matching entry. - * - * If you want to pass custom options to the `$http` service, such as setting the Accept header you - * can configure this via {@link $templateRequestProvider#httpOptions}. - * - * `$templateRequest` is used internally by {@link $compile}, {@link ngRoute.$route}, and directives such - * as {@link ngInclude} to download and cache templates. - * - * 3rd party modules should use `$templateRequest` if their services or directives are loading - * templates. - * - * @param {string|TrustedResourceUrl} tpl The HTTP request template URL - * @param {boolean=} ignoreRequestError Whether or not to ignore the exception when the request fails or the template is empty - * - * @return {Promise} a promise for the HTTP response data of the given URL. - * - * @property {number} totalPendingRequests total amount of pending template requests being downloaded. - */ - this.$get = ['$exceptionHandler', '$templateCache', '$http', '$q', '$sce', - function ($exceptionHandler, $templateCache, $http, $q, $sce) { - - function handleRequestFn(tpl, ignoreRequestError) { - handleRequestFn.totalPendingRequests++; - - // We consider the template cache holds only trusted templates, so - // there's no need to go through adding the template again to the trusted - // resources for keys that already are included in there. This also makes - // AngularJS accept any script directive, no matter its name. However, we - // still need to unwrap trusted types. - if (!isString(tpl) || isUndefined($templateCache.get(tpl))) { - tpl = $sce.getTrustedResourceUrl(tpl); - } - - var transformResponse = $http.defaults && $http.defaults.transformResponse; - - if (isArray(transformResponse)) { - transformResponse = transformResponse.filter(function (transformer) { - return transformer !== defaultHttpResponseTransform; - }); - } else if (transformResponse === defaultHttpResponseTransform) { - transformResponse = null; - } - - return $http.get(tpl, extend({ - cache: $templateCache, - transformResponse: transformResponse - }, httpOptions)) - .finally(function () { - handleRequestFn.totalPendingRequests--; - }) - .then(function (response) { - return $templateCache.put(tpl, response.data); - }, handleError); - - function handleError(resp) { - if (!ignoreRequestError) { - resp = $templateRequestMinErr('tpload', - 'Failed to load template: {0} (HTTP status: {1} {2})', - tpl, resp.status, resp.statusText); - - $exceptionHandler(resp); - } - - return $q.reject(resp); - } - } - - handleRequestFn.totalPendingRequests = 0; - - return handleRequestFn; - } - ]; - } - - /** @this */ - function $$TestabilityProvider() { - this.$get = ['$rootScope', '$browser', '$location', - function ($rootScope, $browser, $location) { - - /** - * @name $testability - * - * @description - * The private $$testability service provides a collection of methods for use when debugging - * or by automated test and debugging tools. - */ - var testability = {}; - - /** - * @name $$testability#findBindings - * - * @description - * Returns an array of elements that are bound (via ng-bind or {{}}) - * to expressions matching the input. - * - * @param {Element} element The element root to search from. - * @param {string} expression The binding expression to match. - * @param {boolean} opt_exactMatch If true, only returns exact matches - * for the expression. Filters and whitespace are ignored. - */ - testability.findBindings = function (element, expression, opt_exactMatch) { - var bindings = element.getElementsByClassName('ng-binding'); - var matches = []; - forEach(bindings, function (binding) { - var dataBinding = angular.element(binding).data('$binding'); - if (dataBinding) { - forEach(dataBinding, function (bindingName) { - if (opt_exactMatch) { - var matcher = new RegExp('(^|\\s)' + escapeForRegexp(expression) + '(\\s|\\||$)'); - if (matcher.test(bindingName)) { - matches.push(binding); - } - } else { - if (bindingName.indexOf(expression) !== -1) { - matches.push(binding); - } - } - }); - } - }); - return matches; - }; - - /** - * @name $$testability#findModels - * - * @description - * Returns an array of elements that are two-way found via ng-model to - * expressions matching the input. - * - * @param {Element} element The element root to search from. - * @param {string} expression The model expression to match. - * @param {boolean} opt_exactMatch If true, only returns exact matches - * for the expression. - */ - testability.findModels = function (element, expression, opt_exactMatch) { - var prefixes = ['ng-', 'data-ng-', 'ng\\:']; - for (var p = 0; p < prefixes.length; ++p) { - var attributeEquals = opt_exactMatch ? '=' : '*='; - var selector = '[' + prefixes[p] + 'model' + attributeEquals + '"' + expression + '"]'; - var elements = element.querySelectorAll(selector); - if (elements.length) { - return elements; - } - } - }; - - /** - * @name $$testability#getLocation - * - * @description - * Shortcut for getting the location in a browser agnostic way. Returns - * the path, search, and hash. (e.g. /path?a=b#hash) - */ - testability.getLocation = function () { - return $location.url(); - }; - - /** - * @name $$testability#setLocation - * - * @description - * Shortcut for navigating to a location without doing a full page reload. - * - * @param {string} url The location url (path, search and hash, - * e.g. /path?a=b#hash) to go to. - */ - testability.setLocation = function (url) { - if (url !== $location.url()) { - $location.url(url); - $rootScope.$digest(); - } - }; - - /** - * @name $$testability#whenStable - * - * @description - * Calls the callback when all pending tasks are completed. - * - * Types of tasks waited for include: - * - Pending timeouts (via {@link $timeout}). - * - Pending HTTP requests (via {@link $http}). - * - In-progress route transitions (via {@link $route}). - * - Pending tasks scheduled via {@link $rootScope#$applyAsync}. - * - Pending tasks scheduled via {@link $rootScope#$evalAsync}. - * These include tasks scheduled via `$evalAsync()` indirectly (such as {@link $q} promises). - * - * @param {function} callback - */ - testability.whenStable = function (callback) { - $browser.notifyWhenNoOutstandingRequests(callback); - }; - - return testability; - } - ]; - } - - var $timeoutMinErr = minErr('$timeout'); - - /** @this */ - function $TimeoutProvider() { - this.$get = ['$rootScope', '$browser', '$q', '$$q', '$exceptionHandler', - function ($rootScope, $browser, $q, $$q, $exceptionHandler) { - - var deferreds = {}; - - - /** - * @ngdoc service - * @name $timeout - * - * @description - * AngularJS's wrapper for `window.setTimeout`. The `fn` function is wrapped into a try/catch - * block and delegates any exceptions to - * {@link ng.$exceptionHandler $exceptionHandler} service. - * - * The return value of calling `$timeout` is a promise, which will be resolved when - * the delay has passed and the timeout function, if provided, is executed. - * - * To cancel a timeout request, call `$timeout.cancel(promise)`. - * - * In tests you can use {@link ngMock.$timeout `$timeout.flush()`} to - * synchronously flush the queue of deferred functions. - * - * If you only want a promise that will be resolved after some specified delay - * then you can call `$timeout` without the `fn` function. - * - * @param {function()=} fn A function, whose execution should be delayed. - * @param {number=} [delay=0] Delay in milliseconds. - * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise - * will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block. - * @param {...*=} Pass additional parameters to the executed function. - * @returns {Promise} Promise that will be resolved when the timeout is reached. The promise - * will be resolved with the return value of the `fn` function. - * - */ - function timeout(fn, delay, invokeApply) { - if (!isFunction(fn)) { - invokeApply = delay; - delay = fn; - fn = noop; - } - - var args = sliceArgs(arguments, 3), - skipApply = (isDefined(invokeApply) && !invokeApply), - deferred = (skipApply ? $$q : $q).defer(), - promise = deferred.promise, - timeoutId; - - timeoutId = $browser.defer(function () { - try { - deferred.resolve(fn.apply(null, args)); - } catch (e) { - deferred.reject(e); - $exceptionHandler(e); - } finally { - delete deferreds[promise.$$timeoutId]; - } - - if (!skipApply) $rootScope.$apply(); - }, delay, '$timeout'); - - promise.$$timeoutId = timeoutId; - deferreds[timeoutId] = deferred; - - return promise; - } - - - /** - * @ngdoc method - * @name $timeout#cancel - * - * @description - * Cancels a task associated with the `promise`. As a result of this, the promise will be - * resolved with a rejection. - * - * @param {Promise=} promise Promise returned by the `$timeout` function. - * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully - * canceled. - */ - timeout.cancel = function (promise) { - if (!promise) return false; - - if (!promise.hasOwnProperty('$$timeoutId')) { - throw $timeoutMinErr('badprom', - '`$timeout.cancel()` called with a promise that was not generated by `$timeout()`.'); - } - - if (!deferreds.hasOwnProperty(promise.$$timeoutId)) return false; - - var id = promise.$$timeoutId; - var deferred = deferreds[id]; - - // Timeout cancels should not report an unhandled promise. - markQExceptionHandled(deferred.promise); - deferred.reject('canceled'); - delete deferreds[id]; - - return $browser.defer.cancel(id); - }; - - return timeout; - } - ]; - } - - // NOTE: The usage of window and document instead of $window and $document here is - // deliberate. This service depends on the specific behavior of anchor nodes created by the - // browser (resolving and parsing URLs) that is unlikely to be provided by mock objects and - // cause us to break tests. In addition, when the browser resolves a URL for XHR, it - // doesn't know about mocked locations and resolves URLs to the real document - which is - // exactly the behavior needed here. There is little value is mocking these out for this - // service. - var urlParsingNode = window.document.createElement('a'); - var originUrl = urlResolve(window.location.href); - var baseUrlParsingNode; - - urlParsingNode.href = 'http://[::1]'; - - // Support: IE 9-11 only, Edge 16-17 only (fixed in 18 Preview) - // IE/Edge don't wrap IPv6 addresses' hostnames in square brackets - // when parsed out of an anchor element. - var ipv6InBrackets = urlParsingNode.hostname === '[::1]'; - - /** - * - * Implementation Notes for non-IE browsers - * ---------------------------------------- - * Assigning a URL to the href property of an anchor DOM node, even one attached to the DOM, - * results both in the normalizing and parsing of the URL. Normalizing means that a relative - * URL will be resolved into an absolute URL in the context of the application document. - * Parsing means that the anchor node's host, hostname, protocol, port, pathname and related - * properties are all populated to reflect the normalized URL. This approach has wide - * compatibility - Safari 1+, Mozilla 1+ etc. See - * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html - * - * Implementation Notes for IE - * --------------------------- - * IE <= 10 normalizes the URL when assigned to the anchor node similar to the other - * browsers. However, the parsed components will not be set if the URL assigned did not specify - * them. (e.g. if you assign a.href = "foo", then a.protocol, a.host, etc. will be empty.) We - * work around that by performing the parsing in a 2nd step by taking a previously normalized - * URL (e.g. by assigning to a.href) and assigning it a.href again. This correctly populates the - * properties such as protocol, hostname, port, etc. - * - * References: - * http://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement - * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html - * http://url.spec.whatwg.org/#urlutils - * https://github.com/angular/angular.js/pull/2902 - * http://james.padolsey.com/javascript/parsing-urls-with-the-dom/ - * - * @kind function - * @param {string|object} url The URL to be parsed. If `url` is not a string, it will be returned - * unchanged. - * @description Normalizes and parses a URL. - * @returns {object} Returns the normalized URL as a dictionary. - * - * | member name | Description | - * |---------------|------------------------------------------------------------------------| - * | href | A normalized version of the provided URL if it was not an absolute URL | - * | protocol | The protocol without the trailing colon | - * | host | The host and port (if the port is non-default) of the normalizedUrl | - * | search | The search params, minus the question mark | - * | hash | The hash string, minus the hash symbol | - * | hostname | The hostname | - * | port | The port, without ":" | - * | pathname | The pathname, beginning with "/" | - * - */ - function urlResolve(url) { - if (!isString(url)) return url; - - var href = url; - - // Support: IE 9-11 only - if (msie) { - // Normalize before parse. Refer Implementation Notes on why this is - // done in two steps on IE. - urlParsingNode.setAttribute('href', href); - href = urlParsingNode.href; - } - - urlParsingNode.setAttribute('href', href); - - var hostname = urlParsingNode.hostname; - - if (!ipv6InBrackets && hostname.indexOf(':') > -1) { - hostname = '[' + hostname + ']'; - } - - return { - href: urlParsingNode.href, - protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', - host: urlParsingNode.host, - search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', - hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', - hostname: hostname, - port: urlParsingNode.port, - pathname: (urlParsingNode.pathname.charAt(0) === '/') ? - urlParsingNode.pathname : '/' + urlParsingNode.pathname - }; - } - - /** - * Parse a request URL and determine whether this is a same-origin request as the application - * document. - * - * @param {string|object} requestUrl The url of the request as a string that will be resolved - * or a parsed URL object. - * @returns {boolean} Whether the request is for the same origin as the application document. - */ - function urlIsSameOrigin(requestUrl) { - return urlsAreSameOrigin(requestUrl, originUrl); - } - - /** - * Parse a request URL and determine whether it is same-origin as the current document base URL. - * - * Note: The base URL is usually the same as the document location (`location.href`) but can - * be overriden by using the `` tag. - * - * @param {string|object} requestUrl The url of the request as a string that will be resolved - * or a parsed URL object. - * @returns {boolean} Whether the URL is same-origin as the document base URL. - */ - function urlIsSameOriginAsBaseUrl(requestUrl) { - return urlsAreSameOrigin(requestUrl, getBaseUrl()); - } - - /** - * Create a function that can check a URL's origin against a list of allowed/trusted origins. - * The current location's origin is implicitly trusted. - * - * @param {string[]} trustedOriginUrls - A list of URLs (strings), whose origins are trusted. - * - * @returns {Function} - A function that receives a URL (string or parsed URL object) and returns - * whether it is of an allowed origin. - */ - function urlIsAllowedOriginFactory(trustedOriginUrls) { - var parsedAllowedOriginUrls = [originUrl].concat(trustedOriginUrls.map(urlResolve)); - - /** - * Check whether the specified URL (string or parsed URL object) has an origin that is allowed - * based on a list of trusted-origin URLs. The current location's origin is implicitly - * trusted. - * - * @param {string|Object} requestUrl - The URL to be checked (provided as a string that will be - * resolved or a parsed URL object). - * - * @returns {boolean} - Whether the specified URL is of an allowed origin. - */ - return function urlIsAllowedOrigin(requestUrl) { - var parsedUrl = urlResolve(requestUrl); - return parsedAllowedOriginUrls.some(urlsAreSameOrigin.bind(null, parsedUrl)); - }; - } - - /** - * Determine if two URLs share the same origin. - * - * @param {string|Object} url1 - First URL to compare as a string or a normalized URL in the form of - * a dictionary object returned by `urlResolve()`. - * @param {string|object} url2 - Second URL to compare as a string or a normalized URL in the form - * of a dictionary object returned by `urlResolve()`. - * - * @returns {boolean} - True if both URLs have the same origin, and false otherwise. - */ - function urlsAreSameOrigin(url1, url2) { - url1 = urlResolve(url1); - url2 = urlResolve(url2); - - return (url1.protocol === url2.protocol && - url1.host === url2.host); - } - - /** - * Returns the current document base URL. - * @returns {string} - */ - function getBaseUrl() { - if (window.document.baseURI) { - return window.document.baseURI; - } - - // `document.baseURI` is available everywhere except IE - if (!baseUrlParsingNode) { - baseUrlParsingNode = window.document.createElement('a'); - baseUrlParsingNode.href = '.'; - - // Work-around for IE bug described in Implementation Notes. The fix in `urlResolve()` is not - // suitable here because we need to track changes to the base URL. - baseUrlParsingNode = baseUrlParsingNode.cloneNode(false); - } - return baseUrlParsingNode.href; - } - - /** - * @ngdoc service - * @name $window - * @this - * - * @description - * A reference to the browser's `window` object. While `window` - * is globally available in JavaScript, it causes testability problems, because - * it is a global variable. In AngularJS we always refer to it through the - * `$window` service, so it may be overridden, removed or mocked for testing. - * - * Expressions, like the one defined for the `ngClick` directive in the example - * below, are evaluated with respect to the current scope. Therefore, there is - * no risk of inadvertently coding in a dependency on a global value in such an - * expression. - * - * @example - - - -
- - -
-
- - it('should display the greeting in the input box', function() { - element(by.model('greeting')).sendKeys('Hello, E2E Tests'); - // If we click the button it will block the test runner - // element(':button').click(); - }); - -
- */ - function $WindowProvider() { - this.$get = valueFn(window); - } - - /** - * @name $$cookieReader - * @requires $document - * - * @description - * This is a private service for reading cookies used by $http and ngCookies - * - * @return {Object} a key/value map of the current cookies - */ - function $$CookieReader($document) { - var rawDocument = $document[0] || {}; - var lastCookies = {}; - var lastCookieString = ''; - - function safeGetCookie(rawDocument) { - try { - return rawDocument.cookie || ''; - } catch (e) { - return ''; - } - } - - function safeDecodeURIComponent(str) { - try { - return decodeURIComponent(str); - } catch (e) { - return str; - } - } - - return function () { - var cookieArray, cookie, i, index, name; - var currentCookieString = safeGetCookie(rawDocument); - - if (currentCookieString !== lastCookieString) { - lastCookieString = currentCookieString; - cookieArray = lastCookieString.split('; '); - lastCookies = {}; - - for (i = 0; i < cookieArray.length; i++) { - cookie = cookieArray[i]; - index = cookie.indexOf('='); - if (index > 0) { //ignore nameless cookies - name = safeDecodeURIComponent(cookie.substring(0, index)); - // the first value that is seen for a cookie is the most - // specific one. values for the same cookie name that - // follow are for less specific paths. - if (isUndefined(lastCookies[name])) { - lastCookies[name] = safeDecodeURIComponent(cookie.substring(index + 1)); - } - } - } - } - return lastCookies; - }; - } - - $$CookieReader.$inject = ['$document']; - - /** @this */ - function $$CookieReaderProvider() { - this.$get = $$CookieReader; - } - - /* global currencyFilter: true, - dateFilter: true, - filterFilter: true, - jsonFilter: true, - limitToFilter: true, - lowercaseFilter: true, - numberFilter: true, - orderByFilter: true, - uppercaseFilter: true, - */ - - /** - * @ngdoc provider - * @name $filterProvider - * @description - * - * Filters are just functions which transform input to an output. However filters need to be - * Dependency Injected. To achieve this a filter definition consists of a factory function which is - * annotated with dependencies and is responsible for creating a filter function. - * - *
- * **Note:** Filter names must be valid AngularJS {@link expression} identifiers, such as `uppercase` or `orderBy`. - * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace - * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores - * (`myapp_subsection_filterx`). - *
- * - * ```js - * // Filter registration - * function MyModule($provide, $filterProvider) { - * // create a service to demonstrate injection (not always needed) - * $provide.value('greet', function(name){ - * return 'Hello ' + name + '!'; - * }); - * - * // register a filter factory which uses the - * // greet service to demonstrate DI. - * $filterProvider.register('greet', function(greet){ - * // return the filter function which uses the greet service - * // to generate salutation - * return function(text) { - * // filters need to be forgiving so check input validity - * return text && greet(text) || text; - * }; - * }); - * } - * ``` - * - * The filter function is registered with the `$injector` under the filter name suffix with - * `Filter`. - * - * ```js - * it('should be the same instance', inject( - * function($filterProvider) { - * $filterProvider.register('reverse', function(){ - * return ...; - * }); - * }, - * function($filter, reverseFilter) { - * expect($filter('reverse')).toBe(reverseFilter); - * }); - * ``` - * - * - * For more information about how AngularJS filters work, and how to create your own filters, see - * {@link guide/filter Filters} in the AngularJS Developer Guide. - */ - - /** - * @ngdoc service - * @name $filter - * @kind function - * @description - * Filters are used for formatting data displayed to the user. - * - * They can be used in view templates, controllers or services. AngularJS comes - * with a collection of [built-in filters](api/ng/filter), but it is easy to - * define your own as well. - * - * The general syntax in templates is as follows: - * - * ```html - * {{ expression [| filter_name[:parameter_value] ... ] }} - * ``` - * - * @param {String} name Name of the filter function to retrieve - * @return {Function} the filter function - * @example - - -
-

{{ originalText }}

-

{{ filteredText }}

-
-
- - - angular.module('filterExample', []) - .controller('MainCtrl', function($scope, $filter) { - $scope.originalText = 'hello'; - $scope.filteredText = $filter('uppercase')($scope.originalText); - }); - -
- */ - $FilterProvider.$inject = ['$provide']; - /** @this */ - function $FilterProvider($provide) { - var suffix = 'Filter'; - - /** - * @ngdoc method - * @name $filterProvider#register - * @param {string|Object} name Name of the filter function, or an object map of filters where - * the keys are the filter names and the values are the filter factories. - * - *
- * **Note:** Filter names must be valid AngularJS {@link expression} identifiers, such as `uppercase` or `orderBy`. - * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace - * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores - * (`myapp_subsection_filterx`). - *
- * @param {Function} factory If the first argument was a string, a factory function for the filter to be registered. - * @returns {Object} Registered filter instance, or if a map of filters was provided then a map - * of the registered filter instances. - */ - function register(name, factory) { - if (isObject(name)) { - var filters = {}; - forEach(name, function (filter, key) { - filters[key] = register(key, filter); - }); - return filters; - } else { - return $provide.factory(name + suffix, factory); - } - } - this.register = register; - - this.$get = ['$injector', function ($injector) { - return function (name) { - return $injector.get(name + suffix); - }; - }]; - - //////////////////////////////////////// - - /* global - currencyFilter: false, - dateFilter: false, - filterFilter: false, - jsonFilter: false, - limitToFilter: false, - lowercaseFilter: false, - numberFilter: false, - orderByFilter: false, - uppercaseFilter: false - */ - - register('currency', currencyFilter); - register('date', dateFilter); - register('filter', filterFilter); - register('json', jsonFilter); - register('limitTo', limitToFilter); - register('lowercase', lowercaseFilter); - register('number', numberFilter); - register('orderBy', orderByFilter); - register('uppercase', uppercaseFilter); - } - - /** - * @ngdoc filter - * @name filter - * @kind function - * - * @description - * Selects a subset of items from `array` and returns it as a new array. - * - * @param {Array} array The source array. - *
- * **Note**: If the array contains objects that reference themselves, filtering is not possible. - *
- * @param {string|Object|function()} expression The predicate to be used for selecting items from - * `array`. - * - * Can be one of: - * - * - `string`: The string is used for matching against the contents of the `array`. All strings or - * objects with string properties in `array` that match this string will be returned. This also - * applies to nested object properties. - * The predicate can be negated by prefixing the string with `!`. - * - * - `Object`: A pattern object can be used to filter specific properties on objects contained - * by `array`. For example `{name:"M", phone:"1"}` predicate will return an array of items - * which have property `name` containing "M" and property `phone` containing "1". A special - * property name (`$` by default) can be used (e.g. as in `{$: "text"}`) to accept a match - * against any property of the object or its nested object properties. That's equivalent to the - * simple substring match with a `string` as described above. The special property name can be - * overwritten, using the `anyPropertyKey` parameter. - * The predicate can be negated by prefixing the string with `!`. - * For example `{name: "!M"}` predicate will return an array of items which have property `name` - * not containing "M". - * - * Note that a named property will match properties on the same level only, while the special - * `$` property will match properties on the same level or deeper. E.g. an array item like - * `{name: {first: 'John', last: 'Doe'}}` will **not** be matched by `{name: 'John'}`, but - * **will** be matched by `{$: 'John'}`. - * - * - `function(value, index, array)`: A predicate function can be used to write arbitrary filters. - * The function is called for each element of the array, with the element, its index, and - * the entire array itself as arguments. - * - * The final result is an array of those elements that the predicate returned true for. - * - * @param {function(actual, expected)|true|false} [comparator] Comparator which is used in - * determining if values retrieved using `expression` (when it is not a function) should be - * considered a match based on the expected value (from the filter expression) and actual - * value (from the object in the array). - * - * Can be one of: - * - * - `function(actual, expected)`: - * The function will be given the object value and the predicate value to compare and - * should return true if both values should be considered equal. - * - * - `true`: A shorthand for `function(actual, expected) { return angular.equals(actual, expected)}`. - * This is essentially strict comparison of expected and actual. - * - * - `false`: A short hand for a function which will look for a substring match in a case - * insensitive way. Primitive values are converted to strings. Objects are not compared against - * primitives, unless they have a custom `toString` method (e.g. `Date` objects). - * - * - * Defaults to `false`. - * - * @param {string} [anyPropertyKey] The special property name that matches against any property. - * By default `$`. - * - * @example - - -
- - -
- - - - - -
NamePhone
{{friend.name}}{{friend.phone}}
-
-
-
-
-
- - - - - - -
NamePhone
{{friendObj.name}}{{friendObj.phone}}
- - - var expectFriendNames = function(expectedNames, key) { - element.all(by.repeater(key + ' in friends').column(key + '.name')).then(function(arr) { - arr.forEach(function(wd, i) { - expect(wd.getText()).toMatch(expectedNames[i]); - }); - }); - }; - - it('should search across all fields when filtering with a string', function() { - var searchText = element(by.model('searchText')); - searchText.clear(); - searchText.sendKeys('m'); - expectFriendNames(['Mary', 'Mike', 'Adam'], 'friend'); - - searchText.clear(); - searchText.sendKeys('76'); - expectFriendNames(['John', 'Julie'], 'friend'); - }); - - it('should search in specific fields when filtering with a predicate object', function() { - var searchAny = element(by.model('search.$')); - searchAny.clear(); - searchAny.sendKeys('i'); - expectFriendNames(['Mary', 'Mike', 'Julie', 'Juliette'], 'friendObj'); - }); - it('should use a equal comparison when comparator is true', function() { - var searchName = element(by.model('search.name')); - var strict = element(by.model('strict')); - searchName.clear(); - searchName.sendKeys('Julie'); - strict.click(); - expectFriendNames(['Julie'], 'friendObj'); - }); - - - */ - - function filterFilter() { - return function (array, expression, comparator, anyPropertyKey) { - if (!isArrayLike(array)) { - if (array == null) { - return array; - } else { - throw minErr('filter')('notarray', 'Expected array but received: {0}', array); - } - } - - anyPropertyKey = anyPropertyKey || '$'; - var expressionType = getTypeForFilter(expression); - var predicateFn; - var matchAgainstAnyProp; - - switch (expressionType) { - case 'function': - predicateFn = expression; - break; - case 'boolean': - case 'null': - case 'number': - case 'string': - matchAgainstAnyProp = true; - // falls through - case 'object': - predicateFn = createPredicateFn(expression, comparator, anyPropertyKey, matchAgainstAnyProp); - break; - default: - return array; - } - - return Array.prototype.filter.call(array, predicateFn); - }; - } - - // Helper functions for `filterFilter` - function createPredicateFn(expression, comparator, anyPropertyKey, matchAgainstAnyProp) { - var shouldMatchPrimitives = isObject(expression) && (anyPropertyKey in expression); - var predicateFn; - - if (comparator === true) { - comparator = equals; - } else if (!isFunction(comparator)) { - comparator = function (actual, expected) { - if (isUndefined(actual)) { - // No substring matching against `undefined` - return false; - } - if ((actual === null) || (expected === null)) { - // No substring matching against `null`; only match against `null` - return actual === expected; - } - if (isObject(expected) || (isObject(actual) && !hasCustomToString(actual))) { - // Should not compare primitives against objects, unless they have custom `toString` method - return false; - } - - actual = lowercase('' + actual); - expected = lowercase('' + expected); - return actual.indexOf(expected) !== -1; - }; - } - - predicateFn = function (item) { - if (shouldMatchPrimitives && !isObject(item)) { - return deepCompare(item, expression[anyPropertyKey], comparator, anyPropertyKey, false); - } - return deepCompare(item, expression, comparator, anyPropertyKey, matchAgainstAnyProp); - }; - - return predicateFn; - } - - function deepCompare(actual, expected, comparator, anyPropertyKey, matchAgainstAnyProp, dontMatchWholeObject) { - var actualType = getTypeForFilter(actual); - var expectedType = getTypeForFilter(expected); - - if ((expectedType === 'string') && (expected.charAt(0) === '!')) { - return !deepCompare(actual, expected.substring(1), comparator, anyPropertyKey, matchAgainstAnyProp); - } else if (isArray(actual)) { - // In case `actual` is an array, consider it a match - // if ANY of it's items matches `expected` - return actual.some(function (item) { - return deepCompare(item, expected, comparator, anyPropertyKey, matchAgainstAnyProp); - }); - } - - switch (actualType) { - case 'object': - var key; - if (matchAgainstAnyProp) { - for (key in actual) { - // Under certain, rare, circumstances, key may not be a string and `charAt` will be undefined - // See: https://github.com/angular/angular.js/issues/15644 - if (key.charAt && (key.charAt(0) !== '$') && - deepCompare(actual[key], expected, comparator, anyPropertyKey, true)) { - return true; - } - } - return dontMatchWholeObject ? false : deepCompare(actual, expected, comparator, anyPropertyKey, false); - } else if (expectedType === 'object') { - for (key in expected) { - var expectedVal = expected[key]; - if (isFunction(expectedVal) || isUndefined(expectedVal)) { - continue; - } - - var matchAnyProperty = key === anyPropertyKey; - var actualVal = matchAnyProperty ? actual : actual[key]; - if (!deepCompare(actualVal, expectedVal, comparator, anyPropertyKey, matchAnyProperty, matchAnyProperty)) { - return false; - } - } - return true; - } else { - return comparator(actual, expected); - } - case 'function': - return false; - default: - return comparator(actual, expected); - } - } - - // Used for easily differentiating between `null` and actual `object` - function getTypeForFilter(val) { - return (val === null) ? 'null' : typeof val; - } - - var MAX_DIGITS = 22; - var DECIMAL_SEP = '.'; - var ZERO_CHAR = '0'; - - /** - * @ngdoc filter - * @name currency - * @kind function - * - * @description - * Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default - * symbol for current locale is used. - * - * @param {number} amount Input to filter. - * @param {string=} symbol Currency symbol or identifier to be displayed. - * @param {number=} fractionSize Number of decimal places to round the amount to, defaults to default max fraction size for current locale - * @returns {string} Formatted number. - * - * - * @example - - - -
-
- default currency symbol ($): {{amount | currency}}
- custom currency identifier (USD$): {{amount | currency:"USD$"}}
- no fractions (0): {{amount | currency:"USD$":0}} -
-
- - it('should init with 1234.56', function() { - expect(element(by.id('currency-default')).getText()).toBe('$1,234.56'); - expect(element(by.id('currency-custom')).getText()).toBe('USD$1,234.56'); - expect(element(by.id('currency-no-fractions')).getText()).toBe('USD$1,235'); - }); - it('should update', function() { - if (browser.params.browser === 'safari') { - // Safari does not understand the minus key. See - // https://github.com/angular/protractor/issues/481 - return; - } - element(by.model('amount')).clear(); - element(by.model('amount')).sendKeys('-1234'); - expect(element(by.id('currency-default')).getText()).toBe('-$1,234.00'); - expect(element(by.id('currency-custom')).getText()).toBe('-USD$1,234.00'); - expect(element(by.id('currency-no-fractions')).getText()).toBe('-USD$1,234'); - }); - -
- */ - currencyFilter.$inject = ['$locale']; - - function currencyFilter($locale) { - var formats = $locale.NUMBER_FORMATS; - return function (amount, currencySymbol, fractionSize) { - if (isUndefined(currencySymbol)) { - currencySymbol = formats.CURRENCY_SYM; - } - - if (isUndefined(fractionSize)) { - fractionSize = formats.PATTERNS[1].maxFrac; - } - - // If the currency symbol is empty, trim whitespace around the symbol - var currencySymbolRe = !currencySymbol ? /\s*\u00A4\s*/g : /\u00A4/g; - - // if null or undefined pass it through - return (amount == null) ? - amount : - formatNumber(amount, formats.PATTERNS[1], formats.GROUP_SEP, formats.DECIMAL_SEP, fractionSize). - replace(currencySymbolRe, currencySymbol); - }; - } - - /** - * @ngdoc filter - * @name number - * @kind function - * - * @description - * Formats a number as text. - * - * If the input is null or undefined, it will just be returned. - * If the input is infinite (Infinity or -Infinity), the Infinity symbol '∞' or '-∞' is returned, respectively. - * If the input is not a number an empty string is returned. - * - * - * @param {number|string} number Number to format. - * @param {(number|string)=} fractionSize Number of decimal places to round the number to. - * If this is not provided then the fraction size is computed from the current locale's number - * formatting pattern. In the case of the default locale, it will be 3. - * @returns {string} Number rounded to `fractionSize` appropriately formatted based on the current - * locale (e.g., in the en_US locale it will have "." as the decimal separator and - * include "," group separators after each third digit). - * - * @example - - - -
-
- Default formatting: {{val | number}}
- No fractions: {{val | number:0}}
- Negative number: {{-val | number:4}} -
-
- - it('should format numbers', function() { - expect(element(by.id('number-default')).getText()).toBe('1,234.568'); - expect(element(by.binding('val | number:0')).getText()).toBe('1,235'); - expect(element(by.binding('-val | number:4')).getText()).toBe('-1,234.5679'); - }); - - it('should update', function() { - element(by.model('val')).clear(); - element(by.model('val')).sendKeys('3374.333'); - expect(element(by.id('number-default')).getText()).toBe('3,374.333'); - expect(element(by.binding('val | number:0')).getText()).toBe('3,374'); - expect(element(by.binding('-val | number:4')).getText()).toBe('-3,374.3330'); - }); - -
- */ - numberFilter.$inject = ['$locale']; - - function numberFilter($locale) { - var formats = $locale.NUMBER_FORMATS; - return function (number, fractionSize) { - - // if null or undefined pass it through - return (number == null) ? - number : - formatNumber(number, formats.PATTERNS[0], formats.GROUP_SEP, formats.DECIMAL_SEP, - fractionSize); - }; - } - - /** - * Parse a number (as a string) into three components that can be used - * for formatting the number. - * - * (Significant bits of this parse algorithm came from https://github.com/MikeMcl/big.js/) - * - * @param {string} numStr The number to parse - * @return {object} An object describing this number, containing the following keys: - * - d : an array of digits containing leading zeros as necessary - * - i : the number of the digits in `d` that are to the left of the decimal point - * - e : the exponent for numbers that would need more than `MAX_DIGITS` digits in `d` - * - */ - function parse(numStr) { - var exponent = 0, - digits, numberOfIntegerDigits; - var i, j, zeros; - - // Decimal point? - if ((numberOfIntegerDigits = numStr.indexOf(DECIMAL_SEP)) > -1) { - numStr = numStr.replace(DECIMAL_SEP, ''); - } - - // Exponential form? - if ((i = numStr.search(/e/i)) > 0) { - // Work out the exponent. - if (numberOfIntegerDigits < 0) numberOfIntegerDigits = i; - numberOfIntegerDigits += +numStr.slice(i + 1); - numStr = numStr.substring(0, i); - } else if (numberOfIntegerDigits < 0) { - // There was no decimal point or exponent so it is an integer. - numberOfIntegerDigits = numStr.length; - } - - // Count the number of leading zeros. - for (i = 0; numStr.charAt(i) === ZERO_CHAR; i++) { - /* empty */ - } - - if (i === (zeros = numStr.length)) { - // The digits are all zero. - digits = [0]; - numberOfIntegerDigits = 1; - } else { - // Count the number of trailing zeros - zeros--; - while (numStr.charAt(zeros) === ZERO_CHAR) zeros--; - - // Trailing zeros are insignificant so ignore them - numberOfIntegerDigits -= i; - digits = []; - // Convert string to array of digits without leading/trailing zeros. - for (j = 0; i <= zeros; i++, j++) { - digits[j] = +numStr.charAt(i); - } - } - - // If the number overflows the maximum allowed digits then use an exponent. - if (numberOfIntegerDigits > MAX_DIGITS) { - digits = digits.splice(0, MAX_DIGITS - 1); - exponent = numberOfIntegerDigits - 1; - numberOfIntegerDigits = 1; - } - - return { - d: digits, - e: exponent, - i: numberOfIntegerDigits - }; - } - - /** - * Round the parsed number to the specified number of decimal places - * This function changed the parsedNumber in-place - */ - function roundNumber(parsedNumber, fractionSize, minFrac, maxFrac) { - var digits = parsedNumber.d; - var fractionLen = digits.length - parsedNumber.i; - - // determine fractionSize if it is not specified; `+fractionSize` converts it to a number - fractionSize = (isUndefined(fractionSize)) ? Math.min(Math.max(minFrac, fractionLen), maxFrac) : +fractionSize; - - // The index of the digit to where rounding is to occur - var roundAt = fractionSize + parsedNumber.i; - var digit = digits[roundAt]; - - if (roundAt > 0) { - // Drop fractional digits beyond `roundAt` - digits.splice(Math.max(parsedNumber.i, roundAt)); - - // Set non-fractional digits beyond `roundAt` to 0 - for (var j = roundAt; j < digits.length; j++) { - digits[j] = 0; - } - } else { - // We rounded to zero so reset the parsedNumber - fractionLen = Math.max(0, fractionLen); - parsedNumber.i = 1; - digits.length = Math.max(1, roundAt = fractionSize + 1); - digits[0] = 0; - for (var i = 1; i < roundAt; i++) digits[i] = 0; - } - - if (digit >= 5) { - if (roundAt - 1 < 0) { - for (var k = 0; k > roundAt; k--) { - digits.unshift(0); - parsedNumber.i++; - } - digits.unshift(1); - parsedNumber.i++; - } else { - digits[roundAt - 1]++; - } - } - - // Pad out with zeros to get the required fraction length - for (; fractionLen < Math.max(0, fractionSize); fractionLen++) digits.push(0); - - - // Do any carrying, e.g. a digit was rounded up to 10 - var carry = digits.reduceRight(function (carry, d, i, digits) { - d = d + carry; - digits[i] = d % 10; - return Math.floor(d / 10); - }, 0); - if (carry) { - digits.unshift(carry); - parsedNumber.i++; - } - } - - /** - * Format a number into a string - * @param {number} number The number to format - * @param {{ - * minFrac, // the minimum number of digits required in the fraction part of the number - * maxFrac, // the maximum number of digits required in the fraction part of the number - * gSize, // number of digits in each group of separated digits - * lgSize, // number of digits in the last group of digits before the decimal separator - * negPre, // the string to go in front of a negative number (e.g. `-` or `(`)) - * posPre, // the string to go in front of a positive number - * negSuf, // the string to go after a negative number (e.g. `)`) - * posSuf // the string to go after a positive number - * }} pattern - * @param {string} groupSep The string to separate groups of number (e.g. `,`) - * @param {string} decimalSep The string to act as the decimal separator (e.g. `.`) - * @param {[type]} fractionSize The size of the fractional part of the number - * @return {string} The number formatted as a string - */ - function formatNumber(number, pattern, groupSep, decimalSep, fractionSize) { - - if (!(isString(number) || isNumber(number)) || isNaN(number)) return ''; - - var isInfinity = !isFinite(number); - var isZero = false; - var numStr = Math.abs(number) + '', - formattedText = '', - parsedNumber; - - if (isInfinity) { - formattedText = '\u221e'; - } else { - parsedNumber = parse(numStr); - - roundNumber(parsedNumber, fractionSize, pattern.minFrac, pattern.maxFrac); - - var digits = parsedNumber.d; - var integerLen = parsedNumber.i; - var exponent = parsedNumber.e; - var decimals = []; - isZero = digits.reduce(function (isZero, d) { - return isZero && !d; - }, true); - - // pad zeros for small numbers - while (integerLen < 0) { - digits.unshift(0); - integerLen++; - } - - // extract decimals digits - if (integerLen > 0) { - decimals = digits.splice(integerLen, digits.length); - } else { - decimals = digits; - digits = [0]; - } - - // format the integer digits with grouping separators - var groups = []; - if (digits.length >= pattern.lgSize) { - groups.unshift(digits.splice(-pattern.lgSize, digits.length).join('')); - } - while (digits.length > pattern.gSize) { - groups.unshift(digits.splice(-pattern.gSize, digits.length).join('')); - } - if (digits.length) { - groups.unshift(digits.join('')); - } - formattedText = groups.join(groupSep); - - // append the decimal digits - if (decimals.length) { - formattedText += decimalSep + decimals.join(''); - } - - if (exponent) { - formattedText += 'e+' + exponent; - } - } - if (number < 0 && !isZero) { - return pattern.negPre + formattedText + pattern.negSuf; - } else { - return pattern.posPre + formattedText + pattern.posSuf; - } - } - - function padNumber(num, digits, trim, negWrap) { - var neg = ''; - if (num < 0 || (negWrap && num <= 0)) { - if (negWrap) { - num = -num + 1; - } else { - num = -num; - neg = '-'; - } - } - num = '' + num; - while (num.length < digits) num = ZERO_CHAR + num; - if (trim) { - num = num.substr(num.length - digits); - } - return neg + num; - } - - - function dateGetter(name, size, offset, trim, negWrap) { - offset = offset || 0; - return function (date) { - var value = date['get' + name](); - if (offset > 0 || value > -offset) { - value += offset; - } - if (value === 0 && offset === -12) value = 12; - return padNumber(value, size, trim, negWrap); - }; - } - - function dateStrGetter(name, shortForm, standAlone) { - return function (date, formats) { - var value = date['get' + name](); - var propPrefix = (standAlone ? 'STANDALONE' : '') + (shortForm ? 'SHORT' : ''); - var get = uppercase(propPrefix + name); - - return formats[get][value]; - }; - } - - function timeZoneGetter(date, formats, offset) { - var zone = -1 * offset; - var paddedZone = (zone >= 0) ? '+' : ''; - - paddedZone += padNumber(Math[zone > 0 ? 'floor' : 'ceil'](zone / 60), 2) + - padNumber(Math.abs(zone % 60), 2); - - return paddedZone; - } - - function getFirstThursdayOfYear(year) { - // 0 = index of January - var dayOfWeekOnFirst = (new Date(year, 0, 1)).getDay(); - // 4 = index of Thursday (+1 to account for 1st = 5) - // 11 = index of *next* Thursday (+1 account for 1st = 12) - return new Date(year, 0, ((dayOfWeekOnFirst <= 4) ? 5 : 12) - dayOfWeekOnFirst); - } - - function getThursdayThisWeek(datetime) { - return new Date(datetime.getFullYear(), datetime.getMonth(), - // 4 = index of Thursday - datetime.getDate() + (4 - datetime.getDay())); - } - - function weekGetter(size) { - return function (date) { - var firstThurs = getFirstThursdayOfYear(date.getFullYear()), - thisThurs = getThursdayThisWeek(date); - - var diff = +thisThurs - +firstThurs, - result = 1 + Math.round(diff / 6.048e8); // 6.048e8 ms per week - - return padNumber(result, size); - }; - } - - function ampmGetter(date, formats) { - return date.getHours() < 12 ? formats.AMPMS[0] : formats.AMPMS[1]; - } - - function eraGetter(date, formats) { - return date.getFullYear() <= 0 ? formats.ERAS[0] : formats.ERAS[1]; - } - - function longEraGetter(date, formats) { - return date.getFullYear() <= 0 ? formats.ERANAMES[0] : formats.ERANAMES[1]; - } - - var DATE_FORMATS = { - yyyy: dateGetter('FullYear', 4, 0, false, true), - yy: dateGetter('FullYear', 2, 0, true, true), - y: dateGetter('FullYear', 1, 0, false, true), - MMMM: dateStrGetter('Month'), - MMM: dateStrGetter('Month', true), - MM: dateGetter('Month', 2, 1), - M: dateGetter('Month', 1, 1), - LLLL: dateStrGetter('Month', false, true), - dd: dateGetter('Date', 2), - d: dateGetter('Date', 1), - HH: dateGetter('Hours', 2), - H: dateGetter('Hours', 1), - hh: dateGetter('Hours', 2, -12), - h: dateGetter('Hours', 1, -12), - mm: dateGetter('Minutes', 2), - m: dateGetter('Minutes', 1), - ss: dateGetter('Seconds', 2), - s: dateGetter('Seconds', 1), - // while ISO 8601 requires fractions to be prefixed with `.` or `,` - // we can be just safely rely on using `sss` since we currently don't support single or two digit fractions - sss: dateGetter('Milliseconds', 3), - EEEE: dateStrGetter('Day'), - EEE: dateStrGetter('Day', true), - a: ampmGetter, - Z: timeZoneGetter, - ww: weekGetter(2), - w: weekGetter(1), - G: eraGetter, - GG: eraGetter, - GGG: eraGetter, - GGGG: longEraGetter - }; - - var DATE_FORMATS_SPLIT = /((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|m+|s+|a|Z|G+|w+))([\s\S]*)/, - NUMBER_STRING = /^-?\d+$/; - - /** - * @ngdoc filter - * @name date - * @kind function - * - * @description - * Formats `date` to a string based on the requested `format`. - * - * `format` string can be composed of the following elements: - * - * * `'yyyy'`: 4 digit representation of year (e.g. AD 1 => 0001, AD 2010 => 2010) - * * `'yy'`: 2 digit representation of year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10) - * * `'y'`: 1 digit representation of year, e.g. (AD 1 => 1, AD 199 => 199) - * * `'MMMM'`: Month in year (January-December) - * * `'MMM'`: Month in year (Jan-Dec) - * * `'MM'`: Month in year, padded (01-12) - * * `'M'`: Month in year (1-12) - * * `'LLLL'`: Stand-alone month in year (January-December) - * * `'dd'`: Day in month, padded (01-31) - * * `'d'`: Day in month (1-31) - * * `'EEEE'`: Day in Week,(Sunday-Saturday) - * * `'EEE'`: Day in Week, (Sun-Sat) - * * `'HH'`: Hour in day, padded (00-23) - * * `'H'`: Hour in day (0-23) - * * `'hh'`: Hour in AM/PM, padded (01-12) - * * `'h'`: Hour in AM/PM, (1-12) - * * `'mm'`: Minute in hour, padded (00-59) - * * `'m'`: Minute in hour (0-59) - * * `'ss'`: Second in minute, padded (00-59) - * * `'s'`: Second in minute (0-59) - * * `'sss'`: Millisecond in second, padded (000-999) - * * `'a'`: AM/PM marker - * * `'Z'`: 4 digit (+sign) representation of the timezone offset (-1200-+1200) - * * `'ww'`: Week of year, padded (00-53). Week 01 is the week with the first Thursday of the year - * * `'w'`: Week of year (0-53). Week 1 is the week with the first Thursday of the year - * * `'G'`, `'GG'`, `'GGG'`: The abbreviated form of the era string (e.g. 'AD') - * * `'GGGG'`: The long form of the era string (e.g. 'Anno Domini') - * - * `format` string can also be one of the following predefined - * {@link guide/i18n localizable formats}: - * - * * `'medium'`: equivalent to `'MMM d, y h:mm:ss a'` for en_US locale - * (e.g. Sep 3, 2010 12:05:08 PM) - * * `'short'`: equivalent to `'M/d/yy h:mm a'` for en_US locale (e.g. 9/3/10 12:05 PM) - * * `'fullDate'`: equivalent to `'EEEE, MMMM d, y'` for en_US locale - * (e.g. Friday, September 3, 2010) - * * `'longDate'`: equivalent to `'MMMM d, y'` for en_US locale (e.g. September 3, 2010) - * * `'mediumDate'`: equivalent to `'MMM d, y'` for en_US locale (e.g. Sep 3, 2010) - * * `'shortDate'`: equivalent to `'M/d/yy'` for en_US locale (e.g. 9/3/10) - * * `'mediumTime'`: equivalent to `'h:mm:ss a'` for en_US locale (e.g. 12:05:08 PM) - * * `'shortTime'`: equivalent to `'h:mm a'` for en_US locale (e.g. 12:05 PM) - * - * `format` string can contain literal values. These need to be escaped by surrounding with single quotes (e.g. - * `"h 'in the morning'"`). In order to output a single quote, escape it - i.e., two single quotes in a sequence - * (e.g. `"h 'o''clock'"`). - * - * Any other characters in the `format` string will be output as-is. - * - * @param {(Date|number|string)} date Date to format either as Date object, milliseconds (string or - * number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.sssZ and its - * shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is - * specified in the string input, the time is considered to be in the local timezone. - * @param {string=} format Formatting rules (see Description). If not specified, - * `mediumDate` is used. - * @param {string=} timezone Timezone to be used for formatting. It understands UTC/GMT and the - * continental US time zone abbreviations, but for general use, use a time zone offset, for - * example, `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian) - * If not specified, the timezone of the browser will be used. - * @returns {string} Formatted string or the input if input is not recognized as date/millis. - * - * @example - - - {{1288323623006 | date:'medium'}}: - {{1288323623006 | date:'medium'}}
- {{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}: - {{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}
- {{1288323623006 | date:'MM/dd/yyyy @ h:mma'}}: - {{'1288323623006' | date:'MM/dd/yyyy @ h:mma'}}
- {{1288323623006 | date:"MM/dd/yyyy 'at' h:mma"}}: - {{'1288323623006' | date:"MM/dd/yyyy 'at' h:mma"}}
-
- - it('should format date', function() { - expect(element(by.binding("1288323623006 | date:'medium'")).getText()). - toMatch(/Oct 2\d, 2010 \d{1,2}:\d{2}:\d{2} (AM|PM)/); - expect(element(by.binding("1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'")).getText()). - toMatch(/2010-10-2\d \d{2}:\d{2}:\d{2} (-|\+)?\d{4}/); - expect(element(by.binding("'1288323623006' | date:'MM/dd/yyyy @ h:mma'")).getText()). - toMatch(/10\/2\d\/2010 @ \d{1,2}:\d{2}(AM|PM)/); - expect(element(by.binding("'1288323623006' | date:\"MM/dd/yyyy 'at' h:mma\"")).getText()). - toMatch(/10\/2\d\/2010 at \d{1,2}:\d{2}(AM|PM)/); - }); - -
- */ - dateFilter.$inject = ['$locale']; - - function dateFilter($locale) { - - - var R_ISO8601_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/; - // 1 2 3 4 5 6 7 8 9 10 11 - function jsonStringToDate(string) { - var match; - if ((match = string.match(R_ISO8601_STR))) { - var date = new Date(0), - tzHour = 0, - tzMin = 0, - dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear, - timeSetter = match[8] ? date.setUTCHours : date.setHours; - - if (match[9]) { - tzHour = toInt(match[9] + match[10]); - tzMin = toInt(match[9] + match[11]); - } - dateSetter.call(date, toInt(match[1]), toInt(match[2]) - 1, toInt(match[3])); - var h = toInt(match[4] || 0) - tzHour; - var m = toInt(match[5] || 0) - tzMin; - var s = toInt(match[6] || 0); - var ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000); - timeSetter.call(date, h, m, s, ms); - return date; - } - return string; - } - - - return function (date, format, timezone) { - var text = '', - parts = [], - fn, match; - - format = format || 'mediumDate'; - //Eoapi--start - var tmpLangTarget = { - en: "DATETIME_FORMATS", - cn: "DATETIME_FORMATS_CN" - } - format = $locale[tmpLangTarget[window.eoLang || "cn"]][format] || format; - //end 原始:format = $locale.DATETIME_FORMATS[format] || format; - if (isString(date)) { - date = NUMBER_STRING.test(date) ? toInt(date) : jsonStringToDate(date); - } - - if (isNumber(date)) { - date = new Date(date); - } - - if (!isDate(date) || !isFinite(date.getTime())) { - return date; - } - - while (format) { - match = DATE_FORMATS_SPLIT.exec(format); - if (match) { - parts = concat(parts, match, 1); - format = parts.pop(); - } else { - parts.push(format); - format = null; - } - } - - var dateTimezoneOffset = date.getTimezoneOffset(); - if (timezone) { - dateTimezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset); - date = convertTimezoneToLocal(date, timezone, true); - } - forEach(parts, function (value) { - fn = DATE_FORMATS[value]; - text += fn ? fn(date, $locale[tmpLangTarget[window.eoLang || "cn"]], dateTimezoneOffset) : value === '\'\'' ? '\'' : value.replace(/(^'|'$)/g, '').replace(/''/g, '\''); - }); - - return text; - }; - } - - - /** - * @ngdoc filter - * @name json - * @kind function - * - * @description - * Allows you to convert a JavaScript object into JSON string. - * - * This filter is mostly useful for debugging. When using the double curly {{value}} notation - * the binding is automatically converted to JSON. - * - * @param {*} object Any JavaScript object (including arrays and primitive types) to filter. - * @param {number=} spacing The number of spaces to use per indentation, defaults to 2. - * @returns {string} JSON string. - * - * - * @example - - -
{{ {'name':'value'} | json }}
-
{{ {'name':'value'} | json:4 }}
-
- - it('should jsonify filtered objects', function() { - expect(element(by.id('default-spacing')).getText()).toMatch(/\{\n {2}"name": ?"value"\n}/); - expect(element(by.id('custom-spacing')).getText()).toMatch(/\{\n {4}"name": ?"value"\n}/); - }); - -
- * - */ - function jsonFilter() { - return function (object, spacing) { - if (isUndefined(spacing)) { - spacing = 2; - } - return toJson(object, spacing); - }; - } - - - /** - * @ngdoc filter - * @name lowercase - * @kind function - * @description - * Converts string to lowercase. - * - * See the {@link ng.uppercase uppercase filter documentation} for a functionally identical example. - * - * @see angular.lowercase - */ - var lowercaseFilter = valueFn(lowercase); - - - /** - * @ngdoc filter - * @name uppercase - * @kind function - * @description - * Converts string to uppercase. - * @example - - - -
- -

{{title}}

- -

{{title | uppercase}}

-
-
-
- */ - var uppercaseFilter = valueFn(uppercase); - - /** - * @ngdoc filter - * @name limitTo - * @kind function - * - * @description - * Creates a new array or string containing only a specified number of elements. The elements are - * taken from either the beginning or the end of the source array, string or number, as specified by - * the value and sign (positive or negative) of `limit`. Other array-like objects are also supported - * (e.g. array subclasses, NodeLists, jqLite/jQuery collections etc). If a number is used as input, - * it is converted to a string. - * - * @param {Array|ArrayLike|string|number} input - Array/array-like, string or number to be limited. - * @param {string|number} limit - The length of the returned array or string. If the `limit` number - * is positive, `limit` number of items from the beginning of the source array/string are copied. - * If the number is negative, `limit` number of items from the end of the source array/string - * are copied. The `limit` will be trimmed if it exceeds `array.length`. If `limit` is undefined, - * the input will be returned unchanged. - * @param {(string|number)=} begin - Index at which to begin limitation. As a negative index, - * `begin` indicates an offset from the end of `input`. Defaults to `0`. - * @returns {Array|string} A new sub-array or substring of length `limit` or less if the input had - * less than `limit` elements. - * - * @example - - - -
- -

Output numbers: {{ numbers | limitTo:numLimit }}

- -

Output letters: {{ letters | limitTo:letterLimit }}

- -

Output long number: {{ longNumber | limitTo:longNumberLimit }}

-
-
- - var numLimitInput = element(by.model('numLimit')); - var letterLimitInput = element(by.model('letterLimit')); - var longNumberLimitInput = element(by.model('longNumberLimit')); - var limitedNumbers = element(by.binding('numbers | limitTo:numLimit')); - var limitedLetters = element(by.binding('letters | limitTo:letterLimit')); - var limitedLongNumber = element(by.binding('longNumber | limitTo:longNumberLimit')); - - it('should limit the number array to first three items', function() { - expect(numLimitInput.getAttribute('value')).toBe('3'); - expect(letterLimitInput.getAttribute('value')).toBe('3'); - expect(longNumberLimitInput.getAttribute('value')).toBe('3'); - expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3]'); - expect(limitedLetters.getText()).toEqual('Output letters: abc'); - expect(limitedLongNumber.getText()).toEqual('Output long number: 234'); - }); - - // There is a bug in safari and protractor that doesn't like the minus key - // it('should update the output when -3 is entered', function() { - // numLimitInput.clear(); - // numLimitInput.sendKeys('-3'); - // letterLimitInput.clear(); - // letterLimitInput.sendKeys('-3'); - // longNumberLimitInput.clear(); - // longNumberLimitInput.sendKeys('-3'); - // expect(limitedNumbers.getText()).toEqual('Output numbers: [7,8,9]'); - // expect(limitedLetters.getText()).toEqual('Output letters: ghi'); - // expect(limitedLongNumber.getText()).toEqual('Output long number: 342'); - // }); - - it('should not exceed the maximum size of input array', function() { - numLimitInput.clear(); - numLimitInput.sendKeys('100'); - letterLimitInput.clear(); - letterLimitInput.sendKeys('100'); - longNumberLimitInput.clear(); - longNumberLimitInput.sendKeys('100'); - expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3,4,5,6,7,8,9]'); - expect(limitedLetters.getText()).toEqual('Output letters: abcdefghi'); - expect(limitedLongNumber.getText()).toEqual('Output long number: 2345432342'); - }); - -
- */ - function limitToFilter() { - return function (input, limit, begin) { - if (Math.abs(Number(limit)) === Infinity) { - limit = Number(limit); - } else { - limit = toInt(limit); - } - if (isNumberNaN(limit)) return input; - - if (isNumber(input)) input = input.toString(); - if (!isArrayLike(input)) return input; - - begin = (!begin || isNaN(begin)) ? 0 : toInt(begin); - begin = (begin < 0) ? Math.max(0, input.length + begin) : begin; - - if (limit >= 0) { - return sliceFn(input, begin, begin + limit); - } else { - if (begin === 0) { - return sliceFn(input, limit, input.length); - } else { - return sliceFn(input, Math.max(0, begin + limit), begin); - } - } - }; - } - - function sliceFn(input, begin, end) { - if (isString(input)) return input.slice(begin, end); - - return slice.call(input, begin, end); - } - - /** - * @ngdoc filter - * @name orderBy - * @kind function - * - * @description - * Returns an array containing the items from the specified `collection`, ordered by a `comparator` - * function based on the values computed using the `expression` predicate. - * - * For example, `[{id: 'foo'}, {id: 'bar'}] | orderBy:'id'` would result in - * `[{id: 'bar'}, {id: 'foo'}]`. - * - * The `collection` can be an Array or array-like object (e.g. NodeList, jQuery object, TypedArray, - * String, etc). - * - * The `expression` can be a single predicate, or a list of predicates each serving as a tie-breaker - * for the preceding one. The `expression` is evaluated against each item and the output is used - * for comparing with other items. - * - * You can change the sorting order by setting `reverse` to `true`. By default, items are sorted in - * ascending order. - * - * The comparison is done using the `comparator` function. If none is specified, a default, built-in - * comparator is used (see below for details - in a nutshell, it compares numbers numerically and - * strings alphabetically). - * - * ### Under the hood - * - * Ordering the specified `collection` happens in two phases: - * - * 1. All items are passed through the predicate (or predicates), and the returned values are saved - * along with their type (`string`, `number` etc). For example, an item `{label: 'foo'}`, passed - * through a predicate that extracts the value of the `label` property, would be transformed to: - * ``` - * { - * value: 'foo', - * type: 'string', - * index: ... - * } - * ``` - * **Note:** `null` values use `'null'` as their type. - * 2. The comparator function is used to sort the items, based on the derived values, types and - * indices. - * - * If you use a custom comparator, it will be called with pairs of objects of the form - * `{value: ..., type: '...', index: ...}` and is expected to return `0` if the objects are equal - * (as far as the comparator is concerned), `-1` if the 1st one should be ranked higher than the - * second, or `1` otherwise. - * - * In order to ensure that the sorting will be deterministic across platforms, if none of the - * specified predicates can distinguish between two items, `orderBy` will automatically introduce a - * dummy predicate that returns the item's index as `value`. - * (If you are using a custom comparator, make sure it can handle this predicate as well.) - * - * If a custom comparator still can't distinguish between two items, then they will be sorted based - * on their index using the built-in comparator. - * - * Finally, in an attempt to simplify things, if a predicate returns an object as the extracted - * value for an item, `orderBy` will try to convert that object to a primitive value, before passing - * it to the comparator. The following rules govern the conversion: - * - * 1. If the object has a `valueOf()` method that returns a primitive, its return value will be - * used instead.
- * (If the object has a `valueOf()` method that returns another object, then the returned object - * will be used in subsequent steps.) - * 2. If the object has a custom `toString()` method (i.e. not the one inherited from `Object`) that - * returns a primitive, its return value will be used instead.
- * (If the object has a `toString()` method that returns another object, then the returned object - * will be used in subsequent steps.) - * 3. No conversion; the object itself is used. - * - * ### The default comparator - * - * The default, built-in comparator should be sufficient for most usecases. In short, it compares - * numbers numerically, strings alphabetically (and case-insensitively), for objects falls back to - * using their index in the original collection, sorts values of different types by type and puts - * `undefined` and `null` values at the end of the sorted list. - * - * More specifically, it follows these steps to determine the relative order of items: - * - * 1. If the compared values are of different types: - * - If one of the values is undefined, consider it "greater than" the other. - * - Else if one of the values is null, consider it "greater than" the other. - * - Else compare the types themselves alphabetically. - * 2. If both values are of type `string`, compare them alphabetically in a case- and - * locale-insensitive way. - * 3. If both values are objects, compare their indices instead. - * 4. Otherwise, return: - * - `0`, if the values are equal (by strict equality comparison, i.e. using `===`). - * - `-1`, if the 1st value is "less than" the 2nd value (compared using the `<` operator). - * - `1`, otherwise. - * - * **Note:** If you notice numbers not being sorted as expected, make sure they are actually being - * saved as numbers and not strings. - * **Note:** For the purpose of sorting, `null` and `undefined` are considered "greater than" - * any other value (with undefined "greater than" null). This effectively means that `null` - * and `undefined` values end up at the end of a list sorted in ascending order. - * **Note:** `null` values use `'null'` as their type to be able to distinguish them from objects. - * - * @param {Array|ArrayLike} collection - The collection (array or array-like object) to sort. - * @param {(Function|string|Array.)=} expression - A predicate (or list of - * predicates) to be used by the comparator to determine the order of elements. - * - * Can be one of: - * - * - `Function`: A getter function. This function will be called with each item as argument and - * the return value will be used for sorting. - * - `string`: An AngularJS expression. This expression will be evaluated against each item and the - * result will be used for sorting. For example, use `'label'` to sort by a property called - * `label` or `'label.substring(0, 3)'` to sort by the first 3 characters of the `label` - * property.
- * (The result of a constant expression is interpreted as a property name to be used for - * comparison. For example, use `'"special name"'` (note the extra pair of quotes) to sort by a - * property called `special name`.)
- * An expression can be optionally prefixed with `+` or `-` to control the sorting direction, - * ascending or descending. For example, `'+label'` or `'-label'`. If no property is provided, - * (e.g. `'+'` or `'-'`), the collection element itself is used in comparisons. - * - `Array`: An array of function and/or string predicates. If a predicate cannot determine the - * relative order of two items, the next predicate is used as a tie-breaker. - * - * **Note:** If the predicate is missing or empty then it defaults to `'+'`. - * - * @param {boolean=} reverse - If `true`, reverse the sorting order. - * @param {(Function)=} comparator - The comparator function used to determine the relative order of - * value pairs. If omitted, the built-in comparator will be used. - * - * @returns {Array} - The sorted array. - * - * - * @example - * ### Ordering a table with `ngRepeat` - * - * The example below demonstrates a simple {@link ngRepeat ngRepeat}, where the data is sorted by - * age in descending order (expression is set to `'-age'`). The `comparator` is not set, which means - * it defaults to the built-in comparator. - * - - -
- - - - - - - - - - - -
NamePhone NumberAge
{{friend.name}}{{friend.phone}}{{friend.age}}
-
-
- - angular.module('orderByExample1', []) - .controller('ExampleController', ['$scope', function($scope) { - $scope.friends = [ - {name: 'John', phone: '555-1212', age: 10}, - {name: 'Mary', phone: '555-9876', age: 19}, - {name: 'Mike', phone: '555-4321', age: 21}, - {name: 'Adam', phone: '555-5678', age: 35}, - {name: 'Julie', phone: '555-8765', age: 29} - ]; - }]); - - - .friends { - border-collapse: collapse; - } - - .friends th { - border-bottom: 1px solid; - } - .friends td, .friends th { - border-left: 1px solid; - padding: 5px 10px; - } - .friends td:first-child, .friends th:first-child { - border-left: none; - } - - - // Element locators - var names = element.all(by.repeater('friends').column('friend.name')); - - it('should sort friends by age in reverse order', function() { - expect(names.get(0).getText()).toBe('Adam'); - expect(names.get(1).getText()).toBe('Julie'); - expect(names.get(2).getText()).toBe('Mike'); - expect(names.get(3).getText()).toBe('Mary'); - expect(names.get(4).getText()).toBe('John'); - }); - -
- *
- * - * @example - * ### Changing parameters dynamically - * - * All parameters can be changed dynamically. The next example shows how you can make the columns of - * a table sortable, by binding the `expression` and `reverse` parameters to scope properties. - * - - -
-
Sort by = {{propertyName}}; reverse = {{reverse}}
-
- -
- - - - - - - - - - - -
- - - - - - - - -
{{friend.name}}{{friend.phone}}{{friend.age}}
-
-
- - angular.module('orderByExample2', []) - .controller('ExampleController', ['$scope', function($scope) { - var friends = [ - {name: 'John', phone: '555-1212', age: 10}, - {name: 'Mary', phone: '555-9876', age: 19}, - {name: 'Mike', phone: '555-4321', age: 21}, - {name: 'Adam', phone: '555-5678', age: 35}, - {name: 'Julie', phone: '555-8765', age: 29} - ]; - - $scope.propertyName = 'age'; - $scope.reverse = true; - $scope.friends = friends; - - $scope.sortBy = function(propertyName) { - $scope.reverse = ($scope.propertyName === propertyName) ? !$scope.reverse : false; - $scope.propertyName = propertyName; - }; - }]); - - - .friends { - border-collapse: collapse; - } - - .friends th { - border-bottom: 1px solid; - } - .friends td, .friends th { - border-left: 1px solid; - padding: 5px 10px; - } - .friends td:first-child, .friends th:first-child { - border-left: none; - } - - .sortorder:after { - content: '\25b2'; // BLACK UP-POINTING TRIANGLE - } - .sortorder.reverse:after { - content: '\25bc'; // BLACK DOWN-POINTING TRIANGLE - } - - - // Element locators - var unsortButton = element(by.partialButtonText('unsorted')); - var nameHeader = element(by.partialButtonText('Name')); - var phoneHeader = element(by.partialButtonText('Phone')); - var ageHeader = element(by.partialButtonText('Age')); - var firstName = element(by.repeater('friends').column('friend.name').row(0)); - var lastName = element(by.repeater('friends').column('friend.name').row(4)); - - it('should sort friends by some property, when clicking on the column header', function() { - expect(firstName.getText()).toBe('Adam'); - expect(lastName.getText()).toBe('John'); - - phoneHeader.click(); - expect(firstName.getText()).toBe('John'); - expect(lastName.getText()).toBe('Mary'); - - nameHeader.click(); - expect(firstName.getText()).toBe('Adam'); - expect(lastName.getText()).toBe('Mike'); - - ageHeader.click(); - expect(firstName.getText()).toBe('John'); - expect(lastName.getText()).toBe('Adam'); - }); - - it('should sort friends in reverse order, when clicking on the same column', function() { - expect(firstName.getText()).toBe('Adam'); - expect(lastName.getText()).toBe('John'); - - ageHeader.click(); - expect(firstName.getText()).toBe('John'); - expect(lastName.getText()).toBe('Adam'); - - ageHeader.click(); - expect(firstName.getText()).toBe('Adam'); - expect(lastName.getText()).toBe('John'); - }); - - it('should restore the original order, when clicking "Set to unsorted"', function() { - expect(firstName.getText()).toBe('Adam'); - expect(lastName.getText()).toBe('John'); - - unsortButton.click(); - expect(firstName.getText()).toBe('John'); - expect(lastName.getText()).toBe('Julie'); - }); - -
- *
- * - * @example - * ### Using `orderBy` inside a controller - * - * It is also possible to call the `orderBy` filter manually, by injecting `orderByFilter`, and - * calling it with the desired parameters. (Alternatively, you could inject the `$filter` factory - * and retrieve the `orderBy` filter with `$filter('orderBy')`.) - * - - -
-
Sort by = {{propertyName}}; reverse = {{reverse}}
-
- -
- - - - - - - - - - - -
- - - - - - - - -
{{friend.name}}{{friend.phone}}{{friend.age}}
-
-
- - angular.module('orderByExample3', []) - .controller('ExampleController', ['$scope', 'orderByFilter', function($scope, orderBy) { - var friends = [ - {name: 'John', phone: '555-1212', age: 10}, - {name: 'Mary', phone: '555-9876', age: 19}, - {name: 'Mike', phone: '555-4321', age: 21}, - {name: 'Adam', phone: '555-5678', age: 35}, - {name: 'Julie', phone: '555-8765', age: 29} - ]; - - $scope.propertyName = 'age'; - $scope.reverse = true; - $scope.friends = orderBy(friends, $scope.propertyName, $scope.reverse); - - $scope.sortBy = function(propertyName) { - $scope.reverse = (propertyName !== null && $scope.propertyName === propertyName) - ? !$scope.reverse : false; - $scope.propertyName = propertyName; - $scope.friends = orderBy(friends, $scope.propertyName, $scope.reverse); - }; - }]); - - - .friends { - border-collapse: collapse; - } - - .friends th { - border-bottom: 1px solid; - } - .friends td, .friends th { - border-left: 1px solid; - padding: 5px 10px; - } - .friends td:first-child, .friends th:first-child { - border-left: none; - } - - .sortorder:after { - content: '\25b2'; // BLACK UP-POINTING TRIANGLE - } - .sortorder.reverse:after { - content: '\25bc'; // BLACK DOWN-POINTING TRIANGLE - } - - - // Element locators - var unsortButton = element(by.partialButtonText('unsorted')); - var nameHeader = element(by.partialButtonText('Name')); - var phoneHeader = element(by.partialButtonText('Phone')); - var ageHeader = element(by.partialButtonText('Age')); - var firstName = element(by.repeater('friends').column('friend.name').row(0)); - var lastName = element(by.repeater('friends').column('friend.name').row(4)); - - it('should sort friends by some property, when clicking on the column header', function() { - expect(firstName.getText()).toBe('Adam'); - expect(lastName.getText()).toBe('John'); - - phoneHeader.click(); - expect(firstName.getText()).toBe('John'); - expect(lastName.getText()).toBe('Mary'); - - nameHeader.click(); - expect(firstName.getText()).toBe('Adam'); - expect(lastName.getText()).toBe('Mike'); - - ageHeader.click(); - expect(firstName.getText()).toBe('John'); - expect(lastName.getText()).toBe('Adam'); - }); - - it('should sort friends in reverse order, when clicking on the same column', function() { - expect(firstName.getText()).toBe('Adam'); - expect(lastName.getText()).toBe('John'); - - ageHeader.click(); - expect(firstName.getText()).toBe('John'); - expect(lastName.getText()).toBe('Adam'); - - ageHeader.click(); - expect(firstName.getText()).toBe('Adam'); - expect(lastName.getText()).toBe('John'); - }); - - it('should restore the original order, when clicking "Set to unsorted"', function() { - expect(firstName.getText()).toBe('Adam'); - expect(lastName.getText()).toBe('John'); - - unsortButton.click(); - expect(firstName.getText()).toBe('John'); - expect(lastName.getText()).toBe('Julie'); - }); - -
- *
- * - * @example - * ### Using a custom comparator - * - * If you have very specific requirements about the way items are sorted, you can pass your own - * comparator function. For example, you might need to compare some strings in a locale-sensitive - * way. (When specifying a custom comparator, you also need to pass a value for the `reverse` - * argument - passing `false` retains the default sorting order, i.e. ascending.) - * - - -
-
-

Locale-sensitive Comparator

- - - - - - - - - -
NameFavorite Letter
{{friend.name}}{{friend.favoriteLetter}}
-
-
-

Default Comparator

- - - - - - - - - -
NameFavorite Letter
{{friend.name}}{{friend.favoriteLetter}}
-
-
-
- - angular.module('orderByExample4', []) - .controller('ExampleController', ['$scope', function($scope) { - $scope.friends = [ - {name: 'John', favoriteLetter: 'Ä'}, - {name: 'Mary', favoriteLetter: 'Ü'}, - {name: 'Mike', favoriteLetter: 'Ö'}, - {name: 'Adam', favoriteLetter: 'H'}, - {name: 'Julie', favoriteLetter: 'Z'} - ]; - - $scope.localeSensitiveComparator = function(v1, v2) { - // If we don't get strings, just compare by index - if (v1.type !== 'string' || v2.type !== 'string') { - return (v1.index < v2.index) ? -1 : 1; - } - - // Compare strings alphabetically, taking locale into account - return v1.value.localeCompare(v2.value); - }; - }]); - - - .friends-container { - display: inline-block; - margin: 0 30px; - } - - .friends { - border-collapse: collapse; - } - - .friends th { - border-bottom: 1px solid; - } - .friends td, .friends th { - border-left: 1px solid; - padding: 5px 10px; - } - .friends td:first-child, .friends th:first-child { - border-left: none; - } - - - // Element locators - var container = element(by.css('.custom-comparator')); - var names = container.all(by.repeater('friends').column('friend.name')); - - it('should sort friends by favorite letter (in correct alphabetical order)', function() { - expect(names.get(0).getText()).toBe('John'); - expect(names.get(1).getText()).toBe('Adam'); - expect(names.get(2).getText()).toBe('Mike'); - expect(names.get(3).getText()).toBe('Mary'); - expect(names.get(4).getText()).toBe('Julie'); - }); - -
- * - */ - orderByFilter.$inject = ['$parse']; - - function orderByFilter($parse) { - return function (array, sortPredicate, reverseOrder, compareFn) { - - if (array == null) return array; - if (!isArrayLike(array)) { - throw minErr('orderBy')('notarray', 'Expected array but received: {0}', array); - } - - if (!isArray(sortPredicate)) { - sortPredicate = [sortPredicate]; - } - if (sortPredicate.length === 0) { - sortPredicate = ['+']; - } - - var predicates = processPredicates(sortPredicate); - - var descending = reverseOrder ? -1 : 1; - - // Define the `compare()` function. Use a default comparator if none is specified. - var compare = isFunction(compareFn) ? compareFn : defaultCompare; - - // The next three lines are a version of a Swartzian Transform idiom from Perl - // (sometimes called the Decorate-Sort-Undecorate idiom) - // See https://en.wikipedia.org/wiki/Schwartzian_transform - var compareValues = Array.prototype.map.call(array, getComparisonObject); - compareValues.sort(doComparison); - array = compareValues.map(function (item) { - return item.value; - }); - - return array; - - function getComparisonObject(value, index) { - // NOTE: We are adding an extra `tieBreaker` value based on the element's index. - // This will be used to keep the sort stable when none of the input predicates can - // distinguish between two elements. - return { - value: value, - tieBreaker: { - value: index, - type: 'number', - index: index - }, - predicateValues: predicates.map(function (predicate) { - return getPredicateValue(predicate.get(value), index); - }) - }; - } - - function doComparison(v1, v2) { - for (var i = 0, ii = predicates.length; i < ii; i++) { - var result = compare(v1.predicateValues[i], v2.predicateValues[i]); - if (result) { - return result * predicates[i].descending * descending; - } - } - - return (compare(v1.tieBreaker, v2.tieBreaker) || defaultCompare(v1.tieBreaker, v2.tieBreaker)) * descending; - } - }; - - function processPredicates(sortPredicates) { - return sortPredicates.map(function (predicate) { - var descending = 1, - get = identity; - - if (isFunction(predicate)) { - get = predicate; - } else if (isString(predicate)) { - if ((predicate.charAt(0) === '+' || predicate.charAt(0) === '-')) { - descending = predicate.charAt(0) === '-' ? -1 : 1; - predicate = predicate.substring(1); - } - if (predicate !== '') { - get = $parse(predicate); - if (get.constant) { - var key = get(); - get = function (value) { - return value[key]; - }; - } - } - } - return { - get: get, - descending: descending - }; - }); - } - - function isPrimitive(value) { - switch (typeof value) { - case 'number': - /* falls through */ - case 'boolean': - /* falls through */ - case 'string': - return true; - default: - return false; - } - } - - function objectValue(value) { - // If `valueOf` is a valid function use that - if (isFunction(value.valueOf)) { - value = value.valueOf(); - if (isPrimitive(value)) return value; - } - // If `toString` is a valid function and not the one from `Object.prototype` use that - if (hasCustomToString(value)) { - value = value.toString(); - if (isPrimitive(value)) return value; - } - - return value; - } - - function getPredicateValue(value, index) { - var type = typeof value; - if (value === null) { - type = 'null'; - } else if (type === 'object') { - value = objectValue(value); - } - return { - value: value, - type: type, - index: index - }; - } - - function defaultCompare(v1, v2) { - var result = 0; - var type1 = v1.type; - var type2 = v2.type; - - if (type1 === type2) { - var value1 = v1.value; - var value2 = v2.value; - - if (type1 === 'string') { - // Compare strings case-insensitively - value1 = value1.toLowerCase(); - value2 = value2.toLowerCase(); - } else if (type1 === 'object') { - // For basic objects, use the position of the object - // in the collection instead of the value - if (isObject(value1)) value1 = v1.index; - if (isObject(value2)) value2 = v2.index; - } - - if (value1 !== value2) { - result = value1 < value2 ? -1 : 1; - } - } else { - result = (type1 === 'undefined') ? 1 : - (type2 === 'undefined') ? -1 : - (type1 === 'null') ? 1 : - (type2 === 'null') ? -1 : - (type1 < type2) ? -1 : 1; - } - - return result; - } - } - - function ngDirective(directive) { - if (isFunction(directive)) { - directive = { - link: directive - }; - } - directive.restrict = directive.restrict || 'AC'; - return valueFn(directive); - } - - /** - * @ngdoc directive - * @name a - * @restrict E - * - * @description - * Modifies the default behavior of the html a tag so that the default action is prevented when - * the href attribute is empty. - * - * For dynamically creating `href` attributes for a tags, see the {@link ng.ngHref `ngHref`} directive. - */ - var htmlAnchorDirective = valueFn({ - restrict: 'E', - compile: function (element, attr) { - if (!attr.href && !attr.xlinkHref) { - return function (scope, element) { - // If the linked element is not an anchor tag anymore, do nothing - if (element[0].nodeName.toLowerCase() !== 'a') return; - - // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute. - var href = toString.call(element.prop('href')) === '[object SVGAnimatedString]' ? - 'xlink:href' : 'href'; - element.on('click', function (event) { - // if we have no href url, then don't navigate anywhere. - if (!element.attr(href)) { - event.preventDefault(); - } - }); - }; - } - } - }); - - /** - * @ngdoc directive - * @name ngHref - * @restrict A - * @priority 99 - * - * @description - * Using AngularJS markup like `{{hash}}` in an href attribute will - * make the link go to the wrong URL if the user clicks it before - * AngularJS has a chance to replace the `{{hash}}` markup with its - * value. Until AngularJS replaces the markup the link will be broken - * and will most likely return a 404 error. The `ngHref` directive - * solves this problem. - * - * The wrong way to write it: - * ```html - * link1 - * ``` - * - * The correct way to write it: - * ```html - * link1 - * ``` - * - * @element A - * @param {template} ngHref any string which can contain `{{}}` markup. - * - * @example - * This example shows various combinations of `href`, `ng-href` and `ng-click` attributes - * in links and their different behaviors: - - -
- link 1 (link, don't reload)
- link 2 (link, don't reload)
- link 3 (link, reload!)
- anchor (link, don't reload)
- anchor (no link)
- link (link, change location) -
- - it('should execute ng-click but not reload when href without value', function() { - element(by.id('link-1')).click(); - expect(element(by.model('value')).getAttribute('value')).toEqual('1'); - expect(element(by.id('link-1')).getAttribute('href')).toBe(''); - }); - - it('should execute ng-click but not reload when href empty string', function() { - element(by.id('link-2')).click(); - expect(element(by.model('value')).getAttribute('value')).toEqual('2'); - expect(element(by.id('link-2')).getAttribute('href')).toBe(''); - }); - - it('should execute ng-click and change url when ng-href specified', function() { - expect(element(by.id('link-3')).getAttribute('href')).toMatch(/\/123$/); - - element(by.id('link-3')).click(); - - // At this point, we navigate away from an AngularJS page, so we need - // to use browser.driver to get the base webdriver. - - browser.wait(function() { - return browser.driver.getCurrentUrl().then(function(url) { - return url.match(/\/123$/); - }); - }, 5000, 'page should navigate to /123'); - }); - - it('should execute ng-click but not reload when href empty string and name specified', function() { - element(by.id('link-4')).click(); - expect(element(by.model('value')).getAttribute('value')).toEqual('4'); - expect(element(by.id('link-4')).getAttribute('href')).toBe(''); - }); - - it('should execute ng-click but not reload when no href but name specified', function() { - element(by.id('link-5')).click(); - expect(element(by.model('value')).getAttribute('value')).toEqual('5'); - expect(element(by.id('link-5')).getAttribute('href')).toBe(null); - }); - - it('should only change url when only ng-href', function() { - element(by.model('value')).clear(); - element(by.model('value')).sendKeys('6'); - expect(element(by.id('link-6')).getAttribute('href')).toMatch(/\/6$/); - - element(by.id('link-6')).click(); - - // At this point, we navigate away from an AngularJS page, so we need - // to use browser.driver to get the base webdriver. - browser.wait(function() { - return browser.driver.getCurrentUrl().then(function(url) { - return url.match(/\/6$/); - }); - }, 5000, 'page should navigate to /6'); - }); - -
- */ - - /** - * @ngdoc directive - * @name ngSrc - * @restrict A - * @priority 99 - * - * @description - * Using AngularJS markup like `{{hash}}` in a `src` attribute doesn't - * work right: The browser will fetch from the URL with the literal - * text `{{hash}}` until AngularJS replaces the expression inside - * `{{hash}}`. The `ngSrc` directive solves this problem. - * - * The buggy way to write it: - * ```html - * Description - * ``` - * - * The correct way to write it: - * ```html - * Description - * ``` - * - * @element IMG - * @param {template} ngSrc any string which can contain `{{}}` markup. - */ - - /** - * @ngdoc directive - * @name ngSrcset - * @restrict A - * @priority 99 - * - * @description - * Using AngularJS markup like `{{hash}}` in a `srcset` attribute doesn't - * work right: The browser will fetch from the URL with the literal - * text `{{hash}}` until AngularJS replaces the expression inside - * `{{hash}}`. The `ngSrcset` directive solves this problem. - * - * The buggy way to write it: - * ```html - * Description - * ``` - * - * The correct way to write it: - * ```html - * Description - * ``` - * - * @element IMG - * @param {template} ngSrcset any string which can contain `{{}}` markup. - */ - - /** - * @ngdoc directive - * @name ngDisabled - * @restrict A - * @priority 100 - * - * @description - * - * This directive sets the `disabled` attribute on the element (typically a form control, - * e.g. `input`, `button`, `select` etc.) if the - * {@link guide/expression expression} inside `ngDisabled` evaluates to truthy. - * - * A special directive is necessary because we cannot use interpolation inside the `disabled` - * attribute. See the {@link guide/interpolation interpolation guide} for more info. - * - * @example - - -
- -
- - it('should toggle button', function() { - expect(element(by.css('button')).getAttribute('disabled')).toBeFalsy(); - element(by.model('checked')).click(); - expect(element(by.css('button')).getAttribute('disabled')).toBeTruthy(); - }); - -
- * - * @param {expression} ngDisabled If the {@link guide/expression expression} is truthy, - * then the `disabled` attribute will be set on the element - */ - - - /** - * @ngdoc directive - * @name ngChecked - * @restrict A - * @priority 100 - * - * @description - * Sets the `checked` attribute on the element, if the expression inside `ngChecked` is truthy. - * - * Note that this directive should not be used together with {@link ngModel `ngModel`}, - * as this can lead to unexpected behavior. - * - * A special directive is necessary because we cannot use interpolation inside the `checked` - * attribute. See the {@link guide/interpolation interpolation guide} for more info. - * - * @example - - -
- -
- - it('should check both checkBoxes', function() { - expect(element(by.id('checkFollower')).getAttribute('checked')).toBeFalsy(); - element(by.model('leader')).click(); - expect(element(by.id('checkFollower')).getAttribute('checked')).toBeTruthy(); - }); - -
- * - * @element INPUT - * @param {expression} ngChecked If the {@link guide/expression expression} is truthy, - * then the `checked` attribute will be set on the element - */ - - - /** - * @ngdoc directive - * @name ngReadonly - * @restrict A - * @priority 100 - * - * @description - * - * Sets the `readonly` attribute on the element, if the expression inside `ngReadonly` is truthy. - * Note that `readonly` applies only to `input` elements with specific types. [See the input docs on - * MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-readonly) for more information. - * - * A special directive is necessary because we cannot use interpolation inside the `readonly` - * attribute. See the {@link guide/interpolation interpolation guide} for more info. - * - * @example - - -
- -
- - it('should toggle readonly attr', function() { - expect(element(by.css('[type="text"]')).getAttribute('readonly')).toBeFalsy(); - element(by.model('checked')).click(); - expect(element(by.css('[type="text"]')).getAttribute('readonly')).toBeTruthy(); - }); - -
- * - * @element INPUT - * @param {expression} ngReadonly If the {@link guide/expression expression} is truthy, - * then special attribute "readonly" will be set on the element - */ - - - /** - * @ngdoc directive - * @name ngSelected - * @restrict A - * @priority 100 - * - * @description - * - * Sets the `selected` attribute on the element, if the expression inside `ngSelected` is truthy. - * - * A special directive is necessary because we cannot use interpolation inside the `selected` - * attribute. See the {@link guide/interpolation interpolation guide} for more info. - * - *
- * **Note:** `ngSelected` does not interact with the `select` and `ngModel` directives, it only - * sets the `selected` attribute on the element. If you are using `ngModel` on the select, you - * should not use `ngSelected` on the options, as `ngModel` will set the select value and - * selected options. - *
- * - * @example - - -
- -
- - it('should select Greetings!', function() { - expect(element(by.id('greet')).getAttribute('selected')).toBeFalsy(); - element(by.model('selected')).click(); - expect(element(by.id('greet')).getAttribute('selected')).toBeTruthy(); - }); - -
- * - * @element OPTION - * @param {expression} ngSelected If the {@link guide/expression expression} is truthy, - * then special attribute "selected" will be set on the element - */ - - /** - * @ngdoc directive - * @name ngOpen - * @restrict A - * @priority 100 - * - * @description - * - * Sets the `open` attribute on the element, if the expression inside `ngOpen` is truthy. - * - * A special directive is necessary because we cannot use interpolation inside the `open` - * attribute. See the {@link guide/interpolation interpolation guide} for more info. - * - * ## A note about browser compatibility - * - * Internet Explorer and Edge do not support the `details` element, it is - * recommended to use {@link ng.ngShow} and {@link ng.ngHide} instead. - * - * @example - - -
-
- List -
    -
  • Apple
  • -
  • Orange
  • -
  • Durian
  • -
-
-
- - it('should toggle open', function() { - expect(element(by.id('details')).getAttribute('open')).toBeFalsy(); - element(by.model('open')).click(); - expect(element(by.id('details')).getAttribute('open')).toBeTruthy(); - }); - -
- * - * @element DETAILS - * @param {expression} ngOpen If the {@link guide/expression expression} is truthy, - * then special attribute "open" will be set on the element - */ - - var ngAttributeAliasDirectives = {}; - - // boolean attrs are evaluated - forEach(BOOLEAN_ATTR, function (propName, attrName) { - // binding to multiple is not supported - if (propName === 'multiple') return; - - function defaultLinkFn(scope, element, attr) { - scope.$watch(attr[normalized], function ngBooleanAttrWatchAction(value) { - attr.$set(attrName, !!value); - }); - } - - var normalized = directiveNormalize('ng-' + attrName); - var linkFn = defaultLinkFn; - - if (propName === 'checked') { - linkFn = function (scope, element, attr) { - // ensuring ngChecked doesn't interfere with ngModel when both are set on the same input - if (attr.ngModel !== attr[normalized]) { - defaultLinkFn(scope, element, attr); - } - }; - } - - ngAttributeAliasDirectives[normalized] = function () { - return { - restrict: 'A', - priority: 100, - link: linkFn - }; - }; - }); - - // aliased input attrs are evaluated - forEach(ALIASED_ATTR, function (htmlAttr, ngAttr) { - ngAttributeAliasDirectives[ngAttr] = function () { - return { - priority: 100, - link: function (scope, element, attr) { - //special case ngPattern when a literal regular expression value - //is used as the expression (this way we don't have to watch anything). - if (ngAttr === 'ngPattern' && attr.ngPattern.charAt(0) === '/') { - var match = attr.ngPattern.match(REGEX_STRING_REGEXP); - if (match) { - attr.$set('ngPattern', new RegExp(match[1], match[2])); - return; - } - } - - scope.$watch(attr[ngAttr], function ngAttrAliasWatchAction(value) { - attr.$set(ngAttr, value); - }); - } - }; - }; - }); - - // ng-src, ng-srcset, ng-href are interpolated - forEach(['src', 'srcset', 'href'], function (attrName) { - var normalized = directiveNormalize('ng-' + attrName); - ngAttributeAliasDirectives[normalized] = ['$sce', function ($sce) { - return { - priority: 99, // it needs to run after the attributes are interpolated - link: function (scope, element, attr) { - var propName = attrName, - name = attrName; - - if (attrName === 'href' && - toString.call(element.prop('href')) === '[object SVGAnimatedString]') { - name = 'xlinkHref'; - attr.$attr[name] = 'xlink:href'; - propName = null; - } - - // We need to sanitize the url at least once, in case it is a constant - // non-interpolated attribute. - attr.$set(normalized, $sce.getTrustedMediaUrl(attr[normalized])); - - attr.$observe(normalized, function (value) { - if (!value) { - if (attrName === 'href') { - attr.$set(name, null); - } - return; - } - - attr.$set(name, value); - - // Support: IE 9-11 only - // On IE, if "ng:src" directive declaration is used and "src" attribute doesn't exist - // then calling element.setAttribute('src', 'foo') doesn't do anything, so we need - // to set the property as well to achieve the desired effect. - // We use attr[attrName] value since $set might have sanitized the url. - if (msie && propName) element.prop(propName, attr[name]); - }); - } - }; - }]; - }); - - /* global -nullFormCtrl, -PENDING_CLASS, -SUBMITTED_CLASS - */ - var nullFormCtrl = { - $addControl: noop, - $getControls: valueFn([]), - $$renameControl: nullFormRenameControl, - $removeControl: noop, - $setValidity: noop, - $setDirty: noop, - $setPristine: noop, - $setSubmitted: noop, - $$setSubmitted: noop - }, - PENDING_CLASS = 'ng-pending', - SUBMITTED_CLASS = 'ng-submitted'; - - function nullFormRenameControl(control, name) { - control.$name = name; - } - - /** - * @ngdoc type - * @name form.FormController - * - * @property {boolean} $pristine True if user has not interacted with the form yet. - * @property {boolean} $dirty True if user has already interacted with the form. - * @property {boolean} $valid True if all of the containing forms and controls are valid. - * @property {boolean} $invalid True if at least one containing control or form is invalid. - * @property {boolean} $submitted True if user has submitted the form even if its invalid. - * - * @property {Object} $pending An object hash, containing references to controls or forms with - * pending validators, where: - * - * - keys are validations tokens (error names). - * - values are arrays of controls or forms that have a pending validator for the given error name. - * - * See {@link form.FormController#$error $error} for a list of built-in validation tokens. - * - * @property {Object} $error An object hash, containing references to controls or forms with failing - * validators, where: - * - * - keys are validation tokens (error names), - * - values are arrays of controls or forms that have a failing validator for the given error name. - * - * Built-in validation tokens: - * - `email` - * - `max` - * - `maxlength` - * - `min` - * - `minlength` - * - `number` - * - `pattern` - * - `required` - * - `url` - * - `date` - * - `datetimelocal` - * - `time` - * - `week` - * - `month` - * - * @description - * `FormController` keeps track of all its controls and nested forms as well as the state of them, - * such as being valid/invalid or dirty/pristine. - * - * Each {@link ng.directive:form form} directive creates an instance - * of `FormController`. - * - */ - //asks for $scope to fool the BC controller module - FormController.$inject = ['$element', '$attrs', '$scope', '$animate', '$interpolate']; - - function FormController($element, $attrs, $scope, $animate, $interpolate) { - this.$$controls = []; - - // init state - this.$error = {}; - this.$$success = {}; - this.$pending = undefined; - this.$name = $interpolate($attrs.name || $attrs.ngForm || '')($scope); - this.$dirty = false; - this.$pristine = true; - this.$valid = true; - this.$invalid = false; - this.$submitted = false; - this.$$parentForm = nullFormCtrl; - - this.$$element = $element; - this.$$animate = $animate; - - setupValidity(this); - } - - FormController.prototype = { - /** - * @ngdoc method - * @name form.FormController#$rollbackViewValue - * - * @description - * Rollback all form controls pending updates to the `$modelValue`. - * - * Updates may be pending by a debounced event or because the input is waiting for a some future - * event defined in `ng-model-options`. This method is typically needed by the reset button of - * a form that uses `ng-model-options` to pend updates. - */ - $rollbackViewValue: function () { - forEach(this.$$controls, function (control) { - control.$rollbackViewValue(); - }); - }, - - /** - * @ngdoc method - * @name form.FormController#$commitViewValue - * - * @description - * Commit all form controls pending updates to the `$modelValue`. - * - * Updates may be pending by a debounced event or because the input is waiting for a some future - * event defined in `ng-model-options`. This method is rarely needed as `NgModelController` - * usually handles calling this in response to input events. - */ - $commitViewValue: function () { - forEach(this.$$controls, function (control) { - control.$commitViewValue(); - }); - }, - - /** - * @ngdoc method - * @name form.FormController#$addControl - * @param {object} control control object, either a {@link form.FormController} or an - * {@link ngModel.NgModelController} - * - * @description - * Register a control with the form. Input elements using ngModelController do this automatically - * when they are linked. - * - * Note that the current state of the control will not be reflected on the new parent form. This - * is not an issue with normal use, as freshly compiled and linked controls are in a `$pristine` - * state. - * - * However, if the method is used programmatically, for example by adding dynamically created controls, - * or controls that have been previously removed without destroying their corresponding DOM element, - * it's the developers responsibility to make sure the current state propagates to the parent form. - * - * For example, if an input control is added that is already `$dirty` and has `$error` properties, - * calling `$setDirty()` and `$validate()` afterwards will propagate the state to the parent form. - */ - $addControl: function (control) { - // Breaking change - before, inputs whose name was "hasOwnProperty" were quietly ignored - // and not added to the scope. Now we throw an error. - assertNotHasOwnProperty(control.$name, 'input'); - this.$$controls.push(control); - - if (control.$name) { - this[control.$name] = control; - } - - control.$$parentForm = this; - }, - - /** - * @ngdoc method - * @name form.FormController#$getControls - * @returns {Array} the controls that are currently part of this form - * - * @description - * This method returns a **shallow copy** of the controls that are currently part of this form. - * The controls can be instances of {@link form.FormController `FormController`} - * ({@link ngForm "child-forms"}) and of {@link ngModel.NgModelController `NgModelController`}. - * If you need access to the controls of child-forms, you have to call `$getControls()` - * recursively on them. - * This can be used for example to iterate over all controls to validate them. - * - * The controls can be accessed normally, but adding to, or removing controls from the array has - * no effect on the form. Instead, use {@link form.FormController#$addControl `$addControl()`} and - * {@link form.FormController#$removeControl `$removeControl()`} for this use-case. - * Likewise, adding a control to, or removing a control from the form is not reflected - * in the shallow copy. That means you should get a fresh copy from `$getControls()` every time - * you need access to the controls. - */ - $getControls: function () { - return shallowCopy(this.$$controls); - }, - - // Private API: rename a form control - $$renameControl: function (control, newName) { - var oldName = control.$name; - - if (this[oldName] === control) { - delete this[oldName]; - } - this[newName] = control; - control.$name = newName; - }, - - /** - * @ngdoc method - * @name form.FormController#$removeControl - * @param {object} control control object, either a {@link form.FormController} or an - * {@link ngModel.NgModelController} - * - * @description - * Deregister a control from the form. - * - * Input elements using ngModelController do this automatically when they are destroyed. - * - * Note that only the removed control's validation state (`$errors`etc.) will be removed from the - * form. `$dirty`, `$submitted` states will not be changed, because the expected behavior can be - * different from case to case. For example, removing the only `$dirty` control from a form may or - * may not mean that the form is still `$dirty`. - */ - $removeControl: function (control) { - if (control.$name && this[control.$name] === control) { - delete this[control.$name]; - } - forEach(this.$pending, function (value, name) { - // eslint-disable-next-line no-invalid-this - this.$setValidity(name, null, control); - }, this); - forEach(this.$error, function (value, name) { - // eslint-disable-next-line no-invalid-this - this.$setValidity(name, null, control); - }, this); - forEach(this.$$success, function (value, name) { - // eslint-disable-next-line no-invalid-this - this.$setValidity(name, null, control); - }, this); - - arrayRemove(this.$$controls, control); - control.$$parentForm = nullFormCtrl; - }, - - /** - * @ngdoc method - * @name form.FormController#$setDirty - * - * @description - * Sets the form to a dirty state. - * - * This method can be called to add the 'ng-dirty' class and set the form to a dirty - * state (ng-dirty class). This method will also propagate to parent forms. - */ - $setDirty: function () { - this.$$animate.removeClass(this.$$element, PRISTINE_CLASS); - this.$$animate.addClass(this.$$element, DIRTY_CLASS); - this.$dirty = true; - this.$pristine = false; - this.$$parentForm.$setDirty(); - }, - - /** - * @ngdoc method - * @name form.FormController#$setPristine - * - * @description - * Sets the form to its pristine state. - * - * This method sets the form's `$pristine` state to true, the `$dirty` state to false, removes - * the `ng-dirty` class and adds the `ng-pristine` class. Additionally, it sets the `$submitted` - * state to false. - * - * This method will also propagate to all the controls contained in this form. - * - * Setting a form back to a pristine state is often useful when we want to 'reuse' a form after - * saving or resetting it. - */ - $setPristine: function () { - this.$$animate.setClass(this.$$element, PRISTINE_CLASS, DIRTY_CLASS + ' ' + SUBMITTED_CLASS); - this.$dirty = false; - this.$pristine = true; - this.$submitted = false; - forEach(this.$$controls, function (control) { - control.$setPristine(); - }); - }, - - /** - * @ngdoc method - * @name form.FormController#$setUntouched - * - * @description - * Sets the form to its untouched state. - * - * This method can be called to remove the 'ng-touched' class and set the form controls to their - * untouched state (ng-untouched class). - * - * Setting a form controls back to their untouched state is often useful when setting the form - * back to its pristine state. - */ - $setUntouched: function () { - forEach(this.$$controls, function (control) { - control.$setUntouched(); - }); - }, - - /** - * @ngdoc method - * @name form.FormController#$setSubmitted - * - * @description - * Sets the form to its `$submitted` state. This will also set `$submitted` on all child and - * parent forms of the form. - */ - $setSubmitted: function () { - var rootForm = this; - while (rootForm.$$parentForm && (rootForm.$$parentForm !== nullFormCtrl)) { - rootForm = rootForm.$$parentForm; - } - rootForm.$$setSubmitted(); - }, - - $$setSubmitted: function () { - this.$$animate.addClass(this.$$element, SUBMITTED_CLASS); - this.$submitted = true; - forEach(this.$$controls, function (control) { - if (control.$$setSubmitted) { - control.$$setSubmitted(); - } - }); - } - }; - - /** - * @ngdoc method - * @name form.FormController#$setValidity - * - * @description - * Change the validity state of the form, and notify the parent form (if any). - * - * Application developers will rarely need to call this method directly. It is used internally, by - * {@link ngModel.NgModelController#$setValidity NgModelController.$setValidity()}, to propagate a - * control's validity state to the parent `FormController`. - * - * @param {string} validationErrorKey Name of the validator. The `validationErrorKey` will be - * assigned to either `$error[validationErrorKey]` or `$pending[validationErrorKey]` (for - * unfulfilled `$asyncValidators`), so that it is available for data-binding. The - * `validationErrorKey` should be in camelCase and will get converted into dash-case for - * class name. Example: `myError` will result in `ng-valid-my-error` and - * `ng-invalid-my-error` classes and can be bound to as `{{ someForm.$error.myError }}`. - * @param {boolean} isValid Whether the current state is valid (true), invalid (false), pending - * (undefined), or skipped (null). Pending is used for unfulfilled `$asyncValidators`. - * Skipped is used by AngularJS when validators do not run because of parse errors and when - * `$asyncValidators` do not run because any of the `$validators` failed. - * @param {NgModelController | FormController} controller - The controller whose validity state is - * triggering the change. - */ - addSetValidityMethod({ - clazz: FormController, - set: function (object, property, controller) { - var list = object[property]; - if (!list) { - object[property] = [controller]; - } else { - var index = list.indexOf(controller); - if (index === -1) { - list.push(controller); - } - } - }, - unset: function (object, property, controller) { - var list = object[property]; - if (!list) { - return; - } - arrayRemove(list, controller); - if (list.length === 0) { - delete object[property]; - } - } - }); - - /** - * @ngdoc directive - * @name ngForm - * @restrict EAC - * - * @description - * Helper directive that makes it possible to create control groups inside a - * {@link ng.directive:form `form`} directive. - * These "child forms" can be used, for example, to determine the validity of a sub-group of - * controls. - * - *
- * **Note**: `ngForm` cannot be used as a replacement for `
`, because it lacks its - * [built-in HTML functionality](https://html.spec.whatwg.org/#the-form-element). - * Specifically, you cannot submit `ngForm` like a `` tag. That means, - * you cannot send data to the server with `ngForm`, or integrate it with - * {@link ng.directive:ngSubmit `ngSubmit`}. - *
- * - * @param {string=} ngForm|name Name of the form. If specified, the form controller will - * be published into the related scope, under this name. - * - */ - - /** - * @ngdoc directive - * @name form - * @restrict E - * - * @description - * Directive that instantiates - * {@link form.FormController FormController}. - * - * If the `name` attribute is specified, the form controller is published onto the current scope under - * this name. - * - * ## Alias: {@link ng.directive:ngForm `ngForm`} - * - * In AngularJS, forms can be nested. This means that the outer form is valid when all of the child - * forms are valid as well. However, browsers do not allow nesting of `` elements, so - * AngularJS provides the {@link ng.directive:ngForm `ngForm`} directive, which behaves identically to - * `form` but can be nested. Nested forms can be useful, for example, if the validity of a sub-group - * of controls needs to be determined. - * - * ## CSS classes - * - `ng-valid` is set if the form is valid. - * - `ng-invalid` is set if the form is invalid. - * - `ng-pending` is set if the form is pending. - * - `ng-pristine` is set if the form is pristine. - * - `ng-dirty` is set if the form is dirty. - * - `ng-submitted` is set if the form was submitted. - * - * Keep in mind that ngAnimate can detect each of these classes when added and removed. - * - * - * ## Submitting a form and preventing the default action - * - * Since the role of forms in client-side AngularJS applications is different than in classical - * roundtrip apps, it is desirable for the browser not to translate the form submission into a full - * page reload that sends the data to the server. Instead some javascript logic should be triggered - * to handle the form submission in an application-specific way. - * - * For this reason, AngularJS prevents the default action (form submission to the server) unless the - * `` element has an `action` attribute specified. - * - * You can use one of the following two ways to specify what javascript method should be called when - * a form is submitted: - * - * - {@link ng.directive:ngSubmit ngSubmit} directive on the form element - * - {@link ng.directive:ngClick ngClick} directive on the first - * button or input field of type submit (input[type=submit]) - * - * To prevent double execution of the handler, use only one of the {@link ng.directive:ngSubmit ngSubmit} - * or {@link ng.directive:ngClick ngClick} directives. - * This is because of the following form submission rules in the HTML specification: - * - * - If a form has only one input field then hitting enter in this field triggers form submit - * (`ngSubmit`) - * - if a form has 2+ input fields and no buttons or input[type=submit] then hitting enter - * doesn't trigger submit - * - if a form has one or more input fields and one or more buttons or input[type=submit] then - * hitting enter in any of the input fields will trigger the click handler on the *first* button or - * input[type=submit] (`ngClick`) *and* a submit handler on the enclosing form (`ngSubmit`) - * - * Any pending `ngModelOptions` changes will take place immediately when an enclosing form is - * submitted. Note that `ngClick` events will occur before the model is updated. Use `ngSubmit` - * to have access to the updated model. - * - * @animations - * Animations in ngForm are triggered when any of the associated CSS classes are added and removed. - * These classes are: `.ng-pristine`, `.ng-dirty`, `.ng-invalid` and `.ng-valid` as well as any - * other validations that are performed within the form. Animations in ngForm are similar to how - * they work in ngClass and animations can be hooked into using CSS transitions, keyframes as well - * as JS animations. - * - * The following example shows a simple way to utilize CSS transitions to style a form element - * that has been rendered as invalid after it has been validated: - * - *
-    * //be sure to include ngAnimate as a module to hook into more
-    * //advanced animations
-    * .my-form {
-    *   transition:0.5s linear all;
-    *   background: white;
-    * }
-    * .my-form.ng-invalid {
-    *   background: red;
-    *   color:white;
-    * }
-    * 
- * - * @example - - - - - - userType: - Required!
- userType = {{userType}}
- myForm.input.$valid = {{myForm.input.$valid}}
- myForm.input.$error = {{myForm.input.$error}}
- myForm.$valid = {{myForm.$valid}}
- myForm.$error.required = {{!!myForm.$error.required}}
- -
- - it('should initialize to model', function() { - var userType = element(by.binding('userType')); - var valid = element(by.binding('myForm.input.$valid')); - - expect(userType.getText()).toContain('guest'); - expect(valid.getText()).toContain('true'); - }); - - it('should be invalid if empty', function() { - var userType = element(by.binding('userType')); - var valid = element(by.binding('myForm.input.$valid')); - var userInput = element(by.model('userType')); - - userInput.clear(); - userInput.sendKeys(''); - - expect(userType.getText()).toEqual('userType ='); - expect(valid.getText()).toContain('false'); - }); - -
- * - * @param {string=} name Name of the form. If specified, the form controller will be published into - * related scope, under this name. - */ - var formDirectiveFactory = function (isNgForm) { - return ['$timeout', '$parse', function ($timeout, $parse) { - var formDirective = { - name: 'form', - restrict: isNgForm ? 'EAC' : 'E', - require: ['form', '^^?form'], //first is the form's own ctrl, second is an optional parent form - controller: FormController, - compile: function ngFormCompile(formElement, attr) { - // Setup initial state of the control - formElement.addClass(PRISTINE_CLASS).addClass(VALID_CLASS); - - var nameAttr = attr.name ? 'name' : (isNgForm && attr.ngForm ? 'ngForm' : false); - - return { - pre: function ngFormPreLink(scope, formElement, attr, ctrls) { - var controller = ctrls[0]; - - // if `action` attr is not present on the form, prevent the default action (submission) - if (!('action' in attr)) { - // we can't use jq events because if a form is destroyed during submission the default - // action is not prevented. see #1238 - // - // IE 9 is not affected because it doesn't fire a submit event and try to do a full - // page reload if the form was destroyed by submission of the form via a click handler - // on a button in the form. Looks like an IE9 specific bug. - var handleFormSubmission = function (event) { - scope.$apply(function () { - controller.$commitViewValue(); - controller.$setSubmitted(); - }); - - event.preventDefault(); - }; - - formElement[0].addEventListener('submit', handleFormSubmission); - - // unregister the preventDefault listener so that we don't not leak memory but in a - // way that will achieve the prevention of the default action. - formElement.on('$destroy', function () { - $timeout(function () { - formElement[0].removeEventListener('submit', handleFormSubmission); - }, 0, false); - }); - } - - var parentFormCtrl = ctrls[1] || controller.$$parentForm; - parentFormCtrl.$addControl(controller); - - var setter = nameAttr ? getSetter(controller.$name) : noop; - - if (nameAttr) { - setter(scope, controller); - attr.$observe(nameAttr, function (newValue) { - if (controller.$name === newValue) return; - setter(scope, undefined); - controller.$$parentForm.$$renameControl(controller, newValue); - setter = getSetter(controller.$name); - setter(scope, controller); - }); - } - formElement.on('$destroy', function () { - controller.$$parentForm.$removeControl(controller); - setter(scope, undefined); - extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards - }); - } - }; - } - }; - - return formDirective; - - function getSetter(expression) { - if (expression === '') { - //create an assignable expression, so forms with an empty name can be renamed later - return $parse('this[""]').assign; - } - return $parse(expression).assign || noop; - } - }]; - }; - - var formDirective = formDirectiveFactory(); - var ngFormDirective = formDirectiveFactory(true); - - - - // helper methods - function setupValidity(instance) { - instance.$$classCache = {}; - instance.$$classCache[INVALID_CLASS] = !(instance.$$classCache[VALID_CLASS] = instance.$$element.hasClass(VALID_CLASS)); - } - - function addSetValidityMethod(context) { - var clazz = context.clazz, - set = context.set, - unset = context.unset; - - clazz.prototype.$setValidity = function (validationErrorKey, state, controller) { - if (isUndefined(state)) { - createAndSet(this, '$pending', validationErrorKey, controller); - } else { - unsetAndCleanup(this, '$pending', validationErrorKey, controller); - } - if (!isBoolean(state)) { - unset(this.$error, validationErrorKey, controller); - unset(this.$$success, validationErrorKey, controller); - } else { - if (state) { - unset(this.$error, validationErrorKey, controller); - set(this.$$success, validationErrorKey, controller); - } else { - set(this.$error, validationErrorKey, controller); - unset(this.$$success, validationErrorKey, controller); - } - } - if (this.$pending) { - cachedToggleClass(this, PENDING_CLASS, true); - this.$valid = this.$invalid = undefined; - toggleValidationCss(this, '', null); - } else { - cachedToggleClass(this, PENDING_CLASS, false); - this.$valid = isObjectEmpty(this.$error); - this.$invalid = !this.$valid; - toggleValidationCss(this, '', this.$valid); - } - - // re-read the state as the set/unset methods could have - // combined state in this.$error[validationError] (used for forms), - // where setting/unsetting only increments/decrements the value, - // and does not replace it. - var combinedState; - if (this.$pending && this.$pending[validationErrorKey]) { - combinedState = undefined; - } else if (this.$error[validationErrorKey]) { - combinedState = false; - } else if (this.$$success[validationErrorKey]) { - combinedState = true; - } else { - combinedState = null; - } - - toggleValidationCss(this, validationErrorKey, combinedState); - this.$$parentForm.$setValidity(validationErrorKey, combinedState, this); - }; - - function createAndSet(ctrl, name, value, controller) { - if (!ctrl[name]) { - ctrl[name] = {}; - } - set(ctrl[name], value, controller); - } - - function unsetAndCleanup(ctrl, name, value, controller) { - if (ctrl[name]) { - unset(ctrl[name], value, controller); - } - if (isObjectEmpty(ctrl[name])) { - ctrl[name] = undefined; - } - } - - function cachedToggleClass(ctrl, className, switchValue) { - if (switchValue && !ctrl.$$classCache[className]) { - ctrl.$$animate.addClass(ctrl.$$element, className); - ctrl.$$classCache[className] = true; - } else if (!switchValue && ctrl.$$classCache[className]) { - ctrl.$$animate.removeClass(ctrl.$$element, className); - ctrl.$$classCache[className] = false; - } - } - - function toggleValidationCss(ctrl, validationErrorKey, isValid) { - validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : ''; - - cachedToggleClass(ctrl, VALID_CLASS + validationErrorKey, isValid === true); - cachedToggleClass(ctrl, INVALID_CLASS + validationErrorKey, isValid === false); - } - } - - function isObjectEmpty(obj) { - if (obj) { - for (var prop in obj) { - if (obj.hasOwnProperty(prop)) { - return false; - } - } - } - return true; - } - - /* global - VALID_CLASS: false, - INVALID_CLASS: false, - PRISTINE_CLASS: false, - DIRTY_CLASS: false, - ngModelMinErr: false - */ - - // Regex code was initially obtained from SO prior to modification: https://stackoverflow.com/questions/3143070/javascript-regex-iso-datetime#answer-3143231 - var ISO_DATE_REGEXP = /^\d{4,}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+(?:[+-][0-2]\d:[0-5]\d|Z)$/; - // See valid URLs in RFC3987 (http://tools.ietf.org/html/rfc3987) - // Note: We are being more lenient, because browsers are too. - // 1. Scheme - // 2. Slashes - // 3. Username - // 4. Password - // 5. Hostname - // 6. Port - // 7. Path - // 8. Query - // 9. Fragment - // 1111111111111111 222 333333 44444 55555555555555555555555 666 77777777 8888888 999 - var URL_REGEXP = /^[a-z][a-z\d.+-]*:\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\s:/?#]+|\[[a-f\d:]+])(?::\d+)?(?:\/[^?#]*)?(?:\?[^#]*)?(?:#.*)?$/i; - // eslint-disable-next-line max-len - var EMAIL_REGEXP = /^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/; - var NUMBER_REGEXP = /^\s*(-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/; - var DATE_REGEXP = /^(\d{4,})-(\d{2})-(\d{2})$/; - var DATETIMELOCAL_REGEXP = /^(\d{4,})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/; - var WEEK_REGEXP = /^(\d{4,})-W(\d\d)$/; - var MONTH_REGEXP = /^(\d{4,})-(\d\d)$/; - var TIME_REGEXP = /^(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/; - - var PARTIAL_VALIDATION_EVENTS = 'keydown wheel mousedown'; - var PARTIAL_VALIDATION_TYPES = createMap(); - forEach('date,datetime-local,month,time,week'.split(','), function (type) { - PARTIAL_VALIDATION_TYPES[type] = true; - }); - - var inputType = { - - /** - * @ngdoc input - * @name input[text] - * - * @description - * Standard HTML text input with AngularJS data binding, inherited by most of the `input` elements. - * - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} required Adds `required` validation error key if the value is not entered. - * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to - * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of - * `required` when you want to data-bind to the `required` attribute. - * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than - * minlength. - * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than - * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of - * any length. - * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string - * that contains the regular expression body that will be converted to a regular expression - * as in the ngPattern directive. - * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue} - * does not match a RegExp found by evaluating the AngularJS expression given in the attribute value. - * If the expression evaluates to a RegExp object, then this is used directly. - * If the expression evaluates to a string, then it will be converted to a RegExp - * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to - * `new RegExp('^abc$')`.
- * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to - * start at the index of the last search's match, thus not taking the whole input value into - * account. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * @param {boolean=} [ngTrim=true] If set to false AngularJS will not automatically trim the input. - * This parameter is ignored for input[type=password] controls, which will never trim the - * input. - * - * @example - - - -
- -
- - Required! - - Single word only! -
- text = {{example.text}}
- myForm.input.$valid = {{myForm.input.$valid}}
- myForm.input.$error = {{myForm.input.$error}}
- myForm.$valid = {{myForm.$valid}}
- myForm.$error.required = {{!!myForm.$error.required}}
-
-
- - var text = element(by.binding('example.text')); - var valid = element(by.binding('myForm.input.$valid')); - var input = element(by.model('example.text')); - - it('should initialize to model', function() { - expect(text.getText()).toContain('guest'); - expect(valid.getText()).toContain('true'); - }); - - it('should be invalid if empty', function() { - input.clear(); - input.sendKeys(''); - - expect(text.getText()).toEqual('text ='); - expect(valid.getText()).toContain('false'); - }); - - it('should be invalid if multi word', function() { - input.clear(); - input.sendKeys('hello world'); - - expect(valid.getText()).toContain('false'); - }); - -
- */ - 'text': textInputType, - - /** - * @ngdoc input - * @name input[date] - * - * @description - * Input with date validation and transformation. In browsers that do not yet support - * the HTML5 date input, a text element will be used. In that case, text must be entered in a valid ISO-8601 - * date format (yyyy-MM-dd), for example: `2009-01-06`. Since many - * modern browsers do not yet support this input type, it is important to provide cues to users on the - * expected input format via a placeholder or label. - * - * The model must always be a Date object, otherwise AngularJS will throw an error. - * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string. - * - * The timezone to be used to read/write the `Date` instance in the model can be defined using - * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser. - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. This must be a - * valid ISO date string (yyyy-MM-dd). You can also use interpolation inside this attribute - * (e.g. `min="{{minDate | date:'yyyy-MM-dd'}}"`). Note that `min` will also add native HTML5 - * constraint validation. - * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. This must be - * a valid ISO date string (yyyy-MM-dd). You can also use interpolation inside this attribute - * (e.g. `max="{{maxDate | date:'yyyy-MM-dd'}}"`). Note that `max` will also add native HTML5 - * constraint validation. - * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO date string - * the `ngMin` expression evaluates to. Note that it does not set the `min` attribute. - * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO date string - * the `ngMax` expression evaluates to. Note that it does not set the `max` attribute. - * @param {string=} required Sets `required` validation error key if the value is not entered. - * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to - * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of - * `required` when you want to data-bind to the `required` attribute. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * - * @example - - - -
- - -
- - Required! - - Not a valid date! -
- value = {{example.value | date: "yyyy-MM-dd"}}
- myForm.input.$valid = {{myForm.input.$valid}}
- myForm.input.$error = {{myForm.input.$error}}
- myForm.$valid = {{myForm.$valid}}
- myForm.$error.required = {{!!myForm.$error.required}}
-
-
- - var value = element(by.binding('example.value | date: "yyyy-MM-dd"')); - var valid = element(by.binding('myForm.input.$valid')); - - // currently protractor/webdriver does not support - // sending keys to all known HTML5 input controls - // for various browsers (see https://github.com/angular/protractor/issues/562). - function setInput(val) { - // set the value of the element and force validation. - var scr = "var ipt = document.getElementById('exampleInput'); " + - "ipt.value = '" + val + "';" + - "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });"; - browser.executeScript(scr); - } - - it('should initialize to model', function() { - expect(value.getText()).toContain('2013-10-22'); - expect(valid.getText()).toContain('myForm.input.$valid = true'); - }); - - it('should be invalid if empty', function() { - setInput(''); - expect(value.getText()).toEqual('value ='); - expect(valid.getText()).toContain('myForm.input.$valid = false'); - }); - - it('should be invalid if over max', function() { - setInput('2015-01-01'); - expect(value.getText()).toContain(''); - expect(valid.getText()).toContain('myForm.input.$valid = false'); - }); - -
- */ - 'date': createDateInputType('date', DATE_REGEXP, - createDateParser(DATE_REGEXP, ['yyyy', 'MM', 'dd']), - 'yyyy-MM-dd'), - - /** - * @ngdoc input - * @name input[datetime-local] - * - * @description - * Input with datetime validation and transformation. In browsers that do not yet support - * the HTML5 date input, a text element will be used. In that case, the text must be entered in a valid ISO-8601 - * local datetime format (yyyy-MM-ddTHH:mm:ss), for example: `2010-12-28T14:57:00`. - * - * The model must always be a Date object, otherwise AngularJS will throw an error. - * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string. - * - * The timezone to be used to read/write the `Date` instance in the model can be defined using - * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser. - * - * The format of the displayed time can be adjusted with the - * {@link ng.directive:ngModelOptions#ngModelOptions-arguments ngModelOptions} `timeSecondsFormat` - * and `timeStripZeroSeconds`. - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. - * This must be a valid ISO datetime format (yyyy-MM-ddTHH:mm:ss). You can also use interpolation - * inside this attribute (e.g. `min="{{minDatetimeLocal | date:'yyyy-MM-ddTHH:mm:ss'}}"`). - * Note that `min` will also add native HTML5 constraint validation. - * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. - * This must be a valid ISO datetime format (yyyy-MM-ddTHH:mm:ss). You can also use interpolation - * inside this attribute (e.g. `max="{{maxDatetimeLocal | date:'yyyy-MM-ddTHH:mm:ss'}}"`). - * Note that `max` will also add native HTML5 constraint validation. - * @param {(date|string)=} ngMin Sets the `min` validation error key to the Date / ISO datetime string - * the `ngMin` expression evaluates to. Note that it does not set the `min` attribute. - * @param {(date|string)=} ngMax Sets the `max` validation error key to the Date / ISO datetime string - * the `ngMax` expression evaluates to. Note that it does not set the `max` attribute. - * @param {string=} required Sets `required` validation error key if the value is not entered. - * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to - * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of - * `required` when you want to data-bind to the `required` attribute. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * - * @example - - - -
- - -
- - Required! - - Not a valid date! -
- value = {{example.value | date: "yyyy-MM-ddTHH:mm:ss"}}
- myForm.input.$valid = {{myForm.input.$valid}}
- myForm.input.$error = {{myForm.input.$error}}
- myForm.$valid = {{myForm.$valid}}
- myForm.$error.required = {{!!myForm.$error.required}}
-
-
- - var value = element(by.binding('example.value | date: "yyyy-MM-ddTHH:mm:ss"')); - var valid = element(by.binding('myForm.input.$valid')); - - // currently protractor/webdriver does not support - // sending keys to all known HTML5 input controls - // for various browsers (https://github.com/angular/protractor/issues/562). - function setInput(val) { - // set the value of the element and force validation. - var scr = "var ipt = document.getElementById('exampleInput'); " + - "ipt.value = '" + val + "';" + - "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });"; - browser.executeScript(scr); - } - - it('should initialize to model', function() { - expect(value.getText()).toContain('2010-12-28T14:57:00'); - expect(valid.getText()).toContain('myForm.input.$valid = true'); - }); - - it('should be invalid if empty', function() { - setInput(''); - expect(value.getText()).toEqual('value ='); - expect(valid.getText()).toContain('myForm.input.$valid = false'); - }); - - it('should be invalid if over max', function() { - setInput('2015-01-01T23:59:00'); - expect(value.getText()).toContain(''); - expect(valid.getText()).toContain('myForm.input.$valid = false'); - }); - -
- */ - 'datetime-local': createDateInputType('datetimelocal', DATETIMELOCAL_REGEXP, - createDateParser(DATETIMELOCAL_REGEXP, ['yyyy', 'MM', 'dd', 'HH', 'mm', 'ss', 'sss']), - 'yyyy-MM-ddTHH:mm:ss.sss'), - - /** - * @ngdoc input - * @name input[time] - * - * @description - * Input with time validation and transformation. In browsers that do not yet support - * the HTML5 time input, a text element will be used. In that case, the text must be entered in a valid ISO-8601 - * local time format (HH:mm:ss), for example: `14:57:00`. Model must be a Date object. This binding will always output a - * Date object to the model of January 1, 1970, or local date `new Date(1970, 0, 1, HH, mm, ss)`. - * - * The model must always be a Date object, otherwise AngularJS will throw an error. - * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string. - * - * The timezone to be used to read/write the `Date` instance in the model can be defined using - * {@link ng.directive:ngModelOptions#ngModelOptions-arguments ngModelOptions}. By default, - * this is the timezone of the browser. - * - * The format of the displayed time can be adjusted with the - * {@link ng.directive:ngModelOptions#ngModelOptions-arguments ngModelOptions} `timeSecondsFormat` - * and `timeStripZeroSeconds`. - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. - * This must be a valid ISO time format (HH:mm:ss). You can also use interpolation inside this - * attribute (e.g. `min="{{minTime | date:'HH:mm:ss'}}"`). Note that `min` will also add - * native HTML5 constraint validation. - * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. - * This must be a valid ISO time format (HH:mm:ss). You can also use interpolation inside this - * attribute (e.g. `max="{{maxTime | date:'HH:mm:ss'}}"`). Note that `max` will also add - * native HTML5 constraint validation. - * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO time string the - * `ngMin` expression evaluates to. Note that it does not set the `min` attribute. - * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO time string the - * `ngMax` expression evaluates to. Note that it does not set the `max` attribute. - * @param {string=} required Sets `required` validation error key if the value is not entered. - * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to - * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of - * `required` when you want to data-bind to the `required` attribute. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * - * @example - - - -
- - -
- - Required! - - Not a valid date! -
- value = {{example.value | date: "HH:mm:ss"}}
- myForm.input.$valid = {{myForm.input.$valid}}
- myForm.input.$error = {{myForm.input.$error}}
- myForm.$valid = {{myForm.$valid}}
- myForm.$error.required = {{!!myForm.$error.required}}
-
-
- - var value = element(by.binding('example.value | date: "HH:mm:ss"')); - var valid = element(by.binding('myForm.input.$valid')); - - // currently protractor/webdriver does not support - // sending keys to all known HTML5 input controls - // for various browsers (https://github.com/angular/protractor/issues/562). - function setInput(val) { - // set the value of the element and force validation. - var scr = "var ipt = document.getElementById('exampleInput'); " + - "ipt.value = '" + val + "';" + - "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });"; - browser.executeScript(scr); - } - - it('should initialize to model', function() { - expect(value.getText()).toContain('14:57:00'); - expect(valid.getText()).toContain('myForm.input.$valid = true'); - }); - - it('should be invalid if empty', function() { - setInput(''); - expect(value.getText()).toEqual('value ='); - expect(valid.getText()).toContain('myForm.input.$valid = false'); - }); - - it('should be invalid if over max', function() { - setInput('23:59:00'); - expect(value.getText()).toContain(''); - expect(valid.getText()).toContain('myForm.input.$valid = false'); - }); - -
- */ - 'time': createDateInputType('time', TIME_REGEXP, - createDateParser(TIME_REGEXP, ['HH', 'mm', 'ss', 'sss']), - 'HH:mm:ss.sss'), - - /** - * @ngdoc input - * @name input[week] - * - * @description - * Input with week-of-the-year validation and transformation to Date. In browsers that do not yet support - * the HTML5 week input, a text element will be used. In that case, the text must be entered in a valid ISO-8601 - * week format (yyyy-W##), for example: `2013-W02`. - * - * The model must always be a Date object, otherwise AngularJS will throw an error. - * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string. - * - * The value of the resulting Date object will be set to Thursday at 00:00:00 of the requested week, - * due to ISO-8601 week numbering standards. Information on ISO's system for numbering the weeks of the - * year can be found at: https://en.wikipedia.org/wiki/ISO_8601#Week_dates - * - * The timezone to be used to read/write the `Date` instance in the model can be defined using - * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser. - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. - * This must be a valid ISO week format (yyyy-W##). You can also use interpolation inside this - * attribute (e.g. `min="{{minWeek | date:'yyyy-Www'}}"`). Note that `min` will also add - * native HTML5 constraint validation. - * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. - * This must be a valid ISO week format (yyyy-W##). You can also use interpolation inside this - * attribute (e.g. `max="{{maxWeek | date:'yyyy-Www'}}"`). Note that `max` will also add - * native HTML5 constraint validation. - * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO week string - * the `ngMin` expression evaluates to. Note that it does not set the `min` attribute. - * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO week string - * the `ngMax` expression evaluates to. Note that it does not set the `max` attribute. - * @param {string=} required Sets `required` validation error key if the value is not entered. - * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to - * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of - * `required` when you want to data-bind to the `required` attribute. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * - * @example - - - -
- -
- - Required! - - Not a valid date! -
- value = {{example.value | date: "yyyy-Www"}}
- myForm.input.$valid = {{myForm.input.$valid}}
- myForm.input.$error = {{myForm.input.$error}}
- myForm.$valid = {{myForm.$valid}}
- myForm.$error.required = {{!!myForm.$error.required}}
-
-
- - var value = element(by.binding('example.value | date: "yyyy-Www"')); - var valid = element(by.binding('myForm.input.$valid')); - - // currently protractor/webdriver does not support - // sending keys to all known HTML5 input controls - // for various browsers (https://github.com/angular/protractor/issues/562). - function setInput(val) { - // set the value of the element and force validation. - var scr = "var ipt = document.getElementById('exampleInput'); " + - "ipt.value = '" + val + "';" + - "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });"; - browser.executeScript(scr); - } - - it('should initialize to model', function() { - expect(value.getText()).toContain('2013-W01'); - expect(valid.getText()).toContain('myForm.input.$valid = true'); - }); - - it('should be invalid if empty', function() { - setInput(''); - expect(value.getText()).toEqual('value ='); - expect(valid.getText()).toContain('myForm.input.$valid = false'); - }); - - it('should be invalid if over max', function() { - setInput('2015-W01'); - expect(value.getText()).toContain(''); - expect(valid.getText()).toContain('myForm.input.$valid = false'); - }); - -
- */ - 'week': createDateInputType('week', WEEK_REGEXP, weekParser, 'yyyy-Www'), - - /** - * @ngdoc input - * @name input[month] - * - * @description - * Input with month validation and transformation. In browsers that do not yet support - * the HTML5 month input, a text element will be used. In that case, the text must be entered in a valid ISO-8601 - * month format (yyyy-MM), for example: `2009-01`. - * - * The model must always be a Date object, otherwise AngularJS will throw an error. - * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string. - * If the model is not set to the first of the month, the next view to model update will set it - * to the first of the month. - * - * The timezone to be used to read/write the `Date` instance in the model can be defined using - * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser. - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. - * This must be a valid ISO month format (yyyy-MM). You can also use interpolation inside this - * attribute (e.g. `min="{{minMonth | date:'yyyy-MM'}}"`). Note that `min` will also add - * native HTML5 constraint validation. - * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. - * This must be a valid ISO month format (yyyy-MM). You can also use interpolation inside this - * attribute (e.g. `max="{{maxMonth | date:'yyyy-MM'}}"`). Note that `max` will also add - * native HTML5 constraint validation. - * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO week string - * the `ngMin` expression evaluates to. Note that it does not set the `min` attribute. - * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO week string - * the `ngMax` expression evaluates to. Note that it does not set the `max` attribute. - - * @param {string=} required Sets `required` validation error key if the value is not entered. - * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to - * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of - * `required` when you want to data-bind to the `required` attribute. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * - * @example - - - -
- - -
- - Required! - - Not a valid month! -
- value = {{example.value | date: "yyyy-MM"}}
- myForm.input.$valid = {{myForm.input.$valid}}
- myForm.input.$error = {{myForm.input.$error}}
- myForm.$valid = {{myForm.$valid}}
- myForm.$error.required = {{!!myForm.$error.required}}
-
-
- - var value = element(by.binding('example.value | date: "yyyy-MM"')); - var valid = element(by.binding('myForm.input.$valid')); - - // currently protractor/webdriver does not support - // sending keys to all known HTML5 input controls - // for various browsers (https://github.com/angular/protractor/issues/562). - function setInput(val) { - // set the value of the element and force validation. - var scr = "var ipt = document.getElementById('exampleInput'); " + - "ipt.value = '" + val + "';" + - "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });"; - browser.executeScript(scr); - } - - it('should initialize to model', function() { - expect(value.getText()).toContain('2013-10'); - expect(valid.getText()).toContain('myForm.input.$valid = true'); - }); - - it('should be invalid if empty', function() { - setInput(''); - expect(value.getText()).toEqual('value ='); - expect(valid.getText()).toContain('myForm.input.$valid = false'); - }); - - it('should be invalid if over max', function() { - setInput('2015-01'); - expect(value.getText()).toContain(''); - expect(valid.getText()).toContain('myForm.input.$valid = false'); - }); - -
- */ - 'month': createDateInputType('month', MONTH_REGEXP, - createDateParser(MONTH_REGEXP, ['yyyy', 'MM']), - 'yyyy-MM'), - - /** - * @ngdoc input - * @name input[number] - * - * @description - * Text input with number validation and transformation. Sets the `number` validation - * error if not a valid number. - * - *
- * The model must always be of type `number` otherwise AngularJS will throw an error. - * Be aware that a string containing a number is not enough. See the {@link ngModel:numfmt} - * error docs for more information and an example of how to convert your model if necessary. - *
- * - * - * - * @knownIssue - * - * ### HTML5 constraint validation and `allowInvalid` - * - * In browsers that follow the - * [HTML5 specification](https://html.spec.whatwg.org/multipage/forms.html#number-state-%28type=number%29), - * `input[number]` does not work as expected with {@link ngModelOptions `ngModelOptions.allowInvalid`}. - * If a non-number is entered in the input, the browser will report the value as an empty string, - * which means the view / model values in `ngModel` and subsequently the scope value - * will also be an empty string. - * - * @knownIssue - * - * ### Large numbers and `step` validation - * - * The `step` validation will not work correctly for very large numbers (e.g. 9999999999) due to - * Javascript's arithmetic limitations. If you need to handle large numbers, purpose-built - * libraries (e.g. https://github.com/MikeMcl/big.js/), can be included into AngularJS by - * {@link guide/forms#modifying-built-in-validators overwriting the validators} - * for `number` and / or `step`, or by {@link guide/forms#custom-validation applying custom validators} - * to an `input[text]` element. The source for `input[number]` type can be used as a starting - * point for both implementations. - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. - * Can be interpolated. - * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. - * Can be interpolated. - * @param {string=} ngMin Like `min`, sets the `min` validation error key if the value entered is less than `ngMin`, - * but does not trigger HTML5 native validation. Takes an expression. - * @param {string=} ngMax Like `max`, sets the `max` validation error key if the value entered is greater than `ngMax`, - * but does not trigger HTML5 native validation. Takes an expression. - * @param {string=} step Sets the `step` validation error key if the value entered does not fit the `step` constraint. - * Can be interpolated. - * @param {string=} ngStep Like `step`, sets the `step` validation error key if the value entered does not fit the `ngStep` constraint, - * but does not trigger HTML5 native validation. Takes an expression. - * @param {string=} required Sets `required` validation error key if the value is not entered. - * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to - * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of - * `required` when you want to data-bind to the `required` attribute. - * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than - * minlength. - * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than - * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of - * any length. - * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string - * that contains the regular expression body that will be converted to a regular expression - * as in the ngPattern directive. - * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue} - * does not match a RegExp found by evaluating the AngularJS expression given in the attribute value. - * If the expression evaluates to a RegExp object, then this is used directly. - * If the expression evaluates to a string, then it will be converted to a RegExp - * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to - * `new RegExp('^abc$')`.
- * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to - * start at the index of the last search's match, thus not taking the whole input value into - * account. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * - * @example - - - -
- -
- - Required! - - Not valid number! -
- value = {{example.value}}
- myForm.input.$valid = {{myForm.input.$valid}}
- myForm.input.$error = {{myForm.input.$error}}
- myForm.$valid = {{myForm.$valid}}
- myForm.$error.required = {{!!myForm.$error.required}}
-
-
- - var value = element(by.binding('example.value')); - var valid = element(by.binding('myForm.input.$valid')); - var input = element(by.model('example.value')); - - it('should initialize to model', function() { - expect(value.getText()).toContain('12'); - expect(valid.getText()).toContain('true'); - }); - - it('should be invalid if empty', function() { - input.clear(); - input.sendKeys(''); - expect(value.getText()).toEqual('value ='); - expect(valid.getText()).toContain('false'); - }); - - it('should be invalid if over max', function() { - input.clear(); - input.sendKeys('123'); - expect(value.getText()).toEqual('value ='); - expect(valid.getText()).toContain('false'); - }); - -
- */ - 'number': numberInputType, - - - /** - * @ngdoc input - * @name input[url] - * - * @description - * Text input with URL validation. Sets the `url` validation error key if the content is not a - * valid URL. - * - *
- * **Note:** `input[url]` uses a regex to validate urls that is derived from the regex - * used in Chromium. If you need stricter validation, you can use `ng-pattern` or modify - * the built-in validators (see the {@link guide/forms Forms guide}) - *
- * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} required Sets `required` validation error key if the value is not entered. - * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to - * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of - * `required` when you want to data-bind to the `required` attribute. - * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than - * minlength. - * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than - * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of - * any length. - * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string - * that contains the regular expression body that will be converted to a regular expression - * as in the ngPattern directive. - * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue} - * does not match a RegExp found by evaluating the AngularJS expression given in the attribute value. - * If the expression evaluates to a RegExp object, then this is used directly. - * If the expression evaluates to a string, then it will be converted to a RegExp - * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to - * `new RegExp('^abc$')`.
- * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to - * start at the index of the last search's match, thus not taking the whole input value into - * account. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * - * @example - - - -
-
- - var text = element(by.binding('url.text')); - var valid = element(by.binding('myForm.input.$valid')); - var input = element(by.model('url.text')); - - it('should initialize to model', function() { - expect(text.getText()).toContain('http://google.com'); - expect(valid.getText()).toContain('true'); - }); - - it('should be invalid if empty', function() { - input.clear(); - input.sendKeys(''); - - expect(text.getText()).toEqual('text ='); - expect(valid.getText()).toContain('false'); - }); - - it('should be invalid if not url', function() { - input.clear(); - input.sendKeys('box'); - - expect(valid.getText()).toContain('false'); - }); - -
- */ - 'url': urlInputType, - - - /** - * @ngdoc input - * @name input[email] - * - * @description - * Text input with email validation. Sets the `email` validation error key if not a valid email - * address. - * - *
- * **Note:** `input[email]` uses a regex to validate email addresses that is derived from the regex - * used in Chromium, which may not fulfill your app's requirements. - * If you need stricter (e.g. requiring a top-level domain), or more relaxed validation - * (e.g. allowing IPv6 address literals) you can use `ng-pattern` or - * modify the built-in validators (see the {@link guide/forms Forms guide}). - *
- * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} required Sets `required` validation error key if the value is not entered. - * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to - * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of - * `required` when you want to data-bind to the `required` attribute. - * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than - * minlength. - * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than - * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of - * any length. - * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string - * that contains the regular expression body that will be converted to a regular expression - * as in the ngPattern directive. - * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue} - * does not match a RegExp found by evaluating the AngularJS expression given in the attribute value. - * If the expression evaluates to a RegExp object, then this is used directly. - * If the expression evaluates to a string, then it will be converted to a RegExp - * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to - * `new RegExp('^abc$')`.
- * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to - * start at the index of the last search's match, thus not taking the whole input value into - * account. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * - * @example - - - -
- -
- - Required! - - Not valid email! -
- text = {{email.text}}
- myForm.input.$valid = {{myForm.input.$valid}}
- myForm.input.$error = {{myForm.input.$error}}
- myForm.$valid = {{myForm.$valid}}
- myForm.$error.required = {{!!myForm.$error.required}}
- myForm.$error.email = {{!!myForm.$error.email}}
-
-
- - var text = element(by.binding('email.text')); - var valid = element(by.binding('myForm.input.$valid')); - var input = element(by.model('email.text')); - - it('should initialize to model', function() { - expect(text.getText()).toContain('me@example.com'); - expect(valid.getText()).toContain('true'); - }); - - it('should be invalid if empty', function() { - input.clear(); - input.sendKeys(''); - expect(text.getText()).toEqual('text ='); - expect(valid.getText()).toContain('false'); - }); - - it('should be invalid if not email', function() { - input.clear(); - input.sendKeys('xxx'); - - expect(valid.getText()).toContain('false'); - }); - -
- */ - 'email': emailInputType, - - - /** - * @ngdoc input - * @name input[radio] - * - * @description - * HTML radio button. - * - * **Note:**
- * All inputs controlled by {@link ngModel ngModel} (including those of type `radio`) will use the - * value of their `name` attribute to determine the property under which their - * {@link ngModel.NgModelController NgModelController} will be published on the parent - * {@link form.FormController FormController}. Thus, if you use the same `name` for multiple - * inputs of a form (e.g. a group of radio inputs), only _one_ `NgModelController` will be - * published on the parent `FormController` under that name. The rest of the controllers will - * continue to work as expected, but you won't be able to access them as properties on the parent - * `FormController`. - * - *
- *

- * In plain HTML forms, the `name` attribute is used to identify groups of radio inputs, so - * that the browser can manage their state (checked/unchecked) based on the state of other - * inputs in the same group. - *

- *

- * In AngularJS forms, this is not necessary. The input's state will be updated based on the - * value of the underlying model data. - *

- *
- * - *
- * If you omit the `name` attribute on a radio input, `ngModel` will automatically assign it a - * unique name. - *
- * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string} value The value to which the `ngModel` expression should be set when selected. - * Note that `value` only supports `string` values, i.e. the scope model needs to be a string, - * too. Use `ngValue` if you need complex models (`number`, `object`, ...). - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * @param {string} ngValue AngularJS expression to which `ngModel` will be be set when the radio - * is selected. Should be used instead of the `value` attribute if you need - * a non-string `ngModel` (`boolean`, `array`, ...). - * - * @example - - - -
-
-
-
- color = {{color.name | json}}
-
- Note that `ng-value="specialValue"` sets radio item's value to be the value of `$scope.specialValue`. -
- - it('should change state', function() { - var inputs = element.all(by.model('color.name')); - var color = element(by.binding('color.name')); - - expect(color.getText()).toContain('blue'); - - inputs.get(0).click(); - expect(color.getText()).toContain('red'); - - inputs.get(1).click(); - expect(color.getText()).toContain('green'); - }); - -
- */ - 'radio': radioInputType, - - /** - * @ngdoc input - * @name input[range] - * - * @description - * Native range input with validation and transformation. - * - * The model for the range input must always be a `Number`. - * - * IE9 and other browsers that do not support the `range` type fall back - * to a text input without any default values for `min`, `max` and `step`. Model binding, - * validation and number parsing are nevertheless supported. - * - * Browsers that support range (latest Chrome, Safari, Firefox, Edge) treat `input[range]` - * in a way that never allows the input to hold an invalid value. That means: - * - any non-numerical value is set to `(max + min) / 2`. - * - any numerical value that is less than the current min val, or greater than the current max val - * is set to the min / max val respectively. - * - additionally, the current `step` is respected, so the nearest value that satisfies a step - * is used. - * - * See the [HTML Spec on input[type=range]](https://www.w3.org/TR/html5/forms.html#range-state-(type=range)) - * for more info. - * - * This has the following consequences for AngularJS: - * - * Since the element value should always reflect the current model value, a range input - * will set the bound ngModel expression to the value that the browser has set for the - * input element. For example, in the following input ``, - * if the application sets `model.value = null`, the browser will set the input to `'50'`. - * AngularJS will then set the model to `50`, to prevent input and model value being out of sync. - * - * That means the model for range will immediately be set to `50` after `ngModel` has been - * initialized. It also means a range input can never have the required error. - * - * This does not only affect changes to the model value, but also to the values of the `min`, - * `max`, and `step` attributes. When these change in a way that will cause the browser to modify - * the input value, AngularJS will also update the model value. - * - * Automatic value adjustment also means that a range input element can never have the `required`, - * `min`, or `max` errors. - * - * However, `step` is currently only fully implemented by Firefox. Other browsers have problems - * when the step value changes dynamically - they do not adjust the element value correctly, but - * instead may set the `stepMismatch` error. If that's the case, the AngularJS will set the `step` - * error on the input, and set the model to `undefined`. - * - * Note that `input[range]` is not compatible with`ngMax`, `ngMin`, and `ngStep`, because they do - * not set the `min` and `max` attributes, which means that the browser won't automatically adjust - * the input value based on their values, and will always assume min = 0, max = 100, and step = 1. - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} min Sets the `min` validation to ensure that the value entered is greater - * than `min`. Can be interpolated. - * @param {string=} max Sets the `max` validation to ensure that the value entered is less than `max`. - * Can be interpolated. - * @param {string=} step Sets the `step` validation to ensure that the value entered matches the `step` - * Can be interpolated. - * @param {expression=} ngChange AngularJS expression to be executed when the ngModel value changes due - * to user interaction with the input element. - * @param {expression=} ngChecked If the expression is truthy, then the `checked` attribute will be set on the - * element. **Note** : `ngChecked` should not be used alongside `ngModel`. - * Checkout {@link ng.directive:ngChecked ngChecked} for usage. - * - * @example - - - -
- - Model as range: -
- Model as number:
- Min:
- Max:
- value = {{value}}
- myForm.range.$valid = {{myForm.range.$valid}}
- myForm.range.$error = {{myForm.range.$error}} -
-
-
- - * ## Range Input with ngMin & ngMax attributes - - * @example - - - -
- Model as range: -
- Model as number:
- Min:
- Max:
- value = {{value}}
- myForm.range.$valid = {{myForm.range.$valid}}
- myForm.range.$error = {{myForm.range.$error}} -
-
-
- - */ - 'range': rangeInputType, - - /** - * @ngdoc input - * @name input[checkbox] - * - * @description - * HTML checkbox. - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {expression=} ngTrueValue The value to which the expression should be set when selected. - * @param {expression=} ngFalseValue The value to which the expression should be set when not selected. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * - * @example - - - -
-
-
- value1 = {{checkboxModel.value1}}
- value2 = {{checkboxModel.value2}}
-
-
- - it('should change state', function() { - var value1 = element(by.binding('checkboxModel.value1')); - var value2 = element(by.binding('checkboxModel.value2')); - - expect(value1.getText()).toContain('true'); - expect(value2.getText()).toContain('YES'); - - element(by.model('checkboxModel.value1')).click(); - element(by.model('checkboxModel.value2')).click(); - - expect(value1.getText()).toContain('false'); - expect(value2.getText()).toContain('NO'); - }); - -
- */ - 'checkbox': checkboxInputType, - - 'hidden': noop, - 'button': noop, - 'submit': noop, - 'reset': noop, - 'file': noop - }; - - function stringBasedInputType(ctrl) { - ctrl.$formatters.push(function (value) { - return ctrl.$isEmpty(value) ? value : value.toString(); - }); - } - - function textInputType(scope, element, attr, ctrl, $sniffer, $browser) { - baseInputType(scope, element, attr, ctrl, $sniffer, $browser); - stringBasedInputType(ctrl); - } - - function baseInputType(scope, element, attr, ctrl, $sniffer, $browser) { - var type = lowercase(element[0].type); - - // In composition mode, users are still inputting intermediate text buffer, - // hold the listener until composition is done. - // More about composition events: https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent - if (!$sniffer.android) { - var composing = false; - - element.on('compositionstart', function () { - composing = true; - }); - - // Support: IE9+ - element.on('compositionupdate', function (ev) { - // End composition when ev.data is empty string on 'compositionupdate' event. - // When the input de-focusses (e.g. by clicking away), IE triggers 'compositionupdate' - // instead of 'compositionend'. - if (isUndefined(ev.data) || ev.data === '') { - composing = false; - } - }); - - element.on('compositionend', function () { - composing = false; - listener(); - }); - } - - var timeout; - - var listener = function (ev) { - if (timeout) { - $browser.defer.cancel(timeout); - timeout = null; - } - if (composing) return; - var value = element.val(), - event = ev && ev.type; - - // By default we will trim the value - // If the attribute ng-trim exists we will avoid trimming - // If input type is 'password', the value is never trimmed - if (type !== 'password' && (!attr.ngTrim || attr.ngTrim !== 'false')) { - value = trim(value); - } - - // If a control is suffering from bad input (due to native validators), browsers discard its - // value, so it may be necessary to revalidate (by calling $setViewValue again) even if the - // control's value is the same empty value twice in a row. - if (ctrl.$viewValue !== value || (value === '' && ctrl.$$hasNativeValidators)) { - ctrl.$setViewValue(value, event); - } - }; - - // if the browser does support "input" event, we are fine - except on IE9 which doesn't fire the - // input event on backspace, delete or cut - if ($sniffer.hasEvent('input')) { - element.on('input', listener); - } else { - var deferListener = function (ev, input, origValue) { - if (!timeout) { - timeout = $browser.defer(function () { - timeout = null; - if (!input || input.value !== origValue) { - listener(ev); - } - }); - } - }; - - element.on('keydown', /** @this */ function (event) { - var key = event.keyCode; - - // ignore - // command modifiers arrows - if (key === 91 || (15 < key && key < 19) || (37 <= key && key <= 40)) return; - - deferListener(event, this, this.value); - }); - - // if user modifies input value using context menu in IE, we need "paste", "cut" and "drop" events to catch it - if ($sniffer.hasEvent('paste')) { - element.on('paste cut drop', deferListener); - } - } - - // if user paste into input using mouse on older browser - // or form autocomplete on newer browser, we need "change" event to catch it - element.on('change', listener); - - // Some native input types (date-family) have the ability to change validity without - // firing any input/change events. - // For these event types, when native validators are present and the browser supports the type, - // check for validity changes on various DOM events. - if (PARTIAL_VALIDATION_TYPES[type] && ctrl.$$hasNativeValidators && type === attr.type) { - element.on(PARTIAL_VALIDATION_EVENTS, /** @this */ function (ev) { - if (!timeout) { - var validity = this[VALIDITY_STATE_PROPERTY]; - var origBadInput = validity.badInput; - var origTypeMismatch = validity.typeMismatch; - timeout = $browser.defer(function () { - timeout = null; - if (validity.badInput !== origBadInput || validity.typeMismatch !== origTypeMismatch) { - listener(ev); - } - }); - } - }); - } - - ctrl.$render = function () { - // Workaround for Firefox validation #12102. - var value = ctrl.$isEmpty(ctrl.$viewValue) ? '' : ctrl.$viewValue; - if (element.val() !== value) { - element.val(value); - } - }; - } - - function weekParser(isoWeek, existingDate) { - if (isDate(isoWeek)) { - return isoWeek; - } - - if (isString(isoWeek)) { - WEEK_REGEXP.lastIndex = 0; - var parts = WEEK_REGEXP.exec(isoWeek); - if (parts) { - var year = +parts[1], - week = +parts[2], - hours = 0, - minutes = 0, - seconds = 0, - milliseconds = 0, - firstThurs = getFirstThursdayOfYear(year), - addDays = (week - 1) * 7; - - if (existingDate) { - hours = existingDate.getHours(); - minutes = existingDate.getMinutes(); - seconds = existingDate.getSeconds(); - milliseconds = existingDate.getMilliseconds(); - } - - return new Date(year, 0, firstThurs.getDate() + addDays, hours, minutes, seconds, milliseconds); - } - } - - return NaN; - } - - function createDateParser(regexp, mapping) { - return function (iso, previousDate) { - var parts, map; - - if (isDate(iso)) { - return iso; - } - - if (isString(iso)) { - // When a date is JSON'ified to wraps itself inside of an extra - // set of double quotes. This makes the date parsing code unable - // to match the date string and parse it as a date. - if (iso.charAt(0) === '"' && iso.charAt(iso.length - 1) === '"') { - iso = iso.substring(1, iso.length - 1); - } - if (ISO_DATE_REGEXP.test(iso)) { - return new Date(iso); - } - regexp.lastIndex = 0; - parts = regexp.exec(iso); - - if (parts) { - parts.shift(); - if (previousDate) { - map = { - yyyy: previousDate.getFullYear(), - MM: previousDate.getMonth() + 1, - dd: previousDate.getDate(), - HH: previousDate.getHours(), - mm: previousDate.getMinutes(), - ss: previousDate.getSeconds(), - sss: previousDate.getMilliseconds() / 1000 - }; - } else { - map = { - yyyy: 1970, - MM: 1, - dd: 1, - HH: 0, - mm: 0, - ss: 0, - sss: 0 - }; - } - - forEach(parts, function (part, index) { - if (index < mapping.length) { - map[mapping[index]] = +part; - } - }); - - var date = new Date(map.yyyy, map.MM - 1, map.dd, map.HH, map.mm, map.ss || 0, map.sss * 1000 || 0); - if (map.yyyy < 100) { - // In the constructor, 2-digit years map to 1900-1999. - // Use `setFullYear()` to set the correct year. - date.setFullYear(map.yyyy); - } - - return date; - } - } - - return NaN; - }; - } - - function createDateInputType(type, regexp, parseDate, format) { - return function dynamicDateInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter, $parse) { - badInputChecker(scope, element, attr, ctrl, type); - baseInputType(scope, element, attr, ctrl, $sniffer, $browser); - - var isTimeType = type === 'time' || type === 'datetimelocal'; - var previousDate; - var previousTimezone; - - ctrl.$parsers.push(function (value) { - if (ctrl.$isEmpty(value)) return null; - - if (regexp.test(value)) { - // Note: We cannot read ctrl.$modelValue, as there might be a different - // parser/formatter in the processing chain so that the model - // contains some different data format! - return parseDateAndConvertTimeZoneToLocal(value, previousDate); - } - ctrl.$$parserName = type; - return undefined; - }); - - ctrl.$formatters.push(function (value) { - if (value && !isDate(value)) { - throw ngModelMinErr('datefmt', 'Expected `{0}` to be a date', value); - } - if (isValidDate(value)) { - previousDate = value; - var timezone = ctrl.$options.getOption('timezone'); - - if (timezone) { - previousTimezone = timezone; - previousDate = convertTimezoneToLocal(previousDate, timezone, true); - } - - return formatter(value, timezone); - } else { - previousDate = null; - previousTimezone = null; - return ''; - } - }); - - if (isDefined(attr.min) || attr.ngMin) { - var minVal = attr.min || $parse(attr.ngMin)(scope); - var parsedMinVal = parseObservedDateValue(minVal); - - ctrl.$validators.min = function (value) { - return !isValidDate(value) || isUndefined(parsedMinVal) || parseDate(value) >= parsedMinVal; - }; - attr.$observe('min', function (val) { - if (val !== minVal) { - parsedMinVal = parseObservedDateValue(val); - minVal = val; - ctrl.$validate(); - } - }); - } - - if (isDefined(attr.max) || attr.ngMax) { - var maxVal = attr.max || $parse(attr.ngMax)(scope); - var parsedMaxVal = parseObservedDateValue(maxVal); - - ctrl.$validators.max = function (value) { - return !isValidDate(value) || isUndefined(parsedMaxVal) || parseDate(value) <= parsedMaxVal; - }; - attr.$observe('max', function (val) { - if (val !== maxVal) { - parsedMaxVal = parseObservedDateValue(val); - maxVal = val; - ctrl.$validate(); - } - }); - } - - function isValidDate(value) { - // Invalid Date: getTime() returns NaN - return value && !(value.getTime && value.getTime() !== value.getTime()); - } - - function parseObservedDateValue(val) { - return isDefined(val) && !isDate(val) ? parseDateAndConvertTimeZoneToLocal(val) || undefined : val; - } - - function parseDateAndConvertTimeZoneToLocal(value, previousDate) { - var timezone = ctrl.$options.getOption('timezone'); - - if (previousTimezone && previousTimezone !== timezone) { - // If the timezone has changed, adjust the previousDate to the default timezone - // so that the new date is converted with the correct timezone offset - previousDate = addDateMinutes(previousDate, timezoneToOffset(previousTimezone)); - } - - var parsedDate = parseDate(value, previousDate); - - if (!isNaN(parsedDate) && timezone) { - parsedDate = convertTimezoneToLocal(parsedDate, timezone); - } - return parsedDate; - } - - function formatter(value, timezone) { - var targetFormat = format; - - if (isTimeType && isString(ctrl.$options.getOption('timeSecondsFormat'))) { - targetFormat = format - .replace('ss.sss', ctrl.$options.getOption('timeSecondsFormat')) - .replace(/:$/, ''); - } - - var formatted = $filter('date')(value, targetFormat, timezone); - - if (isTimeType && ctrl.$options.getOption('timeStripZeroSeconds')) { - formatted = formatted.replace(/(?::00)?(?:\.000)?$/, ''); - } - - return formatted; - } - }; - } - - function badInputChecker(scope, element, attr, ctrl, parserName) { - var node = element[0]; - var nativeValidation = ctrl.$$hasNativeValidators = isObject(node.validity); - if (nativeValidation) { - ctrl.$parsers.push(function (value) { - var validity = element.prop(VALIDITY_STATE_PROPERTY) || {}; - if (validity.badInput || validity.typeMismatch) { - ctrl.$$parserName = parserName; - return undefined; - } - - return value; - }); - } - } - - function numberFormatterParser(ctrl) { - ctrl.$parsers.push(function (value) { - if (ctrl.$isEmpty(value)) return null; - if (NUMBER_REGEXP.test(value)) return parseFloat(value); - - ctrl.$$parserName = 'number'; - return undefined; - }); - - ctrl.$formatters.push(function (value) { - if (!ctrl.$isEmpty(value)) { - if (!isNumber(value)) { - throw ngModelMinErr('numfmt', 'Expected `{0}` to be a number', value); - } - value = value.toString(); - } - return value; - }); - } - - function parseNumberAttrVal(val) { - if (isDefined(val) && !isNumber(val)) { - val = parseFloat(val); - } - return !isNumberNaN(val) ? val : undefined; - } - - function isNumberInteger(num) { - // See http://stackoverflow.com/questions/14636536/how-to-check-if-a-variable-is-an-integer-in-javascript#14794066 - // (minus the assumption that `num` is a number) - - // eslint-disable-next-line no-bitwise - return (num | 0) === num; - } - - function countDecimals(num) { - var numString = num.toString(); - var decimalSymbolIndex = numString.indexOf('.'); - - if (decimalSymbolIndex === -1) { - if (-1 < num && num < 1) { - // It may be in the exponential notation format (`1e-X`) - var match = /e-(\d+)$/.exec(numString); - - if (match) { - return Number(match[1]); - } - } - - return 0; - } - - return numString.length - decimalSymbolIndex - 1; - } - - function isValidForStep(viewValue, stepBase, step) { - // At this point `stepBase` and `step` are expected to be non-NaN values - // and `viewValue` is expected to be a valid stringified number. - var value = Number(viewValue); - - var isNonIntegerValue = !isNumberInteger(value); - var isNonIntegerStepBase = !isNumberInteger(stepBase); - var isNonIntegerStep = !isNumberInteger(step); - - // Due to limitations in Floating Point Arithmetic (e.g. `0.3 - 0.2 !== 0.1` or - // `0.5 % 0.1 !== 0`), we need to convert all numbers to integers. - if (isNonIntegerValue || isNonIntegerStepBase || isNonIntegerStep) { - var valueDecimals = isNonIntegerValue ? countDecimals(value) : 0; - var stepBaseDecimals = isNonIntegerStepBase ? countDecimals(stepBase) : 0; - var stepDecimals = isNonIntegerStep ? countDecimals(step) : 0; - - var decimalCount = Math.max(valueDecimals, stepBaseDecimals, stepDecimals); - var multiplier = Math.pow(10, decimalCount); - - value = value * multiplier; - stepBase = stepBase * multiplier; - step = step * multiplier; - - if (isNonIntegerValue) value = Math.round(value); - if (isNonIntegerStepBase) stepBase = Math.round(stepBase); - if (isNonIntegerStep) step = Math.round(step); - } - - return (value - stepBase) % step === 0; - } - - function numberInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter, $parse) { - badInputChecker(scope, element, attr, ctrl, 'number'); - numberFormatterParser(ctrl); - baseInputType(scope, element, attr, ctrl, $sniffer, $browser); - - var parsedMinVal; - - if (isDefined(attr.min) || attr.ngMin) { - var minVal = attr.min || $parse(attr.ngMin)(scope); - parsedMinVal = parseNumberAttrVal(minVal); - - ctrl.$validators.min = function (modelValue, viewValue) { - return ctrl.$isEmpty(viewValue) || isUndefined(parsedMinVal) || viewValue >= parsedMinVal; - }; - - attr.$observe('min', function (val) { - if (val !== minVal) { - parsedMinVal = parseNumberAttrVal(val); - minVal = val; - // TODO(matsko): implement validateLater to reduce number of validations - ctrl.$validate(); - } - }); - } - - if (isDefined(attr.max) || attr.ngMax) { - var maxVal = attr.max || $parse(attr.ngMax)(scope); - var parsedMaxVal = parseNumberAttrVal(maxVal); - - ctrl.$validators.max = function (modelValue, viewValue) { - return ctrl.$isEmpty(viewValue) || isUndefined(parsedMaxVal) || viewValue <= parsedMaxVal; - }; - - attr.$observe('max', function (val) { - if (val !== maxVal) { - parsedMaxVal = parseNumberAttrVal(val); - maxVal = val; - // TODO(matsko): implement validateLater to reduce number of validations - ctrl.$validate(); - } - }); - } - - if (isDefined(attr.step) || attr.ngStep) { - var stepVal = attr.step || $parse(attr.ngStep)(scope); - var parsedStepVal = parseNumberAttrVal(stepVal); - - ctrl.$validators.step = function (modelValue, viewValue) { - return ctrl.$isEmpty(viewValue) || isUndefined(parsedStepVal) || - isValidForStep(viewValue, parsedMinVal || 0, parsedStepVal); - }; - - attr.$observe('step', function (val) { - // TODO(matsko): implement validateLater to reduce number of validations - if (val !== stepVal) { - parsedStepVal = parseNumberAttrVal(val); - stepVal = val; - ctrl.$validate(); - } - - }); - - } - } - - function rangeInputType(scope, element, attr, ctrl, $sniffer, $browser) { - badInputChecker(scope, element, attr, ctrl, 'range'); - numberFormatterParser(ctrl); - baseInputType(scope, element, attr, ctrl, $sniffer, $browser); - - var supportsRange = ctrl.$$hasNativeValidators && element[0].type === 'range', - minVal = supportsRange ? 0 : undefined, - maxVal = supportsRange ? 100 : undefined, - stepVal = supportsRange ? 1 : undefined, - validity = element[0].validity, - hasMinAttr = isDefined(attr.min), - hasMaxAttr = isDefined(attr.max), - hasStepAttr = isDefined(attr.step); - - var originalRender = ctrl.$render; - - ctrl.$render = supportsRange && isDefined(validity.rangeUnderflow) && isDefined(validity.rangeOverflow) ? - //Browsers that implement range will set these values automatically, but reading the adjusted values after - //$render would cause the min / max validators to be applied with the wrong value - function rangeRender() { - originalRender(); - ctrl.$setViewValue(element.val()); - } : - originalRender; - - if (hasMinAttr) { - minVal = parseNumberAttrVal(attr.min); - - ctrl.$validators.min = supportsRange ? - // Since all browsers set the input to a valid value, we don't need to check validity - function noopMinValidator() { - return true; - } : - // non-support browsers validate the min val - function minValidator(modelValue, viewValue) { - return ctrl.$isEmpty(viewValue) || isUndefined(minVal) || viewValue >= minVal; - }; - - setInitialValueAndObserver('min', minChange); - } - - if (hasMaxAttr) { - maxVal = parseNumberAttrVal(attr.max); - - ctrl.$validators.max = supportsRange ? - // Since all browsers set the input to a valid value, we don't need to check validity - function noopMaxValidator() { - return true; - } : - // non-support browsers validate the max val - function maxValidator(modelValue, viewValue) { - return ctrl.$isEmpty(viewValue) || isUndefined(maxVal) || viewValue <= maxVal; - }; - - setInitialValueAndObserver('max', maxChange); - } - - if (hasStepAttr) { - stepVal = parseNumberAttrVal(attr.step); - - ctrl.$validators.step = supportsRange ? - function nativeStepValidator() { - // Currently, only FF implements the spec on step change correctly (i.e. adjusting the - // input element value to a valid value). It's possible that other browsers set the stepMismatch - // validity error instead, so we can at least report an error in that case. - return !validity.stepMismatch; - } : - // ngStep doesn't set the setp attr, so the browser doesn't adjust the input value as setting step would - function stepValidator(modelValue, viewValue) { - return ctrl.$isEmpty(viewValue) || isUndefined(stepVal) || - isValidForStep(viewValue, minVal || 0, stepVal); - }; - - setInitialValueAndObserver('step', stepChange); - } - - function setInitialValueAndObserver(htmlAttrName, changeFn) { - // interpolated attributes set the attribute value only after a digest, but we need the - // attribute value when the input is first rendered, so that the browser can adjust the - // input value based on the min/max value - element.attr(htmlAttrName, attr[htmlAttrName]); - var oldVal = attr[htmlAttrName]; - attr.$observe(htmlAttrName, function wrappedObserver(val) { - if (val !== oldVal) { - oldVal = val; - changeFn(val); - } - }); - } - - function minChange(val) { - minVal = parseNumberAttrVal(val); - // ignore changes before model is initialized - if (isNumberNaN(ctrl.$modelValue)) { - return; - } - - if (supportsRange) { - var elVal = element.val(); - // IE11 doesn't set the el val correctly if the minVal is greater than the element value - if (minVal > elVal) { - elVal = minVal; - element.val(elVal); - } - ctrl.$setViewValue(elVal); - } else { - // TODO(matsko): implement validateLater to reduce number of validations - ctrl.$validate(); - } - } - - function maxChange(val) { - maxVal = parseNumberAttrVal(val); - // ignore changes before model is initialized - if (isNumberNaN(ctrl.$modelValue)) { - return; - } - - if (supportsRange) { - var elVal = element.val(); - // IE11 doesn't set the el val correctly if the maxVal is less than the element value - if (maxVal < elVal) { - element.val(maxVal); - // IE11 and Chrome don't set the value to the minVal when max < min - elVal = maxVal < minVal ? minVal : maxVal; - } - ctrl.$setViewValue(elVal); - } else { - // TODO(matsko): implement validateLater to reduce number of validations - ctrl.$validate(); - } - } - - function stepChange(val) { - stepVal = parseNumberAttrVal(val); - // ignore changes before model is initialized - if (isNumberNaN(ctrl.$modelValue)) { - return; - } - - // Some browsers don't adjust the input value correctly, but set the stepMismatch error - if (!supportsRange) { - // TODO(matsko): implement validateLater to reduce number of validations - ctrl.$validate(); - } else if (ctrl.$viewValue !== element.val()) { - ctrl.$setViewValue(element.val()); - } - } - } - - function urlInputType(scope, element, attr, ctrl, $sniffer, $browser) { - // Note: no badInputChecker here by purpose as `url` is only a validation - // in browsers, i.e. we can always read out input.value even if it is not valid! - baseInputType(scope, element, attr, ctrl, $sniffer, $browser); - stringBasedInputType(ctrl); - - ctrl.$validators.url = function (modelValue, viewValue) { - var value = modelValue || viewValue; - return ctrl.$isEmpty(value) || URL_REGEXP.test(value); - }; - } - - function emailInputType(scope, element, attr, ctrl, $sniffer, $browser) { - // Note: no badInputChecker here by purpose as `url` is only a validation - // in browsers, i.e. we can always read out input.value even if it is not valid! - baseInputType(scope, element, attr, ctrl, $sniffer, $browser); - stringBasedInputType(ctrl); - - ctrl.$validators.email = function (modelValue, viewValue) { - var value = modelValue || viewValue; - return ctrl.$isEmpty(value) || EMAIL_REGEXP.test(value); - }; - } - - function radioInputType(scope, element, attr, ctrl) { - var doTrim = !attr.ngTrim || trim(attr.ngTrim) !== 'false'; - // make the name unique, if not defined - if (isUndefined(attr.name)) { - element.attr('name', nextUid()); - } - - var listener = function (ev) { - var value; - if (element[0].checked) { - value = attr.value; - if (doTrim) { - value = trim(value); - } - ctrl.$setViewValue(value, ev && ev.type); - } - }; - - element.on('change', listener); - - ctrl.$render = function () { - var value = attr.value; - if (doTrim) { - value = trim(value); - } - element[0].checked = (value === ctrl.$viewValue); - }; - - attr.$observe('value', ctrl.$render); - } - - function parseConstantExpr($parse, context, name, expression, fallback) { - var parseFn; - if (isDefined(expression)) { - parseFn = $parse(expression); - if (!parseFn.constant) { - throw ngModelMinErr('constexpr', 'Expected constant expression for `{0}`, but saw ' + - '`{1}`.', name, expression); - } - return parseFn(context); - } - return fallback; - } - - function checkboxInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter, $parse) { - var trueValue = parseConstantExpr($parse, scope, 'ngTrueValue', attr.ngTrueValue, true); - var falseValue = parseConstantExpr($parse, scope, 'ngFalseValue', attr.ngFalseValue, false); - - var listener = function (ev) { - ctrl.$setViewValue(element[0].checked, ev && ev.type); - }; - - element.on('change', listener); - - ctrl.$render = function () { - element[0].checked = ctrl.$viewValue; - }; - - // Override the standard `$isEmpty` because the $viewValue of an empty checkbox is always set to `false` - // This is because of the parser below, which compares the `$modelValue` with `trueValue` to convert - // it to a boolean. - ctrl.$isEmpty = function (value) { - return value === false; - }; - - ctrl.$formatters.push(function (value) { - return equals(value, trueValue); - }); - - ctrl.$parsers.push(function (value) { - return value ? trueValue : falseValue; - }); - } - - - /** - * @ngdoc directive - * @name textarea - * @restrict E - * - * @description - * HTML textarea element control with AngularJS data-binding. The data-binding and validation - * properties of this element are exactly the same as those of the - * {@link ng.directive:input input element}. - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} required Sets `required` validation error key if the value is not entered. - * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to - * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of - * `required` when you want to data-bind to the `required` attribute. - * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than - * minlength. - * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than - * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any - * length. - * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue} - * does not match a RegExp found by evaluating the AngularJS expression given in the attribute value. - * If the expression evaluates to a RegExp object, then this is used directly. - * If the expression evaluates to a string, then it will be converted to a RegExp - * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to - * `new RegExp('^abc$')`.
- * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to - * start at the index of the last search's match, thus not taking the whole input value into - * account. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * @param {boolean=} [ngTrim=true] If set to false AngularJS will not automatically trim the input. - * - * @knownIssue - * - * When specifying the `placeholder` attribute of ` - *
{{ list | json }}
- * - * - * it("should split the text by newlines", function() { - * var listInput = element(by.model('list')); - * var output = element(by.binding('list | json')); - * listInput.sendKeys('abc\ndef\nghi'); - * expect(output.getText()).toContain('[\n "abc",\n "def",\n "ghi"\n]'); - * }); - * - * - * - */ - var ngListDirective = function () { - return { - restrict: 'A', - priority: 100, - require: 'ngModel', - link: function (scope, element, attr, ctrl) { - var ngList = attr.ngList || ', '; - var trimValues = attr.ngTrim !== 'false'; - var separator = trimValues ? trim(ngList) : ngList; - - var parse = function (viewValue) { - // If the viewValue is invalid (say required but empty) it will be `undefined` - if (isUndefined(viewValue)) return; - - var list = []; - - if (viewValue) { - forEach(viewValue.split(separator), function (value) { - if (value) list.push(trimValues ? trim(value) : value); - }); - } - - return list; - }; - - ctrl.$parsers.push(parse); - ctrl.$formatters.push(function (value) { - if (isArray(value)) { - return value.join(ngList); - } - - return undefined; - }); - - // Override the standard $isEmpty because an empty array means the input is empty. - ctrl.$isEmpty = function (value) { - return !value || !value.length; - }; - } - }; - }; - - /* global VALID_CLASS: true, - INVALID_CLASS: true, - PRISTINE_CLASS: true, - DIRTY_CLASS: true, - UNTOUCHED_CLASS: true, - TOUCHED_CLASS: true, - PENDING_CLASS: true, - addSetValidityMethod: true, - setupValidity: true, - defaultModelOptions: false - */ - - - var VALID_CLASS = 'ng-valid', - INVALID_CLASS = 'ng-invalid', - PRISTINE_CLASS = 'ng-pristine', - DIRTY_CLASS = 'ng-dirty', - UNTOUCHED_CLASS = 'ng-untouched', - TOUCHED_CLASS = 'ng-touched', - EMPTY_CLASS = 'ng-empty', - NOT_EMPTY_CLASS = 'ng-not-empty'; - - var ngModelMinErr = minErr('ngModel'); - - /** - * @ngdoc type - * @name ngModel.NgModelController - * @property {*} $viewValue The actual value from the control's view. For `input` elements, this is a - * String. See {@link ngModel.NgModelController#$setViewValue} for information about when the $viewValue - * is set. - * - * @property {*} $modelValue The value in the model that the control is bound to. - * - * @property {Array.} $parsers Array of functions to execute, as a pipeline, whenever - * the control updates the ngModelController with a new {@link ngModel.NgModelController#$viewValue - `$viewValue`} from the DOM, usually via user input. - See {@link ngModel.NgModelController#$setViewValue `$setViewValue()`} for a detailed lifecycle explanation. - Note that the `$parsers` are not called when the bound ngModel expression changes programmatically. - - The functions are called in array order, each passing - its return value through to the next. The last return value is forwarded to the - {@link ngModel.NgModelController#$validators `$validators`} collection. - - Parsers are used to sanitize / convert the {@link ngModel.NgModelController#$viewValue - `$viewValue`}. - - Returning `undefined` from a parser means a parse error occurred. In that case, - no {@link ngModel.NgModelController#$validators `$validators`} will run and the `ngModel` - will be set to `undefined` unless {@link ngModelOptions `ngModelOptions.allowInvalid`} - is set to `true`. The parse error is stored in `ngModel.$error.parse`. - - This simple example shows a parser that would convert text input value to lowercase: - * ```js - * function parse(value) { - * if (value) { - * return value.toLowerCase(); - * } - * } - * ngModelController.$parsers.push(parse); - * ``` - - * - * @property {Array.} $formatters Array of functions to execute, as a pipeline, whenever - the bound ngModel expression changes programmatically. The `$formatters` are not called when the - value of the control is changed by user interaction. - - Formatters are used to format / convert the {@link ngModel.NgModelController#$modelValue - `$modelValue`} for display in the control. - - The functions are called in reverse array order, each passing the value through to the - next. The last return value is used as the actual DOM value. - - This simple example shows a formatter that would convert the model value to uppercase: - - * ```js - * function format(value) { - * if (value) { - * return value.toUpperCase(); - * } - * } - * ngModel.$formatters.push(format); - * ``` - * - * @property {Object.} $validators A collection of validators that are applied - * whenever the model value changes. The key value within the object refers to the name of the - * validator while the function refers to the validation operation. The validation operation is - * provided with the model value as an argument and must return a true or false value depending - * on the response of that validation. - * - * ```js - * ngModel.$validators.validCharacters = function(modelValue, viewValue) { - * var value = modelValue || viewValue; - * return /[0-9]+/.test(value) && - * /[a-z]+/.test(value) && - * /[A-Z]+/.test(value) && - * /\W+/.test(value); - * }; - * ``` - * - * @property {Object.} $asyncValidators A collection of validations that are expected to - * perform an asynchronous validation (e.g. a HTTP request). The validation function that is provided - * is expected to return a promise when it is run during the model validation process. Once the promise - * is delivered then the validation status will be set to true when fulfilled and false when rejected. - * When the asynchronous validators are triggered, each of the validators will run in parallel and the model - * value will only be updated once all validators have been fulfilled. As long as an asynchronous validator - * is unfulfilled, its key will be added to the controllers `$pending` property. Also, all asynchronous validators - * will only run once all synchronous validators have passed. - * - * Please note that if $http is used then it is important that the server returns a success HTTP response code - * in order to fulfill the validation and a status level of `4xx` in order to reject the validation. - * - * ```js - * ngModel.$asyncValidators.uniqueUsername = function(modelValue, viewValue) { - * var value = modelValue || viewValue; - * - * // Lookup user by username - * return $http.get('/api/users/' + value). - * then(function resolved() { - * //username exists, this means validation fails - * return $q.reject('exists'); - * }, function rejected() { - * //username does not exist, therefore this validation passes - * return true; - * }); - * }; - * ``` - * - * @property {Array.} $viewChangeListeners Array of functions to execute whenever - * a change to {@link ngModel.NgModelController#$viewValue `$viewValue`} has caused a change - * to {@link ngModel.NgModelController#$modelValue `$modelValue`}. - * It is called with no arguments, and its return value is ignored. - * This can be used in place of additional $watches against the model value. - * - * @property {Object} $error An object hash with all failing validator ids as keys. - * @property {Object} $pending An object hash with all pending validator ids as keys. - * - * @property {boolean} $untouched True if control has not lost focus yet. - * @property {boolean} $touched True if control has lost focus. - * @property {boolean} $pristine True if user has not interacted with the control yet. - * @property {boolean} $dirty True if user has already interacted with the control. - * @property {boolean} $valid True if there is no error. - * @property {boolean} $invalid True if at least one error on the control. - * @property {string} $name The name attribute of the control. - * - * @description - * - * `NgModelController` provides API for the {@link ngModel `ngModel`} directive. - * The controller contains services for data-binding, validation, CSS updates, and value formatting - * and parsing. It purposefully does not contain any logic which deals with DOM rendering or - * listening to DOM events. - * Such DOM related logic should be provided by other directives which make use of - * `NgModelController` for data-binding to control elements. - * AngularJS provides this DOM logic for most {@link input `input`} elements. - * At the end of this page you can find a {@link ngModel.NgModelController#custom-control-example - * custom control example} that uses `ngModelController` to bind to `contenteditable` elements. - * - * @example - * ### Custom Control Example - * This example shows how to use `NgModelController` with a custom control to achieve - * data-binding. Notice how different directives (`contenteditable`, `ng-model`, and `required`) - * collaborate together to achieve the desired result. - * - * `contenteditable` is an HTML5 attribute, which tells the browser to let the element - * contents be edited in place by the user. - * - * We are using the {@link ng.service:$sce $sce} service here and include the {@link ngSanitize $sanitize} - * module to automatically remove "bad" content like inline event listener (e.g. ``). - * However, as we are using `$sce` the model can still decide to provide unsafe content if it marks - * that content using the `$sce` service. - * - * - - [contenteditable] { - border: 1px solid black; - background-color: white; - min-height: 20px; - } - - .ng-invalid { - border: 1px solid red; - } - - - - angular.module('customControl', ['ngSanitize']). - directive('contenteditable', ['$sce', function($sce) { - return { - restrict: 'A', // only activate on element attribute - require: '?ngModel', // get a hold of NgModelController - link: function(scope, element, attrs, ngModel) { - if (!ngModel) return; // do nothing if no ng-model - - // Specify how UI should be updated - ngModel.$render = function() { - element.html($sce.getTrustedHtml(ngModel.$viewValue || '')); - }; - - // Listen for change events to enable binding - element.on('blur keyup change', function() { - scope.$evalAsync(read); - }); - read(); // initialize - - // Write data to the model - function read() { - var html = element.html(); - // When we clear the content editable the browser leaves a
behind - // If strip-br attribute is provided then we strip this out - if (attrs.stripBr && html === '
') { - html = ''; - } - ngModel.$setViewValue(html); - } - } - }; - }]); -
- -
-
Change me!
- Required! -
- -
-
- - it('should data-bind and become invalid', function() { - if (browser.params.browser === 'safari' || browser.params.browser === 'firefox') { - // SafariDriver can't handle contenteditable - // and Firefox driver can't clear contenteditables very well - return; - } - var contentEditable = element(by.css('[contenteditable]')); - var content = 'Change me!'; - - expect(contentEditable.getText()).toEqual(content); - - contentEditable.clear(); - contentEditable.sendKeys(protractor.Key.BACK_SPACE); - expect(contentEditable.getText()).toEqual(''); - expect(contentEditable.getAttribute('class')).toMatch(/ng-invalid-required/); - }); - - *
- * - * - */ - NgModelController.$inject = ['$scope', '$exceptionHandler', '$attrs', '$element', '$parse', '$animate', '$timeout', '$q', '$interpolate']; - - function NgModelController($scope, $exceptionHandler, $attr, $element, $parse, $animate, $timeout, $q, $interpolate) { - this.$viewValue = Number.NaN; - this.$modelValue = Number.NaN; - this.$$rawModelValue = undefined; // stores the parsed modelValue / model set from scope regardless of validity. - this.$validators = {}; - this.$asyncValidators = {}; - this.$parsers = []; - this.$formatters = []; - this.$viewChangeListeners = []; - this.$untouched = true; - this.$touched = false; - this.$pristine = true; - this.$dirty = false; - this.$valid = true; - this.$invalid = false; - this.$error = {}; // keep invalid keys here - this.$$success = {}; // keep valid keys here - this.$pending = undefined; // keep pending keys here - this.$name = $interpolate($attr.name || '', false)($scope); - this.$$parentForm = nullFormCtrl; - this.$options = defaultModelOptions; - this.$$updateEvents = ''; - // Attach the correct context to the event handler function for updateOn - this.$$updateEventHandler = this.$$updateEventHandler.bind(this); - - this.$$parsedNgModel = $parse($attr.ngModel); - this.$$parsedNgModelAssign = this.$$parsedNgModel.assign; - this.$$ngModelGet = this.$$parsedNgModel; - this.$$ngModelSet = this.$$parsedNgModelAssign; - this.$$pendingDebounce = null; - this.$$parserValid = undefined; - this.$$parserName = 'parse'; - - this.$$currentValidationRunId = 0; - - this.$$scope = $scope; - this.$$rootScope = $scope.$root; - this.$$attr = $attr; - this.$$element = $element; - this.$$animate = $animate; - this.$$timeout = $timeout; - this.$$parse = $parse; - this.$$q = $q; - this.$$exceptionHandler = $exceptionHandler; - - setupValidity(this); - setupModelWatcher(this); - } - - NgModelController.prototype = { - $$initGetterSetters: function () { - if (this.$options.getOption('getterSetter')) { - var invokeModelGetter = this.$$parse(this.$$attr.ngModel + '()'), - invokeModelSetter = this.$$parse(this.$$attr.ngModel + '($$$p)'); - - this.$$ngModelGet = function ($scope) { - var modelValue = this.$$parsedNgModel($scope); - if (isFunction(modelValue)) { - modelValue = invokeModelGetter($scope); - } - return modelValue; - }; - this.$$ngModelSet = function ($scope, newValue) { - if (isFunction(this.$$parsedNgModel($scope))) { - invokeModelSetter($scope, { - $$$p: newValue - }); - } else { - this.$$parsedNgModelAssign($scope, newValue); - } - }; - } else if (!this.$$parsedNgModel.assign) { - throw ngModelMinErr('nonassign', 'Expression \'{0}\' is non-assignable. Element: {1}', - this.$$attr.ngModel, startingTag(this.$$element)); - } - }, - - - /** - * @ngdoc method - * @name ngModel.NgModelController#$render - * - * @description - * Called when the view needs to be updated. It is expected that the user of the ng-model - * directive will implement this method. - * - * The `$render()` method is invoked in the following situations: - * - * * `$rollbackViewValue()` is called. If we are rolling back the view value to the last - * committed value then `$render()` is called to update the input control. - * * The value referenced by `ng-model` is changed programmatically and both the `$modelValue` and - * the `$viewValue` are different from last time. - * - * Since `ng-model` does not do a deep watch, `$render()` is only invoked if the values of - * `$modelValue` and `$viewValue` are actually different from their previous values. If `$modelValue` - * or `$viewValue` are objects (rather than a string or number) then `$render()` will not be - * invoked if you only change a property on the objects. - */ - $render: noop, - - /** - * @ngdoc method - * @name ngModel.NgModelController#$isEmpty - * - * @description - * This is called when we need to determine if the value of an input is empty. - * - * For instance, the required directive does this to work out if the input has data or not. - * - * The default `$isEmpty` function checks whether the value is `undefined`, `''`, `null` or `NaN`. - * - * You can override this for input directives whose concept of being empty is different from the - * default. The `checkboxInputType` directive does this because in its case a value of `false` - * implies empty. - * - * @param {*} value The value of the input to check for emptiness. - * @returns {boolean} True if `value` is "empty". - */ - $isEmpty: function (value) { - // eslint-disable-next-line no-self-compare - return isUndefined(value) || value === '' || value === null || value !== value; - }, - - $$updateEmptyClasses: function (value) { - if (this.$isEmpty(value)) { - this.$$animate.removeClass(this.$$element, NOT_EMPTY_CLASS); - this.$$animate.addClass(this.$$element, EMPTY_CLASS); - } else { - this.$$animate.removeClass(this.$$element, EMPTY_CLASS); - this.$$animate.addClass(this.$$element, NOT_EMPTY_CLASS); - } - }, - - /** - * @ngdoc method - * @name ngModel.NgModelController#$setPristine - * - * @description - * Sets the control to its pristine state. - * - * This method can be called to remove the `ng-dirty` class and set the control to its pristine - * state (`ng-pristine` class). A model is considered to be pristine when the control - * has not been changed from when first compiled. - */ - $setPristine: function () { - this.$dirty = false; - this.$pristine = true; - this.$$animate.removeClass(this.$$element, DIRTY_CLASS); - this.$$animate.addClass(this.$$element, PRISTINE_CLASS); - }, - - /** - * @ngdoc method - * @name ngModel.NgModelController#$setDirty - * - * @description - * Sets the control to its dirty state. - * - * This method can be called to remove the `ng-pristine` class and set the control to its dirty - * state (`ng-dirty` class). A model is considered to be dirty when the control has been changed - * from when first compiled. - */ - $setDirty: function () { - this.$dirty = true; - this.$pristine = false; - this.$$animate.removeClass(this.$$element, PRISTINE_CLASS); - this.$$animate.addClass(this.$$element, DIRTY_CLASS); - this.$$parentForm.$setDirty(); - }, - - /** - * @ngdoc method - * @name ngModel.NgModelController#$setUntouched - * - * @description - * Sets the control to its untouched state. - * - * This method can be called to remove the `ng-touched` class and set the control to its - * untouched state (`ng-untouched` class). Upon compilation, a model is set as untouched - * by default, however this function can be used to restore that state if the model has - * already been touched by the user. - */ - $setUntouched: function () { - this.$touched = false; - this.$untouched = true; - this.$$animate.setClass(this.$$element, UNTOUCHED_CLASS, TOUCHED_CLASS); - }, - - /** - * @ngdoc method - * @name ngModel.NgModelController#$setTouched - * - * @description - * Sets the control to its touched state. - * - * This method can be called to remove the `ng-untouched` class and set the control to its - * touched state (`ng-touched` class). A model is considered to be touched when the user has - * first focused the control element and then shifted focus away from the control (blur event). - */ - $setTouched: function () { - this.$touched = true; - this.$untouched = false; - this.$$animate.setClass(this.$$element, TOUCHED_CLASS, UNTOUCHED_CLASS); - }, - - /** - * @ngdoc method - * @name ngModel.NgModelController#$rollbackViewValue - * - * @description - * Cancel an update and reset the input element's value to prevent an update to the `$modelValue`, - * which may be caused by a pending debounced event or because the input is waiting for some - * future event. - * - * If you have an input that uses `ng-model-options` to set up debounced updates or updates that - * depend on special events such as `blur`, there can be a period when the `$viewValue` is out of - * sync with the ngModel's `$modelValue`. - * - * In this case, you can use `$rollbackViewValue()` to manually cancel the debounced / future update - * and reset the input to the last committed view value. - * - * It is also possible that you run into difficulties if you try to update the ngModel's `$modelValue` - * programmatically before these debounced/future events have resolved/occurred, because AngularJS's - * dirty checking mechanism is not able to tell whether the model has actually changed or not. - * - * The `$rollbackViewValue()` method should be called before programmatically changing the model of an - * input which may have such events pending. This is important in order to make sure that the - * input field will be updated with the new model value and any pending operations are cancelled. - * - * @example - * - * - * angular.module('cancel-update-example', []) - * - * .controller('CancelUpdateController', ['$scope', function($scope) { - * $scope.model = {value1: '', value2: ''}; - * - * $scope.setEmpty = function(e, value, rollback) { - * if (e.keyCode === 27) { - * e.preventDefault(); - * if (rollback) { - * $scope.myForm[value].$rollbackViewValue(); - * } - * $scope.model[value] = ''; - * } - * }; - * }]); - * - * - *
- *

Both of these inputs are only updated if they are blurred. Hitting escape should - * empty them. Follow these steps and observe the difference:

- *
    - *
  1. Type something in the input. You will see that the model is not yet updated
  2. - *
  3. Press the Escape key. - *
      - *
    1. In the first example, nothing happens, because the model is already '', and no - * update is detected. If you blur the input, the model will be set to the current view. - *
    2. - *
    3. In the second example, the pending update is cancelled, and the input is set back - * to the last committed view value (''). Blurring the input does nothing. - *
    4. - *
    - *
  4. - *
- * - *
- *
- *

Without $rollbackViewValue():

- * - * value1: "{{ model.value1 }}" - *
- * - *
- *

With $rollbackViewValue():

- * - * value2: "{{ model.value2 }}" - *
- *
- *
- *
- - div { - display: table-cell; - } - div:nth-child(1) { - padding-right: 30px; - } - - - *
- */ - $rollbackViewValue: function () { - this.$$timeout.cancel(this.$$pendingDebounce); - this.$viewValue = this.$$lastCommittedViewValue; - this.$render(); - }, - - /** - * @ngdoc method - * @name ngModel.NgModelController#$validate - * - * @description - * Runs each of the registered validators (first synchronous validators and then - * asynchronous validators). - * If the validity changes to invalid, the model will be set to `undefined`, - * unless {@link ngModelOptions `ngModelOptions.allowInvalid`} is `true`. - * If the validity changes to valid, it will set the model to the last available valid - * `$modelValue`, i.e. either the last parsed value or the last value set from the scope. - */ - $validate: function () { - - // ignore $validate before model is initialized - if (isNumberNaN(this.$modelValue)) { - return; - } - - var viewValue = this.$$lastCommittedViewValue; - // Note: we use the $$rawModelValue as $modelValue might have been - // set to undefined during a view -> model update that found validation - // errors. We can't parse the view here, since that could change - // the model although neither viewValue nor the model on the scope changed - var modelValue = this.$$rawModelValue; - - var prevValid = this.$valid; - var prevModelValue = this.$modelValue; - - var allowInvalid = this.$options.getOption('allowInvalid'); - - var that = this; - this.$$runValidators(modelValue, viewValue, function (allValid) { - // If there was no change in validity, don't update the model - // This prevents changing an invalid modelValue to undefined - if (!allowInvalid && prevValid !== allValid) { - // Note: Don't check this.$valid here, as we could have - // external validators (e.g. calculated on the server), - // that just call $setValidity and need the model value - // to calculate their validity. - that.$modelValue = allValid ? modelValue : undefined; - - if (that.$modelValue !== prevModelValue) { - that.$$writeModelToScope(); - } - } - }); - }, - - $$runValidators: function (modelValue, viewValue, doneCallback) { - this.$$currentValidationRunId++; - var localValidationRunId = this.$$currentValidationRunId; - var that = this; - - // check parser error - if (!processParseErrors()) { - validationDone(false); - return; - } - if (!processSyncValidators()) { - validationDone(false); - return; - } - processAsyncValidators(); - - function processParseErrors() { - var errorKey = that.$$parserName; - - if (isUndefined(that.$$parserValid)) { - setValidity(errorKey, null); - } else { - if (!that.$$parserValid) { - forEach(that.$validators, function (v, name) { - setValidity(name, null); - }); - forEach(that.$asyncValidators, function (v, name) { - setValidity(name, null); - }); - } - - // Set the parse error last, to prevent unsetting it, should a $validators key == parserName - setValidity(errorKey, that.$$parserValid); - return that.$$parserValid; - } - return true; - } - - function processSyncValidators() { - var syncValidatorsValid = true; - forEach(that.$validators, function (validator, name) { - var result = Boolean(validator(modelValue, viewValue)); - syncValidatorsValid = syncValidatorsValid && result; - setValidity(name, result); - }); - if (!syncValidatorsValid) { - forEach(that.$asyncValidators, function (v, name) { - setValidity(name, null); - }); - return false; - } - return true; - } - - function processAsyncValidators() { - var validatorPromises = []; - var allValid = true; - forEach(that.$asyncValidators, function (validator, name) { - var promise = validator(modelValue, viewValue); - if (!isPromiseLike(promise)) { - throw ngModelMinErr('nopromise', - 'Expected asynchronous validator to return a promise but got \'{0}\' instead.', promise); - } - setValidity(name, undefined); - validatorPromises.push(promise.then(function () { - setValidity(name, true); - }, function () { - allValid = false; - setValidity(name, false); - })); - }); - if (!validatorPromises.length) { - validationDone(true); - } else { - that.$$q.all(validatorPromises).then(function () { - validationDone(allValid); - }, noop); - } - } - - function setValidity(name, isValid) { - if (localValidationRunId === that.$$currentValidationRunId) { - that.$setValidity(name, isValid); - } - } - - function validationDone(allValid) { - if (localValidationRunId === that.$$currentValidationRunId) { - - doneCallback(allValid); - } - } - }, - - /** - * @ngdoc method - * @name ngModel.NgModelController#$commitViewValue - * - * @description - * Commit a pending update to the `$modelValue`. - * - * Updates may be pending by a debounced event or because the input is waiting for a some future - * event defined in `ng-model-options`. this method is rarely needed as `NgModelController` - * usually handles calling this in response to input events. - */ - $commitViewValue: function () { - var viewValue = this.$viewValue; - - this.$$timeout.cancel(this.$$pendingDebounce); - - // If the view value has not changed then we should just exit, except in the case where there is - // a native validator on the element. In this case the validation state may have changed even though - // the viewValue has stayed empty. - if (this.$$lastCommittedViewValue === viewValue && (viewValue !== '' || !this.$$hasNativeValidators)) { - return; - } - this.$$updateEmptyClasses(viewValue); - this.$$lastCommittedViewValue = viewValue; - - // change to dirty - if (this.$pristine) { - this.$setDirty(); - } - this.$$parseAndValidate(); - }, - - $$parseAndValidate: function () { - var viewValue = this.$$lastCommittedViewValue; - var modelValue = viewValue; - var that = this; - - this.$$parserValid = isUndefined(modelValue) ? undefined : true; - - // Reset any previous parse error - this.$setValidity(this.$$parserName, null); - this.$$parserName = 'parse'; - - if (this.$$parserValid) { - for (var i = 0; i < this.$parsers.length; i++) { - modelValue = this.$parsers[i](modelValue); - if (isUndefined(modelValue)) { - this.$$parserValid = false; - break; - } - } - } - if (isNumberNaN(this.$modelValue)) { - // this.$modelValue has not been touched yet... - this.$modelValue = this.$$ngModelGet(this.$$scope); - } - var prevModelValue = this.$modelValue; - var allowInvalid = this.$options.getOption('allowInvalid'); - this.$$rawModelValue = modelValue; - - if (allowInvalid) { - this.$modelValue = modelValue; - writeToModelIfNeeded(); - } - - // Pass the $$lastCommittedViewValue here, because the cached viewValue might be out of date. - // This can happen if e.g. $setViewValue is called from inside a parser - this.$$runValidators(modelValue, this.$$lastCommittedViewValue, function (allValid) { - if (!allowInvalid) { - // Note: Don't check this.$valid here, as we could have - // external validators (e.g. calculated on the server), - // that just call $setValidity and need the model value - // to calculate their validity. - that.$modelValue = allValid ? modelValue : undefined; - writeToModelIfNeeded(); - } - }); - - function writeToModelIfNeeded() { - if (that.$modelValue !== prevModelValue) { - that.$$writeModelToScope(); - } - } - }, - - $$writeModelToScope: function () { - this.$$ngModelSet(this.$$scope, this.$modelValue); - forEach(this.$viewChangeListeners, function (listener) { - try { - listener(); - } catch (e) { - // eslint-disable-next-line no-invalid-this - this.$$exceptionHandler(e); - } - }, this); - }, - - /** - * @ngdoc method - * @name ngModel.NgModelController#$setViewValue - * - * @description - * Update the view value. - * - * This method should be called when a control wants to change the view value; typically, - * this is done from within a DOM event handler. For example, the {@link ng.directive:input input} - * directive calls it when the value of the input changes and {@link ng.directive:select select} - * calls it when an option is selected. - * - * When `$setViewValue` is called, the new `value` will be staged for committing through the `$parsers` - * and `$validators` pipelines. If there are no special {@link ngModelOptions} specified then the staged - * value is sent directly for processing through the `$parsers` pipeline. After this, the `$validators` and - * `$asyncValidators` are called and the value is applied to `$modelValue`. - * Finally, the value is set to the **expression** specified in the `ng-model` attribute and - * all the registered change listeners, in the `$viewChangeListeners` list are called. - * - * In case the {@link ng.directive:ngModelOptions ngModelOptions} directive is used with `updateOn` - * and the `default` trigger is not listed, all those actions will remain pending until one of the - * `updateOn` events is triggered on the DOM element. - * All these actions will be debounced if the {@link ng.directive:ngModelOptions ngModelOptions} - * directive is used with a custom debounce for this particular event. - * Note that a `$digest` is only triggered once the `updateOn` events are fired, or if `debounce` - * is specified, once the timer runs out. - * - * When used with standard inputs, the view value will always be a string (which is in some cases - * parsed into another type, such as a `Date` object for `input[date]`.) - * However, custom controls might also pass objects to this method. In this case, we should make - * a copy of the object before passing it to `$setViewValue`. This is because `ngModel` does not - * perform a deep watch of objects, it only looks for a change of identity. If you only change - * the property of the object then ngModel will not realize that the object has changed and - * will not invoke the `$parsers` and `$validators` pipelines. For this reason, you should - * not change properties of the copy once it has been passed to `$setViewValue`. - * Otherwise you may cause the model value on the scope to change incorrectly. - * - *
- * In any case, the value passed to the method should always reflect the current value - * of the control. For example, if you are calling `$setViewValue` for an input element, - * you should pass the input DOM value. Otherwise, the control and the scope model become - * out of sync. It's also important to note that `$setViewValue` does not call `$render` or change - * the control's DOM value in any way. If we want to change the control's DOM value - * programmatically, we should update the `ngModel` scope expression. Its new value will be - * picked up by the model controller, which will run it through the `$formatters`, `$render` it - * to update the DOM, and finally call `$validate` on it. - *
- * - * @param {*} value value from the view. - * @param {string} trigger Event that triggered the update. - */ - $setViewValue: function (value, trigger) { - this.$viewValue = value; - if (this.$options.getOption('updateOnDefault')) { - this.$$debounceViewValueCommit(trigger); - } - }, - - $$debounceViewValueCommit: function (trigger) { - var debounceDelay = this.$options.getOption('debounce'); - - if (isNumber(debounceDelay[trigger])) { - debounceDelay = debounceDelay[trigger]; - } else if (isNumber(debounceDelay['default']) && - this.$options.getOption('updateOn').indexOf(trigger) === -1 - ) { - debounceDelay = debounceDelay['default']; - } else if (isNumber(debounceDelay['*'])) { - debounceDelay = debounceDelay['*']; - } - - this.$$timeout.cancel(this.$$pendingDebounce); - var that = this; - if (debounceDelay > 0) { // this fails if debounceDelay is an object - this.$$pendingDebounce = this.$$timeout(function () { - that.$commitViewValue(); - }, debounceDelay); - } else if (this.$$rootScope.$$phase) { - this.$commitViewValue(); - } else { - this.$$scope.$apply(function () { - that.$commitViewValue(); - }); - } - }, - - /** - * @ngdoc method - * - * @name ngModel.NgModelController#$overrideModelOptions - * - * @description - * - * Override the current model options settings programmatically. - * - * The previous `ModelOptions` value will not be modified. Instead, a - * new `ModelOptions` object will inherit from the previous one overriding - * or inheriting settings that are defined in the given parameter. - * - * See {@link ngModelOptions} for information about what options can be specified - * and how model option inheritance works. - * - *
- * **Note:** this function only affects the options set on the `ngModelController`, - * and not the options on the {@link ngModelOptions} directive from which they might have been - * obtained initially. - *
- * - *
- * **Note:** it is not possible to override the `getterSetter` option. - *
- * - * @param {Object} options a hash of settings to override the previous options - * - */ - $overrideModelOptions: function (options) { - this.$options = this.$options.createChild(options); - this.$$setUpdateOnEvents(); - }, - - /** - * @ngdoc method - * - * @name ngModel.NgModelController#$processModelValue - - * @description - * - * Runs the model -> view pipeline on the current - * {@link ngModel.NgModelController#$modelValue $modelValue}. - * - * The following actions are performed by this method: - * - * - the `$modelValue` is run through the {@link ngModel.NgModelController#$formatters $formatters} - * and the result is set to the {@link ngModel.NgModelController#$viewValue $viewValue} - * - the `ng-empty` or `ng-not-empty` class is set on the element - * - if the `$viewValue` has changed: - * - {@link ngModel.NgModelController#$render $render} is called on the control - * - the {@link ngModel.NgModelController#$validators $validators} are run and - * the validation status is set. - * - * This method is called by ngModel internally when the bound scope value changes. - * Application developers usually do not have to call this function themselves. - * - * This function can be used when the `$viewValue` or the rendered DOM value are not correctly - * formatted and the `$modelValue` must be run through the `$formatters` again. - * - * @example - * Consider a text input with an autocomplete list (for fruit), where the items are - * objects with a name and an id. - * A user enters `ap` and then selects `Apricot` from the list. - * Based on this, the autocomplete widget will call `$setViewValue({name: 'Apricot', id: 443})`, - * but the rendered value will still be `ap`. - * The widget can then call `ctrl.$processModelValue()` to run the model -> view - * pipeline again, which formats the object to the string `Apricot`, - * then updates the `$viewValue`, and finally renders it in the DOM. - * - * - -
-
- Search Fruit: - -
-
- Model:
-
{{selectedFruit | json}}
-
-
-
- - angular.module('inputExample', []) - .controller('inputController', function($scope) { - $scope.items = [ - {name: 'Apricot', id: 443}, - {name: 'Clementine', id: 972}, - {name: 'Durian', id: 169}, - {name: 'Jackfruit', id: 982}, - {name: 'Strawberry', id: 863} - ]; - }) - .component('basicAutocomplete', { - bindings: { - items: '<', - onSelect: '&' - }, - templateUrl: 'autocomplete.html', - controller: function($element, $scope) { - var that = this; - var ngModel; - - that.$postLink = function() { - ngModel = $element.find('input').controller('ngModel'); - - ngModel.$formatters.push(function(value) { - return (value && value.name) || value; - }); - - ngModel.$parsers.push(function(value) { - var match = value; - for (var i = 0; i < that.items.length; i++) { - if (that.items[i].name === value) { - match = that.items[i]; - break; - } - } - - return match; - }); - }; - - that.selectItem = function(item) { - ngModel.$setViewValue(item); - ngModel.$processModelValue(); - that.onSelect({item: item}); - }; - } - }); - - -
- -
    -
  • - -
  • -
-
-
- *
- * - */ - $processModelValue: function () { - var viewValue = this.$$format(); - - if (this.$viewValue !== viewValue) { - this.$$updateEmptyClasses(viewValue); - this.$viewValue = this.$$lastCommittedViewValue = viewValue; - this.$render(); - // It is possible that model and view value have been updated during render - this.$$runValidators(this.$modelValue, this.$viewValue, noop); - } - }, - - /** - * This method is called internally to run the $formatters on the $modelValue - */ - $$format: function () { - var formatters = this.$formatters, - idx = formatters.length; - - var viewValue = this.$modelValue; - while (idx--) { - viewValue = formatters[idx](viewValue); - } - - return viewValue; - }, - - /** - * This method is called internally when the bound scope value changes. - */ - $$setModelValue: function (modelValue) { - this.$modelValue = this.$$rawModelValue = modelValue; - this.$$parserValid = undefined; - this.$processModelValue(); - }, - - $$setUpdateOnEvents: function () { - if (this.$$updateEvents) { - this.$$element.off(this.$$updateEvents, this.$$updateEventHandler); - } - - this.$$updateEvents = this.$options.getOption('updateOn'); - if (this.$$updateEvents) { - this.$$element.on(this.$$updateEvents, this.$$updateEventHandler); - } - }, - - $$updateEventHandler: function (ev) { - this.$$debounceViewValueCommit(ev && ev.type); - } - }; - - function setupModelWatcher(ctrl) { - // model -> value - // Note: we cannot use a normal scope.$watch as we want to detect the following: - // 1. scope value is 'a' - // 2. user enters 'b' - // 3. ng-change kicks in and reverts scope value to 'a' - // -> scope value did not change since the last digest as - // ng-change executes in apply phase - // 4. view should be changed back to 'a' - ctrl.$$scope.$watch(function ngModelWatch(scope) { - var modelValue = ctrl.$$ngModelGet(scope); - - // if scope model value and ngModel value are out of sync - // This cannot be moved to the action function, because it would not catch the - // case where the model is changed in the ngChange function or the model setter - if (modelValue !== ctrl.$modelValue && - // checks for NaN is needed to allow setting the model to NaN when there's an asyncValidator - // eslint-disable-next-line no-self-compare - (ctrl.$modelValue === ctrl.$modelValue || modelValue === modelValue) - ) { - ctrl.$$setModelValue(modelValue); - } - - return modelValue; - }); - } - - /** - * @ngdoc method - * @name ngModel.NgModelController#$setValidity - * - * @description - * Change the validity state, and notify the form. - * - * This method can be called within $parsers/$formatters or a custom validation implementation. - * However, in most cases it should be sufficient to use the `ngModel.$validators` and - * `ngModel.$asyncValidators` collections which will call `$setValidity` automatically. - * - * @param {string} validationErrorKey Name of the validator. The `validationErrorKey` will be assigned - * to either `$error[validationErrorKey]` or `$pending[validationErrorKey]` - * (for unfulfilled `$asyncValidators`), so that it is available for data-binding. - * The `validationErrorKey` should be in camelCase and will get converted into dash-case - * for class name. Example: `myError` will result in `ng-valid-my-error` and `ng-invalid-my-error` - * classes and can be bound to as `{{ someForm.someControl.$error.myError }}`. - * @param {boolean} isValid Whether the current state is valid (true), invalid (false), pending (undefined), - * or skipped (null). Pending is used for unfulfilled `$asyncValidators`. - * Skipped is used by AngularJS when validators do not run because of parse errors and - * when `$asyncValidators` do not run because any of the `$validators` failed. - */ - addSetValidityMethod({ - clazz: NgModelController, - set: function (object, property) { - object[property] = true; - }, - unset: function (object, property) { - delete object[property]; - } - }); - - - /** - * @ngdoc directive - * @name ngModel - * @restrict A - * @priority 1 - * @param {expression} ngModel assignable {@link guide/expression Expression} to bind to. - * - * @description - * The `ngModel` directive binds an `input`,`select`, `textarea` (or custom form control) to a - * property on the scope using {@link ngModel.NgModelController NgModelController}, - * which is created and exposed by this directive. - * - * `ngModel` is responsible for: - * - * - Binding the view into the model, which other directives such as `input`, `textarea` or `select` - * require. - * - Providing validation behavior (i.e. required, number, email, url). - * - Keeping the state of the control (valid/invalid, dirty/pristine, touched/untouched, validation errors). - * - Setting related css classes on the element (`ng-valid`, `ng-invalid`, `ng-dirty`, `ng-pristine`, `ng-touched`, - * `ng-untouched`, `ng-empty`, `ng-not-empty`) including animations. - * - Registering the control with its parent {@link ng.directive:form form}. - * - * Note: `ngModel` will try to bind to the property given by evaluating the expression on the - * current scope. If the property doesn't already exist on this scope, it will be created - * implicitly and added to the scope. - * - * For best practices on using `ngModel`, see: - * - * - [Understanding Scopes](https://github.com/angular/angular.js/wiki/Understanding-Scopes) - * - * For basic examples, how to use `ngModel`, see: - * - * - {@link ng.directive:input input} - * - {@link input[text] text} - * - {@link input[checkbox] checkbox} - * - {@link input[radio] radio} - * - {@link input[number] number} - * - {@link input[email] email} - * - {@link input[url] url} - * - {@link input[date] date} - * - {@link input[datetime-local] datetime-local} - * - {@link input[time] time} - * - {@link input[month] month} - * - {@link input[week] week} - * - {@link ng.directive:select select} - * - {@link ng.directive:textarea textarea} - * - * ## Complex Models (objects or collections) - * - * By default, `ngModel` watches the model by reference, not value. This is important to know when - * binding inputs to models that are objects (e.g. `Date`) or collections (e.g. arrays). If only properties of the - * object or collection change, `ngModel` will not be notified and so the input will not be re-rendered. - * - * The model must be assigned an entirely new object or collection before a re-rendering will occur. - * - * Some directives have options that will cause them to use a custom `$watchCollection` on the model expression - * - for example, `ngOptions` will do so when a `track by` clause is included in the comprehension expression or - * if the select is given the `multiple` attribute. - * - * The `$watchCollection()` method only does a shallow comparison, meaning that changing properties deeper than the - * first level of the object (or only changing the properties of an item in the collection if it's an array) will still - * not trigger a re-rendering of the model. - * - * ## CSS classes - * The following CSS classes are added and removed on the associated input/select/textarea element - * depending on the validity of the model. - * - * - `ng-valid`: the model is valid - * - `ng-invalid`: the model is invalid - * - `ng-valid-[key]`: for each valid key added by `$setValidity` - * - `ng-invalid-[key]`: for each invalid key added by `$setValidity` - * - `ng-pristine`: the control hasn't been interacted with yet - * - `ng-dirty`: the control has been interacted with - * - `ng-touched`: the control has been blurred - * - `ng-untouched`: the control hasn't been blurred - * - `ng-pending`: any `$asyncValidators` are unfulfilled - * - `ng-empty`: the view does not contain a value or the value is deemed "empty", as defined - * by the {@link ngModel.NgModelController#$isEmpty} method - * - `ng-not-empty`: the view contains a non-empty value - * - * Keep in mind that ngAnimate can detect each of these classes when added and removed. - * - * @animations - * Animations within models are triggered when any of the associated CSS classes are added and removed - * on the input element which is attached to the model. These classes include: `.ng-pristine`, `.ng-dirty`, - * `.ng-invalid` and `.ng-valid` as well as any other validations that are performed on the model itself. - * The animations that are triggered within ngModel are similar to how they work in ngClass and - * animations can be hooked into using CSS transitions, keyframes as well as JS animations. - * - * The following example shows a simple way to utilize CSS transitions to style an input element - * that has been rendered as invalid after it has been validated: - * - *
-     * //be sure to include ngAnimate as a module to hook into more
-     * //advanced animations
-     * .my-input {
-     *   transition:0.5s linear all;
-     *   background: white;
-     * }
-     * .my-input.ng-invalid {
-     *   background: red;
-     *   color:white;
-     * }
-     * 
- * - * @example - * ### Basic Usage - * - - - -

- Update input to see transitions when valid/invalid. - Integer is a valid value. -

-
- -
-
- *
- * - * @example - * ### Binding to a getter/setter - * - * Sometimes it's helpful to bind `ngModel` to a getter/setter function. A getter/setter is a - * function that returns a representation of the model when called with zero arguments, and sets - * the internal state of a model when called with an argument. It's sometimes useful to use this - * for models that have an internal representation that's different from what the model exposes - * to the view. - * - *
- * **Best Practice:** It's best to keep getters fast because AngularJS is likely to call them more - * frequently than other parts of your code. - *
- * - * You use this behavior by adding `ng-model-options="{ getterSetter: true }"` to an element that - * has `ng-model` attached to it. You can also add `ng-model-options="{ getterSetter: true }"` to - * a `
`, which will enable this behavior for all ``s within it. See - * {@link ng.directive:ngModelOptions `ngModelOptions`} for more. - * - * The following example shows how to use `ngModel` with a getter/setter: - * - * @example - * - -
- - - -
user.name = 
-
-
- - angular.module('getterSetterExample', []) - .controller('ExampleController', ['$scope', function($scope) { - var _name = 'Brian'; - $scope.user = { - name: function(newName) { - // Note that newName can be undefined for two reasons: - // 1. Because it is called as a getter and thus called with no arguments - // 2. Because the property should actually be set to undefined. This happens e.g. if the - // input is invalid - return arguments.length ? (_name = newName) : _name; - } - }; - }]); - - *
- */ - var ngModelDirective = ['$rootScope', function ($rootScope) { - return { - restrict: 'A', - require: ['ngModel', '^?form', '^?ngModelOptions'], - controller: NgModelController, - // Prelink needs to run before any input directive - // so that we can set the NgModelOptions in NgModelController - // before anyone else uses it. - priority: 1, - compile: function ngModelCompile(element) { - // Setup initial state of the control - element.addClass(PRISTINE_CLASS).addClass(UNTOUCHED_CLASS).addClass(VALID_CLASS); - - return { - pre: function ngModelPreLink(scope, element, attr, ctrls) { - var modelCtrl = ctrls[0], - formCtrl = ctrls[1] || modelCtrl.$$parentForm, - optionsCtrl = ctrls[2]; - - if (optionsCtrl) { - modelCtrl.$options = optionsCtrl.$options; - } - - modelCtrl.$$initGetterSetters(); - - // notify others, especially parent forms - formCtrl.$addControl(modelCtrl); - - attr.$observe('name', function (newValue) { - if (modelCtrl.$name !== newValue) { - modelCtrl.$$parentForm.$$renameControl(modelCtrl, newValue); - } - }); - - scope.$on('$destroy', function () { - modelCtrl.$$parentForm.$removeControl(modelCtrl); - }); - }, - post: function ngModelPostLink(scope, element, attr, ctrls) { - var modelCtrl = ctrls[0]; - modelCtrl.$$setUpdateOnEvents(); - - function setTouched() { - modelCtrl.$setTouched(); - } - - element.on('blur', function () { - if (modelCtrl.$touched) return; - - if ($rootScope.$$phase) { - scope.$evalAsync(setTouched); - } else { - scope.$apply(setTouched); - } - }); - } - }; - } - }; - }]; - - /* exported defaultModelOptions */ - var defaultModelOptions; - var DEFAULT_REGEXP = /(\s+|^)default(\s+|$)/; - - /** - * @ngdoc type - * @name ModelOptions - * @description - * A container for the options set by the {@link ngModelOptions} directive - */ - function ModelOptions(options) { - this.$$options = options; - } - - ModelOptions.prototype = { - - /** - * @ngdoc method - * @name ModelOptions#getOption - * @param {string} name the name of the option to retrieve - * @returns {*} the value of the option - * @description - * Returns the value of the given option - */ - getOption: function (name) { - return this.$$options[name]; - }, - - /** - * @ngdoc method - * @name ModelOptions#createChild - * @param {Object} options a hash of options for the new child that will override the parent's options - * @return {ModelOptions} a new `ModelOptions` object initialized with the given options. - */ - createChild: function (options) { - var inheritAll = false; - - // make a shallow copy - options = extend({}, options); - - // Inherit options from the parent if specified by the value `"$inherit"` - forEach(options, /** @this */ function (option, key) { - if (option === '$inherit') { - if (key === '*') { - inheritAll = true; - } else { - options[key] = this.$$options[key]; - // `updateOn` is special so we must also inherit the `updateOnDefault` option - if (key === 'updateOn') { - options.updateOnDefault = this.$$options.updateOnDefault; - } - } - } else { - if (key === 'updateOn') { - // If the `updateOn` property contains the `default` event then we have to remove - // it from the event list and set the `updateOnDefault` flag. - options.updateOnDefault = false; - options[key] = trim(option.replace(DEFAULT_REGEXP, function () { - options.updateOnDefault = true; - return ' '; - })); - } - } - }, this); - - if (inheritAll) { - // We have a property of the form: `"*": "$inherit"` - delete options['*']; - defaults(options, this.$$options); - } - - // Finally add in any missing defaults - defaults(options, defaultModelOptions.$$options); - - return new ModelOptions(options); - } - }; - - - defaultModelOptions = new ModelOptions({ - updateOn: '', - updateOnDefault: true, - debounce: 0, - getterSetter: false, - allowInvalid: false, - timezone: null - }); - - - /** - * @ngdoc directive - * @name ngModelOptions - * @restrict A - * @priority 10 - * - * @description - * This directive allows you to modify the behaviour of {@link ngModel} directives within your - * application. You can specify an `ngModelOptions` directive on any element. All {@link ngModel} - * directives will use the options of their nearest `ngModelOptions` ancestor. - * - * The `ngModelOptions` settings are found by evaluating the value of the attribute directive as - * an AngularJS expression. This expression should evaluate to an object, whose properties contain - * the settings. For example: `
- *
- * - *
- *
- * ``` - * - * the `input` element will have the following settings - * - * ```js - * { allowInvalid: true, updateOn: 'default', debounce: 0 } - * ``` - * - * Notice that the `debounce` setting was not inherited and used the default value instead. - * - * You can specify that all undefined settings are automatically inherited from an ancestor by - * including a property with key of `"*"` and value of `"$inherit"`. - * - * For example given the following fragment of HTML - * - * - * ```html - *
- *
- * - *
- *
- * ``` - * - * the `input` element will have the following settings - * - * ```js - * { allowInvalid: true, updateOn: 'default', debounce: 200 } - * ``` - * - * Notice that the `debounce` setting now inherits the value from the outer `
` element. - * - * If you are creating a reusable component then you should be careful when using `"*": "$inherit"` - * since you may inadvertently inherit a setting in the future that changes the behavior of your component. - * - * - * ## Triggering and debouncing model updates - * - * The `updateOn` and `debounce` properties allow you to specify a custom list of events that will - * trigger a model update and/or a debouncing delay so that the actual update only takes place when - * a timer expires; this timer will be reset after another change takes place. - * - * Given the nature of `ngModelOptions`, the value displayed inside input fields in the view might - * be different from the value in the actual model. This means that if you update the model you - * should also invoke {@link ngModel.NgModelController#$rollbackViewValue} on the relevant input field in - * order to make sure it is synchronized with the model and that any debounced action is canceled. - * - * The easiest way to reference the control's {@link ngModel.NgModelController#$rollbackViewValue} - * method is by making sure the input is placed inside a form that has a `name` attribute. This is - * important because `form` controllers are published to the related scope under the name in their - * `name` attribute. - * - * Any pending changes will take place immediately when an enclosing form is submitted via the - * `submit` event. Note that `ngClick` events will occur before the model is updated. Use `ngSubmit` - * to have access to the updated model. - * - * ### Overriding immediate updates - * - * The following example shows how to override immediate updates. Changes on the inputs within the - * form will update the model only when the control loses focus (blur event). If `escape` key is - * pressed while the input field is focused, the value is reset to the value in the current model. - * - * - * - *
- *
- *
- *
- *
- *
user.name = 
- *
- *
- * - * angular.module('optionsExample', []) - * .controller('ExampleController', ['$scope', function($scope) { - * $scope.user = { name: 'say', data: '' }; - * - * $scope.cancel = function(e) { - * if (e.keyCode === 27) { - * $scope.userForm.userName.$rollbackViewValue(); - * } - * }; - * }]); - * - * - * var model = element(by.binding('user.name')); - * var input = element(by.model('user.name')); - * var other = element(by.model('user.data')); - * - * it('should allow custom events', function() { - * input.sendKeys(' hello'); - * input.click(); - * expect(model.getText()).toEqual('say'); - * other.click(); - * expect(model.getText()).toEqual('say hello'); - * }); - * - * it('should $rollbackViewValue when model changes', function() { - * input.sendKeys(' hello'); - * expect(input.getAttribute('value')).toEqual('say hello'); - * input.sendKeys(protractor.Key.ESCAPE); - * expect(input.getAttribute('value')).toEqual('say'); - * other.click(); - * expect(model.getText()).toEqual('say'); - * }); - * - *
- * - * ### Debouncing updates - * - * The next example shows how to debounce model changes. Model will be updated only 1 sec after last change. - * If the `Clear` button is pressed, any debounced action is canceled and the value becomes empty. - * - * - * - *
- *
- * Name: - * - *
- *
- *
user.name = 
- *
- *
- * - * angular.module('optionsExample', []) - * .controller('ExampleController', ['$scope', function($scope) { - * $scope.user = { name: 'say' }; - * }]); - * - *
- * - * ### Default events, extra triggers, and catch-all debounce values - * - * This example shows the relationship between "default" update events and - * additional `updateOn` triggers. - * - * `default` events are those that are bound to the control, and when fired, update the `$viewValue` - * via {@link ngModel.NgModelController#$setViewValue $setViewValue}. Every event that is not listed - * in `updateOn` is considered a "default" event, since different control types have different - * default events. - * - * The control in this example updates by "default", "click", and "blur", with different `debounce` - * values. You can see that "click" doesn't have an individual `debounce` value - - * therefore it uses the `*` debounce value. - * - * There is also a button that calls {@link ngModel.NgModelController#$setViewValue $setViewValue} - * directly with a "custom" event. Since "custom" is not defined in the `updateOn` list, - * it is considered a "default" event and will update the - * control if "default" is defined in `updateOn`, and will receive the "default" debounce value. - * Note that this is just to illustrate how custom controls would possibly call `$setViewValue`. - * - * You can change the `updateOn` and `debounce` configuration to test different scenarios. This - * is done with {@link ngModel.NgModelController#$overrideModelOptions $overrideModelOptions}. - * - - - - - - angular.module('optionsExample', []) - .component('modelUpdateDemo', { - templateUrl: 'template.html', - controller: function() { - this.name = 'Chinua'; - - this.options = { - updateOn: 'default blur click', - debounce: { - default: 2000, - blur: 0, - '*': 1000 - } - }; - - this.updateEvents = function() { - var eventList = this.options.updateOn.split(' '); - eventList.push('*'); - var events = {}; - - for (var i = 0; i < eventList.length; i++) { - events[eventList[i]] = this.options.debounce[eventList[i]]; - } - - this.events = events; - }; - - this.updateOptions = function() { - var options = angular.extend(this.options, { - updateOn: Object.keys(this.events).join(' ').replace('*', ''), - debounce: this.events - }); - - this.form.input.$overrideModelOptions(options); - }; - - // Initialize the event form - this.updateEvents(); - } - }); - - -
- Input: -
- Model: {{$ctrl.name}} -
- - -
-
- updateOn
- - - - - - - - - - - -
OptionDebounce value
{{key}}
- -
- -
-
-
- * - * - * ## Model updates and validation - * - * The default behaviour in `ngModel` is that the model value is set to `undefined` when the - * validation determines that the value is invalid. By setting the `allowInvalid` property to true, - * the model will still be updated even if the value is invalid. - * - * - * ## Connecting to the scope - * - * By setting the `getterSetter` property to true you are telling ngModel that the `ngModel` expression - * on the scope refers to a "getter/setter" function rather than the value itself. - * - * The following example shows how to bind to getter/setters: - * - * - * - *
- *
- * - *
- *
user.name = 
- *
- *
- * - * angular.module('getterSetterExample', []) - * .controller('ExampleController', ['$scope', function($scope) { - * var _name = 'Brian'; - * $scope.user = { - * name: function(newName) { - * return angular.isDefined(newName) ? (_name = newName) : _name; - * } - * }; - * }]); - * - *
- * - * - * ## Programmatically changing options - * - * The `ngModelOptions` expression is only evaluated once when the directive is linked; it is not - * watched for changes. However, it is possible to override the options on a single - * {@link ngModel.NgModelController} instance with - * {@link ngModel.NgModelController#$overrideModelOptions `NgModelController#$overrideModelOptions()`}. - * See also the example for - * {@link ngModelOptions#default-events-extra-triggers-and-catch-all-debounce-values - * Default events, extra triggers, and catch-all debounce values}. - * - * - * ## Specifying timezones - * - * You can specify the timezone that date/time input directives expect by providing its name in the - * `timezone` property. - * - * - * ## Formatting the value of `time` and `datetime-local` - * - * With the options `timeSecondsFormat` and `timeStripZeroSeconds` it is possible to adjust the value - * that is displayed in the control. Note that browsers may apply their own formatting - * in the user interface. - * - - - - - - angular.module('timeExample', []) - .component('timeExample', { - templateUrl: 'timeExample.html', - controller: function() { - this.time = new Date(1970, 0, 1, 14, 57, 0); - - this.options = { - timeSecondsFormat: 'ss', - timeStripZeroSeconds: true - }; - - this.optionChange = function() { - this.timeForm.timeFormatted.$overrideModelOptions(this.options); - this.time = new Date(this.time); - }; - } - }); - - -
- Default: -
- With options: - -
- - Options:
- timeSecondsFormat: - -
- timeStripZeroSeconds: - -
-
- *
- * - * @param {Object} ngModelOptions options to apply to {@link ngModel} directives on this element and - * and its descendents. - * - * **General options**: - * - * - `updateOn`: string specifying which event should the input be bound to. You can set several - * events using an space delimited list. There is a special event called `default` that - * matches the default events belonging to the control. These are the events that are bound to - * the control, and when fired, update the `$viewValue` via `$setViewValue`. - * - * `ngModelOptions` considers every event that is not listed in `updateOn` a "default" event, - * since different control types use different default events. - * - * See also the section {@link ngModelOptions#triggering-and-debouncing-model-updates - * Triggering and debouncing model updates}. - * - * - `debounce`: integer value which contains the debounce model update value in milliseconds. A - * value of 0 triggers an immediate update. If an object is supplied instead, you can specify a - * custom value for each event. For example: - * ``` - * ng-model-options="{ - * updateOn: 'default blur', - * debounce: { 'default': 500, 'blur': 0 } - * }" - * ``` - * You can use the `*` key to specify a debounce value that applies to all events that are not - * specifically listed. In the following example, `mouseup` would have a debounce delay of 1000: - * ``` - * ng-model-options="{ - * updateOn: 'default blur mouseup', - * debounce: { 'default': 500, 'blur': 0, '*': 1000 } - * }" - * ``` - * - `allowInvalid`: boolean value which indicates that the model can be set with values that did - * not validate correctly instead of the default behavior of setting the model to undefined. - * - `getterSetter`: boolean value which determines whether or not to treat functions bound to - * `ngModel` as getters/setters. - * - * - * **Input-type specific options**: - * - * - `timezone`: Defines the timezone to be used to read/write the `Date` instance in the model for - * ``, ``, ... . It understands UTC/GMT and the - * continental US time zone abbreviations, but for general use, use a time zone offset, for - * example, `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian) - * If not specified, the timezone of the browser will be used. - * Note that changing the timezone will have no effect on the current date, and is only applied after - * the next input / model change. - * - * - `timeSecondsFormat`: Defines if the `time` and `datetime-local` types should show seconds and - * milliseconds. The option follows the format string of {@link date date filter}. - * By default, the options is `undefined` which is equal to `'ss.sss'` (seconds and milliseconds). - * The other options are `'ss'` (strips milliseconds), and `''` (empty string), which strips both - * seconds and milliseconds. - * Note that browsers that support `time` and `datetime-local` require the hour and minutes - * part of the time string, and may show the value differently in the user interface. - * {@link ngModelOptions#formatting-the-value-of-time-and-datetime-local- See the example}. - * - * - `timeStripZeroSeconds`: Defines if the `time` and `datetime-local` types should strip the - * seconds and milliseconds from the formatted value if they are zero. This option is applied - * after `timeSecondsFormat`. - * This option can be used to make the formatting consistent over different browsers, as some - * browsers with support for `time` will natively hide the milliseconds and - * seconds if they are zero, but others won't, and browsers that don't implement these input - * types will always show the full string. - * {@link ngModelOptions#formatting-the-value-of-time-and-datetime-local- See the example}. - * - */ - var ngModelOptionsDirective = function () { - NgModelOptionsController.$inject = ['$attrs', '$scope']; - - function NgModelOptionsController($attrs, $scope) { - this.$$attrs = $attrs; - this.$$scope = $scope; - } - NgModelOptionsController.prototype = { - $onInit: function () { - var parentOptions = this.parentCtrl ? this.parentCtrl.$options : defaultModelOptions; - var modelOptionsDefinition = this.$$scope.$eval(this.$$attrs.ngModelOptions); - - this.$options = parentOptions.createChild(modelOptionsDefinition); - } - }; - - return { - restrict: 'A', - // ngModelOptions needs to run before ngModel and input directives - priority: 10, - require: { - parentCtrl: '?^^ngModelOptions' - }, - bindToController: true, - controller: NgModelOptionsController - }; - }; - - - // shallow copy over values from `src` that are not already specified on `dst` - function defaults(dst, src) { - forEach(src, function (value, key) { - if (!isDefined(dst[key])) { - dst[key] = value; - } - }); - } - - /** - * @ngdoc directive - * @name ngNonBindable - * @restrict AC - * @priority 1000 - * @element ANY - * - * @description - * The `ngNonBindable` directive tells AngularJS not to compile or bind the contents of the current - * DOM element, including directives on the element itself that have a lower priority than - * `ngNonBindable`. This is useful if the element contains what appears to be AngularJS directives - * and bindings but which should be ignored by AngularJS. This could be the case if you have a site - * that displays snippets of code, for instance. - * - * @example - * In this example there are two locations where a simple interpolation binding (`{{}}`) is present, - * but the one wrapped in `ngNonBindable` is left alone. - * - - -
Normal: {{1 + 2}}
-
Ignored: {{1 + 2}}
-
- - it('should check ng-non-bindable', function() { - expect(element(by.binding('1 + 2')).getText()).toContain('3'); - expect(element.all(by.css('div')).last().getText()).toMatch(/1 \+ 2/); - }); - -
- */ - var ngNonBindableDirective = ngDirective({ - terminal: true, - priority: 1000 - }); - - /* exported ngOptionsDirective */ - - /* global jqLiteRemove */ - - var ngOptionsMinErr = minErr('ngOptions'); - - /** - * @ngdoc directive - * @name ngOptions - * @restrict A - * - * @description - * - * The `ngOptions` attribute can be used to dynamically generate a list of `` - * DOM element. - * * `disable`: The result of this expression will be used to disable the rendered `