From e15340d625bfd93ea683b273bfa9a2f18b2a9ba1 Mon Sep 17 00:00:00 2001 From: Boris Sekachev <40690378+bsekachev@users.noreply.github.com> Date: Tue, 27 Aug 2019 21:58:35 +0300 Subject: [PATCH] Different fixes for Release 0.5.0 Part 2 (#670) * Fixed: Invalid labels parsing (#628) * Updated changelog * Improved error messages on a client side * Updated changelog * Fixed register --- .gitignore | 1 + CHANGELOG.md | 8 +- cvat-core/src/server-proxy.js | 179 ++++++------------ .../static/dashboard/js/dashboard.js | 7 +- .../engine/static/engine/js/cvat-core.min.js | 6 +- .../engine/static/engine/js/labelsInfo.js | 2 +- 6 files changed, 74 insertions(+), 129 deletions(-) diff --git a/.gitignore b/.gitignore index 28c53d5d..8142585f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # Project Specific /data/ +/models/ /share/ /static/ /db.sqlite3 diff --git a/CHANGELOG.md b/CHANGELOG.md index 8532a372..198db453 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,12 +23,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Outside and keyframe buttons in the side panel for all interpolation shapes (they were only for boxes before) +- Improved error messages on client side (#511) ### Deprecated - ### Removed -- +- "Flip images" has been removed. UI now contains rotation features. ### Fixed - Incorrect width of shapes borders in some cases @@ -41,6 +42,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Exception in attribute annotation mode when a label are switched to a value without any attributes - Handling of wrong labelamp json file in auto annotation () - No default attributes in dumped annotation () +- Required field "Frame Filter" on admin page during a task modifying (#666) +- Dump annotation errors for a task with several segments (#610, #500) +- Invalid label parsing during a task creating (#628) +- Button "Open Task" in the annotation view +- Creating a video task with 0 overlap ### Security - diff --git a/cvat-core/src/server-proxy.js b/cvat-core/src/server-proxy.js index 66ee2b69..9b5eef3f 100644 --- a/cvat-core/src/server-proxy.js +++ b/cvat-core/src/server-proxy.js @@ -5,7 +5,6 @@ /* global require:false - encodeURIComponent:false */ (() => { @@ -16,6 +15,19 @@ const store = require('store'); const config = require('./config'); + function generateError(errorData, baseMessage) { + if (errorData.response) { + const message = `${baseMessage}. ` + + `${errorData.message}. ${JSON.stringify(errorData.response.data) || ''}.`; + return new ServerError(message, errorData.response.status); + } + + // Server is unavailable (no any response) + const message = `${baseMessage}. ` + + `${errorData.message}.`; // usually is "Error Network" + return new ServerError(message, 0); + } + class ServerProxy { constructor() { const Axios = require('axios'); @@ -37,11 +49,7 @@ proxy: config.proxy, }); } catch (errorData) { - const code = errorData.response ? errorData.response.status : errorData.code; - throw new ServerError( - 'Could not get "about" information from the server', - code, - ); + throw generateError(errorData, 'Could not get "about" information from the server'); } return response.data; @@ -57,11 +65,7 @@ proxy: config.proxy, }); } catch (errorData) { - const code = errorData.response ? errorData.response.status : errorData.code; - throw new ServerError( - 'Could not get "share" information from the server', - code, - ); + throw generateError(errorData, 'Could not get "share" information from the server'); } return response.data; @@ -78,11 +82,7 @@ }, }); } catch (errorData) { - const code = errorData.response ? errorData.response.status : errorData.code; - throw new ServerError( - 'Could not send an exception to the server', - code, - ); + throw generateError(errorData, 'Could not send an exception to the server'); } } @@ -95,11 +95,7 @@ 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, - ); + throw generateError(errorData, 'Could not get annotation formats from the server'); } return response.data; @@ -118,13 +114,12 @@ }); response = await Axios.post(`${config.backendAPI}/auth/register`, data, { proxy: config.proxy, + headers: { + 'Content-Type': 'application/json', + }, }); } catch (errorData) { - const code = errorData.response ? errorData.response.status : errorData.code; - throw new ServerError( - `Could not register '${username}' user on the server`, - code, - ); + throw generateError(errorData, `Could not register '${username}' user on the server`); } return response.data; @@ -145,12 +140,7 @@ }, ); } catch (errorData) { - const code = errorData.response - ? errorData.response.status : errorData.code; - throw new ServerError( - 'Could not login on a server', - code, - ); + throw generateError(errorData, 'Could not login on a server'); } if (authenticationResponse.headers['set-cookie']) { @@ -171,11 +161,7 @@ proxy: config.proxy, }); } catch (errorData) { - const code = errorData.response ? errorData.response.status : errorData.code; - throw new ServerError( - 'Could not logout from the server', - code, - ); + throw generateError(errorData, 'Could not logout from the server'); } store.remove('token'); @@ -205,11 +191,7 @@ proxy: config.proxy, }); } catch (errorData) { - const code = errorData.response ? errorData.response.status : errorData.code; - throw new ServerError( - 'Could not get tasks from a server', - code, - ); + throw generateError(errorData, 'Could not get tasks from a server'); } response.data.results.count = response.data.count; @@ -227,11 +209,7 @@ }, }); } catch (errorData) { - const code = errorData.response ? errorData.response.status : errorData.code; - throw new ServerError( - 'Could not save the task on the server', - code, - ); + throw generateError(errorData, 'Could not save the task on the server'); } } @@ -241,11 +219,7 @@ try { await Axios.delete(`${backendAPI}/tasks/${id}`); } catch (errorData) { - const code = errorData.response ? errorData.response.status : errorData.code; - throw new ServerError( - 'Could not delete the task from the server', - code, - ); + throw generateError(errorData, 'Could not delete the task from the server'); } } @@ -267,10 +241,9 @@ } else if (response.data.state === 'Failed') { // If request has been successful, but task hasn't been created // Then passed data is wrong and we can pass code 400 - reject(new ServerError( - 'Could not create the task on the server', - 400, - )); + const message = 'Could not create the task on the server. ' + + `${response.data.message}.`; + reject(new ServerError(message, 400)); } else { // If server has another status, it is unexpected // Therefore it is server error and we can pass code 500 @@ -280,13 +253,9 @@ )); } } catch (errorData) { - const code = errorData.response - ? errorData.response.status : errorData.code; - - reject(new ServerError( - 'Data uploading error occurred', - code, - )); + reject( + generateError(errorData, 'Could not put task to the server'), + ); } } @@ -314,11 +283,7 @@ }, }); } catch (errorData) { - const code = errorData.response ? errorData.response.status : errorData.code; - throw new ServerError( - 'Could not put task to the server', - code, - ); + throw generateError(errorData, 'Could not put task to the server'); } onUpdate('The data is being uploaded to the server..'); @@ -327,12 +292,13 @@ proxy: config.proxy, }); } catch (errorData) { - await deleteTask(response.data.id); - const code = errorData.response ? errorData.response.status : errorData.code; - throw new ServerError( - 'Could not put data to the server', - code, - ); + try { + await deleteTask(response.data.id); + } catch (_) { + // ignore + } + + throw generateError(errorData, 'Could not put data to the server'); } try { @@ -342,7 +308,6 @@ throw createException; } - const createdTask = await getTasks(`?id=${response.id}`); return createdTask[0]; } @@ -356,11 +321,7 @@ proxy: config.proxy, }); } catch (errorData) { - const code = errorData.response ? errorData.response.status : errorData.code; - throw new ServerError( - 'Could not get jobs from a server', - code, - ); + throw generateError(errorData, 'Could not get jobs from a server'); } return response.data; @@ -377,11 +338,7 @@ }, }); } catch (errorData) { - const code = errorData.response ? errorData.response.status : errorData.code; - throw new ServerError( - 'Could not save the job on the server', - code, - ); + throw generateError(errorData, 'Could not save the job on the server'); } } @@ -394,11 +351,7 @@ proxy: config.proxy, }); } catch (errorData) { - const code = errorData.response ? errorData.response.status : errorData.code; - throw new ServerError( - 'Could not get users from the server', - code, - ); + throw generateError(errorData, 'Could not get users from the server'); } return response.data.results; @@ -413,11 +366,7 @@ proxy: config.proxy, }); } catch (errorData) { - const code = errorData.response ? errorData.response.status : errorData.code; - throw new ServerError( - 'Could not get user data from the server', - code, - ); + throw generateError(errorData, 'Could not get user data from the server'); } return response.data; @@ -433,10 +382,9 @@ responseType: 'blob', }); } catch (errorData) { - const code = errorData.response ? errorData.response.status : errorData.code; - throw new ServerError( + throw generateError( + errorData, `Could not get frame ${frame} for the task ${tid} from the server`, - code, ); } @@ -452,10 +400,9 @@ proxy: config.proxy, }); } catch (errorData) { - const code = errorData.response ? errorData.response.status : errorData.code; - throw new ServerError( + throw generateError( + errorData, `Could not get frame meta info for the task ${tid} from the server`, - code, ); } @@ -472,10 +419,9 @@ proxy: config.proxy, }); } catch (errorData) { - const code = errorData.response ? errorData.response.status : errorData.code; - throw new ServerError( + throw generateError( + errorData, `Could not get annotations for the ${session} ${id} from the server`, - code, ); } @@ -504,10 +450,9 @@ }, }); } catch (errorData) { - const code = errorData.response ? errorData.response.status : errorData.code; - throw new ServerError( - `Could not updated annotations for the ${session} ${id} on the server`, - code, + throw generateError( + errorData, + `Could not ${action} annotations for the ${session} ${id} on the server`, ); } @@ -535,13 +480,10 @@ resolve(); } } catch (errorData) { - const code = errorData.response - ? errorData.response.status : errorData.code; - const error = new ServerError( + reject(generateError( + errorData, `Could not upload annotations for the ${session} ${id}`, - code, - ); - reject(error); + )); } } @@ -569,13 +511,10 @@ resolve(url); } } catch (errorData) { - const code = errorData.response - ? errorData.response.status : errorData.code; - const error = new ServerError( + reject(generateError( + errorData, `Could not dump annotations for the task ${id} from the server`, - code, - ); - reject(error); + )); } } diff --git a/cvat/apps/dashboard/static/dashboard/js/dashboard.js b/cvat/apps/dashboard/static/dashboard/js/dashboard.js index 6d887eb7..8ebf05ea 100644 --- a/cvat/apps/dashboard/static/dashboard/js/dashboard.js +++ b/cvat/apps/dashboard/static/dashboard/js/dashboard.js @@ -28,6 +28,7 @@ class TaskView { async _remove() { try { await this._task.delete(); + this._disable(); } catch (exception) { let { message } = exception; if (exception instanceof window.cvat.exceptions.ServerError) { @@ -35,8 +36,6 @@ class TaskView { } showMessage(message); } - - this._disable(); } _update() { @@ -49,7 +48,7 @@ class TaskView { $('#dashboardCancelUpdate').on('click', () => { dashboardUpdateModal.remove(); }); - $('#dashboardSubmitUpdate').on('click', () => { + $('#dashboardSubmitUpdate').on('click', async () => { let jsonLabels = null; try { jsonLabels = LabelsInfo.deserialize($('#dashboardNewLabels').prop('value')); @@ -61,7 +60,7 @@ class TaskView { try { const labels = jsonLabels.map(label => new window.cvat.classes.Label(label)); this._task.labels = labels; - this._task.save(); + await this._task.save(); showMessage('Task has been successfully updated'); } catch (exception) { let { message } = exception; diff --git a/cvat/apps/engine/static/engine/js/cvat-core.min.js b/cvat/apps/engine/static/engine/js/cvat-core.min.js index 4e810852..bf2b4569 100644 --- a/cvat/apps/engine/static/engine/js/cvat-core.min.js +++ b/cvat/apps/engine/static/engine/js/cvat-core.min.js @@ -1,15 +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;W?((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(){G?R.emit("unhandledRejection",r,t):H("unhandledrejection",t,r)}),e.rejection=G||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(){G?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,_),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:_,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=G?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,_,!1,!0),f(_),i=u.Promise,s({target:_,stat:!0,forced:J},{reject:function(t){var e=B(this);return e.reject.call(void 0,t),e.promise}}),s({target:_,stat:!0,forced:a||J},{resolve:function(t){return x(a&&this===i?N:this,t)}}),s({target:_,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({ALL:"all",SHAPE:"shape",NONE:"none"});t.exports={ShareFileType:e,TaskStatus:n,TaskMode:r,AttributeType:o,ObjectType:i,ObjectShape:s,VisibleState:a,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}}})()},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)};void 0!==this.bugTracker&&(e.bug_tracker=this.bugTracker),void 0!==this.segmentSize&&(e.segment_size=this.segmentSize),void 0!==this.overlap&&(e.overlap=this.overlap),void 0!==this.startFrame&&(e.start_frame=this.startFrame),void 0!==this.stopFrame&&(e.stop_frame=this.stopFrame),void 0!==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,visibility: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,this.visibility=!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}},visibility:{get:()=>e.visibility,set:t=>{e.updateFlags.visibility=!0,e.visibility=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,this.visibility=t.visibility,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("