@pageproof/sdk-pr 96.0.1532299633749 → 96.0.1532300375167

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/lib/api/Proofs.js CHANGED
@@ -1 +1 @@
1
- "use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _ProofsOwners=require("./ProofsOwners");var _ProofsOwners2=_interopRequireDefault(_ProofsOwners);var _ProofsEditors=require("./ProofsEditors");var _ProofsEditors2=_interopRequireDefault(_ProofsEditors);var _ProofsVersions=require("./ProofsVersions");var _ProofsVersions2=_interopRequireDefault(_ProofsVersions);var _ProofsGroups=require("./ProofsGroups");var _ProofsGroups2=_interopRequireDefault(_ProofsGroups);var _Proof=require("../models/Proof");var _Proof2=_interopRequireDefault(_Proof);var _FileStatus=require("../enum/FileStatus");var _FileStatus2=_interopRequireDefault(_FileStatus);var _constants=require("../util/constants");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}var Proofs=function(_API){_inherits(Proofs,_API);function Proofs(client){_classCallCheck(this,Proofs);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.owners=new _ProofsOwners2.default(client);_this.editors=new _ProofsEditors2.default(client);_this.versions=new _ProofsVersions2.default(client);_this.groups=new _ProofsGroups2.default(client);return _this}Proofs.prototype.setWorkflow=function setWorkflow(proofId,workflowId){var _this2=this;return this.client.request("proofs.normalize-workflow",{proofId:proofId,workflowId:workflowId}).then(function(){return _this2.client.request("proofs.set-workflow",{proofId:proofId,workflowId:workflowId})})};Proofs.prototype.setTags=function setTags(proofId,tags){return this.client.request("proofs.set-tags",{relatedId:proofId,tag:tags.join(",")})};Proofs.prototype.deleteTag=function deleteTag(proofId,tag){return this.client.request("proofs.tag-delete",{relatedId:proofId,tag:tag})};Proofs.prototype.setFile=function setFile(proofId,fileId){var _this3=this;return this.client.request("proofs.set-file",{proofId:proofId,fileId:fileId}).then(function(){return _this3.client.request("proofs.distribute-file",{proofId:proofId})})};Proofs.prototype.create=function create(_ref){var _this4=this;var name=_ref.name,_ref$tags=_ref.tags,tags=_ref$tags===undefined?[]:_ref$tags,_ref$dueDate=_ref.dueDate,dueDate=_ref$dueDate===undefined?new Date(Date.now()+3*_constants.DAY_IN_MS):_ref$dueDate,messageToReviewers=_ref.messageToReviewers,workflow=_ref.workflow,file=_ref.file,group=_ref.group,_ref$start=_ref.start,start=_ref$start===undefined?true:_ref$start;var shouldStart=start&&!group;return this.client.request("proofs.create",{title:name,dueDate:dueDate.toISOString(),description:messageToReviewers,groupId:group?group.id:undefined}).then(function(response){var proof=(new _Proof2.default).fromProof(response.data);return Promise.all([proof,tags.length&&_this4.setTags(proof.id,tags),workflow&&_this4.setWorkflow(proof.id,workflow.id),file&&_this4.setFile(proof.id,file.id)])}).then(function(_ref2){var proof=_ref2[0];return Promise.resolve(shouldStart&&_this4.start(proof.id)).then(function(){return proof})}).then(function(proof){if(workflow){proof.workflowId=workflow.id}if(file){proof.fileId=file.id;proof.fileStatus=_FileStatus2.default.UPLOADING}proof.calculateState();return proof})};Proofs.prototype.archive=function archive(proofId){return this.client.request("proofs.archive",{proofId:proofId})};Proofs.prototype.unarchive=function unarchive(proofId){return this.client.request("proofs.unarchive",{proofId:proofId})};Proofs.prototype.delete=function _delete(proofId){return this.client.request("proofs.delete",{proofId:proofId})};Proofs.prototype.return=function _return(proofId){return this.client.request("proofs.return",{proofId:proofId})};Proofs.prototype.start=function start(proofId){return this.client.request("proofs.start",{proofId:proofId})};Proofs.prototype.removeEditor=function removeEditor(id){return this.client.request("proofs.remove-editor",{proofId:id})};Proofs.prototype.load=function load(proofId){return this.client.request("proofs.load",{proofId:proofId}).then(function(response){return(new _Proof2.default).fromProof(response.data)})};Proofs.prototype.lock=function lock(proofId){return this.client.request("proofs.lock",{proofId:proofId})};Proofs.prototype.unlock=function unlock(proofId){return this.client.request("proofs.unlock",{proofId:proofId})};Proofs.prototype.requestUnlock=function requestUnlock(proofId){return this.client.request("proofs.request-unlock",{proofId:proofId})};Proofs.prototype.requestAccess=function requestAccess(proofId){return this.client.request("proofs.requestaccess",{proofId:proofId})};return Proofs}(_API3.default);exports.default=Proofs;
1
+ "use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _ProofsOwners=require("./ProofsOwners");var _ProofsOwners2=_interopRequireDefault(_ProofsOwners);var _ProofsEditors=require("./ProofsEditors");var _ProofsEditors2=_interopRequireDefault(_ProofsEditors);var _ProofsVersions=require("./ProofsVersions");var _ProofsVersions2=_interopRequireDefault(_ProofsVersions);var _ProofsGroups=require("./ProofsGroups");var _ProofsGroups2=_interopRequireDefault(_ProofsGroups);var _Proof=require("../models/Proof");var _Proof2=_interopRequireDefault(_Proof);var _FileStatus=require("../enum/FileStatus");var _FileStatus2=_interopRequireDefault(_FileStatus);var _constants=require("../util/constants");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}var Proofs=function(_API){_inherits(Proofs,_API);function Proofs(client){_classCallCheck(this,Proofs);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.owners=new _ProofsOwners2.default(client);_this.editors=new _ProofsEditors2.default(client);_this.versions=new _ProofsVersions2.default(client);_this.groups=new _ProofsGroups2.default(client);return _this}Proofs.prototype.setWorkflow=function setWorkflow(proofId,workflowId){var _this2=this;return this.client.request("proofs.normalize-workflow",{proofId:proofId,workflowId:workflowId}).then(function(){return _this2.client.request("proofs.set-workflow",{proofId:proofId,workflowId:workflowId})})};Proofs.prototype.setTags=function setTags(proofId,tags){return this.client.request("proofs.set-tags",{relatedId:proofId,tag:tags.join(",")})};Proofs.prototype.deleteTag=function deleteTag(proofId,tag){return this.client.request("proofs.tag-delete",{relatedId:proofId,tag:tag})};Proofs.prototype.setFile=function setFile(proofId,fileId){var _this3=this;return this.client.request("proofs.set-file",{proofId:proofId,fileId:fileId}).then(function(){return _this3.client.request("proofs.distribute-file",{proofId:proofId})})};Proofs.prototype.create=function create(_ref){var _this4=this;var name=_ref.name,_ref$tags=_ref.tags,tags=_ref$tags===undefined?[]:_ref$tags,_ref$dueDate=_ref.dueDate,dueDate=_ref$dueDate===undefined?new Date(Date.now()+3*_constants.DAY_IN_MS):_ref$dueDate,messageToReviewers=_ref.messageToReviewers,workflow=_ref.workflow,file=_ref.file,group=_ref.group,_ref$start=_ref.start,start=_ref$start===undefined?true:_ref$start;var shouldStart=start&&!group;return this.client.request("proofs.create",{title:name,dueDate:dueDate.toISOString(),description:messageToReviewers,groupId:group?group.id:undefined}).then(function(response){var proof=(new _Proof2.default).fromProof(response.data);return Promise.all([proof,tags.length&&_this4.setTags(proof.id,tags),workflow&&_this4.setWorkflow(proof.id,workflow.id),file&&_this4.setFile(proof.id,file.id)])}).then(function(_ref2){var proof=_ref2[0];return Promise.resolve(shouldStart&&_this4.start(proof.id)).then(function(){return proof})}).then(function(proof){if(workflow){proof.workflowId=workflow.id}if(file){proof.fileId=file.id;proof.fileStatus=_FileStatus2.default.UPLOADING}proof.calculateState();return proof})};Proofs.prototype.archive=function archive(proofId){return this.client.request("proofs.archive",{proofId:proofId})};Proofs.prototype.unarchive=function unarchive(proofId){return this.client.request("proofs.unarchive",{proofId:proofId})};Proofs.prototype.delete=function _delete(proofId){return this.client.request("proofs.delete",{proofId:proofId})};Proofs.prototype.return=function _return(proofId){return this.client.request("proofs.return",{proofId:proofId})};Proofs.prototype.start=function start(proofId){return this.client.request("proofs.start",{proofId:proofId})};Proofs.prototype.removeEditor=function removeEditor(id){return this.client.request("proofs.remove-editor",{proofId:id})};Proofs.prototype.load=function load(proofId){return this.client.request("proofs.load",{proofId:proofId}).then(function(response){return(new _Proof2.default).fromProof(response.data)})};Proofs.prototype.lock=function lock(proofId){return this.client.request("proofs.lock",{proofId:proofId})};Proofs.prototype.unlock=function unlock(proofId){return this.client.request("proofs.unlock",{proofId:proofId})};Proofs.prototype.requestUnlock=function requestUnlock(proofId){return this.client.request("proofs.request-unlock",{proofId:proofId})};Proofs.prototype.requestAccess=function requestAccess(proofId){return this.client.request("proofs.request-access",{proofId:proofId})};return Proofs}(_API3.default);exports.default=Proofs;
@@ -212,7 +212,7 @@
212
212
  "chain": ["proofId"],
