@pageproof/sdk-pr 104.0.1535945812873 → 104.0.1538691344811

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.0.0-beta.53
4
+
5
+ Released on the 5th of October 2018.
6
+
7
+ - [[#112](https://github.com/PageProofCom/sdk/pull/112)] Comments can now have an "unmarked done" state when they have been marked as done without first being marked as a to-do. See [CommentState](http://docs.pageproof.tech/@pageproof/sdk/beta/variable/index.html#static-variable-CommentState).
8
+
9
+ ## 2.0.0-beta.52
10
+
11
+ Released on the 20th of September 2018.
12
+
13
+ - [[#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).
14
+
3
15
  ## 2.0.0-beta.51
4
16
 
5
17
  Released on the 15th of August 2018.
package/README.md CHANGED
@@ -258,6 +258,7 @@ Name | Namespace | Description | Admin-only | Stability
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
259
  [Dashboard Groups API](./class/src/api/DashboardGroups.js~DashboardGroups.html) | `dashboard.groups` | Used to load proof groups | No | Experimental
260
260
  [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
261
262
  [Profile API](./class/src/api/Profile.js~Profile.html) | `profile` | Manage your account details. | No | Experimental
262
263
  [Proofs API](./class/src/api/Proofs.js~Proofs.html) | `proofs` | Used to create & manage proofs. | No | Stable
263
264
  [Proofs Groups API](./class/src/api/ProofsGroups.js~ProofsGroups.html) | `proofs.groups` | Used to manage groups of proofs. | No | Experimental
@@ -328,11 +329,11 @@ if (sessionJSON !== null) {
328
329
  ```
329
330
 
330
331
  You may notice we're making use of a method called
331
- [`setSession`](http://localhost:8080/class/src/core/PageProof.js~PageProof.html#instance-method-setSession) within our
332
+ [`setSession`](./class/src/core/PageProof.js~PageProof.html#instance-method-setSession) within our
332
333
  PageProof client. This method is automatically called when calling the `accounts.login` method, but if the user
333
334
  refreshes, we need to remind the client what the current session is.
334
335
 
335
336
  **NEVER** send the session object over the network. The
336
- [Session](http://localhost:8080/class/src/models/Session.js~Session.html) object contains the user's private keys.
337
+ [Session](./class/src/models/Session.js~Session.html) object contains the user's private keys.
337
338
  Sharing the private keys with anybody, directly or even indirectly (over unencrypted traffic, for example), gives
338
339
  anybody the ability to access & decrypt all proofs you have access to, including those you have been invited to.
@@ -0,0 +1 @@
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;
@@ -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 _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;
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 _Preferences=require("../api/Preferences");var _Preferences2=_interopRequireDefault(_Preferences);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.preferences=new _Preferences2.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;
@@ -1 +1 @@
1
- "use strict";exports.__esModule=true;var CommentState={COMMENT:"comment",TODO:"todo",DONE:"done"};exports.default=CommentState;
1
+ "use strict";exports.__esModule=true;var CommentState={COMMENT:"comment",TODO:"todo",DONE:"done",UNMARKED_DONE:"unmarked-done"};exports.default=CommentState;
@@ -0,0 +1 @@
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/enum/index.js CHANGED
@@ -1 +1 @@
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;
1
+ "use strict";exports.__esModule=true;exports.Preference=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);var _Preference=require("./Preference");var _Preference2=_interopRequireDefault(_Preference);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;exports.Preference=_Preference2.default;
@@ -1 +1 @@
1
- "use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);var _User=require("./User");var _User2=_interopRequireDefault(_User);var _Pin=require("./Pin");var _Pin2=_interopRequireDefault(_Pin);var _File=require("./File");var _File2=_interopRequireDefault(_File);var _CommentState=require("../enum/CommentState");var _CommentState2=_interopRequireDefault(_CommentState);var _parseComment=require("../util/comments/parseComment");var _parseComment2=_interopRequireDefault(_parseComment);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 commentSchema={__prepare:function __prepare(data){data._XY=_Pin2.default.parseValue(data.XY)},id:"CommentId",proofId:"ProofId",pin:function pin(data){return(new _Pin2.default).fromPin(data._XY)},user:function user(data){return(new _User2.default).fromUser(data)},comment$:"EncryptedComment",envelope:"Envelope",attachments:function attachments(data){if(data.Attachment){return[(new _File2.default).fromCommentAttachment(data)]}return[]},agreeCount:function agreeCount(data){return data.Agrees.length},pageNumber:(0,_transform.number)("Page"),mediaTime:function mediaTime(data){return data._XY.time==null?undefined:data._XY.time},mediaDuration:function mediaDuration(data){return data._XY.duration==null?undefined:data._XY.duration},createdDate:(0,_transform.date)("Timestamp"),updatedDate:(0,_transform.date)("Updated"),parentCommentId:(0,_transform.optional)("Parent"),metadata:(0,_transform.json)("Metadata",{}),state:function state(data){return+data.Done?_CommentState2.default.DONE:+data.Change?_CommentState2.default.TODO:_CommentState2.default.COMMENT}};var Comment=function(){function Comment(){_classCallCheck(this,Comment)}Comment.prototype.fromComment=function fromComment(commentData){(0,_transform2.default)(this,commentSchema,commentData);return this};Comment.prototype.fromRawComment=function fromRawComment(rawComment){var parsed=(0,_parseComment2.default)(rawComment);this.raw=rawComment;this.tokens=parsed;return this};return Comment}();exports.default=Comment;
1
+ "use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);var _User=require("./User");var _User2=_interopRequireDefault(_User);var _Pin=require("./Pin");var _Pin2=_interopRequireDefault(_Pin);var _File=require("./File");var _File2=_interopRequireDefault(_File);var _CommentState=require("../enum/CommentState");var _CommentState2=_interopRequireDefault(_CommentState);var _parseComment=require("../util/comments/parseComment");var _parseComment2=_interopRequireDefault(_parseComment);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 commentSchema={__prepare:function __prepare(data){data._XY=_Pin2.default.parseValue(data.XY)},id:"CommentId",proofId:"ProofId",pin:function pin(data){return(new _Pin2.default).fromPin(data._XY)},user:function user(data){return(new _User2.default).fromUser(data)},comment$:"EncryptedComment",envelope:"Envelope",attachments:function attachments(data){if(data.Attachment){return[(new _File2.default).fromCommentAttachment(data)]}return[]},agreeCount:function agreeCount(data){return data.Agrees.length},pageNumber:(0,_transform.number)("Page"),mediaTime:function mediaTime(data){return data._XY.time==null?undefined:data._XY.time},mediaDuration:function mediaDuration(data){return data._XY.duration==null?undefined:data._XY.duration},createdDate:(0,_transform.date)("Timestamp"),updatedDate:(0,_transform.date)("Updated"),parentCommentId:(0,_transform.optional)("Parent"),metadata:(0,_transform.json)("Metadata",{}),state:function state(data){return+data.Done?+data.Change?_CommentState2.default.DONE:_CommentState2.default.UNMARKED_DONE:+data.Change?_CommentState2.default.TODO:_CommentState2.default.COMMENT}};var Comment=function(){function Comment(){_classCallCheck(this,Comment)}Comment.prototype.fromComment=function fromComment(commentData){(0,_transform2.default)(this,commentSchema,commentData);return this};Comment.prototype.fromRawComment=function fromRawComment(rawComment){var parsed=(0,_parseComment2.default)(rawComment);this.raw=rawComment;this.tokens=parsed;return this};return Comment}();exports.default=Comment;
@@ -0,0 +1 @@
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;
@@ -38,6 +38,25 @@
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
+ },
41
60
  "dashboard.inbox": {
42
61
  "method": "GET",
43
62
  "path": "/api/proofs/dashboard/proofin",
package/lib/pageproof.js CHANGED
@@ -1,2 +1,2 @@
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(r){if(o[r])return o[r].exports;var n=o[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var o={};return t.m=e,t.c=o,t.d=function(e,o,r){t.o(e,o)||Object.defineProperty(e,o,{configurable:!1,enumerable:!0,get:r})},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=32)}([function(e,t,o){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var n=function e(t){r(this,e),this.client=t};t.default=n},function(e,t,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t,o){var r=[],n={};return Array.isArray(t)?(r=t,t.forEach(function(e){n[e]=e})):(0,y.default)(t)&&(r=Object.keys(t),n=t),r.forEach(function(t){var r=n[t],i=void 0;if("string"==typeof r)i=-1!==r.indexOf(".")?function(){for(var e=r.split("."),t=o,n=0;n<e.length;n++){var i=e[n];if(!(0,w.default)(t,i)){t=void 0;break}t=t[i]}return t}:function(){return o[r]};else{if("function"!=typeof r){if(null===r)return;throw new Error("Unknown transformer.")}i=r}var s=i.call(e,o);void 0!==s&&(e[t]=s)}),e}function i(e){return function(t){return Number(t[e])}}function s(e,t){return function(o){return t[o[e]]}}function a(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 r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}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=o(9),y=r(h),m=o(6),w=r(m);t.default=n},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)}{(.*?)}/,t.COMMENT_LABEL_REGEX=/^(approved|highlight):/i,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 r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var n=o(1),i=function(e){return e&&e.__esModule?e:{default:e}}(n),s={id:"UserId",name:"Name",email:"Email",hasActivated:"Activated",hasRegistered:"IsRegistered",hasAvatar:"HasAvatar",accountType:"AccountType",teamType:"TeamType",teamLogo:"Branding.LogoURL",registeredDate:(0,n.date)("Registered"),lastLoginDate:(0,n.date)("LastLogin"),lastUploadDate:(0,n.date)("LastUpload"),isAdmin:"IsDomainAdmin"},a=function(){function e(){r(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,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(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=o(1),a=r(s),u=o(20),f=r(u),c=o(21),l=r(c),p=o(5),d=r(p),h=o(22),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(){n(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,o){"use strict";t.__esModule=!0;var r={OK:"OK",UPLOADING:"Uploading",QUEUED:"Queued",RIPPING:"Ripping",ERROR:"Error"};t.default=r},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 r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=o(1),s=r(i),a=o(3),u=r(a),f={userId:"UserId",token:"Token",sharedKey:"SharedKey",privateKeyPEM$:"PrivateKey",privateKeyPEM:null,publicKeyPEM:"PublicKey",serverPublicKeyPEM:"PublicServerKey"},c=function(){function e(){n(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,o){"use strict";function r(){if("function"==typeof r.driver){return new(0,r.driver)}if("string"==typeof r.driver){var e=void 0;switch(r.driver){case"Blob":e=o(59).default;break;case"Buffer":e=o(60).default;break;case"String":e=o(61).default;break;default:throw new Error('Unknown Bluffer driver "'+r.driver+'".')}if(e)return new e;throw new Error('Bluffer driver "'+r.driver+'" not found.')}throw new Error('Bluffer.driver must be either "Blob", "Bluffer", or "String" or a custom constructor.')}t.__esModule=!0;var n=o(13)("bluffer");r.driver="String","undefined"!=typeof Blob?r.driver="Blob":(n("The current JavaScript environment does not support native Bluffer, falling back to using StringBluffer."),r.driver="String"),t.default=r},function(e,t,o){"use strict";t.__esModule=!0;var r=Object.prototype.toString;t.default=function(e){return"[object Object]"===r.call(e)}},function(e,t,o){"use strict";t.__esModule=!0;var r={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=r},function(e,t,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=o(1),s=r(i),a=o(4),u=r(a),f={id:"GroupId",name:"Name",proofs:(0,i.each)("ProofInfo",function(e){return(new u.default).fromProof(e)})},c=function(){function e(){n(this,e)}return e.prototype.fromProofGroup=function(e){return(0,s.default)(this,f,e),this},e}();t.default=c},function(e,t,o){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var n=o(1),i=function(e){return e&&e.__esModule?e:{default:e}}(n),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(){r(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,o){"use strict";e.exports=function e(){return e}},function(e,t,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=o(1),s=r(i),a=o(15),u=r(a),f=o(28),c=r(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(){n(this,e)}return e.prototype.fromWorkflowStep=function(e){return(0,s.default)(this,l,e),this},e}();t.default=p},function(e,t,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(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=o(1),u=r(a),f=o(3),c=r(f),l=o(27),p=r(l),d={id:"UserId",name:"Name",email:"Email",role:"Role",permissions:function(e){return{inviter:e.IsInviter}}},h=function(e){function t(){return n(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,o){"use strict";t.__esModule=!0;var r={COMMENT:"comment",TODO:"todo",DONE:"done"};t.default=r},function(e,t,o){"use strict";function r(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 n(e){if(0===e.indexOf(d)){var t=e.substring(d.length,e.indexOf(h));return parseInt(t,10)}if(e.match(l))try{return JSON.parse(e)[p]}catch(e){}return 1}function i(e){var t=n(e),o=c[t];if(o)return o(e);throw new Error("Unsupported comment schema version. Please update to a newer version of the SDK.")}t.__esModule=!0,t.getVersionNumber=void 0;var s=o(70),a=r(s),u=o(18),f=r(u),c={2:f.parse,1:a.parse},l=/^\s*{/,p="_",d='{"_":',h=",";t.default=i,t.getVersionNumber=n},function(e,t,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(Array.isArray(e))return e.map(function(e){return n(e,t)});if((0,l.default)(e)){var o={};for(var r in e)(0,f.default)(e,r)&&t[r]&&(o[t[r]]=n(e[r],t));return o}return e}function i(e){return n(JSON.parse(e),p)}function s(e){var t=n(a({version:2},e),d);return JSON.stringify(t)}t.__esModule=!0,t.serialize=t.parse=void 0;var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},u=o(6),f=r(u),c=o(9),l=r(c),p={_:"version",bs:"blocks",t:"type",v:"value",i:"index",l:"length",st:"styles",en:"entities",md:"metadata",i_:"id",lb:"label",ur:"url"},d={};for(var h in p)(0,f.default)(p,h)&&(d[p[h]]=h);t.parse=i,t.serialize=s},function(e,t,o){"use strict";t.__esModule=!0;var r=void 0;r="104.0.1535945812873",t.default=r},function(e,t,o){"use strict";t.__esModule=!0;var r={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=r},function(e,t,o){"use strict";t.__esModule=!0;var r={NEW:0,PROOFING:10,FINAL_APPROVING:30,TODOS_REQUESTED:50,AWAITING_NEW_VERSION:60,APPROVED:70,ARCHIVED:100};t.default=r},function(e,t,o){"use strict";var r={Proof:"P",Workflow:"W",File:"F",User:"U",Brief:"B"},n={};Object.keys(r).forEach(function(e){n["is"+e+"Id"]=function(t){return t&&16===t.length&&t[0]===r[e]}}),e.exports=n},function(e,t,o){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var n=o(1),i=function(e){return e&&e.__esModule?e:{default:e}}(n),s={id:"ProofId",version:"Version"},a=function(){function e(){r(this,e)}return e.prototype.fromProofVersion=function(e){return(0,i.default)(this,s,e),this},e}();t.default=a},function(e,t,o){"use strict";function r(e,t){return n(function(t){return t[e]},t)}function n(e,t){var o=t?1:-1,r=t?-1:1;return function(t,n){var i=e(t),s=e(n);return i<s?o:i>s?r:0}}function i(e,t){var o={};t.forEach(function(e,t){o[e]=t});var r="function"==typeof e?e:function(t){return t[e]};return function(e,t){var n=o[r(e)],i=o[r(t)];return n<i?-1:n>i?1:0}}function s(){for(var e=arguments.length,t=Array(e),o=0;o<e;o++)t[o]=arguments[o];var r=t.length;return function(e,o){for(var n=0;n<r;n++){var i=t[n](e,o);if(i)return i}return 0}}t.__esModule=!0,t.sortObjectsByKey=r,t.sortObjectsBy=n,t.sortObjectsByValues=i,t.combineSort=s},function(e,t,o){"use strict";t.__esModule=!0;var r={NONE:"none",GOOGLE_DRIVE:"drive",DROPBOX:"dropbox",ONEDRIVE:"onedrive",BOX:"box"};t.default=r},function(e,t,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=o(1),s=r(i),a=o(14),u=r(a),f={id:"WorkflowId",name:"Title",steps:(0,i.each)("WorkflowSteps",function(e){return(new u.default).fromWorkflowStep(e)})},c=function(){function e(){n(this,e)}return e.prototype.getStepByPosition=function(e){for(var t=this.steps.length,o=0;o<t;o+=1){var r=this.steps[o];if(r.position===e)return r}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,o){"use strict";t.__esModule=!0;var r={NONE:null,NOT_VISIBLE:"not-visible",VISIBLE:"visible",SEEN:"seen",SKIPPED:"skipped",FINISHED:"finished"};t.default=r},function(e,t,o){"use strict";t.__esModule=!0;var r={NONE:null,NOT_VISIBLE:"not-visible",VISIBLE:"visible",COMPLETE:"complete"};t.default=r},function(e,t,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=o(1),s=r(i),a=o(3),u=r(a),f=o(30),c=r(f),l=o(12),p=r(l),d=o(16),h=r(d),y=o(17),m=r(y),w={__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}},v=function(){function e(){n(this,e)}return e.prototype.fromComment=function(e){return(0,s.default)(this,w,e),this},e.prototype.fromRawComment=function(e){var t=(0,m.default)(e);return this.raw=e,this.tokens=t,this},e}();t.default=v},function(e,t,o){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},i=o(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(){r(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 o=JSON.parse(e);t=n({},t,o)}else if(-1!==e.indexOf(",")){var r=e.split(","),i=r[0],s=r[1];t.x=parseFloat(i),t.y=parseFloat(s)}return t},e}();t.default=u},function(e,t,o){"use strict";function r(e){var t=[];return e.blocks.forEach(function(e){e.entities.forEach(function(e){if("mention"===e.type){var o=e.metadata.id;-1===t.indexOf(o)&&t.push(o)}})}),t}t.__esModule=!0,t.default=r},function(e,t,o){"use strict";function r(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 n(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.version=t.util=t.Model=t.Enum=t.Bluffer=t.Client=void 0;var i=o(33),s=n(i),a=o(8),u=n(a),f=o(77),c=r(f),l=o(80),p=r(l),d=o(19),h=n(d),y=o(81),m=r(y);t.default=s.default,t.Client=s.default,t.Bluffer=u.default,t.Enum=c,t.Model=p,t.util=m,t.version=h.default},function(e,t,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=o(34),s=r(i),a=o(39),u=r(a),f=o(40),c=r(f),l=o(42),p=r(l),d=o(44),h=r(d),y=o(46),m=r(y),w=o(48),v=r(w),_=o(49),b=r(_),E=o(56),O=r(E),g=o(57),P=r(g),I=o(64),T=r(I),S=o(67),R=r(S),k=o(69),M=r(k),A=o(73),C=r(A),j=o(74),D=r(j),q=o(7),N=r(q),x=o(75),U=r(x),B=o(10),G=r(B),K=o(76),L=r(K),W=o(13)("PageProof"),F=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};n(this,e),this.options=t,this.events=new U.default,this.adapters=new s.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 O.default(this),this.users=new v.default(this),this.workflows=new R.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 r=this,n=new c.default(e,t),i=this.adapters.getRequestAdapter(),s=Promise.resolve();if(!n.endpoint.anonymous){if(!this.session)return Promise.reject(new Error("Cannot make call to endpoint ("+e+") when unauthorized."));s=this.adapters.getCryptoAdapter().generateAuthorizationHeaders(n.getMethod(),n.getPath(),this.session).then(function(e){return n.addHeaders(e)})}var a={request:n};return s.then(function(){var e=n.build();return r.events.emit("experimental.request.before",a,!0).then(function(){return e})}).then(function(e){return i.send(e,o)}).then(p.default.parse).then(function(n){if(a.response=n,r.events.emit("experimental.request.after",a),n.code===G.default.ERROR_THROTTLED){var i=r.events.emit("error.throttled",a);if(i.some(Boolean))return Promise.all(i).then(function(){return r.events.emit("experimental.request.retry",a),r.request(e,t,o)})}if(n.code===G.default.ERROR_UNAUTHORISED){var s=r.session?r.session.token:null;return r.events.emit("error.unauthorized",a,!0).then(function(){return r.session&&r.session.token!==s?r.request(e,t,o):n})}if(n.deprecated){var u="The "+e+" API has been deprecated. "+(n.deprecated||"");r.events.emit("error.deprecated",{name:e,message:u})}return n}).then(function(t){try{if(t.error){r.events.emit("error.response",a);var o=new Error(e+" request resulted in an "+t.code+" error.");return o.response=t,o.request=n,Promise.reject(o)}return r.events.emit("experimental.request.resolve",a),Promise.resolve(t)}finally{r.events.emit("experimental.request.finally",a)}})},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 r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=o(35),s=r(i),a=o(36),u=r(a),f=o(37),c=r(f),l=o(38),p=r(l),d=function(){function e(t){n(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__,r=0;r<this.adapters.length;r+=1){var n=this.adapters[r];Object.getPrototypeOf(Object.getPrototypeOf(n)).constructor.__adapter__===o&&t.push(n)}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,o){"use strict";function r(){}t.__esModule=!0,r.__adapter__="ICryptoAdapter",t.default=r},function(e,t,o){"use strict";function r(){}t.__esModule=!0,r.__adapter__="IRequestAdapter",t.default=r},function(e,t,o){"use strict";function r(){}t.__esModule=!0,r.__adapter__="ICacheAdapter",t.default=r},function(e,t,o){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t,o){var r=e[t];e[t]=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var i=r.bind.apply(r,[this].concat(t));return o(i,this,t).apply(this,t)}}function i(e){function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],s=Object.getOwnPropertyNames(n).filter(function(t){return n[t].client===e}),a=Object.getPrototypeOf(n),u=Object.keys(a).filter(function(e){return"function"==typeof a[e]&&0!==e.indexOf("_")});(i.length||o)&&u.forEach(function(e){r.push({namespace:i.join("."),name:e,api:n})}),s.forEach(function(e){t(n[e],i.concat(e))})}var o=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=[];return t(e),r}t.__esModule=!0;var s,a,u=(a=s=function(){function e(){r(this,e)}return e.prototype.onClientReady=function(e){var t=this;i(e).forEach(function(e){n(e.api,e.name,function(o){var r={api:e.api,namespace:e.namespace,name:e.name,displayName:e.namespace+"."+e.name};return t.onMethodBefore(r),function(){var e=void 0;try{e=o()}catch(e){throw r.error=e,t.onMethodThrown(r),e}finally{r.value=e,t.onMethodAfter(r),e&&"function"==typeof e.then&&e.then(function(e){r.resolved=e,t.onMethodResolve(r)},function(e){r.rejected=e,t.onMethodReject(r)}).then(function(){t.onMethodFinally(r)})}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,o){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var n=function(){function e(t){r(this,e),this.client=t}return e.prototype.auto=function(e,t){var o=this.client.adapters.getCacheAdapter(),r=function(){};return o?(r=function(t){void 0!==t&&o.set(e,t)},o.get(e).catch(function(){return Promise.resolve(t(r)).then(function(e){return r(e),e})})):Promise.resolve(t(r))},e}();t.default=n},function(e,t,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(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 r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},s=o(41),a=r(s),u=o(9),f=r(u),c=o(19),l=r(c),p=o(2),d=function(){function e(t,o){if(n(this,e),this.name=t,this.endpoint=a.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,r=t.chain,n=t.trailing,i=o;return r&&r.forEach(function(t){"/"!==i[i.length-1]&&(i+="/"),i+=e.params[t]}),n&&"/"!==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 r=!0===t.body?Object.keys(this.params):t.body,n={};switch(r.forEach(function(t){var o=e.params[t];void 0!==o&&(n[t]=o)}),t.version){case 2:return JSON.stringify(n);case 1:default:return Object.keys(n).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"]},"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,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=o(10),s=r(i),a=o(43),u=o(2),f=o(6),c=r(f),l=function(){function e(){n(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,r=t.headers,n=void 0===r?{}:r,i=t.body,f=new e;if(o===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(n[u.RETRY_AFTER_HEADER])||60)},f;if((0,c.default)(n,"deprecated")&&(f.deprecated=n.deprecated),o===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,o){"use strict";t.__esModule=!0;t.TOO_MANY_REQUESTS_STATUS=429,t.OK_STATUS=200},function(e,t,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(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=o(0),u=r(a),f=o(7),c=r(f),l=o(45),p=r(l),d=function(e){function t(o){n(this,t);var r=i(this,e.call(this,o));return r.sso=new p.default(o),r}return s(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 r=e[0],n=e[1];return Promise.all([r,n,o.client.crypto().encryptPrivateKey(n.privateKeyPEM,t)])}).then(function(t){var r=t[0],n=t[1],i=t[2];return Promise.all([n,o.client.request("accounts.register",{email:e,password:r,privateKey:i,publicKey:n.publicKeyPEM})])}).then(function(r){var n=r[0];return Promise.all([n,o.login(e,t,!1)])}).then(function(e){var t=e[0],r=e[1];return Promise.all([t,r,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,r=!(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 r?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 r(e){return e&&e.__esModule?e:{default:e}}function n(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=o(0),u=r(a),f=o(7),c=r(f),l=function(e){function t(){return n(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 o=t.key,r=t.key$;return Promise.all([o,e.client.request("sso.get-session",{nonce:r})])}).then(function(t){var o=t[0],r=t[1],n=(new c.default).fromSession(r.data);return Promise.all([n,e.client.crypto().decryptManagedPrivateKey(n.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 r(e){return e&&e.__esModule?e:{default:e}}function n(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(o){t[o]=e[y[o]]}),t}function u(e){return(e||[]).map(function(e){return(new p.default).fromProof(e)})}t.__esModule=!0;var f=o(0),c=r(f),l=o(4),p=r(l),d=o(47),h=r(d),y={inbox:"ProofIn",sent:"ProofOut",outbox:"ProofOutBox"},m=function(e){function t(o){n(this,t);var r=i(this,e.call(this,o));return r.groups=new h.default(o),r}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,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(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=o(0),f=r(u),c=o(11),l=r(c),p=function(e){function t(){return n(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,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(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=o(0),c=r(f),l=o(3),p=r(l),d=function(e){function t(){return n(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,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(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=o(0),u=r(a),f=o(50),c=r(f),l=o(51),p=r(l),d=o(52),h=r(d),y=o(53),m=r(y),w=o(4),v=r(w),_=o(5),b=r(_),E=o(2),O=function(e){function t(o){n(this,t);var r=i(this,e.call(this,o));return r.owners=new c.default(o),r.editors=new p.default(o),r.versions=new h.default(o),r.groups=new m.default(o),r}return s(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,r=e.tags,n=void 0===r?[]:r,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:o,dueDate:s.toISOString(),description:a,groupId:c?c.id:void 0}).then(function(e){var o=(new v.default).fromProof(e.data);return Promise.all([o,n.length&&t.setTags(o.id,n),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",{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=O},function(e,t,o){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(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=o(0),a=function(e){return e&&e.__esModule?e:{default:e}}(s),u=function(e){function t(){return r(this,t),n(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,o){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(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=o(0),a=function(e){return e&&e.__esModule?e:{default:e}}(s),u=function(e){function t(){return r(this,t),n(this,e.apply(this,arguments))}return i(t,e),t.prototype.add=function(e,t,o){var r={proofId:e,editors:[].concat(t),editorMessage:null===o?"":o};return this.client.request("proofs.editors.add",r)},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}(a.default);t.default=u},function(e,t,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(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=o(0),u=r(a),f=o(23),c=r(f),l=o(24),p=(0,l.sortObjectsByKey)("version"),d=function(e){function t(){return n(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,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(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=o(0),f=r(u),c=o(11),l=r(c),p=o(54),d=r(p),h=o(55),y=r(h),m=function(e){function t(o){n(this,t);var r=i(this,e.call(this,o));return r.owners=new d.default(o),r.workflows=new y.default(o),r}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 o=t.name;return this.client.request("proofs.groups.update",{groupId:e,name:o}).then(a)},t}(f.default);t.default=m},function(e,t,o){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(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=o(0),a=function(e){return e&&e.__esModule?e:{default:e}}(s),u=function(e){function t(){return r(this,t),n(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,o){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(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=o(0),a=function(e){return e&&e.__esModule?e:{default:e}}(s),u=function(e){function t(){return r(this,t),n(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,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(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=o(0),u=r(a),f=o(4),c=r(f),l=o(5),p=r(l),d=o(2),h=function(e){function t(){return n(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 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,r=e.file,n=e.tags,i=void 0===n?[]:n,s=e.dueDate,a=void 0===s?new Date(Date.now()+3*d.DAY_IN_MS):s;return this.client.request("briefs.create",{title:o,messageToRecipient:"",dueDate:a.toISOString(),tag:i.join(",")}).then(function(e){var o=(new c.default).fromProof(e.data.Brief);return Promise.all([o,r&&t.setFile(o.id,r.id)])}).then(function(e){var t=e[0];return r&&(t.fileId=r.id,t.fileStatus=p.default.UPLOADING),t.calculateState(),t})},t.prototype.update=function(e){var t=this,o=e.briefId,r=e.data,n=e.start,i=void 0!==n&&n;return this.client.request("briefs.update",{briefId:o,title:r.title,messageToRecipient:r.messageToRecipient,dueDate:r.dueDate?r.dueDate.toISOString():"",tag:r.tags?r.tags.join(","):"",recipient:r.recipient,editorId:r.editorId,editorMessage:r.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 r(e){return e&&e.__esModule?e:{default:e}}function n(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=o(0),f=r(u),c=o(12),l=r(c),p=o(5),d=r(p),h=o(25),y=r(h),m=o(58),w=r(m),v=o(8),_=r(v),b=o(63),E=r(b),O=o(2),g=function(e){function t(){return n(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(o,r){var n=null,i=null;!function s(){t.details(e).then(function(t){switch(n=null,t.status){case d.default.OK:o(t);break;case d.default.ERROR:r(new Error("File "+e+" encountered a processing error: "+t.message));break;default:n=setTimeout(s,5e3)}n&&t.status!==d.default.RIPPING||clearTimeout(i)}).catch(r)}(),i=setTimeout(function(){clearTimeout(n),r(new Error("File did not finish processing within specified duration."))},3e4)})},t.prototype.import=function(e){var t=this,o=e.name,r=e.url,n=e.provider,i=void 0===n?y.default.NONE:n,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(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:r,envelope:o,accessToken:s,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,r=e.contents,n=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(n,i).then(function(e){return Promise.all([e,t._generateKeyIVEnvelope()])}).then(function(e){var n=e[0],i=e[1],s=i.keyIV,u=i.envelope,l=t._upload({name:o,contents:r,download:a,token:n,keyIV:s,envelope:u,onProgress:c,onError:p});return f&&(l=Promise.resolve()),l.then(function(){return n})}).then(function(e){var t=new l.default;return t.id=e,t})},t.prototype._upload=function(e){var t=this,o=e.name,r=e.contents,n=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(T));else{var o=I(t,v++);m=m.then(function(){return o}),o.then(c)}})}var l=4,p=a(o),d=p.name,h=p.extension,y=(0,w.default)(r),m=Promise.resolve(),v=0,_=!1,b=Math.ceil((0,E.default)(r)/O.BYTES_PER_BLOCK),g=new Array(b),P=function(){};f&&(P=function(e,t){g[e]=Math.max(t,g[e]||0),f(g.reduce(function(e,t){return e+(t||0)},0)/b*.99)});for(var I=function(e,o){return t.client.crypto().encryptFileBlock(s,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:n?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,r=o.fileId,n=o.onFileDetails;return this.details(r).then(function(e){if(!e.downloadable)throw new Error("File "+r+" is not downloadable.");if(e.status!==d.default.OK)throw new Error("File "+r+" cannot be download. The file may still be uploading, processing or has errored.");if(!e.blocks)throw new Error("File "+r+" is empty.");return n&&n(e),t._downloadFile(e,o)})},t.prototype._downloadFile=function(e,t){var o=this;return new Promise(function(r){function n(){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(n)}else y=!0,r(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,o){p[e]=Math.max(o,p[e]||0),t.onProgress(p.reduce(function(e,t){return e+(t||0)},0)/a*.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 s.createBase64(e)})})},h=0,y=!1,m=function(){return t.onProgress&&t.onProgress(100),t.onData?null:s.combine.apply(s,u)};i--;)n()})},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(O.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,r=t.async,n=void 0!==r&&r,i=t.onLoadThumbnails,s=[];return Promise.all(e.map(function(e){return o.client.cache.auto(O.THUMBNAIL_CACHE_PREFIX+e,function(t){s.push({fileId:e,resolve:t})}).then(function(t){var o;return t&&(o={},o[e]=t,o)})})).then(function(e){var t=Promise.all(s.map(function(e){var t=e.fileId,r=e.resolve;return o._thumbnail(t).then(function(e){if(r(e),n){var o;i((o={},o[t]=e,o))}return e})}));return n?e:t.then(function(t){return[].concat(e,t)})}).then(function(e){return Object.assign.apply(Object,[{}].concat(e))})},t}(f.default);t.default=g},function(e,t,o){"use strict";function r(e){var t=new s.default,o=0,r=Promise.resolve(),i=t.size(e);return function(){var s=o++*n.BYTES_PER_BLOCK,a=s+n.BYTES_PER_BLOCK;return r=r.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 n=o(2),i=o(8),s=function(e){return e&&e.__esModule?e:{default:e}}(i);t.default=r},function(e,t,o){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e){for(var t=new ArrayBuffer(e.length),o=new Uint8Array(t),r=0;r<e.length;r++)o[r]=e.charCodeAt(r);return t}t.__esModule=!0;var i=function(){function e(){r(this,e)}return e.prototype.create=function(e){return Promise.resolve(new Blob([n(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 r=new FileReader;r.onload=function(){t(r.result)},r.onerror=function(){o(r.error)},r.readAsText(e)})},e.prototype.readBase64=function(e){return new Promise(function(t,o){var r=new FileReader;r.onload=function(){var e=r.result;t(e.substring(e.indexOf(",")+1))},r.onerror=function(){o(r.error)},r.readAsDataURL(e)})},e.prototype.size=function(e){return e.size},e}();t.default=i},function(e,t,o){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var n=function(){function e(){r(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=n},function(e,t,o){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e){for(var t=e.length,o=e.length-1;o>=0;o--){var r=e.charCodeAt(o);r>127&&r<=2047?t++:r>2047&&r<=65535&&(t+=2),r>=56320&&r<=57343&&o--}return t}t.__esModule=!0;var i=o(62),s=function(){function e(){r(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 n(e)},e}();t.default=s},function(e,t,o){!function(){function e(e){this.message=e}var o=t,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.prototype=new Error,e.prototype.name="InvalidCharacterError",o.btoa||(o.btoa=function(t){for(var o,n,i=String(t),s=0,a=r,u="";i.charAt(0|s)||(a="=",s%1);u+=a.charAt(63&o>>8-s%1*8)){if((n=i.charCodeAt(s+=.75))>255)throw new e("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");o=o<<8|n}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 n,i,s=0,a=0,u="";i=o.charAt(a++);~i&&(n=s%4?64*n+i:i,s++%4)?u+=String.fromCharCode(255&n>>(-2*s&6)):0)i=r.indexOf(i);return u})}()},function(e,t,o){"use strict";function r(e){return"undefined"!=typeof Blob&&e instanceof Blob?e.size:0}t.__esModule=!0,t.default=r},function(e,t,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(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=o(0),u=r(a),f=o(65),c=r(f),l=function(e){function t(o){n(this,t);var r=i(this,e.call(this,o));return r.team=new c.default(o),r}return s(t,e),t}(u.default);t.default=l},function(e,t,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(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=o(0),u=r(a),f=o(66),c=r(f),l=function(e){function t(o){n(this,t);var r=i(this,e.call(this,o));return r.users=new c.default(o),r}return s(t,e),t}(u.default);t.default=l},function(e,t,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(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=o(0),f=r(u),c=o(3),l=r(c),p=function(e){function t(){return n(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,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(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=o(0),c=r(f),l=o(26),p=r(l),d=o(14),h=r(d),y=o(15),m=r(y),w=o(22),v=o(68),_=r(v),b=function(e){function t(o){n(this,t);var r=i(this,e.call(this,o));return r.steps=new _.default(o),r}return s(t,e),t.prototype.create=function(e){var t=this,o=e.save,r=void 0!==o&&o,n=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(r&&!n)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(n).then(function(e){return y=e.id,Promise.all([e,Promise.all(c.map(function(o){var r=e.getStepByPosition(o.position);return r?t._setWorkflowStepUsersMutate(e.id,r,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 r?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(r){var n=(new h.default).fromWorkflowStep(r.data);return o._setWorkflowStepUsersMutate(e,n,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 r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(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=o(0),a=function(e){return e&&e.__esModule?e:{default:e}}(s),u=function(e){function t(){return r(this,t),n(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,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(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(o){e[o].Comments.forEach(function(e){t.push(e)})}),t}function u(e){var t=[],o=[];e.forEach(function(e){var r=(new p.default).fromComment(e);r.parentCommentId?o.push(r):t.push(r)}),t.sort(R);var r=t.map(function(e){return e.id}),n=(0,m.sortObjectsBy)(function(e){return r.indexOf(e.parentCommentId)},!0);return o.sort((0,m.combineSort)(k,n)),t.concat(o)}t.__esModule=!0;var f=o(0),c=r(f),l=o(29),p=r(l),d=o(16),h=r(d),y=o(2),m=o(24),w=o(18),v=o(31),_=r(v),b=o(17),E=r(b),O=o(71),g=o(72),P=r(g),I=(0,m.sortObjectsByKey)("pageNumber"),T=(0,m.sortObjectsByKey)("createdDate",!0),S=(0,m.sortObjectsByKey)("createdDate",!1),R=(0,m.combineSort)(I,T),k=(0,m.combineSort)(I,S),M=function(e){function t(){return n(this,t),i(this,e.apply(this,arguments))}return s(t,e),t.prototype._mark=function(e,t,o){var r,n=void 0;switch(t){case h.default.TODO:n="change";break;case h.default.DONE:n="done";break;default:throw new Error('Cannot mark comment state "'+t+'".')}var i=(r={commentId:e},r[n]=o?1:0,r);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,r=o.proofId,n=o.pageNumber,i=void 0===n?null:n,s=o.sinceDate,f=void 0===s?null:s,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,b=f?f.toISOString().match(y.ISO_REGEX)[0]:y.DEFAULT_ISO_DATE,E={proofId:r,page:i,timestamp:b};return this.client.request(null!==i?"comments.load-page":"comments.load-all",E).then(function(e){var o=u(e.data.Pages?a(e.data.Pages):e.data),r=Promise.resolve();if(d){var n=[],i=[],s=m?(0,P.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){n.push({comment:e,resolve:t})}).then(function(t){return t&&e.fromRawComment(t),e})}));r=r.then(function(){return f}),r=r.then(function(){var e=n.map(function(e){var o=e.comment,r=e.resolve;return t.client.crypto().decryptComment(o.comment$,o.envelope,t.client.session.privateKeyPEM).then(function(e){o.fromRawComment(e),r(e),h&&h(o),i.push(o),s()}).catch(function(e){if(_&&_(e,o),!l)return Promise.reject(e)})});return l?null:Promise.all(e)})}return r.then(function(){return o})})},t.prototype.create=function(e){var t=this,o=e.raw,r=e.tokens,n=e.proofId,i=e.pageNumber,s=void 0===i?1:i,a=e.pin,u=e.mediaTime,f=e.mediaDuration,c=e.parentCommentId,l=e.metadata,d=e.state,y=e.creationToken,m=[],v=o||(0,w.serialize)(r),b=r||(0,E.default)(o);m.push.apply(m,(0,_.default)(b));var g=y||(0,O.generateCreationToken)();return this.client.crypto().encryptComment(v,[this.client.session.serverPublicKeyPEM,this.client.session.publicKeyPEM]).then(function(e){var t=e.envelope,o=e.comment$;return{proofId:n,page:c?void 0:s,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 u?u:null,duration:"number"==typeof f?f:null}),parent:c||void 0,mentions:m,metadata:l?JSON.stringify(l):"{}",creationToken:g,change:d===h.default.TODO?"1":void 0,done:d===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(v)})}).catch(function(e){return e&&(e.creationToken=g),Promise.reject(e)})},t}(c.default);t.default=M},function(e,t,o){"use strict";function r(e){for(var t=[],o=e.split(/\n/g),r=0;r<o.length;r++){var i=o[r],s=[];if(0===r){var a=i.match(n.COMMENT_LABEL_REGEX);a&&s.push({type:"label",index:0,length:a[0].length,metadata:{label:a[1].toLowerCase()}})}for(var u=void 0;null!==(u=n.MENTION_REGEX.exec(i));){var f=u,c=f[0],l=f[1],p=f[2];s.push({type:"mention",index:u.index,length:p.length,metadata:{id:l}}),i=i.substring(0,u.index)+p+i.substring(u.index+c.length)}t.push({type:"text",value:i,styles:[],entities:s})}return{version:2,blocks:t}}t.__esModule=!0,t.parse=void 0;var n=o(2);t.parse=r},function(e,t,o){"use strict";function r(){for(var e=(new Date).getTime(),t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~`!@#$%^&*()_+-={}[]:\";'<>?,./|\\",o="",r=n;r>0;--r)o+=t[Math.round(Math.random()*(t.length-1))];return o+"-"+e}t.__esModule=!0;var n=32;t.generateCreationToken=r},function(e,t,o){"use strict";function r(e,t){var o=void 0;return function(){o||(o=setTimeout(function(){e(),o=null},t))}}t.__esModule=!0,t.default=r},function(e,t,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(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=o(0),u=r(a),f=o(8),c=r(f),l=function(e){function t(){return n(this,t),i(this,e.apply(this,arguments))}return s(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,r=this.client.crypto();return Promise.all([r.generatePasswordHash(e),r.generatePasswordHash(t),r.encryptPrivateKey(this.client.session.privateKeyPEM,t)]).then(function(e){var t=e[0],r=e[1],n=e[2];return o.client.request("profile.change-password",{oldPassword:t,newPassword:r,newPrivateKey:n})})},t}(u.default);t.default=l},function(e,t,o){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(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=o(0),a=function(e){return e&&e.__esModule?e:{default:e}}(s),u=function(e){function t(){return r(this,t),n(this,e.apply(this,arguments))}return i(t,e),t.prototype.check=function(){return this.client.request("sessions.check").then(function(){return null})},t}(a.default);t.default=u},function(e,t,o){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var n="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(6),s=function(e){return e&&e.__esModule?e:{default:e}}(i),a=o(13)("EventEmitter"),u=function(){function e(){r(this,e),this.handlers={}}return e.prototype.getHandlers=function(e){var t=this,o=[],r=[e];if(-1!==e.indexOf("."))for(var n=e;(n=n.substring(0,n.lastIndexOf("."))).length;)r.push(n+".*");return r.push("*"),r.forEach(function(e){(0,s.default)(t.handlers,e)&&o.push.apply(o,t.handlers[e])}),o},e.prototype.on=function(e,t){if("function"!=typeof t)return void a("Handler is not a function, got "+(void 0===t?"undefined":n(t)));(0,s.default)(this.handlers,e)||(this.handlers[e]=[]),this.handlers[e].push(t)},e.prototype.off=function(e,t){if((0,s.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],r=this.getHandlers(e),n=new Array(r.length);a("Emitting"+(o?" async":"")+' "'+e+'" event ('+(t?"with":"without")+" data) to "+r.length+" handler(s)");var i=Object.freeze({type:e,data:t,timestamp:Date.now()});return r.forEach(function(e,t){try{n[t]=e(i)}catch(e){n[t]=e}}),o?Promise.all(n):n},e}();t.default=u},function(e,t,o){"use strict";t.__esModule=!0,t.default=function(e,t,o){return new Promise(function(r,n){setTimeout(function(){void 0!==o?n(o):r(t)},e)})}},function(e,t,o){"use strict";function r(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 n=o(16),i=r(n),s=o(78),a=r(s),u=o(5),f=r(u),c=o(25),l=r(c),p=o(20),d=r(p),h=o(21),y=r(h),m=o(10),w=r(m),v=o(28),_=r(v),b=o(79),E=r(b),O=o(27),g=r(O);t.CommentState=i.default,t.FileAssignee=a.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=g.default},function(e,t,o){"use strict";t.__esModule=!0;var r={PROOF:"proof",ATTACHMENT:"attachment",SNAPSHOT:"snapshot"};t.default=r},function(e,t,o){"use strict";t.__esModule=!0;var r={REVIEWER:"reviewer",MANDATORY:"mandatory",GATEKEEPER:"gatekeeper",APPROVER:"approver"};t.default=r},function(e,t,o){"use strict";function r(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 n=o(29),i=r(n),s=o(12),a=r(s),u=o(30),f=r(u),c=o(4),l=r(c),p=o(11),d=r(p),h=o(23),y=r(h),m=o(7),w=r(m),v=o(3),_=r(v),b=o(26),E=r(b),O=o(14),g=r(O),P=o(15),I=r(P);t.Comment=i.default,t.File=a.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=g.default,t.WorkflowUser=I.default},function(e,t,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e){return"string"==typeof e&&(e=(0,s.default)(e)),(0,f.default)(e)}t.__esModule=!0,t.comments=void 0;var i=o(17),s=r(i),a=o(18),u=o(31),f=r(u);t.comments={parse:s.default,serialize:a.serialize,mentions:n}}])});
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(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=36)}([function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=function e(t){n(this,e),this.client=t};t.default=o},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t,r){var n=[],o={};return Array.isArray(t)?(n=t,t.forEach(function(e){o[e]=e})):(0,y.default)(t)&&(n=Object.keys(t),o=t),n.forEach(function(t){var n=o[t],i=void 0;if("string"==typeof n)i=-1!==n.indexOf(".")?function(){for(var e=n.split("."),t=r,o=0;o<e.length;o++){var i=e[o];if(!(0,_.default)(t,i)){t=void 0;break}t=t[i]}return t}:function(){return r[n]};else{if("function"!=typeof n){if(null===n)return;throw new Error("Unknown transformer.")}i=n}var a=i.call(e,r);void 0!==a&&(e[t]=a)}),e}function i(e){return function(t){return Number(t[e])}}function a(e,t){return function(r){return t[r[e]]}}function u(e){return function(t){var r=t[e];if(r&&"0001-01-01T00:00:00"!==r)return"number"==typeof r?new Date(1e3*r):new Date(r+"Z")}}function s(e){return function(t){var r=String(t[e]);return"1"===r||"true"===r}}function c(e){return function(t){return _.default.call(t,e)}}function f(e,t){return function(r){return r[e]?r[e].map(t):[]}}function l(e,t){return function(r){return r[e]?JSON.parse(r[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 r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};t.number=i,t.enumeration=a,t.date=u,t.truthy=s,t.exists=c,t.each=f,t.json=l,t.optional=p;var h=r(9),y=n(h),m=r(6),_=n(m);t.default=o},function(e,t,r){"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)}{(.*?)}/,t.COMMENT_LABEL_REGEX=/^(approved|highlight):/i,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,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(1),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={id:"UserId",name:"Name",email:"Email",hasActivated:"Activated",hasRegistered:"IsRegistered",hasAvatar:"HasAvatar",accountType:"AccountType",teamType:"TeamType",teamLogo:"Branding.LogoURL",registeredDate:(0,o.date)("Registered"),lastLoginDate:(0,o.date)("LastLogin"),lastUploadDate:(0,o.date)("LastUpload"),isAdmin:"IsDomainAdmin"},u=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=u},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(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=r(1),u=n(a),s=r(20),c=n(s),f=r(21),l=n(f),p=r(5),d=n(p),h=r(22),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",todoCommentCount:(0,a.number)("CountTodoComments"),doneCommentCount:(0,a.number)("CountDoneComments")},m=function(){function e(){o(this,e)}return e.prototype.getState=function(){var e=c.default.ACTIVE;return this.fileStatus===d.default.UPLOADING?e=c.default.UPLOADING:this.hasFileError()?e=c.default.FILE_ERROR:this.isProcessing()?e=c.default.PROCESSING:this.status===l.default.ARCHIVED?e=c.default.ARCHIVED:this.hasWorkflow()?this.status===l.default.TODOS_REQUESTED?e=c.default.TODOS_REQUESTED:this.status===l.default.AWAITING_NEW_VERSION?e=c.default.AWAITING_NEW_VERSION:this.status===l.default.APPROVED?e=c.default.APPROVED:this.hasWorkflowStarted()?this.isOverdue&&(e=c.default.OVERDUE):e=c.default.NOT_STARTED:e=c.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()===c.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,u.default)(this,y,e),this.calculateState(),this},e}();t.default=m},function(e,t,r){"use strict";t.__esModule=!0;var n={OK:"OK",UPLOADING:"Uploading",QUEUED:"Queued",RIPPING:"Ripping",ERROR:"Error"};t.default=n},function(e,t,r){"use strict";t.__esModule=!0,t.default=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=r(1),a=n(i),u=r(3),s=n(u),c={userId:"UserId",token:"Token",sharedKey:"SharedKey",privateKeyPEM$:"PrivateKey",privateKeyPEM:null,publicKeyPEM:"PublicKey",serverPublicKeyPEM:"PublicServerKey"},f=function(){function e(){o(this,e)}return e.prototype.fromJSON=function(e){return(0,a.default)(this,Object.keys(c),e),this.user=(new s.default).fromJSON(e.user),this},e.prototype.fromSession=function(e){return(0,a.default)(this,c,e),this.user=(new s.default).fromUser(e),this},e}();t.default=f},function(e,t,r){"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=r(63).default;break;case"Buffer":e=r(64).default;break;case"String":e=r(65).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 o=r(13)("bluffer");n.driver="String","undefined"!=typeof Blob?n.driver="Blob":(o("The current JavaScript environment does not support native Bluffer, falling back to using StringBluffer."),n.driver="String"),t.default=n},function(e,t,r){"use strict";t.__esModule=!0;var n=Object.prototype.toString;t.default=function(e){return"[object Object]"===n.call(e)}},function(e,t,r){"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,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=r(1),a=n(i),u=r(4),s=n(u),c={id:"GroupId",name:"Name",proofs:(0,i.each)("ProofInfo",function(e){return(new s.default).fromProof(e)})},f=function(){function e(){o(this,e)}return e.prototype.fromProofGroup=function(e){return(0,a.default)(this,c,e),this},e}();t.default=f},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(1),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={id:"FileId",name:"Name",blocks:"Chunks",downloadable:"Downloadable",assignedTo:"AssignedTo",assignedType:"AssignedType",status:"Status",message:"Message"},u={id:"Attachment",name:"AttachmentName",blocks:"AttachmentChunks",assignedTo:"CommentId",assignedType:function(){return"attachment"},status:"AttachmentStatus",message:function(){return""}},s=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,u,e),this},e}();t.default=s},function(e,t,r){"use strict";e.exports=function e(){return e}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=r(1),a=n(i),u=r(15),s=n(u),c=r(28),f=n(c),l={id:"StepId",name:"Title",position:(0,i.number)("Position"),state:function(e){return e.Complete?f.default.COMPLETE:e.Visible?f.default.VISIBLE:f.default.NOT_VISIBLE},users:(0,i.each)("Users",function(e,t){var r=(new s.default).fromWorkflowUser(e);return r._calculateState(e,t),r})},p=function(){function e(){o(this,e)}return e.prototype.fromWorkflowStep=function(e){return(0,a.default)(this,l,e),this},e}();t.default=p},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(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 u=r(1),s=n(u),c=r(3),f=n(c),l=r(27),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 o(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,s.default)(this,d,e),this},t}(f.default);t.default=h},function(e,t,r){"use strict";t.__esModule=!0;var n={COMMENT:"comment",TODO:"todo",DONE:"done",UNMARKED_DONE:"unmarked-done"};t.default=n},function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function o(e){if(0===e.indexOf(d)){var t=e.substring(d.length,e.indexOf(h));return parseInt(t,10)}if(e.match(l))try{return JSON.parse(e)[p]}catch(e){}return 1}function i(e){var t=o(e),r=f[t];if(r)return r(e);throw new Error("Unsupported comment schema version. Please update to a newer version of the SDK.")}t.__esModule=!0,t.getVersionNumber=void 0;var a=r(76),u=n(a),s=r(18),c=n(s),f={2:c.parse,1:u.parse},l=/^\s*{/,p="_",d='{"_":',h=",";t.default=i,t.getVersionNumber=o},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(Array.isArray(e))return e.map(function(e){return o(e,t)});if((0,l.default)(e)){var r={};for(var n in e)(0,c.default)(e,n)&&t[n]&&(r[t[n]]=o(e[n],t));return r}return e}function i(e){return o(JSON.parse(e),p)}function a(e){var t=o(u({version:2},e),d);return JSON.stringify(t)}t.__esModule=!0,t.serialize=t.parse=void 0;var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(6),c=n(s),f=r(9),l=n(f),p={_:"version",bs:"blocks",t:"type",v:"value",i:"index",l:"length",st:"styles",en:"entities",md:"metadata",i_:"id",lb:"label",ur:"url"},d={};for(var h in p)(0,c.default)(p,h)&&(d[p[h]]=h);t.parse=i,t.serialize=a},function(e,t,r){"use strict";t.__esModule=!0;var n=void 0;n="104.0.1538691344811",t.default=n},function(e,t,r){"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,r){"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,r){"use strict";var n={Proof:"P",Workflow:"W",File:"F",User:"U",Brief:"B"},o={};Object.keys(n).forEach(function(e){o["is"+e+"Id"]=function(t){return t&&16===t.length&&t[0]===n[e]}}),e.exports=o},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(1),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={id:"ProofId",version:"Version"},u=function(){function e(){n(this,e)}return e.prototype.fromProofVersion=function(e){return(0,i.default)(this,a,e),this},e}();t.default=u},function(e,t,r){"use strict";function n(e,t){return o(function(t){return t[e]},t)}function o(e,t){var r=t?1:-1,n=t?-1:1;return function(t,o){var i=e(t),a=e(o);return i<a?r:i>a?n:0}}function i(e,t){var r={};t.forEach(function(e,t){r[e]=t});var n="function"==typeof e?e:function(t){return t[e]};return function(e,t){var o=r[n(e)],i=r[n(t)];return o<i?-1:o>i?1:0}}function a(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length;return function(e,r){for(var o=0;o<n;o++){var i=t[o](e,r);if(i)return i}return 0}}t.__esModule=!0,t.sortObjectsByKey=n,t.sortObjectsBy=o,t.sortObjectsByValues=i,t.combineSort=a},function(e,t,r){"use strict";t.__esModule=!0;var n={NONE:"none",GOOGLE_DRIVE:"drive",DROPBOX:"dropbox",ONEDRIVE:"onedrive",BOX:"box"};t.default=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=r(1),a=n(i),u=r(14),s=n(u),c={id:"WorkflowId",name:"Title",steps:(0,i.each)("WorkflowSteps",function(e){return(new s.default).fromWorkflowStep(e)})},f=function(){function e(){o(this,e)}return e.prototype.getStepByPosition=function(e){for(var t=this.steps.length,r=0;r<t;r+=1){var n=this.steps[r];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,c,e),this},e}();t.default=f},function(e,t,r){"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,r){"use strict";t.__esModule=!0;var n={NONE:null,NOT_VISIBLE:"not-visible",VISIBLE:"visible",COMPLETE:"complete"};t.default=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=r(1),a=n(i),u=r(3),s=n(u),c=r(30),f=n(c),l=r(12),p=n(l),d=r(16),h=n(d),y=r(17),m=n(y),_={__prepare:function(e){e._XY=f.default.parseValue(e.XY)},id:"CommentId",proofId:"ProofId",pin:function(e){return(new f.default).fromPin(e._XY)},user:function(e){return(new s.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?+e.Change?h.default.DONE:h.default.UNMARKED_DONE:+e.Change?h.default.TODO:h.default.COMMENT}},v=function(){function e(){o(this,e)}return e.prototype.fromComment=function(e){return(0,a.default)(this,_,e),this},e.prototype.fromRawComment=function(e){var t=(0,m.default)(e);return this.raw=e,this.tokens=t,this},e}();t.default=v},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i=r(1),a=function(e){return e&&e.__esModule?e:{default:e}}(i),u={x:"x",y:"y",x2:(0,i.optional)("x2"),y2:(0,i.optional)("y2")},s=function(){function e(){n(this,e)}return e.prototype.fromPin=function(e){return(0,a.default)(this,u,e),this},e.parseValue=function(e){var t={x:null,y:null,x2:null,y2:null,time:null,duration:null};if("{"===e[0]){var r=JSON.parse(e);t=o({},t,r)}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=s},function(e,t,r){"use strict";function n(e){var t=[];return e.blocks.forEach(function(e){e.entities.forEach(function(e){if("mention"===e.type){var r=e.metadata.id;-1===t.indexOf(r)&&t.push(r)}})}),t}t.__esModule=!0,t.default=n},function(e,t,r){"use strict";function n(e,t){for(var r=new Array(t),n=t;n>0;--n)r[n]=e[Math.round(Math.random()*(e.length-1))];return r.join("")}t.__esModule=!0;t.lower="abcdefghijklmnopqrstuvwxyz",t.upper="ABCDEFGHIJKLMNOPQRSTUVWXYZ",t.numbers="0123456789",t.symbols="~`!@#$%^&*()_+-={}[]:\";'<>?,./|\\";t.default=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments[2],n=arguments[3],o=0,a=[].concat(i(e),i(t)).sort(function(e,t){return e.offset-t.offset}),u=[];return a.length<1?(u.push(new d.default({block:n,start:0,end:r.length})),u):(a.forEach(function(e){e.offset>o&&u.push(new d.default({block:n,start:o,end:e.offset})),u.push(new d.default({block:n,entity:e.key,decorator:e.component,decoratorProps:e.decoratorProps,decoratedText:e.component?h(r,e.offset,e.offset+e.length):void 0,start:e.offset,end:e.offset+e.length,contentState:e.contentState})),o=e.offset+e.length}),o<r.length&&u.push(new d.default({block:n,start:o,end:r.length})),u)}function u(e,t){return t.forEach(function(t){e.push(t.offset),e.push(t.offset+t.length)}),e}function s(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],o=[];return o=u(o,t),o=u(o,r),o=u(o,n),o.push(0),o.push(e.length),o.filter(function(e,t,r){return r.indexOf(e)===t}).sort(function(e,t){return e-t})}Object.defineProperty(t,"__esModule",{value:!0});var c=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),f=r(34),l=n(f),p=r(92),d=n(p),h=function(e,t,r){return l.default.ucs2.encode(e.slice(t,r))},y=function(){function e(t){var r=t.flat,n=void 0!==r&&r;o(this,e),this.flat=n}return c(e,[{key:"relevantStyles",value:function(e){return this.ranges.filter(function(t){return e>=t.offset&&e<t.offset+t.length}).map(function(e){return e.style})}},{key:"nodeIterator",value:function(e,t,r){var n=this,o=this.relevantIndexes.slice(this.relevantIndexes.indexOf(t),this.relevantIndexes.indexOf(r));return o.forEach(function(t,i){var a=n.relevantStyles(t),u=o[i+1]?o[i+1]-t:1,s=h(n.textArray,t,t+u);e.pushContent(s,a,n.flat),!o[i+1]&&t<r&&e.pushContent(h(n.textArray,t+1,r),n.relevantStyles(r-1),n.flat)}),e}},{key:"parse",value:function(e){var t=this,r=e.text,n=e.inlineStyleRanges,o=e.entityRanges,i=e.decoratorRanges,u=void 0===i?[]:i;this.textArray=l.default.ucs2.decode(r),this.ranges=n,this.iterator=0,this.relevantIndexes=s(r,n,o,u);var c=a(o,u,this.textArray,e),f=c.map(function(e){return t.nodeIterator(e,e.start,e.end)});return new d.default({block:e,content:f})}}]),e}();t.default=y},function(e,t,r){"use strict";function n(e){throw new RangeError(l[e])}function o(e,t){for(var r=[],n=e.length;n--;)r[n]=t(e[n]);return r}function i(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),e=e.replace(f,"."),n+o(e.split("."),t).join(".")}function a(e){for(var t=[],r=0,n=e.length;r<n;){var o=e.charCodeAt(r++);if(o>=55296&&o<=56319&&r<n){var i=e.charCodeAt(r++);56320==(64512&i)?t.push(((1023&o)<<10)+(1023&i)+65536):(t.push(o),r--)}else t.push(o)}return t}t.__esModule=!0;var u=2147483647,s=/^xn--/,c=/[^\0-\x7E]/,f=/[\x2E\u3002\uFF0E\uFF61]/g,l={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},p=Math.floor,d=String.fromCharCode,h=function(e){return String.fromCodePoint.apply(String,e)},y=function(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:36},m=function(e,t){return e+22+75*(e<26)-((0!=t)<<5)},_=function(e,t,r){var n=0;for(e=r?p(e/700):e>>1,e+=p(e/t);e>455;n+=36)e=p(e/35);return p(n+36*e/(e+38))},v=function(e){var t=[],r=e.length,o=0,i=128,a=72,s=e.lastIndexOf("-");s<0&&(s=0);for(var c=0;c<s;++c)e.charCodeAt(c)>=128&&n("not-basic"),t.push(e.charCodeAt(c));for(var f=s>0?s+1:0;f<r;){for(var l=o,d=1,h=36;;h+=36){f>=r&&n("invalid-input");var m=y(e.charCodeAt(f++));(m>=36||m>p((u-o)/d))&&n("overflow"),o+=m*d;var v=h<=a?1:h>=a+26?26:h-a;if(m<v)break;var b=36-v;d>p(u/b)&&n("overflow"),d*=b}var g=t.length+1;a=_(o-l,g,0==l),p(o/g)>u-i&&n("overflow"),i+=p(o/g),o%=g,t.splice(o++,0,i)}return String.fromCodePoint.apply(String,t)},b=function(e){var t=[];e=a(e);for(var r=e.length,o=128,i=0,s=72,c=e,f=Array.isArray(c),l=0,c=f?c:c[Symbol.iterator]();;){var h;if(f){if(l>=c.length)break;h=c[l++]}else{if(l=c.next(),l.done)break;h=l.value}var y=h;y<128&&t.push(d(y))}var v=t.length,b=v;for(v&&t.push("-");b<r;){for(var g=u,w=e,E=Array.isArray(w),O=0,w=E?w:w[Symbol.iterator]();;){var k;if(E){if(O>=w.length)break;k=w[O++]}else{if(O=w.next(),O.done)break;k=O.value}var P=k;P>=o&&P<g&&(g=P)}var I=b+1;g-o>p((u-i)/I)&&n("overflow"),i+=(g-o)*I,o=g;for(var T=e,S=Array.isArray(T),R=0,T=S?T:T[Symbol.iterator]();;){var D;if(S){if(R>=T.length)break;D=T[R++]}else{if(R=T.next(),R.done)break;D=R.value}var A=D;if(A<o&&++i>u&&n("overflow"),A==o){for(var C=i,x=36;;x+=36){var j=x<=s?1:x>=s+26?26:x-s;if(C<j)break;var M=C-j,F=36-j;t.push(d(m(j+M%F,0))),C=p(M/F)}t.push(d(m(C,0))),s=_(i,I,b==v),i=0,++b}}++i,++o}return t.join("")},g=function(e){return i(e,function(e){return s.test(e)?v(e.slice(4).toLowerCase()):e})},w=function(e){return i(e,function(e){return c.test(e)?"xn--"+b(e):e})},E={version:"2.1.0",ucs2:{decode:a,encode:h},decode:v,encode:b,toASCII:w,toUnicode:g};t.ucs2decode=a,t.ucs2encode=h,t.decode=v,t.encode=b,t.toASCII=w,t.toUnicode=g,t.default=E},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t,r){for(var n=t;n<r;n++)if(null!=e[n])return!1;return!0}function i(e,t,r,n){for(var o=t;o<r;o++)e[o]=n}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=function(){function e(t){n(this,e),this.decorators=t.slice()}return a(e,[{key:"getDecorations",value:function(e,t){var r=Array(e.getText().length).fill(null);return this.decorators.forEach(function(n,a){var u=0;(0,n.strategy)(e,function(e,t){o(r,e,t)&&(i(r,e,t,a+"."+u),u++)},t)}),r}},{key:"getComponentForKey",value:function(e){var t=parseInt(e.split(".")[0],10);return this.decorators[t].component}},{key:"getPropsForKey",value:function(e){var t=parseInt(e.split(".")[0],10);return this.decorators[t].props}}]),e}();t.default=u},function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function o(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.version=t.util=t.Model=t.Enum=t.Bluffer=t.Client=void 0;var i=r(37),a=o(i),u=r(8),s=o(u),c=r(83),f=n(c),l=r(87),p=n(l),d=r(19),h=o(d),y=r(88),m=n(y);t.default=a.default,t.Client=a.default,t.Bluffer=s.default,t.Enum=f,t.Model=p,t.util=m,t.version=h.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=r(38),a=n(i),u=r(43),s=n(u),c=r(44),f=n(c),l=r(46),p=n(l),d=r(48),h=n(d),y=r(50),m=n(y),_=r(52),v=n(_),b=r(53),g=n(b),w=r(60),E=n(w),O=r(61),k=n(O),P=r(68),I=n(P),T=r(71),S=n(T),R=r(73),D=n(R),A=r(75),C=n(A),x=r(79),j=n(x),M=r(80),F=n(M),q=r(7),z=n(q),N=r(81),B=n(N),U=r(10),K=n(U),L=r(82),G=n(L),W=r(13)("PageProof"),V=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,e),this.options=t,this.events=new B.default,this.adapters=new a.default(this.options.adapters),this.cache=new s.default(this),this.accounts=new h.default(this),this.comments=new C.default(this),this.dashboard=new m.default(this),this.files=new k.default(this),this.profile=new j.default(this),this.proofs=new g.default(this),this.briefs=new E.default(this),this.users=new v.default(this),this.workflows=new S.default(this),this.preferences=new D.default(this),this.sessions=new F.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,G.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 z.default?this.session=e||null:this.session=(new z.default).fromJSON(e),this.session},e.prototype.request=function(e,t,r){var n=this,o=new f.default(e,t),i=this.adapters.getRequestAdapter(),a=Promise.resolve();if(!o.endpoint.anonymous){if(!this.session)return Promise.reject(new Error("Cannot make call to endpoint ("+e+") when unauthorized."));a=this.adapters.getCryptoAdapter().generateAuthorizationHeaders(o.getMethod(),o.getPath(),this.session).then(function(e){return o.addHeaders(e)})}var u={request:o};return a.then(function(){var e=o.build();return n.events.emit("experimental.request.before",u,!0).then(function(){return e})}).then(function(e){return i.send(e,r)}).then(p.default.parse).then(function(o){if(u.response=o,n.events.emit("experimental.request.after",u),o.code===K.default.ERROR_THROTTLED){var i=n.events.emit("error.throttled",u);if(i.some(Boolean))return Promise.all(i).then(function(){return n.events.emit("experimental.request.retry",u),n.request(e,t,r)})}if(o.code===K.default.ERROR_UNAUTHORISED){var a=n.session?n.session.token:null;return n.events.emit("error.unauthorized",u,!0).then(function(){return n.session&&n.session.token!==a?n.request(e,t,r):o})}if(o.deprecated){var s="The "+e+" API has been deprecated. "+(o.deprecated||"");n.events.emit("error.deprecated",{name:e,message:s})}return o}).then(function(t){try{if(t.error){n.events.emit("error.response",u);var r=new Error(e+" request resulted in an "+t.code+" error.");return r.response=t,r.request=o,Promise.reject(r)}return n.events.emit("experimental.request.resolve",u),Promise.resolve(t)}finally{n.events.emit("experimental.request.finally",u)}})},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=V},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=r(39),a=n(i),u=r(40),s=n(u),c=r(41),f=n(c),l=r(42),p=n(l),d=function(){function e(t){o(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=[],r=e.__adapter__,n=0;n<this.adapters.length;n+=1){var o=this.adapters[n];Object.getPrototypeOf(Object.getPrototypeOf(o)).constructor.__adapter__===r&&t.push(o)}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(s.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(f.default)},e.prototype.getEnhancementAdapters=function(){return this.getAnyAdaptersInstanceOf(p.default)},e}();t.default=d},function(e,t,r){"use strict";function n(){}t.__esModule=!0,n.__adapter__="ICryptoAdapter",t.default=n},function(e,t,r){"use strict";function n(){}t.__esModule=!0,n.__adapter__="IRequestAdapter",t.default=n},function(e,t,r){"use strict";function n(){}t.__esModule=!0,n.__adapter__="ICacheAdapter",t.default=n},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t,r){var n=e[t];e[t]=function(){for(var e=arguments.length,t=Array(e),o=0;o<e;o++)t[o]=arguments[o];var i=n.bind.apply(n,[this].concat(t));return r(i,this,t).apply(this,t)}}function i(e){function t(o){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a=Object.getOwnPropertyNames(o).filter(function(t){return o[t].client===e}),u=Object.getPrototypeOf(o),s=Object.keys(u).filter(function(e){return"function"==typeof u[e]&&0!==e.indexOf("_")});(i.length||r)&&s.forEach(function(e){n.push({namespace:i.join("."),name:e,api:o})}),a.forEach(function(e){t(o[e],i.concat(e))})}var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=[];return t(e),n}t.__esModule=!0;var a,u,s=(u=a=function(){function e(){n(this,e)}return e.prototype.onClientReady=function(e){var t=this;i(e).forEach(function(e){o(e.api,e.name,function(r){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=r()}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",u);t.default=s},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=function(){function e(t){n(this,e),this.client=t}return e.prototype.auto=function(e,t){var r=this.client.adapters.getCacheAdapter(),n=function(){};return r?(n=function(t){void 0!==t&&r.set(e,t)},r.get(e).catch(function(){return Promise.resolve(t(n)).then(function(e){return n(e),e})})):Promise.resolve(t(n))},e}();t.default=o},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(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 r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a=r(45),u=n(a),s=r(9),c=n(s),f=r(19),l=n(f),p=r(2),d=function(){function e(t,r){if(o(this,e),this.name=t,this.endpoint=u.default[t],!this.endpoint)throw new Error('Unknown request endpoint "'+t+'".');this.params={},this.addParams(r),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,r=t.path,n=t.chain,o=t.trailing,i=r;return n&&n.forEach(function(t){"/"!==i[i.length-1]&&(i+="/"),i+=e.params[t]}),o&&"/"!==i[i.length-1]&&(i+="/"),i},e.prototype.getQuery=function(){var e=this,t=this.endpoint.query;if(t){var r=t.map(function(t){return void 0!==e.params[t]?t+"="+encodeURIComponent(e.params[t]):null}).filter(Boolean).join("&");if(r)return"?"+r}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 r=this.params[t.body];return r=(0,c.default)(r)?JSON.stringify(r):String(r)}var n=!0===t.body?Object.keys(this.params):t.body,o={};switch(n.forEach(function(t){var r=e.params[t];void 0!==r&&(o[t]=r)}),t.version){case 2:return JSON.stringify(o);case 1:default:return Object.keys(o).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,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=r(10),a=n(i),u=r(47),s=r(2),c=r(6),f=n(c),l=function(){function e(){o(this,e),this.error=!1,this.code=-1,this.data=null,this.message=null,this.deprecated=null}return e.parse=function(t){var r=t.status,n=t.headers,o=void 0===n?{}:n,i=t.body,c=new e;if(r===u.TOO_MANY_REQUESTS_STATUS)return c.error=!0,c.message="PageProof Error #h"+u.TOO_MANY_REQUESTS_STATUS,c.code=a.default.ERROR_THROTTLED,c.data={timeout:1e3*(parseFloat(o[s.RETRY_AFTER_HEADER])||60)},c;if((0,f.default)(o,"deprecated")&&(c.deprecated=o.deprecated),r===u.OK_STATUS&&!i)return c.code=a.default.OK,c;try{var l=JSON.parse(i);"string"==typeof l||(l&&"ResponseCode"in l?(c.code=l.ResponseCode,c.code!==a.default.OK&&(c.error=!0)):l.Message&&1===Object.keys(l).length&&(c.error=!0,c.code=a.default.ERROR_CRITICAL)),c.error&&(c.message="PageProof Error #s"+c.code),c.data=l}catch(e){c.error=!0}return c},e}();t.default=l},function(e,t,r){"use strict";t.__esModule=!0;t.TOO_MANY_REQUESTS_STATUS=429,t.OK_STATUS=200},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(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 u=r(0),s=n(u),c=r(7),f=n(c),l=r(49),p=n(l),d=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.sso=new p.default(r),n}return a(t,e),t.prototype.register=function(e,t){var r=this;return this.client.crypto().generatePasswordHash(t).then(function(e){return Promise.all([e,r.client.crypto().generateKeyPair()])}).then(function(e){var n=e[0],o=e[1];return Promise.all([n,o,r.client.crypto().encryptPrivateKey(o.privateKeyPEM,t)])}).then(function(t){var n=t[0],o=t[1],i=t[2];return Promise.all([o,r.client.request("accounts.register",{email:e,password:n,privateKey:i,publicKey:o.publicKeyPEM})])}).then(function(n){var o=n[0];return Promise.all([o,r.login(e,t,!1)])}).then(function(e){var t=e[0],n=e[1];return Promise.all([t,n,r.generateActivationCode()])}).then(function(e){var t=e[0],r=e[1];return r.privateKeyPEM=t.privateKeyPEM,r})},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 r=this,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return this.client.crypto().generatePasswordHash(t).then(function(t){return r.client.request("accounts.login",{email:e,password:t})}).then(function(t){var r=(new f.default).fromSession(t.data);return r.user.email=e,r}).then(function(e){return n?r.client.crypto().decryptPrivateKey(e.privateKeyPEM$,t).then(function(t){return e.privateKeyPEM=t,e}):e}).then(function(e){return r.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}(s.default);t.default=d},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(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 u=r(0),s=n(u),c=r(7),f=n(c),l=function(e){function t(){return o(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 r=t.key,n=t.key$;return Promise.all([r,e.client.request("sso.get-session",{nonce:n})])}).then(function(t){var r=t[0],n=t[1],o=(new f.default).fromSession(n.data);return Promise.all([o,e.client.crypto().decryptManagedPrivateKey(o.privateKeyPEM$,r)])}).then(function(e){var t=e[0],r=e[1];return t.privateKeyPEM=r,t})},t.prototype.getLoginOptions=function(e){return this.client.request("sso.get-login-options",{email:e}).then(function(e){return e.data})},t}(s.default);t.default=l},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(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 u(e){var t={};return Object.keys(y).forEach(function(r){t[r]=e[y[r]]}),t}function s(e){return(e||[]).map(function(e){return(new p.default).fromProof(e)})}t.__esModule=!0;var c=r(0),f=n(c),l=r(4),p=n(l),d=r(51),h=n(d),y={inbox:"ProofIn",sent:"ProofOut",outbox:"ProofOutBox"},m=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.groups=new h.default(r),n}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 u(e.data)}).then(function(t){return t[e]}).then(s)},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 s(e.data.Proofs)})},t}(f.default);t.default=m},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(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 u(e){return(e||[]).map(function(e){return(new l.default).fromProofGroup(e)})}t.__esModule=!0;var s=r(0),c=n(s),f=r(11),l=n(f),p=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype._loadGroups=function(e){return this.client.request("dashboard.groups.filter-by",{filterBy:e}).then(function(e){return u(e.data)})},t.prototype.current=function(){return this._loadGroups("current")},t}(c.default);t.default=p},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(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 u(e){return e.data.length>0?(new p.default).fromUser(e.data[0]):(new p.default).fromUser(e.data)}function s(e){return e.data.length?(new p.default).fromUser(e.data[0]):null}t.__esModule=!0;var c=r(0),f=n(c),l=r(3),p=n(l),d=function(e){function t(){return o(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(s)},t.prototype.byId=function(e){return this.client.request("users.by-id",{userId:e}).then(u)},t.prototype.invite=function(e){return this.client.request("users.invite",{email:e}).then(u)},t}(f.default);t.default=d},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(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 u=r(0),s=n(u),c=r(54),f=n(c),l=r(55),p=n(l),d=r(56),h=n(d),y=r(57),m=n(y),_=r(4),v=n(_),b=r(5),g=n(b),w=r(2),E=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.owners=new f.default(r),n.editors=new p.default(r),n.versions=new h.default(r),n.groups=new m.default(r),n}return a(t,e),t.prototype.setWorkflow=function(e,t){var r=this;return this.client.request("proofs.normalize-workflow",{proofId:e,workflowId:t}).then(function(){return r.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 r=this;return this.client.request("proofs.set-file",{proofId:e,fileId:t}).then(function(){return r.client.request("proofs.distribute-file",{proofId:e})})},t.prototype.create=function(e){var t=this,r=e.name,n=e.tags,o=void 0===n?[]:n,i=e.dueDate,a=void 0===i?new Date(Date.now()+3*w.DAY_IN_MS):i,u=e.messageToReviewers,s=e.workflow,c=e.file,f=e.group,l=e.start,p=void 0===l||l,d=p&&!f;return this.client.request("proofs.create",{title:r,dueDate:a.toISOString(),description:u,groupId:f?f.id:void 0}).then(function(e){var r=(new v.default).fromProof(e.data);return Promise.all([r,o.length&&t.setTags(r.id,o),s&&t.setWorkflow(r.id,s.id),c&&t.setFile(r.id,c.id)])}).then(function(e){var r=e[0];return Promise.resolve(d&&t.start(r.id)).then(function(){return r})}).then(function(e){return s&&(e.workflowId=s.id),c&&(e.fileId=c.id,e.fileStatus=g.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}(s.default);t.default=E},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(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=r(0),u=function(e){return e&&e.__esModule?e:{default:e}}(a),s=function(e){function t(){return n(this,t),o(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}(u.default);t.default=s},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(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=r(0),u=function(e){return e&&e.__esModule?e:{default:e}}(a),s=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.add=function(e,t,r){var n={proofId:e,editors:[].concat(t),editorMessage:null===r?"":r};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,r){return this.client.request("proofs.editors.replace",{proofId:e,oldEditors:[].concat(t),newEditors:[].concat(r)})},t.prototype.set=function(e,t){return this.client.request("proofs.editors.set",{proofId:e,editors:[].concat(t)})},t}(u.default);t.default=s},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(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 u=r(0),s=n(u),c=r(23),f=n(c),l=r(24),p=(0,l.sortObjectsByKey)("version"),d=function(e){function t(){return o(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 f.default).fromProofVersion(e)}).sort(p)})},t}(s.default);t.default=d},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(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 u(e){return(new l.default).fromProofGroup(e.data)}t.__esModule=!0;var s=r(0),c=n(s),f=r(11),l=n(f),p=r(58),d=n(p),h=r(59),y=n(h),m=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.owners=new d.default(r),n.workflows=new y.default(r),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(u)},t.prototype.load=function(e){return this.client.request("proofs.groups.load",{groupId:e}).then(u)},t.prototype.ready=function(e){return this.client.request("proofs.groups.ready",{groupId:e})},t.prototype.update=function(e,t){var r=t.name;return this.client.request("proofs.groups.update",{groupId:e,name:r}).then(u)},t}(c.default);t.default=m},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(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=r(0),u=function(e){return e&&e.__esModule?e:{default:e}}(a),s=function(e){function t(){return n(this,t),o(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}(u.default);t.default=s},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(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=r(0),u=function(e){return e&&e.__esModule?e:{default:e}}(a),s=function(e){function t(){return n(this,t),o(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}(u.default);t.default=s},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(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 u=r(0),s=n(u),c=r(4),f=n(c),l=r(5),p=n(l),d=r(2),h=function(e){function t(){return o(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 r=this;return this.client.request("proofs.set-file",{proofId:e,fileId:t}).then(function(){return r.client.request("proofs.distribute-file",{proofId:e})})},t.prototype.create=function(e){var t=this,r=e.name,n=e.file,o=e.tags,i=void 0===o?[]:o,a=e.dueDate,u=void 0===a?new Date(Date.now()+3*d.DAY_IN_MS):a;return this.client.request("briefs.create",{title:r,messageToRecipient:"",dueDate:u.toISOString(),tag:i.join(",")}).then(function(e){var r=(new f.default).fromProof(e.data.Brief);return Promise.all([r,n&&t.setFile(r.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,r=e.briefId,n=e.data,o=e.start,i=void 0!==o&&o;return this.client.request("briefs.update",{briefId:r,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 f.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}(s.default);t.default=h},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(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 u(e){var t=e.lastIndexOf(".");return{name:e.substring(0,t),extension:e.substring(t+1)}}t.__esModule=!0;var s=r(0),c=n(s),f=r(12),l=n(f),p=r(5),d=n(p),h=r(25),y=n(h),m=r(62),_=n(m),v=r(8),b=n(v),g=r(67),w=n(g),E=r(2),O=function(e){function t(){return o(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(r,n){var o=null,i=null;!function a(){t.details(e).then(function(t){switch(o=null,t.status){case d.default.OK:r(t);break;case d.default.ERROR:n(new Error("File "+e+" encountered a processing error: "+t.message));break;default:o=setTimeout(a,5e3)}o&&t.status!==d.default.RIPPING||clearTimeout(i)}).catch(n)}(),i=setTimeout(function(){clearTimeout(o),n(new Error("File did not finish processing within specified duration."))},3e4)})},t.prototype.import=function(e){var t=this,r=e.name,n=e.url,o=e.provider,i=void 0===o?y.default.NONE:o,a=e.auth,s=e.download,c=void 0!==s&&s,f=e.process,p=void 0!==f&&f;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=u(r),m=h.name,_=h.extension;return this._generateKeyIVEnvelope().then(function(e){var r=e.envelope;return t.client.request("files.import."+d,{extn:_,filename:m,url:n,envelope:r,accessToken:a,storeOriginal:c})}).then(function(e){return e.data}).then(function(e){if(p)return t._waitFileProcessed(e);var r=new l.default;return r.id=e,r})},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,r=e.name,n=e.contents,o=e.assignedTo,i=e.assignedType,a=e.download,u=void 0!==a&&a,s=e.async,c=void 0===s||s,f=e.onProgress,p=e.onError;return this.generateToken(o,i).then(function(e){return Promise.all([e,t._generateKeyIVEnvelope()])}).then(function(e){var o=e[0],i=e[1],a=i.keyIV,s=i.envelope,l=t._upload({name:r,contents:n,download:u,token:o,keyIV:a,envelope:s,onProgress:f,onError:p});return c&&(l=Promise.resolve()),l.then(function(){return o})}).then(function(e){var t=new l.default;return t.id=e,t})},t.prototype._upload=function(e){var t=this,r=e.name,n=e.contents,o=e.download,i=e.token,a=e.keyIV,s=e.envelope,c=e.onProgress;return new Promise(function(e){function f(){y().then(function(t){if(!b)if(null===t)b=!0,e(m.then(I));else{var r=P(t,v++);m=m.then(function(){return r}),r.then(f)}})}var l=4,p=u(r),d=p.name,h=p.extension,y=(0,_.default)(n),m=Promise.resolve(),v=0,b=!1,g=Math.ceil((0,w.default)(n)/E.BYTES_PER_BLOCK),O=new Array(g),k=function(){};c&&(k=function(e,t){O[e]=Math.max(t,O[e]||0),c(O.reduce(function(e,t){return e+(t||0)},0)/g*.99)});for(var P=function(e,r){return t.client.crypto().encryptFileBlock(a,e).then(function(e){return t.client.request("files.upload-block",{block:r,part:1,token:i,data:e},{onUploadProgress:k.bind(null,r)})})},I=function(){return t.client.request("files.upload-complete",{block:0,blockCount:v,part:0,token:i,extn:h,pages:1,filename:d,storeoriginal:o?1:0,envelope:s}).then(function(){return c&&c(100)})};l--;)f()})},t.prototype.download=function(e){var t=this,r="string"==typeof e?{fileId:e}:e,n=r.fileId,o=r.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 o&&o(e),t._downloadFile(e,r)})},t.prototype._downloadFile=function(e,t){var r=this;return new Promise(function(n){function o(){if(!y)if(h<s.length){var e=h++,t=d(e);c=c.then(function(){return t.then(function(t){return f(t,e,u)})}),t.then(o)}else y=!0,n(c.then(m))}var i=4,a=new b.default,u=e.blocks,s=new Array(u),c=Promise.resolve(),f=t.onData||function(e,t){s[t]=e},l=function(){};if(t.onProgress){var p=new Array(u);l=function(e,r){p[e]=Math.max(r,p[e]||0),t.onProgress(p.reduce(function(e,t){return e+(t||0)},0)/u*.99)}}for(var d=function(t){return r.client.request("files.download-block",{proofId:e.assignedTo,fileId:e.id,block:t+1},{onDownloadProgress:l.bind(null,t)}).then(function(e){return r.client.crypto().decryptFileBlock(e.data,r.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,s)};i--;)o()})},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(E.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 b.default).createBase64(e)})},t.prototype.thumbnails=function(e,t){var r=this,n=t.async,o=void 0!==n&&n,i=t.onLoadThumbnails,a=[];return Promise.all(e.map(function(e){return r.client.cache.auto(E.THUMBNAIL_CACHE_PREFIX+e,function(t){a.push({fileId:e,resolve:t})}).then(function(t){var r;return t&&(r={},r[e]=t,r)})})).then(function(e){var t=Promise.all(a.map(function(e){var t=e.fileId,n=e.resolve;return r._thumbnail(t).then(function(e){if(n(e),o){var r;i((r={},r[t]=e,r))}return e})}));return o?e:t.then(function(t){return[].concat(e,t)})}).then(function(e){return Object.assign.apply(Object,[{}].concat(e))})},t}(c.default);t.default=O},function(e,t,r){"use strict";function n(e){var t=new a.default,r=0,n=Promise.resolve(),i=t.size(e);return function(){var a=r++*o.BYTES_PER_BLOCK,u=a+o.BYTES_PER_BLOCK;return n=n.then(function(){return a>i?null:t.slice(e,a,u).then(t.readBase64).then(function(e){return"data:;base64,"+e})})}}t.__esModule=!0;var o=r(2),i=r(8),a=function(e){return e&&e.__esModule?e:{default:e}}(i);t.default=n},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e){for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n<e.length;n++)r[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([o(e)]))},e.prototype.createBase64=function(e){return this.create(atob(e))},e.prototype.combine=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return Promise.resolve(new Blob(t))},e.prototype.slice=function(e,t,r){return Promise.resolve(e.slice(t,r))},e.prototype.read=function(e){return new Promise(function(t,r){var n=new FileReader;n.onload=function(){t(n.result)},n.onerror=function(){r(n.error)},n.readAsText(e)})},e.prototype.readBase64=function(e){return new Promise(function(t,r){var n=new FileReader;n.onload=function(){var e=n.result;t(e.substring(e.indexOf(",")+1))},n.onerror=function(){r(n.error)},n.readAsDataURL(e)})},e.prototype.size=function(e){return e.size},e}();t.default=i},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=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),r=0;r<e;r++)t[r]=arguments[r];return Promise.resolve(Buffer.concat(t))},e.prototype.slice=function(e,t,r){return Promise.resolve(e.slice(t,r))},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=o},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e){for(var t=e.length,r=e.length-1;r>=0;r--){var n=e.charCodeAt(r);n>127&&n<=2047?t++:n>2047&&n<=65535&&(t+=2),n>=56320&&n<=57343&&r--}return t}t.__esModule=!0;var i=r(66),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),r=0;r<e;r++)t[r]=arguments[r];return Promise.resolve(t.join(""))},e.prototype.slice=function(e,t,r){return Promise.resolve(e.slice(t,r))},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 o(e)},e}();t.default=a},function(e,t,r){!function(){function e(e){this.message=e}var r=t,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.prototype=new Error,e.prototype.name="InvalidCharacterError",r.btoa||(r.btoa=function(t){for(var r,o,i=String(t),a=0,u=n,s="";i.charAt(0|a)||(u="=",a%1);s+=u.charAt(63&r>>8-a%1*8)){if((o=i.charCodeAt(a+=.75))>255)throw new e("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");r=r<<8|o}return s}),r.atob||(r.atob=function(t){var r=String(t).replace(/[=]+$/,"");if(r.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var o,i,a=0,u=0,s="";i=r.charAt(u++);~i&&(o=a%4?64*o+i:i,a++%4)?s+=String.fromCharCode(255&o>>(-2*a&6)):0)i=n.indexOf(i);return s})}()},function(e,t,r){"use strict";function n(e){return"undefined"!=typeof Blob&&e instanceof Blob?e.size:0}t.__esModule=!0,t.default=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(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 u=r(0),s=n(u),c=r(69),f=n(c),l=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.team=new f.default(r),n}return a(t,e),t}(s.default);t.default=l},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(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 u=r(0),s=n(u),c=r(70),f=n(c),l=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.users=new f.default(r),n}return a(t,e),t}(s.default);t.default=l},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(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 u(e){return e.data.map(function(e){return(new l.default).fromUser(e)})}t.__esModule=!0;var s=r(0),c=n(s),f=r(3),l=n(f),p=function(e){function t(){return o(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(u)},t.prototype.disabled=function(){return this.client.request("admin.team.users.disabled").then(u)},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}(c.default);t.default=p},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(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 u(e){return e&&((0,_.isUserId)(e.id)||e.email)}function s(e){return(e||[]).map(function(e){return(new p.default).fromWorkflow(e)})}t.__esModule=!0;var c=r(0),f=n(c),l=r(26),p=n(l),d=r(14),h=n(d),y=r(15),m=n(y),_=r(22),v=r(72),b=n(v),g=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.steps=new b.default(r),n}return a(t,e),t.prototype.create=function(e){var t=this,r=e.save,n=void 0!==r&&r,o=e.name,i=e.steps,a=void 0===i?[]:i,s=e.reviewers,c=e.approver;if(!u(c))return Promise.reject(Error("An approver is required to create a workflow."));if(n&&!o)return Promise.reject(Error("A workflow must have a name when saving it as a workflow template."));var f=a;s&&s.length&&f.splice(0,0,{users:s}),c&&f.push({position:1e3,users:[c]});for(var l=0,p=0;p<f.length;p++){var d=f[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(!u(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(o).then(function(e){return y=e.id,Promise.all([e,Promise.all(f.map(function(r){var n=e.getStepByPosition(r.position);return n?t._setWorkflowStepUsersMutate(e.id,n,r.users):t._addWorkflowStepAndUsers(e.id,r)}))])}).then(function(e){var t=e[0],r=e[1];return t.steps=r,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 s(e.data)})},t.prototype.shared=function(){return this.client.request("workflows.shared").then(function(e){return s(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 r=e.data.WorkflowId;return t.load(r)})},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 r=this;return this.client.request("workflows.steps.add",{workflowId:e,title:t.name,position:t.position}).then(function(n){var o=(new h.default).fromWorkflowStep(n.data);return r._setWorkflowStepUsersMutate(e,o,t.users)})},t.prototype._setWorkflowStepUsersMutate=function(e,t,r){return this.client.request("workflows.users.set",{workflowId:e,stepId:t.id,users:r.map(function(e){return{email:e.email,userId:e.id,role:e.role,permissions:e.permissions&&{inviter:!!e.permissions.inviter}}})}).then(function(e){var r=e.data.map(function(e){return(new m.default).fromWorkflowUser(e)});return t.users=r,t})},t}(f.default);t.default=g},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(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=r(0),u=function(e){return e&&e.__esModule?e:{default:e}}(a),s=function(e){function t(){return n(this,t),o(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}(u.default);t.default=s},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(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 u(e){return(new p.default).fromPreference(e)}function s(e,t){var r=new Array(e.length);return t.forEach(function(t){r[e.indexOf(t.name)]=t}),r}t.__esModule=!0;var c=r(0),f=n(c),l=r(74),p=n(l),d=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(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(u)}).then(function(r){return"string"==typeof e?r[0]:s(t,r)})},t.prototype.update=function(e,t){var r,n=void 0!==t?(r={},r[e]=t,r):e;return this.client.request("preferences.update",n)},t.prototype.reset=function(e){return this.client.request("preferences.reset",{preferences:[].concat(e)})},t}(f.default);t.default=d},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(1),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={name:"Name",defaultValue:"DefaultValue",value:"Value"},u=function(){function e(){n(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,a,e),this},e}();t.default=u},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(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 u(e){var t=[];return Object.keys(e).forEach(function(r){e[r].Comments.forEach(function(e){t.push(e)})}),t}function s(e){var t=[],r=[];e.forEach(function(e){var n=(new p.default).fromComment(e);n.parentCommentId?r.push(n):t.push(n)}),t.sort(S);var n=t.map(function(e){return e.id}),o=(0,m.sortObjectsBy)(function(e){return n.indexOf(e.parentCommentId)},!0);return r.sort((0,m.combineSort)(R,o)),t.concat(r)}t.__esModule=!0;var c=r(0),f=n(c),l=r(29),p=n(l),d=r(16),h=n(d),y=r(2),m=r(24),_=r(18),v=r(31),b=n(v),g=r(17),w=n(g),E=r(77),O=r(78),k=n(O),P=(0,m.sortObjectsByKey)("pageNumber"),I=(0,m.sortObjectsByKey)("createdDate",!0),T=(0,m.sortObjectsByKey)("createdDate",!1),S=(0,m.combineSort)(P,I),R=(0,m.combineSort)(P,T),D=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype._mark=function(e,t,r){var n,o=void 0;switch(t){case h.default.TODO:o="change";break;case h.default.DONE:o="done";break;default:throw new Error('Cannot mark comment state "'+t+'".')}var i=(n={commentId:e},n[o]=r?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,r="string"==typeof e?{proofId:e}:e,n=r.proofId,o=r.pageNumber,i=void 0===o?null:o,a=r.sinceDate,c=void 0===a?null:a,f=r.async,l=void 0!==f&&f,p=r.decrypt,d=void 0===p||p,h=r.onDecryptComment,m=r.onDecryptComments,_=r.onDecryptCommentsThrottleMs,v=void 0===_?1e3:_,b=r.onDecryptError,g=c?c.toISOString().match(y.ISO_REGEX)[0]:y.DEFAULT_ISO_DATE,w={proofId:n,page:i,timestamp:g};return this.client.request(null!==i?"comments.load-page":"comments.load-all",w).then(function(e){var r=s(e.data.Pages?u(e.data.Pages):e.data),n=Promise.resolve();if(d){var o=[],i=[],a=m?(0,k.default)(function(){i.length&&(m(i),i=[])},v):function(){},c=Promise.all(r.map(function(e){return t.client.cache.auto(y.COMMENT_CACHE_PREFIX+e.comment$,function(t){o.push({comment:e,resolve:t})}).then(function(t){return t&&e.fromRawComment(t),e})}));n=n.then(function(){return c}),n=n.then(function(){var e=o.map(function(e){var r=e.comment,n=e.resolve;return t.client.crypto().decryptComment(r.comment$,r.envelope,t.client.session.privateKeyPEM).then(function(e){r.fromRawComment(e),n(e),h&&h(r),i.push(r),a()}).catch(function(e){if(b&&b(e,r),!l)return Promise.reject(e)})});return l?null:Promise.all(e)})}return n.then(function(){return r})})},t.prototype.create=function(e){var t=this,r=e.raw,n=e.tokens,o=e.proofId,i=e.pageNumber,a=void 0===i?1:i,u=e.pin,s=e.mediaTime,c=e.mediaDuration,f=e.parentCommentId,l=e.metadata,d=e.state,y=e.creationToken,m=[],v=r||(0,_.serialize)(n),g=n||(0,w.default)(r);m.push.apply(m,(0,b.default)(g));var O=y||(0,E.generateCreationToken)();return this.client.crypto().encryptComment(v,[this.client.session.serverPublicKeyPEM,this.client.session.publicKeyPEM]).then(function(e){var t=e.envelope,r=e.comment$;return{proofId:o,page:f?void 0:a,envelope:t,encryptedComment:r,xy:JSON.stringify({x:u&&"number"==typeof u.x?u.x:null,y:u&&"number"==typeof u.y?u.y:null,x2:u&&"number"==typeof u.x2?u.x2:null,y2:u&&"number"==typeof u.y2?u.y2:null,time:"number"==typeof s?s:null,duration:"number"==typeof c?c:null}),parent:f||void 0,mentions:m,metadata:l?JSON.stringify(l):"{}",creationToken:O,change:d===h.default.TODO?"1":void 0,done:d===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(v)})}).catch(function(e){return e&&(e.creationToken=O),Promise.reject(e)})},t}(f.default);t.default=D},function(e,t,r){"use strict";function n(e){for(var t=[],r=e.split(/\n/g),n=0;n<r.length;n++){var i=r[n],a=[];if(0===n){var u=i.match(o.COMMENT_LABEL_REGEX);u&&a.push({type:"label",index:0,length:u[0].length,metadata:{label:u[1].toLowerCase()}})}for(var s=void 0;null!==(s=o.MENTION_REGEX.exec(i));){var c=s,f=c[0],l=c[1],p=c[2];a.push({type:"mention",index:s.index,length:p.length,metadata:{id:l}}),i=i.substring(0,s.index)+p+i.substring(s.index+f.length)}t.push({type:"text",value:i,styles:[],entities:a})}return{version:2,blocks:t}}t.__esModule=!0,t.parse=void 0;var o=r(2);t.parse=n},function(e,t,r){"use strict";function n(){var e=(new Date).getTime();return(0,i.default)(u,a)+"-"+e}t.__esModule=!0,t.generateCreationToken=void 0;var o=r(32),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a=32,u=o.lower+o.upper+o.numbers+o.symbols;t.generateCreationToken=n},function(e,t,r){"use strict";function n(e,t){var r=void 0;return function(){r||(r=setTimeout(function(){e(),r=null},t))}}t.__esModule=!0,t.default=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(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 u=r(0),s=n(u),c=r(8),f=n(c),l=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.uploadAvatar=function(e){var t=this;return(new f.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 r=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],o=e[2];return r.client.request("profile.change-password",{oldPassword:t,newPassword:n,newPrivateKey:o})})},t}(s.default);t.default=l},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(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=r(0),u=function(e){return e&&e.__esModule?e:{default:e}}(a),s=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.check=function(){return this.client.request("sessions.check").then(function(){return null})},t}(u.default);t.default=s},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o="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=r(6),a=function(e){return e&&e.__esModule?e:{default:e}}(i),u=r(13)("EventEmitter"),s=function(){function e(){n(this,e),this.handlers={}}return e.prototype.getHandlers=function(e){var t=this,r=[],n=[e];if(-1!==e.indexOf("."))for(var o=e;(o=o.substring(0,o.lastIndexOf("."))).length;)n.push(o+".*");return n.push("*"),n.forEach(function(e){(0,a.default)(t.handlers,e)&&r.push.apply(r,t.handlers[e])}),r},e.prototype.on=function(e,t){if("function"!=typeof t)return void u("Handler is not a function, got "+(void 0===t?"undefined":o(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 r=this.handlers[e];r.splice(r.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 r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=this.getHandlers(e),o=new Array(n.length);u("Emitting"+(r?" 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{o[t]=e(i)}catch(e){o[t]=e}}),r?Promise.all(o):o},e}();t.default=s},function(e,t,r){"use strict";t.__esModule=!0,t.default=function(e,t,r){return new Promise(function(n,o){setTimeout(function(){void 0!==r?o(r):n(t)},e)})}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.Preference=t.WorkflowUserState=t.WorkflowUserRole=t.WorkflowStepState=t.ResponseStatus=t.ProofStatus=t.ProofState=t.ImportProvider=t.FileStatus=t.FileAssignee=t.CommentState=void 0;var o=r(16),i=n(o),a=r(84),u=n(a),s=r(5),c=n(s),f=r(25),l=n(f),p=r(20),d=n(p),h=r(21),y=n(h),m=r(10),_=n(m),v=r(28),b=n(v),g=r(85),w=n(g),E=r(27),O=n(E),k=r(86),P=n(k);t.CommentState=i.default,t.FileAssignee=u.default,t.FileStatus=c.default,t.ImportProvider=l.default,t.ProofState=d.default,t.ProofStatus=y.default,t.ResponseStatus=_.default,t.WorkflowStepState=b.default,t.WorkflowUserRole=w.default,t.WorkflowUserState=O.default,t.Preference=P.default},function(e,t,r){"use strict";t.__esModule=!0;var n={PROOF:"proof",ATTACHMENT:"attachment",SNAPSHOT:"snapshot"};t.default=n},function(e,t,r){"use strict";t.__esModule=!0;var n={REVIEWER:"reviewer",MANDATORY:"mandatory",GATEKEEPER:"gatekeeper",APPROVER:"approver"};t.default=n},function(e,t,r){"use strict";t.__esModule=!0;var n={DEFAULT_DUE_DATE:"dueDate",DEFAULT_MESSAGE_TO_REVIEWERS:"messageToReviewers",ENABLE_COLOR_BLIND_UI:"colorBlind"};t.default=n},function(e,t,r){"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 o=r(29),i=n(o),a=r(12),u=n(a),s=r(30),c=n(s),f=r(4),l=n(f),p=r(11),d=n(p),h=r(23),y=n(h),m=r(7),_=n(m),v=r(3),b=n(v),g=r(26),w=n(g),E=r(14),O=n(E),k=r(15),P=n(k);t.Comment=i.default,t.File=u.default,t.Pin=c.default,t.Proof=l.default,t.ProofGroup=d.default,t.ProofVersion=y.default,t.Session=_.default,t.User=b.default,t.Workflow=w.default,t.WorkflowStep=O.default,t.WorkflowUser=P.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){return"string"==typeof e&&(e=(0,a.default)(e)),(0,c.default)(e)}t.__esModule=!0,t.comments=void 0;var i=r(17),a=n(i),u=r(18),s=r(31),c=n(s),f=r(89),l=n(f),p=r(90),d=n(p);t.comments={parse:a.default,serialize:u.serialize,mentions:o,text:l.default,html:d.default}},function(e,t,r){"use strict";function n(e){return e.blocks.map(function(e){return e.value}).join("\n")}t.__esModule=!0,t.default=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){return"string"==typeof e?e:e.map(o).join("")}function i(e){return Object.keys(e).map(function(t){return t+": "+e[t]}).join("; ")}function a(e){var t=(0,p.default)(e);return(0,s.default)(t,v).join("")}t.__esModule=!0;var u=r(91),s=n(u),c=r(106),f=n(c),l=r(114),p=n(l),d={BOLD:{"font-weight":"bold"},ITALIC:{"font-style":"italic"},UNDERLINE:{"text-decoration":"underline"},STRIKETHROUGH:{"text-decoration":"line-through"}},h=function(e){var t=e.style,r=e.children;return'<span style="'+i(t)+'">'+o(r)+"</span>"},y={unstyled:function(e){return"<div>"+o(e)+"</div>"}},m={mention:function(e,t){return'<span data-mention-user-id="'+t.mention.link+'">'+o(e)+"</span>"}},_=[{strategy:f.default,component:function(e){var t=e.children;return'<a href="'+e.decoratedText+'" target="_blank" rel="noopener noreferrer">'+o(t)+"</a>"}}],v={styles:(0,u.createStylesRenderer)(h,d),blocks:y,entities:m,decorators:_};t.default=a},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.CompositeDecorator=t.renderNode=t.RawParser=t.createBlockRenderer=t.createStylesRenderer=void 0;var o=r(33),i=n(o),a=r(94),u=n(a),s=r(95),c=r(35),f=n(c),l=r(105),p=n(l);t.createStylesRenderer=u.default,t.createBlockRenderer=p.default,t.RawParser=i.default,t.renderNode=s.renderNode,t.CompositeDecorator=f.default,t.default=s.render},function(e,t,r){"use strict";function n(e){return Array.isArray(e)?e:Array.from(e)}function o(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=r(93),s=function(e){return e&&e.__esModule?e:{default:e}}(u),c=function(){function e(t){i(this,e),this.content=t.content||[],this.start=void 0!==t.start?t.start:null,this.end=void 0!==t.end?t.end:null,this.entity=void 0!==t.entity?t.entity:null,this.decorator=void 0!==t.decorator?t.decorator:null,this.decoratorProps=t.decoratorProps||null,this.decoratedText=void 0!==t.decoratedText?t.decoratedText:null,this.contentState=t.contentState,this.style=t.style||null,this.styles=t.styles||null,this.block=t.block||{}}return a(e,[{key:"getCurrentContent",value:function(){return this.content[this.content.length-1]}},{key:"addToCurrentContent",value:function(e){this.content[this.content.length-1]=this.content[this.content.length-1]+e}},{key:"handleFlatPush",value:function(t,r){var n=this.getCurrentContent();if(n instanceof e&&(0,s.default)(r,n.styles))return void n.addToCurrentContent(t);var i=new e({styles:[].concat(o(r)),content:[t]});this.content.push(i)}},{key:"pushContent",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!r||r.length<1)return"string"==typeof t&&"string"==typeof this.getCurrentContent()?this.addToCurrentContent(t):this.content.push(t),this;if(o)return this.handleFlatPush(t,r),this;var i=n(r),a=i[0],u=i.slice(1),s=this.getCurrentContent();if(s instanceof e&&s.style===a)s.pushContent(t,u,o);else{var c=new e({style:a});c.pushContent(t,u,o),this.content.push(c)}return this}}]),e}();t.default=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0};t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){return e.map(function(e){return t[e]}).reduce(function(e,t){var r={};if(void 0!==t){var n="text-decoration"in t?"text-decoration":"textDecoration";t[n]!==e[n]&&(r[n]=[e[n],t[n]].join(" ").trim())}return Object.assign(e,t,r)},{})},o=function(e,t){return function(r,o,i){var a=n(o,t);return e(Object.assign({},{children:r},i,{style:a}))}};t.default=o},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.render=t.renderNode=void 0;var o=r(33),i=n(o),a=r(96),u=n(a),s=r(97),c=n(s),f=r(98),l=n(f),p=r(99),d=n(p),h=r(100),y=n(h),m=r(101),_=n(m),v=r(102),b=n(v),g=t.renderNode=function e(t,r,n,o,i,a,u){if(t.styles&&o)return o((0,d.default)(t.content,a),t.styles,{key:u()});var s=[],c=0;if(t.content.forEach(function(t){"string"==typeof t?s=(0,y.default)(t,s,c):(c+=1,s[c]=e(t,r,n,o,i,a,u),c+=1)}),t.style&&r[t.style])return r[t.style]((0,d.default)(s,a),{key:u()});if(null!==t.entity){var f=i[t.entity];if(f&&n[f.type])return n[f.type]((0,d.default)(s,a),f.data,{key:t.entity})}if(null!==t.decorator){var l=[t.block.key,t.start,0].join(".");return t.decorator(Object.assign({children:(0,d.default)(s,a),decoratedText:t.decoratedText,contentState:t.contentState,entityKey:t.entity,offsetKey:l,key:l},t.decoratorProps))}return s},w=function(e){var t=[],r=[],n=0,o=function(e){var o=n-e;for(r.length<o&&(o=r.length),o;o>0;o-=1){var i=t;t=r.pop(),t[t.length-1].children=i}};return e.forEach(function(e){n<e.depth?(r.push(t),t=[]):n>e.depth&&o(e.depth),n=e.depth,t.push(e)}),0!==n&&o(0),t},E=function(e,t,r,n,o){var i=n.prevType,a=n.prevDepth,u=n.prevKeys,s=n.prevData;if(0!==e.length){var c=t[i]||t[o.blockFallback];if(c){var f={depth:a,keys:u};return s&&s.some(function(e){return!!e})&&(f.data=s),void r.push(c(e,f))}r.push(e)}},O=function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=arguments[4],u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{},f=Object.assign({},_.default,s),p=[],h=[],y=null,m=0,v=[],b=[],w=!1,O=new i.default({flat:!!a});return t.forEach(function(t){if((0,c.default)(t,y,f))return void(!0===f.cleanup.split&&(w=!0));var i=O.parse(t),s=g(i,r,o,a,u,f,(0,l.default)());if((y&&y!==t.type||w)&&(E(h,n,p,{prevType:y,prevDepth:m,prevKeys:v,prevData:b},f),b=[],v=[],h=[],w=!1),t.children){var d=e(t.children,r,n,o,a,u,f);s.push(d)}h.push(s),y=t.type,m=t.depth,v.push(t.key),b.push(t.data)}),E(h,n,p,{prevType:y,prevDepth:m,prevKeys:v,prevData:b},f),(0,d.default)(p,f)};t.render=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e||!Array.isArray(e.blocks))return(0,u.default)("invalid raw object"),null;if(!e.blocks.length)return null;var n=t.inline,o=t.blocks,i=t.entities,a=t.styles,s=t.decorators,c=s?(0,b.default)(e,s,r):e.blocks,f=w(c);return O(f,n,o,i,a,e.entityMap,r)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){};t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){return!!(t.trim?e.trim():e)},o=function(e,t){return!!n(e.text,t)||(!(!e.data||!Object.keys(e.data).length)||!(!e.entityRanges||!e.entityRanges.length))},i=function(e,t,r){var n=r.cleanup;return!(!n||o(e,n))&&((!n.after||"all"===n.after||-1!==n.after.indexOf(t))&&(!(!n.except||-1!==n.except.indexOf(e.type))||!(!n.types||"all"!==n.types&&-1===n.types.indexOf(e.type))))};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){var e=0;return function(){var t=e;return e+=1,t}};t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){return Array.isArray(e)&&t.joinOutput?e.join(""):e};t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t,r){var n=t;return t[r]?n[r]+=e:n[r]=e,n};t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={joinOutput:!1,cleanup:{after:["atomic"],types:["unstyled"],trim:!1,split:!0},blockFallback:"unstyled"};t.default=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var i=r(34),a=n(i),u=r(35),s=n(u),c=r(103),f=n(c),l=r(104),p=n(l),d=function(e,t){return e.forEach(function(e){var r=t.text.substring(0,e.offset),n=t.text.substring(e.offset,e.offset+e.length);e.offset=a.default.ucs2.decode(r).length,e.length=a.default.ucs2.decode(n).length}),e},h=function(e){return"function"==typeof e.getDecorations&&"function"==typeof e.getComponentForKey&&"function"==typeof e.getPropsForKey},y=function(e){var t=new s.default(e.filter(function(e){return!h(e)})),r=e.filter(function(e){return h(e)}),n=[].concat(o(r),[t]);return new f.default(n)},m=function(e,t,r,n){var o=n.createContentBlock,i=[],a=y(t),u=o?o(e):(0,p.default)(e),s=a.getDecorations(u,r),c=0;return s.forEach(function(e,t){if(!e)return void(c+=1);var n=t+1,o=s[n];o&&o===e||(i.push({offset:c,length:n-c,component:a.getComponentForKey(e),decoratorProps:a.getPropsForKey(e)||{},contentState:r}),c=n)}),Object.assign({},e,{decoratorRanges:d(i,e)})},_=function(e,t,r){var n=r.convertFromRaw&&r.convertFromRaw(e);return e.blocks.map(function(e){return m(e,t,n,r||{})})};t.default=_},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(){function e(t){n(this,e),this.decorators=t}return o(e,[{key:"getDecorations",value:function(e,t){var r=new Array(e.getText().length).fill(null);return this.decorators.forEach(function(n,o){n.getDecorations(e,t).forEach(function(e,t){e&&(r[t]=o+"-"+e)})}),r}},{key:"getComponentForKey",value:function(t){return this.getDecoratorForKey(t).getComponentForKey(e.getInnerKey(t))}},{key:"getPropsForKey",value:function(t){return this.getDecoratorForKey(t).getPropsForKey(e.getInnerKey(t))}},{key:"getDecoratorForKey",value:function(e){var t=e.split("-"),r=Number(t[0]);return this.decorators[r]}}],[{key:"getInnerKey",value:function(e){return e.split("-").slice(1).join("-")}}]),e}();t.default=i},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(){function e(t){n(this,e),Object.assign(this,t)}return o(e,[{key:"get",value:function(e){return this[e]}},{key:"getText",value:function(){return this.text}},{key:"getType",value:function(){return this.type}},{key:"getKey",value:function(){return this.key}},{key:"getLength",value:function(){return this.text.length}},{key:"getDepth",value:function(){return this.depth}},{key:"getData",value:function(){return this.data}}]),e}(),a=function(e){return new i(e)};t.default=a},function(e,t,r){"use strict";function n(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var o=function(e,t){var r=e.keys;if(t)return t;if(r)return r.join(",")},i=function(e,t){return function(r,i,a){var u=Object.assign({},i),s=o(u,a);return delete u.depth,delete u.keys,t.apply(void 0,[e,Object.assign({},u,{key:s})].concat(n(r)))}},a=function(e,t,r){var n=r.children,o=r.props,a=r.key,u=i(t.wrapper,e),s=i(t.element,e);return u(n.map(function(e,t){return s(e,{depth:o.depth},o.keys&&o.keys[t])}),o,a)},u=function(e,t){var r={};return Object.keys(t).forEach(function(n){var o=t[n];if(o.wrapper)return void(r[n]=function(t,r,n){return a(e,o,{children:t,props:r,key:n})});r[n]=i(o.element,e)}),r};t.default=u},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(107),i=n(o),a=r(113),u=n(a),s=(0,i.default)();s.tlds(u.default);var c=function(e,t){var r=s.match(e.get("text"));if(void 0!==r&&null!==r)for(var n=0;n<r.length;n+=1)t(r[n].index,r[n].lastIndex)};t.default=c},function(e,t,r){"use strict";function n(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){t&&Object.keys(t).forEach(function(r){e[r]=t[r]})}),e}function o(e){return Object.prototype.toString.call(e)}function i(e){return"[object String]"===o(e)}function a(e){return"[object Object]"===o(e)}function u(e){return"[object RegExp]"===o(e)}function s(e){return"[object Function]"===o(e)}function c(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function f(e){return Object.keys(e||{}).reduce(function(e,t){return e||v.hasOwnProperty(t)},!1)}function l(e){e.__index__=-1,e.__text_cache__=""}function p(e){return function(t,r){var n=t.slice(r);return e.test(n)?n.match(e)[0].length:0}}function d(){return function(e,t){t.normalize(e)}}function h(e){function t(e){return e.replace("%TLDS%",o.src_tlds)}function n(e,t){throw new Error('(LinkifyIt) Invalid schema "'+e+'": '+t)}var o=e.re=r(108)(e.__opts__),f=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||f.push(g),f.push(o.src_xn),o.src_tlds=f.join("|"),o.email_fuzzy=RegExp(t(o.tpl_email_fuzzy),"i"),o.link_fuzzy=RegExp(t(o.tpl_link_fuzzy),"i"),o.link_no_ip_fuzzy=RegExp(t(o.tpl_link_no_ip_fuzzy),"i"),o.host_fuzzy_test=RegExp(t(o.tpl_host_fuzzy_test),"i");var h=[];e.__compiled__={},Object.keys(e.__schemas__).forEach(function(t){var r=e.__schemas__[t];if(null!==r){var o={validate:null,link:null};return e.__compiled__[t]=o,a(r)?(u(r.validate)?o.validate=p(r.validate):s(r.validate)?o.validate=r.validate:n(t,r),void(s(r.normalize)?o.normalize=r.normalize:r.normalize?n(t,r):o.normalize=d())):i(r)?void h.push(t):void n(t,r)}}),h.forEach(function(t){e.__compiled__[e.__schemas__[t]]&&(e.__compiled__[t].validate=e.__compiled__[e.__schemas__[t]].validate,e.__compiled__[t].normalize=e.__compiled__[e.__schemas__[t]].normalize)}),e.__compiled__[""]={validate:null,normalize:d()};var y=Object.keys(e.__compiled__).filter(function(t){return t.length>0&&e.__compiled__[t]}).map(c).join("|");e.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+o.src_ZPCc+"))("+y+")","i"),e.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+o.src_ZPCc+"))("+y+")","ig"),e.re.pretest=RegExp("("+e.re.schema_test.source+")|("+e.re.host_fuzzy_test.source+")|@","i"),l(e)}function y(e,t){var r=e.__index__,n=e.__last_index__,o=e.__text_cache__.slice(r,n);this.schema=e.__schema__.toLowerCase(),this.index=r+t,this.lastIndex=n+t,this.raw=o,this.text=o,this.url=o}function m(e,t){var r=new y(e,t);return e.__compiled__[r.schema].normalize(r,e),r}function _(e,t){if(!(this instanceof _))return new _(e,t);t||f(e)&&(t=e,e={}),this.__opts__=n({},v,t),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=n({},b,e),this.__compiled__={},this.__tlds__=w,this.__tlds_replaced__=!1,this.re={},h(this)}var v={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1},b={"http:":{validate:function(e,t,r){var n=e.slice(t);return r.re.http||(r.re.http=new RegExp("^\\/\\/"+r.re.src_auth+r.re.src_host_port_strict+r.re.src_path,"i")),r.re.http.test(n)?n.match(r.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,t,r){var n=e.slice(t);return r.re.no_http||(r.re.no_http=new RegExp("^"+r.re.src_auth+"(?:localhost|(?:(?:"+r.re.src_domain+")\\.)+"+r.re.src_domain_root+")"+r.re.src_port+r.re.src_host_terminator+r.re.src_path,"i")),r.re.no_http.test(n)?t>=3&&":"===e[t-3]?0:t>=3&&"/"===e[t-3]?0:n.match(r.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,r){var n=e.slice(t);return r.re.mailto||(r.re.mailto=new RegExp("^"+r.re.src_email_name+"@"+r.re.src_host_strict,"i")),r.re.mailto.test(n)?n.match(r.re.mailto)[0].length:0}}},g="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",w="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");_.prototype.add=function(e,t){return this.__schemas__[e]=t,h(this),this},_.prototype.set=function(e){return this.__opts__=n(this.__opts__,e),this},_.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;var t,r,n,o,i,a,u,s;if(this.re.schema_test.test(e))for(u=this.re.schema_search,u.lastIndex=0;null!==(t=u.exec(e));)if(o=this.testSchemaAt(e,t[2],u.lastIndex)){this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+o;break}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(s=e.search(this.re.host_fuzzy_test))>=0&&(this.__index__<0||s<this.__index__)&&null!==(r=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))&&(i=r.index+r[1].length,(this.__index__<0||i<this.__index__)&&(this.__schema__="",this.__index__=i,this.__last_index__=r.index+r[0].length)),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&e.indexOf("@")>=0&&null!==(n=e.match(this.re.email_fuzzy))&&(i=n.index+n[1].length,a=n.index+n[0].length,(this.__index__<0||i<this.__index__||i===this.__index__&&a>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=i,this.__last_index__=a)),this.__index__>=0},_.prototype.pretest=function(e){return this.re.pretest.test(e)},_.prototype.testSchemaAt=function(e,t,r){return this.__compiled__[t.toLowerCase()]?this.__compiled__[t.toLowerCase()].validate(e,r,this):0},_.prototype.match=function(e){var t=0,r=[];this.__index__>=0&&this.__text_cache__===e&&(r.push(m(this,t)),t=this.__last_index__);for(var n=t?e.slice(t):e;this.test(n);)r.push(m(this,t)),n=n.slice(this.__last_index__),t+=this.__last_index__;return r.length?r:null},_.prototype.tlds=function(e,t){return e=Array.isArray(e)?e:[e],t?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(e,t,r){return e!==r[t-1]}).reverse(),h(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,h(this),this)},_.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),"mailto:"!==e.schema||/^mailto:/i.test(e.url)||(e.url="mailto:"+e.url)},_.prototype.onCompile=function(){},e.exports=_},function(e,t,r){"use strict";e.exports=function(e){var t={};t.src_Any=r(109).source,t.src_Cc=r(110).source,t.src_Z=r(111).source,t.src_P=r(112).source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join("|"),t.src_ZCc=[t.src_Z,t.src_Cc].join("|");return t.src_pseudo_letter="(?:(?![><|]|"+t.src_ZPCc+")"+t.src_Any+")",t.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",t.src_auth="(?:(?:(?!"+t.src_ZCc+"|[@/\\[\\]()]).)+@)?",t.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",t.src_host_terminator="(?=$|[><|]|"+t.src_ZPCc+")(?!-|_|:\\d|\\.-|\\.(?!$|"+t.src_ZPCc+"))",t.src_path="(?:[/?#](?:(?!"+t.src_ZCc+"|[><|]|[()[\\]{}.,\"'?!\\-]).|\\[(?:(?!"+t.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+t.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+t.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+t.src_ZCc+'|["]).)+\\"|\\\'(?:(?!'+t.src_ZCc+"|[']).)+\\'|\\'(?="+t.src_pseudo_letter+"|[-]).|\\.{2,3}[a-zA-Z0-9%/]|\\.(?!"+t.src_ZCc+"|[.]).|"+(e&&e["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+"\\,(?!"+t.src_ZCc+").|\\!(?!"+t.src_ZCc+"|[!]).|\\?(?!"+t.src_ZCc+"|[?]).)+|\\/)?",t.src_email_name='[\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]+',t.src_xn="xn--[a-z0-9\\-]{1,59}",t.src_domain_root="(?:"+t.src_xn+"|"+t.src_pseudo_letter+"{1,63})",t.src_domain="(?:"+t.src_xn+"|(?:"+t.src_pseudo_letter+")|(?:"+t.src_pseudo_letter+"(?:-(?!-)|"+t.src_pseudo_letter+"){0,61}"+t.src_pseudo_letter+"))",t.src_host="(?:(?:(?:(?:"+t.src_domain+")\\.)*"+t.src_domain+"))",t.tpl_host_fuzzy="(?:"+t.src_ip4+"|(?:(?:(?:"+t.src_domain+")\\.)+(?:%TLDS%)))",t.tpl_host_no_ip_fuzzy="(?:(?:(?:"+t.src_domain+")\\.)+(?:%TLDS%))",t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+t.src_ZPCc+"|>|$))",t.tpl_email_fuzzy="(^|[><|]|\\(|"+t.src_ZCc+")("+t.src_email_name+"@"+t.tpl_host_fuzzy_strict+")",t.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_fuzzy_strict+t.src_path+")",t.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+")",t}},function(e,t){e.exports=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/},function(e,t){e.exports=/[\0-\x1F\x7F-\x9F]/},function(e,t){e.exports=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/},function(e,t){e.exports=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E49\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/},function(e,t){e.exports=["aaa","aarp","abarth","abb","abbott","abbvie","abc","able","abogado","abudhabi","ac","academy","accenture","accountant","accountants","aco","active","actor","ad","adac","ads","adult","ae","aeg","aero","aetna","af","afamilycompany","afl","africa","ag","agakhan","agency","ai","aig","aigo","airbus","airforce","airtel","akdn","al","alfaromeo","alibaba","alipay","allfinanz","allstate","ally","alsace","alstom","am","americanexpress","americanfamily","amex","amfam","amica","amsterdam","analytics","android","anquan","anz","ao","aol","apartments","app","apple","aq","aquarelle","ar","arab","aramco","archi","army","arpa","art","arte","as","asda","asia","associates","at","athleta","attorney","au","auction","audi","audible","audio","auspost","author","auto","autos","avianca","aw","aws","ax","axa","az","azure","ba","baby","baidu","banamex","bananarepublic","band","bank","bar","barcelona","barclaycard","barclays","barefoot","bargains","baseball","basketball","bauhaus","bayern","bb","bbc","bbt","bbva","bcg","bcn","bd","be","beats","beauty","beer","bentley","berlin","best","bestbuy","bet","bf","bg","bh","bharti","bi","bible","bid","bike","bing","bingo","bio","biz","bj","black","blackfriday","blanco","blockbuster","blog","bloomberg","blue","bm","bms","bmw","bn","bnl","bnpparibas","bo","boats","boehringer","bofa","bom","bond","boo","book","booking","bosch","bostik","boston","bot","boutique","box","br","bradesco","bridgestone","broadway","broker","brother","brussels","bs","bt","budapest","bugatti","build","builders","business","buy","buzz","bv","bw","by","bz","bzh","ca","cab","cafe","cal","call","calvinklein","cam","camera","camp","cancerresearch","canon","capetown","capital","capitalone","car","caravan","cards","care","career","careers","cars","cartier","casa","case","caseih","cash","casino","cat","catering","catholic","cba","cbn","cbre","cbs","cc","cd","ceb","center","ceo","cern","cf","cfa","cfd","cg","ch","chanel","channel","chase","chat","cheap","chintai","christmas","chrome","chrysler","church","ci","cipriani","circle","cisco","citadel","citi","citic","city","cityeats","ck","cl","claims","cleaning","click","clinic","clinique","clothing","cloud","club","clubmed","cm","cn","co","coach","codes","coffee","college","cologne","com","comcast","commbank","community","company","compare","computer","comsec","condos","construction","consulting","contact","contractors","cooking","cookingchannel","cool","coop","corsica","country","coupon","coupons","courses","cr","credit","creditcard","creditunion","cricket","crown","crs","cruise","cruises","csc","cu","cuisinella","cv","cw","cx","cy","cymru","cyou","cz","dabur","dad","dance","data","date","dating","datsun","day","dclk","dds","de","deal","dealer","deals","degree","delivery","dell","deloitte","delta","democrat","dental","dentist","desi","design","dev","dhl","diamonds","diet","digital","direct","directory","discount","discover","dish","diy","dj","dk","dm","dnp","do","docs","doctor","dodge","dog","doha","domains","dot","download","drive","dtv","dubai","duck","dunlop","duns","dupont","durban","dvag","dvr","dz","earth","eat","ec","eco","edeka","edu","education","ee","eg","email","emerck","energy","engineer","engineering","enterprises","epost","epson","equipment","er","ericsson","erni","es","esq","estate","esurance","et","etisalat","eu","eurovision","eus","events","everbank","exchange","expert","exposed","express","extraspace","fage","fail","fairwinds","faith","family","fan","fans","farm","farmers","fashion","fast","fedex","feedback","ferrari","ferrero","fi","fiat","fidelity","fido","film","final","finance","financial","fire","firestone","firmdale","fish","fishing","fit","fitness","fj","fk","flickr","flights","flir","florist","flowers","fly","fm","fo","foo","food","foodnetwork","football","ford","forex","forsale","forum","foundation","fox","fr","free","fresenius","frl","frogans","frontdoor","frontier","ftr","fujitsu","fujixerox","fun","fund","furniture","futbol","fyi","ga","gal","gallery","gallo","gallup","game","games","gap","garden","gb","gbiz","gd","gdn","ge","gea","gent","genting","george","gf","gg","ggee","gh","gi","gift","gifts","gives","giving","gl","glade","glass","gle","global","globo","gm","gmail","gmbh","gmo","gmx","gn","godaddy","gold","goldpoint","golf","goo","goodhands","goodyear","goog","google","gop","got","gov","gp","gq","gr","grainger","graphics","gratis","green","gripe","grocery","group","gs","gt","gu","guardian","gucci","guge","guide","guitars","guru","gw","gy","hair","hamburg","hangout","haus","hbo","hdfc","hdfcbank","health","healthcare","help","helsinki","here","hermes","hgtv","hiphop","hisamitsu","hitachi","hiv","hk","hkt","hm","hn","hockey","holdings","holiday","homedepot","homegoods","homes","homesense","honda","honeywell","horse","hospital","host","hosting","hot","hoteles","hotels","hotmail","house","how","hr","hsbc","ht","hu","hughes","hyatt","hyundai","ibm","icbc","ice","icu","id","ie","ieee","ifm","ikano","il","im","imamat","imdb","immo","immobilien","in","industries","infiniti","info","ing","ink","institute","insurance","insure","int","intel","international","intuit","investments","io","ipiranga","iq","ir","irish","is","iselect","ismaili","ist","istanbul","it","itau","itv","iveco","iwc","jaguar","java","jcb","jcp","je","jeep","jetzt","jewelry","jio","jlc","jll","jm","jmp","jnj","jo","jobs","joburg","jot","joy","jp","jpmorgan","jprs","juegos","juniper","kaufen","kddi","ke","kerryhotels","kerrylogistics","kerryproperties","kfh","kg","kh","ki","kia","kim","kinder","kindle","kitchen","kiwi","km","kn","koeln","komatsu","kosher","kp","kpmg","kpn","kr","krd","kred","kuokgroup","kw","ky","kyoto","kz","la","lacaixa","ladbrokes","lamborghini","lamer","lancaster","lancia","lancome","land","landrover","lanxess","lasalle","lat","latino","latrobe","law","lawyer","lb","lc","lds","lease","leclerc","lefrak","legal","lego","lexus","lgbt","li","liaison","lidl","life","lifeinsurance","lifestyle","lighting","like","lilly","limited","limo","lincoln","linde","link","lipsy","live","living","lixil","lk","llc","loan","loans","locker","locus","loft","lol","london","lotte","lotto","love","lpl","lplfinancial","lr","ls","lt","ltd","ltda","lu","lundbeck","lupin","luxe","luxury","lv","ly","ma","macys","madrid","maif","maison","makeup","man","management","mango","map","market","marketing","markets","marriott","marshalls","maserati","mattel","mba","mc","mckinsey","md","me","med","media","meet","melbourne","meme","memorial","men","menu","meo","merckmsd","metlife","mg","mh","miami","microsoft","mil","mini","mint","mit","mitsubishi","mk","ml","mlb","mls","mm","mma","mn","mo","mobi","mobile","mobily","moda","moe","moi","mom","monash","money","monster","mopar","mormon","mortgage","moscow","moto","motorcycles","mov","movie","movistar","mp","mq","mr","ms","msd","mt","mtn","mtr","mu","museum","mutual","mv","mw","mx","my","mz","na","nab","nadex","nagoya","name","nationwide","natura","navy","nba","nc","ne","nec","net","netbank","netflix","network","neustar","new","newholland","news","next","nextdirect","nexus","nf","nfl","ng","ngo","nhk","ni","nico","nike","nikon","ninja","nissan","nissay","nl","no","nokia","northwesternmutual","norton","now","nowruz","nowtv","np","nr","nra","nrw","ntt","nu","nyc","nz","obi","observer","off","office","okinawa","olayan","olayangroup","oldnavy","ollo","om","omega","one","ong","onl","online","onyourside","ooo","open","oracle","orange","org","organic","origins","osaka","otsuka","ott","ovh","pa","page","panasonic","panerai","paris","pars","partners","parts","party","passagens","pay","pccw","pe","pet","pf","pfizer","pg","ph","pharmacy","phd","philips","phone","photo","photography","photos","physio","piaget","pics","pictet","pictures","pid","pin","ping","pink","pioneer","pizza","pk","pl","place","play","playstation","plumbing","plus","pm","pn","pnc","pohl","poker","politie","porn","post","pr","pramerica","praxi","press","prime","pro","prod","productions","prof","progressive","promo","properties","property","protection","pru","prudential","ps","pt","pub","pw","pwc","py","qa","qpon","quebec","quest","qvc","racing","radio","raid","re","read","realestate","realtor","realty","recipes","red","redstone","redumbrella","rehab","reise","reisen","reit","reliance","ren","rent","rentals","repair","report","republican","rest","restaurant","review","reviews","rexroth","rich","richardli","ricoh","rightathome","ril","rio","rip","rmit","ro","rocher","rocks","rodeo","rogers","room","rs","rsvp","ru","rugby","ruhr","run","rw","rwe","ryukyu","sa","saarland","safe","safety","sakura","sale","salon","samsclub","samsung","sandvik","sandvikcoromant","sanofi","sap","sapo","sarl","sas","save","saxo","sb","sbi","sbs","sc","sca","scb","schaeffler","schmidt","scholarships","school","schule","schwarz","science","scjohnson","scor","scot","sd","se","search","seat","secure","security","seek","select","sener","services","ses","seven","sew","sex","sexy","sfr","sg","sh","shangrila","sharp","shaw","shell","shia","shiksha","shoes","shop","shopping","shouji","show","showtime","shriram","si","silk","sina","singles","site","sj","sk","ski","skin","sky","skype","sl","sling","sm","smart","smile","sn","sncf","so","soccer","social","softbank","software","sohu","solar","solutions","song","sony","soy","space","spiegel","sport","spot","spreadbetting","sr","srl","srt","st","stada","staples","star","starhub","statebank","statefarm","statoil","stc","stcgroup","stockholm","storage","store","stream","studio","study","style","su","sucks","supplies","supply","support","surf","surgery","suzuki","sv","swatch","swiftcover","swiss","sx","sy","sydney","symantec","systems","sz","tab","taipei","talk","taobao","target","tatamotors","tatar","tattoo","tax","taxi","tc","tci","td","tdk","team","tech","technology","tel","telecity","telefonica","temasek","tennis","teva","tf","tg","th","thd","theater","theatre","tiaa","tickets","tienda","tiffany","tips","tires","tirol","tj","tjmaxx","tjx","tk","tkmaxx","tl","tm","tmall","tn","to","today","tokyo","tools","top","toray","toshiba","total","tours","town","toyota","toys","tr","trade","trading","training","travel","travelchannel","travelers","travelersinsurance","trust","trv","tt","tube","tui","tunes","tushu","tv","tvs","tw","tz","ua","ubank","ubs","uconnect","ug","uk","unicom","university","uno","uol","ups","us","uy","uz","va","vacations","vana","vanguard","vc","ve","vegas","ventures","verisign","versicherung","vet","vg","vi","viajes","video","vig","viking","villas","vin","vip","virgin","visa","vision","vista","vistaprint","viva","vivo","vlaanderen","vn","vodka","volkswagen","volvo","vote","voting","voto","voyage","vu","vuelos","wales","walmart","walter","wang","wanggou","warman","watch","watches","weather","weatherchannel","webcam","weber","website","wed","wedding","weibo","weir","wf","whoswho","wien","wiki","williamhill","win","windows","wine","winners","wme","wolterskluwer","woodside","work","works","world","wow","ws","wtc","wtf","xbox","xerox","xfinity","xihuan","xin","कॉम","セール","佛山","ಭಾರತ","慈善","集团","在线","한국","ଭାରତ","大众汽车","点看","คอม","ভাৰত","ভারত","八卦","موقع","বাংলা","公益","公司","香格里拉","网站","移动","我爱你","москва","қаз","католик","онлайн","сайт","联通","срб","бг","бел","קום","时尚","微博","淡马锡","ファッション","орг","नेट","ストア","삼성","சிங்கப்பூர்","商标","商店","商城","дети","мкд","ею","ポイント","新闻","工行","家電","كوم","中文网","中信","中国","中國","娱乐","谷歌","భారత్","ලංකා","電訊盈科","购物","クラウド","ભારત","通販","भारतम्","भारत","भारोत","网店","संगठन","餐厅","网络","ком","укр","香港","诺基亚","食品","飞利浦","台湾","台灣","手表","手机","мон","الجزائر","عمان","ارامكو","ایران","العليان","اتصالات","امارات","بازار","پاکستان","الاردن","موبايلي","بارت","بھارت","المغرب","ابوظبي","السعودية","ڀارت","كاثوليك","سودان","همراه","عراق","مليسيا","澳門","닷컴","政府","شبكة","بيتك","عرب","გე","机构","组织机构","健康","ไทย","سورية","招聘","рус","рф","珠宝","تونس","大拿","みんな","グーグル","ελ","世界","書籍","ഭാരതം","ਭਾਰਤ","网址","닷넷","コム","天主教","游戏","vermögensberater","vermögensberatung","企业","信息","嘉里大酒店","嘉里","مصر","قطر","广东","இலங்கை","இந்தியா","հայ","新加坡","فلسطين","政务","xperia","xxx","xyz","yachts","yahoo","yamaxun","yandex","ye","yodobashi","yoga","yokohama","you","youtube","yt","yun","za","zappos","zara","zero","zip","zippo","zm","zone","zuerich","zw"]},function(e,t,r){"use strict";function n(){return(0,u.default)(a.lower+a.upper+a.numbers,6)}function o(e){var t=0,r={},o=[];return e.blocks.forEach(function(e){var i=[],a=[];e.entities.forEach(function(n){var o=t++,i=e.value.substr(n.index,n.length);switch(n.type){case"mention":r[o]={type:"mention",mutability:"IMMUTABLE",data:{mention:{link:n.metadata.id,name:i}}};break;default:return}a.push({key:o,offset:n.index,length:n.length})}),e.styles.forEach(function(e){var t=s[e.type];t&&i.push({style:t,offset:e.index,length:e.length})}),o.push({key:n(),type:"unstyled",text:e.value,inlineStyleRanges:i,entityRanges:a,data:{},depth:0})}),{blocks:o,entityMap:r}}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a=r(32),u=function(e){return e&&e.__esModule?e:{default:e}}(a),s=function(){return Object.keys({italic:!0,bold:!0,underline:!0,strikethrough:!0}).reduce(function(e,t){var r;return i({},e,(r={},r[t]=t.toUpperCase(),r[t.toUpperCase()]=t,r))},{})}();t.default=o}])});
2
2
  //# sourceMappingURL=pageproof.js.map
@@ -0,0 +1,99 @@
1
+ 'use strict';
2
+
3
+ exports.__esModule = true;
4
+
5
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /* Copyright (C) 2018 PageProof Holdings Limited - All Rights Reserved.
6
+ * Unauthorized copying of this file, via any medium is strictly prohibited.
7
+ * Proprietary and confidential.
8
+ */
9
+
10
+
11
+ var _generateRandom = require('../generateRandom');
12
+
13
+ var _generateRandom2 = _interopRequireDefault(_generateRandom);
14
+
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+
17
+ function id() {
18
+ return (0, _generateRandom2.default)(_generateRandom.lower + _generateRandom.upper + _generateRandom.numbers, 6);
19
+ }
20
+
21
+ var STYLES = function () {
22
+ return Object.keys({
23
+ italic: true,
24
+ bold: true,
25
+ underline: true,
26
+ strikethrough: true
27
+ }).reduce(function (obj, key) {
28
+ var _extends2;
29
+
30
+ return _extends({}, obj, (_extends2 = {}, _extends2[key] = key.toUpperCase(), _extends2[key.toUpperCase()] = key, _extends2));
31
+ }, {});
32
+ }();
33
+
34
+ function convertToDraft(tokens) {
35
+ var index = 0;
36
+ var entityMap = {};
37
+ var blocks = [];
38
+
39
+ tokens.blocks.forEach(function (block) {
40
+ var inlineStyleRanges = [];
41
+ var entityRanges = [];
42
+ block.entities.forEach(function (entity) {
43
+ var key = index++;
44
+ var value = block.value.substr(entity.index, entity.length);
45
+ switch (entity.type) {
46
+ case 'mention':
47
+ {
48
+ entityMap[key] = {
49
+ type: 'mention',
50
+ mutability: 'IMMUTABLE',
51
+ data: {
52
+ mention: {
53
+ link: entity.metadata.id,
54
+ name: value
55
+ }
56
+ }
57
+ };
58
+ break;
59
+ }
60
+ default:
61
+ {
62
+ return; // skip adding the entity range for an unknown entity type
63
+ }
64
+ }
65
+ entityRanges.push({
66
+ key: key,
67
+ offset: entity.index,
68
+ length: entity.length
69
+ });
70
+ });
71
+ block.styles.forEach(function (style) {
72
+ var name = STYLES[style.type];
73
+ if (name) {
74
+ inlineStyleRanges.push({
75
+ style: name,
76
+ offset: style.index,
77
+ length: style.length
78
+ });
79
+ }
80
+ });
81
+ blocks.push({
82
+ key: id(),
83
+ type: 'unstyled',
84
+ text: block.value,
85
+ inlineStyleRanges: inlineStyleRanges,
86
+ entityRanges: entityRanges,
87
+ data: {},
88
+ depth: 0
89
+ });
90
+ });
91
+
92
+ return {
93
+ blocks: blocks,
94
+ entityMap: entityMap
95
+ };
96
+ }
97
+
98
+ exports.default = convertToDraft;
99
+ //# sourceMappingURL=convertToDraft.js.map
@@ -0,0 +1,93 @@
1
+ 'use strict';
2
+
3
+ exports.__esModule = true;
4
+
5
+ var _redraft = require('redraft');
6
+
7
+ var _redraft2 = _interopRequireDefault(_redraft);
8
+
9
+ var _linkStrategy = require('draft-js-linkify-plugin/lib/linkStrategy');
10
+
11
+ var _linkStrategy2 = _interopRequireDefault(_linkStrategy);
12
+
13
+ var _convertToDraft = require('./convertToDraft');
14
+
15
+ var _convertToDraft2 = _interopRequireDefault(_convertToDraft);
16
+
17
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
+
19
+ var styleMap = {
20
+ BOLD: {
21
+ 'font-weight': 'bold'
22
+ },
23
+ ITALIC: {
24
+ 'font-style': 'italic'
25
+ },
26
+ UNDERLINE: {
27
+ 'text-decoration': 'underline'
28
+ },
29
+ STRIKETHROUGH: {
30
+ 'text-decoration': 'line-through'
31
+ }
32
+ }; /* Copyright (C) 2018 PageProof Holdings Limited - All Rights Reserved.
33
+ * Unauthorized copying of this file, via any medium is strictly prohibited.
34
+ * Proprietary and confidential.
35
+ */
36
+
37
+
38
+ function renderChildren(children) {
39
+ if (typeof children === 'string') {
40
+ return children;
41
+ } else {
42
+ return children.map(renderChildren).join('');
43
+ }
44
+ }
45
+
46
+ function stringifyStyles(styles) {
47
+ return Object.keys(styles).map(function (key) {
48
+ return key + ': ' + styles[key];
49
+ }).join('; ');
50
+ }
51
+
52
+ var InlineWrapper = function InlineWrapper(_ref) {
53
+ var style = _ref.style,
54
+ children = _ref.children;
55
+ return '<span style="' + stringifyStyles(style) + '">' + renderChildren(children) + '</span>';
56
+ };
57
+
58
+ var blockRenderMap = {
59
+ unstyled: function unstyled(children) {
60
+ return '<div>' + renderChildren(children) + '</div>';
61
+ }
62
+ };
63
+
64
+ var entityMap = {
65
+ mention: function mention(children, data) {
66
+ return '<span data-mention-user-id="' + data.mention.link + '">' + renderChildren(children) + '</span>';
67
+ }
68
+ };
69
+
70
+ var decorators = [{
71
+ strategy: _linkStrategy2.default,
72
+ component: function component(_ref2) {
73
+ var children = _ref2.children,
74
+ decoratedText = _ref2.decoratedText;
75
+ return '<a href="' + decoratedText + '" target="_blank" rel="noopener noreferrer">' + renderChildren(children) + '</a>';
76
+ }
77
+ }];
78
+
79
+ var renderers = {
80
+ styles: (0, _redraft.createStylesRenderer)(InlineWrapper, styleMap),
81
+ blocks: blockRenderMap,
82
+ entities: entityMap,
83
+ decorators: decorators
84
+ };
85
+
86
+ function renderHTML(tokens) {
87
+ var raw = (0, _convertToDraft2.default)(tokens);
88
+ var rendered = (0, _redraft2.default)(raw, renderers);
89
+ return rendered.join('');
90
+ }
91
+
92
+ exports.default = renderHTML;
93
+ //# sourceMappingURL=renderHTML.js.map
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ exports.__esModule = true;
4
+ /* Copyright (C) 2018 PageProof Holdings Limited - All Rights Reserved.
5
+ * Unauthorized copying of this file, via any medium is strictly prohibited.
6
+ * Proprietary and confidential.
7
+ */
8
+ function renderText(tokens) {
9
+ return tokens.blocks.map(function (block) {
10
+ return block.value;
11
+ }).join('\n');
12
+ }
13
+
14
+ exports.default = renderText;
15
+ //# sourceMappingURL=renderText.js.map
@@ -1 +1 @@
1
- "use strict";exports.__esModule=true;var CREATION_TOKEN_LENGTH=32;function generateCreationToken(){var time=(new Date).getTime();var mask="abcdefghijklmnopqrstuvwxyz"+"ABCDEFGHIJKLMNOPQRSTUVWXYZ"+"0123456789"+"~`!@#$%^&*()_+-={}[]:\";'<>?,./|\\";var result="";for(var i=CREATION_TOKEN_LENGTH;i>0;--i){result+=mask[Math.round(Math.random()*(mask.length-1))]}return result+"-"+time}exports.generateCreationToken=generateCreationToken;
1
+ "use strict";exports.__esModule=true;exports.generateCreationToken=undefined;var _generateRandom=require("./generateRandom");var _generateRandom2=_interopRequireDefault(_generateRandom);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var CREATION_TOKEN_LENGTH=32;var CREATION_TOKEN_CHARS=_generateRandom.lower+_generateRandom.upper+_generateRandom.numbers+_generateRandom.symbols;function generateCreationToken(){var time=(new Date).getTime();var result=(0,_generateRandom2.default)(CREATION_TOKEN_CHARS,CREATION_TOKEN_LENGTH);return result+"-"+time}exports.generateCreationToken=generateCreationToken;
@@ -1 +1 @@
1
- "use strict";exports.__esModule=true;exports.comments=undefined;var _parseComment=require("./comments/parseComment");var _parseComment2=_interopRequireDefault(_parseComment);var _v=require("./comments/v2");var _extractMentions=require("./comments/extractMentions");var _extractMentions2=_interopRequireDefault(_extractMentions);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function extractMentionsFromStringOrStructure(value){if(typeof value==="string"){value=(0,_parseComment2.default)(value)}return(0,_extractMentions2.default)(value)}var comments=exports.comments={parse:_parseComment2.default,serialize:_v.serialize,mentions:extractMentionsFromStringOrStructure};
1
+ "use strict";exports.__esModule=true;exports.comments=undefined;var _parseComment=require("./comments/parseComment");var _parseComment2=_interopRequireDefault(_parseComment);var _v=require("./comments/v2");var _extractMentions=require("./comments/extractMentions");var _extractMentions2=_interopRequireDefault(_extractMentions);var _renderText=require("./comments/renderText");var _renderText2=_interopRequireDefault(_renderText);var _renderHTML=require("./comments/renderHTML");var _renderHTML2=_interopRequireDefault(_renderHTML);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function extractMentionsFromStringOrStructure(value){if(typeof value==="string"){value=(0,_parseComment2.default)(value)}return(0,_extractMentions2.default)(value)}var comments=exports.comments={parse:_parseComment2.default,serialize:_v.serialize,mentions:extractMentionsFromStringOrStructure,text:_renderText2.default,html:_renderHTML2.default};
@@ -0,0 +1 @@
1
+ "use strict";exports.__esModule=true;function generateRandom(chars,length){var result=new Array(length);for(var i=length;i>0;--i){result[i]=chars[Math.round(Math.random()*(chars.length-1))]}return result.join("")}var lower=exports.lower="abcdefghijklmnopqrstuvwxyz";var upper=exports.upper="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var numbers=exports.numbers="0123456789";var symbols=exports.symbols="~`!@#$%^&*()_+-={}[]:\";'<>?,./|\\";exports.default=generateRandom;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pageproof/sdk-pr",
3
3
  "description": "The official PageProof SDK",
4
- "version": "104.0.1535945812873",
4
+ "version": "104.0.1538691344811",
5
5
  "main": "lib/index.js",
6
6
  "browser": "lib/pageproof.js",
7
7
  "dependencies": {
@@ -9,7 +9,9 @@
9
9
  "Base64": "^1.0.1",
10
10
  "crypto-js": "^3.1.9-1",
11
11
  "debug": "^2.6.8",
12
+ "draft-js-linkify-plugin": "^2.0.1",
12
13
  "node-forge": "^0.7.1",
14
+ "redraft": "^0.10.1",
13
15
  "superagent": "3.7.x",
14
16
  "superagent-proxy": "1.0.x",
15
17
  "system-proxy-url": "^0.2.0"