diff --git a/.codacy.yml b/.codacy.yml index 87fe5a3a..0549c8f5 100644 --- a/.codacy.yml +++ b/.codacy.yml @@ -1,3 +1,3 @@ exclude_paths: - '**/3rdparty/**' - - '**/engine/js/cvat.js' + - '**/engine/js/cvat-core.min.js' diff --git a/.eslintrc.js b/.eslintrc.js index 7c728adb..c8663998 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -24,7 +24,7 @@ "eslint:recommended", "plugin:security/recommended", "plugin:no-unsanitized/DOM", - "airbnb", + "airbnb-base", ], "rules": { "no-await-in-loop": [0], diff --git a/.gitignore b/.gitignore index 5cde8fce..28c53d5d 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,6 @@ node_modules # Ignore temporary files docker-compose.override.yml -/.vscode __pycache__ *.pyc ._* diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 00000000..effa6735 --- /dev/null +++ b/.pylintrc @@ -0,0 +1,420 @@ +[MASTER] + +# Specify a configuration file. +#rcfile= + +# Python code to execute, usually for sys.path manipulation such as +# pygtk.require(). +#init-hook= + +# Add files or directories to the blacklist. They should be base names, not +# paths. +ignore=CVS + +# Add files or directories matching the regex patterns to the blacklist. The +# regex matches against base names, not paths. +ignore-patterns= + +# Pickle collected data for later comparisons. +persistent=yes + +# List of plugins (as comma separated values of python modules names) to load, +# usually to register additional checkers. +load-plugins= + +# Use multiple processes to speed up Pylint. +jobs=1 + +# Allow loading of arbitrary C extensions. Extensions are imported into the +# active Python interpreter and may run arbitrary code. +unsafe-load-any-extension=no + +# A comma-separated list of package or module names from where C extensions may +# be loaded. Extensions are loading into the active Python interpreter and may +# run arbitrary code +extension-pkg-whitelist= + +# Allow optimization of some AST trees. This will activate a peephole AST +# optimizer, which will apply various small optimizations. For instance, it can +# be used to obtain the result of joining multiple strings with the addition +# operator. Joining a lot of strings can lead to a maximum recursion error in +# Pylint and this flag can prevent that. It has one side effect, the resulting +# AST will be different than the one from reality. This option is deprecated +# and it will be removed in Pylint 2.0. +optimize-ast=no + + +[MESSAGES CONTROL] + +# Only show warnings with the listed confidence levels. Leave empty to show +# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED +confidence= + +# Enable the message, report, category or checker with the given id(s). You can +# either give multiple identifier separated by comma (,) or put this option +# multiple time (only on the command line, not in the configuration file where +# it should appear only once). See also the "--disable" option for examples. +disable=all +enable= E0001,E0100,E0101,E0102,E0103,E0104,E0105,E0106,E0107,E0110, + E0113,E0114,E0115,E0116,E0117,E0108,E0202,E0203,E0211,E0236, + E0238,E0239,E0240,E0241,E0301,E0302,E0601,E0603,E0604,E0701, + E0702,E0703,E0704,E0710,E0711,E0712,E1003,E1102,E1111,E0112, + E1120,E1121,E1123,E1124,E1125,E1126,E1127,E1132,E1200,E1201, + E1205,E1206,E1300,E1301,E1302,E1303,E1304,E1305,E1306, + C0123,C0200,C0303,C1001, + W0101,W0102,W0104,W0105,W0106,W0107,W0108,W0109,W0110,W0120, + W0122,W0124,W0150,W0199,W0221,W0222,W0233,W0404,W0410,W0601, + W0602,W0604,W0611,W0612,W0622,W0623,W0702,W0705,W0711,W1300, + W1301,W1302,W1303,,W1305,W1306,W1307 + R0102,R0201,R0202,R0203 + + +# Disable the message, report, category or checker with the given id(s). You +# can either give multiple identifiers separated by comma (,) or put this +# option multiple times (only on the command line, not in the configuration +# file where it should appear only once).You can also use "--disable=all" to +# disable everything first and then reenable specific checks. For example, if +# you want to run only the similarities checker, you can use "--disable=all +# --enable=similarities". If you want to run only the classes checker, but have +# no Warning level messages displayed, use"--disable=all --enable=classes +# --disable=W" +#disable=old-octal-literal,basestring-builtin,no-absolute-import,old-division,coerce-method,long-suffix,reload-builtin,unichr-builtin,indexing-exception,raising-string,dict-iter-method,metaclass-assignment,filter-builtin-not-iterating,import-star-module-level,next-method-called,cmp-method,raw_input-builtin,old-raise-syntax,cmp-builtin,apply-builtin,getslice-method,input-builtin,backtick,coerce-builtin,range-builtin-not-iterating,xrange-builtin,using-cmp-argument,buffer-builtin,hex-method,execfile-builtin,unpacking-in-except,standarderror-builtin,round-builtin,nonzero-method,unicode-builtin,reduce-builtin,file-builtin,dict-view-method,old-ne-operator,print-statement,suppressed-message,oct-method,useless-suppression,delslice-method,long-builtin,setslice-method,zip-builtin-not-iterating,map-builtin-not-iterating,intern-builtin,parameter-unpacking + + +[REPORTS] + +# Set the output format. Available formats are text, parseable, colorized, msvs +# (visual studio) and html. You can also give a reporter class, eg +# mypackage.mymodule.MyReporterClass. +output-format=text + +# Put messages in a separate file for each module / package specified on the +# command line instead of printing them on stdout. Reports (if any) will be +# written in a file name "pylint_global.[txt|html]". This option is deprecated +# and it will be removed in Pylint 2.0. +files-output=no + +# Tells whether to display a full report or only the messages +reports=yes + +# Python expression which should return a note less than 10 (10 is the highest +# note). You have access to the variables errors warning, statement which +# respectively contain the number of errors / warnings messages and the total +# number of statements analyzed. This is used by the global evaluation report +# (RP0004). +evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) + +# Template used to display messages. This is a python new-style format string +# used to format the message information. See doc for all details +#msg-template= + + +[BASIC] + +# Good variable names which should always be accepted, separated by a comma +good-names=i,j,k,ex,Run,_ + +# Bad variable names which should always be refused, separated by a comma +bad-names=foo,bar,baz,toto,tutu,tata + +# Colon-delimited sets of names that determine each other's naming style when +# the name regexes allow several styles. +name-group= + +# Include a hint for the correct naming format with invalid-name +include-naming-hint=no + +# List of decorators that produce properties, such as abc.abstractproperty. Add +# to this list to register other decorators that produce valid properties. +property-classes=abc.abstractproperty + +# Regular expression matching correct constant names +const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ + +# Naming hint for constant names +const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$ + +# Regular expression matching correct class names +class-rgx=[A-Z_][a-zA-Z0-9]+$ + +# Naming hint for class names +class-name-hint=[A-Z_][a-zA-Z0-9]+$ + +# Regular expression matching correct argument names +argument-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Naming hint for argument names +argument-name-hint=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression matching correct variable names +variable-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Naming hint for variable names +variable-name-hint=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression matching correct class attribute names +class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ + +# Naming hint for class attribute names +class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ + +# Regular expression matching correct method names +method-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Naming hint for method names +method-name-hint=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression matching correct module names +module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ + +# Naming hint for module names +module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ + +# Regular expression matching correct function names +function-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Naming hint for function names +function-name-hint=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression matching correct attribute names +attr-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Naming hint for attribute names +attr-name-hint=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression matching correct inline iteration names +inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ + +# Naming hint for inline iteration names +inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$ + +# Regular expression which should only match function or class names that do +# not require a docstring. +no-docstring-rgx=^_ + +# Minimum line length for functions/classes that require docstrings, shorter +# ones are exempt. +docstring-min-length=-1 + + +[ELIF] + +# Maximum number of nested blocks for function / method body +max-nested-blocks=5 + + +[FORMAT] + +# Maximum number of characters on a single line. +max-line-length=100 + +# Regexp for a line that is allowed to be longer than the limit. +ignore-long-lines=^\s*(# )??$ + +# Allow the body of an if to be on the same line as the test if there is no +# else. +single-line-if-stmt=no + +# List of optional constructs for which whitespace checking is disabled. `dict- +# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}. +# `trailing-comma` allows a space between comma and closing bracket: (a, ). +# `empty-line` allows space-only lines. +no-space-check=trailing-comma,dict-separator + +# Maximum number of lines in a module +max-module-lines=1000 + +# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 +# tab). +indent-string=' ' + +# Number of spaces of indent required inside a hanging or continued line. +indent-after-paren=4 + +# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. +expected-line-ending-format= + + +[LOGGING] + +# Logging modules to check that the string format arguments are in logging +# function parameter format +logging-modules=logging + + +[MISCELLANEOUS] + +# List of note tags to take in consideration, separated by a comma. +notes=FIXME,XXX,TODO + + +[SIMILARITIES] + +# Minimum lines number of a similarity. +min-similarity-lines=4 + +# Ignore comments when computing similarities. +ignore-comments=yes + +# Ignore docstrings when computing similarities. +ignore-docstrings=yes + +# Ignore imports when computing similarities. +ignore-imports=no + + +[SPELLING] + +# Spelling dictionary name. Available dictionaries: none. To make it working +# install python-enchant package. +spelling-dict= + +# List of comma separated words that should not be checked. +spelling-ignore-words= + +# A path to a file that contains private dictionary; one word per line. +spelling-private-dict-file= + +# Tells whether to store unknown words to indicated private dictionary in +# --spelling-private-dict-file option instead of raising a message. +spelling-store-unknown-words=no + + +[TYPECHECK] + +# Tells whether missing members accessed in mixin class should be ignored. A +# mixin class is detected if its name ends with "mixin" (case insensitive). +ignore-mixin-members=yes + +# List of module names for which member attributes should not be checked +# (useful for modules/projects where namespaces are manipulated during runtime +# and thus existing member attributes cannot be deduced by static analysis. It +# supports qualified module names, as well as Unix pattern matching. +ignored-modules= + +# List of class names for which member attributes should not be checked (useful +# for classes with dynamically set attributes). This supports the use of +# qualified names. +ignored-classes=optparse.Values,thread._local,_thread._local + +# List of members which are set dynamically and missed by pylint inference +# system, and so shouldn't trigger E1101 when accessed. Python regular +# expressions are accepted. +generated-members= + +# List of decorators that produce context managers, such as +# contextlib.contextmanager. Add to this list to register other decorators that +# produce valid context managers. +contextmanager-decorators=contextlib.contextmanager + + +[VARIABLES] + +# Tells whether we should check for unused import in __init__ files. +init-import=no + +# A regular expression matching the name of dummy variables (i.e. expectedly +# not used). +dummy-variables-rgx=(_+[a-zA-Z0-9]*?$)|dummy + +# List of additional names supposed to be defined in builtins. Remember that +# you should avoid to define new builtins when possible. +additional-builtins= + +# List of strings which can identify a callback function by name. A callback +# name must start or end with one of those strings. +callbacks=cb_,_cb + +# List of qualified module names which can have objects that can redefine +# builtins. +redefining-builtins-modules=six.moves,future.builtins + + +[CLASSES] + +# List of method names used to declare (i.e. assign) instance attributes. +defining-attr-methods=__init__,__new__,setUp + +# List of valid names for the first argument in a class method. +valid-classmethod-first-arg=cls + +# List of valid names for the first argument in a metaclass class method. +valid-metaclass-classmethod-first-arg=mcs + +# List of member names, which should be excluded from the protected access +# warning. +exclude-protected=_asdict,_fields,_replace,_source,_make + + +[DESIGN] + +# Maximum number of arguments for function / method +max-args=5 + +# Argument names that match this expression will be ignored. Default to name +# with leading underscore +ignored-argument-names=_.* + +# Maximum number of locals for function / method body +max-locals=15 + +# Maximum number of return / yield for function / method body +max-returns=6 + +# Maximum number of branch for function / method body +max-branches=12 + +# Maximum number of statements in function / method body +max-statements=50 + +# Maximum number of parents for a class (see R0901). +max-parents=7 + +# Maximum number of attributes for a class (see R0902). +max-attributes=7 + +# Minimum number of public methods for a class (see R0903). +min-public-methods=2 + +# Maximum number of public methods for a class (see R0904). +max-public-methods=20 + +# Maximum number of boolean expressions in a if statement +max-bool-expr=5 + + +[IMPORTS] + +# Deprecated modules which should not be used, separated by a comma +deprecated-modules=optparse + +# Create a graph of every (i.e. internal and external) dependencies in the +# given file (report RP0402 must not be disabled) +import-graph= + +# Create a graph of external dependencies in the given file (report RP0402 must +# not be disabled) +ext-import-graph= + +# Create a graph of internal dependencies in the given file (report RP0402 must +# not be disabled) +int-import-graph= + +# Force import order to recognize a module as part of the standard +# compatibility libraries. +known-standard-library= + +# Force import order to recognize a module as part of a third party library. +known-third-party=enchant + +# Analyse import fallback blocks. This can be used to support both Python 2 and +# 3 compatible code, which means that the block might have code that exists +# only in one or another interpreter, leading to false positives when analysed. +analyse-fallback-blocks=no + + +[EXCEPTIONS] + +# Exceptions that will emit a warning when being caught. Defaults to +# "Exception" +overgeneral-exceptions=Exception diff --git a/.vscode/launch.json b/.vscode/launch.json index e14338b0..e60884e7 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,7 +5,15 @@ "version": "0.2.0", "configurations": [ { - "name": "server", + "type": "chrome", + "request": "launch", + "preLaunchTask": "ui.js: server", + "name": "ui.js: debug", + "url": "http://localhost:3000", + "webRoot": "${workspaceFolder}/cvat-ui" + }, + { + "name": "server: django", "type": "python", "request": "launch", "stopOnEntry": false, @@ -19,10 +27,11 @@ "127.0.0.1:7000" ], "django": true, - "cwd": "${workspaceFolder}" + "cwd": "${workspaceFolder}", + "console": "internalConsole" }, { - "name": "client", + "name": "server: chrome", "type": "chrome", "request": "launch", "url": "http://localhost:7000/", @@ -35,7 +44,7 @@ } }, { - "name": "RQ - default", + "name": "server: RQ - default", "type": "python", "request": "launch", "stopOnEntry": false, @@ -50,10 +59,11 @@ ], "django": true, "cwd": "${workspaceFolder}", - "env": {} + "env": {}, + "console": "internalConsole" }, { - "name": "RQ - low", + "name": "server: RQ - low", "type": "python", "request": "launch", "justMyCode": false, @@ -68,10 +78,11 @@ ], "django": true, "cwd": "${workspaceFolder}", - "env": {} + "env": {}, + "console": "internalConsole" }, { - "name": "git", + "name": "server: git", "type": "python", "request": "launch", "justMyCode": false, @@ -83,10 +94,11 @@ ], "django": true, "cwd": "${workspaceFolder}", - "env": {} + "env": {}, + "console": "internalConsole" }, { - "name": "migrate", + "name": "server: migrate", "type": "python", "request": "launch", "justMyCode": false, @@ -98,10 +110,11 @@ ], "django": true, "cwd": "${workspaceFolder}", - "env": {} + "env": {}, + "console": "internalConsole" }, { - "name": "tests", + "name": "server: tests", "type": "python", "request": "launch", "justMyCode": false, @@ -116,10 +129,11 @@ ], "django": true, "cwd": "${workspaceFolder}", - "env": {} + "env": {}, + "console": "internalConsole" }, { - "name": "cvat.js debug", + "name": "core.js: debug", "type": "node", "request": "launch", "cwd": "${workspaceFolder}/cvat-core", @@ -143,18 +157,22 @@ "console": "integratedTerminal", "internalConsoleOptions": "neverOpen", "disableOptimisticBPs": true, - } + }, + { + "type": "chrome", + + } ], "compounds": [ { - "name": "debugging", + "name": "server: debug", "configurations": [ - "client", - "server", - "RQ - default", - "RQ - low", - "git", + "server: chrome", + "server: django", + "server: RQ - default", + "server: RQ - low", + "server: git", ] - }, + } ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index 649a2c4e..47941676 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,5 @@ { - "python.pythonPath": ".env/bin/python", + "python.pythonPath": "python", "eslint.enable": true, "eslint.validate": [ "javascript", @@ -18,5 +18,6 @@ "directory": ".", "changeProcessCWD": true } - ] + ], + "python.linting.pylintEnabled": true } diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000..10c34d90 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,14 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "ui.js: server", + "type": "npm", + "script": "start", + "path": "cvat-ui/", + "problemMatcher": [] + } + ] +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 10e6a6ca..fed82a7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added in PDF extractor - Added in a command line model manager tester - Ability to dump/load annotations in several formats from UI (CVAT, Pascal VOC, YOLO, MS COCO, png mask, TFRecord) +- Auth for REST API (api/v1/auth/): login, logout, register, ... ### Changed - Outside and keyframe buttons in the side panel for all interpolation shapes (they were only for boxes before) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f2533f7f..e2c6e88d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -53,7 +53,7 @@ $ code . - Reload Visual Studio Code -- Select `CVAT Debugging` configuration and start debugging (F5) +- Select `server: debug` configuration and start debugging (F5) You have done! Now it is possible to insert breakpoints and debug server and client of the tool. diff --git a/cvat-core/.eslintrc.js b/cvat-core/.eslintrc.js index 7a2e5f89..ff0d3398 100644 --- a/cvat-core/.eslintrc.js +++ b/cvat-core/.eslintrc.js @@ -26,7 +26,7 @@ "eslint:recommended", "plugin:security/recommended", "plugin:no-unsanitized/DOM", - "airbnb", + "airbnb-base", ], "rules": { "no-await-in-loop": [0], diff --git a/cvat-core/.gitignore b/cvat-core/.gitignore index 0409a55a..80b08369 100644 --- a/cvat-core/.gitignore +++ b/cvat-core/.gitignore @@ -2,3 +2,5 @@ docs node_modules reports package-lock.json +yarn.lock +dist diff --git a/cvat-core/package.json b/cvat-core/package.json index e94bfe4f..deab3a7f 100644 --- a/cvat-core/package.json +++ b/cvat-core/package.json @@ -1,5 +1,5 @@ { - "name": "cvat.js", + "name": "cvat-core.js", "version": "0.1.0", "description": "Part of Computer Vision Tool which presents an interface for client-side integration", "main": "babel.config.js", @@ -15,11 +15,17 @@ "@babel/cli": "^7.4.4", "@babel/core": "^7.4.4", "@babel/preset-env": "^7.4.4", + "airbnb": "0.0.2", "babel-eslint": "^10.0.1", "babel-loader": "^8.0.6", "core-js": "^3.0.1", "coveralls": "^3.0.5", - "eslint": "^6.1.0", + "eslint": "6.1.0", + "eslint-config-airbnb-base": "14.0.0", + "eslint-plugin-import": "2.18.2", + "eslint-plugin-no-unsafe-innerhtml": "^1.0.16", + "eslint-plugin-no-unsanitized": "^3.0.2", + "eslint-plugin-security": "^1.4.0", "jest": "^24.8.0", "jest-junit": "^6.4.0", "jsdoc": "^3.6.2", @@ -33,6 +39,7 @@ "form-data": "^2.5.0", "jest-config": "^24.8.0", "js-cookie": "^2.2.0", - "platform": "^1.3.5" + "platform": "^1.3.5", + "store": "^2.0.12" } } diff --git a/cvat-core/src/api-implementation.js b/cvat-core/src/api-implementation.js index 708b7a0b..8f4b8841 100644 --- a/cvat-core/src/api-implementation.js +++ b/cvat-core/src/api-implementation.js @@ -50,6 +50,12 @@ return result.map(el => new AnnotationFormat(el)); }; + cvat.server.register.implementation = async (username, firstName, lastName, + email, password1, password2) => { + await serverProxy.server.register(username, firstName, lastName, email, + password1, password2); + }; + cvat.server.login.implementation = async (username, password) => { await serverProxy.server.login(username, password); }; diff --git a/cvat-core/src/api.js b/cvat-core/src/api.js index 0c4fb8a4..adc6fa8f 100644 --- a/cvat-core/src/api.js +++ b/cvat-core/src/api.js @@ -115,6 +115,26 @@ function build() { .apiWrapper(cvat.server.formats); return result; }, + /** + * Method allows to register on a server + * @method register + * @async + * @memberof module:API.cvat.server + * @param {string} username An username for the new account + * @param {string} firstName A first name for the new account + * @param {string} lastName A last name for the new account + * @param {string} email A email address for the new account + * @param {string} password1 A password for the new account + * @param {string} password2 The confirmation password for the new account + * @throws {module:API.cvat.exceptions.PluginError} + * @throws {module:API.cvat.exceptions.ServerError} + */ + async register(username, firstName, lastName, email, password1, password2) { + const result = await PluginRegistry + .apiWrapper(cvat.server.register, username, firstName, + lastName, email, password1, password2); + return result; + }, /** * Method allows to login on a server * @method login @@ -122,7 +142,6 @@ function build() { * @memberof module:API.cvat.server * @param {string} username An username of an account * @param {string} password A password of an account - * @throws {module:API.cvat.exceptions.ScriptingError} * @throws {module:API.cvat.exceptions.PluginError} * @throws {module:API.cvat.exceptions.ServerError} */ diff --git a/cvat-core/src/server-proxy.js b/cvat-core/src/server-proxy.js index 3836168f..66ee2b69 100644 --- a/cvat-core/src/server-proxy.js +++ b/cvat-core/src/server-proxy.js @@ -12,24 +12,20 @@ const FormData = require('form-data'); const { ServerError, - ScriptingError, } = require('./exceptions'); - + const store = require('store'); const config = require('./config'); class ServerProxy { constructor() { - const Cookie = require('js-cookie'); const Axios = require('axios'); + Axios.defaults.withCredentials = true; + Axios.defaults.xsrfHeaderName = 'X-CSRFTOKEN'; + Axios.defaults.xsrfCookieName = 'csrftoken'; - function setCSRFHeader(header) { - Axios.defaults.headers.delete['X-CSRFToken'] = header; - Axios.defaults.headers.patch['X-CSRFToken'] = header; - Axios.defaults.headers.post['X-CSRFToken'] = header; - Axios.defaults.headers.put['X-CSRFToken'] = header; - - // Allows to move authentification headers to backend - Axios.defaults.withCredentials = true; + let token = store.get('token'); + if (token) { + Axios.defaults.headers.common.Authorization = `Token ${token}`; } async function about() { @@ -109,108 +105,69 @@ return response.data; } - async function login(username, password) { - function setCookie(response) { - if (response.headers['set-cookie']) { - // Browser itself setup cookie and header is none - // In NodeJS we need do it manually - let cookies = ''; - for (let cookie of response.headers['set-cookie']) { - [cookie] = cookie.split(';'); // truncate extra information - const name = cookie.split('=')[0]; - const value = cookie.split('=')[1]; - if (name === 'csrftoken') { - setCSRFHeader(value); - } - Cookie.set(name, value); - cookies += `${cookie};`; - } - - Axios.defaults.headers.common.Cookie = cookies; - } else { - // Browser code. We need set additinal header for authentification - let csrftoken = response.data.csrf; - if (csrftoken) { - setCSRFHeader(csrftoken); - Cookie.set('csrftoken', csrftoken); - } else { - csrftoken = Cookie.get('csrftoken'); - if (csrftoken) { - setCSRFHeader(csrftoken); - } else { - throw new ScriptingError( - 'An environment has been detected as a browser' - + ', but CSRF token has not been found in cookies', - ); - } - } - } - } - - const host = config.backendAPI.slice(0, -7); - let csrf = null; + async function register(username, firstName, lastName, email, password1, password2) { + let response = null; try { - csrf = await Axios.get(`${host}/auth/csrf`, { + const data = JSON.stringify({ + username, + first_name: firstName, + last_name: lastName, + email, + password1, + password2, + }); + response = await Axios.post(`${config.backendAPI}/auth/register`, data, { proxy: config.proxy, }); } catch (errorData) { const code = errorData.response ? errorData.response.status : errorData.code; throw new ServerError( - 'Could not get CSRF token from a server', + `Could not register '${username}' user on the server`, code, ); } - setCookie(csrf); + return response.data; + } - const authentificationData = ([ + async function login(username, password) { + const authenticationData = ([ `${encodeURIComponent('username')}=${encodeURIComponent(username)}`, `${encodeURIComponent('password')}=${encodeURIComponent(password)}`, ]).join('&').replace(/%20/g, '+'); - let authentificationResponse = null; + let authenticationResponse = null; try { - authentificationResponse = await Axios.post( - `${host}/auth/login`, - authentificationData, - { - 'Content-Type': 'application/x-www-form-urlencoded', + authenticationResponse = await Axios.post( + `${config.backendAPI}/auth/login`, + authenticationData, { proxy: config.proxy, - // do not redirect to a dashboard, - // otherwise we don't get a session id in a response - maxRedirects: 0, }, ); } catch (errorData) { - if (errorData.response.status === 302) { - // Redirection code expected - authentificationResponse = errorData.response; - } else { - const code = errorData.response - ? errorData.response.status : errorData.code; - throw new ServerError( - 'Could not login on a server', - code, - ); - } - } - - // TODO: Perhaps we should redesign the authorization method on the server. - if (authentificationResponse.data.includes('didn\'t match')) { + const code = errorData.response + ? errorData.response.status : errorData.code; throw new ServerError( - 'The pair login/password is invalid', - 403, + 'Could not login on a server', + code, ); } - setCookie(authentificationResponse); + if (authenticationResponse.headers['set-cookie']) { + // Browser itself setup cookie and header is none + // In NodeJS we need do it manually + const cookies = authenticationResponse.headers['set-cookie'].join(';'); + Axios.defaults.headers.common.Cookie = cookies; + } + + token = authenticationResponse.data.key; + store.set('token', token); + Axios.defaults.headers.common.Authorization = `Token ${token}`; } async function logout() { - const host = config.backendAPI.slice(0, -7); - try { - await Axios.get(`${host}/auth/logout`, { + await Axios.post(`${config.backendAPI}/auth/logout`, { proxy: config.proxy, }); } catch (errorData) { @@ -220,13 +177,16 @@ code, ); } + + store.remove('token'); + Axios.defaults.headers.common.Authorization = ''; } async function authorized() { try { await module.exports.users.getSelf(); } catch (serverError) { - if (serverError.code === 403) { + if (serverError.code === 401) { return false; } @@ -315,7 +275,7 @@ // If server has another status, it is unexpected // Therefore it is server error and we can pass code 500 reject(new ServerError( - `Unknown task state has been recieved: ${response.data.state}`, + `Unknown task state has been received: ${response.data.state}`, 500, )); } @@ -324,7 +284,7 @@ ? errorData.response.status : errorData.code; reject(new ServerError( - 'Data uploading error occured', + 'Data uploading error occurred', code, )); } @@ -623,14 +583,6 @@ }); } - // Set csrftoken header from browser cookies if it exists - // NodeJS env returns 'undefined' - // So in NodeJS we need login after each run - const csrftoken = Cookie.get('csrftoken'); - if (csrftoken) { - setCSRFHeader(csrftoken); - } - Object.defineProperties(this, Object.freeze({ server: { value: Object.freeze({ @@ -641,6 +593,7 @@ login, logout, authorized, + register, }), writable: false, }, diff --git a/cvat-core/webpack.config.js b/cvat-core/webpack.config.js index 22a9baf6..9b55ccde 100644 --- a/cvat-core/webpack.config.js +++ b/cvat-core/webpack.config.js @@ -37,7 +37,7 @@ const webConfig = { entry: './src/api.js', output: { path: path.resolve(__dirname, 'dist'), - filename: 'cvat-core.js', + filename: 'cvat-core.min.js', library: 'cvat', libraryTarget: 'window', }, diff --git a/cvat-ui/.env b/cvat-ui/.env index acc9a2fe..f0902663 100644 --- a/cvat-ui/.env +++ b/cvat-ui/.env @@ -8,3 +8,5 @@ REACT_APP_API_FULL_URL=${REACT_APP_API_PROTOCOL}://${REACT_APP_API_HOST}:${REACT REACT_APP_LOGIN=admin REACT_APP_PASSWORD=admin + +SKIP_PREFLIGHT_CHECK=true diff --git a/cvat-ui/public/cvat-core.min.js b/cvat-ui/public/cvat-core.min.js index a9c22af0..8dc7fe2d 100644 --- a/cvat-ui/public/cvat-core.min.js +++ b/cvat-ui/public/cvat-core.min.js @@ -1,22 +1,15 @@ -window.cvat=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=89)}([function(t,e,n){(function(e){var n="object",r=function(t){return t&&t.Math==Math&&t};t.exports=r(typeof globalThis==n&&globalThis)||r(typeof window==n&&window)||r(typeof self==n&&self)||r(typeof e==n&&e)||Function("return this")()}).call(this,n(38))},function(t,e,n){var r=n(0),o=n(29),s=n(56),i=n(96),a=r.Symbol,c=o("wks");t.exports=function(t){return c[t]||(c[t]=i&&a[t]||(i?a:s)("Symbol."+t))}},function(t,e,n){"use strict";var r=n(28),o=n(107),s=n(24),i=n(17),a=n(72),c=i.set,u=i.getterFor("Array Iterator");t.exports=a(Array,"Array",function(t,e){c(this,{type:"Array Iterator",target:r(t),index:0,kind:e})},function(){var t=u(this),e=t.target,n=t.kind,r=t.index++;return!e||r>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:e[r],done:!1}:{value:[r,e[r]],done:!1}},"values"),s.Arguments=s.Array,o("keys"),o("values"),o("entries")},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,n){var r=n(11);t.exports=function(t){if(!r(t))throw TypeError(String(t)+" is not an object");return t}},function(t,e,n){var r=n(0),o=n(111),s=n(2),i=n(12),a=n(1),c=a("iterator"),u=a("toStringTag"),l=s.values;for(var p in o){var f=r[p],h=f&&f.prototype;if(h){if(h[c]!==l)try{i(h,c,l)}catch(t){h[c]=l}if(h[u]||i(h,u,p),o[p])for(var d in s)if(h[d]!==s[d])try{i(h,d,s[d])}catch(t){h[d]=s[d]}}}},function(t,e,n){n(9),(()=>{const e=n(112),r=n(114),o=n(47);class s extends Error{constructor(t){super(t);const n=(new Date).toISOString(),s=e.os.toString(),i=`${e.name} ${e.version}`,a=r.parse(this)[0],c=`${a.fileName}`,u=a.lineNumber,l=a.columnNumber,{jobID:p,taskID:f,clientID:h}=o;Object.defineProperties(this,Object.freeze({system:{get:()=>s},client:{get:()=>i},time:{get:()=>n},jobID:{get:()=>p},taskID:{get:()=>f},projID:{get:()=>void 0},clientID:{get:()=>h},filename:{get:()=>c},line:{get:()=>u},column:{get:()=>l}}))}async save(){const t={system:this.system,client:this.client,time:this.time,job_id:this.jobID,task_id:this.taskID,proj_id:this.projID,client_id:this.clientID,message:this.message,filename:this.filename,line:this.line,column:this.column,stack:this.stack};try{const e=n(18);await e.server.exception(t)}catch(t){}}}t.exports={Exception:s,ArgumentError:class extends s{constructor(t){super(t)}},DataError:class extends s{constructor(t){super(t)}},ScriptingError:class extends s{constructor(t){super(t)}},PluginError:class extends s{constructor(t){super(t)}},ServerError:class extends s{constructor(t,e){super(t),Object.defineProperties(this,Object.freeze({code:{get:()=>e}}))}}}})()},function(t,e,n){"use strict";var r=n(77),o=n(125),s=Object.prototype.toString;function i(t){return"[object Array]"===s.call(t)}function a(t){return null!==t&&"object"==typeof t}function c(t){return"[object Function]"===s.call(t)}function u(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),i(t))for(var n=0,r=t.length;ni;){var a,c,u,l=r[i++],p=s?l.ok:l.fail,f=l.resolve,h=l.reject,d=l.domain;try{p?(s||(2===e.rejection&&et(t,e),e.rejection=1),!0===p?a=o:(d&&d.enter(),a=p(o),d&&(d.exit(),u=!0)),a===l.promise?h(D("Promise-chain cycle")):(c=K(a))?c.call(a,f,h):f(a)):h(o)}catch(t){d&&!u&&d.exit(),h(t)}}e.reactions=[],e.notified=!1,n&&!e.rejection&&Q(t,e)})}},Y=function(t,e,n){var r,o;V?((r=L.createEvent("Event")).promise=e,r.reason=n,r.initEvent(t,!1,!0),u.dispatchEvent(r)):r={promise:e,reason:n},(o=u["on"+t])?o(r):"unhandledrejection"===t&&A("Unhandled promise rejection",n)},Q=function(t,e){k.call(u,function(){var n,r=e.value;if(tt(e)&&(n=E(function(){J?B.emit("unhandledRejection",r,t):Y("unhandledrejection",t,r)}),e.rejection=J||tt(e)?2:1,n.error))throw n.value})},tt=function(t){return 1!==t.rejection&&!t.parent},et=function(t,e){k.call(u,function(){J?B.emit("rejectionHandled",t):Y("rejectionhandled",t,e.value)})},nt=function(t,e,n,r){return function(o){t(e,n,o,r)}},rt=function(t,e,n,r){e.done||(e.done=!0,r&&(e=r),e.value=n,e.state=2,Z(t,e,!0))},ot=function(t,e,n,r){if(!e.done){e.done=!0,r&&(e=r);try{if(t===n)throw D("Promise can't be resolved itself");var o=K(n);o?j(function(){var r={done:!1};try{o.call(n,nt(ot,t,r,e),nt(rt,t,r,e))}catch(n){rt(t,r,n,e)}}):(e.value=n,e.state=1,Z(t,e,!1))}catch(n){rt(t,{done:!1},n,e)}}};X&&(R=function(t){y(this,R,_),m(t),r.call(this);var e=N(this);try{t(nt(ot,this,e),nt(rt,this,e))}catch(t){rt(this,e,t)}},(r=function(t){M(this,{type:_,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=h(R.prototype,{then:function(t,e){var n=$(this),r=G(x(this,R));return r.ok="function"!=typeof t||t,r.fail="function"==typeof e&&e,r.domain=J?B.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&Z(this,n,!1),r.promise},catch:function(t){return this.then(void 0,t)}}),o=function(){var t=new r,e=N(t);this.promise=t,this.resolve=nt(ot,t,e),this.reject=nt(rt,t,e)},T.f=G=function(t){return t===R||t===s?new o(t):q(t)},c||"function"!=typeof p||(i=p.prototype.then,f(p.prototype,"then",function(t,e){var n=this;return new R(function(t,e){i.call(n,t,e)}).then(t,e)}),"function"==typeof z&&a({global:!0,enumerable:!0,forced:!0},{fetch:function(t){return S(R,z.apply(u,arguments))}}))),a({global:!0,wrap:!0,forced:X},{Promise:R}),d(R,_,!1,!0),b(_),s=l.Promise,a({target:_,stat:!0,forced:X},{reject:function(t){var e=G(this);return e.reject.call(void 0,t),e.promise}}),a({target:_,stat:!0,forced:c||X},{resolve:function(t){return S(c&&this===s?R:this,t)}}),a({target:_,stat:!0,forced:H},{all:function(t){var e=this,n=G(e),r=n.resolve,o=n.reject,s=E(function(){var n=m(e.resolve),s=[],i=0,a=1;w(t,function(t){var c=i++,u=!1;s.push(void 0),a++,n.call(e,t).then(function(t){u||(u=!0,s[c]=t,--a||r(s))},o)}),--a||r(s)});return s.error&&o(s.value),n.promise},race:function(t){var e=this,n=G(e),r=n.reject,o=E(function(){var o=m(e.resolve);w(t,function(t){o.call(e,t).then(n.resolve,r)})});return o.error&&r(o.value),n.promise}})},function(t,e,n){var r=n(3);t.exports=!r(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,n){var r=n(10),o=n(14),s=n(27);t.exports=r?function(t,e,n){return o.f(t,e,s(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var r=n(0),o=n(39).f,s=n(12),i=n(15),a=n(42),c=n(57),u=n(61);t.exports=function(t,e){var n,l,p,f,h,d=t.target,b=t.global,g=t.stat;if(n=b?r:g?r[d]||a(d,{}):(r[d]||{}).prototype)for(l in e){if(f=e[l],p=t.noTargetGet?(h=o(n,l))&&h.value:n[l],!u(b?l:d+(g?".":"#")+l,t.forced)&&void 0!==p){if(typeof f==typeof p)continue;c(f,p)}(t.sham||p&&p.sham)&&s(f,"sham",!0),i(n,l,f,t)}}},function(t,e,n){var r=n(10),o=n(54),s=n(4),i=n(40),a=Object.defineProperty;e.f=r?a:function(t,e,n){if(s(t),e=i(e,!0),s(n),o)try{return a(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){var r=n(0),o=n(29),s=n(12),i=n(8),a=n(42),c=n(55),u=n(17),l=u.get,p=u.enforce,f=String(c).split("toString");o("inspectSource",function(t){return c.call(t)}),(t.exports=function(t,e,n,o){var c=!!o&&!!o.unsafe,u=!!o&&!!o.enumerable,l=!!o&&!!o.noTargetGet;"function"==typeof n&&("string"!=typeof e||i(n,"name")||s(n,"name",e),p(n).source=f.join("string"==typeof e?e:"")),t!==r?(c?!l&&t[e]&&(u=!0):delete t[e],u?t[e]=n:s(t,e,n)):u?t[e]=n:a(e,n)})(Function.prototype,"toString",function(){return"function"==typeof this&&l(this).source||c.call(this)})},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e,n){var r,o,s,i=n(90),a=n(0),c=n(11),u=n(12),l=n(8),p=n(43),f=n(44),h=a.WeakMap;if(i){var d=new h,b=d.get,g=d.has,m=d.set;r=function(t,e){return m.call(d,t,e),e},o=function(t){return b.call(d,t)||{}},s=function(t){return g.call(d,t)}}else{var y=p("state");f[y]=!0,r=function(t,e){return u(t,y,e),e},o=function(t){return l(t,y)?t[y]:{}},s=function(t){return l(t,y)}}t.exports={set:r,get:o,has:s,enforce:function(t){return s(t)?o(t):r(t,{})},getterFor:function(t){return function(e){var n;if(!c(e)||(n=o(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return n}}}},function(t,e,n){n(2),n(9),n(116),n(5),(()=>{const e=n(121),{ServerError:r,ScriptingError:o}=n(6),s=n(47);const i=new class{constructor(){const i=n(122),a=n(123);function c(t){a.defaults.headers.delete["X-CSRFToken"]=t,a.defaults.headers.patch["X-CSRFToken"]=t,a.defaults.headers.post["X-CSRFToken"]=t,a.defaults.headers.put["X-CSRFToken"]=t,a.defaults.withCredentials=!0}async function u(t=""){const{backendAPI:e}=s;let n=null;try{n=await a.get(`${e}/tasks?${t}`,{proxy:s.proxy})}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not get tasks from a server",e)}return n.data.results.count=n.data.count,n.data.results}async function l(t){const{backendAPI:e}=s;try{await a.delete(`${e}/tasks/${t}`)}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not delete the task from the server",e)}}const p=i.get("csrftoken");p&&c(p),Object.defineProperties(this,Object.freeze({server:{value:Object.freeze({about:async function(){const{backendAPI:t}=s;let e=null;try{e=await a.get(`${t}/server/about`,{proxy:s.proxy})}catch(t){const e=t.response?t.response.status:t.code;throw new r('Could not get "about" information from the server',e)}return e.data},share:async function(t){const{backendAPI:e}=s;t=encodeURIComponent(t);let n=null;try{n=await a.get(`${e}/server/share?directory=${t}`,{proxy:s.proxy})}catch(t){const e=t.response?t.response.status:t.code;throw new r('Could not get "share" information from the server',e)}return n.data},formats:async function(){const{backendAPI:t}=s;let e=null;try{e=await a.get(`${t}/server/annotation/formats`,{proxy:s.proxy})}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not get annotation formats from the server",e)}return e.data},exception:async function(t){const{backendAPI:e}=s;try{await a.post(`${e}/server/exception`,JSON.stringify(t),{proxy:s.proxy,headers:{"Content-Type":"application/json"}})}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not send an exception to the server",e)}},login:async function(t,e){function n(t){if(t.headers["set-cookie"]){let e="";for(let n of t.headers["set-cookie"]){[n]=n.split(";");const t=n.split("=")[0],r=n.split("=")[1];"csrftoken"===t&&c(r),i.set(t,r),e+=`${n};`}a.defaults.headers.common.Cookie=e}else{let e=t.data.csrf;if(e)c(e),i.set("csrftoken",e);else{if(!(e=i.get("csrftoken")))throw new o("An environment has been detected as a browser, but CSRF token has not been found in cookies");c(e)}}}const u=s.backendAPI.slice(0,-7);let l=null;try{l=await a.get(`${u}/auth/csrf`,{proxy:s.proxy})}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not get CSRF token from a server",e)}n(l);const p=[`${encodeURIComponent("username")}=${encodeURIComponent(t)}`,`${encodeURIComponent("password")}=${encodeURIComponent(e)}`].join("&").replace(/%20/g,"+");let f=null;try{f=await a.post(`${u}/auth/login`,p,{"Content-Type":"application/x-www-form-urlencoded",proxy:s.proxy,maxRedirects:0})}catch(t){if(302!==t.response.status){const e=t.response?t.response.status:t.code;throw new r("Could not login on a server",e)}f=t.response}if(f.data.includes("didn't match"))throw new r("The pair login/password is invalid",403);n(f)},logout:async function(){const t=s.backendAPI.slice(0,-7);try{await a.get(`${t}/auth/logout`,{proxy:s.proxy})}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not logout from the server",e)}},authorized:async function(){try{await t.exports.users.getSelf()}catch(t){if(403===t.code)return!1;throw t}return!0}}),writable:!1},tasks:{value:Object.freeze({getTasks:u,saveTask:async function(t,e){const{backendAPI:n}=s;try{await a.patch(`${n}/tasks/${t}`,JSON.stringify(e),{proxy:s.proxy,headers:{"Content-Type":"application/json"}})}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not save the task on the server",e)}},createTask:async function(t,n,o){const{backendAPI:i}=s,c=new e;for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t))for(let e=0;e{setTimeout(async function s(){try{const c=await a.get(`${i}/tasks/${t}/status`);["Queued","Started"].includes(c.data.state)?(""!==c.data.message&&o(c.data.message),setTimeout(s,1e3)):"Finished"===c.data.state?e():"Failed"===c.data.state?n(new r("Could not create the task on the server",400)):n(new r(`Unknown task state has been recieved: ${c.data.state}`,500))}catch(t){const e=t.response?t.response.status:t.code;n(new r("Data uploading error occured",e))}},1e3)})}(p.data.id)}catch(t){throw await l(p.data.id),t}return(await u(`?id=${p.id}`))[0]},deleteTask:l}),writable:!1},jobs:{value:Object.freeze({getJob:async function(t){const{backendAPI:e}=s;let n=null;try{n=await a.get(`${e}/jobs/${t}`,{proxy:s.proxy})}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not get jobs from a server",e)}return n.data},saveJob:async function(t,e){const{backendAPI:n}=s;try{await a.patch(`${n}/jobs/${t}`,JSON.stringify(e),{proxy:s.proxy,headers:{"Content-Type":"application/json"}})}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not save the job on the server",e)}}}),writable:!1},users:{value:Object.freeze({getUsers:async function(){const{backendAPI:t}=s;let e=null;try{e=await a.get(`${t}/users`,{proxy:s.proxy})}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not get users from the server",e)}return e.data.results},getSelf:async function(){const{backendAPI:t}=s;let e=null;try{e=await a.get(`${t}/users/self`,{proxy:s.proxy})}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not get user data from the server",e)}return e.data}}),writable:!1},frames:{value:Object.freeze({getData:async function(t,e){const{backendAPI:n}=s;let o=null;try{o=await a.get(`${n}/tasks/${t}/frames/${e}`,{proxy:s.proxy,responseType:"blob"})}catch(n){const o=n.response?n.response.status:n.code;throw new r(`Could not get frame ${e} for the task ${t} from the server`,o)}return o.data},getMeta:async function(t){const{backendAPI:e}=s;let n=null;try{n=await a.get(`${e}/tasks/${t}/frames/meta`,{proxy:s.proxy})}catch(e){const n=e.response?e.response.status:e.code;throw new r(`Could not get frame meta info for the task ${t} from the server`,n)}return n.data}}),writable:!1},annotations:{value:Object.freeze({updateAnnotations:async function(t,e,n,o){const{backendAPI:i}=s;let c=null,u=null;"PUT"===o.toUpperCase()?(c=a.put.bind(a),u=`${i}/${t}s/${e}/annotations`):(c=a.patch.bind(a),u=`${i}/${t}s/${e}/annotations?action=${o}`);let l=null;try{l=await c(u,JSON.stringify(n),{proxy:s.proxy,headers:{"Content-Type":"application/json"}})}catch(n){const o=n.response?n.response.status:n.code;throw new r(`Could not updated annotations for the ${t} ${e} on the server`,o)}return l.data},getAnnotations:async function(t,e){const{backendAPI:n}=s;let o=null;try{o=await a.get(`${n}/${t}s/${e}/annotations`,{proxy:s.proxy})}catch(n){const o=n.response?n.response.status:n.code;throw new r(`Could not get annotations for the ${t} ${e} from the server`,o)}return o.data},dumpAnnotations:async function(t,e,n){const{backendAPI:o}=s,i=e.replace(/\//g,"_");let c=`${o}/tasks/${t}/annotations/${i}?format=${n}`;return new Promise((e,n)=>{setTimeout(async function o(){try{202===(await a.get(`${c}`,{proxy:s.proxy})).status?setTimeout(o,3e3):e(c=`${c}&action=download`)}catch(e){const o=e.response?e.response.status:e.code,s=new r(`Could not dump annotations for the task ${t} from the server`,o);n(s)}})})},uploadAnnotations:async function(t,n,o,i){const{backendAPI:c}=s;let u=new e;return u.append("annotation_file",o),new Promise((o,l)=>{setTimeout(async function p(){try{202===(await a.put(`${c}/${t}s/${n}/annotations?format=${i}`,u,{proxy:s.proxy})).status?(u=new e,setTimeout(p,3e3)):o()}catch(e){const o=e.response?e.response.status:e.code,s=new r(`Could not upload annotations for the ${t} ${n}`,o);l(s)}})})}}),writable:!1}}))}};t.exports=i})()},function(t,e){(()=>{const e=Object.freeze({DIR:"DIR",REG:"REG"}),n=Object.freeze({ANNOTATION:"annotation",VALIDATION:"validation",COMPLETED:"completed"}),r=Object.freeze({ANNOTATION:"annotation",INTERPOLATION:"interpolation"}),o=Object.freeze({CHECKBOX:"checkbox",RADIO:"radio",SELECT:"select",NUMBER:"number",TEXT:"text"}),s=Object.freeze({TAG:"tag",SHAPE:"shape",TRACK:"track"}),i=Object.freeze({RECTANGLE:"rectangle",POLYGON:"polygon",POLYLINE:"polyline",POINTS:"points"}),a=Object.freeze({frameDownloaded:0});t.exports={ShareFileType:e,TaskStatus:n,TaskMode:r,AttributeType:o,ObjectType:s,ObjectShape:i,LogType:{pasteObject:0,changeAttribute:1,dragObject:2,deleteObject:3,pressShortcut:4,resizeObject:5,sendLogs:6,saveJob:7,jumpFrame:8,drawObject:9,changeLabel:10,sendTaskInfo:11,loadJob:12,moveImage:13,zoomImage:14,lockObject:15,mergeObjects:16,copyObject:17,propagateObject:18,undoAction:19,redoAction:20,sendUserActivity:21,sendException:22,changeFrame:23,debugInfo:24,fitImage:25,rotateImage:26},EventType:a}})()},function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,e){t.exports=!1},function(t,e,n){var r=n(14).f,o=n(8),s=n(1)("toStringTag");t.exports=function(t,e,n){t&&!o(t=n?t:t.prototype,s)&&r(t,s,{configurable:!0,value:e})}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t}},function(t,e){t.exports={}},function(t,e,n){n(106),n(2),n(9),n(5),(()=>{const{PluginError:e}=n(6),r=[];class o{static async apiWrapper(t,...n){const r=await o.list();for(const o of r){const r=o.functions.filter(e=>e.callback===t)[0];if(r&&r.enter)try{await r.enter.call(this,o,...n)}catch(t){throw t instanceof e?t:new e(`Exception in plugin ${o.name}: ${t.toString()}`)}}let s=await t.implementation.call(this,...n);for(const o of r){const r=o.functions.filter(e=>e.callback===t)[0];if(r&&r.leave)try{s=await r.leave.call(this,o,s,...n)}catch(t){throw t instanceof e?t:new e(`Exception in plugin ${o.name}: ${t.toString()}`)}}return s}static async register(t){const n=[];if("object"!=typeof t)throw new e(`Plugin should be an object, but got "${typeof t}"`);if(!("name"in t)||"string"!=typeof t.name)throw new e('Plugin must contain a "name" field and it must be a string');if(!("description"in t)||"string"!=typeof t.description)throw new e('Plugin must contain a "description" field and it must be a string');if("functions"in t)throw new e('Plugin must not contain a "functions" field');!function t(e,r){const o={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&("object"==typeof e[n]?Object.prototype.hasOwnProperty.call(r,n)&&t(e[n],r[n]):["enter","leave"].includes(n)&&"function"==typeof r&&(e[n],1)&&(o.callback=r,o[n]=e[n]));Object.keys(o).length&&n.push(o)}(t,{cvat:this}),Object.defineProperty(t,"functions",{value:n,writable:!1}),r.push(t)}static async list(){return r}}t.exports=o})()},function(t,e,n){var r=n(20);t.exports=function(t){return Object(r(t))}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,n){var r=n(53),o=n(20);t.exports=function(t){return r(o(t))}},function(t,e,n){var r=n(0),o=n(42),s=n(21),i=r["__core-js_shared__"]||o("__core-js_shared__",{});(t.exports=function(t,e){return i[t]||(i[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.2.1",mode:s?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(t,e,n){var r=n(58),o=n(0),s=function(t){return"function"==typeof t?t:void 0};t.exports=function(t,e){return arguments.length<2?s(r[t])||s(o[t]):r[t]&&r[t][e]||o[t]&&o[t][e]}},function(t,e,n){var r=n(32),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},function(t,e,n){var r=n(23);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 0:return function(){return t.call(e)};case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}}},function(t,e,n){var r=n(99),o=n(24),s=n(1)("iterator");t.exports=function(t){if(null!=t)return t[s]||t["@@iterator"]||o[r(t)]}},function(t,e,n){n(2),n(9),n(141),n(5),n(51),(()=>{const e=n(25),r=n(18),{getFrame:o}=n(144),{ArgumentError:s}=n(6),{TaskStatus:i}=n(19),{Label:a}=n(36);function c(t){Object.defineProperties(t,{annotations:Object.freeze({value:{async upload(n,r){return await e.apiWrapper.call(this,t.annotations.upload,n,r)},async save(){return await e.apiWrapper.call(this,t.annotations.save)},async clear(n=!1){return await e.apiWrapper.call(this,t.annotations.clear,n)},async dump(n,r){return await e.apiWrapper.call(this,t.annotations.dump,n,r)},async statistics(){return await e.apiWrapper.call(this,t.annotations.statistics)},async put(n=[]){return await e.apiWrapper.call(this,t.annotations.put,n)},async get(n,r={}){return await e.apiWrapper.call(this,t.annotations.get,n,r)},async search(n,r,o){return await e.apiWrapper.call(this,t.annotations.search,n,r,o)},async select(n,r,o){return await e.apiWrapper.call(this,t.annotations.select,n,r,o)},async hasUnsavedChanges(){return await e.apiWrapper.call(this,t.annotations.hasUnsavedChanges)},async merge(n){return await e.apiWrapper.call(this,t.annotations.merge,n)},async split(n,r){return await e.apiWrapper.call(this,t.annotations.split,n,r)},async group(n,r=!1){return await e.apiWrapper.call(this,t.annotations.group,n,r)}},writable:!0}),frames:Object.freeze({value:{async get(n){return await e.apiWrapper.call(this,t.frames.get,n)}},writable:!0}),logs:Object.freeze({value:{async put(n,r){return await e.apiWrapper.call(this,t.logs.put,n,r)},async save(n){return await e.apiWrapper.call(this,t.logs.save,n)}},writable:!0}),actions:Object.freeze({value:{async undo(n){return await e.apiWrapper.call(this,t.actions.undo,n)},async redo(n){return await e.apiWrapper.call(this,t.actions.redo,n)},async clear(){return await e.apiWrapper.call(this,t.actions.clear)}},writable:!0}),events:Object.freeze({value:{async subscribe(n,r){return await e.apiWrapper.call(this,t.events.subscribe,n,r)},async unsubscribe(n,r=null){return await e.apiWrapper.call(this,t.events.unsubscribe,n,r)}},writable:!0})})}class u{constructor(){}}class l extends u{constructor(t){super();const e={id:void 0,assignee:void 0,status:void 0,start_frame:void 0,stop_frame:void 0,task:void 0};for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&(n in t&&(e[n]=t[n]),void 0===e[n]))throw new s(`Job field "${n}" was not initialized`);Object.defineProperties(this,Object.freeze({id:{get:()=>e.id},assignee:{get:()=>e.assignee,set:()=>t=>{if(!Number.isInteger(t)||t<0)throw new s("Value must be a non negative integer");e.assignee=t}},status:{get:()=>e.status,set:t=>{const n=i;let r=!1;for(const e in n)if(n[e]===t){r=!0;break}if(!r)throw new s("Value must be a value from the enumeration cvat.enums.TaskStatus");e.status=t}},startFrame:{get:()=>e.start_frame},stopFrame:{get:()=>e.stop_frame},task:{get:()=>e.task}})),this.annotations={get:Object.getPrototypeOf(this).annotations.get.bind(this),put:Object.getPrototypeOf(this).annotations.put.bind(this),save:Object.getPrototypeOf(this).annotations.save.bind(this),dump:Object.getPrototypeOf(this).annotations.dump.bind(this),merge:Object.getPrototypeOf(this).annotations.merge.bind(this),split:Object.getPrototypeOf(this).annotations.split.bind(this),group:Object.getPrototypeOf(this).annotations.group.bind(this),clear:Object.getPrototypeOf(this).annotations.clear.bind(this),upload:Object.getPrototypeOf(this).annotations.upload.bind(this),select:Object.getPrototypeOf(this).annotations.select.bind(this),statistics:Object.getPrototypeOf(this).annotations.statistics.bind(this),hasUnsavedChanges:Object.getPrototypeOf(this).annotations.hasUnsavedChanges.bind(this)},this.frames={get:Object.getPrototypeOf(this).frames.get.bind(this)}}async save(){return await e.apiWrapper.call(this,l.prototype.save)}}class p extends u{constructor(t){super();const e={id:void 0,name:void 0,status:void 0,size:void 0,mode:void 0,owner:void 0,assignee:void 0,created_date:void 0,updated_date:void 0,bug_tracker:void 0,overlap:void 0,segment_size:void 0,z_order:void 0,image_quality:void 0,start_frame:void 0,stop_frame:void 0,frame_filter:void 0};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&n in t&&(e[n]=t[n]);if(e.labels=[],e.jobs=[],e.files=Object.freeze({server_files:[],client_files:[],remote_files:[]}),Array.isArray(t.segments))for(const n of t.segments)if(Array.isArray(n.jobs))for(const t of n.jobs){const r=new l({url:t.url,id:t.id,assignee:t.assignee,status:t.status,start_frame:n.start_frame,stop_frame:n.stop_frame,task:this});e.jobs.push(r)}if(Array.isArray(t.labels))for(const n of t.labels){const t=new a(n);e.labels.push(t)}Object.defineProperties(this,Object.freeze({id:{get:()=>e.id},name:{get:()=>e.name,set:t=>{if(!t.trim().length)throw new s("Value must not be empty");e.name=t}},status:{get:()=>e.status},size:{get:()=>e.size},mode:{get:()=>e.mode},owner:{get:()=>e.owner},assignee:{get:()=>e.assignee,set:()=>t=>{if(!Number.isInteger(t)||t<0)throw new s("Value must be a non negative integer");e.assignee=t}},createdDate:{get:()=>e.created_date},updatedDate:{get:()=>e.updated_date},bugTracker:{get:()=>e.bug_tracker,set:t=>{e.bug_tracker=t}},overlap:{get:()=>e.overlap,set:t=>{if(!Number.isInteger(t)||t<0)throw new s("Value must be a non negative integer");e.overlap=t}},segmentSize:{get:()=>e.segment_size,set:t=>{if(!Number.isInteger(t)||t<0)throw new s("Value must be a positive integer");e.segment_size=t}},zOrder:{get:()=>e.z_order,set:t=>{if("boolean"!=typeof t)throw new s("Value must be a boolean");e.z_order=t}},imageQuality:{get:()=>e.image_quality,set:t=>{if(!Number.isInteger(t)||t<0)throw new s("Value must be a positive integer");e.image_quality=t}},labels:{get:()=>[...e.labels],set:t=>{if(!Array.isArray(t))throw new s("Value must be an array of Labels");for(const e of t)if(!(e instanceof a))throw new s("Each array value must be an instance of Label. "+`${typeof e} was found`);void 0===e.id?e.labels=[...t]:e.labels=e.labels.concat([...t])}},jobs:{get:()=>[...e.jobs]},serverFiles:{get:()=>[...e.files.server_files],set:t=>{if(!Array.isArray(t))throw new s(`Value must be an array. But ${typeof t} has been got.`);for(const e of t)if("string"!=typeof e)throw new s(`Array values must be a string. But ${typeof e} has been got.`);Array.prototype.push.apply(e.files.server_files,t)}},clientFiles:{get:()=>[...e.files.client_files],set:t=>{if(!Array.isArray(t))throw new s(`Value must be an array. But ${typeof t} has been got.`);for(const e of t)if(!(e instanceof File))throw new s(`Array values must be a File. But ${e.constructor.name} has been got.`);Array.prototype.push.apply(e.files.client_files,t)}},remoteFiles:{get:()=>[...e.files.remote_files],set:t=>{if(!Array.isArray(t))throw new s(`Value must be an array. But ${typeof t} has been got.`);for(const e of t)if("string"!=typeof e)throw new s(`Array values must be a string. But ${typeof e} has been got.`);Array.prototype.push.apply(e.files.remote_files,t)}},startFrame:{get:()=>e.start_frame,set:t=>{if(!Number.isInteger(t)||t<0)throw new s("Value must be a not negative integer");e.start_frame=t}},stopFrame:{get:()=>e.stop_frame,set:t=>{if(!Number.isInteger(t)||t<0)throw new s("Value must be a not negative integer");e.stop_frame=t}},frameFilter:{get:()=>e.frame_filter,set:t=>{if("string"!=typeof t)throw new s(`Filter value must be a string. But ${typeof t} has been got.`);e.frame_filter=t}}})),this.annotations={get:Object.getPrototypeOf(this).annotations.get.bind(this),put:Object.getPrototypeOf(this).annotations.put.bind(this),save:Object.getPrototypeOf(this).annotations.save.bind(this),dump:Object.getPrototypeOf(this).annotations.dump.bind(this),merge:Object.getPrototypeOf(this).annotations.merge.bind(this),split:Object.getPrototypeOf(this).annotations.split.bind(this),group:Object.getPrototypeOf(this).annotations.group.bind(this),clear:Object.getPrototypeOf(this).annotations.clear.bind(this),upload:Object.getPrototypeOf(this).annotations.upload.bind(this),select:Object.getPrototypeOf(this).annotations.select.bind(this),statistics:Object.getPrototypeOf(this).annotations.statistics.bind(this),hasUnsavedChanges:Object.getPrototypeOf(this).annotations.hasUnsavedChanges.bind(this)},this.frames={get:Object.getPrototypeOf(this).frames.get.bind(this)}}async save(t=(()=>{})){return await e.apiWrapper.call(this,p.prototype.save,t)}async delete(){return await e.apiWrapper.call(this,p.prototype.delete)}}t.exports={Job:l,Task:p};const{getAnnotations:f,putAnnotations:h,saveAnnotations:d,hasUnsavedChanges:b,mergeAnnotations:g,splitAnnotations:m,groupAnnotations:y,clearAnnotations:v,selectObject:w,annotationsStatistics:O,uploadAnnotations:x,dumpAnnotations:k}=n(146);c(l.prototype),c(p.prototype),l.prototype.save.implementation=async function(){if(this.id){const t={status:this.status};return await r.jobs.saveJob(this.id,t),this}throw new s("Can not save job without and id")},l.prototype.frames.get.implementation=async function(t){if(!Number.isInteger(t)||t<0)throw new s(`Frame must be a positive integer. Got: "${t}"`);if(tthis.stopFrame)throw new s(`The frame with number ${t} is out of the job`);return await o(this.task.id,this.task.mode,t)},l.prototype.annotations.get.implementation=async function(t,e){if(tthis.stopFrame)throw new s(`Frame ${t} does not exist in the job`);return await f(this,t,e)},l.prototype.annotations.save.implementation=async function(t){return await d(this,t)},l.prototype.annotations.merge.implementation=async function(t){return await g(this,t)},l.prototype.annotations.split.implementation=async function(t,e){return await m(this,t,e)},l.prototype.annotations.group.implementation=async function(t,e){return await y(this,t,e)},l.prototype.annotations.hasUnsavedChanges.implementation=function(){return b(this)},l.prototype.annotations.clear.implementation=async function(t){return await v(this,t)},l.prototype.annotations.select.implementation=function(t,e,n){return w(this,t,e,n)},l.prototype.annotations.statistics.implementation=function(){return O(this)},l.prototype.annotations.put.implementation=function(t){return h(this,t)},l.prototype.annotations.upload.implementation=async function(t,e){return await x(this,t,e)},l.prototype.annotations.dump.implementation=async function(t,e){return await k(this,t,e)},p.prototype.save.implementation=async function(t){if(void 0!==this.id){const t={name:this.name,bug_tracker:this.bugTracker,z_order:this.zOrder,labels:[...this.labels.map(t=>t.toJSON())]};return await r.tasks.saveTask(this.id,t),this}const e={name:this.name,labels:this.labels.map(t=>t.toJSON()),image_quality:this.imageQuality,z_order:Boolean(this.zOrder)};this.bugTracker&&(e.bug_tracker=this.bugTracker),this.segmentSize&&(e.segment_size=this.segmentSize),this.overlap&&(e.overlap=this.overlap),this.startFrame&&(e.start_frame=this.startFrame),this.stopFrame&&(e.stop_frame=this.stopFrame),this.frameFilter&&(e.frame_filter=this.frameFilter);const n={client_files:this.clientFiles,server_files:this.serverFiles,remote_files:this.remoteFiles},o=await r.tasks.createTask(e,n,t);return new p(o)},p.prototype.delete.implementation=async function(){return await r.tasks.deleteTask(this.id)},p.prototype.frames.get.implementation=async function(t){if(!Number.isInteger(t)||t<0)throw new s(`Frame must be a positive integer. Got: "${t}"`);if(t>=this.size)throw new s(`The frame with number ${t} is out of the task`);return await o(this.id,this.mode,t)},p.prototype.annotations.get.implementation=async function(t,e){if(!Number.isInteger(t)||t<0)throw new s(`Frame must be a positive integer. Got: "${t}"`);if(t>=this.size)throw new s(`Frame ${t} does not exist in the task`);return await f(this,t,e)},p.prototype.annotations.save.implementation=async function(t){return await d(this,t)},p.prototype.annotations.merge.implementation=async function(t){return await g(this,t)},p.prototype.annotations.split.implementation=async function(t,e){return await m(this,t,e)},p.prototype.annotations.group.implementation=async function(t,e){return await y(this,t,e)},p.prototype.annotations.hasUnsavedChanges.implementation=function(){return b(this)},p.prototype.annotations.clear.implementation=async function(t){return await v(this,t)},p.prototype.annotations.select.implementation=function(t,e,n){return w(this,t,e,n)},p.prototype.annotations.statistics.implementation=function(){return O(this)},p.prototype.annotations.put.implementation=function(t){return h(this,t)},p.prototype.annotations.upload.implementation=async function(t,e){return await x(this,t,e)},p.prototype.annotations.dump.implementation=async function(t,e){return await k(this,t,e)}})()},function(t,e,n){n(2),n(5),n(51),(()=>{const{AttributeType:e}=n(19),{ArgumentError:r}=n(6);class o{constructor(t){const n={id:void 0,default_value:void 0,input_type:void 0,mutable:void 0,name:void 0,values:void 0};for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&Object.prototype.hasOwnProperty.call(t,e)&&(Array.isArray(t[e])?n[e]=[...t[e]]:n[e]=t[e]);if(!Object.values(e).includes(n.input_type))throw new r(`Got invalid attribute type ${n.input_type}`);Object.defineProperties(this,Object.freeze({id:{get:()=>n.id},defaultValue:{get:()=>n.default_value},inputType:{get:()=>n.input_type},mutable:{get:()=>n.mutable},name:{get:()=>n.name},values:{get:()=>[...n.values]}}))}toJSON(){const t={name:this.name,mutable:this.mutable,input_type:this.inputType,default_value:this.defaultValue,values:this.values};return void 0!==this.id&&(t.id=this.id),t}}t.exports={Attribute:o,Label:class{constructor(t){const e={id:void 0,name:void 0};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);if(e.attributes=[],Object.prototype.hasOwnProperty.call(t,"attributes")&&Array.isArray(t.attributes))for(const n of t.attributes)e.attributes.push(new o(n));Object.defineProperties(this,Object.freeze({id:{get:()=>e.id},name:{get:()=>e.name},attributes:{get:()=>[...e.attributes]}}))}toJSON(){const t={name:this.name,attributes:[...this.attributes.map(t=>t.toJSON())]};return void 0!==this.id&&(t.id=this.id),t}}}})()},function(t,e,n){(()=>{const{ArgumentError:e}=n(6);t.exports={isBoolean:function(t){return"boolean"==typeof t},isInteger:function(t){return"number"==typeof t&&Number.isInteger(t)},isEnum:function(t){for(const e in this)if(Object.prototype.hasOwnProperty.call(this,e)&&this[e]===t)return!0;return!1},isString:function(t){return"string"==typeof t},checkFilter:function(t,n){for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(!(r in n))throw new e(`Unsupported filter property has been recieved: "${r}"`);if(!n[r](t[r]))throw new e(`Received filter property "${r}" is not satisfied for checker`)}},checkObjectType:function(t,n,r,o){if(r){if(typeof n!==r){if("integer"===r&&Number.isInteger(n))return;throw new e(`"${t}" is expected to be "${r}", but "${typeof n}" has been got.`)}}else if(o&&!(n instanceof o)){if(void 0!==n)throw new e(`"${t}" is expected to be ${o.name}, but `+`"${n.constructor.name}" has been got`);throw new e(`"${t}" is expected to be ${o.name}, but "undefined" has been got.`)}}}})()},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){var r=n(10),o=n(52),s=n(27),i=n(28),a=n(40),c=n(8),u=n(54),l=Object.getOwnPropertyDescriptor;e.f=r?l:function(t,e){if(t=i(t),e=a(e,!0),u)try{return l(t,e)}catch(t){}if(c(t,e))return s(!o.f.call(t,e),t[e])}},function(t,e,n){var r=n(11);t.exports=function(t,e){if(!r(t))return t;var n,o;if(e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;if("function"==typeof(n=t.valueOf)&&!r(o=n.call(t)))return o;if(!e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,e,n){var r=n(0),o=n(11),s=r.document,i=o(s)&&o(s.createElement);t.exports=function(t){return i?s.createElement(t):{}}},function(t,e,n){var r=n(0),o=n(12);t.exports=function(t,e){try{o(r,t,e)}catch(n){r[t]=e}return e}},function(t,e,n){var r=n(29),o=n(56),s=r("keys");t.exports=function(t){return s[t]||(s[t]=o(t))}},function(t,e){t.exports={}},function(t,e){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(t,e){t.exports=function(t,e,n){if(!(t instanceof e))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return t}},function(t,e){t.exports={backendAPI:"http://localhost:7000/api/v1",proxy:!1,taskID:void 0,jobID:void 0,clientID:+Date.now().toString().substr(-6)}},function(t,e,n){var r=n(32),o=n(20),s=function(t){return function(e,n){var s,i,a=String(o(e)),c=r(n),u=a.length;return c<0||c>=u?t?"":void 0:(s=a.charCodeAt(c))<55296||s>56319||c+1===u||(i=a.charCodeAt(c+1))<56320||i>57343?t?a.charAt(c):s:t?a.slice(c,c+2):i-56320+(s-55296<<10)+65536}};t.exports={codeAt:s(!1),charAt:s(!0)}},function(t,e,n){"use strict";(function(e){var r=n(7),o=n(127),s={"Content-Type":"application/x-www-form-urlencoded"};function i(t,e){!r.isUndefined(t)&&r.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var a,c={adapter:("undefined"!=typeof XMLHttpRequest?a=n(79):void 0!==e&&(a=n(79)),a),transformRequest:[function(t,e){return o(e,"Content-Type"),r.isFormData(t)||r.isArrayBuffer(t)||r.isBuffer(t)||r.isStream(t)||r.isFile(t)||r.isBlob(t)?t:r.isArrayBufferView(t)?t.buffer:r.isURLSearchParams(t)?(i(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):r.isObject(t)?(i(e,"application/json;charset=utf-8"),JSON.stringify(t)):t}],transformResponse:[function(t){if("string"==typeof t)try{t=JSON.parse(t)}catch(t){}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(t){return t>=200&&t<300}};c.headers={common:{Accept:"application/json, text/plain, */*"}},r.forEach(["delete","get","head"],function(t){c.headers[t]={}}),r.forEach(["post","put","patch"],function(t){c.headers[t]=r.merge(s)}),t.exports=c}).call(this,n(78))},function(t,e,n){n(2),n(9),n(5),(()=>{const e=n(25),{ArgumentError:r}=n(6);class o{constructor(t){const e={label:null,attributes:{},points:null,outside:null,occluded:null,keyframe:null,group:null,zOrder:null,lock:null,color:null,clientID:t.clientID,serverID:t.serverID,frame:t.frame,objectType:t.objectType,shapeType:t.shapeType,updateFlags:{}};Object.defineProperty(e.updateFlags,"reset",{value:function(){this.label=!1,this.attributes=!1,this.points=!1,this.outside=!1,this.occluded=!1,this.keyframe=!1,this.group=!1,this.zOrder=!1,this.lock=!1,this.color=!1},writable:!1}),Object.defineProperties(this,Object.freeze({updateFlags:{get:()=>e.updateFlags},frame:{get:()=>e.frame},objectType:{get:()=>e.objectType},shapeType:{get:()=>e.shapeType},clientID:{get:()=>e.clientID},serverID:{get:()=>e.serverID},label:{get:()=>e.label,set:t=>{e.updateFlags.label=!0,e.label=t}},color:{get:()=>e.color,set:t=>{e.updateFlags.color=!0,e.color=t}},points:{get:()=>e.points,set:t=>{if(!Array.isArray(t))throw new r("Points are expected to be an array "+`but got ${"object"==typeof t?t.constructor.name:typeof t}`);e.updateFlags.points=!0,e.points=[...t]}},group:{get:()=>e.group,set:t=>{e.updateFlags.group=!0,e.group=t}},zOrder:{get:()=>e.zOrder,set:t=>{e.updateFlags.zOrder=!0,e.zOrder=t}},outside:{get:()=>e.outside,set:t=>{e.updateFlags.outside=!0,e.outside=t}},keyframe:{get:()=>e.keyframe,set:t=>{e.updateFlags.keyframe=!0,e.keyframe=t}},occluded:{get:()=>e.occluded,set:t=>{e.updateFlags.occluded=!0,e.occluded=t}},lock:{get:()=>e.lock,set:t=>{e.updateFlags.lock=!0,e.lock=t}},attributes:{get:()=>e.attributes,set:t=>{if("object"!=typeof t)throw new r("Attributes are expected to be an object "+`but got ${"object"==typeof t?t.constructor.name:typeof t}`);for(const n of Object.keys(t))e.updateFlags.attributes=!0,e.attributes[n]=t[n]}}})),this.label=t.label,this.group=t.group,this.zOrder=t.zOrder,this.outside=t.outside,this.keyframe=t.keyframe,this.occluded=t.occluded,this.color=t.color,this.lock=t.lock,void 0!==t.points&&(this.points=t.points),void 0!==t.attributes&&(this.attributes=t.attributes),e.updateFlags.reset()}async save(){return await e.apiWrapper.call(this,o.prototype.save)}async delete(t=!1){return await e.apiWrapper.call(this,o.prototype.delete,t)}async up(){return await e.apiWrapper.call(this,o.prototype.up)}async down(){return await e.apiWrapper.call(this,o.prototype.down)}}o.prototype.save.implementation=async function(){return this.hidden&&this.hidden.save?this.hidden.save():this},o.prototype.delete.implementation=async function(t){return!(!this.hidden||!this.hidden.delete)&&this.hidden.delete(t)},o.prototype.up.implementation=async function(){return!(!this.hidden||!this.hidden.up)&&this.hidden.up()},o.prototype.down.implementation=async function(){return!(!this.hidden||!this.hidden.down)&&this.hidden.down()},t.exports=o})()},function(t,e,n){"use strict";n(13)({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return URL.prototype.toString.call(this)}})},function(t,e,n){"use strict";var r={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,s=o&&!r.call({1:2},1);e.f=s?function(t){var e=o(this,t);return!!e&&e.enumerable}:r},function(t,e,n){var r=n(3),o=n(16),s="".split;t.exports=r(function(){return!Object("z").propertyIsEnumerable(0)})?function(t){return"String"==o(t)?s.call(t,""):Object(t)}:Object},function(t,e,n){var r=n(10),o=n(3),s=n(41);t.exports=!r&&!o(function(){return 7!=Object.defineProperty(s("div"),"a",{get:function(){return 7}}).a})},function(t,e,n){var r=n(29);t.exports=r("native-function-to-string",Function.toString)},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++n+r).toString(36)}},function(t,e,n){var r=n(8),o=n(91),s=n(39),i=n(14);t.exports=function(t,e){for(var n=o(e),a=i.f,c=s.f,u=0;uc;)r(a,n=e[c++])&&(~s(u,n)||u.push(n));return u}},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e,n){var r=n(3),o=/#|\.prototype\./,s=function(t,e){var n=a[i(t)];return n==u||n!=c&&("function"==typeof e?r(e):!!e)},i=s.normalize=function(t){return String(t).replace(o,".").toLowerCase()},a=s.data={},c=s.NATIVE="N",u=s.POLYFILL="P";t.exports=s},function(t,e,n){var r=n(15);t.exports=function(t,e,n){for(var o in e)r(t,o,e[o],n);return t}},function(t,e,n){var r=n(1),o=n(24),s=r("iterator"),i=Array.prototype;t.exports=function(t){return void 0!==t&&(o.Array===t||i[s]===t)}},function(t,e,n){var r=n(4);t.exports=function(t,e,n,o){try{return o?e(r(n)[0],n[1]):e(n)}catch(e){var s=t.return;throw void 0!==s&&r(s.call(t)),e}}},function(t,e,n){var r,o,s,i=n(0),a=n(3),c=n(16),u=n(33),l=n(66),p=n(41),f=i.location,h=i.setImmediate,d=i.clearImmediate,b=i.process,g=i.MessageChannel,m=i.Dispatch,y=0,v={},w=function(t){if(v.hasOwnProperty(t)){var e=v[t];delete v[t],e()}},O=function(t){return function(){w(t)}},x=function(t){w(t.data)},k=function(t){i.postMessage(t+"",f.protocol+"//"+f.host)};h&&d||(h=function(t){for(var e=[],n=1;arguments.length>n;)e.push(arguments[n++]);return v[++y]=function(){("function"==typeof t?t:Function(t)).apply(void 0,e)},r(y),y},d=function(t){delete v[t]},"process"==c(b)?r=function(t){b.nextTick(O(t))}:m&&m.now?r=function(t){m.now(O(t))}:g?(s=(o=new g).port2,o.port1.onmessage=x,r=u(s.postMessage,s,1)):!i.addEventListener||"function"!=typeof postMessage||i.importScripts||a(k)?r="onreadystatechange"in p("script")?function(t){l.appendChild(p("script")).onreadystatechange=function(){l.removeChild(this),w(t)}}:function(t){setTimeout(O(t),0)}:(r=k,i.addEventListener("message",x,!1))),t.exports={set:h,clear:d}},function(t,e,n){var r=n(30);t.exports=r("document","documentElement")},function(t,e,n){var r=n(30);t.exports=r("navigator","userAgent")||""},function(t,e,n){"use strict";var r=n(23),o=function(t){var e,n;this.promise=new t(function(t,r){if(void 0!==e||void 0!==n)throw TypeError("Bad Promise constructor");e=t,n=r}),this.resolve=r(e),this.reject=r(n)};t.exports.f=function(t){return new o(t)}},function(t,e,n){var r=n(4),o=n(70),s=n(45),i=n(44),a=n(66),c=n(41),u=n(43)("IE_PROTO"),l=function(){},p=function(){var t,e=c("iframe"),n=s.length;for(e.style.display="none",a.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(" + diff --git a/cvat/apps/engine/static/engine/js/cvat-core.min.js b/cvat/apps/engine/static/engine/js/cvat-core.min.js new file mode 100644 index 00000000..8dc7fe2d --- /dev/null +++ b/cvat/apps/engine/static/engine/js/cvat-core.min.js @@ -0,0 +1,15 @@ +window.cvat=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=90)}([function(t,e,n){(function(e){var n="object",r=function(t){return t&&t.Math==Math&&t};t.exports=r(typeof globalThis==n&&globalThis)||r(typeof window==n&&window)||r(typeof self==n&&self)||r(typeof e==n&&e)||Function("return this")()}).call(this,n(28))},function(t,e,n){var r=n(0),o=n(31),i=n(57),s=n(96),a=r.Symbol,c=o("wks");t.exports=function(t){return c[t]||(c[t]=s&&a[t]||(s?a:i)("Symbol."+t))}},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,n){var r=n(11);t.exports=function(t){if(!r(t))throw TypeError(String(t)+" is not an object");return t}},function(t,e,n){"use strict";var r=n(30),o=n(107),i=n(25),s=n(17),a=n(73),c=s.set,u=s.getterFor("Array Iterator");t.exports=a(Array,"Array",function(t,e){c(this,{type:"Array Iterator",target:r(t),index:0,kind:e})},function(){var t=u(this),e=t.target,n=t.kind,r=t.index++;return!e||r>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:e[r],done:!1}:{value:[r,e[r]],done:!1}},"values"),i.Arguments=i.Array,o("keys"),o("values"),o("entries")},function(t,e,n){n(9),(()=>{const e=n(112),r=n(114),o=n(48);class i extends Error{constructor(t){super(t);const n=(new Date).toISOString(),i=e.os.toString(),s=`${e.name} ${e.version}`,a=r.parse(this)[0],c=`${a.fileName}`,u=a.lineNumber,l=a.columnNumber,{jobID:p,taskID:f,clientID:h}=o;Object.defineProperties(this,Object.freeze({system:{get:()=>i},client:{get:()=>s},time:{get:()=>n},jobID:{get:()=>p},taskID:{get:()=>f},projID:{get:()=>void 0},clientID:{get:()=>h},filename:{get:()=>c},line:{get:()=>u},column:{get:()=>l}}))}async save(){const t={system:this.system,client:this.client,time:this.time,job_id:this.jobID,task_id:this.taskID,proj_id:this.projID,client_id:this.clientID,message:this.message,filename:this.filename,line:this.line,column:this.column,stack:this.stack};try{const e=n(18);await e.server.exception(t)}catch(t){}}}t.exports={Exception:i,ArgumentError:class extends i{constructor(t){super(t)}},DataError:class extends i{constructor(t){super(t)}},ScriptingError:class extends i{constructor(t){super(t)}},PluginError:class extends i{constructor(t){super(t)}},ServerError:class extends i{constructor(t,e){super(t),Object.defineProperties(this,Object.freeze({code:{get:()=>e}}))}}}})()},function(t,e,n){"use strict";var r=n(78),o=n(135),i=Object.prototype.toString;function s(t){return"[object Array]"===i.call(t)}function a(t){return null!==t&&"object"==typeof t}function c(t){return"[object Function]"===i.call(t)}function u(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),s(t))for(var n=0,r=t.length;ns;){var a,c,u,l=r[s++],p=i?l.ok:l.fail,f=l.resolve,h=l.reject,d=l.domain;try{p?(i||(2===e.rejection&&Y(t,e),e.rejection=1),!0===p?a=o:(d&&d.enter(),a=p(o),d&&(d.exit(),u=!0)),a===l.promise?h(M("Promise-chain cycle")):(c=V(a))?c.call(a,f,h):f(a)):h(o)}catch(t){d&&!u&&d.exit(),h(t)}}e.reactions=[],e.notified=!1,n&&!e.rejection&&K(t,e)})}},H=function(t,e,n){var r,o;G?((r=$.createEvent("Event")).promise=e,r.reason=n,r.initEvent(t,!1,!0),c.dispatchEvent(r)):r={promise:e,reason:n},(o=c["on"+t])?o(r):"unhandledrejection"===t&&j("Unhandled promise rejection",n)},K=function(t,e){w.call(c,function(){var n,r=e.value;if(Z(e)&&(n=S(function(){W?R.emit("unhandledRejection",r,t):H("unhandledrejection",t,r)}),e.rejection=W||Z(e)?2:1,n.error))throw n.value})},Z=function(t){return 1!==t.rejection&&!t.parent},Y=function(t,e){w.call(c,function(){W?R.emit("rejectionHandled",t):H("rejectionhandled",t,e.value)})},Q=function(t,e,n,r){return function(o){t(e,n,o,r)}},tt=function(t,e,n,r){e.done||(e.done=!0,r&&(e=r),e.value=n,e.state=2,X(t,e,!0))},et=function(t,e,n,r){if(!e.done){e.done=!0,r&&(e=r);try{if(t===n)throw M("Promise can't be resolved itself");var o=V(n);o?O(function(){var r={done:!1};try{o.call(n,Q(et,t,r,e),Q(tt,t,r,e))}catch(n){tt(t,r,n,e)}}):(e.value=n,e.state=1,X(t,e,!1))}catch(n){tt(t,{done:!1},n,e)}}};J&&(N=function(t){b(this,N,P),d(t),r.call(this);var e=I(this);try{t(Q(et,this,e),Q(tt,this,e))}catch(t){tt(this,e,t)}},(r=function(t){F(this,{type:P,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=l(N.prototype,{then:function(t,e){var n=C(this),r=B(v(this,N));return r.ok="function"!=typeof t||t,r.fail="function"==typeof e&&e,r.domain=W?R.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&X(this,n,!1),r.promise},catch:function(t){return this.then(void 0,t)}}),o=function(){var t=new r,e=I(t);this.promise=t,this.resolve=Q(et,t,e),this.reject=Q(tt,t,e)},k.f=B=function(t){return t===N||t===i?new o(t):U(t)},a||"function"!=typeof D||s({global:!0,enumerable:!0,forced:!0},{fetch:function(t){return x(N,D.apply(c,arguments))}})),s({global:!0,wrap:!0,forced:J},{Promise:N}),p(N,P,!1,!0),f(P),i=u.Promise,s({target:P,stat:!0,forced:J},{reject:function(t){var e=B(this);return e.reject.call(void 0,t),e.promise}}),s({target:P,stat:!0,forced:a||J},{resolve:function(t){return x(a&&this===i?N:this,t)}}),s({target:P,stat:!0,forced:q},{all:function(t){var e=this,n=B(e),r=n.resolve,o=n.reject,i=S(function(){var n=d(e.resolve),i=[],s=0,a=1;m(t,function(t){var c=s++,u=!1;i.push(void 0),a++,n.call(e,t).then(function(t){u||(u=!0,i[c]=t,--a||r(i))},o)}),--a||r(i)});return i.error&&o(i.value),n.promise},race:function(t){var e=this,n=B(e),r=n.reject,o=S(function(){var o=d(e.resolve);m(t,function(t){o.call(e,t).then(n.resolve,r)})});return o.error&&r(o.value),n.promise}})},function(t,e,n){var r=n(2);t.exports=!r(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,n){var r=n(10),o=n(14),i=n(29);t.exports=r?function(t,e,n){return o.f(t,e,i(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var r=n(0),o=n(40).f,i=n(12),s=n(16),a=n(43),c=n(58),u=n(62);t.exports=function(t,e){var n,l,p,f,h,d=t.target,b=t.global,g=t.stat;if(n=b?r:g?r[d]||a(d,{}):(r[d]||{}).prototype)for(l in e){if(f=e[l],p=t.noTargetGet?(h=o(n,l))&&h.value:n[l],!u(b?l:d+(g?".":"#")+l,t.forced)&&void 0!==p){if(typeof f==typeof p)continue;c(f,p)}(t.sham||p&&p.sham)&&i(f,"sham",!0),s(n,l,f,t)}}},function(t,e,n){var r=n(10),o=n(55),i=n(3),s=n(41),a=Object.defineProperty;e.f=r?a:function(t,e,n){if(i(t),e=s(e,!0),i(n),o)try{return a(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e,n){var r=n(0),o=n(31),i=n(12),s=n(7),a=n(43),c=n(56),u=n(17),l=u.get,p=u.enforce,f=String(c).split("toString");o("inspectSource",function(t){return c.call(t)}),(t.exports=function(t,e,n,o){var c=!!o&&!!o.unsafe,u=!!o&&!!o.enumerable,l=!!o&&!!o.noTargetGet;"function"==typeof n&&("string"!=typeof e||s(n,"name")||i(n,"name",e),p(n).source=f.join("string"==typeof e?e:"")),t!==r?(c?!l&&t[e]&&(u=!0):delete t[e],u?t[e]=n:i(t,e,n)):u?t[e]=n:a(e,n)})(Function.prototype,"toString",function(){return"function"==typeof this&&l(this).source||c.call(this)})},function(t,e,n){var r,o,i,s=n(91),a=n(0),c=n(11),u=n(12),l=n(7),p=n(44),f=n(45),h=a.WeakMap;if(s){var d=new h,b=d.get,g=d.has,m=d.set;r=function(t,e){return m.call(d,t,e),e},o=function(t){return b.call(d,t)||{}},i=function(t){return g.call(d,t)}}else{var y=p("state");f[y]=!0,r=function(t,e){return u(t,y,e),e},o=function(t){return l(t,y)?t[y]:{}},i=function(t){return l(t,y)}}t.exports={set:r,get:o,has:i,enforce:function(t){return i(t)?o(t):r(t,{})},getterFor:function(t){return function(e){var n;if(!c(e)||(n=o(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return n}}}},function(t,e,n){n(9),n(116),(()=>{const e=n(121),{ServerError:r}=n(5),o=n(122),i=n(48);const s=new class{constructor(){const s=n(133);s.defaults.withCredentials=!0,s.defaults.xsrfHeaderName="X-CSRFTOKEN",s.defaults.xsrfCookieName="csrftoken";let a=o.get("token");async function c(t=""){const{backendAPI:e}=i;let n=null;try{n=await s.get(`${e}/tasks?${t}`,{proxy:i.proxy})}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not get tasks from a server",e)}return n.data.results.count=n.data.count,n.data.results}async function u(t){const{backendAPI:e}=i;try{await s.delete(`${e}/tasks/${t}`)}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not delete the task from the server",e)}}a&&(s.defaults.headers.common.Authorization=`Token ${a}`),Object.defineProperties(this,Object.freeze({server:{value:Object.freeze({about:async function(){const{backendAPI:t}=i;let e=null;try{e=await s.get(`${t}/server/about`,{proxy:i.proxy})}catch(t){const e=t.response?t.response.status:t.code;throw new r('Could not get "about" information from the server',e)}return e.data},share:async function(t){const{backendAPI:e}=i;t=encodeURIComponent(t);let n=null;try{n=await s.get(`${e}/server/share?directory=${t}`,{proxy:i.proxy})}catch(t){const e=t.response?t.response.status:t.code;throw new r('Could not get "share" information from the server',e)}return n.data},formats:async function(){const{backendAPI:t}=i;let e=null;try{e=await s.get(`${t}/server/annotation/formats`,{proxy:i.proxy})}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not get annotation formats from the server",e)}return e.data},exception:async function(t){const{backendAPI:e}=i;try{await s.post(`${e}/server/exception`,JSON.stringify(t),{proxy:i.proxy,headers:{"Content-Type":"application/json"}})}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not send an exception to the server",e)}},login:async function(t,e){const n=[`${encodeURIComponent("username")}=${encodeURIComponent(t)}`,`${encodeURIComponent("password")}=${encodeURIComponent(e)}`].join("&").replace(/%20/g,"+");let c=null;try{c=await s.post(`${i.backendAPI}/auth/login`,n,{proxy:i.proxy})}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not login on a server",e)}if(c.headers["set-cookie"]){const t=c.headers["set-cookie"].join(";");s.defaults.headers.common.Cookie=t}a=c.data.key,o.set("token",a),s.defaults.headers.common.Authorization=`Token ${a}`},logout:async function(){try{await s.post(`${i.backendAPI}/auth/logout`,{proxy:i.proxy})}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not logout from the server",e)}o.remove("token"),s.defaults.headers.common.Authorization=""},authorized:async function(){try{await t.exports.users.getSelf()}catch(t){if(401===t.code)return!1;throw t}return!0},register:async function(t,e,n,o,a,c){let u=null;try{const l=JSON.stringify({username:t,first_name:e,last_name:n,email:o,password1:a,password2:c});u=await s.post(`${i.backendAPI}/auth/register`,l,{proxy:i.proxy})}catch(e){const n=e.response?e.response.status:e.code;throw new r(`Could not register '${t}' user on the server`,n)}return u.data}}),writable:!1},tasks:{value:Object.freeze({getTasks:c,saveTask:async function(t,e){const{backendAPI:n}=i;try{await s.patch(`${n}/tasks/${t}`,JSON.stringify(e),{proxy:i.proxy,headers:{"Content-Type":"application/json"}})}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not save the task on the server",e)}},createTask:async function(t,n,o){const{backendAPI:a}=i,l=new e;for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t))for(let e=0;e{setTimeout(async function i(){try{const c=await s.get(`${a}/tasks/${t}/status`);["Queued","Started"].includes(c.data.state)?(""!==c.data.message&&o(c.data.message),setTimeout(i,1e3)):"Finished"===c.data.state?e():"Failed"===c.data.state?n(new r("Could not create the task on the server",400)):n(new r(`Unknown task state has been received: ${c.data.state}`,500))}catch(t){const e=t.response?t.response.status:t.code;n(new r("Data uploading error occurred",e))}},1e3)})}(p.data.id)}catch(t){throw await u(p.data.id),t}return(await c(`?id=${p.id}`))[0]},deleteTask:u}),writable:!1},jobs:{value:Object.freeze({getJob:async function(t){const{backendAPI:e}=i;let n=null;try{n=await s.get(`${e}/jobs/${t}`,{proxy:i.proxy})}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not get jobs from a server",e)}return n.data},saveJob:async function(t,e){const{backendAPI:n}=i;try{await s.patch(`${n}/jobs/${t}`,JSON.stringify(e),{proxy:i.proxy,headers:{"Content-Type":"application/json"}})}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not save the job on the server",e)}}}),writable:!1},users:{value:Object.freeze({getUsers:async function(){const{backendAPI:t}=i;let e=null;try{e=await s.get(`${t}/users`,{proxy:i.proxy})}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not get users from the server",e)}return e.data.results},getSelf:async function(){const{backendAPI:t}=i;let e=null;try{e=await s.get(`${t}/users/self`,{proxy:i.proxy})}catch(t){const e=t.response?t.response.status:t.code;throw new r("Could not get user data from the server",e)}return e.data}}),writable:!1},frames:{value:Object.freeze({getData:async function(t,e){const{backendAPI:n}=i;let o=null;try{o=await s.get(`${n}/tasks/${t}/frames/${e}`,{proxy:i.proxy,responseType:"blob"})}catch(n){const o=n.response?n.response.status:n.code;throw new r(`Could not get frame ${e} for the task ${t} from the server`,o)}return o.data},getMeta:async function(t){const{backendAPI:e}=i;let n=null;try{n=await s.get(`${e}/tasks/${t}/frames/meta`,{proxy:i.proxy})}catch(e){const n=e.response?e.response.status:e.code;throw new r(`Could not get frame meta info for the task ${t} from the server`,n)}return n.data}}),writable:!1},annotations:{value:Object.freeze({updateAnnotations:async function(t,e,n,o){const{backendAPI:a}=i;let c=null,u=null;"PUT"===o.toUpperCase()?(c=s.put.bind(s),u=`${a}/${t}s/${e}/annotations`):(c=s.patch.bind(s),u=`${a}/${t}s/${e}/annotations?action=${o}`);let l=null;try{l=await c(u,JSON.stringify(n),{proxy:i.proxy,headers:{"Content-Type":"application/json"}})}catch(n){const o=n.response?n.response.status:n.code;throw new r(`Could not updated annotations for the ${t} ${e} on the server`,o)}return l.data},getAnnotations:async function(t,e){const{backendAPI:n}=i;let o=null;try{o=await s.get(`${n}/${t}s/${e}/annotations`,{proxy:i.proxy})}catch(n){const o=n.response?n.response.status:n.code;throw new r(`Could not get annotations for the ${t} ${e} from the server`,o)}return o.data},dumpAnnotations:async function(t,e,n){const{backendAPI:o}=i,a=e.replace(/\//g,"_");let c=`${o}/tasks/${t}/annotations/${a}?format=${n}`;return new Promise((e,n)=>{setTimeout(async function o(){try{202===(await s.get(`${c}`,{proxy:i.proxy})).status?setTimeout(o,3e3):e(c=`${c}&action=download`)}catch(e){const o=e.response?e.response.status:e.code,i=new r(`Could not dump annotations for the task ${t} from the server`,o);n(i)}})})},uploadAnnotations:async function(t,n,o,a){const{backendAPI:c}=i;let u=new e;return u.append("annotation_file",o),new Promise((o,l)=>{setTimeout(async function p(){try{202===(await s.put(`${c}/${t}s/${n}/annotations?format=${a}`,u,{proxy:i.proxy})).status?(u=new e,setTimeout(p,3e3)):o()}catch(e){const o=e.response?e.response.status:e.code,i=new r(`Could not upload annotations for the ${t} ${n}`,o);l(i)}})})}}),writable:!1}}))}};t.exports=s})()},function(t,e,n){(function(e){var n=Object.assign?Object.assign:function(t,e,n,r){for(var o=1;o{const e=Object.freeze({DIR:"DIR",REG:"REG"}),n=Object.freeze({ANNOTATION:"annotation",VALIDATION:"validation",COMPLETED:"completed"}),r=Object.freeze({ANNOTATION:"annotation",INTERPOLATION:"interpolation"}),o=Object.freeze({CHECKBOX:"checkbox",RADIO:"radio",SELECT:"select",NUMBER:"number",TEXT:"text"}),i=Object.freeze({TAG:"tag",SHAPE:"shape",TRACK:"track"}),s=Object.freeze({RECTANGLE:"rectangle",POLYGON:"polygon",POLYLINE:"polyline",POINTS:"points"}),a=Object.freeze({frameDownloaded:0});t.exports={ShareFileType:e,TaskStatus:n,TaskMode:r,AttributeType:o,ObjectType:i,ObjectShape:s,LogType:{pasteObject:0,changeAttribute:1,dragObject:2,deleteObject:3,pressShortcut:4,resizeObject:5,sendLogs:6,saveJob:7,jumpFrame:8,drawObject:9,changeLabel:10,sendTaskInfo:11,loadJob:12,moveImage:13,zoomImage:14,lockObject:15,mergeObjects:16,copyObject:17,propagateObject:18,undoAction:19,redoAction:20,sendUserActivity:21,sendException:22,changeFrame:23,debugInfo:24,fitImage:25,rotateImage:26},EventType:a}})()},function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,e){t.exports=!1},function(t,e,n){var r=n(14).f,o=n(7),i=n(1)("toStringTag");t.exports=function(t,e,n){t&&!o(t=n?t:t.prototype,i)&&r(t,i,{configurable:!0,value:e})}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t}},function(t,e){t.exports={}},function(t,e,n){n(106),n(4),n(9),n(8),(()=>{const{PluginError:e}=n(5),r=[];class o{static async apiWrapper(t,...n){const r=await o.list();for(const o of r){const r=o.functions.filter(e=>e.callback===t)[0];if(r&&r.enter)try{await r.enter.call(this,o,...n)}catch(t){throw t instanceof e?t:new e(`Exception in plugin ${o.name}: ${t.toString()}`)}}let i=await t.implementation.call(this,...n);for(const o of r){const r=o.functions.filter(e=>e.callback===t)[0];if(r&&r.leave)try{i=await r.leave.call(this,o,i,...n)}catch(t){throw t instanceof e?t:new e(`Exception in plugin ${o.name}: ${t.toString()}`)}}return i}static async register(t){const n=[];if("object"!=typeof t)throw new e(`Plugin should be an object, but got "${typeof t}"`);if(!("name"in t)||"string"!=typeof t.name)throw new e('Plugin must contain a "name" field and it must be a string');if(!("description"in t)||"string"!=typeof t.description)throw new e('Plugin must contain a "description" field and it must be a string');if("functions"in t)throw new e('Plugin must not contain a "functions" field');!function t(e,r){const o={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&("object"==typeof e[n]?Object.prototype.hasOwnProperty.call(r,n)&&t(e[n],r[n]):["enter","leave"].includes(n)&&"function"==typeof r&&(e[n],1)&&(o.callback=r,o[n]=e[n]));Object.keys(o).length&&n.push(o)}(t,{cvat:this}),Object.defineProperty(t,"functions",{value:n,writable:!1}),r.push(t)}static async list(){return r}}t.exports=o})()},function(t,e,n){var r=n(21);t.exports=function(t){return Object(r(t))}},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,n){var r=n(54),o=n(21);t.exports=function(t){return r(o(t))}},function(t,e,n){var r=n(0),o=n(43),i=n(22),s=r["__core-js_shared__"]||o("__core-js_shared__",{});(t.exports=function(t,e){return s[t]||(s[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.1.3",mode:i?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(t,e,n){var r=n(59),o=n(0),i=function(t){return"function"==typeof t?t:void 0};t.exports=function(t,e){return arguments.length<2?i(r[t])||i(o[t]):r[t]&&r[t][e]||o[t]&&o[t][e]}},function(t,e,n){var r=n(34),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},function(t,e,n){var r=n(24);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 0:return function(){return t.call(e)};case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}}},function(t,e,n){var r=n(99),o=n(25),i=n(1)("iterator");t.exports=function(t){if(null!=t)return t[i]||t["@@iterator"]||o[r(t)]}},function(t,e,n){n(4),n(9),n(151),n(8),n(52),(()=>{const e=n(26),r=n(18),{getFrame:o}=n(154),{ArgumentError:i}=n(5),{TaskStatus:s}=n(20),{Label:a}=n(38);function c(t){Object.defineProperties(t,{annotations:Object.freeze({value:{async upload(n,r){return await e.apiWrapper.call(this,t.annotations.upload,n,r)},async save(){return await e.apiWrapper.call(this,t.annotations.save)},async clear(n=!1){return await e.apiWrapper.call(this,t.annotations.clear,n)},async dump(n,r){return await e.apiWrapper.call(this,t.annotations.dump,n,r)},async statistics(){return await e.apiWrapper.call(this,t.annotations.statistics)},async put(n=[]){return await e.apiWrapper.call(this,t.annotations.put,n)},async get(n,r={}){return await e.apiWrapper.call(this,t.annotations.get,n,r)},async search(n,r,o){return await e.apiWrapper.call(this,t.annotations.search,n,r,o)},async select(n,r,o){return await e.apiWrapper.call(this,t.annotations.select,n,r,o)},async hasUnsavedChanges(){return await e.apiWrapper.call(this,t.annotations.hasUnsavedChanges)},async merge(n){return await e.apiWrapper.call(this,t.annotations.merge,n)},async split(n,r){return await e.apiWrapper.call(this,t.annotations.split,n,r)},async group(n,r=!1){return await e.apiWrapper.call(this,t.annotations.group,n,r)}},writable:!0}),frames:Object.freeze({value:{async get(n){return await e.apiWrapper.call(this,t.frames.get,n)}},writable:!0}),logs:Object.freeze({value:{async put(n,r){return await e.apiWrapper.call(this,t.logs.put,n,r)},async save(n){return await e.apiWrapper.call(this,t.logs.save,n)}},writable:!0}),actions:Object.freeze({value:{async undo(n){return await e.apiWrapper.call(this,t.actions.undo,n)},async redo(n){return await e.apiWrapper.call(this,t.actions.redo,n)},async clear(){return await e.apiWrapper.call(this,t.actions.clear)}},writable:!0}),events:Object.freeze({value:{async subscribe(n,r){return await e.apiWrapper.call(this,t.events.subscribe,n,r)},async unsubscribe(n,r=null){return await e.apiWrapper.call(this,t.events.unsubscribe,n,r)}},writable:!0})})}class u{constructor(){}}class l extends u{constructor(t){super();const e={id:void 0,assignee:void 0,status:void 0,start_frame:void 0,stop_frame:void 0,task:void 0};for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&(n in t&&(e[n]=t[n]),void 0===e[n]))throw new i(`Job field "${n}" was not initialized`);Object.defineProperties(this,Object.freeze({id:{get:()=>e.id},assignee:{get:()=>e.assignee,set:()=>t=>{if(!Number.isInteger(t)||t<0)throw new i("Value must be a non negative integer");e.assignee=t}},status:{get:()=>e.status,set:t=>{const n=s;let r=!1;for(const e in n)if(n[e]===t){r=!0;break}if(!r)throw new i("Value must be a value from the enumeration cvat.enums.TaskStatus");e.status=t}},startFrame:{get:()=>e.start_frame},stopFrame:{get:()=>e.stop_frame},task:{get:()=>e.task}})),this.annotations={get:Object.getPrototypeOf(this).annotations.get.bind(this),put:Object.getPrototypeOf(this).annotations.put.bind(this),save:Object.getPrototypeOf(this).annotations.save.bind(this),dump:Object.getPrototypeOf(this).annotations.dump.bind(this),merge:Object.getPrototypeOf(this).annotations.merge.bind(this),split:Object.getPrototypeOf(this).annotations.split.bind(this),group:Object.getPrototypeOf(this).annotations.group.bind(this),clear:Object.getPrototypeOf(this).annotations.clear.bind(this),upload:Object.getPrototypeOf(this).annotations.upload.bind(this),select:Object.getPrototypeOf(this).annotations.select.bind(this),statistics:Object.getPrototypeOf(this).annotations.statistics.bind(this),hasUnsavedChanges:Object.getPrototypeOf(this).annotations.hasUnsavedChanges.bind(this)},this.frames={get:Object.getPrototypeOf(this).frames.get.bind(this)}}async save(){return await e.apiWrapper.call(this,l.prototype.save)}}class p extends u{constructor(t){super();const e={id:void 0,name:void 0,status:void 0,size:void 0,mode:void 0,owner:void 0,assignee:void 0,created_date:void 0,updated_date:void 0,bug_tracker:void 0,overlap:void 0,segment_size:void 0,z_order:void 0,image_quality:void 0,start_frame:void 0,stop_frame:void 0,frame_filter:void 0};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&n in t&&(e[n]=t[n]);if(e.labels=[],e.jobs=[],e.files=Object.freeze({server_files:[],client_files:[],remote_files:[]}),Array.isArray(t.segments))for(const n of t.segments)if(Array.isArray(n.jobs))for(const t of n.jobs){const r=new l({url:t.url,id:t.id,assignee:t.assignee,status:t.status,start_frame:n.start_frame,stop_frame:n.stop_frame,task:this});e.jobs.push(r)}if(Array.isArray(t.labels))for(const n of t.labels){const t=new a(n);e.labels.push(t)}Object.defineProperties(this,Object.freeze({id:{get:()=>e.id},name:{get:()=>e.name,set:t=>{if(!t.trim().length)throw new i("Value must not be empty");e.name=t}},status:{get:()=>e.status},size:{get:()=>e.size},mode:{get:()=>e.mode},owner:{get:()=>e.owner},assignee:{get:()=>e.assignee,set:()=>t=>{if(!Number.isInteger(t)||t<0)throw new i("Value must be a non negative integer");e.assignee=t}},createdDate:{get:()=>e.created_date},updatedDate:{get:()=>e.updated_date},bugTracker:{get:()=>e.bug_tracker,set:t=>{e.bug_tracker=t}},overlap:{get:()=>e.overlap,set:t=>{if(!Number.isInteger(t)||t<0)throw new i("Value must be a non negative integer");e.overlap=t}},segmentSize:{get:()=>e.segment_size,set:t=>{if(!Number.isInteger(t)||t<0)throw new i("Value must be a positive integer");e.segment_size=t}},zOrder:{get:()=>e.z_order,set:t=>{if("boolean"!=typeof t)throw new i("Value must be a boolean");e.z_order=t}},imageQuality:{get:()=>e.image_quality,set:t=>{if(!Number.isInteger(t)||t<0)throw new i("Value must be a positive integer");e.image_quality=t}},labels:{get:()=>[...e.labels],set:t=>{if(!Array.isArray(t))throw new i("Value must be an array of Labels");for(const e of t)if(!(e instanceof a))throw new i("Each array value must be an instance of Label. "+`${typeof e} was found`);void 0===e.id?e.labels=[...t]:e.labels=e.labels.concat([...t])}},jobs:{get:()=>[...e.jobs]},serverFiles:{get:()=>[...e.files.server_files],set:t=>{if(!Array.isArray(t))throw new i(`Value must be an array. But ${typeof t} has been got.`);for(const e of t)if("string"!=typeof e)throw new i(`Array values must be a string. But ${typeof e} has been got.`);Array.prototype.push.apply(e.files.server_files,t)}},clientFiles:{get:()=>[...e.files.client_files],set:t=>{if(!Array.isArray(t))throw new i(`Value must be an array. But ${typeof t} has been got.`);for(const e of t)if(!(e instanceof File))throw new i(`Array values must be a File. But ${e.constructor.name} has been got.`);Array.prototype.push.apply(e.files.client_files,t)}},remoteFiles:{get:()=>[...e.files.remote_files],set:t=>{if(!Array.isArray(t))throw new i(`Value must be an array. But ${typeof t} has been got.`);for(const e of t)if("string"!=typeof e)throw new i(`Array values must be a string. But ${typeof e} has been got.`);Array.prototype.push.apply(e.files.remote_files,t)}},startFrame:{get:()=>e.start_frame,set:t=>{if(!Number.isInteger(t)||t<0)throw new i("Value must be a not negative integer");e.start_frame=t}},stopFrame:{get:()=>e.stop_frame,set:t=>{if(!Number.isInteger(t)||t<0)throw new i("Value must be a not negative integer");e.stop_frame=t}},frameFilter:{get:()=>e.frame_filter,set:t=>{if("string"!=typeof t)throw new i(`Filter value must be a string. But ${typeof t} has been got.`);e.frame_filter=t}}})),this.annotations={get:Object.getPrototypeOf(this).annotations.get.bind(this),put:Object.getPrototypeOf(this).annotations.put.bind(this),save:Object.getPrototypeOf(this).annotations.save.bind(this),dump:Object.getPrototypeOf(this).annotations.dump.bind(this),merge:Object.getPrototypeOf(this).annotations.merge.bind(this),split:Object.getPrototypeOf(this).annotations.split.bind(this),group:Object.getPrototypeOf(this).annotations.group.bind(this),clear:Object.getPrototypeOf(this).annotations.clear.bind(this),upload:Object.getPrototypeOf(this).annotations.upload.bind(this),select:Object.getPrototypeOf(this).annotations.select.bind(this),statistics:Object.getPrototypeOf(this).annotations.statistics.bind(this),hasUnsavedChanges:Object.getPrototypeOf(this).annotations.hasUnsavedChanges.bind(this)},this.frames={get:Object.getPrototypeOf(this).frames.get.bind(this)}}async save(t=(()=>{})){return await e.apiWrapper.call(this,p.prototype.save,t)}async delete(){return await e.apiWrapper.call(this,p.prototype.delete)}}t.exports={Job:l,Task:p};const{getAnnotations:f,putAnnotations:h,saveAnnotations:d,hasUnsavedChanges:b,mergeAnnotations:g,splitAnnotations:m,groupAnnotations:y,clearAnnotations:v,selectObject:w,annotationsStatistics:O,uploadAnnotations:x,dumpAnnotations:j}=n(156);c(l.prototype),c(p.prototype),l.prototype.save.implementation=async function(){if(this.id){const t={status:this.status};return await r.jobs.saveJob(this.id,t),this}throw new i("Can not save job without and id")},l.prototype.frames.get.implementation=async function(t){if(!Number.isInteger(t)||t<0)throw new i(`Frame must be a positive integer. Got: "${t}"`);if(tthis.stopFrame)throw new i(`The frame with number ${t} is out of the job`);return await o(this.task.id,this.task.mode,t)},l.prototype.annotations.get.implementation=async function(t,e){if(tthis.stopFrame)throw new i(`Frame ${t} does not exist in the job`);return await f(this,t,e)},l.prototype.annotations.save.implementation=async function(t){return await d(this,t)},l.prototype.annotations.merge.implementation=async function(t){return await g(this,t)},l.prototype.annotations.split.implementation=async function(t,e){return await m(this,t,e)},l.prototype.annotations.group.implementation=async function(t,e){return await y(this,t,e)},l.prototype.annotations.hasUnsavedChanges.implementation=function(){return b(this)},l.prototype.annotations.clear.implementation=async function(t){return await v(this,t)},l.prototype.annotations.select.implementation=function(t,e,n){return w(this,t,e,n)},l.prototype.annotations.statistics.implementation=function(){return O(this)},l.prototype.annotations.put.implementation=function(t){return h(this,t)},l.prototype.annotations.upload.implementation=async function(t,e){return await x(this,t,e)},l.prototype.annotations.dump.implementation=async function(t,e){return await j(this,t,e)},p.prototype.save.implementation=async function(t){if(void 0!==this.id){const t={name:this.name,bug_tracker:this.bugTracker,z_order:this.zOrder,labels:[...this.labels.map(t=>t.toJSON())]};return await r.tasks.saveTask(this.id,t),this}const e={name:this.name,labels:this.labels.map(t=>t.toJSON()),image_quality:this.imageQuality,z_order:Boolean(this.zOrder)};this.bugTracker&&(e.bug_tracker=this.bugTracker),this.segmentSize&&(e.segment_size=this.segmentSize),this.overlap&&(e.overlap=this.overlap),this.startFrame&&(e.start_frame=this.startFrame),this.stopFrame&&(e.stop_frame=this.stopFrame),this.frameFilter&&(e.frame_filter=this.frameFilter);const n={client_files:this.clientFiles,server_files:this.serverFiles,remote_files:this.remoteFiles},o=await r.tasks.createTask(e,n,t);return new p(o)},p.prototype.delete.implementation=async function(){return await r.tasks.deleteTask(this.id)},p.prototype.frames.get.implementation=async function(t){if(!Number.isInteger(t)||t<0)throw new i(`Frame must be a positive integer. Got: "${t}"`);if(t>=this.size)throw new i(`The frame with number ${t} is out of the task`);return await o(this.id,this.mode,t)},p.prototype.annotations.get.implementation=async function(t,e){if(!Number.isInteger(t)||t<0)throw new i(`Frame must be a positive integer. Got: "${t}"`);if(t>=this.size)throw new i(`Frame ${t} does not exist in the task`);return await f(this,t,e)},p.prototype.annotations.save.implementation=async function(t){return await d(this,t)},p.prototype.annotations.merge.implementation=async function(t){return await g(this,t)},p.prototype.annotations.split.implementation=async function(t,e){return await m(this,t,e)},p.prototype.annotations.group.implementation=async function(t,e){return await y(this,t,e)},p.prototype.annotations.hasUnsavedChanges.implementation=function(){return b(this)},p.prototype.annotations.clear.implementation=async function(t){return await v(this,t)},p.prototype.annotations.select.implementation=function(t,e,n){return w(this,t,e,n)},p.prototype.annotations.statistics.implementation=function(){return O(this)},p.prototype.annotations.put.implementation=function(t){return h(this,t)},p.prototype.annotations.upload.implementation=async function(t,e){return await x(this,t,e)},p.prototype.annotations.dump.implementation=async function(t,e){return await j(this,t,e)}})()},function(t,e,n){n(4),n(8),n(52),(()=>{const{AttributeType:e}=n(20),{ArgumentError:r}=n(5);class o{constructor(t){const n={id:void 0,default_value:void 0,input_type:void 0,mutable:void 0,name:void 0,values:void 0};for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&Object.prototype.hasOwnProperty.call(t,e)&&(Array.isArray(t[e])?n[e]=[...t[e]]:n[e]=t[e]);if(!Object.values(e).includes(n.input_type))throw new r(`Got invalid attribute type ${n.input_type}`);Object.defineProperties(this,Object.freeze({id:{get:()=>n.id},defaultValue:{get:()=>n.default_value},inputType:{get:()=>n.input_type},mutable:{get:()=>n.mutable},name:{get:()=>n.name},values:{get:()=>[...n.values]}}))}toJSON(){const t={name:this.name,mutable:this.mutable,input_type:this.inputType,default_value:this.defaultValue,values:this.values};return void 0!==this.id&&(t.id=this.id),t}}t.exports={Attribute:o,Label:class{constructor(t){const e={id:void 0,name:void 0};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);if(e.attributes=[],Object.prototype.hasOwnProperty.call(t,"attributes")&&Array.isArray(t.attributes))for(const n of t.attributes)e.attributes.push(new o(n));Object.defineProperties(this,Object.freeze({id:{get:()=>e.id},name:{get:()=>e.name},attributes:{get:()=>[...e.attributes]}}))}toJSON(){const t={name:this.name,attributes:[...this.attributes.map(t=>t.toJSON())]};return void 0!==this.id&&(t.id=this.id),t}}}})()},function(t,e,n){(()=>{const{ArgumentError:e}=n(5);t.exports={isBoolean:function(t){return"boolean"==typeof t},isInteger:function(t){return"number"==typeof t&&Number.isInteger(t)},isEnum:function(t){for(const e in this)if(Object.prototype.hasOwnProperty.call(this,e)&&this[e]===t)return!0;return!1},isString:function(t){return"string"==typeof t},checkFilter:function(t,n){for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(!(r in n))throw new e(`Unsupported filter property has been recieved: "${r}"`);if(!n[r](t[r]))throw new e(`Received filter property "${r}" is not satisfied for checker`)}},checkObjectType:function(t,n,r,o){if(r){if(typeof n!==r){if("integer"===r&&Number.isInteger(n))return;throw new e(`"${t}" is expected to be "${r}", but "${typeof n}" has been got.`)}}else if(o&&!(n instanceof o)){if(void 0!==n)throw new e(`"${t}" is expected to be ${o.name}, but `+`"${n.constructor.name}" has been got`);throw new e(`"${t}" is expected to be ${o.name}, but "undefined" has been got.`)}}}})()},function(t,e,n){var r=n(10),o=n(53),i=n(29),s=n(30),a=n(41),c=n(7),u=n(55),l=Object.getOwnPropertyDescriptor;e.f=r?l:function(t,e){if(t=s(t),e=a(e,!0),u)try{return l(t,e)}catch(t){}if(c(t,e))return i(!o.f.call(t,e),t[e])}},function(t,e,n){var r=n(11);t.exports=function(t,e){if(!r(t))return t;var n,o;if(e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;if("function"==typeof(n=t.valueOf)&&!r(o=n.call(t)))return o;if(!e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,e,n){var r=n(0),o=n(11),i=r.document,s=o(i)&&o(i.createElement);t.exports=function(t){return s?i.createElement(t):{}}},function(t,e,n){var r=n(0),o=n(12);t.exports=function(t,e){try{o(r,t,e)}catch(n){r[t]=e}return e}},function(t,e,n){var r=n(31),o=n(57),i=r("keys");t.exports=function(t){return i[t]||(i[t]=o(t))}},function(t,e){t.exports={}},function(t,e){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(t,e){t.exports=function(t,e,n){if(!(t instanceof e))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return t}},function(t,e){t.exports={backendAPI:"http://localhost:7000/api/v1",proxy:!1,taskID:void 0,jobID:void 0,clientID:+Date.now().toString().substr(-6)}},function(t,e,n){var r=n(34),o=n(21),i=function(t){return function(e,n){var i,s,a=String(o(e)),c=r(n),u=a.length;return c<0||c>=u?t?"":void 0:(i=a.charCodeAt(c))<55296||i>56319||c+1===u||(s=a.charCodeAt(c+1))<56320||s>57343?t?a.charAt(c):i:t?a.slice(c,c+2):s-56320+(i-55296<<10)+65536}};t.exports={codeAt:i(!1),charAt:i(!0)}},function(t,e,n){"use strict";(function(e){var r=n(6),o=n(137),i={"Content-Type":"application/x-www-form-urlencoded"};function s(t,e){!r.isUndefined(t)&&r.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var a,c={adapter:("undefined"!=typeof XMLHttpRequest?a=n(80):void 0!==e&&(a=n(80)),a),transformRequest:[function(t,e){return o(e,"Content-Type"),r.isFormData(t)||r.isArrayBuffer(t)||r.isBuffer(t)||r.isStream(t)||r.isFile(t)||r.isBlob(t)?t:r.isArrayBufferView(t)?t.buffer:r.isURLSearchParams(t)?(s(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):r.isObject(t)?(s(e,"application/json;charset=utf-8"),JSON.stringify(t)):t}],transformResponse:[function(t){if("string"==typeof t)try{t=JSON.parse(t)}catch(t){}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(t){return t>=200&&t<300}};c.headers={common:{Accept:"application/json, text/plain, */*"}},r.forEach(["delete","get","head"],function(t){c.headers[t]={}}),r.forEach(["post","put","patch"],function(t){c.headers[t]=r.merge(i)}),t.exports=c}).call(this,n(79))},function(t,e,n){n(4),n(9),n(8),(()=>{const e=n(26),{ArgumentError:r}=n(5);class o{constructor(t){const e={label:null,attributes:{},points:null,outside:null,occluded:null,keyframe:null,group:null,zOrder:null,lock:null,color:null,clientID:t.clientID,serverID:t.serverID,frame:t.frame,objectType:t.objectType,shapeType:t.shapeType,updateFlags:{}};Object.defineProperty(e.updateFlags,"reset",{value:function(){this.label=!1,this.attributes=!1,this.points=!1,this.outside=!1,this.occluded=!1,this.keyframe=!1,this.group=!1,this.zOrder=!1,this.lock=!1,this.color=!1},writable:!1}),Object.defineProperties(this,Object.freeze({updateFlags:{get:()=>e.updateFlags},frame:{get:()=>e.frame},objectType:{get:()=>e.objectType},shapeType:{get:()=>e.shapeType},clientID:{get:()=>e.clientID},serverID:{get:()=>e.serverID},label:{get:()=>e.label,set:t=>{e.updateFlags.label=!0,e.label=t}},color:{get:()=>e.color,set:t=>{e.updateFlags.color=!0,e.color=t}},points:{get:()=>e.points,set:t=>{if(!Array.isArray(t))throw new r("Points are expected to be an array "+`but got ${"object"==typeof t?t.constructor.name:typeof t}`);e.updateFlags.points=!0,e.points=[...t]}},group:{get:()=>e.group,set:t=>{e.updateFlags.group=!0,e.group=t}},zOrder:{get:()=>e.zOrder,set:t=>{e.updateFlags.zOrder=!0,e.zOrder=t}},outside:{get:()=>e.outside,set:t=>{e.updateFlags.outside=!0,e.outside=t}},keyframe:{get:()=>e.keyframe,set:t=>{e.updateFlags.keyframe=!0,e.keyframe=t}},occluded:{get:()=>e.occluded,set:t=>{e.updateFlags.occluded=!0,e.occluded=t}},lock:{get:()=>e.lock,set:t=>{e.updateFlags.lock=!0,e.lock=t}},attributes:{get:()=>e.attributes,set:t=>{if("object"!=typeof t)throw new r("Attributes are expected to be an object "+`but got ${"object"==typeof t?t.constructor.name:typeof t}`);for(const n of Object.keys(t))e.updateFlags.attributes=!0,e.attributes[n]=t[n]}}})),this.label=t.label,this.group=t.group,this.zOrder=t.zOrder,this.outside=t.outside,this.keyframe=t.keyframe,this.occluded=t.occluded,this.color=t.color,this.lock=t.lock,void 0!==t.points&&(this.points=t.points),void 0!==t.attributes&&(this.attributes=t.attributes),e.updateFlags.reset()}async save(){return await e.apiWrapper.call(this,o.prototype.save)}async delete(t=!1){return await e.apiWrapper.call(this,o.prototype.delete,t)}async up(){return await e.apiWrapper.call(this,o.prototype.up)}async down(){return await e.apiWrapper.call(this,o.prototype.down)}}o.prototype.save.implementation=async function(){return this.hidden&&this.hidden.save?this.hidden.save():this},o.prototype.delete.implementation=async function(t){return!(!this.hidden||!this.hidden.delete)&&this.hidden.delete(t)},o.prototype.up.implementation=async function(){return!(!this.hidden||!this.hidden.up)&&this.hidden.up()},o.prototype.down.implementation=async function(){return!(!this.hidden||!this.hidden.down)&&this.hidden.down()},t.exports=o})()},function(t,e,n){"use strict";n(13)({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return URL.prototype.toString.call(this)}})},function(t,e,n){"use strict";var r={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,i=o&&!r.call({1:2},1);e.f=i?function(t){var e=o(this,t);return!!e&&e.enumerable}:r},function(t,e,n){var r=n(2),o=n(15),i="".split;t.exports=r(function(){return!Object("z").propertyIsEnumerable(0)})?function(t){return"String"==o(t)?i.call(t,""):Object(t)}:Object},function(t,e,n){var r=n(10),o=n(2),i=n(42);t.exports=!r&&!o(function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a})},function(t,e,n){var r=n(31);t.exports=r("native-function-to-string",Function.toString)},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++n+r).toString(36)}},function(t,e,n){var r=n(7),o=n(92),i=n(40),s=n(14);t.exports=function(t,e){for(var n=o(e),a=s.f,c=i.f,u=0;uc;)r(a,n=e[c++])&&(~i(u,n)||u.push(n));return u}},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e,n){var r=n(2),o=/#|\.prototype\./,i=function(t,e){var n=a[s(t)];return n==u||n!=c&&("function"==typeof e?r(e):!!e)},s=i.normalize=function(t){return String(t).replace(o,".").toLowerCase()},a=i.data={},c=i.NATIVE="N",u=i.POLYFILL="P";t.exports=i},function(t,e,n){var r=n(16);t.exports=function(t,e,n){for(var o in e)r(t,o,e[o],n);return t}},function(t,e,n){var r=n(1),o=n(25),i=r("iterator"),s=Array.prototype;t.exports=function(t){return void 0!==t&&(o.Array===t||s[i]===t)}},function(t,e,n){var r=n(3);t.exports=function(t,e,n,o){try{return o?e(r(n)[0],n[1]):e(n)}catch(e){var i=t.return;throw void 0!==i&&r(i.call(t)),e}}},function(t,e,n){var r,o,i,s=n(0),a=n(2),c=n(15),u=n(35),l=n(67),p=n(42),f=s.location,h=s.setImmediate,d=s.clearImmediate,b=s.process,g=s.MessageChannel,m=s.Dispatch,y=0,v={},w=function(t){if(v.hasOwnProperty(t)){var e=v[t];delete v[t],e()}},O=function(t){return function(){w(t)}},x=function(t){w(t.data)},j=function(t){s.postMessage(t+"",f.protocol+"//"+f.host)};h&&d||(h=function(t){for(var e=[],n=1;arguments.length>n;)e.push(arguments[n++]);return v[++y]=function(){("function"==typeof t?t:Function(t)).apply(void 0,e)},r(y),y},d=function(t){delete v[t]},"process"==c(b)?r=function(t){b.nextTick(O(t))}:m&&m.now?r=function(t){m.now(O(t))}:g?(i=(o=new g).port2,o.port1.onmessage=x,r=u(i.postMessage,i,1)):!s.addEventListener||"function"!=typeof postMessage||s.importScripts||a(j)?r="onreadystatechange"in p("script")?function(t){l.appendChild(p("script")).onreadystatechange=function(){l.removeChild(this),w(t)}}:function(t){setTimeout(O(t),0)}:(r=j,s.addEventListener("message",x,!1))),t.exports={set:h,clear:d}},function(t,e,n){var r=n(32);t.exports=r("document","documentElement")},function(t,e,n){var r=n(32);t.exports=r("navigator","userAgent")||""},function(t,e,n){"use strict";var r=n(24),o=function(t){var e,n;this.promise=new t(function(t,r){if(void 0!==e||void 0!==n)throw TypeError("Bad Promise constructor");e=t,n=r}),this.resolve=r(e),this.reject=r(n)};t.exports.f=function(t){return new o(t)}},function(t,e,n){var r=n(3),o=n(71),i=n(46),s=n(45),a=n(67),c=n(42),u=n(44)("IE_PROTO"),l=function(){},p=function(){var t,e=c("iframe"),n=i.length;for(e.style.display="none",a.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write("