213
213
  "trailing": true
214
214
  },
215
- "proofs.requestaccess": {
215
+ "proofs.request-access": {
216
216
  "method": "GET",
217
217
  "path": "/api/proofs/requestaccess",
218
218
  "chain": ["proofId"]
package/lib/pageproof.js CHANGED
@@ -1,4 +1,4 @@
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=29)}([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(15),y=r(h),m=o(9),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})}{(.*?)}/g,t.ISO_REGEX=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/,t.DEFAULT_ISO_DATE="0001-01-01T00:00:00",t.DAY_IN_MS=864e5,t.COMMENT_CACHE_PREFIX="comment",t.THUMBNAIL_CACHE_PREFIX="thumbnail"},function(e,t,o){"use strict";function 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(17),f=r(u),c=o(18),l=r(c),p=o(5),d=r(p),h=o(19),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"},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";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(55).default;break;case"Buffer":e=o(56).default;break;case"String":e=o(57).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(11)("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={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";t.__esModule=!0,t.default=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},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(13),u=r(a),f=o(26),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(25),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";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=void 0;r="96.0.1532299633749",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";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";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(12),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(67),s=r(i),a=o(1),u=r(a),f=o(3),c=r(f),l=o(28),p=r(l),d=o(10),h=r(d),y=o(14),m=r(y),w=o(2),v={__prepare:function(e){e._XY=p.default.parseValue(e.XY)},id:"CommentId",pin:function(e){return(new p.default).fromPin(e._XY)},user:function(e){return(new c.default).fromUser(e)},comment$:"EncryptedComment",envelope:"Envelope",attachments:function(e){return e.Attachment?[(new h.default).fromCommentAttachment(e)]:[]},agreeCount:function(e){return e.Agrees.length},pageNumber:(0,a.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,a.date)("Timestamp"),updatedDate:(0,a.date)("Updated"),parentCommentId:(0,a.optional)("Parent"),metadata:(0,a.json)("Metadata",{}),state:function(e){return+e.Done?m.default.DONE:+e.Change?m.default.TODO:m.default.COMMENT}},_=function(){function e(){n(this,e)}return e.prototype.fromComment=function(e){return(0,u.default)(this,v,e),this},e.prototype.fromRawComment=function(e){this.raw=e;var t=(0,s.default)(e);this.text=t.replace(w.MENTION_REGEX,function(e,t,o){return o});var o=0;this.html=t.replace(w.MENTION_REGEX,function(e,t,r,n){return'<span data-mention data-mention-index="'+o+++'" data-mention-user-id="'+t+'" data-mention-user-label="'+r.replace(/"/,'\\"')+'" data-mention-start-index="'+n+'" data-mention-end-index="'+(n+e.length)+'" data-mention-length="'+e.length+'">'+r+"</span>"});var r=[];e.replace(w.MENTION_REGEX,function(e,t,o,n){r.push({id:t,label:o,index:n,length:e.length})});var n=[],i=0;r.forEach(function(t){var o=e.slice(i,t.index);i=t.index+t.length,o&&n.push({type:"text",value:o}),n.push({type:"mention",value:t})});var a=e.slice(i);return a&&n.push({type:"text",value:a}),this.tokens=n,this},e}();t.default=_},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){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.Model=t.Enum=t.Bluffer=t.Client=void 0;var i=o(30),s=n(i),a=o(7),u=n(a),f=o(72),c=r(f),l=o(75),p=r(l),d=o(16),h=n(d);t.default=s.default,t.Client=s.default,t.Bluffer=u.default,t.Enum=c,t.Model=p,t.version=h.default},function(e,t,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(31),s=r(i),a=o(36),u=r(a),f=o(37),c=r(f),l=o(39),p=r(l),d=o(41),h=r(d),y=o(43),m=r(y),w=o(44),v=r(w),_=o(45),b=r(_),E=o(52),O=r(E),g=o(53),P=r(g),I=o(61),T=r(I),R=o(64),S=r(R),k=o(66),M=r(k),A=o(68),j=r(A),C=o(69),D=r(C),q=o(6),N=r(q),U=o(70),x=r(U),B=o(8),G=r(B),K=o(71),W=r(K),L=o(11)("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 x.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 j.default(this),this.proofs=new b.default(this),this.briefs=new O.default(this),this.users=new v.default(this),this.workflows=new S.default(this),this.sessions=new D.default(this),this._registerCoreHooks(),this._enhance()}return e.prototype._registerCoreHooks=function(){this.on("error.throttled",function(e){var t=e.data.response.data.timeout;return L("Sleeping "+t+"ms until rate limit resets"),(0,W.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(32),s=r(i),a=o(33),u=r(a),f=o(34),c=r(f),l=o(35),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(38),a=r(s),u=o(15),f=r(u),c=o(16),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"]},"users.by-id":{method:"GET",path:"/api/users",chain:["userId"]},"users.by-email":{method:"POST",path:"/api/users/email",body:["email"],trailing:!0},"users.invite":{method:"POST",path:"/api/users/create",body:["email"]},"proofs.create":{method:"POST",path:"/api/proofs/create",body:["title","dueDate","description","groupId"]},"proofs.normalize-workflow":{method:"POST",path:"/api/proofs/permission/check",body:["proofId","workflowId"]},"proofs.set-workflow":{method:"POST",path:"/api/proofs/update",body:["proofId","workflowId"]},"proofs.set-tags":{method:"POST",path:"/api/tags/create",body:["relatedId","tag"]},"proofs.set-file":{method:"POST",path:"/api/proofs/update",body:["proofId","fileId"]},"proofs.distribute-file":{method:"GET",path:"/api/proofs/distribute",chain:["proofId"],trailing:!0},"proofs.archive":{method:"GET",path:"/api/proofs/close",chain:["proofId"],trailing:!0},"proofs.unarchive":{method:"GET",path:"/api/proofs/reopen",chain:["proofId"],trailing:!0},"proofs.delete":{method:"GET",path:"/api/proofs/delete",chain:["proofId"],trailing:!0},"proofs.start":{method:"POST",path:"/api/proofs/startworkflow",body:["proofId"],trailing:!0},"proofs.editors.add":{version:2,method:"POST",path:"/api/proofs/editor/add",body:["proofId","editors","editorMessage"]},"proofs.editors.remove":{version:2,method:"POST",path:"/api/proofs/editor/remove",body:["proofId","editors"]},"proofs.editors.replace":{version:2,method:"POST",path:"/api/proofs/editor/replace",body:["proofId","oldEditors","newEditors"]},"proofs.editors.set":{version:2,method:"POST",path:"/api/proofs/editor/set",body:["proofId","editors"]},"briefs.start":{method:"POST",path:"/api/briefs/start",body:["briefId"]},"proofs.return":{method:"GET",path:"/api/proofs/returnproof",chain:["proofId"]},"proofs.groups.create":{method:"POST",path:"/api/proofs/groups/create",body:["name"]},"proofs.groups.update":{method:"POST",path:"/api/proofs/groups/update",body:["groupId","name"]},"proofs.groups.load":{method:"GET",path:"/api/proofs/group",chain:["groupId"]},"proofs.groups.ready":{method:"POST",path:"/api/proofs/groups/ready",body:["groupId"]},"proofs.groups.owners.add":{version:2,method:"POST",path:"/api/v2/proofs/owners/groups/add",body:["groupId","owners"]},"proofs.groups.workflows.add-reviewers":{version:2,method:"POST",path:"/api/v2/workflows/groups/reviewers/add",body:["groupId","reviewers"]},"proofs.versions.attach":{method:"POST",path:"/api/proofs/versions/create",body:["proofId","versionId"]},"proofs.versions.list":{method:"GET",path:"/api/proofs/versions",chain:["proofId"],trailing:!0},"proofs.load":{method:"GET",path:"/api/proofs/",chain:["proofId"],trailing:!0},"proofs.requestaccess":{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"]},"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(8),s=r(i),a=o(40),u=o(2),f=o(9),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(6),c=r(f),l=o(42),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(6),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(d).forEach(function(o){t[o]=e[d[o]]}),t}function u(e){return(e||[]).map(function(e){return(new p.default).fromProof(e)})}t.__esModule=!0;var f=o(0),c=r(f),l=o(4),p=r(l),d={inbox:"ProofIn",sent:"ProofOut",outbox:"ProofOutBox"},h=function(e){function t(){return n(this,t),i(this,e.apply(this,arguments))}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=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){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(46),c=r(f),l=o(47),p=r(l),d=o(48),h=r(d),y=o(49),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",{proofId:e})},t.prototype.unarchive=function(e){return this.client.request("proofs.unarchive",{proofId:e})},t.prototype.delete=function(e){return this.client.request("proofs.delete",{proofId:e})},t.prototype.return=function(e){return this.client.request("proofs.return",{proofId:e})},t.prototype.start=function(e){return this.client.request("proofs.start",{proofId:e})},t.prototype.removeEditor=function(e){return this.client.request("proofs.remove-editor",{proofId:e})},t.prototype.load=function(e){return this.client.request("proofs.load",{proofId:e}).then(function(e){return(new v.default).fromProof(e.data)})},t.prototype.lock=function(e){return this.client.request("proofs.lock",{proofId:e})},t.prototype.unlock=function(e){return this.client.request("proofs.unlock",{proofId:e})},t.prototype.requestUnlock=function(e){return this.client.request("proofs.request-unlock",{proofId:e})},t.prototype.requestAccess=function(e){return this.client.request("proofs.requestaccess",{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(20),c=r(f),l=o(21),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(22),l=r(c),p=o(50),d=r(p),h=o(51),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:(0,g.default)(e.substring(0,t)),extension:e.substring(t+1)}}t.__esModule=!0;var u=o(0),f=r(u),c=o(10),l=r(c),p=o(5),d=r(p),h=o(23),y=r(h),m=o(54),w=r(m),v=o(7),_=r(v),b=o(59),E=r(b),O=o(60),g=r(O),P=o(2),I=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)/P.BYTES_PER_BLOCK),O=new Array(b),g=function(){};f&&(g=function(e,t){O[e]=Math.max(t,O[e]||0),f(O.reduce(function(e,t){return e+(t||0)},0)/b*.99)});for(var I=function(e,o){return t.client.crypto().encryptFileBlock(s,e).then(function(e){return t.client.request("files.upload-block",{block:o,part:1,token:i,data:e},{onUploadProgress:g.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;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 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(P.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(P.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=I},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(7),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(58),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.replace(/[-_()]/g,"").replace(/\s+/g," ").replace(/\s/g,"_")}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(62),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(63),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(24),p=r(l),d=o(12),h=r(d),y=o(13),m=r(y),w=o(19),v=o(65),_=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(b);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)(E,n)),t.concat(o)}t.__esModule=!0;var f=o(0),c=r(f),l=o(27),p=r(l),d=o(14),h=r(d),y=o(2),m=o(21),w=(0,m.sortObjectsByKey)("pageNumber"),v=(0,m.sortObjectsByKey)("createdDate",!0),_=(0,m.sortObjectsByKey)("createdDate",!1),b=(0,m.combineSort)(w,v),E=(0,m.combineSort)(w,_),O=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=f?f.toISOString().match(y.ISO_REGEX)[0]:y.DEFAULT_ISO_DATE,w={proofId:r,page:i,timestamp:m};return this.client.request(null!==i?"comments.load-page":"comments.load-all",w).then(function(e){var o=u(e.data.Pages?a(e.data.Pages):e.data),r=Promise.resolve();if(d){var n=[],i=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 i}),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)})});return l?null:Promise.all(e)})}return r.then(function(){return o})})},t}(c.default);t.default=O},function(e,t,o){"use strict";function r(e){var t=""+e,o=n.exec(t);if(!o)return t;var r,i="",s=0,a=0;for(s=o.index;s<t.length;s++){switch(t.charCodeAt(s)){case 34:r="&quot;";break;case 38:r="&amp;";break;case 39:r="&#39;";break;case 60:r="&lt;";break;case 62:r="&gt;";break;default:continue}a!==s&&(i+=t.substring(a,s)),a=s+1,i+=r}return a!==s?i+t.substring(a,s):i}/*!
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.PageProof=t():e.PageProof=t()}(this,function(){return function(e){function t(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=29)}([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(15),y=r(h),m=o(9),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})}{(.*?)}/g,t.ISO_REGEX=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/,t.DEFAULT_ISO_DATE="0001-01-01T00:00:00",t.DAY_IN_MS=864e5,t.COMMENT_CACHE_PREFIX="comment",t.THUMBNAIL_CACHE_PREFIX="thumbnail"},function(e,t,o){"use strict";function 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(17),f=r(u),c=o(18),l=r(c),p=o(5),d=r(p),h=o(19),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"},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";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(55).default;break;case"Buffer":e=o(56).default;break;case"String":e=o(57).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(11)("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={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";t.__esModule=!0,t.default=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},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(13),u=r(a),f=o(26),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(25),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";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=void 0;r="96.0.1532300375167",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";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";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(12),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(67),s=r(i),a=o(1),u=r(a),f=o(3),c=r(f),l=o(28),p=r(l),d=o(10),h=r(d),y=o(14),m=r(y),w=o(2),v={__prepare:function(e){e._XY=p.default.parseValue(e.XY)},id:"CommentId",pin:function(e){return(new p.default).fromPin(e._XY)},user:function(e){return(new c.default).fromUser(e)},comment$:"EncryptedComment",envelope:"Envelope",attachments:function(e){return e.Attachment?[(new h.default).fromCommentAttachment(e)]:[]},agreeCount:function(e){return e.Agrees.length},pageNumber:(0,a.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,a.date)("Timestamp"),updatedDate:(0,a.date)("Updated"),parentCommentId:(0,a.optional)("Parent"),metadata:(0,a.json)("Metadata",{}),state:function(e){return+e.Done?m.default.DONE:+e.Change?m.default.TODO:m.default.COMMENT}},_=function(){function e(){n(this,e)}return e.prototype.fromComment=function(e){return(0,u.default)(this,v,e),this},e.prototype.fromRawComment=function(e){this.raw=e;var t=(0,s.default)(e);this.text=t.replace(w.MENTION_REGEX,function(e,t,o){return o});var o=0;this.html=t.replace(w.MENTION_REGEX,function(e,t,r,n){return'<span data-mention data-mention-index="'+o+++'" data-mention-user-id="'+t+'" data-mention-user-label="'+r.replace(/"/,'\\"')+'" data-mention-start-index="'+n+'" data-mention-end-index="'+(n+e.length)+'" data-mention-length="'+e.length+'">'+r+"</span>"});var r=[];e.replace(w.MENTION_REGEX,function(e,t,o,n){r.push({id:t,label:o,index:n,length:e.length})});var n=[],i=0;r.forEach(function(t){var o=e.slice(i,t.index);i=t.index+t.length,o&&n.push({type:"text",value:o}),n.push({type:"mention",value:t})});var a=e.slice(i);return a&&n.push({type:"text",value:a}),this.tokens=n,this},e}();t.default=_},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){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.Model=t.Enum=t.Bluffer=t.Client=void 0;var i=o(30),s=n(i),a=o(7),u=n(a),f=o(72),c=r(f),l=o(75),p=r(l),d=o(16),h=n(d);t.default=s.default,t.Client=s.default,t.Bluffer=u.default,t.Enum=c,t.Model=p,t.version=h.default},function(e,t,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(31),s=r(i),a=o(36),u=r(a),f=o(37),c=r(f),l=o(39),p=r(l),d=o(41),h=r(d),y=o(43),m=r(y),w=o(44),v=r(w),_=o(45),b=r(_),E=o(52),O=r(E),g=o(53),P=r(g),I=o(61),T=r(I),R=o(64),S=r(R),k=o(66),M=r(k),A=o(68),j=r(A),C=o(69),D=r(C),q=o(6),N=r(q),U=o(70),x=r(U),B=o(8),G=r(B),K=o(71),W=r(K),L=o(11)("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 x.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 j.default(this),this.proofs=new b.default(this),this.briefs=new O.default(this),this.users=new v.default(this),this.workflows=new S.default(this),this.sessions=new D.default(this),this._registerCoreHooks(),this._enhance()}return e.prototype._registerCoreHooks=function(){this.on("error.throttled",function(e){var t=e.data.response.data.timeout;return L("Sleeping "+t+"ms until rate limit resets"),(0,W.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(32),s=r(i),a=o(33),u=r(a),f=o(34),c=r(f),l=o(35),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(38),a=r(s),u=o(15),f=r(u),c=o(16),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"]},"users.by-id":{method:"GET",path:"/api/users",chain:["userId"]},"users.by-email":{method:"POST",path:"/api/users/email",body:["email"],trailing:!0},"users.invite":{method:"POST",path:"/api/users/create",body:["email"]},"proofs.create":{method:"POST",path:"/api/proofs/create",body:["title","dueDate","description","groupId"]},"proofs.normalize-workflow":{method:"POST",path:"/api/proofs/permission/check",body:["proofId","workflowId"]},"proofs.set-workflow":{method:"POST",path:"/api/proofs/update",body:["proofId","workflowId"]},"proofs.set-tags":{method:"POST",path:"/api/tags/create",body:["relatedId","tag"]},"proofs.set-file":{method:"POST",path:"/api/proofs/update",body:["proofId","fileId"]},"proofs.distribute-file":{method:"GET",path:"/api/proofs/distribute",chain:["proofId"],trailing:!0},"proofs.archive":{method:"GET",path:"/api/proofs/close",chain:["proofId"],trailing:!0},"proofs.unarchive":{method:"GET",path:"/api/proofs/reopen",chain:["proofId"],trailing:!0},"proofs.delete":{method:"GET",path:"/api/proofs/delete",chain:["proofId"],trailing:!0},"proofs.start":{method:"POST",path:"/api/proofs/startworkflow",body:["proofId"],trailing:!0},"proofs.editors.add":{version:2,method:"POST",path:"/api/proofs/editor/add",body:["proofId","editors","editorMessage"]},"proofs.editors.remove":{version:2,method:"POST",path:"/api/proofs/editor/remove",body:["proofId","editors"]},"proofs.editors.replace":{version:2,method:"POST",path:"/api/proofs/editor/replace",body:["proofId","oldEditors","newEditors"]},"proofs.editors.set":{version:2,method:"POST",path:"/api/proofs/editor/set",body:["proofId","editors"]},"briefs.start":{method:"POST",path:"/api/briefs/start",body:["briefId"]},"proofs.return":{method:"GET",path:"/api/proofs/returnproof",chain:["proofId"]},"proofs.groups.create":{method:"POST",path:"/api/proofs/groups/create",body:["name"]},"proofs.groups.update":{method:"POST",path:"/api/proofs/groups/update",body:["groupId","name"]},"proofs.groups.load":{method:"GET",path:"/api/proofs/group",chain:["groupId"]},"proofs.groups.ready":{method:"POST",path:"/api/proofs/groups/ready",body:["groupId"]},"proofs.groups.owners.add":{version:2,method:"POST",path:"/api/v2/proofs/owners/groups/add",body:["groupId","owners"]},"proofs.groups.workflows.add-reviewers":{version:2,method:"POST",path:"/api/v2/workflows/groups/reviewers/add",body:["groupId","reviewers"]},"proofs.versions.attach":{method:"POST",path:"/api/proofs/versions/create",body:["proofId","versionId"]},"proofs.versions.list":{method:"GET",path:"/api/proofs/versions",chain:["proofId"],trailing:!0},"proofs.load":{method:"GET",path:"/api/proofs/",chain:["proofId"],trailing:!0},"proofs.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"]},"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(8),s=r(i),a=o(40),u=o(2),f=o(9),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(6),c=r(f),l=o(42),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(6),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(d).forEach(function(o){t[o]=e[d[o]]}),t}function u(e){return(e||[]).map(function(e){return(new p.default).fromProof(e)})}t.__esModule=!0;var f=o(0),c=r(f),l=o(4),p=r(l),d={inbox:"ProofIn",sent:"ProofOut",outbox:"ProofOutBox"},h=function(e){function t(){return n(this,t),i(this,e.apply(this,arguments))}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=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){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(46),c=r(f),l=o(47),p=r(l),d=o(48),h=r(d),y=o(49),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",{proofId:e})},t.prototype.unarchive=function(e){return this.client.request("proofs.unarchive",{proofId:e})},t.prototype.delete=function(e){return this.client.request("proofs.delete",{proofId:e})},t.prototype.return=function(e){return this.client.request("proofs.return",{proofId:e})},t.prototype.start=function(e){return this.client.request("proofs.start",{proofId:e})},t.prototype.removeEditor=function(e){return this.client.request("proofs.remove-editor",{proofId:e})},t.prototype.load=function(e){return this.client.request("proofs.load",{proofId:e}).then(function(e){return(new v.default).fromProof(e.data)})},t.prototype.lock=function(e){return this.client.request("proofs.lock",{proofId:e})},t.prototype.unlock=function(e){return this.client.request("proofs.unlock",{proofId:e})},t.prototype.requestUnlock=function(e){return this.client.request("proofs.request-unlock",{proofId:e})},t.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(20),c=r(f),l=o(21),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(22),l=r(c),p=o(50),d=r(p),h=o(51),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:(0,g.default)(e.substring(0,t)),extension:e.substring(t+1)}}t.__esModule=!0;var u=o(0),f=r(u),c=o(10),l=r(c),p=o(5),d=r(p),h=o(23),y=r(h),m=o(54),w=r(m),v=o(7),_=r(v),b=o(59),E=r(b),O=o(60),g=r(O),P=o(2),I=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)/P.BYTES_PER_BLOCK),O=new Array(b),g=function(){};f&&(g=function(e,t){O[e]=Math.max(t,O[e]||0),f(O.reduce(function(e,t){return e+(t||0)},0)/b*.99)});for(var I=function(e,o){return t.client.crypto().encryptFileBlock(s,e).then(function(e){return t.client.request("files.upload-block",{block:o,part:1,token:i,data:e},{onUploadProgress:g.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;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 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(P.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(P.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=I},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(7),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(58),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.replace(/[-_()]/g,"").replace(/\s+/g," ").replace(/\s/g,"_")}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(62),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(63),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(24),p=r(l),d=o(12),h=r(d),y=o(13),m=r(y),w=o(19),v=o(65),_=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(b);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)(E,n)),t.concat(o)}t.__esModule=!0;var f=o(0),c=r(f),l=o(27),p=r(l),d=o(14),h=r(d),y=o(2),m=o(21),w=(0,m.sortObjectsByKey)("pageNumber"),v=(0,m.sortObjectsByKey)("createdDate",!0),_=(0,m.sortObjectsByKey)("createdDate",!1),b=(0,m.combineSort)(w,v),E=(0,m.combineSort)(w,_),O=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=f?f.toISOString().match(y.ISO_REGEX)[0]:y.DEFAULT_ISO_DATE,w={proofId:r,page:i,timestamp:m};return this.client.request(null!==i?"comments.load-page":"comments.load-all",w).then(function(e){var o=u(e.data.Pages?a(e.data.Pages):e.data),r=Promise.resolve();if(d){var n=[],i=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 i}),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)})});return l?null:Promise.all(e)})}return r.then(function(){return o})})},t}(c.default);t.default=O},function(e,t,o){"use strict";function r(e){var t=""+e,o=n.exec(t);if(!o)return t;var r,i="",s=0,a=0;for(s=o.index;s<t.length;s++){switch(t.charCodeAt(s)){case 34:r="&quot;";break;case 38:r="&amp;";break;case 39:r="&#39;";break;case 60:r="&lt;";break;case 62:r="&gt;";break;default:continue}a!==s&&(i+=t.substring(a,s)),a=s+1,i+=r}return a!==s?i+t.substring(a,s):i}/*!
2
2
  * escape-html
3
3
  * Copyright(c) 2012-2013 TJ Holowaychuk
4
4
  * Copyright(c) 2015 Andreas Lubbe
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": "96.0.1532299633749",
4
+ "version": "96.0.1532300375167",
5
5
  "main": "lib/index.js",
6
6
  "browser": "lib/pageproof.js",
7
7
  "dependencies": {