1 | !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Dropbox={})}(this,(function(e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var r=0;t.length>r;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function s(e,t,s){return t&&r(e.prototype,t),s&&r(e,s),e}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function n(e,t){return(n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function a(e,t,r){return(a=u()?Reflect.construct:function(e,t,r){var s=[null];s.push.apply(s,t);var i=new(Function.bind.apply(e,s));return r&&n(i,r.prototype),i}).apply(null,arguments)}function o(e){var t="function"==typeof Map?new Map:void 0;return(o=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return a(e,arguments,i(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),n(r,e)})(e)}function c(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}var p="user",l={};function f(e){var t="000".concat(e.charCodeAt(0).toString(16)).slice(-4);return"\\u".concat(t)}function h(e){return"https://".concat(e,".dropboxapi.com/2/")}function m(e){return JSON.stringify(e).replace(/[\u007f-\uffff]/g,f)}function d(e){return new Date(Date.now()+1e3*e)}function _(){return"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope||"undefined"==typeof module||"undefined"!=typeof window}l.accountSetProfilePhoto=function(e){return this.request("account/set_profile_photo",e,"user","api","rpc")},l.authTokenFromOauth1=function(e){return this.request("auth/token/from_oauth1",e,"app","api","rpc")},l.authTokenRevoke=function(){return this.request("auth/token/revoke",null,"user","api","rpc")},l.checkApp=function(e){return this.request("check/app",e,"app","api","rpc")},l.checkUser=function(e){return this.request("check/user",e,"user","api","rpc")},l.contactsDeleteManualContacts=function(){return this.request("contacts/delete_manual_contacts",null,"user","api","rpc")},l.contactsDeleteManualContactsBatch=function(e){return this.request("contacts/delete_manual_contacts_batch",e,"user","api","rpc")},l.filePropertiesPropertiesAdd=function(e){return this.request("file_properties/properties/add",e,"user","api","rpc")},l.filePropertiesPropertiesOverwrite=function(e){return this.request("file_properties/properties/overwrite",e,"user","api","rpc")},l.filePropertiesPropertiesRemove=function(e){return this.request("file_properties/properties/remove",e,"user","api","rpc")},l.filePropertiesPropertiesSearch=function(e){return this.request("file_properties/properties/search",e,"user","api","rpc")},l.filePropertiesPropertiesSearchContinue=function(e){return this.request("file_properties/properties/search/continue",e,"user","api","rpc")},l.filePropertiesPropertiesUpdate=function(e){return this.request("file_properties/properties/update",e,"user","api","rpc")},l.filePropertiesTemplatesAddForTeam=function(e){return this.request("file_properties/templates/add_for_team",e,"team","api","rpc")},l.filePropertiesTemplatesAddForUser=function(e){return this.request("file_properties/templates/add_for_user",e,"user","api","rpc")},l.filePropertiesTemplatesGetForTeam=function(e){return this.request("file_properties/templates/get_for_team",e,"team","api","rpc")},l.filePropertiesTemplatesGetForUser=function(e){return this.request("file_properties/templates/get_for_user",e,"user","api","rpc")},l.filePropertiesTemplatesListForTeam=function(){return this.request("file_properties/templates/list_for_team",null,"team","api","rpc")},l.filePropertiesTemplatesListForUser=function(){return this.request("file_properties/templates/list_for_user",null,"user","api","rpc")},l.filePropertiesTemplatesRemoveForTeam=function(e){return this.request("file_properties/templates/remove_for_team",e,"team","api","rpc")},l.filePropertiesTemplatesRemoveForUser=function(e){return this.request("file_properties/templates/remove_for_user",e,"user","api","rpc")},l.filePropertiesTemplatesUpdateForTeam=function(e){return this.request("file_properties/templates/update_for_team",e,"team","api","rpc")},l.filePropertiesTemplatesUpdateForUser=function(e){return this.request("file_properties/templates/update_for_user",e,"user","api","rpc")},l.fileRequestsCount=function(){return this.request("file_requests/count",null,"user","api","rpc")},l.fileRequestsCreate=function(e){return this.request("file_requests/create",e,"user","api","rpc")},l.fileRequestsDelete=function(e){return this.request("file_requests/delete",e,"user","api","rpc")},l.fileRequestsDeleteAllClosed=function(){return this.request("file_requests/delete_all_closed",null,"user","api","rpc")},l.fileRequestsGet=function(e){return this.request("file_requests/get",e,"user","api","rpc")},l.fileRequestsListV2=function(e){return this.request("file_requests/list_v2",e,"user","api","rpc")},l.fileRequestsList=function(){return this.request("file_requests/list",null,"user","api","rpc")},l.fileRequestsListContinue=function(e){return this.request("file_requests/list/continue",e,"user","api","rpc")},l.fileRequestsUpdate=function(e){return this.request("file_requests/update",e,"user","api","rpc")},l.filesAlphaGetMetadata=function(e){return this.request("files/alpha/get_metadata",e,"user","api","rpc")},l.filesAlphaUpload=function(e){return this.request("files/alpha/upload",e,"user","content","upload")},l.filesCopyV2=function(e){return this.request("files/copy_v2",e,"user","api","rpc")},l.filesCopy=function(e){return this.request("files/copy",e,"user","api","rpc")},l.filesCopyBatchV2=function(e){return this.request("files/copy_batch_v2",e,"user","api","rpc")},l.filesCopyBatch=function(e){return this.request("files/copy_batch",e,"user","api","rpc")},l.filesCopyBatchCheckV2=function(e){return this.request("files/copy_batch/check_v2",e,"user","api","rpc")},l.filesCopyBatchCheck=function(e){return this.request("files/copy_batch/check",e,"user","api","rpc")},l.filesCopyReferenceGet=function(e){return this.request("files/copy_reference/get",e,"user","api","rpc")},l.filesCopyReferenceSave=function(e){return this.request("files/copy_reference/save",e,"user","api","rpc")},l.filesCreateFolderV2=function(e){return this.request("files/create_folder_v2",e,"user","api","rpc")},l.filesCreateFolder=function(e){return this.request("files/create_folder",e,"user","api","rpc")},l.filesCreateFolderBatch=function(e){return this.request("files/create_folder_batch",e,"user","api","rpc")},l.filesCreateFolderBatchCheck=function(e){return this.request("files/create_folder_batch/check",e,"user","api","rpc")},l.filesDeleteV2=function(e){return this.request("files/delete_v2",e,"user","api","rpc")},l.filesDelete=function(e){return this.request("files/delete",e,"user","api","rpc")},l.filesDeleteBatch=function(e){return this.request("files/delete_batch",e,"user","api","rpc")},l.filesDeleteBatchCheck=function(e){return this.request("files/delete_batch/check",e,"user","api","rpc")},l.filesDownload=function(e){return this.request("files/download",e,"user","content","download")},l.filesDownloadZip=function(e){return this.request("files/download_zip",e,"user","content","download")},l.filesExport=function(e){return this.request("files/export",e,"user","content","download")},l.filesGetFileLockBatch=function(e){return this.request("files/get_file_lock_batch",e,"user","api","rpc")},l.filesGetMetadata=function(e){return this.request("files/get_metadata",e,"user","api","rpc")},l.filesGetPreview=function(e){return this.request("files/get_preview",e,"user","content","download")},l.filesGetTemporaryLink=function(e){return this.request("files/get_temporary_link",e,"user","api","rpc")},l.filesGetTemporaryUploadLink=function(e){return this.request("files/get_temporary_upload_link",e,"user","api","rpc")},l.filesGetThumbnail=function(e){return this.request("files/get_thumbnail",e,"user","content","download")},l.filesGetThumbnailV2=function(e){return this.request("files/get_thumbnail_v2",e,"app, user","content","download")},l.filesGetThumbnailBatch=function(e){return this.request("files/get_thumbnail_batch",e,"user","content","rpc")},l.filesListFolder=function(e){return this.request("files/list_folder",e,"user","api","rpc")},l.filesListFolderContinue=function(e){return this.request("files/list_folder/continue",e,"user","api","rpc")},l.filesListFolderGetLatestCursor=function(e){return this.request("files/list_folder/get_latest_cursor",e,"user","api","rpc")},l.filesListFolderLongpoll=function(e){return this.request("files/list_folder/longpoll",e,"noauth","notify","rpc")},l.filesListRevisions=function(e){return this.request("files/list_revisions",e,"user","api","rpc")},l.filesLockFileBatch=function(e){return this.request("files/lock_file_batch",e,"user","api","rpc")},l.filesMoveV2=function(e){return this.request("files/move_v2",e,"user","api","rpc")},l.filesMove=function(e){return this.request("files/move",e,"user","api","rpc")},l.filesMoveBatchV2=function(e){return this.request("files/move_batch_v2",e,"user","api","rpc")},l.filesMoveBatch=function(e){return this.request("files/move_batch",e,"user","api","rpc")},l.filesMoveBatchCheckV2=function(e){return this.request("files/move_batch/check_v2",e,"user","api","rpc")},l.filesMoveBatchCheck=function(e){return this.request("files/move_batch/check",e,"user","api","rpc")},l.filesPermanentlyDelete=function(e){return this.request("files/permanently_delete",e,"user","api","rpc")},l.filesPropertiesAdd=function(e){return this.request("files/properties/add",e,"user","api","rpc")},l.filesPropertiesOverwrite=function(e){return this.request("files/properties/overwrite",e,"user","api","rpc")},l.filesPropertiesRemove=function(e){return this.request("files/properties/remove",e,"user","api","rpc")},l.filesPropertiesTemplateGet=function(e){return this.request("files/properties/template/get",e,"user","api","rpc")},l.filesPropertiesTemplateList=function(){return this.request("files/properties/template/list",null,"user","api","rpc")},l.filesPropertiesUpdate=function(e){return this.request("files/properties/update",e,"user","api","rpc")},l.filesRestore=function(e){return this.request("files/restore",e,"user","api","rpc")},l.filesSaveUrl=function(e){return this.request("files/save_url",e,"user","api","rpc")},l.filesSaveUrlCheckJobStatus=function(e){return this.request("files/save_url/check_job_status",e,"user","api","rpc")},l.filesSearch=function(e){return this.request("files/search",e,"user","api","rpc")},l.filesSearchV2=function(e){return this.request("files/search_v2",e,"user","api","rpc")},l.filesSearchContinueV2=function(e){return this.request("files/search/continue_v2",e,"user","api","rpc")},l.filesUnlockFileBatch=function(e){return this.request("files/unlock_file_batch",e,"user","api","rpc")},l.filesUpload=function(e){return this.request("files/upload",e,"user","content","upload")},l.filesUploadSessionAppendV2=function(e){return this.request("files/upload_session/append_v2",e,"user","content","upload")},l.filesUploadSessionAppend=function(e){return this.request("files/upload_session/append",e,"user","content","upload")},l.filesUploadSessionFinish=function(e){return this.request("files/upload_session/finish",e,"user","content","upload")},l.filesUploadSessionFinishBatch=function(e){return this.request("files/upload_session/finish_batch",e,"user","api","rpc")},l.filesUploadSessionFinishBatchCheck=function(e){return this.request("files/upload_session/finish_batch/check",e,"user","api","rpc")},l.filesUploadSessionStart=function(e){return this.request("files/upload_session/start",e,"user","content","upload")},l.paperDocsArchive=function(e){return this.request("paper/docs/archive",e,"user","api","rpc")},l.paperDocsCreate=function(e){return this.request("paper/docs/create",e,"user","api","upload")},l.paperDocsDownload=function(e){return this.request("paper/docs/download",e,"user","api","download")},l.paperDocsFolderUsersList=function(e){return this.request("paper/docs/folder_users/list",e,"user","api","rpc")},l.paperDocsFolderUsersListContinue=function(e){return this.request("paper/docs/folder_users/list/continue",e,"user","api","rpc")},l.paperDocsGetFolderInfo=function(e){return this.request("paper/docs/get_folder_info",e,"user","api","rpc")},l.paperDocsList=function(e){return this.request("paper/docs/list",e,"user","api","rpc")},l.paperDocsListContinue=function(e){return this.request("paper/docs/list/continue",e,"user","api","rpc")},l.paperDocsPermanentlyDelete=function(e){return this.request("paper/docs/permanently_delete",e,"user","api","rpc")},l.paperDocsSharingPolicyGet=function(e){return this.request("paper/docs/sharing_policy/get",e,"user","api","rpc")},l.paperDocsSharingPolicySet=function(e){return this.request("paper/docs/sharing_policy/set",e,"user","api","rpc")},l.paperDocsUpdate=function(e){return this.request("paper/docs/update",e,"user","api","upload")},l.paperDocsUsersAdd=function(e){return this.request("paper/docs/users/add",e,"user","api","rpc")},l.paperDocsUsersList=function(e){return this.request("paper/docs/users/list",e,"user","api","rpc")},l.paperDocsUsersListContinue=function(e){return this.request("paper/docs/users/list/continue",e,"user","api","rpc")},l.paperDocsUsersRemove=function(e){return this.request("paper/docs/users/remove",e,"user","api","rpc")},l.paperFoldersCreate=function(e){return this.request("paper/folders/create",e,"user","api","rpc")},l.sharingAddFileMember=function(e){return this.request("sharing/add_file_member",e,"user","api","rpc")},l.sharingAddFolderMember=function(e){return this.request("sharing/add_folder_member",e,"user","api","rpc")},l.sharingChangeFileMemberAccess=function(e){return this.request("sharing/change_file_member_access",e,"user","api","rpc")},l.sharingCheckJobStatus=function(e){return this.request("sharing/check_job_status",e,"user","api","rpc")},l.sharingCheckRemoveMemberJobStatus=function(e){return this.request("sharing/check_remove_member_job_status",e,"user","api","rpc")},l.sharingCheckShareJobStatus=function(e){return this.request("sharing/check_share_job_status",e,"user","api","rpc")},l.sharingCreateSharedLink=function(e){return this.request("sharing/create_shared_link",e,"user","api","rpc")},l.sharingCreateSharedLinkWithSettings=function(e){return this.request("sharing/create_shared_link_with_settings",e,"user","api","rpc")},l.sharingGetFileMetadata=function(e){return this.request("sharing/get_file_metadata",e,"user","api","rpc")},l.sharingGetFileMetadataBatch=function(e){return this.request("sharing/get_file_metadata/batch",e,"user","api","rpc")},l.sharingGetFolderMetadata=function(e){return this.request("sharing/get_folder_metadata",e,"user","api","rpc")},l.sharingGetSharedLinkFile=function(e){return this.request("sharing/get_shared_link_file",e,"user","content","download")},l.sharingGetSharedLinkMetadata=function(e){return this.request("sharing/get_shared_link_metadata",e,"user","api","rpc")},l.sharingGetSharedLinks=function(e){return this.request("sharing/get_shared_links",e,"user","api","rpc")},l.sharingListFileMembers=function(e){return this.request("sharing/list_file_members",e,"user","api","rpc")},l.sharingListFileMembersBatch=function(e){return this.request("sharing/list_file_members/batch",e,"user","api","rpc")},l.sharingListFileMembersContinue=function(e){return this.request("sharing/list_file_members/continue",e,"user","api","rpc")},l.sharingListFolderMembers=function(e){return this.request("sharing/list_folder_members",e,"user","api","rpc")},l.sharingListFolderMembersContinue=function(e){return this.request("sharing/list_folder_members/continue",e,"user","api","rpc")},l.sharingListFolders=function(e){return this.request("sharing/list_folders",e,"user","api","rpc")},l.sharingListFoldersContinue=function(e){return this.request("sharing/list_folders/continue",e,"user","api","rpc")},l.sharingListMountableFolders=function(e){return this.request("sharing/list_mountable_folders",e,"user","api","rpc")},l.sharingListMountableFoldersContinue=function(e){return this.request("sharing/list_mountable_folders/continue",e,"user","api","rpc")},l.sharingListReceivedFiles=function(e){return this.request("sharing/list_received_files",e,"user","api","rpc")},l.sharingListReceivedFilesContinue=function(e){return this.request("sharing/list_received_files/continue",e,"user","api","rpc")},l.sharingListSharedLinks=function(e){return this.request("sharing/list_shared_links",e,"user","api","rpc")},l.sharingModifySharedLinkSettings=function(e){return this.request("sharing/modify_shared_link_settings",e,"user","api","rpc")},l.sharingMountFolder=function(e){return this.request("sharing/mount_folder",e,"user","api","rpc")},l.sharingRelinquishFileMembership=function(e){return this.request("sharing/relinquish_file_membership",e,"user","api","rpc")},l.sharingRelinquishFolderMembership=function(e){return this.request("sharing/relinquish_folder_membership",e,"user","api","rpc")},l.sharingRemoveFileMember=function(e){return this.request("sharing/remove_file_member",e,"user","api","rpc")},l.sharingRemoveFileMember2=function(e){return this.request("sharing/remove_file_member_2",e,"user","api","rpc")},l.sharingRemoveFolderMember=function(e){return this.request("sharing/remove_folder_member",e,"user","api","rpc")},l.sharingRevokeSharedLink=function(e){return this.request("sharing/revoke_shared_link",e,"user","api","rpc")},l.sharingSetAccessInheritance=function(e){return this.request("sharing/set_access_inheritance",e,"user","api","rpc")},l.sharingShareFolder=function(e){return this.request("sharing/share_folder",e,"user","api","rpc")},l.sharingTransferFolder=function(e){return this.request("sharing/transfer_folder",e,"user","api","rpc")},l.sharingUnmountFolder=function(e){return this.request("sharing/unmount_folder",e,"user","api","rpc")},l.sharingUnshareFile=function(e){return this.request("sharing/unshare_file",e,"user","api","rpc")},l.sharingUnshareFolder=function(e){return this.request("sharing/unshare_folder",e,"user","api","rpc")},l.sharingUpdateFileMember=function(e){return this.request("sharing/update_file_member",e,"user","api","rpc")},l.sharingUpdateFolderMember=function(e){return this.request("sharing/update_folder_member",e,"user","api","rpc")},l.sharingUpdateFolderPolicy=function(e){return this.request("sharing/update_folder_policy",e,"user","api","rpc")},l.teamDevicesListMemberDevices=function(e){return this.request("team/devices/list_member_devices",e,"team","api","rpc")},l.teamDevicesListMembersDevices=function(e){return this.request("team/devices/list_members_devices",e,"team","api","rpc")},l.teamDevicesListTeamDevices=function(e){return this.request("team/devices/list_team_devices",e,"team","api","rpc")},l.teamDevicesRevokeDeviceSession=function(e){return this.request("team/devices/revoke_device_session",e,"team","api","rpc")},l.teamDevicesRevokeDeviceSessionBatch=function(e){return this.request("team/devices/revoke_device_session_batch",e,"team","api","rpc")},l.teamFeaturesGetValues=function(e){return this.request("team/features/get_values",e,"team","api","rpc")},l.teamGetInfo=function(){return this.request("team/get_info",null,"team","api","rpc")},l.teamGroupsCreate=function(e){return this.request("team/groups/create",e,"team","api","rpc")},l.teamGroupsDelete=function(e){return this.request("team/groups/delete",e,"team","api","rpc")},l.teamGroupsGetInfo=function(e){return this.request("team/groups/get_info",e,"team","api","rpc")},l.teamGroupsJobStatusGet=function(e){return this.request("team/groups/job_status/get",e,"team","api","rpc")},l.teamGroupsList=function(e){return this.request("team/groups/list",e,"team","api","rpc")},l.teamGroupsListContinue=function(e){return this.request("team/groups/list/continue",e,"team","api","rpc")},l.teamGroupsMembersAdd=function(e){return this.request("team/groups/members/add",e,"team","api","rpc")},l.teamGroupsMembersList=function(e){return this.request("team/groups/members/list",e,"team","api","rpc")},l.teamGroupsMembersListContinue=function(e){return this.request("team/groups/members/list/continue",e,"team","api","rpc")},l.teamGroupsMembersRemove=function(e){return this.request("team/groups/members/remove",e,"team","api","rpc")},l.teamGroupsMembersSetAccessType=function(e){return this.request("team/groups/members/set_access_type",e,"team","api","rpc")},l.teamGroupsUpdate=function(e){return this.request("team/groups/update",e,"team","api","rpc")},l.teamLegalHoldsCreatePolicy=function(e){return this.request("team/legal_holds/create_policy",e,"team","api","rpc")},l.teamLegalHoldsGetPolicy=function(e){return this.request("team/legal_holds/get_policy",e,"team","api","rpc")},l.teamLegalHoldsListHeldRevisions=function(e){return this.request("team/legal_holds/list_held_revisions",e,"team","api","rpc")},l.teamLegalHoldsListHeldRevisionsContinue=function(e){return this.request("team/legal_holds/list_held_revisions_continue",e,"team","api","rpc")},l.teamLegalHoldsListPolicies=function(e){return this.request("team/legal_holds/list_policies",e,"team","api","rpc")},l.teamLegalHoldsReleasePolicy=function(e){return this.request("team/legal_holds/release_policy",e,"team","api","rpc")},l.teamLegalHoldsUpdatePolicy=function(e){return this.request("team/legal_holds/update_policy",e,"team","api","rpc")},l.teamLinkedAppsListMemberLinkedApps=function(e){return this.request("team/linked_apps/list_member_linked_apps",e,"team","api","rpc")},l.teamLinkedAppsListMembersLinkedApps=function(e){return this.request("team/linked_apps/list_members_linked_apps",e,"team","api","rpc")},l.teamLinkedAppsListTeamLinkedApps=function(e){return this.request("team/linked_apps/list_team_linked_apps",e,"team","api","rpc")},l.teamLinkedAppsRevokeLinkedApp=function(e){return this.request("team/linked_apps/revoke_linked_app",e,"team","api","rpc")},l.teamLinkedAppsRevokeLinkedAppBatch=function(e){return this.request("team/linked_apps/revoke_linked_app_batch",e,"team","api","rpc")},l.teamMemberSpaceLimitsExcludedUsersAdd=function(e){return this.request("team/member_space_limits/excluded_users/add",e,"team","api","rpc")},l.teamMemberSpaceLimitsExcludedUsersList=function(e){return this.request("team/member_space_limits/excluded_users/list",e,"team","api","rpc")},l.teamMemberSpaceLimitsExcludedUsersListContinue=function(e){return this.request("team/member_space_limits/excluded_users/list/continue",e,"team","api","rpc")},l.teamMemberSpaceLimitsExcludedUsersRemove=function(e){return this.request("team/member_space_limits/excluded_users/remove",e,"team","api","rpc")},l.teamMemberSpaceLimitsGetCustomQuota=function(e){return this.request("team/member_space_limits/get_custom_quota",e,"team","api","rpc")},l.teamMemberSpaceLimitsRemoveCustomQuota=function(e){return this.request("team/member_space_limits/remove_custom_quota",e,"team","api","rpc")},l.teamMemberSpaceLimitsSetCustomQuota=function(e){return this.request("team/member_space_limits/set_custom_quota",e,"team","api","rpc")},l.teamMembersAdd=function(e){return this.request("team/members/add",e,"team","api","rpc")},l.teamMembersAddJobStatusGet=function(e){return this.request("team/members/add/job_status/get",e,"team","api","rpc")},l.teamMembersDeleteProfilePhoto=function(e){return this.request("team/members/delete_profile_photo",e,"team","api","rpc")},l.teamMembersGetInfo=function(e){return this.request("team/members/get_info",e,"team","api","rpc")},l.teamMembersList=function(e){return this.request("team/members/list",e,"team","api","rpc")},l.teamMembersListContinue=function(e){return this.request("team/members/list/continue",e,"team","api","rpc")},l.teamMembersMoveFormerMemberFiles=function(e){return this.request("team/members/move_former_member_files",e,"team","api","rpc")},l.teamMembersMoveFormerMemberFilesJobStatusCheck=function(e){return this.request("team/members/move_former_member_files/job_status/check",e,"team","api","rpc")},l.teamMembersRecover=function(e){return this.request("team/members/recover",e,"team","api","rpc")},l.teamMembersRemove=function(e){return this.request("team/members/remove",e,"team","api","rpc")},l.teamMembersRemoveJobStatusGet=function(e){return this.request("team/members/remove/job_status/get",e,"team","api","rpc")},l.teamMembersSecondaryEmailsAdd=function(e){return this.request("team/members/secondary_emails/add",e,"team","api","rpc")},l.teamMembersSecondaryEmailsDelete=function(e){return this.request("team/members/secondary_emails/delete",e,"team","api","rpc")},l.teamMembersSecondaryEmailsResendVerificationEmails=function(e){return this.request("team/members/secondary_emails/resend_verification_emails",e,"team","api","rpc")},l.teamMembersSendWelcomeEmail=function(e){return this.request("team/members/send_welcome_email",e,"team","api","rpc")},l.teamMembersSetAdminPermissions=function(e){return this.request("team/members/set_admin_permissions",e,"team","api","rpc")},l.teamMembersSetProfile=function(e){return this.request("team/members/set_profile",e,"team","api","rpc")},l.teamMembersSetProfilePhoto=function(e){return this.request("team/members/set_profile_photo",e,"team","api","rpc")},l.teamMembersSuspend=function(e){return this.request("team/members/suspend",e,"team","api","rpc")},l.teamMembersUnsuspend=function(e){return this.request("team/members/unsuspend",e,"team","api","rpc")},l.teamNamespacesList=function(e){return this.request("team/namespaces/list",e,"team","api","rpc")},l.teamNamespacesListContinue=function(e){return this.request("team/namespaces/list/continue",e,"team","api","rpc")},l.teamPropertiesTemplateAdd=function(e){return this.request("team/properties/template/add",e,"team","api","rpc")},l.teamPropertiesTemplateGet=function(e){return this.request("team/properties/template/get",e,"team","api","rpc")},l.teamPropertiesTemplateList=function(){return this.request("team/properties/template/list",null,"team","api","rpc")},l.teamPropertiesTemplateUpdate=function(e){return this.request("team/properties/template/update",e,"team","api","rpc")},l.teamReportsGetActivity=function(e){return this.request("team/reports/get_activity",e,"team","api","rpc")},l.teamReportsGetDevices=function(e){return this.request("team/reports/get_devices",e,"team","api","rpc")},l.teamReportsGetMembership=function(e){return this.request("team/reports/get_membership",e,"team","api","rpc")},l.teamReportsGetStorage=function(e){return this.request("team/reports/get_storage",e,"team","api","rpc")},l.teamTeamFolderActivate=function(e){return this.request("team/team_folder/activate",e,"team","api","rpc")},l.teamTeamFolderArchive=function(e){return this.request("team/team_folder/archive",e,"team","api","rpc")},l.teamTeamFolderArchiveCheck=function(e){return this.request("team/team_folder/archive/check",e,"team","api","rpc")},l.teamTeamFolderCreate=function(e){return this.request("team/team_folder/create",e,"team","api","rpc")},l.teamTeamFolderGetInfo=function(e){return this.request("team/team_folder/get_info",e,"team","api","rpc")},l.teamTeamFolderList=function(e){return this.request("team/team_folder/list",e,"team","api","rpc")},l.teamTeamFolderListContinue=function(e){return this.request("team/team_folder/list/continue",e,"team","api","rpc")},l.teamTeamFolderPermanentlyDelete=function(e){return this.request("team/team_folder/permanently_delete",e,"team","api","rpc")},l.teamTeamFolderRename=function(e){return this.request("team/team_folder/rename",e,"team","api","rpc")},l.teamTeamFolderUpdateSyncSettings=function(e){return this.request("team/team_folder/update_sync_settings",e,"team","api","rpc")},l.teamTokenGetAuthenticatedAdmin=function(){return this.request("team/token/get_authenticated_admin",null,"team","api","rpc")},l.teamLogGetEvents=function(e){return this.request("team_log/get_events",e,"team","api","rpc")},l.teamLogGetEventsContinue=function(e){return this.request("team_log/get_events/continue",e,"team","api","rpc")},l.usersFeaturesGetValues=function(e){return this.request("users/features/get_values",e,"user","api","rpc")},l.usersGetAccount=function(e){return this.request("users/get_account",e,"user","api","rpc")},l.usersGetAccountBatch=function(e){return this.request("users/get_account_batch",e,"user","api","rpc")},l.usersGetCurrentAccount=function(){return this.request("users/get_current_account",null,"user","api","rpc")},l.usersGetSpaceUsage=function(){return this.request("users/get_space_usage",null,"user","api","rpc")};var q,g,b=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&n(e,t)}(o,e);var r,s,a=(r=o,s=u(),function(){var e,t=i(r);if(s){var n=i(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return c(this,e)});function o(e,r,s){var i;return t(this,o),(i=a.call(this,"Response failed with a ".concat(e," code"))).name="DropboxResponseError",i.status=e,i.headers=r,i.error=s,i}return o}(o(Error)),v=function e(r,s,i){t(this,e),this.status=r,this.headers=s,this.result=i};function k(e){return e.text().then((function(t){var r;try{r=JSON.parse(t)}catch(e){r=t}throw new b(e.status,e.headers,r)}))}function y(e){return e.ok?e.text().then((function(t){var r;try{r=JSON.parse(t)}catch(e){r=t}return new v(e.status,e.headers,r)})):k(e)}q="undefined"!=typeof window?window.fetch.bind(window):require("node-fetch"),g="undefined"!=typeof window?window.crypto||window.msCrypto:require("crypto");var w,A=["legacy","offline","online"],S=["code","token"],L=["none","user","team"],T="https://www.dropbox.com/oauth2/authorize",C="https://api.dropboxapi.com/oauth2/token",F=function(){function e(r){t(this,e),this.fetch=(r=r||{}).fetch||q,this.accessToken=r.accessToken,this.accessTokenExpiresAt=r.accessTokenExpiresAt,this.refreshToken=r.refreshToken,this.clientId=r.clientId,this.clientSecret=r.clientSecret}return s(e,[{key:"setAccessToken",value:function(e){this.accessToken=e}},{key:"getAccessToken",value:function(){return this.accessToken}},{key:"setClientId",value:function(e){this.clientId=e}},{key:"getClientId",value:function(){return this.clientId}},{key:"setClientSecret",value:function(e){this.clientSecret=e}},{key:"getClientSecret",value:function(){return this.clientSecret}},{key:"getRefreshToken",value:function(){return this.refreshToken}},{key:"setRefreshToken",value:function(e){this.refreshToken=e}},{key:"getAccessTokenExpiresAt",value:function(){return this.accessTokenExpiresAt}},{key:"setAccessTokenExpiresAt",value:function(e){this.accessTokenExpiresAt=e}},{key:"generatePKCECodes",value:function(){var e=g.randomBytes(128);e=e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"").substr(0,128),this.codeVerifier=e;var t=(new TextEncoder).encode(e),r=g.createHash("sha256").update(t).digest();r=r.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),this.codeChallenge=r}},{key:"getAuthenticationUrl",value:function(e,t){var r,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"token",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"none",a=arguments.length>6&&void 0!==arguments[6]&&arguments[6],o=this.getClientId(),c=T;if(!o)throw Error("A client id is required. You can set the client id using .setClientId().");if("code"!==s&&!e)throw Error("A redirect uri is required.");if(!S.includes(s))throw Error("Authorization type must be code or token");if(i&&!A.includes(i))throw Error("Token Access Type must be legacy, offline, or online");if(n&&!(n instanceof Array))throw Error("Scope must be an array of strings");if(!L.includes(u))throw Error("includeGrantedScopes must be none, user, or team");return r="code"===s?"".concat(c,"?response_type=code&client_id=").concat(o):"".concat(c,"?response_type=token&client_id=").concat(o),e&&(r+="&redirect_uri=".concat(e)),t&&(r+="&state=".concat(t)),i&&(r+="&token_access_type=".concat(i)),n&&(r+="&scope=".concat(n.join(" "))),"none"!==u&&(r+="&include_granted_scopes=".concat(u)),a&&(this.generatePKCECodes(),r+="&code_challenge_method=S256",r+="&code_challenge=".concat(this.codeChallenge)),r}},{key:"getAccessTokenFromCode",value:function(e,t){var r=this.getClientId(),s=this.getClientSecret();if(!r)throw Error("A client id is required. You can set the client id using .setClientId().");var i=C;if(i+="?grant_type=authorization_code",i+="&code=".concat(t),i+="&client_id=".concat(r),s)i+="&client_secret=".concat(s);else{if(!this.codeChallenge)throw Error("You must use PKCE when generating the authorization URL to not include a client secret");i+="&code_verifier=".concat(this.codeVerifier)}e&&(i+="&redirect_uri=".concat(e));return this.fetch(i,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"}}).then((function(e){return y(e)}))}},{key:"checkAndRefreshAccessToken",value:function(){var e=this.getRefreshToken()&&this.getClientId(),t=!this.getAccessTokenExpiresAt()||new Date(Date.now()+3e5)>=this.getAccessTokenExpiresAt(),r=!this.getAccessToken();return(t||r)&&e?this.refreshAccessToken():Promise.resolve()}},{key:"refreshAccessToken",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=C,s=this.getClientId(),i=this.getClientSecret();if(!s)throw Error("A client id is required. You can set the client id using .setClientId().");if(t&&!(t instanceof Array))throw Error("Scope must be an array of strings");var n={"Content-Type":"application/json"};r+="?grant_type=refresh_token&refresh_token=".concat(this.getRefreshToken()),r+="&client_id=".concat(s),i&&(r+="&client_secret=".concat(i)),t&&(r+="&scope=".concat(t.join(" ")));var u={method:"POST"};return u.headers=n,this.fetch(r,u).then((function(e){return y(e)})).then((function(t){e.setAccessToken(t.result.access_token),e.setAccessTokenExpiresAt(d(t.result.expires_in))}))}},{key:"authenticateWithCordova",value:function(e,t){var r=this.getAuthenticationUrl("https://www.dropbox.com/1/oauth2/redirect_receiver"),s=!1,i=window.open(r,"_blank");function n(e){-999!==e.code&&(window.setTimeout((function(){i.close()}),10),t())}function u(r){if(r.url.indexOf("&error=")>-1)window.setTimeout((function(){i.close()}),10),t();else{var s="#access_token=",n=r.url.indexOf(s),u=r.url.indexOf("&token_type=");if(n>-1){n+=14,window.setTimeout((function(){i.close()}),10);var a=r.url.substring(n,u);e(a)}}}i.addEventListener("loaderror",n),i.addEventListener("loadstop",u),i.addEventListener("exit",(function e(){s||(i.removeEventListener("loaderror",n),i.removeEventListener("loadstop",u),i.removeEventListener("exit",e),s=!0)}))}}]),e}();w="undefined"!=typeof window?window.fetch.bind(window):require("node-fetch");var M="undefined"==typeof btoa?function(e){return Buffer.from(e).toString("base64")}:btoa;e.Dropbox=function(){function e(r){t(this,e),this.auth=(r=r||{}).auth?r.auth:new F(r),this.fetch=r.fetch||w,this.selectUser=r.selectUser,this.selectAdmin=r.selectAdmin,this.pathRoot=r.pathRoot,Object.assign(this,l)}return s(e,[{key:"request",value:function(e,t,r,s,i){switch(i){case"rpc":return this.rpcRequest(e,t,r,s);case"download":return this.downloadRequest(e,t,r,s);case"upload":return this.uploadRequest(e,t,r,s);default:throw Error("Invalid request style: ".concat(i))}}},{key:"rpcRequest",value:function(e,t,r,s){var i=this;return this.auth.checkAndRefreshAccessToken().then((function(){var e,s={method:"POST",body:t?JSON.stringify(t):null,headers:{}};switch(t&&(s.headers["Content-Type"]="application/json"),r){case"app":if(!i.auth.clientId||!i.auth.clientSecret)throw Error("A client id and secret is required for this function");e=M("".concat(i.auth.clientId,":").concat(i.auth.clientSecret)),s.headers.Authorization="Basic ".concat(e);break;case"team":case p:s.headers.Authorization="Bearer ".concat(i.auth.getAccessToken());break;case"noauth":break;default:throw Error("Unhandled auth type: ".concat(r))}return i.setCommonHeaders(s),s})).then((function(t){return i.fetch(h(s)+e,t)})).then((function(e){return y(e)}))}},{key:"downloadRequest",value:function(e,t,r,s){var i=this;return this.auth.checkAndRefreshAccessToken().then((function(){if(r!==p)throw Error("Unexpected auth type: ".concat(r));var e={method:"POST",headers:{Authorization:"Bearer ".concat(i.auth.getAccessToken()),"Dropbox-API-Arg":m(t)}};return i.setCommonHeaders(e),e})).then((function(t){return w(h(s)+e,t)})).then((function(e){return function(e){return e.ok?new Promise((function(t){_()?e.blob().then((function(e){return t(e)})):e.buffer().then((function(e){return t(e)}))})).then((function(t){var r=JSON.parse(e.headers.get("dropbox-api-result"));return _()?r.fileBlob=t:r.fileBinary=t,new v(e.status,e.headers,r)})):k(e)}(e)}))}},{key:"uploadRequest",value:function(e,t,r,s){var i=this;return this.auth.checkAndRefreshAccessToken().then((function(){if(r!==p)throw Error("Unexpected auth type: ".concat(r));var e=t.contents;delete t.contents;var s={body:e,method:"POST",headers:{Authorization:"Bearer ".concat(i.auth.getAccessToken()),"Content-Type":"application/octet-stream","Dropbox-API-Arg":m(t)}};return i.setCommonHeaders(s),s})).then((function(t){return i.fetch(h(s)+e,t)})).then((function(e){return y(e)}))}},{key:"setCommonHeaders",value:function(e){this.selectUser&&(e.headers["Dropbox-API-Select-User"]=this.selectUser),this.selectAdmin&&(e.headers["Dropbox-API-Select-Admin"]=this.selectAdmin),this.pathRoot&&(e.headers["Dropbox-API-Path-Root"]=this.pathRoot)}}]),e}(),e.DropboxAuth=F,Object.defineProperty(e,"__esModule",{value:!0})}));
|