diff --git a/cvat-core/jest.config.js b/cvat-core/jest.config.js
index efa327eb..c7712052 100644
--- a/cvat-core/jest.config.js
+++ b/cvat-core/jest.config.js
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 Intel Corporation
+ * Copyright (C) 2019 Intel Corporation
* SPDX-License-Identifier: MIT
*/
diff --git a/cvat-core/jsdoc.config.js b/cvat-core/jsdoc.config.js
index c5bb836c..a51208c5 100644
--- a/cvat-core/jsdoc.config.js
+++ b/cvat-core/jsdoc.config.js
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 Intel Corporation
+ * Copyright (C) 2019 Intel Corporation
* SPDX-License-Identifier: MIT
*/
diff --git a/cvat-core/src/annotation-format.js b/cvat-core/src/annotation-format.js
new file mode 100644
index 00000000..0bf8cfdf
--- /dev/null
+++ b/cvat-core/src/annotation-format.js
@@ -0,0 +1,235 @@
+/*
+* Copyright (C) 2019 Intel Corporation
+* SPDX-License-Identifier: MIT
+*/
+
+(() => {
+ /**
+ * Class representing an annotation loader
+ * @memberof module:API.cvat.classes
+ * @hideconstructor
+ */
+ class Loader {
+ constructor(initialData) {
+ const data = {
+ display_name: initialData.display_name,
+ format: initialData.format,
+ handler: initialData.handler,
+ version: initialData.version,
+ };
+
+ Object.defineProperties(this, {
+ name: {
+ /**
+ * @name name
+ * @type {string}
+ * @memberof module:API.cvat.classes.Loader
+ * @readonly
+ * @instance
+ */
+ get: () => data.display_name,
+ },
+ format: {
+ /**
+ * @name format
+ * @type {string}
+ * @memberof module:API.cvat.classes.Loader
+ * @readonly
+ * @instance
+ */
+ get: () => data.format,
+ },
+ handler: {
+ /**
+ * @name handler
+ * @type {string}
+ * @memberof module:API.cvat.classes.Loader
+ * @readonly
+ * @instance
+ */
+ get: () => data.handler,
+ },
+ version: {
+ /**
+ * @name version
+ * @type {string}
+ * @memberof module:API.cvat.classes.Loader
+ * @readonly
+ * @instance
+ */
+ get: () => data.version,
+ },
+ });
+ }
+ }
+
+ /**
+ * Class representing an annotation dumper
+ * @memberof module:API.cvat.classes
+ * @hideconstructor
+ */
+ class Dumper {
+ constructor(initialData) {
+ const data = {
+ display_name: initialData.display_name,
+ format: initialData.format,
+ handler: initialData.handler,
+ version: initialData.version,
+ };
+
+ Object.defineProperties(this, {
+ name: {
+ /**
+ * @name name
+ * @type {string}
+ * @memberof module:API.cvat.classes.Dumper
+ * @readonly
+ * @instance
+ */
+ get: () => data.display_name,
+ },
+ format: {
+ /**
+ * @name format
+ * @type {string}
+ * @memberof module:API.cvat.classes.Dumper
+ * @readonly
+ * @instance
+ */
+ get: () => data.format,
+ },
+ handler: {
+ /**
+ * @name handler
+ * @type {string}
+ * @memberof module:API.cvat.classes.Dumper
+ * @readonly
+ * @instance
+ */
+ get: () => data.handler,
+ },
+ version: {
+ /**
+ * @name version
+ * @type {string}
+ * @memberof module:API.cvat.classes.Dumper
+ * @readonly
+ * @instance
+ */
+ get: () => data.version,
+ },
+ });
+ }
+ }
+
+ /**
+ * Class representing an annotation format
+ * @memberof module:API.cvat.classes
+ * @hideconstructor
+ */
+ class AnnotationFormat {
+ constructor(initialData) {
+ const data = {
+ created_date: initialData.created_date,
+ updated_date: initialData.updated_date,
+ id: initialData.id,
+ owner: initialData.owner,
+ name: initialData.name,
+ handler_file: initialData.handler_file,
+ };
+
+ data.dumpers = initialData.dumpers.map(el => new Dumper(el));
+ data.loaders = initialData.loaders.map(el => new Loader(el));
+
+ // Now all fields are readonly
+ Object.defineProperties(this, {
+ id: {
+ /**
+ * @name id
+ * @type {integer}
+ * @memberof module:API.cvat.classes.AnnotationFormat
+ * @readonly
+ * @instance
+ */
+ get: () => data.id,
+ },
+ owner: {
+ /**
+ * @name owner
+ * @type {integer}
+ * @memberof module:API.cvat.classes.AnnotationFormat
+ * @readonly
+ * @instance
+ */
+ get: () => data.owner,
+ },
+ name: {
+ /**
+ * @name name
+ * @type {string}
+ * @memberof module:API.cvat.classes.AnnotationFormat
+ * @readonly
+ * @instance
+ */
+ get: () => data.name,
+ },
+ createdDate: {
+ /**
+ * @name createdDate
+ * @type {string}
+ * @memberof module:API.cvat.classes.AnnotationFormat
+ * @readonly
+ * @instance
+ */
+ get: () => data.created_date,
+ },
+ updatedDate: {
+ /**
+ * @name updatedDate
+ * @type {string}
+ * @memberof module:API.cvat.classes.AnnotationFormat
+ * @readonly
+ * @instance
+ */
+ get: () => data.updated_date,
+ },
+ handlerFile: {
+ /**
+ * @name handlerFile
+ * @type {string}
+ * @memberof module:API.cvat.classes.AnnotationFormat
+ * @readonly
+ * @instance
+ */
+ get: () => data.handler_file,
+ },
+ loaders: {
+ /**
+ * @name loaders
+ * @type {module:API.cvat.classes.Loader[]}
+ * @memberof module:API.cvat.classes.AnnotationFormat
+ * @readonly
+ * @instance
+ */
+ get: () => [...data.loaders],
+ },
+ dumpers: {
+ /**
+ * @name dumpers
+ * @type {module:API.cvat.classes.Dumper[]}
+ * @memberof module:API.cvat.classes.AnnotationFormat
+ * @readonly
+ * @instance
+ */
+ get: () => [...data.dumpers],
+ },
+ });
+ }
+ }
+
+ module.exports = {
+ AnnotationFormat,
+ Loader,
+ Dumper,
+ };
+})();
diff --git a/cvat-core/src/annotations-collection.js b/cvat-core/src/annotations-collection.js
index 7a5db6f0..5e14974b 100644
--- a/cvat-core/src/annotations-collection.js
+++ b/cvat-core/src/annotations-collection.js
@@ -1,5 +1,5 @@
/*
-* Copyright (C) 2018 Intel Corporation
+* Copyright (C) 2019 Intel Corporation
* SPDX-License-Identifier: MIT
*/
diff --git a/cvat-core/src/annotations-objects.js b/cvat-core/src/annotations-objects.js
index d76fc4d6..d81c505f 100644
--- a/cvat-core/src/annotations-objects.js
+++ b/cvat-core/src/annotations-objects.js
@@ -1,5 +1,5 @@
/*
-* Copyright (C) 2018 Intel Corporation
+* Copyright (C) 2019 Intel Corporation
* SPDX-License-Identifier: MIT
*/
diff --git a/cvat-core/src/annotations-saver.js b/cvat-core/src/annotations-saver.js
index 4d76f1fb..3e662f9a 100644
--- a/cvat-core/src/annotations-saver.js
+++ b/cvat-core/src/annotations-saver.js
@@ -1,5 +1,5 @@
/*
-* Copyright (C) 2018 Intel Corporation
+* Copyright (C) 2019 Intel Corporation
* SPDX-License-Identifier: MIT
*/
diff --git a/cvat-core/src/annotations.js b/cvat-core/src/annotations.js
index 059ff006..8c9014ca 100644
--- a/cvat-core/src/annotations.js
+++ b/cvat-core/src/annotations.js
@@ -1,5 +1,5 @@
/*
-* Copyright (C) 2018 Intel Corporation
+* Copyright (C) 2019 Intel Corporation
* SPDX-License-Identifier: MIT
*/
@@ -13,9 +13,14 @@
const AnnotationsSaver = require('./annotations-saver');
const { checkObjectType } = require('./common');
const { Task } = require('./session');
+ const {
+ Loader,
+ Dumper,
+ } = require('./annotation-format.js');
const {
ScriptingError,
DataError,
+ ArgumentError,
} = require('./exceptions');
const jobCache = new WeakMap();
@@ -190,15 +195,33 @@
);
}
- async function uploadAnnotations(session, file, format) {
+ async function uploadAnnotations(session, file, loader) {
const sessionType = session instanceof Task ? 'task' : 'job';
- await serverProxy.annotations.uploadAnnotations(sessionType, session.id, file, format);
+ if (!(loader instanceof Loader)) {
+ throw new ArgumentError(
+ 'A loader must be instance of Loader class',
+ );
+ }
+ await serverProxy.annotations.uploadAnnotations(sessionType, session.id, file, loader.name);
}
- async function dumpAnnotations(session, name, format) {
+ async function dumpAnnotations(session, name, dumper) {
+ if (!(dumper instanceof Dumper)) {
+ throw new ArgumentError(
+ 'A dumper must be instance of Dumper class',
+ );
+ }
+
+ let result = null;
const sessionType = session instanceof Task ? 'task' : 'job';
- const result = await serverProxy.annotations
- .dumpAnnotations(sessionType, session.id, name, format);
+ if (sessionType === 'job') {
+ result = await serverProxy.annotations
+ .dumpAnnotations(session.task.id, name, dumper.name);
+ } else {
+ result = await serverProxy.annotations
+ .dumpAnnotations(session.id, name, dumper.name);
+ }
+
return result;
}
diff --git a/cvat-core/src/api-implementation.js b/cvat-core/src/api-implementation.js
index fde9c25b..afb0ad02 100644
--- a/cvat-core/src/api-implementation.js
+++ b/cvat-core/src/api-implementation.js
@@ -1,5 +1,5 @@
/*
-* Copyright (C) 2018 Intel Corporation
+* Copyright (C) 2019 Intel Corporation
* SPDX-License-Identifier: MIT
*/
@@ -27,6 +27,7 @@
} = require('./enums');
const User = require('./user');
+ const { AnnotationFormat } = require('./annotation-format.js');
const { ArgumentError } = require('./exceptions');
const { Task } = require('./session');
@@ -44,6 +45,11 @@
return result;
};
+ cvat.server.formats.implementation = async () => {
+ const result = await serverProxy.server.formats();
+ return result.map(el => new AnnotationFormat(el));
+ };
+
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 bf61f409..6bf52a72 100644
--- a/cvat-core/src/api.js
+++ b/cvat-core/src/api.js
@@ -1,5 +1,5 @@
/*
-* Copyright (C) 2018 Intel Corporation
+* Copyright (C) 2019 Intel Corporation
* SPDX-License-Identifier: MIT
*/
@@ -101,6 +101,20 @@ function build() {
.apiWrapper(cvat.server.share, directory);
return result;
},
+ /**
+ * Method returns available annotation formats
+ * @method formats
+ * @async
+ * @memberof module:API.cvat.server
+ * @returns {module:API.cvat.classes.AnnotationFormat[]}
+ * @throws {module:API.cvat.exceptions.PluginError}
+ * @throws {module:API.cvat.exceptions.ServerError}
+ */
+ async formats() {
+ const result = await PluginRegistry
+ .apiWrapper(cvat.server.formats);
+ return result;
+ },
/**
* Method allows to login on a server
* @method login
@@ -218,7 +232,7 @@ function build() {
* @async
* @memberof module:API.cvat.users
* @param {UserFilter} [filter={}] user filter
- * @returns {User[]}
+ * @returns {module:API.cvat.classes.User[]}
* @throws {module:API.cvat.exceptions.PluginError}
* @throws {module:API.cvat.exceptions.ServerError}
*/
diff --git a/cvat-core/src/common.js b/cvat-core/src/common.js
index b0e6f014..51819bff 100644
--- a/cvat-core/src/common.js
+++ b/cvat-core/src/common.js
@@ -1,5 +1,5 @@
/*
-* Copyright (C) 2018 Intel Corporation
+* Copyright (C) 2019 Intel Corporation
* SPDX-License-Identifier: MIT
*/
diff --git a/cvat-core/src/config.js b/cvat-core/src/config.js
index 30a86de3..e940a214 100644
--- a/cvat-core/src/config.js
+++ b/cvat-core/src/config.js
@@ -1,5 +1,5 @@
/*
-* Copyright (C) 2018 Intel Corporation
+* Copyright (C) 2019 Intel Corporation
* SPDX-License-Identifier: MIT
*/
diff --git a/cvat-core/src/enums.js b/cvat-core/src/enums.js
index 948646d3..e8fbdeae 100644
--- a/cvat-core/src/enums.js
+++ b/cvat-core/src/enums.js
@@ -1,5 +1,5 @@
/*
-* Copyright (C) 2018 Intel Corporation
+* Copyright (C) 2019 Intel Corporation
* SPDX-License-Identifier: MIT
*/
diff --git a/cvat-core/src/exceptions.js b/cvat-core/src/exceptions.js
index e80c4ce0..97788cf6 100644
--- a/cvat-core/src/exceptions.js
+++ b/cvat-core/src/exceptions.js
@@ -1,5 +1,5 @@
/*
-* Copyright (C) 2018 Intel Corporation
+* Copyright (C) 2019 Intel Corporation
* SPDX-License-Identifier: MIT
*/
diff --git a/cvat-core/src/frames.js b/cvat-core/src/frames.js
index 67f7a8fb..06342bd0 100644
--- a/cvat-core/src/frames.js
+++ b/cvat-core/src/frames.js
@@ -1,5 +1,5 @@
/*
-* Copyright (C) 2018 Intel Corporation
+* Copyright (C) 2019 Intel Corporation
* SPDX-License-Identifier: MIT
*/
diff --git a/cvat-core/src/labels.js b/cvat-core/src/labels.js
index de6ba99c..dc0235ff 100644
--- a/cvat-core/src/labels.js
+++ b/cvat-core/src/labels.js
@@ -1,5 +1,5 @@
/*
-* Copyright (C) 2018 Intel Corporation
+* Copyright (C) 2019 Intel Corporation
* SPDX-License-Identifier: MIT
*/
diff --git a/cvat-core/src/logging.js b/cvat-core/src/logging.js
index 195273c2..f6b52c4e 100644
--- a/cvat-core/src/logging.js
+++ b/cvat-core/src/logging.js
@@ -1,5 +1,5 @@
/*
-* Copyright (C) 2018 Intel Corporation
+* Copyright (C) 2019 Intel Corporation
* SPDX-License-Identifier: MIT
*/
diff --git a/cvat-core/src/object-state.js b/cvat-core/src/object-state.js
index 0f6ddb64..f1eb44ae 100644
--- a/cvat-core/src/object-state.js
+++ b/cvat-core/src/object-state.js
@@ -1,5 +1,5 @@
/*
-* Copyright (C) 2018 Intel Corporation
+* Copyright (C) 2019 Intel Corporation
* SPDX-License-Identifier: MIT
*/
diff --git a/cvat-core/src/plugins.js b/cvat-core/src/plugins.js
index 7dc08384..595e6cbc 100644
--- a/cvat-core/src/plugins.js
+++ b/cvat-core/src/plugins.js
@@ -1,5 +1,5 @@
/*
-* Copyright (C) 2018 Intel Corporation
+* Copyright (C) 2019 Intel Corporation
* SPDX-License-Identifier: MIT
*/
diff --git a/cvat-core/src/server-proxy.js b/cvat-core/src/server-proxy.js
index a7b18b3e..dfb8c144 100644
--- a/cvat-core/src/server-proxy.js
+++ b/cvat-core/src/server-proxy.js
@@ -1,5 +1,5 @@
/*
-* Copyright (C) 2018 Intel Corporation
+* Copyright (C) 2019 Intel Corporation
* SPDX-License-Identifier: MIT
*/
@@ -90,6 +90,25 @@
}
}
+ async function formats() {
+ const { backendAPI } = config;
+
+ let response = null;
+ try {
+ response = await Axios.get(`${backendAPI}/server/annotation/formats`, {
+ proxy: config.proxy,
+ });
+ } catch (errorData) {
+ const code = errorData.response ? errorData.response.status : errorData.code;
+ throw new ServerError(
+ 'Could not get annotation formats from the server',
+ code,
+ );
+ }
+
+ return response.data;
+ }
+
async function login(username, password) {
function setCookie(response) {
if (response.headers['set-cookie']) {
@@ -532,7 +551,7 @@
async function request() {
try {
const response = await Axios
- .post(`${backendAPI}/${session}s/${id}/annotations?upload_format=${format}`, annotationData, {
+ .put(`${backendAPI}/${session}s/${id}/annotations?format=${format}`, annotationData, {
proxy: config.proxy,
});
if (response.status === 202) {
@@ -560,7 +579,7 @@
async function dumpAnnotations(id, name, format) {
const { backendAPI } = config;
const filename = name.replace(/\//g, '_');
- let url = `${backendAPI}/tasks/${id}/annotations/${filename}?dump_format=${format}`;
+ let url = `${backendAPI}/tasks/${id}/annotations/${filename}?format=${format}`;
return new Promise((resolve, reject) => {
async function request() {
@@ -603,6 +622,7 @@
value: Object.freeze({
about,
share,
+ formats,
exception,
login,
logout,
diff --git a/cvat-core/src/session.js b/cvat-core/src/session.js
index 0bb3a12d..ae70c5f2 100644
--- a/cvat-core/src/session.js
+++ b/cvat-core/src/session.js
@@ -1,5 +1,5 @@
/*
-* Copyright (C) 2018 Intel Corporation
+* Copyright (C) 2019 Intel Corporation
* SPDX-License-Identifier: MIT
*/
@@ -19,9 +19,9 @@
Object.defineProperties(prototype, {
annotations: Object.freeze({
value: {
- async upload(file, format) {
+ async upload(file, loader) {
const result = await PluginRegistry
- .apiWrapper.call(this, prototype.annotations.upload, file, format);
+ .apiWrapper.call(this, prototype.annotations.upload, file, loader);
return result;
},
@@ -37,9 +37,9 @@
return result;
},
- async dump(name, format) {
+ async dump(name, dumper) {
const result = await PluginRegistry
- .apiWrapper.call(this, prototype.annotations.dump, name, format);
+ .apiWrapper.call(this, prototype.annotations.dump, name, dumper);
return result;
},
@@ -183,7 +183,8 @@
* @method upload
* @memberof Session.annotations
* @param {File} annotations - a text file with annotations
- * @param {string} format - a format of the file
+ * @param {module:API.cvat.classes.Loader} loader - a loader
+ * which will be used to upload
* @instance
* @async
* @throws {module:API.cvat.exceptions.PluginError}
@@ -224,10 +225,12 @@
* @method dump
* @memberof Session.annotations
* @param {string} name - a name of a file with annotations
- * @param {string} format - a format of the file
+ * @param {module:API.cvat.classes.Dumper} dumper - a dumper
+ * which will be used to dump
* @returns {string} URL which can be used in order to get a dump file
* @throws {module:API.cvat.exceptions.PluginError}
* @throws {module:API.cvat.exceptions.ServerError}
+ * @throws {module:API.cvat.exceptions.ArgumentError}
* @instance
* @async
*/
@@ -1272,13 +1275,13 @@
return result;
};
- Job.prototype.annotations.upload.implementation = async function (file, format) {
- const result = await uploadAnnotations(this, file, format);
+ Job.prototype.annotations.upload.implementation = async function (file, loader) {
+ const result = await uploadAnnotations(this, file, loader);
return result;
};
- Job.prototype.annotations.dump.implementation = async function (name, format) {
- const result = await dumpAnnotations(this, name, format);
+ Job.prototype.annotations.dump.implementation = async function (name, dumper) {
+ const result = await dumpAnnotations(this, name, dumper);
return result;
};
@@ -1418,13 +1421,13 @@
return result;
};
- Task.prototype.annotations.upload.implementation = async function (file, format) {
- const result = await uploadAnnotations(this, file, format);
+ Task.prototype.annotations.upload.implementation = async function (file, loader) {
+ const result = await uploadAnnotations(this, file, loader);
return result;
};
- Task.prototype.annotations.dump.implementation = async function (name, format) {
- const result = await dumpAnnotations(this, name, format);
+ Task.prototype.annotations.dump.implementation = async function (name, dumper) {
+ const result = await dumpAnnotations(this, name, dumper);
return result;
};
})();
diff --git a/cvat-core/src/statistics.js b/cvat-core/src/statistics.js
index 33704bc6..36910eb7 100644
--- a/cvat-core/src/statistics.js
+++ b/cvat-core/src/statistics.js
@@ -1,5 +1,5 @@
/*
-* Copyright (C) 2018 Intel Corporation
+* Copyright (C) 2019 Intel Corporation
* SPDX-License-Identifier: MIT
*/
diff --git a/cvat-core/src/user.js b/cvat-core/src/user.js
index 2e6f31f1..62221c67 100644
--- a/cvat-core/src/user.js
+++ b/cvat-core/src/user.js
@@ -1,5 +1,5 @@
/*
-* Copyright (C) 2018 Intel Corporation
+* Copyright (C) 2019 Intel Corporation
* SPDX-License-Identifier: MIT
*/
diff --git a/cvat-core/tests/api/server.js b/cvat-core/tests/api/server.js
index d48e664d..6220e158 100644
--- a/cvat-core/tests/api/server.js
+++ b/cvat-core/tests/api/server.js
@@ -17,6 +17,11 @@ jest.mock('../../src/server-proxy', () => {
// Initialize api
window.cvat = require('../../src/api');
+const {
+ AnnotationFormat,
+ Loader,
+ Dumper,
+} = require('../../src/annotation-format');
// Test cases
describe('Feature: get info about cvat', () => {
@@ -49,3 +54,43 @@ describe('Feature: get share storage info', () => {
)).rejects.toThrow(window.cvat.exceptions.ServerError);
});
});
+
+describe('Feature: get annotation formats', () => {
+ test('get annotation formats from a server', async () => {
+ const result = await window.cvat.server.formats();
+ expect(Array.isArray(result)).toBeTruthy();
+ for (const format of result) {
+ expect(format).toBeInstanceOf(AnnotationFormat);
+ }
+ });
+});
+
+describe('Feature: get annotation loaders', () => {
+ test('get annotation formats from a server', async () => {
+ const result = await window.cvat.server.formats();
+ expect(Array.isArray(result)).toBeTruthy();
+ for (const format of result) {
+ expect(format).toBeInstanceOf(AnnotationFormat);
+ const { loaders } = format;
+ expect(Array.isArray(loaders)).toBeTruthy();
+ for (const loader of loaders) {
+ expect(loader).toBeInstanceOf(Loader);
+ }
+ }
+ });
+});
+
+describe('Feature: get annotation dumpers', () => {
+ test('get annotation formats from a server', async () => {
+ const result = await window.cvat.server.formats();
+ expect(Array.isArray(result)).toBeTruthy();
+ for (const format of result) {
+ expect(format).toBeInstanceOf(AnnotationFormat);
+ const { dumpers } = format;
+ expect(Array.isArray(dumpers)).toBeTruthy();
+ for (const dumper of dumpers) {
+ expect(dumper).toBeInstanceOf(Dumper);
+ }
+ }
+ });
+});
\ No newline at end of file
diff --git a/cvat-core/tests/mocks/dummy-data.mock.js b/cvat-core/tests/mocks/dummy-data.mock.js
index 065b34e6..1f215d21 100644
--- a/cvat-core/tests/mocks/dummy-data.mock.js
+++ b/cvat-core/tests/mocks/dummy-data.mock.js
@@ -6,6 +6,85 @@ const aboutDummyData = {
"version": "0.5.dev20190516142240"
}
+const formatsDummyData = [{
+ "id": 1,
+ "dumpers": [
+ {
+ "display_name": "CVAT XML 1.1 for videos",
+ "format": "XML",
+ "version": "1.1",
+ "handler": "dump_as_cvat_interpolation"
+ },
+ {
+ "display_name": "CVAT XML 1.1 for images",
+ "format": "XML",
+ "version": "1.1",
+ "handler": "dump_as_cvat_annotation"
+ }
+ ],
+ "loaders": [
+ {
+ "display_name": "CVAT XML 1.1",
+ "format": "XML",
+ "version": "1.1",
+ "handler": "load"
+ }
+ ],
+ "name": "CVAT",
+ "created_date": "2019-08-08T12:18:56.571488+03:00",
+ "updated_date": "2019-08-08T12:18:56.571533+03:00",
+ "handler_file": "cvat/apps/annotation/cvat.py",
+ "owner": null
+},
+{
+ "id": 2,
+ "dumpers": [
+ {
+ "display_name": "PASCAL VOC ZIP 1.0",
+ "format": "ZIP",
+ "version": "1.0",
+ "handler": "dump"
+ }
+ ],
+ "loaders": [
+ {
+ "display_name": "PASCAL VOC ZIP 1.0",
+ "format": "ZIP",
+ "version": "1.0",
+ "handler": "load"
+ }
+ ],
+ "name": "PASCAL VOC",
+ "created_date": "2019-08-08T12:18:56.625025+03:00",
+ "updated_date": "2019-08-08T12:18:56.625071+03:00",
+ "handler_file": "cvat/apps/annotation/pascal_voc.py",
+ "owner": null
+},
+{
+ "id": 3,
+ "dumpers": [
+ {
+ "display_name": "YOLO ZIP 1.0",
+ "format": "ZIP",
+ "version": "1.0",
+ "handler": "dump"
+ }
+ ],
+ "loaders": [
+ {
+ "display_name": "YOLO ZIP 1.0",
+ "format": "ZIP",
+ "version": "1.0",
+ "handler": "load"
+ }
+ ],
+ "name": "YOLO",
+ "created_date": "2019-08-08T12:18:56.667534+03:00",
+ "updated_date": "2019-08-08T12:18:56.667578+03:00",
+ "handler_file": "cvat/apps/annotation/yolo.py",
+ "owner": null
+}];
+
const usersDummyData = {
"count": 2,
"next": null,
@@ -2445,4 +2524,5 @@ module.exports = {
taskAnnotationsDummyData,
jobAnnotationsDummyData,
frameMetaDummyData,
+ formatsDummyData,
}
diff --git a/cvat-core/tests/mocks/server-proxy.mock.js b/cvat-core/tests/mocks/server-proxy.mock.js
index 56d83924..fd53b954 100644
--- a/cvat-core/tests/mocks/server-proxy.mock.js
+++ b/cvat-core/tests/mocks/server-proxy.mock.js
@@ -12,6 +12,7 @@
const {
tasksDummyData,
aboutDummyData,
+ formatsDummyData,
shareDummyData,
usersDummyData,
taskAnnotationsDummyData,
@@ -48,6 +49,10 @@ class ServerProxy {
return JSON.parse(JSON.stringify(position));
}
+ async function formats() {
+ return JSON.parse(JSON.stringify(formatsDummyData));
+ }
+
async function exception() {
return null;
}
@@ -239,6 +244,7 @@ class ServerProxy {
value: Object.freeze({
about,
share,
+ formats,
exception,
login,
logout,
diff --git a/cvat/apps/dashboard/static/dashboard/js/dashboard.js b/cvat/apps/dashboard/static/dashboard/js/dashboard.js
index bd504ff1..58c5a552 100644
--- a/cvat/apps/dashboard/static/dashboard/js/dashboard.js
+++ b/cvat/apps/dashboard/static/dashboard/js/dashboard.js
@@ -6,8 +6,6 @@
/* global
userConfirm:false
- dumpAnnotationRequest:false
- uploadTaskAnnotationRequest:false
LabelsInfo:false
showMessage:false
showOverlay:false
@@ -85,10 +83,8 @@ class TaskView {
if (file) {
button.text('Uploading..');
button.prop('disabled', true);
- const annotationData = new FormData();
- annotationData.append('annotation_file', file);
try {
- await uploadTaskAnnotationRequest(this._task.id, annotationData, format);
+ await this._task.annotations.upload(file, format);
} catch (error) {
showMessage(error.message);
} finally {
@@ -102,7 +98,12 @@ class TaskView {
async _dump(button, format) {
button.disabled = true;
try {
- await dumpAnnotationRequest(this._task.id, this._task.name, format);
+ const url = await this._task.annotations.dump(this._task.name, format);
+ const a = document.createElement('a');
+ a.href = `${url}`;
+ document.body.appendChild(a);
+ a.click();
+ a.remove();
} catch (error) {
showMessage(error.message);
} finally {
@@ -139,22 +140,22 @@ class TaskView {
for (const format of this._annotationFormats) {
for (const dumper of format.dumpers) {
- const listItem = $(`
${dumper.display_name}`).on('click', () => {
+ const listItem = $(`${dumper.name}`).on('click', () => {
dropdownDownloadMenu.addClass('hidden');
- this._dump(downloadButton[0], dumper.display_name);
+ this._dump(downloadButton[0], dumper);
});
- if (isDefaultFormat(dumper.display_name, this._task.mode)) {
+ if (isDefaultFormat(dumper.name, this._task.mode)) {
listItem.addClass('bold');
}
dropdownDownloadMenu.append(listItem);
}
for (const loader of format.loaders) {
- dropdownUploadMenu.append($(`${loader.display_name}`).on('click', () => {
+ dropdownUploadMenu.append($(`${loader.name}`).on('click', () => {
dropdownUploadMenu.addClass('hidden');
userConfirm('The current annotation will be lost. Are you sure?', () => {
- this._upload(uploadButton, loader.display_name);
+ this._upload(uploadButton, loader);
});
}));
}
@@ -728,10 +729,10 @@ window.addEventListener('DOMContentLoaded', () => {
// TODO: Use REST API in order to get meta
$.get('/dashboard/meta'),
$.get(`/api/v1/tasks${window.location.search}`),
- $.get('/api/v1/server/annotation/formats'),
+ window.cvat.server.formats(),
).then((metaData, taskData, annotationFormats) => {
try {
- new DashboardView(metaData[0], taskData[0], annotationFormats[0]);
+ new DashboardView(metaData[0], taskData[0], annotationFormats);
} catch (exception) {
$('#content').empty();
const message = `Can not build CVAT dashboard. Exception: ${exception}.`;
diff --git a/cvat/apps/engine/static/engine/js/cvat.js b/cvat/apps/engine/static/engine/js/cvat.js
index 768307bb..6e63df36 100644
--- a/cvat/apps/engine/static/engine/js/cvat.js
+++ b/cvat/apps/engine/static/engine/js/cvat.js
@@ -1,22 +1,22 @@
-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=88)}([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(94),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){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(28),o=n(105),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,n){n(9),(()=>{const e=n(110),r=n(112),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(123),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&&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)}}};q&&(N=function(t){b(this,N,P),d(t),r.call(this);var e=C(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=_(this),r=z(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=C(t);this.promise=t,this.resolve=Q(et,t,e),this.reject=Q(tt,t,e)},k.f=z=function(t){return t===N||t===s?new o(t):U(t)},a||"function"!=typeof D||i({global:!0,enumerable:!0,forced:!0},{fetch:function(t){return x(N,D.apply(c,arguments))}})),i({global:!0,wrap:!0,forced:q},{Promise:N}),p(N,P,!1,!0),f(P),s=u.Promise,i({target:P,stat:!0,forced:q},{reject:function(t){var e=z(this);return e.reject.call(void 0,t),e.promise}}),i({target:P,stat:!0,forced:a||q},{resolve:function(t){return x(a&&this===s?N:this,t)}}),i({target:P,stat:!0,forced:J},{all:function(t){var e=this,n=z(e),r=n.resolve,o=n.reject,s=S(function(){var n=d(e.resolve),s=[],i=0,a=1;m(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=z(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),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(16),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(3),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){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e,n){var r=n(0),o=n(29),s=n(12),i=n(7),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,n){var r,o,s,i=n(89),a=n(0),c=n(11),u=n(12),l=n(7),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(4),n(9),n(114),n(8),(()=>{const e=n(119),{ServerError:r,ScriptingError:o}=n(5),s=n(47);const i=new class{constructor(){const t=n(120),i=n(121);function a(t){i.defaults.headers.delete["X-CSRFToken"]=t,i.defaults.headers.patch["X-CSRFToken"]=t,i.defaults.headers.post["X-CSRFToken"]=t,i.defaults.headers.put["X-CSRFToken"]=t,i.defaults.withCredentials=!0}async function c(t=""){const{backendAPI:e}=s;let n=null;try{n=await i.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 u(t){const{backendAPI:e}=s;try{await i.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 l=t.get("csrftoken");l&&a(l),Object.defineProperties(this,Object.freeze({server:{value:Object.freeze({about:async function(){const{backendAPI:t}=s;let e=null;try{e=await i.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 i.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},exception:async function(t){const{backendAPI:e}=s;try{await i.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(e,n){function c(e){if(e.headers["set-cookie"]){let n="";for(let r of e.headers["set-cookie"]){[r]=r.split(";");const e=r.split("=")[0],o=r.split("=")[1];"csrftoken"===e&&a(o),t.set(e,o),n+=`${r};`}i.defaults.headers.common.Cookie=n}else{let n=e.data.csrf;if(n)a(n),t.set("csrftoken",n);else{if(!(n=t.get("csrftoken")))throw new o("An environment has been detected as a browser, but CSRF token has not been found in cookies");a(n)}}}const u=s.backendAPI.slice(0,-7);let l=null;try{l=await i.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)}c(l);const p=[`${encodeURIComponent("username")}=${encodeURIComponent(e)}`,`${encodeURIComponent("password")}=${encodeURIComponent(n)}`].join("&").replace(/%20/g,"+");let f=null;try{f=await i.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);c(f)},logout:async function(){const t=s.backendAPI.slice(0,-7);try{await i.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)}}}),writable:!1},tasks:{value:Object.freeze({getTasks:c,saveTask:async function(t,e){const{backendAPI:n}=s;try{await i.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:a}=s,l=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 i.get(`${a}/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 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}=s;let n=null;try{n=await i.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 i.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 i.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 i.get(`${t}/users/self`,{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}}),writable:!1},frames:{value:Object.freeze({getData:async function(t,e){const{backendAPI:n}=s;let o=null;try{o=await i.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 i.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:a}=s;let c=null,u=null;"PUT"===o.toUpperCase()?(c=i.put.bind(i),u=`${a}/${t}s/${e}/annotations`):(c=i.patch.bind(i),u=`${a}/${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 i.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,a=e.replace(/\//g,"_");let c=`${o}/tasks/${t}/annotations/${a}?dump_format=${n}`;return new Promise((e,n)=>{setTimeout(async function o(){try{202===(await i.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,a){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 i.post(`${c}/${t}s/${n}/annotations?upload_format=${a}`,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(7),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(104),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 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.1.3",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(97),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(4),n(9),n(140),n(8),n(51),(()=>{const e=n(25),r=n(18),{getFrame:o}=n(143),{ArgumentError:s}=n(5),{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:j}=n(151);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 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 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 j(this,t,e)}})()},function(t,e,n){n(4),n(8),n(51),(()=>{const{AttributeType:e}=n(19),{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){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(7),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(6),o=n(126),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(78):void 0!==e&&(a=n(78)),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(125))},function(t,e,n){n(4),n(9),n(8),(()=>{const e=n(25),{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,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(2),o=n(15),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(2),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(7),o=n(90),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(2),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(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(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(3);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(2),c=n(15),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)},j=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(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,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(3),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("