@pageproof/sdk-pr 97.0.1537399623795 → 99.0.1532904725067
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +0 -37
- package/README.md +2 -4
- package/lib/api/Dashboard.js +1 -1
- package/lib/api/Proofs.js +1 -1
- package/lib/core/PageProof.js +1 -1
- package/lib/enum/index.js +1 -1
- package/lib/models/Proof.js +1 -1
- package/lib/network/endpoints.json +3 -33
- package/lib/pageproof.js +2 -2
- package/package.json +1 -1
- package/lib/api/DashboardGroups.js +0 -1
- package/lib/api/Preferences.js +0 -1
- package/lib/enum/Preference.js +0 -1
- package/lib/models/Preference.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,42 +1,5 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 2.0.0-beta.52
|
|
4
|
-
|
|
5
|
-
Released on the 20th of September 2018.
|
|
6
|
-
|
|
7
|
-
- [[#97](https://github.com/PageProofCom/sdk/pull/97)] Support for user preferences (for customizing the default message to reviewers and due date of new proofs). See [Preferences](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/Preferences.js~Preferences.html).
|
|
8
|
-
|
|
9
|
-
## 2.0.0-beta.51
|
|
10
|
-
|
|
11
|
-
Released on the 15th of August 2018.
|
|
12
|
-
|
|
13
|
-
- [[#60](https://github.com/PageProofCom/sdk/pull/60)] You can now archive multiple proofs at the same time. See [Proofs.archive](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/Proofs.js~Proofs.html#instance-method-archive).
|
|
14
|
-
|
|
15
|
-
## 2.0.0-beta.50
|
|
16
|
-
|
|
17
|
-
Released on the 3rd of August 2018.
|
|
18
|
-
|
|
19
|
-
- [[#102](https://github.com/PageProofCom/sdk/pull/102)] Support for todo and done comment counts in Proof model. See [Proof.todoCommentCount](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/models/Proof.js~Proof.html#instance-member-todoCommentCount) and [Proof.doneCommentCount](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/models/Proof.js~Proof.html#instance-member-doneCommentCount).
|
|
20
|
-
|
|
21
|
-
## 2.0.0-beta.49
|
|
22
|
-
|
|
23
|
-
Released on the 30th of July 2018.
|
|
24
|
-
|
|
25
|
-
- [[#96](https://github.com/PageProofCom/sdk/pull/96)] Adds the ability to request access to a proof you have not yet been invited to. See [Proofs.requestAccess](http://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/Proofs.js~Proofs.html#instance-method-requestAccess).
|
|
26
|
-
|
|
27
|
-
## 2.0.0-beta.48
|
|
28
|
-
|
|
29
|
-
Released on the 30th of July 2018.
|
|
30
|
-
|
|
31
|
-
- [[#99](https://github.com/PageProofCom/sdk/pull/99)] Adds support for special characters in filenames uploaded through the SDK. And adds support for a `onFileDetails` callback option when downloading files - this option provides you details about the file about to be downloaded (like filename, what it's assigned to, etc...). See [Files.upload](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/Files.js~Files.html#instance-method-upload) and [Files.download](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/Files.js~Files.html#instance-method-download).
|
|
32
|
-
|
|
33
|
-
## 2.0.0-beta.47
|
|
34
|
-
|
|
35
|
-
Released on the 30th of July 2018.
|
|
36
|
-
|
|
37
|
-
- [[#92](https://github.com/PageProofCom/sdk/pull/92)] Support for loading active proof groups (known as "Collections"). See [DashboardGroups.current](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/DashboardGroups.js~DashboardGroups.html).
|
|
38
|
-
|
|
39
|
-
|
|
40
3
|
## 2.0.0-beta.46
|
|
41
4
|
|
|
42
5
|
Released on the 27th of July 2018.
|
package/README.md
CHANGED
|
@@ -256,9 +256,7 @@ Name | Namespace | Description | Admin-only | Stability
|
|
|
256
256
|
[Accounts SSO API](./class/src/api/AccountsSSO.js~AccountsSSO.html) | `accounts.sso` | Used to login using a SSO provider. | No | Experimental
|
|
257
257
|
[Comments API](./class/src/api/Comments.js~Comments.html) | `comments` | Used to load comments. | No | Stable
|
|
258
258
|
[Dashboard API](./class/src/api/Dashboard.js~Dashboard.html) | `dashboard` | Used to load the authenticated user's dashboard & search for/filter proofs. | No | Stable
|
|
259
|
-
[Dashboard Groups API](./class/src/api/DashboardGroups.js~DashboardGroups.html) | `dashboard.groups` | Used to load proof groups | No | Experimental
|
|
260
259
|
[Files API](./class/src/api/Files.js~Files.html) | `files` | Used to upload & manage files. | No | Stable
|
|
261
|
-
[Preferences API](./class/src/api/Preferences.js~Preferences.html) | `preferences` | Manage your account preferences. | No | Experimental
|
|
262
260
|
[Profile API](./class/src/api/Profile.js~Profile.html) | `profile` | Manage your account details. | No | Experimental
|
|
263
261
|
[Proofs API](./class/src/api/Proofs.js~Proofs.html) | `proofs` | Used to create & manage proofs. | No | Stable
|
|
264
262
|
[Proofs Groups API](./class/src/api/ProofsGroups.js~ProofsGroups.html) | `proofs.groups` | Used to manage groups of proofs. | No | Experimental
|
|
@@ -329,11 +327,11 @@ if (sessionJSON !== null) {
|
|
|
329
327
|
```
|
|
330
328
|
|
|
331
329
|
You may notice we're making use of a method called
|
|
332
|
-
[`setSession`](
|
|
330
|
+
[`setSession`](http://localhost:8080/class/src/core/PageProof.js~PageProof.html#instance-method-setSession) within our
|
|
333
331
|
PageProof client. This method is automatically called when calling the `accounts.login` method, but if the user
|
|
334
332
|
refreshes, we need to remind the client what the current session is.
|
|
335
333
|
|
|
336
334
|
**NEVER** send the session object over the network. The
|
|
337
|
-
[Session](
|
|
335
|
+
[Session](http://localhost:8080/class/src/models/Session.js~Session.html) object contains the user's private keys.
|
|
338
336
|
Sharing the private keys with anybody, directly or even indirectly (over unencrypted traffic, for example), gives
|
|
339
337
|
anybody the ability to access & decrypt all proofs you have access to, including those you have been invited to.
|
package/lib/api/Dashboard.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _Proof=require("../models/Proof");var _Proof2=_interopRequireDefault(_Proof);
|
|
1
|
+
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _Proof=require("../models/Proof");var _Proof2=_interopRequireDefault(_Proof);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}var TABS={inbox:"ProofIn",sent:"ProofOut",outbox:"ProofOutBox"};function transformTabs(data){var tabs={};Object.keys(TABS).forEach(function(name){tabs[name]=data[TABS[name]]});return tabs}function transformProofs(proofs){return(proofs||[]).map(function(proofData){return(new _Proof2.default).fromProof(proofData)})}var Dashboard=function(_API){_inherits(Dashboard,_API);function Dashboard(){_classCallCheck(this,Dashboard);return _possibleConstructorReturn(this,_API.apply(this,arguments))}Dashboard.prototype.inbox=function inbox(){return this._loadSingleTabProofs("inbox")};Dashboard.prototype.sent=function sent(){return this._loadSingleTabProofs("sent")};Dashboard.prototype.outbox=function outbox(){return this._loadSingleTabProofs("outbox")};Dashboard.prototype._loadSingleTabProofs=function _loadSingleTabProofs(name){return this.client.request("dashboard."+name).then(function(response){return transformTabs(response.data)}).then(function(dashboard){return dashboard[name]}).then(transformProofs)};Dashboard.prototype.search=function search(query){return this._loadSearchProofs({query:query})};Dashboard.prototype.everything=function everything(){return this._loadSearchProofs({all:1})};Dashboard.prototype.approved=function approved(){return this._loadSearchProofs({filterBy:70})};Dashboard.prototype.archived=function archived(){return this._loadSearchProofs({filterBy:100})};Dashboard.prototype._loadSearchProofs=function _loadSearchProofs(params){return this.client.request("dashboard.search",params).then(function(response){return transformProofs(response.data.Proofs)})};return Dashboard}(_API3.default);exports.default=Dashboard;
|
package/lib/api/Proofs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _ProofsOwners=require("./ProofsOwners");var _ProofsOwners2=_interopRequireDefault(_ProofsOwners);var _ProofsEditors=require("./ProofsEditors");var _ProofsEditors2=_interopRequireDefault(_ProofsEditors);var _ProofsVersions=require("./ProofsVersions");var _ProofsVersions2=_interopRequireDefault(_ProofsVersions);var _ProofsGroups=require("./ProofsGroups");var _ProofsGroups2=_interopRequireDefault(_ProofsGroups);var _Proof=require("../models/Proof");var _Proof2=_interopRequireDefault(_Proof);var _FileStatus=require("../enum/FileStatus");var _FileStatus2=_interopRequireDefault(_FileStatus);var _constants=require("../util/constants");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}var Proofs=function(_API){_inherits(Proofs,_API);function Proofs(client){_classCallCheck(this,Proofs);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.owners=new _ProofsOwners2.default(client);_this.editors=new _ProofsEditors2.default(client);_this.versions=new _ProofsVersions2.default(client);_this.groups=new _ProofsGroups2.default(client);return _this}Proofs.prototype.setWorkflow=function setWorkflow(proofId,workflowId){var _this2=this;return this.client.request("proofs.normalize-workflow",{proofId:proofId,workflowId:workflowId}).then(function(){return _this2.client.request("proofs.set-workflow",{proofId:proofId,workflowId:workflowId})})};Proofs.prototype.setTags=function setTags(proofId,tags){return this.client.request("proofs.set-tags",{relatedId:proofId,tag:tags.join(",")})};Proofs.prototype.deleteTag=function deleteTag(proofId,tag){return this.client.request("proofs.tag-delete",{relatedId:proofId,tag:tag})};Proofs.prototype.setFile=function setFile(proofId,fileId){var _this3=this;return this.client.request("proofs.set-file",{proofId:proofId,fileId:fileId}).then(function(){return _this3.client.request("proofs.distribute-file",{proofId:proofId})})};Proofs.prototype.create=function create(_ref){var _this4=this;var name=_ref.name,_ref$tags=_ref.tags,tags=_ref$tags===undefined?[]:_ref$tags,_ref$dueDate=_ref.dueDate,dueDate=_ref$dueDate===undefined?new Date(Date.now()+3*_constants.DAY_IN_MS):_ref$dueDate,messageToReviewers=_ref.messageToReviewers,workflow=_ref.workflow,file=_ref.file,group=_ref.group,_ref$start=_ref.start,start=_ref$start===undefined?true:_ref$start;var shouldStart=start&&!group;return this.client.request("proofs.create",{title:name,dueDate:dueDate.toISOString(),description:messageToReviewers,groupId:group?group.id:undefined}).then(function(response){var proof=(new _Proof2.default).fromProof(response.data);return Promise.all([proof,tags.length&&_this4.setTags(proof.id,tags),workflow&&_this4.setWorkflow(proof.id,workflow.id),file&&_this4.setFile(proof.id,file.id)])}).then(function(_ref2){var proof=_ref2[0];return Promise.resolve(shouldStart&&_this4.start(proof.id)).then(function(){return proof})}).then(function(proof){if(workflow){proof.workflowId=workflow.id}if(file){proof.fileId=file.id;proof.fileStatus=_FileStatus2.default.UPLOADING}proof.calculateState();return proof})};Proofs.prototype.archive=function archive(
|
|
1
|
+
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _ProofsOwners=require("./ProofsOwners");var _ProofsOwners2=_interopRequireDefault(_ProofsOwners);var _ProofsEditors=require("./ProofsEditors");var _ProofsEditors2=_interopRequireDefault(_ProofsEditors);var _ProofsVersions=require("./ProofsVersions");var _ProofsVersions2=_interopRequireDefault(_ProofsVersions);var _ProofsGroups=require("./ProofsGroups");var _ProofsGroups2=_interopRequireDefault(_ProofsGroups);var _Proof=require("../models/Proof");var _Proof2=_interopRequireDefault(_Proof);var _FileStatus=require("../enum/FileStatus");var _FileStatus2=_interopRequireDefault(_FileStatus);var _constants=require("../util/constants");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}var Proofs=function(_API){_inherits(Proofs,_API);function Proofs(client){_classCallCheck(this,Proofs);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.owners=new _ProofsOwners2.default(client);_this.editors=new _ProofsEditors2.default(client);_this.versions=new _ProofsVersions2.default(client);_this.groups=new _ProofsGroups2.default(client);return _this}Proofs.prototype.setWorkflow=function setWorkflow(proofId,workflowId){var _this2=this;return this.client.request("proofs.normalize-workflow",{proofId:proofId,workflowId:workflowId}).then(function(){return _this2.client.request("proofs.set-workflow",{proofId:proofId,workflowId:workflowId})})};Proofs.prototype.setTags=function setTags(proofId,tags){return this.client.request("proofs.set-tags",{relatedId:proofId,tag:tags.join(",")})};Proofs.prototype.deleteTag=function deleteTag(proofId,tag){return this.client.request("proofs.tag-delete",{relatedId:proofId,tag:tag})};Proofs.prototype.setFile=function setFile(proofId,fileId){var _this3=this;return this.client.request("proofs.set-file",{proofId:proofId,fileId:fileId}).then(function(){return _this3.client.request("proofs.distribute-file",{proofId:proofId})})};Proofs.prototype.create=function create(_ref){var _this4=this;var name=_ref.name,_ref$tags=_ref.tags,tags=_ref$tags===undefined?[]:_ref$tags,_ref$dueDate=_ref.dueDate,dueDate=_ref$dueDate===undefined?new Date(Date.now()+3*_constants.DAY_IN_MS):_ref$dueDate,messageToReviewers=_ref.messageToReviewers,workflow=_ref.workflow,file=_ref.file,group=_ref.group,_ref$start=_ref.start,start=_ref$start===undefined?true:_ref$start;var shouldStart=start&&!group;return this.client.request("proofs.create",{title:name,dueDate:dueDate.toISOString(),description:messageToReviewers,groupId:group?group.id:undefined}).then(function(response){var proof=(new _Proof2.default).fromProof(response.data);return Promise.all([proof,tags.length&&_this4.setTags(proof.id,tags),workflow&&_this4.setWorkflow(proof.id,workflow.id),file&&_this4.setFile(proof.id,file.id)])}).then(function(_ref2){var proof=_ref2[0];return Promise.resolve(shouldStart&&_this4.start(proof.id)).then(function(){return proof})}).then(function(proof){if(workflow){proof.workflowId=workflow.id}if(file){proof.fileId=file.id;proof.fileStatus=_FileStatus2.default.UPLOADING}proof.calculateState();return proof})};Proofs.prototype.archive=function archive(proofId){return this.client.request("proofs.archive",{proofId:proofId})};Proofs.prototype.unarchive=function unarchive(proofId){return this.client.request("proofs.unarchive",{proofId:proofId})};Proofs.prototype.delete=function _delete(proofId){return this.client.request("proofs.delete",{proofId:proofId})};Proofs.prototype.return=function _return(proofId){return this.client.request("proofs.return",{proofId:proofId})};Proofs.prototype.start=function start(proofId){return this.client.request("proofs.start",{proofId:proofId})};Proofs.prototype.removeEditor=function removeEditor(id){return this.client.request("proofs.remove-editor",{proofId:id})};Proofs.prototype.load=function load(proofId){return this.client.request("proofs.load",{proofId:proofId}).then(function(response){return(new _Proof2.default).fromProof(response.data)})};Proofs.prototype.lock=function lock(proofId){return this.client.request("proofs.lock",{proofId:proofId})};Proofs.prototype.unlock=function unlock(proofId){return this.client.request("proofs.unlock",{proofId:proofId})};Proofs.prototype.requestUnlock=function requestUnlock(proofId){return this.client.request("proofs.request-unlock",{proofId:proofId})};return Proofs}(_API3.default);exports.default=Proofs;
|
package/lib/core/PageProof.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _AdapterRepository=require("./AdapterRepository");var _AdapterRepository2=_interopRequireDefault(_AdapterRepository);var _Cache=require("./Cache");var _Cache2=_interopRequireDefault(_Cache);var _Request=require("../network/Request");var _Request2=_interopRequireDefault(_Request);var _Response=require("../network/Response");var _Response2=_interopRequireDefault(_Response);var _Accounts=require("../api/Accounts");var _Accounts2=_interopRequireDefault(_Accounts);var _Dashboard=require("../api/Dashboard");var _Dashboard2=_interopRequireDefault(_Dashboard);var _Users=require("../api/Users");var _Users2=_interopRequireDefault(_Users);var _Proofs=require("../api/Proofs");var _Proofs2=_interopRequireDefault(_Proofs);var _Briefs=require("../api/Briefs");var _Briefs2=_interopRequireDefault(_Briefs);var _Files=require("../api/Files");var _Files2=_interopRequireDefault(_Files);var _Admin=require("../api/admin/Admin");var _Admin2=_interopRequireDefault(_Admin);var _Workflows=require("../api/Workflows");var _Workflows2=_interopRequireDefault(_Workflows);var
|
|
1
|
+
"use strict";exports.__esModule=true;var _AdapterRepository=require("./AdapterRepository");var _AdapterRepository2=_interopRequireDefault(_AdapterRepository);var _Cache=require("./Cache");var _Cache2=_interopRequireDefault(_Cache);var _Request=require("../network/Request");var _Request2=_interopRequireDefault(_Request);var _Response=require("../network/Response");var _Response2=_interopRequireDefault(_Response);var _Accounts=require("../api/Accounts");var _Accounts2=_interopRequireDefault(_Accounts);var _Dashboard=require("../api/Dashboard");var _Dashboard2=_interopRequireDefault(_Dashboard);var _Users=require("../api/Users");var _Users2=_interopRequireDefault(_Users);var _Proofs=require("../api/Proofs");var _Proofs2=_interopRequireDefault(_Proofs);var _Briefs=require("../api/Briefs");var _Briefs2=_interopRequireDefault(_Briefs);var _Files=require("../api/Files");var _Files2=_interopRequireDefault(_Files);var _Admin=require("../api/admin/Admin");var _Admin2=_interopRequireDefault(_Admin);var _Workflows=require("../api/Workflows");var _Workflows2=_interopRequireDefault(_Workflows);var _Comments=require("../api/Comments");var _Comments2=_interopRequireDefault(_Comments);var _Profile=require("../api/Profile");var _Profile2=_interopRequireDefault(_Profile);var _Sessions=require("../api/Sessions");var _Sessions2=_interopRequireDefault(_Sessions);var _Session=require("../models/Session");var _Session2=_interopRequireDefault(_Session);var _EventEmitter=require("../events/EventEmitter");var _EventEmitter2=_interopRequireDefault(_EventEmitter);var _ResponseStatus=require("../enum/ResponseStatus");var _ResponseStatus2=_interopRequireDefault(_ResponseStatus);var _sleep=require("../util/sleep");var _sleep2=_interopRequireDefault(_sleep);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var debug=require("debug")("PageProof");var PageProof=function(){function PageProof(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,PageProof);this.options=options;this.events=new _EventEmitter2.default;this.adapters=new _AdapterRepository2.default(this.options.adapters);this.cache=new _Cache2.default(this);this.accounts=new _Accounts2.default(this);this.comments=new _Comments2.default(this);this.dashboard=new _Dashboard2.default(this);this.files=new _Files2.default(this);this.profile=new _Profile2.default(this);this.proofs=new _Proofs2.default(this);this.briefs=new _Briefs2.default(this);this.users=new _Users2.default(this);this.workflows=new _Workflows2.default(this);this.sessions=new _Sessions2.default(this);this._registerCoreHooks();this._enhance()}PageProof.prototype._registerCoreHooks=function _registerCoreHooks(){this.on("error.throttled",function(event){var ms=event.data.response.data.timeout;debug("Sleeping "+ms+"ms until rate limit resets");return(0,_sleep2.default)(ms)})};PageProof.prototype._enhance=function _enhance(){var _this=this;var adapters=this.adapters.getEnhancementAdapters();adapters.forEach(function(adapter){return adapter.onClientReady(_this)})};PageProof.prototype.setSession=function setSession(session){if(session&&!(session instanceof _Session2.default)){this.session=(new _Session2.default).fromJSON(session)}else{this.session=session||null}return this.session};PageProof.prototype.request=function request(name,params,options){var _this2=this;var request=new _Request2.default(name,params);var adapter=this.adapters.getRequestAdapter();var start=Promise.resolve();if(!request.endpoint.anonymous){if(!this.session){return Promise.reject(new Error("Cannot make call to endpoint ("+name+") when unauthorized."))}var crypto=this.adapters.getCryptoAdapter();start=crypto.generateAuthorizationHeaders(request.getMethod(),request.getPath(),this.session).then(function(headers){return request.addHeaders(headers)})}var meta={request:request};return start.then(function(){var data=request.build();return _this2.events.emit("experimental.request.before",meta,true).then(function(){return data})}).then(function(data){return adapter.send(data,options)}).then(_Response2.default.parse).then(function(response){meta.response=response;_this2.events.emit("experimental.request.after",meta);if(response.code===_ResponseStatus2.default.ERROR_THROTTLED){var handlers=_this2.events.emit("error.throttled",meta);if(handlers.some(Boolean)){return Promise.all(handlers).then(function(){_this2.events.emit("experimental.request.retry",meta);return _this2.request(name,params,options)})}}if(response.code===_ResponseStatus2.default.ERROR_UNAUTHORISED){var sessionToken=_this2.session?_this2.session.token:null;return _this2.events.emit("error.unauthorized",meta,true).then(function(){if(_this2.session&&_this2.session.token!==sessionToken){return _this2.request(name,params,options)}return response})}if(response.deprecated){var message="The "+name+" API has been deprecated. "+(response.deprecated||"");_this2.events.emit("error.deprecated",{name:name,message:message})}return response}).then(function(response){try{if(response.error){_this2.events.emit("error.response",meta);var err=new Error(name+" request resulted in an "+response.code+" error.");err.response=response;err.request=request;return Promise.reject(err)}else{_this2.events.emit("experimental.request.resolve",meta);return Promise.resolve(response)}}finally{_this2.events.emit("experimental.request.finally",meta)}})};PageProof.prototype.admin=function admin(){if(!this.session){return Promise.reject(new Error("You must be logged in to use the Admin API."))}if(!this.session.user.isAdmin){return Promise.reject(new Error("The current user must be an administrator of a team or enterprise account."))}if(!this._admin){this._admin=Promise.resolve(new _Admin2.default(this))}return this._admin};PageProof.prototype.crypto=function crypto(){return this.adapters.getCryptoAdapter()};PageProof.prototype.on=function on(event,handler){return this.events.on(event,handler)};return PageProof}();exports.default=PageProof;
|
package/lib/enum/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;exports.
|
|
1
|
+
"use strict";exports.__esModule=true;exports.WorkflowUserState=exports.WorkflowUserRole=exports.WorkflowStepState=exports.ResponseStatus=exports.ProofStatus=exports.ProofState=exports.ImportProvider=exports.FileStatus=exports.FileAssignee=exports.CommentState=undefined;var _CommentState=require("./CommentState");var _CommentState2=_interopRequireDefault(_CommentState);var _FileAssignee=require("./FileAssignee");var _FileAssignee2=_interopRequireDefault(_FileAssignee);var _FileStatus=require("./FileStatus");var _FileStatus2=_interopRequireDefault(_FileStatus);var _ImportProvider=require("./ImportProvider");var _ImportProvider2=_interopRequireDefault(_ImportProvider);var _ProofState=require("./ProofState");var _ProofState2=_interopRequireDefault(_ProofState);var _ProofStatus=require("./ProofStatus");var _ProofStatus2=_interopRequireDefault(_ProofStatus);var _ResponseStatus=require("./ResponseStatus");var _ResponseStatus2=_interopRequireDefault(_ResponseStatus);var _WorkflowStepState=require("./WorkflowStepState");var _WorkflowStepState2=_interopRequireDefault(_WorkflowStepState);var _WorkflowUserRole=require("./WorkflowUserRole");var _WorkflowUserRole2=_interopRequireDefault(_WorkflowUserRole);var _WorkflowUserState=require("./WorkflowUserState");var _WorkflowUserState2=_interopRequireDefault(_WorkflowUserState);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.CommentState=_CommentState2.default;exports.FileAssignee=_FileAssignee2.default;exports.FileStatus=_FileStatus2.default;exports.ImportProvider=_ImportProvider2.default;exports.ProofState=_ProofState2.default;exports.ProofStatus=_ProofStatus2.default;exports.ResponseStatus=_ResponseStatus2.default;exports.WorkflowStepState=_WorkflowStepState2.default;exports.WorkflowUserRole=_WorkflowUserRole2.default;exports.WorkflowUserState=_WorkflowUserState2.default;
|
package/lib/models/Proof.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);var _ProofState=require("../enum/ProofState");var _ProofState2=_interopRequireDefault(_ProofState);var _ProofStatus=require("../enum/ProofStatus");var _ProofStatus2=_interopRequireDefault(_ProofStatus);var _FileStatus=require("../enum/FileStatus");var _FileStatus2=_interopRequireDefault(_FileStatus);var _id=require("../util/id");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function isOverdue(){return this.dueDate&&this.dueDate.getTime()<Date.now()}var proofSchema={id:"ProofId",name:"Title",status:"Status",workflowId:"WorkflowId",version:"Version",dueDate:(0,_transform.date)("DueDate"),createdDate:(0,_transform.date)("CreatedDate"),approvedDate:(0,_transform.date)("ApprovedDate"),isLocked:"Locked",isArchived:"Closed",isOverdue:isOverdue,uploaderUserId:"UserId",ownerUserIds:"OwnerIds",editorUserId:"EditorId",editorUserIds:"EditorIds",lockerUserId:"ProofLockerId",messageToReviewers:"Description",messageToOwners:"OwnerMessage",messageToEditor:"EditorMessage",fileId:"FileId",fileExtension:"Extension",fileStatus:"FileStatus",fileMessage:"FileStatusMessage",pageCount:(0,_transform.number)("Pages"),commentCount:(0,_transform.number)("ParentComments"),canDownload:(0,_transform.truthy)("DownloadOriginal"),type:"Type",processStatus:"ProcessStatus",recipient:"Recipient"
|
|
1
|
+
"use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);var _ProofState=require("../enum/ProofState");var _ProofState2=_interopRequireDefault(_ProofState);var _ProofStatus=require("../enum/ProofStatus");var _ProofStatus2=_interopRequireDefault(_ProofStatus);var _FileStatus=require("../enum/FileStatus");var _FileStatus2=_interopRequireDefault(_FileStatus);var _id=require("../util/id");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function isOverdue(){return this.dueDate&&this.dueDate.getTime()<Date.now()}var proofSchema={id:"ProofId",name:"Title",status:"Status",workflowId:"WorkflowId",version:"Version",dueDate:(0,_transform.date)("DueDate"),createdDate:(0,_transform.date)("CreatedDate"),approvedDate:(0,_transform.date)("ApprovedDate"),isLocked:"Locked",isArchived:"Closed",isOverdue:isOverdue,uploaderUserId:"UserId",ownerUserIds:"OwnerIds",editorUserId:"EditorId",editorUserIds:"EditorIds",lockerUserId:"ProofLockerId",messageToReviewers:"Description",messageToOwners:"OwnerMessage",messageToEditor:"EditorMessage",fileId:"FileId",fileExtension:"Extension",fileStatus:"FileStatus",fileMessage:"FileStatusMessage",pageCount:(0,_transform.number)("Pages"),commentCount:(0,_transform.number)("ParentComments"),canDownload:(0,_transform.truthy)("DownloadOriginal"),type:"Type",processStatus:"ProcessStatus",recipient:"Recipient"};var Proof=function(){function Proof(){_classCallCheck(this,Proof)}Proof.prototype.getState=function getState(){var state=_ProofState2.default.ACTIVE;if(this.fileStatus===_FileStatus2.default.UPLOADING){state=_ProofState2.default.UPLOADING}else if(this.hasFileError()){state=_ProofState2.default.FILE_ERROR}else if(this.isProcessing()){state=_ProofState2.default.PROCESSING}else if(this.status===_ProofStatus2.default.ARCHIVED){state=_ProofState2.default.ARCHIVED}else if(!this.hasWorkflow()){state=_ProofState2.default.PROOFERS_NEEDED}else if(this.status===_ProofStatus2.default.TODOS_REQUESTED){state=_ProofState2.default.TODOS_REQUESTED}else if(this.status===_ProofStatus2.default.AWAITING_NEW_VERSION){state=_ProofState2.default.AWAITING_NEW_VERSION}else if(this.status===_ProofStatus2.default.APPROVED){state=_ProofState2.default.APPROVED}else if(!this.hasWorkflowStarted()){state=_ProofState2.default.NOT_STARTED}else if(this.isOverdue){state=_ProofState2.default.OVERDUE}return state};Proof.prototype.hasWorkflowStarted=function hasWorkflowStarted(){return this.hasWorkflow()&&this.status!==_ProofStatus2.default.NEW};Proof.prototype.isProcessing=function isProcessing(){return this.fileStatus===_FileStatus2.default.UPLOADING||this.fileStatus===_FileStatus2.default.QUEUED||this.fileStatus===_FileStatus2.default.RIPPING};Proof.prototype.getProcessingProgress=function getProcessingProgress(){switch(this.fileStatus){case _FileStatus2.default.UPLOADING:return.1;case _FileStatus2.default.QUEUED:return.2;case _FileStatus2.default.RIPPING:return.6;default:return-1}};Proof.prototype.hasWorkflow=function hasWorkflow(){return(0,_id.isWorkflowId)(this.workflowId)};Proof.prototype.hasFile=function hasFile(){return(0,_id.isFileId)(this.fileId)};Proof.prototype.hasFileError=function hasFileError(){return this.fileStatus===_FileStatus2.default.ERROR||!this.fileStatus||!this.hasFile()};Proof.prototype.hasEditor=function hasEditor(){return(0,_id.isUserId)(this.editorUserId)};Proof.prototype.hasThumbnail=function hasThumbnail(){return this.fileStatus===_FileStatus2.default.OK};Proof.prototype.canUserUploadNewVersion=function canUserUploadNewVersion(userId){return this.getState()===_ProofState2.default.AWAITING_NEW_VERSION&&(this.editorUserId===userId||this.isOwner(userId))};Proof.prototype.isOwner=function isOwner(userId){return this.ownerUserIds.indexOf(userId)!==-1};Proof.prototype.calculateState=function calculateState(){this.state=this.getState()};Proof.prototype.fromProof=function fromProof(proofData){(0,_transform2.default)(this,proofSchema,proofData);this.calculateState();return this};return Proof}();exports.default=Proof;
|
|
@@ -38,25 +38,6 @@
|
|
|
38
38
|
"body": ["oldPassword", "newPassword", "newPrivateKey"],
|
|
39
39
|
"trailing": true
|
|
40
40
|
},
|
|
41
|
-
"preferences.all": {
|
|
42
|
-
"method": "GET",
|
|
43
|
-
"path": "/api/users/preferences/all"
|
|
44
|
-
},
|
|
45
|
-
"preferences.get": {
|
|
46
|
-
"method": "GET",
|
|
47
|
-
"path": "/api/users/preferences/get",
|
|
48
|
-
"query": ["preferences"]
|
|
49
|
-
},
|
|
50
|
-
"preferences.update": {
|
|
51
|
-
"method": "POST",
|
|
52
|
-
"path": "/api/users/preferences/update",
|
|
53
|
-
"body": true
|
|
54
|
-
},
|
|
55
|
-
"preferences.reset": {
|
|
56
|
-
"method": "POST",
|
|
57
|
-
"path": "api/users/preferences/update",
|
|
58
|
-
"body": ["preferences"]
|
|
59
|
-
},
|
|
60
41
|
"dashboard.inbox": {
|
|
61
42
|
"method": "GET",
|
|
62
43
|
"path": "/api/proofs/dashboard/proofin",
|
|
@@ -77,12 +58,6 @@
|
|
|
77
58
|
"path": "/api/proofs/search",
|
|
78
59
|
"body": ["query", "all", "filterBy"]
|
|
79
60
|
},
|
|
80
|
-
"dashboard.groups.filter-by": {
|
|
81
|
-
"method": "GET",
|
|
82
|
-
"path": "/api/proofs/dashboard/groups",
|
|
83
|
-
"chain": ["filterBy"],
|
|
84
|
-
"trailing": true
|
|
85
|
-
},
|
|
86
61
|
"users.by-id": {
|
|
87
62
|
"method": "GET",
|
|
88
63
|
"path": "/api/users",
|
|
@@ -131,10 +106,10 @@
|
|
|
131
106
|
"trailing": true
|
|
132
107
|
},
|
|
133
108
|
"proofs.archive": {
|
|
134
|
-
"
|
|
135
|
-
"method": "POST",
|
|
109
|
+
"method": "GET",
|
|
136
110
|
"path": "/api/proofs/close",
|
|
137
|
-
"
|
|
111
|
+
"chain": ["proofId"],
|
|
112
|
+
"trailing": true
|
|
138
113
|
},
|
|
139
114
|
"proofs.unarchive": {
|
|
140
115
|
"method": "GET",
|
|
@@ -237,11 +212,6 @@
|
|
|
237
212
|
"chain": ["proofId"],
|
|
238
213
|
"trailing": true
|
|
239
214
|
},
|
|
240
|
-
"proofs.request-access": {
|
|
241
|
-
"method": "GET",
|
|
242
|
-
"path": "/api/proofs/requestaccess",
|
|
243
|
-
"chain": ["proofId"]
|
|
244
|
-
},
|
|
245
215
|
"proofs.lock": {
|
|
246
216
|
"method": "GET",
|
|
247
217
|
"path": "/api/proofs/lock/",
|
package/lib/pageproof.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.PageProof=t():e.PageProof=t()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=30)}([function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=function e(t){o(this,e),this.client=t};t.default=r},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t,n){var o=[],r={};return Array.isArray(t)?(o=t,t.forEach(function(e){r[e]=e})):(0,y.default)(t)&&(o=Object.keys(t),r=t),o.forEach(function(t){var o=r[t],i=void 0;if("string"==typeof o)i=-1!==o.indexOf(".")?function(){for(var e=o.split("."),t=n,r=0;r<e.length;r++){var i=e[r];if(!(0,w.default)(t,i)){t=void 0;break}t=t[i]}return t}:function(){return n[o]};else{if("function"!=typeof o){if(null===o)return;throw new Error("Unknown transformer.")}i=o}var s=i.call(e,n);void 0!==s&&(e[t]=s)}),e}function i(e){return function(t){return Number(t[e])}}function s(e,t){return function(n){return t[n[e]]}}function a(e){return function(t){var n=t[e];if(n&&"0001-01-01T00:00:00"!==n)return"number"==typeof n?new Date(1e3*n):new Date(n+"Z")}}function u(e){return function(t){var n=String(t[e]);return"1"===n||"true"===n}}function f(e){return function(t){return w.default.call(t,e)}}function c(e,t){return function(n){return n[e]?n[e].map(t):[]}}function l(e,t){return function(n){return n[e]?JSON.parse(n[e]):Array.isArray(t)?[].concat(t):d({},t)}}function p(e){return function(t){return t[e]?t[e]:void 0}}t.__esModule=!0;var d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e};t.number=i,t.enumeration=s,t.date=a,t.truthy=u,t.exists=f,t.each=c,t.json=l,t.optional=p;var h=n(16),y=o(h),m=n(9),w=o(m);t.default=r},function(e,t,n){"use strict";t.__esModule=!0;t.TOKEN_HEADER="x-authorization-token",t.HMAC_HEADER="x-authorization-hmac",t.TIMESTAMP_HEADER="x-timestamp",t.DEVICE_ID_HEADER="x-device-id",t.SUBSCRIPTION_KEY_HEADER="ocp-apim-subscription-key",t.SDK_VERSION_HEADER="x-pageproof-javascript-sdk",t.RETRY_AFTER_HEADER="retry-after",t.BYTES_PER_BLOCK=2097152,t.MENTION_REGEX=/@{(U[a-zA-Z0-9]{15}|~everyone)}{(.*?)}/g,t.ISO_REGEX=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/,t.DEFAULT_ISO_DATE="0001-01-01T00:00:00",t.DAY_IN_MS=864e5,t.COMMENT_CACHE_PREFIX="comment",t.THUMBNAIL_CACHE_PREFIX="thumbnail"},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=n(1),i=function(e){return e&&e.__esModule?e:{default:e}}(r),s={id:"UserId",name:"Name",email:"Email",hasActivated:"Activated",hasRegistered:"IsRegistered",hasAvatar:"HasAvatar",accountType:"AccountType",teamType:"TeamType",teamLogo:"Branding.LogoURL",registeredDate:(0,r.date)("Registered"),lastLoginDate:(0,r.date)("LastLogin"),lastUploadDate:(0,r.date)("LastUpload"),isAdmin:"IsDomainAdmin"},a=function(){function e(){o(this,e)}return e.prototype.fromJSON=function(e){return(0,i.default)(this,Object.keys(s),e),this},e.prototype.fromUser=function(e){return(0,i.default)(this,s,e),this},e}();t.default=a},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(){return this.dueDate&&this.dueDate.getTime()<Date.now()}t.__esModule=!0;var s=n(1),a=o(s),u=n(18),f=o(u),c=n(19),l=o(c),p=n(5),d=o(p),h=n(20),y={id:"ProofId",name:"Title",status:"Status",workflowId:"WorkflowId",version:"Version",dueDate:(0,s.date)("DueDate"),createdDate:(0,s.date)("CreatedDate"),approvedDate:(0,s.date)("ApprovedDate"),isLocked:"Locked",isArchived:"Closed",isOverdue:i,uploaderUserId:"UserId",ownerUserIds:"OwnerIds",editorUserId:"EditorId",editorUserIds:"EditorIds",lockerUserId:"ProofLockerId",messageToReviewers:"Description",messageToOwners:"OwnerMessage",messageToEditor:"EditorMessage",fileId:"FileId",fileExtension:"Extension",fileStatus:"FileStatus",fileMessage:"FileStatusMessage",pageCount:(0,s.number)("Pages"),commentCount:(0,s.number)("ParentComments"),canDownload:(0,s.truthy)("DownloadOriginal"),type:"Type",processStatus:"ProcessStatus",recipient:"Recipient",todoCommentCount:(0,s.number)("CountTodoComments"),doneCommentCount:(0,s.number)("CountDoneComments")},m=function(){function e(){r(this,e)}return e.prototype.getState=function(){var e=f.default.ACTIVE;return this.fileStatus===d.default.UPLOADING?e=f.default.UPLOADING:this.hasFileError()?e=f.default.FILE_ERROR:this.isProcessing()?e=f.default.PROCESSING:this.status===l.default.ARCHIVED?e=f.default.ARCHIVED:this.hasWorkflow()?this.status===l.default.TODOS_REQUESTED?e=f.default.TODOS_REQUESTED:this.status===l.default.AWAITING_NEW_VERSION?e=f.default.AWAITING_NEW_VERSION:this.status===l.default.APPROVED?e=f.default.APPROVED:this.hasWorkflowStarted()?this.isOverdue&&(e=f.default.OVERDUE):e=f.default.NOT_STARTED:e=f.default.PROOFERS_NEEDED,e},e.prototype.hasWorkflowStarted=function(){return this.hasWorkflow()&&this.status!==l.default.NEW},e.prototype.isProcessing=function(){return this.fileStatus===d.default.UPLOADING||this.fileStatus===d.default.QUEUED||this.fileStatus===d.default.RIPPING},e.prototype.getProcessingProgress=function(){switch(this.fileStatus){case d.default.UPLOADING:return.1;case d.default.QUEUED:return.2;case d.default.RIPPING:return.6;default:return-1}},e.prototype.hasWorkflow=function(){return(0,h.isWorkflowId)(this.workflowId)},e.prototype.hasFile=function(){return(0,h.isFileId)(this.fileId)},e.prototype.hasFileError=function(){return this.fileStatus===d.default.ERROR||!this.fileStatus||!this.hasFile()},e.prototype.hasEditor=function(){return(0,h.isUserId)(this.editorUserId)},e.prototype.hasThumbnail=function(){return this.fileStatus===d.default.OK},e.prototype.canUserUploadNewVersion=function(e){return this.getState()===f.default.AWAITING_NEW_VERSION&&(this.editorUserId===e||this.isOwner(e))},e.prototype.isOwner=function(e){return-1!==this.ownerUserIds.indexOf(e)},e.prototype.calculateState=function(){this.state=this.getState()},e.prototype.fromProof=function(e){return(0,a.default)(this,y,e),this.calculateState(),this},e}();t.default=m},function(e,t,n){"use strict";t.__esModule=!0;var o={OK:"OK",UPLOADING:"Uploading",QUEUED:"Queued",RIPPING:"Ripping",ERROR:"Error"};t.default=o},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=n(1),s=o(i),a=n(3),u=o(a),f={userId:"UserId",token:"Token",sharedKey:"SharedKey",privateKeyPEM$:"PrivateKey",privateKeyPEM:null,publicKeyPEM:"PublicKey",serverPublicKeyPEM:"PublicServerKey"},c=function(){function e(){r(this,e)}return e.prototype.fromJSON=function(e){return(0,s.default)(this,Object.keys(f),e),this.user=(new u.default).fromJSON(e.user),this},e.prototype.fromSession=function(e){return(0,s.default)(this,f,e),this.user=(new u.default).fromUser(e),this},e}();t.default=c},function(e,t,n){"use strict";function o(){if("function"==typeof o.driver){return new(0,o.driver)}if("string"==typeof o.driver){var e=void 0;switch(o.driver){case"Blob":e=n(57).default;break;case"Buffer":e=n(58).default;break;case"String":e=n(59).default;break;default:throw new Error('Unknown Bluffer driver "'+o.driver+'".')}if(e)return new e;throw new Error('Bluffer driver "'+o.driver+'" not found.')}throw new Error('Bluffer.driver must be either "Blob", "Bluffer", or "String" or a custom constructor.')}t.__esModule=!0;var r=n(12)("bluffer");o.driver="String","undefined"!=typeof Blob?o.driver="Blob":(r("The current JavaScript environment does not support native Bluffer, falling back to using StringBluffer."),o.driver="String"),t.default=o},function(e,t,n){"use strict";t.__esModule=!0;var o={ERROR_CRITICAL:3,OK:200,ERROR_INVALID:201,ERROR_NO_ACCESS:100,ERROR_NO_ACCESS_WRITE:101,ERROR_RESTRICTED:102,ERROR_SQL_ERROR:105,ERROR_OUT_SYNC:106,ERROR_STORAGE_ERROR:110,ERROR_QUEUE_ERROR:111,ERROR_SQL_DEADLOCK_ERROR:121,ERROR_BAD_REQUEST:400,ERROR_UNAUTHORISED:401,ERROR_MEDIA_PERMISSION_NO_ACCESS:402,ERROR_NOT_FOUND:1e3,ERROR_CREATE:1001,ERROR_UPDATE:1002,ERROR_DELETE:1003,ERROR_EXISTS:1004,ERROR_USER_INVALID_LOGIN:1010,ERROR_USER_INVALID_PASSWORD:1011,ERROR_USER_IS_REGISTERED:1012,ERROR_USER_INVALID_EMAIL:1013,ERROR_USER_INVALID_LOGIN_COUNT:1014,ERROR_USER_DISABLED:1015,ERROR_BAD_REQUEST_DATE:201,ERROR_THROTTLED:429,ERROR_REUSED_CREATION_TOKEN:2011,ERROR_UPGRADE_REQUIRED:3e3,ERROR_VISIBLE_WORKFLOW_USERS_EXIST:3001,ERROR_GROUP_EXISTS:3002,ERROR_GROUP_PROOFS_EXIST:3003};t.default=o},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=n(1),s=o(i),a=n(4),u=o(a),f={id:"GroupId",name:"Name",proofs:(0,i.each)("ProofInfo",function(e){return(new u.default).fromProof(e)})},c=function(){function e(){r(this,e)}return e.prototype.fromProofGroup=function(e){return(0,s.default)(this,f,e),this},e}();t.default=c},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=n(1),i=function(e){return e&&e.__esModule?e:{default:e}}(r),s={id:"FileId",name:"Name",blocks:"Chunks",downloadable:"Downloadable",assignedTo:"AssignedTo",assignedType:"AssignedType",status:"Status",message:"Message"},a={id:"Attachment",name:"AttachmentName",blocks:"AttachmentChunks",assignedTo:"CommentId",assignedType:function(){return"attachment"},status:"AttachmentStatus",message:function(){return""}},u=function(){function e(){o(this,e)}return e.prototype.fromFile=function(e){return(0,i.default)(this,s,e),this},e.prototype.fromCommentAttachment=function(e){return(0,i.default)(this,a,e),this},e}();t.default=u},function(e,t,n){"use strict";e.exports=function e(){return e}},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=n(1),s=o(i),a=n(14),u=o(a),f=n(26),c=o(f),l={id:"StepId",name:"Title",position:(0,i.number)("Position"),state:function(e){return e.Complete?c.default.COMPLETE:e.Visible?c.default.VISIBLE:c.default.NOT_VISIBLE},users:(0,i.each)("Users",function(e,t){var n=(new u.default).fromWorkflowUser(e);return n._calculateState(e,t),n})},p=function(){function e(){r(this,e)}return e.prototype.fromWorkflowStep=function(e){return(0,s.default)(this,l,e),this},e}();t.default=p},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=n(1),u=o(a),f=n(3),c=o(f),l=n(25),p=o(l),d={id:"UserId",name:"Name",email:"Email",role:"Role",permissions:function(e){return{inviter:e.IsInviter}}},h=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return s(t,e),t.prototype._calculateState=function(e,t){e.SkippedInStep?this.state=p.default.SKIPPED:e.CompleteInStep?this.state=p.default.FINISHED:e.ViewedInStep?this.state=p.default.SEEN:t.Visible?this.state=p.default.VISIBLE:this.state=p.default.NOT_VISIBLE},t.prototype.fromWorkflowUser=function(e){return this._calculateState({},{}),(0,u.default)(this,d,e),this},t}(c.default);t.default=h},function(e,t,n){"use strict";t.__esModule=!0;var o={COMMENT:"comment",TODO:"todo",DONE:"done"};t.default=o},function(e,t,n){"use strict";t.__esModule=!0;var o=Object.prototype.toString;t.default=function(e){return"[object Object]"===o.call(e)}},function(e,t,n){"use strict";t.__esModule=!0;var o=void 0;o="97.0.1537399623795",t.default=o},function(e,t,n){"use strict";t.__esModule=!0;var o={UPLOADING:"uploading",FILE_ERROR:"file-error",PROCESSING:"processing",ARCHIVED:"archived",PROOFERS_NEEDED:"proofers-needed",TODOS_REQUESTED:"todos-requested",AWAITING_NEW_VERSION:"awaiting-new-version",APPROVED:"approved",NOT_STARTED:"not-started",OVERDUE:"overdue",ACTIVE:"active"};t.default=o},function(e,t,n){"use strict";t.__esModule=!0;var o={NEW:0,PROOFING:10,FINAL_APPROVING:30,TODOS_REQUESTED:50,AWAITING_NEW_VERSION:60,APPROVED:70,ARCHIVED:100};t.default=o},function(e,t,n){"use strict";var o={Proof:"P",Workflow:"W",File:"F",User:"U",Brief:"B"},r={};Object.keys(o).forEach(function(e){r["is"+e+"Id"]=function(t){return t&&16===t.length&&t[0]===o[e]}}),e.exports=r},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=n(1),i=function(e){return e&&e.__esModule?e:{default:e}}(r),s={id:"ProofId",version:"Version"},a=function(){function e(){o(this,e)}return e.prototype.fromProofVersion=function(e){return(0,i.default)(this,s,e),this},e}();t.default=a},function(e,t,n){"use strict";function o(e,t){return r(function(t){return t[e]},t)}function r(e,t){var n=t?1:-1,o=t?-1:1;return function(t,r){var i=e(t),s=e(r);return i<s?n:i>s?o:0}}function i(e,t){var n={};t.forEach(function(e,t){n[e]=t});var o="function"==typeof e?e:function(t){return t[e]};return function(e,t){var r=n[o(e)],i=n[o(t)];return r<i?-1:r>i?1:0}}function s(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var o=t.length;return function(e,n){for(var r=0;r<o;r++){var i=t[r](e,n);if(i)return i}return 0}}t.__esModule=!0,t.sortObjectsByKey=o,t.sortObjectsBy=r,t.sortObjectsByValues=i,t.combineSort=s},function(e,t,n){"use strict";t.__esModule=!0;var o={NONE:"none",GOOGLE_DRIVE:"drive",DROPBOX:"dropbox",ONEDRIVE:"onedrive",BOX:"box"};t.default=o},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=n(1),s=o(i),a=n(13),u=o(a),f={id:"WorkflowId",name:"Title",steps:(0,i.each)("WorkflowSteps",function(e){return(new u.default).fromWorkflowStep(e)})},c=function(){function e(){r(this,e)}return e.prototype.getStepByPosition=function(e){for(var t=this.steps.length,n=0;n<t;n+=1){var o=this.steps[n];if(o.position===e)return o}return null},e.prototype.getOrderedSteps=function(){return this.steps.sort(function(e,t){return e.position<t.position?-1:e.position>t.position?1:0})},e.prototype.getApproverStep=function(){return this.getStepByPosition(1e3)},e.prototype.fromWorkflow=function(e){return(0,s.default)(this,f,e),this},e}();t.default=c},function(e,t,n){"use strict";t.__esModule=!0;var o={NONE:null,NOT_VISIBLE:"not-visible",VISIBLE:"visible",SEEN:"seen",SKIPPED:"skipped",FINISHED:"finished"};t.default=o},function(e,t,n){"use strict";t.__esModule=!0;var o={NONE:null,NOT_VISIBLE:"not-visible",VISIBLE:"visible",COMPLETE:"complete"};t.default=o},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=n(1),s=o(i),a=n(3),u=o(a),f=n(28),c=o(f),l=n(11),p=o(l),d=n(15),h=o(d),y=n(29),m={__prepare:function(e){e._XY=c.default.parseValue(e.XY)},id:"CommentId",proofId:"ProofId",pin:function(e){return(new c.default).fromPin(e._XY)},user:function(e){return(new u.default).fromUser(e)},comment$:"EncryptedComment",envelope:"Envelope",attachments:function(e){return e.Attachment?[(new p.default).fromCommentAttachment(e)]:[]},agreeCount:function(e){return e.Agrees.length},pageNumber:(0,i.number)("Page"),mediaTime:function(e){return null==e._XY.time?void 0:e._XY.time},mediaDuration:function(e){return null==e._XY.duration?void 0:e._XY.duration},createdDate:(0,i.date)("Timestamp"),updatedDate:(0,i.date)("Updated"),parentCommentId:(0,i.optional)("Parent"),metadata:(0,i.json)("Metadata",{}),state:function(e){return+e.Done?h.default.DONE:+e.Change?h.default.TODO:h.default.COMMENT}},w=function(){function e(){r(this,e)}return e.prototype.fromComment=function(e){return(0,s.default)(this,m,e),this},e.prototype.fromRawComment=function(e){var t=(0,y.parseComment)(e);return this.raw=t.raw,this.text=t.text,this.html=t.html,this.tokens=t.tokens,this},e}();t.default=w},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},i=n(1),s=function(e){return e&&e.__esModule?e:{default:e}}(i),a={x:"x",y:"y",x2:(0,i.optional)("x2"),y2:(0,i.optional)("y2")},u=function(){function e(){o(this,e)}return e.prototype.fromPin=function(e){return(0,s.default)(this,a,e),this},e.parseValue=function(e){var t={x:null,y:null,x2:null,y2:null,time:null,duration:null};if("{"===e[0]){var n=JSON.parse(e);t=r({},t,n)}else if(-1!==e.indexOf(",")){var o=e.split(","),i=o[0],s=o[1];t.x=parseFloat(i),t.y=parseFloat(s)}return t},e}();t.default=u},function(e,t,n){"use strict";function o(e){return(0,c.default)(e)}function r(e){return e.replace(l.MENTION_REGEX,function(e,t,n){return n})}function i(e){var t=0;return e.replace(l.MENTION_REGEX,function(e,n,o,r){return'<span data-mention data-mention-index="'+t+++'" data-mention-user-id="'+n+'" data-mention-user-label="'+o.replace(/"/,'\\"')+'" data-mention-start-index="'+r+'" data-mention-end-index="'+(r+e.length)+'" data-mention-length="'+e.length+'">'+o+"</span>"})}function s(e){var t=[];return e.replace(l.MENTION_REGEX,function(e,n,o,r){t.push({id:n,label:o,index:r,length:e.length})}),t}function a(e){var t=s(e),n=[],o=0;t.forEach(function(t){var r=e.slice(o,t.index);o=t.index+t.length,r&&n.push({type:"text",value:r}),n.push({type:"mention",value:t})});var r=e.slice(o);return r&&n.push({type:"text",value:r}),n}function u(e){var t=o(e);return{raw:e,text:r(t),html:i(t),mentions:s(e),tokens:a(e)}}t.__esModule=!0,t.getCommentTokens=t.getCommentText=t.getCommentMentions=t.getCommentHTML=t.getCommentEscaped=t.parseComment=void 0;var f=n(70),c=function(e){return e&&e.__esModule?e:{default:e}}(f),l=n(2);t.parseComment=u,t.getCommentEscaped=o,t.getCommentHTML=i,t.getCommentMentions=s,t.getCommentText=r,t.getCommentTokens=a},function(e,t,n){"use strict";function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.version=t.Model=t.Enum=t.Bluffer=t.Client=void 0;var i=n(31),s=r(i),a=n(7),u=r(a),f=n(77),c=o(f),l=n(81),p=o(l),d=n(17),h=r(d);t.default=s.default,t.Client=s.default,t.Bluffer=u.default,t.Enum=c,t.Model=p,t.version=h.default},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=n(32),s=o(i),a=n(37),u=o(a),f=n(38),c=o(f),l=n(40),p=o(l),d=n(42),h=o(d),y=n(44),m=o(y),w=n(46),v=o(w),_=n(47),b=o(_),E=n(54),g=o(E),O=n(55),P=o(O),T=n(62),I=o(T),R=n(65),S=o(R),k=n(67),M=o(k),A=n(69),C=o(A),j=n(73),D=o(j),q=n(74),N=o(q),x=n(6),U=o(x),B=n(75),G=o(B),L=n(8),K=o(L),W=n(76),F=o(W),V=n(12)("PageProof"),H=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r(this,e),this.options=t,this.events=new G.default,this.adapters=new s.default(this.options.adapters),this.cache=new u.default(this),this.accounts=new h.default(this),this.comments=new C.default(this),this.dashboard=new m.default(this),this.files=new P.default(this),this.profile=new D.default(this),this.proofs=new b.default(this),this.briefs=new g.default(this),this.users=new v.default(this),this.workflows=new S.default(this),this.preferences=new M.default(this),this.sessions=new N.default(this),this._registerCoreHooks(),this._enhance()}return e.prototype._registerCoreHooks=function(){this.on("error.throttled",function(e){var t=e.data.response.data.timeout;return V("Sleeping "+t+"ms until rate limit resets"),(0,F.default)(t)})},e.prototype._enhance=function(){var e=this;this.adapters.getEnhancementAdapters().forEach(function(t){return t.onClientReady(e)})},e.prototype.setSession=function(e){return!e||e instanceof U.default?this.session=e||null:this.session=(new U.default).fromJSON(e),this.session},e.prototype.request=function(e,t,n){var o=this,r=new c.default(e,t),i=this.adapters.getRequestAdapter(),s=Promise.resolve();if(!r.endpoint.anonymous){if(!this.session)return Promise.reject(new Error("Cannot make call to endpoint ("+e+") when unauthorized."));s=this.adapters.getCryptoAdapter().generateAuthorizationHeaders(r.getMethod(),r.getPath(),this.session).then(function(e){return r.addHeaders(e)})}var a={request:r};return s.then(function(){var e=r.build();return o.events.emit("experimental.request.before",a,!0).then(function(){return e})}).then(function(e){return i.send(e,n)}).then(p.default.parse).then(function(r){if(a.response=r,o.events.emit("experimental.request.after",a),r.code===K.default.ERROR_THROTTLED){var i=o.events.emit("error.throttled",a);if(i.some(Boolean))return Promise.all(i).then(function(){return o.events.emit("experimental.request.retry",a),o.request(e,t,n)})}if(r.code===K.default.ERROR_UNAUTHORISED){var s=o.session?o.session.token:null;return o.events.emit("error.unauthorized",a,!0).then(function(){return o.session&&o.session.token!==s?o.request(e,t,n):r})}if(r.deprecated){var u="The "+e+" API has been deprecated. "+(r.deprecated||"");o.events.emit("error.deprecated",{name:e,message:u})}return r}).then(function(t){try{if(t.error){o.events.emit("error.response",a);var n=new Error(e+" request resulted in an "+t.code+" error.");return n.response=t,n.request=r,Promise.reject(n)}return o.events.emit("experimental.request.resolve",a),Promise.resolve(t)}finally{o.events.emit("experimental.request.finally",a)}})},e.prototype.admin=function(){return this.session?this.session.user.isAdmin?(this._admin||(this._admin=Promise.resolve(new I.default(this))),this._admin):Promise.reject(new Error("The current user must be an administrator of a team or enterprise account.")):Promise.reject(new Error("You must be logged in to use the Admin API."))},e.prototype.crypto=function(){return this.adapters.getCryptoAdapter()},e.prototype.on=function(e,t){return this.events.on(e,t)},e}();t.default=H},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=n(33),s=o(i),a=n(34),u=o(a),f=n(35),c=o(f),l=n(36),p=o(l),d=function(){function e(t){r(this,e),this.adapters=[].concat(t)}return e.prototype.getAdapterInstanceOf=function(e){return this.getAnyAdaptersInstanceOf(e)[0]||null},e.prototype.getAnyAdaptersInstanceOf=function(e){for(var t=[],n=e.__adapter__,o=0;o<this.adapters.length;o+=1){var r=this.adapters[o];Object.getPrototypeOf(Object.getPrototypeOf(r)).constructor.__adapter__===n&&t.push(r)}return t},e.prototype.getCryptoAdapter=function(){var e=this.getAdapterInstanceOf(s.default);if(!e)throw new Error("ICryptoAdapter not found. This adapter is required for the SDK to function correctly.");return e},e.prototype.getRequestAdapter=function(){var e=this.getAdapterInstanceOf(u.default);if(!e)throw new Error("IRequestAdapter not found. This adapter is required for the SDK to function correctly.");return e},e.prototype.getCacheAdapter=function(){return this.getAdapterInstanceOf(c.default)},e.prototype.getEnhancementAdapters=function(){return this.getAnyAdaptersInstanceOf(p.default)},e}();t.default=d},function(e,t,n){"use strict";function o(){}t.__esModule=!0,o.__adapter__="ICryptoAdapter",t.default=o},function(e,t,n){"use strict";function o(){}t.__esModule=!0,o.__adapter__="IRequestAdapter",t.default=o},function(e,t,n){"use strict";function o(){}t.__esModule=!0,o.__adapter__="ICacheAdapter",t.default=o},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n){var o=e[t];e[t]=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];var i=o.bind.apply(o,[this].concat(t));return n(i,this,t).apply(this,t)}}function i(e){function t(r){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],s=Object.getOwnPropertyNames(r).filter(function(t){return r[t].client===e}),a=Object.getPrototypeOf(r),u=Object.keys(a).filter(function(e){return"function"==typeof a[e]&&0!==e.indexOf("_")});(i.length||n)&&u.forEach(function(e){o.push({namespace:i.join("."),name:e,api:r})}),s.forEach(function(e){t(r[e],i.concat(e))})}var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=[];return t(e),o}t.__esModule=!0;var s,a,u=(a=s=function(){function e(){o(this,e)}return e.prototype.onClientReady=function(e){var t=this;i(e).forEach(function(e){r(e.api,e.name,function(n){var o={api:e.api,namespace:e.namespace,name:e.name,displayName:e.namespace+"."+e.name};return t.onMethodBefore(o),function(){var e=void 0;try{e=n()}catch(e){throw o.error=e,t.onMethodThrown(o),e}finally{o.value=e,t.onMethodAfter(o),e&&"function"==typeof e.then&&e.then(function(e){o.resolved=e,t.onMethodResolve(o)},function(e){o.rejected=e,t.onMethodReject(o)}).then(function(){t.onMethodFinally(o)})}return e}})}),e.on("experimental.request.before",function(e){return t.onRequestBefore(e.data)}),e.on("experimental.request.after",function(e){return t.onRequestAfter(e.data)}),e.on("error.response",function(e){return t.onRequestReject(e.data)}),e.on("error.throttled",function(e){return t.onRequestThrottled(e.data)}),e.on("experimental.request.retry",function(e){return t.onRequestRetry(e.data)}),e.on("error.unauthorized",function(e){return t.onRequestUnauthorized(e.data)}),e.on("error.deprecated",function(e){return t.onRequestDeprecated(e.data)}),e.on("experimental.request.resolve",function(e){return t.onRequestResolve(e.data)}),e.on("experimental.request.finally",function(e){return t.onRequestFinally(e.data)})},e.prototype.onMethodBefore=function(){},e.prototype.onMethodAfter=function(){},e.prototype.onMethodReject=function(){},e.prototype.onMethodResolve=function(){},e.prototype.onMethodFinally=function(){},e.prototype.onMethodThrown=function(){},e.prototype.onRequestBefore=function(){},e.prototype.onRequestAfter=function(){},e.prototype.onRequestReject=function(){},e.prototype.onRequestThrottled=function(){},e.prototype.onRequestRetry=function(){},e.prototype.onRequestUnauthorized=function(){},e.prototype.onRequestDeprecated=function(){},e.prototype.onRequestResolve=function(){},e.prototype.onRequestFinally=function(){},e}(),s.__adapter__="IEnhancementAdapter",a);t.default=u},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=function(){function e(t){o(this,e),this.client=t}return e.prototype.auto=function(e,t){var n=this.client.adapters.getCacheAdapter(),o=function(){};return n?(o=function(t){void 0!==t&&n.set(e,t)},n.get(e).catch(function(){return Promise.resolve(t(o)).then(function(e){return o(e),e})})):Promise.resolve(t(o))},e}();t.default=r},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},s=n(39),a=o(s),u=n(16),f=o(u),c=n(17),l=o(c),p=n(2),d=function(){function e(t,n){if(r(this,e),this.name=t,this.endpoint=a.default[t],!this.endpoint)throw new Error('Unknown request endpoint "'+t+'".');this.params={},this.addParams(n),this.headers={}}return e.prototype.addHeaders=function(e){return this.headers=i({},this.headers,e),this},e.prototype.addHeader=function(e,t){return this.headers[e]=t,this},e.prototype.addParams=function(e){return this.params=i({},this.params,e),this},e.prototype.addParam=function(e,t){this.params[e]=t},e.prototype.getPath=function(){var e=this,t=this.endpoint,n=t.path,o=t.chain,r=t.trailing,i=n;return o&&o.forEach(function(t){"/"!==i[i.length-1]&&(i+="/"),i+=e.params[t]}),r&&"/"!==i[i.length-1]&&(i+="/"),i},e.prototype.getQuery=function(){var e=this,t=this.endpoint.query;if(t){var n=t.map(function(t){return void 0!==e.params[t]?t+"="+encodeURIComponent(e.params[t]):null}).filter(Boolean).join("&");if(n)return"?"+n}return""},e.prototype.getHeaders=function(){var e,t=i({},this.headers,(e={},e[p.SDK_VERSION_HEADER]=l.default,e));if("POST"===this.endpoint.method)switch(this.endpoint.version){case 2:t["Content-Type"]="application/json";break;case 1:default:t["Content-Type"]="application/x-www-form-urlencoded"}return t},e.prototype.getBody=function(){var e=this,t=this.endpoint;if(t.body){if("string"==typeof t.body){var n=this.params[t.body];return n=(0,f.default)(n)?JSON.stringify(n):String(n)}var o=!0===t.body?Object.keys(this.params):t.body,r={};switch(o.forEach(function(t){var n=e.params[t];void 0!==n&&(r[t]=n)}),t.version){case 2:return JSON.stringify(r);case 1:default:return Object.keys(r).map(function(t){return t+"="+encodeURIComponent(e.params[t])}).join("&")}}return null},e.prototype.getMethod=function(){return(this.endpoint.method||"GET").toUpperCase()},e.prototype.isWithCredentials=function(){return!0===this.endpoint.credentials},e.prototype.build=function(){return{method:this.getMethod(),path:this.getPath(),query:this.getQuery(),body:this.getBody(),headers:this.getHeaders(),credentials:this.isWithCredentials()}},e}();t.default=d},function(e,t){e.exports={"accounts.register":{method:"POST",path:"/api/users/register",body:["email","password","privateKey","publicKey"],anonymous:!0},"accounts.login":{method:"POST",path:"/api/users/login",body:["email","password"],anonymous:!0},"accounts.generate-activation-code":{method:"GET",path:"/api/users/auth/generate",chain:["userId"],trailing:!0},"accounts.activate":{method:"POST",path:"/api/users/auth/activate",body:["userId","authCode"],trailing:!0},"accounts.logout":{method:"GET",path:"/api/users/logout"},"profile.upload-avatar":{method:"POST",path:"/api/media/file/avatar",body:["uploadedImage"]},"profile.change-password":{method:"POST",path:"/api/users/changepassword",body:["oldPassword","newPassword","newPrivateKey"],trailing:!0},"preferences.all":{method:"GET",path:"/api/users/preferences/all"},"preferences.get":{method:"GET",path:"/api/users/preferences/get",query:["preferences"]},"preferences.update":{method:"POST",path:"/api/users/preferences/update",body:!0},"preferences.reset":{method:"POST",path:"api/users/preferences/update",body:["preferences"]},"dashboard.inbox":{method:"GET",path:"/api/proofs/dashboard/proofin",trailing:!0},"dashboard.sent":{method:"GET",path:"/api/proofs/dashboard/proofout",trailing:!0},"dashboard.outbox":{method:"GET",path:"/api/proofs/dashboard/proofoutbox",trailing:!0},"dashboard.search":{method:"POST",path:"/api/proofs/search",body:["query","all","filterBy"]},"dashboard.groups.filter-by":{method:"GET",path:"/api/proofs/dashboard/groups",chain:["filterBy"],trailing:!0},"users.by-id":{method:"GET",path:"/api/users",chain:["userId"]},"users.by-email":{method:"POST",path:"/api/users/email",body:["email"],trailing:!0},"users.invite":{method:"POST",path:"/api/users/create",body:["email"]},"proofs.create":{method:"POST",path:"/api/proofs/create",body:["title","dueDate","description","groupId"]},"proofs.normalize-workflow":{method:"POST",path:"/api/proofs/permission/check",body:["proofId","workflowId"]},"proofs.set-workflow":{method:"POST",path:"/api/proofs/update",body:["proofId","workflowId"]},"proofs.set-tags":{method:"POST",path:"/api/tags/create",body:["relatedId","tag"]},"proofs.set-file":{method:"POST",path:"/api/proofs/update",body:["proofId","fileId"]},"proofs.distribute-file":{method:"GET",path:"/api/proofs/distribute",chain:["proofId"],trailing:!0},"proofs.archive":{version:2,method:"POST",path:"/api/proofs/close",body:["proofIds"]},"proofs.unarchive":{method:"GET",path:"/api/proofs/reopen",chain:["proofId"],trailing:!0},"proofs.delete":{method:"GET",path:"/api/proofs/delete",chain:["proofId"],trailing:!0},"proofs.start":{method:"POST",path:"/api/proofs/startworkflow",body:["proofId"],trailing:!0},"proofs.editors.add":{version:2,method:"POST",path:"/api/proofs/editor/add",body:["proofId","editors","editorMessage"]},"proofs.editors.remove":{version:2,method:"POST",path:"/api/proofs/editor/remove",body:["proofId","editors"]},"proofs.editors.replace":{version:2,method:"POST",path:"/api/proofs/editor/replace",body:["proofId","oldEditors","newEditors"]},"proofs.editors.set":{version:2,method:"POST",path:"/api/proofs/editor/set",body:["proofId","editors"]},"briefs.start":{method:"POST",path:"/api/briefs/start",body:["briefId"]},"proofs.return":{method:"GET",path:"/api/proofs/returnproof",chain:["proofId"]},"proofs.groups.create":{method:"POST",path:"/api/proofs/groups/create",body:["name"]},"proofs.groups.update":{method:"POST",path:"/api/proofs/groups/update",body:["groupId","name"]},"proofs.groups.load":{method:"GET",path:"/api/proofs/group",chain:["groupId"]},"proofs.groups.ready":{method:"POST",path:"/api/proofs/groups/ready",body:["groupId"]},"proofs.groups.owners.add":{version:2,method:"POST",path:"/api/v2/proofs/owners/groups/add",body:["groupId","owners"]},"proofs.groups.workflows.add-reviewers":{version:2,method:"POST",path:"/api/v2/workflows/groups/reviewers/add",body:["groupId","reviewers"]},"proofs.versions.attach":{method:"POST",path:"/api/proofs/versions/create",body:["proofId","versionId"]},"proofs.versions.list":{method:"GET",path:"/api/proofs/versions",chain:["proofId"],trailing:!0},"proofs.load":{method:"GET",path:"/api/proofs/",chain:["proofId"],trailing:!0},"proofs.request-access":{method:"GET",path:"/api/proofs/requestaccess",chain:["proofId"]},"proofs.lock":{method:"GET",path:"/api/proofs/lock/",chain:["proofId"],trailing:!0},"proofs.unlock":{method:"GET",path:"/api/proofs/unlock/",chain:["proofId"],trailing:!0},"proofs.request-unlock":{method:"GET",path:"/api/proofs/unlockemail/",chain:["proofId"],trailing:!0},"files.generate-token":{method:"GET",path:"/api/media/getfiletoken",query:["relatedId","fileType"]},"files.upload-block":{method:"POST",path:"/api/media/file",query:["block","part","token"],body:"data"},"files.upload-complete":{method:"POST",path:"/api/media/file",query:["block","blockCount","part","token","extn","pages","filename","storeoriginal"],body:"envelope"},"files.details":{method:"GET",path:"/api/media/file/details",chain:["fileId"]},"files.download-block":{method:"GET",path:"/api/media/getfilechunk",chain:["proofId","fileId","block"]},"files.thumbnail":{method:"GET",path:"/api/media/getimage/thumb",chain:["fileId"]},"files.import.generic":{method:"POST",path:"/api/media/filedrive",body:["extn","filename","url","envelope","storeOriginal"]},"files.import.drive":{method:"POST",path:"/api/media/filedrive",body:["extn","filename","url","envelope","storeOriginal","accessToken"]},"files.import.onedrive":{method:"POST",path:"/api/media/fileonedrive",body:["extn","filename","url","envelope","storeOriginal","accessToken"]},"files.import.box":{method:"POST",path:"/api/media/filebox",body:["extn","filename","url","envelope","storeOriginal","accessToken"]},"files.import.dropbox":{method:"POST",path:"/api/media/filedropbox",body:["extn","filename","url","envelope","storeOriginal","accessToken"]},"workflows.create":{version:2,method:"POST",path:"/api/v2/workflows/create",body:["title"]},"workflows.load":{version:2,method:"GET",path:"/api/v2/workflows/detail",chain:["workflowId"]},"workflows.steps.add":{version:2,method:"POST",path:"/api/v2/workflows/steps/add",body:["workflowId","title","position"]},"workflows.steps.move-before":{method:"POST",path:"/api/workflows/step/movebefore",body:["stepId","beforeStepId"]},"workflows.steps.move-after":{method:"POST",path:"/api/workflows/step/moveafter",body:["stepId","afterStepId"]},"workflows.steps.swap":{method:"POST",path:"/api/workflows/step/swap",body:["stepId","swapStepId"]},"workflows.users.set":{version:2,method:"POST",path:"/api/v2/workflows/users/set",body:["workflowId","stepId","position","users"]},"workflows.users.update":{version:2,method:"POST",path:"/api/v2/workflows/users/update",body:["workflowId","stepId","userId","role","permissions"]},"workflows.users.add":{version:2,method:"POST",path:"/api/v2/workflows/users/add",body:["workflowId","stepId","users"]},"workflows.delete":{method:"POST",path:"/api/workflows/delete",body:["workflowId"]},"workflows.duplicate":{method:"POST",path:"/api/workflows/duplicateonly",body:["workflowId"]},"workflows.owned":{method:"GET",path:"/api/workflows",trailing:!0},"workflows.shared":{method:"GET",path:"/api/workflows/share/user",trailing:!0},"comments.load-all":{method:"POST",path:"/api/proofs/recent",body:["proofId","timestamp"]},"comments.load-page":{method:"POST",path:"/api/proofs/comment/recent",body:["proofId","timestamp","page"]},"comments.state.update":{method:"POST",path:"/api/proofs/comment/updatestatus",body:["commentId","change","done"]},"comments.create":{method:"POST",path:"/api/proofs/comment/create",body:["proofId","page","envelope","encryptedComment","xy","parent","mentions","metadata","creationToken","change","done"]},"proofs-owners.add":{version:2,method:"POST",path:"/api/v2/proofs/owners/add",body:["proofId","users"]},"proofs-owners.remove":{version:2,method:"POST",path:"/api/v2/proofs/owners/remove",body:["proofId","users"]},"proofs.tag-delete":{method:"POST",path:"/api/tags/delete",body:["relatedId","tag"]},"proofs.remove-editor":{method:"GET",path:"/api/proofs/deleteeditor",chain:["proofId"],trailing:!0},"briefs.create":{method:"POST",path:"/api/briefs/create",body:["title","messageToRecipient","dueDate","tag"]},"briefs.update":{method:"POST",path:"/api/briefs/update",body:["briefId","title","messageToRecipient","dueDate","tag","recipient","editorId","editorMessage"]},"admin.team.users.enabled":{method:"GET",path:"/api/admin/getusers/active",trailing:!0},"admin.team.users.disabled":{method:"GET",path:"/api/admin/getusers/inactive",trailing:!0},"admin.team.users.set-enabled":{method:"POST",path:"/api/admin/setenabled",body:["email","enabled"]},"sessions.check":{method:"GET",path:"/api/sessions/check"},"sso.get-public-key":{method:"GET",path:"/sso/public_key",anonymous:!0},"sso.get-session":{version:2,method:"POST",path:"/sso/session",body:["nonce"],anonymous:!0,credentials:!0},"sso.get-login-options":{version:2,method:"POST",path:"/sso/login_options",body:["email"],anonymous:!0}}},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=n(8),s=o(i),a=n(41),u=n(2),f=n(9),c=o(f),l=function(){function e(){r(this,e),this.error=!1,this.code=-1,this.data=null,this.message=null,this.deprecated=null}return e.parse=function(t){var n=t.status,o=t.headers,r=void 0===o?{}:o,i=t.body,f=new e;if(n===a.TOO_MANY_REQUESTS_STATUS)return f.error=!0,f.message="PageProof Error #h"+a.TOO_MANY_REQUESTS_STATUS,f.code=s.default.ERROR_THROTTLED,f.data={timeout:1e3*(parseFloat(r[u.RETRY_AFTER_HEADER])||60)},f;if((0,c.default)(r,"deprecated")&&(f.deprecated=r.deprecated),n===a.OK_STATUS&&!i)return f.code=s.default.OK,f;try{var l=JSON.parse(i);"string"==typeof l||(l&&"ResponseCode"in l?(f.code=l.ResponseCode,f.code!==s.default.OK&&(f.error=!0)):l.Message&&1===Object.keys(l).length&&(f.error=!0,f.code=s.default.ERROR_CRITICAL)),f.error&&(f.message="PageProof Error #s"+f.code),f.data=l}catch(e){f.error=!0}return f},e}();t.default=l},function(e,t,n){"use strict";t.__esModule=!0;t.TOO_MANY_REQUESTS_STATUS=429,t.OK_STATUS=200},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=n(0),u=o(a),f=n(6),c=o(f),l=n(43),p=o(l),d=function(e){function t(n){r(this,t);var o=i(this,e.call(this,n));return o.sso=new p.default(n),o}return s(t,e),t.prototype.register=function(e,t){var n=this;return this.client.crypto().generatePasswordHash(t).then(function(e){return Promise.all([e,n.client.crypto().generateKeyPair()])}).then(function(e){var o=e[0],r=e[1];return Promise.all([o,r,n.client.crypto().encryptPrivateKey(r.privateKeyPEM,t)])}).then(function(t){var o=t[0],r=t[1],i=t[2];return Promise.all([r,n.client.request("accounts.register",{email:e,password:o,privateKey:i,publicKey:r.publicKeyPEM})])}).then(function(o){var r=o[0];return Promise.all([r,n.login(e,t,!1)])}).then(function(e){var t=e[0],o=e[1];return Promise.all([t,o,n.generateActivationCode()])}).then(function(e){var t=e[0],n=e[1];return n.privateKeyPEM=t.privateKeyPEM,n})},t.prototype.generateActivationCode=function(){return this.client.request("accounts.generate-activation-code",{userId:this.client.session.userId})},t.prototype.activate=function(e){var t=this;return this.client.request("accounts.activate",{userId:this.client.session.userId,authCode:e}).then(function(){t.client.session.user.hasActivated=!0})},t.prototype.login=function(e,t){var n=this,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return this.client.crypto().generatePasswordHash(t).then(function(t){return n.client.request("accounts.login",{email:e,password:t})}).then(function(t){var n=(new c.default).fromSession(t.data);return n.user.email=e,n}).then(function(e){return o?n.client.crypto().decryptPrivateKey(e.privateKeyPEM$,t).then(function(t){return e.privateKeyPEM=t,e}):e}).then(function(e){return n.client.setSession(e),e})},t.prototype.logout=function(){var e=this;return this.client.request("accounts.logout").catch(function(t){return e.client.setSession(null),Promise.reject(t)}).then(function(){e.client.setSession(null)})},t}(u.default);t.default=d},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=n(0),u=o(a),f=n(6),c=o(f),l=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return s(t,e),t.prototype.getSession=function(){var e=this;return this.client.request("sso.get-public-key").then(function(e){return e.data.ServerPublicKey}).then(function(t){return e.client.crypto().generateWrappedSymmetricKey(t)}).then(function(t){var n=t.key,o=t.key$;return Promise.all([n,e.client.request("sso.get-session",{nonce:o})])}).then(function(t){var n=t[0],o=t[1],r=(new c.default).fromSession(o.data);return Promise.all([r,e.client.crypto().decryptManagedPrivateKey(r.privateKeyPEM$,n)])}).then(function(e){var t=e[0],n=e[1];return t.privateKeyPEM=n,t})},t.prototype.getLoginOptions=function(e){return this.client.request("sso.get-login-options",{email:e}).then(function(e){return e.data})},t}(u.default);t.default=l},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e){var t={};return Object.keys(y).forEach(function(n){t[n]=e[y[n]]}),t}function u(e){return(e||[]).map(function(e){return(new p.default).fromProof(e)})}t.__esModule=!0;var f=n(0),c=o(f),l=n(4),p=o(l),d=n(45),h=o(d),y={inbox:"ProofIn",sent:"ProofOut",outbox:"ProofOutBox"},m=function(e){function t(n){r(this,t);var o=i(this,e.call(this,n));return o.groups=new h.default(n),o}return s(t,e),t.prototype.inbox=function(){return this._loadSingleTabProofs("inbox")},t.prototype.sent=function(){return this._loadSingleTabProofs("sent")},t.prototype.outbox=function(){return this._loadSingleTabProofs("outbox")},t.prototype._loadSingleTabProofs=function(e){return this.client.request("dashboard."+e).then(function(e){return a(e.data)}).then(function(t){return t[e]}).then(u)},t.prototype.search=function(e){return this._loadSearchProofs({query:e})},t.prototype.everything=function(){return this._loadSearchProofs({all:1})},t.prototype.approved=function(){return this._loadSearchProofs({filterBy:70})},t.prototype.archived=function(){return this._loadSearchProofs({filterBy:100})},t.prototype._loadSearchProofs=function(e){return this.client.request("dashboard.search",e).then(function(e){return u(e.data.Proofs)})},t}(c.default);t.default=m},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e){return(e||[]).map(function(e){return(new l.default).fromProofGroup(e)})}t.__esModule=!0;var u=n(0),f=o(u),c=n(10),l=o(c),p=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return s(t,e),t.prototype._loadGroups=function(e){return this.client.request("dashboard.groups.filter-by",{filterBy:e}).then(function(e){return a(e.data)})},t.prototype.current=function(){return this._loadGroups("current")},t}(f.default);t.default=p},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e){return e.data.length>0?(new p.default).fromUser(e.data[0]):(new p.default).fromUser(e.data)}function u(e){return e.data.length?(new p.default).fromUser(e.data[0]):null}t.__esModule=!0;var f=n(0),c=o(f),l=n(3),p=o(l),d=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return s(t,e),t.prototype.byEmail=function(e){return this.client.request("users.by-email",{email:e}).then(u)},t.prototype.byId=function(e){return this.client.request("users.by-id",{userId:e}).then(a)},t.prototype.invite=function(e){return this.client.request("users.invite",{email:e}).then(a)},t}(c.default);t.default=d},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=n(0),u=o(a),f=n(48),c=o(f),l=n(49),p=o(l),d=n(50),h=o(d),y=n(51),m=o(y),w=n(4),v=o(w),_=n(5),b=o(_),E=n(2),g=function(e){function t(n){r(this,t);var o=i(this,e.call(this,n));return o.owners=new c.default(n),o.editors=new p.default(n),o.versions=new h.default(n),o.groups=new m.default(n),o}return s(t,e),t.prototype.setWorkflow=function(e,t){var n=this;return this.client.request("proofs.normalize-workflow",{proofId:e,workflowId:t}).then(function(){return n.client.request("proofs.set-workflow",{proofId:e,workflowId:t})})},t.prototype.setTags=function(e,t){return this.client.request("proofs.set-tags",{relatedId:e,tag:t.join(",")})},t.prototype.deleteTag=function(e,t){return this.client.request("proofs.tag-delete",{relatedId:e,tag:t})},t.prototype.setFile=function(e,t){var n=this;return this.client.request("proofs.set-file",{proofId:e,fileId:t}).then(function(){return n.client.request("proofs.distribute-file",{proofId:e})})},t.prototype.create=function(e){var t=this,n=e.name,o=e.tags,r=void 0===o?[]:o,i=e.dueDate,s=void 0===i?new Date(Date.now()+3*E.DAY_IN_MS):i,a=e.messageToReviewers,u=e.workflow,f=e.file,c=e.group,l=e.start,p=void 0===l||l,d=p&&!c;return this.client.request("proofs.create",{title:n,dueDate:s.toISOString(),description:a,groupId:c?c.id:void 0}).then(function(e){var n=(new v.default).fromProof(e.data);return Promise.all([n,r.length&&t.setTags(n.id,r),u&&t.setWorkflow(n.id,u.id),f&&t.setFile(n.id,f.id)])}).then(function(e){var n=e[0];return Promise.resolve(d&&t.start(n.id)).then(function(){return n})}).then(function(e){return u&&(e.workflowId=u.id),f&&(e.fileId=f.id,e.fileStatus=b.default.UPLOADING),e.calculateState(),e})},t.prototype.archive=function(e){return this.client.request("proofs.archive",{proofIds:e})},t.prototype.unarchive=function(e){return this.client.request("proofs.unarchive",{proofId:e})},t.prototype.delete=function(e){return this.client.request("proofs.delete",{proofId:e})},t.prototype.return=function(e){return this.client.request("proofs.return",{proofId:e})},t.prototype.start=function(e){return this.client.request("proofs.start",{proofId:e})},t.prototype.removeEditor=function(e){return this.client.request("proofs.remove-editor",{proofId:e})},t.prototype.load=function(e){return this.client.request("proofs.load",{proofId:e}).then(function(e){return(new v.default).fromProof(e.data)})},t.prototype.lock=function(e){return this.client.request("proofs.lock",{proofId:e})},t.prototype.unlock=function(e){return this.client.request("proofs.unlock",{proofId:e})},t.prototype.requestUnlock=function(e){return this.client.request("proofs.request-unlock",{proofId:e})},t.prototype.requestAccess=function(e){return this.client.request("proofs.request-access",{proofId:e})},t}(u.default);t.default=g},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=n(0),a=function(e){return e&&e.__esModule?e:{default:e}}(s),u=function(e){function t(){return o(this,t),r(this,e.apply(this,arguments))}return i(t,e),t.prototype.add=function(e,t){return this.client.request("proofs-owners.add",{proofId:e,users:[].concat(t)})},t.prototype.remove=function(e,t){return this.client.request("proofs-owners.remove",{proofId:e,users:[].concat(t)})},t}(a.default);t.default=u},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=n(0),a=function(e){return e&&e.__esModule?e:{default:e}}(s),u=function(e){function t(){return o(this,t),r(this,e.apply(this,arguments))}return i(t,e),t.prototype.add=function(e,t,n){var o={proofId:e,editors:[].concat(t),editorMessage:null===n?"":n};return this.client.request("proofs.editors.add",o)},t.prototype.remove=function(e,t){return this.client.request("proofs.editors.remove",{proofId:e,editors:[].concat(t)})},t.prototype.replace=function(e,t,n){return this.client.request("proofs.editors.replace",{proofId:e,oldEditors:[].concat(t),newEditors:[].concat(n)})},t.prototype.set=function(e,t){return this.client.request("proofs.editors.set",{proofId:e,editors:[].concat(t)})},t}(a.default);t.default=u},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=n(0),u=o(a),f=n(21),c=o(f),l=n(22),p=(0,l.sortObjectsByKey)("version"),d=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return s(t,e),t.prototype.attach=function(e,t){return this.client.request("proofs.versions.attach",{proofId:e,versionId:t})},t.prototype.list=function(e){return this.client.request("proofs.versions.list",{proofId:e}).then(function(e){return e.data.map(function(e){return(new c.default).fromProofVersion(e)}).sort(p)})},t}(u.default);t.default=d},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e){return(new l.default).fromProofGroup(e.data)}t.__esModule=!0;var u=n(0),f=o(u),c=n(10),l=o(c),p=n(52),d=o(p),h=n(53),y=o(h),m=function(e){function t(n){r(this,t);var o=i(this,e.call(this,n));return o.owners=new d.default(n),o.workflows=new y.default(n),o}return s(t,e),t.prototype.create=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.name;return this.client.request("proofs.groups.create",{name:t}).then(a)},t.prototype.load=function(e){return this.client.request("proofs.groups.load",{groupId:e}).then(a)},t.prototype.ready=function(e){return this.client.request("proofs.groups.ready",{groupId:e})},t.prototype.update=function(e,t){var n=t.name;return this.client.request("proofs.groups.update",{groupId:e,name:n}).then(a)},t}(f.default);t.default=m},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=n(0),a=function(e){return e&&e.__esModule?e:{default:e}}(s),u=function(e){function t(){return o(this,t),r(this,e.apply(this,arguments))}return i(t,e),t.prototype.add=function(e,t){return this.client.request("proofs.groups.owners.add",{groupId:e,owners:[].concat(t)})},t}(a.default);t.default=u},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=n(0),a=function(e){return e&&e.__esModule?e:{default:e}}(s),u=function(e){function t(){return o(this,t),r(this,e.apply(this,arguments))}return i(t,e),t.prototype.addReviewers=function(e,t){return this.client.request("proofs.groups.workflows.add-reviewers",{groupId:e,reviewers:[].concat(t)})},t}(a.default);t.default=u},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=n(0),u=o(a),f=n(4),c=o(f),l=n(5),p=o(l),d=n(2),h=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return s(t,e),t.prototype.setTags=function(e,t){return this.client.request("proofs.set-tags",{relatedId:e,tag:t.join(",")})},t.prototype.deleteTag=function(e,t){return this.client.request("proofs.tag-delete",{relatedId:e,tag:t})},t.prototype.setFile=function(e,t){var n=this;return this.client.request("proofs.set-file",{proofId:e,fileId:t}).then(function(){return n.client.request("proofs.distribute-file",{proofId:e})})},t.prototype.create=function(e){var t=this,n=e.name,o=e.file,r=e.tags,i=void 0===r?[]:r,s=e.dueDate,a=void 0===s?new Date(Date.now()+3*d.DAY_IN_MS):s;return this.client.request("briefs.create",{title:n,messageToRecipient:"",dueDate:a.toISOString(),tag:i.join(",")}).then(function(e){var n=(new c.default).fromProof(e.data.Brief);return Promise.all([n,o&&t.setFile(n.id,o.id)])}).then(function(e){var t=e[0];return o&&(t.fileId=o.id,t.fileStatus=p.default.UPLOADING),t.calculateState(),t})},t.prototype.update=function(e){var t=this,n=e.briefId,o=e.data,r=e.start,i=void 0!==r&&r;return this.client.request("briefs.update",{briefId:n,title:o.title,messageToRecipient:o.messageToRecipient,dueDate:o.dueDate?o.dueDate.toISOString():"",tag:o.tags?o.tags.join(","):"",recipient:o.recipient,editorId:o.editorId,editorMessage:o.editorMessage}).then(function(e){return(new c.default).fromProof(e.data.Brief)}).then(function(e){return Promise.resolve(i&&t.start(e.id)).then(function(){return e})})},t.prototype.delete=function(e){return this.client.request("proofs.delete",{proofId:e})},t.prototype.start=function(e){return this.client.request("briefs.start",{briefId:e})},t}(u.default);t.default=h},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e){var t=e.lastIndexOf(".");return{name:e.substring(0,t),extension:e.substring(t+1)}}t.__esModule=!0;var u=n(0),f=o(u),c=n(11),l=o(c),p=n(5),d=o(p),h=n(23),y=o(h),m=n(56),w=o(m),v=n(7),_=o(v),b=n(61),E=o(b),g=n(2),O=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return s(t,e),t.prototype.generateToken=function(e,t){return e&&!t?Promise.reject(Error('The "assignedType" option is required when specifying the "assignedTo" option.')):!e&&t?Promise.reject(Error('The "assignedTo" option is required when specifying the "assignedType" option.')):this.client.request("files.generate-token",{relatedId:e,fileType:t}).then(function(e){return e.data.Token})},t.prototype._waitFileProcessed=function(e){var t=this;return new Promise(function(n,o){var r=null,i=null;!function s(){t.details(e).then(function(t){switch(r=null,t.status){case d.default.OK:n(t);break;case d.default.ERROR:o(new Error("File "+e+" encountered a processing error: "+t.message));break;default:r=setTimeout(s,5e3)}r&&t.status!==d.default.RIPPING||clearTimeout(i)}).catch(o)}(),i=setTimeout(function(){clearTimeout(r),o(new Error("File did not finish processing within specified duration."))},3e4)})},t.prototype.import=function(e){var t=this,n=e.name,o=e.url,r=e.provider,i=void 0===r?y.default.NONE:r,s=e.auth,u=e.download,f=void 0!==u&&u,c=e.process,p=void 0!==c&&c;if(!Object.keys(y.default).some(function(e){return y.default[e]===i}))return Promise.reject(new Error('Unsupported provider "'+i+'"'));var d=i;i===y.default.NONE&&(d="generic");var h=a(n),m=h.name,w=h.extension;return this._generateKeyIVEnvelope().then(function(e){var n=e.envelope;return t.client.request("files.import."+d,{extn:w,filename:m,url:o,envelope:n,accessToken:s,storeOriginal:f})}).then(function(e){return e.data}).then(function(e){if(p)return t._waitFileProcessed(e);var n=new l.default;return n.id=e,n})},t.prototype._generateKeyIVEnvelope=function(){var e=this;return this.client.crypto().generateKeyIV().then(function(t){return Promise.all([t,e.client.crypto().envelopeSeal(t.keyIV,[e.client.session.serverPublicKeyPEM,e.client.session.publicKeyPEM])])}).then(function(e){return{keyIV:e[0],envelope:e[1]}})},t.prototype.upload=function(e){var t=this,n=e.name,o=e.contents,r=e.assignedTo,i=e.assignedType,s=e.download,a=void 0!==s&&s,u=e.async,f=void 0===u||u,c=e.onProgress,p=e.onError;return this.generateToken(r,i).then(function(e){return Promise.all([e,t._generateKeyIVEnvelope()])}).then(function(e){var r=e[0],i=e[1],s=i.keyIV,u=i.envelope,l=t._upload({name:n,contents:o,download:a,token:r,keyIV:s,envelope:u,onProgress:c,onError:p});return f&&(l=Promise.resolve()),l.then(function(){return r})}).then(function(e){var t=new l.default;return t.id=e,t})},t.prototype._upload=function(e){var t=this,n=e.name,o=e.contents,r=e.download,i=e.token,s=e.keyIV,u=e.envelope,f=e.onProgress;return new Promise(function(e){function c(){y().then(function(t){if(!_)if(null===t)_=!0,e(m.then(I));else{var n=T(t,v++);m=m.then(function(){return n}),n.then(c)}})}var l=4,p=a(n),d=p.name,h=p.extension,y=(0,w.default)(o),m=Promise.resolve(),v=0,_=!1,b=Math.ceil((0,E.default)(o)/g.BYTES_PER_BLOCK),O=new Array(b),P=function(){};f&&(P=function(e,t){O[e]=Math.max(t,O[e]||0),f(O.reduce(function(e,t){return e+(t||0)},0)/b*.99)});for(var T=function(e,n){return t.client.crypto().encryptFileBlock(s,e).then(function(e){return t.client.request("files.upload-block",{block:n,part:1,token:i,data:e},{onUploadProgress:P.bind(null,n)})})},I=function(){return t.client.request("files.upload-complete",{block:0,blockCount:v,part:0,token:i,extn:h,pages:1,filename:d,storeoriginal:r?1:0,envelope:u}).then(function(){return f&&f(100)})};l--;)c()})},t.prototype.download=function(e){var t=this,n="string"==typeof e?{fileId:e}:e,o=n.fileId,r=n.onFileDetails;return this.details(o).then(function(e){if(!e.downloadable)throw new Error("File "+o+" is not downloadable.");if(e.status!==d.default.OK)throw new Error("File "+o+" cannot be download. The file may still be uploading, processing or has errored.");if(!e.blocks)throw new Error("File "+o+" is empty.");return r&&r(e),t._downloadFile(e,n)})},t.prototype._downloadFile=function(e,t){var n=this;return new Promise(function(o){function r(){if(!y)if(h<u.length){var e=h++,t=d(e);f=f.then(function(){return t.then(function(t){return c(t,e,a)})}),t.then(r)}else y=!0,o(f.then(m))}var i=4,s=new _.default,a=e.blocks,u=new Array(a),f=Promise.resolve(),c=t.onData||function(e,t){u[t]=e},l=function(){};if(t.onProgress){var p=new Array(a);l=function(e,n){p[e]=Math.max(n,p[e]||0),t.onProgress(p.reduce(function(e,t){return e+(t||0)},0)/a*.99)}}for(var d=function(t){return n.client.request("files.download-block",{proofId:e.assignedTo,fileId:e.id,block:t+1},{onDownloadProgress:l.bind(null,t)}).then(function(e){return n.client.crypto().decryptFileBlock(e.data,n.client.session.privateKeyPEM).then(function(e){return s.createBase64(e)})})},h=0,y=!1,m=function(){return t.onProgress&&t.onProgress(100),t.onData?null:s.combine.apply(s,u)};i--;)r()})},t.prototype.details=function(e){return this.client.request("files.details",{fileId:e}).then(function(e){return(new l.default).fromFile(e.data)})},t.prototype.thumbnail=function(e){var t=this;return this.client.cache.auto(g.THUMBNAIL_CACHE_PREFIX+e,function(){return t._thumbnail(e)})},t.prototype._thumbnail=function(e){var t=this;return this.client.request("files.thumbnail",{fileId:e}).then(function(e){return t.client.crypto().decryptImage(e.data,t.client.session.privateKeyPEM)}).then(function(e){return(new _.default).createBase64(e)})},t.prototype.thumbnails=function(e,t){var n=this,o=t.async,r=void 0!==o&&o,i=t.onLoadThumbnails,s=[];return Promise.all(e.map(function(e){return n.client.cache.auto(g.THUMBNAIL_CACHE_PREFIX+e,function(t){s.push({fileId:e,resolve:t})}).then(function(t){var n;return t&&(n={},n[e]=t,n)})})).then(function(e){var t=Promise.all(s.map(function(e){var t=e.fileId,o=e.resolve;return n._thumbnail(t).then(function(e){if(o(e),r){var n;i((n={},n[t]=e,n))}return e})}));return r?e:t.then(function(t){return[].concat(e,t)})}).then(function(e){return Object.assign.apply(Object,[{}].concat(e))})},t}(f.default);t.default=O},function(e,t,n){"use strict";function o(e){var t=new s.default,n=0,o=Promise.resolve(),i=t.size(e);return function(){var s=n++*r.BYTES_PER_BLOCK,a=s+r.BYTES_PER_BLOCK;return o=o.then(function(){return s>i?null:t.slice(e,s,a).then(t.readBase64).then(function(e){return"data:;base64,"+e})})}}t.__esModule=!0;var r=n(2),i=n(7),s=function(e){return e&&e.__esModule?e:{default:e}}(i);t.default=o},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e){for(var t=new ArrayBuffer(e.length),n=new Uint8Array(t),o=0;o<e.length;o++)n[o]=e.charCodeAt(o);return t}t.__esModule=!0;var i=function(){function e(){o(this,e)}return e.prototype.create=function(e){return Promise.resolve(new Blob([r(e)]))},e.prototype.createBase64=function(e){return this.create(atob(e))},e.prototype.combine=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return Promise.resolve(new Blob(t))},e.prototype.slice=function(e,t,n){return Promise.resolve(e.slice(t,n))},e.prototype.read=function(e){return new Promise(function(t,n){var o=new FileReader;o.onload=function(){t(o.result)},o.onerror=function(){n(o.error)},o.readAsText(e)})},e.prototype.readBase64=function(e){return new Promise(function(t,n){var o=new FileReader;o.onload=function(){var e=o.result;t(e.substring(e.indexOf(",")+1))},o.onerror=function(){n(o.error)},o.readAsDataURL(e)})},e.prototype.size=function(e){return e.size},e}();t.default=i},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=function(){function e(){o(this,e)}return e.prototype.create=function(e){return Promise.resolve(Buffer.from(e))},e.prototype.createBase64=function(e){return Promise.resolve(Buffer.from(e,"base64"))},e.prototype.combine=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return Promise.resolve(Buffer.concat(t))},e.prototype.slice=function(e,t,n){return Promise.resolve(e.slice(t,n))},e.prototype.read=function(e){return Promise.resolve(e.toString())},e.prototype.readBase64=function(e){return Promise.resolve(e.toString("base64"))},e.prototype.size=function(e){return Buffer.byteLength(e)},e}();t.default=r},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e){for(var t=e.length,n=e.length-1;n>=0;n--){var o=e.charCodeAt(n);o>127&&o<=2047?t++:o>2047&&o<=65535&&(t+=2),o>=56320&&o<=57343&&n--}return t}t.__esModule=!0;var i=n(60),s=function(){function e(){o(this,e)}return e.prototype.create=function(e){return Promise.resolve(e)},e.prototype.createBase64=function(e){return Promise.resolve((0,i.atob)(e))},e.prototype.combine=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return Promise.resolve(t.join(""))},e.prototype.slice=function(e,t,n){return Promise.resolve(e.slice(t,n))},e.prototype.read=function(e){return Promise.resolve(e)},e.prototype.readBase64=function(e){return Promise.resolve((0,i.btoa)(e))},e.prototype.size=function(e){return r(e)},e}();t.default=s},function(e,t,n){!function(){function e(e){this.message=e}var n=t,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.prototype=new Error,e.prototype.name="InvalidCharacterError",n.btoa||(n.btoa=function(t){for(var n,r,i=String(t),s=0,a=o,u="";i.charAt(0|s)||(a="=",s%1);u+=a.charAt(63&n>>8-s%1*8)){if((r=i.charCodeAt(s+=.75))>255)throw new e("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");n=n<<8|r}return u}),n.atob||(n.atob=function(t){var n=String(t).replace(/[=]+$/,"");if(n.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,i,s=0,a=0,u="";i=n.charAt(a++);~i&&(r=s%4?64*r+i:i,s++%4)?u+=String.fromCharCode(255&r>>(-2*s&6)):0)i=o.indexOf(i);return u})}()},function(e,t,n){"use strict";function o(e){return"undefined"!=typeof Blob&&e instanceof Blob?e.size:0}t.__esModule=!0,t.default=o},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=n(0),u=o(a),f=n(63),c=o(f),l=function(e){function t(n){r(this,t);var o=i(this,e.call(this,n));return o.team=new c.default(n),o}return s(t,e),t}(u.default);t.default=l},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=n(0),u=o(a),f=n(64),c=o(f),l=function(e){function t(n){r(this,t);var o=i(this,e.call(this,n));return o.users=new c.default(n),o}return s(t,e),t}(u.default);t.default=l},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e){return e.data.map(function(e){return(new l.default).fromUser(e)})}t.__esModule=!0;var u=n(0),f=o(u),c=n(3),l=o(c),p=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return s(t,e),t.prototype.enabled=function(){return this.client.request("admin.team.users.enabled").then(a)},t.prototype.disabled=function(){return this.client.request("admin.team.users.disabled").then(a)},t.prototype._setEnabled=function(e,t){return this.client.request("admin.team.users.set-enabled",{email:e,enabled:t})},t.prototype.enable=function(e){return this._setEnabled(e,!0)},t.prototype.disable=function(e){return this._setEnabled(e,!1)},t}(f.default);t.default=p},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e){return e&&((0,w.isUserId)(e.id)||e.email)}function u(e){return(e||[]).map(function(e){return(new p.default).fromWorkflow(e)})}t.__esModule=!0;var f=n(0),c=o(f),l=n(24),p=o(l),d=n(13),h=o(d),y=n(14),m=o(y),w=n(20),v=n(66),_=o(v),b=function(e){function t(n){r(this,t);var o=i(this,e.call(this,n));return o.steps=new _.default(n),o}return s(t,e),t.prototype.create=function(e){var t=this,n=e.save,o=void 0!==n&&n,r=e.name,i=e.steps,s=void 0===i?[]:i,u=e.reviewers,f=e.approver;if(!a(f))return Promise.reject(Error("An approver is required to create a workflow."));if(o&&!r)return Promise.reject(Error("A workflow must have a name when saving it as a workflow template."));var c=s;u&&u.length&&c.splice(0,0,{users:u}),f&&c.push({position:1e3,users:[f]});for(var l=0,p=0;p<c.length;p++){var d=c[p];if(!d.users||!d.users.length)return Promise.reject(Error("Workflow steps must contain users."));(!d.position||d.position<l)&&(d.position=l+1),l=Math.max(l,d.position);for(var h=0;h<d.users.length;h++){if(!a(d.users[h]))return Promise.reject(Error("A user id or email address must be provided for a workflow user."))}}var y=void 0;return this._createWorkflow(r).then(function(e){return y=e.id,Promise.all([e,Promise.all(c.map(function(n){var o=e.getStepByPosition(n.position);return o?t._setWorkflowStepUsersMutate(e.id,o,n.users):t._addWorkflowStepAndUsers(e.id,n)}))])}).then(function(e){var t=e[0],n=e[1];return t.steps=n,t}).then(function(e){return o?t._duplicateWorkflow(y):e}).catch(function(e){return Promise.resolve(y&&t._deleteWorkflow(y)).then(function(){return Promise.reject(e)})})},t.prototype.load=function(e){return this.client.request("workflows.load",{workflowId:e}).then(function(e){return(new p.default).fromWorkflow(e.data)})},t.prototype.use=function(e){return this.duplicate(e)},t.prototype.duplicate=function(e){return this._duplicateWorkflow(e)},t.prototype.delete=function(e){return this._deleteWorkflow(e)},t.prototype.all=function(){return Promise.all([this.owned(),this.shared()]).then(function(e){return[].concat(e[0],e[1])})},t.prototype.owned=function(){return this.client.request("workflows.owned").then(function(e){return u(e.data)})},t.prototype.shared=function(){return this.client.request("workflows.shared").then(function(e){return u(e.data)})},t.prototype.setApprover=function(e,t){return this.client.request("workflows.users.set",{workflowId:e,position:1e3,users:[t]})},t.prototype._duplicateWorkflow=function(e){var t=this;return this.client.request("workflows.duplicate",{workflowId:e}).then(function(e){var n=e.data.WorkflowId;return t.load(n)})},t.prototype._deleteWorkflow=function(e){return this.client.request("workflows.delete",{workflowId:e})},t.prototype._createWorkflow=function(e){return this.client.request("workflows.create",{title:e}).then(function(e){return(new p.default).fromWorkflow(e.data)})},t.prototype._addWorkflowStepAndUsers=function(e,t){var n=this;return this.client.request("workflows.steps.add",{workflowId:e,title:t.name,position:t.position}).then(function(o){var r=(new h.default).fromWorkflowStep(o.data);return n._setWorkflowStepUsersMutate(e,r,t.users)})},t.prototype._setWorkflowStepUsersMutate=function(e,t,n){return this.client.request("workflows.users.set",{workflowId:e,stepId:t.id,users:n.map(function(e){return{email:e.email,userId:e.id,role:e.role,permissions:e.permissions&&{inviter:!!e.permissions.inviter}}})}).then(function(e){var n=e.data.map(function(e){return(new m.default).fromWorkflowUser(e)});return t.users=n,t})},t}(c.default);t.default=b},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=n(0),a=function(e){return e&&e.__esModule?e:{default:e}}(s),u=function(e){function t(){return o(this,t),r(this,e.apply(this,arguments))}return i(t,e),t.prototype.moveBefore=function(e,t){return this.client.request("workflows.steps.move-before",{stepId:e,beforeStepId:t})},t.prototype.moveAfter=function(e,t){return this.client.request("workflows.steps.move-after",{stepId:e,afterStepId:t})},t.prototype.swap=function(e,t){return this.client.request("workflows.steps.swap",{stepId:e,swapStepId:t})},t}(a.default);t.default=u},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e){return(new p.default).fromPreference(e)}function u(e,t){var n=new Array(e.length);return t.forEach(function(t){n[e.indexOf(t.name)]=t}),n}t.__esModule=!0;var f=n(0),c=o(f),l=n(68),p=o(l),d=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return s(t,e),t.prototype.all=function(){return this.client.request("preferences.all")},t.prototype.get=function(e){var t=[].concat(e);return this.client.request("preferences.get",{preferences:t}).then(function(e){return e.data.map(a)}).then(function(n){return"string"==typeof e?n[0]:u(t,n)})},t.prototype.update=function(e,t){var n,o=void 0!==t?(n={},n[e]=t,n):e;return this.client.request("preferences.update",o)},t.prototype.reset=function(e){return this.client.request("preferences.reset",{preferences:[].concat(e)})},t}(c.default);t.default=d},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=n(1),i=function(e){return e&&e.__esModule?e:{default:e}}(r),s={name:"Name",defaultValue:"DefaultValue",value:"Value"},a=function(){function e(){o(this,e)}return e.prototype.getValueOrDefault=function(){return null===this.value?this.defaultValue:this.value},e.prototype.fromPreference=function(e){return(0,i.default)(this,s,e),this},e}();t.default=a},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e){var t=[];return Object.keys(e).forEach(function(n){e[n].Comments.forEach(function(e){t.push(e)})}),t}function u(e){var t=[],n=[];e.forEach(function(e){var o=(new p.default).fromComment(e);o.parentCommentId?n.push(o):t.push(o)}),t.sort(P);var o=t.map(function(e){return e.id}),r=(0,m.sortObjectsBy)(function(e){return o.indexOf(e.parentCommentId)},!0);return n.sort((0,m.combineSort)(T,r)),t.concat(n)}t.__esModule=!0;var f=n(0),c=o(f),l=n(27),p=o(l),d=n(15),h=o(d),y=n(2),m=n(22),w=n(29),v=n(71),_=n(72),b=o(_),E=(0,m.sortObjectsByKey)("pageNumber"),g=(0,m.sortObjectsByKey)("createdDate",!0),O=(0,m.sortObjectsByKey)("createdDate",!1),P=(0,m.combineSort)(E,g),T=(0,m.combineSort)(E,O),I=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return s(t,e),t.prototype._mark=function(e,t,n){var o,r=void 0;switch(t){case h.default.TODO:r="change";break;case h.default.DONE:r="done";break;default:throw new Error('Cannot mark comment state "'+t+'".')}var i=(o={commentId:e},o[r]=n?1:0,o);return this.client.request("comments.state.update",i).then(function(){return null})},t.prototype.mark=function(e,t){return this._mark(e,t,!0)},t.prototype.unmark=function(e,t){return this._mark(e,t,!1)},t.prototype.load=function(e){var t=this,n="string"==typeof e?{proofId:e}:e,o=n.proofId,r=n.pageNumber,i=void 0===r?null:r,s=n.sinceDate,f=void 0===s?null:s,c=n.async,l=void 0!==c&&c,p=n.decrypt,d=void 0===p||p,h=n.onDecryptComment,m=n.onDecryptComments,w=n.onDecryptCommentsThrottleMs,v=void 0===w?1e3:w,_=n.onDecryptError,E=f?f.toISOString().match(y.ISO_REGEX)[0]:y.DEFAULT_ISO_DATE,g={proofId:o,page:i,timestamp:E};return this.client.request(null!==i?"comments.load-page":"comments.load-all",g).then(function(e){var n=u(e.data.Pages?a(e.data.Pages):e.data),o=Promise.resolve();if(d){var r=[],i=[],s=m?(0,b.default)(function(){i.length&&(m(i),i=[])},v):function(){},f=Promise.all(n.map(function(e){return t.client.cache.auto(y.COMMENT_CACHE_PREFIX+e.comment$,function(t){r.push({comment:e,resolve:t})}).then(function(t){return t&&e.fromRawComment(t),e})}));o=o.then(function(){return f}),o=o.then(function(){var e=r.map(function(e){var n=e.comment,o=e.resolve;return t.client.crypto().decryptComment(n.comment$,n.envelope,t.client.session.privateKeyPEM).then(function(e){n.fromRawComment(e),o(e),h&&h(n),i.push(n),s()}).catch(function(e){if(_&&_(e,n),!l)return Promise.reject(e)})});return l?null:Promise.all(e)})}return o.then(function(){return n})})},t.prototype.create=function(e){var t=this,n=e.raw,o=e.proofId,r=e.pageNumber,i=void 0===r?1:r,s=e.pin,a=e.mediaTime,u=e.mediaDuration,f=e.parentCommentId,c=e.metadata,l=e.state,d=e.creationToken,y=(0,w.getCommentMentions)(n),m=d||(0,v.generateCreationToken)();return this.client.crypto().encryptComment(n,[this.client.session.serverPublicKeyPEM,this.client.session.publicKeyPEM]).then(function(e){var t=e.envelope,n=e.comment$;return{proofId:o,page:f?void 0:i,envelope:t,encryptedComment:n,xy:JSON.stringify({x:s&&"number"==typeof s.x?s.x:null,y:s&&"number"==typeof s.y?s.y:null,x2:s&&"number"==typeof s.x2?s.x2:null,y2:s&&"number"==typeof s.y2?s.y2:null,time:"number"==typeof a?a:null,duration:"number"==typeof u?u:null}),parent:f||void 0,mentions:y.map(function(e){return e.id}).join(","),metadata:c?JSON.stringify(c):"{}",creationToken:m,change:l===h.default.TODO?"1":void 0,done:l===h.default.DONE?"1":void 0}}).then(function(e){return t.client.request("comments.create",e).then(function(e){return(new p.default).fromComment(e.data).fromRawComment(n)})}).catch(function(e){return e&&(e.creationToken=m),Promise.reject(e)})},t}(c.default);t.default=I},function(e,t,n){"use strict";function o(e){var t=""+e,n=r.exec(t);if(!n)return t;var o,i="",s=0,a=0;for(s=n.index;s<t.length;s++){switch(t.charCodeAt(s)){case 34:o=""";break;case 38:o="&";break;case 39:o="'";break;case 60:o="<";break;case 62:o=">";break;default:continue}a!==s&&(i+=t.substring(a,s)),a=s+1,i+=o}return a!==s?i+t.substring(a,s):i}/*!
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.PageProof=t():e.PageProof=t()}(this,function(){return function(e){function t(n){if(o[n])return o[n].exports;var r=o[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var o={};return t.m=e,t.c=o,t.d=function(e,o,n){t.o(e,o)||Object.defineProperty(e,o,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var o=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(o,"a",o),o},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=30)}([function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=function e(t){n(this,e),this.client=t};t.default=r},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t,o){var n=[],r={};return Array.isArray(t)?(n=t,t.forEach(function(e){r[e]=e})):(0,y.default)(t)&&(n=Object.keys(t),r=t),n.forEach(function(t){var n=r[t],i=void 0;if("string"==typeof n)i=-1!==n.indexOf(".")?function(){for(var e=n.split("."),t=o,r=0;r<e.length;r++){var i=e[r];if(!(0,w.default)(t,i)){t=void 0;break}t=t[i]}return t}:function(){return o[n]};else{if("function"!=typeof n){if(null===n)return;throw new Error("Unknown transformer.")}i=n}var a=i.call(e,o);void 0!==a&&(e[t]=a)}),e}function i(e){return function(t){return Number(t[e])}}function a(e,t){return function(o){return t[o[e]]}}function s(e){return function(t){var o=t[e];if(o&&"0001-01-01T00:00:00"!==o)return"number"==typeof o?new Date(1e3*o):new Date(o+"Z")}}function u(e){return function(t){var o=String(t[e]);return"1"===o||"true"===o}}function f(e){return function(t){return w.default.call(t,e)}}function c(e,t){return function(o){return o[e]?o[e].map(t):[]}}function l(e,t){return function(o){return o[e]?JSON.parse(o[e]):Array.isArray(t)?[].concat(t):d({},t)}}function p(e){return function(t){return t[e]?t[e]:void 0}}t.__esModule=!0;var d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e};t.number=i,t.enumeration=a,t.date=s,t.truthy=u,t.exists=f,t.each=c,t.json=l,t.optional=p;var h=o(15),y=n(h),m=o(9),w=n(m);t.default=r},function(e,t,o){"use strict";t.__esModule=!0;t.TOKEN_HEADER="x-authorization-token",t.HMAC_HEADER="x-authorization-hmac",t.TIMESTAMP_HEADER="x-timestamp",t.DEVICE_ID_HEADER="x-device-id",t.SUBSCRIPTION_KEY_HEADER="ocp-apim-subscription-key",t.SDK_VERSION_HEADER="x-pageproof-javascript-sdk",t.RETRY_AFTER_HEADER="retry-after",t.BYTES_PER_BLOCK=2097152,t.MENTION_REGEX=/@{(U[a-zA-Z0-9]{15}|~everyone)}{(.*?)}/g,t.ISO_REGEX=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/,t.DEFAULT_ISO_DATE="0001-01-01T00:00:00",t.DAY_IN_MS=864e5,t.COMMENT_CACHE_PREFIX="comment",t.THUMBNAIL_CACHE_PREFIX="thumbnail"},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=o(1),i=function(e){return e&&e.__esModule?e:{default:e}}(r),a={id:"UserId",name:"Name",email:"Email",hasActivated:"Activated",hasRegistered:"IsRegistered",hasAvatar:"HasAvatar",accountType:"AccountType",teamType:"TeamType",teamLogo:"Branding.LogoURL",registeredDate:(0,r.date)("Registered"),lastLoginDate:(0,r.date)("LastLogin"),lastUploadDate:(0,r.date)("LastUpload"),isAdmin:"IsDomainAdmin"},s=function(){function e(){n(this,e)}return e.prototype.fromJSON=function(e){return(0,i.default)(this,Object.keys(a),e),this},e.prototype.fromUser=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(){return this.dueDate&&this.dueDate.getTime()<Date.now()}t.__esModule=!0;var a=o(1),s=n(a),u=o(17),f=n(u),c=o(18),l=n(c),p=o(5),d=n(p),h=o(19),y={id:"ProofId",name:"Title",status:"Status",workflowId:"WorkflowId",version:"Version",dueDate:(0,a.date)("DueDate"),createdDate:(0,a.date)("CreatedDate"),approvedDate:(0,a.date)("ApprovedDate"),isLocked:"Locked",isArchived:"Closed",isOverdue:i,uploaderUserId:"UserId",ownerUserIds:"OwnerIds",editorUserId:"EditorId",editorUserIds:"EditorIds",lockerUserId:"ProofLockerId",messageToReviewers:"Description",messageToOwners:"OwnerMessage",messageToEditor:"EditorMessage",fileId:"FileId",fileExtension:"Extension",fileStatus:"FileStatus",fileMessage:"FileStatusMessage",pageCount:(0,a.number)("Pages"),commentCount:(0,a.number)("ParentComments"),canDownload:(0,a.truthy)("DownloadOriginal"),type:"Type",processStatus:"ProcessStatus",recipient:"Recipient"},m=function(){function e(){r(this,e)}return e.prototype.getState=function(){var e=f.default.ACTIVE;return this.fileStatus===d.default.UPLOADING?e=f.default.UPLOADING:this.hasFileError()?e=f.default.FILE_ERROR:this.isProcessing()?e=f.default.PROCESSING:this.status===l.default.ARCHIVED?e=f.default.ARCHIVED:this.hasWorkflow()?this.status===l.default.TODOS_REQUESTED?e=f.default.TODOS_REQUESTED:this.status===l.default.AWAITING_NEW_VERSION?e=f.default.AWAITING_NEW_VERSION:this.status===l.default.APPROVED?e=f.default.APPROVED:this.hasWorkflowStarted()?this.isOverdue&&(e=f.default.OVERDUE):e=f.default.NOT_STARTED:e=f.default.PROOFERS_NEEDED,e},e.prototype.hasWorkflowStarted=function(){return this.hasWorkflow()&&this.status!==l.default.NEW},e.prototype.isProcessing=function(){return this.fileStatus===d.default.UPLOADING||this.fileStatus===d.default.QUEUED||this.fileStatus===d.default.RIPPING},e.prototype.getProcessingProgress=function(){switch(this.fileStatus){case d.default.UPLOADING:return.1;case d.default.QUEUED:return.2;case d.default.RIPPING:return.6;default:return-1}},e.prototype.hasWorkflow=function(){return(0,h.isWorkflowId)(this.workflowId)},e.prototype.hasFile=function(){return(0,h.isFileId)(this.fileId)},e.prototype.hasFileError=function(){return this.fileStatus===d.default.ERROR||!this.fileStatus||!this.hasFile()},e.prototype.hasEditor=function(){return(0,h.isUserId)(this.editorUserId)},e.prototype.hasThumbnail=function(){return this.fileStatus===d.default.OK},e.prototype.canUserUploadNewVersion=function(e){return this.getState()===f.default.AWAITING_NEW_VERSION&&(this.editorUserId===e||this.isOwner(e))},e.prototype.isOwner=function(e){return-1!==this.ownerUserIds.indexOf(e)},e.prototype.calculateState=function(){this.state=this.getState()},e.prototype.fromProof=function(e){return(0,s.default)(this,y,e),this.calculateState(),this},e}();t.default=m},function(e,t,o){"use strict";t.__esModule=!0;var n={OK:"OK",UPLOADING:"Uploading",QUEUED:"Queued",RIPPING:"Ripping",ERROR:"Error"};t.default=n},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=o(1),a=n(i),s=o(3),u=n(s),f={userId:"UserId",token:"Token",sharedKey:"SharedKey",privateKeyPEM$:"PrivateKey",privateKeyPEM:null,publicKeyPEM:"PublicKey",serverPublicKeyPEM:"PublicServerKey"},c=function(){function e(){r(this,e)}return e.prototype.fromJSON=function(e){return(0,a.default)(this,Object.keys(f),e),this.user=(new u.default).fromJSON(e.user),this},e.prototype.fromSession=function(e){return(0,a.default)(this,f,e),this.user=(new u.default).fromUser(e),this},e}();t.default=c},function(e,t,o){"use strict";function n(){if("function"==typeof n.driver){return new(0,n.driver)}if("string"==typeof n.driver){var e=void 0;switch(n.driver){case"Blob":e=o(56).default;break;case"Buffer":e=o(57).default;break;case"String":e=o(58).default;break;default:throw new Error('Unknown Bluffer driver "'+n.driver+'".')}if(e)return new e;throw new Error('Bluffer driver "'+n.driver+'" not found.')}throw new Error('Bluffer.driver must be either "Blob", "Bluffer", or "String" or a custom constructor.')}t.__esModule=!0;var r=o(11)("bluffer");n.driver="String","undefined"!=typeof Blob?n.driver="Blob":(r("The current JavaScript environment does not support native Bluffer, falling back to using StringBluffer."),n.driver="String"),t.default=n},function(e,t,o){"use strict";t.__esModule=!0;var n={ERROR_CRITICAL:3,OK:200,ERROR_INVALID:201,ERROR_NO_ACCESS:100,ERROR_NO_ACCESS_WRITE:101,ERROR_RESTRICTED:102,ERROR_SQL_ERROR:105,ERROR_OUT_SYNC:106,ERROR_STORAGE_ERROR:110,ERROR_QUEUE_ERROR:111,ERROR_SQL_DEADLOCK_ERROR:121,ERROR_BAD_REQUEST:400,ERROR_UNAUTHORISED:401,ERROR_MEDIA_PERMISSION_NO_ACCESS:402,ERROR_NOT_FOUND:1e3,ERROR_CREATE:1001,ERROR_UPDATE:1002,ERROR_DELETE:1003,ERROR_EXISTS:1004,ERROR_USER_INVALID_LOGIN:1010,ERROR_USER_INVALID_PASSWORD:1011,ERROR_USER_IS_REGISTERED:1012,ERROR_USER_INVALID_EMAIL:1013,ERROR_USER_INVALID_LOGIN_COUNT:1014,ERROR_USER_DISABLED:1015,ERROR_BAD_REQUEST_DATE:201,ERROR_THROTTLED:429,ERROR_REUSED_CREATION_TOKEN:2011,ERROR_UPGRADE_REQUIRED:3e3,ERROR_VISIBLE_WORKFLOW_USERS_EXIST:3001,ERROR_GROUP_EXISTS:3002,ERROR_GROUP_PROOFS_EXIST:3003};t.default=n},function(e,t,o){"use strict";t.__esModule=!0,t.default=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=o(1),i=function(e){return e&&e.__esModule?e:{default:e}}(r),a={id:"FileId",name:"Name",blocks:"Chunks",downloadable:"Downloadable",assignedTo:"AssignedTo",assignedType:"AssignedType",status:"Status",message:"Message"},s={id:"Attachment",name:"AttachmentName",blocks:"AttachmentChunks",assignedTo:"CommentId",assignedType:function(){return"attachment"},status:"AttachmentStatus",message:function(){return""}},u=function(){function e(){n(this,e)}return e.prototype.fromFile=function(e){return(0,i.default)(this,a,e),this},e.prototype.fromCommentAttachment=function(e){return(0,i.default)(this,s,e),this},e}();t.default=u},function(e,t,o){"use strict";e.exports=function e(){return e}},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=o(1),a=n(i),s=o(13),u=n(s),f=o(26),c=n(f),l={id:"StepId",name:"Title",position:(0,i.number)("Position"),state:function(e){return e.Complete?c.default.COMPLETE:e.Visible?c.default.VISIBLE:c.default.NOT_VISIBLE},users:(0,i.each)("Users",function(e,t){var o=(new u.default).fromWorkflowUser(e);return o._calculateState(e,t),o})},p=function(){function e(){r(this,e)}return e.prototype.fromWorkflowStep=function(e){return(0,a.default)(this,l,e),this},e}();t.default=p},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=o(1),u=n(s),f=o(3),c=n(f),l=o(25),p=n(l),d={id:"UserId",name:"Name",email:"Email",role:"Role",permissions:function(e){return{inviter:e.IsInviter}}},h=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype._calculateState=function(e,t){e.SkippedInStep?this.state=p.default.SKIPPED:e.CompleteInStep?this.state=p.default.FINISHED:e.ViewedInStep?this.state=p.default.SEEN:t.Visible?this.state=p.default.VISIBLE:this.state=p.default.NOT_VISIBLE},t.prototype.fromWorkflowUser=function(e){return this._calculateState({},{}),(0,u.default)(this,d,e),this},t}(c.default);t.default=h},function(e,t,o){"use strict";t.__esModule=!0;var n={COMMENT:"comment",TODO:"todo",DONE:"done"};t.default=n},function(e,t,o){"use strict";t.__esModule=!0;var n=Object.prototype.toString;t.default=function(e){return"[object Object]"===n.call(e)}},function(e,t,o){"use strict";t.__esModule=!0;var n=void 0;n="99.0.1532904725067",t.default=n},function(e,t,o){"use strict";t.__esModule=!0;var n={UPLOADING:"uploading",FILE_ERROR:"file-error",PROCESSING:"processing",ARCHIVED:"archived",PROOFERS_NEEDED:"proofers-needed",TODOS_REQUESTED:"todos-requested",AWAITING_NEW_VERSION:"awaiting-new-version",APPROVED:"approved",NOT_STARTED:"not-started",OVERDUE:"overdue",ACTIVE:"active"};t.default=n},function(e,t,o){"use strict";t.__esModule=!0;var n={NEW:0,PROOFING:10,FINAL_APPROVING:30,TODOS_REQUESTED:50,AWAITING_NEW_VERSION:60,APPROVED:70,ARCHIVED:100};t.default=n},function(e,t,o){"use strict";var n={Proof:"P",Workflow:"W",File:"F",User:"U",Brief:"B"},r={};Object.keys(n).forEach(function(e){r["is"+e+"Id"]=function(t){return t&&16===t.length&&t[0]===n[e]}}),e.exports=r},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=o(1),i=function(e){return e&&e.__esModule?e:{default:e}}(r),a={id:"ProofId",version:"Version"},s=function(){function e(){n(this,e)}return e.prototype.fromProofVersion=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,o){"use strict";function n(e,t){return r(function(t){return t[e]},t)}function r(e,t){var o=t?1:-1,n=t?-1:1;return function(t,r){var i=e(t),a=e(r);return i<a?o:i>a?n:0}}function i(e,t){var o={};t.forEach(function(e,t){o[e]=t});var n="function"==typeof e?e:function(t){return t[e]};return function(e,t){var r=o[n(e)],i=o[n(t)];return r<i?-1:r>i?1:0}}function a(){for(var e=arguments.length,t=Array(e),o=0;o<e;o++)t[o]=arguments[o];var n=t.length;return function(e,o){for(var r=0;r<n;r++){var i=t[r](e,o);if(i)return i}return 0}}t.__esModule=!0,t.sortObjectsByKey=n,t.sortObjectsBy=r,t.sortObjectsByValues=i,t.combineSort=a},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=o(1),a=n(i),s=o(4),u=n(s),f={id:"GroupId",name:"Name",proofs:(0,i.each)("ProofInfo",function(e){return(new u.default).fromProof(e)})},c=function(){function e(){r(this,e)}return e.prototype.fromProofGroup=function(e){return(0,a.default)(this,f,e),this},e}();t.default=c},function(e,t,o){"use strict";t.__esModule=!0;var n={NONE:"none",GOOGLE_DRIVE:"drive",DROPBOX:"dropbox",ONEDRIVE:"onedrive",BOX:"box"};t.default=n},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=o(1),a=n(i),s=o(12),u=n(s),f={id:"WorkflowId",name:"Title",steps:(0,i.each)("WorkflowSteps",function(e){return(new u.default).fromWorkflowStep(e)})},c=function(){function e(){r(this,e)}return e.prototype.getStepByPosition=function(e){for(var t=this.steps.length,o=0;o<t;o+=1){var n=this.steps[o];if(n.position===e)return n}return null},e.prototype.getOrderedSteps=function(){return this.steps.sort(function(e,t){return e.position<t.position?-1:e.position>t.position?1:0})},e.prototype.getApproverStep=function(){return this.getStepByPosition(1e3)},e.prototype.fromWorkflow=function(e){return(0,a.default)(this,f,e),this},e}();t.default=c},function(e,t,o){"use strict";t.__esModule=!0;var n={NONE:null,NOT_VISIBLE:"not-visible",VISIBLE:"visible",SEEN:"seen",SKIPPED:"skipped",FINISHED:"finished"};t.default=n},function(e,t,o){"use strict";t.__esModule=!0;var n={NONE:null,NOT_VISIBLE:"not-visible",VISIBLE:"visible",COMPLETE:"complete"};t.default=n},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=o(1),a=n(i),s=o(3),u=n(s),f=o(28),c=n(f),l=o(10),p=n(l),d=o(14),h=n(d),y=o(29),m={__prepare:function(e){e._XY=c.default.parseValue(e.XY)},id:"CommentId",proofId:"ProofId",pin:function(e){return(new c.default).fromPin(e._XY)},user:function(e){return(new u.default).fromUser(e)},comment$:"EncryptedComment",envelope:"Envelope",attachments:function(e){return e.Attachment?[(new p.default).fromCommentAttachment(e)]:[]},agreeCount:function(e){return e.Agrees.length},pageNumber:(0,i.number)("Page"),mediaTime:function(e){return null==e._XY.time?void 0:e._XY.time},mediaDuration:function(e){return null==e._XY.duration?void 0:e._XY.duration},createdDate:(0,i.date)("Timestamp"),updatedDate:(0,i.date)("Updated"),parentCommentId:(0,i.optional)("Parent"),metadata:(0,i.json)("Metadata",{}),state:function(e){return+e.Done?h.default.DONE:+e.Change?h.default.TODO:h.default.COMMENT}},w=function(){function e(){r(this,e)}return e.prototype.fromComment=function(e){return(0,a.default)(this,m,e),this},e.prototype.fromRawComment=function(e){var t=(0,y.parseComment)(e);return this.raw=t.raw,this.text=t.text,this.html=t.html,this.tokens=t.tokens,this},e}();t.default=w},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},i=o(1),a=function(e){return e&&e.__esModule?e:{default:e}}(i),s={x:"x",y:"y",x2:(0,i.optional)("x2"),y2:(0,i.optional)("y2")},u=function(){function e(){n(this,e)}return e.prototype.fromPin=function(e){return(0,a.default)(this,s,e),this},e.parseValue=function(e){var t={x:null,y:null,x2:null,y2:null,time:null,duration:null};if("{"===e[0]){var o=JSON.parse(e);t=r({},t,o)}else if(-1!==e.indexOf(",")){var n=e.split(","),i=n[0],a=n[1];t.x=parseFloat(i),t.y=parseFloat(a)}return t},e}();t.default=u},function(e,t,o){"use strict";function n(e){return(0,c.default)(e)}function r(e){return e.replace(l.MENTION_REGEX,function(e,t,o){return o})}function i(e){var t=0;return e.replace(l.MENTION_REGEX,function(e,o,n,r){return'<span data-mention data-mention-index="'+t+++'" data-mention-user-id="'+o+'" data-mention-user-label="'+n.replace(/"/,'\\"')+'" data-mention-start-index="'+r+'" data-mention-end-index="'+(r+e.length)+'" data-mention-length="'+e.length+'">'+n+"</span>"})}function a(e){var t=[];return e.replace(l.MENTION_REGEX,function(e,o,n,r){t.push({id:o,label:n,index:r,length:e.length})}),t}function s(e){var t=a(e),o=[],n=0;t.forEach(function(t){var r=e.slice(n,t.index);n=t.index+t.length,r&&o.push({type:"text",value:r}),o.push({type:"mention",value:t})});var r=e.slice(n);return r&&o.push({type:"text",value:r}),o}function u(e){var t=n(e);return{raw:e,text:r(t),html:i(t),mentions:a(e),tokens:s(e)}}t.__esModule=!0,t.getCommentTokens=t.getCommentText=t.getCommentMentions=t.getCommentHTML=t.getCommentEscaped=t.parseComment=void 0;var f=o(67),c=function(e){return e&&e.__esModule?e:{default:e}}(f),l=o(2);t.parseComment=u,t.getCommentEscaped=n,t.getCommentHTML=i,t.getCommentMentions=a,t.getCommentText=r,t.getCommentTokens=s},function(e,t,o){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t.default=e,t}function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.version=t.Model=t.Enum=t.Bluffer=t.Client=void 0;var i=o(31),a=r(i),s=o(7),u=r(s),f=o(74),c=n(f),l=o(77),p=n(l),d=o(16),h=r(d);t.default=a.default,t.Client=a.default,t.Bluffer=u.default,t.Enum=c,t.Model=p,t.version=h.default},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=o(32),a=n(i),s=o(37),u=n(s),f=o(38),c=n(f),l=o(40),p=n(l),d=o(42),h=n(d),y=o(44),m=n(y),w=o(45),v=n(w),_=o(46),b=n(_),E=o(53),g=n(E),O=o(54),P=n(O),I=o(61),T=n(I),R=o(64),S=n(R),k=o(66),M=n(k),A=o(70),C=n(A),j=o(71),D=n(j),q=o(6),N=n(q),x=o(72),U=n(x),B=o(8),K=n(B),G=o(73),L=n(G),W=o(11)("PageProof"),F=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r(this,e),this.options=t,this.events=new U.default,this.adapters=new a.default(this.options.adapters),this.cache=new u.default(this),this.accounts=new h.default(this),this.comments=new M.default(this),this.dashboard=new m.default(this),this.files=new P.default(this),this.profile=new C.default(this),this.proofs=new b.default(this),this.briefs=new g.default(this),this.users=new v.default(this),this.workflows=new S.default(this),this.sessions=new D.default(this),this._registerCoreHooks(),this._enhance()}return e.prototype._registerCoreHooks=function(){this.on("error.throttled",function(e){var t=e.data.response.data.timeout;return W("Sleeping "+t+"ms until rate limit resets"),(0,L.default)(t)})},e.prototype._enhance=function(){var e=this;this.adapters.getEnhancementAdapters().forEach(function(t){return t.onClientReady(e)})},e.prototype.setSession=function(e){return!e||e instanceof N.default?this.session=e||null:this.session=(new N.default).fromJSON(e),this.session},e.prototype.request=function(e,t,o){var n=this,r=new c.default(e,t),i=this.adapters.getRequestAdapter(),a=Promise.resolve();if(!r.endpoint.anonymous){if(!this.session)return Promise.reject(new Error("Cannot make call to endpoint ("+e+") when unauthorized."));a=this.adapters.getCryptoAdapter().generateAuthorizationHeaders(r.getMethod(),r.getPath(),this.session).then(function(e){return r.addHeaders(e)})}var s={request:r};return a.then(function(){var e=r.build();return n.events.emit("experimental.request.before",s,!0).then(function(){return e})}).then(function(e){return i.send(e,o)}).then(p.default.parse).then(function(r){if(s.response=r,n.events.emit("experimental.request.after",s),r.code===K.default.ERROR_THROTTLED){var i=n.events.emit("error.throttled",s);if(i.some(Boolean))return Promise.all(i).then(function(){return n.events.emit("experimental.request.retry",s),n.request(e,t,o)})}if(r.code===K.default.ERROR_UNAUTHORISED){var a=n.session?n.session.token:null;return n.events.emit("error.unauthorized",s,!0).then(function(){return n.session&&n.session.token!==a?n.request(e,t,o):r})}if(r.deprecated){var u="The "+e+" API has been deprecated. "+(r.deprecated||"");n.events.emit("error.deprecated",{name:e,message:u})}return r}).then(function(t){try{if(t.error){n.events.emit("error.response",s);var o=new Error(e+" request resulted in an "+t.code+" error.");return o.response=t,o.request=r,Promise.reject(o)}return n.events.emit("experimental.request.resolve",s),Promise.resolve(t)}finally{n.events.emit("experimental.request.finally",s)}})},e.prototype.admin=function(){return this.session?this.session.user.isAdmin?(this._admin||(this._admin=Promise.resolve(new T.default(this))),this._admin):Promise.reject(new Error("The current user must be an administrator of a team or enterprise account.")):Promise.reject(new Error("You must be logged in to use the Admin API."))},e.prototype.crypto=function(){return this.adapters.getCryptoAdapter()},e.prototype.on=function(e,t){return this.events.on(e,t)},e}();t.default=F},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=o(33),a=n(i),s=o(34),u=n(s),f=o(35),c=n(f),l=o(36),p=n(l),d=function(){function e(t){r(this,e),this.adapters=[].concat(t)}return e.prototype.getAdapterInstanceOf=function(e){return this.getAnyAdaptersInstanceOf(e)[0]||null},e.prototype.getAnyAdaptersInstanceOf=function(e){for(var t=[],o=e.__adapter__,n=0;n<this.adapters.length;n+=1){var r=this.adapters[n];Object.getPrototypeOf(Object.getPrototypeOf(r)).constructor.__adapter__===o&&t.push(r)}return t},e.prototype.getCryptoAdapter=function(){var e=this.getAdapterInstanceOf(a.default);if(!e)throw new Error("ICryptoAdapter not found. This adapter is required for the SDK to function correctly.");return e},e.prototype.getRequestAdapter=function(){var e=this.getAdapterInstanceOf(u.default);if(!e)throw new Error("IRequestAdapter not found. This adapter is required for the SDK to function correctly.");return e},e.prototype.getCacheAdapter=function(){return this.getAdapterInstanceOf(c.default)},e.prototype.getEnhancementAdapters=function(){return this.getAnyAdaptersInstanceOf(p.default)},e}();t.default=d},function(e,t,o){"use strict";function n(){}t.__esModule=!0,n.__adapter__="ICryptoAdapter",t.default=n},function(e,t,o){"use strict";function n(){}t.__esModule=!0,n.__adapter__="IRequestAdapter",t.default=n},function(e,t,o){"use strict";function n(){}t.__esModule=!0,n.__adapter__="ICacheAdapter",t.default=n},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,o){var n=e[t];e[t]=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];var i=n.bind.apply(n,[this].concat(t));return o(i,this,t).apply(this,t)}}function i(e){function t(r){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a=Object.getOwnPropertyNames(r).filter(function(t){return r[t].client===e}),s=Object.getPrototypeOf(r),u=Object.keys(s).filter(function(e){return"function"==typeof s[e]&&0!==e.indexOf("_")});(i.length||o)&&u.forEach(function(e){n.push({namespace:i.join("."),name:e,api:r})}),a.forEach(function(e){t(r[e],i.concat(e))})}var o=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=[];return t(e),n}t.__esModule=!0;var a,s,u=(s=a=function(){function e(){n(this,e)}return e.prototype.onClientReady=function(e){var t=this;i(e).forEach(function(e){r(e.api,e.name,function(o){var n={api:e.api,namespace:e.namespace,name:e.name,displayName:e.namespace+"."+e.name};return t.onMethodBefore(n),function(){var e=void 0;try{e=o()}catch(e){throw n.error=e,t.onMethodThrown(n),e}finally{n.value=e,t.onMethodAfter(n),e&&"function"==typeof e.then&&e.then(function(e){n.resolved=e,t.onMethodResolve(n)},function(e){n.rejected=e,t.onMethodReject(n)}).then(function(){t.onMethodFinally(n)})}return e}})}),e.on("experimental.request.before",function(e){return t.onRequestBefore(e.data)}),e.on("experimental.request.after",function(e){return t.onRequestAfter(e.data)}),e.on("error.response",function(e){return t.onRequestReject(e.data)}),e.on("error.throttled",function(e){return t.onRequestThrottled(e.data)}),e.on("experimental.request.retry",function(e){return t.onRequestRetry(e.data)}),e.on("error.unauthorized",function(e){return t.onRequestUnauthorized(e.data)}),e.on("error.deprecated",function(e){return t.onRequestDeprecated(e.data)}),e.on("experimental.request.resolve",function(e){return t.onRequestResolve(e.data)}),e.on("experimental.request.finally",function(e){return t.onRequestFinally(e.data)})},e.prototype.onMethodBefore=function(){},e.prototype.onMethodAfter=function(){},e.prototype.onMethodReject=function(){},e.prototype.onMethodResolve=function(){},e.prototype.onMethodFinally=function(){},e.prototype.onMethodThrown=function(){},e.prototype.onRequestBefore=function(){},e.prototype.onRequestAfter=function(){},e.prototype.onRequestReject=function(){},e.prototype.onRequestThrottled=function(){},e.prototype.onRequestRetry=function(){},e.prototype.onRequestUnauthorized=function(){},e.prototype.onRequestDeprecated=function(){},e.prototype.onRequestResolve=function(){},e.prototype.onRequestFinally=function(){},e}(),a.__adapter__="IEnhancementAdapter",s);t.default=u},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=function(){function e(t){n(this,e),this.client=t}return e.prototype.auto=function(e,t){var o=this.client.adapters.getCacheAdapter(),n=function(){};return o?(n=function(t){void 0!==t&&o.set(e,t)},o.get(e).catch(function(){return Promise.resolve(t(n)).then(function(e){return n(e),e})})):Promise.resolve(t(n))},e}();t.default=r},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},a=o(39),s=n(a),u=o(15),f=n(u),c=o(16),l=n(c),p=o(2),d=function(){function e(t,o){if(r(this,e),this.name=t,this.endpoint=s.default[t],!this.endpoint)throw new Error('Unknown request endpoint "'+t+'".');this.params={},this.addParams(o),this.headers={}}return e.prototype.addHeaders=function(e){return this.headers=i({},this.headers,e),this},e.prototype.addHeader=function(e,t){return this.headers[e]=t,this},e.prototype.addParams=function(e){return this.params=i({},this.params,e),this},e.prototype.addParam=function(e,t){this.params[e]=t},e.prototype.getPath=function(){var e=this,t=this.endpoint,o=t.path,n=t.chain,r=t.trailing,i=o;return n&&n.forEach(function(t){"/"!==i[i.length-1]&&(i+="/"),i+=e.params[t]}),r&&"/"!==i[i.length-1]&&(i+="/"),i},e.prototype.getQuery=function(){var e=this,t=this.endpoint.query;if(t){var o=t.map(function(t){return void 0!==e.params[t]?t+"="+encodeURIComponent(e.params[t]):null}).filter(Boolean).join("&");if(o)return"?"+o}return""},e.prototype.getHeaders=function(){var e,t=i({},this.headers,(e={},e[p.SDK_VERSION_HEADER]=l.default,e));if("POST"===this.endpoint.method)switch(this.endpoint.version){case 2:t["Content-Type"]="application/json";break;case 1:default:t["Content-Type"]="application/x-www-form-urlencoded"}return t},e.prototype.getBody=function(){var e=this,t=this.endpoint;if(t.body){if("string"==typeof t.body){var o=this.params[t.body];return o=(0,f.default)(o)?JSON.stringify(o):String(o)}var n=!0===t.body?Object.keys(this.params):t.body,r={};switch(n.forEach(function(t){var o=e.params[t];void 0!==o&&(r[t]=o)}),t.version){case 2:return JSON.stringify(r);case 1:default:return Object.keys(r).map(function(t){return t+"="+encodeURIComponent(e.params[t])}).join("&")}}return null},e.prototype.getMethod=function(){return(this.endpoint.method||"GET").toUpperCase()},e.prototype.isWithCredentials=function(){return!0===this.endpoint.credentials},e.prototype.build=function(){return{method:this.getMethod(),path:this.getPath(),query:this.getQuery(),body:this.getBody(),headers:this.getHeaders(),credentials:this.isWithCredentials()}},e}();t.default=d},function(e,t){e.exports={"accounts.register":{method:"POST",path:"/api/users/register",body:["email","password","privateKey","publicKey"],anonymous:!0},"accounts.login":{method:"POST",path:"/api/users/login",body:["email","password"],anonymous:!0},"accounts.generate-activation-code":{method:"GET",path:"/api/users/auth/generate",chain:["userId"],trailing:!0},"accounts.activate":{method:"POST",path:"/api/users/auth/activate",body:["userId","authCode"],trailing:!0},"accounts.logout":{method:"GET",path:"/api/users/logout"},"profile.upload-avatar":{method:"POST",path:"/api/media/file/avatar",body:["uploadedImage"]},"profile.change-password":{method:"POST",path:"/api/users/changepassword",body:["oldPassword","newPassword","newPrivateKey"],trailing:!0},"dashboard.inbox":{method:"GET",path:"/api/proofs/dashboard/proofin",trailing:!0},"dashboard.sent":{method:"GET",path:"/api/proofs/dashboard/proofout",trailing:!0},"dashboard.outbox":{method:"GET",path:"/api/proofs/dashboard/proofoutbox",trailing:!0},"dashboard.search":{method:"POST",path:"/api/proofs/search",body:["query","all","filterBy"]},"users.by-id":{method:"GET",path:"/api/users",chain:["userId"]},"users.by-email":{method:"POST",path:"/api/users/email",body:["email"],trailing:!0},"users.invite":{method:"POST",path:"/api/users/create",body:["email"]},"proofs.create":{method:"POST",path:"/api/proofs/create",body:["title","dueDate","description","groupId"]},"proofs.normalize-workflow":{method:"POST",path:"/api/proofs/permission/check",body:["proofId","workflowId"]},"proofs.set-workflow":{method:"POST",path:"/api/proofs/update",body:["proofId","workflowId"]},"proofs.set-tags":{method:"POST",path:"/api/tags/create",body:["relatedId","tag"]},"proofs.set-file":{method:"POST",path:"/api/proofs/update",body:["proofId","fileId"]},"proofs.distribute-file":{method:"GET",path:"/api/proofs/distribute",chain:["proofId"],trailing:!0},"proofs.archive":{method:"GET",path:"/api/proofs/close",chain:["proofId"],trailing:!0},"proofs.unarchive":{method:"GET",path:"/api/proofs/reopen",chain:["proofId"],trailing:!0},"proofs.delete":{method:"GET",path:"/api/proofs/delete",chain:["proofId"],trailing:!0},"proofs.start":{method:"POST",path:"/api/proofs/startworkflow",body:["proofId"],trailing:!0},"proofs.editors.add":{version:2,method:"POST",path:"/api/proofs/editor/add",body:["proofId","editors","editorMessage"]},"proofs.editors.remove":{version:2,method:"POST",path:"/api/proofs/editor/remove",body:["proofId","editors"]},"proofs.editors.replace":{version:2,method:"POST",path:"/api/proofs/editor/replace",body:["proofId","oldEditors","newEditors"]},"proofs.editors.set":{version:2,method:"POST",path:"/api/proofs/editor/set",body:["proofId","editors"]},"briefs.start":{method:"POST",path:"/api/briefs/start",body:["briefId"]},"proofs.return":{method:"GET",path:"/api/proofs/returnproof",chain:["proofId"]},"proofs.groups.create":{method:"POST",path:"/api/proofs/groups/create",body:["name"]},"proofs.groups.update":{method:"POST",path:"/api/proofs/groups/update",body:["groupId","name"]},"proofs.groups.load":{method:"GET",path:"/api/proofs/group",chain:["groupId"]},"proofs.groups.ready":{method:"POST",path:"/api/proofs/groups/ready",body:["groupId"]},"proofs.groups.owners.add":{version:2,method:"POST",path:"/api/v2/proofs/owners/groups/add",body:["groupId","owners"]},"proofs.groups.workflows.add-reviewers":{version:2,method:"POST",path:"/api/v2/workflows/groups/reviewers/add",body:["groupId","reviewers"]},"proofs.versions.attach":{method:"POST",path:"/api/proofs/versions/create",body:["proofId","versionId"]},"proofs.versions.list":{method:"GET",path:"/api/proofs/versions",chain:["proofId"],trailing:!0},"proofs.load":{method:"GET",path:"/api/proofs/",chain:["proofId"],trailing:!0},"proofs.lock":{method:"GET",path:"/api/proofs/lock/",chain:["proofId"],trailing:!0},"proofs.unlock":{method:"GET",path:"/api/proofs/unlock/",chain:["proofId"],trailing:!0},"proofs.request-unlock":{method:"GET",path:"/api/proofs/unlockemail/",chain:["proofId"],trailing:!0},"files.generate-token":{method:"GET",path:"/api/media/getfiletoken",query:["relatedId","fileType"]},"files.upload-block":{method:"POST",path:"/api/media/file",query:["block","part","token"],body:"data"},"files.upload-complete":{method:"POST",path:"/api/media/file",query:["block","blockCount","part","token","extn","pages","filename","storeoriginal"],body:"envelope"},"files.details":{method:"GET",path:"/api/media/file/details",chain:["fileId"]},"files.download-block":{method:"GET",path:"/api/media/getfilechunk",chain:["proofId","fileId","block"]},"files.thumbnail":{method:"GET",path:"/api/media/getimage/thumb",chain:["fileId"]},"files.import.generic":{method:"POST",path:"/api/media/filedrive",body:["extn","filename","url","envelope","storeOriginal"]},"files.import.drive":{method:"POST",path:"/api/media/filedrive",body:["extn","filename","url","envelope","storeOriginal","accessToken"]},"files.import.onedrive":{method:"POST",path:"/api/media/fileonedrive",body:["extn","filename","url","envelope","storeOriginal","accessToken"]},"files.import.box":{method:"POST",path:"/api/media/filebox",body:["extn","filename","url","envelope","storeOriginal","accessToken"]},"files.import.dropbox":{method:"POST",path:"/api/media/filedropbox",body:["extn","filename","url","envelope","storeOriginal","accessToken"]},"workflows.create":{version:2,method:"POST",path:"/api/v2/workflows/create",body:["title"]},"workflows.load":{version:2,method:"GET",path:"/api/v2/workflows/detail",chain:["workflowId"]},"workflows.steps.add":{version:2,method:"POST",path:"/api/v2/workflows/steps/add",body:["workflowId","title","position"]},"workflows.steps.move-before":{method:"POST",path:"/api/workflows/step/movebefore",body:["stepId","beforeStepId"]},"workflows.steps.move-after":{method:"POST",path:"/api/workflows/step/moveafter",body:["stepId","afterStepId"]},"workflows.steps.swap":{method:"POST",path:"/api/workflows/step/swap",body:["stepId","swapStepId"]},"workflows.users.set":{version:2,method:"POST",path:"/api/v2/workflows/users/set",body:["workflowId","stepId","position","users"]},"workflows.users.update":{version:2,method:"POST",path:"/api/v2/workflows/users/update",body:["workflowId","stepId","userId","role","permissions"]},"workflows.users.add":{version:2,method:"POST",path:"/api/v2/workflows/users/add",body:["workflowId","stepId","users"]},"workflows.delete":{method:"POST",path:"/api/workflows/delete",body:["workflowId"]},"workflows.duplicate":{method:"POST",path:"/api/workflows/duplicateonly",body:["workflowId"]},"workflows.owned":{method:"GET",path:"/api/workflows",trailing:!0},"workflows.shared":{method:"GET",path:"/api/workflows/share/user",trailing:!0},"comments.load-all":{method:"POST",path:"/api/proofs/recent",body:["proofId","timestamp"]},"comments.load-page":{method:"POST",path:"/api/proofs/comment/recent",body:["proofId","timestamp","page"]},"comments.state.update":{method:"POST",path:"/api/proofs/comment/updatestatus",body:["commentId","change","done"]},"comments.create":{method:"POST",path:"/api/proofs/comment/create",body:["proofId","page","envelope","encryptedComment","xy","parent","mentions","metadata","creationToken","change","done"]},"proofs-owners.add":{version:2,method:"POST",path:"/api/v2/proofs/owners/add",body:["proofId","users"]},"proofs-owners.remove":{version:2,method:"POST",path:"/api/v2/proofs/owners/remove",body:["proofId","users"]},"proofs.tag-delete":{method:"POST",path:"/api/tags/delete",body:["relatedId","tag"]},"proofs.remove-editor":{method:"GET",path:"/api/proofs/deleteeditor",chain:["proofId"],trailing:!0},"briefs.create":{method:"POST",path:"/api/briefs/create",body:["title","messageToRecipient","dueDate","tag"]},"briefs.update":{method:"POST",path:"/api/briefs/update",body:["briefId","title","messageToRecipient","dueDate","tag","recipient","editorId","editorMessage"]},"admin.team.users.enabled":{method:"GET",path:"/api/admin/getusers/active",trailing:!0},"admin.team.users.disabled":{method:"GET",path:"/api/admin/getusers/inactive",trailing:!0},"admin.team.users.set-enabled":{method:"POST",path:"/api/admin/setenabled",body:["email","enabled"]},"sessions.check":{method:"GET",path:"/api/sessions/check"},"sso.get-public-key":{method:"GET",path:"/sso/public_key",anonymous:!0},"sso.get-session":{version:2,method:"POST",path:"/sso/session",body:["nonce"],anonymous:!0,credentials:!0},"sso.get-login-options":{version:2,method:"POST",path:"/sso/login_options",body:["email"],anonymous:!0}}},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=o(8),a=n(i),s=o(41),u=o(2),f=o(9),c=n(f),l=function(){function e(){r(this,e),this.error=!1,this.code=-1,this.data=null,this.message=null,this.deprecated=null}return e.parse=function(t){var o=t.status,n=t.headers,r=void 0===n?{}:n,i=t.body,f=new e;if(o===s.TOO_MANY_REQUESTS_STATUS)return f.error=!0,f.message="PageProof Error #h"+s.TOO_MANY_REQUESTS_STATUS,f.code=a.default.ERROR_THROTTLED,f.data={timeout:1e3*(parseFloat(r[u.RETRY_AFTER_HEADER])||60)},f;if((0,c.default)(r,"deprecated")&&(f.deprecated=r.deprecated),o===s.OK_STATUS&&!i)return f.code=a.default.OK,f;try{var l=JSON.parse(i);"string"==typeof l||(l&&"ResponseCode"in l?(f.code=l.ResponseCode,f.code!==a.default.OK&&(f.error=!0)):l.Message&&1===Object.keys(l).length&&(f.error=!0,f.code=a.default.ERROR_CRITICAL)),f.error&&(f.message="PageProof Error #s"+f.code),f.data=l}catch(e){f.error=!0}return f},e}();t.default=l},function(e,t,o){"use strict";t.__esModule=!0;t.TOO_MANY_REQUESTS_STATUS=429,t.OK_STATUS=200},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=o(0),u=n(s),f=o(6),c=n(f),l=o(43),p=n(l),d=function(e){function t(o){r(this,t);var n=i(this,e.call(this,o));return n.sso=new p.default(o),n}return a(t,e),t.prototype.register=function(e,t){var o=this;return this.client.crypto().generatePasswordHash(t).then(function(e){return Promise.all([e,o.client.crypto().generateKeyPair()])}).then(function(e){var n=e[0],r=e[1];return Promise.all([n,r,o.client.crypto().encryptPrivateKey(r.privateKeyPEM,t)])}).then(function(t){var n=t[0],r=t[1],i=t[2];return Promise.all([r,o.client.request("accounts.register",{email:e,password:n,privateKey:i,publicKey:r.publicKeyPEM})])}).then(function(n){var r=n[0];return Promise.all([r,o.login(e,t,!1)])}).then(function(e){var t=e[0],n=e[1];return Promise.all([t,n,o.generateActivationCode()])}).then(function(e){var t=e[0],o=e[1];return o.privateKeyPEM=t.privateKeyPEM,o})},t.prototype.generateActivationCode=function(){return this.client.request("accounts.generate-activation-code",{userId:this.client.session.userId})},t.prototype.activate=function(e){var t=this;return this.client.request("accounts.activate",{userId:this.client.session.userId,authCode:e}).then(function(){t.client.session.user.hasActivated=!0})},t.prototype.login=function(e,t){var o=this,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return this.client.crypto().generatePasswordHash(t).then(function(t){return o.client.request("accounts.login",{email:e,password:t})}).then(function(t){var o=(new c.default).fromSession(t.data);return o.user.email=e,o}).then(function(e){return n?o.client.crypto().decryptPrivateKey(e.privateKeyPEM$,t).then(function(t){return e.privateKeyPEM=t,e}):e}).then(function(e){return o.client.setSession(e),e})},t.prototype.logout=function(){var e=this;return this.client.request("accounts.logout").catch(function(t){return e.client.setSession(null),Promise.reject(t)}).then(function(){e.client.setSession(null)})},t}(u.default);t.default=d},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=o(0),u=n(s),f=o(6),c=n(f),l=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.getSession=function(){var e=this;return this.client.request("sso.get-public-key").then(function(e){return e.data.ServerPublicKey}).then(function(t){return e.client.crypto().generateWrappedSymmetricKey(t)}).then(function(t){var o=t.key,n=t.key$;return Promise.all([o,e.client.request("sso.get-session",{nonce:n})])}).then(function(t){var o=t[0],n=t[1],r=(new c.default).fromSession(n.data);return Promise.all([r,e.client.crypto().decryptManagedPrivateKey(r.privateKeyPEM$,o)])}).then(function(e){var t=e[0],o=e[1];return t.privateKeyPEM=o,t})},t.prototype.getLoginOptions=function(e){return this.client.request("sso.get-login-options",{email:e}).then(function(e){return e.data})},t}(u.default);t.default=l},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){var t={};return Object.keys(d).forEach(function(o){t[o]=e[d[o]]}),t}function u(e){return(e||[]).map(function(e){return(new p.default).fromProof(e)})}t.__esModule=!0;var f=o(0),c=n(f),l=o(4),p=n(l),d={inbox:"ProofIn",sent:"ProofOut",outbox:"ProofOutBox"},h=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.inbox=function(){return this._loadSingleTabProofs("inbox")},t.prototype.sent=function(){return this._loadSingleTabProofs("sent")},t.prototype.outbox=function(){return this._loadSingleTabProofs("outbox")},t.prototype._loadSingleTabProofs=function(e){return this.client.request("dashboard."+e).then(function(e){return s(e.data)}).then(function(t){return t[e]}).then(u)},t.prototype.search=function(e){return this._loadSearchProofs({query:e})},t.prototype.everything=function(){return this._loadSearchProofs({all:1})},t.prototype.approved=function(){return this._loadSearchProofs({filterBy:70})},t.prototype.archived=function(){return this._loadSearchProofs({filterBy:100})},t.prototype._loadSearchProofs=function(e){return this.client.request("dashboard.search",e).then(function(e){return u(e.data.Proofs)})},t}(c.default);t.default=h},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return e.data.length>0?(new p.default).fromUser(e.data[0]):(new p.default).fromUser(e.data)}function u(e){return e.data.length?(new p.default).fromUser(e.data[0]):null}t.__esModule=!0;var f=o(0),c=n(f),l=o(3),p=n(l),d=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.byEmail=function(e){return this.client.request("users.by-email",{email:e}).then(u)},t.prototype.byId=function(e){return this.client.request("users.by-id",{userId:e}).then(s)},t.prototype.invite=function(e){return this.client.request("users.invite",{email:e}).then(s)},t}(c.default);t.default=d},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=o(0),u=n(s),f=o(47),c=n(f),l=o(48),p=n(l),d=o(49),h=n(d),y=o(50),m=n(y),w=o(4),v=n(w),_=o(5),b=n(_),E=o(2),g=function(e){function t(o){r(this,t);var n=i(this,e.call(this,o));return n.owners=new c.default(o),n.editors=new p.default(o),n.versions=new h.default(o),n.groups=new m.default(o),n}return a(t,e),t.prototype.setWorkflow=function(e,t){var o=this;return this.client.request("proofs.normalize-workflow",{proofId:e,workflowId:t}).then(function(){return o.client.request("proofs.set-workflow",{proofId:e,workflowId:t})})},t.prototype.setTags=function(e,t){return this.client.request("proofs.set-tags",{relatedId:e,tag:t.join(",")})},t.prototype.deleteTag=function(e,t){return this.client.request("proofs.tag-delete",{relatedId:e,tag:t})},t.prototype.setFile=function(e,t){var o=this;return this.client.request("proofs.set-file",{proofId:e,fileId:t}).then(function(){return o.client.request("proofs.distribute-file",{proofId:e})})},t.prototype.create=function(e){var t=this,o=e.name,n=e.tags,r=void 0===n?[]:n,i=e.dueDate,a=void 0===i?new Date(Date.now()+3*E.DAY_IN_MS):i,s=e.messageToReviewers,u=e.workflow,f=e.file,c=e.group,l=e.start,p=void 0===l||l,d=p&&!c;return this.client.request("proofs.create",{title:o,dueDate:a.toISOString(),description:s,groupId:c?c.id:void 0}).then(function(e){var o=(new v.default).fromProof(e.data);return Promise.all([o,r.length&&t.setTags(o.id,r),u&&t.setWorkflow(o.id,u.id),f&&t.setFile(o.id,f.id)])}).then(function(e){var o=e[0];return Promise.resolve(d&&t.start(o.id)).then(function(){return o})}).then(function(e){return u&&(e.workflowId=u.id),f&&(e.fileId=f.id,e.fileStatus=b.default.UPLOADING),e.calculateState(),e})},t.prototype.archive=function(e){return this.client.request("proofs.archive",{proofId:e})},t.prototype.unarchive=function(e){return this.client.request("proofs.unarchive",{proofId:e})},t.prototype.delete=function(e){return this.client.request("proofs.delete",{proofId:e})},t.prototype.return=function(e){return this.client.request("proofs.return",{proofId:e})},t.prototype.start=function(e){return this.client.request("proofs.start",{proofId:e})},t.prototype.removeEditor=function(e){return this.client.request("proofs.remove-editor",{proofId:e})},t.prototype.load=function(e){return this.client.request("proofs.load",{proofId:e}).then(function(e){return(new v.default).fromProof(e.data)})},t.prototype.lock=function(e){return this.client.request("proofs.lock",{proofId:e})},t.prototype.unlock=function(e){return this.client.request("proofs.unlock",{proofId:e})},t.prototype.requestUnlock=function(e){return this.client.request("proofs.request-unlock",{proofId:e})},t}(u.default);t.default=g},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=o(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),r(this,e.apply(this,arguments))}return i(t,e),t.prototype.add=function(e,t){return this.client.request("proofs-owners.add",{proofId:e,users:[].concat(t)})},t.prototype.remove=function(e,t){return this.client.request("proofs-owners.remove",{proofId:e,users:[].concat(t)})},t}(s.default);t.default=u},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=o(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),r(this,e.apply(this,arguments))}return i(t,e),t.prototype.add=function(e,t,o){var n={proofId:e,editors:[].concat(t),editorMessage:null===o?"":o};return this.client.request("proofs.editors.add",n)},t.prototype.remove=function(e,t){return this.client.request("proofs.editors.remove",{proofId:e,editors:[].concat(t)})},t.prototype.replace=function(e,t,o){return this.client.request("proofs.editors.replace",{proofId:e,oldEditors:[].concat(t),newEditors:[].concat(o)})},t.prototype.set=function(e,t){return this.client.request("proofs.editors.set",{proofId:e,editors:[].concat(t)})},t}(s.default);t.default=u},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=o(0),u=n(s),f=o(20),c=n(f),l=o(21),p=(0,l.sortObjectsByKey)("version"),d=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.attach=function(e,t){return this.client.request("proofs.versions.attach",{proofId:e,versionId:t})},t.prototype.list=function(e){return this.client.request("proofs.versions.list",{proofId:e}).then(function(e){return e.data.map(function(e){return(new c.default).fromProofVersion(e)}).sort(p)})},t}(u.default);t.default=d},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return(new l.default).fromProofGroup(e.data)}t.__esModule=!0;var u=o(0),f=n(u),c=o(22),l=n(c),p=o(51),d=n(p),h=o(52),y=n(h),m=function(e){function t(o){r(this,t);var n=i(this,e.call(this,o));return n.owners=new d.default(o),n.workflows=new y.default(o),n}return a(t,e),t.prototype.create=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.name;return this.client.request("proofs.groups.create",{name:t}).then(s)},t.prototype.load=function(e){return this.client.request("proofs.groups.load",{groupId:e}).then(s)},t.prototype.ready=function(e){return this.client.request("proofs.groups.ready",{groupId:e})},t.prototype.update=function(e,t){var o=t.name;return this.client.request("proofs.groups.update",{groupId:e,name:o}).then(s)},t}(f.default);t.default=m},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=o(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),r(this,e.apply(this,arguments))}return i(t,e),t.prototype.add=function(e,t){return this.client.request("proofs.groups.owners.add",{groupId:e,owners:[].concat(t)})},t}(s.default);t.default=u},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=o(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),r(this,e.apply(this,arguments))}return i(t,e),t.prototype.addReviewers=function(e,t){return this.client.request("proofs.groups.workflows.add-reviewers",{groupId:e,reviewers:[].concat(t)})},t}(s.default);t.default=u},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=o(0),u=n(s),f=o(4),c=n(f),l=o(5),p=n(l),d=o(2),h=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.setTags=function(e,t){return this.client.request("proofs.set-tags",{relatedId:e,tag:t.join(",")})},t.prototype.deleteTag=function(e,t){return this.client.request("proofs.tag-delete",{relatedId:e,tag:t})},t.prototype.setFile=function(e,t){var o=this;return this.client.request("proofs.set-file",{proofId:e,fileId:t}).then(function(){return o.client.request("proofs.distribute-file",{proofId:e})})},t.prototype.create=function(e){var t=this,o=e.name,n=e.file,r=e.tags,i=void 0===r?[]:r,a=e.dueDate,s=void 0===a?new Date(Date.now()+3*d.DAY_IN_MS):a;return this.client.request("briefs.create",{title:o,messageToRecipient:"",dueDate:s.toISOString(),tag:i.join(",")}).then(function(e){var o=(new c.default).fromProof(e.data.Brief);return Promise.all([o,n&&t.setFile(o.id,n.id)])}).then(function(e){var t=e[0];return n&&(t.fileId=n.id,t.fileStatus=p.default.UPLOADING),t.calculateState(),t})},t.prototype.update=function(e){var t=this,o=e.briefId,n=e.data,r=e.start,i=void 0!==r&&r;return this.client.request("briefs.update",{briefId:o,title:n.title,messageToRecipient:n.messageToRecipient,dueDate:n.dueDate?n.dueDate.toISOString():"",tag:n.tags?n.tags.join(","):"",recipient:n.recipient,editorId:n.editorId,editorMessage:n.editorMessage}).then(function(e){return(new c.default).fromProof(e.data.Brief)}).then(function(e){return Promise.resolve(i&&t.start(e.id)).then(function(){return e})})},t.prototype.delete=function(e){return this.client.request("proofs.delete",{proofId:e})},t.prototype.start=function(e){return this.client.request("briefs.start",{briefId:e})},t}(u.default);t.default=h},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){var t=e.lastIndexOf(".");return{name:e.substring(0,t),extension:e.substring(t+1)}}t.__esModule=!0;var u=o(0),f=n(u),c=o(10),l=n(c),p=o(5),d=n(p),h=o(23),y=n(h),m=o(55),w=n(m),v=o(7),_=n(v),b=o(60),E=n(b),g=o(2),O=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.generateToken=function(e,t){return e&&!t?Promise.reject(Error('The "assignedType" option is required when specifying the "assignedTo" option.')):!e&&t?Promise.reject(Error('The "assignedTo" option is required when specifying the "assignedType" option.')):this.client.request("files.generate-token",{relatedId:e,fileType:t}).then(function(e){return e.data.Token})},t.prototype._waitFileProcessed=function(e){var t=this;return new Promise(function(o,n){var r=null,i=null;!function a(){t.details(e).then(function(t){switch(r=null,t.status){case d.default.OK:o(t);break;case d.default.ERROR:n(new Error("File "+e+" encountered a processing error: "+t.message));break;default:r=setTimeout(a,5e3)}r&&t.status!==d.default.RIPPING||clearTimeout(i)}).catch(n)}(),i=setTimeout(function(){clearTimeout(r),n(new Error("File did not finish processing within specified duration."))},3e4)})},t.prototype.import=function(e){var t=this,o=e.name,n=e.url,r=e.provider,i=void 0===r?y.default.NONE:r,a=e.auth,u=e.download,f=void 0!==u&&u,c=e.process,p=void 0!==c&&c;if(!Object.keys(y.default).some(function(e){return y.default[e]===i}))return Promise.reject(new Error('Unsupported provider "'+i+'"'));var d=i;i===y.default.NONE&&(d="generic");var h=s(o),m=h.name,w=h.extension;return this._generateKeyIVEnvelope().then(function(e){var o=e.envelope;return t.client.request("files.import."+d,{extn:w,filename:m,url:n,envelope:o,accessToken:a,storeOriginal:f})}).then(function(e){return e.data}).then(function(e){if(p)return t._waitFileProcessed(e);var o=new l.default;return o.id=e,o})},t.prototype._generateKeyIVEnvelope=function(){var e=this;return this.client.crypto().generateKeyIV().then(function(t){return Promise.all([t,e.client.crypto().envelopeSeal(t.keyIV,[e.client.session.serverPublicKeyPEM,e.client.session.publicKeyPEM])])}).then(function(e){return{keyIV:e[0],envelope:e[1]}})},t.prototype.upload=function(e){var t=this,o=e.name,n=e.contents,r=e.assignedTo,i=e.assignedType,a=e.download,s=void 0!==a&&a,u=e.async,f=void 0===u||u,c=e.onProgress,p=e.onError;return this.generateToken(r,i).then(function(e){return Promise.all([e,t._generateKeyIVEnvelope()])}).then(function(e){var r=e[0],i=e[1],a=i.keyIV,u=i.envelope,l=t._upload({name:o,contents:n,download:s,token:r,keyIV:a,envelope:u,onProgress:c,onError:p});return f&&(l=Promise.resolve()),l.then(function(){return r})}).then(function(e){var t=new l.default;return t.id=e,t})},t.prototype._upload=function(e){var t=this,o=e.name,n=e.contents,r=e.download,i=e.token,a=e.keyIV,u=e.envelope,f=e.onProgress;return new Promise(function(e){function c(){y().then(function(t){if(!_)if(null===t)_=!0,e(m.then(T));else{var o=I(t,v++);m=m.then(function(){return o}),o.then(c)}})}var l=4,p=s(o),d=p.name,h=p.extension,y=(0,w.default)(n),m=Promise.resolve(),v=0,_=!1,b=Math.ceil((0,E.default)(n)/g.BYTES_PER_BLOCK),O=new Array(b),P=function(){};f&&(P=function(e,t){O[e]=Math.max(t,O[e]||0),f(O.reduce(function(e,t){return e+(t||0)},0)/b*.99)});for(var I=function(e,o){return t.client.crypto().encryptFileBlock(a,e).then(function(e){return t.client.request("files.upload-block",{block:o,part:1,token:i,data:e},{onUploadProgress:P.bind(null,o)})})},T=function(){return t.client.request("files.upload-complete",{block:0,blockCount:v,part:0,token:i,extn:h,pages:1,filename:d,storeoriginal:r?1:0,envelope:u}).then(function(){return f&&f(100)})};l--;)c()})},t.prototype.download=function(e){var t=this,o="string"==typeof e?{fileId:e}:e,n=o.fileId,r=o.onFileDetails;return this.details(n).then(function(e){if(!e.downloadable)throw new Error("File "+n+" is not downloadable.");if(e.status!==d.default.OK)throw new Error("File "+n+" cannot be download. The file may still be uploading, processing or has errored.");if(!e.blocks)throw new Error("File "+n+" is empty.");return r&&r(e),t._downloadFile(e,o)})},t.prototype._downloadFile=function(e,t){var o=this;return new Promise(function(n){function r(){if(!y)if(h<u.length){var e=h++,t=d(e);f=f.then(function(){return t.then(function(t){return c(t,e,s)})}),t.then(r)}else y=!0,n(f.then(m))}var i=4,a=new _.default,s=e.blocks,u=new Array(s),f=Promise.resolve(),c=t.onData||function(e,t){u[t]=e},l=function(){};if(t.onProgress){var p=new Array(s);l=function(e,o){p[e]=Math.max(o,p[e]||0),t.onProgress(p.reduce(function(e,t){return e+(t||0)},0)/s*.99)}}for(var d=function(t){return o.client.request("files.download-block",{proofId:e.assignedTo,fileId:e.id,block:t+1},{onDownloadProgress:l.bind(null,t)}).then(function(e){return o.client.crypto().decryptFileBlock(e.data,o.client.session.privateKeyPEM).then(function(e){return a.createBase64(e)})})},h=0,y=!1,m=function(){return t.onProgress&&t.onProgress(100),t.onData?null:a.combine.apply(a,u)};i--;)r()})},t.prototype.details=function(e){return this.client.request("files.details",{fileId:e}).then(function(e){return(new l.default).fromFile(e.data)})},t.prototype.thumbnail=function(e){var t=this;return this.client.cache.auto(g.THUMBNAIL_CACHE_PREFIX+e,function(){return t._thumbnail(e)})},t.prototype._thumbnail=function(e){var t=this;return this.client.request("files.thumbnail",{fileId:e}).then(function(e){return t.client.crypto().decryptImage(e.data,t.client.session.privateKeyPEM)}).then(function(e){return(new _.default).createBase64(e)})},t.prototype.thumbnails=function(e,t){var o=this,n=t.async,r=void 0!==n&&n,i=t.onLoadThumbnails,a=[];return Promise.all(e.map(function(e){return o.client.cache.auto(g.THUMBNAIL_CACHE_PREFIX+e,function(t){a.push({fileId:e,resolve:t})}).then(function(t){var o;return t&&(o={},o[e]=t,o)})})).then(function(e){var t=Promise.all(a.map(function(e){var t=e.fileId,n=e.resolve;return o._thumbnail(t).then(function(e){if(n(e),r){var o;i((o={},o[t]=e,o))}return e})}));return r?e:t.then(function(t){return[].concat(e,t)})}).then(function(e){return Object.assign.apply(Object,[{}].concat(e))})},t}(f.default);t.default=O},function(e,t,o){"use strict";function n(e){var t=new a.default,o=0,n=Promise.resolve(),i=t.size(e);return function(){var a=o++*r.BYTES_PER_BLOCK,s=a+r.BYTES_PER_BLOCK;return n=n.then(function(){return a>i?null:t.slice(e,a,s).then(t.readBase64).then(function(e){return"data:;base64,"+e})})}}t.__esModule=!0;var r=o(2),i=o(7),a=function(e){return e&&e.__esModule?e:{default:e}}(i);t.default=n},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e){for(var t=new ArrayBuffer(e.length),o=new Uint8Array(t),n=0;n<e.length;n++)o[n]=e.charCodeAt(n);return t}t.__esModule=!0;var i=function(){function e(){n(this,e)}return e.prototype.create=function(e){return Promise.resolve(new Blob([r(e)]))},e.prototype.createBase64=function(e){return this.create(atob(e))},e.prototype.combine=function(){for(var e=arguments.length,t=Array(e),o=0;o<e;o++)t[o]=arguments[o];return Promise.resolve(new Blob(t))},e.prototype.slice=function(e,t,o){return Promise.resolve(e.slice(t,o))},e.prototype.read=function(e){return new Promise(function(t,o){var n=new FileReader;n.onload=function(){t(n.result)},n.onerror=function(){o(n.error)},n.readAsText(e)})},e.prototype.readBase64=function(e){return new Promise(function(t,o){var n=new FileReader;n.onload=function(){var e=n.result;t(e.substring(e.indexOf(",")+1))},n.onerror=function(){o(n.error)},n.readAsDataURL(e)})},e.prototype.size=function(e){return e.size},e}();t.default=i},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=function(){function e(){n(this,e)}return e.prototype.create=function(e){return Promise.resolve(Buffer.from(e))},e.prototype.createBase64=function(e){return Promise.resolve(Buffer.from(e,"base64"))},e.prototype.combine=function(){for(var e=arguments.length,t=Array(e),o=0;o<e;o++)t[o]=arguments[o];return Promise.resolve(Buffer.concat(t))},e.prototype.slice=function(e,t,o){return Promise.resolve(e.slice(t,o))},e.prototype.read=function(e){return Promise.resolve(e.toString())},e.prototype.readBase64=function(e){return Promise.resolve(e.toString("base64"))},e.prototype.size=function(e){return Buffer.byteLength(e)},e}();t.default=r},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e){for(var t=e.length,o=e.length-1;o>=0;o--){var n=e.charCodeAt(o);n>127&&n<=2047?t++:n>2047&&n<=65535&&(t+=2),n>=56320&&n<=57343&&o--}return t}t.__esModule=!0;var i=o(59),a=function(){function e(){n(this,e)}return e.prototype.create=function(e){return Promise.resolve(e)},e.prototype.createBase64=function(e){return Promise.resolve((0,i.atob)(e))},e.prototype.combine=function(){for(var e=arguments.length,t=Array(e),o=0;o<e;o++)t[o]=arguments[o];return Promise.resolve(t.join(""))},e.prototype.slice=function(e,t,o){return Promise.resolve(e.slice(t,o))},e.prototype.read=function(e){return Promise.resolve(e)},e.prototype.readBase64=function(e){return Promise.resolve((0,i.btoa)(e))},e.prototype.size=function(e){return r(e)},e}();t.default=a},function(e,t,o){!function(){function e(e){this.message=e}var o=t,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.prototype=new Error,e.prototype.name="InvalidCharacterError",o.btoa||(o.btoa=function(t){for(var o,r,i=String(t),a=0,s=n,u="";i.charAt(0|a)||(s="=",a%1);u+=s.charAt(63&o>>8-a%1*8)){if((r=i.charCodeAt(a+=.75))>255)throw new e("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");o=o<<8|r}return u}),o.atob||(o.atob=function(t){var o=String(t).replace(/[=]+$/,"");if(o.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,i,a=0,s=0,u="";i=o.charAt(s++);~i&&(r=a%4?64*r+i:i,a++%4)?u+=String.fromCharCode(255&r>>(-2*a&6)):0)i=n.indexOf(i);return u})}()},function(e,t,o){"use strict";function n(e){return"undefined"!=typeof Blob&&e instanceof Blob?e.size:0}t.__esModule=!0,t.default=n},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=o(0),u=n(s),f=o(62),c=n(f),l=function(e){function t(o){r(this,t);var n=i(this,e.call(this,o));return n.team=new c.default(o),n}return a(t,e),t}(u.default);t.default=l},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=o(0),u=n(s),f=o(63),c=n(f),l=function(e){function t(o){r(this,t);var n=i(this,e.call(this,o));return n.users=new c.default(o),n}return a(t,e),t}(u.default);t.default=l},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return e.data.map(function(e){return(new l.default).fromUser(e)})}t.__esModule=!0;var u=o(0),f=n(u),c=o(3),l=n(c),p=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.enabled=function(){return this.client.request("admin.team.users.enabled").then(s)},t.prototype.disabled=function(){return this.client.request("admin.team.users.disabled").then(s)},t.prototype._setEnabled=function(e,t){return this.client.request("admin.team.users.set-enabled",{email:e,enabled:t})},t.prototype.enable=function(e){return this._setEnabled(e,!0)},t.prototype.disable=function(e){return this._setEnabled(e,!1)},t}(f.default);t.default=p},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return e&&((0,w.isUserId)(e.id)||e.email)}function u(e){return(e||[]).map(function(e){return(new p.default).fromWorkflow(e)})}t.__esModule=!0;var f=o(0),c=n(f),l=o(24),p=n(l),d=o(12),h=n(d),y=o(13),m=n(y),w=o(19),v=o(65),_=n(v),b=function(e){function t(o){r(this,t);var n=i(this,e.call(this,o));return n.steps=new _.default(o),n}return a(t,e),t.prototype.create=function(e){var t=this,o=e.save,n=void 0!==o&&o,r=e.name,i=e.steps,a=void 0===i?[]:i,u=e.reviewers,f=e.approver;if(!s(f))return Promise.reject(Error("An approver is required to create a workflow."));if(n&&!r)return Promise.reject(Error("A workflow must have a name when saving it as a workflow template."));var c=a;u&&u.length&&c.splice(0,0,{users:u}),f&&c.push({position:1e3,users:[f]});for(var l=0,p=0;p<c.length;p++){var d=c[p];if(!d.users||!d.users.length)return Promise.reject(Error("Workflow steps must contain users."));(!d.position||d.position<l)&&(d.position=l+1),l=Math.max(l,d.position);for(var h=0;h<d.users.length;h++){if(!s(d.users[h]))return Promise.reject(Error("A user id or email address must be provided for a workflow user."))}}var y=void 0;return this._createWorkflow(r).then(function(e){return y=e.id,Promise.all([e,Promise.all(c.map(function(o){var n=e.getStepByPosition(o.position);return n?t._setWorkflowStepUsersMutate(e.id,n,o.users):t._addWorkflowStepAndUsers(e.id,o)}))])}).then(function(e){var t=e[0],o=e[1];return t.steps=o,t}).then(function(e){return n?t._duplicateWorkflow(y):e}).catch(function(e){return Promise.resolve(y&&t._deleteWorkflow(y)).then(function(){return Promise.reject(e)})})},t.prototype.load=function(e){return this.client.request("workflows.load",{workflowId:e}).then(function(e){return(new p.default).fromWorkflow(e.data)})},t.prototype.use=function(e){return this.duplicate(e)},t.prototype.duplicate=function(e){return this._duplicateWorkflow(e)},t.prototype.delete=function(e){return this._deleteWorkflow(e)},t.prototype.all=function(){return Promise.all([this.owned(),this.shared()]).then(function(e){return[].concat(e[0],e[1])})},t.prototype.owned=function(){return this.client.request("workflows.owned").then(function(e){return u(e.data)})},t.prototype.shared=function(){return this.client.request("workflows.shared").then(function(e){return u(e.data)})},t.prototype.setApprover=function(e,t){return this.client.request("workflows.users.set",{workflowId:e,position:1e3,users:[t]})},t.prototype._duplicateWorkflow=function(e){var t=this;return this.client.request("workflows.duplicate",{workflowId:e}).then(function(e){var o=e.data.WorkflowId;return t.load(o)})},t.prototype._deleteWorkflow=function(e){return this.client.request("workflows.delete",{workflowId:e})},t.prototype._createWorkflow=function(e){return this.client.request("workflows.create",{title:e}).then(function(e){return(new p.default).fromWorkflow(e.data)})},t.prototype._addWorkflowStepAndUsers=function(e,t){var o=this;return this.client.request("workflows.steps.add",{workflowId:e,title:t.name,position:t.position}).then(function(n){var r=(new h.default).fromWorkflowStep(n.data);return o._setWorkflowStepUsersMutate(e,r,t.users)})},t.prototype._setWorkflowStepUsersMutate=function(e,t,o){return this.client.request("workflows.users.set",{workflowId:e,stepId:t.id,users:o.map(function(e){return{email:e.email,userId:e.id,role:e.role,permissions:e.permissions&&{inviter:!!e.permissions.inviter}}})}).then(function(e){var o=e.data.map(function(e){return(new m.default).fromWorkflowUser(e)});return t.users=o,t})},t}(c.default);t.default=b},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=o(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),r(this,e.apply(this,arguments))}return i(t,e),t.prototype.moveBefore=function(e,t){return this.client.request("workflows.steps.move-before",{stepId:e,beforeStepId:t})},t.prototype.moveAfter=function(e,t){return this.client.request("workflows.steps.move-after",{stepId:e,afterStepId:t})},t.prototype.swap=function(e,t){return this.client.request("workflows.steps.swap",{stepId:e,swapStepId:t})},t}(s.default);t.default=u},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){var t=[];return Object.keys(e).forEach(function(o){e[o].Comments.forEach(function(e){t.push(e)})}),t}function u(e){var t=[],o=[];e.forEach(function(e){var n=(new p.default).fromComment(e);n.parentCommentId?o.push(n):t.push(n)}),t.sort(P);var n=t.map(function(e){return e.id}),r=(0,m.sortObjectsBy)(function(e){return n.indexOf(e.parentCommentId)},!0);return o.sort((0,m.combineSort)(I,r)),t.concat(o)}t.__esModule=!0;var f=o(0),c=n(f),l=o(27),p=n(l),d=o(14),h=n(d),y=o(2),m=o(21),w=o(29),v=o(68),_=o(69),b=n(_),E=(0,m.sortObjectsByKey)("pageNumber"),g=(0,m.sortObjectsByKey)("createdDate",!0),O=(0,m.sortObjectsByKey)("createdDate",!1),P=(0,m.combineSort)(E,g),I=(0,m.combineSort)(E,O),T=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype._mark=function(e,t,o){var n,r=void 0;switch(t){case h.default.TODO:r="change";break;case h.default.DONE:r="done";break;default:throw new Error('Cannot mark comment state "'+t+'".')}var i=(n={commentId:e},n[r]=o?1:0,n);return this.client.request("comments.state.update",i).then(function(){return null})},t.prototype.mark=function(e,t){return this._mark(e,t,!0)},t.prototype.unmark=function(e,t){return this._mark(e,t,!1)},t.prototype.load=function(e){var t=this,o="string"==typeof e?{proofId:e}:e,n=o.proofId,r=o.pageNumber,i=void 0===r?null:r,a=o.sinceDate,f=void 0===a?null:a,c=o.async,l=void 0!==c&&c,p=o.decrypt,d=void 0===p||p,h=o.onDecryptComment,m=o.onDecryptComments,w=o.onDecryptCommentsThrottleMs,v=void 0===w?1e3:w,_=o.onDecryptError,E=f?f.toISOString().match(y.ISO_REGEX)[0]:y.DEFAULT_ISO_DATE,g={proofId:n,page:i,timestamp:E};return this.client.request(null!==i?"comments.load-page":"comments.load-all",g).then(function(e){var o=u(e.data.Pages?s(e.data.Pages):e.data),n=Promise.resolve();if(d){var r=[],i=[],a=m?(0,b.default)(function(){i.length&&(m(i),i=[])},v):function(){},f=Promise.all(o.map(function(e){return t.client.cache.auto(y.COMMENT_CACHE_PREFIX+e.comment$,function(t){r.push({comment:e,resolve:t})}).then(function(t){return t&&e.fromRawComment(t),e})}));n=n.then(function(){return f}),n=n.then(function(){var e=r.map(function(e){var o=e.comment,n=e.resolve;return t.client.crypto().decryptComment(o.comment$,o.envelope,t.client.session.privateKeyPEM).then(function(e){o.fromRawComment(e),n(e),h&&h(o),i.push(o),a()}).catch(function(e){if(_&&_(e,o),!l)return Promise.reject(e)})});return l?null:Promise.all(e)})}return n.then(function(){return o})})},t.prototype.create=function(e){var t=this,o=e.raw,n=e.proofId,r=e.pageNumber,i=void 0===r?1:r,a=e.pin,s=e.mediaTime,u=e.mediaDuration,f=e.parentCommentId,c=e.metadata,l=e.state,d=e.creationToken,y=(0,w.getCommentMentions)(o),m=d||(0,v.generateCreationToken)();return this.client.crypto().encryptComment(o,[this.client.session.serverPublicKeyPEM,this.client.session.publicKeyPEM]).then(function(e){var t=e.envelope,o=e.comment$;return{proofId:n,page:f?void 0:i,envelope:t,encryptedComment:o,xy:JSON.stringify({x:a&&"number"==typeof a.x?a.x:null,y:a&&"number"==typeof a.y?a.y:null,x2:a&&"number"==typeof a.x2?a.x2:null,y2:a&&"number"==typeof a.y2?a.y2:null,time:"number"==typeof s?s:null,duration:"number"==typeof u?u:null}),parent:f||void 0,mentions:y.map(function(e){return e.id}).join(","),metadata:c?JSON.stringify(c):"{}",creationToken:m,change:l===h.default.TODO?"1":void 0,done:l===h.default.DONE?"1":void 0}}).then(function(e){return t.client.request("comments.create",e).then(function(e){return(new p.default).fromComment(e.data).fromRawComment(o)})}).catch(function(e){return e&&(e.creationToken=m),Promise.reject(e)})},t}(c.default);t.default=T},function(e,t,o){"use strict";function n(e){var t=""+e,o=r.exec(t);if(!o)return t;var n,i="",a=0,s=0;for(a=o.index;a<t.length;a++){switch(t.charCodeAt(a)){case 34:n=""";break;case 38:n="&";break;case 39:n="'";break;case 60:n="<";break;case 62:n=">";break;default:continue}s!==a&&(i+=t.substring(s,a)),s=a+1,i+=n}return s!==a?i+t.substring(s,a):i}/*!
|
|
2
2
|
* escape-html
|
|
3
3
|
* Copyright(c) 2012-2013 TJ Holowaychuk
|
|
4
4
|
* Copyright(c) 2015 Andreas Lubbe
|
|
5
5
|
* Copyright(c) 2015 Tiancheng "Timothy" Gu
|
|
6
6
|
* MIT Licensed
|
|
7
7
|
*/
|
|
8
|
-
var r=/["'&<>]/;e.exports=
|
|
8
|
+
var r=/["'&<>]/;e.exports=n},function(e,t,o){"use strict";function n(){for(var e=(new Date).getTime(),t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~`!@#$%^&*()_+-={}[]:\";'<>?,./|\\",o="",n=r;n>0;--n)o+=t[Math.round(Math.random()*(t.length-1))];return o+"-"+e}t.__esModule=!0;var r=32;t.generateCreationToken=n},function(e,t,o){"use strict";function n(e,t){var o=void 0;return function(){o||(o=setTimeout(function(){e(),o=null},t))}}t.__esModule=!0,t.default=n},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=o(0),u=n(s),f=o(7),c=n(f),l=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.uploadAvatar=function(e){var t=this;return(new c.default).readBase64(e).then(function(e){return t.client.request("profile.upload-avatar",{uploadedImage:"data:image/png;base64,"+e})})},t.prototype.changePassword=function(e,t){var o=this,n=this.client.crypto();return Promise.all([n.generatePasswordHash(e),n.generatePasswordHash(t),n.encryptPrivateKey(this.client.session.privateKeyPEM,t)]).then(function(e){var t=e[0],n=e[1],r=e[2];return o.client.request("profile.change-password",{oldPassword:t,newPassword:n,newPrivateKey:r})})},t}(u.default);t.default=l},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=o(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),r(this,e.apply(this,arguments))}return i(t,e),t.prototype.check=function(){return this.client.request("sessions.check").then(function(){return null})},t}(s.default);t.default=u},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=o(9),a=function(e){return e&&e.__esModule?e:{default:e}}(i),s=o(11)("EventEmitter"),u=function(){function e(){n(this,e),this.handlers={}}return e.prototype.getHandlers=function(e){var t=this,o=[],n=[e];if(-1!==e.indexOf("."))for(var r=e;(r=r.substring(0,r.lastIndexOf("."))).length;)n.push(r+".*");return n.push("*"),n.forEach(function(e){(0,a.default)(t.handlers,e)&&o.push.apply(o,t.handlers[e])}),o},e.prototype.on=function(e,t){if("function"!=typeof t)return void s("Handler is not a function, got "+(void 0===t?"undefined":r(t)));(0,a.default)(this.handlers,e)||(this.handlers[e]=[]),this.handlers[e].push(t)},e.prototype.off=function(e,t){if((0,a.default)(this.handlers,e)){var o=this.handlers[e];o.splice(o.indexOf(t),1)}},e.prototype.addEventListener=function(e,t){return this.on(e,t)},e.prototype.removeEventListener=function(e,t){return this.off(e,t)},e.prototype.emit=function(e,t){var o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=this.getHandlers(e),r=new Array(n.length);s("Emitting"+(o?" async":"")+' "'+e+'" event ('+(t?"with":"without")+" data) to "+n.length+" handler(s)");var i=Object.freeze({type:e,data:t,timestamp:Date.now()});return n.forEach(function(e,t){try{r[t]=e(i)}catch(e){r[t]=e}}),o?Promise.all(r):r},e}();t.default=u},function(e,t,o){"use strict";t.__esModule=!0,t.default=function(e,t,o){return new Promise(function(n,r){setTimeout(function(){void 0!==o?r(o):n(t)},e)})}},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.WorkflowUserState=t.WorkflowUserRole=t.WorkflowStepState=t.ResponseStatus=t.ProofStatus=t.ProofState=t.ImportProvider=t.FileStatus=t.FileAssignee=t.CommentState=void 0;var r=o(14),i=n(r),a=o(75),s=n(a),u=o(5),f=n(u),c=o(23),l=n(c),p=o(17),d=n(p),h=o(18),y=n(h),m=o(8),w=n(m),v=o(26),_=n(v),b=o(76),E=n(b),g=o(25),O=n(g);t.CommentState=i.default,t.FileAssignee=s.default,t.FileStatus=f.default,t.ImportProvider=l.default,t.ProofState=d.default,t.ProofStatus=y.default,t.ResponseStatus=w.default,t.WorkflowStepState=_.default,t.WorkflowUserRole=E.default,t.WorkflowUserState=O.default},function(e,t,o){"use strict";t.__esModule=!0;var n={PROOF:"proof",ATTACHMENT:"attachment",SNAPSHOT:"snapshot"};t.default=n},function(e,t,o){"use strict";t.__esModule=!0;var n={REVIEWER:"reviewer",MANDATORY:"mandatory",GATEKEEPER:"gatekeeper",APPROVER:"approver"};t.default=n},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.WorkflowUser=t.WorkflowStep=t.Workflow=t.User=t.Session=t.ProofVersion=t.ProofGroup=t.Proof=t.Pin=t.File=t.Comment=void 0;var r=o(27),i=n(r),a=o(10),s=n(a),u=o(28),f=n(u),c=o(4),l=n(c),p=o(22),d=n(p),h=o(20),y=n(h),m=o(6),w=n(m),v=o(3),_=n(v),b=o(24),E=n(b),g=o(12),O=n(g),P=o(13),I=n(P);t.Comment=i.default,t.File=s.default,t.Pin=f.default,t.Proof=l.default,t.ProofGroup=d.default,t.ProofVersion=y.default,t.Session=w.default,t.User=_.default,t.Workflow=E.default,t.WorkflowStep=O.default,t.WorkflowUser=I.default}])});
|
|
9
9
|
//# sourceMappingURL=pageproof.js.map
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _ProofGroup=require("../models/ProofGroup");var _ProofGroup2=_interopRequireDefault(_ProofGroup);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}function transformGroups(groups){return(groups||[]).map(function(groupData){return(new _ProofGroup2.default).fromProofGroup(groupData)})}var DashboardGroups=function(_API){_inherits(DashboardGroups,_API);function DashboardGroups(){_classCallCheck(this,DashboardGroups);return _possibleConstructorReturn(this,_API.apply(this,arguments))}DashboardGroups.prototype._loadGroups=function _loadGroups(filterBy){return this.client.request("dashboard.groups.filter-by",{filterBy:filterBy}).then(function(response){return transformGroups(response.data)})};DashboardGroups.prototype.current=function current(){return this._loadGroups("current")};return DashboardGroups}(_API3.default);exports.default=DashboardGroups;
|
package/lib/api/Preferences.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _Preference=require("../models/Preference");var _Preference2=_interopRequireDefault(_Preference);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}function mapPreference(preferenceData){return(new _Preference2.default).fromPreference(preferenceData)}function sortPreferences(names,preferences){var sorted=new Array(names.length);preferences.forEach(function(preference){sorted[names.indexOf(preference.name)]=preference});return sorted}var Preferences=function(_API){_inherits(Preferences,_API);function Preferences(){_classCallCheck(this,Preferences);return _possibleConstructorReturn(this,_API.apply(this,arguments))}Preferences.prototype.all=function all(){return this.client.request("preferences.all")};Preferences.prototype.get=function get(nameOrNames){var names=[].concat(nameOrNames);return this.client.request("preferences.get",{preferences:names}).then(function(response){return response.data.map(mapPreference)}).then(function(preferences){return typeof nameOrNames==="string"?preferences[0]:sortPreferences(names,preferences)})};Preferences.prototype.update=function update(preferenceNameOrPreferences,preferenceValue){var _ref;var updatedPreferences=typeof preferenceValue!=="undefined"?(_ref={},_ref[preferenceNameOrPreferences]=preferenceValue,_ref):preferenceNameOrPreferences;return this.client.request("preferences.update",updatedPreferences)};Preferences.prototype.reset=function reset(nameOrNames){return this.client.request("preferences.reset",{preferences:[].concat(nameOrNames)})};return Preferences}(_API3.default);exports.default=Preferences;
|
package/lib/enum/Preference.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var Preference={DEFAULT_DUE_DATE:"dueDate",DEFAULT_MESSAGE_TO_REVIEWERS:"messageToReviewers",ENABLE_COLOR_BLIND_UI:"colorBlind"};exports.default=Preference;
|
package/lib/models/Preference.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var preferenceSchema={name:"Name",defaultValue:"DefaultValue",value:"Value"};var Preference=function(){function Preference(){_classCallCheck(this,Preference)}Preference.prototype.getValueOrDefault=function getValueOrDefault(){if(this.value===null){return this.defaultValue}return this.value};Preference.prototype.fromPreference=function fromPreference(preferenceData){(0,_transform2.default)(this,preferenceSchema,preferenceData);return this};return Preference}();exports.default=Preference;
|